feat: 废箔搬运业务
This commit is contained in:
@@ -19,6 +19,7 @@ public enum TagNameEnum {
|
||||
GX_OUT("手持管芯出库"),
|
||||
SWITCH_STATUS_OF_LIFT("货梯切换状态"),
|
||||
ERROR_GX_IN_OUT("管芯满入空出异常处理"),
|
||||
AUTO_CALL_EMPTY_BY_CZZC("自动称重暂存位叫空"),
|
||||
/**
|
||||
* 标记符号
|
||||
*/
|
||||
|
||||
@@ -47,6 +47,12 @@ public class AcsToWmsController {
|
||||
public ResponseEntity<Object> outHotTaskApply(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(acsToWmsService.outHotTaskApply(whereJson), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/receiveWasteFoilWeight")
|
||||
@Log(value = "废箔重量反馈", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> receiveWasteFoilWeight(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(acsToWmsService.receiveWasteFoilWeight(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/againApply")
|
||||
@Log(value = "二次申请任务", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
|
||||
@@ -125,4 +125,11 @@ public interface AcsToWmsService {
|
||||
* @return /
|
||||
*/
|
||||
JSONObject outHotTaskApply(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* ACS请求反馈废箔重量
|
||||
* @param whereJson
|
||||
* @return
|
||||
*/
|
||||
JSONObject receiveWasteFoilWeight(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.TaskFactory;
|
||||
import org.nl.wms.sch.task_manage.TaskStatus;
|
||||
import org.nl.wms.sch.task_manage.service.BakingOperationService;
|
||||
import org.nl.wms.sch.task_manage.service.OtherOperationService;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -32,6 +33,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
private TaskFactory taskFactory;
|
||||
@Autowired
|
||||
private BakingOperationService bakingOperationService;
|
||||
@Autowired
|
||||
private OtherOperationService otherOperationService;
|
||||
@Override
|
||||
public Map<String, Object> receiveTaskStatusAcs(String string) throws InterruptedException {
|
||||
log.info("acs向lms反馈任务状态,请求参数:--------------------------------------" + string);
|
||||
@@ -167,4 +170,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
public JSONObject outHotTaskApply(JSONObject whereJson) {
|
||||
return bakingOperationService.acsRequestOutHotTask(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject receiveWasteFoilWeight(JSONObject whereJson) {
|
||||
return otherOperationService.acsRequestWasteFoilWeight(whereJson);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package org.nl.wms.md.controller;
|
||||
package org.nl.wms.md.interfaceback.controller;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.wms.md.interfaceback.dto.MdPbInterfacebackParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -14,8 +15,7 @@ import org.nl.common.domain.query.PageQuery;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.md.dto.MdPbInterfacebackParam;
|
||||
import org.nl.wms.md.service.ImdPbInterfacebackService;
|
||||
import org.nl.wms.md.interfaceback.service.ImdPbInterfacebackService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -1,10 +1,9 @@
|
||||
package org.nl.wms.md.dao;
|
||||
package org.nl.wms.md.interfaceback.dao;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.nl.wms.md.dao.mapper;
|
||||
package org.nl.wms.md.interfaceback.dao.mapper;
|
||||
|
||||
import org.nl.wms.md.dao.MdPbInterfaceback;
|
||||
import org.nl.wms.md.interfaceback.dao.MdPbInterfaceback;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.md.dao.mapper.MdPbInterfacebackMapper">
|
||||
<mapper namespace="org.nl.wms.md.interfaceback.dao.mapper.MdPbInterfacebackMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.md.dto;
|
||||
package org.nl.wms.md.interfaceback.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package org.nl.wms.md.dto;
|
||||
package org.nl.wms.md.interfaceback.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.*;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.md.dao.MdPbInterfaceback;
|
||||
import org.nl.wms.md.interfaceback.dao.MdPbInterfaceback;
|
||||
|
||||
/**
|
||||
* {@code @Description:} 接口回传设置表(MdPbInterfaceback)查询参数类
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.nl.wms.md.service;
|
||||
package org.nl.wms.md.interfaceback.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.md.dao.MdPbInterfaceback;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.md.dto.MdPbInterfacebackParam;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.md.interfaceback.dao.MdPbInterfaceback;
|
||||
import org.nl.wms.md.interfaceback.dto.MdPbInterfacebackParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -1,18 +1,14 @@
|
||||
package org.nl.wms.md.service.impl;
|
||||
package org.nl.wms.md.interfaceback.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.nl.wms.md.dao.MdPbInterfaceback;
|
||||
import org.nl.wms.md.dto.MdPbInterfacebackParam;
|
||||
import org.nl.wms.md.dao.mapper.MdPbInterfacebackMapper;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.nl.wms.md.service.ImdPbInterfacebackService;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.nl.wms.md.interfaceback.dao.MdPbInterfaceback;
|
||||
import org.nl.wms.md.interfaceback.dto.MdPbInterfacebackParam;
|
||||
import org.nl.wms.md.interfaceback.dao.mapper.MdPbInterfacebackMapper;
|
||||
import org.nl.wms.md.interfaceback.service.ImdPbInterfacebackService;
|
||||
import org.nl.wms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -25,24 +25,34 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class NbjPdaController {
|
||||
@Autowired
|
||||
private NbjPdaService nbjPdaService;
|
||||
|
||||
@PostMapping("/confirmedInStorage")
|
||||
@Log("货梯状态切换")
|
||||
public ResponseEntity<Object> changeLiftStatus(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(nbjPdaService.changeLiftStatus(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getLiftInfos")
|
||||
// @Log("货梯下拉框")
|
||||
public ResponseEntity<Object> getLiftInfos() {
|
||||
return new ResponseEntity<>(nbjPdaService.getLiftInfos(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getWeightCacheInfos")
|
||||
// @Log("成品称重暂存区下拉框")
|
||||
public ResponseEntity<Object> getWeightCacheInfos() {
|
||||
return new ResponseEntity<>(nbjPdaService.getWeightCacheInfos(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/doSubVolumeDown")
|
||||
@Log("子卷下线")
|
||||
public ResponseEntity<Object> doSubVolumeDown(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(nbjPdaService.doSubVolumeDown(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/doSubVolumeBindingWeight")
|
||||
@Log("子卷重量维护")
|
||||
public ResponseEntity<Object> doSubVolumeBindingWeight(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(nbjPdaService.doSubVolumeBindingWeight(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.nl.wms.pda.st.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pda.st.service.OtherPdaService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 其他部分的手持功能
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/pda/other")
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class OtherPdaController {
|
||||
@Autowired
|
||||
private OtherPdaService otherPdaService;
|
||||
@PostMapping("/startMoveWasteFoil")
|
||||
@Log("开始搬运废箔信息")
|
||||
public ResponseEntity<Object> startMoveWasteFoil(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(otherPdaService.startMoveWasteFoil(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/resumeMoveWasteFoil")
|
||||
@Log("继续/结束搬运废箔信息")
|
||||
public ResponseEntity<Object> resumeMoveWasteFoil(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(otherPdaService.resumeMoveWasteFoil(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -34,4 +34,11 @@ public interface NbjPdaService {
|
||||
* @return /
|
||||
*/
|
||||
JSONObject doSubVolumeDown(JSONObject param);
|
||||
|
||||
/**
|
||||
* 子卷绑定重量
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject doSubVolumeBindingWeight(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.nl.wms.pda.st.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
public interface OtherPdaService {
|
||||
/**
|
||||
* 开始搬运废箔
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject startMoveWasteFoil(JSONObject param);
|
||||
|
||||
/**
|
||||
* 继续/结束搬运废箔信息
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject resumeMoveWasteFoil(JSONObject param);
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
package org.nl.wms.pda.st.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.lucene.TagNameEnum;
|
||||
import org.nl.wms.pda.st.service.NbjPdaService;
|
||||
import org.nl.wms.pdm.bi.dao.PdmBiSlittingproductionplan;
|
||||
import org.nl.wms.pdm.bi.service.IpdmBiSlittingproductionplanService;
|
||||
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;
|
||||
@@ -39,6 +44,8 @@ public class NbjPdaServiceImpl implements NbjPdaService {
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private SubRollDownAGVTask subRollDownAGVTask;
|
||||
@Autowired
|
||||
private IpdmBiSlittingproductionplanService slittingproductionplanService;
|
||||
@Override
|
||||
public JSONObject changeLiftStatus(JSONObject param) {
|
||||
MDC.put("tag_name", TagNameEnum.SWITCH_STATUS_OF_LIFT.getTag());
|
||||
@@ -115,4 +122,25 @@ public class NbjPdaServiceImpl implements NbjPdaService {
|
||||
result.put("message", "子卷下线成功!");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject doSubVolumeBindingWeight(JSONObject param) {
|
||||
log.info("子卷绑定重量 - {}", param);
|
||||
// vehicle_code, weight
|
||||
String vehicleCode = param.getString("vehicle_code");
|
||||
String weight = param.getString("weight");
|
||||
PdmBiSlittingproductionplan plan = slittingproductionplanService.getByTubeCode(vehicleCode);
|
||||
if (ObjectUtil.isEmpty(plan)) {
|
||||
throw new BadRequestException("分切计划不存在!");
|
||||
}
|
||||
plan.setWeight(weight);
|
||||
plan.setUpdate_time(DateUtil.now());
|
||||
plan.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
plan.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
slittingproductionplanService.updateById(plan);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "子卷绑定重量成功!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.nl.wms.pda.st.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.pda.st.service.OtherPdaService;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.TaskStatus;
|
||||
import org.nl.wms.sch.task_manage.tasks.other.WasteFoilAGVTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class OtherPdaServiceImpl implements OtherPdaService {
|
||||
@Autowired
|
||||
private WasteFoilAGVTask wasteFoilAGVTask;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject startMoveWasteFoil(JSONObject param) {
|
||||
log.info("手持开始搬运废箔 - {}", param);
|
||||
// row
|
||||
JSONArray row = param.getJSONArray("row");
|
||||
// 将 JSONArray 转换成 List<String>
|
||||
List<String> list = row.toJavaList(String.class);
|
||||
// 判断二次请求
|
||||
String startPointCode = list.get(0);
|
||||
List<SchBaseTask> tasks = taskService.getWasteFoilTask(startPointCode);
|
||||
if (tasks.size() > 0) {
|
||||
throw new BadRequestException("点位[" + startPointCode + "]的废箔搬运系列任务未完成!");
|
||||
}
|
||||
param.put("index_task", 0);
|
||||
param.put("config_code", "WasteFoilAGVTask");
|
||||
param.put("stage", "first");
|
||||
param.put("total", row.size());
|
||||
wasteFoilAGVTask.apply(param);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "废箔开始搬运请求成功!");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject resumeMoveWasteFoil(JSONObject param) {
|
||||
log.info("继续/结束搬运废箔 - {}", param);
|
||||
String flag = param.getString("flag");
|
||||
// 判断是否能够搬运
|
||||
String pointCode = param.getString("point_code");
|
||||
// 查找执行中的任务
|
||||
SchBaseTask task = taskService.getOne(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getPoint_code2, pointCode)
|
||||
.lt(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode()));
|
||||
if (ObjectUtil.isEmpty(task)) {
|
||||
throw new BadRequestException("点位[" + pointCode + "]上一个任务不存在!");
|
||||
}
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject requestObj = JSONObject.parseObject(requestParam);
|
||||
int indexTask = requestObj.getInteger("index_task");
|
||||
int total = requestObj.getInteger("total");
|
||||
JSONArray row = requestObj.getJSONArray("row");
|
||||
if (indexTask == (total - 1) || "2".equals(flag)) {
|
||||
// 最后一个
|
||||
param.put("stage", "end");
|
||||
} else {
|
||||
param.put("stage", "ing");
|
||||
}
|
||||
// 下发任务需要提供车号,从上个任务获取
|
||||
param.put("index_task", ++indexTask);
|
||||
param.put("config_code", "WasteFoilAGVTask");
|
||||
param.put("row", row);
|
||||
param.put("total", row.size());
|
||||
param.put("up_task_code", task.getTask_code());
|
||||
wasteFoilAGVTask.apply(param);
|
||||
// todo: 通知ACS完成上一个任务
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "废箔继续搬运请求成功!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ public class PdmBiSlittingproductionplan extends Model<PdmBiSlittingproductionpl
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long update_optid;
|
||||
private String update_optid;
|
||||
|
||||
|
||||
/**
|
||||
@@ -230,7 +230,6 @@ public class PdmBiSlittingproductionplan extends Model<PdmBiSlittingproductionpl
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String update_time;
|
||||
|
||||
|
||||
@@ -299,6 +298,26 @@ public class PdmBiSlittingproductionplan extends Model<PdmBiSlittingproductionpl
|
||||
*/
|
||||
private String level;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
private String weight;
|
||||
|
||||
/**
|
||||
* 纸管重量
|
||||
*/
|
||||
private String paper_weight;
|
||||
|
||||
/**
|
||||
* 接头数
|
||||
*/
|
||||
private String joint_type;
|
||||
|
||||
/**
|
||||
* 代数
|
||||
*/
|
||||
private String qzz_generation;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -96,6 +96,12 @@ public interface IpdmBiSlittingproductionplanService extends IService<PdmBiSlitt
|
||||
*/
|
||||
void compelFinish(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 通过纸管编码获取分切计划
|
||||
* @param code 纸管编码
|
||||
* @return /
|
||||
*/
|
||||
PdmBiSlittingproductionplan getByTubeCode(String code);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
||||
/**
|
||||
@@ -221,5 +222,15 @@ public class PdmBiSlittingproductionplanServiceImpl extends ServiceImpl<PdmBiSli
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdmBiSlittingproductionplan getByTubeCode(String code) {
|
||||
LambdaQueryWrapper<PdmBiSlittingproductionplan> lam = new QueryWrapper<PdmBiSlittingproductionplan>().lambda();
|
||||
lam.eq(PdmBiSlittingproductionplan::getIs_delete, "0")
|
||||
.eq(PdmBiSlittingproductionplan::getStatus, "09").and(la -> la.eq(PdmBiSlittingproductionplan::getFRP_material, code)
|
||||
.or()
|
||||
.eq(PdmBiSlittingproductionplan::getPaper_tube_material, code));
|
||||
return getOne(lam);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.nl.wms.quartz;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.lucene.TagNameEnum;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.tasks.nbj.CzzcCallEmptyAGVTask;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 自动呼叫空载具到称重暂存位
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutoCallEmptyToWeighTemp {
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private CzzcCallEmptyAGVTask czzcCallEmptyAGVTask;
|
||||
public void run() {
|
||||
MDC.put("tag_name", TagNameEnum.AUTO_CALL_EMPTY_BY_CZZC.getTag());
|
||||
log.info("称重暂存位叫空自动任务开始执行...");
|
||||
List<SchBasePoint> allZcPoints = pointService.getAllBusinessNotTaskPoint("A1", "A1-CZZC",
|
||||
"1", "1", null);
|
||||
for (SchBasePoint point : allZcPoints) {
|
||||
try {
|
||||
JSONObject taskParam = new JSONObject();
|
||||
taskParam.put("device_code", point.getPoint_code());
|
||||
// 纸管编码
|
||||
taskParam.put("config_code", "CzzcCallEmptyAGVTask");
|
||||
taskParam.put("create_mode", GeneralDefinition.PDA_CREATION);
|
||||
czzcCallEmptyAGVTask.apply(taskParam);
|
||||
} catch (Exception e) {
|
||||
log.error("点位[ {} ]呼叫空转运架失败!{}", point.getPoint_code(), e);
|
||||
}
|
||||
}
|
||||
log.info("称重暂存位叫空自动任务本次执行结束...");
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,9 @@
|
||||
<if test="vehicleType != null">
|
||||
AND p.vehicle_type = #{vehicleType}
|
||||
</if>
|
||||
AND 0 = (SELECT COUNT(*) FROM sch_base_task t WHERE t.point_code1 = p.point_code AND t.task_status <![CDATA[<]]> '07')
|
||||
ORDER BY p.in_order_seq
|
||||
AND 0 = (SELECT COUNT(*) FROM sch_base_task t WHERE t.task_status <![CDATA[<]]> '07'
|
||||
AND (t.point_code1 = p.point_code AND t.point_code2 = p.point_code AND t.point_code3 = p.point_code
|
||||
AND t.point_code4 = p.point_code))
|
||||
ORDER BY p.in_order_seq, p.update_time
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -138,4 +138,11 @@ public interface ISchBaseTaskService extends IService<SchBaseTask> {
|
||||
* @return /
|
||||
*/
|
||||
SchBaseTask getTaskByPointCodeX(String p1, String p2, String p3, String p4);
|
||||
|
||||
/**
|
||||
* 查找点位系列的任务
|
||||
* @param code 点位编码
|
||||
* @return /
|
||||
*/
|
||||
List<SchBaseTask> getWasteFoilTask(String code);
|
||||
}
|
||||
|
||||
@@ -18,4 +18,6 @@ public interface SchBaseTaskMapper extends BaseMapper<SchBaseTask> {
|
||||
List<SchBaseTask> checkHaveTask(String code);
|
||||
|
||||
List<SchBaseTask> checkHaveRelatedTaskInRequestParam(String param);
|
||||
|
||||
List<SchBaseTask> getWasteFoilTask(String code);
|
||||
}
|
||||
|
||||
@@ -62,4 +62,11 @@
|
||||
AND task_status <![CDATA[ <> ]]> '07'
|
||||
AND request_param LIKE '%${param}%'
|
||||
</select>
|
||||
<select id="getWasteFoilTask" resultType="org.nl.wms.sch.task.service.dao.SchBaseTask">
|
||||
SELECT *
|
||||
FROM sch_base_task
|
||||
WHERE task_status <![CDATA[ <= ]]> '071'
|
||||
AND task_status <![CDATA[ <> ]]> '07'
|
||||
AND request_param LIKE '%${code}%'
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -276,4 +276,9 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
||||
return getOne(lam, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchBaseTask> getWasteFoilTask(String code) {
|
||||
return schBaseTaskMapper.getWasteFoilTask(code);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.wms.sch.task_manage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
public interface OtherOperationService {
|
||||
/**
|
||||
* ACS反馈废箔重量
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject acsRequestWasteFoilWeight(JSONObject param);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.nl.wms.sch.task_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.md.wastefoilrecord.service.IWastefoilrecordService;
|
||||
import org.nl.wms.md.wastefoilrecord.service.dao.Wastefoilrecord;
|
||||
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.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.service.OtherOperationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class OtherOperationServiceImpl implements OtherOperationService {
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private IWastefoilrecordService wastefoilrecordService;
|
||||
@Override
|
||||
public JSONObject acsRequestWasteFoilWeight(JSONObject param) {
|
||||
log.info("ACS反馈废箔重量: {}", param);
|
||||
// task_code, point_code, weight
|
||||
String taskCode = param.getString("task_code");
|
||||
String pointCode = param.getString("point_code");
|
||||
String weight = param.getString("weight");
|
||||
Assert.notBlank(taskCode, "任务编码不能为空!");
|
||||
// 获取当前任务
|
||||
SchBaseTask currentTask = taskService.getByCode(taskCode);
|
||||
String requestParam = currentTask.getRequest_param();
|
||||
JSONObject requestObj = JSONObject.parseObject(requestParam);
|
||||
int indexTask = requestObj.getInteger("index_task");
|
||||
requestObj.put("weight", weight);
|
||||
if (indexTask != 0) {
|
||||
// 获取上一条任务的重量
|
||||
String upTaskCode = requestObj.getString("up_task_code");
|
||||
SchBaseTask upTask = taskService.getByCode(upTaskCode);
|
||||
String upTaskRequestParam = upTask.getRequest_param();
|
||||
JSONObject upTaskRequestObj = JSONObject.parseObject(upTaskRequestParam);
|
||||
String upWeightStr = upTaskRequestObj.getString("weight");
|
||||
BigDecimal currentWeight = new BigDecimal(weight);
|
||||
BigDecimal upWeight = new BigDecimal(upWeightStr);
|
||||
BigDecimal netWeight = currentWeight.subtract(upWeight);
|
||||
requestObj.put("netWeight", netWeight);
|
||||
// 记录数据
|
||||
SchBasePoint fbPoint = pointService.getById(pointCode);
|
||||
Wastefoilrecord wastefoilrecord = new Wastefoilrecord();
|
||||
wastefoilrecord.setWeight(String.valueOf(netWeight));
|
||||
wastefoilrecord.setRecord_id(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
wastefoilrecord.setPoint_code(pointCode);
|
||||
wastefoilrecord.setPoint_name(fbPoint.getPoint_name());
|
||||
wastefoilrecord.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
wastefoilrecord.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
wastefoilrecord.setCreate_time(DateUtil.now());
|
||||
wastefoilrecordService.save(wastefoilrecord);
|
||||
}
|
||||
currentTask.setRequest_param(requestObj.toJSONString());
|
||||
taskService.updateById(currentTask);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "废箔重量反馈成功!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package org.nl.wms.sch.task_manage.tasks.nbj;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
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.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.TaskStatus;
|
||||
import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.core.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.wms.util.TaskUtils.checkTaskOptionStatus;
|
||||
import static org.nl.wms.util.TaskUtils.setUpdateByPC;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 称重暂存位呼叫空转运架AGV任务
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
@Slf4j
|
||||
@Component(value = "CzzcCallEmptyAGVTask")
|
||||
public class CzzcCallEmptyAGVTask extends AbstractTask {
|
||||
private final String THIS_CLASS = CzzcCallEmptyAGVTask.class.getName();
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Override
|
||||
public void create() throws BadRequestException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createCompletion(SchBaseTask task) {
|
||||
// 查找货梯没任务有载具的点位
|
||||
List<SchBasePoint> startPoints = pointService.getAllBusinessNotTaskPoint("A1", "A1-LIFT-AREA",
|
||||
"1", "2", null);
|
||||
if (startPoints.size() == 0) {
|
||||
throw new BadRequestException("货梯没有可用点位!");
|
||||
}
|
||||
SchBasePoint point = startPoints.get(0);
|
||||
task.setPoint_code1(point.getPoint_code());
|
||||
// 创建任务
|
||||
task.setHandle_class(THIS_CLASS);
|
||||
task.setTask_status(TaskStatus.START_AND_POINT.getCode());
|
||||
setUpdateByPC(task);
|
||||
taskService.save(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
checkTaskOptionStatus(taskObj);
|
||||
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
checkTaskOptionStatus(taskObj);
|
||||
// 取消
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package org.nl.wms.sch.task_manage.tasks.other;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
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.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.TaskStatus;
|
||||
import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.core.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.wms.util.TaskUtils.checkTaskOptionStatus;
|
||||
import static org.nl.wms.util.TaskUtils.setUpdateByPC;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 废箔搬运任务
|
||||
* @Date: 2024/8/14
|
||||
*/
|
||||
@Slf4j
|
||||
@Component(value = "WasteFoilAGVTask")
|
||||
public class WasteFoilAGVTask extends AbstractTask {
|
||||
private final String THIS_CLASS = WasteFoilAGVTask.class.getName();
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
|
||||
@Override
|
||||
public void create() throws BadRequestException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createCompletion(SchBaseTask task) {
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject requestObj = JSONObject.parseObject(requestParam);
|
||||
int indexTask = requestObj.getInteger("index_task");
|
||||
JSONArray row = requestObj.getJSONArray("row");
|
||||
String stage = requestObj.getString("stage");
|
||||
String nowPointCode = row.getString(indexTask);
|
||||
requestObj.put("predict_next_point", (indexTask + 1) == row.size() ? '-' : row.getString(indexTask + 1));
|
||||
if ("first".equals(stage)) {
|
||||
// 第一次
|
||||
// 查找废箔起点
|
||||
List<SchBasePoint> fbPoints = pointService.getAllBusinessNotTaskPoint("A1", "A1-FB",
|
||||
"1", null, null);
|
||||
SchBasePoint fbPoint = fbPoints.get(0);
|
||||
task.setPoint_code1(fbPoint.getPoint_code());
|
||||
task.setPoint_code2(nowPointCode);
|
||||
} else if ("end".equals(stage)) {
|
||||
// 最后一次
|
||||
// 查找废箔终点
|
||||
List<SchBasePoint> fbPoints = pointService.getAllBusinessNotTaskPoint("A1", "A1-FB",
|
||||
"2", null, null);
|
||||
SchBasePoint fbPoint = fbPoints.get(0);
|
||||
task.setPoint_code1(row.getString(indexTask - 1));
|
||||
task.setPoint_code2(fbPoint.getPoint_code());
|
||||
requestObj.put("predict_next_point", '-');
|
||||
} else {
|
||||
// 中间次数
|
||||
task.setPoint_code1(row.getString(indexTask - 1));
|
||||
task.setPoint_code2(nowPointCode);
|
||||
}
|
||||
requestObj.put("now_point", nowPointCode);
|
||||
task.setRequest_param(requestObj.toJSONString());
|
||||
// 创建任务
|
||||
task.setHandle_class(THIS_CLASS);
|
||||
task.setTask_status(TaskStatus.START_AND_POINT.getCode());
|
||||
setUpdateByPC(task);
|
||||
taskService.save(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
checkTaskOptionStatus(taskObj);
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
checkTaskOptionStatus(taskObj);
|
||||
// 取消
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user