diff --git a/measurement/src/main/java/com/ruoyi/bill/controller/PoundBillController.java b/measurement/src/main/java/com/ruoyi/bill/controller/PoundBillController.java index 07db51d..1fdbf01 100644 --- a/measurement/src/main/java/com/ruoyi/bill/controller/PoundBillController.java +++ b/measurement/src/main/java/com/ruoyi/bill/controller/PoundBillController.java @@ -214,6 +214,16 @@ public class PoundBillController extends BaseController { return toAjax(poundBillService.updateMolReWeightPoundBill(poundBill)); } + /** + * 修改磅单信息(钢材磅复磅) + */ + @PreAuthorize("@ss.hasPermi('measurement:poundbill:edit')") + @Log(title = "磅单信息", businessType = BusinessType.UPDATE) + @PutMapping(value = "/steelReWeight") + public AjaxResult editSteelReWeight(@RequestBody PoundBill poundBill) + { + return toAjax(poundBillService.updateSteelPoundBill(poundBill)); + } /** * 删除磅单信息 diff --git a/measurement/src/main/java/com/ruoyi/bill/service/IPoundBillService.java b/measurement/src/main/java/com/ruoyi/bill/service/IPoundBillService.java index e7f536d..83335d5 100644 --- a/measurement/src/main/java/com/ruoyi/bill/service/IPoundBillService.java +++ b/measurement/src/main/java/com/ruoyi/bill/service/IPoundBillService.java @@ -65,6 +65,9 @@ public interface IPoundBillService extends IService public int updateMolReWeightPoundBill(PoundBill poundBill); + + public int updateSteelPoundBill(PoundBill poundBill); + /** * 批量删除磅单信息 * diff --git a/measurement/src/main/java/com/ruoyi/bill/service/impl/PoundBillServiceImpl.java b/measurement/src/main/java/com/ruoyi/bill/service/impl/PoundBillServiceImpl.java index d98b52c..85ac9c2 100644 --- a/measurement/src/main/java/com/ruoyi/bill/service/impl/PoundBillServiceImpl.java +++ b/measurement/src/main/java/com/ruoyi/bill/service/impl/PoundBillServiceImpl.java @@ -620,6 +620,30 @@ public class PoundBillServiceImpl extends ServiceImpl - + 主磅单信息 - 新增 - 修改 - 查询 - 完成 - 取消完成 + 新增 + 修改 + 查询 + 完成 + 取消完成 - 打印 + 打印 - + @@ -165,6 +165,7 @@ v-if="activeTab === 'weighingRequest'" border stripe + ref="poundBillTable" @selection-change="handlePoundBillDetailSelectionChange" height="500" @row-click="handlePoundBillClick" @@ -201,7 +202,7 @@ - 增明细 + 增明细 @@ -221,6 +222,18 @@ + + + + + + + + + + + + @@ -229,7 +242,7 @@ - 修改 + 称重 @@ -241,7 +254,7 @@ - 删除 + 删除 @@ -253,7 +266,7 @@ - 打回复磅 + 打回复磅 @@ -432,13 +445,23 @@ import { listSteelpound, getSteelpound, delSteelpound, addSteelpound, updateSteelpound } from "@/api/measurement/operation/steelpound" import {getTruepound} from "@/api/measurement/basedata/truepound"; import SearchSelect from "@/components/SearchSelect"; -import {addPoundmst, getNumber, getPoundmst, listPoundmst, updatePoundmst,complete} from "@/api/measurement/bill/poundmst"; -import {addTransPoundbill, getNumber as getPoundBillNumber,getMaxBundleNo, listPoundbill,addSteelPoundbill} from "@/api/measurement/bill/poundbill"; +import {addPoundmst, getNumber, getPoundmst, listPoundmst, updatePoundmst,complete,unComplete} from "@/api/measurement/bill/poundmst"; +import { + addTransPoundbill, + getPoundbill, + getNumber as getPoundBillNumber, + getMaxBundleNo, + listPoundbill, + addSteelPoundbill, + updateSteelReWeightPoundbill, + delPoundbill, returnPound +} from "@/api/measurement/bill/poundbill"; import Decimal from "decimal.js"; //引入searchSelect方法 import { getSearchSelectData } from "@/api/tool/gen.js"; //引入searchData组件 import {selectConfigs} from "@/components/SearchSelect/searchdata.js"; +import {Message} from "element-ui"; export default { name: "Steelpound", @@ -540,10 +563,12 @@ export default { mstBillTitle:"主榜单信息", mstBillOpen:false, thisSelectedRow:{}, + isCompleted:false, }, //榜单明细相关界面参数 poundBillDetailFormData:{ selectedIds:[], + reWeighingStatus:[], poundBillDetailForm:{ boilerno: null, carno: null, @@ -555,6 +580,7 @@ export default { thisSelectedRow:{}, isWght:true, mstAndbundleNo:{}, + isReweighing:false, }, //自动过磅相关参数 autoPoundParams:{ @@ -694,6 +720,9 @@ export default { //单击主榜单进行单选。 //主榜单单击选中,并将车号进行赋值。(单选) handleMstBillClick(row) { + if (this.autoPoundParams.autoPound){ + return; + } // 清空之前的选择 this.$refs.mstBillTable.clearSelection(); // 设置当前行为选中状态 @@ -708,9 +737,6 @@ export default { // 设置当前行为选中状态 this.$refs.poundBillTable.toggleRowSelection(row, true); this.poundBillDetailFormData.thisSelectedRow = row; - //将车号和炉次赋值到输入框中 - this.queryParams.carno = row.carno; - this.queryParams.boilerno = row.boilerno; }, // 主榜单多选框选中数据 @@ -718,6 +744,13 @@ export default { if (selection.length > 0){ this.mstBillFormData.selectedIds = selection.map(item => item.id) this.mstBillFormData.selectedUsrcodes = selection.map(item => item.usrcode) + //获取最后选中的数据的完成状态。 + const mstCompletedStatus = selection[selection.length - 1].bllstt; + if ("1" === mstCompletedStatus) { + this.mstBillFormData.isCompleted = false; + } else { + this.mstBillFormData.isCompleted = true; + } var mstId = this.mstBillFormData.selectedIds[0]; this.queryPoundBillDetail(mstId); }else { @@ -730,8 +763,10 @@ export default { handlePoundBillDetailSelectionChange(selection) { if (selection.length > 0){ this.poundBillDetailFormData.selectedIds = selection.map(item => item.id) + this.poundBillDetailFormData.reWeighingStatus = selection.map(item => item.agnstatus) }else { this.poundBillDetailFormData.selectedIds = []; + this.poundBillDetailFormData.reWeighingStatus = []; } }, //检查是否选中磅点。 @@ -828,6 +863,7 @@ export default { this.$message.error("请先选择主榜单!"); return; } + this.poundBillDetailFormData.isReweighing = false; //清空表单中数据 this.resetPoundBillDetailForm(); try { @@ -863,6 +899,43 @@ export default { this.$message.error("新增明细失败,请稍后重试!"); } }, + //点击称毛重,打开榜单明细弹窗。 + async updateWgtPoundBillDetail() { + // 校验是否选中过磅明细 + if (this.poundBillDetailFormData.selectedIds.length === 0) { + this.$message.error("请先选择过磅明细!"); + return; + } + console.log(this.poundBillDetailFormData.reWeighingStatus[0]); + //再判断当前获取的榜单是否为复磅中数据。 + if ("ing" !== this.poundBillDetailFormData.reWeighingStatus[0]){ + //只有复磅单据才允许单独称毛重 + this.$message.error("只有复磅单据才允许单独称重!"); + return; + } + //如果重量为空 + if (this.queryParams.weight == null || this.queryParams.weight === "") { + this.$message.error("请先获取重量!"); + return; + } + this.poundBillDetailFormData.isReweighing = true; + //清空表单中数据 + this.resetPoundBillDetailForm(); + + try { + //通过选中的过磅明细id获取过磅明细数据 + const response = await getPoundbill(this.poundBillDetailFormData.selectedIds[0]); + this.poundBillDetailFormData.poundBillDetailForm = response.data; + const form = this.poundBillDetailFormData.poundBillDetailForm; + //获取重量数据中的数据作为净重数据。 + form.netmqty = this.queryParams.weight; + // 展示弹窗 + this.poundBillDetailFormData.poundBillDetailOpen = true; + } catch (error) { + console.error("称皮重:", error); + this.$message.error("新增明细失败,请稍后重试!"); + } + }, //点击确定,新增榜单明细。 poundBillDetailForNetwgt() { @@ -873,17 +946,27 @@ export default { cancelButtonText: "取消", type: "warning" }).then(() => { - addSteelPoundbill(this.poundBillDetailFormData.poundBillDetailForm).then(response => { - this.$message.success("新增榜单明细成功!"); - this.poundBillDetailFormData.poundBillDetailOpen = false; - //查询榜单明细数据 - this.queryPoundBillDetailFirst(); - //将当前捆号自增1,并更新到缓存中。 - const appliId = this.poundBillDetailFormData.poundBillDetailForm.appliid; - const bundleNo = this.poundBillDetailFormData.poundBillDetailForm.bundleNo; - //将捆号数据缓存到queryPageParams中 - this.poundBillDetailFormData.mstAndbundleNo[appliId] = parseInt(bundleNo) + 1; - }) + //如果当前单据为复磅数据 + if (this.poundBillDetailFormData.isReweighing) { + updateSteelReWeightPoundbill(this.poundBillDetailFormData.poundBillDetailForm).then(response => { + this.$message.success("称重成功!"); + this.poundBillDetailFormData.poundBillDetailOpen = false; + //查询榜单明细数据 + this.queryPoundBillDetailFirst(); + }) + } else { + addSteelPoundbill(this.poundBillDetailFormData.poundBillDetailForm).then(response => { + this.$message.success("新增榜单明细成功!"); + this.poundBillDetailFormData.poundBillDetailOpen = false; + //查询榜单明细数据 + this.queryPoundBillDetailFirst(); + //将当前捆号自增1,并更新到缓存中。 + const appliId = this.poundBillDetailFormData.poundBillDetailForm.appliid; + const bundleNo = this.poundBillDetailFormData.poundBillDetailForm.bundleNo; + //将捆号数据缓存到queryPageParams中 + this.poundBillDetailFormData.mstAndbundleNo[appliId] = parseInt(bundleNo) + 1; + }) + } }).catch(() => {}); } @@ -926,7 +1009,6 @@ export default { } this.poundBillDetailLoading = true; var thisQueryParams = { - billstate:"2", isinuse:"Y" } thisQueryParams.appliid = this.mstBillFormData.selectedIds[0]; @@ -998,6 +1080,7 @@ export default { this.$message.success("完成主榜单成功!"); //查询主榜单数据 this.handleSearchMstBillFirst(); + this.mstBillFormData.isCompleted = true; } else { this.$message.error("完成主榜单失败!"); } @@ -1019,7 +1102,7 @@ export default { } const res = await unComplete(data); if (res.code === 200) { - this.$message.success("完成主榜单成功!"); + this.$message.success("取消完成主榜单成功!"); //查询主榜单数据 this.handleSearchMstBillFirst(); } else { @@ -1051,7 +1134,50 @@ export default { const cfg = this.searchData.selectConfigs.find(c => c.key === key); return this.searchData.optionsMap[this.buildCacheKey(cfg)] || []; }, - + //删除磅单信息 + deletePoundBill() { + // 校验是否选中过磅明细 + if (this.poundBillDetailFormData.selectedIds.length === 0) { + this.$message.error("请先选择过磅明细!"); + return; + } + //判断主磅单状态是否为完成 + if (this.mstBillFormData.isCompleted){ + this.$message.error("主磅单已完成,不能删除!"); + return; + } + this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(() => { + delPoundbill(this.poundBillDetailFormData.selectedIds[0]).then(response => { + this.$message.success("删除成功!"); + //查询榜单明细数据 + this.queryPoundBillDetailFirst(); + }) + }).catch(() => {}); + }, + //打回复磅 + /** 打回复磅按钮操作 */ + handleReturnPound() { + //只能选中一条 + if(this.poundBillDetailFormData.selectedIds.length!==1){ + this.$message.error("请选择一条数据!") + return; + } + if ("ing" === this.poundBillDetailFormData.reWeighingStatus[0]){ + //只有复磅单据才允许单独称毛重 + this.$message.error("该单据已经打回复磅!"); + return; + } + let ids = this.poundBillDetailFormData.selectedIds; + Message("打回中...") + returnPound(ids).then(response => { + this.$modal.msgSuccess("打回成功") + this.queryPoundBillDetailFirst(); + }) + }, } }