rev:更新
This commit is contained in:
@@ -74,4 +74,9 @@ public class StrategyStructParam {
|
||||
private Integer occupancy_state;
|
||||
|
||||
private Boolean is_empty_vehicle;
|
||||
|
||||
/**
|
||||
* 空载具回收时,来源库区无空位则允许在同仓其他库区继续查找。
|
||||
*/
|
||||
private Boolean fallback_other_raw_sects;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,10 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService;
|
||||
import org.nl.wms.basedata_manage.service.ISectattrService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo;
|
||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
@@ -85,6 +87,9 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
@Autowired
|
||||
private IStSectStrategyService iStSectStrategyService;
|
||||
|
||||
@Autowired
|
||||
private IMdPbStoragevehicleinfoService storagevehicleinfoService;
|
||||
|
||||
@Override
|
||||
public IPage<Structattr> queryAll(Map whereJson, PageQuery page) {
|
||||
|
||||
@@ -163,20 +168,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
dto.setStor_code(bsrealStorattr.getStor_code());
|
||||
dto.setStor_name(bsrealStorattr.getStor_name());
|
||||
|
||||
String storagevehicle_code = dto.getStoragevehicle_code();
|
||||
if (ObjectUtil.isNotEmpty(storagevehicle_code)) {
|
||||
// 暂时搁置后续添加
|
||||
// WQLObject vehicleTab = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
||||
// JSONObject obj = vehicleTab.query("storagevehicle_code = '" + storagevehicle_code + "'").uniqueResult(0);
|
||||
|
||||
// if (ObjectUtil.isEmpty(obj)) {
|
||||
// throw new BadRequestException("未发现载具号为【" + storagevehicle_code + "】的载具信息");
|
||||
// }
|
||||
//
|
||||
// dto.setStoragevehicle_id(obj.getLong
|
||||
// ("storagevehicle_id"));
|
||||
// dto.setStoragevehicle_type(obj.getString("storagevehicle_type"));
|
||||
}
|
||||
fillAndValidateStoragevehicleInfo(dto);
|
||||
|
||||
structattrMapper.insert(dto);
|
||||
}
|
||||
@@ -211,9 +203,42 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
dto.setStor_code(bsrealStorattr.getStor_code());
|
||||
dto.setStor_name(bsrealStorattr.getStor_name());
|
||||
|
||||
fillAndValidateStoragevehicleInfo(dto);
|
||||
|
||||
structattrMapper.updateById(dto);
|
||||
}
|
||||
|
||||
private void fillAndValidateStoragevehicleInfo(Structattr dto) {
|
||||
String storagevehicleCode = StringUtils.trimToEmpty(dto.getStoragevehicle_code());
|
||||
Integer occupancyState = dto.getOccupancy_state();
|
||||
|
||||
if (occupancyState != null) {
|
||||
if (occupancyState == 1 && StringUtils.isNotBlank(storagevehicleCode)) {
|
||||
throw new BadRequestException("占用状态为【空位】时,载具号必须为空");
|
||||
}
|
||||
if ((occupancyState == 2 || occupancyState == 3) && StringUtils.isBlank(storagevehicleCode)) {
|
||||
throw new BadRequestException("占用状态为【空载具】或【有料】时,载具号不能为空");
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(storagevehicleCode)) {
|
||||
dto.setStoragevehicle_code("");
|
||||
dto.setStoragevehicle_type("");
|
||||
return;
|
||||
}
|
||||
|
||||
Structattr bindStruct = this.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getStoragevehicle_code, storagevehicleCode)
|
||||
.ne(StringUtils.isNotBlank(dto.getStruct_id()), Structattr::getStruct_id, dto.getStruct_id()));
|
||||
if (bindStruct != null) {
|
||||
throw new BadRequestException("载具号【" + storagevehicleCode + "】已绑定仓位【" + bindStruct.getStruct_code() + "】, 不允许重复绑定");
|
||||
}
|
||||
|
||||
MdPbStoragevehicleinfo vehicleInfo = storagevehicleinfoService.getByCode(storagevehicleCode);
|
||||
dto.setStoragevehicle_code(storagevehicleCode);
|
||||
dto.setStoragevehicle_type(vehicleInfo.getStoragevehicle_type());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeActive(JSONObject json) {
|
||||
String sect_id = json.getString("sect_id");
|
||||
|
||||
@@ -39,21 +39,35 @@ public class RawInRuleHandle extends Decisioner<Structattr, JSONObject> {
|
||||
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq("sect_code", param.getString("sect_code"))
|
||||
.isNotNull("storagevehicle_code")
|
||||
.isNull("Task_code")
|
||||
.and(wrapper -> wrapper.isNull("task_code").or().eq("task_code", ""))
|
||||
.eq("occupancy_state", 2)
|
||||
.orderByAsc("update_time");
|
||||
return iStructattrService.list(query);
|
||||
} else {
|
||||
//空位,适用于空托盘入库
|
||||
QueryWrapper<Structattr> query = new QueryWrapper<Structattr>()
|
||||
.eq("is_used", true)
|
||||
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq("sect_code", param.getString("sect_code"))
|
||||
.isNull("storagevehicle_code")
|
||||
.isNull("Task_code")
|
||||
.eq("occupancy_state", 1)
|
||||
.orderByAsc("update_time");
|
||||
return iStructattrService.list(query);
|
||||
String sourceSectCode = param.getString("sect_code");
|
||||
boolean allowFallback = Boolean.TRUE.equals(param.getBoolean("fallback_other_raw_sects"));
|
||||
List<Structattr> result = "ZZ".equals(sourceSectCode)
|
||||
? java.util.Collections.emptyList()
|
||||
: iStructattrService.list(buildEmptyStructQuery().eq("sect_code", sourceSectCode));
|
||||
if (!result.isEmpty() || !allowFallback) {
|
||||
return result;
|
||||
}
|
||||
// 解包上料的空载具回收:来源库区无空位时,在同一原料仓其他库区兜底,排除 ZZ 周转区。
|
||||
return iStructattrService.list(buildEmptyStructQuery()
|
||||
.eq("stor_code", param.getString("stor_code"))
|
||||
.ne("sect_code", "ZZ")
|
||||
.ne("sect_code", sourceSectCode));
|
||||
}
|
||||
}
|
||||
|
||||
private QueryWrapper<Structattr> buildEmptyStructQuery() {
|
||||
return new QueryWrapper<Structattr>()
|
||||
.eq("is_used", true)
|
||||
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq("occupancy_state", 1)
|
||||
.and(wrapper -> wrapper.isNull("storagevehicle_code").or().eq("storagevehicle_code", ""))
|
||||
.and(wrapper -> wrapper.isNull("task_code").or().eq("task_code", ""))
|
||||
.orderByAsc("update_time");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ public class UnpackingRuleHandler extends Decisioner<Structattr, JSONObject> {
|
||||
if(StatusEnum.IOBILL_TYPE_IN.code("余料入库").equals( param.getString("stragegyType"))){
|
||||
// 获取仓库中对应托盘类型的可出的空桶点位
|
||||
List<Structattr> outPoints = iStructattrService.list(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getIs_used, true)
|
||||
.eq(Structattr::getOccupancy_state, 1)
|
||||
.eq(Structattr::getLock_type, "0")
|
||||
.eq(Structattr::getSect_code, param.getString("sect_code"))
|
||||
@@ -68,6 +69,7 @@ public class UnpackingRuleHandler extends Decisioner<Structattr, JSONObject> {
|
||||
} else if(StatusEnum.IOBILL_TYPE_IN.code("空桶入库").equals( param.getString("stragegyType"))){
|
||||
// 获取仓库中对应托盘类型的可出的空桶点位
|
||||
List<Structattr> outPoints = iStructattrService.list(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getIs_used, true)
|
||||
.eq(Structattr::getOccupancy_state, 1)
|
||||
.eq(Structattr::getLock_type, "0")
|
||||
.eq(Structattr::getSect_code, param.getString("sect_code"))
|
||||
@@ -83,6 +85,7 @@ public class UnpackingRuleHandler extends Decisioner<Structattr, JSONObject> {
|
||||
if (requiresEmptyBucketForUnpacking()) {
|
||||
// 只有走 JbDownAgvTask 的场景才要求目标仓位已存在同类型空桶。
|
||||
outPoints = iStructattrService.list(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getIs_used, true)
|
||||
.eq(Structattr::getOccupancy_state, 2)
|
||||
.eq(Structattr::getStoragevehicle_type, vinfo.getStoragevehicle_type())
|
||||
.eq(Structattr::getLock_type, "0")
|
||||
@@ -96,6 +99,7 @@ public class UnpackingRuleHandler extends Decisioner<Structattr, JSONObject> {
|
||||
} else {
|
||||
// 走其它 AGV 分支时不需要空桶,直接找可用空位即可。
|
||||
outPoints = iStructattrService.list(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getIs_used, true)
|
||||
.eq(Structattr::getOccupancy_state, 1)
|
||||
.eq(Structattr::getLock_type, "0")
|
||||
.eq(Structattr::getSect_code, param.getString("sect_code"))
|
||||
|
||||
@@ -59,6 +59,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.nl.wms.warehouse_manage.enums.IOSEnum.GROUP_PLATE_STATUS;
|
||||
@@ -323,7 +324,16 @@ public class MesToWmsServiceImpl implements MesToWmsService {
|
||||
//得到作业区下面的两个
|
||||
List<SchBasePoint> sonSchBasePointList = pointService.getSonPointList(queryPoint);
|
||||
if (!(sonSchBasePointList != null && sonSchBasePointList.size() == 2)) {
|
||||
throw new BadRequestException("作业位" + outPoint.getPoint_code() + "的周转位不为2个,请核对!");
|
||||
String sonPointCodes = CollectionUtils.isEmpty(sonSchBasePointList)
|
||||
? ""
|
||||
: sonSchBasePointList.stream()
|
||||
.map(SchBasePoint::getPoint_code)
|
||||
.collect(Collectors.joining(","));
|
||||
int sonPointCount = sonSchBasePointList == null ? 0 : sonSchBasePointList.size();
|
||||
log.warn("作业位周转位数量异常,pointCode={}, sonPointCount={}, sonPointCodes={}",
|
||||
outPoint.getPoint_code(), sonPointCount, sonPointCodes);
|
||||
throw new BadRequestException("作业位" + outPoint.getPoint_code() + "的周转位数量为"
|
||||
+ sonPointCount + "个,明细[" + sonPointCodes + "],请核对!");
|
||||
}
|
||||
|
||||
//判断点位和仓位是否有正在执行的任务
|
||||
@@ -350,20 +360,12 @@ public class MesToWmsServiceImpl implements MesToWmsService {
|
||||
//下空桶上满料 4个点 需要拆成2个任务,组装成一组
|
||||
log.info("下空桶上满料叫料,请求参数:【{}】", JSONObject.toJSONString(dto));
|
||||
|
||||
//点位作业位生产完后,满料状态->空料状态
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getPoint_status, "2")
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.eq(SchBasePoint::getPoint_code, outPoint.getPoint_code()));
|
||||
|
||||
MdMeMaterialbase materialbase = materialbaseService.getByCode(groupPlate.getMaterial_code(), false);
|
||||
if (ObjectUtil.isEmpty(materialbase)) {
|
||||
throw new BadRequestException("物料【" + groupPlate.getMaterial_code() + "】不存在!");
|
||||
}
|
||||
if ("1".equals(outPoint.getPoint_status())) {
|
||||
throw new BadRequestException("设备【" + groupPlate.getStruct_code() + "】是空位,请执行单独上料!");
|
||||
throw new BadRequestException("设备【" + outPoint + "】是空位,请执行单独上料!");
|
||||
}
|
||||
|
||||
// 1、创建出库单、明细、分配明细
|
||||
|
||||
@@ -648,6 +648,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
//更新状态为组盘状态
|
||||
iMdPbGroupplateService.update(new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
|
||||
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id"))
|
||||
.eq(GroupPlate::getStoragevehicle_code,whereJson.getString("vehicle_code")));
|
||||
// groupPlate(whereJson);
|
||||
|
||||
@@ -1231,6 +1232,8 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
List<GroupPlate> plateDaoList = iMdPbGroupplateService.list(
|
||||
new QueryWrapper<GroupPlate>().lambda()
|
||||
.eq(GroupPlate::getStoragevehicle_code, whereJson.getString("vehicle_code"))
|
||||
.eq(ObjectUtil.isNotEmpty(whereJson.getString("group_id")),
|
||||
GroupPlate::getGroup_id, whereJson.getString("group_id"))
|
||||
.eq(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("组盘"))
|
||||
);
|
||||
if (ObjectUtil.isEmpty(plateDaoList)) {
|
||||
|
||||
@@ -124,10 +124,9 @@ public class PdaJBServiceImpl implements PdaJBService {
|
||||
|
||||
@Override
|
||||
public PdaResponse getOrderList(JSONObject whereJson) {
|
||||
String flag = whereJson.getString("flag");
|
||||
List<PdmBdWorkorder> workorders = pdaJBMapper.getUnProductOrderList(
|
||||
whereJson.getString("point_code"),
|
||||
"1".equals(flag) ? "2" : "4");
|
||||
"1,2");
|
||||
return PdaResponse.requestParamOk(workorders);
|
||||
}
|
||||
|
||||
@@ -166,6 +165,9 @@ public class PdaJBServiceImpl implements PdaJBService {
|
||||
if (ObjectUtil.isEmpty(workorder)) {
|
||||
throw new BadRequestException("工单不存在!");
|
||||
}
|
||||
if ("1".equals(workorder.getWorkorder_status())) {
|
||||
throw new BadRequestException("工单未审核,不允许开工!");
|
||||
}
|
||||
if (!"2".equals(workorder.getWorkorder_status())) {
|
||||
throw new BadRequestException("该工单不是审核状态,无法开工!");
|
||||
}
|
||||
@@ -1168,10 +1170,18 @@ public class PdaJBServiceImpl implements PdaJBService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PdaResponse groupAndBind(JSONObject param) {
|
||||
// vehicle_code、material_id、pcsn、supp_code、supp_name、single_weight、point_code
|
||||
log.info("解包组盘并绑定开始,载具:{},物料:{},批次:{},目标仓位:{}",
|
||||
param.getString("vehicle_code"), param.getString("material_id"),
|
||||
param.getString("pcsn"), param.getString("point_code"));
|
||||
combination(param);
|
||||
log.info("解包组盘完成,开始绑定仓位,载具:{},目标仓位:{}",
|
||||
param.getString("vehicle_code"), param.getString("point_code"));
|
||||
confirmSet(param);
|
||||
log.info("解包组盘并绑定成功,载具:{},目标仓位:{}",
|
||||
param.getString("vehicle_code"), param.getString("point_code"));
|
||||
return PdaResponse.requestOk("操作成功!");
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
WHERE mg.`status` = '02' AND mg.frozen_qty = 0 AND IFNULL(mg.storagevehicle_code,'') <![CDATA[ <> ]]> ''
|
||||
AND IFNULL(ss.struct_code,'') <![CDATA[ <> ]]> ''
|
||||
AND IFNULL(ss.lock_type, '0') = '0'
|
||||
AND 0 = (SELECT COUNT(*) FROM pdm_bd_workorder po WHERE po.raw_material_code = mg.storagevehicle_code AND po.workorder_status <![CDATA[ <> ]]> '5')
|
||||
AND 0 = (SELECT COUNT(*) FROM pdm_bd_workorder po WHERE po.raw_material_code = mg.storagevehicle_code AND po.workorder_status NOT IN ('5', '6'))
|
||||
<if test="query.stor_id != null and query.stor_id != ''">
|
||||
AND ss.stor_id = #{query.stor_id}
|
||||
</if>
|
||||
@@ -69,7 +69,7 @@
|
||||
WHERE mg.`status` = '02' AND mg.frozen_qty = 0 AND IFNULL(mg.storagevehicle_code,'') <![CDATA[ <> ]]> ''
|
||||
AND IFNULL(ss.struct_code,'') <![CDATA[ <> ]]> ''
|
||||
AND IFNULL(ss.lock_type, '0') = '0'
|
||||
AND 0 = (SELECT COUNT(*) FROM pdm_bd_workorder po WHERE po.raw_material_code = mg.storagevehicle_code AND po.workorder_status <![CDATA[ <> ]]> '5')
|
||||
AND 0 = (SELECT COUNT(*) FROM pdm_bd_workorder po WHERE po.raw_material_code = mg.storagevehicle_code AND po.workorder_status NOT IN ('5', '6'))
|
||||
<if test="query.stor_id != null and query.stor_id != ''">
|
||||
AND ss.stor_id = #{query.stor_id}
|
||||
</if>
|
||||
@@ -79,7 +79,7 @@
|
||||
</if>
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM pdm_bd_workorder o
|
||||
WHERE o.workorder_status <![CDATA[ < ]]> 5
|
||||
WHERE o.workorder_status NOT IN ('5', '6')
|
||||
AND o.struct_code = ss.struct_code)
|
||||
</select>
|
||||
|
||||
|
||||
@@ -78,7 +78,9 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper,
|
||||
public void create(PdmBdWorkorder entity) {
|
||||
List<PdmBdWorkorder> list = this.list(new LambdaQueryWrapper<PdmBdWorkorder>()
|
||||
.eq(PdmBdWorkorder::getStruct_code, entity.getStruct_code())
|
||||
.ne(PdmBdWorkorder::getWorkorder_status, WorkOrderStatusEnum.COMPLETE.getCode()));
|
||||
.notIn(PdmBdWorkorder::getWorkorder_status,
|
||||
WorkOrderStatusEnum.COMPLETE.getCode(),
|
||||
WorkOrderStatusEnum.CANCELED.getCode()));
|
||||
if (list.size() > 0) {
|
||||
throw new BadRequestException("该位置的物料已经存在工单!");
|
||||
}
|
||||
|
||||
@@ -60,4 +60,6 @@ public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
|
||||
@Param("pointType") String pointType);
|
||||
|
||||
SchBasePoint getNotTaskByDeviceAndType(String device, String type);
|
||||
|
||||
List<SchBasePoint> getSonPointList(@Param("parentPoint") SchBasePoint parentPoint);
|
||||
}
|
||||
|
||||
@@ -137,4 +137,14 @@
|
||||
OR t.point_code4 = p.point_code
|
||||
))
|
||||
</select>
|
||||
<select id="getSonPointList" resultType="org.nl.wms.sch_manage.service.dao.SchBasePoint">
|
||||
SELECT p.*
|
||||
FROM `sch_base_point` p
|
||||
WHERE FIND_IN_SET(#{parentPoint.parent_point_code}, p.parent_point_code)
|
||||
<if test="parentPoint.point_type != null and parentPoint.point_type != ''">
|
||||
AND p.point_type = #{parentPoint.point_type}
|
||||
</if>
|
||||
AND p.is_has_workder = true
|
||||
ORDER BY p.point_code
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -140,6 +140,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
if (ObjectUtil.isNotEmpty(pointStatus) && pointStatus.equals(PointStatusEnum.EMPTY_POINT.getCode())) {
|
||||
entity.setVehicle_type("");
|
||||
entity.setVehicle_code("");
|
||||
entity.setVehicle_qty(0);
|
||||
} else {
|
||||
entity.setVehicle_qty(1);
|
||||
}
|
||||
checkVehicleCodeUsed(entity);
|
||||
pointMapper.updateById(entity);
|
||||
@@ -221,12 +224,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
|
||||
@Override
|
||||
public List<SchBasePoint> getSonPointList(SchBasePoint parentPoint) {
|
||||
return pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.like(SchBasePoint::getParent_point_code, parentPoint.getParent_point_code())
|
||||
//点位类型,根据传入的值是否为空增加判断
|
||||
.eq(StringUtils.isNotBlank(parentPoint.getPoint_type()), SchBasePoint::getPoint_type, parentPoint.getPoint_type())
|
||||
.eq(SchBasePoint::getIs_has_workder, true)
|
||||
.orderByAsc(SchBasePoint::getPoint_code));
|
||||
return pointMapper.getSonPointList(parentPoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
@@ -100,12 +101,7 @@ public class BackInManualTask extends AbstractTask {
|
||||
|
||||
@Override
|
||||
public void cancel(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) throw new BadRequestException("该任务不存在");
|
||||
if (Integer.parseInt(taskObj.getTask_status()) > Integer.parseInt(TaskStatus.CREATE.getCode())) {
|
||||
throw new BadRequestException("只能取消生成中的任务!");
|
||||
}
|
||||
this.cancelTask(taskObj);
|
||||
throw new BadRequestException("手工退料任务不允许取消!");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,9 +144,18 @@ public class BackInManualTask extends AbstractTask {
|
||||
.set(Structattr::getTask_code, null)
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定")));
|
||||
|
||||
iMdPbGroupplateService.update(new GroupPlate(), new LambdaUpdateWrapper<GroupPlate>()
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code()));
|
||||
JSONObject requestParam = JSONObject.parseObject(taskObj.getRequest_param());
|
||||
String groupId = requestParam.getString("group_id");
|
||||
if (ObjectUtil.isNotEmpty(groupId)) {
|
||||
GroupPlate currentInGroupPlate = iMdPbGroupplateService.getOne(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getGroup_id, groupId)
|
||||
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
|
||||
if (ObjectUtil.isNotEmpty(currentInGroupPlate)) {
|
||||
iMdPbGroupplateService.removeById(currentInGroupPlate.getGroup_id());
|
||||
}
|
||||
}
|
||||
inBillService.taskCancel(taskObj);
|
||||
|
||||
taskObj.setRemark("已取消");
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
@@ -29,8 +30,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
;import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: Liuxy
|
||||
@@ -106,6 +106,7 @@ public class BackInTask extends AbstractTask {
|
||||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1());
|
||||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2());
|
||||
acsTaskDto.setPriority(taskDao.getPriority());
|
||||
acsTaskDto.setAgv_system_type(normalizeAgvSystemType("2"));
|
||||
acsTaskDto.setTask_type("1");
|
||||
fillCommonAcsTaskFields(taskDao, acsTaskDto);
|
||||
return acsTaskDto;
|
||||
@@ -147,14 +148,7 @@ public class BackInTask extends AbstractTask {
|
||||
|
||||
@Override
|
||||
public void cancel(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
if (Integer.parseInt(taskObj.getTask_status()) > Integer.parseInt(TaskStatus.CREATE.getCode())) {
|
||||
throw new BadRequestException("只能取消生成中的任务!");
|
||||
}
|
||||
this.cancelTask(taskObj);
|
||||
throw new BadRequestException("自动退料任务不允许取消!");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -209,9 +203,18 @@ public class BackInTask extends AbstractTask {
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
);
|
||||
|
||||
iMdPbGroupplateService.update(new GroupPlate(), new LambdaUpdateWrapper<GroupPlate>()
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code()));
|
||||
JSONObject requestParam = JSONObject.parseObject(taskObj.getRequest_param());
|
||||
String groupId = requestParam.getString("group_id");
|
||||
if (ObjectUtil.isNotEmpty(groupId)) {
|
||||
GroupPlate currentInGroupPlate = iMdPbGroupplateService.getOne(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getGroup_id, groupId)
|
||||
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
|
||||
if (ObjectUtil.isNotEmpty(currentInGroupPlate)) {
|
||||
iMdPbGroupplateService.removeById(currentInGroupPlate.getGroup_id());
|
||||
}
|
||||
}
|
||||
inBillService.taskCancel(taskObj);
|
||||
// 更新任务
|
||||
taskObj.setRemark("已取消");
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
|
||||
@@ -107,8 +107,11 @@ public class VehicleInManualTask extends AbstractTask {
|
||||
public void cancel(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) throw new BadRequestException("该任务不存在");
|
||||
if (Integer.parseInt(taskObj.getTask_status()) > Integer.parseInt(TaskStatus.CREATE.getCode())) {
|
||||
throw new BadRequestException("只能取消生成中的任务!");
|
||||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) {
|
||||
throw new BadRequestException("该任务已完成!");
|
||||
}
|
||||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
|
||||
throw new BadRequestException("该任务已取消!");
|
||||
}
|
||||
this.cancelTask(taskObj);
|
||||
}
|
||||
@@ -164,6 +167,12 @@ public class VehicleInManualTask extends AbstractTask {
|
||||
.set(Structattr::getTask_code, null)
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定")));
|
||||
|
||||
List<GroupPlate> groupPlateList = iMdPbGroupPlateService.list(new QueryWrapper<GroupPlate>().lambda()
|
||||
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code()));
|
||||
if (CollectionUtils.isNotEmpty(groupPlateList)) {
|
||||
iMdPbGroupPlateService.delete(groupPlateList.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
taskObj.setRemark("已取消");
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskService.updateById(taskObj);
|
||||
|
||||
@@ -161,8 +161,11 @@ public class VehicleInTask extends AbstractTask {
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
if (Integer.parseInt(taskObj.getTask_status()) > Integer.parseInt(TaskStatus.CREATE.getCode())) {
|
||||
throw new BadRequestException("只能取消生成中的任务!");
|
||||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) {
|
||||
throw new BadRequestException("该任务已完成!");
|
||||
}
|
||||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
|
||||
throw new BadRequestException("该任务已取消!");
|
||||
}
|
||||
this.cancelTask(taskObj);
|
||||
}
|
||||
@@ -230,6 +233,14 @@ public class VehicleInTask extends AbstractTask {
|
||||
.set(Structattr::getTask_code, null)
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
);
|
||||
|
||||
List<GroupPlate> groupPlateList = iMdPbGroupPlateService.list(new QueryWrapper<GroupPlate>().lambda()
|
||||
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code())
|
||||
);
|
||||
if (CollectionUtils.isNotEmpty(groupPlateList)) {
|
||||
iMdPbGroupPlateService.delete(groupPlateList.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
// 更新任务
|
||||
taskObj.setRemark("已取消");
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.pm_manage.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.sch_manage.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
@@ -29,13 +28,17 @@ import org.nl.wms.sch_manage.service.util.TaskUtils;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.IInBillService;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDtlMapper;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -60,6 +63,12 @@ public class JbDownAgvTask extends AbstractTask {
|
||||
private IMdPbStoragevehicleinfoService storagevehicleinfoService;
|
||||
@Resource
|
||||
private IStructattrService structattrService;
|
||||
@Resource
|
||||
private IOStorInvMapper ioStorInvMapper;
|
||||
@Resource
|
||||
private IOStorInvDtlMapper ioStorInvDtlMapper;
|
||||
@Resource
|
||||
private IMdPbGroupplateService groupplateService;
|
||||
@Override
|
||||
public String create(JSONObject param) {
|
||||
// 改造:多条任务
|
||||
@@ -158,7 +167,10 @@ public class JbDownAgvTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
List<IOStorInvDis> disList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getTask_id, taskObj.getTask_id()));
|
||||
// 取消任务
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark("已取消");
|
||||
@@ -188,6 +200,8 @@ public class JbDownAgvTask extends AbstractTask {
|
||||
clearPointTaskCode(taskObj.getPoint_code1());
|
||||
clearStructTaskCode(taskObj.getPoint_code2());
|
||||
}
|
||||
deleteRelatedInBills(disList);
|
||||
deleteRelatedGroupPlate(taskObj.getGroup_id());
|
||||
}
|
||||
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
@@ -302,9 +316,37 @@ public class JbDownAgvTask extends AbstractTask {
|
||||
}
|
||||
structattrService.update(new LambdaUpdateWrapper<Structattr>()
|
||||
.set(Structattr::getTask_code, null)
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq(Structattr::getStruct_code, code));
|
||||
}
|
||||
|
||||
private void deleteRelatedInBills(List<IOStorInvDis> disList) {
|
||||
if (ObjectUtil.isEmpty(disList)) {
|
||||
return;
|
||||
}
|
||||
List<String> invIds = new ArrayList<>();
|
||||
for (IOStorInvDis dis : disList) {
|
||||
if (ObjectUtil.isNotEmpty(dis.getIostorinv_id()) && !invIds.contains(dis.getIostorinv_id())) {
|
||||
invIds.add(dis.getIostorinv_id());
|
||||
}
|
||||
}
|
||||
for (String invId : invIds) {
|
||||
ioStorInvDisMapper.delete(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getIostorinv_id, invId));
|
||||
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<IOStorInvDtl>()
|
||||
.eq(IOStorInvDtl::getIostorinv_id, invId));
|
||||
ioStorInvMapper.deleteById(invId);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteRelatedGroupPlate(String groupId) {
|
||||
if (ObjectUtil.isEmpty(groupId)) {
|
||||
return;
|
||||
}
|
||||
groupplateService.remove(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getGroup_id, groupId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
|
||||
@@ -222,19 +222,20 @@ public class JbUpAgvTask extends AbstractTask {
|
||||
.set(PdmBdWorkorder::getRealproduceend_date, DateUtil.now())
|
||||
.eq(PdmBdWorkorder::getWorkorder_id, orderId));
|
||||
}
|
||||
// 获取托盘数据
|
||||
MdPbStoragevehicleinfo v1 = storagevehicleinfoService.getByCode(taskObj.getVehicle_code());
|
||||
String pointCode;
|
||||
String pointVehicleCode;
|
||||
MdPbStoragevehicleinfo pointVehicleInfo;
|
||||
if (ObjectUtil.isNotEmpty(taskObj.getPoint_code3())) {
|
||||
// 空进满出
|
||||
pointCode = taskObj.getPoint_code1();
|
||||
// 获取托盘数据
|
||||
MdPbStoragevehicleinfo v2 = storagevehicleinfoService.getByCode(taskObj.getVehicle_code2());
|
||||
pointVehicleCode = taskObj.getVehicle_code2();
|
||||
pointVehicleInfo = storagevehicleinfoService.getByCode(pointVehicleCode);
|
||||
MdPbStoragevehicleinfo emptyVehicleInfo = storagevehicleinfoService.getByCode(taskObj.getVehicle_code());
|
||||
|
||||
// 仓位设置空托盘
|
||||
structattrService.update(new LambdaUpdateWrapper<Structattr>()
|
||||
.set(Structattr::getStoragevehicle_code, taskObj.getVehicle_code2())
|
||||
.set(Structattr::getStoragevehicle_type, ObjectUtil.isNotEmpty(v2) ? v2.getStoragevehicle_type() : "")
|
||||
.set(Structattr::getStoragevehicle_code, taskObj.getVehicle_code())
|
||||
.set(Structattr::getStoragevehicle_type, ObjectUtil.isNotEmpty(emptyVehicleInfo) ? emptyVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(Structattr::getOccupancy_state, 2)
|
||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code2()));
|
||||
// 仓位设置空
|
||||
@@ -246,6 +247,8 @@ public class JbUpAgvTask extends AbstractTask {
|
||||
} else {
|
||||
// 满出
|
||||
pointCode = taskObj.getPoint_code2();
|
||||
pointVehicleCode = taskObj.getVehicle_code();
|
||||
pointVehicleInfo = storagevehicleinfoService.getByCode(pointVehicleCode);
|
||||
// 仓位设置空
|
||||
structattrService.update(new LambdaUpdateWrapper<Structattr>()
|
||||
.set(Structattr::getOccupancy_state, 1)
|
||||
@@ -255,10 +258,10 @@ public class JbUpAgvTask extends AbstractTask {
|
||||
}
|
||||
// 点位设置值
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||
.set(SchBasePoint::getVehicle_code, pointVehicleCode)
|
||||
.set(SchBasePoint::getPoint_status, "3")
|
||||
.set(SchBasePoint::getIng_task_code, null)
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(v1) ? v1.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(pointVehicleInfo) ? pointVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
|
||||
@@ -103,25 +103,7 @@ public class JbUpManualTask extends AbstractTask {
|
||||
}
|
||||
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
JSONObject requestParam = JSONObject.parseObject(taskObj.getRequest_param());
|
||||
String orderId = requestParam.getString("order_id");
|
||||
if (ObjectUtil.isNotEmpty(orderId)) {
|
||||
workorderService.update(new LambdaUpdateWrapper<PdmBdWorkorder>()
|
||||
.set(PdmBdWorkorder::getWorkorder_status, "2")
|
||||
.set(PdmBdWorkorder::getRealproduceend_date, null)
|
||||
.eq(PdmBdWorkorder::getWorkorder_id, orderId));
|
||||
}
|
||||
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getIng_task_code, null)
|
||||
.eq(SchBasePoint::getIng_task_code, taskObj.getTask_id()));
|
||||
|
||||
deleteOutBillByTask(taskObj.getTask_id());
|
||||
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark("已取消");
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
throw new BadRequestException("解包上料人工转运任务不允许取消,请完成任务后再进行后续操作!");
|
||||
}
|
||||
|
||||
private void deleteOutBillByTask(String taskId) {
|
||||
|
||||
@@ -13,6 +13,8 @@ import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.ext_manage.service.WmsToMesService;
|
||||
@@ -29,7 +31,10 @@ import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.IInBillService;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDtlMapper;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -63,9 +68,15 @@ public class DownEmptyUpFullManualTask extends AbstractTask {
|
||||
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
@Resource
|
||||
private IOStorInvDtlMapper ioStorInvDtlMapper;
|
||||
@Resource
|
||||
private IOStorInvMapper ioStorInvMapper;
|
||||
|
||||
@Resource
|
||||
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||
@Resource
|
||||
private IMdPbStoragevehicleinfoService storagevehicleinfoService;
|
||||
|
||||
@Resource
|
||||
private ISchBasePointService pointService;
|
||||
@@ -170,35 +181,47 @@ public class DownEmptyUpFullManualTask extends AbstractTask {
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("已完成");
|
||||
taskService.updateById(taskObj);
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentNickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
//如果是序列1
|
||||
if(taskObj.getTask_group_seq().compareTo(new BigDecimal(1))==0){
|
||||
MdPbStoragevehicleinfo fullVehicleInfo = storagevehicleinfoService.getByCode(taskObj.getVehicle_code());
|
||||
MdPbStoragevehicleinfo emptyVehicleInfo = storagevehicleinfoService.getByCode(taskObj.getVehicle_code2());
|
||||
outBillService.taskFinish(taskObj);
|
||||
//点位2
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(fullVehicleInfo) ? fullVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getPoint_status, "3")
|
||||
.set(SchBasePoint::getVehicle_qty, 1)
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2()));
|
||||
//点位3
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getVehicle_type, "")
|
||||
.set(SchBasePoint::getPoint_status, "1")
|
||||
.set(SchBasePoint::getVehicle_qty, 0)
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code3()));
|
||||
//点位4
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code2())
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(emptyVehicleInfo) ? emptyVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getPoint_status, "2")
|
||||
.set(SchBasePoint::getVehicle_qty, 1)
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code4()));
|
||||
|
||||
}
|
||||
@@ -216,21 +239,21 @@ public class DownEmptyUpFullManualTask extends AbstractTask {
|
||||
}
|
||||
|
||||
|
||||
MdPbStoragevehicleinfo fullVehicleInfo = storagevehicleinfoService.getByCode(taskObj.getVehicle_code());
|
||||
List<GroupPlate> groupPlates = iMdPbGroupplateService.list(new QueryWrapper<GroupPlate>().lambda()
|
||||
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
|
||||
|
||||
outBillService.taskFinish(taskObj);
|
||||
|
||||
//点位2
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getVehicle_type, "")
|
||||
.set(SchBasePoint::getPoint_status, "1")
|
||||
.set(SchBasePoint::getVehicle_qty, 0)
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.set(SchBasePoint::getIng_task_code,null)
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1()));
|
||||
|
||||
boolean groupPlatesNotEmpty = CollectionUtils.isNotEmpty(groupPlates);
|
||||
@@ -242,23 +265,25 @@ public class DownEmptyUpFullManualTask extends AbstractTask {
|
||||
//点位3
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(fullVehicleInfo) ? fullVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getPoint_status, "3")
|
||||
.set(SchBasePoint::getVehicle_qty, 1)
|
||||
.set(groupPlatesNotEmpty,SchBasePoint::getRemark,groupId)
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.set(SchBasePoint::getIng_task_code,null)
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2()));
|
||||
//点位4
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getVehicle_type, "")
|
||||
.set(SchBasePoint::getPoint_status, "1")
|
||||
.set(SchBasePoint::getVehicle_qty, 0)
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.set(SchBasePoint::getIng_task_code,null)
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code3()));
|
||||
|
||||
//点位1
|
||||
@@ -291,6 +316,10 @@ public class DownEmptyUpFullManualTask extends AbstractTask {
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask taskObj) {
|
||||
if (taskObj.getTask_group_seq() != null && taskObj.getTask_group_seq().compareTo(BigDecimal.ONE) == 0) {
|
||||
cancelFirstTask(taskObj);
|
||||
return;
|
||||
}
|
||||
|
||||
// 取消任务
|
||||
taskService.update(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
@@ -319,11 +348,6 @@ public class DownEmptyUpFullManualTask extends AbstractTask {
|
||||
iStructattrService.updateStatusByCode("2", finish_map);
|
||||
|
||||
|
||||
//更新组盘表 status 10->20
|
||||
iMdPbGroupplateService.update(new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code()));
|
||||
|
||||
//更新库存 减冻结加可用
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE);
|
||||
@@ -360,4 +384,150 @@ public class DownEmptyUpFullManualTask extends AbstractTask {
|
||||
// wmsToMesService.uploadMes(jsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelFirstTask(SchBaseTask taskObj) {
|
||||
List<SchBaseTask> groupTasks = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_group_id, taskObj.getTask_group_id())
|
||||
.eq(SchBaseTask::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否")));
|
||||
SchBaseTask secondTask = groupTasks.stream()
|
||||
.filter(groupTask -> groupTask.getTask_group_seq() != null
|
||||
&& groupTask.getTask_group_seq().compareTo(new BigDecimal(2)) == 0)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (ObjectUtil.isNotEmpty(secondTask)
|
||||
&& !TaskStatus.CANCELED.getCode().equals(secondTask.getTask_status())) {
|
||||
throw new BadRequestException("第二条任务未取消,请先取消第二条任务!");
|
||||
}
|
||||
|
||||
taskService.update(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.set(SchBaseTask::getIs_delete, BaseDataEnum.IS_YES_NOT.code("是"))
|
||||
.set(SchBaseTask::getTask_status, TaskStatus.CANCELED.getCode())
|
||||
.set(SchBaseTask::getRemark, "已取消")
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getTask_id()));
|
||||
|
||||
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getTask_id, taskObj.getTask_id()));
|
||||
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
Set<String> iostorinvIds = new HashSet<>();
|
||||
Set<String> iostorinvdtlIds = new HashSet<>();
|
||||
|
||||
for (IOStorInvDis ioStorInvDis : ioStorInvDisList) {
|
||||
iostorinvIds.add(ioStorInvDis.getIostorinv_id());
|
||||
iostorinvdtlIds.add(ioStorInvDis.getIostorinvdtl_id());
|
||||
|
||||
JSONObject finishMap = new JSONObject();
|
||||
finishMap.put("struct_code", ioStorInvDis.getStruct_code());
|
||||
finishMap.put("inv_type", null);
|
||||
finishMap.put("inv_id", null);
|
||||
finishMap.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("2", finishMap);
|
||||
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE);
|
||||
jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
jsonIvt.put("material_id", ioStorInvDis.getMaterial_id());
|
||||
jsonIvt.put("pcsn", ioStorInvDis.getPcsn());
|
||||
jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id());
|
||||
jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(updateIvtList)) {
|
||||
iMdPbGroupplateService.updateIvt(updateIvtList);
|
||||
}
|
||||
|
||||
MdPbStoragevehicleinfo emptyVehicleInfo = storagevehicleinfoService.getByCode(taskObj.getVehicle_code2());
|
||||
|
||||
if (CollectionUtils.isNotEmpty(taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_group_id, taskObj.getTask_group_id())
|
||||
.eq(SchBaseTask::getTask_group_seq, BigDecimal.ONE)
|
||||
.eq(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode())))) {
|
||||
normalizeSharedPointsAfterFirstFinished(taskObj);
|
||||
}
|
||||
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getVehicle_type, "")
|
||||
.set(SchBasePoint::getVehicle_qty, 0)
|
||||
.set(SchBasePoint::getPoint_status, "1")
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.in(SchBasePoint::getPoint_code, Arrays.asList(taskObj.getPoint_code2(), taskObj.getPoint_code4())));
|
||||
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code2())
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(emptyVehicleInfo) ? emptyVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getVehicle_qty, 1)
|
||||
.set(SchBasePoint::getPoint_status, "2")
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code3()));
|
||||
|
||||
ioStorInvDisMapper.delete(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getTask_id, taskObj.getTask_id()));
|
||||
|
||||
for (String iostorinvId : iostorinvIds) {
|
||||
int remainDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getIostorinv_id, iostorinvId));
|
||||
if (remainDis == 0) {
|
||||
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<IOStorInvDtl>()
|
||||
.eq(IOStorInvDtl::getIostorinv_id, iostorinvId));
|
||||
ioStorInvMapper.deleteById(iostorinvId);
|
||||
} else {
|
||||
for (String dtlId : iostorinvdtlIds) {
|
||||
int remainDtlDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id, dtlId));
|
||||
if (remainDtlDis == 0) {
|
||||
ioStorInvDtlMapper.deleteById(dtlId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void normalizeSharedPointsAfterFirstFinished(SchBaseTask taskObj) {
|
||||
MdPbStoragevehicleinfo fullVehicleInfo = storagevehicleinfoService.getByCode(taskObj.getVehicle_code());
|
||||
MdPbStoragevehicleinfo emptyVehicleInfo = storagevehicleinfoService.getByCode(taskObj.getVehicle_code2());
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentNickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(fullVehicleInfo) ? fullVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getPoint_status, "3")
|
||||
.set(SchBasePoint::getVehicle_qty, 1)
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1()));
|
||||
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getVehicle_type, "")
|
||||
.set(SchBasePoint::getPoint_status, "1")
|
||||
.set(SchBasePoint::getVehicle_qty, 0)
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2()));
|
||||
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code2())
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(emptyVehicleInfo) ? emptyVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getPoint_status, "2")
|
||||
.set(SchBasePoint::getVehicle_qty, 1)
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code3()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.ext_manage.service.WmsToMesService;
|
||||
@@ -29,7 +31,10 @@ import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.IInBillService;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDtlMapper;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -63,9 +68,15 @@ public class DownEmptyUpFullTask extends AbstractTask {
|
||||
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
@Resource
|
||||
private IOStorInvDtlMapper ioStorInvDtlMapper;
|
||||
@Resource
|
||||
private IOStorInvMapper ioStorInvMapper;
|
||||
|
||||
@Resource
|
||||
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||
@Resource
|
||||
private IMdPbStoragevehicleinfoService storagevehicleinfoService;
|
||||
|
||||
@Resource
|
||||
private ISchBasePointService pointService;
|
||||
@@ -122,6 +133,7 @@ public class DownEmptyUpFullTask extends AbstractTask {
|
||||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2());
|
||||
acsTaskDto.setStart_device_code2(taskDao.getPoint_code3());
|
||||
acsTaskDto.setNext_device_code2(taskDao.getPoint_code4());
|
||||
acsTaskDto.setAgv_system_type(normalizeAgvSystemType("3"));
|
||||
acsTaskDto.setPriority(taskDao.getPriority());
|
||||
acsTaskDto.setTask_type("3");
|
||||
fillCommonAcsTaskFields(taskDao, acsTaskDto);
|
||||
@@ -182,37 +194,56 @@ public class DownEmptyUpFullTask extends AbstractTask {
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("已完成");
|
||||
taskService.updateById(taskObj);
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentNickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
//如果是序列1
|
||||
if(taskObj.getTask_group_seq().compareTo(new BigDecimal(1))==0){
|
||||
MdPbStoragevehicleinfo fullVehicleInfo = storagevehicleinfoService.getByCode(taskObj.getVehicle_code());
|
||||
MdPbStoragevehicleinfo emptyVehicleInfo = storagevehicleinfoService.getByCode(taskObj.getVehicle_code2());
|
||||
outBillService.taskFinish(taskObj);
|
||||
//点位2
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(fullVehicleInfo) ? fullVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getPoint_status, "3")
|
||||
.set(SchBasePoint::getVehicle_qty, 1)
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2()));
|
||||
//点位3
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getVehicle_type, "")
|
||||
.set(SchBasePoint::getPoint_status, "1")
|
||||
.set(SchBasePoint::getVehicle_qty, 0)
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code3()));
|
||||
//点位4
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code2())
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(emptyVehicleInfo) ? emptyVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getPoint_status, "2")
|
||||
.set(SchBasePoint::getVehicle_qty, 1)
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code4()));
|
||||
|
||||
if(IOSEnum.CREATE_MODE.code("外部接口产生").equals(taskObj.getCreate_mode())){
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("status",200);
|
||||
jsonObject.put("message","成功");
|
||||
jsonObject.put("task_code",taskObj.getExt_task_code());
|
||||
wmsToMesService.uploadMes(jsonObject);
|
||||
}
|
||||
}
|
||||
//如果是序列2
|
||||
else{
|
||||
@@ -227,22 +258,21 @@ public class DownEmptyUpFullTask extends AbstractTask {
|
||||
|
||||
}
|
||||
|
||||
|
||||
MdPbStoragevehicleinfo fullVehicleInfo = storagevehicleinfoService.getByCode(taskObj.getVehicle_code());
|
||||
List<GroupPlate> groupPlates = iMdPbGroupplateService.list(new QueryWrapper<GroupPlate>().lambda()
|
||||
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
|
||||
|
||||
outBillService.taskFinish(taskObj);
|
||||
|
||||
//点位2
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getVehicle_type, "")
|
||||
.set(SchBasePoint::getPoint_status, "1")
|
||||
.set(SchBasePoint::getVehicle_qty, 0)
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.set(SchBasePoint::getIng_task_code,null)
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1()));
|
||||
|
||||
boolean groupPlatesNotEmpty = CollectionUtils.isNotEmpty(groupPlates);
|
||||
@@ -254,23 +284,25 @@ public class DownEmptyUpFullTask extends AbstractTask {
|
||||
//点位3
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(fullVehicleInfo) ? fullVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getPoint_status, "3")
|
||||
.set(SchBasePoint::getVehicle_qty, 1)
|
||||
.set(groupPlatesNotEmpty,SchBasePoint::getRemark,groupId)
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.set(SchBasePoint::getIng_task_code,null)
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2()));
|
||||
//点位4
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getVehicle_type, "")
|
||||
.set(SchBasePoint::getPoint_status, "1")
|
||||
.set(SchBasePoint::getVehicle_qty, 0)
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.set(SchBasePoint::getIng_task_code,null)
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code3()));
|
||||
|
||||
//点位1
|
||||
@@ -290,19 +322,15 @@ public class DownEmptyUpFullTask extends AbstractTask {
|
||||
// .eq(GroupPlate::getStoragevehicle_code,taskObj.getVehicle_code()));
|
||||
|
||||
|
||||
//反馈到MES系统
|
||||
if(IOSEnum.CREATE_MODE.code("外部接口产生").equals(taskObj.getCreate_mode())){
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("status",200);
|
||||
jsonObject.put("message","成功");
|
||||
jsonObject.put("task_code",taskObj.getExt_task_code());
|
||||
wmsToMesService.uploadMes(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask taskObj) {
|
||||
if (taskObj.getTask_group_seq() != null && taskObj.getTask_group_seq().compareTo(BigDecimal.ONE) == 0) {
|
||||
cancelFirstTask(taskObj);
|
||||
return;
|
||||
}
|
||||
|
||||
// 取消任务
|
||||
taskService.update(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
@@ -331,11 +359,6 @@ public class DownEmptyUpFullTask extends AbstractTask {
|
||||
iStructattrService.updateStatusByCode("2", finish_map);
|
||||
|
||||
|
||||
//更新组盘表 status 10->20
|
||||
iMdPbGroupplateService.update(new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code()));
|
||||
|
||||
//更新库存 减冻结加可用
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE);
|
||||
@@ -349,6 +372,13 @@ public class DownEmptyUpFullTask extends AbstractTask {
|
||||
}
|
||||
iMdPbGroupplateService.updateIvt(updateIvtList);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_group_id, taskObj.getTask_group_id())
|
||||
.eq(SchBaseTask::getTask_group_seq, BigDecimal.ONE)
|
||||
.eq(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode())))) {
|
||||
normalizeSharedPointsAfterFirstFinished(taskObj);
|
||||
}
|
||||
|
||||
//分配表清除任务
|
||||
ioStorInvDisMapper.update(new IOStorInvDis(),new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getTask_id,null)
|
||||
@@ -372,4 +402,142 @@ public class DownEmptyUpFullTask extends AbstractTask {
|
||||
// wmsToMesService.uploadMes(jsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void normalizeSharedPointsAfterFirstFinished(SchBaseTask taskObj) {
|
||||
MdPbStoragevehicleinfo fullVehicleInfo = storagevehicleinfoService.getByCode(taskObj.getVehicle_code());
|
||||
MdPbStoragevehicleinfo emptyVehicleInfo = storagevehicleinfoService.getByCode(taskObj.getVehicle_code2());
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentNickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(fullVehicleInfo) ? fullVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getPoint_status, "3")
|
||||
.set(SchBasePoint::getVehicle_qty, 1)
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1()));
|
||||
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getVehicle_type, "")
|
||||
.set(SchBasePoint::getPoint_status, "1")
|
||||
.set(SchBasePoint::getVehicle_qty, 0)
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2()));
|
||||
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code2())
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(emptyVehicleInfo) ? emptyVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getPoint_status, "2")
|
||||
.set(SchBasePoint::getVehicle_qty, 1)
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getUpdate_id, currentUserId)
|
||||
.set(SchBasePoint::getUpdate_name, currentNickName)
|
||||
.set(SchBasePoint::getUpdate_time, now)
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code3()));
|
||||
}
|
||||
|
||||
private void cancelFirstTask(SchBaseTask taskObj) {
|
||||
MdPbStoragevehicleinfo emptyVehicleInfo = storagevehicleinfoService.getByCode(taskObj.getVehicle_code2());
|
||||
List<SchBaseTask> groupTasks = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getTask_group_id, taskObj.getTask_group_id())
|
||||
.eq(SchBaseTask::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否")));
|
||||
SchBaseTask secondTask = groupTasks.stream()
|
||||
.filter(groupTask -> groupTask.getTask_group_seq() != null
|
||||
&& groupTask.getTask_group_seq().compareTo(new BigDecimal(2)) == 0)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (ObjectUtil.isNotEmpty(secondTask)
|
||||
&& !TaskStatus.CANCELED.getCode().equals(secondTask.getTask_status())) {
|
||||
throw new BadRequestException("第二条任务未取消,请先取消第二条任务!");
|
||||
}
|
||||
|
||||
taskService.update(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.set(SchBaseTask::getIs_delete, BaseDataEnum.IS_YES_NOT.code("是"))
|
||||
.set(SchBaseTask::getTask_status, TaskStatus.CANCELED.getCode())
|
||||
.set(SchBaseTask::getRemark, "已取消")
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getTask_id()));
|
||||
|
||||
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getTask_id, taskObj.getTask_id()));
|
||||
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
Set<String> iostorinvIds = new HashSet<>();
|
||||
Set<String> iostorinvdtlIds = new HashSet<>();
|
||||
|
||||
for (IOStorInvDis ioStorInvDis : ioStorInvDisList) {
|
||||
iostorinvIds.add(ioStorInvDis.getIostorinv_id());
|
||||
iostorinvdtlIds.add(ioStorInvDis.getIostorinvdtl_id());
|
||||
|
||||
JSONObject finishMap = new JSONObject();
|
||||
finishMap.put("struct_code", ioStorInvDis.getStruct_code());
|
||||
finishMap.put("inv_type", null);
|
||||
finishMap.put("inv_id", null);
|
||||
finishMap.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("2", finishMap);
|
||||
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE);
|
||||
jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
jsonIvt.put("material_id", ioStorInvDis.getMaterial_id());
|
||||
jsonIvt.put("pcsn", ioStorInvDis.getPcsn());
|
||||
jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id());
|
||||
jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(updateIvtList)) {
|
||||
iMdPbGroupplateService.updateIvt(updateIvtList);
|
||||
}
|
||||
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getVehicle_type, "")
|
||||
.set(SchBasePoint::getVehicle_qty, 0)
|
||||
.set(SchBasePoint::getPoint_status, "1")
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.in(SchBasePoint::getPoint_code, Arrays.asList(taskObj.getPoint_code2(), taskObj.getPoint_code4())));
|
||||
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getIng_task_code, "")
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code2())
|
||||
.set(SchBasePoint::getVehicle_type, ObjectUtil.isNotEmpty(emptyVehicleInfo) ? emptyVehicleInfo.getStoragevehicle_type() : "")
|
||||
.set(SchBasePoint::getVehicle_qty, 1)
|
||||
.set(SchBasePoint::getPoint_status, "2")
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code3()));
|
||||
|
||||
ioStorInvDisMapper.delete(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getTask_id, taskObj.getTask_id()));
|
||||
|
||||
for (String iostorinvId : iostorinvIds) {
|
||||
int remainDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getIostorinv_id, iostorinvId));
|
||||
if (remainDis == 0) {
|
||||
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<IOStorInvDtl>()
|
||||
.eq(IOStorInvDtl::getIostorinv_id, iostorinvId));
|
||||
ioStorInvMapper.deleteById(iostorinvId);
|
||||
} else {
|
||||
for (String dtlId : iostorinvdtlIds) {
|
||||
int remainDtlDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id, dtlId));
|
||||
if (remainDtlDis == 0) {
|
||||
ioStorInvDtlMapper.deleteById(dtlId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,12 +278,6 @@ public class SeparateMaterialManualTask extends AbstractTask {
|
||||
//解绑库位
|
||||
iStructattrService.updateStatusByCode("2", finish_map);
|
||||
|
||||
|
||||
//更新组盘表 status 20->10
|
||||
iMdPbGroupplateService.update(new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code()));
|
||||
|
||||
//更新库存 减冻结加可用
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE);
|
||||
|
||||
@@ -291,12 +291,6 @@ public class SeparateMaterialTask extends AbstractTask {
|
||||
//解绑库位
|
||||
iStructattrService.updateStatusByCode("2", finish_map);
|
||||
|
||||
|
||||
//更新组盘表 status 20->10
|
||||
iMdPbGroupplateService.update(new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code()));
|
||||
|
||||
//更新库存 减冻结加可用
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE);
|
||||
|
||||
@@ -62,6 +62,7 @@ public interface IInBillService extends IService<IOStorInv> {
|
||||
void confirm(Map whereJson);
|
||||
|
||||
void taskFinish(SchBaseTask task);
|
||||
void taskCancel(SchBaseTask task);
|
||||
/**
|
||||
* 解包退料专用完成逻辑
|
||||
* 规则:工单状态置为作废(6)
|
||||
|
||||
@@ -701,6 +701,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
.pcsn(param.getString("pcsn"))
|
||||
.stragegyType(param.getString("stragegy_type"))
|
||||
.is_empty_vehicle(param.getBoolean("is_empty_vehicle"))
|
||||
.fallback_other_raw_sects(param.getBoolean("fallback_other_raw_sects"))
|
||||
.build());
|
||||
if (CollectionUtils.isEmpty(structattrs)) {
|
||||
throw new BadRequestException("无可用货位");
|
||||
@@ -1105,7 +1106,8 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
} else if (StatusEnum.IOBILL_TYPE_IN.code("余料入库").equals(invObj.getBill_type())) {
|
||||
// 获取组盘信息
|
||||
GroupPlate groupPlate = mdPbGroupplateService.getOne(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code()));
|
||||
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
|
||||
|
||||
if (ObjectUtil.isEmpty(groupPlate)) {
|
||||
throw new BadRequestException("托盘[" + ioStorInvDis.getStoragevehicle_code() + "]的信息不存在!");
|
||||
@@ -1428,6 +1430,30 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void taskCancel(SchBaseTask task) {
|
||||
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getTask_id, task.getTask_id()));
|
||||
if (ObjectUtil.isEmpty(ioStorInvDis)) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject unlockMap = new JSONObject();
|
||||
unlockMap.put("struct_code", ioStorInvDis.getStruct_code());
|
||||
unlockMap.put("inv_type", null);
|
||||
unlockMap.put("inv_id", null);
|
||||
unlockMap.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("2", unlockMap);
|
||||
|
||||
String invId = ioStorInvDis.getIostorinv_id();
|
||||
ioStorInvDisMapper.delete(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinv_id, invId));
|
||||
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
.eq(IOStorInvDtl::getIostorinv_id, invId));
|
||||
ioStorInvMapper.deleteById(invId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void taskFinishForJbReturn(SchBaseTask task) {
|
||||
|
||||
@@ -1111,6 +1111,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
getPointObj.put("qty", 0);
|
||||
getPointObj.put("material_code", "-");
|
||||
getPointObj.put("is_empty_vehicle", "1");
|
||||
getPointObj.put("fallback_other_raw_sects", true);
|
||||
Structattr attrDao = inBillService.getStructattr(getPointObj);
|
||||
if (ObjectUtil.isEmpty(attrDao)) {
|
||||
throw new BadRequestException("找不到可用的空托盘回收库位!");
|
||||
@@ -1120,7 +1121,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
task_form.put("point_code4", inPoint.getPoint_code());
|
||||
task_form.put("point_code1", inPoint.getPoint_code());
|
||||
task_form.put("point_code2", attrDao.getStruct_code());
|
||||
task_form.put("vehicle_code2", inPoint.getVehicle_code());
|
||||
task_form.put("vehicle_code", inPoint.getVehicle_code());
|
||||
task_form.put("vehicle_code2", ioStorInvDis.getStoragevehicle_code());
|
||||
}
|
||||
task_id = "0".equals(type) ? jbUpManualTask.create(task_form) : jbUpAgvTask.create(task_form);
|
||||
inPoint.setIng_task_code(task_id);
|
||||
@@ -1159,7 +1161,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
task_form.put("ext_task_code", whereJson.getString("ext_task_code"));
|
||||
task_id = taskFactory.getTask(task_form.getString("task_type")).create(task_form);
|
||||
rkPoint.setIng_task_code(task_id);
|
||||
rkPoint.setPoint_status("3");
|
||||
pointService.updateById(rkPoint);
|
||||
} else if (StatusEnum.IOBILL_TYPE_OUT.code("下空桶上满料出库").equals(ioStorInv.getBill_type())) {
|
||||
//这个业务中 point_code3是出库点位
|
||||
@@ -1192,7 +1193,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
task_form.put("task_group_seq", "1");
|
||||
task_form.put("create_mode", whereJson.getString("create_mode"));
|
||||
task_form.put("ext_task_code", whereJson.getString("ext_task_code"));
|
||||
taskFactory.getTask(task_form.getString("task_type")).create(task_form);
|
||||
task_id = taskFactory.getTask(task_form.getString("task_type")).create(task_form);
|
||||
|
||||
JSONObject task_form2 = new JSONObject();
|
||||
task_form2.put("task_type", "0".equals(type) ? "DownEmptyUpFullManualTask" : "DownEmptyUpFullTask");
|
||||
@@ -1211,19 +1212,15 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
task_form2.put("create_mode", whereJson.getString("create_mode"));
|
||||
task_form2.put("ext_task_code", whereJson.getString("ext_task_code"));
|
||||
|
||||
//这个需求特殊,因为会产生2个task,并且第二个task后结束,因此以第二个task_id为准!!
|
||||
task_id = taskFactory.getTask(task_form2.getString("task_type")).create(task_form2);
|
||||
taskFactory.getTask(task_form2.getString("task_type")).create(task_form2);
|
||||
|
||||
point2.setIng_task_code(task_id);
|
||||
point2.setPoint_status("3");
|
||||
pointService.updateById(point2);
|
||||
|
||||
point3.setIng_task_code(task_id);
|
||||
point3.setPoint_status("1");
|
||||
pointService.updateById(point3);
|
||||
|
||||
point4.setIng_task_code(task_id);
|
||||
point4.setPoint_status("2");
|
||||
pointService.updateById(point4);
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user