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