| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.CommandInfo; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.zy.asrs.entity.param.TaskOverToWms; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.CommandInfoService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.TaskWrkService; |
| | |
| | | |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | @Value("${wms.taskStatusFeedbackPath}") |
| | | private String taskStatusFeedbackPath; |
| | | |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | @RequestMapping(value = "/taskWrk/{wrkNo}/auth") |
| | | @ManagerAuth |
| | |
| | | return R.error("已完结或已取消") ; |
| | | } |
| | | LocMast locMast=new LocMast(); |
| | | if(taskWrk.getIoType()==1){//入库任务完成库位为F |
| | | locMast=locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("没有找到该库位") ; |
| | | } |
| | | locMast.setLocSts("F"); |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setBarcode(taskWrk.getBarcode()); |
| | | }else if(taskWrk.getIoType()==2){//出库任务完成库位为O |
| | | locMast=locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("没有找到该库位") ; |
| | | } |
| | | locMast.setLocSts("O"); |
| | | locMast.setModiTime(new Date()); |
| | | }else if(taskWrk.getIoType()==3){ |
| | | locMast=locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("没有找到该库位") ; |
| | | } |
| | | locMast.setLocSts("O"); |
| | | locMast.setModiTime(new Date()); |
| | | locMastService.updateById(locMast); |
| | | locMast=locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("没有找到该库位") ; |
| | | } |
| | | locMast.setLocSts("F"); |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setBarcode(taskWrk.getBarcode()); |
| | | |
| | | if(taskWrk.getIoType()==1){//入库任务完成库位为F |
| | | locMast=locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("没有找到该库位") ; |
| | | } |
| | | locMast.setLocSts("F"); |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setBarcode(taskWrk.getBarcode()); |
| | | }else if(taskWrk.getIoType()==2){//出库任务完成库位为O |
| | | locMast=locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("没有找到该库位") ; |
| | | } |
| | | locMast.setLocSts("O"); |
| | | locMast.setModiTime(new Date()); |
| | | }else if(taskWrk.getIoType()==3){ |
| | | locMast=locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("没有找到该库位") ; |
| | | } |
| | | locMast.setLocSts("O"); |
| | | locMast.setModiTime(new Date()); |
| | | locMastService.updateById(locMast); |
| | | taskWrk.setStatus(7);//手动完成任务 |
| | | taskWrk.setModiTime(new Date()); |
| | | taskWrkService.updateById(taskWrk); |
| | | locMast=locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("没有找到该库位") ; |
| | | } |
| | | locMast.setLocSts("F"); |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setBarcode(taskWrk.getBarcode()); |
| | | |
| | | } |
| | | try{ |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("taskNo",taskWrk.getTaskNo()); |
| | | headParam.put("status",taskWrk.getStatus()); |
| | | headParam.put("ioType",taskWrk.getIoType()); |
| | | headParam.put("barcode",taskWrk.getBarcode()); |
| | | headParam.put("reportTime",new Date()); |
| | | String response; |
| | | response = new HttpHandler.Builder() |
| | | // .setHeaders(headParam) |
| | | .setUri(wmsUrl) |
| | | .setPath(taskStatusFeedbackPath) |
| | | .setJson(JSON.toJSONString(headParam)) |
| | | .build() |
| | | .doPost(); |
| | | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | apiLogService.save("wcs派发入库任务上报wms" |
| | | ,wmsUrl+taskStatusFeedbackPath |
| | | ,null |
| | | ,"127.0.0.1" |
| | | ,JSON.toJSONString(headParam) |
| | | ,response |
| | | ,true |
| | | ); |
| | | }catch (Exception e){ |
| | | log.error("wcs手动取消任务上报wms失败", taskWrk); |
| | | throw new CoolException("wcs派发入库任务上报wms失败"); |
| | | } |
| | | locMastService.updateById(locMast); |
| | | taskWrk.setStatus(7);//手动完成任务 |
| | | taskWrk.setModiTime(new Date()); |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | }catch (Exception e){ |
| | | taskWrk.setModiUser(9999L);//操作员 |
| | | } |
| | | try{ |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("taskNo",taskWrk.getTaskNo()); |
| | | headParam.put("status",taskWrk.getStatus()); |
| | | headParam.put("ioType",taskWrk.getIoType()); |
| | | headParam.put("barcode",taskWrk.getBarcode()); |
| | | headParam.put("reportTime",new Date()); |
| | | String response; |
| | | response = new HttpHandler.Builder() |
| | | // .setHeaders(headParam) |
| | | .setUri(wmsUrl) |
| | | .setPath(taskStatusFeedbackPath) |
| | | .setJson(JSON.toJSONString(headParam)) |
| | | .build() |
| | | .doPost(); |
| | | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | apiLogService.save("wcs派发入库任务上报wms" |
| | | ,wmsUrl+taskStatusFeedbackPath |
| | | ,null |
| | | ,"127.0.0.1" |
| | | ,JSON.toJSONString(headParam) |
| | | ,response |
| | | ,true |
| | | ); |
| | | }catch (Exception e){ |
| | | log.error("wcs手动完结任务上报wms失败", taskWrk); |
| | | throw new CoolException("wcs派发入库任务上报wms失败"); |
| | | } |
| | | taskWrk.setCompleteTime(now);//完结时间 |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |