From d516af1f95472c0a5f86ab3b789c7b1e3c1c8656 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期四, 18 十二月 2025 16:47:42 +0800
Subject: [PATCH] 添加 检验单 扫条码/选源单 请求通用接口
---
WebAPI/Controllers/WebAPIController.cs | 375 +++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 329 insertions(+), 46 deletions(-)
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index ac39ea9..c590ab1 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -20230,20 +20230,20 @@
/// <returns></returns>
[Route("Web/GetCheckItemByCheckProjectID")]
[HttpGet]
- public object GetCheckItemByCheckProjectID(int CheckProjectID, int HBatchQty)
+ public object GetCheckItemByCheckProjectID(int CheckProjectID, int HBatchQty, int HMaterID, string HBillType)
{
- if (CheckProjectID <= 0)
- {
- objjson.code = "0";
- objjson.count = 0;
- objjson.Message = "妫�楠屾柟妗堟湭閫夋嫨";
- objjson.data = null;
- return objjson;
- }
+ //if (CheckProjectID <= 0)
+ //{
+ // objjson.code = "0";
+ // objjson.count = 0;
+ // objjson.Message = "妫�楠屾柟妗堟湭閫夋嫨";
+ // objjson.data = null;
+ // return objjson;
+ //}
try
{
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
- string sql = "exec h_p_Gy_GetQCCheckItemByProject " + CheckProjectID + "," + HBatchQty;
+ string sql = "exec h_p_Gy_GetQCCheckItemByProject " + CheckProjectID + "," + HBatchQty + "," + HMaterID + ",'" + HBillType + "'";
ds = oCN.RunProcReturn(sql, "h_p_Gy_GetQCCheckItemByProject");
if (ds == null || ds.Tables[0].Rows.Count <= 0)
{
@@ -22415,7 +22415,7 @@
{
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
- ds = oCN.RunProcReturn("Select * from Xt_BillType where HNumber = '" + HModuleType + "'", "Xt_BillType");
+ ds = oCN.RunProcReturn("Select * from Xt_BillType with(nolock) where HNumber = '" + HModuleType + "'", "Xt_BillType");
if (ds == null || ds.Tables[0].Rows.Count <= 0)
{
@@ -22660,58 +22660,197 @@
#endregion
- #region 鎯犲悍 鐢熶骇棰嗘枡鍗曟牎楠� 鎵弿婧愬崟 鑾峰彇鐢熶骇棰嗘枡鍗曞拰涓嬫父棰嗘枡鍗曟湭瀹℃牳 鍗曟嵁
- [Route("web/get_BillBarCode_BillCheck_Json_MateOut_HuiKang")]
- [HttpGet]
- public Object get_BillBarCode_BillCheck_Json_MateOut_HuiKang(string HBillNo, string HBillType, string HMaker, Int64 HStockOrgID)
+ #region 璐圭敤椤圭洰 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
+ /// <summary>
+ /// 椤圭洰璐圭敤 淇濆瓨
+ /// </summary>
+ /// <param name="msg"></param>
+ /// <returns></returns>
+ [Route("SaveGy_ItemMoney")]
+ [HttpPost]
+ public object SaveGy_ItemMoney([FromBody] JObject msg)
{
- WebS.ClsKf_ICStockBill_WMS WebSoBar = new WebS.ClsKf_ICStockBill_WMS();
- WebS.WebService1 oWebs = new WebS.WebService1();
+ DataSet ds;
+ var _value = msg["msg"].ToString();
+ string msg3 = _value.ToString();
+ string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg1 = sArray[0].ToString();
+ string msg2 = sArray[1].ToString();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_ItemMoney_Edit", 1, false, msg2))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ Int64 HItemID = 0;
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ //鑾峰彇鏈�澶D鍊艰祴鍊�
+ DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from Gy_ItemMoney_1 ", "Gy_ItemMoney_1");
+ if (Maxds != null || Maxds.Tables[0].Rows.Count > 0)
+ {
+ //HItemID= Maxds.Tables[0].Rows[0]["HItemID"]
+ var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]);
+ maxid += 1;
+ HItemID = maxid;
+ }
+ ListModels oListModels = new ListModels();
try
{
- WebSoBar = null;
- // 1. 鏌ヨ閲戣澏浜戜腑 鎵�鏈夌鍚堢殑鐢熶骇棰嗘枡鍗曞拰涓嬫父棰嗘枡鍗�
- ds = oCN.RunProcReturn($@"
- select HBillNo from h_v_Kf_MateOutBillList_K3 where HBillNo like '%{HBillNo}%'
- ", "h_v_Kf_MateOutBillList_K3");
- List<string> HBillNoList = new List<string>();
- foreach(var row in ds.Tables[0].Rows)
+ WebAPI.DLL.ClsGy_ItemMoney_Ctl oBill = new WebAPI.DLL.ClsGy_ItemMoney_Ctl();
+ List<Model.ClsGy_ItemMoney_Model> lsmain = new List<Model.ClsGy_ItemMoney_Model>();
+ msg1 = msg1.Replace("\\", "");
+ msg1 = msg1.Replace("\n", "");
+ lsmain = oListModels.getObjectByJson_Gy_ItemMoney(msg1);
+ foreach (Model.ClsGy_ItemMoney_Model oItem in lsmain)
{
- HBillNoList.Add(row.ToString());
- }
-
- // 2. 閬嶅巻鑾峰彇鐨勭敓浜ч鏂欏崟
- foreach(string HBillNoOne in HBillNoList)
- {
- WebSoBar = oWebs.get_BillBarCode_BillCheck(HBillNo, HBillType, HMaker, HStockOrgID, ref DBUtility.ClsPub.sErrInfo);
-
- if(WebSoBar != null)
+ if (oItem.HNumber.Trim() == "")
{
- // 3. 鑾峰彇鍒扮鍚堟潯浠剁殑杩斿洖鍊硷紝绔嬪嵆杩斿洖
objJsonResult.code = "0";
- objJsonResult.count = 1;
- objJsonResult.Message = "鎴愬姛";
- objJsonResult.data = WebSoBar;
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒";
+ objJsonResult.data = 1;
return objJsonResult;
}
+ if (oItem.HName.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim()))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+
+ ds = oCN.RunProcReturn("select * from Gy_ItemMoney_1 where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_ItemMoney_1");
+ if (oItem.HNumber.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ //鏂板鏃跺垽鏂�
+ if (oItem.HItemID == 0)
+ {
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+ string sParent;
+ sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+ if (sParent.Trim() == "")
+ {
+ oBill.oModel.HParentID = 0;
+ }
+ else
+ {
+ if (oBill.HavParentCode(sParent.Trim(), HItemID))
+ {
+ oBill.oModel.HParentID = oBill.oModel.HItemID;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ }
+ else//缂栬緫鏃跺垽鏂�
+ {
+ //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+ string sParent;
+ sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+ if (sParent.Trim() == "")
+ {
+ oBill.oModel.HParentID = 0;
+ }
+ else
+ {
+ if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID))
+ {
+ oBill.oModel.HParentID = oBill.oModel.HItemID;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ }
+ //寰楀埌鐭唬鐮�
+ string sShortNumber;
+ sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
+ if (sShortNumber.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ oItem.HShortNumber = sShortNumber;//鐭唬鐮�
+ oItem.HEndFlag = true;//鏈骇鏍囧織
+ oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇
+ oItem.HMakeEmp = msg2; //鍒涘缓浜�
+
+ oBill.oModel = oItem;
}
- // 3. 鎵�鏈夊崟鎹兘琚鏍革紝鎴栬�呮病鏈夌鍚堣姹傜殑鍗曟嵁锛岃繑鍥為敊璇俊鎭�
- if (WebSoBar == null)
+ //淇濆瓨
+ //淇濆瓨瀹屾瘯鍚庡鐞�
+ bool bResult;
+ if (oBill.oModel.HItemID == 0)
+ {
+ bResult = oBill.AddNew();
+ }
+ else
+ {
+ bResult = oBill.ModifyByID(oBill.oModel.HItemID);
+ }
+ if (bResult)
{
objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
- objJsonResult.data = null;
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+ objJsonResult.data = 1;
return objJsonResult;
}
else
{
objJsonResult.code = "0";
- objJsonResult.count = 1;
- objJsonResult.Message = "鎴愬姛";
- objJsonResult.data = WebSoBar;
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = 1;
return objJsonResult;
}
}
@@ -22719,7 +22858,151 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "鎵弿鍗曟嵁鏉$爜澶辫触锛�" + e.ToString();
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+
+ /// <summary>
+ /// 椤圭洰璐圭敤 鑾峰彇淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ [Route("Web/GetGy_ItemMoneyDetail")]
+ [HttpGet]
+ public ApiResult<DataSet> GetGy_ItemMoneyDetail(string HID)
+ {
+ var model = LuBaoSevice.GetGy_ItemMoneyDetail(HID);
+ return model;
+ }
+
+ /// <summary>
+ /// 椤圭洰璐圭敤 鍒犻櫎鍔熻兘
+ /// </summary>
+ /// <returns></returns>
+ [Route("DeltetGy_ItemMoney")]
+ [HttpGet]
+ public object DeltetGy_ItemMoney(string HItemID, string user)
+ {
+ DataSet ds;
+ try
+ {
+ //鍒犻櫎鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_ItemMoney_Delete", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ if (string.IsNullOrWhiteSpace(HItemID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HItemID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ oCN.BeginTran();//寮�濮嬩簨鍔�
+
+ ds = oCN.RunProcReturn("select * from Gy_ItemMoney_1 where HItemID=" + HItemID, "Gy_ItemMoney_1");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜鍒犻櫎锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸茬鐢�!涓嶈兘杩涜鍒犻櫎锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ //鍒犻櫎鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Gy_ItemMoney_BeforeDelCtrl " + HItemID + ",'" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Gy_ItemMoney_BeforeDelCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ //==================================================================================
+
+
+ oCN.RunProc("delete Gy_ItemMoney_1 where HItemID=" + HItemID);
+
+
+ //鍒犻櫎鍚庢帶鍒�=========================================
+ string sql2 = "exec h_p_Gy_ItemMoney_AfterDelCtrl " + HItemID + ",'" + user + "'";
+ ds = oCN.RunProcReturn(sql2, "h_p_Gy_ItemMoney_AfterDelCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜锛氬垹闄ゅ悗鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ //==================================================================================
+
+ oCN.Commit();//鎻愪氦浜嬪姟
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏁版嵁鍒犻櫎鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
--
Gitblit v1.9.1