From 377fa7f01680feb02a5e1305acac68eb79b124b3 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期五, 20 十二月 2024 13:51:46 +0800
Subject: [PATCH] 开完工增加班次字段 报工台根据源单查询数据增加工序查出

---
 WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs |  200 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 190 insertions(+), 10 deletions(-)

diff --git a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
index 3cba9db..08d95d3 100644
--- a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
+++ b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
@@ -379,14 +379,16 @@
                 }
 
 
+                if (oSystemParameter.omodel.WMS_CampanyName == "涔斾竴")
+                {
+                    //鏄惁鍕鹃�夐粯璁ゅ伐鑹鸿矾绾�
+                    if (HStandard)
+                    {
+                        //璁剧疆榛樿宸ヨ壓璺嚎
+                        oCN.RunProc("exec h_p_Gy_RoutingBillCheck " + HInterID + ",'" + user + "'");
+                    }
+                }
 
-                //鏄惁鍕鹃�夐粯璁ゅ伐鑹鸿矾绾�
-                //if (HStandard)
-                //{
-                //    //璁剧疆榛樿宸ヨ壓璺嚎
-                //    oCN.RunProc("exec h_p_Gy_RoutingBillCheck " + HInterID + ",'" + user + "'");
-                //}
-             
                 //鍒ゆ柇鏄惁閲嶅宸ュ簭鍙�
                 ds = oCN.RunProcReturn("exec h_p_Gy_RoutingCtrl " + HInterID, "h_p_Gy_RoutingCtrl");
 
