From 10310e5258249ff7c77f4575bda809131952cde3 Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期五, 15 十月 2021 10:03:56 +0800
Subject: [PATCH] 直接调拨
---
WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs | 371 ++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 356 insertions(+), 15 deletions(-)
diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs
index 5707fd9..0020535 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs
@@ -14,17 +14,14 @@
public class Cj_StationEntrustOutBillController : 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_StationEntrustOutBill/list")]
[HttpGet]
public object list(string sWhere)
@@ -67,12 +64,9 @@
return objJsonResult;
}
}
+ #endregion
- /// <summary>
- /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
- /// </summary>
+ #region 鏂板鍗曟嵁-淇濆瓨鎸夐挳
[Route("Cj_StationEntrustOutBill/AddBill")]
[HttpPost]
public object AddBill([FromBody] JObject oMain)
@@ -228,6 +222,7 @@
oCN.BeginTran();
if ("Add".Equals(eventType))
{
+ //楠岃瘉鍗曟嵁鍙锋槸鍚﹂噸澶�
if (!AllowbillNo(HBillNo))
{
oCN.RollBack();
@@ -323,6 +318,18 @@
oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID.ToString() + ",1");
oCN.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_Out " + HInterID.ToString() + ",1");
oCN.Commit();
+ string sReturn = "";
+ if (oSystemParameter.ShowBill(ref sReturn) == true)
+ {
+ if (oSystemParameter.omodel.MES_StationEntrustOutBill_SaveAutoAddnew == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳
+ {
+ objJsonResult.Verify = "Y";
+ }
+ else
+ {
+ objJsonResult.Verify = "N";
+ }
+ }
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�";
@@ -338,6 +345,8 @@
return objJsonResult;
}
}
+
+ //楠岃瘉鍗曟嵁鍙锋槸鍚﹂噸澶�
private bool AllowbillNo(string HBillNo)
{
ds = oCN.RunProcReturn("select HBillNo from Sc_StationOutBillMain where HBillNo = '" + HBillNo + "'", "Sc_StationOutBillMain");
@@ -347,11 +356,9 @@
}
return false;
}
- /// <summary>
- /// 缂栬緫椤甸潰鏍规嵁id鑾峰彇濮斿宸ュ簭鎺ユ敹鍗曚俊鎭�
- ///鍙傛暟锛歴tring sql銆�
- ///杩斿洖鍊硷細object銆�
- /// </summary>
+ #endregion
+
+ #region 缂栬緫椤甸潰鏍规嵁id鑾峰彇濮斿宸ュ簭鎺ユ敹鍗曚俊鎭�
[Route("Cj_StationEntrustOutBill/GetStationEntrustOutBill")]
[HttpGet]
public object GetStationEntrustOutBill(int HInterID)
@@ -385,6 +392,7 @@
return objJsonResult;
}
}
+ #endregion
#region 鏍规嵁id鍒犻櫎濮斿鎺ユ敹鍗�
[Route("Cj_StationEntrustOutBill/del_StationEntrustOutBill")]
@@ -482,6 +490,339 @@
}
}
#endregion
+
+ #region 缂栬緫鍓嶅垽鏂�
+ [Route("Cj_StationEntrustOutBill/set_ShowBillJudge")]
+ [HttpGet]
+ public object set_ShowBillJudge(string HBillNo, string CurUserName, long HInterID)
+ {
+ try
+ {
+ ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_DelCtrl '" + HBillNo + "'", "h_p_MES_StationOutBill_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_StationEntrustOutBill_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_StationEntrustOutBill BillOld = new DAL.ClsSc_StationEntrustOutBill();
+ 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_StationEntrustOutBill/set_CheckBill")]
+ [HttpGet]
+ public object set_CheckBill(int HInterID, string CurUserName)
+ {
+ try
+ {
+ //string ModRightNameCheck = "MES_StationEntrustOutBill_Check";
+ ////瀹℃牳鏉冮檺
+ //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 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_StationEntrustOutBill oBill = new DAL.ClsSc_StationEntrustOutBill();
+ //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
+ 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_StationEntrustOutBillCheckBill(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_StationEntrustOutBillCheckBill(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_StationOutBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_StationOutBillMain");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ sReturn = "鍗曟嵁鏈壘鍒帮紒";
+ return false;
+ }
+ oCN.RunProc(" Update Sc_StationOutBillMain set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString());
+ oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Check_Out " + lngBillKey.ToString() + ",1");
+ //鍒ゆ柇鏄惁鏄� 鏈亾宸ュ簭
+ DataSet ds1;
+ ds1 = oCN.RunProcReturn(" select HLastProc,HFstProc from Sc_ProcessExchangeBillMain a " +
+ " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID " +
+ " Where a.HInterID=(Select HProcExchInterID from Sc_StationOutBillMain Where HInterID=" + lngBillKey + ") " +
+ " and b.HEntryID=(Select HProcExchEntryID from Sc_StationOutBillMain Where HInterID=" + lngBillKey + ")", "Sc_ProcessExchangeBillMain");
+ if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
+ {
+ }
+ else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "鏄�")
+ {
+ }
+ sReturn = sReturn + " 瀹℃牳鍔熻兘锛�";
+ oCN.Commit();
+ return true;
+ }
+ catch (Exception e)
+ {
+ sReturn = e.Message;
+ oCN.RollBack();
+ return false; ;
+ }
+ }
+ #endregion
+
+ #region 鍙嶅鏍�
+ [Route("Cj_StationEntrustOutBill/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_StationEntrustOutBill oBill = new DAL.ClsSc_StationEntrustOutBill();
+ //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
+ 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_StationEntrustOutBillAbandonCheckBill(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_StationEntrustOutBillAbandonCheckBill(Int64 lngBillKey, string CurUserName, ref string sReturn)
+ {
+ if (Cj_StationEntrustOutBillisUse(lngBillKey, ref sReturn))
+ {
+ return false;
+ }
+ try
+ {
+ string HChecker = CurUserName;
+ string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
+ oCN.BeginTran();
+ ds = oCN.RunProcReturn("Select * from Sc_StationOutBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_StationOutBillMain");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ sReturn = "鍗曟嵁鏈壘鍒帮紒";
+ return false;
+ }
+
+ oCN.RunProc(" Update Sc_StationOutBillMain set HChecker='',HCheckDate=null Where HInterID=" + lngBillKey.ToString());
+ oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Check_Out " + lngBillKey.ToString() + ",-1");
+ //鍒ゆ柇鏄惁鏄� 棣栭亾宸ュ簭
+ DataSet ds1;
+ ds1 = oCN.RunProcReturn("select HLastProc,HFstProc " +
+ " from Sc_ProcessExchangeBillMain a " +
+ " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID " +
+ " Where a.HInterID=(Select HProcExchInterID from Sc_StationOutBillMain Where HInterID=" + lngBillKey + ") " +
+ " and b.HEntryID=(Select HProcExchEntryID from Sc_StationOutBillMain Where HInterID=" + lngBillKey + ")", "Sc_ProcessExchangeBillMain");
+ if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
+ {
+ }
+ else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "鏄�")
+ {
+ }
+ sReturn = sReturn + "鍙嶅鏍稿姛鑳斤紒";
+ oCN.Commit();
+ return true;
+ }
+ catch (Exception e)
+ {
+ sReturn = e.Message;
+ oCN.RollBack();
+ return false; ;
+ }
+ }
+
+ //鏄惁琚叧鑱�
+ public bool Cj_StationEntrustOutBillisUse(Int64 lngBillKey, ref string sReturn)
+ {
+ try
+ {
+ //鏌ヨ涓昏〃
+ DataSet Ds;
+ Ds = oCN.RunProcReturn("Select HinterID from Sc_StationOutBillSub Where HInterID=" + lngBillKey.ToString() + " and isnull(HRelationQty,0)<>0 ", "Sc_StationOutBillSub");
+ if (Ds.Tables[0].Rows.Count != 0)
+ {
+ sReturn = "鍗曟嵁宸茶鍏宠仈,涓嶈兘鎿嶄綔锛�";
+ return true;
+ }
+ sReturn = "";
+ return false;
+ }
+ catch (Exception e)
+ {
+ sReturn = e.Message;
+ throw (e);
+ }
+ }
+ #endregion
//
}
}
\ No newline at end of file
--
Gitblit v1.9.1