王 垚
2021-12-31 9ee2abf3f34b3e6c0d35df6cdde0c4d4e1a5d246
WebSRM/layuiAdmin.std-v1.2.1/src/views/SRM/SRM_BarCodeBill.html
@@ -181,6 +181,15 @@
            var time = date.getFullYear() + "-" + month + "-" + day
            return time;
        }
        function DateDiff(sDate1, sDate2) {    //sDate1和sDate2是2002-12-18格式
            var aDate, oDate1, oDate2, iDays
            aDate = sDate1.split("-")
            oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0])    //转换为12-18-2002格式
            aDate = sDate2.split("-")
            oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0])
            iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24)    //把相差的毫秒数转换为天数
            return iDays
        }
        function getUrlVars() {
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
@@ -197,13 +206,13 @@
        var type = params[params[2]];
        //原生成条码方法(送货单默认)
        var mainUrl = "GetHBarCodeShowBillMain"; //表头数据加载ajax
        var subUrl = "GetHBarCodeShowBillSub";//表体数据加载ajax
        var subUrl = "GetHBarCodeShowBillSub";//表体数据加载ajax h_v_SRM_POInStockBillSub_ForWeb2
        var saveBarCode = "GetBarcodeSaveBillBox";//条码生成保存方法ajax
        var openTmpListType = "SRM_POInStockBillList"; //条码打印按钮 弹出界面
        //采购订单条码生成规则
        if (type == 'SRM_POOrderBillList') {
            mainUrl = 'GetHBarCodeShowBillMainBycg';
            subUrl = "GetHBarCodeShowBillSubBycg";
            subUrl = "GetHBarCodeShowBillSubBycg"; //h_v_Cg_POOrderBillSub_ForWeb2
            saveBarCode = "GetBarcodeSaveBillBoxBycg";
            openTmpListType = 'SRM_POOrderBillList';
@@ -211,7 +220,7 @@
        //委外订单
        else if (type == 'SRM_EntrustOrderBill') {
            mainUrl = 'GetHBarCodeShowBillMainBywy';
            subUrl = "GetHBarCodeShowBillSubBywy";
            subUrl = "GetHBarCodeShowBillSubBywy"; //h_v_srm_EntrustOrderBillSub_ForWeb2
            saveBarCode = "GetBarcodeSaveBillBoxBycg";//调用采购数据
            openTmpListType = 'SRM_POOrderBillList';
        }
@@ -421,7 +430,7 @@
                                });
                                table.render({
                                    elem: '#subTable'
                                    , url: GetWEBURL() + 'GetHBarCodeShowBillSub3'
                                    , url: GetWEBURL() + 'GetHBarCodeShowBillSub3'  //h_v_Web_BarCodeBill_ForWeb1
                                    , toolbar: '#toolbarDemo1'
                                    , defaultToolbar: ['filter', 'exports']
                                    , where: { sMsg: linterid }
@@ -560,17 +569,18 @@
                , where: { sMsg: linterid, sMsg2: lentryid }
                , cols: [[
                    , { field: 'HMaterID', title: '物料ID', width: 100, hide: true }
                    , { field: 'HMaterNumber', title: '物料代码', width: 100 }
                    , { field: 'HMaterName', title: '物料名称', width: 200 }
                    , { field: 'HMaterModel', title: '规格型号', width: 200 }
                    , { field: 'HMaterNumber', title: '物料编码', width: 120 }
                    , { field: 'HMaterShortNumber', title: '物料代码', width: 120 }
                    , { field: 'HMaterName', title: '物料名称', width: 120 }
                    , { field: 'HMaterModel', title: '规格型号', width: 120 }
                    , { field: 'HUnitName', title: '计量单位', width: 100 }
                    , { field: 'HUnitNumber', title: '计量单位代码', width: 100, hide: true }
                    , { field: 'HUnitID', title: '计量单位ID', width: 100, hide: true }
                    , { field: 'HQty', title: '数量', width: 100 }
                    , { field: 'HMinQty', title: '内箱包装数', width: 100, edit: 'text' }
                    , { field: 'HBQty', title: '内箱数', width: 100 }
                    , { field: 'HWXQty', title: '外箱包装数', width: 100 }
                    , { field: 'HWBQty', title: '外箱数', width: 100, edit: 'text' }
                    , { field: 'HWXQty', title: '外箱包装数', width: 100, edit: 'text' }
                    , { field: 'HWBQty', title: '外箱数', width: 100}
                    , { field: 'HPrice', title: '单价', width: 100, hide: true }
                    , { field: 'HMoney', title: '金额', width: 100, hide: true }
                    , { field: 'HMTONO', title: '计划跟踪单号', width: 100 }
@@ -733,7 +743,12 @@
                        , done: function (value, date) {
                            data[field] = value;
                            obj.update(data);
                            if (obj.data.HKFDQDate != "" && obj.data.HKFDate != "") {
                                var days = DateDiff(obj.data.HKFDQDate, obj.data.HKFDate);
                                obj.update({
                                    HKFPeriod: days,
                                });
                            }
                        }
                    });
                }
@@ -824,47 +839,47 @@
                            });
                        }
                        break;
                    case "HWBQty": //外箱个数发生变化
                        if (HWBQty < 0) {
                            f_alert("外箱数量不能为负数")
                            return;
                        }
                        else if (HWBQty > HBQty) {
                            f_alert("外箱数量不能超出内箱数量")
                            return;
                        }
                        else {
                            obj.update({
                                //外箱包装总数 =  内箱数量/外箱数量 * 内箱包装数量
                                HWXQty: Math.ceil(parseFloat(obj.data.HBQty) / parseFloat(obj.data.HWBQty)) * parseFloat(obj.data.HMinQty),
                                //HWXQty: 12
                            });
                        }
                        break;
                    //case "HWXQty":
                    //    if (HWXQty > 0) {
                    //        if (HMinQty >= 0) {
                    //            if (isPositiveIntegerTimes(HMinQty, parseFloat(obj.value))) //外箱包装数能被内箱包装数整除
                    //            {
                    //                obj.update({
                    //                    HWBQty: Math.ceil(parseFloat(obj.data.HQty) / parseFloat(obj.value)),
                    //                });
                    //            }
                    //            else {
                    //                //obj.update({
                    //                //    HWXQty: 0,
                    //                //});
                    //                f_alert("外箱包装数必须是内箱包装数的整数倍!");
                    //            }
                    //        }
                    //case "HWBQty": //外箱个数发生变化
                    //    if (HWBQty < 0) {
                    //        f_alert("外箱数量不能为负数")
                    //        return;
                    //    }
                    //    else if (HWBQty > HBQty) {
                    //        f_alert("外箱数量不能超出内箱数量")
                    //        return;
                    //    }
                    //    else {
                    //        //obj.update({
                    //        //    HWXQty: 0,
                    //        //});
                    //        f_alert("外箱包装数不能为负数!");
                    //        obj.update({
                    //            //外箱包装总数 =  内箱数量/外箱数量 * 内箱包装数量
                    //            HWXQty: Math.ceil(parseFloat(obj.data.HBQty) / parseFloat(obj.data.HWBQty)) * parseFloat(obj.data.HMinQty),
                    //            //HWXQty: 12
                    //        });
                    //    }
                    //    break;
                    case "HWXQty":
                        if (HWXQty > 0) {
                            if (HMinQty >= 0) {
                                if (isPositiveIntegerTimes(HMinQty, parseFloat(obj.value))) //外箱包装数能被内箱包装数整除
                                {
                                    obj.update({
                                        HWBQty: Math.ceil(parseFloat(obj.data.HQty) / parseFloat(obj.value)),
                                    });
                                }
                                else {
                                    //obj.update({
                                    //    HWXQty: 0,
                                    //});
                                    f_alert("外箱包装数必须是内箱包装数的整数倍!");
                                }
                            }
                        }
                        else {
                            //obj.update({
                            //    HWXQty: 0,
                            //});
                            f_alert("外箱包装数不能为负数!");
                        }
                        break;
                    case "HKFPeriod":
                        if (HKFPeriod >= 0) {
                            var sKFDQDate = addDate(obj.data.HKFDate, HKFPeriod);