fix:MES相关接口优化
This commit is contained in:
@@ -38,8 +38,7 @@ public class BstIvtBoxinfoController {
|
||||
@PostMapping("/saveBoxInfo")
|
||||
@Log("保存木箱信息")
|
||||
public ResponseEntity<Object> saveBoxInfo(@RequestBody JSONObject jsonObject) {
|
||||
iBstIvtBoxinfoService.saveBoxInfo(jsonObject);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
return new ResponseEntity<>(iBstIvtBoxinfoService.saveBoxInfo(jsonObject), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getBoxInfo")
|
||||
|
||||
@@ -42,7 +42,7 @@ public interface IBstIvtBoxinfoService extends IService<BstIvtBoxinfo> {
|
||||
*/
|
||||
BstIvtBoxinfo mesInsert(JSONObject whereJson);
|
||||
|
||||
void saveBoxInfo(JSONObject jsonObject);
|
||||
JSONObject saveBoxInfo(JSONObject jsonObject);
|
||||
|
||||
BstIvtBoxinfo getBoxInfo(JSONObject jsonObject);
|
||||
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
package org.nl.b_lms.storage_manage.database.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
|
||||
import org.nl.b_lms.storage_manage.database.service.IMdpbBoxtypeService;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxinfo;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.MdpbBoxtype;
|
||||
import org.nl.b_lms.storage_manage.database.service.dao.mapper.BstIvtBoxinfoMapper;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -54,7 +58,7 @@ public class BstIvtBoxinfoServiceImpl extends ServiceImpl<BstIvtBoxinfoMapper, B
|
||||
@Override
|
||||
public BstIvtBoxinfo mesInsert(JSONObject whereJson) {
|
||||
|
||||
int length = whereJson.getInteger("length");
|
||||
int length = whereJson.getInteger("Length");
|
||||
String boxLength = iSysParamService.findByCode("box_length").getValue();
|
||||
String vehicle_type = "";
|
||||
if (length <= Integer.parseInt(boxLength)) {
|
||||
@@ -63,39 +67,58 @@ public class BstIvtBoxinfoServiceImpl extends ServiceImpl<BstIvtBoxinfoMapper, B
|
||||
vehicle_type = "2";
|
||||
}
|
||||
|
||||
BstIvtBoxinfo boxDao = BstIvtBoxinfo.builder()
|
||||
.box_id(IdUtil.getStringId())
|
||||
.box_high(whereJson.getString("Height"))
|
||||
.box_length(whereJson.getString("Length"))
|
||||
.box_width(whereJson.getString("Width"))
|
||||
.material_code(whereJson.getString("ProductName"))
|
||||
.material_name(whereJson.getString("Description"))
|
||||
.box_no(whereJson.getString("ContainerName"))
|
||||
.vehicle_type(vehicle_type)
|
||||
.insert_time(DateUtil.now())
|
||||
.build();
|
||||
BstIvtBoxinfo boxDao = this.getOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, whereJson.getString("ContainerName")));
|
||||
|
||||
//TODO 根据木箱规格判断木箱的捆扎次数(定义规则)
|
||||
if (ObjectUtil.isEmpty(boxDao)) {
|
||||
boxDao = BstIvtBoxinfo.builder()
|
||||
.box_id(IdUtil.getStringId())
|
||||
.box_high(whereJson.getString("Height"))
|
||||
.box_length(whereJson.getString("Length"))
|
||||
.box_width(whereJson.getString("Width"))
|
||||
.material_code(whereJson.getString("ProductName"))
|
||||
.lash_num("0")
|
||||
.material_name(whereJson.getString("Description"))
|
||||
.box_no(whereJson.getString("ContainerName"))
|
||||
.vehicle_type(vehicle_type)
|
||||
.insert_time(DateUtil.now())
|
||||
.build();
|
||||
|
||||
// 截取子卷号
|
||||
String description = whereJson.getString("Description");
|
||||
// 截取子卷号
|
||||
String description = whereJson.getString("Description");
|
||||
|
||||
try {
|
||||
String one = description.substring(description.indexOf("|") + 1);
|
||||
String two = one.substring(one.indexOf("|") + 1);
|
||||
String num = two.substring(two.indexOf("|") + 1, two.indexOf("|") + 2);
|
||||
boxDao.setNum(num);
|
||||
} catch (Exception e) {
|
||||
boxDao.setNum("截取失败,请检查mes数据!");
|
||||
try {
|
||||
String one = description.substring(description.indexOf("|") + 1);
|
||||
String two = one.substring(one.indexOf("|") + 1);
|
||||
String num = two.substring(two.indexOf("|") + 1, two.indexOf("|") + 2);
|
||||
boxDao.setNum(num);
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("截取失败,请检查mes数据!");
|
||||
}
|
||||
|
||||
this.save(boxDao);
|
||||
|
||||
}else {
|
||||
boxDao.setBox_high(whereJson.getString("Height"));
|
||||
boxDao.setBox_length(whereJson.getString("Length"));
|
||||
boxDao.setBox_length(whereJson.getString("Width"));
|
||||
this.updateById(boxDao);
|
||||
}
|
||||
|
||||
this.save(boxDao);
|
||||
//判断boxType表里面是否存在该类型,存在就不操作,不存在插入一条
|
||||
IMdpbBoxtypeService bean = SpringContextHolder.getBean(IMdpbBoxtypeService.class);
|
||||
MdpbBoxtype boxtype = bean.getOne(new LambdaQueryWrapper<MdpbBoxtype>().eq(MdpbBoxtype::getBox_type, boxDao.getMaterial_code()));
|
||||
if (ObjectUtil.isEmpty(boxtype)) {
|
||||
boxtype = new MdpbBoxtype();
|
||||
boxtype.setBox_type(boxDao.getMaterial_code());
|
||||
boxtype.setBox_name(boxDao.getMaterial_name());
|
||||
bean.save(boxtype);
|
||||
}
|
||||
|
||||
return boxDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveBoxInfo(JSONObject jsonObject) {
|
||||
public JSONObject saveBoxInfo(JSONObject jsonObject) {
|
||||
String boxNo = jsonObject.getString("box_no");
|
||||
String box_weight = jsonObject.getString("box_weight");
|
||||
BstIvtBoxinfo boxinfo = bstIvtBoxinfoMapper.selectOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, boxNo));
|
||||
@@ -104,6 +127,9 @@ public class BstIvtBoxinfoServiceImpl extends ServiceImpl<BstIvtBoxinfoMapper, B
|
||||
}
|
||||
boxinfo.setBox_weight(box_weight);
|
||||
bstIvtBoxinfoMapper.updateById(boxinfo);
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("message", "修改成功!");
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -68,6 +68,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
|
||||
*/
|
||||
private final IschBaseTaskService ischBaseTaskService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
|
||||
@@ -179,7 +180,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
|
||||
JSONObject mesBoxInfo = new JSONObject();
|
||||
|
||||
// 插入木箱信息表
|
||||
// iBstIvtBoxinfoService.mesInsert(mesBoxInfo);
|
||||
|
||||
|
||||
/*
|
||||
* 插入木箱对应载具表
|
||||
@@ -203,6 +204,13 @@ public class InBoxManageServiceImpl implements InBoxManageService {
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
String boxNO = split[i];
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("box_No", boxNO);
|
||||
lmsToMesService.momGetPackingInfo(jo);
|
||||
}
|
||||
|
||||
//查询对应的木箱信息
|
||||
// 查询木箱信息
|
||||
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
|
||||
@@ -423,6 +431,7 @@ public class InBoxManageServiceImpl implements InBoxManageService {
|
||||
|
||||
/**
|
||||
* 根据木箱规格找相同规格的仓位
|
||||
*
|
||||
* @param jsonParam {
|
||||
* stor_id:仓库标识
|
||||
* sect_id:库区标识
|
||||
@@ -452,7 +461,8 @@ public class InBoxManageServiceImpl implements InBoxManageService {
|
||||
.addParam("row_in", "('" + row_in + "')").process().getResultJSONArray(0).toJavaList(JSONObject.class);
|
||||
|
||||
|
||||
outerLoop: for (JSONObject jsonRow : rowList) {
|
||||
outerLoop:
|
||||
for (JSONObject jsonRow : rowList) {
|
||||
// 查询这一排相同木箱规格的仓位
|
||||
List<JSONObject> attrRowList = attrRowAllList.stream()
|
||||
.filter(row -> row.getString("row_num").equals(jsonRow.getString("row_num")))
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package org.nl.system.service.quartz.config;
|
||||
|
||||
import cn.hutool.core.net.NetUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.system.service.quartz.ISysQuartzJobService;
|
||||
import org.nl.system.service.quartz.dao.SysQuartzJob;
|
||||
import org.nl.system.service.quartz.utils.QuartzManage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
@@ -13,11 +17,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: job运行
|
||||
* @Date: 2023/8/14
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Order(100)
|
||||
@@ -33,9 +32,21 @@ public class JobRunner implements ApplicationRunner {
|
||||
*/
|
||||
@Override
|
||||
public void run(ApplicationArguments applicationArguments) {
|
||||
//本机IP
|
||||
String localIp = NetUtil.getLocalhostStr();
|
||||
System.out.println("本机ip:"+localIp);
|
||||
//选择需要开启定时任务的服务器ip
|
||||
String quartzIp = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("QUARTZ_IP").getValue();
|
||||
if (!localIp.equals(quartzIp)) {
|
||||
log.info("--------------------定时任务未开启,请检查配置!---------------------");
|
||||
System.out.println("--------------------定时任务未开启,请检查配置!---------------------");
|
||||
return;
|
||||
}
|
||||
|
||||
log.info("--------------------注入定时任务---------------------");
|
||||
List<SysQuartzJob> quartzJobs = quartzJobService.findByIsPauseIsFalse();
|
||||
quartzJobs.forEach(quartzManage::addJob);
|
||||
log.info("--------------------定时任务注入完成---------------------");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user