feat: 接入ERP成品发货出库流程
This commit is contained in:
1 parent
66a1f60428
commit
7c2722c88d
25 files changed
+2547
-22
No files matched your search
@@ -72,13 +72,20 @@
|
||||
<a-button @@click="handleClick" :loading="loading1" type="primary">入库</a-button>
|
||||
<a-button @@click="emptyIn" :loading="loading1" type="success">空托入库</a-button>
|
||||
<a-button @@click="outClick" :loading="loading1" type="primary">呼叫出库</a-button>
|
||||
<a-button v-if="isShipment" @@click="confirmShipment" :loading="shipmentLoading"
|
||||
type="primary" status="success">确认发货</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<a-table :data="bindList" :columns="columns" :pagination="false">
|
||||
<a-alert v-if="isShipment" type="warning">
|
||||
当前托盘来自ERP发货任务。请逐条填写实际出库数量(可以为0),确认后系统一次完成库存扣减、释放分配并回传ERP。
|
||||
</a-alert>
|
||||
|
||||
<a-table :data="bindList" :columns="displayColumns" :pagination="false"
|
||||
:row-key="record => isShipment ? record.TaskDetailId : record.Id">
|
||||
<template #operations="{ record }">
|
||||
<a-space>
|
||||
<a-space v-if="!isShipment">
|
||||
<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>
|
||||
@@ -87,6 +94,10 @@
|
||||
<template #qty="{ record }">
|
||||
{{ Math.floor(record.Qty) }}
|
||||
</template>
|
||||
<template #actualQty="{ record }">
|
||||
<a-input-number v-if="isShipment" v-model="record.ActualQty" :min="0"
|
||||
:precision="4" style="width: 130px" />
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<a-modal v-model:visible="editModalVisible" title="修改数量" @@ok="handleEditConfirm" @@cancel="handleEditCancel">
|
||||
@@ -131,6 +142,8 @@
|
||||
data() {
|
||||
return {
|
||||
loading1: false,
|
||||
shipmentLoading: false,
|
||||
isShipment: false,
|
||||
materialOptions: [],
|
||||
orderOptions: [],
|
||||
searchTimer: null,
|
||||
@@ -197,10 +210,41 @@
|
||||
dataIndex: 'CompanyCode',
|
||||
},
|
||||
{
|
||||
title: '数量',
|
||||
title: 'ERP发货单',
|
||||
dataIndex: 'ShipmentCode',
|
||||
shipmentOnly: true,
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '需求数量',
|
||||
dataIndex: 'RequiredQty',
|
||||
shipmentOnly: true,
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '已出库',
|
||||
dataIndex: 'CompletedQty',
|
||||
shipmentOnly: true,
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '本托分配',
|
||||
dataIndex: 'AllocatedQty',
|
||||
shipmentOnly: true,
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '当前库存',
|
||||
dataIndex: 'Qty',
|
||||
slotName: 'Qty'
|
||||
},
|
||||
{
|
||||
title: '实际出库',
|
||||
dataIndex: 'ActualQty',
|
||||
slotName: 'actualQty',
|
||||
shipmentOnly: true,
|
||||
width: 150
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
slotName: 'operations',
|
||||
@@ -232,6 +276,9 @@
|
||||
this.history.batch = JSON.parse(localStorage.getItem('batchHistory') || '[]');
|
||||
},
|
||||
computed: {
|
||||
displayColumns() {
|
||||
return this.columns.filter(column => !column.shipmentOnly || this.isShipment);
|
||||
},
|
||||
// 部件名称提示列表
|
||||
batchTips() {
|
||||
return this.getFilteredTips('batch', this.formData.batch);
|
||||
@@ -465,6 +512,10 @@
|
||||
},
|
||||
|
||||
handleClick() {
|
||||
if (this.isShipment) {
|
||||
this.$notification.error('请先确认当前ERP发货,确认后才能将余料回库!');
|
||||
return;
|
||||
}
|
||||
if (!this.formData.containerCode) {
|
||||
this.$notification.error('请扫描箱号!');
|
||||
return;
|
||||
@@ -510,6 +561,7 @@
|
||||
const json = response.data;
|
||||
if (json.Code == 200) {
|
||||
this.$message.success("容器验证成功");
|
||||
this.isShipment = json.IsShipment === true;
|
||||
// 更新绑定列表
|
||||
this.bindList = json.Data;
|
||||
// 验证成功后,将焦点设置到物料编码输入框
|
||||
@@ -520,6 +572,7 @@
|
||||
this.$message.error(json.Msg || "容器验证失败");
|
||||
this.formData.containerCode = '';
|
||||
this.bindList = [];
|
||||
this.isShipment = false;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -527,9 +580,48 @@
|
||||
this.$message.error("容器验证失败: " + (error.message || '网络错误'));
|
||||
this.formData.containerCode = '';
|
||||
this.bindList = [];
|
||||
this.isShipment = false;
|
||||
});
|
||||
},
|
||||
|
||||
confirmShipment() {
|
||||
if (!this.isShipment || !this.formData.containerCode) {
|
||||
this.$notification.error('当前没有待确认的ERP发货托盘!');
|
||||
return;
|
||||
}
|
||||
if (this.bindList.some(item => item.ActualQty === null || item.ActualQty === undefined || Number(item.ActualQty) < 0)) {
|
||||
this.$notification.error('请填写全部实际出库数量,数量可以为0但不能小于0!');
|
||||
return;
|
||||
}
|
||||
|
||||
this.shipmentLoading = true;
|
||||
axios.post('/receipt/SimpleReceiptIn/ConfirmShipment', {
|
||||
ContainerCode: this.formData.containerCode,
|
||||
Rows: this.bindList.map(item => ({
|
||||
TaskDetailId: item.TaskDetailId,
|
||||
ActualQty: Number(item.ActualQty)
|
||||
}))
|
||||
}).then(response => {
|
||||
const json = response.data;
|
||||
if (Number(json.Code) === 200) {
|
||||
const message = json.Data?.Message || '发货确认完成';
|
||||
if (json.Data?.ErpSuccess === false) {
|
||||
this.$notification.warning({ content: message, duration: 8000, closable: true });
|
||||
} else {
|
||||
this.$notification.success(message);
|
||||
}
|
||||
this.isShipment = false;
|
||||
this.validateContainer();
|
||||
} else {
|
||||
this.$notification.error({ content: json.Msg || '确认发货失败', duration: 8000, closable: true });
|
||||
}
|
||||
}).catch(error => {
|
||||
this.$notification.error({ content: error.message || '确认发货失败', duration: 8000, closable: true });
|
||||
}).finally(() => {
|
||||
this.shipmentLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
handleDelete(record) {
|
||||
if (!record || !record.Id) {
|
||||
this.$message.error("无效的记录");
|
||||
|
||||
Reference in new issue
Block a user