From 81456046161696d3e1e31a8d9eb428f3b7a3442f Mon Sep 17 00:00:00 2001
From: jhz <jinghz@oceic.com>
Date: 星期四, 22 九月 2022 10:44:56 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs       |    4 +-
 WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs                |   19 +++++++++
 WebAPI/Controllers/SCGL/日计划管理/JIT_DayPlanPlatFormBillController.cs |   40 +++++++++++++++++--
 WebAPI/Controllers/BLL/Xt_UserController.cs                        |    6 +-
 4 files changed, 58 insertions(+), 11 deletions(-)

diff --git a/WebAPI/Controllers/BLL/Xt_UserController.cs b/WebAPI/Controllers/BLL/Xt_UserController.cs
index e7bf010..e04db05 100644
--- a/WebAPI/Controllers/BLL/Xt_UserController.cs
+++ b/WebAPI/Controllers/BLL/Xt_UserController.cs
@@ -86,9 +86,9 @@
                 //    return objJsonResult;
                 //}
 
-                Int64 lngBillKey = 0;
-                lngBillKey = DBUtility.ClsPub.isLong(HCzybm);
-                if (lngBillKey == 0)
+                string lngBillKey = "";
+                lngBillKey = DBUtility.ClsPub.isStrNull(HCzybm);
+                if (lngBillKey == "")
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
diff --git a/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs b/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
index f18ccfb..d2fde60 100644
--- a/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
+++ b/WebAPI/Controllers/BaseSet/Xt_grdAlignment_WMESController.cs
@@ -56,7 +56,7 @@
             public string HSortFlag;
             public string HSelTotal;
             public string HColumnWidth;
-          
+
         }
         public class grdAlignmentSub
         {
@@ -123,7 +123,7 @@
                     ")  values('" + user + "','" + HModName + "','" + HGridString + "'," + (omdelMian.HFixCols == "" ? "0" : omdelMian.HFixCols) +
                     "," + (omdelMian.HFontSize == "" ? "0" : omdelMian.HFontSize) + ",0" +
                     ",0,'" + omdelMian.HSortFlag + "','" + omdelMian.HSelTotal + "'" +
-                    ","+ (omdelMian.HColumnWidth == "" ? "0" : omdelMian.HColumnWidth) + ")");
+                    "," + (omdelMian.HColumnWidth == "" ? "0" : omdelMian.HColumnWidth) + ")");
 
 
                 objJsonResult.code = "1";
diff --git a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
index aab3a29..c3ac9dd 100644
--- a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
+++ b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
@@ -670,11 +670,28 @@
                 omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<Gy_RoutingBill_temporary>(msg2);
 
 
-                ds = oCN.RunProcReturn("select  distinct 浜у搧浠g爜,宸ヨ壓璺嚎浠g爜 from  diyipi ", "diyipi");
+                ds = oCN.RunProcReturn("select  distinct 浜у搧浠g爜,isnull(宸ヨ壓璺嚎浠g爜,'') 宸ヨ壓璺嚎浠g爜 from  diyipi ", "diyipi");
 
                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                 {
                     var HBillNo = ds.Tables[0].Rows[i]["宸ヨ壓璺嚎浠g爜"].ToString();//鑾峰緱涓�涓柊鐨勫崟鎹彿
+                    if (HBillNo == "")
+                    {
+                        DataSet dataSet = oCN.RunProcReturn($"select HBillNo  from  Gy_RoutingBillMain where HBillNo='1' ", "Gy_RoutingBillMain");
+                        while (1 == 1)
+                        {
+                            if (HBillNo != "")
+                            {
+                                if (dataSet.Tables[0].Rows.Count==0)
+                                {
+                                    break;
+                                }
+                            }
+                            HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
+                            dataSet = oCN.RunProcReturn($"select HBillNo  from  Gy_RoutingBillMain where HBillNo='{HBillNo}' ", "Gy_RoutingBillMain");
+                        }
+
+                    }
                     var HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo);//鑾峰緱涓�涓柊鐨刬d
                     oCN.RunProc($"exec Gy_RoutingBill_Excel '{ds.Tables[0].Rows[i]["浜у搧浠g爜"].ToString()}',{HInterID},'{HBillNo}','{user}',{omdelMian.HOrgID},{omdelMian.HTProcessFlag} ");
                 }
diff --git "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs" "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
index 625ae2d..1cdba47 100644
--- "a/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
+++ "b/WebAPI/Controllers/SCGL/\346\227\245\350\256\241\345\210\222\347\256\241\347\220\206/JIT_DayPlanPlatFormBillController.cs"
@@ -176,7 +176,7 @@
                         var HMaterModel = list[i]["瑙勬牸鍨嬪彿"].ToString();
                         var HUnitID = list[i]["HUnitID"].ToString();
                         var HSeOrderBillQty = list[i]["閿�鍞鍗曟暟閲�"].ToString();
