From f1deb7b024e17cba204de5fcb0dac15801436b90 Mon Sep 17 00:00:00 2001 From: sjz <1240968267@qq.com> Date: 星期一, 28 七月 2025 20:56:41 +0800 Subject: [PATCH] 多组织修改 --- MES.Service/service/WomcaaWWManager.cs | 62 ++++++++++++++++-------------- 1 files changed, 33 insertions(+), 29 deletions(-) diff --git a/MES.Service/service/WomcaaWWManager.cs b/MES.Service/service/WomcaaWWManager.cs index bc6bf20..ad77733 100644 --- a/MES.Service/service/WomcaaWWManager.cs +++ b/MES.Service/service/WomcaaWWManager.cs @@ -2,8 +2,6 @@ using MES.Service.Dto.webApi; using MES.Service.Modes; using SqlSugar; -using System; -using static Microsoft.EntityFrameworkCore.DbLoggerCategory; namespace MES.Service.service; @@ -15,8 +13,8 @@ private readonly WomcabManager _womcabWWManager = new(); private decimal?[] decimals; - private bool update; private bool insertOrUpdate; + private bool update; public bool SaveList(List<ErpWOM> rohIns) { @@ -39,21 +37,20 @@ case "1": case "2": case "4": - return SaveOrUpdateDataWw(db, mesWomcaa, mesWomcabs) ? 1 : 0; + return SaveOrUpdateDataWw(db, mesWomcaa, mesWomcabs) + ? 1 + : 0; case "5": return UpdateData(db, mesWomcaa, mesWomcabs) ? 1 : 0; default: - throw new NotImplementedException( - $"type娌℃湁{womErpCaa.Type}杩欎釜绫诲瀷"); + throw new NotImplementedException($"type娌℃湁{womErpCaa.Type}杩欎釜绫诲瀷"); } }) > 0; } - private bool UpdateData(SqlSugarScope db, Womcaa mesWomcaa, List<Womcab> mesWomcabs) + + private bool UpdateData(SqlSugarScope db, Womcaa mesWomcaa,List<Womcab> mesWomcabs) { - if (mesWomcaa.Id != null) - { - base.DeleteById(mesWomcaa.Id); - } + if (mesWomcaa.Id != null) base.DeleteById(mesWomcaa.Id); if (mesWomcabs.Count > 0) { db.Deleteable<Womcab>().Where(s => s.Eid == mesWomcaa.Erpid).ExecuteCommand(); @@ -69,10 +66,10 @@ var outParam1 = new SugarParameter("c_Result", null, true); var outParam2 = new SugarParameter("C_MSG", null, true); // 浣跨敤 SqlSugar 鎵ц瀛樺偍杩囩▼ - Db.Ado.ExecuteCommand("BEGIN PRC_UPDATE_DAA(:P_WORK_NO,:c_Result,:C_MSG); END;", inputParam1, outParam1, outParam2); + Db.Ado.ExecuteCommand("BEGIN PRC_UPDATE_DAA(:P_WORK_NO,:c_Result,:C_MSG); END;",inputParam1, outParam1, outParam2); // 鑾峰彇杈撳嚭鍙傛暟鐨勫�� - int result = int.Parse((string)outParam1.Value); - string message = outParam2.Value == DBNull.Value ? string.Empty : (string)outParam2.Value; + var result = int.Parse((string)outParam1.Value); + var message = outParam2.Value == DBNull.Value ? string.Empty : (string)outParam2.Value; if (result == 1) { //瀛樺偍杩囩▼澶辫触鍒欎簨鍔¤繘琛屽洖婊� @@ -83,10 +80,11 @@ //db.Ado.CommitTran(); return true; } + throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�"); } - private bool SaveOrUpdateDataWw(SqlSugarScope db, Womcaa mesWomcaa, List<Womcab> mesWomcabss) + private bool SaveOrUpdateDataWw(SqlSugarScope db, Womcaa mesWomcaa,List<Womcab> mesWomcabss) { if (mesWomcaa.Id != null) { @@ -107,10 +105,10 @@ var outParam1 = new SugarParameter("c_Result", null, true); var outParam2 = new SugarParameter("C_MSG", null, true); // 浣跨敤 SqlSugar 鎵ц瀛樺偍杩囩▼ - Db.Ado.ExecuteCommand("BEGIN PRC_UPDATE_DAA(:P_WORK_NO,:c_Result,:C_MSG); END;", inputParam1, outParam1, outParam2); + Db.Ado.ExecuteCommand("BEGIN PRC_UPDATE_DAA(:P_WORK_NO,:c_Result,:C_MSG); END;",inputParam1, outParam1, outParam2); // 鑾峰彇杈撳嚭鍙傛暟鐨勫�� - int result = int.Parse((string)outParam1.Value); - string message = outParam2.Value == DBNull.Value ? string.Empty : (string)outParam2.Value; + var result = int.Parse((string)outParam1.Value); + var message = outParam2.Value == DBNull.Value ? string.Empty : (string)outParam2.Value; if (result == 1) { //瀛樺偍杩囩▼澶辫触鍒欎簨鍔¤繘琛屽洖婊� @@ -138,7 +136,11 @@ update = true; insertOrUpdate = true; } - if (update && insertOrUpdate) return true; + + if (update && insertOrUpdate) + { + return true; + } throw new NotImplementedException("鏇存柊澶辫触"); } @@ -169,7 +171,7 @@ Caa023 = dto.FStatus, Caa024 = 0, RoutingId = dto.FRoutingId, - WorkShopId = dto.FREMWorkShopId, + WorkShopId = dto.FremWorkShopId, DepotCode = dto.FStockId, CreateDate = dto.FDate, WorkGroupId = dto.FWorkGroupId, @@ -189,8 +191,8 @@ SrcSplitBillno = dto.FSrcSplitBillNo, F_ZSXG_KH = dto.F_ZJXF_BASE_KH, F_ZJXF_YHRQ = dto.F_ZJXF_DATETIME_YHRQ, - PrdOrg = dto.erP_SCZZ, - TrustOrg = dto.erP_WTZZ, + PrdOrg = dto.ErpRkhz, //鍏ュ簱璐т富 + TrustOrg = dto.ErpRkzz, //鍏ュ簱缁勭粐 TbTime = DateTime.Now, JaBs = "0", FPURORDERNO = dto.FPurOrderNo, @@ -202,13 +204,9 @@ FinishedProduct = dto.FinishedProduct }; if (dto.Type == "5") - { entity.IsXg = 1; - } else - { entity.IsXg = 0; - } if (dto.FStatus == "6" || dto.FStatus == "7") { @@ -217,7 +215,10 @@ } var single = base.GetSingle(it => it.Erpid == entity.Erpid); - if (single != null) entity.Id = single.Id; + if (single != null) + { + entity.Id = single.Id; + } return entity; } @@ -253,11 +254,14 @@ Denominator = Convert.ToDecimal(dto.FDenominator), SCRAPQTY = Convert.ToDecimal(dto.FFixScrapQty), SCRAPRATE = Convert.ToDecimal(dto.FScrapRate), - SalesOrder = dto.FXSHTBH, + SalesOrder = dto.F_WWC_TEXT }; var entity = Db.Queryable<Womcab>().Where(s => s.Erpid == womcab.Erpid).Single(); - if (entity != null) womcab.Id = entity.Id; + if (entity != null) + { + womcab.Id = entity.Id; + } womcabList.Add(womcab); } -- Gitblit v1.9.3