From cba0ef063a24b5b965bfa943cf1c8d2c8acba84a Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期四, 03 八月 2023 10:16:43 +0800
Subject: [PATCH] 排产 工艺路线的加工数量排产需要 生产入库 单据号改成流转卡号

---
 WebTM/views/车间管理/报表分析/sc_ICOMRKReport.html                  |    4 
 WebTM/views/计划管理/工艺路线/Gy_RoutingBill.html                   |    2 
 WebTM/views/生产管理/生产计划平台/JIT_DayPlanPlatForm.html            |  600 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 WebTM/views/生产管理/日计划基础资料/Cg_PODemandPlanConfigBill_Add.html |   32 --
 4 files changed, 587 insertions(+), 51 deletions(-)

diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\346\227\245\350\256\241\345\210\222\345\237\272\347\241\200\350\265\204\346\226\231/Cg_PODemandPlanConfigBill_Add.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\346\227\245\350\256\241\345\210\222\345\237\272\347\241\200\350\265\204\346\226\231/Cg_PODemandPlanConfigBill_Add.html"
index fc63f58..f436994 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\346\227\245\350\256\241\345\210\222\345\237\272\347\241\200\350\265\204\346\226\231/Cg_PODemandPlanConfigBill_Add.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\346\227\245\350\256\241\345\210\222\345\237\272\347\241\200\350\265\204\346\226\231/Cg_PODemandPlanConfigBill_Add.html"
@@ -14,38 +14,6 @@
     <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
     <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
     <script src="../../../layuiadmin/PubCustom.js"></script>
-    <style>
-        .main-btn { /*澶撮儴涓绘寜閽�*/
-            padding: 0 2px; /*璋冩暣鎸夐挳宸﹀彸绌洪殭澶у皬*/
-            height: 30px;
-            line-height: 30px;
-        }
-
-        .btn-title {
-            font-size: 16px;
-        }
-        /* 闃叉涓嬫媺妗嗙殑涓嬫媺鍒楄〃琚殣钘�---蹇呴』璁剧疆--- */
-        .layui-table-cell {
-            overflow: visible !important;
-        }
-        /* 浣垮緱涓嬫媺妗嗕笌鍗曞厓鏍煎垰濂藉悎閫� */
-        td .layui-form-select {
-            margin-top: -10px;
-            margin-left: -15px;
-            margin-right: -15px;
-        }
-
-        .layui-form-item .layui-inline {
-            margin-top: 5px;
-            margin-bottom: 5px;
-            margin-right: 0px;
-        }
-
-        .layui-form-label {
-            width: 25%;
-        }
-    </style>
-
 </head>
 <body>
     <div class="layui-fluid" style="padding: 0;">
diff --git "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\350\256\241\345\210\222\345\271\263\345\217\260/JIT_DayPlanPlatForm.html" "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\350\256\241\345\210\222\345\271\263\345\217\260/JIT_DayPlanPlatForm.html"
index 2573bf7..2e0facc 100644
--- "a/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\350\256\241\345\210\222\345\271\263\345\217\260/JIT_DayPlanPlatForm.html"
+++ "b/WebTM/views/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\350\256\241\345\210\222\345\271\263\345\217\260/JIT_DayPlanPlatForm.html"
@@ -27,6 +27,7 @@
                             <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnTLYS" id="btnTLYS">鎻愭枡杩愮畻</button>
                             <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnICMOBill" id="btnICMOBill">鐢熶骇璁㈠崟閫夊崟</button>
                             <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnReady" id="btnReady">鍑嗗</button>
+                            <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnProPC" id="btnProPC">鎺掍骇</button>
                         </div>
                         <div class="layui-collapse">
                             <div class="layui-colla-item">
@@ -178,7 +179,7 @@
                                 </div>
                             </div>
                         </div>
-                        <div id="test"></div>
+                        <div id="HProgressBar"></div>
                         <table class="" id="mainTable" lay-filter="mainTable"></table>
                         <script type="text/html" id="toolbarDemo">
                             <div class="layui-btn-container">
@@ -306,6 +307,14 @@
                 }
             });
 
+            for (var i = 0; i < table.cache["mainTable"].length; i++) {
+                if (table.cache["mainTable"][i]["鐢熶骇璁㈠崟鍙�"] != obj.data["鐢熶骇璁㈠崟鍙�"]) {
+                    table.cache["mainTable"][i].LAY_CHECKED = false;
+                }
+            }
+            option.data = table.cache["mainTable"];
+            table.render(option);
+
           
             objData = obj;
         })
@@ -371,7 +380,7 @@
             } else if (table.cache["mainTable"].length == 0) {
                 return layer.msg("鏃犳暟鎹�,鏃犳硶淇濆瓨!");
             } else {
-                set_AddNew(data);
+                set_AddNew();
             }
         });
 
@@ -415,7 +424,18 @@
             get_btnReady();
         })
 
