From 7cff82da32a694368779bfff7c67e7d7827b957a Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期一, 20 十月 2025 08:36:20 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/基础资料/基础资料/Gy_MateNumRelationController.cs | 71 ++++++++++++++++++++++++++++++++++-
1 files changed, 69 insertions(+), 2 deletions(-)
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MateNumRelationController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MateNumRelationController.cs"
index 9a2db52..37b7bb6 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MateNumRelationController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MateNumRelationController.cs"
@@ -282,8 +282,8 @@
foreach (Models.Gy_MateNumRelation_Sec oItem in lsmain)
{
//閲嶆柊鍐欏叆鍏宠仈鏁版嵁
- oCN.RunProc("insert into Gy_MateNumRelation_Sec (HCusID,HMaterID,HCusRelationNumber,HCusRelationName,HMaker,HMakeDate) " +
- "values ('" + msg3 + "','" + oItem.HMaterID + "','" + oItem.HCusRelationNumber + "','" + oItem.HCusRelationName + "','" + msg4 + "',getdate() " +
+ oCN.RunProc("insert into Gy_MateNumRelation_Sec (HCusID,HMaterID,HCusRelationNumber,HCusRelationName,HMaker,HMakeDate,HCusRelationModel,HTemplateID) " +
+ "values ('" + msg3 + "','" + oItem.HMaterID + "','" + oItem.HCusRelationNumber + "','" + oItem.HCusRelationName + "','" + msg4 + "',getdate(),' " + oItem.HCusRelationModel + "'," + oItem.HTemplateID +
")");
}
oCN.Commit();
@@ -457,5 +457,72 @@
}
}
#endregion
+
+ #region 瀹㈡埛鐗╂枡瀵瑰簲琛ㄤ繚瀛�
+ [Route("Gy_MateNumRelation/SaveGy_MateNumRelationAPI")]
+ [HttpPost]
+ public object SaveGy_MateNumRelationAPI([FromBody] JObject oMain)
+ {
+ try
+ {
+ var model = oMain["model"].ToString();
+ LogService.Write("1" + model);
+ //鍙嶅簭鍒楀寲
+ //model = "[" + model + "]";
+ List<Gy_MateNumRelation_Sec> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_MateNumRelation_Sec>>(model);
+ string sql = string.Empty;
+ oCN.BeginTran();
+ foreach (var item in lsmain)
+ {
+ // 浣跨敤褰撳墠item鐨凥ItemID鍒犻櫎
+ sql = $"delete from Gy_MateNumRelation_Sec where HItemID = {item.HItemID} and HMaterID={item.HMaterID} ";
+ oCN.RunProc(sql);
+ // 寮�鍚痠dentity_insert
+ sql = "set identity_insert Gy_MateNumRelation_Sec on";
+ oCN.RunProc(sql);
+
+ LogService.Write("瀹㈡埛鐗╂枡瀵瑰簲琛�" + @"Insert Into Gy_MateNumRelation_Sec " +
+ "(HItemID,HCusID,HCusRelationNumber,HCusRelationName,HMaterID" +
+ ",HUsed,HCREATEORGID,HUSEORGID,HRemark,HMakeDate,HMaker" +
+ ") " +
+ " values('" + item.HItemID + "','" + item.HCusID + "','" + item.HCusRelationNumber + "','" + item.HCusRelationName + "','" + item.HMaterID + "'," +
+ "'" + item.HUsed + "','" + item.HUSEORGID + "','" + item.HUSEORGID + "','" + item.HRemark + "',getdate(),'" + item.HMaker +
+ "') ");
+
+ // 鎻掑叆褰撳墠item鐨勮褰�
+ sql = "Insert Into Gy_MateNumRelation_Sec " +
+ "(HItemID,HCusID,HCusRelationNumber,HCusRelationName,HMaterID" +
+ ",HUsed,HCREATEORGID,HUSEORGID,HRemark,HMakeDate,HMaker" +
+ ") " +
+ " values('" + item.HItemID + "','" + item.HCusID + "','" + item.HCusRelationNumber + "','" + item.HCusRelationName + "','" + item.HMaterID + "'," +
+ "'" + item.HUsed + "','" + item.HUSEORGID + "','" + item.HUSEORGID + "','" + item.HRemark + "',getdate(),'" + item.HMaker +
+ "') ";
+ oCN.RunProc(sql);
+ // 鍏抽棴identity_insert
+ sql = "set identity_insert Gy_MateNumRelation_Sec off";
+ oCN.RunProc(sql);
+
+ }
+
+ // 鎻愪氦褰撳墠浜嬪姟
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
+ //objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+
+ }
+ }
+ #endregion
}
}
\ No newline at end of file
--
Gitblit v1.9.1