From c8d138de62133c15cd8e09bd9c8055411f64147c Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期三, 15 十二月 2021 13:42:31 +0800
Subject: [PATCH] 1

---
 LMES/bin/x86/Debug.rar                                              |    0 
 LMES/ClsShowMod.cs                                                  |   64 +-
 WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user         |   34 
 Pub_Class/CustomerCls/ClsXt_SystemParameter.cs                      |    6 
 WebAPI/Models/ClsGy_StockCheckItemBill.cs                           |   32 +
 WebAPI/Controllers/生产管理/报工台工序/Sc_MESReturnStepWorkBillController.cs |  192 ++++++++
 DBUtility/业务单据/ClsXt_BaseBillMain.cs                                |    2 
 WebAPI/Controllers/基础资料/基础资料/Gy_StockCheckItemBillController.cs     |  254 +++++++++++
 WebAPI/Models/ClsSc_PackUnionBillMain.cs                            |   15 
 Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs                  |    2 
 Model/车间管理/ClsSc_ProcessPlanMain.cs                                 |    7 
 /dev/null                                                           |    0 
 WebAPI/ListModels.cs                                                |   26 +
 WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs       |    4 
 WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs       |    2 
 WebAPI/DLL/ClsSc_PackUnionBill.cs                                   |  383 ++++++++++++++++
 WebAPI/Models/ClsSc_PackUnionBillSub.cs                             |   23 +
 WebAPI/Controllers/博日自动扫码线/ScanlineAPIController.cs                 |  166 ++++++
 WebAPI/DLL/ClsSb_EquipMaintainRuleBill.cs                           |    9 
 WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs                           |  101 ++++
 WebAPI/DLL/ClsSb_EquipDotCheckRuleBill.cs                           |    2 
 WebAPI/WebAPI.csproj                                                |    3 
 22 files changed, 1,256 insertions(+), 71 deletions(-)

diff --git "a/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBillMain.cs" "b/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBillMain.cs"
index fa6bb96..6ad2004 100644
--- "a/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBillMain.cs"
+++ "b/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBillMain.cs"
@@ -43,5 +43,7 @@
         public Int64 HItemMainID;
         //组织
         public Int64 HPRDORGID;
+        //有效状态 
+        public bool HUseFlag;
     }
 }
diff --git a/LMES/ClsShowMod.cs b/LMES/ClsShowMod.cs
index e4adb40..2c8a23c 100644
--- a/LMES/ClsShowMod.cs
+++ b/LMES/ClsShowMod.cs
@@ -3934,6 +3934,12 @@
                         oPt_RadiumCarvingCodeBillList.Show();
                         oMainForm.AddTabPage(oPt_RadiumCarvingCodeBillList);
                         break;
+                    case "sc_packunionbill":
+                        Sc_PackUnionBill oSc_PackUnionBill = new Sc_PackUnionBill();
+                        oSc_PackUnionBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
+                        oSc_PackUnionBill.ModCaption = gnmc;
+                        oSc_PackUnionBill.ShowDialog();
+                        break;
                     default:
                         break;
                 }
@@ -5728,23 +5734,23 @@
                     //    oSc_PackSplitBillList.Show();
                     //    oMainForm.AddTabPage(oSc_PackSplitBillList);
                     //    break;
-                    //case "sc_packunionbill":
-                    //    Sc_PackUnionBill oSc_PackUnionBill = new Sc_PackUnionBill();
-                    //    oSc_PackUnionBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
-                    //    oSc_PackUnionBill.ModCaption = gnmc;
-                    //    oSc_PackUnionBill.ShowDialog();
-                    //    break;
-                    //case "sc_packunionbilllist":
-                    //    Sc_PackUnionBillList oSc_PackUnionBillList = new Sc_PackUnionBillList();
-                    //    oSc_PackUnionBillList.MdiParent = oMain;
-                    //    oSc_PackUnionBillList.ModCaption = gnmc;
-                    //    oSc_PackUnionBillList.Show();
-                    //    oMainForm.AddTabPage(oSc_PackUnionBillList);
-                    //    break;
+                    case "sc_packunionbill":
+                        Sc_PackUnionBill oSc_PackUnionBill = new Sc_PackUnionBill();
+                        oSc_PackUnionBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
+                        oSc_PackUnionBill.ModCaption = gnmc;
+                        oSc_PackUnionBill.ShowDialog();
+                        break;
+                    case "sc_packunionbilllist":
+                        Sc_PackUnionBillList oSc_PackUnionBillList = new Sc_PackUnionBillList();
+                        oSc_PackUnionBillList.MdiParent = oMain;
+                        oSc_PackUnionBillList.ModCaption = gnmc;
+                        oSc_PackUnionBillList.Show();
+                        oMainForm.AddTabPage(oSc_PackUnionBillList);
+                        break;
 
 
-                    
-     
+
+
 
                     //===========================MES平板系统单据
 
@@ -5806,20 +5812,20 @@
                         oMES_StationOutBillList.Show();
                         oMainForm.AddTabPage(oMES_StationOutBillList);
                         break;
-                    case "sc_packunionbill":
-                        Sc_PackUnionBill oSc_PackUnionBill = new Sc_PackUnionBill();
-                        oSc_PackUnionBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
-                        oSc_PackUnionBill.ModCaption = gnmc;
-                        oSc_PackUnionBill.ShowDialog();
-                        break;
-                    case "sc_packunionbilllist":
-                        //权限
-                        Sc_PackUnionBillList oSc_PackUnionBillList = new Sc_PackUnionBillList();
-                        oSc_PackUnionBillList.MdiParent = oMain;
-                        oSc_PackUnionBillList.ModCaption = gnmc;
-                        oSc_PackUnionBillList.Show();
-                        oMainForm.AddTabPage(oSc_PackUnionBillList);
-                        break;
+                    //case "sc_packunionbill":
+                    //    Sc_PackUnionBill oSc_PackUnionBill = new Sc_PackUnionBill();
+                    //    oSc_PackUnionBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
+                    //    oSc_PackUnionBill.ModCaption = gnmc;
+                    //    oSc_PackUnionBill.ShowDialog();
+                    //    break;
+                    //case "sc_packunionbilllist":
+                    //    //权限
+                    //    Sc_PackUnionBillList oSc_PackUnionBillList = new Sc_PackUnionBillList();
+                    //    oSc_PackUnionBillList.MdiParent = oMain;
+                    //    oSc_PackUnionBillList.ModCaption = gnmc;
+                    //    oSc_PackUnionBillList.Show();
+                    //    oMainForm.AddTabPage(oSc_PackUnionBillList);
+                    //    break;
                     //case "mes_mesbeginworkbill":
                     //    MES_MESBeginWorkBill oMES_MESBeginWorkBill = new MES_MESBeginWorkBill();
                     //    oMES_MESBeginWorkBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
diff --git a/LMES/bin/x86/Debug.rar b/LMES/bin/x86/Debug.rar
new file mode 100644
index 0000000..de17e07
--- /dev/null
+++ b/LMES/bin/x86/Debug.rar
Binary files differ
diff --git "a/LMES/bin/x86/\345\245\245\351\202\246Debug.rar" "b/LMES/bin/x86/\345\245\245\351\202\246Debug.rar"
deleted file mode 100644
index 432b354..0000000
--- "a/LMES/bin/x86/\345\245\245\351\202\246Debug.rar"
+++ /dev/null
Binary files differ
diff --git "a/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessPlanMain.cs" "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessPlanMain.cs"
index d4ca9b8..7483cfa 100644
--- "a/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessPlanMain.cs"
+++ "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessPlanMain.cs"
@@ -22,5 +22,12 @@
         public string HInnerBillNo;//    varchar(50)   --内部单据号
         public bool HCloseType;//      bit          --关闭类型   (默认为0)   
         
+        
+        public int HWorkerID;
+        public int HProcNo;
+        public int HProcID;
+        public int HGroupID;
+        public int HDeptID;
+        public int HQty;
     }
 }
diff --git a/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs b/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
index 317a662..1f079d0 100644
--- a/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
+++ b/Pub_Class/CustomerCls/ClsXt_SystemParameter.cs
@@ -732,6 +732,12 @@
                     {
                         omodel.Sc_MESBeginWorkBill_AutoCheck = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
                     }
