| | |
| | | add("ea1f0459efc02a79f046f982767939ae"); |
| | | }}; |
| | | |
| | | private void auth(String appkey, Object obj, HttpServletRequest request) { |
| | | log.info("{}æ¥å£è¢«è®¿é®ï¼appkey:{}ï¼è¯·æ±æ°æ®ï¼{}", request.getServletPath(), appkey, JSON.toJSONString(obj)); |
| | | request.setAttribute("cache", obj); |
| | | if (Cools.isEmpty(appkey)) { |
| | | throw new CoolException("认è¯å¤±è´¥ï¼è¯·ç¡®è®¤appkeyæ 误ï¼"); |
| | | } |
| | | if (!APP_KEY_LIST.contains(appkey)) { |
| | | throw new CoolException("认è¯å¤±è´¥ï¼è¯·ç¡®è®¤appkeyæ 误ï¼"); |
| | | } |
| | | } |
| | | |
| | | //åå»ºä»»å¡ |
| | | @PostMapping("/taskCreate") |
| | | @Transactional |
| | |
| | | return R.error("æ¡ç [barcode]ä¸è½ä¸ºç©º"); |
| | | } |
| | | String locNo=null; |
| | | if(param.getIoType()==1){ |
| | | locNo=param.getTargetPoint(); |
| | | }else{ |
| | | locNo=param.getStartPoint(); |
| | | if (param.getIoType() == 1) { |
| | | locNo = param.getTargetPoint(); |
| | | } else { |
| | | locNo = param.getStartPoint(); |
| | | } |
| | | try{ |
| | | try { |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", locNo).ne("loc_sts","X")); |
| | | if (Cools.isEmpty(locMast)){ |
| | | log.error("åºä½å·ä¸åå¨"+locNo); |
| | | return R.error("åºä½å·ä¸åå¨"+locNo).add("åºä½å·ä¸åå¨"+locNo); |
| | | .eq("loc_no", locNo).ne("loc_sts", "X")); |
| | | if (Cools.isEmpty(locMast)) { |
| | | log.error("åºä½å·ä¸åå¨" + locNo); |
| | | return R.error("åºä½å·ä¸åå¨" + locNo).add("åºä½å·ä¸åå¨" + locNo); |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("åºä½å·æ£æµç¨åºå¼å¸¸==ãå¼å¸¸ä¿¡æ¯"+e); |
| | | return R.error("åºä½å·æ£æµç¨åºå¼å¸¸").add("åºä½å·æ£æµç¨åºå¼å¸¸==ãå¼å¸¸ä¿¡æ¯"+e); |
| | | } catch (Exception e) { |
| | | log.error("åºä½å·æ£æµç¨åºå¼å¸¸==ãå¼å¸¸ä¿¡æ¯" + e); |
| | | return R.error("åºä½å·æ£æµç¨åºå¼å¸¸").add("åºä½å·æ£æµç¨åºå¼å¸¸==ãå¼å¸¸ä¿¡æ¯" + e); |
| | | } |
| | | LocMast locMast=locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts","F") |
| | | .eq("loc_no",locNo) |
| | | .eq("barcode",param.getBarcode())); |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "F") |
| | | .eq("loc_no", locNo) |
| | | .eq("barcode", param.getBarcode())); |
| | | if(Cools.isEmpty(locMast)){ |
| | | return R.error("该åºä½ä¸æ»¡è¶³åºåºæ¡ä»¶"+param.getTargetPoint()); |
| | | } |
| | |
| | | locNoList.add(locMast.getLocNo()); |
| | | paramList.add(param); |
| | | }else { |
| | | return R.error("该åºä½ä¸è½åæ¶ä¸å两ç¬ä»»å¡"+locMast.getLocNo()); |
| | | return R.error("该åºä½ä¸è½åæ¶ä¸å两ç¬ä»»å¡" + locMast.getLocNo()); |
| | | } |
| | | } |
| | | for (TaskCreateParam param : paramList){ |
| | | openService.taskCreate(param); |
| | | } |
| | | }catch (Exception e){ |
| | | log.error("ä»»å¡ä¸åå¼å¸¸"+e); |
| | | return R.error(); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | //å建å
¥åºä»»å¡ |
| | | @PostMapping("/taskCreateIn") |
| | | @Transactional |
| | | public R taskCreateIn(@RequestHeader String appkey, |
| | | @RequestBody TaskCreateInParam param, |
| | | HttpServletRequest request) { |
| | | auth(appkey, param, request); |
| | | try{ |
| | | if (Cools.isEmpty(param)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | if (Cools.isEmpty(param.getTaskNo())) { |
| | | return R.error("ä»»å¡å·[taskNo]ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (Cools.isEmpty(param.getIoType())) { |
| | | return R.error("ä»»å¡ç±»å[ioType]ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (Cools.isEmpty(param.getBarcode())) { |
| | | return R.error("æ¡ç [barcode]ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | openService.taskCreateIn(param); |
| | | }catch (Exception e){ |
| | | log.error("ä»»å¡ä¸åå¼å¸¸"+e); |
| | | return R.error(); |
| | |
| | | |
| | | List<CommandInfo> commandInfos = commandInfoService.selectByTaskNo(taskNo); |
| | | return R.ok().add(commandInfos); |
| | | } |
| | | |
| | | private void auth(String appkey, Object obj, HttpServletRequest request) { |
| | | log.info("{}æ¥å£è¢«è®¿é®ï¼appkey:{}ï¼è¯·æ±æ°æ®ï¼{}", request.getServletPath(), appkey, JSON.toJSONString(obj)); |
| | | request.setAttribute("cache", obj); |
| | | if (Cools.isEmpty(appkey)) { |
| | | throw new CoolException("认è¯å¤±è´¥ï¼è¯·ç¡®è®¤appkeyæ 误ï¼"); |
| | | } |
| | | if (!APP_KEY_LIST.contains(appkey)) { |
| | | throw new CoolException("认è¯å¤±è´¥ï¼è¯·ç¡®è®¤appkeyæ 误ï¼"); |
| | | } |
| | | } |
| | | |
| | | //ä»»å¡ä¸åæ¥å£ |
| | |
| | | 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.dto.NotifyCustomDataDto; |
| | | import com.zy.asrs.domain.enums.NotifyMsgType; |
| | | 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.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.utils.NotifyUtils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | |
| | | @Autowired |
| | | private TaskWrkService taskWrkService; |
| | | |
| | | @Autowired |
| | | private CommandInfoService commandInfoService; |
| | | |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | @Value("${wms.TaskExecCallback}") |
| | | private String TaskExecCallback; |
| | | |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | @Autowired |
| | | private NotifyUtils notifyUtils; |
| | | |
| | | @RequestMapping(value = "/taskWrk/{wrkNo}/auth") |
| | | @ManagerAuth |
| | |
| | | if (Cools.isEmpty(taskWrk) || taskWrk.getStatus()>=3){ |
| | | return R.error("å·²å®ç»æå·²åæ¶") ; |
| | | } |
| | | LocMast locMast=new LocMast(); |
| | | LocMast locMast = new LocMast(); |
| | | if(taskWrk.getIoType()==1){//å
¥åºä»»å¡å®æåºä½ä¸ºF |
| | | locMast=locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("æ²¡ææ¾å°è¯¥åºä½") ; |
| | | } |
| | |
| | | locMast.setModiTime(new Date()); |
| | | locMast.setBarcode(taskWrk.getBarcode()); |
| | | }else if(taskWrk.getIoType()==2){//åºåºä»»å¡å®æåºä½ä¸ºO |
| | | locMast=locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | 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()); |
| | | locMast = locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | if(Cools.isEmpty(locMast)){ |
| | | R.error("æ²¡ææ¾å°è¯¥åºä½") ; |
| | | } |
| | |
| | | locMast.setBarcode(taskWrk.getBarcode()); |
| | | |
| | | } |
| | | String response=""; |
| | | try{ |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("TaskNo",taskWrk.getTaskNo()); |
| | | headParam.put("Result",1); |
| | | // headParam.put("reportTime",new Date()); |
| | | log.info("wcsæå¨å®æä»»å¡ä¸æ¥wms={}", taskWrk); |
| | | response = new HttpHandler.Builder() |
| | | // .setHeaders(headParam) |
| | | .setUri(wmsUrl) |
| | | .setPath(TaskExecCallback) |
| | | .setJson(JSON.toJSONString(headParam)) |
| | | .build() |
| | | .doPost(); |
| | | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | apiLogService.save("wcsæå¨å®æä»»å¡ä¸æ¥wms" |
| | | ,wmsUrl+TaskExecCallback |
| | | ,null |
| | | ,"127.0.0.1" |
| | | ,JSON.toJSONString(headParam) |
| | | ,response |
| | | ,true |
| | | ); |
| | | }catch (Exception e){ |
| | | log.error("wcsæå¨å®æä»»å¡ä¸æ¥wms失{},è¿åå¼={}", taskWrk,response); |
| | | // throw new CoolException(e); |
| | | } |
| | | locMastService.updateById(locMast); |
| | | taskWrk.setStatus(7);//æå¨å®æä»»å¡ |
| | | taskWrk.setModiTime(new Date()); |
| | |
| | | }catch (Exception e){ |
| | | taskWrk.setModiUser(9999L);//æä½å |
| | | } |
| | | String response=""; |
| | | try{ |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("TaskNo",taskWrk.getTaskNo()); |
| | | headParam.put("Result",0); |
| | | // headParam.put("reportTime",new Date()); |
| | | |
| | | log.info("wcsæå¨åæ¶ä»»å¡ä¸æ¥wm={}", taskWrk); |
| | | response = new HttpHandler.Builder() |
| | | // .setHeaders(headParam) |
| | | .setUri(wmsUrl) |
| | | .setPath(TaskExecCallback) |
| | | .setJson(JSON.toJSONString(headParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | apiLogService.save("wcsæå¨åæ¶ä»»å¡ä¸æ¥wms" |
| | | ,wmsUrl+TaskExecCallback |
| | | ,null |
| | | ,"127.0.0.1" |
| | | ,JSON.toJSONString(headParam) |
| | | ,response |
| | | ,true |
| | | ); |
| | | }catch (Exception e){ |
| | | log.error("wcsæå¨åæ¶ä»»å¡ä¸æ¥wms失败={},è¿åå¼={}", taskWrk,response); |
| | | // throw new CoolException(e); |
| | | } |
| | | taskWrk.setCompleteTime(now);//å®ç»æ¶é´ |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.service.WorkService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private WorkService workService; |
| | | |
| | | @RequestMapping("/hand/control/wrkMast") |
| | | @ManagerAuth(memo = "æå¨å¤ç工使¡£") |
| | | public R handControlWrkMast(@RequestParam String workNo, |
| | | @RequestParam Integer type){ |
| | | if (type == 1) { |
| | | workService.completeWrkMast(workNo, getUserId()); |
| | | return R.ok("ä»»å¡å·²å®æ"); |
| | | } else if (type == 2) { |
| | | workService.cancelWrkMast(workNo, getUserId()); |
| | | return R.ok("ä»»å¡å·²åæ¶"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.domain.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class NotifyCustomDataDto { |
| | | |
| | | private String uri; |
| | | |
| | | private String path; |
| | | |
| | | private String data; |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.domain.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class NotifyDto { |
| | | |
| | | private Long id; |
| | | |
| | | //éç¥ç±»å |
| | | private String notifyType; |
| | | |
| | | //设å¤å· |
| | | private Integer device; |
| | | |
| | | //å·¥ä½å· |
| | | private String taskNo; |
| | | |
| | | //ä¸çº§ç³»ç»å·¥ä½å· |
| | | private String superTaskNo; |
| | | |
| | | //æ¶æ¯ç±»å |
| | | private String msgType; |
| | | |
| | | //æ¶æ¯æè¿° |
| | | private String msgDesc; |
| | | |
| | | //æ¶æ¯æ°æ® |
| | | private String data; |
| | | |
| | | //åéèªå®ä¹æ¶æ¯æ°æ®ï¼é»è®¤æ åæ ¼å¼ |
| | | private Boolean sendCustomData = false; |
| | | |
| | | //èªå®ä¹æ¶æ¯æ°æ®æ ¼å¼ |
| | | private NotifyCustomDataDto customData; |
| | | |
| | | //失败éè¯æ¬¡æ° |
| | | private Integer failTimes = 3; |
| | | |
| | | //éè¯æ¬¡æ° |
| | | private Integer retryTimes = 0; |
| | | |
| | | //éè¯é´éé»è®¤30s |
| | | private Integer retryTime = 30; |
| | | |
| | | //䏿¬¡éè¯æ¶é´ |
| | | private Long lastRetryTime = 0L; |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.domain.enums; |
| | | |
| | | public enum NotifyMsgType { |
| | | //ä»»å¡ |
| | | TASK_COMPLETE("task_complete", "ä»»å¡å®æ"), |
| | | TASK_CANCEL("task_cancel", "ä»»å¡åæ¶"), |
| | | ; |
| | | |
| | | public String flag; |
| | | public String desc; |
| | | |
| | | NotifyMsgType(String flag, String desc) { |
| | | this.flag = flag; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public static NotifyMsgType get(String flag) { |
| | | if (null == flag) { |
| | | return null; |
| | | } |
| | | for (NotifyMsgType type : NotifyMsgType.values()) { |
| | | if (type.flag.equals(flag)) { |
| | | return type; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static NotifyMsgType get(NotifyMsgType type) { |
| | | if (null == type) { |
| | | return null; |
| | | } |
| | | for (NotifyMsgType type2 : NotifyMsgType.values()) { |
| | | if (type2 == type) { |
| | | return type2; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.domain.enums; |
| | | |
| | | public enum RedisKeyType { |
| | | |
| | | QUEUE_TASK("queue_task_"), |
| | | ; |
| | | |
| | | public String key; |
| | | |
| | | RedisKeyType(String key) { |
| | | this.key = key; |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.entity.param; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class TaskCreateInParam { |
| | | |
| | | //ä»»å¡å· |
| | | private String taskNo; |
| | | |
| | | //ä»»å¡ç±»å |
| | | private Integer ioType; |
| | | |
| | | //ä¼å
级 |
| | | private Integer taskPriority; |
| | | |
| | | //ç»ç¹ |
| | | private String targetPoint; |
| | | |
| | | //æ¯å¦ç©ºæç Y:æ¯ Nï¼å¦ |
| | | private String emptyContainer; |
| | | |
| | | //æ¡ç |
| | | private String barcode; |
| | | |
| | | //夿³¨ |
| | | private String memo; |
| | | |
| | | //å åæº |
| | | private Integer crn; |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.entity.param; |
| | | |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.zy.asrs.entity.param.TaskCreateInParam; |
| | | import com.zy.asrs.entity.param.TaskCreateParam; |
| | | import java.util.HashMap; |
| | | |
| | |
| | | //åå»ºä»»å¡ |
| | | HashMap<String,Object> taskCreate(TaskCreateParam param); |
| | | |
| | | HashMap<String,Object> taskCreateIn(TaskCreateInParam param); |
| | | |
| | | } |
| | |
| | | |
| | | public interface WorkService { |
| | | |
| | | /** |
| | | * æå¨å®æå·¥ä½æ¡£ |
| | | */ |
| | | void completeWrkMast(String workNo, Long userId); |
| | | |
| | | /** |
| | | * æå¨åæ¶å·¥ä½æ¡£ |
| | | */ |
| | | void cancelWrkMast(String workNo, Long userId); |
| | | |
| | | } |
| | |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.domain.enums.WorkNoType; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.TaskCreateInParam; |
| | | import com.zy.asrs.entity.param.TaskCreateParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | |
| | | if (param.getIoType() == 1) { |
| | | taskWrk.setWrkSts(1); |
| | | if (!Cools.isEmpty(param.getTargetPoint())) { |
| | | taskWrk.setTargetPoint(Utils.getWcsLocNo(param.getTargetPoint()));//ç»ç¹ |
| | | taskWrk.setTargetPoint(param.getTargetPoint());//ç»ç¹ |
| | | taskWrk.setOriginTargetPoint(param.getTargetPoint()); |
| | | } |
| | | |
| | |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public HashMap<String, Object> taskCreateIn(TaskCreateInParam param) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo()); |
| | | if (taskWrk != null) { |
| | | map.put("Code","0"); |
| | | map.put("Msg", param.getTaskNo() + "ä»»å¡å·²ç»çæï¼"); |
| | | return map; |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | taskWrk = new TaskWrk(); |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", param.getTargetPoint())); |
| | | int workNo1 = commonService.getWorkNo(WorkNoType.PAKIN.type);//è·åå
¥åºå·¥ä½å· |
| | | taskWrk.setTaskNo(param.getTaskNo());//ä»»å¡å· |
| | | taskWrk.setWrkNo(workNo1); |
| | | taskWrk.setStatus(TaskStatusType.RECEIVE.id);//ä»»å¡ç¶æï¼æ¥æ¶ |
| | | taskWrk.setCreateTime(now); |
| | | taskWrk.setIoType(param.getIoType());//ä»»å¡ç±»å |
| | | taskWrk.setIoPri(param.getTaskPriority());//ä¼å
级 |
| | | taskWrk.setBarcode(param.getBarcode());//æ¡ç |
| | | taskWrk.setCrnNo(locMast.getCrnNo()); |
| | | taskWrk.setWrkSts(1); |
| | | taskWrk.setTargetPoint(param.getTargetPoint());//ç»ç¹ |
| | | taskWrk.setOriginTargetPoint(param.getTargetPoint()); |
| | | if (!Cools.isEmpty(param.getMemo())) { |
| | | taskWrk.setMemo(param.getMemo());//夿³¨ |
| | | } |
| | | |
| | | if (!taskWrkService.insert(taskWrk)) { |
| | | map.put("Code", "0"); |
| | | map.put("Msg", param.getTaskNo() + "å建任å¡å¤±è´¥ï¼"); |
| | | return map; |
| | | } |
| | | map.put("Code","1"); |
| | | map.put("Msg","ok"); |
| | | return map; |
| | | } |
| | | } |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.concurrent.TimeUnit; |
| | | import com.zy.asrs.service.WorkService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class WorkServiceImpl implements WorkService { |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private WrkMastLogService wrkMastLogService; |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | @Value("${wms.inboundTaskApplyPath}") |
| | | private String inboundTaskApplyPath; |
| | | @Value("${wms.movePath}") |
| | | private String movePath; |
| | | @Value("${wms.taskStatusFeedbackPath}") |
| | | private String taskStatusFeedbackPath; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void completeWrkMast(String workNo, Long userId) { |
| | | WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | if (Cools.isEmpty(wrkMast)) { |
| | | throw new CoolException(workNo + "工使¡£ä¸åå¨"); |
| | | } |
| | | if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 14) { |
| | | throw new CoolException("å½å工使¡£å·²å®æ"); |
| | | } |
| | | // å
¥åº + åºä½è½¬ç§» |
| | | if (wrkMast.getWrkSts() < 4 || (wrkMast.getWrkSts() > 10 && wrkMast.getIoType() == 11)) { |
| | | wrkMast.setWrkSts(4L); |
| | | // åºåº |
| | | } else if (wrkMast.getWrkSts() > 10) { |
| | | wrkMast.setWrkSts(14L); |
| | | } |
| | | Date now = new Date(); |
| | | wrkMast.setCrnStrTime(DateUtils.calculate(now, 1L, TimeUnit.SECONDS, true)); |
| | | wrkMast.setCrnEndTime(now); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setModiUser(userId); |
| | | // 宿æä½äººåè®°å½ |
| | | wrkMast.setManuType("æå¨å®æ"); |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("ä¿®æ¹å·¥ä½æ¡£å¤±è´¥"); |
| | | } |
| | | |
| | | HashMap<String,Object> headParam = new HashMap<>(); |
| | | headParam.put("TaskNo",wrkMast.getTaskNo()); |
| | | headParam.put("Result",0);//宿 |
| | | |
| | | try { |
| | | String response; |
| | | log.error("wcsæå¨å®ç»ä»»å¡ä¸æ¥wms={}", wrkMast); |
| | | |
| | | response = new HttpHandler.Builder() |
| | | // .setHeaders(headParam) |
| | | .setUri(wmsUrl) |
| | | .setPath(taskStatusFeedbackPath) |
| | | .setJson(JSON.toJSONString(headParam)) |
| | | .build() |
| | | .doPost(); |
| | | apiLogService.save("wcsæå¨å®æä»»å¡ä¸æ¥wms" |
| | | , wmsUrl + taskStatusFeedbackPath |
| | | , null |
| | | , "127.0.0.1" |
| | | , JSON.toJSONString(headParam) |
| | | , response |
| | | , true |
| | | ); |
| | | } catch (Exception e) { |
| | | log.error("wcsæå¨å®ç»ä»»å¡ä¸æ¥wms失败={}", wrkMast); |
| | | log.error("wcsæå¨å®ç»ä»»å¡ä¸æ¥wms失败,æ¥éä¿¡æ¯ï¼", e); |
| | | // throw new CoolException("wcsæ´¾åå
¥åºä»»å¡ä¸æ¥wms失败"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void cancelWrkMast(String workNo, Long userId) { |
| | | Date now = new Date(); |
| | | WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | |
| | | String locNo = ""; // å¾
ä¿®æ¹ç®æ åºä½ |
| | | String locSts = ""; // å¾
ä¿®æ¹ç®æ åºä½ç¶æ |
| | | // å
¥åºåæ¶ï¼ä¿®æ¹ç®æ åºä½ï¼ |
| | | if (wrkMast.getWrkSts() < 4) { |
| | | locNo = wrkMast.getLocNo(); |
| | | locSts = "O"; |
| | | |
| | | // åºä½è½¬ç§» |
| | | if (wrkMast.getIoType() == 11) { |
| | | // åºä½è½¬ç§»ï¼æºåºä½ |
| | | LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("åæ¶åºä½è½¬ç§»å¤±è´¥ï¼æºåºä½ä¸åå¨:" + wrkMast.getSourceLocNo()); |
| | | } |
| | | locMast.setLocSts(wrkMast.getFullPlt().equalsIgnoreCase("N") ? "D" : "F"); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(userId); |
| | | locMastService.updateById(locMast); |
| | | } |
| | | // åºåºåæ¶ï¼ä¿®æ¹æºåºä½ï¼ |
| | | } else if (wrkMast.getWrkSts() > 10 && wrkMast.getWrkSts() != 14) { |
| | | locNo = wrkMast.getSourceLocNo(); |
| | | // åºåº ===>> F.å¨åº |
| | | if (wrkMast.getIoType() > 100 && wrkMast.getIoType() != 110) { |
| | | locSts = "F"; |
| | | // 空æ¿åºåº ===>> D.空桶/ç©ºæ æ¿ |
| | | } else if (wrkMast.getIoType() == 110) { |
| | | locSts = "D"; |
| | | // åºä½è½¬ç§» ===>> D.空桶/ç©ºæ æ¿ |
| | | } else if (wrkMast.getIoType() == 11) { |
| | | locSts = wrkMast.getFullPlt().equalsIgnoreCase("N") ? "D" : "F"; |
| | | // åºä½è½¬ç§»ï¼ç®æ åºä½ |
| | | LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("åæ¶åºä½è½¬ç§»å¤±è´¥ï¼ç®æ åºä½ä¸åå¨:" + wrkMast.getSourceLocNo()); |
| | | } |
| | | locMast.setLocSts("O"); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(userId); |
| | | locMastService.updateById(locMast); |
| | | } |
| | | } else { |
| | | throw new CoolException("å½åå·¥ä½ç¶ææ æ³åæ¶"); |
| | | } |
| | | // åæ¶æä½äººåè®°å½ |
| | | wrkMast.setManuType("æå¨åæ¶"); |
| | | wrkMast.setModiUser(userId); |
| | | wrkMast.setModiTime(now); |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("åæ¶ä»»å¡å¤±è´¥"); |
| | | } |
| | | // ä¿åå·¥ä½ä¸»æ¡£å岿¡£ |
| | | if (!wrkMastLogService.save(wrkMast.getWrkNo())) { |
| | | throw new CoolException("ä¿åä»»å¡å岿¡£å¤±è´¥, workNo = " + wrkMast.getWrkNo()); |
| | | } |
| | | |
| | | // å é¤å·¥ä½ä¸»æ¡£ |
| | | boolean wrkMastRes = wrkMastService.deleteById(wrkMast); |
| | | |
| | | // ä¿®æ¹åºä½ç¶æ |
| | | LocMast locMast = locMastService.selectById(locNo); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("åæ¶ä»»å¡å¤±è´¥ï¼åºä½ä¸åå¨:" + locNo); |
| | | } |
| | | locMast.setLocSts(locSts); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(userId); |
| | | boolean locMastRes = locMastService.updateById(locMast); |
| | | if (!wrkMastRes || !locMastRes) { |
| | | throw new CoolException("ä¿åæ°æ®å¤±è´¥"); |
| | | } |
| | | HashMap<String,Object> headParam = new HashMap<>(); |
| | | headParam.put("TaskNo",wrkMast.getTaskNo()); |
| | | headParam.put("Result",1);//åæ¶ |
| | | |
| | | try { |
| | | String response; |
| | | log.error("wcsæå¨åæ¶ä»»å¡ä¸æ¥wms={}", wrkMast); |
| | | |
| | | response = new HttpHandler.Builder() |
| | | // .setHeaders(headParam) |
| | | .setUri(wmsUrl) |
| | | .setPath(taskStatusFeedbackPath) |
| | | .setJson(JSON.toJSONString(headParam)) |
| | | .build() |
| | | .doPost(); |
| | | apiLogService.save("wcsæå¨åæ¶ä»»å¡ä¸æ¥wms" |
| | | , wmsUrl + taskStatusFeedbackPath |
| | | , null |
| | | , "127.0.0.1" |
| | | , JSON.toJSONString(headParam) |
| | | , response |
| | | , true |
| | | ); |
| | | } catch (Exception e) { |
| | | log.error("wcsæå¨åæ¶ä»»å¡ä¸æ¥wms失败={}", wrkMast); |
| | | log.error("wcsæå¨åæ¶ä»»å¡ä¸æ¥wms失败,æ¥éä¿¡æ¯ï¼", e); |
| | | // throw new CoolException("wcsæ´¾åå
¥åºä»»å¡ä¸æ¥wms失败"); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.asrs.domain.dto.NotifyCustomDataDto; |
| | | import com.zy.asrs.domain.dto.NotifyDto; |
| | | import com.zy.asrs.entity.ApiLog; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.utils.NotifyUtils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class NotifyScheduler { |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private NotifyUtils notifyUtils; |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public synchronized void notifyTask(){ |
| | | notifyMsg("task", 1); |
| | | } |
| | | |
| | | private synchronized void notifyMsg(String notifyType, Integer device) { |
| | | Config notifyEnableConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyEnable")); |
| | | if(notifyEnableConfig == null){ |
| | | return; |
| | | } |
| | | String notifyEnable = notifyEnableConfig.getValue(); |
| | | if (!notifyEnable.equals("Y")) { |
| | | return; |
| | | } |
| | | |
| | | Config notifyUriConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyUri")); |
| | | if(notifyUriConfig == null){ |
| | | return; |
| | | } |
| | | String notifyUri = notifyUriConfig.getValue(); |
| | | |
| | | Config notifyUriPathConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyUriPath")); |
| | | if(notifyUriPathConfig == null){ |
| | | return; |
| | | } |
| | | String notifyUriPath = notifyUriPathConfig.getValue(); |
| | | |
| | | List<String> keys = notifyUtils.takeKeys(notifyType, device); |
| | | if(keys == null){ |
| | | return; |
| | | } |
| | | |
| | | if (keys.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | for (String key : keys) { |
| | | Object object = redisUtil.get(key); |
| | | if (object == null) { |
| | | continue; |
| | | } |
| | | NotifyDto notifyDto = (NotifyDto) object; |
| | | |
| | | if (System.currentTimeMillis() - notifyDto.getLastRetryTime() < 1000 * notifyDto.getRetryTime()) { |
| | | continue; |
| | | } |
| | | |
| | | ApiLog apiLog = new ApiLog(); |
| | | |
| | | try { |
| | | //触åéç¥ |
| | | String response = null; |
| | | if (notifyDto.getSendCustomData()) { |
| | | //èªå®ä¹æ¶æ¯æ ¼å¼ |
| | | NotifyCustomDataDto customData = notifyDto.getCustomData(); |
| | | response = new HttpHandler.Builder() |
| | | .setUri(customData.getUri()) |
| | | .setPath(customData.getPath()) |
| | | .setJson(customData.getData()) |
| | | .build() |
| | | .doPost(); |
| | | |
| | | apiLog.setUrl(customData.getUri() + customData.getPath()); |
| | | apiLog.setRequest(customData.getData()); |
| | | apiLog.setCreateTime(new Date()); |
| | | }else { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(notifyUri) |
| | | .setPath(notifyUriPath) |
| | | .setJson(JSON.toJSONString(notifyDto)) |
| | | .build() |
| | | .doPost(); |
| | | |
| | | apiLog.setUrl(notifyUri + notifyUriPath); |
| | | apiLog.setRequest(JSON.toJSONString(notifyDto)); |
| | | apiLog.setCreateTime(new Date()); |
| | | } |
| | | |
| | | apiLog.setResponse(response); |
| | | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if(code == 200){ |
| | | //éç¥æå |
| | | redisUtil.del(key); |
| | | |
| | | continue; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | }finally { |
| | | //ä¿åè®°å½ |
| | | apiLogService.insert(apiLog); |
| | | } |
| | | |
| | | //éç¥å¤±è´¥ |
| | | int times = notifyDto.getRetryTimes() + 1; |
| | | if (times >= notifyDto.getFailTimes()) { |
| | | //è¶
è¿æ¬¡æ° |
| | | redisUtil.del(key); |
| | | continue; |
| | | } |
| | | |
| | | notifyDto.setLastRetryTime(System.currentTimeMillis()); |
| | | notifyDto.setRetryTimes(times); |
| | | redisUtil.set(key, notifyDto); |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.dto.NotifyCustomDataDto; |
| | | import com.zy.asrs.domain.enums.NotifyMsgType; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.TaskOverToWms; |
| | | import com.zy.asrs.entity.param.TaskStatusFeedbackParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.TaskWrkLogServiceImpl; |
| | | import com.zy.asrs.utils.PostMesDataUtils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.asrs.utils.NotifyUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 宿¶å°ä»»å¡(宿ãåæ¶)è½¬ææ¥å¿ |
| | |
| | | |
| | | @Autowired |
| | | private TaskWrkService taskWrkService; |
| | | @Autowired |
| | | private CommandInfoService commandInfoService; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private TaskWrkLogServiceImpl wrkLogService; |
| | | |
| | |
| | | private String TaskExecCallback; |
| | | @Value("${wms.taskStatusFeedbackPath}") |
| | | private String taskStatusFeedbackPath; |
| | | @Autowired |
| | | private NotifyUtils notifyUtils; |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public void execute() throws IOException { |
| | | |
| | | for (TaskWrk taskWrk : taskWrkService.selectToBeHistoryData()) { |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("TaskNo", taskWrk.getTaskNo()); |
| | | if (taskWrk.getStatus().equals(TaskStatusType.OVER.id) || taskWrk.getStatus() == 7) {//宿 |
| | | headParam.put("Result", 1); |
| | | headParam.put("Result", 1);//宿 |
| | | } else if (taskWrk.getStatus().equals(TaskStatusType.CANCEL.id)) { |
| | | headParam.put("Result", 2); |
| | | headParam.put("Result", 2);//åæ¶ |
| | | } |
| | | String response = ""; |
| | | Boolean bool = false; |
| | | try { |
| | | headParam.put("TaskNo", taskWrk.getTaskNo()); |
| | | log.info("wcsæå¨å®æä»»å¡ä¸æ¥wms={}", taskWrk); |
| | | response = new HttpHandler.Builder() |
| | | // .setHeaders(headParam) |
| | | .setUri(wmsUrl) |
| | | .setPath(TaskExecCallback) |
| | | .setJson(JSON.toJSONString(headParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | TaskWrkLog taskWrkLog = new TaskWrkLog(taskWrk); |
| | | if (!wrkLogService.insert(taskWrkLog)) { |
| | | throw new CoolException("转å岿¡£å¤±è´¥" + taskWrkLog); |
| | | } |
| | | if (!taskWrkService.deleteById(taskWrk)) { |
| | | throw new CoolException("任塿¡£å é¤å¤±è´¥" + taskWrkLog); |
| | | } |
| | | bool = true; |
| | | } catch (Exception e) { |
| | | log.error("wcsæå¨å®æä»»å¡ä¸æ¥wms失败{},è¿åå¼={}", taskWrk, response); |
| | | } finally { |
| | | apiLogService.save("wcs宿æè
åæ¶ä»»å¡ä¸æ¥wms" |
| | | , wmsUrl + TaskExecCallback |
| | | , null |
| | | , "127.0.0.1" |
| | | , JSON.toJSONString(headParam) |
| | | , response |
| | | , bool |
| | | ); |
| | | |
| | | NotifyCustomDataDto customDataDto = new NotifyCustomDataDto(); |
| | | customDataDto.setUri(wmsUrl); |
| | | customDataDto.setPath(TaskExecCallback); |
| | | customDataDto.setData(JSON.toJSONString(headParam)); |
| | | notifyUtils.notify("task", 1, String.valueOf(taskWrk.getWrkNo()), taskWrk.getTaskNo(), NotifyMsgType.TASK_COMPLETE, JSON.toJSONString(taskWrk), true, customDataDto); |
| | | |
| | | TaskWrkLog taskWrkLog = new TaskWrkLog(taskWrk); |
| | | if (!wrkLogService.insert(taskWrkLog)) { |
| | | throw new CoolException("转å岿¡£å¤±è´¥" + taskWrkLog); |
| | | } |
| | | if (!taskWrkService.deleteById(taskWrk)) { |
| | | throw new CoolException("任塿¡£å é¤å¤±è´¥" + taskWrkLog); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.utils; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.zy.asrs.domain.dto.NotifyCustomDataDto; |
| | | import com.zy.asrs.domain.dto.NotifyDto; |
| | | import com.zy.asrs.domain.enums.NotifyMsgType; |
| | | import com.zy.asrs.domain.enums.RedisKeyType; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | @Component |
| | | public class NotifyUtils { |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | |
| | | public synchronized boolean notify(String notifyType, Integer device, String taskNo, String superTaskNo, NotifyMsgType msgType) { |
| | | return append(notifyType, device, taskNo, superTaskNo, msgType, null, false, null); |
| | | } |
| | | |
| | | public synchronized boolean notify(String notifyType, Integer device, String taskNo, String superTaskNo, NotifyMsgType msgType, String data, Boolean sendCustomData, NotifyCustomDataDto customData) { |
| | | return append(notifyType, device, taskNo, superTaskNo, msgType, data, sendCustomData, customData); |
| | | } |
| | | |
| | | public synchronized List<String> takeKeys(String notifyType, Integer device) { |
| | | String key = getKey(notifyType, device); |
| | | if(key == null){ |
| | | return null; |
| | | } |
| | | |
| | | Set keys = redisUtil.keys(key + "*"); |
| | | if (keys == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | for (Object object : keys) { |
| | | list.add(object.toString()); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public String getKey(String notifyType, Integer device) { |
| | | String key = null; |
| | | if (notifyType.equals("task")) { |
| | | key = RedisKeyType.QUEUE_TASK.key + device; |
| | | } else { |
| | | return null; |
| | | } |
| | | |
| | | return key; |
| | | } |
| | | |
| | | private boolean append(String notifyType, Integer device, String taskNo, String superTaskNo, NotifyMsgType msgType, String data, Boolean sendCustomData, NotifyCustomDataDto customData) { |
| | | String key = getKey(notifyType, device); |
| | | if (key == null) { |
| | | return false; |
| | | } |
| | | |
| | | NotifyDto dto = new NotifyDto(); |
| | | dto.setId(snowflakeIdWorker.nextId()); |
| | | dto.setNotifyType(notifyType); |
| | | dto.setDevice(device); |
| | | dto.setMsgType(msgType.flag); |
| | | dto.setMsgDesc(msgType.desc); |
| | | dto.setData(data); |
| | | dto.setTaskNo(taskNo); |
| | | dto.setSuperTaskNo(superTaskNo); |
| | | dto.setSendCustomData(sendCustomData); |
| | | dto.setCustomData(customData); |
| | | |
| | | //éè¯æ¬¡æ° |
| | | Config notifyFailTimesConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyFailTimes")); |
| | | if (notifyFailTimesConfig != null) { |
| | | dto.setFailTimes(Integer.parseInt(notifyFailTimesConfig.getValue())); |
| | | } |
| | | |
| | | //éè¯é´é |
| | | Config notifyRetryTimeConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyRetryTime")); |
| | | if (notifyRetryTimeConfig != null) { |
| | | dto.setRetryTime(Integer.parseInt(notifyRetryTimeConfig.getValue())); |
| | | } |
| | | |
| | | redisUtil.set(key + "_" + dto.getId(), dto); |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | return crnNo == 1 ? s : 3 - s; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //转æ¢wmsä¼ è¾çåºä½å· |
| | | public static String getWcsLocNo(String locNo){ |
| | | String[] split = locNo.split("-"); |
| | | int[] wcsRow = getWcsRow(split[0]); |
| | | int[] ints = null; |
| | | if (split[3].equals("01")){ |
| | | ints = Arrays.copyOfRange(wcsRow, 0, (wcsRow.length+2-1) / 2); |
| | | if (split[4].equals("01")){ |
| | | if (ints.length<2){ |
| | | |
| | | }else { |
| | | ints = Arrays.copyOfRange(ints, ints.length / 2, ints.length); |
| | | } |
| | | }else { |
| | | if (ints.length<2){ |
| | | |
| | | }else { |
| | | ints = Arrays.copyOfRange(ints, ints.length / 2-1,ints.length-1); |
| | | } |
| | | } |
| | | }else { |
| | | ints = Arrays.copyOfRange(wcsRow, (wcsRow.length+2-1) / 2,wcsRow.length ); |
| | | if (split[4].equals("01")){ |
| | | if (ints.length<2){ |
| | | |
| | | }else { |
| | | ints = Arrays.copyOfRange(ints, ints.length / 2-1,ints.length-1); |
| | | } |
| | | }else { |
| | | if (ints.length<2){ |
| | | |
| | | }else { |
| | | ints = Arrays.copyOfRange(ints, ints.length / 2, ints.length); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | int i = ints[0]; |
| | | String wcsLocNo = ""; |
| | | Integer bay = Integer.parseInt(split[1])+1; |
| | | String bay2 = ""; |
| | | if (bay>9){ |
| | | bay2 = bay.toString(); |
| | | }else { |
| | | bay2 = "0"+bay; |
| | | } |
| | | if (i>9){ |
| | | wcsLocNo = i+"0"+bay2+split[2]; |
| | | }else { |
| | | wcsLocNo = "0"+i+"0"+bay2+split[2]; |
| | | } |
| | | |
| | | |
| | | |
| | | return wcsLocNo; |
| | | } |
| | | public static int[] getWcsRow(String row){ |
| | | int[] array = null; |
| | | switch (row){ |
| | | case "01": |
| | | array= new int[]{1, 2, 3, 4}; |
| | | break; |
| | | case "02": |
| | | array= new int[]{5,6}; |
| | | break; |
| | | case "03": |
| | | array= new int[]{7,8,9,10}; |
| | | break; |
| | | case "04": |
| | | array= new int[]{11,12,13,14}; |
| | | break; |
| | | case "05": |
| | | array= new int[]{15,16,17,18}; |
| | | break; |
| | | case "06": |
| | | array= new int[]{19,20,21}; |
| | | break; |
| | | default: |
| | | |
| | | } |
| | | return array; |
| | | } |
| | | |
| | | public static float scale(Float f){ |
| | | if (f == null || f == 0f || Float.isNaN(f)) { |
| | | return 0f; |
| | |
| | | // slaveProperties.setGroupCount(4); |
| | | // Integer deepRow = getDeepRow(slaveProperties, 6); |
| | | // System.out.println(deepRow); |
| | | String wcsLocNo = getWcsLocNo("01-01-01-01-01"); |
| | | System.out.println(wcsLocNo); |
| | | } |
| | | |
| | | public static Integer StaNoCrnNo(Integer staNo) { |
| | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.cache.annotation.CachingConfigurerSupport; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| | | import org.springframework.data.redis.core.*; |
| | | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; |
| | |
| | | * Redisé
置类 |
| | | * Created by vincent on 2019-12-23 |
| | | */ |
| | | //@Configuration |
| | | @Configuration |
| | | //@EnableCaching // å¼å¯æ°æ®ç¼åæºå¶ |
| | | public class RedisConfig extends CachingConfigurerSupport { |
| | | |
| | |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | // é¢ç |
| | | private int i = 0; |
| | | |
| | | @Value("${wms.maxCirle}") |
| | | private Integer maxCount; |
| | | |
| | | /** |
| | | * =====>> å¼å§å·¥ä½ |
| | | */ |
| | |
| | | name: @pom.build.finalName@ |
| | | datasource: |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | url: jdbc:sqlserver://192.168.4.42:1433;databasename=czbrasrs |
| | | url: jdbc:sqlserver://192.168.4.42:1433;databasename=ynhfasrs |
| | | username: sa |
| | | password: sa@123 |
| | | mvc: |
| | |
| | | wms: |
| | | #è¾é线æåæ° |
| | | count: 8 |
| | | maxCirle: 3 |
| | | # æ¯å¦å¼å¯ä¸æ¥ |
| | | start: true |
| | | # WMSç³»ç»ip |
| | | #url: 10.32.53.195:8080 |
| | | # WMSç³»ç»ip |
| | | # url: 10.210.157.109:8090 |
| | | url: 10.10.10.222:2410 |
| | | # å
¥åºä»»å¡ç³è¯·æ¥å£ |
| | | #inboundTaskApplyPath: api/InterFace/inboundTaskApply |
| | | inboundTaskApplyPath: api/StereoscopicCallBack/AcceptTaskStatus |
| | | # inboundTaskApplyPath: open/asrs/inboundTaskApply |
| | | # ä»»å¡å¼å§æ¶ï¼WCSåè°WMS |
| | | taskStatusFeedbackPath: api/StereoscopicCallBack/TaskExecCallback |
| | | # ä»»å¡å®æç»ææ¶ï¼WCSåè°WMS |