| | |
| | |
|
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
| | | import com.baomidou.mybatisplus.extension.service.IService;
|
| | | import com.zy.asrs.framework.common.R;
|
| | |
| | | orders.forEach(order -> {
|
| | | List<OrderDetl> detls = orderDetlService.list(new LambdaQueryWrapper<OrderDetl>().eq(OrderDetl::getOrderId, order.getId()));
|
| | | Double sum = detls.stream().mapToDouble(OrderDetl::getQty).sum();
|
| | | Double summed = detls.stream().mapToDouble(OrderDetl::getWorkQty).sum();
|
| | | Double v = Math.round((sum + summed) * 1000) / 1000.0;
|
| | | // Double summed = detls.stream().mapToDouble(OrderDetl::getWorkQty).sum();
|
| | | // Double v = Math.round((sum ) * 1000) / 1000.0;
|
| | | Double anfme = detls.stream().mapToDouble(OrderDetl::getAnfme).sum();
|
| | | if (v.compareTo(anfme) == 0.0) {
|
| | | if (sum.compareTo(anfme) == 0.0) {
|
| | | order.setOrderSettle(OrderSettleType.COMPLETE.val());
|
| | | if (!orderService.updateById(order)) {
|
| | | throw new CoolException("单据状态修改失败!!");
|
| | |
| | | throw new CoolException("订单播种位绑定失败!!");
|
| | | }
|
| | |
|
| | | // if (!waveSeedMapper.update(new LambdaUpdateWrapper<WaveSeed>()
|
| | | // .eq(WaveSeed::getOrderNo, order.getOrderNo())
|
| | | // .set(WaveSeed::getSiteId, siteNo.getId())
|
| | | // .set(WaveSeed::getSiteNo, siteNo.getSiteNo()))) {
|
| | | // throw new CoolException("播种站点更新失败!!");
|
| | | // }
|
| | | //绑定成功,播种墙亮灯
|
| | | sowLightMange(siteNo.getSiteNo(), order, "LIGHT");
|
| | | if (!waveSeedMapper.update(new LambdaUpdateWrapper<WaveSeed>()
|
| | | .eq(WaveSeed::getOrderNo, order.getOrderNo())
|
| | | .set(WaveSeed::getSiteId, siteNo.getId())
|
| | | .set(WaveSeed::getSiteNo, siteNo.getSiteNo()))) {
|
| | | throw new CoolException("播种站点更新失败!!");
|
| | | }
|
| | |
|
| | | } else {
|
| | | if (StringUtil.isNullOrEmpty(siteNo.getOrderNo())) {
|
| | | throw new CoolException("当前播种站点未绑定订单!!");
|
| | |
| | | }
|
| | |
|
| | | params.forEach(order -> {
|
| | | CacheSite cacheSite = cacheSiteService.getOne(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getOrderId, order.getId()));
|
| | | if (cacheSite != null) {
|
| | | cacheSite.setSiteStatus(CacheSiteStatusType.O.id);
|
| | | cacheSite.setOrderId(null);
|
| | | cacheSite.setOrderNo(null);
|
| | | cacheSite.setBarcode(null);
|
| | | cacheSite.setPlatformId(null);
|
| | | cacheSite.setPlatformNo(null);
|
| | | cacheSite.setUpdateTime(new Date());
|
| | | if (!cacheSiteService.updateById(cacheSite)) {
|
| | | throw new CoolException("缓存站清空失败");
|
| | | }
|
| | | }
|
| | |
|
| | | OrderDetl byId = orderDetlService.getById(order.getId());
|
| | | if (Objects.isNull(byId)) {
|
| | | throw new CoolException("订单明细不存在!!");
|
| | |
| | | */
|
| | | @Override
|
| | | public R getMatsByCode(String matnr) {
|
| | | return R.ok().add(matService.list(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, matnr)));
|
| | | QueryWrapper<LocDetl> wrapper = new QueryWrapper<>();
|
| | | wrapper.eq("matnr", matnr).select("matnr, SUM(anfme) anfme");
|
| | | LocDetl detl = locDetlService.getOne(wrapper);
|
| | |
|
| | | Mat one = matService.getOne(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, detl.getMatnr()), false);
|
| | | if (Objects.isNull(one)) {
|
| | | throw new CoolException("物料不存在!!");
|
| | | }
|
| | | one.setAnfme(detl.getAnfme());
|
| | | return R.ok().add(Arrays.asList(one));
|
| | | }
|
| | |
|
| | | /**
|