From 6d0fd2765ebc3e311200aa32e9c895214f4c675f Mon Sep 17 00:00:00 2001 From: zjh <2207896513@qq.com> Date: 星期三, 10 九月 2025 10:32:19 +0800 Subject: [PATCH] 产测新增过站信息接口,添加线体记录 --- StandardPda/MES.Service/service/Warehouse/MesInvItemOutsManager.cs | 203 +++++++++++++++++++++++++++++++++----------------- 1 files changed, 134 insertions(+), 69 deletions(-) diff --git a/StandardPda/MES.Service/service/Warehouse/MesInvItemOutsManager.cs b/StandardPda/MES.Service/service/Warehouse/MesInvItemOutsManager.cs index e2c09b3..7ea5d7b 100644 --- a/StandardPda/MES.Service/service/Warehouse/MesInvItemOutsManager.cs +++ b/StandardPda/MES.Service/service/Warehouse/MesInvItemOutsManager.cs @@ -1,4 +1,5 @@ -锘縰sing MES.Service.DB; +锘縰sing Masuit.Tools; +using MES.Service.DB; using MES.Service.Dto.service; using MES.Service.Modes; @@ -18,7 +19,8 @@ { // 鏍规嵁AsnNo鍜孧esNo瀵规槑缁嗚繘琛屽垎缁� 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, @@ -112,10 +115,10 @@ && s.Id == Convert.ToInt32(from.MesNo) ).First(); - if (mesInvItemIns == null) - { - throw new NotImplementedException("閲囪喘鍏ュ簱涓嶅瓨鍦�"); - } + //if (mesInvItemIns == null) + //{ + // throw new NotImplementedException("閲囪喘鍏ュ簱涓嶅瓨鍦�"); + //} var mesDepots = Db.Queryable<MesDepots>() .Where(s => s.DepotId == Decimal.Parse(from.DepotId)).First(); @@ -187,15 +190,15 @@ foreach (var itemOutList in items) { // 妫�鏌ュ繀瑕佸瓧娈垫槸鍚︿负绌� - if (string.IsNullOrEmpty(itemOutList.SrcDocNo)) - { - throw new NotImplementedException("閲囪喘璁㈠崟鍙蜂笉鑳戒负绌�"); - } + //if (string.IsNullOrEmpty(itemOutList.SrcDocNo)) + //{ + // throw new NotImplementedException("閲囪喘璁㈠崟鍙蜂笉鑳戒负绌�"); + //} - if (string.IsNullOrEmpty(itemOutList.SrcDocLineNo)) - { - throw new NotImplementedException("閲囪喘璁㈠崟琛屽彿涓嶈兘涓虹┖"); - } + //if (string.IsNullOrEmpty(itemOutList.SrcDocLineNo)) + //{ + // throw new NotImplementedException("閲囪喘璁㈠崟琛屽彿涓嶈兘涓虹┖"); + //} //if (string.IsNullOrEmpty(itemOutList.AsnLineNo)) //{ @@ -212,10 +215,10 @@ && s.OrderLineId == itemOutList.SrcDocLineNo) .First(); - if (mesRohInData == null) - { - throw new NotImplementedException("閲囪喘璁㈠崟涓嶅瓨鍦�"); - } + //if (mesRohInData == null) + //{ + // throw new NotImplementedException("閲囪喘璁㈠崟涓嶅瓨鍦�"); + //} //var deliveryDetail = Db.Queryable<DeliveryDetail>() // .Where(a => Int32.Parse(a.ZzitemId) == @@ -231,7 +234,7 @@ var itemIdLinkU9 = Db.Queryable<MesLinkU9>() .Where(s => s.TableType == "MES_ITEMS" - && s.U9Id == itemOutList.itemId).First(); + && s.U9Id == itemOutList.itemId &&s.OrgId== "1002011210000095").First(); if (mesLinkU9 == null) { @@ -247,55 +250,117 @@ throw new NotImplementedException("[" + itemOutList.itemId + "]鐗╂枡涓嶅瓨鍦紝璇峰悓姝ョ粰MES"); } + var mesUnit = Db.Queryable<MesUnit>() + .Where(s => s.Id == int.Parse(mesItems.ItemUnit)).First(); - var mesInvItemInCItems = Db.Queryable<MesInvItemInCItems>() - .Where(s => s.ItemInId == mesInvItemIns.Id - && s.ItemNo == mesItems.ItemNo - && s.Ebeln == itemOutList.SrcDocNo - && s.EbelnLineNo == - Decimal.Parse(itemOutList.SrcDocLineNo) - && s.SuppNo == mesSupplier.SuppNo - ).First(); - - if (mesInvItemInCItems == null) + if (itemOutList.SrcDocNo!=null&& itemOutList.SrcDocNo!="") { - throw new NotImplementedException("娌℃湁瀵瑰簲鐨勫叆搴撴槑缁�"); + var mesInvItemInCItems = Db.Queryable<MesInvItemInCItems>() + .Where(s => s.ItemInId == mesInvItemIns.Id + && s.ItemNo == mesItems.ItemNo + && s.Ebeln == itemOutList.SrcDocNo + && s.EbelnLineNo == + Decimal.Parse(itemOutList.SrcDocLineNo) + && s.SuppNo == mesSupplier.SuppNo + ).First(); + + if (mesInvItemInCItems == null) + { + throw new NotImplementedException("娌℃湁瀵瑰簲鐨勫叆搴撴槑缁�"); + } + + + + + // 纭繚CbillNo涓嶄负绌� + if (string.IsNullOrEmpty(mesInvItemIns.CbillNo)) + { + throw new NotImplementedException("鍏ュ簱鍗曞叧鑱旂殑閲囪喘鍗曞彿涓嶈兘涓虹┖"); + } + + + mesInvItemOutItems.Add(new MesInvItemOutItems + { + ItemOutId = nextSequenceValue, + ItemNo = mesItems.ItemNo, + Quantity = Decimal.Parse(itemOutList.qty), + CreateBy = "PL017", + CreateDate = DateTime.Now, + Factory = "1000", + Company = "1000", + DepotCode = mesDepots.DepotCode, + WorkNo = itemOutList.SrcDocNo, // 纭繚WorkNo鏈夊�� + WorkLine = + Decimal.Parse(itemOutList.SrcDocLineNo), // 纭繚WorkLine鏈夊�� + EbelnK3id = Decimal.Parse(mesRohInData.ErpId), + LineK3id = Decimal.Parse(mesRohInData.EbelnK3id), + FType = 0, + Status = 0, + PbillNo = mesInvItemIns.CbillNo, // 纭繚PbillNo鏈夊�� + RkNo = from.MesNo, // 纭繚RkNo鏈夊�� + RkLine = mesInvItemInCItems.Id, // 纭繚RkLine鏈夊�� + RkQty = mesInvItemInCItems.Quantity, + TlQty = 0, + ItemId = Decimal.Parse(itemIdLinkU9.MesId), // 纭繚ItemId鏈夊�� + SqNo = itemOutList.SqNo, // 纭繚ItemId鏈夊�� + //ZzitemId = itemOutList.AsnLineNo, // 纭繚ItemId鏈夊�� + Unit = mesUnit.Fnumber, + }); } - - - // 纭繚CbillNo涓嶄负绌� - if (string.IsNullOrEmpty(mesInvItemIns.CbillNo)) + else { - throw new NotImplementedException("鍏ュ簱鍗曞叧鑱旂殑閲囪喘鍗曞彿涓嶈兘涓虹┖"); + // var mesInvItemInCItems = Db.Queryable<MesInvItemInCItems>() + //.Where(s => s.ItemInId == mesInvItemIns.Id + // && s.ItemNo == mesItems.ItemNo + // && s.Ebeln == itemOutList.SrcDocNo + // && s.EbelnLineNo == + // Decimal.Parse(itemOutList.SrcDocLineNo) + // && s.SuppNo == mesSupplier.SuppNo + // ).First(); + + // if (mesInvItemInCItems == null) + // { + // throw new NotImplementedException("娌℃湁瀵瑰簲鐨勫叆搴撴槑缁�"); + // } + + + + + //// 纭繚CbillNo涓嶄负绌� + //if (string.IsNullOrEmpty(mesInvItemIns.CbillNo)) + //{ + // throw new NotImplementedException("鍏ュ簱鍗曞叧鑱旂殑閲囪喘鍗曞彿涓嶈兘涓虹┖"); + //} + + mesInvItemOutItems.Add(new MesInvItemOutItems + { + ItemOutId = nextSequenceValue, + ItemNo = mesItems.ItemNo, + Quantity = Decimal.Parse(itemOutList.qty), + CreateBy = "PL017", + CreateDate = DateTime.Now, + Factory = "1000", + Company = "1000", + DepotCode = mesDepots.DepotCode, + WorkNo = itemOutList.SrcDocNo, // 纭繚WorkNo鏈夊�� + WorkLine = + Decimal.Parse(itemOutList.SrcDocLineNo), // 纭繚WorkLine鏈夊�� + //EbelnK3id = Decimal.Parse(mesRohInData.ErpId), + //LineK3id = Decimal.Parse(mesRohInData.EbelnK3id), + FType = 0, + Status = 0, + //PbillNo = mesInvItemIns.CbillNo, // 纭繚PbillNo鏈夊�� + RkNo = from.MesNo, // 纭繚RkNo鏈夊�� + RkLine = null, // 纭繚RkLine鏈夊�� + RkQty = null, + TlQty = 0, + ItemId = Decimal.Parse(itemIdLinkU9.MesId), // 纭繚ItemId鏈夊�� + SqNo = itemOutList.SqNo, // 纭繚ItemId鏈夊�� + //ZzitemId = itemOutList.AsnLineNo, // 纭繚ItemId鏈夊�� + Unit = mesUnit.Fnumber, + }); } - - mesInvItemOutItems.Add(new MesInvItemOutItems - { - ItemOutId = nextSequenceValue, - ItemNo = mesItems.ItemNo, - Quantity = Decimal.Parse(itemOutList.qty), - CreateBy = "PL017", - CreateDate = DateTime.Now, - Factory = "1000", - Company = "1000", - DepotCode = mesDepots.DepotCode, - WorkNo = itemOutList.SrcDocNo, // 纭繚WorkNo鏈夊�� - WorkLine = - Decimal.Parse(itemOutList.SrcDocLineNo), // 纭繚WorkLine鏈夊�� - EbelnK3id = Decimal.Parse(mesRohInData.ErpId), - LineK3id = Decimal.Parse(mesRohInData.EbelnK3id), - FType = 0, - Status = 0, - PbillNo = mesInvItemIns.CbillNo, // 纭繚PbillNo鏈夊�� - RkNo = from.MesNo, // 纭繚RkNo鏈夊�� - RkLine = mesInvItemInCItems.Id, // 纭繚RkLine鏈夊�� - RkQty = mesInvItemInCItems.Quantity, - TlQty = 0, - ItemId = Decimal.Parse(itemIdLinkU9.MesId), // 纭繚ItemId鏈夊�� - SqNo = itemOutList.SqNo, // 纭繚ItemId鏈夊�� - //ZzitemId = itemOutList.AsnLineNo, // 纭繚ItemId鏈夊�� - // Unit = item.Unit, - }); + } var outItemCommand = Db.Insertable(mesInvItemOutItems) -- Gitblit v1.9.3