刘磊
9 天以前 2de09bec5cc05bf875543fa8956167ca7db73021
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Boxing/Dt_CZInfo_mesService.cs
@@ -3,6 +3,8 @@
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using System.ComponentModel.DataAnnotations;
using WIDESEA_Core;
using WIDESEA_DTO;
using WIDESEA_IStoragIntegrationServices;
using WIDESEA_StorageBasicRepository;
namespace WIDESEA_StorageBasicService;
@@ -199,4 +201,100 @@
        // è¿”回验证结果列表
        return validationResults;
    }
    public WebResponseContent RequestAxleloading(RequestTaskDto input)
    {
        WebResponseContent content = new WebResponseContent();
        try
        {
            Dt_CZInfo_mes CZInfot = BaseDal.QueryFirst(x => x.CurrentStatue == "1" || x.CurrentStatue == "11");
            if (CZInfot != null)
            {
                CZInfot.CurrentStatue = CZInfot.CurrentStatue=="1"?"2":"12";
                BaseDal.UpdateData(CZInfot);
                return content.OK(data: CZInfot.CZTM);
            }
            else
            {
                return content.Error("未找到需要上架的车轴条码");
            }
        }
        catch (Exception ex)
        {
            return content.Error(ex.Message);
        }
    }
    public WebResponseContent UpdateAxleCurrentStatue(RequestTaskDto input)
    {
        WebResponseContent content = new WebResponseContent();
        try
        {
            Dt_CZInfo_mes CZInfot = BaseDal.QueryFirst(x => x.CZTM == input.PalletCode);
            if (CZInfot != null)
            {
                if (CZInfot.CurrentStatue == "2")
                {
                    CZInfot.CurrentStatue = "3";
                }
                else if (CZInfot.CurrentStatue == "12")
                {
                    CZInfot.CurrentStatue = "13";
                }
                else
                {
                    return content.Error($"未找到申请车轴条码信息,状态不为输送线运行中,申请条码:{input.PalletCode}");
                }
                BaseDal.UpdateData(CZInfot);    //先修改了状态
                return content.OK();
            }
            else
            {
                return content.Error($"未找到申请车轴条码信息,申请条码:{input.PalletCode}");
            }
        }
        catch (Exception ex)
        {
            return content.Error($"更新车轴信息状态出错,申请条码:{input.PalletCode},错误信息:{ex.Message}");
        }
    }
    public override WebResponseContent UpdateData(SaveModel saveModel)
    {
        WebResponseContent webResponse = new WebResponseContent();
        try
        {
            int id = int.Parse(saveModel.MainData["id"]?.ToString());
            string cztm = saveModel.MainData["cztm"]?.ToString();
            if (string.IsNullOrEmpty(cztm))
                throw new Exception($"车轴号为空");
            string currentStatue = saveModel.MainData["currentStatue"]?.ToString();
            if (string.IsNullOrEmpty(currentStatue))
                throw new Exception($"车轴状态为空");
            Dt_CZInfo_mes CZInfot = BaseDal.QueryFirst(x => x.ID == id);
            if (CZInfot != null)
            {
                CZInfot.CZTM = cztm;
                CZInfot.CurrentStatue = currentStatue;
                BaseDal.UpdateData(CZInfot);    //先修改了状态
                return webResponse.OK($"修改成功");
            }
            else
            {
                return webResponse.Error($"修改失败,未找到车轴信息");
            }
        }
        catch (Exception ex)
        {
            return webResponse.Error($"修改失败,错误信息:{ex.Message}");
            throw;
        }
    }
}