schangxiang@126.com
2024-12-20 01c3a4658026e9c3ed9daaf1f1b27da368ab11a9
LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/ThirdInterFace/ThirdInterFaceService.cs
@@ -45,6 +45,25 @@
            throw Oops.Oh("本次有重复的UPI!重复号为:" + dit.Key + ",重复条数:" + dit.Value);
        }
        //校验数据是否正确 【Editby shaocx,2024-12-20】
        var gg = input.GroupBy(x => x.PackageCode);
        foreach (var item in gg)
        {
            var _list = item.ToList();
            if (_list.Count() == 1)
            {
                throw Oops.Oh($"包号{item.Key}中只有一块板,不符合要求!");
            }
            _list = _list.OrderBy(x => x.Shelf).ToList();
            for (int i = 0; i < _list.Count; i++)
            {
                if (_list[i].Shelf != (i + 1))
                {
                    throw Oops.Oh($"包号{item.Key}中第{(i + 1)}块板的次序不是{i + 1},而是{_list[i].Shelf},不符合要求!");
                }
            }
        }
        //同一个UPI只能属于一个 批次号+订单号
        //会存在 一个批次号,多个订单号的情况 
        //会存在 一个订单号,多个批次号的情况 
@@ -72,6 +91,7 @@
        {
            item.AreaCode = AreaCodeEnum.无区域;
            item.UpiStatus = UpiStatusEnum.初始;
            item.CreateUserName = item.UpdateUserName = "MES";
        }
        List<Mes_Package_Gather> addGatherList = new List<Mes_Package_Gather>();
        var groups = input.GroupBy(x => x.PackageCode);
@@ -81,6 +101,7 @@
            Mes_Package_Gather newGather = first.Adapt<Mes_Package_Gather>();
            newGather.AreaCode = AreaCodeEnum.无区域;
            newGather.UpiStatus = UpiStatusEnum.初始;
            newGather.CreateUserName = newGather.UpdateUserName = "MES";
            addGatherList.Add(newGather);
        }
        await _mes_Package_Gather_Rep.InsertRangeAsync(addGatherList);