任务添加zoneid
添加物料打印 添加物料工序 添加库存出库 修改状态返回接口 wcs请求添加 重量和入口
This commit is contained in:
1 parent
42c26b2800
commit
b12ed2d5e5
54 files changed
+1442
-393
No files matched your search
@@ -4,34 +4,23 @@
|
||||
<a-card class="general-card">
|
||||
<a-form :model="form" :rules="rules" ref="formRef" auto-label-width>
|
||||
<a-form-item label="托盘码" field="palletCode">
|
||||
<a-input v-model="form.palletCode" @@change="scanPallet" ref="palletCodeRef" placeholder="请扫描托盘码" @@keydown.enter.prevent="focusNext('materialCodeRef')" />
|
||||
<a-input v-model="form.palletCode" ref="palletCodeRef" placeholder="请扫描托盘码" @@change="scanPallet" @@keydown.enter="focusNext('materialCodeRef')" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="物料码" field="materialCode">
|
||||
<a-auto-complete
|
||||
v-model="form.materialCode"
|
||||
:data="materialOptions"
|
||||
ref="materialCodeRef"
|
||||
placeholder="请扫描或输入物料码"
|
||||
@@search="handleMaterialSearch"
|
||||
@@select="handleMaterialSelect"
|
||||
ref="materialCodeRef"
|
||||
@@keydown.enter.prevent="focusNext('quantityInput')"
|
||||
>
|
||||
</a-auto-complete>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="生产订单" field="orderId">
|
||||
<a-select v-model="form.orderId" placeholder="请选择生产订单" @@change="handleOrderChange" ref="orderSelect">
|
||||
<a-option v-for="item in orderOptions"
|
||||
:key="item.value"
|
||||
:value="item.value">
|
||||
{{ item.label }}
|
||||
</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="当前工序" field="processId">
|
||||
<a-select v-model="form.processId" placeholder="请选择工序" ref="processSelect">
|
||||
<a-select v-model="form.processId" placeholder="请选择工序" @@change="processSelect">
|
||||
<a-option v-for="item in processOptions"
|
||||
:key="item.value"
|
||||
:value="item.value">
|
||||
@@ -40,31 +29,26 @@
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="入库数量" field="quantity">
|
||||
<a-input-number v-model="form.quantity" :min="1" :precision="0" ref="quantityInput" />
|
||||
<a-form-item label="工序名称" field="processName" v-show="false">
|
||||
<a-input v-model="form.processName" />
|
||||
</a-form-item>
|
||||
|
||||
|
||||
<a-form-item label="是否合格" field="isQualified">
|
||||
<a-switch v-model="form.isQualified" ref="isQualifiedSwitch" />
|
||||
<a-switch v-model="form.isQualified" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="操作员工" field="operatorId">
|
||||
<a-select v-model="form.operatorId" placeholder="请选择操作员工" ref="operatorSelect">
|
||||
<a-option v-for="item in operatorOptions"
|
||||
:key="item.value"
|
||||
:value="item.value">
|
||||
{{ item.label }}
|
||||
</a-option>
|
||||
</a-select>
|
||||
<a-input v-model="form.operatorId" ref="operatorIdRef" placeholder="请扫描员工码" @@keydown.enter="focusNext('operatorInfoRef')" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="检验员信息" field="operatorInfo">
|
||||
<a-input v-model="form.operatorInfo" placeholder="请输入检验员信息" />
|
||||
<a-input v-model="form.operatorInfo" ref="operatorInfoRef" placeholder="请扫描检验员信息" @@keydown.enter="submitForm" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
<a-button type="primary" @@click="submitForm" :loading="loading">上架入库</a-button>
|
||||
<a-button type="success" @@click="submitEmptyPallet" :loading="loading">空托盘入库</a-button>
|
||||
<a-button @@click="resetForm">重置</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
@@ -81,14 +65,26 @@
|
||||
const app = createApp({
|
||||
setup() {
|
||||
const formRef = ref(null);
|
||||
const loading = ref(false);
|
||||
|
||||
const palletCodeRef = ref(null);
|
||||
const materialCodeRef = ref(null);
|
||||
const orderSelect = ref(null);
|
||||
const processSelect = ref(null);
|
||||
const operatorSelect = ref(null);
|
||||
const quantityInput = ref(null);
|
||||
const isQualifiedSwitch = ref(null);
|
||||
const loading = ref(false);
|
||||
const operatorIdRef = ref(null);
|
||||
const operatorInfoRef = ref(null);
|
||||
|
||||
const inputRefs = {
|
||||
palletCodeRef,
|
||||
materialCodeRef,
|
||||
operatorIdRef,
|
||||
operatorInfoRef
|
||||
};
|
||||
const focusNext = (nextRefName) => {
|
||||
nextTick(() => {
|
||||
if (inputRefs[nextRefName] && inputRefs[nextRefName].value && inputRefs[nextRefName].value.focus) {
|
||||
inputRefs[nextRefName].value.focus();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const form = reactive({
|
||||
palletCode: '',
|
||||
@@ -96,15 +92,11 @@
|
||||
orderId: '',
|
||||
operatorId: '',
|
||||
processId: '',
|
||||
quantity: 1,
|
||||
processName:'',
|
||||
isQualified: true,
|
||||
operatorInfo: ''
|
||||
});
|
||||
|
||||
const orderOptions = ref([]);
|
||||
const operatorOptions = ref([]);
|
||||
const processOptions = ref([]);
|
||||
|
||||
const materialOptions = ref([]);
|
||||
let searchTimer = null;
|
||||
|
||||
@@ -115,35 +107,24 @@
|
||||
materialCode: [
|
||||
{ required: true, message: '请输入物料码', trigger: ['change', 'blur'] }
|
||||
],
|
||||
orderId: [
|
||||
{ required: true, message: '请选择生产订单', trigger: ['change', 'blur'] }
|
||||
],
|
||||
operatorId: [
|
||||
{ required: true, message: '请选择操作员工', trigger: ['change', 'blur'] }
|
||||
],
|
||||
|
||||
processId: [
|
||||
{ required: true, message: '请选择工序', trigger: ['change', 'blur'] }
|
||||
],
|
||||
quantity: [
|
||||
{ required: true, type: 'number', message: '请输入数量', trigger: ['change', 'blur'] }
|
||||
operatorId: [
|
||||
{ required: true, message: '请输入操作员工信息', trigger: ['change', 'blur'] }
|
||||
],
|
||||
|
||||
operatorInfo: [
|
||||
{ required: true, message: '请输入检验员信息', trigger: ['change', 'blur'] }
|
||||
]
|
||||
};
|
||||
|
||||
// 加载操作员列表
|
||||
const loadOperators = () => {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
url: "/receipt/ReceiptIn/GetOperators",
|
||||
success: (json) => {
|
||||
operatorOptions.value = json.Data;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const processSelect = (value) => {
|
||||
form.processName = processOptions.value.find(item => item.value === value).processName;
|
||||
focusNext('operatorIdRef');
|
||||
}
|
||||
|
||||
// 加载工序列表
|
||||
const loadProcesses = () => {
|
||||
$.ajax({
|
||||
@@ -151,19 +132,41 @@
|
||||
dataType: "json",
|
||||
url: "/receipt/ReceiptIn/GetProcesses",
|
||||
success: (json) => {
|
||||
processOptions.value = json.Data;
|
||||
if (json.Code == 200) {
|
||||
processOptions.value = json.Data;
|
||||
} else {
|
||||
Message.error(json.Msg || '加载工序列表失败');
|
||||
}
|
||||
},
|
||||
error: (xhr, status, error) => {
|
||||
Message.error('加载工序列表失败:' + error);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 加载当前操作员信息
|
||||
const loadOperatorInfo = () => {
|
||||
// 根据物料加载工序列表
|
||||
const loadProcessesByMaterial = (materialCode) => {
|
||||
if (!materialCode) {
|
||||
processOptions.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
url: "/receipt/ReceiptIn/GetOperatorInfo",
|
||||
data: { materialCode: materialCode },
|
||||
url: "/receipt/ReceiptIn/GetProcessesByMaterial",
|
||||
success: (json) => {
|
||||
form.operatorInfo = json.Data;
|
||||
if (json.Code == 200) {
|
||||
processOptions.value = json.Data;
|
||||
} else {
|
||||
Message.error(json.Msg || '加载物料工序失败');
|
||||
processOptions.value = [];
|
||||
}
|
||||
},
|
||||
error: (xhr, status, error) => {
|
||||
Message.error('加载物料工序失败:' + error);
|
||||
processOptions.value = [];
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -220,28 +223,15 @@
|
||||
const selectedMaterial = materialOptions.value.find(item => item.value === value);
|
||||
if (selectedMaterial) {
|
||||
form.materialCode = selectedMaterial.MaterialCode;
|
||||
// 选择物料后加载相关订单
|
||||
scanMaterial();
|
||||
// 选择物料后加载相关工序
|
||||
loadProcessesByMaterial(selectedMaterial.MaterialCode);
|
||||
}
|
||||
};
|
||||
|
||||
// 扫描物料码
|
||||
const scanMaterial = () => {
|
||||
if (!form.materialCode) return;
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { materialCode: form.materialCode },
|
||||
url: "/receipt/ReceiptIn/GetOrdersByMaterial",
|
||||
success: (json) => {
|
||||
orderOptions.value = json.Data;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 生产订单变更
|
||||
const handleOrderChange = () => {
|
||||
loadProcesses();
|
||||
loadProcessesByMaterial(form.materialCode);
|
||||
};
|
||||
|
||||
// 提交表单
|
||||
@@ -260,7 +250,10 @@
|
||||
Message.success('入库成功!');
|
||||
resetForm();
|
||||
} else {
|
||||
Message.error(json.Msg || '入库失败!');
|
||||
Message.error({
|
||||
content: json.Msg || '入库失败!',
|
||||
duration: 5000 // 设置为 5 秒
|
||||
});
|
||||
}
|
||||
},
|
||||
error: (xhr, status, error) => {
|
||||
@@ -276,10 +269,48 @@
|
||||
});
|
||||
};
|
||||
|
||||
// 空托盘入库
|
||||
const submitEmptyPallet = () => {
|
||||
if (!form.palletCode) {
|
||||
Message.error('请输入托盘码!');
|
||||
return;
|
||||
}
|
||||
|
||||
loading.value = true;
|
||||
const emptyPalletData = {
|
||||
palletCode: form.palletCode,
|
||||
operatorId: form.operatorId || 'SYSTEM'
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(emptyPalletData),
|
||||
url: "/receipt/ReceiptIn/SubmitEmptyPallet",
|
||||
success: (json) => {
|
||||
if (json.Code == 200) {
|
||||
Message.success('空托盘入库成功!');
|
||||
resetForm();
|
||||
} else {
|
||||
Message.error({
|
||||
content: json.Msg || '空托盘入库失败!',
|
||||
duration: 5000
|
||||
});
|
||||
}
|
||||
},
|
||||
error: (xhr, status, error) => {
|
||||
Message.error('提交失败:' + error);
|
||||
},
|
||||
complete: () => {
|
||||
loading.value = false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 重置表单
|
||||
const resetForm = () => {
|
||||
formRef.value.resetFields();
|
||||
orderOptions.value = [];
|
||||
processOptions.value = [];
|
||||
setTimeout(() => {
|
||||
if (palletCodeRef.value) {
|
||||
@@ -288,40 +319,9 @@
|
||||
}, 100);
|
||||
};
|
||||
|
||||
// 焦点跳转到下一个输入框
|
||||
const focusNext = (nextRef) => {
|
||||
const refMap = {
|
||||
materialCodeRef: materialCodeRef,
|
||||
quantityInput: quantityInput
|
||||
};
|
||||
|
||||
const nextElement = refMap[nextRef];
|
||||
if (nextElement?.value) {
|
||||
// 先让当前元素失去焦点
|
||||
if (document.activeElement) {
|
||||
document.activeElement.blur();
|
||||
}
|
||||
|
||||
// 使用 nextTick 确保 DOM 更新完成
|
||||
nextTick(() => {
|
||||
if (nextElement.value.$el) {
|
||||
// 处理 Input 组件
|
||||
const input = nextElement.value.$el.querySelector('input');
|
||||
if (input) {
|
||||
input.focus();
|
||||
}
|
||||
} else {
|
||||
// 处理基础组件
|
||||
nextElement.value.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 生命周期钩子
|
||||
onMounted(() => {
|
||||
loadOperators();
|
||||
loadOperatorInfo();
|
||||
// 页面加载时自动聚焦第一个输入框
|
||||
setTimeout(() => {
|
||||
if (palletCodeRef.value) {
|
||||
@@ -332,28 +332,26 @@
|
||||
|
||||
return {
|
||||
formRef,
|
||||
palletCodeRef,
|
||||
materialCodeRef,
|
||||
orderSelect,
|
||||
processSelect,
|
||||
operatorSelect,
|
||||
quantityInput,
|
||||
isQualifiedSwitch,
|
||||
form,
|
||||
loading,
|
||||
orderOptions,
|
||||
operatorOptions,
|
||||
processOptions,
|
||||
rules,
|
||||
scanPallet,
|
||||
scanMaterial,
|
||||
handleOrderChange,
|
||||
submitForm,
|
||||
submitEmptyPallet,
|
||||
resetForm,
|
||||
focusNext,
|
||||
materialOptions,
|
||||
handleMaterialSearch,
|
||||
handleMaterialSelect
|
||||
handleMaterialSelect,
|
||||
palletCodeRef,
|
||||
materialCodeRef,
|
||||
operatorIdRef,
|
||||
operatorInfoRef,
|
||||
focusNext,
|
||||
loadProcesses,
|
||||
loadProcessesByMaterial,
|
||||
processSelect
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user