opt:优化子卷装箱校验逻辑

This commit is contained in:
2024-06-30 18:10:59 +08:00
parent 17032c858a
commit 9ecc870369
23 changed files with 412 additions and 283 deletions

View File

@@ -120,6 +120,18 @@ public class PdmBiSubpackagerelationController {
}
@PostMapping("/transferBoxPackageToMes")
@Log("传输子卷包装关系至LMS")
//@SaCheckPermission("@el.check(updateEntityList)")
public ResponseEntity<Object> transferBoxPackageToMes(@RequestBody JSONObject whereJson) {
pdmBiSubpackagerelationService.transferBoxPackageToMes(true,whereJson,null,null,null);
return new ResponseEntity<>(HttpStatus.OK);
}
/**
* 删除数据
*

View File

@@ -54,7 +54,7 @@
FROM
pdm_bi_subpackagerelation
WHERE
container_name IN (SELECT container_name FROM bst_ivt_packageinfoivt WHERE point_status = '6')
container_name IN (SELECT container_name FROM bst_ivt_packageinfoivt WHERE point_status = '3' AND ivt_status = '3')
<if test="sale_order_name != null and sale_order_name != ''">
AND sale_order_name LIKE CONCAT('%', #{sale_order_name}, '%')
</if>
@@ -81,7 +81,8 @@
FROM `pdm_bi_subpackagerelation` a
LEFT JOIN bst_ivt_packageinfoivt b ON a.container_name = b.container_name
LEFT JOIN pdm_bi_slittingproductionplan c ON a.container_name = c.container_name
WHERE b.point_status = '6'
WHERE b.point_status = '3'
AND b.ivt_status = '3'
AND a.sale_order_name = #{sale_order_name}
ORDER BY box_group DESC
</select>

View File

@@ -1,19 +1,16 @@
package org.nl.b_lms.pdm.subpackagerelation.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
import org.nl.common.domain.query.PageQuery;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxinfo;
import org.nl.common.domain.query.PageQuery;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestBody;
/**
* {@code @Description:} 子卷包装关系表(PdmBiSubpackagerelation)服务接口层
@@ -69,7 +66,17 @@ public interface IpdmBiSubpackagerelationService extends IService<PdmBiSubpackag
*
* @param whereJson 分配信息
*/
void updateEntityList(@RequestBody JSONObject whereJson);
void updateEntityList(JSONObject whereJson);
/**
* 传输子卷包装关系至LMS
* @param manual 是否手动同步
* @param whereJson 子卷与木箱绑定信息
* @param containerNameList 子卷号信息
* @param boxSn 木箱号
* @param totalWeight 理论毛重
*/
void transferBoxPackageToMes(boolean manual, JSONObject whereJson, Set<String> containerNameList, String boxSn, String totalWeight);
/**

View File

@@ -1,43 +1,45 @@
package org.nl.b_lms.pdm.subpackagerelation.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.StopWatch;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.extern.log4j.Log4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.mapper.PdmBiSlittingproductionplanMapper;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
import org.nl.b_lms.pdm.subpackagerelation.dao.mapper.PdmBiSubpackagerelationMapper;
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
import cn.hutool.core.date.DateUtil;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
import org.nl.b_lms.sch.point.dao.mapper.BstIvtPackageinfoivtMapper;
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.b_lms.sch.tasks.first_floor_area.*;
import org.nl.b_lms.sch.tasks.first_floor_area.auto.TaskQueueManager;
import org.nl.b_lms.sch.tasks.first_floor_area.DjqTask;
import org.nl.b_lms.sch.tasks.first_floor_area.ZxDjwTask;
import org.nl.b_lms.sch.tasks.first_floor_area.ZxqTask;
import org.nl.b_lms.sch.tasks.first_floor_area.auto.TaskQueue;
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxinfo;
import org.nl.b_lms.storage_manage.database.service.dao.mapper.BstIvtBoxinfoMapper;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutBoxManageService;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.enums.PackageInfoIvtEnum;
import org.nl.common.utils.SecurityUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.nl.common.domain.query.PageQuery;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@@ -55,6 +57,7 @@ import java.util.stream.Collectors;
* @since 2024-02-01
*/
@Service("pdmBiSubpackagerelationService")
@Log4j
public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpackagerelationMapper, PdmBiSubpackagerelation> implements IpdmBiSubpackagerelationService {
@Resource
@@ -66,14 +69,14 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
private ISysParamService iSysParamService;
@Resource
private IBstIvtBoxinfoService iBstIvtBoxinfoService;
private LmsToMesServiceImpl lmsToMesServiceImpl;
@Resource
private DjqTask djqTask;
@Resource
private GzqTask gzqTask;
private IPdmBiSlittingproductionplanService iPdmBiSlittingproductionplanService;
@Resource
private DjqToKzjhcwTask djqToKzjhcwTask;
private DjqTask djqTask;
@Resource
private OutBoxManageService outBoxManageService;
@@ -84,11 +87,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
@Resource
private PdmBiSubpackagerelationMapper pdmBiSubpackagerelationMapper;
@Resource
private PdmBiSlittingproductionplanMapper pdmBiSlittingproductionplanMapper;
@Resource
private BstIvtPackageinfoivtMapper bstIvtPackageinfoivtMapper;
@Resource
@@ -123,7 +121,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
@Override
public Map<String, Object> queryBoxSpec(Map whereJson, Pageable page) {
Map<String, Object> boxInfoList = new HashMap<String, Object>();
//IPage<BstIvtBoxinfo> resultPage = new Page<>(page.getPageNumber(), page.getPageSize());
IPage<BstIvtBoxinfo> resultPage = new Page<>(page.getPageNumber() + 1, page.getPageSize());
LambdaQueryWrapper<BstIvtBoxinfo> queryWrapper = new LambdaQueryWrapper<>();
if (whereJson.containsKey("search")) {
@@ -190,11 +187,8 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
queryWrapper.lt(PdmBiSubpackagerelation::getStatus, "99");
}
}
queryWrapper.groupBy(PdmBiSubpackagerelation::getSale_order_name)
.orderByDesc(PdmBiSubpackagerelation::getCreate_time);
return pdmBiSubpackagerelationMapper.selectPage(resultPage, queryWrapper);
}
@@ -213,32 +207,17 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
Map<String, Long> countByGroup = pdmBiSubpackagerelationList.stream()
.filter(item -> item.getBox_group() != null)
.collect(Collectors.groupingBy(PdmBiSubpackagerelation::getBox_group, Collectors.counting()));
pdmBiSubpackagerelationList.forEach(item -> {
if (item.getBox_group() != null) {
item.setQuanlity_in_box(BigDecimal.valueOf(countByGroup.getOrDefault(item.getBox_group(), null)));
pdmBiSubpackagerelationList.forEach(r -> {
//获取子卷长度
// int containerLength = getMaxNum(null, r.getPaper_tube_description());
// r.setUn_plan_product_property3(Integer.toString(containerLength));
if (r.getBox_group() != null) {
r.setQuanlity_in_box(BigDecimal.valueOf(countByGroup.getOrDefault(r.getBox_group(), null)));
} else {
item.setQuanlity_in_box(BigDecimal.ZERO);
item.setBox_group("0");
r.setQuanlity_in_box(BigDecimal.ZERO);
r.setBox_group("0");
}
});
//下发空木箱出库任务
//outBox1();
//满轴->待检
//mzToDj();
//待检->装箱
// djToZx();
//下发桁架任务1
//transferToPacking1();
//下发桁架任务2
//transferToPacking2();
return pdmBiSubpackagerelationList;
}
@@ -275,16 +254,21 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
@Override
@Transactional(rollbackFor = Exception.class)
public void updateEntityList(JSONObject whereJson) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
List<PdmBiSubpackagerelation> packagerelationList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class);
if (CollectionUtils.isEmpty(packagerelationList)) {
throw new BadRequestException("无选中子卷信息");
}
//检查是否存在已分配规格的子卷号
List<PdmBiSubpackagerelation> isOutBox = packagerelationList.stream().filter(r -> r.getStatus().equals("0")).collect(Collectors.toList());
if (isOutBox.size() > 0) {
throw new BadRequestException("标记为黄色的子卷号已分配且对应的木箱正在出库,请重新选择未分配木箱规格的子卷");
}
JSONArray jsonArray = whereJson.getJSONArray("tableMater");
if (jsonArray == null || jsonArray.size() == 0) {
throw new BadRequestException("无选中子卷信息");
throw new BadRequestException("标记为黄色的子卷号已分配且对应的木箱出库,请重新选择未分配木箱规格的子卷");
}
// JSONArray jsonArray = whereJson.getJSONArray("tableMater");
// if (jsonArray == null || jsonArray.size() == 0) {
// throw new BadRequestException("无选中子卷信息");
// }
//均衡获取木箱出库装箱区对接位
String deviceCode = getPointCode();
Integer taskCount = bstIvtPackageinfoivtMapper.getZxqTaskCount(deviceCode.substring(deviceCode.lastIndexOf("_") + 1));
@@ -292,7 +276,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
throw new BadRequestException("子卷搬运任务数已达上限!");
}
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper
.selectList(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getSale_order_name, jsonArray.getJSONObject(0).getString("sale_order_name")));
.selectList(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getSale_order_name, packagerelationList.get(0).getSale_order_name()));
Integer maxBoxGroup = pdmBiSubpackagerelationList.stream()
.map(PdmBiSubpackagerelation::getBox_group)
.filter(Objects::nonNull)
@@ -300,14 +284,31 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
.max(Integer::compareTo)
.orElse(0) + 1;
try {
List<String> entityList = 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(String::valueOf)
.collect(Collectors.toList());
if (entityList.isEmpty()) {
if (workIdList.isEmpty()) {
return;
}
outBox(entityList, packagerelationList, deviceCode, maxBoxGroup, whereJson.getString("checked"));
//根据分切计划获取子卷重量计算理论毛重
Set<String> containerNameList = packagerelationList.stream()
.map(PdmBiSubpackagerelation::getContainer_name)
.collect(Collectors.toSet());
BigDecimal totalWeight;
List<PdmBiSlittingproductionplan> planList = iPdmBiSlittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().in(PdmBiSlittingproductionplan::getContainer_name, containerNameList));
totalWeight = planList.stream()
.map(PdmBiSlittingproductionplan::getWeight)
.filter(Objects::nonNull)
.filter(r -> !r.isEmpty())
.map(BigDecimal::new)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal boxWeight = new BigDecimal(whereJson.getString("box_weight"));
totalWeight = totalWeight.add(boxWeight);
stopWatch.stop();
System.out.println("子卷装箱代码1装箱信息查询执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
log.info("子卷装箱代码1箱信息查询执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
outBox(workIdList, containerNameList, deviceCode, maxBoxGroup, whereJson.getString("checked"), totalWeight.toString());
} catch (Exception e) {
throw new BadRequestException(e.getMessage());
}
@@ -317,52 +318,132 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
/**
* 空木箱出库
*/
private void outBox(List<String> entityList, List<PdmBiSubpackagerelation> packagerelationList, String deviceCode, Integer maxBoxGroup, String boxType) {
private void outBox(List<String> workIdList, Set<String> containerNameList, String deviceCode, Integer maxBoxGroup, String boxType, String totalWeight) {
//均衡获取装箱对接位
//String deviceCode = "ZXQ_1_1";
StopWatch stopWatch = new StopWatch();
stopWatch.start();
JSONObject boxInfo = new JSONObject();
//确定装箱区终点
boxInfo.put("device_code", deviceCode);
boxInfo.put("material_code", boxType);
boxInfo.put("num", entityList.size());
boxInfo.put("num", workIdList.size());
String boxSn = outBoxManageService.outBox(boxInfo);
stopWatch.stop();
System.out.println("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
log.info("木箱出库代码执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch.getTotalTimeMillis());
//String boxSn = "MX230118000013";
StopWatch stopWatch1 = new StopWatch();
stopWatch1.start();
//更新及子卷包装状态已分配规格及木箱规格组
CompletableFuture.runAsync(() -> {
try {
updateBoxGroup(maxBoxGroup, entityList, boxType);
updateBoxGroup(maxBoxGroup, workIdList, boxSn, boxType, totalWeight);
} catch (Exception e) {
log.error("异常信息:" + e);
}
}, pool);
//更新子卷包装关系更新木箱号
//给LMS传输子卷包装关系
CompletableFuture.runAsync(() -> {
try {
updateBoxInfo(entityList, boxSn);
transferBoxPackageToMes(true, null, containerNameList, boxSn, totalWeight);
} catch (Exception e) {
log.error("异常信息:" + e);
}
}, pool);
//待检区->装箱区agv任务
// CompletableFuture.runAsync(() -> {
// try {
// agvTransfer(packagerelationList, deviceCode, boxSn);
// } catch (Exception e) {
// log.error("异常信息:" + e);
// }
// }, pool);
CompletableFuture.runAsync(() -> {
try {
agvTransfer(containerNameList, deviceCode, boxSn);
} catch (Exception e) {
log.error("异常信息:" + e);
}
}, pool);
stopWatch1.stop();
System.out.println("子卷装箱代码2装箱信息更新执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch1.getTotalTimeMillis());
log.info("子卷装箱代码2装箱信息更新执行花费时间------------------------------------------------------------------------------------------*************************************************************************************************= totalTime = " + stopWatch1.getTotalTimeMillis());
}
private void updateBoxGroup(Integer maxBoxGroup, List<String> entityList, String boxType) {
// code终点,material_code木箱规格,num: 子卷数
private void updateBoxGroup(Integer maxBoxGroup, List<String> entityList, String boxSn, String boxType, String totalWeight) {
UpdateWrapper<PdmBiSubpackagerelation> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("package_box_sn", boxSn);
updateWrapper.set("quanlity_in_box", entityList.size());
updateWrapper.set("box_type", boxType);
updateWrapper.set("box_group", maxBoxGroup);
updateWrapper.set("box_weight", totalWeight);
updateWrapper.set("status", "0");
updateWrapper.in("workorder_id", entityList);
pdmBiSubpackagerelationMapper.update(null, updateWrapper);
}
/**
* 传输子卷包装关系至LMS
*/
public void transferBoxPackageToMes(boolean manual, JSONObject whereJson, Set<String> containerNameList, String boxSn, String totalWeight) {
List<PdmBiSubpackagerelation> packagerelationList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class);
JSONObject param = new JSONObject();
//手动推送
if (manual) {
if (StringUtils.isBlank(packagerelationList.get(0).getPackage_box_sn()) || packagerelationList.get(0).getBox_weight() == null) {
throw new BadRequestException("子卷未确定木箱规格信息!");
}
BigDecimal boxWeight = new BigDecimal(String.valueOf(packagerelationList.get(0).getBox_weight()));
if (boxWeight.compareTo(new BigDecimal(0)) == 0) {
throw new BadRequestException("理论毛重不能为0");
}
JSONArray containerJsonArray = packagerelationList.stream().map(PdmBiSubpackagerelation::getContainer_name).collect(Collectors.toCollection(JSONArray::new));
param.put("rows", containerJsonArray);
param.put("num", packagerelationList.size());
param.put("box_no", packagerelationList.get(0).getPackage_box_sn());
param.put("box_weight", packagerelationList.get(0).getBox_weight());
} else {
param.put("num", containerNameList.size());
param.put("rows", containerNameList.stream().collect(Collectors.toCollection(JSONArray::new)));
param.put("box_no", boxSn);
param.put("box_weight", totalWeight);
}
lmsToMesServiceImpl.momBoxPackageSubmit(param);
}
protected void agvTransfer(Set<String> containerNameList, String deviceCode, String boxSn) {
//待检区点位
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("待检区"))
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("合格品"))
//.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("有子卷"))
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
List<BstIvtPackageinfoivt> djqPoints = djqPointList.stream()
.filter(r -> containerNameList.contains(r.getContainer_name()))
.collect(Collectors.toList());
//任务组id
String groupId = deviceCode.substring(deviceCode.lastIndexOf("_") + 1);
List<SchBaseTask> schBaseTaskList = new ArrayList<>();
//确定起点,安装装箱组标识加入任务队列
djqPoints.forEach(r -> {
JSONObject jo = new JSONObject();
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"));
jo.put("vehicle_code", r.getContainer_name());
jo.put("point_code1", r.getPoint_code());
jo.put("task_status", TaskStatusEnum.SURE_START.getCode());
//木箱号
jo.put("vehicle_code2", groupId);
//任务组id
//jo.put("car_no", deviceCode);
SchBaseTask task = new SchBaseTask();
task.setTask_id(zxqTask.createTask(jo));
//增加任务到队列
schBaseTaskList.add(task);
});
//taskQueueManager.addTasksToQueue(groupId, schBaseTaskList);
if (CollectionUtils.isNotEmpty(schBaseTaskList)) {
taskQueue.addTasksToQueue(groupId, schBaseTaskList);
}
}
private String getPointCode() {
//均衡获取木箱出库装箱区对接位
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getPoint_status, "5").eq(BstIvtPackageinfoivt::getIs_used, "1").orderByAsc(BstIvtPackageinfoivt::getPoint_code));
@@ -401,55 +482,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
return minPointCode.orElseGet(() -> bstIvtPackageinfoivtList.get(0).getPoint_code());
}
protected void updateBoxInfo(List<String> entityList, String boxSn) {
UpdateWrapper<PdmBiSubpackagerelation> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("package_box_sn", boxSn);
updateWrapper.in("workorder_id", entityList);
pdmBiSubpackagerelationMapper.update(null, updateWrapper);
}
protected void agvTransfer(List<PdmBiSubpackagerelation> packagerelationList, String deviceCode, String boxSn) {
//待检区点位
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("待检区"))
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
//.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("合格品"))
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("有子卷"))
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
Set<String> containerNames = packagerelationList.stream()
.map(PdmBiSubpackagerelation::getContainer_name)
.collect(Collectors.toSet());
List<BstIvtPackageinfoivt> djqPoints = djqPointList.stream()
.filter(r -> containerNames.contains(r.getContainer_name()))
.collect(Collectors.toList());
//任务组id
String groupId = deviceCode.substring(deviceCode.lastIndexOf("_") + 1);
List<SchBaseTask> schBaseTaskList = new ArrayList<>();
//确定起点,安装装箱组标识加入任务队列
djqPoints.forEach(r -> {
JSONObject jo = new JSONObject();
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"));
jo.put("vehicle_code", r.getContainer_name());
jo.put("point_code1", r.getPoint_code());
jo.put("task_status", TaskStatusEnum.SURE_START.getCode());
//木箱号
jo.put("vehicle_code2", groupId);
//任务组id
//jo.put("car_no", deviceCode);
SchBaseTask task = new SchBaseTask();
task.setTask_id(zxqTask.createTask(jo));
//增加任务到队列
schBaseTaskList.add(task);
});
//taskQueueManager.addTasksToQueue(groupId, schBaseTaskList);
if (CollectionUtils.isNotEmpty(schBaseTaskList)) {
taskQueue.addTasksToQueue(groupId, schBaseTaskList);
}
}
/**
* 待检区->装箱区agv任务
*/
@@ -459,7 +491,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("待检区"))
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
//todo 暂时改为合格品
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("合格品"))
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
Set<String> containerNames = packagerelationList.stream()

