This commit is contained in:
2024-05-20 09:23:35 +08:00
22 changed files with 354 additions and 70 deletions

View File

@@ -39,4 +39,11 @@ public class VehicleTwoController {
public ResponseEntity<Object> boxIn(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(vehicleTwoService.boxIn(whereJson), HttpStatus.OK);
}
@PostMapping("/returnIn")
@Log("退货入库")
@SaIgnore
public ResponseEntity<Object> returnIn(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(vehicleTwoService.returnIn(whereJson), HttpStatus.OK);
}
}

View File

@@ -30,4 +30,15 @@ public interface VehicleTwoService {
* @return JSONObject返回前端参数~
*/
JSONObject boxIn(JSONObject whereJson);
/**
*
* @param whereJson {
* box_no: 木箱号
* vehicle_code: 载具号
* point_code: 点位
* }
* @return JSONObject返回前端参数~
*/
JSONObject returnIn(JSONObject whereJson);
}

View File

@@ -149,4 +149,13 @@ public class VehicleTwoServiceImpl implements VehicleTwoService {
return result;
}
@Override
public JSONObject returnIn(JSONObject whereJson) {
// 调用接口
inBoxManageService.returnIn(whereJson);
JSONObject result = new JSONObject();
result.put("message", "入库成功!");
return result;
}
}

View File

