| | |
| | | import javax.annotation.Resource;
|
| | | import java.util.*;
|
| | | import java.util.stream.Collectors;
|
| | | import java.util.stream.DoubleStream;
|
| | |
|
| | | @Slf4j
|
| | | @Service
|
| | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public R slapLightLogic(Map<String, Object> request) {
|
| | | List<String> taskNos = (List<String>)request.get("taskNo");
|
| | | String taskNo = request.get("taskNo").toString();
|
| | | String orderNo = request.get("orderNo").toString();
|
| | | String siteNo = Objects.isNull(request.get("siteNo")) ? null : request.get("siteNo").toString();
|
| | | List<CacheSite> performs = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getOrderNo, orderNo));
|
| | | if (Objects.isNull(performs.stream().findFirst().get().getPlatformId())) {
|
| | | throw new CoolException("请打印明细,并绑定目标集货区");
|
| | | }
|
| | |
|
| | | //* 1. 判断当前容器是否还有物料未拣,未拣完闪灯,拣完通知容器流动,并灭灯
|
| | | SlapLightControlParam slapParam = new SlapLightControlParam();
|
| | | MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
|
| | |
|
| | | taskNos.forEach(taskNo -> {
|
| | | //判断当前任务是否还有物料未拣
|
| | | if (!checked(orderNo, taskNo)) {
|
| | | log.info("未完成闪灯请求地址:{},请求参数:{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam));
|
| | | //调用三方接口,闪灯不做操作
|
| | | // 设置请求参数
|
| | | throw new CoolException("当前任务未完成,不能执行此操作!!");
|
| | | // throw new CoolException("当前任务未完成,不能执行此操作!!");
|
| | | // params.add("params", JSONObject.toJSONString(slapParam));
|
| | | } else {
|
| | | //调用三方接口,灭灯通知容器流动, 传灭灯参数
|
| | |
| | | // }).collect(Collectors.toList());
|
| | |
|
| | | //判断数量是否与订单明细的需求量相同,相同则订单完成
|
| | |
|
| | | List<WaveSeed> seeds = waveSeedService.list(new LambdaQueryWrapper<WaveSeed>().eq(WaveSeed::getOrderNo, orderNo));
|
| | | if (Objects.isNull(seeds)) {
|
| | | throw new CoolException("数据错误:播种数据不存在!!");
|
| | | }
|
| | |
|
| | | Double tolAnfme = seeds.stream().mapToDouble(WaveSeed::getAnfme).sum();
|
| | | Double toDouble = seeds.stream().mapToDouble(WaveSeed::getWorkQty).sum();
|
| | | if (toDouble.compareTo(tolAnfme) >= 0) {
|
| | | //播种完成,释放绑定站点
|
| | | List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>()
|
| | | .eq(!Objects.isNull(siteNo), CacheSite::getSiteNo, siteNo)
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | params.add("params", JSONObject.toJSONString(slapParam));
|
| | | log.info("完成灭灯请求地址:{},请求参数:{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam));
|
| | | }
|
| | |
| | | log.error("执行异常:UNK", e);
|
| | | throw new CoolException(e.getMessage());
|
| | | }
|
| | | });
|
| | | return R.ok();
|
| | | }
|
| | |
|