yangle
2023-08-03 cba0ef063a24b5b965bfa943cf1c8d2c8acba84a
排产
工艺路线的加工数量排产需要
生产入库 单据号改成流转卡号
4个文件已修改
636 ■■■■■ 已修改文件
WebTM/views/生产管理/日计划基础资料/Cg_PODemandPlanConfigBill_Add.html 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/生产管理/生产计划平台/JIT_DayPlanPlatForm.html 598 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/计划管理/工艺路线/Gy_RoutingBill.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/车间管理/报表分析/sc_ICOMRKReport.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/Éú²ú¹ÜÀí/Èռƻ®»ù´¡×ÊÁÏ/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;">
WebTM/views/Éú²ú¹ÜÀí/Éú²ú¼Æ»®Æ½Ì¨/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();
            }
        });
@@ -416,6 +425,17 @@
        })
        
        //排产
        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: '生产资源代码', title: '生产资源代码', 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]["物料代码"];
                    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]["生产资源代码"];
                        //查询生产资源的剩余工时进行排程。
                        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]["资源代码"];
                                    option.data[i]["HSourceID"] = lSourceID;
                                    option.data[i]["生产资源"] = sSourceName;
                                    option.data[i]["生产资源代码"] = 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]["资源代码"];
                                        option.data[i]["HSourceID"] = lSourceID;
                                        option.data[i]["生产资源"] = sSourceName;
                                        option.data[i]["生产资源代码"] = 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]["资源代码"];
                            option.data[i]["HSourceID"] = lSourceID;
                            option.data[i]["生产资源"] = sSourceName;
                            option.data[i]["生产资源代码"] = 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) {
WebTM/views/¼Æ»®¹ÜÀí/¹¤ÒÕ·Ïß/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
WebTM/views/³µ¼ä¹ÜÀí/±¨±í·ÖÎö/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 != "") {