fix:暂时取消MES子卷毛重推送
This commit is contained in:
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.log4j.Log4j;
|
import lombok.extern.log4j.Log4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -42,6 +43,8 @@ import org.nl.modules.common.exception.BadRequestException;
|
|||||||
import org.nl.system.service.param.ISysParamService;
|
import org.nl.system.service.param.ISysParamService;
|
||||||
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
||||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
|
import org.redisson.api.RLock;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -52,6 +55,7 @@ import java.math.BigDecimal;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@@ -65,6 +69,9 @@ import java.util.stream.Collectors;
|
|||||||
@Log4j
|
@Log4j
|
||||||
public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpackagerelationMapper, PdmBiSubpackagerelation> implements IpdmBiSubpackagerelationService {
|
public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpackagerelationMapper, PdmBiSubpackagerelation> implements IpdmBiSubpackagerelationService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedissonClient redissonClient;
|
||||||
@Resource
|
@Resource
|
||||||
private IschBaseTaskService taskService;
|
private IschBaseTaskService taskService;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -353,11 +360,11 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
boxInfo.put("device_code", deviceCode);
|
boxInfo.put("device_code", deviceCode);
|
||||||
boxInfo.put("material_code", boxType);
|
boxInfo.put("material_code", boxType);
|
||||||
boxInfo.put("num", workIdList.size());
|
boxInfo.put("num", workIdList.size());
|
||||||
String boxSn = outBoxManageService.outBox(boxInfo);
|
//String boxSn = outBoxManageService.outBox(boxInfo);
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.println("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
System.out.println("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
||||||
log.info("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
log.info("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
||||||
//String boxSn = "MX230118000013";
|
String boxSn = "MX230118000013";
|
||||||
StopWatch stopWatch1 = new StopWatch();
|
StopWatch stopWatch1 = new StopWatch();
|
||||||
stopWatch1.start();
|
stopWatch1.start();
|
||||||
//更新及子卷包装状态已分配规格及木箱规格组
|
//更新及子卷包装状态已分配规格及木箱规格组
|
||||||
@@ -760,11 +767,16 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
sub.setCustomer_description("临时包装关系");
|
sub.setCustomer_description("临时包装关系");
|
||||||
sub.setProduct_description(plan.getDescription());
|
sub.setProduct_description(plan.getDescription());
|
||||||
sub.setWidth(String.valueOf(plan.getSplit_breadth()));
|
sub.setWidth(String.valueOf(plan.getSplit_breadth()));
|
||||||
if (StringUtils.isBlank(plan.getWeight()) || StringUtils.isBlank(plan.getPaper_weight())) {
|
BigDecimal paperWeight = BigDecimal.ZERO;
|
||||||
throw new BadRequestException("该子卷分切计划中的子卷重量参数为空!");
|
BigDecimal weight = BigDecimal.ZERO;
|
||||||
|
if (StringUtils.isNotBlank(plan.getPaper_weight())) {
|
||||||
|
paperWeight = new BigDecimal(plan.getPaper_weight());
|
||||||
}
|
}
|
||||||
int net_weight = Integer.parseInt(plan.getWeight()) - Integer.parseInt(plan.getPaper_weight());
|
if (StringUtils.isNotBlank(plan.getWeight())) {
|
||||||
sub.setNet_weight(net_weight + "");
|
weight = new BigDecimal(plan.getWeight());
|
||||||
|
}
|
||||||
|
BigDecimal netWeightDecimal = weight.subtract(paperWeight);
|
||||||
|
sub.setNet_weight(netWeightDecimal.toString());
|
||||||
sub.setLength("1000");
|
sub.setLength("1000");
|
||||||
sub.setIs_un_plan_production("0");
|
sub.setIs_un_plan_production("0");
|
||||||
sub.setCreate_id(1L);
|
sub.setCreate_id(1L);
|
||||||
@@ -819,7 +831,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
.map(Integer::parseInt)
|
.map(Integer::parseInt)
|
||||||
.max(Integer::compareTo)
|
.max(Integer::compareTo)
|
||||||
.orElse(0) + 1;
|
.orElse(0) + 1;
|
||||||
try {
|
|
||||||
List<String> workIdList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class).stream()
|
List<String> workIdList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class).stream()
|
||||||
.map(PdmBiSubpackagerelation::getWorkorder_id)
|
.map(PdmBiSubpackagerelation::getWorkorder_id)
|
||||||
.map(String::valueOf)
|
.map(String::valueOf)
|
||||||
@@ -835,9 +846,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
System.out.println("子卷装箱代码1装箱信息查询执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
System.out.println("子卷装箱代码1装箱信息查询执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
||||||
log.info("子卷装箱代码1箱信息查询执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
log.info("子卷装箱代码1箱信息查询执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
||||||
outBox(workIdList, containerNameList, deviceCode, maxBoxGroup, whereJson.getString("checked"));
|
outBox(workIdList, containerNameList, deviceCode, maxBoxGroup, whereJson.getString("checked"));
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("子卷装箱updateEntityList接口捕获异常信息:" + e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -854,11 +862,11 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
boxInfo.put("device_code", deviceCode);
|
boxInfo.put("device_code", deviceCode);
|
||||||
boxInfo.put("material_code", boxType);
|
boxInfo.put("material_code", boxType);
|
||||||
boxInfo.put("num", workIdList.size());
|
boxInfo.put("num", workIdList.size());
|
||||||
//String boxSn = outBoxManageService.outBox(boxInfo);
|
String boxSn = outBoxManageService.outBox(boxInfo);
|
||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.println("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
System.out.println("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
||||||
log.info("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
log.info("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
|
||||||
String boxSn = "MX240703000118";
|
//String boxSn = "MX240703000118";
|
||||||
StopWatch stopWatch1 = new StopWatch();
|
StopWatch stopWatch1 = new StopWatch();
|
||||||
stopWatch1.start();
|
stopWatch1.start();
|
||||||
//更新及子卷包装状态已分配规格及木箱规格组
|
//更新及子卷包装状态已分配规格及木箱规格组
|
||||||
@@ -883,6 +891,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
protected void agvTransfer(Set<String> containerNameList, String deviceCode, String boxSn) {
|
protected void agvTransfer(Set<String> containerNameList, String deviceCode, String boxSn) {
|
||||||
//待检区点位
|
//待检区点位
|
||||||
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService
|
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService
|
||||||
@@ -897,6 +906,10 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
//任务组id
|
//任务组id
|
||||||
String groupId = deviceCode.substring(deviceCode.lastIndexOf("_") + 1);
|
String groupId = deviceCode.substring(deviceCode.lastIndexOf("_") + 1);
|
||||||
|
RLock lock = redissonClient.getLock(groupId);
|
||||||
|
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||||
|
try {
|
||||||
|
if (tryLock) {
|
||||||
List<SchBaseTask> schBaseTaskList = new ArrayList<>();
|
List<SchBaseTask> schBaseTaskList = new ArrayList<>();
|
||||||
//确定起点,安装装箱组标识加入任务队列
|
//确定起点,安装装箱组标识加入任务队列
|
||||||
djqPoints.forEach(r -> {
|
djqPoints.forEach(r -> {
|
||||||
@@ -924,7 +937,16 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
if (CollectionUtils.isNotEmpty(schBaseTaskList)) {
|
if (CollectionUtils.isNotEmpty(schBaseTaskList)) {
|
||||||
taskQueue.addTasksToQueue(groupId, schBaseTaskList);
|
taskQueue.addTasksToQueue(groupId, schBaseTaskList);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.info("待检区->装箱区任务队列正在创建被锁住。");
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
if (tryLock) {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -28,6 +29,8 @@ import org.nl.modules.common.exception.BadRequestException;
|
|||||||
import org.nl.system.service.param.ISysParamService;
|
import org.nl.system.service.param.ISysParamService;
|
||||||
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
||||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
|
import org.redisson.api.RLock;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -35,6 +38,7 @@ import java.math.BigDecimal;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.nl.wms.util.TaskUtil.getMaxNum;
|
import static org.nl.wms.util.TaskUtil.getMaxNum;
|
||||||
@@ -45,6 +49,7 @@ import static org.nl.wms.util.TaskUtil.getMaxNum;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AutoSendZxToDjw {
|
public class AutoSendZxToDjw {
|
||||||
|
|
||||||
|
private final RedissonClient redissonClient;
|
||||||
@Resource
|
@Resource
|
||||||
private IschBaseTaskService taskService;
|
private IschBaseTaskService taskService;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -76,7 +81,8 @@ public class AutoSendZxToDjw {
|
|||||||
this.sendZxToDjw();
|
this.sendZxToDjw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendZxToDjw() {
|
@SneakyThrows
|
||||||
|
public void sendZxToDjw() {
|
||||||
//装箱位有木箱
|
//装箱位有木箱
|
||||||
List<BstIvtPackageinfoivt> zxwPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱位"), PackageInfoIvtEnum.IVT_STATUS.code("空载具"), "", PackageInfoIvtEnum.SORT_TYPE.code("升序"), PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
|
List<BstIvtPackageinfoivt> zxwPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱位"), PackageInfoIvtEnum.IVT_STATUS.code("空载具"), "", PackageInfoIvtEnum.SORT_TYPE.code("升序"), PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
|
||||||
if (CollectionUtils.isEmpty(zxwPackageinfoivtList)) {
|
if (CollectionUtils.isEmpty(zxwPackageinfoivtList)) {
|
||||||
@@ -106,6 +112,10 @@ public class AutoSendZxToDjw {
|
|||||||
}
|
}
|
||||||
//获取与该木箱号匹配的子卷号
|
//获取与该木箱号匹配的子卷号
|
||||||
String containerName = relationList.get(0).getContainer_name();
|
String containerName = relationList.get(0).getContainer_name();
|
||||||
|
RLock lock = redissonClient.getLock(containerName);
|
||||||
|
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||||
|
try {
|
||||||
|
if (tryLock) {
|
||||||
List<BstIvtPackageinfoivt> zxqPoint = zxqPackageinfoivtList.stream().filter(r -> r.getContainer_name().equals(containerName)).collect(Collectors.toList());
|
List<BstIvtPackageinfoivt> zxqPoint = zxqPackageinfoivtList.stream().filter(r -> r.getContainer_name().equals(containerName)).collect(Collectors.toList());
|
||||||
//装箱区点位上有与该木箱号匹配的子卷
|
//装箱区点位上有与该木箱号匹配的子卷
|
||||||
if (CollectionUtils.isNotEmpty(zxqPoint)) {
|
if (CollectionUtils.isNotEmpty(zxqPoint)) {
|
||||||
@@ -145,13 +155,21 @@ public class AutoSendZxToDjw {
|
|||||||
param.put("barcode", containerName);
|
param.put("barcode", containerName);
|
||||||
jo.put("request_param", param.toString());
|
jo.put("request_param", param.toString());
|
||||||
zxDjwTask.createTask(jo);
|
zxDjwTask.createTask(jo);
|
||||||
try {
|
// try {
|
||||||
//传输子卷包装关系至MES
|
//todo 传输子卷包装关系至MES,暂时不计算,MES会推过来
|
||||||
transferBoxPackageToMes(relationList, bstIvtBoxinfo);
|
//transferBoxPackageToMes(relationList, bstIvtBoxinfo);
|
||||||
} catch (Exception ex) {
|
// } catch (Exception ex) {
|
||||||
log.error("装箱区->装箱对接位sendZxToDjw,传输子卷包装关系至MES接口捕获异常信息:" + ex);
|
// log.error("装箱区->装箱对接位sendZxToDjw,传输子卷包装关系至MES接口捕获异常信息:" + ex);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.info("装箱区->装箱对接位agv自动搬运任务正在创建被锁住。");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (tryLock) {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user