| | |
| | | import com.zy.asrs.wms.asrs.entity.param.GeneratePakInParam; |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | | import com.zy.asrs.wms.utils.LocUtils; |
| | | import com.zy.asrs.wms.utils.OrderUtils; |
| | | import com.zy.asrs.wms.utils.Utils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private LocTypeService locTypeService; |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private OrderUtils orderUtils; |
| | | @Autowired |
| | | private WaveDetlService waveDetlService; |
| | | |
| | | @Override |
| | | public String generateTaskNo(Long taskType) { |
| | |
| | | task.setTaskSts(99L);//99.入库完成 |
| | | }else { |
| | | //出库 |
| | | task.setTaskSts(199L);//199.出库完成 |
| | | TaskDetl taskDetl = taskDetls.get(0); |
| | | if (taskDetl.getWaveId() == null) { |
| | | task.setTaskSts(199L);//199.出库完成 |
| | | }else { |
| | | task.setTaskSts(198L);//198.播种中 |
| | | } |
| | | } |
| | | |
| | | task.setUpdateTime(new Date()); |
| | |
| | | if(!locService.updateById(loc)){ |
| | | throw new CoolException("库位状态变更失败"); |
| | | } |
| | | |
| | | List<TaskDetl> taskDetls = taskDetlService.getTaskDetlByTaskId(taskId); |
| | | for (TaskDetl taskDetl : taskDetls) { |
| | | if (taskDetl.getWaveId() == null) { |
| | | continue; |
| | | } |
| | | |
| | | String matUniqueKey = Utils.getMatUniqueKey(taskDetl.getMatnr(), taskDetl.getBatch(), taskDetl.getUniqueField()); |
| | | WaveDetl waveDetl = waveDetlService.getOne(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getStockIndex, matUniqueKey).eq(WaveDetl::getWaveId, taskDetl.getWaveId())); |
| | | if(waveDetl == null){ |
| | | continue; |
| | | } |
| | | waveDetl.setWorkQty(waveDetl.getWorkQty() - taskDetl.getAnfme()); |
| | | waveDetl.setUpdateTime(new Date()); |
| | | if (!waveDetlService.updateById(waveDetl)) { |
| | | throw new CoolException("波次明细更新失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | break; |
| | | } |
| | | |
| | |
| | | //回滚订单 |
| | | for (TaskDetl taskDetl : taskDetls) { |
| | | if (taskDetl.getDetlId() != null) { |
| | | OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId()); |
| | | if(orderDetl == null){ |
| | | throw new CoolException("订单明细不存在"); |
| | | } |
| | | |
| | | //回滚工作数量 |
| | | orderDetl.setWorkQty(orderDetl.getWorkQty() - taskDetl.getAnfme()); |
| | | orderDetl.setUpdateTime(new Date()); |
| | | boolean orderDetlUpdate = orderDetlService.updateById(orderDetl); |
| | | if(!orderDetlUpdate){ |
| | | throw new CoolException("工作数量回滚失败"); |
| | | } |
| | | |
| | | orderUtils.updateWorkQty(taskDetl.getDetlId(), taskDetl.getAnfme(), false); |
| | | } |
| | | |
| | | //入库回滚组托通知档 |
| | |
| | | } |
| | | |
| | | //获取源库位高度 |
| | | LocTypeBind locTypeBind = locTypeBindService.getOne(new LambdaQueryWrapper<LocTypeBind>().eq(LocTypeBind::getLocId, originLoc.getId())); |
| | | LocTypeBind locTypeBind = locTypeBindService.getOne(new LambdaQueryWrapper<LocTypeBind>().eq(LocTypeBind::getLocId, originLoc.getId()).in(LocTypeBind::getTypeId, LocBindType.HEIGHT.list())); |
| | | if(locTypeBind == null){ |
| | | throw new CoolException("库位类型不存在"); |
| | | } |