From a4ae3bf5f1826e8e29a95da3dc2c947d713d4ebb Mon Sep 17 00:00:00 2001 From: 南骏 池 <chiffly@163.com> Date: 星期五, 06 六月 2025 15:38:14 +0800 Subject: [PATCH] 1.仓库信息储存逻辑调整 2.生产订单接口优化。 --- MES.Service/service/BasicData/ProductionOrderManager.cs | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/MES.Service/service/BasicData/ProductionOrderManager.cs b/MES.Service/service/BasicData/ProductionOrderManager.cs index 5659a47..28b494d 100644 --- a/MES.Service/service/BasicData/ProductionOrderManager.cs +++ b/MES.Service/service/BasicData/ProductionOrderManager.cs @@ -14,12 +14,14 @@ private readonly ProductionOrderSubManager _productionOrderSubManager = new(); + private string ORDERNO = ""; + //ErpWYOrder public bool Save(ErpWYOrder wyOrder) { var erpProductionOrderDto = wyOrder.OrderDto; - var mesRohIn = ConvertErpToProductionOrder(erpProductionOrderDto); + var mesRohIn = ConvertErpToProductionOrder(erpProductionOrderDto, wyOrder.Items[0].FBILLNO); var mesRohInDatas = ConvertErpToProductionOrderSub(wyOrder.Items); @@ -75,10 +77,16 @@ if (mesRohInDatas.Count > 0) db.Deleteable<ProductionOrderSub>() - .Where(s => s.ErpHeaderId == mesRohIn.ErpId).ExecuteCommand(); + .Where(s => s.ErpProductionEntryCode == mesRohIn.ErpProductionEntryCode).ExecuteCommand(); - var orUpdate = base.Insert(mesRohIn); - var baOrUpdate = _productionOrderSubManager.InsertRange(mesRohInDatas); + var orUpdate = db.Insertable(mesRohIn) + .IgnoreColumns(true).ExecuteCommand() > 0; + + + var baOrUpdate = db.Insertable(mesRohInDatas).PageSize(1) + .IgnoreColumnsNull() + .ExecuteCommand() > 0; + if (orUpdate && baOrUpdate) return true; throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�"); @@ -92,7 +100,7 @@ } private ProductionOrder ConvertErpToProductionOrder( - ErpProductionOrderDto erpDto) + ErpProductionOrderDto erpDto,string SUBBOM) { DateTime parsedDate; @@ -110,7 +118,7 @@ var productionOrder = new ProductionOrder { - OrderNo = erpDto.FBillNo, + OrderNo = SUBBOM, Warehouse = erpDto.FStockID, OrderDate = ParseDateTime(erpDto.FDate) ?? null, OrderType = erpDto.FBillType, @@ -142,7 +150,7 @@ ClosingPerson = erpDto.FFORCECLOSERID, ClosingType = erpDto.FCloseType, Remarks = erpDto.FDescription, - ErpId = erpDto.FPPOMID, + ErpId = erpDto.FID, ErpProductionEntryCode = erpDto.FSUBENTRYID, Purchaseorderno = erpDto.FPurOrderNo, Purchaseorderentryseq = Convert.ToInt32(erpDto.FPurOrderEntrySeq), @@ -158,7 +166,7 @@ Typea = erpDto.TypeA, }; - var single = base.GetSingle(it => it.ErpId == erpDto.FPPOMID); + var single = base.GetSingle(it => it.ErpProductionEntryCode == erpDto.FSUBENTRYID); if (single != null) productionOrder.Guid = single.Guid; return productionOrder; -- Gitblit v1.9.3