|
@@ -24,8 +24,9 @@
|
|
|
<el-dialog
|
|
|
title="出库"
|
|
|
v-model="dialogVisible"
|
|
|
- width="500"
|
|
|
- v-loading="loading"
|
|
|
+ width="800"
|
|
|
+ v-loading="submitLoading"
|
|
|
+ destroy-on-close
|
|
|
>
|
|
|
<byForm
|
|
|
:formConfig="formConfig"
|
|
@@ -36,50 +37,28 @@
|
|
|
>
|
|
|
<template #products>
|
|
|
<div style="width: 100%">
|
|
|
- <el-button
|
|
|
+ <!-- <el-button
|
|
|
type="primary"
|
|
|
@click="clickAdd()"
|
|
|
style="margin-bottom: 10px"
|
|
|
v-if="modalType == 'add'"
|
|
|
>
|
|
|
添加物品
|
|
|
- </el-button>
|
|
|
- <el-table :data="formData.data.stockTransferDetailsList">
|
|
|
+ </el-button> -->
|
|
|
+ <el-table :data="formData.data.jdOrderDetailsList">
|
|
|
<el-table-column prop="productCode" label="物品编码" />
|
|
|
<el-table-column prop="productName" label="物品名称" />
|
|
|
<el-table-column prop="productSpec" label="规格型号" />
|
|
|
- <el-table-column
|
|
|
- prop="outQuantity"
|
|
|
- label="调仓数量"
|
|
|
- v-if="modalType == 'detail'"
|
|
|
- />
|
|
|
- <el-table-column
|
|
|
- prop="inQuantity"
|
|
|
- label="接收数量"
|
|
|
- v-if="modalType == 'detail'"
|
|
|
- />
|
|
|
-
|
|
|
- <el-table-column
|
|
|
- prop="outQuantity"
|
|
|
- label="调仓数量"
|
|
|
- v-if="modalType == 'edit'"
|
|
|
- />
|
|
|
- <el-table-column
|
|
|
- prop="outQuantity"
|
|
|
- label="调仓数量"
|
|
|
- min-width="150"
|
|
|
- v-if="modalType == 'add'"
|
|
|
- >
|
|
|
+ <el-table-column prop="waitQuantity" label="待出库数量" />
|
|
|
+ <el-table-column prop="quantity" label="调仓数量" min-width="150">
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-form-item
|
|
|
- :prop="
|
|
|
- 'stockTransferDetailsList.' + $index + '.outQuantity'
|
|
|
- "
|
|
|
- :rules="rules.outQuantity"
|
|
|
+ :prop="'jdOrderDetailsList.' + $index + '.quantity'"
|
|
|
+ :rules="rules.quantity"
|
|
|
:inline-message="true"
|
|
|
>
|
|
|
<el-input-number
|
|
|
- v-model="row.outQuantity"
|
|
|
+ v-model="row.quantity"
|
|
|
:precision="2"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
@@ -95,7 +74,7 @@
|
|
|
>
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-form-item
|
|
|
- :prop="'stockTransferDetailsList.' + $index + '.inQuantity'"
|
|
|
+ :prop="'jdOrderDetailsList.' + $index + '.inQuantity'"
|
|
|
:rules="rules.inQuantity"
|
|
|
:inline-message="true"
|
|
|
>
|
|
@@ -187,18 +166,24 @@ let rules = ref({
|
|
|
warehouseId: [
|
|
|
{ required: true, message: "请选择仓库名称", trigger: "change" },
|
|
|
],
|
|
|
- quantity: [{ required: true, message: "请输入入库数量", trigger: "blur" }],
|
|
|
+ outWarehouseId: [
|
|
|
+ { required: true, message: "请选择调出仓库", trigger: "change" },
|
|
|
+ ],
|
|
|
+ inWarehouseId: [
|
|
|
+ { required: true, message: "请选择调入仓库", trigger: "change" },
|
|
|
+ ],
|
|
|
+ quantity: [{ required: true, message: "请输入调仓数量", trigger: "blur" }],
|
|
|
});
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const selectConfig = reactive([
|
|
|
{
|
|
|
label: "数据来源",
|
|
|
- prop: "type",
|
|
|
+ prop: "businessType",
|
|
|
data: [],
|
|
|
},
|
|
|
{
|
|
|
label: "出库状态",
|
|
|
- prop: "type",
|
|
|
+ prop: "status",
|
|
|
data: [],
|
|
|
},
|
|
|
]);
|
|
@@ -282,7 +267,7 @@ const config = computed(() => {
|
|
|
prop: "status",
|
|
|
},
|
|
|
render(status) {
|
|
|
- return status == 0 ? "未出库" : status == 1 ? "部分出库" : "";
|
|
|
+ return status == 0 ? "未出库" : status == 1 ? "部分出库" : "入库完成";
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -294,18 +279,20 @@ const config = computed(() => {
|
|
|
// 渲染 el-button,一般用在最后一列。
|
|
|
renderHTML(row) {
|
|
|
return [
|
|
|
- {
|
|
|
- attrs: {
|
|
|
- label: "出库",
|
|
|
- type: "primary",
|
|
|
- text: true,
|
|
|
- disabled: row.status > 1,
|
|
|
- },
|
|
|
- el: "button",
|
|
|
- click() {
|
|
|
- outBound(row);
|
|
|
- },
|
|
|
- },
|
|
|
+ row.status < 2
|
|
|
+ ? {
|
|
|
+ attrs: {
|
|
|
+ label: "出库",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ disabled: row.status > 1,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {
|
|
|
+ outBound(row);
|
|
|
+ },
|
|
|
+ }
|
|
|
+ : {},
|
|
|
];
|
|
|
},
|
|
|
},
|
|
@@ -453,62 +440,66 @@ const openModal = () => {
|
|
|
|
|
|
const submitForm = () => {
|
|
|
byform.value.handleSubmit((valid) => {
|
|
|
- const list = formData.data.stockWaitDetailsList;
|
|
|
- const total = list.reduce((total, x) => (total += Number(x.quantity)), 0);
|
|
|
- if (!(total > 0)) {
|
|
|
- return ElMessage({
|
|
|
- message: `本次入库不能为0!`,
|
|
|
- type: "info",
|
|
|
- });
|
|
|
- }
|
|
|
- for (let i = 0; i < list.length; i++) {
|
|
|
- const e = list[i];
|
|
|
- if (Number(e.receiptQuantity) + e.quantity > Number(e.arrivalQuantity)) {
|
|
|
- return ElMessage({
|
|
|
- message: "本次入库加已入库数量不可大于发货数量!",
|
|
|
- type: "info",
|
|
|
- });
|
|
|
+ if (modalType.value === "add") {
|
|
|
+ const list = formData.data.jdOrderDetailsList;
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ const e = list[i];
|
|
|
+ if (!(e.quantity > 0)) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "调仓数量不能为0!",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (e.quantity > e.waitQuantity) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "调仓数量不能大于待出库数量!",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
+ submitLoading.value = true;
|
|
|
+ proxy.post("/jdOrder/outbound", formData.data).then(
|
|
|
+ (res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: "操作成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ dialogVisible.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => (submitLoading.value = false)
|
|
|
+ );
|
|
|
}
|
|
|
- submitLoading.value = true;
|
|
|
- proxy.post("/stockWait/addByWdly", formData.data).then(
|
|
|
- (res) => {
|
|
|
- ElMessage({
|
|
|
- message: "操作成功",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- dialogVisible.value = false;
|
|
|
- submitLoading.value = false;
|
|
|
- getList();
|
|
|
- },
|
|
|
- (err) => (submitLoading.value = false)
|
|
|
- );
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const outBound = (row) => {
|
|
|
- const index = row.$index;
|
|
|
- modalType.value = "add";
|
|
|
- if (index % 2 == 0) {
|
|
|
- formConfig.value = configData[0];
|
|
|
- } else {
|
|
|
+ if (row.businessType == 5) {
|
|
|
+ modalType.value = "add";
|
|
|
formConfig.value = configData[1];
|
|
|
+ proxy.post("/jdOrder/detail", { id: row.businessId }).then((res) => {
|
|
|
+ formData.data = {
|
|
|
+ id: row.businessId,
|
|
|
+ outWarehouseId: "",
|
|
|
+ inWarehouseId: "",
|
|
|
+ jdOrderDetailsList: res.jdOrderDetailsList.map((x) => ({
|
|
|
+ waitQuantity: row.quantity,
|
|
|
+ quantity: row.quantity,
|
|
|
+ productId: x.productId,
|
|
|
+ id: x.id,
|
|
|
+ productCode: x.productCode,
|
|
|
+ productName: x.productName,
|
|
|
+ productSpec: x.productSpec,
|
|
|
+ })),
|
|
|
+ };
|
|
|
+ dialogVisible.value = true;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ modalType.value = "edit";
|
|
|
+ formConfig.value = configData[0];
|
|
|
}
|
|
|
- // proxy.post("/stockWait/detailByWdly", { id: row.id }).then((res) => {
|
|
|
- // const json = JSON.parse(res.victoriatouristJson);
|
|
|
- // formData.data = {
|
|
|
- // type: "1",
|
|
|
- // businessType: res.businessType,
|
|
|
- // warehouseId: "",
|
|
|
- // code: json.code,
|
|
|
- // stockWaitDetailsList: res.stockWaitDetailsList.map((x) => ({
|
|
|
- // ...x,
|
|
|
- // arrivalQuantity: x.quantity,
|
|
|
- // quantity: 0,
|
|
|
- // })),
|
|
|
- // };
|
|
|
- // dialogVisible.value = true;
|
|
|
- // });
|
|
|
+
|
|
|
dialogVisible.value = true;
|
|
|
};
|
|
|
const warehouseType = ref([]);
|
|
@@ -519,7 +510,7 @@ const businessType = [
|
|
|
];
|
|
|
|
|
|
const handleRemove = (index) => {
|
|
|
- formData.data.stockTransferDetailsList.splice(index, 1);
|
|
|
+ formData.data.jdOrderDetailsList.splice(index, 1);
|
|
|
return ElMessage({
|
|
|
message: "删除成功",
|
|
|
type: "success",
|
|
@@ -536,17 +527,17 @@ const clickAdd = () => {
|
|
|
|
|
|
const select = (x) => {
|
|
|
if (
|
|
|
- formData.data.stockTransferDetailsList &&
|
|
|
- formData.data.stockTransferDetailsList.length > 0
|
|
|
+ formData.data.jdOrderDetailsList &&
|
|
|
+ formData.data.jdOrderDetailsList.length > 0
|
|
|
) {
|
|
|
- let data = formData.data.stockTransferDetailsList.filter(
|
|
|
+ let data = formData.data.jdOrderDetailsList.filter(
|
|
|
(row) => row.bussinessId === x.productId
|
|
|
);
|
|
|
if (data && data.length > 0) {
|
|
|
return ElMessage("请勿重复添加");
|
|
|
}
|
|
|
}
|
|
|
- formData.data.stockTransferDetailsList.push({
|
|
|
+ formData.data.jdOrderDetailsList.push({
|
|
|
goodType: x.goodType,
|
|
|
productCode: x.productCode,
|
|
|
productName: x.productName,
|