From 11112827c5ccdd0e03fdd7620c22729351ca6ba5 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期五, 10 二月 2023 16:28:39 +0800
Subject: [PATCH] 工序流转卡  保存工艺路线内码 生产订单完善 工艺路线添加字段  仓库

---
 WebAPI/Models/Gy_RoutingBillSub.cs                     |    5 
 WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs    |  123 ++++++++++++++-
 Pub_Class/CustomerCls/ClsXt_SystemParameter.cs         |   13 +
 Model/车间管理/ClsSc_ProcessExchangeBillMain.cs            |    1 
 WebAPI/Controllers/Sc_ProcessMangementController.cs    |   34 +++
 DAL/车间管理/ClsSc_ProcessExchangeBill.cs                  |    7 
 WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs |  263 +++++++++++++++++++++++++++++++-
 DAL/基础资料/公用基础资料/ClsGy_Warehouse_View.cs                |   21 ++
 8 files changed, 438 insertions(+), 29 deletions(-)

diff --git "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Warehouse_View.cs" "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Warehouse_View.cs"
index 4522e8d..b2c83f3 100644
--- "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Warehouse_View.cs"
+++ "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_Warehouse_View.cs"
@@ -66,7 +66,26 @@
             {
                 throw (e);
             }
-        } 
+        }
+        //鏍规嵁浠g爜杩斿洖椤圭洰淇℃伅
+        public override bool GetInfoByName(string sNumber)
+        {
+            DataSet DS;
+            try
+            {
+                DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HName='" + sNumber + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo);
+                if (DS.Tables[0].Rows.Count == 0)
+                    return false;
+                else
+                {
+                    return GetInfo(DS);
+                }
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
         //杩斿洖椤圭洰淇℃伅
         public override bool GetInfo(DataSet Ds)
         {
diff --git "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBill.cs" "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBill.cs"
index eab9620..2ec97af 100644
--- "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBill.cs"
+++ "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBill.cs"
@@ -293,9 +293,8 @@
                 ",HProdMaterCode,HSeOrderBillNo,HCusShortName,HCusNeedMaterial,HPlanSendGoodsDate" +
                 ",HProdMaterName,HCusName,HWorkRemark,HImportNote,HMaterNumber_A" +
                 ",HMaterNumber_B,HMaterNumber_C,HMaterNumber_D,HProdType,HMaterShortName" +
-                ",HMaterIDA,HMaterIDB,HMaterIDC,HMaterIDD,HICMOEntryID" +
-                ",HPicNumVer,HPicNumAssemble,HMaterTexture,HProductNum,HVerNum,HPRDORGID,HBLFlag,HCusNumber,HPickLabel,HPickLabelNumber,HXTNumber,HXTModel,HWorkBillSortNo" +
-                ") " +
+                ",HMaterIDA,HMaterIDB,HMaterIDC,HMaterIDD,HICMOEntryID" +        ",HPicNumVer,HPicNumAssemble,HMaterTexture,HProductNum,HVerNum,HPRDORGID,HBLFlag,HCusNumber,HPickLabel,HPickLabelNumber,HXTNumber,HXTModel,HWorkBillSortNo" +
+               ", HRoutingBillID) " +
                 " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()," + "" + (omodel.HPrevMainSourceInterID == 0 ? omodel.HInterID : omodel.HPrevMainSourceInterID) +
                 "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HBatchNo + "'," + omodel.HMainMaterID.ToString() + "," + omodel.HKeyMaterID.ToString() + "," + omodel.HNo.ToString() + ",'" + omodel.HOrderProcNO + "'" +
                 "," + omodel.HWWOrderInterID.ToString() + "," + omodel.HWWOrderEntryID.ToString() + ",'" + omodel.HWWOrderBillNo + "'," + omodel.HICMOInterID.ToString() + "," + omodel.HEquipMentID.ToString() +
@@ -307,7 +306,7 @@
                 ",'" + omodel.HMaterNumber_B + "','" + omodel.HMaterNumber_C + "','" + omodel.HMaterNumber_D + "','" + omodel.HProdType + "','" + omodel.HMaterShortName + "'" +
                 ",'" + omodel.HMaterIDA + "','" + omodel.HMaterIDB + "','" + omodel.HMaterIDC + "','" + omodel.HMaterIDD + "'," + omodel.HICMOEntryID +
                 ",'" + omodel.HPicNumVer + "','" + omodel.HPicNumAssemble + "','" + omodel.HMaterTexture + "','" + omodel.HProductNum + "','" + omodel.HVerNum + "','"+ omodel.HPRDORGID+ "','"+omodel.HBLFlag+ "','" + omodel.HCusNumber + "','" + omodel.HPickLabel + "','" + omodel.HPickLabelNumber + "','" + omodel.HXTNumber + "','" + omodel.HXTModel + "','" + omodel.HWorkBillSortNo + 
-                "') ");
+                "',"+ omodel.HRoutingBillID + ") ");
                 sErr = sErr + "1;";
                 //鎻掑叆瀛愯〃
                 foreach (Model.ClsSc_ProcessExchangeBillSub oSub in DetailColl)
diff --git "a/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBillMain.cs" "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBillMain.cs"
index 8811c67..ece4cac 100644
--- "a/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBillMain.cs"
+++ "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBillMain.cs"
@@ -72,5 +72,6 @@
         public string HPickLabelNumber;
         public string HXTNumber;
         public string HXTModel;
+        public string HRoutingBillID;//工艺路线ID
     }
 }
