fix:MES相关接口优化

This commit is contained in:
zhouz
2024-07-02 16:26:30 +08:00
parent 58f243053a
commit 7824298f1a
7 changed files with 97 additions and 39 deletions

View File

@@ -8,11 +8,14 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.ext.mes.service.LmsToMesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
@@ -26,6 +29,9 @@ public class LmsToMesServiceImpl implements LmsToMesService {
private static String is_connect_mes = "1";
@Autowired
private IBstIvtBoxinfoService bstIvtBoxinfoService;
/**
* LMS的PDA操作AGV下卷AGV称重完成后AGV称重信息发送MES
*
@@ -714,7 +720,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("FEISHU_URL").getValue();
String api = "/FeiShuNoticesWebApi/UploadImage";
url = url + api +"?fileName="+file_name;
url = url + api + "?fileName=" + file_name;
log.info("sendSalesIvtMsg接口输入参数为-------------------" + url.toString());
@@ -771,6 +777,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
}
return result;
}
@Override
public JSONObject momAutoTransterMoveIn(JSONObject param) {
String from_area = param.getString("from_area");
@@ -794,7 +801,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
log.info("momAutoTransterMoveIn接口输入参数为-------------------" + param.toString());
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
String api = "/momAutoTransterMoveIn";
String api = "CamstarApi/momAutoTransterMoveIn";
url = url + api;
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
@@ -838,7 +845,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
log.info("momGetPackingInfo接口输入参数为-------------------" + param.toString());
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
String api = "momGetPackingInfo";
String api = "CamstarApi/momGetPackingInfo";
url = url + api;
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
@@ -847,6 +854,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
param.put("Password", Password);
param.put("ContainerName", box_no);
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(param))
@@ -854,12 +862,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
result = JSONObject.parseObject(resultMsg);
log.info("momGetPackingInfo接口输出参数为-------------------" + result.toString());
String RTYPE = result.getString("RTYPE");
if ("E".equals(RTYPE)) {
throw new BadRequestException(result.getString("RTMSG"));
}
bstIvtBoxinfoService.mesInsert(result.getJSONArray("RTDAT").getJSONObject(0));
} catch (Exception e) {
throw new BadRequestException("MES提示错误" + e.getMessage());
@@ -897,7 +906,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
JSONObject result = new JSONObject();
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_URL").getValue();
String api = "momBoxPackageSubmit";
String api = "CamstarApi/momBoxPackageSubmit";
url = url + api;
String UserName = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MES_USERNAME").getValue();

View File

@@ -679,6 +679,9 @@ public class MesToLmsServiceImpl implements MesToLmsService {
if (ResourceName.startsWith("B5") || ResourceName.startsWith("B6")) {
json.put("is_paper_ok", "1");
}
if (Attribute5.equals("0")) {
json.put("is_paper_ok", "5");
}
json.put("sale_order_name", Attribute2);
json.put("start_time", DateUtil.now());
json.put("status", "01");