-        
+      
+
+        //鎺掍骇
+        form.on('submit(btnProPC)', function (data) {
+            var HWorkShopID = $("#HWorkShopID").val();//鐢熶骇杞﹂棿
+            if (HWorkShopID == 0) {
+                return layer.msg("鐢熶骇杞﹂棿涓嶈兘涓虹┖!");
+            } else {
+                get_btnProPC(HWorkShopID)
+            }
+          
+        })
 
         //琛屽唴浜嬩欢
         table.on('tool(mainTable)', function (obj) {
@@ -662,6 +682,10 @@
             columns.push({ field: '鎷嗗崟鏁伴噺', title: '鎷嗗崟鏁伴噺', width: 150 });//0
             columns.push({ field: '璁㈠崟鍙帓鏁伴噺', title: '璁㈠崟鍙帓鏁伴噺', width: 150 });
             columns.push({ field: '鏈叆搴撴暟閲�', title: '鏈叆搴撴暟閲�', width: 150 });//0
+            columns.push({ field: 'HICMOInterID', title: 'HICMOInterID', width: 150, hide:true });
+            columns.push({ field: 'HGroupID', title: 'HGroupID', width: 150, hide:true });
+            columns.push({ field: 'HGroupName', title: 'HGroupName', width: 150, hide:true });
+            columns.push({ field: '鐢熶骇璧勬簮浠g爜', title: '鐢熶骇璧勬簮浠g爜', width: 150, hide:true });
             columns.push({ fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo' });
 
             option = {
@@ -673,7 +697,6 @@
                 , cols: [columns]
                 , limit: Number.MAX_VALUE//榛樿鏄剧ず鍏ㄩ儴
             };
-
         }
 
         //鏌ヨ鍔犺浇鏁版嵁
@@ -682,6 +705,7 @@
             $.ajax({
                 url: GetWEBURL() + '/JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillList',
                 type: "GET",
+                async: false,
                 data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                 success: function (data1) {
                     if (data1.count == 1) {
@@ -721,6 +745,15 @@
                 data: { "sWhere": HinterID_S.toString(),"num":1 },
                 success: function (data1) {
                     if (data1.count == 1) {
+                        for (var i = 0; i < 31; i++) {
+                            option.cols[0][22 + i]["edit"] = "text";
+                            option.cols[0][22 + i]["style"] = "";
+                            var TableDate = option.cols[0][22 + i].field;
+                            var date = new Date(TableDate).getDay();
+                            if (date == 6 || date == 0) {
+                                option.cols[0][22 + i]["style"] = "	background-color: #c3fec8";
+                            }
+                        }
                         if (data1.data[0]["DayNum"] > 0) {
                             //鑾峰彇琚攣瀹氱殑鍒楁暟
                             var tableNum = 0;
@@ -746,12 +779,13 @@
                                 option.cols[0][22 + i]["style"] = "	background-color: #e6e6e6";
                             }
 
-                        } else {
-                            for (var i = 0; i < 31; i++) {
-                                option.cols[0][22 + i]["edit"] = "text";
-                                option.cols[0][22 + i]["style"] = "";
-                            }
                         }
+                        //else {
+                        //    for (var i = 0; i < 31; i++) {
+                        //        option.cols[0][22 + i]["edit"] = "text";
+                        //        option.cols[0][22 + i]["style"] = "";
+                        //    }
+                        //}
                         table.render(option);
                         layer.close(ajaxLoad);
                         //layer.alert("鏌ヨ鎴愬姛", { icon: 1 });
@@ -1120,7 +1154,7 @@
             for (var i = 0; i < data.length; i++) {
                 HICOMNum.push(data[i]["HICMOInterID"] + ";" + data[i]["HICMOEntryID"]);
             }
-            $('#test').html(`
+            $('#HProgressBar').html(`
     <div class="layui-progress" lay-filter="demo-filter-progress">
       <div class="layui-progress-bar" lay-percent="40%"></div>
     </div>
@@ -1177,7 +1211,7 @@
                                 }
                             }
                         }
-                        $('#test').html('')
+                        $('#HProgressBar').html('')
 
                         table.render(option);
                        
@@ -1192,9 +1226,543 @@
             });
         }
 
-        //涓嬬Щ
-        function DownTable(data ,i) {
+
+        //鎺掍骇
+        function get_btnProPC(HWorkShopID) {
+
+            var JDTLen = 0;
+            var lMainID = 0;
+            var sICMOBillNo = "";
+            var dEndDate = "";
+            var sProdTimes = 0;
+            var sPlanQty = 0;
+            var lHGroupID = 0;
+            var sGroupName = "";
+            var lMaterID = 0;
+            var sMaterNumber = "";
+            var sMaterName = "";
+            var sMaterModel = "";
+            var sWorkQty = 0;
+            var sYX = 0;
+            var iLeftQty = 0;
+            var sLeftProdTimes = 0;
+            var lSourceID = 0;
+            var iRow = 0;
+            var sSourceName = "";
+            var sSourceNumber = "";
+            var ds = [];
+            var dsSub = [];
+            var bFind = false;
+            var HPlanDay = 0;
+            var HDelData = 0;
+            JDTLen = (100 / option.data.length).toFixed(2);
+            var HJDLen = 0;
+            var ajaxLoad = layer.load();
            
+
+            //濡傛灉閿佸畾璁″垝锛屽垯涓嶉渶瑕佸啀鎺掔▼
+            //鏌ヨ鏈溅闂存槸鍚︽湁閿佸畾璁″垝鐨勬暟鎹�
+            var HinterID_S = [];
+            for (var i = 0; i < option.data.length; i++) {
+                HinterID_S.push(option.data[i]["hmainid"]);
+            }
+            $.ajax({
+                url: GetWEBURL() + '/JIT_DayPlanPlatFormBill/JIT_DayPlanPlatFormBillHinterIDList',
+                type: "GET",
+                async: false,
+                data: { "sWhere": HinterID_S.toString(), "num": 1 },
+                success: function (data1) {
+                    if (data1.count == 1) {
+                        HPlanDay = data1.data[0].DayNum;
+
+                    } else {
+                        layer.alert(data1.code + data1.Message, { icon: 5 });
+                    }
+                }, error: function () {
+                    layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                }
+            });
+
+            //鏍规嵁杞﹂棿鍒犻櫎娌℃湁閿佸畾鐨勬暟鎹�
+            var sql = "delete from Sc_WorkBillSortBillSub  where  HMasterDate>=convert(varchar(10) ,DATEADD(DAY," + HPlanDay + ",GETDATE()),20)  and HInterID in(select  HInterID  from Sc_WorkBillSortBillMain where HWorkShopID=" + HWorkShopID + ")";
+            $.ajax({
+                url: GetWEBURL() +'/Gy_SOPBillList/UpDelSQL',
+                type: "GET",
+                async: false,
+                data: { "sWhere": sql },
+                success: function (data1) {
+                    if (data1.count == 1) {
+                        HDelData = 1;
+                    } else {
+                        layer.alert(data1.code + data1.Message, { icon: 5 });
+                    }
+                }, error: function () {
+                    layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                }
+            });
+
+            get_FastQuery(2);
+
+            if (HDelData == 1) {
+                //鎸変换鍔″崟浼樺厛绾� 寰幆
+                for (var i = 0; i < option.data.length; i++) {
+                    //鎵惧埌鏈换鍔″崟 鍙敤鐢熶骇璧勬簮
+                    lMainID = option.data[i]["HICMOInterID"];
+                    sICMOBillNo = option.data[i]["鐢熶骇璁㈠崟鍙�"];
+                    dEndDate = Format(option.data[i]["鏈�杩熷畬宸ユ棩鏈�"], 'yyyy/MM/dd');
+                    sProdTimes = option.data[i]["鐢熶骇鍛ㄦ湡"];
+                    sPlanQty = option.data[i]["璁″垝鏁伴噺"];
+                    lHGroupID = option.data[i]["HGroupID"];
+                    sGroupName = option.data[i]["HGroupName"];
+                    lMaterID = option.data[i]["HMaterID"];
+                    sMaterNumber = option.data[i]["鐗╂枡浠g爜"];
+                    sMaterName = option.data[i]["鐗╂枡鍚嶇О"];
+                    sMaterModel = option.data[i]["瑙勬牸鍨嬪彿"];
+                    sWorkQty = option.data[i]["灏忔椂浜ц兘"];
+                    sYX = option.data[i]["浼樺厛绾�"];
+                    //鍓╀綑闇�姹傚伐鏃�
+                    iLeftQty = sPlanQty;
+                    if (sWorkQty <= 0) {
+                        sLeftProdTimes = 0;
+                    }
+                    else {
+                        sLeftProdTimes = iLeftQty / sWorkQty;
+                    }
+                    //鑻ユ湰浠诲姟鍗曞凡鏈夊畨鎺掕祫婧愶紙涓婃鎺掔▼鎴栬�呮墜宸ユ帓绋嬶級 鍒欎笉鍐嶅鎵捐祫婧愶紝鐩存帴鎺掔▼
+                    if (option.data[i]["HSourceID"] != 0 && option.data[i]["鐢熶骇璧勬簮"] != "") {
+                        //鑾峰彇璇ョ敓浜ц祫婧愮殑鍓╀綑宸ユ椂杩涜鎺掔▼銆�
+                        lSourceID = option.data[i]["HSourceID"];
+                        sSourceName = option.data[i]["鐢熶骇璧勬簮"];
+                        sSourceNumber = option.data[i]["鐢熶骇璧勬簮浠g爜"];
+                        //鏌ヨ鐢熶骇璧勬簮鐨勫墿浣欏伐鏃惰繘琛屾帓绋嬨��
+                        var sql = "exec h_p_Sc_ICMOGetWorkSource2 " + lMaterID + ",'" + dEndDate + "'," + sProdTimes + "," + lSourceID;
+                        $.ajax({
+                            url: GetWEBURL() + '/Gy_SOPBillList/WindowPrintList',
+                            type: "GET",
+                            async: false,
+                            data: { "sWhere": sql },
+                            success: function (data1) {
+                                if (data1.count == 1) {
+                                    ds = data1.data
+                                } else {
+                                    layer.alert(data1.code + data1.Message, { icon: 5 });
+                                }
+                            }, error: function () {
+                                layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                            }
+                        });
+                    }
+                    else //娌℃湁璧勬簮鍒� 鑷姩鎵惧埌璧勬簮
+                    {
+                        //鏌ヨ鐢熶骇璧勬簮鐨勫墿浣欏伐鏃惰繘琛屾帓绋嬨��
+                        var sql = "exec h_p_Sc_ICMOGetWorkSource2 " + lMaterID + ",'" + dEndDate + "'," + sProdTimes;
+                        $.ajax({
+                            url: GetWEBURL() + '/Gy_SOPBillList/WindowPrintList',
+                            type: "GET",
+                            async: false,
+                            data: { "sWhere": sql },
+                            success: function (data1) {
+                                if (data1.count == 1) {
+                                    ds = data1.data
+                                } else {
+                                    layer.alert(data1.code + data1.Message, { icon: 5 });
+                                }
+                            }, error: function () {
+                                layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                            }
+                        });
+                    }
+                  
+                    if (ds == null || ds.length == 0) //娌℃湁鍙互鎺掔殑璧勬簮
+                    {
+                        //璺冲埌涓嬩竴鍗�  鏈崟绾㈣壊鏄剧ず
+                        $("tr[data-index='" + i + "']").attr({ "style": "background:red;color:black;" });
+                        continue;
+                    }
+                    else {
+                        $("tr[data-index='" + i + "']").attr({ "style": "background:White;color:black;" });
+                        //寮�濮嬫帓鍗� 
+                        bFind = false;
+                        //瓒呬氦璐ф湡  浠嶇劧鎺掔▼
+                        for (var j = 0; j < ds.length; j++) {
+                            //鍒ゆ柇璧勬簮鍓╀綑宸ユ椂锛屾槸鍚﹀ぇ浜� 鐢熶骇鍛ㄦ湡
+                            if (parseFloat(ds[j]["鍓╀綑宸ユ椂"]) > sLeftProdTimes) {
+                                if (iLeftQty > 0) // 鐢熶骇璁㈠崟鍓╀綑鏁伴噺
+                                {
+                                    //鍦ㄦ湰璧勬簮涓婄敓浜�
+                                    //鑾峰彇璇ョ敓浜ц祫婧愮殑鍓╀綑宸ユ椂杩涜鎺掔▼銆�
+                                    lSourceID = ds[j]["HitemID"];
+                                    sSourceName = ds[j]["璧勬簮鍚嶇О"];
+                                    sSourceNumber = ds[j]["璧勬簮浠g爜"];
+                                    option.data[i]["HSourceID"] = lSourceID;
+                                    option.data[i]["鐢熶骇璧勬簮"] = sSourceName;
+                                    option.data[i]["鐢熶骇璧勬簮浠g爜"] = sSourceNumber;
+
+                                    var sql = "exec h_p_Sc_ICMOGetWorkSourceTime " + lSourceID;
+                                    $.ajax({
+                                        url: GetWEBURL() + '/Gy_SOPBillList/WindowPrintList',
+                                        type: "GET",
+                                        async: false,
+                                        data: { "sWhere": sql },
+                                        success: function (data1) {
+                                            if (data1.count == 1) {
+                                                dsSub = data1.data
+                                            } else {
+                                                layer.alert(data1.code + data1.Message, { icon: 5 });
+                                            }
+                                        }, error: function () {
+                                            layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                                        }
+                                    });
+
+                                    if (dsSub == null || dsSub.length == 0) {
+                                        continue;//濡傛灉娌℃湁鍓╀綑鍒� 鎵ц涓嬩竴涓敓浜ц鍗�
+                                    }
+                                    if (dsSub != null)//涓嶅姞鐝帓绋�
+                                    {
+                                        iRow = i + 1;
+                                        //灏嗘暟鎹帓鍒扮綉鏍间腑
+                                        //grdMain.RowCount = grdMain.RowCount + 1;  //  grdmain 鏂板涓�琛�
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOBillNoCol].Value = sICMOBillNo;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOInterIDCol].Value = lMainID;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecLeftQtyCol].Value = iLeftQty;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecGroupIDCol].Value = lHGroupID;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecGroupNameCol].Value = sGroupName;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterIDCol].Value = lMaterID;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNameCol].Value = sMaterName;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNumberCol].Value = sMaterNumber;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterModelCol].Value = sMaterModel;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanEndDateCol].Value = dEndDate;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanQtyCol].Value = sPlanQty;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceIDCol].Value = lSourceID;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNameCol].Value = sSourceName;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNumberCol].Value = sSourceNumber;
+                                        //grdMain.Rows[grdMain.RowCount - 1].Cells[HSecYXCol].Value = sYX;
+                                        //Sc_ICMOSortBillFun.SetInfoToGrid(grdMain, dsSub, null, grdMain.RowCount - 1, ref iLeftQty, sWorkQty, false, oClsGridValues);
+                                        SetInfoToGrid(option, dsSub, null, (iRow - 1), iLeftQty, sWorkQty, false, HPlanDay);
+                                    }
+                                    bFind = true;
+                                }
+                            }
+                        }
+                        if (!bFind) {
+                            for (var j = 0; j < ds.length; j++) {
+                                //鍒ゆ柇璧勬簮鏈�澶у墿浣欏伐鏃讹紝鏄惁澶т簬 鐢熶骇鍛ㄦ湡
+                                if (parseFloat(ds[j]["鏈�澶у墿浣欏伐鏃�"]) > sLeftProdTimes) {
+                                    if (iLeftQty > 0) {
+
+                                        //鍦ㄦ湰璧勬簮涓婄敓浜�
+                                        grdMain.RowCount = grdMain.RowCount + 1;
+                                        //鑾峰彇璇ョ敓浜ц祫婧愮殑鍓╀綑宸ユ椂杩涜鎺掔▼銆�
+                                        lSourceID = ds[j]["HitemID"];
+                                        sSourceName = ds[j]["璧勬簮鍚嶇О"];
+                                        sSourceNumber = ds[j]["璧勬簮浠g爜"];
+                                        option.data[i]["HSourceID"] = lSourceID;
+                                        option.data[i]["鐢熶骇璧勬簮"] = sSourceName;
+                                        option.data[i]["鐢熶骇璧勬簮浠g爜"] = sSourceNumber;
+
+                                        var sql = "exec h_p_Sc_ICMOGetWorkSourceTime " + lSourceID;
+                                        $.ajax({
+                                            url: GetWEBURL() + '/Gy_SOPBillList/WindowPrintList',
+                                            type: "GET",
+                                            async: false,
+                                            data: { "sWhere": sql },
+                                            success: function (data1) {
+                                                if (data1.count == 1) {
+                                                    dsSub = data1.data
+                                                } else {
+                                                    layer.alert(data1.code + data1.Message, { icon: 5 });
+                                                }
+                                            }, error: function () {
+                                                layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                                            }
+                                        });
+
+                                        if (dsSub == null || dsSub.length == 0) {
+                                            continue;
+                                        }
+                                        //if (dsSub != null)//鍔犵彮鎺掔▼
+                                        //{
+                                        //    //灏嗘暟鎹帓鍒扮綉鏍间腑
+                                        //    grdMain.RowCount = grdMain.RowCount + 1;  //  grdmain 鏂板涓�琛�
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOBillNoCol].Value = sICMOBillNo;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOInterIDCol].Value = lMainID;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecLeftQtyCol].Value = iLeftQty;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecGroupIDCol].Value = lHGroupID;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecGroupNameCol].Value = sGroupName;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterIDCol].Value = lMaterID;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNameCol].Value = sMaterName;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNumberCol].Value = sMaterNumber;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterModelCol].Value = sMaterModel;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanEndDateCol].Value = dEndDate;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanQtyCol].Value = sPlanQty;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceIDCol].Value = lSourceID;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNameCol].Value = sSourceName;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNumberCol].Value = sSourceNumber;
+                                        //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecYXCol].Value = sYX;
+                                        //    Sc_ICMOSortBillFun.SetInfoToGrid(grdMain, dsSub, null, grdMain.RowCount - 1, ref iLeftQty, sWorkQty, true, oClsGridValues);
+                                        //}
+                                    }
+                                    bFind = true;
+                                }
+                            }
+                        }
+                    
+                        if (!bFind) {
+                            //濡傛灉娌℃湁鎵惧埌鍚堥�傝祫婧愬垯锛岀洿鎺ユ帓鏈�鍚庝竴涓墿浣欐渶澶х殑璧勬簮銆�
+                            //鑾峰彇璇ョ敓浜ц祫婧愮殑鍓╀綑宸ユ椂杩涜鎺掔▼銆�
+                            lSourceID = ds[ds.length - 1]["HitemID"];
+                            sSourceName = ds[ds.length - 1]["璧勬簮鍚嶇О"];
+                            sSourceNumber = ds[ds.length - 1]["璧勬簮浠g爜"];
+                            option.data[i]["HSourceID"] = lSourceID;
+                            option.data[i]["鐢熶骇璧勬簮"] = sSourceName;
+                            option.data[i]["鐢熶骇璧勬簮浠g爜"] = sSourceNumber;
+
+                            //鑾峰彇璇ョ敓浜ц祫婧愮殑鍓╀綑宸ユ椂杩涜鎺掔▼銆�
+                            var sql = "exec h_p_Sc_ICMOGetWorkSourceTime " + lSourceID;
+                            $.ajax({
+                                url: GetWEBURL() + '/Gy_SOPBillList/WindowPrintList',
+                                type: "GET",
+                                async: false,
+                                data: { "sWhere": sql },
+                                success: function (data1) {
+                                    if (data1.count == 1) {
+                                        dsSub = data1.data
+                                    } else {
+                                        layer.alert(data1.code + data1.Message, { icon: 5 });
+                                    }
+                                }, error: function () {
+                                    layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                                }
+                            });
+
+                            if (dsSub == null || dsSub.length == 0) {
+                                continue;
+                            }
+                            //if (dsSub != null)//鍔犵彮鎺掔▼
+                            //{
+                            //    //灏嗘暟鎹帓鍒扮綉鏍间腑
+                            //    grdMain.RowCount = grdMain.RowCount + 1;  //  grdmain 鏂板涓�琛�
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOBillNoCol].Value = sICMOBillNo;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecICMOInterIDCol].Value = lMainID;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecLeftQtyCol].Value = iLeftQty;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecGroupIDCol].Value = lHGroupID;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecGroupNameCol].Value = sGroupName;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterIDCol].Value = lMaterID;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNameCol].Value = sMaterName;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterNumberCol].Value = sMaterNumber;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecMaterModelCol].Value = sMaterModel;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanEndDateCol].Value = dEndDate;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecPlanQtyCol].Value = sPlanQty;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceIDCol].Value = lSourceID;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNameCol].Value = sSourceName;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecSourceNumberCol].Value = sSourceNumber;
+                            //    grdMain.Rows[grdMain.RowCount - 1].Cells[HSecYXCol].Value = sYX;
+                            //    Sc_ICMOSortBillFun.SetInfoToGrid(grdMain, dsSub, null, grdMain.RowCount - 1, ref iLeftQty, sWorkQty, true, oClsGridValues);
+                            //}
+                        }
+                    }
+                }
+                table.render(option);
+               
+                set_AddNew();
+            } else {
+                layer.msg("鏁版嵁娓呯┖澶辫触!")
+            }
+            layer.close(ajaxLoad);
+        }
+
+        //灏嗘暟鎹帓绋嬪埌缃戞牸
+        function SetInfoToGrid(grd, ds, dsPre, iRow, sLeftQty, sWorkQty, bAddFlag, HPlanDay) {
+            var b = false;
+            var oSub;
+            //寰幆缃戞牸鍒�
+            if (bAddFlag) {
+                for (var i = 0; i < ds.length; i++) {
+                    //鎵惧埌瀵瑰簲鐨勫垪
+                    for (var j = 22; j < grd.cols[0].length; j++) {
+                        if (sLeftQty > 0) {
+                            if (ds[i]["鏃ユ湡"] == grd.cols[0][j].field) //琛ㄦ牸鐨勬爣棰樹笂 淇濆瓨浜嗘棩鏈燂紱
+                            {
+                                //濡傛灉鏃堕棿琚� 涓婇亾浣欓噺鍗犵敤 鍒� 璺宠繃
+                                b = false;
+                                //if (dsPre != null && dsPre.Tables[0].Rows.Count > 0) {
+                                //    for (var m = 0; m < dsPre.Tables[0].Rows.Count; m++)
+                                //    {
+                                //        if (ds[i]["鏃ユ湡"] < DBUtility.ClsPub.isDate(dsPre.Tables[0].Rows[m]["鏃ユ湡"])) {
+                                //            b = true;
+                                //        }
+                                //    }
+                                //}
+                                if (b == false) {
+                                    if (dsPre != null && ds[i]["鏃ユ湡"] == dsPre[0]["鏃ユ湡"]) {
+                                        ////HUseTimes 涓� 涓婇亾浣欓噺鍚� 鍓╀綑宸ユ椂銆�
+                                        //if (ds[i]["鏈�澶у墿浣欏伐鏃�"] > dsPre[0]["HUseTimes"]) {
+                                        //    if (parseFloat(sLeftQty) > parseFloat(sWorkQty * dsPre[0]["HUseTimes"])) {
+                                        //        grd.data[iRow][j] = parseFloat(sWorkQty * (dsPre[0]["HUseTimes"]));
+                                        //        sLeftQty = sLeftQty - parseFloat(sWorkQty * (dsPre[0]["HUseTimes"]));
+                                        //        oSub = new ClsGridValues();
+                                        //        oSub.iRow = iRow;
+                                        //        oSub.iCol = j;
+                                        //        oSub.HLeftTimes = DBUtility.ClsPub.isSingle(dsPre[0]["HUseTimes"]);
+                                        //        oClsGridValues.Add(oSub);
+                                        //    }
+                                        //    else {
+                                        //        grd.data[iRow][j]= sLeftQty;
+                                        //        sLeftQty = 0;
+                                        //        oSub = new ClsGridValues();
+                                        //        oSub.iRow = iRow;
+                                        //        oSub.iCol = j;
+                                        //        oSub.HLeftTimes = DBUtility.ClsPub.isSingle(dsPre.Tables[0].Rows[0]["HUseTimes"]);
+                                        //        oClsGridValues.Add(oSub);
+                                        //    }
+                                        //}
+                                        //else //鍗撳姏涓嶉渶瑕佽�冭檻鍔犵彮锛屼笅闈㈢殑杩欎竴娈典笉闇�瑕�
+                                        //{
+                                        //    if (sLeftQty > sWorkQty * ds[i]["鏈�澶у墿浣欏伐鏃�"]) {
+                                        //        grd.data[iRow][j]= parseFloat(sWorkQty * ds[i]["鏈�澶у墿浣欏伐鏃�"]);
+                                        //        sLeftQty = sLeftQty - (parseFloat(sWorkQty * ds[i]["鏈�澶у墿浣欏伐鏃�"]));
+                                        //        sLeftQty = 0;
+                                        //        oSub = new ClsGridValues();
+                                        //        oSub.iRow = iRow;
+                                        //        oSub.iCol = j;
+                                        //        oSub.HLeftTimes = ds[i]["鏈�澶у墿浣欏伐鏃�"];
+                                        //        oClsGridValues.Add(oSub);
+                                        //    }
+                                        //    else {
+                                        //        grd.data[iRow][j]= sLeftQty;
+                                        //        sLeftQty = 0;
+                                        //        oSub = new ClsGridValues();
+                                        //        oSub.iRow = iRow;
+                                        //        oSub.iCol = j;
+                                        //        oSub.HLeftTimes = ds[i]["鏈�澶у墿浣欏伐鏃�"];
+                                        //        oClsGridValues.Add(oSub);
+                                        //    }
+                                        //}
+                                    }
+                                    else {
+                                        if (sLeftQty > parseFloat(sWorkQty * ds[i]["鏈�澶у墿浣欏伐鏃�"])) {
+                                            grd.data[iRow][grd.cols[0][j + HPlanDay].field] = parseFloat(sWorkQty * ds[i]["鏈�澶у墿浣欏伐鏃�"]);
+                                            sLeftQty = sLeftQty - (parseFloat(sWorkQty * ds[i]["鏈�澶у墿浣欏伐鏃�"]));
+                                            //oSub = new ClsGridValues();
+                                            //oSub.iRow = iRow;
+                                            //oSub.iCol = j;
+                                            option.data[iRow]["HLeftTimes"] = ds[i]["鏈�澶у墿浣欏伐鏃�"];
+                                            break;
+                                            //oSub.HLeftTimes = ds[i]["鏈�澶у墿浣欏伐鏃�"];
+                                            //oClsGridValues.Add(oSub);
+                                        }
+                                        else {
+                                            grd.data[iRow][grd.cols[0][j + HPlanDay].field] = sLeftQty;
+                                            sLeftQty = 0;
+                                            //oSub = new ClsGridValues();
+                                            //oSub.iRow = iRow;
+                                            //oSub.iCol = j;
+                                            option.data[iRow]["HLeftTimes"] = ds[i]["鏈�澶у墿浣欏伐鏃�"];
+                                            break;
+                                            //oSub.HLeftTimes = ds[i]["鏈�澶у墿浣欏伐鏃�"];
+                                            //oClsGridValues.Add(oSub);
+
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+
+                }
+
+            }
+            else {
+                for (var i = 0; i < ds.length; i++) {
+                    //鎵惧埌瀵瑰簲鐨勫垪
+                    for (var j = 22; j < grd.cols[0].length; j++) {
+                        if (sLeftQty > 0) {
+                            if (ds[i]["鏃ユ湡"] == grd.cols[0][j].field) {
+                                //濡傛灉鏃堕棿琚� 涓婇亾浣欓噺鍗犵敤 鍒� 璺宠繃
+                                b = false;
+                                //if (dsPre != null && dsPre.Tables[0].Rows.Count > 0) {
+                                //    for (var m = 0; m < dsPre.Tables[0].Rows.Count; m++)
+                                //    {
+                                //        if (DBUtility.ClsPub.isDate(ds[i]["鏃ユ湡"]) < DBUtility.ClsPub.isDate(dsPre.Tables[0].Rows[m]["鏃ユ湡"])) {
+                                //            b = true;
+                                //        }
+                                //    }
+                                //}
+                                if (b == false) {
+                                    if (dsPre != null && s[i]["鏃ユ湡"] == dsPre[0]["鏃ユ湡"]) {
+                                        //if (ds[i]["鍓╀綑宸ユ椂"] > (DBUtility.ClsPub.isSingle(dsPre.Tables[0].Rows[0]["HUseTimes"]))) {
+                                        //    if (sLeftQty > parseFloat(sWorkQty * (DBUtility.ClsPub.isSingle(dsPre.Tables[0].Rows[0]["HUseTimes"])))) {
+                                        //        grd.data[iRow][j]= parseFloat(sWorkQty * (DBUtility.ClsPub.isSingle(dsPre.Tables[0].Rows[0]["HUseTimes"])));
+                                        //        sLeftQty = sLeftQty - parseFloat(sWorkQty * (DBUtility.ClsPub.isSingle(dsPre.Tables[0].Rows[0]["HUseTimes"])));
+                                        //        oSub = new ClsGridValues();
+                                        //        oSub.iRow = iRow;
+                                        //        oSub.iCol = j;
+                                        //        oSub.HLeftTimes = DBUtility.ClsPub.isSingle(dsPre.Tables[0].Rows[0]["HUseTimes"]);
+                                        //        oClsGridValues.Add(oSub);
+                                        //    }
+                                        //    else {
+                                        //        grd.data[iRow][j]= sLeftQty;
+                                        //        sLeftQty = 0;
+                                        //        oSub = new ClsGridValues();
+                                        //        oSub.iRow = iRow;
+                                        //        oSub.iCol = j;
+                                        //        oSub.HLeftTimes = DBUtility.ClsPub.isSingle(dsPre.Tables[0].Rows[0]["HUseTimes"]);
+                                        //        oClsGridValues.Add(oSub);
+                                        //    }
+                                        //}
+                                        //else {
+                                        //    if (sLeftQty > sWorkQty * ds[i]["鍓╀綑宸ユ椂"]) {
+                                        //        grd.data[iRow][j]= parseFloat(sWorkQty * ds[i]["鍓╀綑宸ユ椂"]);
+                                        //        sLeftQty = sLeftQty - (parseFloat(sWorkQty * ds[i]["鍓╀綑宸ユ椂"]));
+                                        //        sLeftQty = 0;
+                                        //        oSub = new ClsGridValues();
+                                        //        oSub.iRow = iRow;
+                                        //        oSub.iCol = j;
+                                        //        oSub.HLeftTimes = ds[i]["鍓╀綑宸ユ椂"];
+                                        //        oClsGridValues.Add(oSub);
+                                        //    }
+                                        //    else {
+                                        //        grd.data[iRow][j]= sLeftQty;
+                                        //        sLeftQty = 0;
+                                        //        oSub = new ClsGridValues();
+                                        //        oSub.iRow = iRow;
+                                        //        oSub.iCol = j;
+                                        //        oSub.HLeftTimes = ds[i]["鍓╀綑宸ユ椂"];
+                                        //        oClsGridValues.Add(oSub);
+                                        //    }
+                                        //}
+                                    }
+                                    else {
+                                        if (sLeftQty > parseFloat(sWorkQty * ds[i]["鍓╀綑宸ユ椂"])) {
+                                            grd.data[iRow][grd.cols[0][j + HPlanDay].field] = parseFloat(sWorkQty * ds[i]["鍓╀綑宸ユ椂"]);
+                                            sLeftQty = sLeftQty - (parseFloat(sWorkQty * ds[i]["鍓╀綑宸ユ椂"]));
+                                            //oSub = new ClsGridValues();
+                                            //oSub.iRow = iRow;
+                                            //oSub.iCol = j;
+                                            option.data[iRow]["HLeftTimes"] = ds[i]["鏈�澶у墿浣欏伐鏃�"];
+                                            break;
+                                            //oSub.HLeftTimes = ds[i]["鍓╀綑宸ユ椂"];
+                                            //oClsGridValues.Add(oSub);
+                                        }
+                                        else {
+                                            grd.data[iRow][grd.cols[0][j + HPlanDay].field] = sLeftQty;
+                                            sLeftQty = 0;
+                                            //oSub = new ClsGridValues();
+                                            //oSub.iRow = iRow;
+                                            //oSub.iCol = j;
+                                            option.data[iRow]["HLeftTimes"] = ds[i]["鏈�澶у墿浣欏伐鏃�"];
+                                            break;
+                                            //oSub.HLeftTimes = ds[i]["鍓╀綑宸ユ椂"];
+                                            //oClsGridValues.Add(oSub);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
         }
 
         //鏌ヨ鐢熶骇璁㈠崟
@@ -1354,7 +1922,7 @@
         }
 
         //淇濆瓨
-        function set_AddNew(data) {
+        function set_AddNew() {
 
             //鍒犻櫎瀛愯〃鏁版嵁 浼氬崰鐢ㄦ暟缁勭殑浣嶇疆,闇�瑕侀噸鏂版帓涓�涓嬮『搴�
             var num = [];
@@ -1564,9 +2132,9 @@
                             }
                             //璁剧疆鍐呭瀛椾綋澶у皬
                             if (data1.data[0].HFontSize != 0) {
-                                option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
+                                option.cols[0][i + 1]["style"] += ";font-size:" + data1.data[0].HFontSize + "px;";
                             } else {
-                                option.cols[0][i + 1]["style"] = "font-size:100%";
+                                option.cols[0][i + 1]["style"] += ";font-size:100%";
                             }
                             //璁剧疆鍒楀
                             //if (data1.data[0].HColumnWidth != 0) {
diff --git "a/WebTM/views/\350\256\241\345\210\222\347\256\241\347\220\206/\345\267\245\350\211\272\350\267\257\347\272\277/Gy_RoutingBill.html" "b/WebTM/views/\350\256\241\345\210\222\347\256\241\347\220\206/\345\267\245\350\211\272\350\267\257\347\272\277/Gy_RoutingBill.html"
index 1aea7b8..d90b2ee 100644
--- "a/WebTM/views/\350\256\241\345\210\222\347\256\241\347\220\206/\345\267\245\350\211\272\350\267\257\347\272\277/Gy_RoutingBill.html"
+++ "b/WebTM/views/\350\256\241\345\210\222\347\256\241\347\220\206/\345\267\245\350\211\272\350\267\257\347\272\277/Gy_RoutingBill.html"
@@ -532,7 +532,7 @@
                     //, { field: 'HPicNum', title: '鍥剧焊缂栧彿', edit: 'text' }
                     //, { field: 'HTimeUnit', title: '鏃堕棿鍗曚綅', edit: 'text' }
                     //, { field: 'HUnitTime', title: '杩愯鏃堕棿', edit: 'text' }
-                    //, { field: 'HWorkQty', title: '鍔犲伐鏁伴噺', edit: 'text' }//榛樿
+                    , { field: 'HWorkQty', title: '鍔犲伐鏁伴噺', edit: 'text' }//榛樿
                     //, { field: 'HPassRate', title: '鑹巼', edit: 'text' }//榛樿
                     //, { field: 'HProcID_S', title: '宸ユ', edit: 'text' }
                     ////, { field: 'HCenterID_S', title: '浜х嚎涓績id', hide: true }//hide: true
diff --git "a/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\346\212\245\350\241\250\345\210\206\346\236\220/sc_ICOMRKReport.html" "b/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\346\212\245\350\241\250\345\210\206\346\236\220/sc_ICOMRKReport.html"
index 28935d2..555097c 100644
--- "a/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\346\212\245\350\241\250\345\210\206\346\236\220/sc_ICOMRKReport.html"
+++ "b/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\346\212\245\350\241\250\345\210\206\346\236\220/sc_ICOMRKReport.html"
@@ -52,7 +52,7 @@
                                     </div>
                                 </div>
                                 <div class="layui-inline">
-                                    <label class="layui-form-label" style="width: 85px;">鍗曟嵁鍙�</label>
+                                    <label class="layui-form-label" style="width: 85px;">娴佽浆鍗″彿</label>
                                     <div class="layui-input-block" style="margin-left: 120px;">
                                         <input type="text" class="layui-input" name="HBillNo" id="HBillNo">
                                     </div>
@@ -342,7 +342,7 @@
                 }
 
                 if (HBillNo != "") {
-                    sWhere += " and 鐢熶骇璁㈠崟鍙�='" + HBillNo + "' ";
+                    sWhere += " and 娴佽浆鍗″彿='" + HBillNo + "' ";
                 }
 
                 if (HProductName != "") {

--
Gitblit v1.9.1