rev:出库时移库报错

This commit is contained in:
zhangzq
2024-11-29 17:04:21 +08:00
parent 56400375b0
commit f8129ba748
7 changed files with 28 additions and 16 deletions

View File

@@ -53,12 +53,19 @@ public class EndDecisionChainer extends DecisionerChain<List> {
List<String> structs = new ArrayList<>();
if (in_storage){
StIvtStructattr structattr = (StIvtStructattr)transfers.get(0);
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
UpdateWrapper<StIvtStructattr> updateWrapper = new UpdateWrapper<StIvtStructattr>()
.set("vehicle_code", startParam.getString("vehicle_code"))
.set("lock_type", StatusEnum.LOCK.code("入库锁"))
.set("update_time", DateUtil.now())
.set("update_name", SecurityUtils.getCurrentNickName())
.eq("struct_code", structattr.getStruct_code()));
.eq("struct_code", structattr.getStruct_code());
Boolean isMove = startParam.getBoolean("is_move");
//移库任务不能绑定终点托盘不然报错
if (isMove!=null && isMove==true){
updateWrapper.set("vehicle_code", null)
.set("lock_type", StatusEnum.LOCK.code("移库锁"));
}
iStIvtStructattrService.update(updateWrapper);
System.out.println("货位绑定成功"+structattr.getStruct_code()+"_"+startParam.getString("vehicle_code"));
structs.add(structattr.getStruct_code());
}else {

View File

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.domain.exception.BadRequestException;
import org.nl.common.enums.StatusEnum;
@@ -58,17 +59,23 @@ public class MoveStorageTask extends AbstractTask {
if (!CollectionUtils.isEmpty(list)){
throw new BadRequestException("当前载具存在任务:"+list.stream().map(SchBaseTask::getTask_code).collect(Collectors.joining(",")));
}
StIvtStructattr target = iStIvtStructattrService.getOne(new QueryWrapper<StIvtStructattr>().eq("struct_code", end_struct_code));
if (StringUtils.isNotEmpty(target.getVehicle_code())){
throw new BadRequestException("目标货位存在载具:"+target.getVehicle_code());
}
String now = DateUtil.now();
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
.set("lock_type",StatusEnum.LOCK.code("移库锁"))
.set("update_time", now)
.in("struct_code",start_struct_code,end_struct_code));
SchBaseTask task = new SchBaseTask();
task.setId(IdUtil.getStringId());
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
task.setStatus(StatusEnum.FORM_STATUS.code("生成"));
task.setHandle_class(this.getClass().getName());
task.setAcs_type(StatusEnum.ACS_TYPE.code("立库"));
task.setCreate_time(DateUtil.now());
task.setCreate_time(now);
task.setCreate_name(SecurityUtils.getCurrentNickName());
task.setTask_type(from.getString("task_type"));
task.setVehicle_code(vehicle_code);

View File

@@ -150,7 +150,7 @@ public class OutStorageTask extends AbstractTask {
AtomicReference<String> moveStruct = new AtomicReference<>();
RedissonUtils.lock(() -> {
System.out.println("---3--" + Thread.currentThread().getName());
Map process = SpringContextHolder.getBean(DecisionHandler.class).dispenseTransa(ListOf.of("limitStorage","depthPriority","nearby"), new JSONObject(MapOf.of("stor_code", block.getStor_code(),"vehicle_code",struct.getVehicle_code())));
Map process = SpringContextHolder.getBean(DecisionHandler.class).dispenseTransa(ListOf.of("limitStorage","depthPriority","nearby"), new JSONObject(MapOf.of("is_move",true,"stor_code", block.getStor_code(),"vehicle_code",block.getVehicle_code())));
moveStruct.set(((Map<String, String>) process.get("form_data")).get("end_struct_code"));
}, "1" + block.getStor_code(), 5);
Map moveForm = MapOf.of("task_type", StatusEnum.IOBILL_TYPE_MOVE.code("移库")

View File

@@ -250,7 +250,7 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
RedissonUtils.lock(() -> {
System.out.println("---3--" + Thread.currentThread().getName());
//出阻挡说明是同排跟任务一个类型载具
Map process = SpringContextHolder.getBean(DecisionHandler.class).dispenseTransa(ListOf.of("limitStorage","depthPriority","nearby"), new JSONObject(MapOf.of("stor_code", stIvtStructattr.getStor_code(),"vehicle_code",task.getVehicle_code())));
Map process = SpringContextHolder.getBean(DecisionHandler.class).dispenseTransa(ListOf.of("limitStorage","depthPriority","nearby"), new JSONObject(MapOf.of( "is_move",true,"stor_code", stIvtStructattr.getStor_code(),"vehicle_code",task.getVehicle_code())));
moveStruct.set(((Map<String, String>) process.get("form_data")).get("end_struct_code"));
}, "1" + stIvtStructattr.getStor_code(), 5);
Map moveForm = MapOf.of("task_type", StatusEnum.IOBILL_TYPE_MOVE.code("异常位移库")

View File

@@ -48,10 +48,7 @@ public class PdaFormOutDtl {
* 业务单据状态
*/
private String status;
/**
* 出库仓库
*/
private String stor_code;
/**
* 业务单据状态
*/
@@ -110,10 +107,7 @@ public class PdaFormOutDtl {
* 批次号
*/
private String pcsn;
/**
* 车间字段
*/
private String product_area;
/**
* 载具
*/

View File

@@ -65,7 +65,10 @@ public class PdaFormOutMst implements Serializable {
* 业务单据备注
*/
private String remark;
/**
* 车间字段
*/
private String product_area;
/**
* 创建id
*/

View File

@@ -94,6 +94,7 @@ public class PdaIOService {
mst.setProduct_area(mst.getForm_data().getString("product_area"));
mst.setBill_type(billType);
mst.setIn_storage(false);
mst.setProduct_area(pdaFormOutMst.getProduct_area());
mst.setForm_data(new JSONObject(MapOf.of("shipper",null,"product_area",null)));
List<StIvtIostorinvdtl> list = new ArrayList<>();
for (PdaFormOutDtl dtl : dtls) {
@@ -105,11 +106,11 @@ public class PdaIOService {
ivtDtl.setSource_form_id(dtl.getId());
ivtDtl.setSource_form_type(dtl.getForm_type());
ivtDtl.setMaterial_id(dtl.getMaterial_id());
String productArea = dtl.getProduct_area();
String productArea = pdaFormOutMst.getProduct_area();
if (StringUtils.isEmpty(productArea) || !"A1A2A3".contains(productArea)){
throw new BadRequestException("出库申请失败:明细数据车间字段未指定或不正确");
}
String storCode = dtl.getStor_code();
String storCode = pdaFormOutMst.getStor_code();
if (StringUtils.isEmpty(storCode)){
throw new BadRequestException("出库申请失败:明细数据仓库字段未指定");
}