自动化立体仓库 - WMS系统
#
luxiaotao1123
2022-04-22 0874ababb94bfb41a3bf7826572a60b84e0fd943
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -1,5 +1,7 @@
package com.zy.asrs.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.BaseRes;
import com.core.common.Cools;
@@ -11,8 +13,11 @@
import com.zy.asrs.entity.param.MobileAdjustParam;
import com.zy.asrs.entity.param.OpenOrderPakinParam;
import com.zy.asrs.service.*;
import com.zy.common.constant.MesConstant;
import com.zy.common.entity.Parameter;
import com.zy.common.model.DetlDto;
import com.zy.common.model.MesCombParam;
import com.zy.common.utils.HttpHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -277,7 +282,36 @@
            });
            if (packDown) {
                // 数据上报 todo
                MesCombParam mesCombParam = new MesCombParam();
                mesCombParam.setZpallet(param.getBarcode());
                mesCombParam.setCombTime(DateUtils.convert(now));
                mesCombParam.setLgort("5008");
                for (DetlDto detlDto : detlDtos) {
                    mesCombParam.getList().add(new MesCombParam.Detl(detlDto.getMatnr(), detlDto.getAnfme()));
                }
                String response;
                try {
                    response = new HttpHandler.Builder()
                            .setUri(MesConstant.URL)
                            .setPath(MesConstant.PACK_DOWN_URL)
                            .setJson(JSON.toJSONString(mesCombParam))
                            .build()
                            .doPost();
                    JSONObject jsonObject = JSON.parseObject(response);
                    if (jsonObject.getInteger("code").equals(200)) {
                        log.info("请求接口成功!!!");
                    } else if (jsonObject.getInteger("code").equals(500)) {
                        log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL+MesConstant.PACK_DOWN_URL, JSON.toJSONString(mesCombParam), response);
                        throw new CoolException(jsonObject.getString("msg"));
                    } else {
                        log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL+MesConstant.PACK_DOWN_URL, JSON.toJSONString(mesCombParam), response);
                        throw new CoolException("上报mes系统失败");
                    }
                } catch (Exception e) {
                    log.error("fail", e);
                    throw new CoolException(e.getMessage());
                }
            }
            // 生成入库单据