yangle
13 小时以前 76824fbc74817dc6a87cef54c2ab18705490356e
WebTM/views/ÁìÁÏ·¢»õ/ÁìÁϳö¿â/Kf_MateOutBillLEdit.html
@@ -80,9 +80,12 @@
                                        <div class="layui-inline">
                                            <label class="layui-form-label">工艺单号<label style="color:red"> * </label></label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="HProcExchBillNo" id="HProcExchBillNo" class="layui-input" value="" style="float:left;">
                                                <input type="text" name="HProcExchBillNo" id="HProcExchBillNo" class="layui-input" value="" style="float: left; width: 150px;">
                                                <input type="hidden" name="HProcExchInterID" id="HProcExchInterID" lay-verify="HProcExchInterID" value="0">
                                                <input type="hidden" name="HProcExchEntryID" id="HProcExchEntryID" lay-verify="HProcExchEntryID" value="0">
                                                <button type="button" lay-submit="" class="layui-btn" lay-filter="btnSearchProcExchBill" style="width:40px;">
                                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
                                                </button>
                                            </div>
                                        </div>
                                    </div>
@@ -292,6 +295,8 @@
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine"><i class="layui-icon layui-icon-form"></i>复制一行</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Up"><i class="layui-icon layui-icon-form"></i>上移</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Under"><i class="layui-icon layui-icon-form"></i>下移</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Inventory" id="get_Inventory"><i class="layui-icon layui-icon-form"></i>库存查询</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_InOutSum" id="get_InOutSum"><i class="layui-icon layui-icon-form"></i>出入库记录查询</button>
                            </div>
                        </script>
                        <script type="text/html" id="xuhao">
@@ -393,6 +398,12 @@
                var NewRow = { "HMaterID": 0, "HMaterCode": "", "HMaterName": "", "HMaterSpec": "", "HMaterRuleType":"", "HBatchNo": "", "HUnitID": 0, "HUnitCode": "", "HUnitName": "", "HDesignLife": 0, "HLeaveLife": 0, "HUseLife": 0, "HQtyMust": 0, "HRate": 0, "HQty": 0, "HPrice": 0, "HMoney": 0, "HWHID": 0, "HWHCode": "", "HWHName": "", "HSPID": 0, "HSPCode": "", "HSPName": "", "HStockOrgID": sessionStorage["OrganizationID"], "HRemark": "", "HWeight": "0" };
                console.log(NewRow);
                switch (obj.event) {
                    //库存查询
                    case 'get_Inventory': get_Inventory();
                        break;
                    //出入库记录查询
                    case 'get_InOutSum': get_InOutSum();
                        break;
                    //新增一行
                    case 'btn-AddLine': btnAddLine(NewRow);
                        break;
@@ -412,6 +423,55 @@
            });
            //#endregion
            //#region åº“存查询
            function get_Inventory() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1 && data[0].HMaterID != 0) {
                    var HMaterID = data[0].HMaterID.toString();
                    //弹窗方法
                    layer.open({
                        type: 2//弹窗类型
                        , skin: 'layui-layer-rim' //加上边框
                        , area: ['90%', '90%']//大小
                        , title: '库存查询列表'//标题
                        , shift: 2//弹出动画
                        , content: ['../../仓存管理/条码报表/Kf_ICinventoryQueryReport.html?Type=1&HMaterID=' + HMaterID, 'yes']
                        , btn: ['取消']
                        , btn1: function (index, layero) {
                            layer.close(index);
                        }
                    })
                }
                else {
                    layer.msg('请选择一行有物料数据查询!');
                }
            }
            //#endregion
            //#region å‡ºå…¥åº“记录查询
            function get_InOutSum() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1 && data[0].HMaterID != 0) {
                    var HMaterID = data[0].HMaterID.toString();
                    layer.open({
                        type: 2//弹窗类型
                        , skin: 'layui-layer-rim' //加上边框
                        , area: ['90%', '90%']//大小
                        , title: '出入库记录列表'//标题
                        , shift: 2//弹出动画
                        , content: ['../../仓存管理/条码报表/Kf_StockInOutSumQueryReport.html?Type=1&HMaterID=' + HMaterID, 'yes']
                        , btn: ['取消']
                        , btn1: function (index, layero) {
                            layer.close(index);
                        }
                    })
                }
                else {
                    layer.msg('请选择一行有物料数据查询!');
                }
            }
            //#endregion
            //#region è¡Œå†…事件
            table.on('tool(mainTable)', function (obj) {
                set_GridDelete(obj);   //行内删除
@@ -459,6 +519,45 @@
            });
            //#endregion
            //#region é€‰æ‹©æµè½¬å¡å¼¹çª—
            form.on('submit(btnSearchProcExchBill)', function () {
                //页面层-自定义
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '流转卡列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['80%', '80%'],
                    maxmin: true,
                    content: ['../../车间管理/工序流转卡/Sc_ProcessExchangeBillList.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
                        //按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        $("#HProcExchBillNo").val(checkStatus.data[0].单据号);
                        getMainInfoByHProcExchBillNo();
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                    },
                    end: function () {
                    },
                    success: function (layero, index) {
                    }
                });
            })
            //#endregion
            //#region é€‰æ‹©æ‰“浆人弹窗
            form.on('submit(btnSearchHMaterEmp)', function () {
                //页面层-自定义
@@ -470,7 +569,7 @@
                    shift: 2,
                    area: ['80%', '80%'],
                    maxmin: true,
                    content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html', 'yes'],
                    content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?Type=HMaterEmp', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
@@ -726,9 +825,11 @@
                    for (var i = 0; i < option.data.length; i++) {
                        var HMaterRuleType = option.data[i].HMaterRuleType;
                        if (HMaterRuleType == "染料") {
                            option.data[i].HQty = option.data[i].HRate * HWeight;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            option.data[i].HQty = option.data[i].HRate * HWaterQty;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWaterQty * 0.001);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight * 0.001);
                        }
                    }
                    table.render(option);
