rev:修改所有代码状态判断根据枚举code判断

This commit is contained in:
2023-03-30 10:56:21 +08:00
parent 88f405b1ae
commit d257ecd96c
5 changed files with 70 additions and 45 deletions

View File

@@ -40,6 +40,12 @@ public enum StatusEnum {
POINT_LOCATION_REC("2","接料位",""),
POINT_LOCATION_FULL("3","满料位",""),
POINT_LOCATION_IN("4","上料位",""),
//出入料箱
IN_VEHICLE("1","入箱",""),
OUT_VEHICLE("2","出箱",""),
//出入料箱
PAUSE_CACHELINE("1","暂停",""),
START_CACHELINE("2","启动",""),
;
private String code;
private String desc;

View File

@@ -49,7 +49,7 @@ public class MobileAuthorizationController {
private final ISysRoleService roleService;
@ApiOperation("登录授权")
@PostMapping(value = "/login")
@PostMapping(value = "/login")
@SaIgnore
public ResponseEntity<Object> login(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request) throws Exception {
// 密码解密 - 前端的加密规则: encrypt根据实际更改

View File

@@ -35,7 +35,6 @@ import java.util.Map;
@Api(tags = "海亮缓存线手持服务")
@RequestMapping("/api/cacheLineHand")
@Slf4j
@SaIgnore
public class CacheLineHandController{
private final CacheLineHandService cacheLineHandService;
@@ -49,7 +48,7 @@ public class CacheLineHandController{
//限制查询参数过短,模糊力度大
int length = params.getBytes().length;
if(length < 3) {
throw new BizCoreException("您输入的条件匹配的范围太大,请重新输入稍长一点的内容。");
throw new BizCoreException("您输入的条件匹配的范围太大,请输入大于2个字的内容。");
}
}
return new ResponseEntity<>(cacheLineHandService.queryMaterial(params), HttpStatus.OK);
@@ -106,7 +105,7 @@ public class CacheLineHandController{
@PostMapping("/instPageQuery")
@Log("任务分页查询")
@ApiOperation("任务分页数据")
public ResponseEntity<Map<String,Object>> instPageQuery(@RequestBody Map<String,String> param, Pageable page) {
public ResponseEntity<Object> instPageQuery(@RequestBody Map<String,String> param, Pageable page) {
log.info("海亮缓存线手持服务 [任务分页查询] 接口被请求, 请求参数-{}", param);
if(null == param) {
throw new BizCoreException(ResultCode.MISS_PARAMETER);
@@ -181,7 +180,7 @@ public class CacheLineHandController{
@PostMapping("/inOutExceptionInstConfirm")
@Log("缓存线出入箱异常指令确认")
@ApiOperation("缓存线出入箱异常指令确认")
public ResponseEntity<String> inOutExceptionInstConfirm(@RequestBody JSONObject param) {
public ResponseEntity<Object> inOutExceptionInstConfirm(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出入箱异常指令确认] 接口被请求, 请求参数-{}", param);
//参数校验
if(StringUtils.isEmpty(param.getString("instruct_uuid")) || StringUtils.isEmpty(param.getString("inOut_type")) || StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
@@ -263,7 +262,7 @@ public class CacheLineHandController{
@PostMapping("/cacheLineExcepOpt")
@Log("缓存线异常处理")
@ApiOperation("缓存线异常处理")
public ResponseEntity<String> cacheLineExcepOpt(@RequestBody JSONObject param) {
public ResponseEntity<Object> cacheLineExcepOpt(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线异常处理] 接口被请求, 请求参数-{}", param);
//参数校验
if(StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("opt_type"))) {

View File

@@ -131,7 +131,7 @@ public interface CacheLineHandService{
* @author gbx
* @date 2023/3/24
*/
String inOutExceptionInstConfirm(JSONObject param);
Map<String, Object> inOutExceptionInstConfirm(JSONObject param);
/**
* 任务操作
@@ -245,7 +245,7 @@ public interface CacheLineHandService{
* @author gbx
* @date 2023/3/24
*/
String cacheLineExcepOpt(JSONObject param);
Map<String,Object> cacheLineExcepOpt(JSONObject param);
/**
* 倒料操作
@@ -254,7 +254,7 @@ public interface CacheLineHandService{
* @author gbx
* @date 2023/3/24
*/
void pourMaterial(JSONObject param);
Map<String,Object> pourMaterial(JSONObject param);
/**
* 缓存线下拉框

View File

@@ -16,7 +16,6 @@ import org.nl.common.enums.StatusEnum;
import org.nl.common.utils.*;
import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.exception.BizCoreException;
import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
@@ -26,12 +25,12 @@ import org.nl.wms.pda.dto.MaterialDto;
import org.nl.wms.pda.service.CacheLineHandService;
import org.nl.wms.sch.tasks.SpeMachineryTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.xml.transform.Result;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;
@@ -53,8 +52,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
private final RedisUtils redisUtils;
@Autowired
private LocalCache cache;
@Autowired
private ClassstandardService classstandardService;
@Value("${acs.url}")
private String acsUrl;
@Override
public JSONArray dropdownListQuery(String param, String type) {
@@ -115,7 +114,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
private List<MaterialDto> getMaterialDto(List<MaterialDto> materialList, String param) {
if(StringUtils.isNotEmpty(param)) {
//按条件搜索
materialList = materialList.stream().filter(m -> (m.getMaterial_name().indexOf(param) > -1) || (m.getMaterial_code().indexOf(param)) > -1 || (m.getMaterial_spec().indexOf(param)) > -1|| (m.getClass_name().indexOf(param)) > -1).collect(Collectors.toList());
materialList = materialList.stream().filter(m -> (m.getMaterial_name().indexOf(param) > -1) || (m.getMaterial_code().indexOf(param)) > -1 || (m.getMaterial_spec().indexOf(param)) > -1 || (m.getClass_name().indexOf(param)) > -1).collect(Collectors.toList());
return materialList;
}
return materialList;
@@ -194,12 +193,12 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
SpeMachineryTask SpeMachineryTask = new SpeMachineryTask();
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
JSONObject taskObject = taskTab.query("task_id =" + param.getString("instruct_uuid")).uniqueResult(0);
//01-取消、02-完成、03-任务下发,根据操作类型执行相关操作
if("1".equals(optType) || "2".equals(optType)) {
//1-取消、2-完成、3-任务下发,根据操作类型执行相关操作
if(StatusEnum.TASK_CANNEL.getCode().equals(optType) || StatusEnum.TASK_FINISH.getCode().equals(optType)) {
return updateTaskStatus(taskObject, optType);
}
//任务下发
else if("3".equals(optType)) {
else if(StatusEnum.TASK_PUBLISH.getCode().equals(optType)) {
return SpeMachineryTask.createTask(taskObject);
}
else{
@@ -256,7 +255,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
/**
* status = 0: 空位 status = 1 绿色空箱 || status = 2:黄色满箱 || status = 3:红色异常 || status = 4 :不展示
* status = 1: 空位 status = 2 绿色空箱 || status = 3:黄色满箱 || status = 4:红色异常 || status = 5 :不展示
*/
@Override
public JSONArray cacheLineMaterInfoQuery(JSONObject param) {
@@ -273,14 +272,14 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
json.put("weight", "0");
json.put("quantity", "0");
//不展示
if("0".equals(json.getString("is_show"))) {
json.put("vehicle_status", "4");
if(StatusEnum.CACHE_VEL_DIS.getCode().equals(json.getString("is_show"))) {
json.put("vehicle_status", StatusEnum.CACHE_VEL_DIS.getCode());
}
//展示
else{
//是否空位
if("1".equals(json.getString("is_empty"))) {
json.put("vehicle_status", "0");
if(StatusEnum.CACHE_VEL_NULL.getCode().equals(json.getString("is_empty"))) {
json.put("vehicle_status", StatusEnum.STATUS_FLASE.getCode());
}
else{
// 载具不是空位
@@ -289,7 +288,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
JSONObject ivtObj = ivtTab.query("vehicle_code = '" + vehicle_code + "' and cacheLine_code like '%" + param.getString("wcsdevice_code") + "%'").uniqueResult(0);
if(ivtObj == null) {
//标记为红色异常
json.put("vehicle_status", "3");
json.put("vehicle_status", StatusEnum.CACHE_VEL_ERR.getCode());
}
else{
json.put("vehicle_status", ivtObj.getString("vehicle_status"));
@@ -441,7 +440,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
//缓存线载具物料表
WQLObject vehMaterTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
// 入空箱
if("1".equals(inOut_type)) {
if(StatusEnum.IN_VEHICLE.getCode().equals(inOut_type)) {
// 1.判断是否可以放入空箱子
JSONObject ivtObj = positionTab.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
if(ivtObj != null) {
@@ -457,13 +456,13 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
afterIvt.put("vehmaterial_id", IdUtil.getStringId());
afterIvt.put("vehicle_code", vehicle_code);
afterIvt.put("cacheLine_code", cacheLine_code);
afterIvt.put("vehicle_status", "1");
afterIvt.put("vehicle_status", StatusEnum.STATUS_TRUE.getCode());
afterIvt.put("update_time", DateUtil.now());
afterIvt.put("create_time", DateUtil.now());
result = vehMaterTab.insert(afterIvt).getSucess();
}
// 出空箱
if("2".equals(inOut_type)) {
if(StatusEnum.OUT_VEHICLE.getCode().equals(inOut_type)) {
// 缓存线载具物料表
JSONObject json = vehMaterTab.query("cacheLine_code = '" + cacheLine_code + "'and vehicle_code = '" + vehicle_code + "' and vehicle_status= '1'").uniqueResult(0);
if(json == null) {
@@ -493,7 +492,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
JSONArray result = new JSONArray();
// 入箱扫码异常
if("1".equals(inOut_type)) {
if(StatusEnum.IN_VEHICLE.getCode().equals(inOut_type)) {
String where = "point_code2 = '" + wcsdevice_code + "' and task_status <> '7'";
if(StringUtils.isNotBlank(vehicle_code)) {
where = "point_code2 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
@@ -513,7 +512,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
}
// 出箱扫码异常
if("2".equals(inOut_type)) {
if(StatusEnum.OUT_VEHICLE.getCode().equals(inOut_type)) {
String where = "point_code1 = '" + wcsdevice_code + "' and task_status <> '7'";
if(StringUtils.isNotBlank(vehicle_code)) {
where = "point_code1 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
@@ -536,13 +535,14 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
/**
* 扫码异常确认
* 出入类型 inOut_type 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
* 缓存线编码 wcsdevice_code
* 缓存线位置编码 position_code
* 料箱码 vehicle_code
*/
@Override
public String inOutExceptionInstConfirm(JSONObject param) {
public Map<String,Object> inOutExceptionInstConfirm(JSONObject param) {
// 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
String inOut_type = param.getString("inOut_type");
// 缓存线编码
@@ -554,33 +554,48 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
// 封装给acs的数据
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
// 1 扫码异常-入箱扫码 2 出箱扫码
jsonObject.put("inOut_type", inOut_type);
//缓存线编号
jsonObject.put("wcsdevice_code", wcsdevice_code);
//料箱码
jsonObject.put("vehicle_code", vehicle_code);
//缓存线点位编码
jsonObject.put("position_code", position_code);
jsonArray.add(jsonObject);
//TOFIX 等确定api后换成下发的url
return AcsUtil.notifyAcs("api", jsonArray).getString("status");
try {
//TOFIX 等确定api后换成下发的url
return AcsUtil.notifyAcs(acsUrl, jsonArray);
}
catch(NullPointerException e) {
throw new BadRequestException(e.toString());
}
}
@Override
public String cacheLineExcepOpt(JSONObject param) {
public Map<String,Object> cacheLineExcepOpt(JSONObject param) {
// 缓存线编码
String wcsdevice_code = param.getString("wcsdevice_code");
// 1-暂停、2-启动
// opt_type 1-暂停、2-启动,默认为1暂停
String type = StatusEnum.PAUSE_CACHELINE.getCode();
String opt_type = param.getString("opt_type");
// 类型:恢复是0暂停是1
String type = "1";
if("2".equals(opt_type)) {
if(StatusEnum.START_CACHELINE.getCode().equals(opt_type)) {
type = "0";
}
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
//下发接收的恢复是0暂停是1
jsonObject.put("type", type);
//缓存线编码
jsonObject.put("wcsdevice_code", wcsdevice_code);
jsonArray.add(jsonObject);
//TOFIX 等确定api后换成下发的url
return AcsUtil.notifyAcs("api", jsonArray).getString("status");
try {
//TOFIX 等确定api后换成下发的url
return AcsUtil.notifyAcs(acsUrl, jsonArray);
}
catch(NullPointerException e) {
throw new BadRequestException(e.toString());
}
}
/**
@@ -646,7 +661,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
json.put("vehmaterial_id", IdUtil.getStringId());
json.put("create_time", DateUtil.now());
// 入满箱扫码异常
if("1".equals(inOut_type)) {
if(StatusEnum.IN_VEHICLE.getCode().equals(inOut_type)) {
//5.通过缓存线位置表当前执行任务id获取任务信息中的物料信息
JSONObject positionInfo = positionTab.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
//查不到点位信息
@@ -672,12 +687,12 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
json.put("material_name", meObj.getString("material_name"));
json.put("quantity", instructObj.getString("material_qty"));
json.put("product_area", instructObj.getString("product_area"));
json.put("vehicle_status", "2");
json.put("vehicle_status", StatusEnum.CACHE_VEL_EMT.getCode());
}
// 出满箱扫码异常
if("2".equals(inOut_type)) {
if(StatusEnum.OUT_VEHICLE.getCode().equals(inOut_type)) {
//5.重新新建该缓存线位置上的料箱为空箱子,是空料箱没有放物料等其他信息
json.put("vehicle_status", "1");
json.put("vehicle_status", StatusEnum.STATUS_TRUE.getCode());
json.put("material_uuid", "");
json.put("material_code", "");
json.put("material_spec", "");
@@ -798,7 +813,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
@Override
public void pourMaterial(JSONObject param) {
public Map<String,Object> pourMaterial(JSONObject param) {
// 指令标识
String instruct_uuid = param.getString("instruct_uuid");
// 指令点位表【sch_base_task】
@@ -810,8 +825,13 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
jsonObject.put("producer", producer);
jsonObject.put("putquantity", putquantity);
jsonArray.add(jsonObject);
//TOFIX 等确定api后换成下发的url
AcsUtil.notifyAcs("api", jsonArray);
try {
//TOFIX 等确定api后换成下发的url
return AcsUtil.notifyAcs(acsUrl, jsonArray);
}
catch(NullPointerException e) {
throw new BadRequestException(e.toString());
}
}
@Override