jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/controller/OmProductionOrdeInfoController.java
@@ -109,6 +109,6 @@ @GetMapping("/upDownMove") public AjaxResult upDownMove(OmProductionOrdeInfo omProductionOrdeInfo) { return toAjax(omProductionOrdeInfoService.upDownMove(omProductionOrdeInfo)); return omProductionOrdeInfoService.upDownMove(omProductionOrdeInfo); } } jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/mapper/OmProductionOrdeInfoMapper.java
@@ -59,4 +59,6 @@ * @return 结果 */ public int deleteOmProductionOrdeInfoByIds(Long[] ids); public Integer getMaxStreamNumber(); } jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/service/IOmProductionOrdeInfoService.java
@@ -1,5 +1,6 @@ package com.jcdm.main.om.productionOrde.service; import com.jcdm.common.core.domain.AjaxResult; import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo; import java.util.List; @@ -60,5 +61,5 @@ */ public int deleteOmProductionOrdeInfoById(Long id); int upDownMove(OmProductionOrdeInfo omProductionOrdeInfo); AjaxResult upDownMove(OmProductionOrdeInfo omProductionOrdeInfo); } jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/service/impl/OmProductionOrdeInfoServiceImpl.java
@@ -3,6 +3,7 @@ import java.util.List; import java.util.stream.Collectors; import com.jcdm.common.core.domain.AjaxResult; import com.jcdm.common.utils.DateUtils; import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo; import com.jcdm.main.om.productionOrde.mapper.OmProductionOrdeInfoMapper; @@ -59,6 +60,8 @@ public int insertOmProductionOrdeInfo(OmProductionOrdeInfo omProductionOrdeInfo) { omProductionOrdeInfo.setCreateTime(DateUtils.getNowDate()); Integer streamNumber = omProductionOrdeInfoMapper.getMaxStreamNumber(); omProductionOrdeInfo.setStreamNumber(String.valueOf(streamNumber+1)); return omProductionOrdeInfoMapper.insertOmProductionOrdeInfo(omProductionOrdeInfo); } @@ -100,7 +103,7 @@ } @Override public int upDownMove(OmProductionOrdeInfo omProductionOrdeInfo) { public AjaxResult upDownMove(OmProductionOrdeInfo omProductionOrdeInfo) { long currentId = omProductionOrdeInfo.getFrontEndId(); List<OmProductionOrdeInfo> omProductionOrdeInfos = omProductionOrdeInfoService.selectOmProductionOrdeInfoList(omProductionOrdeInfo); List<Long> idList = omProductionOrdeInfos.stream() @@ -108,10 +111,14 @@ .collect(Collectors.toList()); int index = idList.indexOf(currentId); long moveId = 0L; if(omProductionOrdeInfo.getFlag().equals("up")){ moveId = idList.get(index - 1); }else { moveId = idList.get(index + 1); try { if(omProductionOrdeInfo.getFlag().equals("up")){ moveId = idList.get(index - 1); }else { moveId = idList.get(index + 1); } }catch (Exception e){ return AjaxResult.error("当前工单为最后一个或第一个,无法移动"); } OmProductionOrdeInfo currentInfo = new OmProductionOrdeInfo(); currentInfo.setId(currentId); @@ -125,6 +132,6 @@ omProductionOrdeInfoService.updateOmProductionOrdeInfo(moveOrdeInfos.get(0)); currentOrdeInfos.get(0).setStreamNumber(moveStreamNumber); omProductionOrdeInfoService.updateOmProductionOrdeInfo(currentOrdeInfos.get(0)); return 1; return AjaxResult.success("移动成功"); } } jcdm-main/src/main/resources/mapper/om/productionOrde/OmProductionOrdeInfoMapper.xml
@@ -214,4 +214,8 @@ #{id} </foreach> </delete> <select id="getMaxStreamNumber" resultType="Integer"> SELECT MAX(stream_number) AS streamNumber FROM om_production_orde_info </select> </mapper> jcdm-ui/src/views/main/om/productionOrde/index.vue
@@ -466,6 +466,7 @@ this.queryParams.idNums = ids this.queryParams.flag = 'up' upDownMove(this.queryParams).then(response => { this.$modal.msgSuccess("移动成功"); this.getList(); }); }, @@ -477,6 +478,7 @@ this.queryParams.idNums = ids this.queryParams.flag = 'down' upDownMove(this.queryParams).then(response => { this.$modal.msgSuccess("移动成功"); this.getList(); }); }, @@ -593,25 +595,34 @@ }, // 多选框选中数据 handleSelectionChange(selection) { // this.ids = selection.map(item => item.id) // const statusSize = selection.map(item => item.orderStatus) // const intArr = statusSize.map(str => parseInt(str)); // const sum = intArr.reduce((a, b) => a + b, 0); // this.single = selection.length!==1 // this.multiple = !selection.length // if(selection[0].orderStatus!== '1'||sum!==selection.length){ // this.single = true // this.multiple = true // } // if(selection.length > 1){ // this.move = true // }else { // this.move = false // } this.ids = selection.map(item => item.id) const statusSize = selection.map(item => item.orderStatus) const intArr = statusSize.map(str => parseInt(str)); const sum = intArr.reduce((a, b) => a + b, 0); this.single = selection.length!==1 this.multiple = !selection.length if(selection[0].orderStatus!== '1'||sum!==selection.length){ // this.single = selection.length!==1 // this.multiple = !selection.length this.move = selection.length!==1 if(!selection.length){ this.single = true this.multiple = true } if(selection.length > 1){ this.move = true }else { this.move = false if(selection[0].orderStatus === '1' && selection.length === 1){ this.single = false this.multiple = false } // if (selection.length === 1) { // this.move = false; // } }, /** 新增按钮操作 */ handleAdd() {