+                    //==========返工单
+                    //自动审核
+                    if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "Sc_MESReturnWorkBill_AutoCheck")
+                    {
+                        omodel.Sc_MESReturnWorkBill_AutoCheck = ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HValue"]);
+                    }
                     //==========结班单
                     //自动审核
                     if (ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HKey"]) == "Sc_MESEndWorkBill_AutoCheck")
diff --git a/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs b/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs
index e3a8864..fe5c2e7 100644
--- a/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs
+++ b/Pub_Class/CustomerCls/ClsXt_SystemParameterMain.cs
@@ -205,6 +205,8 @@
 
         //开班单
         public string Sc_MESBeginWorkBill_AutoCheck; //自动审核
+        //返工单
+        public string Sc_MESReturnWorkBill_AutoCheck; //自动审核
         //结班单
         public string Sc_MESEndWorkBill_AutoCheck; //自动审核
         //停工挂起单
diff --git a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs
index 7282ade..8f00320 100644
--- a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs
+++ b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs
@@ -92,7 +92,7 @@
                     return objJsonResult;
                 }
                
-                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
                 if (IsDete)
                 {
                     objJsonResult.code = "0";
diff --git a/WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs
index 3a37cea..4bc6994 100644
--- a/WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs
+++ b/WebAPI/Controllers/SBGL/Sb_EquipMaintainRuleBillController.cs
@@ -90,7 +90,7 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                if (oBill.omodel.HChecker != "")
+                if (oBill.omodel.HChecker != ""&& oBill.omodel.HChecker != null)
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
@@ -99,7 +99,7 @@
                     return objJsonResult;
                 }
 
