From 19f470069c5bff7ea89a67d2b07f02a5475f11f1 Mon Sep 17 00:00:00 2001
From: hao <1836460075@qq.com>
Date: 星期六, 06 九月 2025 09:02:48 +0800
Subject: [PATCH] 生产订单字段
---
StandardInterface/MES.Service/service/WomcaaManager.cs | 107 +++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 95 insertions(+), 12 deletions(-)
diff --git a/StandardInterface/MES.Service/service/WomcaaManager.cs b/StandardInterface/MES.Service/service/WomcaaManager.cs
index baacc02..ef9344e 100644
--- a/StandardInterface/MES.Service/service/WomcaaManager.cs
+++ b/StandardInterface/MES.Service/service/WomcaaManager.cs
@@ -60,25 +60,92 @@
.IgnoreColumns(true).ExecuteCommand() > 0;
//鎵归噺鎻掑叆蹇界暐绌哄瓧娈�
- var baOrUpdate = db.Insertable(mesWomcabs).PageSize(1)
+ var baOrUpdate = db.Insertable(mesWomcabs).PageSize(10)
.IgnoreColumnsNull()
.ExecuteCommand() > 0;
- 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_DAA2(:P_WORK_NO,:c_Result,:C_MSG); END;",
+ inputParam1, outParam1, outParam2);
+ // 鑾峰彇杈撳嚭鍙傛暟鐨勫��
+ var result = int.Parse((string)outParam1.Value);
+ var 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("鎻掑叆鎴栨洿鏂板け璐�");
}
private bool UpdateData(SqlSugarScope db, Womcaa mesWomcaa,
List<Womcab> mesWomcabs)
{
- var decimals = mesWomcabs.Select(s => s.Id).ToArray();
- var update = base.DeleteById(mesWomcaa.Id);
- var insertOrUpdate = db
- .Deleteable<Womcab>().In(decimals)
- .ExecuteCommand() > 0;
- if (update && insertOrUpdate) return true;
+ //瀹氫箟杈撳叆鍙傛暟
+ 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_DAA2(:P_WORK_NO,:c_Result,:C_MSG); END;",
+ inputParam1, outParam1, outParam2);
+ // 鑾峰彇杈撳嚭鍙傛暟鐨勫��
+ var result = int.Parse((string)outParam1.Value);
+ var message = outParam2.Value == DBNull.Value
+ ? string.Empty
+ : (string)outParam2.Value;
+ if (result == 1)
+ {
+ //瀛樺偍杩囩▼澶辫触鍒欎簨鍔¤繘琛屽洖婊�
+ db.Ado.RollbackTran();
+ throw new Exception(message);
+ }
+
+ // 鎻愪氦浜嬪姟
+ db.Ado.CommitTran();
+
+
+ var decimals = mesWomcabs.Select(s => s.Id).ToArray();
+
+ var update = true;
+ if (mesWomcaa != null)
+ {
+ if (mesWomcaa.Id != null)
+ {
+ update = base.DeleteById(mesWomcaa.Id);
+ }
+ }
+ var insertOrUpdate = true;
+ if (decimals != null || decimals.Length > 0)
+ {
+ insertOrUpdate = db.Deleteable<Womcab>().In(decimals).ExecuteCommand() > 0;
+ }
+
+ if (update && insertOrUpdate)
+ {
+
+ return true;
+ }
throw new NotImplementedException("鏇存柊澶辫触");
+
}
private Womcaa MapErpCAAtoWomcaa(ErpCAA dto)
@@ -200,8 +267,18 @@
Typea = dto.TypeA, /// 鍗曟嵁鐘舵��
RkOrg = dto.RK_ORG, //鍏ュ簱缁勭粐
Rcn=dto.RCN, //鏃ヤ骇鑳�
-
-
+ Cglineid=dto.CG_LINE_ID, //閲囪喘璁㈠崟琛宨d
+ Kh=dto.KH,
+ Khjc=dto.KH_JCZL,
+ Scph=dto.SC_PH,
+ Moldno=dto.MOLd_no,
+ Oldmoldno=dto.Old_mold_no,
+ Jt=dto.JT,
+ Xscn=dto.XS_CN,
+ Sjxs=dto.SJ_xs,
+ Nextgx=dto.NEXT_Gx,
+ Rks=dto.RKS,
+ Khwlbm=dto.KHWLBM,
//娌冨皵鏂板
// WR_F_SCDD_SCTZD = dto.F_SCDD_SCTZD
//WR_F_SCDD_XH = dto.F_SCDD_XH
@@ -237,6 +314,7 @@
Lot = dto.FLot, //鎵瑰彿
DepotCode = dto.FStockID, //浠撳簱
IssueType = dto.FIssueType, //鍙戞枡鏂瑰紡
+ Cab008 = dto.GY, //宸ヨ壓
Cab009 = dto.FUnitID, //鍗曚綅
SupplyType = dto.FSupplyType, //渚涘簲绫诲瀷
Cab012 = Convert.ToDecimal(dto.FStdQty), // 鏍囧噯鐢ㄩ噺
@@ -264,8 +342,13 @@
var entity = Db.Queryable<Womcab>()
.Where(s => s.Erpid == womcab.Erpid).Single();
- if (entity != null) womcab.Id = entity.Id;
-
+ if (entity != null)
+ {
+ // 鍒犻櫎宸叉湁鐨� Erpid 鐩稿叧鐨� Womcab 鏁版嵁
+ // Db.Deleteable<Womcab>().Where(s => s.Erpid == womcab.Erpid).ExecuteCommand();
+ womcab.Id = entity.Id;
+ }
+
womcabList.Add(womcab);
}
--
Gitblit v1.9.3