222
schangxiang@126.com
2024-11-29 7d345dd5aa6411e982c5e0c56846ada36550970a
LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsTask/WmsOperationTaskService.cs
@@ -6,6 +6,7 @@
using System.Text;
using DocumentFormat.OpenXml.Office.CustomUI;
using Microsoft.CodeAnalysis.Operations;
using Admin.NET.Application.Service.WmsTask.WmsRbLineTask.Dto;
namespace Admin.NET.Application;
/// <summary>
@@ -18,15 +19,22 @@
    private readonly SqlSugarRepository<WmsStockQuan> _wmsStockQuanRep;
    private readonly SqlSugarRepository<Mes_Package_Gather> _mesPackageGatherRep;
    private readonly SqlSugarRepository<SysConfig> _sysConfigRep;
    private readonly SqlSugarRepository<Mes_BatchOrderUPI_New> _mesBatchOrderUpiRep;
    private readonly SqlSugarRepository<Mes_Order_Gather> _mesOrderGatherRep;
    public WmsOperationTaskService(SqlSugarRepository<WmsRbLineTask> rep, SqlSugarRepository<WmsStockQuan> wmsStockQuanRep
        , SqlSugarRepository<Mes_Package_Gather> mesPackageGatherRep
        , SqlSugarRepository<SysConfig> sysConfigRep
        , SqlSugarRepository<Mes_BatchOrderUPI_New> mesBatchOrderUpiRep
        , SqlSugarRepository<Mes_Order_Gather> mesOrderGatherRep
        )
    {
        _sysConfigRep = sysConfigRep;
        _mesPackageGatherRep = mesPackageGatherRep;
        _rep = rep;
        _wmsStockQuanRep = wmsStockQuanRep;
        _mesBatchOrderUpiRep = mesBatchOrderUpiRep;
        _mesOrderGatherRep = mesOrderGatherRep;
    }
@@ -107,6 +115,14 @@
        }
        var sysConfig = await _sysConfigRep.GetFirstAsync(x => x.Code == CommonConst.WmsBZ30_QiTao);
        if (sysConfig == null)
        {
            throw Oops.Oh($"没有配置 判断齐套 值");
        }
        if (!string.IsNullOrEmpty(sysConfig.Value))
        {
            throw Oops.Oh($"判断齐套值已经存在值{sysConfig.Value},不允许操作");
        }
        sysConfig.Value = setValue;
        await _sysConfigRep.UpdateAsync(sysConfig);
@@ -114,5 +130,59 @@
        output.QiTaoReuslt = _QiTaoReuslt;
        return output;
    }
    /// <summary>
    /// 核对标签
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpPost]
    [ApiDescriptionSettings(Name = "ValdateLabel")]
    [Description("WmsOperationTask/ValdateLabel")]
    public async Task<Mes_Package_Gather> ValdateLabel(ValidateLabelInput input)
    {
        if (input == null || input.PackageCode == null || input.Upi == null)
        {
            throw Oops.Oh("参数不能为空");
        }
        var singleUpi = await _mesBatchOrderUpiRep.AsQueryable().Where(x => x.UPI == input.Upi).FirstAsync();
        if (singleUpi == null)
        {
            throw Oops.Oh($"没有找到部件条码{input.Upi}的数据");
        }
        if (singleUpi.PackageCode != input.PackageCode)
        {
            throw Oops.Oh($"部件条码{input.Upi}所属包是{singleUpi.PackageCode},跟扫描的包号{input.PackageCode}不符");
        }
        var singlePackage = await _mesPackageGatherRep.AsQueryable().Where(x => x.PackageCode == input.PackageCode).FirstAsync();
        if (singlePackage == null)
        {
            throw Oops.Oh($"没有找到包号{input.PackageCode}的汇总数据");
        }
        return singlePackage;
    }
    /// <summary>
    /// 查询不齐套单据
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    [HttpGet]
    [ApiDescriptionSettings(Name = "KittingList")]
    [Description("WmsStockQuan/KittingList")]
    public async Task<List<Mes_Order_Gather>> KittingList([FromQuery] KittingListInput input)
    {
        var list = await _mesOrderGatherRep.AsQueryable()
            .WhereIF(!string.IsNullOrWhiteSpace(input.Info5), u => u.Info5.Contains(input.Info5.Trim()))
            .Where(x => x.IsKitting == false)
            .OrderBy(g => g.Id)
            .ToListAsync(); // 确保获取结果为 List
        return list; // 结果
    }
}