diff --git a/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs b/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
index 2c08827..a24457e 100644
--- a/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
+++ b/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
@@ -1393,6 +1393,12 @@
                         omodel.MES_StationOutBill_InStockType = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
                     }
 
+                    //===========工艺路线
+                    //保存到数据库时自动加上转工序
+                    if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "Gy_RoutingBill_SaveAutoLastProc")
+                    {
+                        omodel.Gy_RoutingBill_SaveAutoLastProc = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
+                    }
 
                     //=======JIT
 
@@ -2905,6 +2911,13 @@
                         omodel.MES_StationEntrustOutBill_SaveAutoAddnew = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
                     }
 
+                    //=========工艺路线
+                    //自动新增   保存到数据库时自动加上转工序
+                    if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "Gy_RoutingBill_SaveAutoLastProc")
+                    {
+                        omodel.Gy_RoutingBill_SaveAutoLastProc = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
+                    }
+
                     //报工台,工序汇报自动审核参数
                     if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "Sc_MESProceReportWorkBill_AutoCheck")
                     {
diff --git a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
index 73b1406..3a69b83 100644
--- a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
+++ b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
@@ -27,8 +27,10 @@
         DAL.ClsIF_Material_View oMaterHlp = new DAL.ClsIF_Material_View();
         public DAL.ClsGy_Process_View oProcHlp = new DAL.ClsGy_Process_View();
         DAL.ClsGy_WorkCenter_View oCenHlp = new DAL.ClsGy_WorkCenter_View();
+        DAL.ClsGy_Warehouse_View oCenWare = new DAL.ClsGy_Warehouse_View();
         Gy_RoutingBill_temporary omdelMian = new Gy_RoutingBill_temporary();
         public string BillType = "3301";
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
 
         #region 鏈煡
         /// <summary>
@@ -162,7 +164,7 @@
                 double HStdSourceQty = mainList[0].HStdSourceQty;//鏍囧噯璧勬簮鏁�
                 double HAddSourceRate = mainList[0].HAddSourceRate;//鍔犺祫婧愬閲�
                 double HDelSourceRate = mainList[0].HDelSourceRate;//鍑忚祫婧愬噺閲�
-                int HPRDORGID = mainList[0].HOrgID;  //鐢熶骇缁勭粐
+                int HPRDORGID = mainList[0].HPRDORGID;  //鐢熶骇缁勭粐
                 int HOrgID = mainList[0].HOrgID;  //缁勭粐
                 string HPicNumVer = mainList[0].HPicNumVer;//鍥惧彿鐗堟湰
                 string HPicNumAssemble = mainList[0].HPicNumAssemble;//鎬昏鍥惧彿
@@ -170,7 +172,7 @@
                 string HProductNum = mainList[0].HProductNum;//鎴愬搧缂栧彿
                 string HVerNum = mainList[0].HVerNum;//鐗堟湰
                 int IsProNo = mainList[0].IsProNo;//鏄惁杞伐搴�
-
+              
                 if (OperationType == 2)
                 {
                     ds = oCN.RunProcReturn("select * from h_v_Gy_RoutingBillList where  鍗曟嵁鍙�='" + HBillNo + "'", "h_v_Gy_RoutingBillList");
@@ -228,6 +230,19 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
+
+                //string sErrMsg = "";
+                //if (oSystemParameter.ShowBill(ref sErrMsg))
+                //{
+                //    if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�")
+                //    {
+                //        if (oSystemParameter.omodel.Gy_RoutingBill_SaveAutoLastProc == "Y" && OperationType == 1)
+                //        {
+                //            //璁剧疆杞伐搴�
+                //            oCN.RunProc("exec Gy_RoutingBill_LastProNo " + HInterID);
+                //        }
+                //    }
+                //}
 
                 if (IsProNo == 1 && OperationType == 1)
                 {
@@ -313,7 +328,7 @@
                     ",HProcID_S,HCenterID_S,HWorkQty_S,HSubStdEmpQty_S,HMouldNo,HChangeMould" +
                     ",HPackStd,HPack,HPutArea,HMyWorkDays,HMyFixWorkDays,HPassRate" +
                     ",HTechnologyParameter,HPicNum,HProcCheckNote" +
-                    ",HOverRate,HProcWorkNum" +
+                    ",HOverRate,HProcWorkNum,HBadWHID,HWasterWHID, HWHID " +
                     ") values("
                     + HInterID + "," + i + "," + oSub.HProcID.ToString() + ",'" + oSub.HProcNo + "'," + oSub.HSupID.ToString() + "," + Convert.ToString(oSub.HSupFlag ? 1 : 0) + "" +
                     "," + oSub.HWorkQty.ToString() + "," + oSub.HCenterID.ToString() + ",'" + oSub.HTimeUnit.ToString() + "'," + oSub.HUnitTime.ToString() +
@@ -325,7 +340,7 @@
                    "," + oSub.HProcID_S.ToString() + "," + oSub.HCenterID_S.ToString() + "," + oSub.HWorkQty_S.ToString() + ", " + oSub.HSubStdEmpQty_S.ToString() + ",'" + oSub.HMouldNo + "'," + oSub.HChangeMould.ToString() +
                    ",'" + oSub.HPackStd + "','" + oSub.HPack + "','" + oSub.HPutArea + "'," + oSub.HMyWorkDays.ToString() + "," + oSub.HMyFixWorkDays.ToString() + "," + oSub.HPassRate.ToString() +
                    ",'" + oSub.HTechnologyParameter.ToString() + "','" + oSub.HPicNum.ToString() + "','" + oSub.HProcCheckNote.ToString() +
-                   "', " + oSub.HOverRate.ToString() + ",'" + oSub.HProcWorkNum.ToString() + "'" +
+                   "', " + oSub.HOverRate.ToString() + ",'" + oSub.HProcWorkNum.ToString() + "'," + oSub.HBadWHID.ToString()+"," + oSub.HWasterWHID.ToString()+"," + oSub.HWHID.ToString() +
                     ") ");
                 }
             }
