| | |
| | | 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; |
| | |
| | | public int insertOmProductionOrdeInfo(OmProductionOrdeInfo omProductionOrdeInfo) |
| | | { |
| | | omProductionOrdeInfo.setCreateTime(DateUtils.getNowDate()); |
| | | Integer streamNumber = omProductionOrdeInfoMapper.getMaxStreamNumber(); |
| | | omProductionOrdeInfo.setStreamNumber(String.valueOf(streamNumber+1)); |
| | | return omProductionOrdeInfoMapper.insertOmProductionOrdeInfo(omProductionOrdeInfo); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @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() |
| | |
| | | .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); |
| | |
| | | omProductionOrdeInfoService.updateOmProductionOrdeInfo(moveOrdeInfos.get(0)); |
| | | currentOrdeInfos.get(0).setStreamNumber(moveStreamNumber); |
| | | omProductionOrdeInfoService.updateOmProductionOrdeInfo(currentOrdeInfos.get(0)); |
| | | return 1; |
| | | return AjaxResult.success("移动成功"); |
| | | } |
| | | } |