add:CTU出入库功能;

This commit is contained in:
2025-10-16 16:55:56 +08:00
parent f7512364cd
commit 3d038430f3
24 changed files with 632 additions and 83 deletions

View File

@@ -53,7 +53,13 @@
<artifactId>jna</artifactId>
<version>5.6.0</version>
</dependency>
<dependency>
<groupId>org.nl</groupId>
<artifactId>nl-verify-check-sdk</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/nl-verify-check-sdk-1.0-SNAPSHOT.jar</systemPath>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>

View File

@@ -13,6 +13,7 @@ public class StructattrChangeDto {
String inv;
String structCode;
String storagevehicleCode;
//默认faletrue则是如果出库是手持库出确认则不在这边变动组盘信息
Boolean inBound;
String taskType;
}

View File

@@ -172,7 +172,6 @@ public class BsrealStorattrServiceImpl extends ServiceImpl<BsrealStorattrMapper,
.eq(BsrealStorattr::getIs_delete, BaseDataEnum.IS_YES_NOT.code(""))
.eq(BsrealStorattr::getIs_used, BaseDataEnum.IS_YES_NOT.code("")
);
return bsrealStorattrMapper.selectList(queryWrapper);
}

View File

@@ -410,25 +410,27 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
wrapper.set("storagevehicle_code", null);
}
this.update(wrapper);
//更新冻结数量
Structattr structattr = this.getByCode(changeDto.getStructCode());
List<StIvtStructivtflow> records = new ArrayList<>();
List<GroupPlate> groupPlates = iMdPbGroupplateService.list(new QueryWrapper<GroupPlate>()
.eq("storagevehicle_code", changeDto.getStoragevehicleCode())
.eq("status", IOSEnum.GROUP_PLATE_STATUS.code("入库")));
List<StIvtStructivtflow> records = new ArrayList<>();
//更新冻结数量
Structattr structattr = this.getByCode(changeDto.getStructCode());
for (GroupPlate vehicleMater : groupPlates) {
String vehicleCode = vehicleMater.getStoragevehicle_code();
BigDecimal subtract = vehicleMater.getQty().subtract(vehicleMater.getFrozen_qty());
//100-出50 = 50
//如果出库是手持库出确认则不在这边变动组盘信息
if (!changeDto.getInBound()){
String status = subtract.compareTo(BigDecimal.ZERO) > 0 ? IOSEnum.GROUP_PLATE_STATUS.code("组盘"):IOSEnum.GROUP_PLATE_STATUS.code("出库");
UpdateWrapper<GroupPlate> update = new UpdateWrapper<GroupPlate>()
.set("frozen_qty", 0)
.set("qty", subtract)
.set("update_time", now)
.set("status", IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
.set("status",status)
.eq("group_id", vehicleMater.getGroup_id());
iMdPbGroupplateService.update(update);
iMdPbGroupplateService.update(update);
}
StIvtStructivtflow record = new StIvtStructivtflow();
record.setId(IdUtil.getStringId());

View File

@@ -51,21 +51,20 @@ public class SameBlockNumRuleHandler extends Decisioner<Structattr, JSONObject>
.thenComparing(Structattr::getLayer_num))
.collect(Collectors.toList());
List<Structattr> result = new ArrayList<>();
// 3. 找出所有层号(去重 + 升序)
// 3. 找出所有层号
Set<Integer> allLayers = blockList.stream()
.map(Structattr::getLayer_num)
.collect(Collectors.toCollection(TreeSet::new)); // 自动排序
// 4. 从小层号开始,尝试找同一列的货位
// 4. 从小层号开始,找同一列的货位
for (Integer layer : allLayers) {
List<Structattr> currentLayer = blockList.stream()
.filter(item -> item.getLayer_num().compareTo(layer) == 0)
.collect(Collectors.toList());
if (!currentLayer.isEmpty()) {
result.addAll(currentLayer);
break; // 找到一层就跳出
break;
}
}
// 5. 如果没找到符合的,就用全部 blockList
if (result.isEmpty()) {
result.addAll(blockList);
}

View File

@@ -4,9 +4,11 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
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 lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.RedissonUtils;
@@ -18,6 +20,7 @@ import org.nl.wms.gateway.dto.FeedBackTaskDto;
import org.nl.wms.gateway.dto.InteracteDto;
import org.nl.wms.gateway.dto.RcsResponse;
import org.nl.wms.gateway.service.IGateWayService;
import org.nl.wms.pda.ios_manage.service.impl.PdaIosInServiceImpl;
import org.nl.wms.sch_manage.enums.TaskStatus;
import org.nl.wms.sch_manage.service.ISchBasePointService;
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
@@ -25,6 +28,9 @@ import org.nl.wms.sch_manage.service.dao.SchBasePoint;
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
import org.nl.wms.sch_manage.service.util.AbstractTask;
import org.nl.wms.sch_manage.service.util.TaskFactory;
import org.nl.wms.warehouse_management.enums.IOSEnum;
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,7 +52,11 @@ import java.util.concurrent.atomic.AtomicReference;
@Slf4j
@Service
public class GateWayServiceImpl implements IGateWayService {
/**
* 组盘记录服务
*/
@Autowired
private IMdPbGroupplateService iMdPbGroupplateService;
@Autowired
private TaskFactory taskFactory;
@@ -61,6 +71,11 @@ public class GateWayServiceImpl implements IGateWayService {
@Autowired
private ISchBaseTaskService iSchBaseTaskService;
@Autowired
private PdaIosInServiceImpl pdaIosInServiceImpl;
public String applyTask(String service, String type, JSONObject data, InteracteDto<Map> param) {
if ("InStorage".equals(service)) {
try {
@@ -96,6 +111,30 @@ public class GateWayServiceImpl implements IGateWayService {
result.put("taskCode", taskCode);
}, param.getService() + param.getType(), null);
}
if ("CtuInStorage".equals(service)) {
RedissonUtils.lock(() -> {
//tofix
String vehicleCode = jsonObject.keySet().iterator().next();
String siteCode = jsonObject.getString(vehicleCode);
Assert.noNullElements(new Object[]{vehicleCode, siteCode}, "站点编号与料箱号不能为空");
List<GroupPlate> groupPlateList = iMdPbGroupplateService.list(
new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getStoragevehicle_code,vehicleCode)
.lt(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
);
JSONObject jsonData = new JSONObject();
jsonData.put("vehicle_code", vehicleCode);
jsonData.put("site_code", siteCode);
jsonData.put("sect_id", "1940612379800899585");
jsonData.put("stor_code", "CTU");
if(ObjectUtils.isEmpty(groupPlateList)) {
jsonData.put("is_empty_vehicle","1");
}
pdaIosInServiceImpl.confirmIn(jsonData);
// String taskCode = gateWayServiceImpl.applyTask(param.getService(), type, jsonObject, param);
// result.put("taskCode", taskCode);
}, param.getService() + param.getType(), null);
}
if ("Task".equals(service)) {
iSchBaseTaskService.operation(jsonObject);
}

View File

@@ -12,6 +12,7 @@ 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 lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
@@ -65,6 +66,7 @@ import static org.nl.wms.warehouse_management.enums.IOSEnum.GROUP_PLATE_STATUS;
* @since 2025-06-05
*/
@Service
@Slf4j
public class PdaIosInServiceImpl implements PdaIosInService {
@Autowired
@@ -566,7 +568,8 @@ public class PdaIosInServiceImpl implements PdaIosInService {
//库存校验
Structattr structattr = iStructattrService.getOne(new LambdaUpdateWrapper<Structattr>().eq(Structattr::getStoragevehicle_code, whereJson.getString("vehicle_code")));
if (structattr != null) {
throw new BadRequestException("此载具已在库内" + structattr.getStruct_code() + " 中,请检查!");
log.error("此载具:"+whereJson.getString("vehicle_code")+"已存在" + structattr.getStruct_code() + " 中,请检查!");
throw new BadRequestException("此载具:"+whereJson.getString("vehicle_code")+"已存在:" + structattr.getStruct_code() + " 中,请检查!");
}
Sectattr sectDao = updateIvtUtils.checkVehicleType(whereJson.getString("sect_id"), whereJson.getString("vehicle_code"));
whereJson.put("stor_code", sectDao.getStor_code());
@@ -609,11 +612,13 @@ public class PdaIosInServiceImpl implements PdaIosInService {
});
taskJson.put("tableMater", tableMater);
iRawAssistIStorService.divPoint(taskJson);
//更新组盘表状态
mdPbGroupplateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<GroupPlate>()
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
.eq(GroupPlate::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")));
if (!"CTU".equals(whereJson.getString("stor_code"))) {
//更新组盘表状态
mdPbGroupplateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<GroupPlate>()
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
.eq(GroupPlate::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")));
}
} else {
//空载具入库
whereJson.put("qty", 1);

View File

@@ -78,6 +78,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
*/
@Autowired
private MdPbGroupplateMapper mdPbGroupplateMapper;
/**
* 库区服务
*/
@@ -647,6 +648,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
@Override
@Transactional(rollbackFor = Exception.class)
public PdaResponse outStorageConfirm(JSONObject whereJson) {
String now = DateUtil.now();
//任务校验
SchBaseTask task = iSchBaseTaskService.getOne(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getVehicle_code, whereJson.getString("storagevehicle_code")).lt(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode()));
if (ObjectUtil.isNotEmpty(task)) {
@@ -666,13 +668,28 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
//自动送回空载具
autoReturnEmptyVehicle(whereJson, pointDao);
} else {
List<GroupPlate> groupPlateList = iMdPbGroupplateService.list(
new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
.lt(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
);
if (groupPlateList.stream().anyMatch(r -> r.getQty().compareTo(BigDecimal.ZERO) > 0)) {
throw new BadRequestException("该载具:" + whereJson.getString("storagevehicle_code") + "存在拣选余料或混托物料,不能直接出库确认,请选择拣选余料回库。");
// List<GroupPlate> groupPlateList = iMdPbGroupplateService.list(
// new LambdaQueryWrapper<GroupPlate>()
// .eq(GroupPlate::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
// .lt(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
// );
// if (groupPlateList.stream().anyMatch(r -> r.getQty().compareTo(BigDecimal.ZERO) > 0)) {
// throw new BadRequestException("该载具:" + whereJson.getString("storagevehicle_code") + "存在拣选余料或混托物料,不能直接出库确认,请选择拣选余料回库。");
// }
List<GroupPlate> groupPlates = iMdPbGroupplateService.list(new QueryWrapper<GroupPlate>()
.eq("storagevehicle_code", whereJson.getString("storagevehicle_code"))
.eq("status", IOSEnum.GROUP_PLATE_STATUS.code("入库")));
for (GroupPlate vehicleMater : groupPlates) {
BigDecimal subtract = vehicleMater.getQty().subtract(vehicleMater.getFrozen_qty());
//100-出50 = 50
String status = subtract.compareTo(BigDecimal.ZERO) > 0 ? IOSEnum.GROUP_PLATE_STATUS.code("组盘"):IOSEnum.GROUP_PLATE_STATUS.code("出库");
UpdateWrapper<GroupPlate> update = new UpdateWrapper<GroupPlate>()
.set("frozen_qty", 0)
.set("qty", subtract)
.set("update_time", now)
.set("status",status)
.eq("group_id", vehicleMater.getGroup_id());
iMdPbGroupplateService.update(update);
}
//载具解绑
iSchBasePointService.update(new SchBasePoint(), new LambdaUpdateWrapper<>(SchBasePoint.class)
@@ -680,18 +697,29 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
.set(SchBasePoint::getIos_id, BaseDataEnum.IS_YES_NOT.code(""))
.eq(SchBasePoint::getPoint_code, pointDao.getPoint_code())
);
//仓位解绑
UpdateWrapper<Structattr> wrapper = new UpdateWrapper<Structattr>()
.set("update_time", now)
.set("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
.set("storagevehicle_code", null)
.eq("storagevehicle_code", whereJson.getString("storagevehicle_code"));
iStructattrService.update(wrapper);
// StructattrChangeDto changeDto = StructattrChangeDto.builder()
// .storagevehicleCode(whereJson.getString("storagevehicle_code"))
// .structCode(task.getPoint_code1()).taskType(task.getConfig_code()).inBound(false).build();
// iStructattrService.changeStruct(changeDto);
//物料全部出库
if (CollectionUtils.isNotEmpty(groupPlateList)) {
LambdaUpdateWrapper<GroupPlate> update = new LambdaUpdateWrapper<>();
Set<String> plateCodes = groupPlateList.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet());
update.set(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("出库"))
.set(GroupPlate::getUpdate_time, DateUtil.now())
.set(GroupPlate::getCreate_time, DateUtil.now())
.set(GroupPlate::getRemark, SecurityUtils.getCurrentNickName() + "" + DateUtil.now() + "使用手持扫码确认出库。")
.set(GroupPlate::getUpdate_optname, SecurityUtils.getCurrentNickName())
.in(GroupPlate::getGroup_id, plateCodes);
mdPbGroupplateMapper.update(null, update);
}
// if (CollectionUtils.isNotEmpty(groupPlateList)) {
// LambdaUpdateWrapper<GroupPlate> update = new LambdaUpdateWrapper<>();
// Set<String> plateCodes = groupPlateList.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet());
// update.set(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("出库"))
// .set(GroupPlate::getUpdate_time, DateUtil.now())
// .set(GroupPlate::getCreate_time, DateUtil.now())
// .set(GroupPlate::getRemark, SecurityUtils.getCurrentNickName() + "于" + DateUtil.now() + "使用手持扫码确认出库。")
// .set(GroupPlate::getUpdate_optname, SecurityUtils.getCurrentNickName())
// .in(GroupPlate::getGroup_id, plateCodes);
// mdPbGroupplateMapper.update(null, update);
// }
}
return PdaResponse.requestOk();
}

View File

@@ -16,6 +16,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
import org.nl.wms.sch_manage.enums.StatusEnum;
@@ -102,7 +103,7 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
String now = DateUtil.now();
Assert.notNull(entity.getTask_status(), "任务状态不能为空!");
entity.setTask_id(IdUtil.getSnowflake(1, 1).nextIdStr());
entity.setTask_code(IdUtil.getSnowflake(1, 1).nextIdStr());
entity.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
entity.setCreate_id(currentUserId);
entity.setCreate_name(nickName);
entity.setCreate_time(now);

View File

@@ -93,11 +93,11 @@ public class BackInTask extends AbstractTask {
task.setPoint_code2(json.getString("point_code2"));
task.setVehicle_code(json.getString("vehicle_code"));
task.setVehicle_type(json.getString("vehicle_type"));
task.setRequest_param(json.toString());
task.setAcs_trace_id(json.getString("acs_task_type"));
task.setCreate_id(SecurityUtils.getCurrentUserId());
task.setCreate_name(SecurityUtils.getCurrentNickName());
task.setCreate_time(DateUtil.now());
task.setRequest_param(json.toString());
taskService.save(task);
return task.getTask_id();
}

View File

@@ -0,0 +1,302 @@
package org.nl.wms.sch_manage.service.util.tasks;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService;
import org.nl.wms.basedata_manage.service.IStructattrService;
import org.nl.wms.basedata_manage.service.dao.Structattr;
import org.nl.wms.decision_manage.service.strategyConfig.decisioner.impl.diy.SameBlockNumRuleHandler;
import org.nl.wms.sch_manage.enums.StatusEnum;
import org.nl.wms.sch_manage.enums.TaskStatus;
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
import org.nl.wms.sch_manage.service.util.AbstractTask;
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
import org.nl.wms.sch_manage.service.util.TaskType;
import org.nl.wms.warehouse_management.enums.IOSConstant;
import org.nl.wms.warehouse_management.enums.IOSEnum;
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
import org.nl.wms.warehouse_management.service.IOutBillService;
import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
import org.nl.wms.warehouse_management.service.dao.mapper.MdPbGroupplateMapper;
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import static org.nl.wms.warehouse_management.enums.IOSEnum.GROUP_PLATE_STATUS;
/**
* @Author: Liuxy
* @Description: CTU入库任务类
* @Date: 2025/5/25
*/
@Slf4j
@Component(value = "CtuInTask")
@TaskType("CtuInTask")
public class CtuInTask extends AbstractTask {
@Autowired
private ISchBaseTaskService taskService;
/**
* 组盘记录mapper
*/
@Autowired
private MdPbGroupplateMapper mdPbGroupplateMapper;
@Resource
private IStructattrService iStructattrService;
@Autowired
private SameBlockNumRuleHandler sameBlockNumRuleHandler;
@Resource
private IRawAssistIStorService rawAssistIStorService;
/**
* 组盘记录服务
*/
@Autowired
private IMdPbGroupplateService iMdPbGroupplateService;
@Resource
private IOStorInvDisMapper ioStorInvDisMapper;
/**
* 载具服务
*/
@Autowired
private IMdPbStoragevehicleinfoService iMdPbStoragevehicleinfoService;
/**
* 校验工具类
*/
@Autowired
private UpdateIvtUtils updateIvtUtils;
@Resource
private IOutBillService outBillService;
@Override
public String create(JSONObject json) {
if (ObjectUtils.isEmpty(json)) {
log.error("创建任务失败:方法请求参数不能为空");
throw new BadRequestException("创建任务失败:方法请求参数不能为空");
}
String vehicleCode = json.keySet().iterator().next();
String startPoint = json.getString(vehicleCode);
//校验载具
// MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(vehicleCode);
// if (ObjectUtil.isEmpty(vehicleDao)) {
// throw new BadRequestException("不存在该载具号信息,请检查");
// }
// //库存校验
// Structattr structattr = iStructattrService.getOne(new LambdaUpdateWrapper<Structattr>().eq(Structattr::getStoragevehicle_code, vehicleCode));
// if (structattr != null) {
// throw new BadRequestException("此载具已在库内:" + structattr.getStruct_code() + " 中,请检查!");
// }
// List<GroupPlate> groupPlateList = iMdPbGroupplateService.list(
// new LambdaQueryWrapper<GroupPlate>()
// .eq(GroupPlate::getStoragevehicle_code, vehicleDao.getStoragevehicle_code())
// .lt(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
// );
// if (ObjectUtils.isEmpty(groupPlateList)) {
// throw new BadRequestException("该载具号未组盘,请检查");
// }
json.put("vehicle_code", vehicleCode);
json.put("point_code1", startPoint);
String endPoint = getEndPoint(vehicleCode);
json.put("point_code2", endPoint);
updateIvtUtils.checkTask(json);
try {
UpdateWrapper<Structattr> updateWrapper = new UpdateWrapper<Structattr>()
.set("storagevehicle_code", vehicleCode)
.set("lock_type", IOSEnum.LOCK_TYPE.code("入库锁"))
.set("update_time", DateUtil.now())
.set("update_optname", SecurityUtils.getCurrentNickName())
.eq("struct_code", endPoint);
iStructattrService.update(updateWrapper);
} catch (Exception e) {
throw new BadRequestException("当前载具:" + vehicleCode + "已绑定仓位CTU申请任务失败请检查仓位信息" + e.getMessage());
}
SchBaseTask task = new SchBaseTask();
task.setTask_status(TaskStatus.CREATE.getCode());
task.setAcs_trace_id(json.getString("acs_task_type"));
task.setVehicle_code(vehicleCode);
task.setPoint_code1(startPoint);
task.setPoint_code2(endPoint);
task.setRequest_param(json.toString());
task.setVehicle_type(json.getString("vehicle_type"));
task.setConfig_code(IOSConstant.CTU_IN_TASK);
taskService.create(task);
return task.getTask_code();
}
public String getEndPoint(String vehicleCode) {
QueryWrapper<Structattr> query = new QueryWrapper<Structattr>()
.eq("is_used", true)
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("stor_code", StatusEnum.STOCK_INFO.code("二楼ctu缓存库"));
query.isNull("storagevehicle_code");
List<Structattr> list = iStructattrService.list(query);
List<Structattr> structList = sameBlockNumRuleHandler.handler(list, null);
if (CollectionUtils.isEmpty(structList)) {
//iSchBasePointService.sendErrorMsg("1", null, "当前载具:" + vehicleCode + "CTU申请任务失败没有可用仓位");
throw new BadRequestException("当前载具:" + vehicleCode + "CTU申请任务失败没有可用仓位");
}
// Map map = SpringContextHolder.getBean(DecisionHandler.class)
// .dispenseTransa(ListOf.of("limitStorage","depthPriority","nearby"), new JSONObject(MapOf.of("stor_code", stIvtStructattr.getStor_code()
// ,"vehicleCode",task.getVehicle_code(),
// "startPoint",task.getPoint_code1())));
// String new_struct_code = ((Map<String, String>) map.get("form_data")).get("end_struct_code");
log.info("货位绑定成功" + structList.get(0).getStruct_code() + "_" + vehicleCode);
return structList.get(0).getStruct_code();
}
@Override
public AcsTaskDto sendAcsParam(String taskId) {
SchBaseTask taskDao = taskService.getById(taskId);
// 组织下发给acs的数据
AcsTaskDto acsTaskDto = new AcsTaskDto();
acsTaskDto.setExt_task_uuid(taskDao.getTask_id());
acsTaskDto.setTask_code(taskDao.getTask_code());
acsTaskDto.setStart_device_code(taskDao.getPoint_code1());
acsTaskDto.setNext_device_code(taskDao.getPoint_code2());
if (taskDao.getPoint_code2().contains("-")) {
acsTaskDto.setNext_device_code(taskDao.getPoint_code2().replace('-', '_'));
}
acsTaskDto.setPriority(taskDao.getPriority());
acsTaskDto.setTask_type("1");
return acsTaskDto;
}
@Override
protected void updateStatus(String task_code, TaskStatus status) {
// 校验任务
SchBaseTask taskObj = taskService.getByCode(task_code);
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) {
throw new BadRequestException("该任务已完成!");
}
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
throw new BadRequestException("该任务已取消!");
}
// 根据传来的类型去对任务进行操作
if (status.equals(TaskStatus.EXECUTING)) {
taskObj.setTask_status(TaskStatus.EXECUTING.getCode());
taskObj.setRemark("执行中");
taskService.updateById(taskObj);
}
if (status.equals(TaskStatus.FINISHED)) {
this.finishTask(taskObj);
}
if (status.equals(TaskStatus.CANCELED)) {
this.cancelTask(taskObj);
}
}
@Override
public void forceFinish(String task_code) {
SchBaseTask taskObj = taskService.getByCode(task_code);
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark("已完成");
taskService.updateById(taskObj);
// 更新终点
iStructattrService.update(
new UpdateWrapper<Structattr>().lambda()
.eq(Structattr::getStruct_code, taskObj.getPoint_code2())
.set(Structattr::getStoragevehicle_code, taskObj.getVehicle_code())
.set(Structattr::getTaskdtl_id, null)
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
);
List<GroupPlate> plates = mdPbGroupplateMapper.selectList(
new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code())
.lt(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("出库"))
);
//更新组盘信息
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(plates)) {
LambdaUpdateWrapper<GroupPlate> update = new LambdaUpdateWrapper<>();
Set<String> plateCodes = plates.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet());
update.set(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("入库"))
.set(GroupPlate::getUpdate_time, DateUtil.now())
.set(GroupPlate::getCreate_time, DateUtil.now())
.in(GroupPlate::getGroup_id, plateCodes);
mdPbGroupplateMapper.update(null, update);
}
}
@Override
public void cancel(String task_code) {
SchBaseTask taskObj = taskService.getByCode(task_code);
if (ObjectUtil.isEmpty(taskObj)) {
throw new BadRequestException("该任务不存在");
}
if (!TaskStatus.CREATE.getCode().equals(taskObj.getTask_status())) {
throw new BadRequestException("任务状态必须为生成才能取消任务");
}
this.cancelTask(taskObj);
}
@Override
public void backMes(String task_code) {
}
@Transactional(rollbackFor = Exception.class)
public void finishTask(SchBaseTask taskObj) {
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark("已完成");
taskService.updateById(taskObj);
// 更新终点
iStructattrService.update(
new UpdateWrapper<Structattr>().lambda()
.eq(Structattr::getStruct_code, taskObj.getPoint_code2())
.set(Structattr::getStoragevehicle_code, taskObj.getVehicle_code())
.set(Structattr::getTaskdtl_id, null)
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
);
List<GroupPlate> plates = mdPbGroupplateMapper.selectList(
new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code())
.lt(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("出库"))
);
//更新组盘信息
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(plates)) {
LambdaUpdateWrapper<GroupPlate> update = new LambdaUpdateWrapper<>();
Set<String> plateCodes = plates.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet());
update.set(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("入库"))
.set(GroupPlate::getUpdate_time, DateUtil.now())
.set(GroupPlate::getCreate_time, DateUtil.now())
.in(GroupPlate::getGroup_id, plateCodes);
mdPbGroupplateMapper.update(null, update);
}
}
@Transactional(rollbackFor = Exception.class)
public void cancelTask(SchBaseTask taskObj) {
//分配表清除任务
ioStorInvDisMapper.update(new IOStorInvDis(), new LambdaUpdateWrapper<>(IOStorInvDis.class)
.set(IOStorInvDis::getTask_id, null)
.set(IOStorInvDis::getPoint_code, null)
.set(IOStorInvDis::getIs_issued, 0)
.set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("未生成"))
.eq(IOStorInvDis::getTask_id, taskObj.getTask_id())
);
// 更新任务状态
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
taskObj.setRemark("已取消");
taskService.updateById(taskObj);
}
}

