|
@@ -7,7 +7,7 @@
|
|
|
</div>
|
|
|
<Row :gutter="10" style="margin-bottom: 10px">
|
|
|
<Col span="4">
|
|
|
- <Select clearable v-model="searchForm.ck" placeholder="仓库名">
|
|
|
+ <Select clearable v-model="searchForm.ck" :disabled="ckLock" placeholder="仓库名">
|
|
|
<Option v-for="item in ckList" :value="item.twId" :key="item.twId">{{ item.twName }}</Option>
|
|
|
</Select>
|
|
|
</Col>
|
|
@@ -57,7 +57,8 @@
|
|
|
import {
|
|
|
queryPurchasePoolList,
|
|
|
tbiGoodsCategoryList,
|
|
|
- warehouseList
|
|
|
+ warehouseList,
|
|
|
+ getMaterialPrice
|
|
|
} from "@/service/getData";
|
|
|
export default {
|
|
|
data() {
|
|
@@ -66,6 +67,8 @@ export default {
|
|
|
approvalState: "",
|
|
|
orderState: "",
|
|
|
areaId: "",
|
|
|
+ gpId: "",
|
|
|
+ ckLock: "",
|
|
|
projectId: "",
|
|
|
type: "",
|
|
|
//新增物料申请表单
|
|
@@ -82,6 +85,7 @@ export default {
|
|
|
},
|
|
|
//表格查询内容
|
|
|
searchForm: {
|
|
|
+ ck: "",
|
|
|
yjfl: "", //一级分类
|
|
|
ejfl: "", // 二级分类
|
|
|
wlmc: "" //物料编码或名称
|
|
@@ -187,10 +191,10 @@ export default {
|
|
|
pageSize: 10,
|
|
|
firstClassId: this.searchForm.yjfl,
|
|
|
secondClassId: this.searchForm.ejfl,
|
|
|
- areaIds: this.areaId.split(',')[0],
|
|
|
+ areaIds: this.areaId.split(",")[0],
|
|
|
queryText1: this.searchForm.wlmc,
|
|
|
queryText2: "",
|
|
|
- projectIds: this.projectId.split(',')[0],
|
|
|
+ projectIds: this.projectId.split(",")[0],
|
|
|
// projectIds: 10,
|
|
|
storehouseId: this.searchForm.ck
|
|
|
};
|
|
@@ -206,16 +210,20 @@ export default {
|
|
|
this.getTableData();
|
|
|
},
|
|
|
tableOnSelect(selection, row) {
|
|
|
- this.tableSelect = selection;
|
|
|
+ this.tableSelect = selection.sort((a, b) => {
|
|
|
+ a.id - b.id;
|
|
|
+ });
|
|
|
},
|
|
|
tableOnCancel(selection, row) {
|
|
|
- this.tableSelect = selection;
|
|
|
+ this.tableSelect = selection.sort((a, b) => {
|
|
|
+ a.id - b.id;
|
|
|
+ });
|
|
|
},
|
|
|
//获取仓库
|
|
|
getCk() {
|
|
|
let postData = {
|
|
|
- areaId: this.areaId.split(',')[0],
|
|
|
- projectId: this.projectId.split(',')[0]
|
|
|
+ areaId: this.areaId.split(",")[0],
|
|
|
+ projectId: this.projectId.split(",")[0]
|
|
|
};
|
|
|
warehouseList(postData).then(res => {
|
|
|
if (res.status == 200) {
|
|
@@ -231,37 +239,66 @@ export default {
|
|
|
},
|
|
|
//批量添加物料
|
|
|
plAdd() {
|
|
|
+ if (!this.tableSelect.length) {
|
|
|
+ this.$Message.error("请至少选择一个物料。");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let ck = this.tableSelect[0].storehouseId;
|
|
|
let arr = [];
|
|
|
+ let postArr = [];
|
|
|
for (let item in this.tableSelect) {
|
|
|
- let date = new Date();
|
|
|
- let dateArr = `${date.getFullYear()}-${date.getMonth() +
|
|
|
- 1}-${date.getDate()} 00:00:00`;
|
|
|
- arr.push({
|
|
|
- applyDetailId: this.tableSelect[item].id,
|
|
|
- applyRuleId: this.tableSelect[item].purchaseApplyId,
|
|
|
- applyRuleCode: this.tableSelect[item].code,
|
|
|
- code: this.tableSelect[item].materialCode,
|
|
|
- firstClassName: this.tableSelect[item].firstClassName,
|
|
|
- materialName: this.tableSelect[item].materialName,
|
|
|
- brandName: this.tableSelect[item].brandName,
|
|
|
- specs: this.tableSelect[item].specs,
|
|
|
- unit: this.tableSelect[item].unit,
|
|
|
- amount: Number(this.tableSelect[item].amount),
|
|
|
- billedAmount: this.tableSelect[item].billedAmount,
|
|
|
- inventory: this.tableSelect[item].inventory,
|
|
|
- storehouseName: this.tableSelect[item].storehouseName,
|
|
|
- price: Number(this.tableSelect[item].referencePrice),
|
|
|
- purchaseNum: 0,
|
|
|
- plannedArrivalTime: dateArr,
|
|
|
- isNumControl: 1,
|
|
|
- isTimeControl: 1,
|
|
|
- applySurplusNum: this.tableSelect[item].amount,
|
|
|
- warehousedNum: 0,
|
|
|
- remark: ""
|
|
|
- });
|
|
|
+ if (this.tableSelect[item].storehouseId != ck) {
|
|
|
+ this.$Message.error("请选择同一仓库下的物料。");
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ postArr.push({
|
|
|
+ applyDetailId: this.tableSelect[item].id,
|
|
|
+ code: this.tableSelect[item].materialCode,
|
|
|
+ gpId: this.gpId
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
- this.$emit("plAdd", arr);
|
|
|
- this.$emit("return");
|
|
|
+ getMaterialPrice(postArr).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ let resArr = res.data.sort((a, b) => {
|
|
|
+ a.applyDetailId - b.applyDetailId;
|
|
|
+ });
|
|
|
+ for (let item in resArr) {
|
|
|
+ let date = new Date();
|
|
|
+ let dateArr = `${date.getFullYear()}-${date.getMonth() +
|
|
|
+ 1}-${date.getDate()} 00:00:00`;
|
|
|
+ arr.push({
|
|
|
+ applyDetailId: this.tableSelect[item].id,
|
|
|
+ applyRuleId: this.tableSelect[item].purchaseApplyId,
|
|
|
+ applyRuleCode: this.tableSelect[item].code,
|
|
|
+ code: this.tableSelect[item].materialCode,
|
|
|
+ firstClassName: this.tableSelect[item].firstClassName,
|
|
|
+ materialName: this.tableSelect[item].materialName,
|
|
|
+ brandName: this.tableSelect[item].brandName,
|
|
|
+ specs: this.tableSelect[item].specs,
|
|
|
+ unit: this.tableSelect[item].unit,
|
|
|
+ amount: Number(this.tableSelect[item].amount),
|
|
|
+ billedAmount: this.tableSelect[item].billedAmount,
|
|
|
+ inventory: this.tableSelect[item].inventory,
|
|
|
+ storehouseName: this.tableSelect[item].storehouseName,
|
|
|
+ storehouseId: this.tableSelect[item].storehouseId,
|
|
|
+ price: Number(resArr[item].price),
|
|
|
+ purchaseNum: Number(this.tableSelect[item].noBilledAmount),
|
|
|
+ plannedArrivalTime: dateArr,
|
|
|
+ isNumControl: 1,
|
|
|
+ isTimeControl: 1,
|
|
|
+ checkNum: null,
|
|
|
+ applySurplusNum: this.tableSelect[item].noBilledAmount,
|
|
|
+ warehousedNum: 0,
|
|
|
+ remark: ""
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.$emit("plAdd", arr);
|
|
|
+ this.$emit("return");
|
|
|
+ } else {
|
|
|
+ this.$Message.error(res.message);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|