From aefedbd83773db8b0ed7af35f08e474bc97be351 Mon Sep 17 00:00:00 2001
From: ch <37327@LLOOCCY>
Date: 星期三, 27 七月 2022 08:46:39 +0800
Subject: [PATCH] 工艺路线自动增加转工序  厂休基础资料

---
 WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs |   46 +++++++++++++++++++++++++++++++++++-----------
 1 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
index 44b51be..76b2def 100644
--- a/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
+++ b/WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
@@ -331,6 +331,7 @@
 
                 //鍒涘缓涓存椂琛�
                 DataTable tb2 = new DataTable("dt2");
+                DataTable tb3 = new DataTable("dt3");
 
                 //娣诲姞鍒楀悕
                 for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
@@ -595,6 +596,7 @@
             public string HPeriod;
             public string DataAppend;
             public string HOrgID;
+            public Int64 HTProcessFlag;
         }
 
         [Route("Gy_RoutingBill/Gy_RoutingBill_btnSave")]
@@ -716,7 +718,7 @@
                     ds = oCN.RunProcReturn("select * from Gy_WorkCenter Where HName='" + list[i]["宸ヤ綔涓績"].ToString() + "'", "Gy_WorkCenter");
                     var HCenterID = "0";
                     if (ds.Tables[0].Rows.Count > 0)
-                        HCenterID = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                    HCenterID = ds.Tables[0].Rows[0]["HItemID"].ToString();
 
                     var HProcNo = list[i]["宸ュ簭搴忓彿"].ToString();
                     var HTimeUnit = list[i]["鏃堕棿鍗曚綅"].ToString();
@@ -739,16 +741,38 @@
                     var HProcWorkNum = list[i]["绋嬪簭鍙�"].ToString();
                     //鐗╂枡鍒嗙被
 
