rev:调度:缓存线任务

This commit is contained in:
zhangzhiqiang
2023-05-30 19:55:50 +08:00
parent ec2157cf91
commit abb6df872d
8 changed files with 42 additions and 23 deletions

View File

@@ -56,8 +56,8 @@ public enum AcsTaskEnum {
ACS_TASK_TYPE_NOBLE_DOUBLE_TASK("1","诺宝双工任务"),
ACS_TASK_TYPE_NOBLE_SINGLE_TASK("2","诺宝单工任务"),
ACS_TASK_TYPE_NOBLE_DOUBLE_ENTRY_TASK("3","诺宝双入-双任务"),
ACS_TASK_TYPE_NOBLE_SINGLE_ENTRY_TASK("4","诺宝单入-单任务"),
ACS_TASK_TYPE_NOBLE_DOUBLE_ENTRY_TASK("4","诺宝双入-双任务"),
ACS_TASK_TYPE_NOBLE_SINGLE_ENTRY_TASK("3","诺宝单入-单任务"),
ACS_TASK_TYPE_NOBLE_POINT_POINT_TASK("5","诺宝点对点任务"),
ACS_TASK_TYPE_WEIGHING_TASK_OF_PS20("6","PS20称重任务刻字-包装)"),
ACS_TASK_TYPE_NON_WEIGHING_TASK_OF_PS20("7","PS20不称重任务刻字-包装)"),

View File

@@ -163,14 +163,17 @@ public class AgvInstService {
//3.agv根据对应载具列表行进扫码匹配匹配到对应物料则创建点对点任务
public void empMatter(JSONObject task){
//参数
String startPoint = task.getString("cacheLine");
String startPoint = task.getString("point_code1");
String cacheVehile = getCacheVehile(startPoint, task.getString("material_id"));
if (StringUtils.isBlank(cacheVehile)) {
throw new BadRequestException("缓存线:"+startPoint+"没有物料"+task.getString("material_id")+"对应可用载具");
}
//判断当前物料载具已经任务分配数量:如果>物料已经分配任务。说明满了,不允许再分配
List<SchBaseTask> allocateTask = taskService.list(new QueryWrapper<SchBaseTask>().eq("point_code1", startPoint).eq("material_id", task.getString("material_id")).lt("task_status", StatusEnum.TASK_FINISH.getCode()));
if (allocateTask.size()>=cacheVehile.split(",").length){
List<SchBaseTask> allocateTask = taskService.list(new QueryWrapper<SchBaseTask>()
.eq("point_code1", startPoint)
.eq("material_id", task.getString("material_id"))
.in("task_status", "4","5","6"));
if (allocateTask.size()>cacheVehile.split(",").length){
log.error("callMatter 缓存线:{}上含有物料:{}的载具分配完任务id:{}",startPoint,task.getString("material_id"),allocateTask.stream().map(SchBaseTask::getTask_id).collect(Collectors.joining(",")));
throw new BadRequestException(String.format("缓存线%s上含物料%s的载具已分配完",startPoint,task.getString("material_id")));
}
@@ -191,7 +194,7 @@ public class AgvInstService {
if (StringUtils.isNotEmpty(cacheLine)){
int count = taskService.count(new QueryWrapper<SchBaseTask>().eq("point_code2", cacheLine).lt("task_status", StatusEnum.TASK_FINISH.getCode()));
String status = StringUtils.isBlank(materialId) ? StatusEnum.CACHE_VEL_EMT.getCode() : StatusEnum.CACHE_VEL_FULL.getCode();
List<SchCachelineVehicle> vehicle = cachelineVehicleService.getCachelineVehicle(MapOf.of("vehicle_status", status, "material_id", materialId));
List<SchCachelineVehicle> vehicle = cachelineVehicleService.getCachelineVehicle(MapOf.of("vehicle_status", status, "material_id", materialId, "cacheLine",cacheLine));
if (vehicle.size()>0){
if (vehicle.size()>count){
return vehicle.stream().map(SchCachelineVehicle::getVehicle_code).collect(Collectors.joining(","));

View File

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.jsonwebtoken.lang.Assert;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
@@ -670,15 +671,18 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
String device_code = param.getString("wcsdevice_code");
//载具编码
String vehicle_code = param.getString("vehicle_code");
if (StringUtils.isEmpty(vehicle_code)){
throw new BadRequestException("载具号不能为空");
}
//缓存线位置编码
// 封装给acs的数据
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
// 1 扫码异常-入箱扫码 2 出箱扫码
jsonObject.put("type", type);
// jsonObject.put("position_code", position_code);
jsonObject.put("device_code", device_code);
jsonObject.put("vehicle_code", vehicle_code);
vehilematerialService.remove(new QueryWrapper<SchCachelineVehilematerial>().eq("vehicle_code",vehicle_code));
try {
return RestBusinessTemplate.execute(() -> AcsUtil.notifyAcs("api/wms/issuedBarcode", jsonObject));
} catch (NullPointerException e) {

View File

@@ -97,8 +97,8 @@ public class SpeEmpTask extends AbstractAcsTask {
throw new BadRequestException(String.format("设备%s存在未完成任务", param.getString("device_code")));
}
JSONObject form = new JSONObject(MapOf.of("start_point_code","",
"next_point_code",param.getString("device_code"),"return_point_code", "","vehicle_code",
JSONObject form = new JSONObject(MapOf.of("start_point_code",cahceLine,
"next_point_code",param.getString("device_code"),"return_point_code", cahceLine,"vehicle_code",
"","product_area",one.getProduct_area(),"quantity", param.getString("quantity"),"type",AcsTaskEnum.TASK_CACHELINE_OUT.getCode(),"material_id", one.getMaterial_id()));
String taskId = IdUtil.getSnowflake(1, 1).nextId() + "";
JSONObject task = packageParam(form, taskId);
@@ -143,7 +143,7 @@ public class SpeEmpTask extends AbstractAcsTask {
task.put("task_name", AcsTaskEnum.TASK_CACHELINE_OUT.getDesc());
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
task.put("task_type", form.getString("type"));
task.put("acs_task_type", AcsTaskEnum.ACS_TASK_TYPE_NOBLE_DOUBLE_TASK.getCode());
task.put("acs_task_type", AcsTaskEnum.ACS_TASK_TYPE_NOBLE_SINGLE_TASK.getCode());
task.put("task_status", TaskStatusEnum.CREATED.getCode());
task.put("point_code1", form.getString("start_point_code"));
task.put("point_code2", form.getString("next_point_code"));
@@ -216,7 +216,8 @@ public class SpeEmpTask extends AbstractAcsTask {
ArrayList<SchBaseTask> Merge = new ArrayList<>();
if (!CollectionUtils.isEmpty(array)){
String pointCollect = array.stream().map(a->a.getPoint_code1() + "','" + a.getPoint_code2()).collect(Collectors.joining("','"));
List<Map<String,String>> needMergeCollect = basePointService.getAllPointRegin(pointCollect);
List<Map<String,String>> needMergeCollect = new ArrayList<>();
//basePointService.getAllPointRegin("'"+pointCollect+"'");
//区域编号对应point_code pointRegionCollent
Map<String, List<Map<String,String>>> pointRegionCollent = needMergeCollect.stream().collect(Collectors.groupingBy(o -> o.get("point_code")));
Set<String> mergePointCollent = needMergeCollect.stream().map(item -> item.get("point_code")).collect(Collectors.toSet());
@@ -291,6 +292,17 @@ public class SpeEmpTask extends AbstractAcsTask {
if (tag){task.setIs_send(true);tag = false;}else {task.setIs_send(false); }
}
}
if (value.size() == 1){
for (SchBaseTask task : value) {
if (task.getAcs_task_type().equals(AcsTaskEnum.ACS_TASK_TYPE_NOBLE_DOUBLE_ENTRY_TASK.getCode())){
task.setAcs_task_type(AcsTaskEnum.ACS_TASK_TYPE_NOBLE_SINGLE_ENTRY_TASK.getCode());
}
if (task.getAcs_task_type().equals(AcsTaskEnum.ACS_TASK_TYPE_NOBLE_DOUBLE_TASK.getCode())){
task.setAcs_task_type(AcsTaskEnum.ACS_TASK_TYPE_NOBLE_SINGLE_TASK.getCode());
}
task.setIs_send(true);
}
}
}

View File

@@ -31,7 +31,7 @@
sch_base_point.point_type = '4' and pdm_bi_device.is_used = true
and workprocedure_id = #{workprocedure_id}
<if test="material_id != null and material_id != ''">
and (pdm_bi_device.material_id = #{material_id} or pdm_bi_device.material_id is null )
and (pdm_bi_device.material_id = #{material_id} or pdm_bi_device.material_id is null or pdm_bi_device.material_id = '')
</if>
<if test="spec != null and spec != ''">
and (pdm_bi_device.spec = #{spec} or pdm_bi_device.spec is null)

View File

@@ -10,7 +10,8 @@
sch_cacheline_vehilematerial v
LEFT JOIN sch_cacheline_position p ON p.vehicle_code = v.vehicle_code
WHERE p.vehicle_code <![CDATA[<>]]> '' and
v.vehicle_status = #{vehicle_status}
v.vehicle_status = #{vehicle_status} and
p.cacheLine_code = #{cacheLine}
<if test="material_id != null and material_id != ''">
and v.material_id = #{material_id}
</if>

View File

@@ -114,10 +114,10 @@
FROM
sch_base_region
LEFT JOIN sch_base_point ON sch_base_region.region_code = sch_base_point.region_code
LEFT JOIN sch_base_point b ON sch_base_region.region_code = b.region_code AND b.point_code IN ( #{points} )
LEFT JOIN sch_base_point b ON sch_base_region.region_code = b.region_code AND b.point_code IN ( ${points} )
WHERE
sch_base_region.is_merge = '1'
AND sch_base_point.point_code IN ( #{points} )
AND sch_base_point.point_code IN ( ${points} )
GROUP BY sch_base_point.point_code
</select>
</mapper>

View File

@@ -149,9 +149,9 @@
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="50" />
<el-table-column prop="task_code" label="任务编码" min-width="100" show-overflow-tooltip />
<el-table-column v-if="true" prop="task_id" label="任务标识" min-width="150" show-overflow-tooltip />
<el-table-column v-if="true" prop="material_id" label="物料标识" min-width="150" show-overflow-tooltip />
<el-table-column prop="task_code" label="任务编码" min-width="100" show-overflow-tooltip />
<el-table-column prop="acs_task_type" label="acs任务类型" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
{{ acsTaskTypeList[scope.row.acs_task_type - 1] }}
@@ -161,21 +161,20 @@
<el-table-column v-if="false" prop="task_status" label="任务状态" />
<el-table-column prop="product_area" label="生产车间" />
<el-table-column prop="task_status_name" label="任务状态" width="120px" :formatter="formatTaskStatusName" />
<el-table-column prop="vehicle_type" label="载具类型" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">
{{ dict.label.vehicle_type[scope.row.vehicle_type] }}
</template>
</el-table-column>
<el-table-column prop="point_code1" label="起点" width="100" />
<el-table-column prop="point1_region_name" label="起点区域" width="120" />
<el-table-column prop="point_code2" label="终点" min-width="100" show-overflow-tooltip />
<el-table-column prop="point2_region_name" label="终点区域" min-width="120" show-overflow-tooltip />
<el-table-column prop="point_code3" label="返回点" min-width="100" show-overflow-tooltip />
<el-table-column prop="point3_region_name" label="返回点区域" min-width="120" show-overflow-tooltip />
<!-- <el-table-column prop="point_code4" label="点位4" min-width="100" show-overflow-tooltip />-->
<!-- <el-table-column prop="point4_region_name" label="点位4区域" min-width="120" show-overflow-tooltip />-->
<el-table-column prop="vehicle_code" label="载具编码1" min-width="100" show-overflow-tooltip />
<el-table-column prop="vehicle_code2" label="载具编码2" min-width="100" show-overflow-tooltip />
<el-table-column prop="vehicle_type" label="载具类型" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">
{{ dict.label.vehicle_type[scope.row.vehicle_type] }}
</template>
</el-table-column>
<el-table-column prop="remark" label="提示" width="120" show-overflow-tooltip />
<el-table-column prop="finished_type" label="任务完成类型" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">