From 0549885dcaed25c47e4fee61d0fc980867810238 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期五, 07 六月 2024 11:29:11 +0800
Subject: [PATCH] 添加委外加工入库出库单接口
---
WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs | 207 ++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 194 insertions(+), 13 deletions(-)
diff --git a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
index 8360cc1..4a5c1dc 100644
--- a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -819,7 +819,7 @@
宸ヤ綔涓績 HCenterName,HSupID,渚涘簲鍟嗕唬鐮� HSupNumber,渚涘簲鍟� HSupName,isEntrust HSupFlag,璁″垝鏁伴噺 HQty,鍔犲伐鍗曚环 HOutPrice, 琛ㄤ綋澶囨敞 HRemark,
杩涚珯鍏宠仈鏁伴噺 HRelationQty_In,鍑虹珯鍏宠仈鏁伴噺 HRelationQty_Out,濮斿宸ュ崟鏁伴噺 HRelationQty_WWOrder,涓嶅悎鏍兼暟閲� HRelationQty_Bad,瓒呴姣斾緥 HOverRate,
鑹巼 HPassRate,绱鑹巼 HSumPassRate,鍥剧焊缂栧彿 HPicNum,鏈伐搴忕‘璁よ褰� HProcCheckNote,宸ヨ壓鍙傛暟 HTechnologyParameter,HDeptID,
- 鍔犲伐杞﹂棿浠g爜 HDeptNumber,鍔犲伐杞﹂棿 HDeptName,鍑虹珯鎶ュ簾鍏宠仈鏁伴噺 HRelationQty_OutBad
+ 鍔犲伐杞﹂棿浠g爜 HDeptNumber,鍔犲伐杞﹂棿 HDeptName,鍑虹珯鎶ュ簾鍏宠仈鏁伴噺 HRelationQty_OutBad,SN杩囩珯鎺у埗 HSNCtrl
from h_v_Sc_ProcessExchangeBillQuerySub");
ds = oCN.RunProcReturn(sql+ " where hmainid="+ HInterID + " order by cast(娴佹按鍙� as int) ", "h_v_Sc_ProcessExchangeBillQuerySub");
objJsonResult.code = "0";
@@ -838,9 +838,9 @@
}
#endregion
- #region [妯″叿淇濆吇璁″垝鍗曞垹闄ゅ姛鑳絔
+ #region [宸ュ簭娴佽浆鍗″垹闄ゅ姛鑳絔
/// <summary>
- /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳�
+ /// 宸ュ簭娴佽浆鍗″垹闄ゅ姛鑳�
/// </summary>
/// <returns></returns>
[Route("Sc_ProcessExchangeBill/DeltetProcessExchangeBillByID")]
@@ -877,14 +877,15 @@
DAL.ClsSc_ProcessExchangeBill oBill = new DAL.ClsSc_ProcessExchangeBill();
- string[] HBillNo = HInterID.Split(',');
+ string[] HInterIDs = HInterID.Split(',');
+ string[] HBillNos = new string[HInterIDs.Length];
string HBillNo_S = "";
- foreach (var item in HBillNo)
+ for (int i = 0; i < HInterIDs.Length; i++)
{
Int64 lngBillKey = 0;
- lngBillKey = DBUtility.ClsPub.isLong(item);
+ lngBillKey = DBUtility.ClsPub.isLong(HInterIDs[i]);
DBUtility.ClsPub.HOrgID = HPRDORGID;
if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
@@ -893,7 +894,7 @@
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "鍗曟嵁鍙�:"+ oBill .omodel.HBillNo+ "鍗曟嵁ID涓虹┖锛�";
+ objJsonResult.Message = "鍗曟嵁鍙�:" + oBill.omodel.HBillNo + "鍗曟嵁ID涓虹┖锛�";
objJsonResult.data = null;
return objJsonResult;
}
@@ -949,6 +950,7 @@
return objJsonResult;
}
HBillNo_S += oBill.omodel.HBillNo + ",";
+ HBillNos[i] = oBill.omodel.HBillNo;
}
else
{
@@ -961,17 +963,18 @@
}
HBillNo_S = HBillNo_S.Substring(0, HBillNo_S.Length - 1);
- LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鍒犻櫎宸ュ簭娴佽浆鍗″崟鎹�:" + HBillNo_S);
oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鍒犻櫎宸ュ簭娴佽浆鍗″崟鎹細" + HBillNo_S + "','LMES-宸ュ簭娴佽浆鍗℃ā鍧�','" + DBUtility.ClsPub.IPAddress + "','鍒犻櫎鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
- foreach (var item in HBillNo)
+ for (int i = 0; i < HInterIDs.Length; i++)
{
oCN.BeginTran();
- if (HSouceBillType == "SUB") {
- ds = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillMain where HInterID=" + item, "Sc_ProcessExchangeBillMain");
+ if (HSouceBillType == "SUB")
+ {
+ ds = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillMain where HInterID=" + HInterIDs[i], "Sc_ProcessExchangeBillMain");
- if (ds.Tables[0].Rows.Count == 0) {
+ if (ds.Tables[0].Rows.Count == 0)
+ {
oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -983,7 +986,31 @@
oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=0 where HInterID=" + ds.Tables[0].Rows[0]["HMainSourceInterID"].ToString() + " and HEntryID=" + ds.Tables[0].Rows[0]["HMainSourceEntryID"].ToString());
}
- bool IsDete = oBill.DeleteBill(long.Parse(item), ref DBUtility.ClsPub.sExeReturnInfo);
+ //鍒犻櫎鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Sc_ProcessExchangeBill_BeforeDelCtrl " + HInterIDs[i] + ",'" + HBillNos[i] + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sc_ProcessExchangeBill_BeforeDelCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ //==================================================================================
+
+ bool IsDete = oBill.DeleteBill(long.Parse(HInterIDs[i]), HBillNos[i], "h_p_Sc_ProcessExchangeBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
if (!IsDete)
{
@@ -994,6 +1021,8 @@
objJsonResult.data = null;
return objJsonResult;
}
+
+
oCN.Commit();
}
@@ -1626,6 +1655,158 @@
}
#endregion
+ #region 宸ュ簭娴佽浆鍗� 浣滃簾/鍙嶄綔搴�
+ /// <summary>
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="IsAudit">浣滃簾(0),鍙嶄綔搴�(1)</param>
+ /// <param name="CurUserName">浣滃簾浜�</param>
+ /// <returns></returns>
+ [Route("Sc_ProcessExchangeBill/DeleteSc_ProcessExchangeBill")]
+ [HttpGet]
+ public object DeleteSc_ProcessExchangeBill(int HInterID, int IsAudit, string CurUserName)
+ {
+ string ModRightNameCheck = "Sc_ProcessExchangeBill_Delete";
+ DBUtility.ClsPub.CurUserName = CurUserName;
+ try
+ {
+ //妫�鏌ユ潈闄�
+ if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "浣滃簾澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //HInterID鏁版嵁鍒ゆ柇
+ if (HInterID <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID灏忎簬0锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ Int64 lngBillKey = 0;
+ lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+ DAL.ClsSc_ProcessExchangeBill oBill = new DAL.ClsSc_ProcessExchangeBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+ ////閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+ //if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+ //{
+ // if (oBill.omodel.HChecker.Trim() != "")
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾锛�";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ // }
+ // if (IsAudit == 0) //浣滃簾鍒ゆ柇
+ // {
+ // if (oBill.omodel.HDeleteMan.Trim() != "")
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶄綔搴燂紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ // }
+ // }
+ // if (IsAudit == 1) //鍙嶄綔搴熷垽鏂�
+ // {
+ // if (oBill.omodel.HDeleteMan.Trim() == "")
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸弽浣滃簾锛�";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ // }
+ // }
+ //}
+ //else
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
+
+ //杩涜闇�瑕佽繘琛岀殑浣滃簾/鍙嶄綔搴熸搷浣�
+ if (IsAudit == 0) //浣滃簾鎻愪氦
+ {
+ //浣滃簾鎻愪氦
+ if (oBill.Cancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "浣滃簾鎴愬姛";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsAudit == 1) //鍙嶅叧闂彁浜�
+ {
+ //鍙嶅叧闂彁浜�
+ oBill.oCn.BeginTran();
+ if (oBill.AbandonCancelltion(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+
+ //鎺у埗鍏宠仈鏁伴噺,鍒ゆ柇鍙嶅叧闂悗锛岀敓浜ц鍗曚笅鎺ㄦ祦杞崱鎬绘暟鏄惁瓒呰繃璁″垝鏁伴噺
+ ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBill_Checkqty " + lngBillKey, "h_p_Sc_ProcessExchangeBill_Checkqty");
+ if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
+ objJsonResult.data = null;
+
+ oBill.oCn.RollBack();
+ return objJsonResult;
+ }
+
+ oBill.oCn.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶄綔搴熸垚鍔�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "浣滃簾澶辫触鎴栬�呭弽浣滃簾澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
#region 鍗曟嵁鍙樻洿 椤甸潰鍒濆鍖�
[Route("Sc_ProcessExchangeBill/GetProcessExchangeBillMain_Change_init")]
--
Gitblit v1.9.1