@@ -1,14 +1,11 @@
package org.nl.b_lms.pdm.subpackagerelation.service.impl;
import cn.hutool.core.map.MapUtil;
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 org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.mapper.PdmBiSlittingproductionplanMapper;
@@ -17,6 +14,9 @@ import org.nl.b_lms.pdm.subpackagerelation.dao.mapper.PdmBiSubpackagerelationMap
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.tasks.first_floor_area.ZxDjwTask;
import org.nl.b_lms.sch.tasks.first_floor_area.ZxqTask;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutBoxManageService;
import org.nl.common.enums.PackageInfoIvtEnum;
@@ -24,8 +24,6 @@ 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.wms.pdm.service.SlittingproductionplanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.nl.common.domain.query.PageQuery;
@@ -49,13 +47,20 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
@Resource
private ZxqTask zxqTask;
@Resource
private ZxDjwTask zxDjwTask;
@Resource
private OutBoxManageService outBoxManageService;
@Resource
private PdmBiSlittingproductionplanMapper pdmBiSlittingproductionplanMapper;
@Resource
private IbstIvtPackageinfoivtService packageinfoivtService;
@Resource
private PdmBiSubpackagerelationMapper pdmBiSubpackagerelationMapper;
@Resource
private BstIvtPackageinfoivtMapper bstIvtPackageinfoivtMapper;
/**
* 查询数据分页
@@ -178,6 +183,10 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
@Transactional(rollbackFor = Exception.class)
public void updateEntityList(JSONObject whereJson) {
List<PdmBiSubpackagerelation> packagerelationList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class);
List<PdmBiSubpackagerelation> isOutBox = packagerelationList.stream().filter(r -> r.getStatus().equals("0")).collect(Collectors.toList());
if (isOutBox.size() > 0) {
throw new BadRequestException("标记为黄色的子卷号已分配木箱,请重新选择未分配木箱的子卷");
}
List<String> entityList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class).stream()
.map(PdmBiSubpackagerelation::getWorkorder_id)
.map(String::valueOf)
@@ -199,22 +208,59 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
String boxType = whereJson.getString("checked");
updateWrapper.set("box_type", boxType);
updateWrapper.set("box_group", maxBoxGroup);
// updateWrapper.set("status", "0");
updateWrapper.set("status", "0");
updateWrapper.in("workorder_id", entityList);
pdmBiSubpackagerelationMapper.update(null, updateWrapper);
//下发空木箱出库任务
//outBox(entityList, boxType);
//下发装箱区桁架任务
transferToPacking(packagerelationList);
//outBox(entityList, packagerelationList, boxType);
} catch (Exception e) {
throw new BadRequestException(e.getMessage());
}
}
private void outBox(List<String> entityList, String boxType) {
/**
* 空木箱出库
*/
private void outBox(List<String> entityList, List<PdmBiSubpackagerelation> packagerelationList, String boxType) {
JSONObject boxInfo = new JSONObject();
//todo 测试暂时默认ZXQ_1_1
boxInfo.put("device_code", "ZXQ_1_1");
String deviceCode;
//均衡获取木箱出库终点
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getPoint_status, "5").eq(BstIvtPackageinfoivt::getIs_used, "1").orderByAsc(BstIvtPackageinfoivt::getPoint_code));
if (CollectionUtils.isEmpty(bstIvtPackageinfoivtList)) {
throw new BadRequestException("没有可用的装箱区对接位");
}
List<Map<String, Integer>> pointCodeList = bstIvtPackageinfoivtList.stream()
.map(p -> {
Map<String, Integer> map = new HashMap<>();
map.put(p.getPoint_code(), StringUtils.isNotBlank(p.getContainer_name()) ? 1 : 0);
return map;
})
.collect(Collectors.toList());
//获取装箱位任务数量
List<Map<String, Integer>> taskCount = bstIvtPackageinfoivtMapper.getPointTaskCount();
if (CollectionUtils.isNotEmpty(taskCount)) {
for (Map<String, Integer> p : pointCodeList) {
for (Map.Entry<String, Integer> e : p.entrySet()) {
String pointCode = e.getKey();
for (Map<String, Integer> taskMap : taskCount) {
if (taskMap.containsKey(pointCode)) {
e.setValue(taskMap.get(pointCode));
break;
}
}
}
}
//获取资源最少的装箱对接位
Optional<String> minPointKey = pointCodeList.stream()
.min(Comparator.comparingInt(map -> map.entrySet().iterator().next().getValue()))
.map(map -> map.keySet().iterator().next());
deviceCode = minPointKey.orElse("");
} else {
deviceCode = bstIvtPackageinfoivtList.get(0).getPoint_code();
}
//确定装箱区终点
boxInfo.put("device_code", deviceCode);
boxInfo.put("material_code", boxType);
boxInfo.put("num", entityList.size());
String boxSn = outBoxManageService.outBox(boxInfo);
@@ -226,21 +272,56 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
updateWrapper1.set("package_box_sn", boxSn);
updateWrapper1.in("workorder_id", entityList);
pdmBiSubpackagerelationMapper.update(null, updateWrapper1);
//待检区->装箱区agv任务
agvTransfer(packagerelationList, deviceCode, boxSn);
}
/**
* 待检区->装箱区agv任务
*/
private 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("有子卷"))
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
Set<String> containerNames = packagerelationList.stream()
.map(PdmBiSubpackagerelation::getContainer_name)
.collect(Collectors.toSet());
List<BstIvtPackageinfoivt> djqPoints = djqPointList.stream()
.filter(djqPoint -> containerNames.contains(djqPoint.getContainer_name()))
.collect(Collectors.toList());
//下发agv任务
djqPoints.forEach(r -> {
//装箱区点位
List<BstIvtPackageinfoivt> zxqPointList = 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::getBlock, deviceCode.substring(deviceCode.indexOf("_") + 1))
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
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("vehicle_code2", boxSn);
//装箱区没满,则确定起点与终点,如果满了则只确定起点
if (CollectionUtils.isNotEmpty(zxqPointList)) {
jo.put("point_code2", zxqPointList.get(0).getPoint_code());
}
zxqTask.createTask(jo);
});
}
private void transferToPacking(List<PdmBiSubpackagerelation> packagerelationList) {
//创建子卷搬运到装箱区任务
// List<BstIvtPackageinfoivt> zxqPointList = 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("空"))
// .orderByAsc(BstIvtPackageinfoivt::getSort_seq));
// //装箱区有点位,就下发
// if (CollectionUtils.isNotEmpty(zxqPointList)) {
//下发装箱区->装箱对接位桁架任务
JSONObject jo = new JSONObject();
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("待检区->装箱"));
jo.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("装箱区->装箱对接位"));
//todo 测试,装箱点位-1-1
jo.put("point_code1", "ZXQ_1_9");
//todo 测试装箱对接位01
@@ -279,13 +360,8 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
//托盘类型 1小托盘 2大托盘
param.put("containerType", "2");
jo.put("request_param", param.toString());
zxqTask.createTask(jo);
// } else {
// throw new BadRequestException("装箱区暂无空余库位!");
// }
}
zxDjwTask.createTask(jo);
}
/**
* 多选删除

View File

@@ -1,7 +1,12 @@
package org.nl.b_lms.sch.point.dao.mapper;
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import java.util.List;
import java.util.Map;
/**
* {@code @Description:} 装箱区点位库存表(BstIvtPackageinfoivt)数据持久层
@@ -11,5 +16,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface BstIvtPackageinfoivtMapper extends BaseMapper<BstIvtPackageinfoivt> {
/**
* 获取对接位任务数量
*/
List<Map<String,Integer>> getPointTaskCount();
}

