From 3aa566cefdfd26b701cfff1c77d050673c485637 Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期三, 08 九月 2021 08:32:46 +0800
Subject: [PATCH] 报工台上料防错扫码接口判断获取备料信息

---
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs |  296 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 295 insertions(+), 1 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index 8eb45d9..7fa0d79 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -465,7 +465,6 @@
         }
         #endregion
 
-
         #region  宸ュ簭鍑虹珯姹囨姤鍗曟枃浠朵笂浼犲鐞�
 
         [Route("Cj_StationOutBill/UploadFile1")]
@@ -759,6 +758,301 @@
         }
         #endregion
 
+        #region 缂栬緫鍓嶅垽鏂�
+        [Route("Cj_StationOutBill/set_ShowBillJudge")]
+        [HttpGet]
+        public object set_ShowBillJudge(string HBillNo)
+        {
+            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;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    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_StationOutBill/set_CheckBill")]
+        [HttpGet]
+        public object set_CheckBill(int HInterID, string CurUserName)
+        {
+            try
+            {
+                //string ModRightNameCheck = "MES_StationOutBill_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_StationOutBill oBill = new DAL.ClsSc_StationOutBill();
+                //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
+                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_StationOutBillCheckBill(HInterID, CurUserName, oBill.omodel.HLastSubProc, 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_StationOutBillCheckBill(Int64 lngBillKey, string CurUserName,bool HLastSubProc, 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_In " + 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 || HLastSubProc ==false)
+                {
+                }
+                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_StationOutBill/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_StationOutBill oBill = new DAL.ClsSc_StationOutBill();
+                //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
+                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_StationOutBillAbandonCheckBill(HInterID, CurUserName, oBill.omodel.HLastSubProc, 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_StationOutBillAbandonCheckBill(Int64 lngBillKey, string CurUserName, bool HLastSubProc, ref string sReturn)
+        {
+            if (Cj_StationInBillisUse(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_StationInBillisUse(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //鏌ヨ涓昏〃
+                DataSet Ds;
+                //Ds = oCN.RunProcReturn("Select HinterID from " + MvarItemKeySub + "  Where HInterID=" + lngBillKey.ToString() + " and isnull(HRelationQty,0)<>0 ", MvarItemKey);
+                //if (Ds.Tables[0].Rows.Count != 0)
+                //{
+                //    sReturn = "鍗曟嵁宸茶鍏宠仈,涓嶈兘鎿嶄綔锛�";
+                //    return true;
+                //}
+                sReturn = "";
+                return false;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+        #endregion
+
         //鎵归噺鍑虹珯
         #region 鎵归噺鍑虹珯妯″潡杩斿洖鏄庣粏淇℃伅鍒楄〃
         [Route("Cj_StationOutBill/get_BarCodeDetail")]

--
Gitblit v1.9.1