-                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
                 if (IsDete)
                 {
                     objJsonResult.code = "0";
diff --git "a/WebAPI/Controllers/\345\215\232\346\227\245\350\207\252\345\212\250\346\211\253\347\240\201\347\272\277/ScanlineAPIController.cs" "b/WebAPI/Controllers/\345\215\232\346\227\245\350\207\252\345\212\250\346\211\253\347\240\201\347\272\277/ScanlineAPIController.cs"
index 9a93a8d..1b23643 100644
--- "a/WebAPI/Controllers/\345\215\232\346\227\245\350\207\252\345\212\250\346\211\253\347\240\201\347\272\277/ScanlineAPIController.cs"
+++ "b/WebAPI/Controllers/\345\215\232\346\227\245\350\207\252\345\212\250\346\211\253\347\240\201\347\272\277/ScanlineAPIController.cs"
@@ -17,6 +17,7 @@
     {
         private jsonScanline objJsonResult = new jsonScanline();
         public DataSet ds = new DataSet();
+        public DataSet ds0 = new DataSet();
         SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
 
         #region 鐢熸垚绠辩爜鎺ュ彛
@@ -66,13 +67,7 @@
         }
         #endregion
 
-
-        #region 鎶ュ伐骞冲彴寮�宸ュ崟淇濆瓨/缂栬緫
-        /// <summary>
-        /// 寮�宸ュ崟
-        /// </summary>
-        /// <param name="msg"></param>
-        /// <returns></returns>
+        #region 绠辨潯鐮佺粦瀹氬叧绯绘彁浜ゆ帴鍙�
         [Route("packagebarcode/pack")]
         [HttpPost]
         public object pack([FromBody] JObject msg)
@@ -81,6 +76,159 @@
             {
                 JavaScriptSerializer js = new JavaScriptSerializer();   //瀹炰緥鍖栦竴涓兘澶熷簭鍒楀寲鏁版嵁鐨勭被
                 ScanLineCode list = js.Deserialize<ScanLineCode>(msg.ToString());    //灏唈son鏁版嵁杞寲涓哄璞$被鍨嬪苟璧嬪�肩粰list
+                if (list.billno != "" && list.billno != null)  //浠诲姟鍗曞彿锛岄潪蹇呴』锛岄潪绌哄垯鏍¢獙barcodes閲宐arcode鏄惁鐢辨浠诲姟鍗曞埗浣滅敓鎴愮殑
+                {
+                    ds = oCN.RunProcReturn("Select HBarCode barcode from Gy_BarCodeBill where HSourceBillNo='" + list.billno.ToString().Trim()+"'  Order by HItemID ", "Gy_BarCodeBill");
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.status = -1;
+                        objJsonResult.msg = "褰撳墠璁㈠崟鏃犵粦瀹氭潯鐮�!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    List<string> NameList = (from r in ds.Tables[0].AsEnumerable() select r.Field<string>("barcode")).ToList();
+                    List<string> NameList1= list.barcodes.Select(t => t.barcode).ToList();
+                    var strList = NameList1.Except(NameList).ToList();  //鍒ゆ柇鎻愪氦鏁版嵁涓潯鐮佹槸鍚﹀瓨鍦ㄤ簬璁㈠崟涓�
+                    if (strList.Count > 0) 
+                    {
+                        string Str=String.Join(",", strList.ToArray());
+                        objJsonResult.status = -1;
+                        objJsonResult.msg = "鏉$爜:"+ Str.ToString()+" 涓嶅寘鍚湪璁㈠崟:"+list.billno+"涓�!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }                
+                }
+                DLL.ClsSc_PackUnionBill oBill = new DLL.ClsSc_PackUnionBill();
+                //鍒ゆ柇绠辩爜鏄惁瀛樺湪
+                bool IsBarCodePack = oBill.IsBarCodePack(list.packagebarcode);
+                if (IsBarCodePack == false) 
+                {
+                    objJsonResult.status = -1;
+                    objJsonResult.msg = "绠辩爜宸插瓨鍦�,涓嶈兘閲嶅缁戝畾锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                Models.ClsSc_PackUnionBillMain oItem = new ClsSc_PackUnionBillMain();
+                oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+                oItem.HBillType = "3783";
+                oItem.HBillSubType = "3783";
+                oItem.HDate= DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
+                oItem.HBillNo = DBUtility.ClsPub.CreateBillCode(oItem.HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
+                oItem.HBillStatus = 1;
+                oItem.HCheckItemNowID = 0;
+                oItem.HCheckItemNextID = 0;
+                oItem.HCheckFlowID = 0;
+                oItem.HRemark = "鑷姩鍖呰绾跨敓杈扮鏉$爜";
+                oItem.HBacker = "";
+                oItem.HBackDate = "";
+                oItem.HMaker = "";
+                oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+                oItem.HChecker = "";
+                oItem.HCheckDate = "";
+                oItem.HUpDater = "";
+                oItem.HUpDateDate = "";
+                oItem.HCloseMan = "";
+                oItem.HCloseDate = "";
+                oItem.HCloseType = false;
+                oItem.HDeleteMan = "";
+                oItem.HDeleteDate = "";
+                oItem.HICMOInterID = 0;
+                oItem.HICMOBillNo = "";
+                oItem.HBarCode_Pack= list.packagebarcode;
+                oItem.HMaterID = 0;
+                oItem.HUnitID = 0;
+                oItem.HUseFlag =false;   //鏈夋晥鐘舵��
+                oBill.omodel = oItem;
+                for (int i = 0; i < list.barcodes.Count; i++)
+                {
+                    //鍒ゆ柇鏉$爜鏄惁瀛樺湪
+                    bool IsBarCode = oBill.IsBarCodePack(list.barcodes[i].barcode);
+                    if (IsBarCodePack == false)
+                    {
+                        objJsonResult.status = -1;
+                        objJsonResult.msg = "鏉$爜宸插瓨鍦�,涓嶈兘閲嶅缁戝畾锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    Models.ClsSc_PackUnionBillSub oItemSub = new ClsSc_PackUnionBillSub();
+                    ds0 = oCN.RunProcReturn("Select HBarCode,HMaterID,HUnitID,HQty,HSourceID,HGroupID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType from Gy_BarCodeBill where HSourceBillNo='" + list.billno.ToString().Trim() + "' and HBarCode='" + list.barcodes[i].barcode + "'  Order by HItemID ", "Gy_BarCodeBill");
+                    oItemSub.HEntryID = i+1;
+                    oItemSub.HMaterID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HMaterID"].ToString());
+                    oItemSub.HUnitID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HUnitID"].ToString());
+                    oItemSub.HQty = DBUtility.ClsPub.isDoule(ds0.Tables[0].Rows[0]["HQty"].ToString());
+                    oItemSub.HSourceID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HSourceID"].ToString());
+                    oItemSub.HEquipID = 0;
+                    oItemSub.HGroupID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HGroupID"].ToString());
+                    oItemSub.HWorkerID = 0; 
+                    oItemSub.HBarCode = list.barcodes[i].barcode;
+                    oItemSub.HBarCode_Pack = list.packagebarcode;
+                    oItemSub.HCloseMan = "";
+                    oItemSub.HCloseType = false;
+                    oItemSub.HRemark = "";
+                    oItemSub.HSourceInterID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HSourceInterID"].ToString());
+                    oItemSub.HSourceEntryID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HSourceEntryID"].ToString());
+                    oItemSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds0.Tables[0].Rows[0]["HSourceBillNo"].ToString());
+                    oItemSub.HSourceBillType = DBUtility.ClsPub.isStrNull(ds0.Tables[0].Rows[0]["HSourceBillType"].ToString());
+                    oItemSub.HRelationQty = 0;
+                    oItemSub.HRelationMoney = 0;
+                    oBill.DetailColl.Add(oItemSub);
+                }
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.omodel.HInterID == 0)
+                {
+                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                else
+                {
+                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+                if (bResult)
+                {
+                    objJsonResult.status = 0;
+                    objJsonResult.msg = "success";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.status = -1;
+                    objJsonResult.msg = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.status =-1;
+                objJsonResult.msg = e.Message;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 绠辨潯鐮佸彇娑堢粦瀹氬叧绯�
+        [Route("packagebarcode/cancel")]
+        [HttpPost]
+        public object cancel(string packagebarcode)
+        {
+            try
+            {
+                //
+                oCN.BeginTran();
+                //鍒犻櫎瀛愯〃
+                oCN.RunProc("Delete From Sc_PackUnionBillSub  where HBarCode_Pack=" + packagebarcode.ToString());
+                //鍒犻櫎涓昏〃
+                oCN.RunProc("Delete From Sc_PackUnionBillMain  where HBarCode_Pack=" + packagebarcode.ToString());
+                //鍒犻櫎鏉$爜妗f琛�
+                oCN.RunProc("Delete From Gy_BarCodeBill  where HBarCode=" + packagebarcode.ToString());
+
+                oCN.Commit();
 
                 objJsonResult.status = 0;
                 objJsonResult.msg = "success";
@@ -89,8 +237,8 @@
             }
             catch (Exception e)
             {
-                objJsonResult.status =-1;
-                objJsonResult.msg = "success";
+                objJsonResult.status = -1;
+                objJsonResult.msg = e.Message;
                 objJsonResult.data = null;
                 return objJsonResult;
             }
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockCheckItemBillController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockCheckItemBillController.cs"
new file mode 100644
index 0000000..6be9f4d
--- /dev/null
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StockCheckItemBillController.cs"
@@ -0,0 +1,254 @@
+锘縰sing Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Web.Http;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.鍩虹璧勬枡.鍩虹璧勬枡
+{
+    public class Gy_StockCheckItemBillController : ApiController
+    {
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
+        private json objJsonResult = new json();
+        public DataSet ds = new DataSet();
+        public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+        public Models.ClsGy_StockCheckItemBill BillNew0 = new Models.ClsGy_StockCheckItemBill();
+
+        #region 鐩樼偣鏂规鍒楄〃
+        [Route("Gy_StockCheckItemBill/Get_StockCheckItemList")]
+        [HttpGet]
+        public object Get_StockCheckItemList(string sWhere)
+        {
+            try
+            {
+                ds = StockCheckItemList(sWhere);
+                if (ds == null)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        public static DataSet StockCheckItemList(string sWhere)
+        {
+            string sql1 = string.Format(@"select * from h_v_Gy_StockCheckItemList");
+            if (sWhere == null || sWhere.Equals(""))
+            {
+                return new SQLHelper.ClsCN().RunProcReturn(sql1 + sWhere + " order by hitemid desc", "h_v_Gy_StockCheckItemList");
+            }
+            else
+            {
+                string sql = sql1 + sWhere + "order by hitemid desc";
+                return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Gy_StockCheckItemList");
+            }
+        }
+        #endregion
+
+        #region [鐩樼偣鏂规鍒犻櫎鍔熻兘]
+        [Route("Gy_StockCheckItemBill/set_DeleteBill")]
+        [HttpGet]
+        public object set_DeleteBill(string HItemID)
+        {
+            Int64 lngBillKey = 0;
+            lngBillKey = DBUtility.ClsPub.isLong(HItemID);
+            if (lngBillKey == 0)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            ds = oCn.RunProcReturn("select * from Gy_StockCheckItem where HItemID=" + lngBillKey, "Gy_StockCheckItem");
+            if (ds != null)
+            {
+                oCn.RunProc("Delete from Gy_StockCheckItem where HItemID=" + lngBillKey);
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "姝ゅ崟鎹笉瀛樺湪锛岃鏌ョ湅鏄惁閲嶅鍒犻櫎";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+        }
+
+        #endregion
+
+        #region [缂栬緫鏄剧ず琛ㄥご]
+        [Route("Gy_StockCheckItemBill/GetStockCheckItemByID")]
+        [HttpGet]
+        public object GetStockCheckItemByID(string HID)
+        {
+            Int64 lngBillKey = 0;
+            lngBillKey = DBUtility.ClsPub.isLong(HID);
+            if (lngBillKey == 0)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍗曟嵁ID涓虹┖锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            ds = oCn.RunProcReturn("select * from Gy_StockCheckItem where HItemID=" + lngBillKey, "Gy_ConkReason");
+            if (ds != null)
+            {
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            else
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "姝ゅ崟鎹笉瀛樺湪";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+        }
+
+        #endregion
+
+        #region 淇濆瓨鐩樼偣鏂规
+        [Route("Gy_StockCheckItemBill/SaveGy_StockCheckItem")]
+        [HttpPost]
+        public object SaveGy_StockCheckItem([FromBody] JObject msg)
+        {
+            var _value = msg["msg"].ToString();
+            string msg2 = _value.ToString();
+            string[] sArray = msg2.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg1 = sArray[0].ToString();
+            string msg3 = sArray[1].ToString();//褰撳墠浜�
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+            ListModels oListModels = new ListModels();
+            try
+            {
+                Models.ClsGy_StockCheckItemBill oBill = new Models.ClsGy_StockCheckItemBill();
+                List<Models.ClsGy_StockCheckItemBill> lsmain = new List<Models.ClsGy_StockCheckItemBill>();
+                msg1 = msg1.Replace("\\", "");
+                msg1 = msg1.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_StockCheckItem(msg1);
+                foreach (Models.ClsGy_StockCheckItemBill oItem in lsmain)
+                {
+                    if (oItem.HNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (oItem.HName.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //寰楀埌鐭唬鐮�
+                    string sShortNumber;
+                    sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
+                    if (sShortNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oItem.HShortNumber = sShortNumber;//鐭唬鐮�
+                    oItem.HEndFlag = true;//鏈骇鏍囧織
+                    oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇
+                    oBill = oItem;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                if (oBill.HItemID == 0)
+                {
+                    oCn.RunProc("Insert into Gy_StockCheckItem " +
+                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
+                    ",HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HMakeTime,HMakeEmp,HEndDate,HOrgID) " +
+                    " Values('" + oBill.HNumber + "','" + oBill.HName + "','" + oBill.HHelpCode + "','" + oBill.HShortNumber + "'," + oBill.HParentID.ToString() +
+                    "," + oBill.HLevel.ToString() + "," + Convert.ToString(oBill.HEndFlag ? 1 : 0) + "," + Convert.ToString(oBill.HStopflag ? 1 : 0) + ",'" + oBill.HRemark +
+                    "','" + oBill.HUseFlag + "',getdate(),'" + msg3 + "','" + oBill.HEndDate.ToString() + "'," + oBill.HOrgID.ToString()+
+                    ")", ref DBUtility.ClsPub.sExeReturnInfo);
+                    //淇敼涓婄骇涓洪潪鏈骇浠g爜
+                    oCn.RunProc("Update Gy_StockCheckItem set HEndflag=0 where HItemID=" + oBill.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    oCN.RunProc("UpDate Gy_StockCheckItem set  " +
+                    " HNumber='" + oBill.HNumber + "'" +  //鍥哄畾璧嬪��===============
+                    ",HName='" + oBill.HName + "'" +
+                    ",HShortNumber='" + oBill.HShortNumber + "'" +
+                    ",HHelpCode='" + oBill.HHelpCode + "'" +
+                    ",HUseFlag='" + oBill.HUseFlag + "'" +
+                    ",HRemark='" + oBill.HRemark + "'" +
+                    ",HEndDate='" + oBill.HEndDate + "'" +
+                    ",HModifyTime=getdate()" +
+                    ",HModifyEmp='" + msg3 + "'" +
+                    ",HStopflag=" + Convert.ToString(oBill.HStopflag ? 1 : 0) +
+                    " where HItemID=" + oBill.HItemID.ToString());
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇敼鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+    }
+}
diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESReturnStepWorkBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESReturnStepWorkBillController.cs"
index df6ff46..17f5d92 100644
--- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESReturnStepWorkBillController.cs"
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MESReturnStepWorkBillController.cs"
@@ -1,4 +1,6 @@
-锘縰sing System;
+锘縰sing DBUtility;
+using Newtonsoft.Json.Linq;
+using System;
 using System.Collections.Generic;
 using System.Data;
 using System.Linq;
@@ -72,17 +74,17 @@
         #endregion
 
         #region[杩斿伐鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁]
-        [Route("Sc_MESBeginStepWorkBill/Sc_MESBeginStepWorkBillListCheckDetai")]
+        [Route("Sc_MESReturnStepWorkBill/Sc_MESReturnStepWorkBillListCheckDetai")]
         [HttpGet]
-        public ApiResult<DataSet> Sc_MESBeginStepWorkBillListCheckDetai(string HID)
+        public ApiResult<DataSet> Sc_MESReturnStepWorkBillListCheckDetai(string HID)
         {
             if (string.IsNullOrEmpty(HID))
                 return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" };
             SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
 
-            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MESBeginWorkBillList_NEW  where hmainid= " + HID + " ", "h_v_Sc_MESBeginWorkBillList_NEW");
+            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MESReturnWorkBillList  where hmainid= " + HID + " ", "h_v_Sc_MESReturnWorkBillList");
             if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
-                return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄥ紑宸ュ崟鍙�" };
+                return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄨ繑宸ュ崟鍙�" };
 
             return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet };
         }
@@ -99,7 +101,7 @@
         {
             DBUtility.ClsPub.CurUserName = UserName;
             //缂栬緫鏉冮檺
-            if (!DBUtility.ClsPub.Security_Log_second("MES_MESReturnWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName))
+            if (!DBUtility.ClsPub.Security_Log_second("Sc_ProcessPlan_Drop", 1, true, DBUtility.ClsPub.CurUserName))
             {
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
@@ -181,7 +183,7 @@
         [HttpGet]
         public object AuditReturnStepProcessReportList(int HInterID, int IsAudit, string CurUserName)
         {
-            string ModRightNameCheck = "MES_MESReturnWorkBill_Check";
+            string ModRightNameCheck = "Sc_ProcessPlan_Check";
             DBUtility.ClsPub.CurUserName = CurUserName;
             try
             {
@@ -308,6 +310,182 @@
         }
         #endregion
 
+        #region 杩斿伐鍗曚繚瀛�/缂栬緫
+        /// <summary>
+        /// 杩斿伐鍗�
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        [Route("Sc_MESReturnStepWorkBill/SaveGetMESReturnStepWorkFrom")]
+        [HttpPost]
+        public object SaveGetMESReturnStepWorkFrom([FromBody] JObject msg)
+        {
+
+            var _value = msg["msg"].ToString();
+            string msg1 = _value.ToString();
+            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg2 = sArray[0].ToString();
+            string UserName = sArray[1].ToString();
+            string refSav = sArray[2].ToString();
+            DBUtility.ClsPub.CurUserName = UserName;
+            
+            //淇濆瓨鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log_second("Sc_ProcessPlan_Edit", 1, true, DBUtility.ClsPub.CurUserName))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+            string s = "";
+            int sYear = 0;
+            int sPeriod = 0;
+            if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = s;
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+            ListModels oListModels = new ListModels();
+            try
+            {
+                DLL.ClsSc_MESReturnStepWorkBill oBill = new DLL.ClsSc_MESReturnStepWorkBill();
+                List<Model.ClsSc_ProcessPlanMain> lsmain = new List<Model.ClsSc_ProcessPlanMain>();
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                lsmain = oListModels.getObjectByJson_Gy_MESReturnWorkFrom(msg2);
+                foreach (Model.ClsSc_ProcessPlanMain oItem in lsmain)
+                {
+                    if (refSav == "Add")
+                    {
+                        //鍗曟嵁鍙锋槸鍚﹂噸澶�
+                        if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                    if (refSav == "Update")
+                    {
+                        if (BillOld.ShowBill(oItem.HInterID, ref s) == false)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        //鍒ゆ柇鏄惁鍙紪杈�
+                        if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (BillOld.omodel.HBillStatus > 1)
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = s + "锛屼笉鍏佽淇敼";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+
+                    DBUtility.ClsPub.CurUserName = oItem.HMaker;
+                    oItem.HBillType = "3718";
+                    oItem.HBillSubType = "3718";
+                    oItem.HBillStatus = 1;   //鍗曟嵁鐘舵�侊紙1鏈锛�2瀹℃牳閫氳繃锛�3鍏抽棴锛�4浣滃簾锛�5瀹℃牳閫�鍥�,6瀹℃牳涓�,7宸查槄锛�8宸插洖澶嶏紝9缁撴锛�10楠岃瘉,11涓嬭揪锛�12寮�宸�,13鐢宠瀹℃壒,15鐢宠妫�楠岋紝16 鍒ゅ畾鍚堟牸锛�17鍒ゅ畾涓嶅悎鏍硷級     
+                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oBill.omodel = oItem;
+                }
+
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.omodel.HInterID == 0)
+                {
+
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    if (bResult)
+                    {
+                        objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //杩斿洖涓籌D
+                        //绯荤粺鍙傛暟  鑷姩瀹℃牳
+                        string sReturn = "";
+                        if (oSystemParameter.ShowBill(ref sReturn) == true)
+                        {
+                            if (oSystemParameter.omodel.Sc_ICMOBillWorkQtyStatus_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                            {
+                                objJsonResult.Verify = "Y";
+                            }
+                            else
+                            {
+                                objJsonResult.Verify = "N";
+                            }
+                        }
+                    }
+
+                }
+                else
+                {
+                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+                    objJsonResult.Verify = "N";
+                }
+                if (bResult)
+                {
+
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.Message;
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
         #endregion
     }
 }
diff --git a/WebAPI/DLL/ClsSb_EquipDotCheckRuleBill.cs b/WebAPI/DLL/ClsSb_EquipDotCheckRuleBill.cs
index d72eaef..b02339f 100644
--- a/WebAPI/DLL/ClsSb_EquipDotCheckRuleBill.cs
+++ b/WebAPI/DLL/ClsSb_EquipDotCheckRuleBill.cs
@@ -12,7 +12,7 @@
 
         public ClsSb_EquipDotCheckRuleBill()
         {
-            base.MvarItemKeySub = "ClsSb_EquipDotCheckRuleBillSub";
+            base.MvarItemKeySub = "Sb_EquipDotCheckRuleBillSub";
             base.MvarItemKeySub2 = "";
             base.MvarItemKeySub3 = "";
             base.MvarItemKeySub4 = "";
diff --git a/WebAPI/DLL/ClsSb_EquipMaintainRuleBill.cs b/WebAPI/DLL/ClsSb_EquipMaintainRuleBill.cs
index 0007191..8bc97a1 100644
--- a/WebAPI/DLL/ClsSb_EquipMaintainRuleBill.cs
+++ b/WebAPI/DLL/ClsSb_EquipMaintainRuleBill.cs
@@ -42,7 +42,7 @@
                 //
                 oCn.BeginTran();
                 //鏇存柊涓昏〃
-                oCn.RunProc("UpDate Sb_EquipMaintainPlanBillMain set  " +
+                oCn.RunProc("UpDate Sb_EquipMaintainRuleBillMain set  " +
                 " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
                 ",HDate='" + omodel.HDate + "'" +
                 ",HYear='" + omodel.HYear.ToString() + "'" +
@@ -83,7 +83,7 @@
                 //鎻掑叆閰嶄欢瀛愯〃
                 foreach (Models.ClsSb_EquipMaintainRuleBillSub oSub in DetailColl_Mater)
                 {
-                    oCn.RunProc("Insert into Sb_EquipMaintainRuleBillSub " +
+                    string sql = "Insert into Sb_EquipMaintainRuleBillSub " +
                       " (HInterID,HEntryID," +
                       "HCloseMan,HEntryCloseDate,HCloseType,HRemark," +
                       "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," +
@@ -92,8 +92,9 @@
                       + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() +
                       ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
                       "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
-                      "," + oSub.HQty.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() +
-                      ") ");
+                      "," + oSub.HQty.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + ",0" +
+                      ") ";
+                    oCn.RunProc(sql);
                 }
                 sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
                 oCn.Commit();
diff --git a/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs b/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs
index 19492b6..33c00b7 100644
--- a/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs
+++ b/WebAPI/DLL/ClsSc_MESReturnStepWorkBill.cs
@@ -22,5 +22,106 @@
             base.HBillSubType = "3718";
 
         }
+
+        #region 鍥哄畾浠g爜
+
+        ~ClsSc_MESReturnStepWorkBill()
+        {
+            DetailColl = null;
+        }
+
+        #endregion   鑷畾涔夋柟娉�
+
+        //淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //
+                oCn.BeginTran();
+                //鏇存柊涓昏〃
+                oCn.RunProc("UpDate Sc_ProcessPlanMain set  " +
+                " HBillNo='" + omodel.HBillNo + "'" +  //鍥哄畾璧嬪��===============
+                ",HDate='" + omodel.HDate + "'" +
+                ",HYear='" + omodel.HYear.ToString() + "'" +
+                ",HPeriod='" + omodel.HPeriod.ToString() + "'" +
+                ",HBillStatus='" + omodel.HBillStatus + "'" +
+                ",HRemark='" + omodel.HRemark + "'" +
+                ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" +
+                ",HUpDateDate=getdate()" +
+                //========================================
+                //",HSupID=" + omodel.HSupID.ToString() +
+                //",HEmpID=" + omodel.HEmpID.ToString() +
+                ",HICMOInterID=" + omodel.HICMOInterID.ToString() +
+                ",HICMOBillNo='" + omodel.HICMOBillNo + "'" +
+                ",HMaterID=" + omodel.HMaterID.ToString() +
+                " where HInterID=" + lngBillKey.ToString());
+                //鍒犻櫎鍏宠仈
+                DeleteRelation(ref sReturn, lngBillKey);
+                //鍒犻櫎瀛愯〃
+                DeleteBillSub(lngBillKey);
+                //鎻掑叆瀛愯〃
+                omodel.HInterID = lngBillKey;
+                //鎻掑叆瀛愯〃
+                oCn.RunProc("Insert Into Sc_ProcessPlanSub " +
+                    "(HInterID,HEntryID,HBillNo" +
+                    ",HICMOInterID,HICMOBillNo,HProcNo,HProcID" +
+                    ",HGroupID,HDeptID,HWorkerID,HQty,HPlanBeginDate" +
+                    ") " +
+                    " values(" + omodel.HInterID.ToString() + ",0,'" + omodel.HBillNo +
+                    "'," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "','" + omodel.HProcNo + "'," + omodel.HProcID.ToString() + "," + omodel.HGroupID.ToString() +
+                    "," + omodel.HDeptID.ToString() + "," + omodel.HWorkerID.ToString() + "," + omodel.HQty.ToString() + ",'" + omodel.HPlanBeginDate.ToString() +
+                     "') ");
+                sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //鏂板鍗曟嵁
+        public override bool AddBill(ref string sReturn)
+        {
+            try
+            {
+                //寰楀埌mainid
+                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+                oCn.BeginTran();
+                //涓昏〃
+                oCn.RunProc("Insert Into Sc_ProcessPlanMain " +
+                "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
+                ",HYear,HPeriod,HRemark" +
+                ",HICMOInterID,HICMOBillNo,HMaterID" +
+                ") " +
+                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + DBUtility.ClsPub.CurUserName + "',getdate()" +
+                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" +
+                "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," +  omodel.HMaterID.ToString() + 
+                 ") ");
+                //鎻掑叆瀛愯〃
+                oCn.RunProc("Insert Into Sc_ProcessPlanSub " +
+                    "(HInterID,HEntryID,HBillNo" +
+                    ",HICMOInterID,HICMOBillNo,HProcNo,HProcID" +
+                    ",HGroupID,HDeptID,HWorkerID,HQty,HPlanBeginDate" +
+                    ") " +
+                    " values(" + omodel.HInterID.ToString() + ",0,'" + omodel.HBillNo +
+                    "'," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "','" + omodel.HProcNo + "'," + omodel.HProcID.ToString() + "," + omodel.HGroupID.ToString() +
+                    "," + omodel.HDeptID.ToString() + "," + omodel.HWorkerID.ToString() + "," + omodel.HQty.ToString() + ",'" + omodel.HPlanBeginDate.ToString() +
+                     "') ");
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
     }
 }
\ No newline at end of file
diff --git a/WebAPI/DLL/ClsSc_PackUnionBill.cs b/WebAPI/DLL/ClsSc_PackUnionBill.cs
new file mode 100644
index 0000000..e9b08f8
--- /dev/null
+++ b/WebAPI/DLL/ClsSc_PackUnionBill.cs
@@ -0,0 +1,383 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+using System.Data;
+
+namespace WebAPI.DLL
+{
+    public class ClsSc_PackUnionBill : DBUtility.ClsXt_BaseBill
+    {
+        public Models.ClsSc_PackUnionBillMain omodel = new Models.ClsSc_PackUnionBillMain();
+        public List<Models.ClsSc_PackUnionBillSub> DetailColl = new List<Models.ClsSc_PackUnionBillSub>();
+
+        public ClsSc_PackUnionBill()
+        {
+            base.MvarItemKeySub = "Sc_PackUnionBillSub";
+            base.MvarItemKeySub2 = "";
+            base.MvarItemKeySub3 = "";
+            base.MvarItemKeySub4 = "";
+            base.MvarItemKey = "Sc_PackUnionBillMain";
+            base.MvarReportTitle = "鐢熶骇鍖呰鍗�";
+            base.BillType = "3783";
+        }
+
+        #region 鍥哄畾浠g爜
+
+        ~ClsSc_PackUnionBill()
+        {
+            DetailColl = null;
+        }
+
+        #endregion   鑷畾涔夋柟娉�
+        //淇敼鍗曟嵁
+        public override bool ModifyBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //
+                oCn.BeginTran();
+                //鏇存柊涓昏〃
+                oCn.RunProc("UpDate Sc_PackUnionBillMain set  " +
+                " HBillNo='" + omodel.HBillNo + "'" +
+                ",HDate='" + omodel.HDate + "'" +
+                ",HICMOInterID=" + omodel.HICMOInterID + "" +
+                ",HICMOBillNo='" + omodel.HICMOBillNo + "'" +
+                ",HBarCode_Pack='" + omodel.HBarCode_Pack + "'" +
+                ",HMaterID=" + omodel.HMaterID + "" +
+                ",HUnitID=" + omodel.HUnitID + "" +
+                ",HRemark='" + omodel.HRemark + "'" +
+                ",HUpdater='" + DBUtility.ClsPub.CurUserName + "'" +
+                ",HUpdateDate='" + DBUtility.ClsPub.GetServerDate(-1) + "'" +
+                " where HInterID=" + lngBillKey.ToString());
+                //鍒犻櫎鍏宠仈
+                //DeleteRelation(ref sReturn, lngBillKey);
+                ////鍒犻櫎瀛愯〃
+                DeleteBillSub(lngBillKey);
+                ////鎻掑叆瀛愯〃
+                omodel.HInterID = lngBillKey;
+                foreach (Models.ClsSc_PackUnionBillSub oSub in DetailColl)
+                {
+                    oCn.RunProc("Insert into Sc_PackUnionBillSub " +
+                      " (HInterID,HEntryID,HMaterID,HUnitID,HQty,HSourceID" +
+                      ",HEquipID,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_Pack" +
+                      ",HCloseMan,HCloseType,HRemark" +
+                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney)" +
+                      " values("
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HSourceID.ToString() + "" +
+                      "," + oSub.HEquipID.ToString() + "," + oSub.HGroupID.ToString() + "," + oSub.HWorkerID.ToString() + ",'" + oSub.HScanDate.ToShortDateString() + "','" + oSub.HBarCode + "','" + oSub.HBarCode_Pack + "'" +
+                      ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
+                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
+                      ") ");
+                }
+                sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //鏂板鍗曟嵁
+        public override bool AddBill(ref string sReturn)
+        {
+            try
+            {
+                //寰楀埌mainid
+                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+                oCn.BeginTran();
+                //涓昏〃
+                oCn.RunProc("Insert Into Sc_PackUnionBillMain   " +
+                "(HYear,HPeriod,HBillType,HInterID" +
+                ",HDate,HBillNo,HBillStatus,HRemark,HICMOInterID" +
+                ",HICMOBillNo,HBarCode_Pack,HMaterID,HUnitID" +
+                ",HMaker,HMakeDate" +
+                ") " +
+                " values(" + omodel.HYear + "," + omodel.HPeriod + ",'" + this.BillType + "'," + omodel.HInterID + "" +
+                ",'" + omodel.HDate + "','" + omodel.HBillNo.ToString() + "'," + omodel.HBillStatus + ",'" + omodel.HRemark + "'," + omodel.HICMOInterID + "" +
+                ",'" + omodel.HICMOBillNo.ToString() + "','" + omodel.HBarCode_Pack.ToString() + "'," + omodel.HMaterID + "," + omodel.HUnitID + "" +
+                ",'" + DBUtility.ClsPub.CurUserName + "','" + DBUtility.ClsPub.GetServerDate(-1) + "'" +
+                ") ");
+                ////鎻掑叆瀛愯〃
+                string HSourceInterID = "0";
+                string HSourceEntryID = "0";
+                string HSourceBillNo = "0";
+                string HSourceBillType = "0";
+                string HMaterID = "0";
+                string HUnitID = "0";
+                double HQty = 0;
+                
+                foreach (Models.ClsSc_PackUnionBillSub oSub in DetailColl)
+                {
+                    HSourceInterID = oSub.HSourceInterID.ToString();
+                    HSourceEntryID = oSub.HSourceEntryID.ToString();
+                    HSourceBillNo = oSub.HSourceBillNo.ToString();
+                    HSourceBillType = oSub.HSourceBillType.ToString();
+                    HMaterID = oSub.HMaterID.ToString();
+                    HUnitID = oSub.HUnitID.ToString();
+                    oCn.RunProc("Insert into Sc_PackUnionBillSub " +
+                      " (HInterID,HEntryID,HMaterID,HUnitID,HQty,HSourceID" +
+                      ",HEquipID,HGroupID,HWorkerID,HBarCode,HBarCode_Pack" +
+                      ",HCloseMan,HCloseType,HRemark" +
+                      ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney)" +
+                      " values("
+                      + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HSourceID.ToString() + "" +
+                      "," + oSub.HEquipID.ToString() + "," + oSub.HGroupID.ToString() + "," + oSub.HWorkerID.ToString() + ",'" + oSub.HBarCode + "','" + oSub.HBarCode_Pack + "'" +
+                      ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" +
+                      "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
+                      ") ");
+                    HQty += oSub.HQty;
+                }
+                //绠辩爜鎻掑叆鏉$爜妗f琛�
+                oCn.RunProc("insert into Gy_BarCodeBill(HInterID,HEntryID,HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBatchNo,HMakeDate " +
+                             ",HSourceInterID, HSourceEntryID, HSourceBillNo, HSourceBillType, HUseFlag, HStopflag, HSupID, HGroupID, HPrintQty)" +
+                             "values('" + HSourceInterID + "', 1, '" + omodel.HBarCode_Pack + "', '绠卞彿鏉$爜', '" + HMaterID + "', '" + HUnitID + "','" + HQty + "', '', getdate()" +
+                             ", '" + HSourceInterID + "', '" + HSourceEntryID + "', '" + HSourceBillNo + "', '" + HSourceBillType + "', 1, 0, 0, 0, 0)");
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+        //鏄剧ず鍗曟嵁
+        public override bool ShowBill(Int64 lngBillKey, ref string sReturn)
+        {
+            try
+            {
+                //鏌ヨ涓昏〃
+                DataSet Ds;
+                Ds = oCn.RunProcReturn("Select * from Sc_PackUnionBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_PackUnionBillMain");
+                if (Ds.Tables[0].Rows.Count == 0)
+                {
+                    sReturn = "鍗曟嵁鏈壘鍒帮紒";
+                    return false;
+                }
+                //璧嬪��
+                omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]);
+                omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]);
+                omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]);
+                omodel.HDate = Convert.ToDateTime(Ds.Tables[0].Rows[0]["HDate"]);
+                omodel.HBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]);
+                omodel.HRemark = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
+                //
+                omodel.HICMOInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOInterID"]);
+                omodel.HICMOBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HICMOBillNo"]);
+                omodel.HBarCode_Pack = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCode_Pack"]);
+                omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]);
+                omodel.HUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HUnitID"]);
+                //
+                omodel.HBacker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBacker"]);
+                omodel.HBackDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBackDate"]);
+                omodel.HChecker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HChecker"]);
+                omodel.HCheckDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckDate"]);
+                omodel.HMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMaker"]);
+                omodel.HMakeDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMakeDate"]);
+                omodel.HUpDateDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDateDate"]);
+                omodel.HUpDater = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUpDater"]);
+                omodel.HCloseDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseDate"]);
+                omodel.HCloseMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCloseMan"]);
+                omodel.HDeleteDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteDate"]);
+                omodel.HDeleteMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeleteMan"]);
+                //寰幆
+                DataSet DsSub;
+                DsSub = oCn.RunProcReturn("Select * from Sc_PackUnionBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_PackUnionBillSub");
+                DetailColl.Clear();//娓呯┖
+                for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
+                {
+                    Models.ClsSc_PackUnionBillSub oSub = new Models.ClsSc_PackUnionBillSub();
+                    oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]);
+                    oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]);
+                    oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]);
+                    oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]);
+                    oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]);
+                    oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]);
+                    oSub.HEquipID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEquipID"]);
+                    oSub.HGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HGroupID"]);
+                    oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]);
+                    oSub.HScanDate = Convert.ToDateTime(DsSub.Tables[0].Rows[i]["HScanDate"]);
+                    oSub.HBarCode = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBarCode"]);
+                    oSub.HBarCode_Pack =DBUtility.ClsPub.isStrNull( DsSub.Tables[0].Rows[i]["HBarCode_Pack"]);
+                    oSub.HRemark = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRemark"]);
+                    oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]);
+                    oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]);
+                    //
+                    oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]);
+                    oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]);
+                    oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillType"]);
+                    oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSourceBillNo"]);
+                    oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]);
+                    oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);
+                    DetailColl.Add(oSub);
+                }
+                sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�";
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                throw (e);
+            }
+        }
+
+        /// <summary>
+        ///  鏉$爜鎵弿璁板綍,鏂板鍒板寘瑁呭崟瀛愯〃(鐘舵�佷负 0  涓存椂璁板綍)
+        /// </summary>
+        /// <param name="DetailColl"></param>
+        /// <param name="sReturn"></param>
+        /// <returns></returns>
+        public bool AddBill_PDA(Model.ClsSc_PackUnionBillSub oSub, ref string sReturn)
+        {
+            try
+            {
+                //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+                oCn.BeginTran();
+                ////鎻掑叆瀛愯〃
+                oCn.RunProc("Insert into Sc_PackUnionBillSub " +
+                  " (HInterID,HEntryID,HMaterID,HUnitID,HQty,HSourceID" +
+                  ",HEquipID,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_Pack" +
+                  ",HCloseMan,HCloseType,HRemark,HStatus" +
+                  ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney)" +
+                  " values("
+                  + oSub.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQty.ToString() + "," + oSub.HSourceID.ToString() + "" +
+                  "," + oSub.HEquipID.ToString() + "," + oSub.HGroupID.ToString() + "," + oSub.HWorkerID.ToString() + ",getdate(),'" + oSub.HBarCode + "','" + oSub.HBarCode_Pack + "'" +
+                  ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "',0" +
+                  "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() +
+                  ") ");
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+
+
+        //鏉$爜鎵弿璁板綍,鏂板鍒板寘瑁呭崟
+        public bool AddBill_PDA(Model.ClsSc_PackUnionBillMain omodel, ref string sReturn)
+        {
+            try
+            {
+                //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+                oCn.BeginTran();
+                //淇敼瀛愯〃鐘舵�佷负 1  , 鏈夋晥鏁版嵁
+                oCn.RunProc("update Sc_PackUnionBillSub set HStatus=1 where HInterID=" + omodel.HInterID.ToString());
+                //涓昏〃
+                oCn.RunProc("Insert Into Sc_PackUnionBillMain   " +
+                "(HYear,HPeriod,HBillType,HInterID" +
+                ",HDate,HBillNo,HBillStatus,HRemark,HICMOInterID" +
+                ",HICMOBillNo,HBarCode_Pack,HMaterID,HUnitID" +
+                ",HMaker,HMakeDate" +
+                ") " +
+                " values(" + omodel.HYear + "," + omodel.HPeriod + ",'" + this.BillType + "'," + omodel.HInterID + "" +
+                ",getdate(),'" + omodel.HBillNo.ToString() + "'," + omodel.HBillStatus + ",'" + omodel.HRemark + "'," + omodel.HICMOInterID + "" +
+                ",'" + omodel.HICMOBillNo.ToString() + "','" + omodel.HBarCode_Pack.ToString() + "'," + omodel.HMaterID + "," + omodel.HUnitID + "" +
+                ",'" + omodel.HMaker + "',getdate()" +
+                ") ");
+                sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+
+        //鏍规嵁浠g爜杩斿洖椤圭洰淇℃伅
+        public DataSet GetInfoByID_View(long HInterID, string sWhere)
+        {
+            DataSet DS;
+            try
+            {
+                DS = oCn.RunProcReturn("Select * from h_v_Sc_PackUnionBillSub Where HInterID=" + HInterID.ToString() + " " + sWhere, "h_v_Sc_PackUnionBillSub", ref DBUtility.ClsPub.sExeReturnInfo);
+                if (DS.Tables[0].Rows.Count == 0)
+                    return null;
+                else
+                {
+                    return DS;
+                }
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
+
+        //鍒ゆ柇鏉$爜涓存椂琛ㄤ腑鏄惁瀛樺湪
+        public bool IsBarCodePack(string HBarCode_Pack)
+        {
+            DataSet DS;
+            try
+            {
+                DS = oCn.RunProcReturn("Select * from Sc_PackUnionBillMain Where  HBarCode_Pack='" + HBarCode_Pack + "'", "Sc_PackUnionBillMain", ref DBUtility.ClsPub.sExeReturnInfo);
+                if (DS.Tables[0].Rows.Count == 0)
+                    return true;       //涓嶅瓨鍦ㄧ浉鍚屾潯鐮�
+                else
+                {
+                    return false;
+                }
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
+
+        //鍒ゆ柇鏉$爜涓存椂琛ㄤ腑鏄惁瀛樺湪
+        public bool IsBarCode(string sBarCode)
+        {
+            DataSet DS;
+            try
+            {
+                DS = oCn.RunProcReturn("Select * from Sc_PackUnionBillSub Where  HBarCode='" + sBarCode + "'", "Sc_PackUnionBillSub", ref DBUtility.ClsPub.sExeReturnInfo);
+                if (DS.Tables[0].Rows.Count == 0)
+                    return true;       //涓嶅瓨鍦ㄧ浉鍚屾潯鐮�
+                else
+                {
+                    return false;
+                }
+            }
+            catch (Exception e)
+            {
+                throw (e);
+            }
+        }
+
+        //瀹℃牳鍖呰鍗曪紙濡傛灉瀛愯〃涓殑鏉$爜涓嶅湪鏉$爜妗f涓� 鍒欙紝鍦ㄦ。妗堜腑鑷姩鐢熸垚锛� 
+        public bool CheckBill(Int64 lngBillKey, ref string sReturn)
+        { 
+            try
+            {
+                oCn.BeginTran();
+                string HChecker =DBUtility.ClsPub.CurUserName;
+                //string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
+                oCn.RunProc("Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate=getdate() Where HInterID=" + lngBillKey.ToString());
+                oCn.RunProc("exec h_p_WMS_PackUnionToBarCode   " + lngBillKey.ToString() ); //鏇存柊鏉$爜妗f
+                sReturn = "";
+                oCn.Commit();
+                return true;
+            }
+            catch (Exception e)
+            {
+                sReturn = e.Message;
+                oCn.RollBack();
+                throw (e);
+            }
+        }
+
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index d01d267..7de695b 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -583,6 +583,18 @@
         }
 
         /// <summary>
+        /// 澶勭悊鏂扮洏鐐规柟妗堣〃鐨刯son
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Models.ClsGy_StockCheckItemBill> getObjectByJson_Gy_StockCheckItem(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Models.ClsGy_StockCheckItemBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsGy_StockCheckItemBill>>(jsonString);
+            return list;
+        }
+
+        /// <summary>
         /// 澶勭悊鏂板妯″叿淇濆吇璁板綍琛ㄤ富琛ㄧ殑json
         /// </summary>
         /// <param name="jsonString"></param>
@@ -1653,7 +1665,19 @@
             List<Models.ClsSc_MESBeginWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSc_MESBeginWorkBillMain>>(jsonString);
             return list;
         }
-    
+
+        /// <summary>
+        /// 鎶ュ伐骞冲彴杩斿伐鍗曚富琛╦son
+        /// </summary>
+        /// <param name="jsonString"></param>
+        /// <returns></returns>
+        public List<Model.ClsSc_ProcessPlanMain> getObjectByJson_Gy_MESReturnWorkFrom(string jsonString)
+        {
+            jsonString = "[" + jsonString.ToString() + "]";
+            List<Model.ClsSc_ProcessPlanMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_ProcessPlanMain>>(jsonString);
+            return list;
+        }
+
         /// <summary>
         /// 鎶ュ伐骞冲彴浜ч噺姹囨姤涓昏〃json
         /// </summary>
diff --git a/WebAPI/Models/ClsGy_StockCheckItemBill.cs b/WebAPI/Models/ClsGy_StockCheckItemBill.cs
new file mode 100644
index 0000000..eb02994
--- /dev/null
+++ b/WebAPI/Models/ClsGy_StockCheckItemBill.cs
@@ -0,0 +1,32 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace WebAPI.Models
+{
+    public class ClsGy_StockCheckItemBill : DBUtility.ClsGy_Base_Model
+    {
+        //public int HItemID;              // int                     //涓婚敭 int             	 
+        //public string HNumber;          //         varchar(50)		//浠g爜 
+        //public string HName;            // varchar(50)		//鍚嶇О 
+        //public string HShortNumber;     // varchar(50)		//鐭唬鐮�   
+        //public int HParentID;           // int           //鐖剁骇ID int   
+        //public int HLevel;              //         int			//绛夌骇	int  
+        //public bool HEndFlag;           //            bit			//鏈骇鏍囧織 bit   
+        //public bool HStopflag;          //       bit			//绂佺敤鏍囧織 bit
+        //public string HRemark;          //         varchar(500)		//澶囨敞 varchar(50)   
+        //public string HHelpCode;        // varchar(20)		//鍔╄鐮�  varchar(20)
+        //public string HUseFlag;         // varchar(10)		//浣跨敤鐘舵�侊紙鏈娴嬶紝鏈娇鐢紝宸蹭娇鐢級
+        //public DateTime HMakeTime;      // datetime			//寤虹珛鏃堕棿(getdate())	
+        public string HMakeEmp;         // varchar(100)		//鍒涘缓浜�			
+        public string HCheckEmp;        // varchar(100)		//瀹℃牳浜�
+        public DateTime HCheckTime;     // datetime			//瀹℃牳鏃堕棿
+        public string HModifyEmp;       // varchar(100)		//淇敼浜�
+        public DateTime HModifyTime;    // datetime			//淇敼鏃堕棿
+        public string HStopEmp;         // varchar(100)		//绂佺敤浜�
+        public DateTime HStopTime;      // datetime			//绂佺敤鏃堕棿
+        public DateTime HEndDate;
+        public int HOrgID;
+    }
+}
\ No newline at end of file
diff --git a/WebAPI/Models/ClsSc_PackUnionBillMain.cs b/WebAPI/Models/ClsSc_PackUnionBillMain.cs
new file mode 100644
index 0000000..98bc8ec
--- /dev/null
+++ b/WebAPI/Models/ClsSc_PackUnionBillMain.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WebAPI.Models
+{
+    public class ClsSc_PackUnionBillMain : DBUtility.ClsXt_BaseBillMain
+    {
+        public Int64 HICMOInterID;
+        public string HICMOBillNo;
+        public string HBarCode_Pack;
+        public Int64 HMaterID;
+        public Int64 HUnitID;
+    }
+}
diff --git a/WebAPI/Models/ClsSc_PackUnionBillSub.cs b/WebAPI/Models/ClsSc_PackUnionBillSub.cs
new file mode 100644
index 0000000..816d847
--- /dev/null
+++ b/WebAPI/Models/ClsSc_PackUnionBillSub.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace WebAPI.Models
+{
+    public class ClsSc_PackUnionBillSub : DBUtility.ClsXt_BaseBillSub
+    {
+        //============
+        public Int64 HMaterID;
+        public Int64 HUnitID;
+        public double HQty;
+        public Int64 HErpClsID;
+        public Int64 HSourceID;
+        public Int64 HEquipID;
+        public Int64 HGroupID;
+        public Int64 HWorkerID;
+        public DateTime HScanDate;
+        public string HBatchNo;
+        public string HBarCode;
+        public string HBarCode_Pack;
+    }
+}
diff --git a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
index 75d6496..4c107a6 100644
--- a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
+++ b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -18,25 +18,25 @@
       <publishTime>02/22/2013 08:43:40</publishTime>
     </File>
     <File Include="bin/BLL.dll">
-      <publishTime>12/10/2021 14:08:52</publishTime>
+      <publishTime>12/14/2021 15:46:52</publishTime>
     </File>
     <File Include="bin/BLL.pdb">
-      <publishTime>12/10/2021 14:08:52</publishTime>
+      <publishTime>12/14/2021 15:46:52</publishTime>
     </File>
     <File Include="bin/DAL.dll">
-      <publishTime>12/10/2021 14:08:44</publishTime>
+      <publishTime>12/14/2021 15:46:49</publishTime>
     </File>
     <File Include="bin/DAL.pdb">
-      <publishTime>12/10/2021 14:08:44</publishTime>
+      <publishTime>12/14/2021 15:46:49</publishTime>
     </File>
     <File Include="bin/Dapper.dll">
       <publishTime>07/22/2016 14:52:40</publishTime>
     </File>
     <File Include="bin/DBUtility.dll">
-      <publishTime>12/10/2021 14:08:24</publishTime>
+      <publishTime>12/14/2021 15:46:43</publishTime>
     </File>
     <File Include="bin/DBUtility.pdb">
-      <publishTime>12/10/2021 14:08:24</publishTime>
+      <publishTime>12/14/2021 15:46:43</publishTime>
     </File>
     <File Include="bin/Interop.gregn6Lib.dll">
       <publishTime>08/25/2021 10:28:25</publishTime>
@@ -60,10 +60,10 @@
       <publishTime>07/25/2012 11:48:56</publishTime>
     </File>
     <File Include="bin/Model.dll">
-      <publishTime>12/10/2021 14:08:25</publishTime>
+      <publishTime>12/14/2021 15:46:44</publishTime>
     </File>
     <File Include="bin/Model.pdb">
-      <publishTime>12/10/2021 14:08:25</publishTime>
+      <publishTime>12/14/2021 15:46:44</publishTime>
     </File>
     <File Include="bin/Models/ClsSc_MouldScrapOutBillMain.cs">
       <publishTime>08/19/2021 09:44:01</publishTime>
@@ -72,22 +72,22 @@
       <publishTime>08/03/2014 20:33:56</publishTime>
     </File>
     <File Include="bin/Pub_Class.dll">
-      <publishTime>12/10/2021 14:08:00</publishTime>
+      <publishTime>12/14/2021 15:46:39</publishTime>
     </File>
     <File Include="bin/Pub_Class.pdb">
-      <publishTime>12/10/2021 14:08:00</publishTime>
+      <publishTime>12/14/2021 15:46:39</publishTime>
     </File>
     <File Include="bin/Pub_Control.dll">
-      <publishTime>12/10/2021 14:08:01</publishTime>
+      <publishTime>12/14/2021 15:46:40</publishTime>
     </File>
     <File Include="bin/Pub_Control.pdb">
-      <publishTime>12/10/2021 14:08:01</publishTime>
+      <publishTime>12/14/2021 15:46:40</publishTime>
     </File>
     <File Include="bin/SQLHelper.dll">
-      <publishTime>12/10/2021 14:08:02</publishTime>
+      <publishTime>12/14/2021 15:46:41</publishTime>
     </File>
     <File Include="bin/SQLHelper.pdb">
-      <publishTime>12/10/2021 14:08:02</publishTime>
+      <publishTime>12/14/2021 15:46:41</publishTime>
     </File>
     <File Include="bin/stdole.dll">
       <publishTime>05/09/2021 13:35:37</publishTime>
@@ -189,10 +189,10 @@
       <publishTime>11/24/2014 11:18:48</publishTime>
     </File>
     <File Include="bin/WebAPI.dll">
-      <publishTime>12/10/2021 14:09:14</publishTime>
+      <publishTime>12/14/2021 15:47:00</publishTime>
     </File>
     <File Include="bin/WebAPI.pdb">
-      <publishTime>12/10/2021 14:09:14</publishTime>
+      <publishTime>12/14/2021 15:47:00</publishTime>
     </File>
     <File Include="bin/WebGrease.dll">
       <publishTime>07/17/2013 17:03:52</publishTime>
@@ -363,7 +363,7 @@
       <publishTime>08/06/2021 22:57:28</publishTime>
     </File>
     <File Include="Web.config">
-      <publishTime>12/10/2021 14:12:34</publishTime>
+      <publishTime>12/14/2021 15:49:27</publishTime>
     </File>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index b741b9c..75c5a74 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -449,8 +449,11 @@
     <Compile Include="DLL\ClsSc_MouldOtherOutBill.cs" />
     <Compile Include="DLL\ClsSc_MouldOtherInBill.cs" />
     <Compile Include="DLL\ClsSc_MouldMoveStockStepOutBill.cs" />
+    <Compile Include="DLL\ClsSc_PackUnionBill.cs" />
     <Compile Include="DLL\宸ヨ祫绠$悊\ClsPay_GroupBalBill.cs" />
     <Compile Include="DLL\宸ヨ祫绠$悊\ClsPay_WorkTimesBill.cs" />
+    <Compile Include="Models\ClsSc_PackUnionBillMain.cs" />
+    <Compile Include="Models\ClsSc_PackUnionBillSub.cs" />
     <Compile Include="Models\jsonScanline.cs" />
     <Compile Include="Models\ScanLineCode.cs" />
     <Compile Include="Models\宸ヨ祫绠$悊\ClsPay_GroupBalBillEmp.cs" />

--
Gitblit v1.9.1