View File

@@ -69,7 +69,7 @@ public class StOutTask extends AbstractTask {
task.setVehicle_type(json.getString("vehicle_type"));
task.setGroup_id(json.getString("group_id"));
task.setRequest_param(json.toString());
task.setHandle_status(json.getString("vehicle_type"));
task.setHandle_status(json.getString("handle_status"));
task.setIs_auto_confirm(StringUtils.isNotBlank(json.getString("is_auto_confirm"))?json.getInteger("is_auto_confirm"):0);
task.setAcs_trace_id(json.getString("acs_task_type"));
task.setCreate_id(SecurityUtils.getCurrentUserId());

View File

@@ -105,4 +105,16 @@ public class IOSConstant {
*/
public final static String XB_OUT_TASK = "XbOutTask";
/**
* CTU入库
*/
public final static String CTU_IN_TASK = "CtuInTask";
/**
* CTU出库
*/
public final static String CTU_OUT_TASK = "CtuOutTask";
}

View File

@@ -177,8 +177,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
}
List<String> billTypeCollect = ObjectUtil.isNotEmpty(bill_type)
? Arrays.stream(bill_type).collect(Collectors.toList()) : null;
IPage<IOStorInv> SS= ioStorInvMapper.queryOutBillPage(new Page<>(page.getPage()+1,page.getSize()),map,billTypeCollect);
return SS;
IPage<IOStorInv> result= ioStorInvMapper.queryOutBillPage(new Page<>(page.getPage()+1,page.getSize()),map,billTypeCollect);
return result;
}
@Override
@@ -1015,6 +1015,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
task_form.put("point_code1", ioStorInvDis.getStruct_code());
task_form.put("point_code2", pointCode);
task_form.put("vehicle_code", ioStorInvDis.getStoragevehicle_code());
task_form.put("handle_status",BaseDataEnum.IS_YES_NOT.code(""));
StOutTask stOutTask = SpringContextHolder.getBean("STOutTask");
String task_id = stOutTask.create(task_form);
//更新点位
@@ -1234,7 +1235,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
StructattrChangeDto changeDto = StructattrChangeDto.builder()
.inv(ioStorInvDis.getIostorinv_id())
.storagevehicleCode(ioStorInvDis.getStoragevehicle_code())
.structCode(ioStorInvDis.getStruct_code()).taskType(task.getConfig_code()).inBound(false).build();
.structCode(ioStorInvDis.getStruct_code()).taskType(task.getConfig_code()).inBound(true).build();
iStructattrService.changeStruct(changeDto);
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getIostorinvdtl_id, ioStorInvDis.getIostorinvdtl_id())