@@ -446,6 +461,15 @@
                 if (!tb2.Columns.Contains("鑹巼"))
                     error += "娌℃湁鎵惧埌銆愯壇鐜囥�戠殑鏍囬";
 
+                if (!tb2.Columns.Contains("涓嶈壇鍝佷粨"))
+                    error += "娌℃湁鎵惧埌銆愪笉鑹搧浠撱�戠殑鏍囬";
+
+                if (!tb2.Columns.Contains("鎶ュ簾鍝佷粨"))
+                    error += "娌℃湁鎵惧埌銆愭姤搴熷搧浠撱�戠殑鏍囬";
+
+                if (!tb2.Columns.Contains("鑹搧浠�"))
+                    error += "娌℃湁鎵惧埌銆愯壇鍝佷粨銆戠殑鏍囬";
+
                 if (error.Length > 0)
                 {
                     objJsonResult.code = "0";
@@ -507,12 +531,12 @@
                                 , 鑹巼, 宸ュ簭宸ヤ环, 涓嶅悎鏍煎崟浠�, 鎶ュ簾鍗曚环, 鏈亾鍥哄畾寮�宸ュぉ鏁�, 鏈亾寮�宸ヤ綑閲�, 涓婇亾绛夊緟澶╂暟
                                 , 涓婇亾寰幆鍛ㄦ湡, 鑷姩杞Щ, 澶栧崗鏍囪, 渚涘簲鍟嗕唬鐮�, 渚涘簲鍟�, 宸ヨ壓鍙傛暟, 鍥剧焊缂栧彿
                                 , 鏈伐搴忕‘璁よ褰�, 澶囨敞, 鍥惧彿鐗堟湰, 鎬昏鍥惧彿, 鏉愯川, 鎴愬搧缂栧彿, 鐗堟湰
-                                , 妯″叿缂栧彿, 绋嬪簭鍙�, 鐝骇瀹氶, 宸ヨ壓璺嚎鍚嶇О, 鏃堕棿鍗曚綅,宸ヨ壓璺嚎浠g爜)values
+                                , 妯″叿缂栧彿, 绋嬪簭鍙�, 鐝骇瀹氶, 宸ヨ壓璺嚎鍚嶇О, 鏃堕棿鍗曚綅,宸ヨ壓璺嚎浠g爜,涓嶈壇鍝佷粨,鎶ュ簾鍝佷粨,鑹搧浠�)values
                                 ('" + tb2.Rows[i]["浜у搧浠g爜"].ToString() + "','" + tb2.Rows[i]["浜у搧鍚嶇О"].ToString() + "','" + tb2.Rows[i]["宸ュ簭搴忓彿"].ToString() + "','" + tb2.Rows[i]["宸ュ簭浠g爜"].ToString() + "','" + tb2.Rows[i]["宸ュ簭"].ToString() + "','" + tb2.Rows[i]["宸ヤ綔涓績"].ToString() + "','" + tb2.Rows[i]["鍔犲伐鏁伴噺"].ToString() + "'" +
                                 ",'" + tb2.Rows[i]["鑹巼"].ToString() + "','" + (tb2.Rows[i]["宸ュ簭宸ヤ环"].ToString() == "" ? "0" : tb2.Rows[i]["宸ュ簭宸ヤ环"].ToString()) + "','" + tb2.Rows[i]["涓嶅悎鏍煎崟浠�"].ToString() + "','" + tb2.Rows[i]["鎶ュ簾鍗曚环"].ToString() + "','" + tb2.Rows[i]["鏈亾鍥哄畾寮�宸ュぉ鏁�"].ToString() + "','" + tb2.Rows[i]["鏈亾寮�宸ヤ綑閲�"].ToString() + "','" + tb2.Rows[i]["涓婇亾绛夊緟澶╂暟"].ToString() + "'" +
                                 ",'" + tb2.Rows[i]["涓婇亾寰幆鍛ㄦ湡"].ToString() + "','" + tb2.Rows[i]["鑷姩杞Щ"].ToString() + "','" + tb2.Rows[i]["澶栧崗鏍囪"].ToString() + "','" + tb2.Rows[i]["渚涘簲鍟嗕唬鐮�"].ToString() + "','" + tb2.Rows[i]["渚涘簲鍟�"].ToString() + "','" + tb2.Rows[i]["宸ヨ壓鍙傛暟"].ToString() + "','" + tb2.Rows[i]["鍥剧焊缂栧彿"].ToString() + "'" +
                                 ",'" + tb2.Rows[i]["鏈伐搴忕‘璁よ褰�"].ToString() + "','" + tb2.Rows[i]["澶囨敞"].ToString() + "','" + tb2.Rows[i]["鍥惧彿鐗堟湰"].ToString() + "','" + tb2.Rows[i]["鎬昏鍥惧彿"].ToString() + "','" + tb2.Rows[i]["鏉愯川"].ToString() + "','" + tb2.Rows[i]["鎴愬搧缂栧彿"].ToString() + "','" + tb2.Rows[i]["鐗堟湰"].ToString() + "'" +
-                                ",'" + tb2.Rows[i]["妯″叿缂栧彿"].ToString() + "','" + tb2.Rows[i]["绋嬪簭鍙�"].ToString() + "','" + tb2.Rows[i]["鐝骇瀹氶"].ToString() + "','" + tb2.Rows[i]["宸ヨ壓璺嚎鍚嶇О"].ToString() + "','" + tb2.Rows[i]["鏃堕棿鍗曚綅"].ToString() + "','" + tb2.Rows[i]["宸ヨ壓璺嚎浠g爜"].ToString() + "')");
+                                ",'" + tb2.Rows[i]["妯″叿缂栧彿"].ToString() + "','" + tb2.Rows[i]["绋嬪簭鍙�"].ToString() + "','" + tb2.Rows[i]["鐝骇瀹氶"].ToString() + "','" + tb2.Rows[i]["宸ヨ壓璺嚎鍚嶇О"].ToString() + "','" + tb2.Rows[i]["鏃堕棿鍗曚綅"].ToString() + "','" + tb2.Rows[i]["宸ヨ壓璺嚎浠g爜"].ToString() + "','" + tb2.Rows[i]["涓嶈壇鍝佷粨"].ToString() + "','" + tb2.Rows[i]["鎶ュ簾鍝佷粨"].ToString() + "','" + tb2.Rows[i]["鑹搧浠�"].ToString() + "')");
                 }
 
                 objJsonResult.code = "1";
