zjh
6 天以前 d5d0d54d8ba486a5b2b669fb16df824a129faaeb
StandardPda/MES.Service/service/Warehouse/MesInvItemOutsManager.cs
@@ -1,4 +1,5 @@
using MES.Service.DB;
using Masuit.Tools;
using MES.Service.DB;
using MES.Service.Dto.service;
using MES.Service.Modes;
@@ -18,7 +19,8 @@
        {
            // 根据AsnNo和MesNo对明细进行分组
            var groupedItems = itemOutLists
                .GroupBy(item => new {  item.MesNo, item.SqNo })
               // .GroupBy(item => new {  item.MesNo, item.SqNo })
                .GroupBy(item => new { item.MesNo })
                .ToList();
            int result = 1;
@@ -35,19 +37,20 @@
                    throw new NotImplementedException("入库单单号不能为空");
                }
                if (group.Key.SqNo == null)
                {
                    throw new NotImplementedException("退货申请单行号不能为空");
                }
                //if (group.Key.SqNo == null)
                //{
                //    throw new NotImplementedException("退货申请单行号不能为空");
                //}
                // 创建一个临时的itemOutFrom对象,使用分组的Key作为主要属性
                var tempItemOutFrom = new ItemOutFrom
                {
                    //AsnNo = group.Key.AsnNo,
                    MesNo = group.Key.MesNo,
                    SqNo = group.Key.SqNo,
                    //SqNo = group.Key.SqNo,
                    // 继承原始itemOutFrom的其他属性
                    RtnNo = itemOutFrom.RtnNo+ "-"+count.ToString(),
                    //RtnNo = itemOutFrom.RtnNo+ "-"+count.ToString(),
                    RtnNo = itemOutFrom.RtnNo,
                    Type = itemOutFrom.Type,
                    CreateBy = itemOutFrom.CreateBy,
                    FMRMODE = itemOutFrom.FMRMODE,
@@ -247,6 +250,8 @@
                throw new NotImplementedException("[" + itemOutList.itemId +
                                                  "]物料不存在,请同步给MES");
            }
            var mesUnit = Db.Queryable<MesUnit>()
               .Where(s => s.Id == int.Parse(mesItems.ItemUnit)).First();
            if (itemOutList.SrcDocNo!=null&& itemOutList.SrcDocNo!="")
            {
@@ -272,6 +277,7 @@
                {
                    throw new NotImplementedException("入库单关联的采购单号不能为空");
                }
                mesInvItemOutItems.Add(new MesInvItemOutItems
                {
@@ -298,7 +304,7 @@
                    ItemId = Decimal.Parse(itemIdLinkU9.MesId), // 确保ItemId有值
                    SqNo = itemOutList.SqNo, // 确保ItemId有值
                                             //ZzitemId = itemOutList.AsnLineNo, // 确保ItemId有值
                                             // Unit = item.Unit,
                                              Unit = mesUnit.Fnumber,
                });
            }
            else
@@ -351,7 +357,7 @@
                    ItemId = Decimal.Parse(itemIdLinkU9.MesId), // 确保ItemId有值
                    SqNo = itemOutList.SqNo, // 确保ItemId有值
                                             //ZzitemId = itemOutList.AsnLineNo, // 确保ItemId有值
                                             // Unit = item.Unit,
                    Unit = mesUnit.Fnumber,
                });
            }