View File

@@ -1,6 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.b_lms.sch.point.dao.mapper.BstIvtPackageinfoivtMapper">
<select id="getPointTaskCount" resultType="java.util.Map">
SELECT
p.point_code,
COUNT(t.point_code2) AS count
FROM
bst_ivt_packageinfoivt p
LEFT JOIN
sch_base_task t ON p.point_code = t.point_code2
WHERE
p.point_status = '5'
AND t.task_status <![CDATA[ < ]]> '07'
GROUP BY
p.point_code
ORDER BY
p.point_code;
</select>
</mapper>

View File

@@ -85,7 +85,7 @@ public class TwoLashTask extends AbstractAcsTask {
interaction_json.put("length",dao.get(0).getBox_length());
interaction_json.put("weight",dao.get(0).getBox_width());
interaction_json.put("height",dao.get(0).getBox_high());
interaction_json.put("template",dao.get(0).getBox_high());
interaction_json.put("template","2");
interaction_json.put("bindingTimes","1");
char dtl_type = json.getString("task_type").charAt(json.getString("task_type").length() - 1);
@@ -214,7 +214,7 @@ public class TwoLashTask extends AbstractAcsTask {
json.put("create_name", SecurityUtils.getCurrentUsername());
json.put("create_time", DateUtil.now());
json.put("priority", "1");
json.put("acs_task_type", "7");
json.put("acs_task_type", "6");
WQLObject.getWQLObject("SCH_BASE_Task").insert(json);
return json.getString("task_id");

View File

@@ -72,7 +72,8 @@ public class TwoOutTask extends AbstractAcsTask {
.task_type(json.getString("acs_task_type"))
.start_device_code(json.getString("point_code1"))
.next_device_code(json.getString("point_code2"))
.vehicle_code(json.getString("vehicle_code2"))
.vehicle_code(json.getString("vehicle_code"))
.interaction_json(json.getJSONObject("request_param"))
.priority(json.getString("priority"))
.class_type(json.getString("task_type"))
.dtl_type(String.valueOf(dtl_type))
@@ -179,6 +180,7 @@ public class TwoOutTask extends AbstractAcsTask {
json.put("task_group_id", form.getString("task_group_id"));
json.put("is_auto_issue", form.getString("is_auto_issue"));
json.put("table_fk", form.getString("table_fk"));
json.put("request_param", form.getString("request_param"));
json.put("sort_seq", form.getIntValue("sort_seq"));
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());

View File

@@ -11,7 +11,6 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
@@ -30,7 +29,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@@ -49,13 +47,8 @@ public class DjqTask extends AbstractAcsTask {
@Resource
private IbstIvtPackageinfoivtService packageinfoivtService;
@Resource
private OutBoxManageService outBoxManageService;
@Resource
private IpdmBiSubpackagerelationService pdmBiSubpackagerelationService;
@Resource
private MzhcwTask mzhcwTask;
@Resource
private ZxqTask zxqTask;
private final String THIS_CLASS = DjqTask.class.getName();
@@ -108,10 +101,9 @@ public class DjqTask extends AbstractAcsTask {
schBaseTask.setTask_status(TaskStatusEnum.FINISHED.getCode());
//2.改变起点点位状态
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
//更新库存记录
//3更新库存记录
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
String vehicleCode = schBaseTask.getVehicle_code();
//5.查询是否有未下发的输送线->满轴位任务,有就下发
//4.查询是否有未下发的输送线->满轴位任务,有就下发
List<SchBaseTask> notIssueTaskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>()
//确定起点
.eq(SchBaseTask::getTask_type, PackageInfoIvtEnum.TASK_TYPE.code("输送线->满轴缓存位"))

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
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;
@@ -12,11 +13,15 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
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.service.IpdmBiSubpackagerelationService;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.b_lms.sch.task.dto.SchBaseTaskVO;
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
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.common.utils.SecurityUtils;
@@ -27,7 +32,6 @@ import org.nl.wms.sch.manage.TaskStatusEnum;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -45,8 +49,13 @@ import java.util.stream.Collectors;
public class ZxDjwTask extends AbstractAcsTask {
@Resource
private ZxqTask zxqTask;
private DjqTask djqTask;
@Resource
private BstIvtBoxinfoMapper bstIvtBoxinfoMapper;
@Resource
private IpdmBiSubpackagerelationService subpackageRelationService;
@Resource
private IschBaseTaskService taskService;
@Resource
@@ -91,7 +100,7 @@ public class ZxDjwTask extends AbstractAcsTask {
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("满轴缓存位 -> 管制区更新接口任务号为空!");
throw new BadRequestException("装箱区 -> 装箱对接位更新接口任务号为空!");
}
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
// 更新任务状态为执行中
@@ -111,7 +120,19 @@ public class ZxDjwTask extends AbstractAcsTask {
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
//更新库存记录
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
//3.创建搬运空载具任务,放空(装箱区->待检区)
//3.更改子卷信息状态为包装1创建装箱区->装箱位桁架任务的时候判断是否最后一个子卷相同木箱号如果生成状态0个数等于1且子卷号等于当前载具号就是最后一个子卷
PdmBiSubpackagerelation pdmBiSubpackagerelation = subpackageRelationService
.getOne(new LambdaUpdateWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getContainer_name, schBaseTask.getVehicle_code()), false);
pdmBiSubpackagerelation.setStatus("1");
subpackageRelationService.updateById(pdmBiSubpackagerelation);
//4.查询同一个木箱号如果生成状态0个数等于0更新该木箱信息表为包装1
List<PdmBiSubpackagerelation> packagerelationList = subpackageRelationService.list(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getPackage_box_sn, schBaseTask.getVehicle_code2()).eq(PdmBiSubpackagerelation::getStatus, "0"));
if (CollectionUtils.isEmpty(packagerelationList)) {
BstIvtBoxinfo bstIvtBoxinfo = bstIvtBoxinfoMapper.selectOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, schBaseTask.getVehicle_code2()).eq(BstIvtBoxinfo::getIs_packing, null));
bstIvtBoxinfo.setIs_packing("1");
bstIvtBoxinfoMapper.updateById(bstIvtBoxinfo);
}
//5.装箱区->装箱对接位桁架任务完成后,创建搬运空载具任务,放空(装箱区->待检区)
List<BstIvtPackageinfoivt> djqOrGzqPointList = packageinfoivtService
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
.in(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("待检区"), PackageInfoIvtEnum.POINT_STATUS.code("管制区"))
@@ -119,6 +140,7 @@ public class ZxDjwTask extends AbstractAcsTask {
List<BstIvtPackageinfoivt> djqPointList = djqOrGzqPointList.stream().filter(r -> r.getPoint_status().equals(PackageInfoIvtEnum.POINT_STATUS.code("待检区"))).collect(Collectors.toList());
JSONObject toDjqOrGzqTask = new JSONObject();
toDjqOrGzqTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("放空(装箱区->待检区)"));
//装箱区->待检区起点为桁架任务的起点
toDjqOrGzqTask.put("point_code1", schBaseTask.getPoint_code1());
if (CollectionUtils.isNotEmpty(djqPointList)) {
//优先送到待检区
@@ -127,7 +149,7 @@ public class ZxDjwTask extends AbstractAcsTask {
toDjqOrGzqTask.put("point_code2", djqOrGzqPointList.get(0).getPoint_code());
}
toDjqOrGzqTask.put("vehicle_code", containerInfo.getContainer_name());
zxqTask.createTask(toDjqOrGzqTask);
djqTask.createTask(toDjqOrGzqTask);
}
// 取消
if (status.equals(IOSEnum.IS_NOTANDYES.code(""))) {

View File

@@ -6,12 +6,14 @@ import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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.extern.slf4j.Slf4j;
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.bi.slittingproductionplan.service.dao.mapper.PdmBiSlittingproductionplanMapper;
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation;
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
@@ -19,6 +21,8 @@ import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.b_lms.sch.task.dto.SchBaseTaskVO;
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
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.common.utils.SecurityUtils;
@@ -29,6 +33,7 @@ import org.nl.wms.sch.manage.TaskStatusEnum;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -49,8 +54,6 @@ public class ZxqTask extends AbstractAcsTask {
private ZxDjwTask zxDjwTask;
@Resource
private IschBaseTaskService taskService;
@Resource
@@ -60,6 +63,13 @@ public class ZxqTask extends AbstractAcsTask {
@Resource
private IPdmBiSlittingproductionplanService productionPlanService;
@Resource
private PdmBiSlittingproductionplanMapper pdmBiSlittingproductionplanMapper;
@Resource
private BstIvtBoxinfoMapper bstIvtBoxinfoMapper;
private final String THIS_CLASS = ZxqTask.class.getName();
@Override
@@ -117,8 +127,7 @@ public class ZxqTask extends AbstractAcsTask {
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("")).set("container_name", null).eq("point_code", schBaseTask.getPoint_code1()));
//更新库存记录
packageinfoivtService.update(new UpdateWrapper<BstIvtPackageinfoivt>().set("ivt_status", PackageInfoIvtEnum.IVT_STATUS.code("有子卷")).set("container_name", schBaseTask.getVehicle_code()).eq("point_code", schBaseTask.getPoint_code2()));
//todo 3.刘先源的空木箱出库任务完成状态更新时,判断装箱区是否存在木箱号对应的子卷,如果存在,就创建搬运任务
//4.查询子卷对应的包装关系表,判断装箱位的木箱号是否为子卷对应的木箱号,是,创建搬运任务到装箱对接位位,否,什么都不做
//3.查询子卷对应的包装关系表,判断装箱位的木箱号是否为子卷对应的木箱号,是,创建搬运任务到装箱对接位位桁架任务,否,什么都不做
PdmBiSubpackagerelation pdmBiSubpackagerelation = subpackageRelationService
.getOne(new LambdaUpdateWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getContainer_name, schBaseTask.getVehicle_code()), false);
if (pdmBiSubpackagerelation != null) {
@@ -135,6 +144,49 @@ public class ZxqTask extends AbstractAcsTask {
jo.put("point_code1", schBaseTask.getPoint_code2());
jo.put("point_code2", zxdjwPoint.getPoint_code());
jo.put("vehicle_code", schBaseTask.getVehicle_code());
jo.put("is_send", "1");
List<PdmBiSlittingproductionplan> productionPlanList = pdmBiSlittingproductionplanMapper.selectList(new LambdaQueryWrapper<PdmBiSlittingproductionplan>().eq(PdmBiSlittingproductionplan::getContainer_name, schBaseTask.getVehicle_code()));
if (productionPlanList.isEmpty()) {
throw new BadRequestException("该子卷暂无分切计划信息");
}
//获取纸管长度
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;
}
}
}
//扩展参数
JSONObject param = new JSONObject();
//获取木箱信息,未包装的木箱
BstIvtBoxinfo bstIvtBoxinfo = bstIvtBoxinfoMapper.selectOne(new LambdaQueryWrapper<BstIvtBoxinfo>().eq(BstIvtBoxinfo::getBox_no, schBaseTask.getVehicle_code2()).eq(BstIvtBoxinfo::getIs_packing, null));
if (bstIvtBoxinfo == null) {
throw new BadRequestException("找不到木箱信息!");
}
//木箱最大数量
param.put("maxNo", bstIvtBoxinfo.getNum());
//托盘类型 1小托盘 2大托盘
param.put("containerType", bstIvtBoxinfo.getVehicle_type());
//查询是否为最后一个子卷,相同木箱号且状态为生成
List<PdmBiSubpackagerelation> packagerelationList = subpackageRelationService.list(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getPackage_box_sn, schBaseTask.getVehicle_code2()).eq(PdmBiSubpackagerelation::getStatus, "0"));
if (packagerelationList.size() == 1 && packagerelationList.get(0).getContainer_name().equals(schBaseTask.getVehicle_code())) {
//最后子卷
param.put("lastOne", "1");
} else {
param.put("lastOne", "0");
}
//木箱放入子卷数量
param.put("boxNo", pdmBiSubpackagerelation.getQuanlity_in_box());
//子卷号
param.put("barcode", schBaseTask.getVehicle_code());
//子卷长度
param.put("len", maxNum);
jo.put("request_param", param.toString());
zxDjwTask.createTask(jo);
}
}

