From e3c454b61eb969d186110c3ad7ab6a289cbc013a Mon Sep 17 00:00:00 2001 From: sjz <1240968267@qq.com> Date: 星期五, 25 四月 2025 10:17:22 +0800 Subject: [PATCH] 生产订单 加 成品编号 --- MES.Service/service/WomcaaWWManager.cs | 41 +++++++++++++++++++++++++++++++++++------ 1 files changed, 35 insertions(+), 6 deletions(-) diff --git a/MES.Service/service/WomcaaWWManager.cs b/MES.Service/service/WomcaaWWManager.cs index 25adab9..692661b 100644 --- a/MES.Service/service/WomcaaWWManager.cs +++ b/MES.Service/service/WomcaaWWManager.cs @@ -87,14 +87,40 @@ private bool SaveOrUpdateDataWw(SqlSugarScope db, Womcaa mesWomcaa, List<Womcab> mesWomcabss) { - if (mesWomcaa.Id != null) base.DeleteById(mesWomcaa.Id); - + if (mesWomcaa.Id != null) + { + base.DeleteById(mesWomcaa.Id); + } if (mesWomcabss.Count > 0) + { db.Deleteable<Womcab>().Where(s => s.Eid == mesWomcaa.Erpid).ExecuteCommand(); - + } var orUpdate = base.Insert(mesWomcaa); var baOrUpdate = _womcabWWManager.InsertRange(mesWomcabss); - if (orUpdate && baOrUpdate) return true; + + if (orUpdate && baOrUpdate) + { + //瀹氫箟杈撳叆鍙傛暟 + var inputParam1 = new SugarParameter("P_WORK_NO", mesWomcaa.Caa001); + // 瀹氫箟杈撳嚭鍙傛暟 + 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); + // 鑾峰彇杈撳嚭鍙傛暟鐨勫�� + int result = int.Parse((string)outParam1.Value); + string message = outParam2.Value == DBNull.Value ? string.Empty : (string)outParam2.Value; + if (result == 1) + { + //瀛樺偍杩囩▼澶辫触鍒欎簨鍔¤繘琛屽洖婊� + db.Ado.RollbackTran(); + throw new Exception(message); + } + // 鎻愪氦浜嬪姟 + db.Ado.CommitTran(); + return true; + } + throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�"); } @@ -130,6 +156,7 @@ Caa012 = Convert.ToDecimal(dto.FQty), Caa013 = dto.FBomId, Caa015 = dto.FXSHTH, + Caa015Head = dto.FSaleOrderEntrySeq, Caa016 = dto.FDescription, Caa017 = 0, Caa018 = Convert.ToDecimal(dto.PLAN_ID), @@ -154,7 +181,7 @@ SrcBillType = dto.FSrcBillType, SrcBillNo = dto.FSrcBillNo, SrcBillentryseq = dto.FSrcBillEntrySeq, - SaleOrderNo = dto.FSaleOrderNo, + SaleOrderNo = dto.FXSHTH, SaleOrderEntryseq = dto.FSaleOrderEntrySeq, ForceCloserid = dto.FForceCloserId, CloseType = dto.FCloseType, @@ -169,7 +196,9 @@ FPURORDERENTRYSEQ = Convert.ToDecimal(dto.FPurOrderEntrySeq), FSUBENTRYID = Convert.ToDecimal(dto.fsubentryid), FSTOCKINQTY = Convert.ToDecimal(dto.Caa024), - FNOSTOCKINQTY = Convert.ToDecimal(dto.Caa025) + FNOSTOCKINQTY = Convert.ToDecimal(dto.Caa025), + SupplierId = dto.SupplierId, + FinishedProduct = dto.FinishedProduct }; if (dto.Type == "5") { -- Gitblit v1.9.3