自动化立体仓库 - WMS系统
#
lsh
2024-12-16 ddb9f9d61b9125651c08fc460b5e499950531f24
src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
@@ -14,6 +14,7 @@
import com.zy.asrs.service.OrderService;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.utils.OrderInAndOutUtil;
import com.zy.common.constant.MesConstant;
import com.zy.common.model.MesPakinParam;
import com.zy.common.model.MesPakoutParam;
@@ -50,7 +51,8 @@
        if (null == docType) {
            return SUCCESS;
        }
        List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId());
//        List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId());
        List<OrderDetl> orderDetls = OrderInAndOutUtil.selectByOrderId(order.getPakinPakoutStatus$(), order.getId());
        // 入库完成上报
        if (docType.getPakin() == 1) {
            MesPakinParam pakinParam = new MesPakinParam();
@@ -74,9 +76,10 @@
                if (jsonObject.getInteger("code").equals(200)) {
                    success = true;
                    // 修改订单状态 4.完成 ===>> 6.已上报
                    if (!orderService.updateSettle(order.getId(), 6L, null)) {
                        throw new CoolException("服务器内部错误,请联系管理员");
                    }
//                    if (!orderService.updateSettle(order.getId(), 6L, null)) {
//                        throw new CoolException("服务器内部错误,请联系管理员");
//                    }
                    OrderInAndOutUtil.updateOrder(order.getPakinPakoutStatus$(),order.getId(),6L,null);
                } else {
                    log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL+MesConstant.PAKIN_URL, JSON.toJSONString(pakinParam), response);
                    throw new CoolException("上报mes系统失败");
@@ -102,13 +105,15 @@
        }
        // 出库完成上报
        if (docType.getPakout() == 1) {
            if (true) {
                return SUCCESS;
            }
            MesPakoutParam pakoutParam = new MesPakoutParam();
            pakoutParam.setPakoutTime(DateUtils.convert(order.getUpdateTime()));    // todo:luxiaotao
            pakoutParam.setLgortFrom("5008");   // todo:luxiaotao
            pakoutParam.setLgortTo("5006");   // todo:luxiaotao
            pakoutParam.setTag(!order.getDocType$().equalsIgnoreCase("手动出库单"));
            pakoutParam.setPakoutTime(DateUtils.convert(order.getUpdateTime()));
            pakoutParam.setLgortFrom("5006");
            pakoutParam.setLgortTo("1111");
            if (!pakoutParam.isTag()) {
                pakoutParam.setKunnr("C1000");
            }
            pakoutParam.setOrderNo(order.getOrderNo());
            for (OrderDetl orderDetl : orderDetls) {
                String serial = Cools.isEmpty(orderDetl.getBatch()) ? "" : orderDetl.getBatch();
                pakoutParam.getList().add(new MesPakoutParam.Detl(orderDetl.getMatnr() + (Cools.isEmpty(serial) ? "" : "-" + serial), orderDetl.getAnfme()));
@@ -118,7 +123,7 @@
            try {
                response = new HttpHandler.Builder()
                        .setUri(MesConstant.URL)
                        .setPath(MesConstant.PAKOUT_URL)    // todo:luxiaotao
                        .setPath(MesConstant.PAKOUT_URL)
                        .setJson(JSON.toJSONString(pakoutParam))
                        .build()
                        .doPost();
@@ -126,9 +131,10 @@
                if (jsonObject.getInteger("code").equals(200)) {
                    success = true;
                    // 修改订单状态 4.完成 ===>> 6.已上报
                    if (!orderService.updateSettle(order.getId(), 6L, null)) {
                        throw new CoolException("服务器内部错误,请联系管理员");
                    }
//                    if (!orderService.updateSettle(order.getId(), 6L, null)) {
//                        throw new CoolException("服务器内部错误,请联系管理员");
//                    }
                    OrderInAndOutUtil.updateOrder(order.getPakinPakoutStatus$(),order.getId(),6L,null);
                } else {
                    log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL+MesConstant.PAKOUT_URL, JSON.toJSONString(pakoutParam), response);
                    throw new CoolException("上报mes系统失败");