From 72594e721deaa9f1485836923184c048cafe8270 Mon Sep 17 00:00:00 2001 From: zjh <2207896513@qq.com> Date: 星期一, 08 九月 2025 09:55:02 +0800 Subject: [PATCH] 采购退货单支持无源单退 --- StandardPda/MES.Service/service/Warehouse/MesInvItemOutsManager.cs | 179 +++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 119 insertions(+), 60 deletions(-) diff --git a/StandardPda/MES.Service/service/Warehouse/MesInvItemOutsManager.cs b/StandardPda/MES.Service/service/Warehouse/MesInvItemOutsManager.cs index cf603b2..051f6fe 100644 --- a/StandardPda/MES.Service/service/Warehouse/MesInvItemOutsManager.cs +++ b/StandardPda/MES.Service/service/Warehouse/MesInvItemOutsManager.cs @@ -112,10 +112,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 +187,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 +212,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) == @@ -248,54 +248,113 @@ "]鐗╂枡涓嶅瓨鍦紝璇峰悓姝ョ粰MES"); } - 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 = item.Unit, + }); } - - - // 纭繚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 = item.Unit, + }); } - - 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