| | |
| | | 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; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * Created by Monkey D. Luffy on 2025.11.10 |
| | |
| | | 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) { |
| | |
| | | |
| | | } |
| | | } |
| | | OrderInspectionRollParam orderInspectionRollParam = new OrderInspectionRollParam(orderDetl.getModel()); |
| | | // OrderInspectionRollParam orderInspectionRollParam = new OrderInspectionRollParam(orderDetl.getModel()); |
| | | String response = ""; |
| | | boolean success = false; |
| | | // Map<String, Object> params = JSON.parseObject(JSON.toJSONString(orderInspectionRollParam), Map.class); |
| | | |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("batchNo", orderDetl.getModel()); |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(MesConstant.URL) |
| | | .setPath(MesConstant.PAKIN_URL) |
| | | .setJson(JSON.toJSONString(orderInspectionRollParam)) |
| | | .setUri(qualityFinishedCheckoutUrl) |
| | | .setPath(qualityFinishedCheckout) |
| | | .setParams(params) |
| | | .setUseFormUrlEncoded(true) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | if (jsonObject.getBoolean("state")) { |
| | | String value = jsonObject.getString("value"); |
| | | if (value.equals("合格")){ |
| | | orderDetl.setDanger(1); |
| | | orderDetlPakoutService.updateById(orderDetl); |
| | | } else if (!Cools.isEmpty(orderDetl.getDanger$()) && value.equals(orderDetl.getDanger$())){ |
| | | if (Cools.isEmpty(memo)){ |
| | | memo = "卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | }else { |
| | | memo = memo+";卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | } |
| | | continue; |
| | | } else { |
| | | if (Cools.isEmpty(memo)){ |
| | | memo = "卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | }else { |
| | | memo = memo+";卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | } |
| | | if (value.equals("不合格")){ |
| | | orderDetl.setDanger(2); |
| | | orderDetlPakoutService.updateById(orderDetl); |
| | | } |
| | | continue; |
| | | if (jsonObject.getBoolean("state")) { |
| | | String value = jsonObject.getString("value"); |
| | | if (value.equals("合格")){ |
| | | orderDetl.setDanger(1); |
| | | orderDetlPakoutService.updateById(orderDetl); |
| | | } else if (!Cools.isEmpty(orderDetl.getDanger$()) && value.equals(orderDetl.getDanger$())){ |
| | | if (Cools.isEmpty(memo)){ |
| | | memo = "卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | }else { |
| | | memo = memo+";卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | } |
| | | continue; |
| | | } else { |
| | | if (Cools.isEmpty(memo)){ |
| | | memo = "卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | }else { |
| | | memo = memo+";卷号"+ orderDetl.getModel()+"查询结果:"+jsonObject.getString("message"); |
| | | } |
| | | if (value.equals("不合格")){ |
| | | orderDetl.setDanger(2); |
| | | orderDetlPakoutService.updateById(orderDetl); |
| | | } |
| | | continue; |
| | | } |
| | | success = true; |
| | | } else { |
| | |
| | | }else { |
| | | 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(params), response); |
| | | // throw new CoolException("查询卷号是否合格失败"); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "查询卷号是否合格", |
| | | MesConstant.URL + MesConstant.PAKIN_URL, |
| | | qualityFinishedCheckoutUrl+"/"+qualityFinishedCheckout, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(orderInspectionRollParam), |
| | | JSON.toJSONString(params), |
| | | response, |
| | | success |
| | | ); |