| | |
| | | var matCodeLayerIdx; |
| | | function getCol() { |
| | | var cols = [ |
| | | {fixed: 'left', field: 'count', title: '实际数量', align: 'center', edit:'text', width: 120, style:'color: blue;font-weight: bold'} |
| | | ,{field: 'anfme', align: 'center',title: '数量'} |
| | | ,{field: 'batch', align: 'center',title: '批号(编辑)', edit: true, style: 'font-weight:bold'} |
| | | {fixed: 'left', field: 'count', title: I18n.t('actual_quantity'), align: 'center', edit:'text', width: 120, style:'color: blue;font-weight: bold'} |
| | | ,{field: 'anfme', align: 'center',title: I18n.t('quantity')} |
| | | ,{field: 'batch', align: 'center',title: I18n.t('batch_edit'), edit: true, style: 'font-weight:bold'} |
| | | ]; |
| | | arrRemove(detlCols, "field", "anfme"); |
| | | arrRemove(detlCols, "field", "batch"); |
| | | cols.push.apply(cols, detlCols); |
| | | cols.push({fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:80}) |
| | | var dCols = []; |
| | | if (typeof getDetlCols === 'function') { |
| | | dCols = getDetlCols(); |
| | | } else { |
| | | dCols = detlCols.slice(); |
| | | } |
| | | arrRemove(dCols, "field", "anfme"); |
| | | arrRemove(dCols, "field", "batch"); |
| | | cols.push.apply(cols, dCols); |
| | | cols.push({fixed: 'right', title: I18n.t('operation'), align: 'center', toolbar: '#operate', width:80}) |
| | | return cols; |
| | | } |
| | | |
| | |
| | | cellMinWidth: 50, |
| | | toolbar: '#toolbar', |
| | | cols: [getCol()], |
| | | text: { |
| | | none: typeof I18n !== 'undefined' ? I18n.t('no_data') : '暂无相关数据' |
| | | }, |
| | | done: function (res, curr, count) { |
| | | limit(); |
| | | if (typeof I18n !== 'undefined') { |
| | | I18n.updatePage($('.layui-table-view')); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | $(document).on('i18n:languageChanged', function() { |
| | | tableIns.reload({ |
| | | cols: [getCol()] |
| | | }); |
| | | $('[data-i18n-placeholder]').each(function() { |
| | | var key = $(this).attr('data-i18n-placeholder'); |
| | | $(this).attr('placeholder', I18n.t(key)); |
| | | }); |
| | | // Update location status message if visible |
| | | if (currLocNo) { |
| | | // Need to re-trigger locTips logic or just update the text if possible. |
| | | // Since locTips makes an ajax call, maybe just leave it until next interaction or if we want to be perfect we could store the status. |
| | | // But 'location_status' is inside the dynamic html string. |
| | | // Let's rely on the user to re-search or just update the static part if we can. |
| | | // Actually, simply re-running the status text update if we had the data would be better. |
| | | // But for now, let's just let it be, or update if we have data. |
| | | } |
| | | }); |
| | | |
| | |
| | | if (obj.field === 'count'){ |
| | | let vle = Number(obj.value); |
| | | if (isNaN(vle)) { |
| | | layer.msg("请输入数字", {icon: 2}); |
| | | layer.msg(I18n.t('please_enter_number'), {icon: 2}); |
| | | modify = false; |
| | | } else { |
| | | if (vle <= 0) { |
| | | layer.msg("数量必须大于零", {icon: 2}); |
| | | layer.msg(I18n.t('quantity_must_be_greater_than_zero'), {icon: 2}); |
| | | modify = false; |
| | | } |
| | | } |
| | |
| | | switch(obj.event) { |
| | | case 'adjust': |
| | | if (isEmpty(currLocNo)) { |
| | | layer.msg("请先检索库位", {icon: 2}) |
| | | layer.msg(I18n.t('please_retrieve_location_first'), {icon: 2}) |
| | | inputTip($("#searchLocNo")); |
| | | return; |
| | | } |
| | | if (matCodeData.length === 0) { |
| | | layer.msg("请先添加明细", {icon: 2}); |
| | | layer.msg(I18n.t('please_add_detail_first'), {icon: 2}); |
| | | return; |
| | | } |
| | | for (var i=0;i<matCodeData.length;i++){ |
| | | if (isNaN(matCodeData[i].count)) { |
| | | layer.msg("请输入数字", {icon: 2}); |
| | | layer.msg(I18n.t('please_enter_number'), {icon: 2}); |
| | | return; |
| | | } |
| | | if (matCodeData[i].count < 0){ |
| | | layer.msg("数量不能小于零", {icon: 2}); |
| | | layer.msg(I18n.t('quantity_cannot_be_less_than_zero'), {icon: 2}); |
| | | return; |
| | | } |
| | | } |
| | | layer.confirm('确定调整'+currLocNo+'库位的明细吗?', {shadeClose: true}, function(){ |
| | | layer.confirm(I18n.t('confirm_adjust_location_detail', {val: currLocNo}), {shadeClose: true, title: I18n.t('prompt'), btn: [I18n.t('confirm'), I18n.t('cancel')]}, function(){ |
| | | $.ajax({ |
| | | url: baseUrl+"/locDdetl/adjust/start", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | layer.msg(currLocNo + res.msg, {icon: 1}); |
| | | layer.msg(currLocNo + " " + I18n.t(res.msg), {icon: 1}); |
| | | init(currLocNo) |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | layer.msg(I18n.t(res.msg), {icon: 2}) |
| | | } |
| | | } |
| | | }) |
| | |
| | | let locNo = data.field.loc_no; |
| | | if (locNo === "") { |
| | | inputTip($("#searchLocNo")); |
| | | layer.msg("请输入库位号"); |
| | | layer.msg(I18n.t('please_enter_source_location')); |
| | | return; |
| | | } |
| | | init(locNo); |
| | |
| | | let data = res.data; |
| | | if (data != null) { |
| | | $(".retrieve").show(); |
| | | $("#locMsg").html(locNo + " ,库位状态:" + data.locSts$); |
| | | $("#locMsg").html(locNo + " ," + I18n.t('location_status') + ":" + data.locSts$); |
| | | $('.not-retrieve').hide(); |
| | | currLocNo = locNo; |
| | | } else { |
| | | layer.msg("请输入有效库位号", {icon: 2}); |
| | | layer.msg(I18n.t('please_enter_valid_location_no'), {icon: 2}); |
| | | $('.not-retrieve').show(); |
| | | $("#locMsg").html(""); |
| | | $(".retrieve").hide(); |
| | |
| | | |
| | | $(document).on('click','#mat-query', function () { |
| | | if (isEmpty(currLocNo)) { |
| | | layer.msg("请先检索库位") |
| | | layer.msg(I18n.t('please_retrieve_location_first')) |
| | | inputTip($("#searchLocNo")); |
| | | return; |
| | | } |
| | | let loadIndex = layer.msg('请求中...', {icon: 16, shade: 0.01, time: false}); |
| | | let loadIndex = layer.msg(I18n.t('requesting'), {icon: 16, shade: 0.01, time: false}); |
| | | matCodeLayerIdx = admin.open({ |
| | | type: 2, |
| | | title: false, |