add:三线专机任务
This commit is contained in:
@@ -0,0 +1,273 @@
|
|||||||
|
package org.nl.wms.pda_manage.pda.controller.zdwash;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 振动清洗机手持功能
|
||||||
|
*/
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.common.TableDataInfo;
|
||||||
|
import org.nl.common.anno.Log;
|
||||||
|
import org.nl.common.enums.AcsTaskEnum;
|
||||||
|
import org.nl.common.enums.StatusEnum;
|
||||||
|
import org.nl.common.utils.RedissonUtils;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.wms.ext_manage.acs.service.WmsToAcsService;
|
||||||
|
import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService;
|
||||||
|
import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase;
|
||||||
|
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtSectattrService;
|
||||||
|
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtSectattr;
|
||||||
|
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
|
||||||
|
import org.nl.wms.scheduler_manage.service.extendtask.Engrave.EngraveCallService;
|
||||||
|
import org.nl.wms.scheduler_manage.service.extendtask.Engrave.EngraveSendEmpTask;
|
||||||
|
import org.nl.wms.scheduler_manage.service.extendtask.manage.TaskStatusEnum;
|
||||||
|
import org.nl.wms.scheduler_manage.service.extendtask.plotter.PlotterCallEmptyTask;
|
||||||
|
import org.nl.wms.scheduler_manage.service.point.ISchBasePointService;
|
||||||
|
import org.nl.wms.scheduler_manage.service.point.dao.SchBasePoint;
|
||||||
|
import org.nl.wms.scheduler_manage.service.task.ISchBaseTaskService;
|
||||||
|
import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
|
||||||
|
import org.nl.wms.storage_manage.productmanage.util.DivRuleCpService;
|
||||||
|
import org.nl.wms.storage_manage.productmanage.util.RuleUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
//@RestController
|
||||||
|
|
||||||
|
@RequestMapping("/api/pda")
|
||||||
|
@Slf4j
|
||||||
|
@SaIgnore
|
||||||
|
public class ZdWashController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WmsToAcsService wmsToAcsService;
|
||||||
|
@Autowired
|
||||||
|
private ISchBasePointService basePointService;
|
||||||
|
@Autowired
|
||||||
|
private PlotterCallEmptyTask plotterCallEmptyTask;
|
||||||
|
@Autowired
|
||||||
|
private ISchBaseTaskService taskService;
|
||||||
|
@Autowired
|
||||||
|
private EngraveCallService engraveScheduleService;
|
||||||
|
@Autowired
|
||||||
|
private IMdMeMaterialbaseService materialbaseService;
|
||||||
|
@Autowired
|
||||||
|
private EngraveSendEmpTask engraveSendEmpTask;
|
||||||
|
@Autowired
|
||||||
|
private IStIvtSectattrService sectattrService;
|
||||||
|
@Autowired
|
||||||
|
private DivRuleCpService divRuleCpService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("deviceinstorQty")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> deviceinstorQty(@RequestBody JSONObject param){
|
||||||
|
SchBasePoint one = basePointService.getOne(new QueryWrapper<SchBasePoint>()
|
||||||
|
.eq("device_code", param.getString("device_code"))
|
||||||
|
.eq("point_type", StatusEnum.POINT_LOCATION_IN.getCode()));
|
||||||
|
if (one==null){
|
||||||
|
throw new BadRequestException("当前设备无倒料点");
|
||||||
|
}
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("device_code", one.getPoint_code());
|
||||||
|
jo.put("qty", param.getString("qty"));
|
||||||
|
JSONObject result = wmsToAcsService.request(jo, "api/wms/handPour");
|
||||||
|
if (!StrUtil.equals(result.getString("status"), "200")) {
|
||||||
|
throw new BadRequestException((String)result.get("message"));
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("callVechile")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> callVechile(@RequestBody JSONObject param){
|
||||||
|
plotterCallEmptyTask.callEmpVechile(param.getString("device_code"));
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
//鞋料
|
||||||
|
@Log("卸料")
|
||||||
|
@PostMapping("kzunload")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> kzunload(@RequestBody JSONObject param) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("device_code", "A1_KZ_SL");
|
||||||
|
JSONObject result = wmsToAcsService.request(jo, "api/wms/startDischarge");
|
||||||
|
if (!StrUtil.equals(result.getString("status"), "200")) {
|
||||||
|
throw new BadRequestException((String)result.get("message"));
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
@PostMapping("kzresidue")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> kzresidue(@RequestBody JSONObject param){
|
||||||
|
RedissonUtils.lock(()->{
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("next_point_code", param.getString("device_code"));
|
||||||
|
jo.put("start_point_code", "A1_KZ_SL");
|
||||||
|
jo.put("weight", param.getString("qty"));
|
||||||
|
JSONObject result = wmsToAcsService.request(jo, "api/wms/putOver");
|
||||||
|
if (!StrUtil.equals(result.getString("status"), "200")) {
|
||||||
|
throw new BadRequestException((String)result.get("message"));
|
||||||
|
}
|
||||||
|
},"kzresidue",null);
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
@PostMapping("tmpcallVechile")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> tmpcallVechile(@RequestBody JSONObject param){
|
||||||
|
RedissonUtils.lock(()->{
|
||||||
|
JSONObject moveTask =taskService.createMoveTask("A1_BCPRKW_SD", "A1_KZ_SL", AcsTaskEnum.TASK_POINT_TO_POINT, AcsTaskEnum.ACS_TASK_TYPE_NON_WEIGHING_TASK_OF_PS20);
|
||||||
|
JSONArray data = new JSONArray();
|
||||||
|
data.add(moveTask);
|
||||||
|
Map<String, Object> result = wmsToAcsService.issueTaskToAcs2(data);
|
||||||
|
if (StrUtil.equals((String)result.get("status"), "400")) {
|
||||||
|
throw new BadRequestException((String)result.get("message"));
|
||||||
|
}
|
||||||
|
moveTask.put("task_status",StatusEnum.TASK_FINISH.getCode());
|
||||||
|
taskService.save(moveTask.toJavaObject(SchBaseTask.class));
|
||||||
|
},"刻字上料送载具",null);
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
@PostMapping("tmpsendVechile")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> tmpsendVechile(@RequestBody JSONObject param){
|
||||||
|
RedissonUtils.lock(()->{
|
||||||
|
JSONObject moveTask = taskService.createMoveTask("A1_KZ_SL", "A1_BCPRKW_SD", AcsTaskEnum.TASK_POINT_TO_POINT, AcsTaskEnum.ACS_TASK_TYPE_NON_WEIGHING_TASK_OF_PS20);
|
||||||
|
JSONArray data = new JSONArray();
|
||||||
|
data.add(moveTask);
|
||||||
|
Map<String, Object> result = wmsToAcsService.issueTaskToAcs2(data);
|
||||||
|
if (StrUtil.equals((String)result.get("status"), "400")) {
|
||||||
|
throw new BadRequestException((String)result.get("message"));
|
||||||
|
}
|
||||||
|
moveTask.put("task_status",StatusEnum.TASK_FINISH.getCode());
|
||||||
|
taskService.save(moveTask.toJavaObject(SchBaseTask.class));
|
||||||
|
},"刻字上料送载具",null);
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
@PostMapping("/kz/submitkz")
|
||||||
|
@Log("提交刻字任务")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> submitkz(@RequestBody JSONArray param){
|
||||||
|
engraveScheduleService.createTask(param);
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/kz/kzTasks")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> kzTasks(@RequestBody JSONObject param){
|
||||||
|
List<Map<String, Object>> list = taskService.listMaps(new QueryWrapper<SchBaseTask>()
|
||||||
|
.lt("task_status", StatusEnum.TASK_FINISH.getCode())
|
||||||
|
.isNotNull("task_step")
|
||||||
|
.eq("product_area", param.getString("product_area"))
|
||||||
|
.nested(a ->
|
||||||
|
a.eq("task_type", AcsTaskEnum.TASK_STRUCT_OUT.getCode())
|
||||||
|
.or()
|
||||||
|
.eq("task_type", AcsTaskEnum.TASK_Engrave_CALL.getCode()))
|
||||||
|
);
|
||||||
|
Set<String> materials = list.stream().map(a->String.valueOf(a.get("material_id"))).collect(Collectors.toSet());
|
||||||
|
if (!CollectionUtils.isEmpty(materials)){
|
||||||
|
Map<String, MdMeMaterialbase> materialMap = materialbaseService.listByIds(materials)
|
||||||
|
.stream().collect(HashMap::new, (k, v) -> k.put(v.getMaterial_id(), v), HashMap::putAll);
|
||||||
|
for (Map<String, Object> map : list) {
|
||||||
|
map.put("material_spec",materialMap.get(map.get("material_id")).getMaterial_spec());
|
||||||
|
map.put("material_code",materialMap.get(map.get("material_id")).getMaterial_code());
|
||||||
|
map.put("create_time",map.get("create_time").toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(list),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/kz/sendVechile")
|
||||||
|
@Log("手动送空框")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> sendVechile(@RequestBody JSONObject param){
|
||||||
|
JSONObject object = new JSONObject();
|
||||||
|
object.put("device_code","A1_KZ_SL");
|
||||||
|
//?刻字满料请求:可以存在多个任务?
|
||||||
|
List<SchBaseTask> list = taskService.list(new QueryWrapper<SchBaseTask>()
|
||||||
|
.lt("task_status", StatusEnum.TASK_FINISH.getCode()).eq("task_type",AcsTaskEnum.TASK_Engrave_EMPTY.getCode()));
|
||||||
|
if (!CollectionUtils.isEmpty(list)){
|
||||||
|
throw new BadRequestException(String.format("刻字输送线-空框送回存在未完成任务"+list.stream().map(SchBaseTask::getTask_code).collect(Collectors.toList()).toString(), param.getString("device_code")));
|
||||||
|
}
|
||||||
|
StIvtSectattr sect = sectattrService.getOne(new QueryWrapper<StIvtSectattr>().eq("sect_name", "半成品库区"));
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("sect_id", sect.getSect_id());
|
||||||
|
jo.put("stor_id", sect.getStor_id());
|
||||||
|
jo.put("rule_type", RuleUtil.PRODUCTION_IN_1);
|
||||||
|
StIvtStructattr stIvtStructattr = divRuleCpService.divRuleIn(jo);
|
||||||
|
if (stIvtStructattr ==null){
|
||||||
|
throw new BadRequestException("半成品库没有可用空位.");
|
||||||
|
}
|
||||||
|
engraveSendEmpTask.createTask(object);
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/kz/resend")
|
||||||
|
@Log("刻字任务重新下发")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> resend(@RequestBody JSONObject param){
|
||||||
|
RedissonUtils.lock(()->{
|
||||||
|
SchBaseTask baseTask = taskService.getById(param.getString("task_id"));
|
||||||
|
if (baseTask.getTask_status().equals(StatusEnum.TASK_FINISH.getCode())){
|
||||||
|
throw new BadRequestException("任务已经完成");
|
||||||
|
};
|
||||||
|
if (baseTask.getTask_type().equals(AcsTaskEnum.TASK_Engrave_CALL.getCode())){
|
||||||
|
//下发
|
||||||
|
Map<String,String> qtyArr = JSONObject.parseObject(baseTask.getQtyArr(), Map.class);
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
jo.put("start_point_code", baseTask.getPoint_code1());
|
||||||
|
jo.put("task_code", baseTask.getTask_code());
|
||||||
|
jo.put("all_weight", baseTask.getMaterial_qty().intValue());
|
||||||
|
String[] to_sort_array = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"};
|
||||||
|
String[] to_devices_array = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"};
|
||||||
|
String[] to_weight_array = {"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"};
|
||||||
|
List<String> sort = qtyArr.keySet().stream().sorted(Comparator.comparingInt(key -> Integer.valueOf(key.substring(key.lastIndexOf("_") + 1)))).collect(Collectors.toList());
|
||||||
|
for (int i1 = 0; i1 < sort.size(); i1++) {
|
||||||
|
String key = sort.get(i1);
|
||||||
|
to_sort_array[i1] = String.valueOf(i1+1);
|
||||||
|
to_devices_array[i1] = String.valueOf(key);
|
||||||
|
to_weight_array[i1] = String.valueOf(new BigDecimal(qtyArr.get(key)));
|
||||||
|
}
|
||||||
|
jo.put("to_sort_array", Arrays.stream(to_sort_array).collect(Collectors.joining(",")));
|
||||||
|
jo.put("to_devices_array",Arrays.stream(to_devices_array).collect(Collectors.joining(",")));
|
||||||
|
jo.put("to_weight_array", Arrays.stream(to_weight_array).collect(Collectors.joining(",")));
|
||||||
|
JSONObject result = wmsToAcsService.request(jo, "api/wms/engravingIn");
|
||||||
|
if (!result.getString("status").equals("200")){
|
||||||
|
log.error("刻字上料输送线任务下发异常:{}",result.getString("message"));
|
||||||
|
baseTask.setRemark(result.getString("message"));
|
||||||
|
baseTask.setTask_status(TaskStatusEnum.SURE_START_ERROR.getCode());
|
||||||
|
taskService.updateById(baseTask);
|
||||||
|
throw new BadRequestException(result.getString("message"));
|
||||||
|
}else {
|
||||||
|
baseTask.setTask_status(TaskStatusEnum.ISSUE.getCode());
|
||||||
|
taskService.updateById(baseTask);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
throw new BadRequestException("搬运任务不允许直接下发");
|
||||||
|
//taskService.operation(MapOf.of("method_name","immediateNotifyAcs","task_id",param.getString("task_id")));
|
||||||
|
}
|
||||||
|
},"刻字输送线下发",null);
|
||||||
|
|
||||||
|
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,11 +3,14 @@ package org.nl.wms.scheduler_manage.service.extendtask.a3;
|
|||||||
import cn.hutool.core.date.DateUnit;
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.nl.common.domain.ReturnLockProcess;
|
||||||
import org.nl.common.enums.AcsTaskEnum;
|
import org.nl.common.enums.AcsTaskEnum;
|
||||||
import org.nl.common.enums.InterfaceLogType;
|
import org.nl.common.enums.InterfaceLogType;
|
||||||
import org.nl.common.enums.StatusEnum;
|
import org.nl.common.enums.StatusEnum;
|
||||||
@@ -33,8 +36,15 @@ import org.nl.wms.scheduler_manage.service.extendtask.manage.AbstractAcsTask;
|
|||||||
import org.nl.wms.scheduler_manage.service.extendtask.manage.TaskStatusEnum;
|
import org.nl.wms.scheduler_manage.service.extendtask.manage.TaskStatusEnum;
|
||||||
import org.nl.wms.scheduler_manage.service.point.ISchBasePointService;
|
import org.nl.wms.scheduler_manage.service.point.ISchBasePointService;
|
||||||
import org.nl.wms.scheduler_manage.service.point.dao.SchBasePoint;
|
import org.nl.wms.scheduler_manage.service.point.dao.SchBasePoint;
|
||||||
|
import org.nl.wms.scheduler_manage.service.scheduler.ISchProcessRouteService;
|
||||||
|
import org.nl.wms.scheduler_manage.service.scheduler.SchedulerService;
|
||||||
|
import org.nl.wms.scheduler_manage.service.scheduler.dao.SchProcessRoute;
|
||||||
|
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.impl.FlowElement;
|
||||||
import org.nl.wms.scheduler_manage.service.task.ISchBaseTaskService;
|
import org.nl.wms.scheduler_manage.service.task.ISchBaseTaskService;
|
||||||
import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
|
import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
|
||||||
|
import org.nl.wms.storage_manage.IOSEnum;
|
||||||
|
import org.nl.wms.storage_manage.semimanagehr.service.iostorInv.IStIvtIostorinvOrderService;
|
||||||
|
import org.nl.wms.storage_manage.semimanagehr.service.iostorInv.dao.StIvtIostorinvOrder;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -62,7 +72,9 @@ public class A3SpeFullTask extends AbstractAcsTask {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IPdmBiWorkprocedureService workprocedureService;
|
private IPdmBiWorkprocedureService workprocedureService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AgvInstService agvInstService;
|
private SchedulerService schedulerService;
|
||||||
|
@Autowired
|
||||||
|
protected IStIvtIostorinvOrderService iStIvtIostorinvOrderService;
|
||||||
|
|
||||||
private final Map<String,SpeStatusHandler > SpeHandles= new HashMap<>();
|
private final Map<String,SpeStatusHandler > SpeHandles= new HashMap<>();
|
||||||
private static String OPT_NAME = "ACS回调# ";
|
private static String OPT_NAME = "ACS回调# ";
|
||||||
@@ -302,8 +314,57 @@ public class A3SpeFullTask extends AbstractAcsTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void pointConfirm(JSONObject param) {
|
public void pointConfirm(JSONObject task) {
|
||||||
agvInstService.fullMaster(param);
|
String nextPoint = null;
|
||||||
|
String quantity = task.getString("material_qty");
|
||||||
|
//获取当前生产工序下一道工序
|
||||||
|
Map<String,String> workprodure = pointService.findDeviceWorkprodure(task.getString("point_code1"));
|
||||||
|
FlowElement currentFlow = schedulerService.getFlowElement(task.getString("point_code1"), task.getString("material_id"), workprodure);
|
||||||
|
FlowElement next = currentFlow.next();
|
||||||
|
Map query = MapOf.of("workprocedure_id", pointService.getWorkprodureByCode(next.getId()).get("workprocedure_id")
|
||||||
|
, "qty", quantity,"spec",workprodure.get("spec"));
|
||||||
|
//判断缓存线是不是去深坑清洗:深坑区域15个点:判断空的物料坑位:
|
||||||
|
List<Map<String,String>> collect = new ArrayList<>();
|
||||||
|
query.put("material_id",task.getString("material_id"));
|
||||||
|
if (next.getName().equals("三线半成品入库")){
|
||||||
|
//查看半成品入库位是否有存在两个任务
|
||||||
|
}else {
|
||||||
|
collect = deviceService.workproceduceDevicesQty(query);
|
||||||
|
List<Map<String, String>> list = collect.stream().filter(stringStringMap -> stringStringMap.get("tasks") == null || stringStringMap.get("materials").contains(task.getString("material_id"))).collect(Collectors.toList());
|
||||||
|
task.put("acs_task_type",AcsTaskEnum.ACS_TASK_TYPE_NOBLE_SINGLE_TASK.getCode());
|
||||||
|
task.put("is_send","1");
|
||||||
|
if (!CollectionUtils.isEmpty(list)){
|
||||||
|
nextPoint = list.get(0).get("point_code");
|
||||||
|
} else {
|
||||||
|
if (currentFlow.getParams().get("cacheLine") == null){
|
||||||
|
throw new BadRequestException("当前任务下一道工序无可用设备");
|
||||||
|
}
|
||||||
|
//查看半成品入库位是否有存在两个任务
|
||||||
|
int count = iStIvtIostorinvOrderService.count(new QueryWrapper<StIvtIostorinvOrder>()
|
||||||
|
.eq("is_delete", false)
|
||||||
|
.eq("type", IOSEnum.IO_TYPE.code("入库")));
|
||||||
|
int taskCount = taskService.count(new QueryWrapper<SchBaseTask>()
|
||||||
|
.eq("point_code2", "A3_BCPRK01")
|
||||||
|
.eq("is_delete", false));
|
||||||
|
if (taskCount>(3-count)){
|
||||||
|
throw new BadRequestException("海柔半成品入库点料箱位已满");
|
||||||
|
}
|
||||||
|
nextPoint = "A3_BCPRK01";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("调度任务分配点位信息:{}", JSON.toJSONString(collect));
|
||||||
|
|
||||||
|
结果校验:{
|
||||||
|
if (StringUtils.isBlank(nextPoint)) {
|
||||||
|
throw new BadRequestException("逻辑非配错误,请检查代码");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SchBaseTask schBaseTask = task.toJavaObject(SchBaseTask.class);
|
||||||
|
schBaseTask.setPoint_code2(nextPoint);
|
||||||
|
schBaseTask.setTask_status(StatusEnum.TASK_START_END_P.getCode());
|
||||||
|
schBaseTask.setUpdate_time(new Date());
|
||||||
|
taskService.updateById(schBaseTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,21 +1,27 @@
|
|||||||
package org.nl.wms.scheduler_manage.service.scheduler;
|
package org.nl.wms.scheduler_manage.service.scheduler;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.nl.common.publish.AbstraceListener;
|
import org.nl.common.publish.AbstraceListener;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.wms.scheduler_manage.service.point.ISchBasePointService;
|
||||||
|
import org.nl.wms.scheduler_manage.service.point.dao.SchBasePoint;
|
||||||
|
import org.nl.wms.scheduler_manage.service.scheduler.dao.SchProcessRoute;
|
||||||
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.BaseConverter;
|
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.BaseConverter;
|
||||||
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.BaseElement;
|
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.BaseElement;
|
||||||
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.impl.FlowElement;
|
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.impl.FlowElement;
|
||||||
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.impl.ProcessElement;
|
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.impl.ProcessElement;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||||
import org.springframework.core.io.FileSystemResourceLoader;
|
import org.springframework.core.io.FileSystemResourceLoader;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.xml.stream.XMLInputFactory;
|
import javax.xml.stream.XMLInputFactory;
|
||||||
import javax.xml.stream.XMLStreamConstants;
|
import javax.xml.stream.XMLStreamConstants;
|
||||||
@@ -42,6 +48,12 @@ public class SchedulerService implements BeanPostProcessor {
|
|||||||
|
|
||||||
private static Map<String,BaseConverter> converterMap =new HashMap<>();
|
private static Map<String,BaseConverter> converterMap =new HashMap<>();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISchProcessRouteService schProcessRouteService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISchBasePointService pointService;
|
||||||
|
|
||||||
@Value(("${schedulerFile}"))
|
@Value(("${schedulerFile}"))
|
||||||
public void setSchedulerFile(String schedulerFile) {
|
public void setSchedulerFile(String schedulerFile) {
|
||||||
SchedulerService.schedulerFile = schedulerFile;
|
SchedulerService.schedulerFile = schedulerFile;
|
||||||
@@ -143,4 +155,27 @@ public class SchedulerService implements BeanPostProcessor {
|
|||||||
}
|
}
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public FlowElement getFlowElement(String point_code,String material_id,Map<String,String> workprodure){
|
||||||
|
if (CollectionUtils.isEmpty(workprodure)){
|
||||||
|
throw new BadRequestException("当前点位所属设备无对应工序");
|
||||||
|
}
|
||||||
|
SchBasePoint devicePoint = pointService.getOne(new QueryWrapper<SchBasePoint>()
|
||||||
|
.eq("point_code", point_code)
|
||||||
|
.eq("is_delete", "0")
|
||||||
|
.eq("is_used", "1")
|
||||||
|
);
|
||||||
|
SchProcessRoute processRoute = schProcessRouteService.findByMaterialId(devicePoint.getRegion_code());
|
||||||
|
if (processRoute == null){
|
||||||
|
throw new BadRequestException("当前没有配置对应工序调度线路:"+material_id+"/"+devicePoint.getRegion_code());
|
||||||
|
}
|
||||||
|
//workprocedure_code,r.workprocedure_id
|
||||||
|
FlowElement flowElement = this.currentFlow(processRoute.getProcess_id(), workprodure.get("workprocedure_code"));
|
||||||
|
if (flowElement == null){
|
||||||
|
throw new BadRequestException("当前工序调度线路:"+processRoute.getProcess_id()+"没有对应工序配置"+workprodure.get("workprocedure_code"));
|
||||||
|
}
|
||||||
|
return flowElement;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user