fix:修改工单出库任务完成后未清空起点载具数量
opt:优化各任务申请点位的查询
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.sch.task_manage.task.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.druid.util.StringUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -94,7 +95,7 @@ public class KJRKTask extends AbstractTask {
|
||||
*/
|
||||
private SchBasePoint findNextPoint() {
|
||||
String regionCode = "KJHC";
|
||||
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode, "0");
|
||||
List<SchBasePoint> schBasePointList = pointMapper.findPointByCondition(regionCode, "0",0);
|
||||
for (SchBasePoint schBasePoint : schBasePointList) {
|
||||
//查找点上无载具号无任务号、载具数量为0的
|
||||
if (schBasePoint.getIs_used()
|
||||
@@ -140,6 +141,7 @@ public class KJRKTask extends AbstractTask {
|
||||
// 终点解锁
|
||||
endPointObj.setIng_task_code("");
|
||||
endPointObj.setVehicle_qty(1);
|
||||
endPointObj.setUpdate_time(DateUtil.now());
|
||||
pointService.update(endPointObj);
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.sch.task_manage.task.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -55,10 +56,6 @@ public class POINTTask extends AbstractTask {
|
||||
private IWorkorderService workorderService;
|
||||
@Autowired
|
||||
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
|
||||
@Autowired
|
||||
private PointMapper pointMapper;
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
|
||||
@Override
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
@@ -68,36 +65,44 @@ public class POINTTask extends AbstractTask {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
for (SchBaseTask task : tasks) {
|
||||
Assert.notNull(taskConfig, "找不到任务配置文件,请确认YCLCKTask配置是否存在!");
|
||||
// 获取任务配置最大生成任务数
|
||||
Integer tcmn = taskConfig.getTask_create_max_num();
|
||||
// 获取执行中的任务
|
||||
List<SchBaseTask> unFinishTasksByTaskConfig = taskService.findUnFinishTasksByTaskConfig(TASK_CONFIG_CODE);
|
||||
//执行中任务数量小于最大可生成任务数
|
||||
if(unFinishTasksByTaskConfig.size() < tcmn){
|
||||
for (SchBaseTask task : tasks) {
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setRemark("");
|
||||
SchBasePoint schBasePoint= pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, task.getPoint_code1()));
|
||||
SchBasePoint nextSchBasePoint= pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, task.getPoint_code2()));
|
||||
if(task.getPoint_code2().startsWith("DKT")){
|
||||
//如果是叠盘位,根据当前数量+1为目标地址
|
||||
int qty=nextSchBasePoint.getVehicle_qty()+1;
|
||||
task.setPoint_code2(task.getPoint_code2().substring(0,task.getPoint_code2().length()-1)+qty);
|
||||
}
|
||||
task.setVehicle_code(schBasePoint.getVehicle_code());
|
||||
task.setVehicle_code2(schBasePoint.getVehicle_code2());
|
||||
taskService.update(task);
|
||||
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setRemark("");
|
||||
SchBasePoint schBasePoint= pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, task.getPoint_code1()));
|
||||
SchBasePoint nextSchBasePoint= pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, task.getPoint_code2()));
|
||||
if(task.getPoint_code2().startsWith("DKT")){
|
||||
//如果是叠盘位,根据当前数量+1为目标地址
|
||||
int qty=nextSchBasePoint.getVehicle_qty()+1;
|
||||
task.setPoint_code2(task.getPoint_code2().substring(0,task.getPoint_code2().length()-1)+qty);
|
||||
//发起任务时先把点位占用,防止发起重复任务
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
pointService.update(schBasePoint);
|
||||
nextSchBasePoint.setIng_task_code(task.getTask_code());
|
||||
pointService.update(nextSchBasePoint);
|
||||
//去回温库的任务,更细工单表
|
||||
if(nextSchBasePoint.getPoint_code().contains("XHW")){
|
||||
//pdm_bd_workorder_two任务完成时,status改为2出库中
|
||||
workorderService.update(schBasePoint.getVehicle_code2(),"2");
|
||||
}
|
||||
//下发
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
task.setVehicle_code(schBasePoint.getVehicle_code());
|
||||
task.setVehicle_code2(schBasePoint.getVehicle_code2());
|
||||
taskService.update(task);
|
||||
|
||||
//发起任务时先把点位占用,防止发起重复任务
|
||||
schBasePoint.setIng_task_code(task.getTask_code());
|
||||
pointService.update(schBasePoint);
|
||||
nextSchBasePoint.setIng_task_code(task.getTask_code());
|
||||
pointService.update(nextSchBasePoint);
|
||||
//去回温库的任务,更细工单表
|
||||
if(nextSchBasePoint.getPoint_code().contains("XHW")){
|
||||
//pdm_bd_workorder_two任务完成时,status改为2出库中
|
||||
workorderService.update(schBasePoint.getVehicle_code2(),"2");
|
||||
}
|
||||
//下发
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,6 +216,11 @@ public class POINTTask extends AbstractTask {
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
endPointObj.setIng_task_code("");
|
||||
pointService.update(endPointObj);
|
||||
//去回温库的任务,更细工单表
|
||||
if(endPointObj.getPoint_code().contains("XHW")){
|
||||
//pdm_bd_workorder_two任务完成时,status改为1出库中
|
||||
workorderService.update(endPointObj.getVehicle_code2(),"1");
|
||||
}
|
||||
}
|
||||
// 起点解锁
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.sch.task_manage.task.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.druid.util.StringUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -92,7 +93,7 @@ public class SSXBKJTask extends AbstractTask {
|
||||
*/
|
||||
private SchBasePoint findNextPoint() {
|
||||
String regionCode = "KJHC";
|
||||
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode, "0");
|
||||
List<SchBasePoint> schBasePointList = pointMapper.findPointByCondition(regionCode, "0",1);
|
||||
for (SchBasePoint schBasePoint : schBasePointList) {
|
||||
//查找点上无载具号无任务号、载具数量为1的
|
||||
if (schBasePoint.getIs_used()
|
||||
@@ -137,6 +138,7 @@ public class SSXBKJTask extends AbstractTask {
|
||||
}
|
||||
// 终点解锁
|
||||
endPointObj.setIng_task_code("");
|
||||
endPointObj.setUpdate_time(DateUtil.now());
|
||||
pointService.update(endPointObj);
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
|
||||
@@ -124,7 +124,7 @@ public class YCLCKTask extends AbstractTask {
|
||||
* @return
|
||||
*/
|
||||
private SchBasePoint findNextPoint(SchBaseTask task, String regionCode) {
|
||||
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode, "0");
|
||||
List<SchBasePoint> schBasePointList = pointMapper.findPointByCondition(regionCode, "0",0);
|
||||
for (SchBasePoint schBasePoint : schBasePointList) {
|
||||
//已锁定直接返回
|
||||
if (task.getTask_code().equals(schBasePoint.getIng_task_code())) {
|
||||
@@ -232,6 +232,7 @@ public class YCLCKTask extends AbstractTask {
|
||||
startPointObj.setVehicle_code("");
|
||||
startPointObj.setVehicle_code2("");
|
||||
startPointObj.setIng_task_code("");
|
||||
startPointObj.setVehicle_qty(0);
|
||||
startPointObj.setUpdate_time(DateUtil.now());
|
||||
pointService.updateById(startPointObj);
|
||||
// 任务完成
|
||||
|
||||
@@ -147,7 +147,7 @@ public class YCLRKTask extends AbstractTask {
|
||||
* @return
|
||||
*/
|
||||
private SchBasePoint getSchBasePoint(String regionCode) {
|
||||
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode, "0");
|
||||
List<SchBasePoint> schBasePointList = pointMapper.findPointByCondition(regionCode, "0",0);
|
||||
for (SchBasePoint schBasePoint : schBasePointList) {
|
||||
if (schBasePoint.getIs_used()
|
||||
&& schBasePoint.getVehicle_qty() ==0
|
||||
|
||||
@@ -14,6 +14,8 @@ import java.util.List;
|
||||
public interface PointMapper extends BaseMapper<SchBasePoint> {
|
||||
List<SchBasePoint> findPointByRegion(String regionCode,String point_status);
|
||||
|
||||
List<SchBasePoint> findPointByCondition(String regionCode,String point_status,Integer vehicle_qty);
|
||||
|
||||
List<SchBasePoint> findPointByParentPoint(String pointCode);
|
||||
|
||||
void updatePointStatus(String device_code,String state);
|
||||
|
||||
@@ -11,6 +11,20 @@
|
||||
ORDER BY region_code
|
||||
</select>
|
||||
|
||||
<select id="findPointByCondition" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
|
||||
SELECT
|
||||
p.*
|
||||
FROM
|
||||
`sch_base_point` p
|
||||
WHERE p.region_code = #{regionCode}
|
||||
and p.point_status = #{point_status}
|
||||
and p.vehicle_qty = #{vehicle_qty}
|
||||
and p.is_used = 1
|
||||
AND (p.ing_task_code IS NULL or p.ing_task_code = '')
|
||||
AND (p.vehicle_code2 IS NULL or p.vehicle_code2 = '')
|
||||
ORDER BY region_code
|
||||
</select>
|
||||
|
||||
<select id="findPointByParentPoint" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
|
||||
SELECT
|
||||
p.*
|
||||
|
||||
Reference in New Issue
Block a user