-                        var HOrderNeedQty = list[i]["璁㈠崟闇�姹傛暟閲�"].ToString();
+                        //var HOrderNeedQty = list[i]["璁㈠崟闇�姹傛暟閲�"].ToString();
                         var HSplitQty = list[i]["鎷嗗崟鏁伴噺"].ToString();
                         var HDayPlanSumQty = list[i]["鏃ヨ鍒掓暟閲忔�婚噺"].ToString();
                         var HPlanBeginDate = list[i]["璁″垝寮�濮嬫棩鏈�"].ToString();
@@ -218,16 +218,18 @@
                             "HICMOEntrySEQ,HWorkShopID,HSourceID, HYX, HProdORGID," +
                             " HMaterID, HMaterName, HMaterModel, HUnitID, HSeOrderBillQty," +
                             " HOrderNeedQty, HSplitQty, HDayPlanSumQty,HPlanBeginDate," +
-                            "HSeOrderBillNo,HICMOBillType,HSourceStockInQty,HLeftPlanQty,HOrderLev,HPreparatDate)values" +
+                            "HSeOrderBillNo,HICMOBillType,HSourceStockInQty,HLeftPlanQty,HOrderLev,HPreparatDate," +
+                            "HMainSourceInterID,HMainSourceEntryID)values" +
                             $"({HInterID},'{HBillNo}',{DateTime.Now.Year},{DateTime.Now.Month},'{BillType}'," +
                             $"'{BillType}',GETDATE(),1,'{user}',getdate(),'{HICMOBillNo}','{HOrderType}'," +
                             $"{(HICMOEntrySEQ == "" ? 0.ToString() : HICMOEntrySEQ)},{(HWorkShopID == "" ? 0.ToString() : HWorkShopID)},{(HSourceID == "" ? 0.ToString() : HSourceID)}, {(HYX == "" ? 0.ToString() : HYX)}, {(HProdORGID == "" ? 0.ToString() : HProdORGID)}," +
                             $" {(HMaterID == "" ? 0.ToString() : HMaterID)}, '{HMaterName}', '{HMaterModel}', {(HUnitID == "" ? 0.ToString() : HUnitID)}, {(HSeOrderBillQty == "" ? 0.ToString() : HSeOrderBillQty)}," +
-                            $" {(HOrderNeedQty == "" ? 0.ToString() : HOrderNeedQty)}, {(HSplitQty == "" ? 0.ToString() : HSplitQty)}, {(HDayPlanSumQty == "" ? 0.ToString() : HDayPlanSumQty)},'{HPlanBeginDate}'," +
-                            $"'{HSeOrderBillNo}','{HICMOBillType}',{(HSourceStockInQty == "" ? 0.ToString() : HSourceStockInQty)},{(HLeftPlanQty == "" ? 0.ToString() : HLeftPlanQty)},'{HOrderLev}',getdate())");
+                            $" 0, {(HSplitQty == "" ? 0.ToString() : HSplitQty)}, {(HDayPlanSumQty == "" ? 0.ToString() : HDayPlanSumQty)},'{HPlanBeginDate}'," +
+                            $"'{HSeOrderBillNo}','{HICMOBillType}',{(HSourceStockInQty == "" ? 0.ToString() : HSourceStockInQty)},{(HLeftPlanQty == "" ? 0.ToString() : HLeftPlanQty)},'{HOrderLev}',getdate()," +
+                            $"{HMainSourceInterID},{HMainSourceEntryID})");
                     }
 
-                    oCN.RunProc($"update Sc_WorkBillSortBillMain set HDayPlanSumQty={list[i]["鏃ヨ鍒掓暟閲忔�婚噺"].ToString()} where HInterID={list[i]["hmainid"].ToString()} and HBillNo='{list[i]["鍗曟嵁鍙�"].ToString()}'");
+                    oCN.RunProc($"update Sc_WorkBillSortBillMain set HDayPlanSumQty={list[i]["鏃ヨ鍒掓暟閲忔�婚噺"].ToString()} where HInterID={(HInterID==0?int.Parse(list[i]["hmainid"].ToString()):HInterID)} and HBillNo='{(HBillNo==""?list[i]["鍗曟嵁鍙�"].ToString(): HBillNo)}'");
 
                     int SumDay = 31; //鍔ㄦ�佷袱鏈堜箣宸� DateTime.Now.AddMonths(1).AddDays(-1).Subtract(DateTime.Now).Days;
 
@@ -1150,5 +1152,33 @@
         }
         #endregion
 
+        #region 鐢熶骇鏃ヨ鍒掑钩鍙� 鐢熶骇璁㈠崟鏌ヨ
+        [Route("JIT_DayPlanPlatFormBill/JIT_ICMOBillList")]
+        [HttpGet]
+        public object JIT_ICMOBillList(string hmainid, string HEntryID)
+        {
+            try
+            {
+
+                oCN.RunProc("exec h_p_ICMOBillList_PrimarySubTable");
+                ds = oCN.RunProcReturn($"select * from  ##ICMOBillList where 婧愬崟涓诲唴鐮� in({hmainid}) and  婧愬崟瀛愬唴鐮� in({HEntryID})", "##ICMOBillList");
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1