View File

@@ -548,9 +548,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
task_form.put("point_code2", ioStorInvDis.get(0).getStruct_code());
task_form.put("vehicle_code", map.get("storagevehicle_code"));
StInTask stInTask = SpringContextHolder.getBean("STInTask");
String task_id = stInTask.create(task_form);
//分配明细表更新任务相关数据
IOStorInvDis dis = new IOStorInvDis();
dis.setIostorinvdis_id(map.get("iostorinvdis_id"));

View File

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.exception.BadRequestException;
@@ -41,6 +42,7 @@ import java.util.stream.Collectors;
* @desc 更新库存工具类
*/
@Component
@Slf4j
public class UpdateIvtUtils {
/**
@@ -146,6 +148,7 @@ public class UpdateIvtUtils {
if (mdPbStoragevehicleinfo == null) {
throw new BadRequestException("该载具不存在,请检查。");
}
//根据载具类型判断RCS任务类型
String acsTaskType = StatusEnum.ACS_TASK_TYPE.getR(mdPbStoragevehicleinfo.getStoragevehicle_type());
where.put("acs_task_type", acsTaskType);
where.put("vehicle_type", mdPbStoragevehicleinfo.getStoragevehicle_type());
@@ -212,7 +215,6 @@ public class UpdateIvtUtils {
*/
private void updateAddFrozenIvt(JSONObject where) {
// 找当前托盘物料库存
LambdaQueryWrapper<GroupPlate> query = new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
@@ -395,10 +397,12 @@ public class UpdateIvtUtils {
Sectattr sectDao = iSectattrService.getById(sectId);
String vehicleTypeList = sectDao.getExt_id();
if (StringUtils.isBlank(vehicleTypeList)) {
log.error("库区:【" + sectDao.getSect_code() + "】未配置允许的载具类型!");
throw new BadRequestException("库区:【" + sectDao.getSect_code() + "】未配置允许的载具类型!");
}
List<String> allowedVehicleTypes = Arrays.asList(vehicleTypeList.split(","));
if (!allowedVehicleTypes.contains(vehicleType)) {
log.error("该载具类型【" + mdPbStoragevehicleinfo.getStoragevehicle_name() + "】不在仓库【"+sectDao.getSect_name()+"】的出入库范围内!");
throw new BadRequestException("该载具类型【" + mdPbStoragevehicleinfo.getStoragevehicle_name() + "】不在仓库【"+sectDao.getSect_name()+"】的出入库范围内!");
}
return sectDao;

View File

@@ -0,0 +1 @@
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCBbWQ38mZdmOX379myX/NFn/qFIeP3kbogDiWlGtc1JNt6eDSsOEShUNj3o8Jo5Qaepyo6j4stP4WpmCAUFsdyOodzU0R60P7gFOR1OIdKyyQ2OS9J1MdNXRRuksfD1WVG+azoB+huQo2D52bcXSjnu1UDRDrXN3XXZgh1L2V/aDg+Gi9QAIsMDHtN62zKsHs4tlClHt0KORSdAxN9RjPzUFNYXfxW3dNTM9zfltoM2bgeUfG61F5EMipkAEVjDb4+Pu2BsNUamjy85eKDWA8NxDU6uuDkxLNiLx5KipLxOR+EM4/cOqRwHdEj8matpGlqBSOfOxXd6Sh5XmVStBjtAgMBAAECggEAQCbcme6IVrRGqJI2MXfluQkGv56AxGFzBBh/CEs5iJnwP8/9K6/oNJ1CLdz5q8x5b4IkKEqmDZOCyQEiRVLVIQVpxfvr4YReEOvKIWAXjzcJh+boTYwuDWapjfUrFyJaxMdUsN3ak2xhgJPeJDP45oOwK6JSGALhYhas8oi/olptl3leZs/5Z3h9UE69u80XRdhjtGyfS3AOOtT6dVcfKw6H8tmoKmx43ZfPvoV+a7hcwHO587mI1epAhYGOn81e5QoNBegiCEv9KutuZtauJuGHKcsvNh/FK8QujRJ1TFxOsMtxsJWZfxQxUuvJ0PulCpGpmkuHFNGDmV3ukJO1AQKBgQC8eiTaWgq8eCrIOi5fYtXQUmzv2e5BOhMrRyUWoB30N7GmKcdNGT5HJVXztidcBj53cNd8T6t5yTwYFrdZ5Lll7ItPAub25CSnGQU2nmceHK+46PNlQfLZRrlyeUuGYJTHVZanV+6Pneqn+6XifTa969HzpejpiJuG8iYVmcztfQKBgQCvy5ha6tBS+sIrjXL8/lrxXMDm4xT3CnCLmBqInppLwfFOgcQFzYWL6SQSJ7k3uC+xFT++VgsRLz/pQrVLsQzkY6mUF8sI7F0kevy/jAFzl9cgFn9BXu1ATyWloQIAX/UdSbzSWxIH3BW3BNOWZ0x91HUqBDAFzyLBkIns8LZ0MQKBgQCyg9oN+kS69/JFjV3IuLsdQkSt9LNGknP/hLYrNOLKIkofwOhlLOigyEsdt0SWU8+sn3Np6afXhPNnOXTWLt4vHJlh77TE2ZehsQAQGH5Athj1waZvHMSgaO1S8HHJSAcCuh0kSRPKcV8FVkNrPv+vaQGFjXoKX3o3mXja8r53nQKBgQCElQVj1GKnoo1csYJ+wgqurCikObFvG8WD0oR4cz2lUzD956qCQd2thnj45FKxbk0xvffkQhp4rG0ELJZ07qPtgCi+Ey/CnBknUUZb5GiX2HWbsrvo/oHqlYasIwFSbQx9OUaaU6sGmHscHBzD+0ZaRCjVNnFNgEoTOEJ9m5HPkQKBgQC0Kd29rQMIm5wXhIyW+bVdwmEyB/Xuq6Ch7lVVfZ6WMSoDbQZdYH3Mxw+yzjYpcS8jf/7x7mYH9Z0ggXwX7CAcRqhpjtKU800KzwQ2Cnd7Jmgq56Mn/e70J4btH73EZB6sm7vmhIuBZZlvc3oYGeJN/t/9vLwomFqrlXVw318J2A==