rev:修改异常入库分配规则
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package org.nl.wms.base_manage.vehicle.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.entity.PageQuery;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.base_manage.vehicle.service.dto.VehicleQuery;
|
||||
import org.nl.wms.base_manage.vehicle.service.IBmVehicleInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -44,7 +46,10 @@ public class BmVehicleInfoController {
|
||||
@PostMapping
|
||||
@Log("新增载具")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject map) {
|
||||
return new ResponseEntity<>(vehicleInfoService.create(map), HttpStatus.OK);
|
||||
RedissonUtils.lock(()->{
|
||||
vehicleInfoService.create(map);
|
||||
},"新增载具",null);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.stream.Stream;
|
||||
* 手动过滤XYZ排信息
|
||||
* {"y":[1,2,3,104,103,102]}
|
||||
*/
|
||||
//@Service("passRCL")
|
||||
@Service("passRCL")
|
||||
@Slf4j
|
||||
public class PassRCLHandler extends Decisioner<StIvtStructattr, JSONObject> {
|
||||
//现场1/4排深位
|
||||
|
||||
@@ -231,30 +231,31 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
JSONObject struct = rzd(stIvtStructattr, task);
|
||||
return struct;
|
||||
case "czd":
|
||||
moveTask(task_code, struct_code, stIvtStructattr);
|
||||
moveTask(task, struct_code, stIvtStructattr);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void moveTask(String task_code, String struct_code, StIvtStructattr stIvtStructattr) {
|
||||
private void moveTask(SchBaseTask task, String struct_code, StIvtStructattr stIvtStructattr) {
|
||||
AtomicReference<String> moveStruct = new AtomicReference<>();
|
||||
this.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("status", StatusEnum.FORM_STATUS.code("生成"))
|
||||
.set("remark", struct_code + "出库阻挡二次下发")
|
||||
.set("update_time", DateUtil.now())
|
||||
.eq("task_code", task_code));
|
||||
.eq("task_code", task.getTask_code()));
|
||||
StIvtStructattr struct = iStIvtStructattrService.getOne(new QueryWrapper<StIvtStructattr>().eq("struct_code", struct_code));
|
||||
String vehicleCode = struct.getVehicle_code();
|
||||
RedissonUtils.lock(() -> {
|
||||
System.out.println("---3--" + Thread.currentThread().getName());
|
||||
Map process = SpringContextHolder.getBean(DecisionHandler.class).dispenseTransa(ListOf.of("nearby","depthPriority"), new JSONObject(MapOf.of("stor_code", stIvtStructattr.getStor_code())));
|
||||
//出阻挡说明是同排跟任务一个类型载具
|
||||
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())));
|
||||
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("异常位移库")
|
||||
, "is_send", false
|
||||
, "vehicle_code", StringUtils.isEmpty(vehicleCode)?"YCZJ" + task_code:vehicleCode, "form_data", new JSONObject(MapOf.of("start_struct_code", struct_code, "end_struct_code", moveStruct.get())));
|
||||
, "vehicle_code", StringUtils.isEmpty(vehicleCode)?"YCZJ" + task.getTask_code():vehicleCode, "form_data", new JSONObject(MapOf.of("start_struct_code", struct_code, "end_struct_code", moveStruct.get())));
|
||||
moveStorageTask.createTask(new JSONObject(moveForm));
|
||||
}
|
||||
|
||||
@@ -282,7 +283,7 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
.eq("struct_code", task.getPoint_code2()));
|
||||
//查询分配规则
|
||||
Map map = SpringContextHolder.getBean(DecisionHandler.class)
|
||||
.dispenseTransa(ListOf.of("depthPriority","passRCL","nearby"), new JSONObject(MapOf.of("stor_code", stIvtStructattr.getStor_code())));
|
||||
.dispenseTransa(ListOf.of("limitStorage","depthPriority","nearby"), new JSONObject(MapOf.of("stor_code", stIvtStructattr.getStor_code(),"vehicle_code",task.getVehicle_code())));
|
||||
String new_struct_code = ((Map<String, String>) map.get("form_data")).get("end_struct_code");
|
||||
iActRuExecutionService.update(new UpdateWrapper<ActRuExecution>()
|
||||
.set("remark", stIvtStructattr.getStruct_code() + "入满异常重新分配货位" + new_struct_code)
|
||||
@@ -305,7 +306,7 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
.eq("is_delete",false));
|
||||
//查询分配规则
|
||||
Map map = SpringContextHolder.getBean(DecisionHandler.class)
|
||||
.dispenseTransa(ListOf.of("depthPriority","passRCL","nearby"), new JSONObject(MapOf.of("stor_code", stIvtStructattr.getStor_code())));
|
||||
.dispenseTransa(ListOf.of("limitStorage","depthPriority","nearby"), new JSONObject(MapOf.of("stor_code", stIvtStructattr.getStor_code(),"vehicle_code",task.getVehicle_code())));
|
||||
String new_struct_code = ((Map<String, String>) map.get("form_data")).get("end_struct_code");
|
||||
if (vehicleCode!=null){
|
||||
iActRuExecutionService.update(new UpdateWrapper<ActRuExecution>()
|
||||
|
||||
@@ -81,8 +81,8 @@ public class DecisionHandler extends TypeHandler<JSONObject,ExecutionEntity<JSON
|
||||
item_json.putAll(map);
|
||||
return t;
|
||||
}
|
||||
public Map<String,String> dispense(List<String> params, JSONObject iostorinvdtl) {
|
||||
if (StringUtils.isEmpty(iostorinvdtl.getString("stor_code"))){
|
||||
public Map<String,String> dispense(List<String> params, JSONObject trafParam) {
|
||||
if (StringUtils.isEmpty(trafParam.getString("stor_code"))){
|
||||
throw new BadRequestException("出入库策略执行异常:单据确认仓库编码");
|
||||
}
|
||||
Map<String, Decisioner> decisionerMap = SpringContextHolder.getBeansOfType(Decisioner.class);
|
||||
@@ -91,14 +91,14 @@ public class DecisionHandler extends TypeHandler<JSONObject,ExecutionEntity<JSON
|
||||
System.out.println("---1--"+Thread.currentThread().getName());
|
||||
RedissonUtils.lock(()->{
|
||||
System.out.println("---3--"+Thread.currentThread().getName());
|
||||
Map<String, String> process = SpringContextHolder.getBean(DecisionHandler.class).dispenseTransa(params, iostorinvdtl);
|
||||
Map<String, String> process = SpringContextHolder.getBean(DecisionHandler.class).dispenseTransa(params, trafParam);
|
||||
atomicResult.set(process);
|
||||
},decisioner.strategyConfig.getStrategy_type()+iostorinvdtl.getString("stor_code"),8);
|
||||
},decisioner.strategyConfig.getStrategy_type()+trafParam.getString("stor_code"),8);
|
||||
return atomicResult.get();
|
||||
}
|
||||
@Transactional(propagation= Propagation.REQUIRES_NEW)
|
||||
public Map<String,String> dispenseTransa(List<String> params, JSONObject iostorinvdtl) {
|
||||
DecisionerChain<List<String>> start = ChainerService.start(params, iostorinvdtl);
|
||||
public Map<String,String> dispenseTransa(List<String> params, JSONObject form) {
|
||||
DecisionerChain<List<String>> start = ChainerService.start(params, form);
|
||||
return start.process(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,17 @@ package org.nl.wms.pda_manage.pick;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.constant.DictConstantPool;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.md_manage.group_dick.service.IMdGruopDickService;
|
||||
import org.nl.wms.md_manage.group_dick.service.dao.MdGruopDick;
|
||||
import org.nl.wms.pda_manage.pick.dto.PdaPickQuery;
|
||||
@@ -16,15 +20,22 @@ import org.nl.wms.pda_manage.pick.dto.PickFormVo;
|
||||
import org.nl.wms.pda_manage.pick.dto.PickTask;
|
||||
import org.nl.wms.pm_manage.form_data.service.IPmFormDataService;
|
||||
import org.nl.wms.pm_manage.form_data.service.dao.PmFormData;
|
||||
import org.nl.wms.stor_manage.pick.service.PickingService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 出入库单主表 前端控制器
|
||||
@@ -37,11 +48,13 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("api/pda/pick")
|
||||
public class PdaPickController {
|
||||
|
||||
@Autowired
|
||||
private IMdGruopDickService iMdGruopDickService;
|
||||
|
||||
@Autowired
|
||||
private IPmFormDataService iPmFormDataService;
|
||||
|
||||
@Autowired
|
||||
private PickingService pickingService;
|
||||
|
||||
@PostMapping("queryPick")
|
||||
@SaIgnore
|
||||
@Log("查询拣选作业")
|
||||
@@ -68,8 +81,13 @@ public class PdaPickController {
|
||||
@SaIgnore
|
||||
@Log("手持拣选确认")
|
||||
public ResponseEntity<Object> savePickTask(@RequestBody PickTask pickTask) {
|
||||
// iMdGruopDickService.groupDick(form);
|
||||
//生成拣选明细:传主表信息
|
||||
Assert.noNullElements(new Object[]{pickTask,pickTask.getId(),pickTask.getPick_vehicle_23(),pickTask.getPick_vehicle_13(),pickTask.getIs_move(),pickTask.getPoint_code(),pickTask.getProduct_area(),pickTask.getStor_code()},"拣选确认异常,请求参数不能为空");
|
||||
RedissonUtils.lock(() -> {
|
||||
pickingService.pdaPick(pickTask);
|
||||
}, pickTask.getCode()+"手持拣选操作", null);
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.constant.DictConstantPool;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.function.PermeateFunction;
|
||||
@@ -23,6 +24,7 @@ import org.nl.wms.md_manage.group_dick.service.IMdGruopDickService;
|
||||
import org.nl.wms.md_manage.group_dick.service.dao.MdGruopDick;
|
||||
import org.nl.wms.md_manage.vehicleMater.service.IMdPbVehicleMaterService;
|
||||
import org.nl.wms.md_manage.vehicleMater.service.dao.MdPbVehicleMater;
|
||||
import org.nl.wms.pda_manage.pick.dto.PickTask;
|
||||
import org.nl.wms.pm_manage.form_data.service.IPmFormDataService;
|
||||
import org.nl.wms.pm_manage.form_data.service.dao.PmFormData;
|
||||
import org.nl.wms.stor_manage.io.service.iostor.dao.StIvtIostorinv;
|
||||
@@ -36,10 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -297,4 +296,53 @@ public class PickingService {
|
||||
|
||||
}
|
||||
}
|
||||
@Transactional
|
||||
public void pdaPick(PickTask pickTask) {
|
||||
PmFormData mst = iFormDataService.getById(pickTask.getId());
|
||||
if (mst==null||mst.getStatus().equals(StatusEnum.FORM_STATUS.code("完成"))||mst.getStatus().equals(StatusEnum.FORM_STATUS.code("取消"))){
|
||||
throw new BadRequestException("拣选作业不存在或已完成");
|
||||
}
|
||||
List<PmFormData> dtls = iFormDataService.getByParentId(pickTask.getId());
|
||||
if (CollectionUtils.isEmpty(dtls)||dtls.size()>0){
|
||||
throw new BadRequestException("拣选作业明细数据异常");
|
||||
}
|
||||
PmFormData dtl = dtls.get(0);
|
||||
dtl.setForm_type("Picking_Task");
|
||||
dtl.setParent_id(dtl.getId());
|
||||
dtl.setProc_inst_id(null);
|
||||
//组装数据
|
||||
JSONArray array = new JSONArray();
|
||||
JSONObject in = (JSONObject)JSONObject.toJSON(dtl);
|
||||
in.put("qty",dtl.getQty().subtract(dtl.getAssign_qty()));
|
||||
in.put("vehicle_code", pickTask.getPick_vehicle_13());
|
||||
HashMap of = MapOf.of("end_struct_code", ""
|
||||
, "stor_code", pickTask.getStor_code()
|
||||
, "pick_vehicle", pickTask.getPick_vehicle_13()
|
||||
, "outbound", ""
|
||||
, "task_type", StatusEnum.IOBILL_TYPE_IN.code("拣选回库")
|
||||
, "point_code", pickTask.getPoint_code()
|
||||
, "is_move", "true");
|
||||
in.put("form_data",of);
|
||||
JSONObject out = (JSONObject)JSONObject.toJSON(dtl);
|
||||
out.put("qty",dtl.getAssign_qty());
|
||||
out.put("vehicle_code", pickTask.getPick_vehicle_23());
|
||||
String outbound;
|
||||
if (pickTask.getVehicle_code().contains("T")){
|
||||
outbound = DictConstantPool.PRODUCT_OUT_POINT_TP.get(pickTask.getProduct_area());
|
||||
}else {
|
||||
outbound = DictConstantPool.PRODUCT_OUT_POINT.get(pickTask.getProduct_area());
|
||||
}
|
||||
HashMap outof = MapOf.of("end_struct_code", ""
|
||||
, "stor_code", pickTask.getStor_code()
|
||||
, "pick_vehicle", pickTask.getPick_vehicle_23()
|
||||
, "outbound", outbound
|
||||
, "task_type", StatusEnum.IOBILL_TYPE_OUT.code("拣选出库")
|
||||
, "point_code", pickTask.getPoint_code()
|
||||
, "is_move", pickTask.getIs_move());
|
||||
out.put("form_data",outof);
|
||||
array.add(in);
|
||||
array.add(out);
|
||||
this.savePickTask(array);
|
||||
this.taskOpen((JSONObject) JSONObject.toJSON(mst));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user