-                    oCN.RunProc("Insert into Gy_RoutingBillSub (HInterID,HEntryID,HSupID,HProcID,HCenterID,HProcNO,HTimeUnit" +
-                                ", hworkqty, HFixPrice, HBadPrice, HWasterPrice, HBeginFixQty, HBeginDayQty, HFixWorkDays" +
-                                ", HTrunWorkDays, HAutoTrunFlag, HSupFlag, HTechnologyParameter, HPicNum, HProcCheckNote" +
-                                ", hpassrate, hremark, HMouldNo, HProcWorkNum, HReadyTime, HQueueTime, HMoveTime, HUnitTime)values" +
-                                $"({HInterID}, {num[0]}, {HSupID}, {HProcID},{HCenterID}, '{HProcNo}', '{HTimeUnit}'" +
-                                $", {hworkqty}, {(HFixPrice==""?"0": HFixPrice)}, {(HBadPrice == "" ? "0": HBadPrice)}, {(HWasterPrice == "" ? "0": HWasterPrice)}, {(HBeginFixQty == "" ? "0": HBeginFixQty)}, {(HBeginDayQty == "" ? "0": HBeginDayQty)}, {(HFixWorkDays == "" ? "0": HFixWorkDays)}" +
-                                $", {(HTrunWorkDays == "" ? "0": HTrunWorkDays)},{(HAutoTrunFlag == "True" ? "1": "0")},{(HSupFlag == "True" ? "1" : "0")}, '{HTechnologyParameter}', '{HPicNum}', '{HProcCheckNote}'" +
-                                $", {hpassrate}, '{hremark}', '{HMouldNo}', '{HProcWorkNum}', 0, 0, 0, 0)");
-                    //鑷娆℃暟
-                    num[0]++;
+
+                    
+                        oCN.RunProc("Insert into Gy_RoutingBillSub (HInterID,HEntryID,HSupID,HProcID,HCenterID,HProcNO,HTimeUnit" +
+                                    ", hworkqty, HFixPrice, HBadPrice, HWasterPrice, HBeginFixQty, HBeginDayQty, HFixWorkDays" +
+                                    ", HTrunWorkDays, HAutoTrunFlag, HSupFlag, HTechnologyParameter, HPicNum, HProcCheckNote" +
+                                    ", hpassrate, hremark, HMouldNo, HProcWorkNum, HReadyTime, HQueueTime, HMoveTime, HUnitTime)values" +
+                                    $"({HInterID}, {num[0]}, {HSupID}, {HProcID},{HCenterID}, '{HProcNo}', '{HTimeUnit}'" +
+                                    $", {hworkqty}, {(HFixPrice == "" ? "0" : HFixPrice)}, {(HBadPrice == "" ? "0" : HBadPrice)}, {(HWasterPrice == "" ? "0" : HWasterPrice)}, {(HBeginFixQty == "" ? "0" : HBeginFixQty)}, {(HBeginDayQty == "" ? "0" : HBeginDayQty)}, {(HFixWorkDays == "" ? "0" : HFixWorkDays)}" +
+                                    $", {(HTrunWorkDays == "" ? "0" : HTrunWorkDays)},{(HAutoTrunFlag == "True" ? "1" : "0")},{(HSupFlag == "True" ? "1" : "0")}, '{HTechnologyParameter}', '{HPicNum}', '{HProcCheckNote}'" +
+                                    $", {hpassrate}, '{hremark}', '{HMouldNo}', '{HProcWorkNum}', 0, 0, 0, 0)");
+                        //鑷娆℃暟
+                        num[0]++;
+                    if(omdelMian.HTProcessFlag == 1 )
+                    {
+                        if ((i == list.Count - 1) || (list[i]["浜у搧浠g爜"].ToString() != list[i + 1]["浜у搧浠g爜"].ToString()))
+                        {
+                            ds = oCN.RunProcReturn("select * from Gy_Process Where HTProcessFlag = 1", "Gy_Process");
+                            if (ds.Tables[0].Rows.Count > 0)
+                            HProcID = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                            HProcNo = ds.Tables[0].Rows[0]["HSno"].ToString();
+                            oCN.RunProc("Insert into Gy_RoutingBillSub (HInterID,HEntryID,HSupID,HProcID,HCenterID,HProcNO,HTimeUnit" +
+                                       ", hworkqty, HFixPrice, HBadPrice, HWasterPrice, HBeginFixQty, HBeginDayQty, HFixWorkDays" +
+                                       ", HTrunWorkDays, HAutoTrunFlag, HSupFlag, HTechnologyParameter, HPicNum, HProcCheckNote" +
+                                       ", hpassrate, hremark, HMouldNo, HProcWorkNum, HReadyTime, HQueueTime, HMoveTime, HUnitTime)values" +
+                                       $"({HInterID}, {num[0]}, {HSupID}, {HProcID},{HCenterID}, '{HProcNo}', '{HTimeUnit}'" +
+                                       $", {hworkqty}, {(HFixPrice == "" ? "0" : HFixPrice)}, {(HBadPrice == "" ? "0" : HBadPrice)}, {(HWasterPrice == "" ? "0" : HWasterPrice)}, {(HBeginFixQty == "" ? "0" : HBeginFixQty)}, {(HBeginDayQty == "" ? "0" : HBeginDayQty)}, {(HFixWorkDays == "" ? "0" : HFixWorkDays)}" +
+                                       $", {(HTrunWorkDays == "" ? "0" : HTrunWorkDays)},{(HAutoTrunFlag == "True" ? "1" : "0")},{(HSupFlag == "True" ? "1" : "0")}, '{HTechnologyParameter}', '{HPicNum}', '{HProcCheckNote}'" +
+                                       $", {hpassrate}, '{hremark}', '{HMouldNo}', '{HProcWorkNum}', 0, 0, 0, 0)");
+                        }
+                        num[0]++;
+                    }
+                  
                 }
 
                 objJsonResult.code = "1";

--
Gitblit v1.9.1