From bd386b409edba6e29b29089bbe958b3936fce1fc Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期五, 25 三月 2022 17:07:14 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/ListModels.cs                                   |    2 
 WebAPI/WebAPI.csproj.user                              |    2 
 WebAPI/Models/ClsQK_PackingBill.cs                     |   17 -
 WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs |  347 +++++++++++++++++++++++++++++++++++++++++++------
 4 files changed, 309 insertions(+), 59 deletions(-)

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 0a6c7a5..beeee53 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"
@@ -75,7 +75,6 @@
         }
         #endregion
 
-
         #region 澧欏挃瑁呯鍗曞洖杞︿簨浠�
         [Route("Sc_ICMOBill/QK_PackingBillByXSBill")]
         [HttpGet]
@@ -83,20 +82,16 @@
         {
             try
             {
-                string sql = string.Format(@"select b.HMaterID,m.HNumber HMaterCode,m.HName HMaterName,b.HUnitID,u.HName HUnitName,
-                                b.HQty HQty,a.HAddress HAddress,b.HDate HDate,b.HOutStockQty HOutStockQty,b.HInvoiceQty HInvoiceQty,
-                                b.HTaxPrice HTaxPrice,b.HPrice HPrice,b.HMoney HMoney,a.HCusID HCusID,c.HName HCusName,a.HEmpID,e.HName HEmpName,
-                                i.HInterID,i.HBillNo
-                                from Xs_SeOrderBillMain a 
-                                left join  Xs_SeOrderBillSub b on a.HInterID=b.HInterID
-                                left join Gy_Material m on b.HMaterID=m.HItemID
-                                left join Gy_Unit u on b.HUnitID=u.HItemID
-                                left join Gy_Customer c on a.HCusID=c.HItemID
-                                left join Gy_Employee e on a.HEmpID=e.HItemID
-                                left join Sc_ICMOBillMain i on i.HSeOrderInterID=a.HInterID
-                                where a.HInterID=(select HSeOrderInterID from Sc_ICMOBillMain where HBillNo='" + HBillNo + "')");
+                string sql = string.Format(@"select a.HInterID,a.HBillNo,a.HMaterID,m.HName HMaterName, a.HUnitID,u.HName HUnitName,a.HPlanQty,a.HCusID, c.HName HCusName,a.HEmpID,e.HName HEmpName,a.HDeptID,d.HName HDeptName,a.HPlanEndDate,0 HMinQty,0 HTotalQty,0 HSpsQty
+                                            from Sc_ICMOBillMain a 
+                                            left join Gy_Material m on a.HMaterID=m.HItemID
+                                            left join Gy_Unit u on a.HUnitID=u.HItemID
+                                            left join Gy_Customer c on a.HCusID=c.HItemID
+                                            left join Gy_Employee e on a.HEmpID=e.HItemID
+                                            left join Gy_Department d on a.HDeptID=d.HItemID
+                                            where HSeOrderInterID=(select HSeOrderInterID from Sc_ICMOBillMain where HBillNo='" + HBillNo + "')");
                
-                ds = oCN.RunProcReturn(sql, "Xs_SeOrderBillMain");
+                ds = oCN.RunProcReturn(sql, "Sc_ICMOBillMain");
                 if (ds.Tables[0].Rows.Count != 0 || ds != null)
                 {
                     objJsonResult.code = "1";
@@ -133,73 +128,157 @@
             string msg2 = sArray[0].ToString();
             string msg3 = sArray[1].ToString();
             string msg4 = sArray[2].ToString();
+            string msg5 = sArray[3].ToString();
 
             ListModels oListModels = new ListModels();
+            DataSet ds = new DataSet();
+            ds = oCN.RunProcReturn("select * from Xt_ORGANIZATIONS where HItemID=" + msg5, "Xt_ORGANIZATIONS");
+            string OrgNum = ds.Tables[0].Rows[0]["HNumber"].ToString();//缁勭粐浠g爜
+            DataSet Ds1 = new DataSet();
             try
             {
+                //琛ㄤ綋鏁版嵁
+                //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+                msg2 = msg2.Replace("\\", "");
+                msg2 = msg2.Replace("\n", "");  //\n
+                                                //msg2 = msg2.Replace("'", "鈥�");
+                List<Models.ClsQK_PackingBill> ls = new List<Models.ClsQK_PackingBill>();
+                ls = oListModels.getObjectByJson_QK_PackingBill(msg2);
+
+
+                //鑾峰彇骞存湀鏃ュ苟鎷兼帴鎴愬瓧绗︿覆
+                string year = DateTime.Now.Year.ToString();
+                string month = DateTime.Now.Month.ToString();
+                string day = DateTime.Now.Day.ToString();
+                string nowDate = year + month + day;
+                string materid = "";
+                long sum = 0;
                 if (msg4=="ZZ")
                 {
-                    //琛ㄤ綋鏁版嵁
-                    //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
-
-                    msg2 = msg2.Replace("\\", "");
-                    msg2 = msg2.Replace("\n", "");  //\n
-                                                    //msg2 = msg2.Replace("'", "鈥�");
-                    List<Models.ClsQK_PackingBill> ls = new List<Models.ClsQK_PackingBill>();
-                    ls = oListModels.getObjectByJson_QK_PackingBill(msg2);
                     oCN.BeginTran();
                     foreach (Models.ClsQK_PackingBill oItemSub in ls)
                     {
-                        var HInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo);
-                        var HBillNo = DBUtility.ClsPub.CreateBillCode("3783", ref DBUtility.ClsPub.sExeReturnInfo, true);
-                        string sql = string.Format(@"Insert Sc_PackUnionBillMain(HYear,HPeriod,HBillType,HInterID,HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID,
-                                                    HRemark,HBacker,HChecker,HMaker,HMakeDate,HUpDater,HCloseMan,HCloseType,HDeleteMan,
-                                                    HICMOInterID,HICMOBillNo,HBarCode_Pack,HMaterID,HUnitID,HWeight,HMWeight,HPWeight,
-                                                    HProdOrgID,HDeptID,HEmpID,HSNum,HPackNum,HBarCode_Cus,HBatchNo,HBillSubType)
-                                                    values('2022',1,'3783'," + HInterID + ",getdate(),'" + HBillNo + "',1,0,0," +
-                                                        "'鑷姩缁戝畾','','', " + msg3 + ",getdate(),'','',0,''," +
-                                                        oItemSub.HInterID + ",'" + oItemSub.HBillNo + "','" + HBillNo + "'," + oItemSub.HMaterID + "," + oItemSub.HUnitID + "," + oItemSub.HWeight + "," + oItemSub.HMWeight + "," + oItemSub.HPWeight + "," +
-                                                        "0,0," + oItemSub.HEmpID + ",0,0,'','','')");
-                        oCN.RunProc(sql);
+                        //鏍规嵁鐢熸垚鏉℃暟鐢熸垚鐩稿簲鏁伴噺鏉$爜
+                        foreach (var item in oItemSub.HTotalQty.ToString())
+                        {
+                            //鐢熸垚鍞竴鏉$爜   鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃�
+                            string sTMNumber = OrgNum + oItemSub.HMaterNumber + nowDate;
+                            Ds1 = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
+                            int LSH = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//鍞竴鐮�
+                                                                             //鑾峰彇鍐呯爜
+                            long HInterID = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
+                            oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
+                                        ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
+                                        ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
+                                        ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
+                                        ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
+                                        ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
+                                        ",HGiveAwayFlag " +
+                                        ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
+                                        ") values ("
+                                        + "'" + LSH + "','鍞竴鏉$爜'," + oItemSub.HMaterID.ToString() + "," + oItemSub.HUnitID.ToString() + "," + oItemSub.HMinQty.ToString()
+                                        + ",'',0,0,'" + msg3 + "',getdate(),0," + oItemSub.HMinQty.ToString()
+                                        + ", " + oItemSub.HInterID.ToString() + "," + oItemSub.HInterID.ToString() + ",'" + oItemSub.HBillNo + "','3710',''"
+                                        + ",1,1," + oItemSub.HDeptID.ToString() + ",0,0,''"
+                                        + ", " + oItemSub.HCusID.ToString() + ",'',getdate(),'',getdate()"
+                                        + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",''," + HInterID.ToString()
+                                        + ",0"
+                                        + ",'" + oItemSub.HMaterName + "','','',0,'','')");
+
+                            string sql1 = string.Format(@"update Sc_ICMOBillMain set HPlanQty=" + oItemSub.HSpsQty + " where HInterID=" + oItemSub.HInterID);
+                            oCN.RunProc(sql1);
+                        }
                     }
                     oCN.Commit();
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
                     objJsonResult.Message = "鏁磋鐢熸垚鎴愬姛锛�";
-                    objJsonResult.data = ds.Tables[0];
+                    objJsonResult.data = 1;
                     return objJsonResult;
                 }
                 else
                 {
-                    msg2 = msg2.Replace("\\", "");
-                    msg2 = msg2.Replace("\n", "");  //\n
-                                                    //msg2 = msg2.Replace("'", "鈥�");
-                    List<Models.ClsQK_PackingBill> ls = new List<Models.ClsQK_PackingBill>();
-                    ls = oListModels.getObjectByJson_QK_PackingBill(msg2);
-
                     var HInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo);
                     var HBillNo = DBUtility.ClsPub.CreateBillCode("3783", ref DBUtility.ClsPub.sExeReturnInfo, true);
                     oCN.BeginTran();
                     foreach (Models.ClsQK_PackingBill oItemSub in ls)
                     {
+                        sum += oItemSub.HMinQty;
+                        materid = oItemSub.HMaterNumber;
+                        //鑾峰彇鍐呯爜
+                        long HInterID2 = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
+                        //鐢熸垚鍞竴鏉$爜   鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃�
+                        string sTMNumber = OrgNum + oItemSub.HMaterNumber + nowDate;
+                        Ds1 = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
+                        int LSH = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//鍞竴鐮�
+                        //鎻掑叆鏉$爜妗f
+                        oCN.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
+                                    ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
+                                    ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
+                                    ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
+                                    ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
+                                    ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
+                                    ",HGiveAwayFlag " +
+                                    ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
+                                    ") values ("
+                                    + "'" + LSH + "','鍞竴鏉$爜'," + oItemSub.HMaterID.ToString() + "," + oItemSub.HUnitID.ToString() + "," + oItemSub.HMinQty.ToString()
+                                    + ",'',0,0,'" + msg3 + "',getdate(),0," + oItemSub.HMinQty.ToString()
+                                    + ", " + oItemSub.HInterID.ToString() + "," + oItemSub.HInterID.ToString() + ",'" + oItemSub.HBillNo + "','3710',''"
+                                    + ",1,1," + oItemSub.HDeptID.ToString() + ",0,0,''"
+                                    + ", " + oItemSub.HCusID.ToString() + ",'',getdate(),'',getdate()"
+                                    + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",''," + HInterID2.ToString()
+                                    + ",0"
+                                    + ",'" + oItemSub.HMaterName + "','','',0,'','')");
+                       //鎻掑叆缁勬墭鍗曞瓙琛�
                         string sql = string.Format(@"insert into Sc_PackUnionBillSub(HInterID,HEntryID,HCloseMan,HCloseType,HRemark,
                                                     HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,
                                                     HRelationQty,HRelationMoney,HMaterID,HUnitID,HQty,HSourceID,HEquipID,HGroupID,HWorkerID,
 	                                                HScanDate,HBarCode,HBarCode_Pack)
-                                                    values("+HInterID+",'','',0,'鑷姩缁戝畾',"+oItemSub.HInterID+",'',"+oItemSub.HBillNo+",'3710',"+
-	                                                "0,0,"+ oItemSub.HMaterID+","+ oItemSub.HUnitID+","+ oItemSub.HQty+", 0,0,0,0,"+
-	                                                "getdate(),'',"+HBillNo+")");
+                                                    values("+HInterID+",'','',0,'鑷姩缁戝畾',"+oItemSub.HInterID+",'','"+oItemSub.HBillNo+"','3710',"+
+	                                                "0,0,"+ oItemSub.HMaterID+","+ oItemSub.HUnitID+","+ oItemSub.HPlanQty+", 0,0,0,0,"+
+	                                                "getdate(),'"+ LSH + "','" +HBillNo+"')");
+                        //鏇存敼鐢熶骇璁㈠崟鐨勬暟閲�
+                        string sql1 = string.Format(@"update Sc_ICMOBillMain set HPlanQty=" + oItemSub.HSpsQty + " where HInterID=" + oItemSub.HInterID);
+
                         oCN.RunProc(sql);
+                        oCN.RunProc(sql1);
                     }
+                    //鐢熸垚缁勬墭鍗曚富琛�
                     string sql2 = string.Format(@"Insert Sc_PackUnionBillMain(HYear,HPeriod,HBillType,HInterID,HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID,
                                                     HRemark,HBacker,HChecker,HMaker,HMakeDate,HUpDater,HCloseMan,HCloseType,HDeleteMan,HICMOInterID,HICMOBillNo,
                                                     HBarCode_Pack,HMaterID,HUnitID,HWeight,HMWeight,HPWeight,
                                                     HProdOrgID,HDeptID,HEmpID,HSNum,HPackNum,HBarCode_Cus,HBatchNo,HBillSubType)
                                                     values('2022',1,'3783'," + HInterID + ",getdate(),'" + HBillNo + "',1,0,0," +
-                                                        "'鑷姩缁戝畾','','', " + msg3 + ",getdate(),'','',0,'',0,0,'" +
-                                                         HBillNo + "',0,0,0,0,0" + 
+                                                        "'鑷姩缁戝畾','','', '" + msg3 + "',getdate(),'','',0,'',0,0,'" +
+                                                         HBillNo + "',0,0,0,0,0," + 
                                                         "0,0,0,0,0,'','','')");
                     oCN.RunProc(sql2);
+                    //鍐嶆鐢熸垚鍞竴鐮�
+                    //鑾峰彇鍐呯爜
+                    long HInterID3 = DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
+                    //鐢熸垚鍞竴鏉$爜   鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃�
+                    string sTMNumber1 = OrgNum  + materid+nowDate;
+                    Ds1 = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber1 + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
+                    int LSH1 = ClsPub.isInt(Ds1.Tables[0].Rows[0][0]);//鍞竴鐮�
+                    string sql3 = string.Format(@"insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
+                                ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
+                                ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
+                                ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
+                                ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
+                                ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
+                                ",HGiveAwayFlag " +
+                                ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
+                                ") values ("
+                                + "'" + LSH1 + "','鍞竴鏉$爜','" + materid.ToString() + "',0," + sum.ToString()
+                                + ",'',0,0,'" + msg3 + "',getdate(),0," + sum.ToString()
+                                + ", 0,0,'" + HBillNo + "','3710','',"
+                                + sum.ToString() + "," + HInterID.ToString() + ",0,0,0,''"
+                                + ",0,'',getdate(),'',getdate()"
+                                + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",''," + HInterID3.ToString()
+                                + ",0"
+                                + ",'','','',0,'','')");
+
+                    oCN.RunProc(sql3);
                     oCN.Commit();
                     objJsonResult.code = "1";
                     objJsonResult.count = 1;
@@ -220,5 +299,183 @@
             }
         }
         #endregion
+
+        # region[澧欏挃瑁呯鐐瑰嚮涓昏〃甯﹀嚭浠庤〃]
+        [Route("Sc_ICMOBillController/QK_GetPackingBillListByMainID")]
+        [HttpGet]
+        public object QK_GetPackingBillListByMainID(string HInterID)
+        {
+
+            DataSet ds;
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                //鑾峰彇淇濆吇椤圭洰缂栬緫鏁版嵁
+                string sql = string.Format(@"select a.HInterID hmainid,a.HBarCode,a.HBillType,a.HBarCodeType,
+                                     a.HMaterID,m.HName HMaterName,a.HUnitID,u.HName HUnitName,
+                                     a.HEmpID,e.HName HEmpName,a.HDeptID,d.HItemID HDeptName,P.HBarCode_Pack,
+                                    a.HMakeDate 鍒跺崟鏃ユ湡,a.HMaker 鍒跺崟浜�
+                                    from Gy_BarCodeBill a 
+                                    left join Gy_Material m on a.HMaterID=m.HItemID
+                                    left join Gy_Unit u on a.HUnitID=u.HItemID 
+                                    left join Gy_Employee e on a.HEmpID=e.HItemID 
+                                    left join Gy_Department d on a.HDeptID=d.HItemID
+                                    left join Sc_PackUnionBillMain p on a.HSourceInterID=p.HInterID
+                                    where a.HBarCode=(select HBarCode from  Sc_PackUnionBillSub where HInterID=
+                                    (select HBarcodeNo from Gy_BarCodeBill where HBarCode='" + HInterID + "'))");
+                ds = oCN.RunProcReturn(sql, "Sc_PackUnionBillSub");
+                
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+                objJsonResult.data = null;
+            }
+            return objJsonResult;
+        }
+        #endregion
+
+        #region[澧欏挃瑁呯鍒楄〃]
+        /// <summary>
+        /// 妯″叿淇濆吇璁板綍琛ㄥ垪琛�
+        /// </summary>
+        /// <returns></returns>
+        [Route("Sc_ICMOBillController/QK_GetPackingBillList")]
+        [HttpGet]
+        public object QK_GetPackingBillList(string sWhere)
+        {
+            try
+            {
+               
+                ds = QK_GetPackingBillList_s(sWhere);
+
+                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
+                //{
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+                //}
+                //else
+                //{
+                //objJsonResult.code = "0";
+                //objJsonResult.count = 0;
+                //objJsonResult.Message = "鏃犳暟鎹�";
+                //objJsonResult.data = null;
+                //return objJsonResult;
+                //}
+            }
+            catch (Exception ex)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        #region sql璇彞
+
+
+        public static DataSet QK_GetPackingBillList_s(string sWhere)
+        {
+            if (sWhere == null || sWhere.Equals(""))
+            {
+                return new SQLHelper.ClsCN().RunProcReturn("select *  from h_v_QK_PackedBillList order by hmainid desc", "h_v_QK_PackedBillList");
+            }
+            else
+            {
+                string sql1 = "select * from h_v_QK_PackedBillList where 1 = 1 ";
+                string sql = sql1 + sWhere + "order by hmainid desc";
+                return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_QK_PackedBillList");
+
+            }
+            //return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldMaintainBillList ", "h_v_Sc_MouldMaintainBillList");
+        }
+        #endregion
+
+        #endregion
+
+        #region[澧欏挃瑁呯鍒楄〃-鍒犻櫎]
+        /// <summary>
+        /// 澧欏挃瑁呯鍒楄〃-鍒犻櫎
+        /// </summary>
+        /// <returns></returns>
+        [Route("Sc_ICMOBillController/DeleteQK_GetPackingBillList")]
+        [HttpGet]
+        public object DeleteQK_GetPackingBillList(string HInterID,string Flag)
+        {
+            try
+            {
+                oCN.BeginTran();
+                if (Flag=="0")
+                {
+                    DataSet ds = new DataSet();
+                    ds = oCN.RunProcReturn("select * from Gy_BarCodeBill where HItemID=" + HInterID, "Gy_BarCodeBill");
+                    DataRow dr = ds.Tables[0].Rows[0];
+                    string sql = string.Format(@"delete from Gy_BarCodeBill where HItemID=" + HInterID);
+                    string sql1 = string.Format(@"update Sc_ICMOBillMain set HPlanQty=HPlanQty+" + dr["HQty"] +" where HInterID=(select HSourceInterID from Gy_BarCodeBill where HItemID="+ HInterID + ")");
+                    oCN.RunProc(sql);
+                    oCN.RunProc(sql1);
+                }
+                else
+                {
+                    //閫氳繃鏉$爜id鎵惧埌鎵樻潯鐮侊紝閫氳繃鎵樻潯鐮佹壘鍒扮粍鎵樺崟瀛愯〃涓殑鍞竴鐮�
+                    string sql2 = "select HBarCode from Sc_PackUnionBillSub where HInterID=(select HBarcodeNo from Gy_BarCodeBill where HItemID=" + HInterID;
+                    //string sql2 = "select HBarCode from Sc_PackUnionBillSub where HInterID=(select HBarcodeNo from Gy_BarCodeBill where HItemID=3250)";
+                    DataSet ds1 = oCN.RunProcReturn(sql2, "Sc_PackUnionBillSub");
+                    DataTable dt = ds1.Tables[0];
+                    //閬嶅巻鎵惧埌鐨勫敮涓�鐮佸垹闄ゆ潯鐮佹。妗堥噷鐨勭浉鍏虫暟鎹紝鍚屾椂閫氳繃鍞竴鐮佺殑婧愬崟鎵惧埌鐢熶骇璁㈠崟鏇存敼鐢熶骇璁㈠崟鐨勬暟閲�
+                    if (dt.Rows.Count > 0)
+                    {
+                        foreach (DataRow dr in dt.Rows)
+                        {
+                            DataSet ds = new DataSet();
+                            ds = oCN.RunProcReturn("select * from Gy_BarCodeBill where HBarCode='" + dr["HBarCode"].ToString()+"'", "Gy_BarCodeBill");
+                            DataRow dr1 = ds.Tables[0].Rows[0];
+
+                            string sql = string.Format(@"delete from Gy_BarCodeBill where HBarCode='" + dr["HBarCode"].ToString()+"'");
+                            string sql1 = string.Format(@"update Sc_ICMOBillMain set HPlanQty=HPlanQty+" + dr1["HQty"] + " where HInterID=(select HSourceInterID from Gy_BarCodeBill where HBarCode='" + dr["HBarCode"].ToString() + "')");
+                            oCN.RunProc(sql);
+                            oCN.RunProc(sql1);
+                        }
+                    }
+                   
+                    //閬嶅巻瀹屽悗鍒犻櫎閫氳繃鏉$爜id鎵惧埌鎵樻潯鐮侊紝閫氳繃鎵樻潯鐮佹壘鍒扮粍鎵樺崟瀛愯〃鐨勬暟鎹紝浠ュ強涓昏〃鏁版嵁
+                    string sql3 = string.Format(@"delect from Sc_PackUnionBillSub where HInterID=(select HBarcodeNo from Gy_BarCodeBill where HItemID="+ HInterID);
+                    string sql4 = string.Format(@"delect from Sc_PackUnionBillMain where HInterID=(select HBarcodeNo from Gy_BarCodeBill where HItemID=" + HInterID);
+                    //鍒犻櫎鏈�澶х殑鍚堟垚鐨勫敮涓�鐮�
+                    string sql5 = string.Format(@"delete from Gy_BarCodeBill where HItemID=" + HInterID);
+                    oCN.RunProc(sql3);
+                    oCN.RunProc(sql4);
+                    oCN.RunProc(sql5);
+                }
+                oCN.Commit();
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍒犻櫎鎴愬姛";
+                objJsonResult.data = null;
+                return objJsonResult;
+
+            }
+            catch (Exception ex)
+            {
+                oCN.RollBack();
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触" + ex.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
     }
 }
\ No newline at end of file
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index bef2372..40dd50d 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -969,7 +969,7 @@
 
         public List<Models.ClsQK_PackingBill> getObjectByJson_QK_PackingBill(string jsonString)
         {
-            jsonString = "[" + jsonString.ToString() + "]";
+            //jsonString = "[" + jsonString.ToString() + "]";
             List<Models.ClsQK_PackingBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsQK_PackingBill>>(jsonString);
             return list;
         }
diff --git a/WebAPI/Models/ClsQK_PackingBill.cs b/WebAPI/Models/ClsQK_PackingBill.cs
index 1828284..2884ea9 100644
--- a/WebAPI/Models/ClsQK_PackingBill.cs
+++ b/WebAPI/Models/ClsQK_PackingBill.cs
@@ -8,28 +8,21 @@
     public class ClsQK_PackingBill
     {
         public Int64 HMaterID;
-        public string HMaterCode;
+        public string HMaterNumber;
         public string HMaterName;
         public Int64 HUnitID;
         public string HUnitName;
-        public Int64 HQty;
+        public Int64 HPlanQty;
         public Int64 HMinQty;
         public Int64 HTotalQty;
         public Int64 HSpsQty;
-        public string HAddress;
-        public string HDate;
-        public string HOutStockQty;
-        public string HInvoiceQty;
-        public string HTaxPrice;
-        public string HPrice;
-        public string HMoney;
         public Int64 HCusID;
         public string HCusName;
         public Int64 HEmpID;
         public string HEmpName;
-        public string HWeight;
-        public string HMWeight;
-        public string HPWeight;
+        public Int64 HDeptID;
+        public string HDeptName;
+        public string HPlanEndDate;
         public Int64 HInterID;
         public string HBillNo;
     }
diff --git a/WebAPI/WebAPI.csproj.user b/WebAPI/WebAPI.csproj.user
index 16d95e2..a3179f3 100644
--- a/WebAPI/WebAPI.csproj.user
+++ b/WebAPI/WebAPI.csproj.user
@@ -9,7 +9,7 @@
     <WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
     <NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
     <NameOfLastUsedPublishProfile>D:\Git\houduan\WebAPI\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
-    <NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
+    <NameOfLastUsedPublishProfile>D:\鏅轰簯MES\Lay-Api\MES-WEB-API\WebAPI\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
     <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
     <UseIISExpress>false</UseIISExpress>
     <Use64BitIISExpress />

--
Gitblit v1.9.1