From d34b37ef388bb384db07787df7f9856b5e410dd9 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期四, 06 六月 2024 15:28:29 +0800
Subject: [PATCH] 1.网页 增加 巡检单2 编辑模块 和 单据列表 模块; 2.生产计划排产 界面 , 增加 页签 缺料分析; 当 点击 日期的列名时, 页签 缺料分析 获取这一天的 缺料情况 复制一个 一模一样的 生产计划排产 界面出来, 命名为 半成品计划排产 。 菜单里 也增加出来。

---
 WebAPI/Controllers/CJGL/Cj_StationInBillController.cs |  172 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 166 insertions(+), 6 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
index 89276bf..6f5e9e6 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
@@ -468,6 +468,63 @@
         }
         #endregion
 
+        #region 宸ュ簭杩涚珯鎺ユ敹鍗曟祦姘村彿鍥炶溅 绯荤粺鍙傛暟鍒ゆ柇鏄惁缁戝畾閰嶄欢娓呭崟
+        [Route("Cj_StationInBill/MES_StationInBillSubBindSource")]
+        [HttpGet]
+        public object MES_StationInBillSubBindSource(string HInterID, string HProcExchInterID,string HProcExchEntryID)
+        {
+            try
+            {
+                //濡傛灉绯荤粺鍙傛暟鍚敤浜� 杩涚珯鍗曠粦瀹氶厤浠舵竻鍗曞垯 浠庣敓浜х敤鏂欐竻鍗曚腑鑾峰彇宸ュ簭BOM鍐欏叆 涓存椂琛紝骞跺姞杞借〃鏍�
+                Pub_Class.ClsXt_SystemParameter oParam = new ClsXt_SystemParameter();
+                string sIsBingLine = oParam.GetSingleSystemParameter("MES_StationInBill_LineBindCtl", ref DBUtility.ClsPub.sExeReturnInfo);
+                if (sIsBingLine.Trim() == "Y")
+                {
+                    oCN.RunProc("exec h_p_MES_StationInBillSubBindSource_Insert " + HProcExchInterID.ToString() + " , " + HProcExchEntryID.ToString() + "," + HInterID.ToString() + " ");
+
+                    ds = oCN.RunProcReturn($@"select * from
+(
+ select 
+a.HICMOInterID,a.HICMOEntryID,b.HProcID  
+from Sc_ProcessExchangeBillMain a with(nolock) 
+inner join Sc_ProcessExchangeBillSub b with(nolock)  on a.HInterID=b.HinterID
+Where a.HInterID={HProcExchInterID} and b.HEntryID={HProcExchEntryID}
+) a
+inner join (
+select a.HICMOInterID,a.HICMOEntryID, b.HProcID 
+from Sc_PPBomBillMain a with(nolock) 
+inner join Sc_PPBomBillSub b with(nolock)  on a.HInterID=b.HInterID
+Where b.HKeyMaterID_Line<>0
+)b on a.HICMOInterID=b.HICMOInterID and a.HICMOEntryID=b.HICMOEntryID and a.HProcID=b.HProcID", "Sc_ProcessExchangeBillMain");
+
+                    if (ds.Tables[0].Rows.Count > 0) {
+                        objJsonResult.Message = "闇�瑕佺粦瀹氶厤浠讹紒";
+                    }
+                    else
+                    {
+                        objJsonResult.Message = "涓嶉渶瑕佺粦瀹氶厤浠讹紒";
+                    }
+                }
+                else {
+                    objJsonResult.Message = "涓嶉渶瑕佺粦瀹氶厤浠讹紒";
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                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_StationInBill/txtHProcNo_KeyDown_qiaoyi")]
@@ -815,8 +872,31 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
+                //瀹℃牳鍓嶆帶鍒�
+                string HBillNo = oBill.omodel.HBillNo;
+                string sql = "exec h_p_Sc_StationInBill_BeforeCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
+                ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_BeforeCheckCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+
+                }
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 //瀹℃牳
-                if (Cj_StationInBillCheckBill(HInterID,CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
+                if (Cj_StationInBillCheckBill(HInterID, HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
                 {
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
@@ -845,7 +925,7 @@
         }
 
         //瀹℃牳
-        public bool Cj_StationInBillCheckBill(Int64 lngBillKey, string CurUserName, ref string sReturn)
+        public bool Cj_StationInBillCheckBill(Int64 lngBillKey,string HBillNo, string CurUserName, ref string sReturn)
         {
             try
             {
@@ -873,6 +953,23 @@
                 else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "鏄�")
                 {
                 }
+
+                //瀹℃牳鍚庢帶鍒�
+                string sql = "exec h_p_Sc_StationInBill_AfterCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'";
+                ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_AfterCheckCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    sReturn = "瀹℃牳杩囩▼涓嚭閿欙紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                    oCN.RollBack();
+                    return false;
+                }
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString();
+                    oCN.RollBack();
+                    return false;
+                }
+
                 sReturn = sReturn + " 瀹℃牳鍔熻兘锛�";
                 oCN.Commit();
                 return true;
@@ -949,8 +1046,31 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
+                //鍙嶅鏍稿墠鎺у埗
+                string HBillNo = oBill.omodel.HBillNo;
+                string sql = "exec h_p_Sc_StationInBill_BeforeUnCheckCtrl " + HInterID + ",'" + HBillNo + "','" + CurUserName + "'";
+                ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_BeforeUnCheckCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+
+                }
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
                 //鍙嶅鏍�
-                if (Cj_StationInBillAbandonCheckBill(HInterID, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
+                if (Cj_StationInBillAbandonCheckBill(HInterID, HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
                 {
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
@@ -978,7 +1098,7 @@
         }
 
         //鍙嶅鏍�
-        public bool Cj_StationInBillAbandonCheckBill(Int64 lngBillKey, string CurUserName, ref string sReturn)
+        public bool Cj_StationInBillAbandonCheckBill(Int64 lngBillKey,string HBillNo, string CurUserName, ref string sReturn)
         {
             if (Cj_StationInBillisUse(lngBillKey, ref sReturn))
             {
@@ -1011,6 +1131,23 @@
                 else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "鏄�")
                 {
                 }
+
+                //鍙嶅鏍稿悗鎺у埗
+                string sql = "exec h_p_Sc_StationInBill_AfterUnCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'";
+                ds = oCN.RunProcReturn(sql, "h_p_Sc_StationInBill_AfterUnCheckCtrl");
+                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                {
+                    sReturn = "鍙嶅鏍歌繃绋嬩腑鍑洪敊锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+                    oCN.RollBack();
+                    return false;
+                }
+                if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                {
+                    sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString();
+                    oCN.RollBack();
+                    return false;
+                }
+
                 sReturn = sReturn + "鍙嶅鏍稿姛鑳斤紒";
                 oCN.Commit();
                 return true;
@@ -1306,8 +1443,31 @@
                         return objJsonResult;
                     }
 
-                   
-                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, ref DBUtility.ClsPub.sExeReturnInfo))
+                    //鍒犻櫎鍓嶆帶鍒�=========================================      
+                    string HBillNo = oBill.omodel.HBillNo;
+                    string sql1 = "exec h_p_Sc_StationInBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + HDeleteMan + "'";
+                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_StationInBill_BeforeDelCtrl");
+                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //==================================================================================      
+
+
+                    if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, HBillNo, "h_p_Sc_StationInBill_AfterDelCtrl", HDeleteMan, ref DBUtility.ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;

--
Gitblit v1.9.1