|
@@ -37,20 +37,17 @@
|
|
|
>
|
|
|
<template #products>
|
|
|
<div style="width: 100%">
|
|
|
- <!-- <el-button
|
|
|
- type="primary"
|
|
|
- @click="clickAdd()"
|
|
|
- style="margin-bottom: 10px"
|
|
|
- v-if="modalType == 'add'"
|
|
|
- >
|
|
|
- 添加物品
|
|
|
- </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="waitQuantity" label="待出库数量" />
|
|
|
- <el-table-column prop="quantity" label="调仓数量" min-width="150">
|
|
|
+ <el-table-column
|
|
|
+ prop="quantity"
|
|
|
+ label="出库数量"
|
|
|
+ min-width="150"
|
|
|
+ v-if="submitType != 5"
|
|
|
+ >
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-form-item
|
|
|
:prop="'jdOrderDetailsList.' + $index + '.quantity'"
|
|
@@ -67,19 +64,19 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="inQuantity"
|
|
|
- label="接收数量"
|
|
|
+ prop="quantity"
|
|
|
+ label="调仓数量"
|
|
|
min-width="150"
|
|
|
- v-if="modalType == 'edit'"
|
|
|
+ v-if="submitType == 5"
|
|
|
>
|
|
|
<template #default="{ row, $index }">
|
|
|
<el-form-item
|
|
|
- :prop="'jdOrderDetailsList.' + $index + '.inQuantity'"
|
|
|
- :rules="rules.inQuantity"
|
|
|
+ :prop="'jdOrderDetailsList.' + $index + '.quantity'"
|
|
|
+ :rules="rules.quantity"
|
|
|
:inline-message="true"
|
|
|
>
|
|
|
<el-input-number
|
|
|
- v-model="row.inQuantity"
|
|
|
+ v-model="row.quantity"
|
|
|
:precision="2"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
@@ -87,19 +84,6 @@
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
- <el-table-column
|
|
|
- prop="zip"
|
|
|
- label="操作"
|
|
|
- width="100"
|
|
|
- v-if="modalType == 'add'"
|
|
|
- >
|
|
|
- <template #default="{ $index }">
|
|
|
- <el-button type="primary" link @click="handleRemove($index)"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -144,6 +128,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
import byTable from "@/components/byTable/index";
|
|
|
import byForm from "@/components/byForm/index";
|
|
|
import InventoryInquiry from "@/views/purchaseSales/outAndInWarehouse/inventoryInquiry/index";
|
|
|
+import { computed } from "vue";
|
|
|
|
|
|
const loading = ref(false);
|
|
|
const submitLoading = ref(false);
|
|
@@ -156,6 +141,9 @@ const sourceList = ref({
|
|
|
type: "2",
|
|
|
},
|
|
|
});
|
|
|
+const productUnit = ref([]);
|
|
|
+const warehouseList = ref([]);
|
|
|
+const logisticsData = ref([]);
|
|
|
let openProduct = ref(false);
|
|
|
let dialogVisible = ref(false);
|
|
|
let modalType = ref("add");
|
|
@@ -318,7 +306,7 @@ const businessType = [
|
|
|
{ label: "京东订单出库", value: "5" },
|
|
|
{ label: "采购退货出库", value: "4" },
|
|
|
];
|
|
|
-const configData = [
|
|
|
+const configData = computed(() => [
|
|
|
[
|
|
|
{
|
|
|
type: "title",
|
|
@@ -326,67 +314,54 @@ const configData = [
|
|
|
},
|
|
|
{
|
|
|
type: "select",
|
|
|
- prop: "businessType",
|
|
|
- label: "数据来源",
|
|
|
- required: true,
|
|
|
- disabled: true,
|
|
|
- itemWidth: 100,
|
|
|
- data: businessType,
|
|
|
+ prop: "warehouseId",
|
|
|
+ label: "仓库名称",
|
|
|
+ itemWidth: 30,
|
|
|
+ data: warehouseList.value,
|
|
|
},
|
|
|
{
|
|
|
- type: "input",
|
|
|
- prop: "businessCode",
|
|
|
- label: "单号",
|
|
|
+ type: "select",
|
|
|
+ prop: "businessType",
|
|
|
+ label: "出库类型",
|
|
|
required: true,
|
|
|
disabled: true,
|
|
|
- itemWidth: 100,
|
|
|
+ itemWidth: 30,
|
|
|
+ data: businessType,
|
|
|
},
|
|
|
+ // {
|
|
|
+ // type: "input",
|
|
|
+ // prop: "businessCode",
|
|
|
+ // label: "单号",
|
|
|
+ // required: true,
|
|
|
+ // disabled: true,
|
|
|
+ // itemWidth: 40,
|
|
|
+ // },
|
|
|
{
|
|
|
- type: "input",
|
|
|
- prop: "productName",
|
|
|
- label: "物品名称",
|
|
|
- required: true,
|
|
|
- disabled: true,
|
|
|
- itemWidth: 100,
|
|
|
+ type: "title",
|
|
|
+ title: "待出库明细",
|
|
|
},
|
|
|
{
|
|
|
- type: "input",
|
|
|
- prop: "waitQuantity",
|
|
|
- label: "待出库数量",
|
|
|
- required: true,
|
|
|
- disabled: true,
|
|
|
- itemWidth: 40,
|
|
|
+ type: "slot",
|
|
|
+ slotName: "products",
|
|
|
},
|
|
|
{
|
|
|
type: "title",
|
|
|
- title: "本次出库",
|
|
|
+ title: "物流信息",
|
|
|
},
|
|
|
{
|
|
|
type: "select",
|
|
|
- prop: "warehouseId",
|
|
|
- label: "仓库名称",
|
|
|
- itemWidth: 100,
|
|
|
- isLoad: {
|
|
|
- url: "/warehouse/page",
|
|
|
- req: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 9999,
|
|
|
- },
|
|
|
- labelKey: "name",
|
|
|
- labelVal: "id",
|
|
|
- method: "post",
|
|
|
- resUrl: "rows",
|
|
|
+ prop: "logisticsCompanyCode",
|
|
|
+ itemWidth: 50,
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
},
|
|
|
+ data: logisticsData.value,
|
|
|
},
|
|
|
{
|
|
|
- type: "number",
|
|
|
- prop: "quantity",
|
|
|
- label: "出库数量",
|
|
|
- disabled: false,
|
|
|
- itemWidth: 33,
|
|
|
- precision: 2,
|
|
|
- min: 1,
|
|
|
- controls: false,
|
|
|
+ type: "input",
|
|
|
+ prop: "logisticsCode",
|
|
|
+ placeholder: "物流/快递单号",
|
|
|
+ itemWidth: 50,
|
|
|
},
|
|
|
],
|
|
|
[
|
|
@@ -400,7 +375,7 @@ const configData = [
|
|
|
label: "调出仓库",
|
|
|
itemWidth: 33,
|
|
|
disabled: false,
|
|
|
- data: [],
|
|
|
+ data: warehouseList.value,
|
|
|
},
|
|
|
{
|
|
|
type: "select",
|
|
@@ -408,7 +383,14 @@ const configData = [
|
|
|
label: "调入仓库",
|
|
|
itemWidth: 33,
|
|
|
disabled: false,
|
|
|
- data: [],
|
|
|
+ data: warehouseList.value,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ label: "预约号",
|
|
|
+ prop: "reservationCode",
|
|
|
+ placeholder: "请输入",
|
|
|
+ itemWidth: 33,
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
@@ -425,8 +407,27 @@ const configData = [
|
|
|
type: "slot",
|
|
|
slotName: "products",
|
|
|
},
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
+ title: "物流信息",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ prop: "logisticsCompanyCode",
|
|
|
+ itemWidth: 50,
|
|
|
+ style: {
|
|
|
+ width: "100%",
|
|
|
+ },
|
|
|
+ data: logisticsData.value,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "logisticsCode",
|
|
|
+ placeholder: "物流/快递单号",
|
|
|
+ itemWidth: 50,
|
|
|
+ },
|
|
|
],
|
|
|
-];
|
|
|
+]);
|
|
|
const getList = async (req) => {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
loading.value = true;
|
|
@@ -458,9 +459,14 @@ const submitForm = () => {
|
|
|
id: formData.data.id,
|
|
|
businessType: formData.data.businessType,
|
|
|
warehouseId: formData.data.warehouseId,
|
|
|
- quantity: formData.data.quantity,
|
|
|
- waitQuantity: formData.data.waitQuantity,
|
|
|
};
|
|
|
+ if (
|
|
|
+ formData.data.jdOrderDetailsList &&
|
|
|
+ formData.data.jdOrderDetailsList.length > 0
|
|
|
+ ) {
|
|
|
+ data.quantity = formData.data.jdOrderDetailsList[0].quantity;
|
|
|
+ data.waitQuantity = formData.data.jdOrderDetailsList[0].waitQuantity;
|
|
|
+ }
|
|
|
if (!(data.quantity > 0)) {
|
|
|
return ElMessage({
|
|
|
message: "出库数量不能为0!",
|
|
@@ -486,71 +492,81 @@ const submitForm = () => {
|
|
|
},
|
|
|
(err) => (submitLoading.value = false)
|
|
|
);
|
|
|
- } else if (submitType.value == 5 || submitType.value == 6) {
|
|
|
- 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)
|
|
|
- );
|
|
|
- } else if (modalType.value === "edit") {
|
|
|
- const data = {
|
|
|
- id: formData.data.id,
|
|
|
- businessType: formData.data.businessType,
|
|
|
- warehouseId: formData.data.warehouseId,
|
|
|
- quantity: formData.data.quantity,
|
|
|
- waitQuantity: formData.data.waitQuantity,
|
|
|
- };
|
|
|
- if (!(data.quantity > 0)) {
|
|
|
+ } else if (submitType.value == 5) {
|
|
|
+ if (formData.data.inWarehouseId === formData.data.outWarehouseId) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "调出和调入仓库不可一致",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ 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!",
|
|
|
+ message: "调仓数量不能为0!",
|
|
|
type: "info",
|
|
|
});
|
|
|
}
|
|
|
- if (data.quantity > data.waitQuantity) {
|
|
|
+ if (e.quantity > e.waitQuantity) {
|
|
|
return ElMessage({
|
|
|
- message: "出库数量不能大于待出库数量!",
|
|
|
+ message: "调仓数量不能大于待出库数量!",
|
|
|
type: "info",
|
|
|
});
|
|
|
}
|
|
|
- submitLoading.value = true;
|
|
|
- proxy.post("/stockWaitDetails/add", data).then(
|
|
|
- (res) => {
|
|
|
- ElMessage({
|
|
|
- message: "操作成功",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- dialogVisible.value = false;
|
|
|
- submitLoading.value = false;
|
|
|
- getList();
|
|
|
- },
|
|
|
- (err) => (submitLoading.value = false)
|
|
|
- );
|
|
|
}
|
|
|
+ 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)
|
|
|
+ );
|
|
|
+ } else if (submitType.value == 6) {
|
|
|
+ const data = {
|
|
|
+ id: formData.data.id,
|
|
|
+ businessType: formData.data.businessType,
|
|
|
+ warehouseId: formData.data.warehouseId,
|
|
|
+ };
|
|
|
+
|
|
|
+ if (
|
|
|
+ formData.data.jdOrderDetailsList &&
|
|
|
+ formData.data.jdOrderDetailsList.length > 0
|
|
|
+ ) {
|
|
|
+ data.quantity = formData.data.jdOrderDetailsList[0].quantity;
|
|
|
+ data.waitQuantity = formData.data.jdOrderDetailsList[0].waitQuantity;
|
|
|
+ }
|
|
|
+ if (!(data.quantity > 0)) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "出库数量不能为0!",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (data.quantity > data.waitQuantity) {
|
|
|
+ return ElMessage({
|
|
|
+ message: "出库数量不能大于待出库数量!",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ submitLoading.value = true;
|
|
|
+ proxy.post("/stockWaitDetails/add", data).then(
|
|
|
+ (res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: "操作成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ dialogVisible.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => (submitLoading.value = false)
|
|
|
+ );
|
|
|
}
|
|
|
});
|
|
|
};
|
|
@@ -559,20 +575,26 @@ const outBound = (row) => {
|
|
|
submitType.value = row.businessType;
|
|
|
if (row.businessType == 4) {
|
|
|
modalType.value = "other";
|
|
|
- formConfig.value = configData[0];
|
|
|
+ formConfig.value = configData.value[0];
|
|
|
formData.data = {
|
|
|
id: row.id,
|
|
|
warehouseId: "",
|
|
|
businessType: row.businessType + "",
|
|
|
businessCode: row.businessCode,
|
|
|
- productName: row.productName,
|
|
|
- waitQuantity: row.quantity,
|
|
|
- quantity: undefined,
|
|
|
+ jdOrderDetailsList: [
|
|
|
+ {
|
|
|
+ waitQuantity: row.quantity,
|
|
|
+ quantity: undefined,
|
|
|
+ productCode: row.productCode,
|
|
|
+ productName: row.productName,
|
|
|
+ productSpec: row.productSpec,
|
|
|
+ },
|
|
|
+ ],
|
|
|
};
|
|
|
dialogVisible.value = true;
|
|
|
} else if (row.businessType == 5) {
|
|
|
modalType.value = "add";
|
|
|
- formConfig.value = configData[1];
|
|
|
+ formConfig.value = configData.value[1];
|
|
|
proxy.post("/jdOrder/detail", { id: row.businessId }).then((res) => {
|
|
|
formData.data = {
|
|
|
id: row.businessId,
|
|
@@ -592,23 +614,26 @@ const outBound = (row) => {
|
|
|
});
|
|
|
} else if (row.businessType == 6) {
|
|
|
modalType.value = "edit";
|
|
|
- formConfig.value = configData[0];
|
|
|
- proxy.post("/orderInfo/detail", { id: row.businessId }).then((res) => {
|
|
|
- formData.data = {
|
|
|
- id: row.id,
|
|
|
- warehouseId: "",
|
|
|
- businessType: row.businessType + "",
|
|
|
- businessCode: row.businessCode,
|
|
|
- productName: row.productName,
|
|
|
- waitQuantity: row.quantity,
|
|
|
- quantity: undefined,
|
|
|
- };
|
|
|
- dialogVisible.value = true;
|
|
|
- });
|
|
|
+ formConfig.value = configData.value[0];
|
|
|
+ formData.data = {
|
|
|
+ id: row.id,
|
|
|
+ warehouseId: "",
|
|
|
+ businessType: row.businessType + "",
|
|
|
+ businessCode: row.businessCode,
|
|
|
+ jdOrderDetailsList: [
|
|
|
+ {
|
|
|
+ waitQuantity: row.quantity,
|
|
|
+ quantity: undefined,
|
|
|
+ productCode: row.productCode,
|
|
|
+ productName: row.productName,
|
|
|
+ productSpec: row.productSpec,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ dialogVisible.value = true;
|
|
|
}
|
|
|
};
|
|
|
const warehouseType = ref([]);
|
|
|
-
|
|
|
const handleRemove = (index) => {
|
|
|
formData.data.jdOrderDetailsList.splice(index, 1);
|
|
|
return ElMessage({
|
|
@@ -617,64 +642,8 @@ const handleRemove = (index) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-const clickAdd = () => {
|
|
|
- if (formData.data.outWarehouseId) {
|
|
|
- openProduct.value = true;
|
|
|
- } else {
|
|
|
- ElMessage("请先选择仓库");
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-const select = (x) => {
|
|
|
- if (
|
|
|
- formData.data.jdOrderDetailsList &&
|
|
|
- formData.data.jdOrderDetailsList.length > 0
|
|
|
- ) {
|
|
|
- let data = formData.data.jdOrderDetailsList.filter(
|
|
|
- (row) => row.bussinessId === x.productId
|
|
|
- );
|
|
|
- if (data && data.length > 0) {
|
|
|
- return ElMessage("请勿重复添加");
|
|
|
- }
|
|
|
- }
|
|
|
- formData.data.jdOrderDetailsList.push({
|
|
|
- goodType: x.goodType,
|
|
|
- productCode: x.productCode,
|
|
|
- productName: x.productName,
|
|
|
- productSpec: x.productSpec,
|
|
|
- productUnit: x.productUnit,
|
|
|
- count: 0,
|
|
|
- price: 0,
|
|
|
- bussinessId: x.productId,
|
|
|
- amount: 0,
|
|
|
- });
|
|
|
- ElMessage({
|
|
|
- message: "添加成功!",
|
|
|
- type: "success",
|
|
|
- });
|
|
|
-};
|
|
|
-const warehouseList = ref([]);
|
|
|
-const warehouseListData = () => {
|
|
|
- proxy
|
|
|
- .post("/warehouse/page", {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 999,
|
|
|
- })
|
|
|
- .then((message) => {
|
|
|
- warehouseList.value = message.rows;
|
|
|
- configData[1][1].data = message.rows.map((x) => ({
|
|
|
- label: x.name,
|
|
|
- value: x.id,
|
|
|
- }));
|
|
|
- configData[1][2].data = message.rows.map((x) => ({
|
|
|
- label: x.name,
|
|
|
- value: x.id,
|
|
|
- }));
|
|
|
- });
|
|
|
-};
|
|
|
-warehouseListData();
|
|
|
getList();
|
|
|
-const productUnit = ref([]);
|
|
|
+
|
|
|
const getDict = () => {
|
|
|
proxy.getDictOne(["unit"]).then((res) => {
|
|
|
productUnit.value = res["unit"].map((x) => ({
|
|
@@ -682,6 +651,19 @@ const getDict = () => {
|
|
|
value: x.dictKey,
|
|
|
}));
|
|
|
});
|
|
|
+ proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
|
|
|
+ if (res.rows && res.rows.length > 0) {
|
|
|
+ warehouseList.value = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ label: item.name,
|
|
|
+ value: item.id,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ proxy.post("/companyInfo/list", { pageNum: 1, pageSize: 999 }).then((res) => {
|
|
|
+ logisticsData.value = res.reverse().slice(0, 100); //截取前100
|
|
|
+ });
|
|
|
};
|
|
|
getDict();
|
|
|
onMounted(() => {
|