View File

@@ -90,8 +90,9 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, pointIds, null);
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货分配"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, null, pointIds);
} else {
//taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, pointIds, pointIds)
} else if(pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务取货分配"))){
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, pointIds, pointIds);
}else{
return packageinfoivtList;
}
// 过滤未完成任务的任务

View File

@@ -26,6 +26,7 @@ import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.util.TaskUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -90,15 +91,7 @@ public class DjqTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
public void updateTaskStatus(JSONObject taskObj, String status) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
if (schBaseTask == null) {
throw new BadRequestException("满轴缓存位 -> 待检区完成接口任务号为空!");
}
if (schBaseTask.getTask_status().equals(TaskStatusEnum.FINISHED.getCode())) {
return;
}
if (StringUtils.isBlank(schBaseTask.getVehicle_code())) {
throw new BadRequestException("满轴缓存位 -> 待检区,子卷号不能为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
// 更新任务状态为执行中
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
@@ -109,7 +102,6 @@ public class DjqTask extends AbstractAcsTask {
//2.改变起点点位状态,二次分配,取货完成就改起点库存
//packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("空")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
//3更新库存记录
//todo 暂时改为质检合格品
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
//清除首次分配目标点位
schBaseTask.setPoint_code3("");
@@ -134,7 +126,6 @@ public class DjqTask extends AbstractAcsTask {
}
//5搬运装箱区
//sendDjqToZxq(schBaseTask);
}
// 取消
if (status.equals(IOSEnum.IS_NOTANDYES.code(""))) {
@@ -150,6 +141,8 @@ public class DjqTask extends AbstractAcsTask {
taskService.update(schBaseTask);
}
@Override
public String createTask(JSONObject form) {
Assert.notNull(form, "请求参数不能为空");
@@ -220,13 +213,7 @@ public class DjqTask extends AbstractAcsTask {
public void forceFinish(String taskId) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_id, taskId), false);
//todo 增加校验,完成状态不执行任何操作
if (schBaseTask == null) {
throw new BadRequestException("满轴缓存位 -> 待检区强制完成接口任务号为空!");
}
if (schBaseTask.getTask_status().equals(TaskStatusEnum.FINISHED.getCode())) {
return;
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
updateTaskStatus(JSONObject.parseObject(JSON.toJSONString(schBaseTask)), TaskStatusEnum.FINISHED.getCode());
}

View File

@@ -25,6 +25,7 @@ import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.util.TaskUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -90,9 +91,7 @@ public class DjqToKzjhcwTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
public void updateTaskStatus(JSONObject taskObj, String status) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
if (schBaseTask == null) {
throw new BadRequestException("待检区->空载具缓存位完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
// 更新任务状态为执行中
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
@@ -196,9 +195,7 @@ public class DjqToKzjhcwTask extends AbstractAcsTask {
public void forceFinish(String taskId) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_id, taskId), false);
if (schBaseTask == null) {
throw new BadRequestException("待检区->空载具缓存位强制完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
updateTaskStatus(JSONObject.parseObject(JSON.toJSONString(schBaseTask)), TaskStatusEnum.FINISHED.getCode());
}

View File

@@ -24,6 +24,7 @@ import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.util.TaskUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -86,9 +87,7 @@ public class GzqTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
public void updateTaskStatus(JSONObject taskObj, String status) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
if (schBaseTask == null) {
throw new BadRequestException("满轴缓存位 -> 管制区完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
// 更新任务状态为执行中
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
@@ -190,9 +189,7 @@ public class GzqTask extends AbstractAcsTask {
public void forceFinish(String taskId) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_id, taskId), false);
if (schBaseTask == null) {
throw new BadRequestException("满轴缓存位 -> 管制区强制完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
updateTaskStatus(JSONObject.parseObject(JSON.toJSONString(schBaseTask)), TaskStatusEnum.FINISHED.getCode());
}

View File

@@ -25,6 +25,7 @@ import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.util.TaskUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -90,9 +91,7 @@ public class GzqToKzjhcwTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
public void updateTaskStatus(JSONObject taskObj, String status) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
if (schBaseTask == null) {
throw new BadRequestException("管制区->空载具缓存位完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
// 更新任务状态为执行中
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
@@ -196,9 +195,7 @@ public class GzqToKzjhcwTask extends AbstractAcsTask {
public void forceFinish(String taskId) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_id, taskId), false);
if (schBaseTask == null) {
throw new BadRequestException("管制区->空载具缓存位强制完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
updateTaskStatus(JSONObject.parseObject(JSON.toJSONString(schBaseTask)), TaskStatusEnum.FINISHED.getCode());
}

View File

@@ -27,6 +27,7 @@ import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.util.TaskUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -107,9 +108,7 @@ public class MzhcwTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
public void updateTaskStatus(JSONObject taskObj, String status) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
if (schBaseTask == null) {
throw new BadRequestException("输送线点位 -> 满轴缓存位完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
// 执行中
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
// 更新任务状态为执行中
@@ -346,9 +345,7 @@ public class MzhcwTask extends AbstractAcsTask {
public void forceFinish(String taskId) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_id, taskId), false);
if (schBaseTask == null) {
throw new BadRequestException("输送线点位 -> 满轴缓存位强制完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
updateTaskStatus(JSONObject.parseObject(JSON.toJSONString(schBaseTask)), TaskStatusEnum.FINISHED.getCode());
}

View File

@@ -22,6 +22,7 @@ import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.util.TaskUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -80,9 +81,7 @@ public class SendDjqKzjTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
public void updateTaskStatus(JSONObject taskObj, String status) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
if (schBaseTask == null) {
throw new BadRequestException("装箱区->待检区送空载具完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
// 更新任务状态为执行中
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
@@ -166,9 +165,7 @@ public class SendDjqKzjTask extends AbstractAcsTask {
public void forceFinish(String taskId) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_id, taskId), false);
if (schBaseTask == null) {
throw new BadRequestException("装箱区->待检区送空载具强制完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
updateTaskStatus(JSONObject.parseObject(JSON.toJSONString(schBaseTask)), TaskStatusEnum.FINISHED.getCode());
}

View File

@@ -22,6 +22,7 @@ import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.util.TaskUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -80,9 +81,7 @@ public class SendGzqKzjTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
public void updateTaskStatus(JSONObject taskObj, String status) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
if (schBaseTask == null) {
throw new BadRequestException("装箱区->管制区送空载具完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
// 更新任务状态为执行中
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
@@ -166,9 +165,7 @@ public class SendGzqKzjTask extends AbstractAcsTask {
public void forceFinish(String taskId) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_id, taskId), false);
if (schBaseTask == null) {
throw new BadRequestException("装箱区->管制区送空载具强制完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
updateTaskStatus(JSONObject.parseObject(JSON.toJSONString(schBaseTask)), TaskStatusEnum.FINISHED.getCode());
}

View File

@@ -22,6 +22,7 @@ import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.util.TaskUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -83,9 +84,7 @@ public class SsxDjwTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
public void updateTaskStatus(JSONObject taskObj, String status) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
if (schBaseTask == null) {
throw new BadRequestException("空载具缓存位 -> 输送线完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
// 更新任务状态为执行中
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
@@ -184,9 +183,7 @@ public class SsxDjwTask extends AbstractAcsTask {
public void forceFinish(String taskId) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_id, taskId), false);
if (schBaseTask == null) {
throw new BadRequestException("空载具缓存位 -> 输送线强制完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
updateTaskStatus(JSONObject.parseObject(JSON.toJSONString(schBaseTask)), TaskStatusEnum.FINISHED.getCode());
}

View File

@@ -30,6 +30,7 @@ import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.util.TaskUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -101,9 +102,7 @@ public class ZxDjwTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
public void updateTaskStatus(JSONObject taskObj, String status) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
if (schBaseTask == null) {
throw new BadRequestException("装箱区 -> 装箱对接位完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
// 更新任务状态为执行中
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
@@ -129,7 +128,7 @@ public class ZxDjwTask extends AbstractAcsTask {
throw new BadRequestException("子卷包装关系为已装箱或找该任务的木箱号不存在!");
}
//4.更改木箱信息为已装箱:1
bstIvtBoxinfo.setIs_packing("1");
bstIvtBoxinfo.setIs_packing(IOSEnum.IS_NOTANDYES.code(""));
bstIvtBoxinfoMapper.updateById(bstIvtBoxinfo);
}
if (packagerelationList.size() == 1 && packagerelationList.get(0).getContainer_name().equals(schBaseTask.getVehicle_code())) {
@@ -139,7 +138,7 @@ public class ZxDjwTask extends AbstractAcsTask {
//6.改变子卷包装状态为已装箱1
PdmBiSubpackagerelation pdmBiSubpackagerelation = subpackageRelationService
.getOne(new LambdaUpdateWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getContainer_name, schBaseTask.getVehicle_code()), false);
pdmBiSubpackagerelation.setStatus("1");
pdmBiSubpackagerelation.setStatus(IOSEnum.IS_NOTANDYES.code(""));
subpackageRelationService.updateById(pdmBiSubpackagerelation);
//创建装箱区->空载具缓存位补空任务
//kzjhcwTask.toKzjHcw(schBaseTask.getPoint_code1());
@@ -218,9 +217,7 @@ public class ZxDjwTask extends AbstractAcsTask {
public void forceFinish(String taskId) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_id, taskId), false);
if (schBaseTask == null) {
throw new BadRequestException("装箱区 -> 装箱对接位强制完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
updateTaskStatus(JSONObject.parseObject(JSON.toJSONString(schBaseTask)), TaskStatusEnum.FINISHED.getCode());
}

View File

@@ -31,6 +31,7 @@ import org.nl.system.service.param.ISysParamService;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.util.TaskUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -113,9 +114,7 @@ public class ZxqTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
public void updateTaskStatus(JSONObject taskObj, String status) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>().eq(SchBaseTask::getTask_id, taskObj.getString("task_id")), false);
if (schBaseTask == null) {
throw new BadRequestException("待检区 -> 装箱区完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
// 更新任务状态为执行中
schBaseTask.setTask_status(TaskStatusEnum.EXECUTING.getCode());
@@ -290,9 +289,7 @@ public class ZxqTask extends AbstractAcsTask {
public void forceFinish(String taskId) {
SchBaseTask schBaseTask = taskService.getOne(new LambdaUpdateWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_id, taskId), false);
if (schBaseTask == null) {
throw new BadRequestException("待检区 -> 装箱区强制完成接口任务号为空!");
}
if (TaskUtil.checkParams(schBaseTask,THIS_CLASS)) return;
updateTaskStatus(JSONObject.parseObject(JSON.toJSONString(schBaseTask)), TaskStatusEnum.FINISHED.getCode());
}

View File

@@ -36,33 +36,12 @@ public class AutoSendToZxq {
this.sendDjqToZxq();
}
/**
* 普通任务
*/
void sendDjqToZxq() {
JSONObject toDjqTask = new JSONObject();
//待检区有子卷且过滤未完成任务
List<BstIvtPackageinfoivt> djqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.IVT_STATUS.code("有子卷"), PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务"), "", "");
if (CollectionUtils.isEmpty(djqPackageinfoivtList)) {
return;
}
List<BstIvtPackageinfoivt> zxqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code(""), PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"), "", "");
if (CollectionUtils.isEmpty(zxqPackageinfoivtList)) {
return;
}
toDjqTask.put("vehicle_code", djqPackageinfoivtList.get(0).getContainer_name());
toDjqTask.put("point_code1", djqPackageinfoivtList.get(0).getPoint_code());
toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"));
toDjqTask.put("point_code2", zxqPackageinfoivtList.get(0).getPoint_code());
zxqTask.createTask(toDjqTask);
}
/**
* 二次分配任务
*/
public void sendDjqToZxq1() {
public void sendDjqToZxq() {
//装箱区有空位,去待检区消费合格品子卷
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = packageinfoivtService.checkEndPointTask(
PackageInfoIvtEnum.POINT_STATUS.code("装箱区"),

View File

@@ -16,6 +16,7 @@ import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
import org.nl.b_lms.sch.tasks.first_floor_area.ZxDjwTask;
import org.nl.b_lms.storage_manage.database.service.dao.BstIvtBoxinfo;
import org.nl.b_lms.storage_manage.database.service.dao.mapper.BstIvtBoxinfoMapper;
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.common.enums.PackageInfoIvtEnum;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.system.service.param.ISysParamService;
@@ -25,6 +26,8 @@ import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
import static org.nl.wms.util.TaskUtil.getMaxNum;
@Slf4j
@Component
@@ -57,12 +60,12 @@ public class AutoSendZxToDjw {
void sendZxToDjw() {
//装箱位有木箱
List<BstIvtPackageinfoivt> zxwPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱位"), PackageInfoIvtEnum.IVT_STATUS.code("空载具"), PackageInfoIvtEnum.TASK_POINT_TYPE.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)) {
return;
}
//装箱区有子卷且没有正在进行的装箱任务
List<BstIvtPackageinfoivt> zxqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("有子卷"), PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务"), "", "");
List<BstIvtPackageinfoivt> zxqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code("有子卷"),"", "", "");
if (CollectionUtils.isEmpty(zxqPackageinfoivtList)) {
return;
}
@@ -98,21 +101,21 @@ public class AutoSendZxToDjw {
jo.put("point_code2", zxwPackageinfoivtList.get(0).getPoint_code());
jo.put("vehicle_code", containerName);
jo.put("vehicle_code2", boxNo);
jo.put("is_send", "1");
jo.put("is_send", IOSEnum.IS_NOTANDYES.code(""));
//扩展参数
JSONObject param = new JSONObject();
//查询是否为最后一个子卷,相同木箱号且子卷包装状态为生成
List<PdmBiSubpackagerelation> packagerelationList = subpackageRelationService.list(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getPackage_box_sn, boxNo).eq(PdmBiSubpackagerelation::getStatus, "0"));
if (packagerelationList.size() == 1 && packagerelationList.get(0).getContainer_name().equals(containerName)) {
//最后子卷
param.put("lastOne", "1");
param.put("lastOne", IOSEnum.IS_NOTANDYES.code(""));
} else {
param.put("lastOne", "0");
param.put("lastOne", IOSEnum.IS_NOTANDYES.code(""));
}
//获取木箱高度等级
param.put("heightLevel", getHeightLevel(bstIvtBoxinfo));
//获取子卷长度
param.put("len", getMaxNum(productionPlanList));
param.put("len", getMaxNum(productionPlanList.get(0),null));
//木箱最大数量
param.put("maxNo", bstIvtBoxinfo.getNum());
//托盘类型 1小托盘 2大托盘
@@ -154,20 +157,7 @@ public class AutoSendZxToDjw {
return height;
}
private static int getMaxNum(List<PdmBiSlittingproductionplan> productionPlanList) {
String containerLength = productionPlanList.get(0).getPaper_tube_or_FRP().equals("1") ? productionPlanList.get(0).getPaper_tube_description() : productionPlanList.get(0).getFRP_description();
int maxNum = 0;
for (String part : containerLength.split("\\|")) {
String numStr = part.replaceAll("\\D+", "");
if (!numStr.isEmpty()) {
int num = Integer.parseInt(numStr);
if (num > maxNum) {
maxNum = num;
}
}
}
return maxNum;
}
// void sendMzqToDjq() {

View File

@@ -0,0 +1,54 @@
package org.nl.b_lms.sch.tasks.first_floor_area.auto;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
import org.nl.b_lms.sch.tasks.first_floor_area.ZxqTask;
import org.nl.common.enums.PackageInfoIvtEnum;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
@Slf4j
@Component
@RequiredArgsConstructor
public class ManualSendToZxq {
@Resource
private IbstIvtPackageinfoivtService packageinfoivtService;
@Resource
private ZxqTask zxqTask;
//待检区->装箱区agv手动搬运任务
public void run() {
this.sendDjqToZxq();
}
/**
* 普通任务
*/
void sendDjqToZxq() {
JSONObject toDjqTask = new JSONObject();
//待检区有子卷且过滤未完成任务
List<BstIvtPackageinfoivt> djqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.IVT_STATUS.code("合格品"), PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务"), "", "");
if (CollectionUtils.isEmpty(djqPackageinfoivtList)) {
return;
}
List<BstIvtPackageinfoivt> zxqPackageinfoivtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("装箱区"), PackageInfoIvtEnum.IVT_STATUS.code(""), PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"), "", "");
if (CollectionUtils.isEmpty(zxqPackageinfoivtList)) {
return;
}
toDjqTask.put("vehicle_code", djqPackageinfoivtList.get(0).getContainer_name());
toDjqTask.put("point_code1", djqPackageinfoivtList.get(0).getPoint_code());
toDjqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱区"));
toDjqTask.put("point_code2", zxqPackageinfoivtList.get(0).getPoint_code());
zxqTask.createTask(toDjqTask);
}
}

View File

@@ -87,5 +87,10 @@ public class BstIvtBoxinfo implements Serializable {
*/
private String insert_time;
/*
* 木箱重量
*/
private String box_weight;
}

View File

@@ -1,5 +1,11 @@
package org.nl.wms.util;
import org.apache.commons.lang3.StringUtils;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.sch.manage.TaskStatusEnum;
public class TaskUtil {
/**
@@ -12,4 +18,38 @@ public class TaskUtil {
return "normal";
}
}
/**
* 任务类参数校验
*/
public static boolean checkParams(SchBaseTask schBaseTask, String taskType) {
if (schBaseTask == null) {
throw new BadRequestException("任务类型为:" + taskType + "完成接口任务号为空!");
}
if (schBaseTask.getTask_status().equals(TaskStatusEnum.FINISHED.getCode())) {
return true;
}
if (StringUtils.isBlank(schBaseTask.getVehicle_code())) {
throw new BadRequestException("任务类型为:" + taskType + "子卷号不能为空!");
}
return false;
}
/**
* 根据分切计划获取子卷长度
*/
public static int getMaxNum(PdmBiSlittingproductionplan productionPlan, String paperDescription) {
String containerLength = productionPlan != null ? productionPlan.getPaper_tube_or_FRP().equals("1") ? productionPlan.getPaper_tube_description() : productionPlan.getFRP_description() : paperDescription;
int maxNum = 0;
for (String part : containerLength.split("\\|")) {
String numStr = part.replaceAll("\\D+", "");
if (!numStr.isEmpty()) {
int num = Integer.parseInt(numStr);
if (num > maxNum) {
maxNum = num;
}
}
}
return maxNum;
}
}