自动化立体仓库 - WMS系统
*
lsh
17 小时以前 4448779d76ff424e666d65f2f168a5890642c857
src/main/java/com/zy/asrs/controller/OrderPakoutController.java
@@ -9,19 +9,17 @@
import com.core.common.*;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.OrderDomainParam;
import com.zy.asrs.entity.param.QualityGroupListParam;
import com.zy.asrs.entity.result.OrderPakoutDetailVo;
import com.zy.asrs.entity.result.OrderPakoutMainVo;
import com.zy.asrs.entity.result.WrkTraceVo;
import com.zy.asrs.service.*;
import com.zy.common.constant.MesConstant;
import com.zy.common.model.DetlDto;
import com.zy.common.utils.HttpHandler;
import com.zy.common.web.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@@ -52,6 +50,11 @@
    private WrkMastLogService wrkMastLogService;
    @Autowired
    private ApiLogService apiLogService;
    @Value("${srXghyMes.actualShipmentMesUrl}")
    private String actualShipmentMesUrl;
    @Value("${srXghyMes.actualShipmentMes}")
    private String actualShipmentMes;
    @RequestMapping(value = "/order/nav/list/auth")
    @ManagerAuth
@@ -367,8 +370,19 @@
    @RequestMapping(value = "/actual/shipment/order/report/auth")
    @ManagerAuth(memo = "上报MES实际组货单")
    public R actualShipmentOrder(@RequestParam String itemName) {
        Long userId = getUserId();
        Long userId = null;
        try {
            userId = getUserId();
            if (Cools.isEmpty(userId)) {
                return R.error("用户异常").add("用户异常");
            }
        } catch (Exception e){
            return R.error("用户异常").add("用户异常");
        }
        List<OrderPakoutDetailVo> OrderPakoutDetailVoList = orderDetlService.selectOrderPakoutDetailVoListV1(itemName);
        if (OrderPakoutDetailVoList.isEmpty()) {
            return R.error("上报明细为空!!!").add("上报明细为空!!!");
        }
        List<String> boxList = new ArrayList<>();
        List<String> rollList = new ArrayList<>();
        for (OrderPakoutDetailVo orderDetl : OrderPakoutDetailVoList){
@@ -390,8 +404,8 @@
        boolean success = false;
        try {
            response = new HttpHandler.Builder()
                    .setUri(MesConstant.URL)
                    .setPath(MesConstant.PAKIN_URL)
                    .setUri(actualShipmentMesUrl)
                    .setPath(actualShipmentMes)
                    .setJson(JSON.toJSONString(qualityGroupListParam))
                    .build()
                    .doPost();
@@ -400,20 +414,24 @@
                success = true;
                // 修改订单状态 4.完成 ===>> 16.已上报
                if (!orderService.updateItemName(itemName, 16L, userId)) {
                    throw new CoolException("服务器内部错误,请联系管理员");
//                    throw new CoolException("服务器内部错误,请联系管理员");
                    log.error("组货单更新状态失败!!!组货单号"+itemName+".updateItemName");
                } else {
                    return R.ok();
                }
            } else {
                // 修改订单状态 4.完成 ===>> 17.已上报
                if (!orderService.updateItemName(itemName, 17L, userId)) {
                    throw new CoolException("服务器内部错误,请联系管理员");
//                    throw new CoolException("服务器内部错误,请联系管理员");
                    log.error("组货单更新状态失败!!!组货单号"+itemName+".updateItemName");
                }
                log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL+MesConstant.PAKIN_URL, JSON.toJSONString(qualityGroupListParam), response);
                throw new CoolException("上报mes系统失败");
                log.error("请求接口失败!!!url:{};request:{};response:{}", actualShipmentMesUrl+"/"+actualShipmentMes, JSON.toJSONString(qualityGroupListParam), response);
            }
            return R.error("上报mes系统失败").add("上报mes系统失败");
        } catch (Exception e) {
            // 修改订单状态 4.完成 ===>> 17.已上报
            if (!orderService.updateItemName(itemName, 17L, userId)) {
                throw new CoolException("服务器内部错误,请联系管理员");
                log.error("组货单更新状态失败!!!组货单号"+itemName+".updateItemName");
            }
            log.error("fail", e);
        } finally {
@@ -421,7 +439,7 @@
                // 保存接口日志
                apiLogService.save(
                        "上报MES实际组货单",
                        MesConstant.URL + MesConstant.PAKIN_URL,
                        actualShipmentMesUrl+"/"+actualShipmentMes,
                        null,
                        "127.0.0.1",
                        JSON.toJSONString(qualityGroupListParam),
@@ -430,9 +448,6 @@
                );
            } catch (Exception e) { log.error("", e); }
        }
        return R.ok();
        return R.error("上报失败").add("上报失败");
    }
}