@@ -1348,6 +1350,16 @@
                 var ds = oCN.RunProcReturn("select * from Gy_RoutingBillMain where HInterID=" + HInterID, "Gy_RoutingBillMain");
                 if (ds.Tables[0].Rows.Count > 0)
                 {
+                    string HBillStatus = Convert.ToString(ds.Tables[0].Rows[0]["HBillStatus"]);
+                    //string hdeleteman = Convert.ToString(ds.Tables[0].Rows[0]["hdeleteman"]);
+                    if (HBillStatus == "6")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁鍦ㄥ鏍镐腑,涓嶈兘鍏抽棴锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                     if (IsAudit == 0)  //鍏抽棴鍒ゆ柇
                     {
                         if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
@@ -1623,10 +1635,11 @@
                     return objJsonResult;
                 }
                 //鎼滅储闇�瑕佸鏍哥殑
-                string sql = "  select DISTINCT a.*,c.HItemID as HCheckFlowStatusID,m.HName as 瀹℃壒娴�,c.HCheckFlowID,i.HName as 瀹℃壒椤圭洰鍚嶇О,c.HCheckItemID,c.HChecker as 椤圭洰瀹℃牳浜�,c.HCheckNote as 瀹℃壒娴佸鏍稿缓璁�,c.HCheckDate 瀹℃壒娴佸鏍告棩鏈�   from h_v_Gy_RoutingBillList AS a LEFT JOIN Xt_BillCheckFlowStatus AS c ON a.hmainid = c.HBillInterID and a.鍗曟嵁绫诲瀷 = c.HBillTypeID" +
+                string sql = "select TOP 1000 a.*,c.HItemID as HCheckFlowStatusID,m.HName as 瀹℃壒娴�,c.HCheckFlowID,i.HName as 瀹℃壒椤圭洰鍚嶇О,c.HCheckItemID,c.HChecker as 椤圭洰瀹℃牳浜�,c.HCheckNote as 瀹℃壒娴佸鏍稿缓璁�,c.HCheckDate 瀹℃壒娴佸鏍告棩鏈�   from h_v_Gy_RoutingBillList AS a LEFT JOIN Xt_BillCheckFlowStatus AS c ON a.hmainid = c.HBillInterID and a.鍗曟嵁绫诲瀷 = c.HBillTypeID" +
                     " LEFT JOIN Xt_CheckFlowMain as m ON m.HInterID = c.HCheckFlowID" +
                     " LEFT JOIN Xt_CheckItem as i ON i.HItemID = c.HCheckItemID" +
-                    " where 宸ュ簭浠g爜 != '9999' and a.HBillSubType<>'SUB' and c.HCheckDate is  not NUll and c.HChecker = '" + user + "'";
+                    " where 宸ュ簭浠g爜 != '9999' and a.HBillSubType<>'SUB' and c.HCheckDate is  not NUll and c.HChecker = '" + user + "'"+ 
+                    " ORDER BY a.hmainid DESC;";
                 ds = oCN.RunProcReturn(sql, "h_v_Gy_RoutingBillList");
                 foreach (DataColumn col in ds.Tables[0].Columns)
                 {
@@ -2046,6 +2059,17 @@
                             objJsonResult.count = CountConstant.SUCCEED;
                             objJsonResult.Message = "瀹℃牳鎴愬姛";
                             objJsonResult.data = null;
+                            //鑾峰彇绯荤粺鍙傛暟
+                            string Ret = "";
+                            if (oSystemParameter.ShowBill(ref Ret))
+                            {
+                                //鍒ゆ柇瀹㈡埛
+                                if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧") //绯荤粺鍙傛暟                      
+                                {
+                                    //鍒锋柊榛樿宸ヨ壓璺嚎
+                                    oCN.RunProc("exec h_p_Gy_RoutingBillCheck " + HInterID + ",'" + CurUserName + "'");
+                                }
+                            }
                         }
                         else
                         {
@@ -2301,7 +2325,7 @@
                     return objJsonResult;
                 }
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
-                ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList  where 瀹氶绫诲瀷 = '涓存椂瀹氶' and 澶辨晥鏃堕棿 BETWEEN DATEADD(DAY, -15, GETDATE()) AND GETDATE() " + sWhere + " order by hmainid desc", "h_v_Gy_RoutingBillList");
+                ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList  where 瀹氶绫诲瀷 = '涓存椂瀹氶' and 鐘舵��!= '鍏抽棴' and 澶辨晥鏃堕棿 BETWEEN  CAST(GETDATE() AS DATE) AND DATEADD(DAY, 15, GETDATE()) " + sWhere + " order by hmainid desc", "h_v_Gy_RoutingBillList");
                 foreach (DataColumn col in ds.Tables[0].Columns)
                 {
                     Type dataType = col.DataType;
@@ -2379,5 +2403,161 @@
         }
         #endregion
 
+        #region 宸ヨ壓璺嚎 鎵归噺椹冲洖
+        [Route("Gy_Routing/RejectAllCheckFlow")]
+        [HttpGet]
+        public object RejectAllCheckFlow(string HInterIDS,string CurUserID)
+        {
+            try
+            {
+                //澶勭悊瀛楃涓�
+                if (!string.IsNullOrEmpty(HInterIDS))
+                {
+                    int[] idArray = Array.ConvertAll(HInterIDS.Split(','), int.Parse);
+                    // 澶勭悊idArray...
+                    for (int i = 0; i < idArray.Length; i++)
+                    {
+                        objJsonResult = (json)RejectCheckFlow(idArray[i].ToString(),CurUserID);//瀹℃牳鎵ц
+                        if (objJsonResult.count == 0)
+                        {
+                            objJsonResult.Message += "绗�" + (i + 1) + "琛屽嚭鐜伴棶棰樻棤娉曠户缁畬鎴�";
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "璇烽�夋嫨姝g‘琛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                objJsonResult.code = CodeConstant.SUCCEED;
+                objJsonResult.count = CountConstant.SUCCEED;
+                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 宸ヨ壓璺嚎鎾ゅ洖
+        [Route("Gy_Routing/WithdrawCheckFlow")]
+        [HttpGet]
+        public object WithdrawCheckFlow(string HInterID, string user)
+        {
+            try
+            {
+                Int64 lngBillKey = 0;
+                lngBillKey = DBUtility.ClsPub.isLong(HInterID);      //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+                DAL.ClsGy_RoutingBill oBill = new DAL.ClsGy_RoutingBill();                              //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+                //鑾峰彇绯荤粺鍙傛暟鍒ゆ柇宸ヨ壓璺嚎鏄惁鍚敤澶氱骇瀹℃壒绂佺敤
+                Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+                string sReturn = "";
+                if (oSystemParameter.ShowBill(ref sReturn) == true)
+                {
+                    if (oSystemParameter.omodel.Gy_RoutingBill_EnableMultiLevel.ToUpper() == "N") //绯荤粺鍙傛暟  鏈惎鐢ㄨ嚜鍔ㄥ鏍� 
+                    {
+                        objJsonResult.code = CodeConstant.FAIL;
+                        objJsonResult.count = CountConstant.FAIL;
+                        objJsonResult.Message = "宸ヨ壓璺嚎鏈惎鐢ㄥ绾у鎵圭鐢�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))                    //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+                {
+                    if (oBill.omodel.HBillStatus != 6)
+                    {
+                        objJsonResult.code = CodeConstant.FAIL;
+                        objJsonResult.count = CountConstant.FAIL;
+                        objJsonResult.Message = "鍗曟嵁鏈湪瀹℃牳涓笉鑳芥挙鍥�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Edit", 1, false, user))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "宸ヨ壓璺嚎鏃犳潈闄愭挙鍥�!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = CodeConstant.FAIL;
+                    objJsonResult.count = CountConstant.FAIL;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //鍒ゆ柇鏄惁瀛樺湪瀹℃牳杩囩殑椤圭洰
+                string sql0 = "select * from Xt_BillCheckFlowStatus where HBillInterID = " + lngBillKey + " and HBillTypeID = '" + oBill.BillType + "' and ISNULL(HChecker,'') <> ''";
+                DataSet ds0 = oCN.RunProcReturn(sql0, "Xt_BillCheckFlowStatus");
+                if (ds0 != null && ds0.Tables[0].Rows.Count == 0)
+                {
+                    oCN.BeginTran();
+                    //鑾峰彇闇�瑕侀┏鍥炵殑瀹℃牳椤圭洰
+                    string sql1 = "select c.* from Xt_CheckFlowMain as a " +
+                                  "inner join Xt_CheckFlowSub as b on a.HInterID = b.HInterID " +
+                                  "inner join Xt_BillCheckFlowStatus as c on a.HBillTypeID = c.HBillTypeID and b.HCheckItemID = c.HCheckItemID " +
+                                  "where c.HBillTypeID = '" + this.BillType + "' and c.HBillInterID = " + lngBillKey + " " +
+                                  "order by b.HFlowNo asc";
+                    DataSet ds1= oCN.RunProcReturn(sql1, "Xt_BillCheckFlowStatus");
+                    if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
+                    {
+                        sReturn = "鎾ゅ洖澶辫触!鍘熷洜:鏈彂璧峰鎵癸紒锛�";
+                        return false;
+                    }
+                    //鑾峰彇褰撳墠瀹℃牳椤圭洰
+                    string HCheckFlowID = ds1.Tables[0].Rows[0]["HCheckFlowID"].ToString();             //瀹℃壒娴佸唴鐮�
+                    sql0 = "select * from Gy_RoutingBillMain " + " where HInterID = " + lngBillKey;
+                    ds0 = oCN.RunProcReturn(sql0, "Gy_RoutingBillMain");
+                    string HCheckItemNowID = ds0.Tables[0].Rows[0]["HCheckItemNowID"].ToString();       //褰撳墠瀹℃壒椤圭洰鍐呯爜
+                    //鏇存柊 椹冲洖鍒犻櫎瀹℃牳娴佺姸鎬佽〃
+                    string sql02 = "Delete Xt_BillCheckFlowStatus where HBillTypeID = '" + this.BillType + "' and HBillInterID=" + lngBillKey + " and HCheckFlowID=" + HCheckFlowID;
+                    oCN.RunProc(sql02);
+                    oCN.RunProc(" Update Gy_RoutingBillMain" + " set HChecker='',HCheckDate=null,HBillStatus=1,HCheckItemNowID = 0,HCheckItemNextID = 0 Where HInterID=" + lngBillKey.ToString());
+                    oCN.Commit();
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鎾ゅ洖鎴愬姛锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult; ;
+                }
+                else
+                {
+                    objJsonResult.code = CodeConstant.FAIL;
+                    objJsonResult.count = CountConstant.FAIL;
+                    objJsonResult.Message = "鎾ゅ洖澶辫触!鍘熷洜:鍗曟嵁瀛樺湪宸茬粡瀹℃牳鐨勯」鐩紒锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                objJsonResult.code = CodeConstant.FAIL;
+                objJsonResult.count = CountConstant.FAIL;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1