schangxiang@126.com
2024-11-28 5ebca0d5d35a8d29ffabc1cc78080a393ce92368
LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsOperationTaskService.cs
@@ -4,6 +4,9 @@
using System.Data;
using System.Web;
using System.Text;
using DocumentFormat.OpenXml.Office.CustomUI;
using Microsoft.CodeAnalysis.Operations;
namespace Admin.NET.Application;
/// <summary>
/// 操作任务服务
@@ -13,8 +16,15 @@
{
    private readonly SqlSugarRepository<WmsRbLineTask> _rep;
    private readonly SqlSugarRepository<WmsStockQuan> _wmsStockQuanRep;
    public WmsOperationTaskService(SqlSugarRepository<WmsRbLineTask> rep, SqlSugarRepository<WmsStockQuan> wmsStockQuanRep)
    private readonly SqlSugarRepository<Mes_Package_Gather> _mesPackageGatherRep;
    private readonly SqlSugarRepository<SysConfig> _sysConfigRep;
    public WmsOperationTaskService(SqlSugarRepository<WmsRbLineTask> rep, SqlSugarRepository<WmsStockQuan> wmsStockQuanRep
        , SqlSugarRepository<Mes_Package_Gather> mesPackageGatherRep
        , SqlSugarRepository<SysConfig> sysConfigRep
        )
    {
        _sysConfigRep = sysConfigRep;
        _mesPackageGatherRep = mesPackageGatherRep;
        _rep = rep;
        _wmsStockQuanRep = wmsStockQuanRep;
    }
@@ -59,6 +69,50 @@
    }
    /// <summary>
    /// 判断齐套
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost]
    [ApiDescriptionSettings(Name = "ValdateQiTao")]
    [Description("WmsOperationTask/ValdateQiTao")]
    public async Task<ValidateQiTaoOutput> ValdateQiTao(ValidateQiTaoInput input)
    {
        ValidateQiTaoOutput output = new ValidateQiTaoOutput();
        if (input == null || input.PackageCode == null)
        {
            throw Oops.Oh("参数不能为空");
        }
        var singlePackage = await _mesPackageGatherRep.AsQueryable().Where(x => x.PackageCode == input.PackageCode).FirstAsync();
        if (singlePackage == null)
        {
            throw Oops.Oh($"没有找到包号{input.PackageCode}的汇总数据");
        }
        var setValue = "";
        var _QiTaoReuslt = "";
        var other_orderList = await _mesPackageGatherRep.AsQueryable().Where(x => x.Info5 == singlePackage.Info5 && x.PackageCode != input.PackageCode).ToListAsync();
        var num = other_orderList.Where(x => x.UpiStatus == UpiStatusEnum.初始 || x.UpiStatus == UpiStatusEnum.不齐包).Count();
        if (num > 0)
        {
            //不齐套
            setValue = $"{input.PackageCode}|不齐套";
            _QiTaoReuslt = "不齐套";
        }
        else
        {
            setValue = $"{input.PackageCode}|齐套";
            _QiTaoReuslt = "齐套";
        }
        var sysConfig = await _sysConfigRep.GetFirstAsync(x => x.Code == CommonConst.WmsBZ30_QiTao);
        sysConfig.Value = setValue;
        await _sysConfigRep.UpdateAsync(sysConfig);
        output = singlePackage.Adapt<ValidateQiTaoOutput>();
        output.QiTaoReuslt = _QiTaoReuslt;
        return output;
    }
}