@@ -745,9 +846,11 @@
                    for (var i = 0; i < option.data.length; i++) {
                        var HMaterRuleType = option.data[i].HMaterRuleType;
                        if (HMaterRuleType == "染料") {
                            option.data[i].HQty = option.data[i].HRate * HWeight;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            option.data[i].HQty = option.data[i].HRate * HWaterQty;
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWaterQty * 0.001);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            option.data[i].HQty = dealDoubleToFixed(option.data[i].HRate * HWeight * 0.001);
                        }
                    }
                    table.render(option);
@@ -950,9 +1053,11 @@
                        var HQty = 0;
                        var HMaterRuleType = obj.data.HMaterRuleType;
                        if (HMaterRuleType == "染料") {
                            HQty = HRate * HWeight;
                            HQty = dealDoubleToFixed(HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            HQty = HRate * HWaterQty;
                            HQty = dealDoubleToFixed(HRate * HWaterQty * 0.001);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            HQty = dealDoubleToFixed(HRate * HWeight * 0.001);
                        }
                        //同步更新表格和缓存对应的值
                        obj.update({
@@ -968,9 +1073,11 @@
                        var HQty = 0;
                        var HMaterRuleType = value;
                        if (HMaterRuleType == "染料") {
                            HQty = HRate * HWeight;
                            HQty = dealDoubleToFixed(HRate * HWeight);
                        } else if (HMaterRuleType == "助剂") {
                            HQty = HRate * HWaterQty;
                            HQty = dealDoubleToFixed(HRate * HWaterQty * 0.001);
                        } else if (HMaterRuleType == "助剂(按布算)") {
                            HQty = dealDoubleToFixed(HRate * HWeight * 0.001);
                        }
                        //同步更新表格和缓存对应的值
                        obj.update({
@@ -1330,7 +1437,7 @@
                    url: GetWEBURL() + 'Kf_MateOutBill/Kf_MateOutBillListProjectDetai',
                    async:false,
                    type: "GET",
                    data: { "sqlWhere": "and hmainid=" + linterid },
                    data: { "sqlWhere": " and hmainid=" + linterid },
                    success: function (result) {
                        if (result.count == 1) {
                            option.data = result.list[0];
@@ -1545,9 +1652,11 @@
                                        var HWeight = $("#HWeight").val();
                                        var HWaterQty = $("#HWaterQty").val();
                                        if (option.data[rowIndex + i].HMaterRuleType == "染料") {
                                            option.data[rowIndex + i].HQty = option.data[rowIndex + i].HRate * HWeight;
                                            option.data[rowIndex + i].HQty = dealDoubleToFixed(option.data[rowIndex + i].HRate * HWeight);
                                        } else if (option.data[rowIndex + i].HMaterRuleType == "助剂") {
                                            option.data[rowIndex + i].HQty = option.data[rowIndex + i].HRate * HWaterQty;
                                            option.data[rowIndex + i].HQty = dealDoubleToFixed(option.data[rowIndex + i].HRate * HWaterQty * 0.001);
                                        } else if (option.data[rowIndex + i].HMaterRuleType == "助剂(按布算)") {
                                            option.data[rowIndex + i].HQty = dealDoubleToFixed(option.data[rowIndex + i].HRate * HWeight * 0.001);
                                        }
                                    }
                                    table.render(option);
@@ -1559,7 +1668,14 @@
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                },
                                end: function () {
                                     obj.update({
                                         "HMaterID": OptionData.HItemID
                                        ,"HMaterCode" : OptionData.物料代码
                                       , "HMaterName" :OptionData.物料名称
                                        ,"HMaterSpec" : OptionData.规格型号
                                        ,"HUnitID" :OptionData.HUnitID
                                        ,"HUnitName" : OptionData.计量单位名称
                                })
                                }
                            });
                        }
@@ -1600,7 +1716,11 @@
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                },
                                end: function () {
                                     obj.update({
                                     "HPropertyID" :OptionData.HItemID
                                        ,"HPropertyCode" : OptionData.HNumber
                                       , "辅助属性" :OptionData.HName
                                })
                                }
                            });
                        }
