Browse Source

拆分限制

master
常熟吴彦祖 2 weeks ago
parent
commit
ccd4f1ae17
  1. 3
      src/api/inventory/label.js
  2. 69
      src/views/modules/inventory/label-query.vue

3
src/api/inventory/label.js

@ -14,6 +14,9 @@ export const cancelReserve = data => createAPI(`/pda/label/cancelReserve`,'post'
// 标签拆分
export const splitLabel = data => createAPI(`/pda/label/split`,'post',data)
// 标签查询拆分门禁:54子工厂且仍在立库区域A01托盘上时拒绝。人工分拣不调用 - rqrq
export const checkLabelQuerySplit = data => createAPI(`/autoWareHourceHaian/haiAnLabelQuery/checkLabelQuerySplit`, 'post', data)
// ========== 标签校准 ========== - rqrq
// 查询标签校准信息 - rqrq

69
src/views/modules/inventory/label-query.vue

@ -129,8 +129,9 @@
<button
class="action-btn primary"
@click="showSplitDialog"
:disabled="splitCheckLoading || splitLoading"
>
拆分
{{ splitCheckLoading ? '校验中...' : '拆分' }}
</button>
<button
class="action-btn secondary"
@ -201,7 +202,7 @@
</template>
<script>
import { queryLabelInfo, splitLabel } from '@/api/inventory/label'
import { queryLabelInfo, splitLabel, checkLabelQuerySplit } from '@/api/inventory/label'
import { printLabelCommon } from '@/api/production/production-inbound.js'
export default {
@ -217,6 +218,8 @@ export default {
splitDialogVisible: false,
splitQty: '',
splitLoading: false,
// 点击拆分时的立库在盘校验,防止重复打开弹窗 - rqrq
splitCheckLoading: false,
// 离开或重置时递增,避免已发出的查询回填到空页面 - rqrq
scanRequestSeq: 0
};
@ -280,6 +283,7 @@ export default {
this.splitDialogVisible = false;
this.splitQty = '';
this.splitLoading = false;
this.splitCheckLoading = false;
if (needFocus) {
this.focusLabelInput();
}
@ -440,23 +444,53 @@ export default {
},
/**
* 显示拆分对话框
* 标签查询拆分门禁:54子工厂、标签仍在托盘、托盘在立库区域A01时不允许从本页拆分 - rqrq
*/
showSplitDialog() {
async assertLabelQuerySplitAllowed() {
if (!this.labelInfo || !this.labelInfo.site || !this.labelInfo.unitId) {
this.$alert('标签缺少工厂编码,无法拆分', '提示', { confirmButtonText: '确定' });
return false;
}
const { data } = await checkLabelQuerySplit({
site: this.labelInfo.site,
unitId: this.labelInfo.unitId
});
if (data && data.code === 0) {
return true;
}
this.$alert((data && data.msg) || '只有立库区域以外的标签可以从这里拆分', '提示', { confirmButtonText: '确定' });
return false;
},
/**
* 点击拆分先校验立库在盘,通过后才打开数量弹窗。人工分拣页不走这里 - rqrq
*/
async showSplitDialog() {
if (!this.labelInfo) {
this.$message.error('没有可拆分的标签');
return;
}
this.splitQty = '';
this.splitDialogVisible = true;
// 聚焦到拆分数量输入框
this.$nextTick(() => {
if (this.$refs.splitInput) {
this.$refs.splitInput.focus();
if (this.splitCheckLoading || this.splitLoading) {
return;
}
this.splitCheckLoading = true;
try {
const allowed = await this.assertLabelQuerySplitAllowed();
if (!allowed) {
return;
}
});
this.splitQty = '';
this.splitDialogVisible = true;
this.$nextTick(() => {
if (this.$refs.splitInput) {
this.$refs.splitInput.focus();
}
});
} catch (error) {
this.$message.error((error && error.message) || '拆分校验失败');
} finally {
this.splitCheckLoading = false;
}
},
/**
@ -486,10 +520,15 @@ export default {
this.$message.error('标签缺少工厂编码,无法拆分');
return;
}
this.splitLoading = true;
try {
// 确定拆分前再查一次托盘区域,避免弹窗打开后托盘进入立库A01仍被拆分 - rqrq
const allowed = await this.assertLabelQuerySplitAllowed();
if (!allowed) {
return;
}
const { data } = await splitLabel({
// 拆分按 site + unitId 定位原标签,必须用 HandlingUnit.site,不能用登录工厂
site: this.labelInfo.site,

Loading…
Cancel
Save