add: 添加外协加工区,堆叠区的取放任务
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package org.nl.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
* 载具类型
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum VehicleTypeEnum {
|
||||
|
||||
TRAY("T001","钢托盘"),
|
||||
FRAME_R01("R01","料框 1230mm*840mm*990mm"),
|
||||
FRAME_R02("R02","料框 1230mm*840mm*450mm"),
|
||||
RACKS_S04("S04","料架 1230mm*840mm*1670mm"),
|
||||
RACKS_S06("S06","料架 1230mm*840mm*1700mm");
|
||||
|
||||
private final String vehicleCode;
|
||||
private final String vehicleName;
|
||||
}
|
||||
@@ -10,6 +10,7 @@ public enum RegionEnum {
|
||||
STAMPING_AND_BLANKING("Amada 80T冲床(手动加工)","111-06"),
|
||||
TRUBEND_SHELVES_3_1_1("TruBend 7036货架03-01-01","111-07"),
|
||||
ZDFJ("分拣工序","111-08"),
|
||||
DDLK("堆叠笼框工序","111-20"),
|
||||
;
|
||||
private final String region_name;
|
||||
private final String region_code;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.system.service.notice.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -148,7 +149,7 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||
public void changeRead(JSONObject jsonObject) {
|
||||
JSONArray data = jsonObject.getJSONArray("data");
|
||||
String haveRead = jsonObject.getString("have_read");
|
||||
List<SysNotice> sysNotices = JSON.parseArray(data.toJSONString(), SysNotice.class);
|
||||
List<SysNotice> sysNotices = BeanUtil.copyToList(data, SysNotice.class);
|
||||
sysNotices.forEach(sysNotice -> sysNotice.setHave_read(haveRead));
|
||||
this.updateBatchById(sysNotices);
|
||||
}
|
||||
|
||||
@@ -40,4 +40,10 @@ public interface IMdBaseVehicleService extends IService<MdBaseVehicle> {
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 根据载具号查询
|
||||
* @param vehicle_code
|
||||
*/
|
||||
MdBaseVehicle selectByVehicleCode(String vehicle_code);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -82,4 +83,10 @@ public class MdBaseVehicleServiceImpl extends ServiceImpl<MdBaseVehicleMapper, M
|
||||
mdBaseVehicleMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MdBaseVehicle selectByVehicleCode(String vehicle_code) {
|
||||
return mdBaseVehicleMapper.selectOne(Wrappers.lambdaQuery(MdBaseVehicle.class)
|
||||
.eq(MdBaseVehicle::getVehicle_code, vehicle_code));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "手持")
|
||||
@RequestMapping("/api/")
|
||||
@RequestMapping("/api/handheld")
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class HandheldController {
|
||||
@@ -29,20 +29,51 @@ public class HandheldController {
|
||||
private HandheldService handheldService;
|
||||
|
||||
@PostMapping("/task")
|
||||
@Log("手持创建去地面点位任务")
|
||||
@ApiOperation("手持创建去地面点位任务")
|
||||
@Log("手持空料笼入库")
|
||||
@ApiOperation("手持空料笼入库")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> applyGroundTask(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(handheldService.applyTask(param), HttpStatus.OK);
|
||||
public ResponseEntity<Object> createEmptyCageStorageTask(@RequestBody JSONObject param) {
|
||||
handheldService.emptyCageStorageTask(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/emptyVehicle")
|
||||
@Log("呼叫地面空载具点位")
|
||||
@ApiOperation("呼叫地面空载具点位")
|
||||
@Log("手持呼叫空料笼")
|
||||
@ApiOperation("手持呼叫空料笼")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> applyEmptyVehicle(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(handheldService.applyEmptyVehicle(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/blanking")
|
||||
@Log("手持工序下料")
|
||||
@ApiOperation("手持工序下料")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> createCageBlankingTask(@RequestBody JSONObject param) {
|
||||
handheldService.cageBlankingTask(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/lock")
|
||||
@Log("点位锁定释放")
|
||||
@ApiOperation("点位锁定释放")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> applyPointLock(@RequestBody JSONObject param) {
|
||||
handheldService.pointLock(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/sourehouse")
|
||||
@Log("物料回库")
|
||||
@ApiOperation("物料回库")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> createToStorehouse(@RequestBody JSONObject param) {
|
||||
handheldService.toStorehouse(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,17 +9,35 @@ public interface HandheldService {
|
||||
|
||||
|
||||
/**
|
||||
* 手持申请去地面点位任务
|
||||
* 手持创建空料笼入库任务
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Object applyTask(JSONObject param);
|
||||
void emptyCageStorageTask(JSONObject param);
|
||||
|
||||
|
||||
/**
|
||||
* 手持呼叫空载具地面点位
|
||||
* 手持呼叫空料笼
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Object applyEmptyVehicle(JSONObject param);
|
||||
|
||||
/**
|
||||
* 手持工序下料
|
||||
* @param param
|
||||
*/
|
||||
void cageBlankingTask(JSONObject param);
|
||||
|
||||
/**
|
||||
* 点位锁定
|
||||
* @param param
|
||||
*/
|
||||
void pointLock(JSONObject param);
|
||||
|
||||
/**
|
||||
* 物料回库任务
|
||||
* @param param
|
||||
*/
|
||||
void toStorehouse(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -4,12 +4,16 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import nl.basjes.shaded.org.springframework.util.Assert;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext.handheld.service.HandheldService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.region.service.ISchBaseRegionService;
|
||||
import org.nl.wms.sch.region.service.dao.SchBaseRegion;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.task.TaskFactory;
|
||||
@@ -30,43 +34,115 @@ public class HandheldServiceImpl implements HandheldService {
|
||||
@Autowired
|
||||
private TaskFactory taskFactory;
|
||||
|
||||
@Autowired
|
||||
private ISchBaseRegionService iSchBaseRegionService;
|
||||
|
||||
|
||||
@Override
|
||||
public Object applyTask(JSONObject param) {
|
||||
public void emptyCageStorageTask(JSONObject param) {
|
||||
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_list")
|
||||
, param.getString("vehicle_type")}, "参数不能为空!");
|
||||
String vehicle_list = param.getString("vehicle_list");
|
||||
String region_code = param.getString("region_code");
|
||||
|
||||
JSONArray vehicle_list = param.getJSONArray("vehicle_list");
|
||||
String device_code = param.getString("device_code");
|
||||
String vehicle_type = param.getString("vehicle_type");
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
|
||||
boolean equals = StrUtil.equals(schBasePoint.getPoint_type(), vehicle_type);
|
||||
if (ObjectUtil.isEmpty(schBasePoint) || !equals) throw new BadRequestException("设备点位不存在!");
|
||||
AbstractTask connectorTask = taskFactory.getTask("HHTask");
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
|
||||
AbstractTask connectorTask = taskFactory.getTask("EMPTYCAGETask");
|
||||
// 准备参数:设备编码
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("config_code", "HHTask");
|
||||
jo.put("config_code", "EMPTYCAGETask");
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
jo.put("vehicle_qty", BeanUtil.toBean(vehicle_list, List.class).size());
|
||||
jo.put("vehicles", BeanUtil.toBean(vehicle_list, List.class));
|
||||
jo.put("vehicle_qty", vehicle_list.size());
|
||||
jo.put("vehicle_code", vehicle_list);
|
||||
jo.put("vehicle_type", vehicle_type);
|
||||
jo.put("ext_data", param);
|
||||
connectorTask.apply(jo);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object applyEmptyVehicle(JSONObject param) {
|
||||
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_type")}, "参数不能为空!");
|
||||
/* Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_type")}, "参数不能为空!");
|
||||
String device_code = param.getString("device_code");
|
||||
String vehicle_type = param.getString("vehicle_type");
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
|
||||
boolean equals = StrUtil.equals(schBasePoint.getPoint_type(), vehicle_type);
|
||||
if (ObjectUtil.isEmpty(schBasePoint) || !equals) throw new BadRequestException("设备点位不存在!");
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
|
||||
AbstractTask connectorTask = taskFactory.getTask("CALLEMPTYTask");
|
||||
// 准备参数:设备编码
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("config_code", "CALLEMPTYTask");
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
jo.put("vehicle_type", vehicle_type);
|
||||
jo.put("ext_data", param);
|
||||
connectorTask.apply(jo);*/
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cageBlankingTask(JSONObject param) {
|
||||
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_code")
|
||||
, param.getString("material_id"), param.getString("region_code"), param.getString("has_report")}, "参数不能为空!");
|
||||
String device_code = param.getString("device_code");
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
String material_id = param.getString("material_id");
|
||||
String region_code = param.getString("region_code");
|
||||
String has_report = param.getString("has_report");
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
|
||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, device_code)
|
||||
.set(SchBasePoint::getIs_lock,true));
|
||||
AbstractTask connectorTask = taskFactory.getTask("BLANKINGTask");
|
||||
// 准备参数:设备编码
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("config_code", "BLANKINGTask");
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("region_code", region_code);
|
||||
jo.put("ext_data", param);
|
||||
connectorTask.apply(jo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pointLock(JSONObject param) {
|
||||
Assert.noNullElements(new Object[]{param.getString("region_code"), param.getString("status")}, "参数不能为空!");
|
||||
String region_code = param.getString("region_code");
|
||||
String status = param.getString("status");
|
||||
SchBaseRegion schBaseRegion = iSchBaseRegionService.getOne(Wrappers.lambdaQuery(SchBaseRegion.class)
|
||||
.eq(SchBaseRegion::getRegion_code, region_code));
|
||||
if (ObjectUtil.isEmpty(schBaseRegion)) throw new BadRequestException("该区域不存在!");
|
||||
if (StrUtil.equals(status, "0")) {
|
||||
iSchBasePointService.releasePoint(region_code);
|
||||
} else if (StrUtil.equals(status, "1")) {
|
||||
iSchBasePointService.lockPoint(region_code);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toStorehouse(JSONObject param) {
|
||||
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_code"), param.getString("ext")}, "参数不能为空!");
|
||||
//点位编码
|
||||
String device_code = param.getString("device_code");
|
||||
//载具号
|
||||
String vehicle_code = param.getString("vehicle_code");
|
||||
String region_code = param.getString("region_code");
|
||||
//物料数据
|
||||
String ext = param.getString("ext");
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
|
||||
AbstractTask connectorTask = taskFactory.getTask("BLANKINGTask");
|
||||
// 准备参数:设备编码
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("device_code", device_code);
|
||||
jo.put("config_code", "TOSTOREHOUSETask");
|
||||
jo.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("region_code", region_code);
|
||||
jo.put("ext_data", param);
|
||||
connectorTask.apply(jo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ public class SortingServiceImpl implements SortingService {
|
||||
|
||||
@Override
|
||||
public Map createAgvTask(JSONObject jsonObject) {
|
||||
log.info("sorting下发agv任务:{}",jsonObject);
|
||||
log.info("sorting下发agv任务:{}", jsonObject);
|
||||
try {
|
||||
Assert.noNullElements(new Object[]{jsonObject,jsonObject.getString("pointCode"),jsonObject.getString("vehicle_code")
|
||||
,jsonObject.getString("task_type"),jsonObject.getString("is_empty")},"请求参数不能为空");
|
||||
Assert.noNullElements(new Object[]{jsonObject, jsonObject.getString("pointCode"), jsonObject.getString("vehicle_code")
|
||||
, jsonObject.getString("task_type"), jsonObject.getString("is_empty")}, "请求参数不能为空");
|
||||
//任务号
|
||||
String task_code = jsonObject.getString("task_code");
|
||||
String pointCode = jsonObject.getString("pointCode");
|
||||
@@ -64,47 +64,66 @@ public class SortingServiceImpl implements SortingService {
|
||||
String task_type = jsonObject.getString("task_type");
|
||||
//是否空托盘; 1.是 0.否
|
||||
String is_empty = jsonObject.getString("is_empty");
|
||||
String task_time = jsonObject.getString("task_time");
|
||||
String task_time = jsonObject.getString("taskTime");
|
||||
//冲床工作号
|
||||
String jobname = jsonObject.getString("jobname");
|
||||
//载具托盘号
|
||||
String vehicle_code = jsonObject.getString("vehicle_code");
|
||||
String vehicle_type = jsonObject.getString("vehicle_type");
|
||||
//托盘上的堆垛信息
|
||||
JSONArray jsonArray = JSONUtil.parseArray(jsonObject.get("pallet_detail"));
|
||||
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(pointCode);
|
||||
if(ObjectUtil.isEmpty(schBasePoint)) {
|
||||
return MapOf.of("status", 400,"msg", "点位编码不存在!");
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
return MapOf.of("status", 400, "msg", "点位编码不存在!");
|
||||
}
|
||||
if(schBasePoint.getIs_lock()){
|
||||
return MapOf.of("status", 400,"msg", "该点位已创建任务!");
|
||||
if (schBasePoint.getIs_lock()) {
|
||||
return MapOf.of("status", 400, "msg", "该点位已创建任务!");
|
||||
}
|
||||
// TODO:呼叫空托
|
||||
iSchBasePointService.update(new UpdateWrapper<SchBasePoint>()
|
||||
.set("is_lock",true)
|
||||
.set("remark",task_code)
|
||||
.eq("point_code",pointCode));
|
||||
JSONObject taskParam = new JSONObject(MapOf.of("task_code",task_code,"job_name",jobname,"device_code",pointCode,"requestNo"
|
||||
, "sorting_"+IdUtil.getStringId(),"ext_data",jsonObject,"vehicle_code",vehicle_code,"ext_data",jsonObject));
|
||||
JSONObject taskParam = new JSONObject(MapOf.of("task_code", task_code, "job_name", jobname, "device_code", pointCode, "requestNo"
|
||||
, "sorting_" + IdUtil.getStringId(), "ext_data", jsonObject, "vehicle_code", vehicle_code, "ext_data", jsonObject));
|
||||
AbstractTask connectorTask = taskFactory.getTask("CNTTask");
|
||||
if(SortingEnum.TASK_TYPE_ONE.getValue().equals(task_type) && SortingEnum.IS_EMPTY.getValue().equals(is_empty)){
|
||||
taskParam.put("config_code","SortingCNTTask");
|
||||
connectorTask.apply(taskParam);
|
||||
//TODO:叫料
|
||||
}else if(SortingEnum.TASK_TYPE_ONE.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)){
|
||||
taskParam.put("config_code","SortingCMTTask");
|
||||
connectorTask.apply(taskParam);
|
||||
//TODO:将空托盘放到线边库
|
||||
}else if(SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.IS_EMPTY.getValue().equals(is_empty)){
|
||||
taskParam.put("config_code","SortingSNTTask");
|
||||
connectorTask.apply(taskParam);
|
||||
//TODO:将满料放到线边库
|
||||
}else if(SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)){
|
||||
taskParam.put("config_code","SortingSMTTask");
|
||||
connectorTask.apply(taskParam);
|
||||
if ("0".equals(vehicle_type)) {
|
||||
// TODO:呼叫空托
|
||||
iSchBasePointService.update(new UpdateWrapper<SchBasePoint>()
|
||||
.set("is_lock", true)
|
||||
.set("remark", task_code)
|
||||
.eq("point_code", pointCode));
|
||||
if (SortingEnum.TASK_TYPE_ONE.getValue().equals(task_type) && SortingEnum.IS_EMPTY.getValue().equals(is_empty)) {
|
||||
taskParam.put("config_code", "SortingCNTTask");
|
||||
connectorTask.apply(taskParam);
|
||||
//TODO:叫料
|
||||
} else if (SortingEnum.TASK_TYPE_ONE.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)) {
|
||||
taskParam.put("config_code", "SortingCMTTask");
|
||||
connectorTask.apply(taskParam);
|
||||
//TODO:将空托盘放到线边库
|
||||
} else if (SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.IS_EMPTY.getValue().equals(is_empty)) {
|
||||
taskParam.put("config_code", "SortingSNTTask");
|
||||
connectorTask.apply(taskParam);
|
||||
//TODO:将满料放到线边库
|
||||
} else if (SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)) {
|
||||
taskParam.put("config_code", "SortingSMTTask");
|
||||
connectorTask.apply(taskParam);
|
||||
}
|
||||
} else if ("1".equals(vehicle_type)) {
|
||||
//TODO:呼叫两个空笼框
|
||||
if (SortingEnum.TASK_TYPE_ONE.getValue().equals(task_type) && SortingEnum.IS_EMPTY.getValue().equals(is_empty)) {
|
||||
taskParam.put("device_code", pointCode + "_1");
|
||||
taskParam.put("config_code", "SortingTwoCNTTask");
|
||||
connectorTask.apply(taskParam);
|
||||
taskParam.put("device_code", pointCode + "_2");
|
||||
connectorTask.apply(taskParam);
|
||||
//TODO:将两个笼框放到线边库
|
||||
} else if (SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)) {
|
||||
taskParam.put("config_code", "SortingSMTTask");
|
||||
taskParam.put("device_code", pointCode + "_1");
|
||||
connectorTask.apply(taskParam);
|
||||
taskParam.put("device_code", pointCode + "_2");
|
||||
connectorTask.apply(taskParam);
|
||||
}
|
||||
}
|
||||
return MapOf.of("status", 200,"msg", "sucess");
|
||||
}catch (Exception ex){
|
||||
return MapOf.of("status", 200,"msg", "操作失败","errMsg",ex.getMessage());
|
||||
return MapOf.of("status", 200, "msg", "sucess");
|
||||
} catch (Exception ex) {
|
||||
return MapOf.of("status", 200, "msg", "操作失败", "errMsg", ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,8 +135,8 @@ public class SortingServiceImpl implements SortingService {
|
||||
for (SchBaseVehiclematerialgroup schBaseVehiclematerialgroup : list) {
|
||||
Gson gson = new Gson();
|
||||
ConnectorDto connectorDto = gson.fromJson(schBaseVehiclematerialgroup.getExtend(), ConnectorDto.class);
|
||||
connectorDto.setDueDate(StrUtil.isNotEmpty(connectorDto.getDueDate())?connectorDto.getDueDate():RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code());
|
||||
connectorDto.setNextOperation(StrUtil.isNotEmpty(connectorDto.getNextOperation())?connectorDto.getNextOperation(): DateUtil.now());
|
||||
connectorDto.setDueDate(StrUtil.isNotEmpty(connectorDto.getDueDate()) ? connectorDto.getDueDate() : RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code());
|
||||
connectorDto.setNextOperation(StrUtil.isNotEmpty(connectorDto.getNextOperation()) ? connectorDto.getNextOperation() : DateUtil.now());
|
||||
connectors.add(connectorDto);
|
||||
}
|
||||
// List<PointMaterialInfo> structList = iSchBasePointService.getStructList(RegionEnum.ZDFJ.getRegion_code(), "1");
|
||||
|
||||
@@ -6,52 +6,59 @@ import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.point.service.dto.PointMaterialInfo;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
* @author lyd
|
||||
* @description 服务接口
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<SchBasePoint>
|
||||
*/
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<SchBasePoint>
|
||||
*/
|
||||
IPage<SchBasePoint> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
* 创建
|
||||
*
|
||||
* @param entity /
|
||||
*/
|
||||
void create(SchBasePoint entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
* 编辑
|
||||
*
|
||||
* @param entity /
|
||||
*/
|
||||
void update(SchBasePoint entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 改变启用状态
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
void changeUsed(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* 获取点位
|
||||
*
|
||||
* @param region
|
||||
* @return
|
||||
*/
|
||||
@@ -59,38 +66,45 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
|
||||
/**
|
||||
* 更改固化室点位状态
|
||||
*
|
||||
* @param jsonObject
|
||||
*/
|
||||
void updateStatus(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* 获取子点位
|
||||
*
|
||||
* @param deviceCode
|
||||
* @return
|
||||
*/
|
||||
List<SchBasePoint> getSubSites(String deviceCode);
|
||||
|
||||
/**
|
||||
* 行锁获取对应点位
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
SchBasePoint selectByIdLock(String id);
|
||||
|
||||
/**
|
||||
* 根据工序查询区域存放位置
|
||||
*
|
||||
* @param region_code
|
||||
*/
|
||||
SchBasePoint selectByRegionCode(String region_code,String vehicleCode);
|
||||
SchBasePoint selectByRegionCode(String region_code, String vehicleCode,String point_type);
|
||||
|
||||
/**
|
||||
* 根据工序查询区域空载具
|
||||
* 没有点位则返回null
|
||||
*
|
||||
* @param region_code,vehicleType托盘类型允许多种类型
|
||||
*/
|
||||
SchBasePoint selectEmpVehicleByRegionCode(String region_code, String...vehicleType);
|
||||
SchBasePoint selectEmpVehicleByRegionCode(String region_code, String... vehicleType);
|
||||
|
||||
|
||||
/**
|
||||
* 根据点位编码查询
|
||||
*
|
||||
* @param start_device_code
|
||||
* @return
|
||||
*/
|
||||
@@ -98,30 +112,71 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
||||
|
||||
/**
|
||||
* 查询二次分配的虚拟站点
|
||||
*
|
||||
* @param region_code
|
||||
* @return
|
||||
*/
|
||||
SchBasePoint selectByReassign(String region_code ,String vehicleCode);
|
||||
SchBasePoint selectByReassign(String region_code, String vehicleCode);
|
||||
|
||||
/**
|
||||
* 根据区域及托盘类型获取库存信息
|
||||
*
|
||||
* @param region_code
|
||||
* @return
|
||||
*/
|
||||
List<PointMaterialInfo> getStructList(String region_code ,String vehicle_type);
|
||||
List<PointMaterialInfo> getStructList(String region_code, String vehicle_type);
|
||||
|
||||
|
||||
/**
|
||||
* 根据终点等待设备查询
|
||||
*
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
SchBasePoint selectByNextWaitPoint(String device_code,String vehicleCode);
|
||||
SchBasePoint selectByNextWaitPoint(String device_code, String vehicleCode);
|
||||
|
||||
/**
|
||||
* 根据托盘类型查询
|
||||
*
|
||||
* @param vehicle_type
|
||||
* @return
|
||||
*/
|
||||
SchBasePoint selectByVehicleQty(String config_code, String vehicle_type);
|
||||
|
||||
/**
|
||||
* 根据载具类型查询点位
|
||||
*
|
||||
* @param vehicle_type
|
||||
* @return
|
||||
*/
|
||||
SchBasePoint selectByEmptyVehicleType(String vehicle_type);
|
||||
|
||||
/**
|
||||
* 根据载具类型查询地面空点位
|
||||
*
|
||||
* @param vehicle_type
|
||||
* @return
|
||||
*/
|
||||
SchBasePoint selectByGroundPoint(String region_code,String pointStatus, String vehicle_type, int seq);
|
||||
|
||||
|
||||
/**
|
||||
* 呼叫空料笼
|
||||
* @param region_code
|
||||
* @param vehicle_type
|
||||
* @return
|
||||
*/
|
||||
SchBasePoint selectByEmptyCage(String region_code,String vehicle_type,String pointStatus ,boolean isVehicle,SchBaseTask task);
|
||||
|
||||
/**
|
||||
* 释放点位
|
||||
* @param region_code
|
||||
*/
|
||||
void releasePoint(String region_code);
|
||||
|
||||
/**
|
||||
* 锁定点位
|
||||
* @param region_code
|
||||
*/
|
||||
void lockPoint(String region_code);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ public class SchBasePoint implements Serializable {
|
||||
@ApiModelProperty(value = "载具编码")
|
||||
private String vehicle_code;
|
||||
|
||||
@ApiModelProperty(value = "多个载具编码")
|
||||
private String vehicles;
|
||||
|
||||
@ApiModelProperty(value = "载具数量")
|
||||
private Integer vehicle_qty;
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package org.nl.wms.sch.point.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -14,11 +16,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
||||
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
@@ -27,6 +32,9 @@ import org.nl.wms.sch.point.service.dao.mapper.SchBasePointMapper;
|
||||
import org.nl.wms.sch.point.service.dto.PointMaterialInfo;
|
||||
import org.nl.wms.sch.region.service.dao.SchBaseRegion;
|
||||
import org.nl.wms.sch.region.service.dao.mapper.SchBaseRegionMapper;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.PointStatusEnum;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -35,30 +43,33 @@ import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
* @author lyd
|
||||
* @description 服务实现
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, SchBasePoint> implements ISchBasePointService {
|
||||
|
||||
@Autowired
|
||||
private SchBasePointMapper pointMapper;
|
||||
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private SchBaseRegionMapper regionMapper;
|
||||
|
||||
@Autowired
|
||||
private IMdBaseVehicleService iMdBaseVehicleService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
@Override
|
||||
public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page){
|
||||
public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page) {
|
||||
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? whereJson.get("blurry").toString() : null;
|
||||
String workshop_code = ObjectUtil.isNotEmpty(whereJson.get("workshop_code")) ? whereJson.get("workshop_code").toString() : null;
|
||||
String region_code = ObjectUtil.isNotEmpty(whereJson.get("region_code")) ? whereJson.get("region_code").toString() : null;
|
||||
@@ -194,7 +205,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
if (ObjectUtil.isEmpty(region)) return this.list();
|
||||
return pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getRegion_code, region.getRegion_code())
|
||||
.eq(ObjectUtil.isNotEmpty(region.getPoint_type()),SchBasePoint::getPoint_type, region.getPoint_type())
|
||||
.eq(ObjectUtil.isNotEmpty(region.getPoint_type()), SchBasePoint::getPoint_type, region.getPoint_type())
|
||||
.orderByAsc(SchBasePoint::getPoint_code));
|
||||
}
|
||||
|
||||
@@ -203,13 +214,13 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
|
||||
String device_code = jsonObject.getString("device_code");
|
||||
Integer state = jsonObject.getInteger("state");
|
||||
if(device_code.startsWith("ZDM")){
|
||||
if (device_code.startsWith("ZDM")) {
|
||||
//todo 根据传入的自动门设备号,将对应自动门的十个点位设置为传入的状态
|
||||
//1-设备禁用 2-取货完毕,允许放货 3-固化完毕,允许取货
|
||||
UpdateWrapper<SchBasePoint> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.like("point_code","GHS"+device_code.substring(device_code.length()-2));
|
||||
updateWrapper.set("point_status",state);
|
||||
pointMapper.update(null,updateWrapper);
|
||||
updateWrapper.like("point_code", "GHS" + device_code.substring(device_code.length() - 2));
|
||||
updateWrapper.set("point_status", state);
|
||||
pointMapper.update(null, updateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,38 +238,39 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SchBasePoint selectByRegionCode(String region_code,String vehicleCode) {
|
||||
public SchBasePoint selectByRegionCode(String region_code, String vehicleCode,String piont_type) {
|
||||
//查询载具的类型
|
||||
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(vehicleCode);
|
||||
if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
|
||||
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
|
||||
//查询满足条件的站点
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getIs_lock, false)
|
||||
.isNull(SchBasePoint::getVehicle_code)
|
||||
.eq(SchBasePoint::getPoint_type, piont_type)
|
||||
.eq(SchBasePoint::getRegion_code, region_code)
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||
.eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
|
||||
.eq(SchBasePoint::getIs_used, true));
|
||||
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){
|
||||
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) {
|
||||
SchBasePoint schBasePoint = schBasePoints.get(0);
|
||||
schBasePoint.setVehicle_code(vehicleCode);
|
||||
schBasePoint.setIs_lock(true);
|
||||
return schBasePoint;
|
||||
}
|
||||
SchBasePoint schBasePoint1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code)).get(0);
|
||||
if(ObjectUtil.isEmpty(schBasePoint1)) throw new BadRequestException("不存在该区域!");
|
||||
if (ObjectUtil.isEmpty(schBasePoint1)) throw new BadRequestException("不存在该区域!");
|
||||
//分配载具类型相同的站点
|
||||
List<SchBasePoint> schBasePoints1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getIs_lock, false)
|
||||
.isNull(SchBasePoint::getVehicle_code)
|
||||
.eq(SchBasePoint::getPoint_type, piont_type)
|
||||
.eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
|
||||
.eq(SchBasePoint::getIs_used, true)
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()));
|
||||
schBasePoints1.stream().sorted(Comparator.comparingInt(schBasePoint -> Math.abs(schBasePoint1.getRegion_seq() - schBasePoint.getRegion_seq())));
|
||||
if(CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0){
|
||||
if (CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0) {
|
||||
SchBasePoint schBasePoint = schBasePoints1.get(0);
|
||||
schBasePoint.setVehicle_code(vehicleCode);
|
||||
schBasePoint.setIs_lock(true);
|
||||
@@ -274,10 +286,10 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchBasePoint selectByReassign(String region_code,String vehicleCode) {
|
||||
public SchBasePoint selectByReassign(String region_code, String vehicleCode) {
|
||||
//查询载具的类型
|
||||
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getById(vehicleCode);
|
||||
if(ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
|
||||
if (ObjectUtil.isEmpty(mdBaseVehicle)) throw new BadRequestException("载具类型不存在!");
|
||||
//查询满足条件的站点
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getIs_lock, false)
|
||||
@@ -286,10 +298,10 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||
.eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
|
||||
.eq(SchBasePoint::getIs_used, true));
|
||||
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){
|
||||
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) {
|
||||
SchBasePoint schBasePoint1 = schBasePoints.get(0);
|
||||
SchBasePoint schBasePoint = pointMapper.selectById(schBasePoint1.getNext_wait_point());
|
||||
if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!");
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!");
|
||||
schBasePoint1.setVehicle_code(vehicleCode);
|
||||
schBasePoint1.setIs_lock(true);
|
||||
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
|
||||
@@ -304,10 +316,10 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
.eq(SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
|
||||
.eq(SchBasePoint::getIs_used, true)
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()));
|
||||
if(CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0){
|
||||
if (CollUtil.isNotEmpty(schBasePoints1) && schBasePoints1.size() > 0) {
|
||||
SchBasePoint schBasePoint1 = schBasePoints1.get(0);
|
||||
SchBasePoint schBasePoint = pointMapper.selectById(schBasePoint1.getNext_wait_point());
|
||||
if(ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!");
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("没有找到等待点!");
|
||||
schBasePoint1.setVehicle_code(vehicleCode);
|
||||
schBasePoint1.setIs_lock(true);
|
||||
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
|
||||
@@ -319,11 +331,11 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchBasePoint selectByNextWaitPoint(String device_code,String vehicleCode) {
|
||||
public SchBasePoint selectByNextWaitPoint(String device_code, String vehicleCode) {
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getNext_wait_point, device_code).eq(SchBasePoint::getIs_used, true)
|
||||
.eq(SchBasePoint::getIs_lock, false).isNull(SchBasePoint::getVehicle_code)
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()));
|
||||
if(CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0){
|
||||
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) {
|
||||
SchBasePoint schBasePoint = schBasePoints.get(0);
|
||||
schBasePoint.setVehicle_code(vehicleCode);
|
||||
schBasePoint.setIs_lock(true);
|
||||
@@ -338,15 +350,97 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
@Override
|
||||
public SchBasePoint selectByVehicleQty(String config_code, String vehicle_type) {
|
||||
Assert.noNullElements(new Object[]{config_code, vehicle_type}, "载具类型不能为空!");
|
||||
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false)
|
||||
.isNotNull(SchBasePoint::getVehicle_code)
|
||||
.eq(SchBasePoint::getRegion_code, config_code)
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue())
|
||||
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type));
|
||||
.isNotNull(SchBasePoint::getVehicle_code)
|
||||
.eq(SchBasePoint::getRegion_code, config_code)
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue())
|
||||
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type));
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchBasePoint selectByEmptyVehicleType(String vehicle_type) {
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getIs_lock, false)
|
||||
.eq(SchBasePoint::getIs_used, true)
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type)
|
||||
.isNull(SchBasePoint::getVehicle_code));
|
||||
return (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) ? schBasePoints.get(0) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchBasePoint selectByGroundPoint(String region_code, String pointStatus, String vehicle_type, int seq) {
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getIs_lock, false)
|
||||
.eq(SchBasePoint::getIs_used, true)
|
||||
.eq(SchBasePoint::getPoint_status, pointStatus)
|
||||
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type)
|
||||
.isNull(seq == 2,SchBasePoint::getVehicles)
|
||||
.isNull(seq == 1,SchBasePoint::getVehicle_code)
|
||||
.eq(StrUtil.isNotBlank(region_code), SchBasePoint::getRegion_code, region_code)
|
||||
.orderByAsc(seq == 2, SchBasePoint::getIn_order_seq));
|
||||
return (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) ? schBasePoints.get(0) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
|
||||
public SchBasePoint selectByEmptyCage(String region_code, String vehicle_type, String pointStatus, boolean isVehicle, SchBaseTask task) {
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getIs_lock, false)
|
||||
.eq(SchBasePoint::getIs_used, true)
|
||||
.eq(SchBasePoint::getPoint_status, pointStatus)
|
||||
.eq(SchBasePoint::getCan_vehicle_type, vehicle_type)
|
||||
.eq(SchBasePoint::getRegion_code, region_code)
|
||||
.isNotNull(SchBasePoint::getVehicles)
|
||||
.orderByDesc(SchBasePoint::getIn_order_seq));
|
||||
if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) {
|
||||
SchBasePoint schBasePoint = schBasePoints.get(0);
|
||||
if (schBasePoints.size() == 1 && isVehicle) {
|
||||
if (schBasePoint.getVehicle_qty() == 1) {
|
||||
task.setRemark("没有多余空笼框,待补充!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice("没有多余空笼框,待补充!", task.getConfig_code() + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
Type setType = new TypeToken<List<String>>() {
|
||||
}.getType();
|
||||
List<String> msg = gson.fromJson(schBasePoint.getVehicles(), setType);
|
||||
Integer vehicle_qty = schBasePoint.getVehicle_qty();
|
||||
if (vehicle_qty != msg.size()) throw new BadRequestException("载具数量与载具编码数量不一致!");
|
||||
String s = msg.get(msg.size() - 1);
|
||||
schBasePoint.setVehicle_qty(vehicle_qty - 1);
|
||||
msg.remove(s);
|
||||
schBasePoint.setVehicles(JSONUtil.toJsonStr(msg));
|
||||
/*schBasePoint.setIs_lock(true);*/
|
||||
this.updateById(schBasePoint);
|
||||
if (schBasePoint.getVehicle_qty() == 0) {
|
||||
update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code())
|
||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||
.set(SchBasePoint::getVehicles, null));
|
||||
}
|
||||
SchBasePoint schBasePoint1 = selectByPointCode(schBasePoint.getPoint_code() + "_" + (vehicle_qty - 1));
|
||||
schBasePoint1.setVehicle_code(s);
|
||||
return schBasePoint1;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releasePoint(String region_code) {
|
||||
update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code).set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lockPoint(String region_code) {
|
||||
update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code).set(SchBasePoint::getIs_lock, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PointMaterialInfo> getStructList(String region_code, String vehicle_type) {
|
||||
List<PointMaterialInfo> structList = pointMapper.getStructList(region_code, vehicle_type);
|
||||
@@ -354,23 +448,23 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation= Propagation.REQUIRES_NEW)
|
||||
public SchBasePoint selectEmpVehicleByRegionCode(String region_code, String...vehicleType) {
|
||||
synchronized(region_code){
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public SchBasePoint selectEmpVehicleByRegionCode(String region_code, String... vehicleType) {
|
||||
synchronized (region_code) {
|
||||
//查询满足条件的站点
|
||||
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getIs_lock, false).
|
||||
isNotNull(SchBasePoint::getVehicle_code)
|
||||
.eq(SchBasePoint::getRegion_code, region_code)
|
||||
.eq(SchBasePoint::getPoint_status,GoodsEnum.EMPTY_PALLETS.getValue())
|
||||
.eq(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue())
|
||||
.in(SchBasePoint::getCan_vehicle_type, vehicleType)
|
||||
.eq(SchBasePoint::getIs_used, true));
|
||||
if(CollectionUtils.isEmpty(schBasePoints)) {
|
||||
if (CollectionUtils.isEmpty(schBasePoints)) {
|
||||
return null;
|
||||
}
|
||||
SchBasePoint schBasePoint = schBasePoints.get(0);
|
||||
this.update(new UpdateWrapper<SchBasePoint>()
|
||||
.set("is_lock",true)
|
||||
.eq("point_code",schBasePoint.getPoint_code()));
|
||||
.set("is_lock", true)
|
||||
.eq("point_code", schBasePoint.getPoint_code()));
|
||||
return schBasePoint;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,9 @@ public class SchBaseTask implements Serializable {
|
||||
@ApiModelProperty(value = "任务类型")
|
||||
private String task_type;
|
||||
|
||||
@ApiModelProperty(value = "区域编码")
|
||||
private String region_code;
|
||||
|
||||
@ApiModelProperty(value = "配置编码")
|
||||
private String config_code;
|
||||
|
||||
|
||||
@@ -277,6 +277,7 @@ public abstract class AbstractTask {
|
||||
task.setVehicle_qty(param.getInteger("vehicle_qty"));
|
||||
task.setVehicle_type(param.getString("vehicle_type"));
|
||||
task.setJob_name(param.getString("job_name"));
|
||||
task.setRegion_code(param.getString("region_code"));
|
||||
task.setTask_status(TaskStatus.APPLY.getCode());
|
||||
task.setTask_type(StrUtil.isNotEmpty(param.getString("task_type")) ? param.getString("task_type") : taskConfig.getTask_type());
|
||||
task.setWorkshop_code(taskConfig.getWorkshop_code());
|
||||
|
||||
@@ -59,7 +59,7 @@ public class CNTTask extends AbstractTask {
|
||||
// 找起点
|
||||
SchBasePoint schBasePoint = null;
|
||||
if (TaskType.CARRY_TASK.getValue().equals(task.getTask_type())) {
|
||||
schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(), task.getVehicle_code());
|
||||
schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(), task.getVehicle_code(),"1");
|
||||
} else if (TaskType.REASSIGN_TASK.getValue().equals(task.getTask_type())) {
|
||||
schBasePoint = schBasePointService.selectByReassign(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(), task.getVehicle_code());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
package org.nl.wms.sch.task_manage.task.tasks.handheld;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
||||
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
* 工序下料
|
||||
*/
|
||||
@Component("BLANKINGTask")
|
||||
public class BlankingTask extends AbstractTask {
|
||||
private static final String TASK_CONFIG_CODE = "BLANKINGTask";
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private ISchBasePointService schBasePointService;
|
||||
@Autowired
|
||||
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService;
|
||||
@Autowired
|
||||
private IMdBaseVehicleService iMdBaseVehicleService;
|
||||
|
||||
@Override
|
||||
protected void create() throws BadRequestException {
|
||||
// 获取任务
|
||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||
// 配置信息
|
||||
for (SchBaseTask task : tasks) {
|
||||
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(task.getVehicle_code());
|
||||
if(ObjectUtil.isEmpty(mdBaseVehicle)){
|
||||
task.setRemark("载具号不存在!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice("载具号不存在!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(task.getRegion_code(),
|
||||
GoodsEnum.OUT_OF_STOCK.getValue(),mdBaseVehicle.getVehicle_type(),1);
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
task.setRemark("未找到所需点位!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(schBasePoint.getPoint_code());
|
||||
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
||||
task.setRemark("");
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
taskService.updateById(task);
|
||||
|
||||
|
||||
schBasePoint.setVehicle_code(task.getVehicle_code());
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
|
||||
schBasePoint.setIs_lock(true);
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateStatus(String task_code, TaskStatus status) {
|
||||
//TODO:完成任务的时候将int_task_code的清除
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_code) {
|
||||
//TODO:取消任务的时候将int_task_code的清除
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
|
||||
|
||||
}
|
||||
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1();
|
||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1();
|
||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package org.nl.wms.sch.task_manage.task.tasks.handheld;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
||||
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
* 手持呼叫空料笼
|
||||
*/
|
||||
@Component("CALLEMPTYTask")
|
||||
public class CallEmptyTask extends AbstractTask {
|
||||
|
||||
private static final String TASK_CONFIG_CODE = "CALLEMPTYTask";
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private ISchBasePointService schBasePointService;
|
||||
@Autowired
|
||||
private IMdBaseVehicleService iMdBaseVehicleService;
|
||||
|
||||
@Override
|
||||
protected void create() throws BadRequestException {
|
||||
// 获取任务
|
||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||
// 配置信息
|
||||
for (SchBaseTask task : tasks) {
|
||||
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(task.getVehicle_code());
|
||||
if (ObjectUtil.isEmpty(mdBaseVehicle)) {
|
||||
task.setRemark("载具号不存在!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice("载具号不存在!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(task.getRegion_code(), GoodsEnum.OUT_OF_STOCK.getValue(), mdBaseVehicle.getVehicle_type(), 1);
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
task.setRemark("未找到所需点位!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code1(schBasePoint.getPoint_code());
|
||||
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
||||
task.setRemark("");
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
taskService.updateById(task);
|
||||
|
||||
|
||||
schBasePoint.setVehicle_code(task.getVehicle_code());
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
schBasePoint.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue());
|
||||
schBasePoint.setIs_lock(true);
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateStatus(String task_code, TaskStatus status) {
|
||||
//TODO:完成任务的时候将int_task_code的清除
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_code) {
|
||||
//TODO:取消任务的时候将int_task_code的清除
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
|
||||
|
||||
}
|
||||
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1();
|
||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1();
|
||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
package org.nl.wms.sch.task_manage.task.tasks.handheld;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.enums.VehicleTypeEnum;
|
||||
import org.nl.common.enums.region.RegionEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
* 手持创建空料笼入库
|
||||
*/
|
||||
@Component("EMPTYCAGETask")
|
||||
public class EmptyCageTask extends AbstractTask {
|
||||
|
||||
private static final String TASK_CONFIG_CODE = "EMPTYCAGETask";
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private ISchBasePointService schBasePointService;
|
||||
@Autowired
|
||||
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService;
|
||||
|
||||
@Override
|
||||
protected void create() throws BadRequestException {
|
||||
// 获取任务
|
||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||
// 配置信息
|
||||
for (SchBaseTask task : tasks) {
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
// 查询是空料笼还是,空料架
|
||||
Integer vehicle_qty = task.getVehicle_qty();
|
||||
SchBasePoint schBasePoint = null;
|
||||
switch (vehicle_qty) {
|
||||
case 1:
|
||||
//空料架
|
||||
/*schBasePoint = schBasePointService.selectByGroundPoint(GoodsEnum.OUT_OF_STOCK.getValue(),task.getVehicle_type(),1);*/
|
||||
break;
|
||||
case 2:
|
||||
//RO1空料容
|
||||
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(),
|
||||
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.FRAME_R01.getVehicleCode(),2);
|
||||
break;
|
||||
case 4:
|
||||
//RO2空料容
|
||||
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(),
|
||||
GoodsEnum.OUT_OF_STOCK.getValue(),VehicleTypeEnum.FRAME_R02.getVehicleCode(),2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
task.setRemark("未找到所需点位!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(schBasePoint.getPoint_code());
|
||||
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
||||
task.setRemark("");
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
taskService.updateById(task);
|
||||
|
||||
|
||||
schBasePoint.setVehicle_qty(task.getVehicle_qty());
|
||||
schBasePoint.setVehicles(task.getVehicle_code());
|
||||
schBasePoint.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue());
|
||||
schBasePoint.setIs_lock(true);
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateStatus(String task_code, TaskStatus status) {
|
||||
//TODO:完成任务的时候将int_task_code的清除
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_code) {
|
||||
//TODO:取消任务的时候将int_task_code的清除
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
|
||||
|
||||
}
|
||||
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1();
|
||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1();
|
||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package org.nl.wms.sch.task_manage.task.tasks.handheld;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.enums.region.RegionEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskType;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
*/
|
||||
@Component("HHTask")
|
||||
public class HHTask extends AbstractTask {
|
||||
|
||||
|
||||
private static final String TASK_CONFIG_CODE = "HHTask";
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private ISchBasePointService schBasePointService;
|
||||
@Autowired
|
||||
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService;
|
||||
|
||||
@Override
|
||||
protected void create() throws BadRequestException {
|
||||
// 获取任务
|
||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||
// 配置信息
|
||||
for (SchBaseTask task : tasks) {
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
// 查询终点
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByVehicleQty(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(),task.getVehicle_type());
|
||||
if (TaskType.CARRY_TASK.getValue().equals(task.getTask_type())) {
|
||||
schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(), task.getVehicle_code());
|
||||
} else if (TaskType.REASSIGN_TASK.getValue().equals(task.getTask_type())) {
|
||||
schBasePoint = schBasePointService.selectByReassign(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(), task.getVehicle_code());
|
||||
}
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
task.setRemark("未找到所需点位!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(schBasePoint.getPoint_code());
|
||||
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
||||
task.setRemark("");
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
taskService.updateById(task);
|
||||
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateStatus(String task_code, TaskStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_code) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_code) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package org.nl.wms.sch.task_manage.task.tasks.handheld;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
||||
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
* 物料回库
|
||||
*/
|
||||
@Component("TOSTOREHOUSETask")
|
||||
public class ToStoreHouseTask extends AbstractTask {
|
||||
private static final String TASK_CONFIG_CODE = "TOSTOREHOUSETask";
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private ISchBasePointService schBasePointService;
|
||||
@Autowired
|
||||
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService;
|
||||
@Autowired
|
||||
private IMdBaseVehicleService iMdBaseVehicleService;
|
||||
|
||||
@Override
|
||||
protected void create() throws BadRequestException {
|
||||
// 获取任务
|
||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||
// 配置信息
|
||||
for (SchBaseTask task : tasks) {
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(task.getVehicle_code());
|
||||
if(ObjectUtil.isEmpty(mdBaseVehicle)){
|
||||
task.setRemark("该载具不存在!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice("该载具不存在!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(task.getRegion_code(), GoodsEnum.OUT_OF_STOCK.getValue()
|
||||
,mdBaseVehicle.getVehicle_type(),1);
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
task.setRemark("未找到所需点位!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(schBasePoint.getPoint_code());
|
||||
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
||||
task.setRemark("");
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
taskService.updateById(task);
|
||||
|
||||
|
||||
schBasePoint.setVehicle_code(task.getVehicle_code());
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
|
||||
schBasePoint.setIs_lock(true);
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateStatus(String task_code, TaskStatus status) {
|
||||
//TODO:完成任务的时候将int_task_code的清除
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_code) {
|
||||
//TODO:取消任务的时候将int_task_code的清除
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
|
||||
|
||||
}
|
||||
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1();
|
||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1();
|
||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class SortingSMTTask extends AbstractTask {
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
// 根据对接位查找对应的载具类型
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.ZDFJ.getRegion_code(),task.getVehicle_code());
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.ZDFJ.getRegion_code(),task.getVehicle_code(),"1");
|
||||
if(ObjectUtil.isEmpty(schBasePoint)) continue;
|
||||
jsonObject.put("vehicle_type", schBasePoint.getCan_vehicle_type());
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
|
||||
@@ -69,7 +69,7 @@ public class SortingSNTTask extends AbstractTask {
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
// 根据对接位查找对应的载具类型
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.ZDFJ.getRegion_code(),task.getVehicle_code());
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.ZDFJ.getRegion_code(),task.getVehicle_code(),"0");
|
||||
if(ObjectUtil.isEmpty(schBasePoint)) continue;
|
||||
jsonObject.put("vehicle_type", schBasePoint.getCan_vehicle_type());
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
package org.nl.wms.sch.task_manage.task.tasks.sorting;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.nl.common.enums.GoodsEnum;
|
||||
import org.nl.common.enums.VehicleEnum;
|
||||
import org.nl.common.enums.VehicleTypeEnum;
|
||||
import org.nl.common.enums.region.RegionEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author LENOVO
|
||||
* sorting呼叫两个笼框
|
||||
*/
|
||||
@Component("SortingTwoCNTTask")
|
||||
public class SortingTwoCNTTask extends AbstractTask {
|
||||
|
||||
|
||||
private static final String TASK_CONFIG_CODE = "SortingTwoCNTTask";
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private ISchBasePointService schBasePointService;
|
||||
@Autowired
|
||||
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService;
|
||||
|
||||
@Override
|
||||
protected void create() throws BadRequestException {
|
||||
// 获取任务
|
||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||
for (SchBaseTask task : tasks) {
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
// 找起点
|
||||
SchBasePoint basePoint = schBasePointService.selectByEmptyCage(RegionEnum.DDLK.getRegion_code(),
|
||||
VehicleTypeEnum.FRAME_R02.getVehicleCode(),GoodsEnum.EMPTY_PALLETS.getValue(),true,task);
|
||||
if (basePoint==null){
|
||||
task.setRemark("未找到所需点位!");
|
||||
taskService.updateById(task);
|
||||
continue;
|
||||
}
|
||||
taskService.update(new UpdateWrapper<SchBaseTask>()
|
||||
.set("task_status",TaskStatus.CREATED.getCode())
|
||||
.set("point_code1",basePoint.getPoint_code())
|
||||
.set("vehicle_code",basePoint.getVehicle_code())
|
||||
.eq("task_id",task.getTask_id()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateStatus(String task_code, TaskStatus status) {
|
||||
//TODO:完成任务的时候将int_task_code的清除
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_code) {
|
||||
//TODO:取消任务的时候将int_task_code的清除
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) {
|
||||
|
||||
}
|
||||
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
/*// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1();
|
||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint)
|
||||
.set(SchBasePoint::getIs_lock, false).set(SchBasePoint::getVehicle_code,null));
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2)
|
||||
.set(SchBasePoint::getIs_lock, false));
|
||||
}*/
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1();
|
||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
}
|
||||
String point_code2 = taskObj.getPoint_code2();
|
||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
||||
pointService.updateById(schBasePoint2);
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user