| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.OrderDetlPakout; |
| | | import com.zy.asrs.entity.OrderPakout; |
| | | import com.zy.asrs.entity.param.OrderCargoBookingNoteParam; |
| | | import com.zy.asrs.entity.param.OrderInspectionRollParam; |
| | | import com.zy.asrs.entity.param.OrderOutLocBoxCsUtilParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.LocMastServiceImpl; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.utils.CodeDetectionUtil; |
| | | import com.zy.asrs.utils.OrderOutBatchUtil; |
| | | import com.zy.common.constant.MesConstant; |
| | | 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; |
| | | |
| | |
| | | |
| | | /** |
| | | * Created by Monkey D. Luffy on 2025.11.10 |
| | | * 徐工汉云..............以下.............上饶江铜.............拆垛完成信息处理 |
| | | * 徐工汉云..............以下.............上饶江铜.............组货单相关 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | |
| | | private ApiLogService apiLogService; |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private LocMastServiceImpl locMastService; |
| | | |
| | | @Value("${srXghyMes.qualityFinishedCheckoutUrl}") |
| | | private String qualityFinishedCheckoutUrl; |
| | | @Value("${srXghyMes.qualityFinishedCheckout}") |
| | | private String qualityFinishedCheckout; |
| | | |
| | | @Transactional |
| | | public ReturnT<String> abandoned(OrderPakout orderPakout) { |
| | |
| | | List<OrderDetlPakout> orderDetls = orderDetlPakoutService.selectByOrderId(orderPakout.getId()); |
| | | String memo = ""; |
| | | for (OrderDetlPakout orderDetl : orderDetls) { |
| | | boolean signD = true; |
| | | if (!CodeDetectionUtil.barcodeDetection(orderDetl.getManu(),7)){ |
| | | if (Cools.isEmpty(memo)){ |
| | | memo = "无库存"; |
| | | }else { |
| | | memo = memo+";无库存"; |
| | | LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("model", orderDetl.getModel())); |
| | | if (!Cools.isEmpty(locDetl)){ |
| | | LocMast locMast = locMastService.selectById(locDetl.getLocNo()); |
| | | if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("F")){ |
| | | if (Cools.isEmpty(memo)){ |
| | | memo = "卷号"+ orderDetl.getModel()+"所在库位"+locDetl.getLocNo()+"不是在库状态"; |
| | | }else { |
| | | memo = memo+";卷号"+ orderDetl.getModel()+"所在库位"+locDetl.getLocNo()+"不是在库状态"; |
| | | } |
| | | continue; |
| | | } |
| | | signD = false; |
| | | orderDetl.sync(locDetl); |
| | | orderDetl.setManu(locDetl.getLocNo()); |
| | | orderDetl.setBarcode(locDetl.getBarcode()); |
| | | orderDetl.setDanger(locDetl.getDanger()); |
| | | orderDetl.setMemo(locDetl.getMemo()); |
| | | if (!Cools.isEmpty(locDetl.getDanger$()) && locDetl.getDanger()==1){ |
| | | orderDetl.setDanger(1); |
| | | orderDetlPakoutService.updateById(orderDetl); |
| | | continue; |
| | | } |
| | | |
| | | } else { |
| | | if (Cools.isEmpty(memo)){ |
| | | memo = "卷号"+ orderDetl.getModel()+"无库存"; |
| | | }else { |
| | | memo = memo+";卷号"+ orderDetl.getModel()+"无库存"; |
| | | } |
| | | continue; |
| | | } |
| | | continue; |
| | | } |
| | | if (Cools.isEmpty(orderDetl.getDanger$()) || orderDetl.getDanger()==1){//合格不需要检验 |
| | | continue; |
| | | if (signD){ |
| | | LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("model", orderDetl.getModel())); |
| | | if (!Cools.isEmpty(locDetl)){ |
| | | LocMast locMast = locMastService.selectById(locDetl.getLocNo()); |
| | | if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("F")){ |
| | | if (Cools.isEmpty(memo)){ |
| | | memo = "卷号"+ orderDetl.getModel()+"所在库位"+locDetl.getLocNo()+"不是在库状态"; |
| | | }else { |
| | | memo = memo+";卷号"+ orderDetl.getModel()+"所在库位"+locDetl.getLocNo()+"不是在库状态"; |
| | | } |
| | | continue; |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(orderDetl.getDanger$()) && orderDetl.getDanger()==1){//合格不需要检验 |
| | | continue; |
| | | } else { |
| | | if (!Cools.isEmpty(locDetl.getDanger$()) && locDetl.getDanger()==1){ |
| | | orderDetl.setDanger(1); |
| | | orderDetlPakoutService.updateById(orderDetl); |
| | | continue; |
| | | } |
| | | |
| | | } |
| | | } |
| | | OrderInspectionRollParam orderInspectionRollParam = new OrderInspectionRollParam(orderDetl.getModel()); |
| | | String response = ""; |
| | | boolean success = false; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(MesConstant.URL) |
| | | .setPath(MesConstant.PAKIN_URL) |
| | | .setUri(qualityFinishedCheckoutUrl) |
| | | .setPath(qualityFinishedCheckout) |
| | | .setJson(JSON.toJSONString(orderInspectionRollParam)) |
| | | .build() |
| | | .doPost(); |
| | |
| | | if (value.equals("合格")){ |
| | | orderDetl.setDanger(1); |
| | | orderDetlPakoutService.updateById(orderDetl); |
| | | } else if (value.equals(orderDetl.getDanger$())){ |
| | | } else if (!Cools.isEmpty(orderDetl.getDanger$()) && value.equals(orderDetl.getDanger$())){ |
| | | if (Cools.isEmpty(memo)){ |
| | | memo = "查询卷号结果:"+jsonObject.getString("message"); |
| | | memo = "卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | }else { |
| | | memo = memo+";查询卷号结果:"+jsonObject.getString("message"); |
| | | memo = memo+";卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | } |
| | | continue; |
| | | } else { |
| | | if (Cools.isEmpty(memo)){ |
| | | memo = "查询卷号结果:"+jsonObject.getString("message"); |
| | | memo = "卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | }else { |
| | | memo = memo+";查询卷号结果:"+jsonObject.getString("message"); |
| | | memo = memo+";卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | } |
| | | if (value.equals("不合格")){ |
| | | orderDetl.setDanger(2); |
| | |
| | | } |
| | | } else { |
| | | if (Cools.isEmpty(memo)){ |
| | | memo = "查询卷号结果:"+jsonObject.getString("message"); |
| | | memo = "卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | }else { |
| | | memo = memo+";查询卷号结果:"+jsonObject.getString("message"); |
| | | memo = memo+";卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | } |
| | | } |
| | | success = true; |
| | | } else { |
| | | if (Cools.isEmpty(memo)){ |
| | | memo = "查询卷号结果:"+jsonObject.getString("message"); |
| | | memo = "卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | }else { |
| | | memo = memo+";查询卷号结果:"+jsonObject.getString("message"); |
| | | memo = memo+";卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | } |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL+MesConstant.PAKIN_URL, JSON.toJSONString(orderInspectionRollParam), response); |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", qualityFinishedCheckoutUrl+"/"+qualityFinishedCheckout, JSON.toJSONString(orderInspectionRollParam), response); |
| | | // throw new CoolException("查询卷号是否合格失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | if (Cools.isEmpty(memo)){ |
| | | memo = "查询卷号结果:"+"异常"+e.getMessage(); |
| | | memo = "卷号"+ orderDetl.getModel()+"查询结果:"+"异常"+e.getMessage(); |
| | | }else { |
| | | memo = memo+";查询卷号结果:"+"异常"+e.getMessage(); |
| | | memo = memo+"卷号"+ orderDetl.getModel()+"查询结果:"+"异常"+e.getMessage(); |
| | | } |
| | | log.error("fail", e); |
| | | // TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "查询卷号是否合格", |
| | | MesConstant.URL + MesConstant.PAKIN_URL, |
| | | qualityFinishedCheckoutUrl+"/"+qualityFinishedCheckout, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(orderInspectionRollParam), |