一级出库和二级出库问题修改

master
zhangdi 3 months ago
parent 6449275882
commit 6b71c5ec1f
  1. 10
      src/views/firstOrder/components/batchSelectionDialog.vue
  2. 5
      src/views/firstOrder/components/inDialog.vue
  3. 85
      src/views/firstOrder/components/outDialog.vue
  4. 18
      src/views/firstOrder/outbound.vue

@ -10,23 +10,19 @@
@selection-change="(val) => handleSelectionChange(val, props.row)" border> @selection-change="(val) => handleSelectionChange(val, props.row)" border>
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column type="index" label="#" width="55" /> <el-table-column type="index" label="#" width="55" />
<!-- <el-table-column label="表单ID" prop="id" width="80" /> -->
<el-table-column label="物料名称" prop="materialName" /> <el-table-column label="物料名称" prop="materialName" />
<el-table-column label="物料编码" prop="materialCode" /> <el-table-column label="物料编码" prop="materialCode" />
<el-table-column label="规格型号" prop="model" /> <el-table-column label="规格型号" prop="model" />
<!-- <el-table-column label="申请数量" prop="applicationQuantity" /> -->
<el-table-column label="单价" prop="unitPrice" width="80" /> <el-table-column label="单价" prop="unitPrice" width="80" />
</el-table> </el-table>
</template> </template>
</el-table-column> </el-table-column>
<!-- 常规列展示 --> <!-- 常规列展示 -->
<!-- <el-table-column label="物料ID" prop="materialId" /> -->
<el-table-column label="物料编码" prop="materialCode" /> <el-table-column label="物料编码" prop="materialCode" />
<el-table-column label="物料名称" prop="materialName" /> <el-table-column label="物料名称" prop="materialName" />
<el-table-column label="规格型号" prop="model" /> <el-table-column label="规格型号" prop="model" />
<el-table-column label="申请数量" prop="applicationQuantity" /> <el-table-column label="申请数量" prop="applicationQuantity" />
<!-- <el-table-column label="本此出库数量" prop="applicationQuantity" /> -->
<el-table-column label="已出库数量" prop="outboundQuantity" /> <el-table-column label="已出库数量" prop="outboundQuantity" />
<el-table-column label="部门" prop="departmentName" /> <el-table-column label="部门" prop="departmentName" />
<el-table-column label="单位" prop="unit" /> <el-table-column label="单位" prop="unit" />
@ -96,6 +92,11 @@ export default {
// //
handleSelectionChange(selection, parentRow) { handleSelectionChange(selection, parentRow) {
console.log('666666', selection, parentRow) console.log('666666', selection, parentRow)
if(selection.length>(parentRow.applicationQuantity-parentRow.outboundQuantity)){
this.$message.error('勾选数量不能大于申请数量')
return
}
// //
const selectionWithParent = selection.map(item => ({ const selectionWithParent = selection.map(item => ({
...item, ...item,
@ -112,7 +113,6 @@ export default {
); );
// //
this.selectedRows.push(...selectionWithParent); this.selectedRows.push(...selectionWithParent);
console.log('777777', selection, parentRow, this.selectedRows)
// //
}, },

@ -652,9 +652,8 @@ export default {
this.statisticsList = res.data.result; this.statisticsList = res.data.result;
this.statisticsList = this.statisticsList.map((stat) => { this.statisticsList = this.statisticsList.map((stat) => {
const detail = this.sizeForm.inTableData.find( const detail = this.sizeForm.inTableData.find(
(item) => item.materialCode === stat.materialCode (item) => item.materialCode === stat.materialCode && item.type === stat.type
); );
console.log("detail", detail,stat);
return { return {
...stat, ...stat,
theInboundQuantity: detail.theInboundQuantity, // theInboundQuantity: detail.theInboundQuantity, //
@ -670,7 +669,7 @@ export default {
this.statisticsList = res.data.result; this.statisticsList = res.data.result;
this.statisticsList = this.statisticsList.map((stat) => { this.statisticsList = this.statisticsList.map((stat) => {
const detail = this.sizeForm.singleData.find( const detail = this.sizeForm.singleData.find(
(item) => item.materialId === stat.materialId (item) => item.materialId === stat.materialId&& item.type === stat.type
); );
return { return {
...stat, ...stat,

@ -148,7 +148,7 @@
}} }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="type" label="出库类型"> <!-- <el-table-column prop="type" label="出库类型">
<template slot-scope="scope"> <template slot-scope="scope">
{{ {{
scope.row.type === "NY" scope.row.type === "NY"
@ -158,7 +158,7 @@
: "" : ""
}} }}
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column prop="unit" label="单位"> </el-table-column> <el-table-column prop="unit" label="单位"> </el-table-column>
<el-table-column <el-table-column
label="部门" label="部门"
@ -279,7 +279,7 @@
}} }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
prop="departmentName" prop="departmentName"
label="部门" label="部门"
v-if="sizeForm.options == 2" v-if="sizeForm.options == 2"
@ -290,27 +290,18 @@
{{ getDepartmentName(scope.row.department) }} {{ getDepartmentName(scope.row.department) }}
</span> </span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column prop="num" label="数量"> <el-table-column prop="num" label="数量"> </el-table-column>
</el-table-column>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="date" label="出库信息">
prop="date"
label="出库信息"
>
<el-table-column prop="theOutboundQuantity" label="数量"> <el-table-column prop="theOutboundQuantity" label="数量">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.theOutboundQuantity || 0 }} {{ scope.row.theOutboundQuantity || 0 }}
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column <el-table-column prop="date" label="出库后库存">
prop="date"
label="出库后库存"
>
<el-table-column prop="totalQuantity" label="数量"> <el-table-column prop="totalQuantity" label="数量">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.totalQuantity || 0 }} {{ scope.row.totalQuantity || 0 }}
@ -563,8 +554,8 @@ export default {
if ( if (
columnIndex === 0 || columnIndex === 0 ||
columnIndex === 1 || columnIndex === 1 ||
columnIndex === 6 || columnIndex === 5 ||
columnIndex === 7 columnIndex === 6
) { ) {
const key = `${row.materialCode}-${row.materialName}`; const key = `${row.materialCode}-${row.materialName}`;
const rows = this.sizeForm.inTableData.filter( const rows = this.sizeForm.inTableData.filter(
@ -594,25 +585,41 @@ export default {
}, },
getStatistics() { getStatistics() {
getStatistics(this.sizeForm.inTableData).then((res) => { getStatistics(this.sizeForm.inTableData).then((res) => {
this.statisticsList = res.data.result this.statisticsList = res.data.result;
this.statisticsList = this.statisticsList.map((stat) => { this.statisticsList = this.statisticsList.map((stat) => {
const detail = this.sizeForm.inTableData.find( const detail = this.sizeForm.inTableData.find(
(item) => item.materialCode === stat.materialCode (item) => item.materialCode === stat.materialCode
) );
console.log("detail", detail, stat) console.log("detail", detail, stat);
//
if (
this.sizeForm.options == 1 &&
this.inBatchForm.optionType == "NY"
) {
const detailList = this.sizeForm.inTableData.filter(
(item) =>
item.materialCode === stat.materialCode &&
item.materialName === stat.materialName
);
console.log("detailList", detailList);
detail.theOutboundQuantity = detailList.reduce((acc, cur) => acc + cur.num, 0);
}
return { return {
...stat, ...stat,
theOutboundQuantity: detail.theOutboundQuantity, // theOutboundQuantity: detail.theOutboundQuantity, //
unitPrice: detail.unitPrice, unitPrice: detail.unitPrice,
totalQuantity: stat.num - detail.theOutboundQuantity, totalQuantity: stat.num - detail.theOutboundQuantity,
department: detail.department, // ID department: detail.department, // ID
departmentName: detail.departmentName || this.getDepartmentName(detail.department), departmentName:
} detail.departmentName ||
}) this.getDepartmentName(detail.department),
}) };
});
});
}, },
changeDepartment(){ changeDepartment() {
this.getStatistics() this.getStatistics();
}, },
batchclose() { batchclose() {
this.batchSelectionVisible = false; this.batchSelectionVisible = false;
@ -684,13 +691,13 @@ export default {
if (row.theOutboundQuantity > maxAllowQuantity) { if (row.theOutboundQuantity > maxAllowQuantity) {
this.$message.error(`本次出库数量不能大于${maxAllowQuantity}`); this.$message.error(`本次出库数量不能大于${maxAllowQuantity}`);
row.theOutboundQuantity = maxAllowQuantity; row.theOutboundQuantity = maxAllowQuantity;
return false return false;
} }
} }
if (this.sizeForm.optionType === "NY") { if (this.sizeForm.optionType === "NY") {
row.theOutboundQuantity = 1; row.theOutboundQuantity = 1;
} }
this.getStatistics() this.getStatistics();
}, },
// //
handleCloseDetail() { handleCloseDetail() {
@ -769,7 +776,6 @@ export default {
let res; let res;
if (this.inBatchForm.optionType === "YH") { if (this.inBatchForm.optionType === "YH") {
res = await getDetailedList(requestParams); res = await getDetailedList(requestParams);
} else if (this.inBatchForm.optionType === "NY") { } else if (this.inBatchForm.optionType === "NY") {
res = await batchList(requestParams); res = await batchList(requestParams);
} }
@ -804,8 +810,8 @@ export default {
this.dialogVisible = true; this.dialogVisible = true;
console.log(1); console.log(1);
this.batchTableData = res.data.result; this.batchTableData = res.data.result;
}else { } else {
this.getStatistics() this.getStatistics();
} }
// //
@ -839,8 +845,8 @@ export default {
getDepartmentName(departmentId) { getDepartmentName(departmentId) {
const department = this.list.find( const department = this.list.find(
(item) => item.departmentId === departmentId (item) => item.departmentId === departmentId
) );
return department ? department.department : "" return department ? department.department : "";
}, },
// //
async getMaterialList() { async getMaterialList() {
@ -872,7 +878,7 @@ export default {
this.sizeForm.inTableData[index].materialName = row.materialName; this.sizeForm.inTableData[index].materialName = row.materialName;
this.sizeForm.inTableData[index].type = row.type; this.sizeForm.inTableData[index].type = row.type;
this.sizeForm.inTableData[index].unit = row.unit; this.sizeForm.inTableData[index].unit = row.unit;
this.getStatistics() this.getStatistics();
}, },
// //
async submit(index) { async submit(index) {
@ -928,7 +934,10 @@ export default {
} }
); );
console.log(this.sizeForm, "111"); console.log(this.sizeForm, "111");
this.sizeForm.inTableData = []; // this.sizeForm.inTableData = [];
if (this.sizeForm.options === 1) {
this.sizeForm.optionType = this.inBatchForm.optionType;
}
try { try {
const res = await submitData(this.sizeForm); const res = await submitData(this.sizeForm);
console.log(this.sizeForm, "222"); console.log(this.sizeForm, "222");
@ -1000,13 +1009,13 @@ export default {
// //
radioChange() { radioChange() {
this.sizeForm.inTableData = []; this.sizeForm.inTableData = [];
this.statisticsList = [] this.statisticsList = [];
this.sizeForm.optionType = ""; this.sizeForm.optionType = "";
this.inBatchDialogVisible = false; this.inBatchDialogVisible = false;
this.consumableVisible = false; this.consumableVisible = false;
this.inBatchDialogVisible = false; this.inBatchDialogVisible = false;
this.batchSelectionVisible = false; this.batchSelectionVisible = false;
this.sizeForm.optionType = ''; this.sizeForm.optionType = "";
this.batchTableData = []; this.batchTableData = [];
if (this.sizeForm.options === 1) { if (this.sizeForm.options === 1) {
this.getQuarterList(); this.getQuarterList();

@ -18,6 +18,10 @@
> >
<span v-else></span> <span v-else></span>
</template> </template>
<template slot-scope="scope" slot="outTypeInfo">
<span v-if="scope.row.optionType=='YH'">发放单</span>
<span v-if="scope.row.optionType=='NY'">出库单</span>
</template>
<template #menu="scope"> <template #menu="scope">
<el-button type="text" @click.stop="handleDetails(scope.row)">详情</el-button> <el-button type="text" @click.stop="handleDetails(scope.row)">详情</el-button>
<el-button type="text" v-if="scope.row.status == 1" @click.stop="handleEdit(scope.row)">编辑</el-button> <el-button type="text" v-if="scope.row.status == 1" @click.stop="handleEdit(scope.row)">编辑</el-button>
@ -104,13 +108,13 @@ export default {
headerAlign: "center", headerAlign: "center",
align: "center", align: "center",
}, },
// { {
// label: "", label: "出库类型",
// prop: "outType", prop: "outTypeInfo",
// width: 140, width: 140,
// headerAlign: "center", headerAlign: "center",
// align: "center", align: "center",
// }, },
{ {
label: "出库日期", label: "出库日期",
prop: "outDate", prop: "outDate",

Loading…
Cancel
Save