@@ -545,12 +569,12 @@
                 Single sWorkQty = 0;
                 Single sHPassRate = 0;
 
-                //
                 sHNumber = DBUtility.ClsPub.isStrNull(dt.Rows[i]["浜у搧浠g爜"].ToString());
                 sHNumberCen = DBUtility.ClsPub.isStrNull(dt.Rows[i]["宸ヤ綔涓績"].ToString());
                 sHNamePoc = DBUtility.ClsPub.isStrNull(dt.Rows[i]["宸ュ簭"].ToString());
                 sWorkQty = DBUtility.ClsPub.isSingle(dt.Rows[i]["鍔犲伐鏁伴噺"].ToString());
                 sHPassRate = DBUtility.ClsPub.isSingle(dt.Rows[i]["鑹巼"].ToString());
+             
                 if (sHNumber != "")
                 {
                     // 
@@ -613,9 +637,92 @@
                             sErrMsg = sErrMsg + "[" + sHNumberCen + "]宸ヤ綔涓績涓嶅瓨鍦╘r\n";
                         }
                         b = true;
-
                     }
 
+
+                    string sErr = "";
+                    if (oSystemParameter.ShowBill(ref sErr))
+                    {
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�")
+                        {
+                            string HBadWHName = ""; //涓嶈壇鍝佷粨
+                            string HWasterWHName = ""; //鎶ュ簾鍝佷粨
+                            string HWHName = ""; //鑹搧浠�
+
+                            HBadWHName = DBUtility.ClsPub.isStrNull(dt.Rows[i]["涓嶈壇鍝佷粨"].ToString());
+                            HWasterWHName = DBUtility.ClsPub.isStrNull(dt.Rows[i]["鎶ュ簾鍝佷粨"].ToString());
+                            HWHName = DBUtility.ClsPub.isStrNull(dt.Rows[i]["鑹搧浠�"].ToString());
+
+                            //鍒ゆ柇鏄惁涓虹┖
+                            if (HBadWHName == "")
+                            {
+                                sErrMsg = sErrMsg + "绗�" + index + "琛� :涓嶈壇鍝佷粨涓嶈兘涓虹┖ !\r\n";
+                                b = true;
+                            }
+
+                            if (HWasterWHName == "")
+                            {
+                                sErrMsg = sErrMsg + "绗�" + index + "琛� :鎶ュ簾鍝佷粨涓嶈兘涓虹┖ !\r\n";
+                                b = true;
+                            }
+
+                            if (HWHName == "")
+                            {
+                                sErrMsg = sErrMsg + "绗�" + index + "琛� :鑹搧浠撲笉鑳戒负绌� !\r\n";
+                                b = true;
+                            }
+
+                            //鍒ゆ柇浠撳簱鏄惁閲嶅
+                            if (HBadWHName == HWasterWHName)
+                            {
+                                sErrMsg = sErrMsg + "涓嶈壇鍝佷粨鍜屾姤搴熷搧浠撻噸澶峔r\n";
+                                b = true;
+                            }
+
+                            if (HWasterWHName == HWHName)
+                            {
+                                sErrMsg = sErrMsg + "鎶ュ簾鍝佷粨鍜岃壇鍝佷粨閲嶅\r\n";
+                                b = true;
+                            }
+
+                            if (HBadWHName == HWHName)
+                            {
+                                sErrMsg = sErrMsg + "涓嶈壇鍝佷粨鍜岃壇鍝佷粨閲嶅\r\n";
+                                b = true;
+                            }
+
+                            //寰楀埌浠撳簱鍐呯爜
+                            if (!oCenWare.GetInfoByName(HBadWHName))
+                            {
+                                sMsg = "[" + HBadWHName + "]浠撳簱涓嶅瓨鍦�";
+                                if (sErrMsg.Contains(sMsg) == false)
+                                {
+                                    sErrMsg = sErrMsg + "[" + HBadWHName + "]浠撳簱涓嶅瓨鍦╘r\n";
+                                }
+                                b = true;
+                            }
+
+                            if (!oCenWare.GetInfoByName(HWasterWHName))
+                            {
+                                sMsg = "[" + HWasterWHName + "]浠撳簱涓嶅瓨鍦�";
+                                if (sErrMsg.Contains(sMsg) == false)
+                                {
+                                    sErrMsg = sErrMsg + "[" + HWasterWHName + "]浠撳簱涓嶅瓨鍦╘r\n";
+                                }
+                                b = true;
+                            }
+
+                            if (!oCenWare.GetInfoByName(HWHName))
+                            {
+                                sMsg = "[" + HWHName + "]浠撳簱涓嶅瓨鍦�";
+                                if (sErrMsg.Contains(sMsg) == false)
+                                {
+                                    sErrMsg = sErrMsg + "[" + HWHName + "]浠撳簱涓嶅瓨鍦╘r\n";
+                                }
+                                b = true;
+                            }
+                        }
+                    }
                 }
             }
             if (b == true)
diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs
index 9a71202..042f69e 100644
--- a/WebAPI/Controllers/Sc_ProcessMangementController.cs
+++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -20,7 +20,7 @@
         public DBUtility.ClsPub.Enum_BillStatus BillStatus;
 
         private json objJsonResult = new json();
-
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
 
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
         DataSet ds;
@@ -712,7 +712,21 @@
                     FentityModel.Add("FBaseRealQty", item["鏁伴噺"].ToString());//
                     FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");//
                     FentityModel.Add("FOwnerId", new JObject() { ["FNumber"] = item["HPrdOrgNumber"].ToString() });//
-                    FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 浠撳簱 
+                    string sErr = "";
+                    if (oSystemParameter.ShowBill(ref sErr))
+                    {
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�")
+                        {
+                            if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "宸ヨ壓璺嚎")
+                            {
+                                FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumbers"].ToString() }); // 浠撳簱 
+                            }
+                            else if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "宸ュ簭")
+                            {
+                                FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 浠撳簱 
+                            }
+                        }
+                    }
                     FentityModel.Add("FLot", new JObject() { ["FNumber"] = item["HBatchNo"].ToString() }); //鎵瑰彿
                     FentityModel.Add("FISBACKFLUSH", "true");//  
                     FentityModel.Add("FWorkShopId1", new JObject() { ["FNumber"] = item["HWorkShopNumber"].ToString() }); //  鐢熶骇杞﹂棿
