fix;表处代码修改
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package org.nl.b_lms.pdm.ivt.rest;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.pdm.ivt.service.StPointIvtService;
|
||||
@@ -54,4 +56,12 @@ public class StPointIvtController {
|
||||
stpointivtService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("表处下料")
|
||||
@PostMapping("/rollDown")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> rollDown(@RequestBody JSONObject param) {
|
||||
stpointivtService.rollDown(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.b_lms.pdm.ivt.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.b_lms.pdm.ivt.service.dto.StPointIvtDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -67,4 +68,6 @@ public interface StPointIvtService {
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
void rollDown(JSONObject param);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ package org.nl.b_lms.pdm.ivt.service.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -11,12 +12,14 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.pdm.ivt.service.StPointIvtService;
|
||||
import org.nl.b_lms.pdm.ivt.service.dto.StPointIvtDto;
|
||||
import org.nl.b_lms.sch.tasks.SurfaceTask;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -34,6 +37,9 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class StPointIvtServiceImpl implements StPointIvtService {
|
||||
|
||||
@Autowired
|
||||
private SurfaceTask surfaceTask;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
//获取人员对应的区域
|
||||
@@ -142,4 +148,57 @@ public class StPointIvtServiceImpl implements StPointIvtService {
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollDown(JSONObject param) {
|
||||
String device_code = param.getString("device_code");
|
||||
if (StrUtil.isEmpty(device_code)) {
|
||||
throw new BadRequestException("设备号不能为空!");
|
||||
}
|
||||
JSONObject device_jo = WQLObject.getWQLObject("st_ivt_stpointivt").query("point_code = '" + device_code + "'").uniqueResult(0);
|
||||
if (device_jo == null) {
|
||||
throw new BadRequestException("未查询到设备号为:【" + device_code + "】的设备!");
|
||||
}
|
||||
String down_pcsn = device_jo.getString("down_pcsn");
|
||||
String sort_seq = device_jo.getString("sort_seq");
|
||||
if (StrUtil.isEmpty(down_pcsn)) {
|
||||
throw new BadRequestException("当前表处机上的库存为空,请检测系统库存,并手动进行维护!");
|
||||
}
|
||||
|
||||
JSONObject task_jo = new JSONObject();
|
||||
task_jo.put("material_code", down_pcsn);
|
||||
task_jo.put("product_area", device_jo.getString("product_area"));
|
||||
//查询可用的满轴点位
|
||||
JSONObject full_point = WQL.getWO("ST_IVT_STPOINTIVT")
|
||||
.addParam("sql_str", " ORDER BY abs(" + sort_seq + "-sort_seq),point_code")
|
||||
.addParam("product_area", device_jo.getString("product_area"))
|
||||
.addParam("flag", "2").process().uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(full_point)) {
|
||||
throw new BadRequestException("未查询到可用的满轴空点位!");
|
||||
}
|
||||
//查询可用的空轴点位
|
||||
JSONObject empty_point = WQL.getWO("ST_IVT_STPOINTIVT")
|
||||
.addParam("sql_str", " ORDER BY abs(" + sort_seq + "-sort_seq),point_code")
|
||||
.addParam("product_area", device_jo.getString("product_area"))
|
||||
.addParam("flag", "3").process().uniqueResult(0);
|
||||
|
||||
task_jo.put("point_code1", device_jo.getString("down_point_code"));
|
||||
task_jo.put("point_code2", full_point.getString("full_point_code"));
|
||||
task_jo.put("truss_type", "1");
|
||||
task_jo.put("task_type", "010901");
|
||||
if (ObjectUtil.isNotEmpty(empty_point)) {
|
||||
task_jo.put("truss_type", "2");
|
||||
int num = empty_point.getIntValue("num");
|
||||
//缓存架最大存放空轴数量
|
||||
int max_num = 3;
|
||||
int layer_num = max_num - num;
|
||||
task_jo.put("point_code3", empty_point.getString("empty_point_code") + "_" + layer_num);
|
||||
task_jo.put("point_code4", device_jo.getString("down_point_code"));
|
||||
task_jo.put("task_type", "010902");
|
||||
}
|
||||
|
||||
//创建并下发行架任务
|
||||
surfaceTask.createTask(task_jo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
输入.is_used TYPEAS s_string
|
||||
输入.mes_used TYPEAS s_string
|
||||
输入.in_area_id TYPEAS f_string
|
||||
输入.sql_str TYPEAS f_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -61,4 +62,64 @@
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
ivt.*
|
||||
FROM
|
||||
ST_IVT_StPointCacheIvt ivt
|
||||
WHERE
|
||||
full_point_status = '01'
|
||||
AND ivt.is_used = '1'
|
||||
AND NOT EXISTS
|
||||
(
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sch_base_task
|
||||
WHERE
|
||||
(point_code1 = ivt.full_point_code OR point_code2 = ivt.full_point_code)
|
||||
AND
|
||||
task_status < '07'
|
||||
AND is_delete = '0'
|
||||
)
|
||||
OPTION 输入.product_area <> ""
|
||||
ivt.product_area = 输入.product_area
|
||||
ENDOPTION
|
||||
输入.sql_str
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
ivt.*
|
||||
FROM
|
||||
ST_IVT_StPointCacheIvt ivt
|
||||
WHERE
|
||||
(empty_point_status = '01'
|
||||
OR
|
||||
(empty_point_status = '02' AND num < 3))
|
||||
AND ivt.is_used = '1'
|
||||
AND NOT EXISTS
|
||||
(
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sch_base_task
|
||||
WHERE
|
||||
(point_code1 = ivt.full_point_code OR point_code3 = ivt.full_point_code)
|
||||
AND
|
||||
task_status < '07'
|
||||
AND is_delete = '0'
|
||||
)
|
||||
OPTION 输入.product_area <> ""
|
||||
ivt.product_area = 输入.product_area
|
||||
ENDOPTION
|
||||
输入.sql_str
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -0,0 +1,190 @@
|
||||
package org.nl.b_lms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
|
||||
import org.nl.wms.pda.mps.service.mapper.HotMapper;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.tasks.CutConveyorTask;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SurfaceTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = SurfaceTask.class.getName();
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
/*
|
||||
* 下发给ACS时需要特殊处理
|
||||
*/
|
||||
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + THIS_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
|
||||
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
String product_area = json.getString("product_area");
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.start_device_code2(json.getString("point_code3"))
|
||||
.next_device_code2(json.getString("point_code4"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.priority(json.getString("priority"))
|
||||
.truss_type(json.getString("response_param"))
|
||||
.remark(json.getString("remark"))
|
||||
.product_area(product_area)
|
||||
.build();
|
||||
|
||||
resultList.add(dto);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
|
||||
WQLObject pointIvtTab = WQLObject.getWQLObject("st_ivt_stpointivt"); // 表处库存表
|
||||
WQLObject cacheIvtTab = WQLObject.getWQLObject("ST_IVT_StPointCacheIvt"); // 表处缓存位表
|
||||
|
||||
String task_id = taskObj.getString("task_id");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
if (StrUtil.equals(status, "0")) {
|
||||
// 更新删除字段
|
||||
jsonTask.put("is_delete", "1");
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
String task_type = taskObj.getString("task_type");
|
||||
JSONObject stpoint_jo = pointIvtTab.query("down_point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
|
||||
stpoint_jo.put("down_pcsn", "");
|
||||
pointIvtTab.update(stpoint_jo);
|
||||
JSONObject cache_jo = cacheIvtTab.query("full_point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
|
||||
cache_jo.put("container_name", jsonTask.getString("material_code"));
|
||||
cache_jo.put("full_point_status", "02");
|
||||
cacheIvtTab.update(cache_jo);
|
||||
if ("010902".equals(task_type)) {
|
||||
String empty_point = jsonTask.getString("point_code3").substring(0, jsonTask.getString("point_code3").lastIndexOf("_"));
|
||||
JSONObject empty_cache_jo = cacheIvtTab.query("empty_point_code = '" + empty_point + "'").uniqueResult(0);
|
||||
int num = cache_jo.getIntValue("num");
|
||||
num = num - 1 > 0 ? num - 1 : 0;
|
||||
empty_cache_jo.put("num", num);
|
||||
if (num == 0) {
|
||||
empty_cache_jo.put("empty_point_status", "01");
|
||||
}
|
||||
empty_cache_jo.put("update_time", DateUtil.now());
|
||||
cacheIvtTab.update(empty_cache_jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String createTask(JSONObject form) {
|
||||
WQLObject tab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
|
||||
CutConveyorTask cutConveyorTask = new CutConveyorTask();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
String task_id = "";
|
||||
|
||||
String point_code1 = form.getString("point_code1");
|
||||
String point_code2 = form.getString("point_code2");
|
||||
String point_code3 = form.getString("point_code3");
|
||||
if (cutConveyorTask.isSingleTask(point_code1)) {
|
||||
throw new BadRequestException("点位:" + point_code1 + "存在未完成的任务!");
|
||||
}
|
||||
if (cutConveyorTask.isSingleTask(point_code2)) {
|
||||
throw new BadRequestException("点位:" + point_code3 + "存在未完成的任务!");
|
||||
}
|
||||
if (cutConveyorTask.isSingleTask(point_code3) && StrUtil.isNotEmpty(point_code3)) {
|
||||
throw new BadRequestException("点位:" + point_code3 + "存在未完成的任务!");
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_type", form.getString("task_type"));
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("point_code1", form.getString("point_code1"));
|
||||
json.put("point_code2", form.getString("point_code2"));
|
||||
json.put("point_code3", form.getString("point_code3"));
|
||||
json.put("point_code4", form.getString("point_code4"));
|
||||
json.put("product_area", form.getString("product_area"));
|
||||
json.put("handle_class", THIS_CLASS);
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("material_code", form.getString("material_code"));
|
||||
json.put("response_param", form.getString("truss_type"));
|
||||
json.put("create_name", currentUsername);
|
||||
json.put("create_time", DateUtil.now());
|
||||
json.put("acs_task_type", "6");
|
||||
tab.insert(json);
|
||||
task_id = json.getString("task_id");
|
||||
immediateNotifyAcs(task_id);
|
||||
return task_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, "0");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class AutoSendAirShaftAgvTask {
|
||||
// 获取任意一条
|
||||
PdmBiSlittingproductionplan demoPlan = plans.get(0);
|
||||
// 区域(B1, B2, B3, B4)
|
||||
String area = demoPlan.getResource_name().substring(0, 2);
|
||||
String area = demoPlan.getContainer_name().substring(0, 2);
|
||||
StIvtCutpointivt deviceCut = cutpointivtService.getOne(new LambdaQueryWrapper<StIvtCutpointivt>()
|
||||
.eq(StIvtCutpointivt::getExt_code, demoPlan.getResource_name()));
|
||||
// 校验是否为一组
|
||||
|
||||
@@ -80,7 +80,7 @@ public class AutoSlitterDownAgvTask {
|
||||
}
|
||||
} else if ("3".equals(cut.getPoint_type())) {
|
||||
// 2、没有位置,就去分切缓存位
|
||||
areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("3", "1", "0","0");
|
||||
areaEmptyNotTaskPoint = cutpointivtService.getAreaNotTaskPointByStatus("2", "1", "0","0");
|
||||
}
|
||||
if (areaEmptyNotTaskPoint.size() == 0) {
|
||||
log.warn(cut.getProduct_area() + "该区域暂无位置存放满轴");
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -26,7 +26,7 @@
|
||||
全部分配
|
||||
</el-button>
|
||||
</slot>
|
||||
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
|
||||
<el-button slot="left" type="info" @click="close">关闭</el-button>
|
||||
</span>
|
||||
</div>
|
||||
</span>
|
||||
@@ -292,6 +292,7 @@ export default {
|
||||
this.form.dtl_row = null
|
||||
this.sectProp = null
|
||||
this.sects = []
|
||||
this.sect_id = null
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('AddChanged')
|
||||
this.crud.refresh()
|
||||
@@ -387,6 +388,7 @@ export default {
|
||||
})
|
||||
},
|
||||
allDivStruct() {
|
||||
debugger
|
||||
if (!this.sect_id) {
|
||||
this.crud.notify('请先选择虚拟库区区域!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
@@ -399,6 +401,7 @@ export default {
|
||||
crudRawAssist.getIODtl({ 'bill_code': this.openParam[0].bill_code, 'open_flag': '1' }).then(res => {
|
||||
this.openParam = res
|
||||
})
|
||||
this.crud.notify('分配货位成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).finally(() => {
|
||||
this.allDivBtn = false
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user