条码数量:{{ codeArray.length }}
+
条码数量:{{ codesNum }}
@@ -179,16 +171,16 @@
>
-
-
+
@@ -298,7 +290,8 @@ import {
deleteCountOrderDetail,
addCountOrderDetail
} from "@/api/inventory/invCountOrder";
-import {getCountCodesList, deleteCode} from "@/api/inventory/invCountCodes";
+import {getCountCodesList, deleteCode, addCode, getCodesNum} from "@/api/inventory/invCountCodes";
+import {enterCodeWeb} from "@/api/inout/order";
export default {
@@ -316,17 +309,15 @@ export default {
data() {
return {
formData: {
+ code: null,
orderId: null,
billDate: null,
- locStorageCode: null,
+ invStorageCode: null,
invWarehouseCode: null,
invSpaceCode: null
},
formRules: {
- billDate: [
- {required: true, message: "请选择单据日期", trigger: "blur"}
- ],
- locStorageCode: [
+ invStorageCode: [
{required: true, message: "请选择当前仓库", trigger: "blur"}
],
invWarehouseCode: [
@@ -357,43 +348,40 @@ export default {
scanText: "扫码录入:",
codesList: [],
detailQuery: {
- orderId: null,
+ orderIdFk: null,
page: 1,
limit: 10
},
- detailTotal: 0
+ detailTotal: 0,
+ countProductList: [],
+ codesNum: 0
};
},
methods: {
saveOrder(type) {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
- if (this.codeArray.length === 0) {
- this.$message.error("请选择盘点产品");
- return;
- }
-
let orderData = {
- invCountOrder: {
- createTime: this.formData.billDate,
- invStorageCode: this.formData.locStorageCode,
- invWarehouseCode: this.formData.invWarehouseCode,
- invSpaceCode: this.formData.invSpaceCode
- }
+ orderId: this.formData.orderId,
+ createTime: this.formData.billDate,
+ invStorageCode: this.formData.invStorageCode,
+ invWarehouseCode: this.formData.invWarehouseCode,
+ invSpaceCode: this.formData.invSpaceCode
};
saveCountOrder(orderData).then((res) => {
if (res.code === 20000) {
- this.formData.orderId = res.data;
+ this.formData.orderId = res.data.orderId;
+ this.formData.billDate = res.data.createTime;
this.$message.success("保存成功");
if (type != null) {
//保存当前单据详情
- let product = this.codeArray[0];
+ let product = this.countProductList[0];
let detailData = {
orderIdFk: this.formData.orderId,
- product: product.id,
+ productId: product.relIdFk,
batchNo: product.batchNo,
- produceDate: product.produceDate,
+ produceDate: product.productionDate,
expireDate: product.expireDate
};
addCountOrderDetail(detailData).then((result) => {
@@ -420,7 +408,10 @@ export default {
this.formData.invWarehouseCode = null;
this.formData.invSpaceCode = null;
//查询分库
- let params = {pcode: this.formData.locStorageCode}
+ this.getSubInvList();
+ },
+ getSubInvList() {
+ let params = {pcode: this.formData.invStorageCode}
filterSubByInv(params).then((res) => {
this.subInvList = res.data || [];
});
@@ -428,8 +419,11 @@ export default {
subStorageChange() {
this.formData.invSpaceCode = null;
//查询货位
+ this.getInvSpaceList();
+ },
+ getInvSpaceList() {
let params = {
- invStorageCode: this.formData.locStorageCode,
+ invStorageCode: this.formData.invStorageCode,
invWarehouseCode: this.formData.invWarehouseCode
};
getSpaceCodeList(params).then((res) => {
@@ -440,7 +434,7 @@ export default {
this.$forceUpdate();
},
selectProductFunction() {
- if (isBlank(this.formData.locStorageCode) || isBlank(this.formData.invWarehouseCode)) {
+ if (isBlank(this.formData.invStorageCode) || isBlank(this.formData.invWarehouseCode)) {
this.$message.warning("请先选择当前仓库货位信息");
return;
}
@@ -449,7 +443,7 @@ export default {
this.getInvProducts();
},
getInvProducts() {
- this.filterQuery.invStorageCode = this.formData.locStorageCode;
+ this.filterQuery.invStorageCode = this.formData.invStorageCode;
this.filterQuery.invWarehouseCode = this.formData.invWarehouseCode;
filterProducts(this.filterQuery).then((res) => {
if (res.code === 20000) {
@@ -463,7 +457,12 @@ export default {
if (res.code === 20000) {
this.storageList = res.data || [];
}
- })
+ });
+
+ if (this.countOrder.orderId != null) {
+ this.getSubInvList();
+ this.getInvSpaceList();
+ }
},
onReset() {
this.filterQuery = {
@@ -475,6 +474,7 @@ export default {
page: 1,
limit: 10
};
+ this.countProductList = [];
this.getInvProducts();
},
combine() {
@@ -483,7 +483,10 @@ export default {
this.$message.warning("请选择产品");
return;
}
- if (this.codeArray === 0) {
+ selection.forEach(product => {
+ this.countProductList.push(product);
+ })
+ if (this.codeArray.length === 0) {
//添加第一个产品,先保存单据,再添加单据详情
this.saveOrder(1);
}
@@ -500,7 +503,7 @@ export default {
if (res.code === 20000) {
this.$message.success("删除成功");
let detailParam = {
- orderId: this.formData.orderId
+ orderIdFk: this.formData.orderId
}
getCountOrderDetailList(detailParam).then((result) => {
this.codeArray = result.data.list || [];
@@ -513,9 +516,10 @@ export default {
},
showCodes(row) {
let params = {
- orderId: this.formData.orderId,
+ orderIdFk: this.formData.orderId,
productId: row.productId
};
+
getCountCodesList(params).then((res) => {
this.codesList = res.data.list || [];
});
@@ -523,28 +527,60 @@ export default {
getInputFocus(event) {
event.currentTarget.select();
},
+ enterKey(event) {
+ if (this.codeArray.length === 0) {
+ this.$message.error("请先录入盘点产品!");
+ return;
+ }
+ this.addCode();
+ },
getCountOrderDetail() {
- this.detailQuery.orderId = this.formData.orderId;
+ this.detailQuery.orderIdFk = this.formData.orderId;
getCountOrderDetailList(this.detailQuery).then((res) => {
if (res.code === 20000) {
this.codeArray = res.data.list || [];
this.detailTotal = res.data.total || 0;
}
})
- }
+ },
+ addCode() {
+ this.formData.code.trim();
+ let params = {
+ orderIdFk: this.formData.orderId,
+ code: this.formData.code
+ };
+ addCode(params).then((res) => {
+ if (res.code === 20000) {
+ this.getCountOrderCodesNum();
+ this.getCountOrderDetail();
+ }
+ })
+ },
+ getCountOrderCodesNum() {
+ if (isBlank(this.formData.orderId)) {
+ this.codesNum = 0;
+ } else {
+ let params = {orderIdFk: this.formData.orderId}
+ getCodesNum(params).then((res) => {
+ this.codesNum = res.data;
+ });
+ }
+ },
},
created() {
this.getStorage();
this.formData = this.countOrder;
+ this.formData.billDate = this.countOrder.createTime;
if (!isBlank(this.formData.orderId)) {
//拉取单据详情信息
- let params = {orderId: this.formData.orderId};
+ let params = {orderIdFk: this.formData.orderId};
getCountOrderDetailList(params).then((res) => {
if (res.code === 20000) {
- this.productList = res.data.list || [];
+ this.codeArray = res.data.list || [];
this.total = res.data.total || 0;
}
- })
+ });
+ this.getCountOrderCodesNum();
}
},
};
diff --git a/src/views/inventory/invCountOrderNew.vue b/src/views/inventory/invCountOrderNew.vue
index 0bcd391..881fe2b 100644
--- a/src/views/inventory/invCountOrderNew.vue
+++ b/src/views/inventory/invCountOrderNew.vue
@@ -107,7 +107,7 @@
>