@@ -951,7 +965,21 @@
                     FentityModel.Add("FBaseRealQty", item["鏁伴噺"].ToString());//
                     FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");//
                     FentityModel.Add("FOwnerId", new JObject() { ["FNumber"] = item["HPrdOrgNumber"].ToString() });//
-                    FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 浠撳簱 
+                    string sErr = "";
+                    if (oSystemParameter.ShowBill(ref sErr))
+                    {
+                        if (oSystemParameter.omodel.WMS_CampanyName == "鐟炰笌绁�")
+                        {
+                            if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "宸ヨ壓璺嚎")
+                            {
+                                FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumbers"].ToString() }); // 浠撳簱 
+                            }
+                            else if (oSystemParameter.omodel.MES_StationOutBill_InStockType == "宸ュ簭")
+                            {
+                                FentityModel.Add("FStockId", new JObject() { ["FNumber"] = item["HStockNumber"].ToString() }); // 浠撳簱 
+                            }
+                        }
+                    }
                     FentityModel.Add("FLot", new JObject() { ["FNumber"] = item["HBatchNo"].ToString() }); //鎵瑰彿
                     FentityModel.Add("FISBACKFLUSH", "true");//  
                     FentityModel.Add("FWorkShopId1", new JObject() { ["FNumber"] = item["HWorkShopNumber"].ToString() }); //  鐢熶骇杞﹂棿
diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
index 2339256..9c0b28c 100644
--- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
@@ -25,6 +25,7 @@
 
         //鑾峰彇绯荤粺鍙傛暟
         Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+        public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
 
         #region 鐢熶骇浠诲姟鍗� 淇濆瓨/缂栬緫鍔熻兘
         [Route("Sc_ICMOBill/ICMOBillEdit")]
@@ -392,6 +393,7 @@
             string msg2 = sArray[0].ToString(); //涓昏〃鏁版嵁
             int OperationType = int.Parse(sArray[1].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼
             string user = sArray[2].ToString();
+            int HEntryID = int.Parse(sArray[3].ToString());
 
             try
             {
@@ -441,15 +443,15 @@
                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                 { //淇敼
                     oCN.RunProc("update Sc_ICMOBillMain  set " +
-                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
+                                "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                 ", HSeOrderBillNo='" + HSeOrderBillNo + "', HSeOrderInterID=" + HSeOrderInterID + ", HSeOrderEntryID=" + HSeOrderEntryID + ", HEmpID=" + HEmpID + ", HCusID=" + HCusID + "" +
                                 ", HCenterID=" + HCenterID + ",HBomID=" + HBomID + " where HInterID=" + HInterID);
 
                     //鍒犻櫎瀛愯〃
-                    oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "'");
+                    oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'");
                 }
                 //淇濆瓨瀛愯〃
-                objJsonResult = AddBillSub_NoTable(msg3, HInterID, OperationType);
+                objJsonResult = AddBillSub_NoTable(msg3, HInterID, OperationType, HEntryID);
 
                 if (objJsonResult.code == "0")
                 {
@@ -476,7 +478,7 @@
             }
         }
 
-        public json AddBillSub_NoTable(string msg3, long HInterID, int OperationType)
+        public json AddBillSub_NoTable(string msg3, long HInterID, int OperationType,int HEntryID)
         {
             ClsSc_ICMOBillSub oSub = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsSc_ICMOBillSub>(msg3);
             if (oSub.HQty <= 0 || oSub.HQty == null)
@@ -515,14 +517,14 @@
                 return objJsonResult;
             }
 
