添加客户管理
修改入库页面 修改 库存 物料 工序等页面
This commit is contained in:
1 parent
2435176f77
commit
c2b039ea47
41 files changed
+977
-160
No files matched your search
@@ -4,7 +4,9 @@
|
||||
<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" ref="palletCodeRef" placeholder="请扫描托盘码" @@change="scanPallet" @@keydown.enter="focusNext('materialCodeRef')" />
|
||||
<a-input v-model="form.palletCode" ref="palletCodeRef" placeholder="请扫描托盘码"
|
||||
|
||||
@@keyup.enter="validateContainer" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="物料码" field="materialCode">
|
||||
@@ -19,11 +21,15 @@
|
||||
</a-auto-complete>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="图号" field="name">
|
||||
<a-input v-model="form.name" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="当前工序" field="processId">
|
||||
<a-select v-model="form.processId" placeholder="请选择工序" @@change="processSelect">
|
||||
<a-option v-for="item in processOptions"
|
||||
:key="item.value"
|
||||
:value="item.value">
|
||||
:key="item.value"
|
||||
:value="item.value">
|
||||
{{ item.label }}
|
||||
</a-option>
|
||||
</a-select>
|
||||
@@ -32,6 +38,10 @@
|
||||
<a-form-item label="工序名称" field="processName" v-show="false">
|
||||
<a-input v-model="form.processName" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item field="qty" label="小托盘数量">
|
||||
<a-input-number v-model="form.qty" :min="0" style="width: 100%" ref="numInput" @@keydown.enter="focusNext('operatorIdRef')"/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="是否合格" field="isQualified">
|
||||
<a-switch v-model="form.isQualified" />
|
||||
@@ -69,12 +79,14 @@
|
||||
|
||||
const palletCodeRef = ref(null);
|
||||
const materialCodeRef = ref(null);
|
||||
const numInput = ref(null);
|
||||
const operatorIdRef = ref(null);
|
||||
const operatorInfoRef = ref(null);
|
||||
|
||||
const inputRefs = {
|
||||
palletCodeRef,
|
||||
materialCodeRef,
|
||||
numInput,
|
||||
operatorIdRef,
|
||||
operatorInfoRef
|
||||
};
|
||||
@@ -93,6 +105,8 @@
|
||||
operatorId: '',
|
||||
processId: '',
|
||||
processName:'',
|
||||
name:'',
|
||||
qty:null,
|
||||
isQualified: true,
|
||||
operatorInfo: ''
|
||||
});
|
||||
@@ -107,7 +121,9 @@
|
||||
materialCode: [
|
||||
{ required: true, message: '请输入物料码', trigger: ['change', 'blur'] }
|
||||
],
|
||||
|
||||
qty: [
|
||||
{ required: true, message: '请输入数量', trigger: ['change', 'blur'] }
|
||||
],
|
||||
processId: [
|
||||
{ required: true, message: '请选择工序', trigger: ['change', 'blur'] }
|
||||
],
|
||||
@@ -119,10 +135,29 @@
|
||||
{ required: true, message: '请输入检验员信息', trigger: ['change', 'blur'] }
|
||||
]
|
||||
};
|
||||
|
||||
const validateContainer = (value) => {
|
||||
if (!form.palletCode) return;
|
||||
|
||||
axios.get(`/receipt/SimpleReceiptIn/ValidateContainer?containerCode=${encodeURIComponent(form.palletCode)}`)
|
||||
.then((json) => {
|
||||
if (json.data.Code == 200) {
|
||||
Message.success("容器验证成功");
|
||||
focusNext('materialCodeRef')
|
||||
} else {
|
||||
Message.error(json.data.Msg || "容器验证失败");
|
||||
resetForm();
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
Message.error("容器验证失败");
|
||||
resetForm()
|
||||
});
|
||||
};
|
||||
|
||||
const processSelect = (value) => {
|
||||
form.processName = processOptions.value.find(item => item.value === value).processName;
|
||||
focusNext('operatorIdRef');
|
||||
focusNext('numInput');
|
||||
}
|
||||
|
||||
// 加载工序列表
|
||||
@@ -147,10 +182,11 @@
|
||||
// 根据物料加载工序列表
|
||||
const loadProcessesByMaterial = (materialCode) => {
|
||||
if (!materialCode) {
|
||||
form.processId = '';
|
||||
processOptions.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
processOptions.value = [];
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
@@ -158,7 +194,15 @@
|
||||
url: "/receipt/ReceiptIn/GetProcessesByMaterial",
|
||||
success: (json) => {
|
||||
if (json.Code == 200) {
|
||||
processOptions.value = json.Data;
|
||||
|
||||
const newOptions = json.Data.map(item => ({
|
||||
...item,
|
||||
value: item.value,
|
||||
label: `${item.processCode} - ${item.processName}`
|
||||
}));
|
||||
// 使用新数组赋值,强制组件重新渲染
|
||||
processOptions.value = [...newOptions];
|
||||
|
||||
} else {
|
||||
Message.error(json.Msg || '加载物料工序失败');
|
||||
processOptions.value = [];
|
||||
@@ -192,30 +236,25 @@
|
||||
};
|
||||
|
||||
// 搜索物料
|
||||
|
||||
const searchMaterials = (keyword) => {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: { keyword: keyword },
|
||||
url: "/receipt/ReceiptIn/SearchMaterials",
|
||||
success: (json) => {
|
||||
console.log(json);
|
||||
if (json.Code == 200) {
|
||||
materialOptions.value = json.Data.map(item => ({
|
||||
axios.get(`/receipt/SimpleReceiptIn/SearchMaterials?keyword=${encodeURIComponent(keyword)}`)
|
||||
.then(function (json) {
|
||||
if (json.data.Code == 200) {
|
||||
materialOptions.value = json.data.Data.map(item => ({
|
||||
...item,
|
||||
value: item.MaterialCode,
|
||||
label: `${item.MaterialCode} - ${item.MaterialName}`
|
||||
}));console.log(materialOptions.value)
|
||||
label: `${item.MaterialCode} - ${item.MaterialType} - ${item.MaterialName}`
|
||||
}));
|
||||
} else {
|
||||
Message.error(json.Msg || '搜索失败');
|
||||
Message.error(json.data.Msg);
|
||||
materialOptions.value = [];
|
||||
}
|
||||
},
|
||||
error: (xhr, status, error) => {
|
||||
Message.error('搜索失败:' + error);
|
||||
})
|
||||
.catch(function (error) {
|
||||
Message.error(error);
|
||||
materialOptions.value = [];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// 处理物料选择
|
||||
@@ -223,8 +262,19 @@
|
||||
const selectedMaterial = materialOptions.value.find(item => item.value === value);
|
||||
if (selectedMaterial) {
|
||||
form.materialCode = selectedMaterial.MaterialCode;
|
||||
form.name = selectedMaterial.MaterialType;
|
||||
// 选择物料后加载相关工序
|
||||
loadProcessesByMaterial(selectedMaterial.MaterialCode);
|
||||
// 先清空当前工序选择,避免显示旧数据
|
||||
form.processId = '';
|
||||
form.processName = '';
|
||||
|
||||
// 清除现有工序选项,触发重新渲染
|
||||
processOptions.value = [];
|
||||
|
||||
// 延迟加载新工序,确保先清空再加载
|
||||
nextTick(() => {
|
||||
loadProcessesByMaterial(selectedMaterial.MaterialCode);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -337,6 +387,7 @@
|
||||
processOptions,
|
||||
rules,
|
||||
scanPallet,
|
||||
validateContainer,
|
||||
scanMaterial,
|
||||
submitForm,
|
||||
submitEmptyPallet,
|
||||
@@ -346,6 +397,7 @@
|
||||
handleMaterialSelect,
|
||||
palletCodeRef,
|
||||
materialCodeRef,
|
||||
numInput,
|
||||
operatorIdRef,
|
||||
operatorInfoRef,
|
||||
focusNext,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<div id="receiptin">
|
||||
<a-space direction="vertical" fill>
|
||||
<a-form :model="formData" layout="horizontal" :label-col="{ style: { width: '100px' } }" :wrapper-col="{ style: { width: '220px' } }">
|
||||
<a-form-item field="containerCode" label="容器编码">
|
||||
<a-form-item field="containerCode" label="托盘号">
|
||||
<a-input
|
||||
v-model="ContainerCode"
|
||||
placeholder="扫描箱号"
|
||||
placeholder="扫描托盘号"
|
||||
allow-clear
|
||||
@@keyup.enter="validateContainer"
|
||||
ref="containerInput"/>
|
||||
@@ -15,21 +15,33 @@
|
||||
:data="materialOptions"
|
||||
@@search="handleSearch"
|
||||
@@select="handleSelect"
|
||||
placeholder="输入物料编码或名称"
|
||||
placeholder="输入物料编码或图号"
|
||||
ref="materialInput">
|
||||
</a-auto-complete>
|
||||
</a-form-item>
|
||||
<a-form-item field="materialName" label="物料名称">
|
||||
<a-input v-model="MaterialName" disabled/>
|
||||
<a-form-item field="materialName" label="图号">
|
||||
<a-input v-model="MaterialName"/>
|
||||
</a-form-item>
|
||||
<a-form-item field="materialSpec" label="物料型号">
|
||||
<a-input v-model="MaterialSpec" disabled/>
|
||||
@* <a-form-item field="materialSpec" label="物料型号"> *@
|
||||
@* <a-input v-model="MaterialSpec" disabled/> *@
|
||||
@* </a-form-item> *@
|
||||
<a-form-item field="sourceCode" label="订单号">
|
||||
<a-input v-model="SourceCode" placeholder="输入订单号" ref="sourceCodeInput" @@keydown.enter="this.$nextTick(() => {
|
||||
this.$refs.companyCodeInput.focus();
|
||||
});"/>
|
||||
</a-form-item>
|
||||
<a-form-item field="company" label="公司">
|
||||
<a-input v-model="Company" placeholder="输入公司"/>
|
||||
<a-form-item field="companyCode" label="公司">
|
||||
<a-auto-complete
|
||||
v-model="CompanyCode"
|
||||
:data="companyOptions"
|
||||
@@search="handleCompanySearch"
|
||||
@@select="handleCompanySelect"
|
||||
placeholder="输入公司名称或编码"
|
||||
ref="companyCodeInput">
|
||||
</a-auto-complete>
|
||||
</a-form-item>
|
||||
<a-form-item field="qty" label="数量">
|
||||
<a-input-number v-model="Qty" :min="0" style="width: 100%"/>
|
||||
<a-input-number v-model="Qty" :min="0" style="width: 100%" ref="numInput" @@keydown.enter="this.handleBind()"/>
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
@@ -46,7 +58,7 @@
|
||||
<a-space>
|
||||
<a-button type="text" status="danger" @@click="handleDelete(record)">删除</a-button>
|
||||
<a-button type="text" @@click="handleEdit(record)">修改</a-button>
|
||||
@* <a-button type="text" @@click="handleDeduct(record)">扣料</a-button> *@
|
||||
<a-button type="text" @@click="handleDeduct(record)">扣料</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #qty="{ record }">
|
||||
@@ -77,6 +89,7 @@
|
||||
<a-radio-group v-model="outForm.level">
|
||||
<a-radio value="high">高货位</a-radio>
|
||||
<a-radio value="low">低货位</a-radio>
|
||||
<a-radio value="mid">模具库</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<a-form-item label="出库口">
|
||||
@@ -98,7 +111,8 @@
|
||||
MaterialCode: '',
|
||||
MaterialName: '',
|
||||
MaterialSpec: '',
|
||||
Company: '',
|
||||
SourceCode: '',
|
||||
CompanyCode: '',
|
||||
Qty: null,
|
||||
loading1: false,
|
||||
materialOptions: [],
|
||||
@@ -150,9 +164,13 @@
|
||||
title: '物料型号',
|
||||
dataIndex: 'MaterialSpec',
|
||||
},
|
||||
{
|
||||
title: '订单号',
|
||||
dataIndex: 'SourceCode',
|
||||
},
|
||||
{
|
||||
title: '公司',
|
||||
dataIndex: 'Company',
|
||||
dataIndex: 'CompanyCode',
|
||||
},
|
||||
{
|
||||
title: '数量',
|
||||
@@ -169,10 +187,13 @@
|
||||
containerCode: '',
|
||||
materialCode: '',
|
||||
materialName: '',
|
||||
materialSpec: '',
|
||||
company: '',
|
||||
materialSpec: '',
|
||||
sourceCode: '',
|
||||
companyCode: '',
|
||||
qty: 1
|
||||
}
|
||||
},
|
||||
companyOptions: [],
|
||||
companySearchTimer: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -203,7 +224,7 @@
|
||||
_this.materialOptions = json.data.Data.map(item => ({
|
||||
...item,
|
||||
value: item.MaterialCode,
|
||||
label: `${item.MaterialCode} - ${item.MaterialName} - ${item.MaterialSpec}`
|
||||
label: `${item.MaterialCode} - ${item.MaterialType} - ${item.MaterialName}`
|
||||
}));
|
||||
} else {
|
||||
_this.$message.error(json.data.Msg);
|
||||
@@ -220,9 +241,13 @@
|
||||
const selectedMaterial = this.materialOptions.find(item => item.value === value);
|
||||
if (selectedMaterial) {
|
||||
this.MaterialCode = selectedMaterial.MaterialCode;
|
||||
this.MaterialName = selectedMaterial.MaterialName;
|
||||
this.MaterialName = selectedMaterial.MaterialType;
|
||||
this.MaterialSpec = selectedMaterial.MaterialSpec;
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$refs.sourceCodeInput.focus();
|
||||
});
|
||||
},
|
||||
|
||||
handleBind() {
|
||||
@@ -254,7 +279,8 @@
|
||||
MaterialCode: this.MaterialCode,
|
||||
MaterialName: this.MaterialName,
|
||||
MaterialSpec: this.MaterialSpec,
|
||||
Company: this.Company,
|
||||
SourceCode: this.SourceCode,
|
||||
CompanyCode: this.CompanyCode,
|
||||
Qty: this.Qty
|
||||
};
|
||||
|
||||
@@ -262,7 +288,8 @@
|
||||
let postData = new URLSearchParams();
|
||||
postData.append('containerCode', this.ContainerCode);
|
||||
postData.append('materialCode', this.MaterialCode);
|
||||
postData.append('company', this.Company);
|
||||
postData.append('company', this.CompanyCode);
|
||||
postData.append('sourceCode', this.SourceCode);
|
||||
postData.append('qty', this.Qty);
|
||||
|
||||
axios.post("/receipt/SimpleReceiptIn/AddInventory", postData)
|
||||
@@ -276,7 +303,8 @@
|
||||
this.MaterialCode = '';
|
||||
this.MaterialName = '';
|
||||
this.MaterialSpec = '';
|
||||
this.Company = '';
|
||||
this.SourceCode = '';
|
||||
this.CompanyCode = '';
|
||||
this.Qty = null;
|
||||
// 验证成功后,将焦点设置到物料编码输入框
|
||||
this.$nextTick(() => {
|
||||
@@ -309,7 +337,8 @@
|
||||
this.MaterialCode = '';
|
||||
this.MaterialName = '';
|
||||
this.MaterialSpec = '';
|
||||
this.Company = '';
|
||||
this.SourceCode = '';
|
||||
this.CompanyCode = '';
|
||||
this.Qty = 1;
|
||||
this.bindList = [];
|
||||
this.$notification.success("入库任务创建成功!");
|
||||
@@ -498,7 +527,7 @@
|
||||
this.MaterialCode = '';
|
||||
this.MaterialName = '';
|
||||
this.MaterialSpec = '';
|
||||
this.Company = '';
|
||||
this.CompanyCode = '';
|
||||
this.Qty = 1;
|
||||
this.bindList = [];
|
||||
this.$notification.success("空托入库成功!");
|
||||
@@ -546,8 +575,9 @@
|
||||
this.MaterialCode = '';
|
||||
this.MaterialName = '';
|
||||
this.MaterialSpec = '';
|
||||
this.Company = '';
|
||||
this.Qty = 1;
|
||||
this.SourceCode = '';
|
||||
this.CompanyCode = '';
|
||||
this.Qty = '';
|
||||
this.bindList = [];
|
||||
this.outModalVisible = false;
|
||||
this.$notification.success("呼叫出库成功!");
|
||||
@@ -570,6 +600,47 @@
|
||||
},
|
||||
handleOutCancel() {
|
||||
this.outModalVisible = false;
|
||||
},
|
||||
handleCompanySearch(value) {
|
||||
if (this.companySearchTimer) {
|
||||
clearTimeout(this.companySearchTimer);
|
||||
}
|
||||
this.companySearchTimer = setTimeout(() => {
|
||||
if (value) {
|
||||
this.searchCompanies(value);
|
||||
} else {
|
||||
this.companyOptions = [];
|
||||
}
|
||||
}, 300);
|
||||
},
|
||||
searchCompanies(keyword) {
|
||||
var _this = this;
|
||||
axios.get(`/receipt/SimpleReceiptIn/SearchCompanies?keyword=${encodeURIComponent(keyword)}`)
|
||||
.then(function (json) {
|
||||
if (json.data.Code == 200) {
|
||||
_this.companyOptions = json.data.Data.map(item => ({
|
||||
...item,
|
||||
value: item.CompanyName,
|
||||
label: `${item.CompanyCode} - ${item.CompanyName}`
|
||||
}));
|
||||
} else {
|
||||
_this.$message.error(json.data.Msg);
|
||||
_this.companyOptions = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
_this.$message.error(error);
|
||||
_this.companyOptions = [];
|
||||
});
|
||||
},
|
||||
handleCompanySelect(value, option) {
|
||||
const selectedCompany = this.companyOptions.find(item => item.value === value);
|
||||
if (selectedCompany) {
|
||||
this.CompanyCode = selectedCompany.CompanyName;
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.numInput.focus();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user