@@ -1642,7 +1762,10 @@
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                },
                                end: function () {
                                 obj.update({
                                    "HUnitID": OptionData.HItemID
                                    , "计量单位": OptionData.计量单位名称
                                })
                                }
                            });
                        }
@@ -1691,7 +1814,6 @@
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                },
                                end: function () {
                                }
                            });
                        }
@@ -2062,6 +2184,53 @@
        });
          function GetHDeptNameValue(obj)  //返回车间
        {
            $("#HDeptName").val(obj[0].部门名称);
            $("#HDeptID").val(obj[0].HItemID);
        }
        function GetHMaterEmpValue(obj)  //返回打浆人
        {
            $("#HMaterEmpName").val(obj[0].职员名称);
            $("#HMaterEmpID").val(obj[0].HItemID);
        }
          //双击返回物料
         function GetGyMaterial(data) {
             OptionData = data
         }
           //双击返回计量单位
         function GetGyUnit(data) {
             OptionData = data
        }
        //#region å¤„理小数显示位数(data:需要处理的数据;num:数据的类型(如1:数量;2:金额;3:单价))
        function dealDoubleToFixed(data) {
            //用于设置小数位数
            var dotLength = 6;
            //判断是否存在小数点及其索引位置
            data = data + "";
            var index = data.indexOf(".");
            //处理数据并返回
            if (index < 0) {
                return data * 1;
            } else {
                //获取小数位数
                var length = data.length - index - 1;
                if (length <= dotLength) {
                    return data * 1;
                } else {
                    data = data * 1;
                    return data.toFixed(dotLength) * 1;
                }
            }
        }
                //#endregion
    </script>
</body>
</html>