-            if (oSub.HBomID == 0)
-            {
-                objJsonResult.code = "0";
-                objJsonResult.count = 0;
-                objJsonResult.Message = "BOM涓嶈兘涓虹┖";
-                objJsonResult.data = null;
-                return objJsonResult;
-            }
+            //if (oSub.HBomID == 0)
+            //{
+            //    objJsonResult.code = "0";
+            //    objJsonResult.count = 0;
+            //    objJsonResult.Message = "BOM涓嶈兘涓虹┖";
+            //    objJsonResult.data = null;
+            //    return objJsonResult;
+            //}
 
             oCN.RunProc($@"Insert into Sc_ICMOBillSub 
                 (HInterID,HENTRYID,HQty
@@ -531,7 +533,7 @@
                 ,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS
                 ,HBomID,HEntryCusID
 				,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney) 
-                 values({HInterID},1,{(oSub.HQty == null ? 0 : oSub.HQty)}
+                 values({HInterID},{HEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)}
                 ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}'
                 ,'{(oSub.HBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HBeginDate.ToString())}','{(oSub.HEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HEndDate.ToString())}'
                 ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},{oSub.HSTATUS}
@@ -547,6 +549,241 @@
         }
         #endregion
 
+        #region 鐢熶骇浠诲姟鍗曞鏍�/鍙嶅鏍稿姛鑳�
+        [Route("Sc_ICMOBill/CheckSc_ICMOReportBill")]
+        [HttpGet]
+        public object CheckSc_ICMOReportBill(string HInterID,int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBill_Check", 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;
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 瀹℃牳  2  鍙嶅鏍�
+                if (Type == 1)
+                {
+                    if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                        DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl");
+                        //if (DBUtility.ClsPub.isInt(DSet.Tables[0].Rows[0]["Hback"]) != 0)
+                        //{
+                        //    objJsonResult.code = "0";
+                        //    objJsonResult.count = 1;
+                        //    objJsonResult.Message = "璇ヤ换鍔″崟宸蹭笅鎺ㄦ祦杞崱锛屼笉鍏佽鍙嶅鏍�" + DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[0]["HBackRemark"]);
+                        //    objJsonResult.data = null;
+                        //    return objJsonResult;
+                        //}
+                    }
+                    else
+                    {
+                        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 鐢熶骇浠诲姟鍗曞叧闂�/鍙嶅叧闂姛鑳�
+        [Route("Sc_ICMOBill/CloseSc_ICMOReportBill")]
+        [HttpGet]
+        public object CloseSc_ICMOReportBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBill_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;
+
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 鍏抽棴  2  鍙嶅叧闂�
+                if (Type == 1)
+                {
+                    if (!BillOld.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (!BillOld.CancelClose(int.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 鐢熶骇浠诲姟鍗曚綔搴�/鍙嶄綔搴熷姛鑳�
+        [Route("Sc_ICMOBill/CancellSc_ICMOReportBill")]
+        [HttpGet]
+        public object CancellSc_ICMOReportBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBill_Delete", 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;
+
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 1 浣滃簾  2  鍙嶄綔搴�
+                if (Type == 1)
+                {
+                    if (!BillOld.Cancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else
+                {
+                    if (!BillOld.AbandonCancelltion(int.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 鐢熶骇浠诲姟鍗曞垹闄ゅ姛鑳�
         [Route("Sc_ICMOBill/DeltetSc_ICMOReportBill")]
         [HttpGet]
diff --git a/WebAPI/Models/Gy_RoutingBillSub.cs b/WebAPI/Models/Gy_RoutingBillSub.cs
index 4547697..4d4634f 100644
--- a/WebAPI/Models/Gy_RoutingBillSub.cs
+++ b/WebAPI/Models/Gy_RoutingBillSub.cs
@@ -65,5 +65,10 @@
         public string HProcCheckNote = "";        // varchar(2000)  鏈伐搴忕‘璁よ褰�
         public string HProcWorkNum = "";        // varchar(100)  绋嬪簭鍙�
 
+        //鐟炵惇鏂板姞瀛楁
+        public int HBadWHID { get; set; }  //涓嶈壇鍝佷粨
+        public int HWasterWHID { get; set; } //鎶ュ簾浠�
+        public int HWHID { get; set; }  //鑹搧浠�
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1