diff --git a/src/api/inventory/InvProducts.js b/src/api/inventory/InvProducts.js index 34edd17..f946570 100644 --- a/src/api/inventory/InvProducts.js +++ b/src/api/inventory/InvProducts.js @@ -50,3 +50,11 @@ export function checkCodeSpace(data) { data: data }); } + +export function getCountInvProductProduct(params) { + return axios({ + url: "spms/inv/products/getCountInvProductProduct", + method: "get", + params: params + }) +} diff --git a/src/views/inventory/addCountOrder.vue b/src/views/inventory/addCountOrder.vue index ce713f5..a4093fd 100644 --- a/src/views/inventory/addCountOrder.vue +++ b/src/views/inventory/addCountOrder.vue @@ -1,20 +1,33 @@ <template> <div> - <el-form :model="formData" :rules="formRules" ref="dataForm"> + <el-form :model="formData" ref="dataForm"> <el-button-group style="display: flex;margin: -50px 0 10px 80%; height: 35px"> + <el-button + v-if="countType != 2" + type="primary" + :disabled="this.codeArray.length > 0" + @click.native="startCount()" + >开始盘点 + </el-button> + <el-button + v-if="countType == 2" + type="primary" + :disabled="this.codeArray.length > 0" + @click.native="saveOrder()" + >录入产品 + </el-button> <el-button type="primary" @click.native="saveOrder()" >保存 - </el-button - > + </el-button> </el-button-group> <el-row :gutter="20" style="margin-top: 20px;"> <el-col :span="3"> <div class="ao-text"> - <span>单据号:</span> + <span>盘点单号:</span> </div> </el-col> <el-col :span="7"> @@ -24,7 +37,7 @@ </el-col> <el-col :span="3"> <div class="ao-text"> - <span>单据日期:</span> + <span>盘点日期:</span> </div> </el-col> <el-col :span="7"> @@ -37,13 +50,13 @@ <el-row :gutter="20" style="margin-top: 0px"> <el-col :span="3"> <div class="ao-text"> - <span>当前仓库:</span> + <span>盘点仓库:</span> </div> </el-col> <el-col :span="7"> <el-form-item prop="invStorageCode"> - <el-select v-model="formData.invStorageCode" placeholder="当前仓库信息" + <el-select v-model="formData.invStorageCode" placeholder="盘点仓库信息" @change="locInChange" :disabled="codeArray.length>0" clearable> @@ -60,13 +73,13 @@ <el-col :span="3"> <div class="ao-text"> - <span>当前分库:</span> + <span>盘点分库:</span> </div> </el-col> <el-col :span="7"> <el-form-item prop="invWarehouseCode"> - <el-select v-model="formData.invWarehouseCode" placeholder="当前分库信息" + <el-select v-model="formData.invWarehouseCode" placeholder="盘点分库信息" :disabled="codeArray.length>0" @change="subStorageChange" clearable> @@ -85,13 +98,13 @@ <el-row :gutter="20"> <el-col :span="3"> <div class="ao-text"> - <span>当前货位:</span> + <span>盘点货位:</span> </div> </el-col> <el-col :span="7"> <el-form-item class="query-form-item" prop="invSpaceCode" > - <el-select v-model="formData.invSpaceCode" placeholder="当前货位信息" + <el-select v-model="formData.invSpaceCode" placeholder="盘点货位信息" :disabled="codeArray.length>0" @change="invSpaceChange" clearable> @@ -139,13 +152,6 @@ >添加 </el-button > - <el-button - type="primary" - size="small" - @click.native.stop="selectProductFunction()" - >产品录入 - </el-button - > </el-button-group> </el-col> @@ -298,7 +304,7 @@ import {filterSubByInv} from "@/api/basic/invSubWarehouse"; import {isBlank} from "@/utils/strUtil"; import {filterAllByUser} from "@/api/basic/invWarehouse"; import {getSpaceCodeList} from "@/api/inventory/invSpace"; -import {filterProducts} from "@/api/inventory/InvProducts"; +import {filterProducts, getCountInvProductProduct} from "@/api/inventory/InvProducts"; import { saveCountOrder, getCountOrderDetailList, @@ -319,6 +325,10 @@ export default { countOrder: { type: Object, required: true, + }, + countType: { + type: Number, + required: true } }, data() { @@ -329,18 +339,8 @@ export default { billDate: null, invStorageCode: null, invWarehouseCode: null, - invSpaceCode: null - }, - formRules: { - invStorageCode: [ - {required: true, message: "请选择当前仓库", trigger: "blur"} - ], - invWarehouseCode: [ - {required: true, message: "请选择当前分库", trigger: "blur"} - ], - invSpaceCode: [ - {required: true, message: "请选择当前货位", trigger: "blur"} - ] + invSpaceCode: null, + countType: this.countType }, codeArray: [], total: 0, @@ -375,51 +375,48 @@ export default { orderIdFk: null, edit: true }, - codesVisible: false + codesVisible: false, }; }, methods: { saveOrder(type) { - this.$refs['dataForm'].validate((valid) => { - if (valid) { - let orderData = { - orderId: this.formData.orderId, - createTime: this.formData.billDate, - invStorageCode: this.formData.invStorageCode, - invWarehouseCode: this.formData.invWarehouseCode, - invSpaceCode: this.formData.invSpaceCode - }; + let orderData = { + orderId: this.formData.orderId, + createTime: this.formData.billDate, + invStorageCode: this.formData.invStorageCode, + invWarehouseCode: this.formData.invWarehouseCode, + invSpaceCode: this.formData.invSpaceCode, + countType: this.countType + }; - saveCountOrder(orderData).then((res) => { - if (res.code === 20000) { - this.formData.orderId = res.data.orderId; - this.formData.billDate = res.data.createTime; - this.$message.success("保存成功"); - if (type != null) { - //保存当前单据详情 - let product = this.countProductList[0]; - let detailData = { - orderIdFk: this.formData.orderId, - productId: product.relIdFk, - nameCode: product.nameCode, - batchNo: product.batchNo, - produceDate: product.productionDate, - expireDate: product.expireDate - }; - addCountOrderDetail(detailData).then((result) => { - if (result.code === 20000) { - this.getCountOrderDetail(); - } - }); - } else { - this.closeDialog(); + saveCountOrder(orderData).then((res) => { + if (res.code === 20000) { + this.formData.orderId = res.data.orderId; + this.formData.billDate = res.data.createTime; + this.$message.success("保存成功"); + if (type != null) { + //保存当前单据详情 + let product = this.countProductList[0]; + let detailData = { + orderIdFk: this.formData.orderId, + productId: product.relIdFk, + nameCode: product.nameCode, + batchNo: product.batchNo, + produceDate: product.productionDate, + expireDate: product.expireDate + }; + addCountOrderDetail(detailData).then((result) => { + if (result.code === 20000) { + this.getCountOrderDetail(); } - } else { - this.$message.error(res.data.message); - } - }); + }); + } else { + this.closeDialog(); + } + } else { + this.$message.error(res.data.message); } - }) + }); }, // 刷新表单 handleCurrentChange(val) { @@ -455,15 +452,6 @@ export default { invSpaceChange() { this.$forceUpdate(); }, - selectProductFunction() { - if (isBlank(this.formData.invStorageCode) || isBlank(this.formData.invWarehouseCode)) { - this.$message.warning("请先选择当前仓库货位信息"); - return; - } - this.selectInvProductVisible = true; - this.onReset(); - this.getInvProducts(); - }, getInvProducts() { this.filterQuery.invStorageCode = this.formData.invStorageCode; this.filterQuery.invWarehouseCode = this.formData.invWarehouseCode; @@ -541,7 +529,7 @@ export default { showCodes(row) { this.codesVisible = true; this.codeQuery = { - orderIdFk: this.formData.orderId, + orderIdFk: row.orderIdFk, productId: row.productId, edit: true } @@ -593,6 +581,53 @@ export default { }); } }, + startCount() { + if (this.countType === 0) { + if (isBlank(this.formData.invStorageCode) || isBlank(this.formData.invWarehouseCode)) { + this.$message.warning("请先选择盘点仓库"); + return; + } + //拉取整个仓库的数据 + let params = { + invStorageCode: this.formData.invStorageCode, + invWarehouseCode: this.formData.invWarehouseCode + }; + getCountInvProductProduct(params).then((res) => { + if (res.data.length !== 0) { + let invProductList = res.data; + for (let product of invProductList) { + this.countProductList.push(product); + } + this.saveOrder(1); + } + }); + } else if (this.countType === 1) { + if (isBlank(this.formData.invStorageCode) || isBlank(this.formData.invWarehouseCode) || isBlank(this.formData.invSpaceCode)) { + this.$message.warning("请先选择盘点仓库和货位"); + return; + } + let params = { + invStorageCode: this.formData.invStorageCode, + invWarehouseCode: this.formData.invWarehouseCode, + invSpaceCode: this.formData.invSpaceCode + }; + getCountInvProductProduct(params).then((res) => { + if (res.data.length !== 0) { + let invProductList = res.data; + for (let product of invProductList) { + this.countProductList.push(product); + } + this.saveOrder(1); + } + }); + } else if (this.countType === 2) { + if (isBlank(this.formData.invStorageCode) || isBlank(this.formData.invWarehouseCode)) { + this.$message.warning("请先选盘点仓库"); + return; + } + this.selectInvProductVisible = true; + } + }, }, components: { countOrderCodes diff --git a/src/views/inventory/countOrderCodes.vue b/src/views/inventory/countOrderCodes.vue index 7f50f2c..af76579 100644 --- a/src/views/inventory/countOrderCodes.vue +++ b/src/views/inventory/countOrderCodes.vue @@ -117,7 +117,7 @@ export default { getCodeList() { this.loading = true; this.query.productId = this.codeQuery.productId; - this.query.orderIdfK = this.codeQuery.orderIdfK; + this.query.orderIdFk = this.codeQuery.orderIdFk; getCountCodesList(this.query).then((res) => { this.loading = false; if (res.code === 20000) { diff --git a/src/views/inventory/invCountOrderNew.vue b/src/views/inventory/invCountOrderNew.vue index 2f14e71..44fec67 100644 --- a/src/views/inventory/invCountOrderNew.vue +++ b/src/views/inventory/invCountOrderNew.vue @@ -50,7 +50,24 @@ @click="onReset" ></el-button> <el-button type="primary" icon="search" @click="onSubmit">查询</el-button> - <el-button type="primary" icon="search" @click="addCountOrder">新增盘点单</el-button> + <el-button + type="primary" + @click.native.stop="addCountOrder(0)" + >新增整库盘点单 + </el-button + > + <el-button + type="primary" + @click.native.stop="addCountOrder(1)" + >新增货位盘点单 + </el-button + > + <el-button + type="primary" + @click.native.stop="addCountOrder(2)" + >新增部分盘点单 + </el-button + > </el-button-group> </el-form-item> </el-row> @@ -117,6 +134,7 @@ <addCountOrder :closeDialog="closeAddDialog" :countOrder="countOrder" + :countType="countType" ></addCountOrder> </el-dialog> @@ -164,6 +182,7 @@ export default { add: "新增盘点单", edit: "编辑盘点单" }, + countType: null }; }, methods: { @@ -274,9 +293,10 @@ export default { } }) }, - addCountOrder() { + addCountOrder(type) { this.addCountOrderVisible = true; this.countOrder = {}; + this.countType = type; this.formName = 'add'; }, closeAddDialog() {