From 02ba47f5a081fcfe6d7ea3a829769db5bf8b2c2b Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期一, 24 七月 2023 13:32:33 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs |  156 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 147 insertions(+), 9 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
index eec616b..2940b96 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
@@ -16,7 +16,7 @@
     {
         public DBUtility.ClsPub.Enum_BillStatus BillStatus;
         Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
-
+        public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
         private json objJsonResult = new json();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         DataSet ds;
@@ -164,20 +164,51 @@
                     NewBarCode = sBillBarCode.Split(Convert.ToChar("#"));
                     sBillBarCode = NewBarCode[0];
                 }
-                string sBillNo = sBillBarCode;
-                //鎴彇鏉$爜绫诲瀷
-                string BillNoType = sBillNo.Substring(0, Math.Min(3, sBillNo.Length));
-                //鎴彇鏉$爜绫诲瀷2
-                string BillNoType2 = sBillNo.Substring(0, Math.Min(4, sBillNo.Length));
+                string sBillNo = sBillBarCode; //鏉″舰鐮�
+
+                string[] arr = sBillNo.Split('&'); //浠ョ鍙封��&鈥欏垎鍓叉潯褰㈢爜
+                string BillNo_PGD = arr[0]; //鍗曟嵁鍙�
+                string entryid_PGD = "";//瀛恑d
+                if(arr.Length > 1)
+                {
+                    entryid_PGD = arr[1];
+                }
+
+                //鎴彇鏉$爜绫诲瀷 鍓嶄笁浣�
+                string BillNoType = BillNo_PGD.Substring(0, Math.Min(3, BillNo_PGD.Length));
+                //鎴彇鏉$爜绫诲瀷2 鍓嶅洓浣�
+                string BillNoType2 = BillNo_PGD.Substring(0, Math.Min(4, BillNo_PGD.Length));
                 //鎴彇鍐呯爜
-                string BillNo = sBillNo.Substring(3, Math.Min(sBillNo.Length - 3,sBillNo.Length));
+                string BillNo = BillNo_PGD.Substring(3, Math.Min(BillNo_PGD.Length - 3, BillNo_PGD.Length));
                 switch (BillNoType2)
                 {
                     case "GXLZ"://宸ュ簭娴佽浆娲惧伐
-                        ds = oCN.RunProcReturn("select * from h_v_Sc_ProcExchSendWorkBill  where 娲惧伐鍗曟嵁鍙� = '" + sBillNo + "'", "h_v_Sc_ProcExchSendWorkBill");
+                        ds = oCN.RunProcReturn("select * from h_v_Sc_ProcExchSendWorkBill  where 娲惧伐鍗曟嵁鍙� = '" + BillNo_PGD + "'" + " and HEntryID ='" + entryid_PGD + "'", "h_v_Sc_ProcExchSendWorkBill");
                         break;
                     case "GXLX"://娴佽浆鍗�
-                        ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList  where 鍗曟嵁鍙�= '" + sBillNo + "'", "h_v_Sc_ProcessExchangeBillList");
+                        string sErr = "";
+                        if (oSystemParameter.ShowBill(ref sErr))
+                        {
+                            if (oSystemParameter.omodel.WMS_CampanyName == "涔斾竴")
+                            { //绯荤粺鍙傛暟鏄惁涓哄彧鏄剧ず褰撳墠鐧诲綍鐢ㄦ埛鍏宠仈鐨勫伐搴忎俊鎭�,N涓哄惁锛孻涓烘槸
+                                if (oSystemParameter.omodel.MES_StationInBill_ShowUSERProcess == "Y")
+                                {
+                                    ds = oCN.RunProcReturn($"exec h_p_ProcessExchangeBillLastHProNo '{BillNo_PGD}','{UserID}','{HBillType}'", "h_v_Gy_ProcessList_GetProcNoByUser");
+                                }
+                                else
+                                {
+                                    ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList  where 鍗曟嵁鍙�= '" + BillNo_PGD + "'", "h_v_Sc_ProcessExchangeBillList");
+                                }
+                            }
+                            else if (entryid_PGD != "") //濡傛灉瀛恑d涓嶄负绌哄垯鍔犲叆瀛恑d杩囨护锛�
+                            {
+                                ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillList  where 鍗曟嵁鍙�= '" + BillNo_PGD + "'" + " and hsubid ='" + entryid_PGD + "'", "h_v_Sc_ProcessExchangeBillList");
+                            }
+                            else
+                            {
+                                ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList  where 鍗曟嵁鍙�= '" + BillNo_PGD + "'", "h_v_Sc_ProcessExchangeBillList");
+                            }
+                        }
                         break;
                 }
                 switch (BillNoType)
@@ -1103,6 +1134,113 @@
         }
         #endregion
 
+
+        #region 宸ュ簭濮斿鍙戝嚭鍗曞叧闂�/鍙嶅叧闂姛鑳�
+        [Route("Cj_StationEntrustInBill/CloseCj_StationEntrustInBill")]
+        [HttpGet]
+        public object CloseCj_StationEntrustInBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("MES_StationEntrustInBill_Close", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+                BillOld.MvarItemKey = "Sc_StationInBillMain";
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 鍏抽棴  2  鍙嶅叧闂�
+                if (Type == 1)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶉渶瑕佸啀鍏抽棴!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    //鍏抽棴鍗曟嵁
+                    if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂�
+                    DataSet ds;
+                    string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插弽鍏抽棴!涓嶉渶瑕佸啀鍙嶅叧闂�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    //鍙嶅叧闂崟鎹�
+                    if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        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;
+            }
+        }
+        #endregion
+
         #region 鏍规嵁id鍒犻櫎濮斿鍙戝嚭鍗�
         [Route("Cj_StationEntrustInBill/del_StationEntrustInBill")]
         [HttpGet]

--
Gitblit v1.9.1