diff --git a/measurement/src/main/java/com/ruoyi/bill/controller/PoundmstController.java b/measurement/src/main/java/com/ruoyi/bill/controller/PoundmstController.java index 59e80d5..8f96988 100644 --- a/measurement/src/main/java/com/ruoyi/bill/controller/PoundmstController.java +++ b/measurement/src/main/java/com/ruoyi/bill/controller/PoundmstController.java @@ -109,10 +109,10 @@ public class PoundmstController extends BaseController */ @PreAuthorize("@ss.hasPermi('measurement/bill:poundmst:add')") @Log(title = "主榜单信息", businessType = BusinessType.INSERT) - @GetMapping(value = "/complete/{id}") - public AjaxResult complete(@PathVariable("id") String id) + @PostMapping(value = "/complete") + public AjaxResult complete(@RequestBody Poundmst poundmst) { - return toAjax(poundmstService.completePoundmst(id)); + return toAjax(poundmstService.completePoundmst(poundmst)); } /** diff --git a/measurement/src/main/java/com/ruoyi/bill/mapper/PoundmstMapper.java b/measurement/src/main/java/com/ruoyi/bill/mapper/PoundmstMapper.java index b8277ff..a6e20c1 100644 --- a/measurement/src/main/java/com/ruoyi/bill/mapper/PoundmstMapper.java +++ b/measurement/src/main/java/com/ruoyi/bill/mapper/PoundmstMapper.java @@ -70,4 +70,8 @@ public interface PoundmstMapper extends BaseMapper * @return 结果 */ public int updateFidById(@Param("id")String id,@Param("fid")String fid); + + public int completeBillMst(@Param("id")String id); + + public int unCompleteBillMst(@Param("id")String id); } diff --git a/measurement/src/main/java/com/ruoyi/bill/service/IPoundmstService.java b/measurement/src/main/java/com/ruoyi/bill/service/IPoundmstService.java index 41d20c9..47f3def 100644 --- a/measurement/src/main/java/com/ruoyi/bill/service/IPoundmstService.java +++ b/measurement/src/main/java/com/ruoyi/bill/service/IPoundmstService.java @@ -56,10 +56,10 @@ public interface IPoundmstService extends IService /** * 完成主榜单信息 * - * @param id 主榜单信息 + * @param poundmst 主榜单信息 * @return 结果 */ - public int completePoundmst(String id); + public int completePoundmst(Poundmst poundmst); /** * 批量删除主榜单信息 @@ -78,6 +78,20 @@ public interface IPoundmstService extends IService */ public int updateFidById(String id, String fid); + /** + * 根据id进行单据状态完成。 + * @param id + * @return + */ + public int completeBillMst(String id); + + /** + * 根据Id进行单据反完成 + * @param id + * @return + */ + public int unCompleteBillMst(String id); + /** * 删除主榜单信息信息 * diff --git a/measurement/src/main/java/com/ruoyi/bill/service/impl/PoundmstServiceImpl.java b/measurement/src/main/java/com/ruoyi/bill/service/impl/PoundmstServiceImpl.java index 703cfd4..333f7fd 100644 --- a/measurement/src/main/java/com/ruoyi/bill/service/impl/PoundmstServiceImpl.java +++ b/measurement/src/main/java/com/ruoyi/bill/service/impl/PoundmstServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.bill.service.impl; import java.io.IOException; import java.util.List; +import com.ruoyi.bill.domain.PoundBill; import com.ruoyi.webApi.ApiPostBack; import org.apache.ibatis.annotations.Param; @@ -28,6 +29,8 @@ public class PoundmstServiceImpl extends ServiceImpl i @Autowired private ApiPostBack apiPostBack; + @Autowired + private PoundBillServiceImpl poundBillServiceImpl; /** * 查询主榜单信息 @@ -64,6 +67,7 @@ public class PoundmstServiceImpl extends ServiceImpl i public int insertPoundmst(Poundmst poundmst) { poundmst.initAddFields(poundmst); + poundmst.setBllstt("1"); boolean save = save(poundmst); if (save){ return 1; @@ -103,15 +107,26 @@ public class PoundmstServiceImpl extends ServiceImpl i } @Override - public int completePoundmst(String id) { + @Transactional(rollbackFor = Exception.class) + public int completePoundmst(Poundmst poundmst) { + String id = poundmst.getId(); + String usrcode = poundmst.getUsrcode(); try { + //根据当前id,查询下游的榜单信息,如果存在非完成状态的数据,则提示报错。 + PoundBill queryPoundBill = new PoundBill(); + queryPoundBill.setAppliid(id); + queryPoundBill.setBillstate("1"); + List poundBills = poundBillServiceImpl.selectPoundBillList(queryPoundBill); + if (!poundBills.isEmpty()){ + //下游还存在未完成的榜单,不允许“完成” + throw new Exception("下游存在“未完成”的榜单,不允许完成。"); + } //推送星空 apiPostBack.makePoundmstFormData(id); - //推送完成后。将单据状态设置为完成。 - + completeBillMst(id); }catch (Exception e){ - throw new RuntimeException("主榜单:" + id + "推送星空时,出现异常:"+e.getMessage()); + throw new RuntimeException("主榜单:" + usrcode + " 推送星空时,出现异常:"+e.getMessage()); } return 1; } @@ -137,7 +152,25 @@ public class PoundmstServiceImpl extends ServiceImpl i */ public int updateFidById(String id, String fid){ return poundmstMapper.updateFidById(id,fid); - }; + } + + /** + * 完成单据 + * @param id + * @return + */ + public int completeBillMst(String id){ + return poundmstMapper.completeBillMst(id); + } + + /** + * 反完成单据 + * @param id + * @return + */ + public int unCompleteBillMst(String id){ + return poundmstMapper.unCompleteBillMst(id); + } /** * 删除主榜单信息信息 diff --git a/measurement/src/main/java/com/ruoyi/webApi/ApiTask.java b/measurement/src/main/java/com/ruoyi/webApi/ApiTask.java index 82b5869..86a8d8e 100644 --- a/measurement/src/main/java/com/ruoyi/webApi/ApiTask.java +++ b/measurement/src/main/java/com/ruoyi/webApi/ApiTask.java @@ -326,6 +326,7 @@ public class ApiTask { // 3. 保存 Poundmst poundmst = new Poundmst(); poundmst.setId(UUID.randomUUID().toString()); + poundmst.setBllstt("1");//是否完成 poundmst.setBsndt(date); poundmst.setSrcbllid(billno); poundmst.setItmname(materialName); @@ -361,6 +362,7 @@ public class ApiTask { // 3. 保存过磅申请 Poundmst poundmst = new Poundmst(); poundmst.setId(UUID.randomUUID().toString()); + poundmst.setBllstt("1");//是否完成 poundmst.setBsndt(date); poundmst.setSrcbllid(billno); poundmst.setFid(fid); diff --git a/measurement/src/main/resources/mapper/measurement/bill/PoundmstMapper.xml b/measurement/src/main/resources/mapper/measurement/bill/PoundmstMapper.xml index e215a05..a49e9c9 100644 --- a/measurement/src/main/resources/mapper/measurement/bill/PoundmstMapper.xml +++ b/measurement/src/main/resources/mapper/measurement/bill/PoundmstMapper.xml @@ -311,4 +311,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" set fid = #{fid} where id = #{id} + + + update t_data_poundmst + set bllstt = '2' + where id = #{id} + + + + update t_data_poundmst + set bllstt = '1' + where id = #{id} + \ No newline at end of file diff --git a/ruoyi-ui/src/api/measurement/bill/poundmst.js b/ruoyi-ui/src/api/measurement/bill/poundmst.js index 4b3fb75..02848d5 100644 --- a/ruoyi-ui/src/api/measurement/bill/poundmst.js +++ b/ruoyi-ui/src/api/measurement/bill/poundmst.js @@ -44,11 +44,12 @@ export function updatePoundmst(data) { } -// 查询主榜单信息详细 -export function complete(id) { +// 完成主榜单。 +export function complete(data) { return request({ - url: '/measurement/bill/poundmst/complete/' + id, - method: 'get' + url: '/measurement/bill/poundmst/complete', + method: 'post', + data:data }) } diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index 7150ecb..2d97c7d 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -17,7 +17,7 @@ const service = axios.create({ // axios中请求配置有baseURL选项,表示请求URL公共部分 baseURL: process.env.VUE_APP_BASE_API, // 超时 - timeout: 10000 + timeout: 20000 }) // request拦截器 diff --git a/ruoyi-ui/src/views/measurement/operation/moltenironpound/index.vue b/ruoyi-ui/src/views/measurement/operation/moltenironpound/index.vue index 9737c0d..619f54a 100644 --- a/ruoyi-ui/src/views/measurement/operation/moltenironpound/index.vue +++ b/ruoyi-ui/src/views/measurement/operation/moltenironpound/index.vue @@ -81,8 +81,8 @@ 完成 @@ -735,6 +735,7 @@ export default { //主榜单相关界面参数 mstBillFormData:{ selectedIds:[], + selectedUsrcodes:[], mstBillForm:{}, mstBillRules:{}, mstBillTitle:"主榜单信息", @@ -858,9 +859,11 @@ export default { handleMstSelectionChange(selection) { if (selection.length > 0){ this.mstBillFormData.selectedIds = selection.map(item => item.id) + this.mstBillFormData.selectedUsrcodes = selection.map(item => item.usrcode) this.queryPoundBillDetailFirst(); }else { this.mstBillFormData.selectedIds = []; + this.mstBillFormData.selectedUsrcodes = []; } }, // 过磅明细多选框选中数据 @@ -1190,7 +1193,19 @@ export default { return; } //触发完成方法 - await complete(this.mstBillFormData.selectedIds[0]) + //拼接参数 + const data = { + id:this.mstBillFormData.selectedIds[0], + usrcode:this.mstBillFormData.selectedUsrcodes[0], + } + const res = await complete(data); + if (res.code === 200) { + this.$message.success("完成主榜单成功!"); + //查询主榜单数据 + this.handleSearchMstBillFirst(); + } else { + this.$message.error("完成主榜单失败!"); + } }, //searchSelect相关方法 diff --git a/ruoyi-ui/src/views/measurement/operation/shortdispound/index.vue b/ruoyi-ui/src/views/measurement/operation/shortdispound/index.vue index 8f775ad..5fbcacf 100644 --- a/ruoyi-ui/src/views/measurement/operation/shortdispound/index.vue +++ b/ruoyi-ui/src/views/measurement/operation/shortdispound/index.vue @@ -81,8 +81,8 @@ 完成 diff --git a/ruoyi-ui/src/views/measurement/operation/steelpound/index.vue b/ruoyi-ui/src/views/measurement/operation/steelpound/index.vue index 6a11d37..f350e25 100644 --- a/ruoyi-ui/src/views/measurement/operation/steelpound/index.vue +++ b/ruoyi-ui/src/views/measurement/operation/steelpound/index.vue @@ -39,13 +39,13 @@ 获取重量 - - - + + + 自动过磅 手动过磅 @@ -53,6 +53,17 @@ 查询 打印 + + + + 完成 + + + @@ -495,6 +506,7 @@ export default { trnunitid:"",//运输单位 sendunitid:"",//发货单位 poundid:"",//业务磅点,java对象中存储为该字段。 + bllstt:"1" }, poundBillDetail: { total: 0, @@ -521,6 +533,7 @@ export default { //主榜单相关界面参数 mstBillFormData:{ selectedIds:[], + selectedUsrcodes:[], mstBillForm:{}, mstBillRules:{}, mstBillTitle:"主榜单信息", @@ -703,10 +716,12 @@ export default { handleMstSelectionChange(selection) { if (selection.length > 0){ this.mstBillFormData.selectedIds = selection.map(item => item.id) + this.mstBillFormData.selectedUsrcodes = selection.map(item => item.usrcode) var mstId = this.mstBillFormData.selectedIds[0]; this.queryPoundBillDetail(mstId); }else { this.mstBillFormData.selectedIds = []; + this.mstBillFormData.selectedUsrcodes = []; } }, @@ -969,7 +984,19 @@ export default { return; } //触发完成方法 - await complete(this.mstBillFormData.selectedIds[0]) + //拼接参数 + const data = { + id:this.mstBillFormData.selectedIds[0], + usrcode:this.mstBillFormData.selectedUsrcodes[0], + } + const res = await complete(data); + if (res.code === 200) { + this.$message.success("完成主榜单成功!"); + //查询主榜单数据 + this.handleSearchMstBillFirst(); + } else { + this.$message.error("完成主榜单失败!"); + } }, //searchSelect相关方法 buildCacheKey({ params, where, groupby = '', orderby = '' }) {