From f269c61bc0ebc13dcf1351cfaf7233e2fa72890e Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期二, 12 十月 2021 14:42:22 +0800
Subject: [PATCH] 器具退库单 往来单位
---
WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs | 427 +++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 399 insertions(+), 28 deletions(-)
diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
index 63a3916..db60c68 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
@@ -14,17 +14,14 @@
public class Cj_StationEntrustInBillController : ApiController
{
public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+ Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
private json objJsonResult = new json();
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
DataSet ds;
- /// <summary>
- /// 杩斿洖濮斿宸ュ簭鍙戝嚭鍗曞垪琛�
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
- /// </summary>
+ #region 杩斿洖濮斿宸ュ簭鍙戝嚭鍗曞垪琛�
[Route("Cj_StationEntrustInBill/list")]
[HttpGet]
public object list(string sWhere)
@@ -33,11 +30,11 @@
{
if (sWhere == null || sWhere.Equals(""))
{
- ds = oCN.RunProcReturn("select * from h_v_MES_StationEntrustInBillList " + sWhere, "h_v_MES_StationEntrustInBillList");
+ ds = oCN.RunProcReturn("select * from h_v_MES_StationEntrustInBillList " + sWhere+ " order by 鍙戝嚭鏃堕棿 desc", "h_v_MES_StationEntrustInBillList");
}
else
{
- string sql1 = "select * from h_v_MES_StationEntrustInBillList where 1 = 1 ";
+ string sql1 = "select * from h_v_MES_StationEntrustInBillList where 1 = 1 order by 鍙戝嚭鏃堕棿 desc";
string sql = sql1 + sWhere;
ds = oCN.RunProcReturn(sql, "h_v_MES_StationEntrustInBillList");
}
@@ -67,12 +64,9 @@
return objJsonResult;
}
}
+ #endregion
- /// <summary>
- /// 濮斿宸ュ簭鍙戝嚭鍗曟祦姘村彿鍥炶溅鑾峰彇娴佽浆鍗′俊鎭紙濮斿宸ュ簭鎺ユ敹銆佸伐搴忚繘绔欐帴鏀堕�氱敤锛�
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
- /// </summary>
+ #region 濮斿宸ュ簭鍙戝嚭鍗曟祦姘村彿鍥炶溅鑾峰彇娴佽浆鍗′俊鎭紙濮斿宸ュ簭鎺ユ敹銆佸伐搴忚繘绔欐帴鏀堕�氱敤锛�
[Route("Cj_StationEntrustInBill/txtHBarCode_KeyDown")]
[HttpGet]
public object txtHBarCode_KeyDown(string HBarCode)
@@ -122,12 +116,9 @@
return objJsonResult;
}
}
+ #endregion
- /// <summary>
- /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
- /// </summary>
+ #region 鏂板鍗曟嵁-淇濆瓨鎸夐挳
[Route("Cj_StationEntrustInBill/AddBill")]
[HttpPost]
public object AddBill([FromBody] JObject oMain)
@@ -342,6 +333,18 @@
oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_In " + HInterID.ToString() + ",1");
oCN.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_In " + HInterID.ToString() + ",1");
oCN.Commit();
+ string sReturn = "";
+ if (oSystemParameter.ShowBill(ref sReturn) == true)
+ {
+ if (oSystemParameter.omodel.MES_StationEntrustInBill_SaveAutoAddnew == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳
+ {
+ objJsonResult.Verify = "Y";
+ }
+ else
+ {
+ objJsonResult.Verify = "N";
+ }
+ }
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
@@ -367,12 +370,9 @@
}
return false;
}
+ #endregion
- /// <summary>
- /// 缂栬緫椤甸潰鏍规嵁id鑾峰彇濮斿宸ュ簭鎺ユ敹鍗曚俊鎭�
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
- /// </summary>
+ #region 缂栬緫椤甸潰鏍规嵁id鑾峰彇濮斿宸ュ簭鎺ユ敹鍗曚俊鎭�
[Route("Cj_StationEntrustInBill/GetStationEntrustInBill")]
[HttpGet]
public object GetStationEntrustInBill(int HInterID)
@@ -406,13 +406,9 @@
return objJsonResult;
}
}
+ #endregion
-
- /// <summary>
- /// 濮斿宸ュ簭鍙戝嚭鍗曟祦姘村彿鍥炶溅鑾峰彇宸ュ簭淇℃伅
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
- /// </summary>
+ #region 濮斿宸ュ簭鍙戝嚭鍗曟祦姘村彿鍥炶溅鑾峰彇宸ュ簭淇℃伅
[Route("Cj_StationEntrustInBill/txtHProcNo_KeyDown")]
[HttpGet]
public object txtHProcNo_KeyDown(string sBillNo, string sProcNo)
@@ -455,10 +451,385 @@
return objJsonResult;
}
}
+ #endregion
+ #region 缂栬緫鍓嶅垽鏂�
+ [Route("Cj_StationEntrustInBill/set_ShowBillJudge")]
+ [HttpGet]
+ public object set_ShowBillJudge(string HBillNo, string CurUserName,long HInterID)
+ {
+ try
+ {
+ //ds = oCN.RunProcReturn("exec h_p_MES_StationInBill_DelCtrl '" + HBillNo + "'", "h_p_MES_StationInBill_DelCtrl");
+ //if (ds == null || ds.Tables[0].Rows.Count == 0)
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鍒ゆ柇鍏宠仈澶辫触锛�";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+ //else if (ds.Tables[0].Rows.Count > 0 && Pub_Class.ClsPub.isInt(ds.Tables[0].Rows[0][0]) == 2)
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]);
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+ //鍒ゆ柇鏉冮檺
+ if (!ClsPub.Security_Log("MES_StationEntrustInBill_Edit", 1, true, CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ ////鍒ゆ柇璇ョ敤鎴峰悕鏄惁鏈夎宸ョ珯鏉冮檺
+ //if (BillNew.CheckCenterIDByUser(DBUtility.ClsPub.isLong(66865)) == false)
+ //{
+ // MessageBox.Show("娌℃湁璇ュ伐绔欐潈闄愶紒", "鎻愮ず");
+ // return;
+ //}
+ ////妫�鏌ユ槸鍚﹀紑绁�
+ //string d = "";
+ //if (BillOld.CheckIsKP(BillOld.omodel.HInterID, ref d) == false)
+ //{
+ // MessageBox.Show(d, "鎻愮ず");
+ // return;
+ //}
+ string s = "";
+ DAL.ClsSc_StationEntrustInBill BillOld = new DAL.ClsSc_StationEntrustInBill();
+ if (BillOld.ShowBill(HInterID, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹湁閿欒锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍒ゆ柇鏄惁鍙紪杈�
+ if (BillOld.omodel.HChecker != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #region 瀹℃牳
+ [Route("Cj_StationEntrustInBill/set_CheckBill")]
+ [HttpGet]
+ public object set_CheckBill(int HInterID, string CurUserName)
+ {
+ try
+ {
+ //瀹℃牳鏉冮檺
+ //if (!DBUtility.ClsPub.Security_Log("MES_StationEntrustInBill_Check", 1, true, CurUserName))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+ if (HInterID == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁ID涓�0锛屼笉鑳藉鏍革紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ DAL.ClsSc_StationEntrustInBill oBill = new DAL.ClsSc_StationEntrustInBill();
+ //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
+ if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ if (oBill.omodel.HChecker.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 (Cj_StationEntrustInBillCheckBill(HInterID, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ 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;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ //瀹℃牳
+ public bool Cj_StationEntrustInBillCheckBill(Int64 lngBillKey, string CurUserName, ref string sReturn)
+ {
+ try
+ {
+ string HChecker = CurUserName;
+ string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
+ oCN.BeginTran();
+ ds = oCN.RunProcReturn("Select * from Sc_StationInBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_StationInBillMain");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ sReturn = "鍗曟嵁鏈壘鍒帮紒";
+ return false;
+ }
+
+ oCN.RunProc(" Update Sc_StationInBillMain set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString());
+ oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Check_In " + lngBillKey.ToString() + ",1");
+ sReturn = sReturn + " 瀹℃牳鍔熻兘锛�";
+ oCN.Commit();
+ return true;
+ }
+ catch (Exception e)
+ {
+ sReturn = e.Message;
+ oCN.RollBack();
+ return false; ;
+ }
+ }
+ #endregion
+
+ #region 鍙嶅鏍�
+ [Route("Cj_StationEntrustInBill/set_AbandonCheck")]
+ [HttpGet]
+ public object set_AbandonCheck(int HInterID, string CurUserName)
+ {
+ try
+ {
+ if (HInterID == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁ID涓�0锛屼笉鑳藉弽瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ DAL.ClsSc_StationEntrustInBill oBill = new DAL.ClsSc_StationEntrustInBill();
+ //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
+ if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ if (oBill.omodel.HChecker.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 (Cj_StationEntrustInBillAbandonCheckBill(HInterID, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ 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;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅鏍稿け璐ワ紒" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ //鍙嶅鏍�
+ public bool Cj_StationEntrustInBillAbandonCheckBill(Int64 lngBillKey, string CurUserName, ref string sReturn)
+ {
+ try
+ {
+ string HChecker = CurUserName;
+ string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
+ oCN.BeginTran();
+ ds = oCN.RunProcReturn("Select * from Sc_StationInBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_StationInBillMain");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ sReturn = "鍗曟嵁鏈壘鍒帮紒";
+ return false;
+ }
+
+ oCN.RunProc(" Update Sc_StationInBillMain set HChecker='',HCheckDate=null Where HInterID=" + lngBillKey.ToString());
+ //oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Check_In " + lngBillKey.ToString() + ",-1");
+ sReturn = sReturn + "鍙嶅鏍稿姛鑳斤紒";
+ oCN.Commit();
+ return true;
+ }
+ catch (Exception e)
+ {
+ sReturn = e.Message;
+ oCN.RollBack();
+ return false; ;
+ }
+ }
+ #endregion
+
+ #region 鏍规嵁id鍒犻櫎濮斿鍙戝嚭鍗�
+ [Route("Cj_StationEntrustInBill/del_StationEntrustInBill")]
+ [HttpGet]
+ public object del_StationEntrustInBill(long HInterID, string HDeleteMan)
+ {
+ try
+ {
+
+ //缂栬緫鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("MES_StationEntrustInBill_Delete", 1, true, HDeleteMan))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ DAL.ClsSc_StationEntrustInBill oBill = new DAL.ClsSc_StationEntrustInBill();
+ if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ if (oBill.omodel.HMaker != HDeleteMan && (HDeleteMan != "admin" && HDeleteMan != "Admin"))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙兘鍒犻櫎鏈汉鐨勫崟鎹紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (oBill.omodel.HChecker != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+ DataSet ds;
+ //鍒ゆ柇鏄惁瀛樺湪 鐩稿悓鍗曟嵁鍙� 鐨勯鏂欏崟 鍒ゆ柇鐢熶骇璁㈠崟鏄惁宸茬粨妗堬紝瑕佹眰璁″垝鎵嬪伐鍙嶇粨妗�
+ ds = oCn.RunProcReturn("exec h_p_MES_StationInBill_DelCtrl '" + oBill.omodel.HBillNo + "'", "h_p_MES_StationInBill_DelCtrl");
+ if (ds == null)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒ゆ柇鍏宠仈澶辫触锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (ds.Tables[0].Rows.Count > 0 && Pub_Class.ClsPub.isInt(ds.Tables[0].Rows[0][0]) == 2)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鍐欏叆鍒犻櫎鏃ュ織
+ string WorkList = "鍒犻櫎濮斿鍙戝嚭鍗曪細" + oBill.omodel.HBillNo;
+ if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ 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;
+ }
+ }
+ #endregion
//
}
}
\ No newline at end of file
--
Gitblit v1.9.1