From 1948124877478db58b27841f9398aed97ef13053 Mon Sep 17 00:00:00 2001
From: chenhaozhe <gaozhechen26@gmail.com>
Date: 星期日, 26 十月 2025 17:19:15 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WebAPI/Controllers/基础资料/基础资料/Gy_MateNumRelationController.cs | 67 +++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 0 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 b1932ff..70e7ed4 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"
@@ -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,HShopID" +
+ ") " +
+ " values('" + item.HItemID + "','" + item.HCusID + "','" + item.HCusRelationNumber + "','" + item.HCusRelationName + "','" + item.HMaterID + "'," +
+ "'" + item.HUsed + "','" + item.HUSEORGID + "','" + item.HUSEORGID + "','" + item.HRemark + "',getdate(),'" + item.HMaker + "','" + item.HShopID +
+ "') ");
+
+ // 鎻掑叆褰撳墠item鐨勮褰�
+ sql = "Insert Into Gy_MateNumRelation_Sec " +
+ "(HItemID,HCusID,HCusRelationNumber,HCusRelationName,HMaterID" +
+ ",HUsed,HCREATEORGID,HUSEORGID,HRemark,HMakeDate,HMaker,HShopID" +
+ ") " +
+ " values('" + item.HItemID + "','" + item.HCusID + "','" + item.HCusRelationNumber + "','" + item.HCusRelationName + "','" + item.HMaterID + "'," +
+ "'" + item.HUsed + "','" + item.HUSEORGID + "','" + item.HUSEORGID + "','" + item.HRemark + "',getdate(),'" + item.HMaker + "','" + item.HShopID +
+ "') ";
+ 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