View File

@@ -30,7 +30,7 @@ public class BstIvtBoxinfo implements Serializable {
* 木箱标识
*/
@TableId(value = "box_id")
private Long box_id;
private String box_id;
/*
* 木箱号

View File

@@ -47,7 +47,7 @@ public class BstIvtBoxinfoServiceImpl extends ServiceImpl<BstIvtBoxinfoMapper, B
public BstIvtBoxinfo mesInsert(JSONObject whereJson) {
BstIvtBoxinfo boxDao = BstIvtBoxinfo.builder()
.box_id(IdUtil.getLongId())
.box_id(IdUtil.getStringId())
.box_high(whereJson.getString("Height"))
.box_length(whereJson.getString("Length"))
.box_width(whereJson.getString("Width"))

View File

@@ -86,7 +86,7 @@ public enum IOSEnum {
ZDEPTH_STRUCT(MapOf.of("", "1","","2","","3")),
//是否自动下发
IS_SEND(MapOf.of("", "1","","2")),
IS_SEND(MapOf.of("", "1","","0")),
//外部系统
EXT_SYSTEM(MapOf.of("mes", "mes","sap","sap","crm","crm")),
@@ -95,7 +95,7 @@ public enum IOSEnum {
PRODUCT_AREA(MapOf.of("BLK", "BLK")),
//acs申请任务
ACSTOLMS_TYPE(MapOf.of("成品入库任务", "1","空盘入库","2","空盘出库","3","异常处理位","4","木箱入库","5","贴标","1","捆扎","2")),
ACSTOLMS_TYPE(MapOf.of("成品入库任务", "1","空盘入库","2","空盘出库","3","异常处理位","4","木箱入库","5","退货入库","6","贴标","1","捆扎","2")),
;
private Map<String, String> code;

View File

@@ -13,6 +13,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.b_lms.pdm_manage.enums.SUBEnum;
import org.nl.b_lms.sch.tasks.TwoOutExceptionalTask;
import org.nl.b_lms.sch.tasks.TwoOutTask;
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.ios.enums.IOSEnum;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvOutService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvService;
@@ -97,6 +99,9 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
@Autowired
private InBussManageService inBussManageService;
@Autowired
private IBstIvtBoxinfoService iBstIvtBoxinfoService;
@Override
@Transactional
public String insertMst(JSONObject whereJson) {
@@ -1272,6 +1277,13 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
}
jsonTaskParam.put("task_group_id", task_group_id);
jsonTaskParam.put("is_auto_issue", is_auto_issue);
JSONObject request_param = new JSONObject();
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
new QueryWrapper<BstIvtBoxinfo>().lambda()
.eq(BstIvtBoxinfo::getBox_no, json.getString("storagevehicle_code"))
);
request_param.put("containerType", boxDao.getVehicle_type());
request_param.put("request_param", request_param);
jsonTaskParam.put("table_fk", disDaoList.get(0).getIostorinv_id().toString());
if (json.getString("zdepth").equals(IOSEnum.ZDEPTH_STRUCT.code("")) ||
@@ -1460,6 +1472,7 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
mstDao.setDetail_count(BigDecimal.valueOf(whereJson.getJSONArray("tableData").size()));
mstDao.setRemark(whereJson.getString("remark"));
mstDao.setTotal_qty(whereJson.getBigDecimal("total_qty"));
mstDao.setBill_type(whereJson.getString("bill_type"));
mstDao.setUpdate_optid(Long.parseLong(SecurityUtils.getCurrentUserId()));
mstDao.setUpdate_optname(SecurityUtils.getCurrentNickName());
mstDao.setUpdate_time(DateUtil.now());

View File

@@ -260,6 +260,67 @@ public class InBoxManageServiceImpl implements InBoxManageService {
taskBean.immediateNotifyAcs(null);
}
@Override
public void returnIn(JSONObject whereJson) {
// 载具表
WQLObject vehicleTab = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
// 载具扩展属性表
// WQLObject veExtTab = WQLObject.getWQLObject("md_pb_storagevehicleext");
/*
* 查询mes木箱信息插入木箱信息表
*/
// TODO 调用mes接口
JSONObject mesBoxInfo = new JSONObject();
// 插入木箱信息表
// iBstIvtBoxinfoService.mesInsert(mesBoxInfo);
/*
* 插入木箱对应载具表
*/
//查询对应的木箱信息
// 查询木箱信息
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
new QueryWrapper<BstIvtBoxinfo>().lambda()
.eq(BstIvtBoxinfo::getBox_no, whereJson.getString("box_no"))
);
if (boxDao == null) {
throw new BadRequestException("木箱不存在!");
}
JSONObject jsonVehicle = vehicleTab.query("storagevehicle_code = '" + whereJson.getString("vehicle_code") + "'")
.uniqueResult(0);
// if (ObjectUtil.isEmpty(jsonVehicle)) {
// throw new BadRequestException("载具不存在!");
// }
// JSONObject jsonVeExt = new JSONObject();
// jsonVeExt.put("storagevehicleext_id", IdUtil.getLongId());
// jsonVeExt.put("storagevehicle_id", jsonVehicle.getLongValue("storagevehicle_id"));
// jsonVeExt.put("storagevehicle_code", jsonVehicle.getString("storagevehicle_code"));
// jsonVeExt.put("storagevehicle_type", jsonVehicle.getString("storagevehicle_type"));
// jsonVeExt.put("pcsn", whereJson.getString("box_no"));
// jsonVeExt.put("device_uuid", IdUtil.getLongId());
// veExtTab.insert(jsonVeExt);
// 下发桁架任务
JSONObject taskParam = new JSONObject();
taskParam.put("task_type", "010713");
taskParam.put("start_device_code", whereJson.getString("point_code"));
taskParam.put("next_device_code", "CK2005");
taskParam.put("vehicle_code", whereJson.getString("box_no"));
// taskParam.put("vehicle_code2", whereJson.getString("box_no"));
JSONObject param = new JSONObject();
param.put("layer", whereJson.getString("layer"));
param.put("length", boxDao.getBox_length());
param.put("width", boxDao.getBox_width());
param.put("height", boxDao.getBox_high());
param.put("containerType", boxDao.getVehicle_type());
param.put("barcode", whereJson.getString("box_no"));
taskParam.put("request_param", param.toString());
TwoInBoxTrussTask taskBean = new TwoInBoxTrussTask();
taskBean.createTask(taskParam);
taskBean.immediateNotifyAcs(null);
}
@Override
@Transactional
public String taskExceptional(JSONObject jsonObject) {

View File

@@ -220,7 +220,7 @@ public class InBussManageServiceImpl implements InBussManageService {
mst.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
mst.put("total_qty", subList.stream().map(row -> row.getDoubleValue("net_weight")).reduce(Double::sum).orElse(0.00));
mst.put("detail_count", subList.size());
mst.put("bill_type", IOSEnum.IN_TYPE.code("生产入库"));
mst.put("bill_type", jsonObject.getString("bill_type"));
mst.put("biz_date", DateUtil.today());
mst.put("remark", "");

View File

@@ -198,21 +198,15 @@ public class LashManageServiceImpl implements LashManageService {
// TODO 贴标流程
JSONObject result = new JSONObject();
// 查询木箱对应托盘信息
JSONObject jsonExt = extTab.query("storagevehicle_code = '" + whereJson.getString("vehicle_code") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonExt)) {
throw new BadRequestException("此托盘上没有木箱!"+whereJson.getString("vehicle_code"));
}
// 查询木箱信息
BstIvtBoxinfo boxDao = iBstIvtBoxinfoService.getOne(
new QueryWrapper<BstIvtBoxinfo>().lambda()
.eq(BstIvtBoxinfo::getBox_no, jsonExt.getString("pcsn"))
.eq(BstIvtBoxinfo::getBox_no, whereJson.getString("vehicle_code"))
);
// 返回参数
result.put("length", boxDao.getBox_length());
result.put("weight", boxDao.getBox_width());
result.put("width", boxDao.getBox_width());
result.put("height", boxDao.getBox_high());
result.put("isBinding", IOSEnum.IS_SEND.code(""));
result.put("isLabeling", IOSEnum.IS_SEND.code(""));

View File

@@ -46,4 +46,6 @@ public interface InBoxManageService {
*/
String taskExceptional(JSONObject jsonObject);
void returnIn(JSONObject whereJson);
}

View File

@@ -7,14 +7,12 @@ public enum LevelEnum {
INFO,
WARN,
ERROR;
public static LevelEnum checkLevel(String level) {
if (!StringUtils.isEmpty(level)) {
for (LevelEnum value : LevelEnum.values()) {
if (value.name().equals(level)) {
return value;
}
;
}
}
return LevelEnum.DEBUG;

View File

@@ -1835,6 +1835,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (ObjectUtil.isEmpty(whereJson.getString("material_barcode"))) {
throw new BadRequestException("子卷号不能为空!");
}
whereJson.put("bill_type", IOSEnum.IN_TYPE.code("生产入库"));
inBussManageService.inTask(whereJson);
} else if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("空盘入库"))) {
// 2-空盘入库
@@ -1855,7 +1856,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
JSONObject jsonTaskParam = new JSONObject();
jsonTaskParam.put("task_type", "010710");
jsonTaskParam.put("start_device_code", whereJson.getString("device_code"));
jsonTaskParam.put("next_device_code", "B1_ERRO");
jsonTaskParam.put("next_device_code", "RK1003");
jsonTaskParam.put("vehicle_code", whereJson.getString("material_barcode"));
TwoBoxExcepTask taskBean = new TwoBoxExcepTask();
taskBean.createTask(jsonTaskParam);
@@ -1863,6 +1864,25 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
// 5-木箱入库
whereJson.put("box_no", whereJson.getString("material_barcode"));
inBoxManageService.inBox(whereJson);
} else if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("退货入库"))) {
// 6-退货入库
whereJson.put("bill_type", IOSEnum.IN_TYPE.code("退货入库"));
whereJson.put("box_no", whereJson.getString("material_barcode"));
JSONArray resultJSONArray = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + whereJson.getString("material_barcode") + "' AND status = '0'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(resultJSONArray)) {
throw new BadRequestException("未查询到子卷包装信息!");
}
String material_barcode = "";
for (int i = 0; i < resultJSONArray.size(); i++) {
JSONObject resultObj = resultJSONArray.getJSONObject(i);
if (i==0){
material_barcode = resultObj.getString("container_name");
}else {
material_barcode += "," + resultObj.getString("container_name");
}
}
whereJson.put("material_barcode", material_barcode);
inBussManageService.inTask(whereJson);
}
result.put("status", HttpStatus.OK.value());
result.put("message", "下发成功!");