自动化立体仓库 - WMS系统
*
lsh
17 小时以前 4448779d76ff424e666d65f2f168a5890642c857
src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
@@ -22,6 +22,7 @@
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.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -50,6 +51,11 @@
    private WrkDetlServiceImpl wrkDetlService;
    @Autowired
    private SnowflakeIdWorker snowflakeIdWorker;
    @Value("${srXghyMes.productInventoryUrl}")
    private String productInventoryUrl;
    @Value("${srXghyMes.productInventory}")
    private String productInventory;
    @Transactional
    public ReturnT<String> start(Order order) {
@@ -245,7 +251,41 @@
        orderMesXGHYParam.setBarcode(String.valueOf(snowflakeIdWorker.nextId()));
        orderMesXGHYParam.setPalletizingNo(1);
        System.out.println(orderMesXGHYParam.toString());
        String response = "";
        boolean success = false;
        try {
            response = new HttpHandler.Builder()
                    .setUri(productInventoryUrl)
                    .setPath(productInventory)
                    .setJson(JSON.toJSONString(orderMesXGHYParam))
                    .build()
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            if (jsonObject.getInteger("code").equals(200)) {
                success = true;
            } else {
                log.error("请求接口失败!!!url:{};request:{};response:{}", productInventoryUrl+"/"+productInventory, JSON.toJSONString(orderMesXGHYParam), response);
            }
        } catch (Exception e) {
            log.error("fail", e);
//            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return FAIL.setMsg(e.getMessage());
        } finally {
            try {
                // 保存接口日志
                apiLogService.save(
                        "成品库入库上报",
                        productInventoryUrl+"/"+productInventory,
                        null,
                        "127.0.0.1",
                        JSON.toJSONString(orderMesXGHYParam),
                        response,
                        success
                );
            } catch (Exception e) { log.error("", e); }
        }
        return SUCCESS;
    }