rev: 对照马钢LMS - 点位管理、工单管理、任务工厂类、组盘表
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package org.nl.wms.ext.acs.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
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: acs请求lms接口
|
||||
* @Date: 2023/6/16
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "acs请求lms")
|
||||
@RequestMapping("/api/wms")
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class AcsToWmsController {
|
||||
@Autowired
|
||||
private AcsToWmsService acsToWmsService;
|
||||
|
||||
@PostMapping("/apply")
|
||||
@Log("新增任务管理")
|
||||
@ApiOperation("新增任务管理")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> apply(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(acsToWmsService.acsApply(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.nl.wms.ext.acs.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: acs请求wms
|
||||
* @Date: 2023/6/26
|
||||
*/
|
||||
public interface AcsToWmsService {
|
||||
/** ACS请求接口 */
|
||||
BaseResponse acsApply(JSONObject param);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.nl.wms.ext.acs.service;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: mes请求wms
|
||||
* @Date: 2023/8/3
|
||||
*/
|
||||
public interface MesToWmsService {
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.nl.wms.ext.acs.service;
|
||||
|
||||
import org.nl.wms.ext.acs.service.dto.ResultForAcs;
|
||||
import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest;
|
||||
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
|
||||
import org.nl.wms.pdm.workorder.service.dao.vo.AcsWorkOrderVo;
|
||||
import org.nl.wms.sch.task_manage.AcsTaskDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: Wms请求Acs,统一管理与ACS对接的接口
|
||||
* @Date: 2023/6/30
|
||||
*/
|
||||
public interface WmsToAcsService {
|
||||
|
||||
/**
|
||||
* 下发工单
|
||||
* @param list: 工单链表
|
||||
* @return
|
||||
*/
|
||||
AcsResponse order(List<AcsWorkOrderVo> list);
|
||||
/**
|
||||
* 下发任务
|
||||
* 统一在这里维护
|
||||
* @param list: 任务链表
|
||||
* @return
|
||||
*/
|
||||
AcsResponse renotifyAcs(List<AcsTaskDto> list);
|
||||
|
||||
/**
|
||||
* 下发信号 - 覆膜机释放托盘
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
ResultForAcs getVehicleForLaminatingMachine(List<PutActionRequest> list);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.nl.wms.ext.acs.service;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: wms请求acs
|
||||
* @Date: 2023/8/3
|
||||
*/
|
||||
public interface WmsToMesService {
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.nl.wms.ext.acs.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseRequest;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 砖信息实体
|
||||
* @Date: 2023/7/18
|
||||
*/
|
||||
@Data
|
||||
public class BrickInfoDto extends BaseRequest {
|
||||
/** 当前抓取工位 **/
|
||||
private String get_station;
|
||||
/** 当前放置工位 **/
|
||||
private String put_station;
|
||||
/** 是否合格 **/
|
||||
private String is_qualified;
|
||||
/** 激光标刻码 **/
|
||||
private String laser_marking_code;
|
||||
/** 碾次 **/
|
||||
private String grinding_number;
|
||||
/** 高度1 **/
|
||||
private String height1;
|
||||
/** 高度2 **/
|
||||
private String height2;
|
||||
/** 高度3 **/
|
||||
private String height3;
|
||||
/** 高度4 **/
|
||||
private String height4;
|
||||
/** 宽度1 **/
|
||||
private String width1;
|
||||
/** 宽度2 **/
|
||||
private String width2;
|
||||
/** 长度 **/
|
||||
private String len;
|
||||
/** 体积 **/
|
||||
private String volume;
|
||||
/** 平面度 **/
|
||||
private String flatness;
|
||||
/** 缺陷个数 **/
|
||||
private String unqualified_qty;
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package org.nl.wms.ext.acs.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 垛型参数
|
||||
* @Date: 2023/7/18
|
||||
*/
|
||||
@Data
|
||||
public class PalletizeDto {
|
||||
/** 产品编号 */
|
||||
private String product_code;
|
||||
/** A长边 */
|
||||
private String AlongSide;
|
||||
/** B短边 */
|
||||
private String BshortSide;
|
||||
/** H梯形高 */
|
||||
private String Htrapezoidal;
|
||||
/** W厚度 */
|
||||
private String Wthickness;
|
||||
/** 当前垛盘数 */
|
||||
private String tray_qty;
|
||||
/** 垛盘高度 */
|
||||
private String tray_high;
|
||||
/** 垛型类别 */
|
||||
private String crib_category;
|
||||
/** 码垛X1行 */
|
||||
private String palletX1_line;
|
||||
/** 码垛Y1列 */
|
||||
private String palletY1_row;
|
||||
/** 码垛A1角度 */
|
||||
private String palletA1_angle;
|
||||
/** 码垛X2行 */
|
||||
private String palletX2_line;
|
||||
/** 码垛Y2列 */
|
||||
private String palletY2_row;
|
||||
/** 码垛A2角度 */
|
||||
private String palletA2_angle;
|
||||
/** 码垛X3行 */
|
||||
private String palletX3_line;
|
||||
/** 码垛Y3列 */
|
||||
private String palletY3_row;
|
||||
/** 码垛A3角度 */
|
||||
private String palletA3_angle;
|
||||
/** 压垛X1行 */
|
||||
private String pressCribX1_line;
|
||||
/** 压垛Y1列 */
|
||||
private String pressCribY1_row;
|
||||
/** 压垛A1角度 */
|
||||
private String pressCribA1_angle;
|
||||
/** 压垛X2行 */
|
||||
private String pressCribX2_line;
|
||||
/** 压垛Y2列 */
|
||||
private String pressCribY2_row;
|
||||
/** 压垛A2角度 */
|
||||
private String pressCribA2_angle;
|
||||
/** 压垛X3行 */
|
||||
private String pressCribX3_line;
|
||||
/** 压垛Y3列 */
|
||||
private String pressCribY3_row;
|
||||
/** 压垛A3角度 */
|
||||
private String pressCribA3_angle;
|
||||
/** Z轴偏移 */
|
||||
private String Zoffset;
|
||||
/** 码垛层数 */
|
||||
private String pallet_layerQty;
|
||||
/** 压垛层数 */
|
||||
private String pressCrib_layerQty;
|
||||
/** 码层X1间隔 */
|
||||
private String codeLayerX1_interval;
|
||||
/** 码层Y1间隔 */
|
||||
private String codeLayerY1_interval;
|
||||
/** 码层X2间隔 */
|
||||
private String codeLayerX2_interval;
|
||||
/** 码层Y2间隔 */
|
||||
private String codeLayerY2_interval;
|
||||
/** 码层X3间隔 */
|
||||
private String codeLayerX3_interval;
|
||||
/** 码层Y3间隔 */
|
||||
private String codeLayerY3_interval;
|
||||
/** 码层X1偏移 */
|
||||
private String codeLayerX1_offset;
|
||||
/** 码层Y1偏移 */
|
||||
private String codeLayerY1_offset;
|
||||
/** 码层X2偏移 */
|
||||
private String codeLayerX2_offset;
|
||||
/** 码层Y2偏移 */
|
||||
private String codeLayerY2_offset;
|
||||
/** 码层X3偏移 */
|
||||
private String codeLayerX3_offset;
|
||||
/** 码层Y3偏移 */
|
||||
private String codeLayerY3_offset;
|
||||
/** 压层X1间隔 */
|
||||
private String pressLayerX1_interval;
|
||||
/** 压层Y1间隔 */
|
||||
private String pressLayerY1_interval;
|
||||
/** 压层X2间隔 */
|
||||
private String pressLayerX2_interval;
|
||||
/** 压层Y2间隔 */
|
||||
private String pressLayerY2_interval;
|
||||
/** 压层X3间隔 */
|
||||
private String pressLayerX3_interval;
|
||||
/** 压层Y3间隔 */
|
||||
private String pressLayerY3_interval;
|
||||
/** 压层X1偏移 */
|
||||
private String pressLayerX1_offset;
|
||||
/** 压层Y1偏移 */
|
||||
private String pressLayerY1_offset;
|
||||
/** 压层X2偏移 */
|
||||
private String pressLayerX2_offset;
|
||||
/** 压层Y2偏移 */
|
||||
private String pressLayerY2_offset;
|
||||
/** 压层X3偏移 */
|
||||
private String pressLayerX3_offset;
|
||||
/** 压层Y3偏移 */
|
||||
private String pressLayerY3_offset;
|
||||
/** 工具坐标 */
|
||||
private String tool_coordinate;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.nl.wms.ext.acs.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 调用立库接口统一返回参数类
|
||||
*
|
||||
* @author: geng by
|
||||
* @createDate: 2022/11/24
|
||||
*/
|
||||
@Data
|
||||
public class Resp<T> {
|
||||
/**
|
||||
* 成功返回true,失败返回false
|
||||
*/
|
||||
public String result;
|
||||
|
||||
/**
|
||||
* 错误码(0表示成功)1代表入库目的位置有货,其他更多情况待定
|
||||
*/
|
||||
public String code;
|
||||
|
||||
/**
|
||||
* 错误信息,如果成功则为null
|
||||
*/
|
||||
public String comment;
|
||||
|
||||
/**
|
||||
* 报文携带的数据
|
||||
*/
|
||||
public T data;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.nl.wms.ext.acs.service.dto;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 统一接口返回 - 请求ACS返回的数据类型 - 以前不做处理的类型
|
||||
* @Date: 2023/7/28
|
||||
*/
|
||||
@Data
|
||||
public class ResultForAcs {
|
||||
private int status;
|
||||
private String message;
|
||||
private String timestamp;
|
||||
private JSONObject data;
|
||||
private JSONArray errArr;
|
||||
|
||||
public static ResultForAcs requestRefuse(String message) {
|
||||
ResultForAcs result = new ResultForAcs();
|
||||
result.setStatus(HttpStatus.HTTP_BAD_REQUEST);
|
||||
result.setMessage(message);
|
||||
result.setTimestamp(DateUtil.now());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ResultForAcs requestOk() {
|
||||
ResultForAcs result = new ResultForAcs();
|
||||
result.setStatus(HttpStatus.HTTP_OK);
|
||||
result.setMessage("请求成功");
|
||||
result.setTimestamp(DateUtil.now());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ResultForAcs requestOk(String message, JSONObject data) {
|
||||
ResultForAcs result = new ResultForAcs();
|
||||
result.setStatus(HttpStatus.HTTP_OK);
|
||||
result.setMessage(message);
|
||||
result.setTimestamp(DateUtil.now());
|
||||
result.setData(data);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.nl.wms.ext.acs.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 信号:mode:'1', move:'0'之类
|
||||
* @Date: 2023/7/26
|
||||
*/
|
||||
@Data
|
||||
public class SignalData {
|
||||
|
||||
private String code; // to_command
|
||||
|
||||
private String value; // 1
|
||||
|
||||
public static SignalData buildSignalData(String code, String value) {
|
||||
SignalData signalData = new SignalData();
|
||||
signalData.setCode(code);
|
||||
signalData.setValue(value);
|
||||
return signalData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.nl.wms.ext.acs.service.dto.to;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ACS请求基础实体
|
||||
*/
|
||||
@Data
|
||||
public class BaseRequest {
|
||||
|
||||
/**
|
||||
* 请求号:uuid 唯一,LMS需要返回对应值
|
||||
*/
|
||||
private String requestNo;
|
||||
|
||||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
private String requestDate;
|
||||
|
||||
/**
|
||||
* 请求方法编号
|
||||
*/
|
||||
private String request_medthod_code;
|
||||
|
||||
/**
|
||||
* 请求方法名称
|
||||
*/
|
||||
private String request_medthod_name;
|
||||
|
||||
/**
|
||||
* 设备号
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
|
||||
/**
|
||||
* 系统编号
|
||||
*/
|
||||
private String systemCode;
|
||||
|
||||
/**
|
||||
* 扩展参数:砖型等
|
||||
*/
|
||||
private Map<String, String> parameters = new HashMap();
|
||||
|
||||
public static BaseRequest createRequest() {
|
||||
BaseRequest baseRequest = new BaseRequest();
|
||||
baseRequest.setRequestNo(IdUtil.simpleUUID());
|
||||
baseRequest.setRequestDate(DateUtil.now());
|
||||
return baseRequest;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package org.nl.wms.ext.acs.service.dto.to;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BaseResponse implements Serializable {
|
||||
|
||||
/**
|
||||
* 请求号
|
||||
*/
|
||||
private String requestNo;
|
||||
|
||||
/**
|
||||
* 响应时间
|
||||
*/
|
||||
private String responseDate;
|
||||
|
||||
/**
|
||||
* 结果 200成功
|
||||
*/
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* 信息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 扩展信息
|
||||
*/
|
||||
private Map<String, String> parameters = new HashMap();
|
||||
|
||||
public static BaseResponse build(String requestNo) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setRequestNo(requestNo);
|
||||
response.setCode(HttpStatus.HTTP_OK);
|
||||
response.setMessage("请求成功");
|
||||
response.setResponseDate(DateUtil.now());
|
||||
return response;
|
||||
}
|
||||
|
||||
public static BaseResponse responseOk(String requestNo) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setRequestNo(requestNo);
|
||||
response.setCode(HttpStatus.HTTP_OK);
|
||||
response.setMessage("请求成功");
|
||||
response.setResponseDate(DateUtil.now());
|
||||
return response;
|
||||
}
|
||||
public static BaseResponse responseOk(String requestNo, String message) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setRequestNo(requestNo);
|
||||
response.setCode(HttpStatus.HTTP_OK);
|
||||
response.setMessage(message);
|
||||
response.setResponseDate(DateUtil.now());
|
||||
return response;
|
||||
}
|
||||
public static BaseResponse responseOk(String requestNo, HashMap<String, String> parameters) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setRequestNo(requestNo);
|
||||
response.setCode(HttpStatus.HTTP_OK);
|
||||
response.setMessage("请求成功");
|
||||
response.setResponseDate(DateUtil.now());
|
||||
response.setParameters(parameters);
|
||||
return response;
|
||||
}
|
||||
|
||||
public static BaseResponse responseError(String requestNo, String message) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setRequestNo(requestNo);
|
||||
response.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
response.setMessage(message);
|
||||
response.setResponseDate(DateUtil.now());
|
||||
return response;
|
||||
}
|
||||
public static BaseResponse responseError(String requestNo, int code, String message) {
|
||||
BaseResponse response = new BaseResponse();
|
||||
response.setRequestNo(requestNo);
|
||||
response.setCode(code);
|
||||
response.setMessage(message);
|
||||
response.setResponseDate(DateUtil.now());
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.nl.wms.ext.acs.service.dto.to.acs;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import lombok.Data;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
|
||||
@Data
|
||||
public class ApplyTaskResponse extends BaseResponse {
|
||||
/**
|
||||
* 是否静置完成 1完成
|
||||
*/
|
||||
private String is_standing_finish;
|
||||
|
||||
/**
|
||||
* 是否优先包装
|
||||
*/
|
||||
private String is_package;
|
||||
private String mix_number;
|
||||
|
||||
public static ApplyTaskResponse responseOk(String requestNo) {
|
||||
ApplyTaskResponse response = new ApplyTaskResponse();
|
||||
response.setRequestNo(requestNo);
|
||||
response.setMessage("任务申请成功");
|
||||
response.setResponseDate(DateUtil.now());
|
||||
response.setCode(HttpStatus.HTTP_OK);
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.nl.wms.ext.acs.service.dto.to.acs;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import lombok.Data;
|
||||
import org.nl.wms.ext.acs.service.dto.SignalData;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 提供设备信号 lms->acs
|
||||
* @Date: 2023/7/26
|
||||
*/
|
||||
@Data
|
||||
public class PutActionRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 设备号
|
||||
*/
|
||||
private String device_code;
|
||||
private String vehicle_type;
|
||||
|
||||
/**
|
||||
* 信号数据
|
||||
*/
|
||||
private List<SignalData> list;
|
||||
|
||||
public static PutActionRequest createRequest() {
|
||||
PutActionRequest baseRequest = new PutActionRequest();
|
||||
baseRequest.setRequestNo(IdUtil.simpleUUID());
|
||||
baseRequest.setRequestDate(DateUtil.now());
|
||||
return baseRequest;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.nl.wms.ext.acs.service.dto.to.wms;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import lombok.Data;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 下发acs的反馈数据*new
|
||||
* @Date: 2023/7/26
|
||||
*/
|
||||
@Data
|
||||
public class AcsResponse extends BaseResponse {
|
||||
private JSONArray errArr = new JSONArray();
|
||||
|
||||
public static AcsResponse requestRefuse(String message) {
|
||||
AcsResponse result = new AcsResponse();
|
||||
result.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
result.setMessage(message);
|
||||
result.setResponseDate(DateUtil.now());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static AcsResponse requestOk() {
|
||||
AcsResponse result = new AcsResponse();
|
||||
result.setCode(HttpStatus.HTTP_OK);
|
||||
result.setMessage("请求成功");
|
||||
result.setResponseDate(DateUtil.now());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.nl.wms.ext.acs.service.dto.to.wms;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2023/8/14
|
||||
*/
|
||||
@Data
|
||||
public class ApplyDeviceDto {
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private String qty;
|
||||
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 载具类型
|
||||
*/
|
||||
private String vehicle_type;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.database.material.service.IMdBaseMaterialService;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.ext.record.service.ISysInteractRecordService;
|
||||
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.TaskFactory;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: acs请求wms的实现类
|
||||
* @Date: 2023/6/26
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private ISysInteractRecordService interactRecordService;
|
||||
|
||||
@Override
|
||||
public BaseResponse acsApply(JSONObject param) {
|
||||
String requestNo = param.getString("requestNo");
|
||||
String requestMethodName = param.getString("request_medthod_name");
|
||||
BaseResponse result = BaseResponse.build(requestNo);
|
||||
try {
|
||||
String requestMethodCode = param.getString("request_medthod_code"); // 获取请求方法名
|
||||
if (ObjectUtil.isEmpty(requestMethodCode)) {
|
||||
throw new BadRequestException("请求参数错误");
|
||||
}
|
||||
Method method = this.getClass().getMethod(StrUtil.toCamelCase(requestMethodCode), JSONObject.class);
|
||||
result = (BaseResponse) method.invoke(this, param);
|
||||
} catch (Exception e) {
|
||||
String message = ObjectUtil.isEmpty(e.getMessage())
|
||||
? ((InvocationTargetException) e).getTargetException().getMessage()
|
||||
: e.getMessage();
|
||||
log.error("ACS请求LMS出现错误: {}", message);
|
||||
result.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
result.setMessage(message);
|
||||
result.setRequestNo(requestNo);
|
||||
// 消息通知
|
||||
noticeService.createNotice("异常信息:" + message, "acsApply: " + param.getString("request_medthod_code"),
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
}
|
||||
// acs对接记录
|
||||
interactRecordService.saveRecord(requestMethodName, param, result, GeneralDefinition.ACS_LMS);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.ext.acs.service.MesToWmsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2023/8/3
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MesToWmsServiceImpl implements MesToWmsService {
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.acs.service.dto.ResultForAcs;
|
||||
import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest;
|
||||
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
|
||||
import org.nl.wms.ext.record.service.ISysInteractRecordService;
|
||||
import org.nl.wms.pdm.workorder.service.dao.vo.AcsWorkOrderVo;
|
||||
import org.nl.wms.sch.task_manage.AcsTaskDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: WMS请求ACS - 业务开发
|
||||
* @Date: 2023/6/30
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
@Autowired
|
||||
private ISysInteractRecordService interactRecordService;
|
||||
@Override
|
||||
public AcsResponse order(List<AcsWorkOrderVo> list) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AcsResponse renotifyAcs(List<AcsTaskDto> list) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultForAcs getVehicleForLaminatingMachine(List<PutActionRequest> list) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.ext.acs.service.WmsToMesService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2023/8/3
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.nl.wms.ext.record.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.ext.record.service.ISysInteractRecordService;
|
||||
import org.nl.wms.ext.record.service.dao.SysInteractRecord;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-07-19
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "外部系统接口记录管理")
|
||||
@RequestMapping("/api/sysInteractRecord")
|
||||
public class SysInteractRecordController {
|
||||
|
||||
@Autowired
|
||||
private ISysInteractRecordService sysInteractRecordService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询外部系统接口记录")
|
||||
@ApiOperation("查询外部系统接口记录")
|
||||
//@SaCheckPermission("@el.check('sysInteractRecord:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(sysInteractRecordService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增外部系统接口记录")
|
||||
@ApiOperation("新增外部系统接口记录")
|
||||
//@SaCheckPermission("@el.check('sysInteractRecord:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SysInteractRecord entity){
|
||||
sysInteractRecordService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改外部系统接口记录")
|
||||
@ApiOperation("修改外部系统接口记录")
|
||||
//@SaCheckPermission("@el.check('sysInteractRecord:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody SysInteractRecord entity){
|
||||
sysInteractRecordService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除外部系统接口记录")
|
||||
@ApiOperation("删除外部系统接口记录")
|
||||
//@SaCheckPermission("@el.check('sysInteractRecord:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
sysInteractRecordService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package org.nl.wms.ext.record.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.ext.acs.service.dto.ResultForAcs;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.ext.record.service.dao.SysInteractRecord;
|
||||
import org.nl.wms.pdm.workorder.service.dao.vo.AcsWorkOrderVo;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2023-07-19
|
||||
**/
|
||||
public interface ISysInteractRecordService extends IService<SysInteractRecord> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<SysInteractRecord>
|
||||
*/
|
||||
IPage<SysInteractRecord> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(SysInteractRecord entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(SysInteractRecord entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 创建记录
|
||||
*/
|
||||
void saveRecord(Object request, BaseResponse response, String direction);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param workorder
|
||||
* @param resultForAcs
|
||||
* @param direction
|
||||
*/
|
||||
void saveRecord(AcsWorkOrderVo workorder, ResultForAcs resultForAcs, String direction);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @param request
|
||||
* @param response
|
||||
* @param direction
|
||||
*/
|
||||
<K, V> void saveRecord(String name, K request, V response, String direction);
|
||||
|
||||
void deleteByDay(String day);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package org.nl.wms.ext.record.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2023-07-19
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("sys_interact_record")
|
||||
public class SysInteractRecord implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "interact_id", type = IdType.NONE)
|
||||
@ApiModelProperty(value = "对接标识")
|
||||
private String interact_id;
|
||||
|
||||
@ApiModelProperty(value = "对接名称")
|
||||
private String interact_name;
|
||||
|
||||
@ApiModelProperty(value = "响应编码")
|
||||
private int code;
|
||||
|
||||
@ApiModelProperty(value = "响应信息")
|
||||
private String message;
|
||||
|
||||
@ApiModelProperty(value = "请求报文")
|
||||
private String request_param;
|
||||
|
||||
@ApiModelProperty(value = "响应结果")
|
||||
private String response_param;
|
||||
|
||||
@ApiModelProperty(value = "记录时间")
|
||||
private String record_time;
|
||||
|
||||
@ApiModelProperty(value = "方向")
|
||||
private String direction;
|
||||
|
||||
@ApiModelProperty(value = "是否成功")
|
||||
private Boolean is_success;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.nl.wms.ext.record.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.ext.record.service.dao.SysInteractRecord;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-07-19
|
||||
**/
|
||||
public interface SysInteractRecordMapper extends BaseMapper<SysInteractRecord> {
|
||||
|
||||
void deleteByDay(String day);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?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.ext.record.service.dao.mapper.SysInteractRecordMapper">
|
||||
|
||||
<delete id="deleteByDay">
|
||||
DELETE FROM sys_interact_record
|
||||
WHERE record_time <![CDATA[<=]]> DATE_SUB(NOW(), INTERVAL #{day} DAY);
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.nl.wms.ext.record.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2023-07-19
|
||||
**/
|
||||
@Data
|
||||
public class SysInteractRecordDto implements Serializable {
|
||||
|
||||
/** 对接标识 */
|
||||
private String interact_id;
|
||||
|
||||
/** 对接编码 */
|
||||
private String interact_code;
|
||||
|
||||
/** 响应编码 */
|
||||
private String code;
|
||||
|
||||
/** 响应信息 */
|
||||
private String message;
|
||||
|
||||
/** 请求报文 */
|
||||
private String request_param;
|
||||
|
||||
/** 响应结果 */
|
||||
private String response_param;
|
||||
|
||||
/** 记录时间 */
|
||||
private String record_time;
|
||||
|
||||
/** 方向 */
|
||||
private String direction;
|
||||
|
||||
/** 是否成功 */
|
||||
private Boolean is_success;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.ext.record.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.ext.record.service.dao.SysInteractRecord;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-07-19
|
||||
**/
|
||||
public class SysInteractRecordQuery extends BaseQuery<SysInteractRecord> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package org.nl.wms.ext.record.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext.acs.service.dto.ResultForAcs;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
|
||||
import org.nl.wms.ext.record.service.ISysInteractRecordService;
|
||||
import org.nl.wms.ext.record.service.dao.SysInteractRecord;
|
||||
import org.nl.wms.ext.record.service.dao.mapper.SysInteractRecordMapper;
|
||||
import org.nl.wms.pdm.workorder.service.dao.vo.AcsWorkOrderVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2023-07-19
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SysInteractRecordServiceImpl extends ServiceImpl<SysInteractRecordMapper, SysInteractRecord> implements ISysInteractRecordService {
|
||||
|
||||
@Autowired
|
||||
private SysInteractRecordMapper sysInteractRecordMapper;
|
||||
|
||||
@Override
|
||||
public IPage<SysInteractRecord> queryAll(Map whereJson, PageQuery page){
|
||||
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? whereJson.get("blurry").toString() : null;
|
||||
String interactDirection = ObjectUtil.isNotEmpty(whereJson.get("interact_direction")) ? whereJson.get("interact_direction").toString() : null;
|
||||
LambdaQueryWrapper<SysInteractRecord> lam = new LambdaQueryWrapper<>();
|
||||
lam.eq(interactDirection!=null, SysInteractRecord::getDirection, interactDirection)
|
||||
.and(blurry != null, s -> s.like(SysInteractRecord::getInteract_name, blurry)
|
||||
.or()
|
||||
.like(SysInteractRecord::getMessage, blurry)
|
||||
.or()
|
||||
.like(SysInteractRecord::getRequest_param, blurry)
|
||||
.or()
|
||||
.like(SysInteractRecord::getResponse_param, blurry));
|
||||
lam.orderByDesc(SysInteractRecord::getRecord_time);
|
||||
IPage<SysInteractRecord> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
sysInteractRecordMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(SysInteractRecord entity) {
|
||||
|
||||
entity.setInteract_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
sysInteractRecordMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(SysInteractRecord entity) {
|
||||
SysInteractRecord dto = sysInteractRecordMapper.selectById(entity.getInteract_id());
|
||||
if (dto == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
sysInteractRecordMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
sysInteractRecordMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveRecord(Object param, BaseResponse response, String direction) {
|
||||
SysInteractRecord entity = new SysInteractRecord();
|
||||
entity.setInteract_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setInteract_name(response.getRequestNo());
|
||||
entity.setCode(response.getCode());
|
||||
entity.setMessage(response.getMessage());
|
||||
entity.setRecord_time(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS"));
|
||||
entity.setDirection(direction);
|
||||
entity.setRequest_param(JSONObject.toJSONString(param));
|
||||
entity.setResponse_param(JSONObject.toJSONString(response));
|
||||
entity.setIs_success(response.getCode() == HttpStatus.HTTP_OK);
|
||||
sysInteractRecordMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveRecord(AcsWorkOrderVo workorder, ResultForAcs resultForAcs, String lmsAcs) {
|
||||
SysInteractRecord entity = new SysInteractRecord();
|
||||
entity.setInteract_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setInteract_name(workorder.getWorkorder_code());
|
||||
entity.setCode(resultForAcs.getStatus());
|
||||
entity.setMessage(resultForAcs.getMessage());
|
||||
entity.setRecord_time(DateUtil.now());
|
||||
entity.setDirection(lmsAcs);
|
||||
entity.setRequest_param(JSONObject.toJSONString(workorder));
|
||||
entity.setResponse_param(JSONObject.toJSONString(resultForAcs));
|
||||
entity.setIs_success(resultForAcs.getStatus() == HttpStatus.HTTP_OK);
|
||||
sysInteractRecordMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <K, V> void saveRecord(String name, K request, V response, String direction) {
|
||||
SysInteractRecord entity = new SysInteractRecord();
|
||||
entity.setInteract_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setRecord_time(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS"));
|
||||
entity.setInteract_name(name);
|
||||
entity.setDirection(direction);
|
||||
entity.setRequest_param(JSONObject.toJSONString(request));
|
||||
entity.setResponse_param(JSONObject.toJSONString(response));
|
||||
if (response instanceof BaseResponse) { // acs请求wms的返回数据
|
||||
BaseResponse re = (BaseResponse) response;
|
||||
entity.setCode(re.getCode());
|
||||
entity.setMessage(re.getMessage());
|
||||
entity.setIs_success(re.getCode() == HttpStatus.HTTP_OK);
|
||||
}
|
||||
if (response instanceof ResultForAcs) { // wms请求acs的返回数据
|
||||
ResultForAcs re = (ResultForAcs) response;
|
||||
entity.setCode(re.getStatus());
|
||||
entity.setMessage(re.getMessage());
|
||||
entity.setIs_success(re.getStatus() == HttpStatus.HTTP_OK);
|
||||
}
|
||||
if (response instanceof AcsResponse) { // wms请求acs的返回数据
|
||||
AcsResponse re = (AcsResponse) response;
|
||||
entity.setCode(re.getCode());
|
||||
entity.setMessage(re.getMessage());
|
||||
entity.setIs_success(re.getCode() == HttpStatus.HTTP_OK);
|
||||
}
|
||||
sysInteractRecordMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByDay(String day) {
|
||||
sysInteractRecordMapper.deleteByDay(day);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package org.nl.wms.pdm.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pdm.service.dto.PdmBdWorkorderQuery;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-05-05
|
||||
**/
|
||||
public interface PdmBdWorkorderMapper extends BaseMapper<PdmBdWorkorder> {
|
||||
|
||||
IPage<PdmBdWorkorder> selectPageLeftJoin(IPage<PdmBdWorkorder> pages, PdmBdWorkorderQuery query);
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package org.nl.wms.pdm.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pdm.service.dao.mapper.PdmBdWorkorderMapper;
|
||||
import org.nl.wms.pdm.service.dto.PdmBdWorkorderQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2023-05-05
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper, PdmBdWorkorder> implements IPdmBdWorkorderService {
|
||||
|
||||
@Autowired
|
||||
private PdmBdWorkorderMapper pdmBdWorkorderMapper;
|
||||
|
||||
@Override
|
||||
public IPage<PdmBdWorkorder> queryAll(PdmBdWorkorderQuery query, PageQuery page){
|
||||
IPage<PdmBdWorkorder> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
pages = pdmBdWorkorderMapper.selectPageLeftJoin(pages, query);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(PdmBdWorkorder entity) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
// 点位编码和点位名称为父点位
|
||||
|
||||
entity.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setWorkorder_code(CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
||||
entity.setCreate_id(currentUserId);
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
pdmBdWorkorderMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(PdmBdWorkorder entity) {
|
||||
PdmBdWorkorder dto = pdmBdWorkorderMapper.selectById(entity.getWorkorder_id());
|
||||
if (dto == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
|
||||
pdmBdWorkorderMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
pdmBdWorkorderMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.pdm.controller;
|
||||
package org.nl.wms.pdm.workorder.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -6,9 +6,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pdm.service.dto.PdmBdWorkorderQuery;
|
||||
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pdm.workorder.service.dto.PdmBdWorkorderQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -63,4 +63,12 @@ public class PdmBdWorkorderController {
|
||||
pdmBdWorkorderService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/submits")
|
||||
@Log("工单下发")
|
||||
@ApiOperation("工单下发")
|
||||
public ResponseEntity<Object> submits(@RequestBody PdmBdWorkorder entity){
|
||||
pdmBdWorkorderService.submits(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.nl.wms.pdm.service;
|
||||
package org.nl.wms.pdm.workorder.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pdm.service.dto.PdmBdWorkorderQuery;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pdm.workorder.service.dto.PdmBdWorkorderQuery;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@@ -40,4 +40,19 @@ public interface IPdmBdWorkorderService extends IService<PdmBdWorkorder> {
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 获取设备生产中的工单
|
||||
* @param deviceCode
|
||||
* @return
|
||||
*/
|
||||
PdmBdWorkorder getDeviceProductionTask(String deviceCode);
|
||||
|
||||
PdmBdWorkorder getByCode(String orderCode);
|
||||
|
||||
/**
|
||||
* 工单下发
|
||||
* @param entity
|
||||
*/
|
||||
void submits(PdmBdWorkorder entity);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.pdm.service.dao;
|
||||
package org.nl.wms.pdm.workorder.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
@@ -39,6 +39,9 @@ public class PdmBdWorkorder implements Serializable {
|
||||
@ApiModelProperty(value = "物料标识")
|
||||
private String material_id;
|
||||
|
||||
@ApiModelProperty(value = "原材料物料标识")
|
||||
private String raw_material_code;
|
||||
|
||||
@ApiModelProperty(value = "载具类型")
|
||||
private String vehicle_type;
|
||||
|
||||
@@ -86,6 +89,8 @@ public class PdmBdWorkorder implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "外部标识")
|
||||
private String ext_id;
|
||||
@ApiModelProperty(value = "外部数据")
|
||||
private String ext_data;
|
||||
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Boolean is_delete;
|
||||
@@ -108,6 +113,9 @@ public class PdmBdWorkorder implements Serializable {
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private String update_time;
|
||||
|
||||
@ApiModelProperty(value = "是否加急")
|
||||
private Boolean is_urgent;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String material_name;
|
||||
|
||||
@@ -116,5 +124,7 @@ public class PdmBdWorkorder implements Serializable {
|
||||
|
||||
@TableField(exist = false)
|
||||
private String material_spec;
|
||||
@TableField(exist = false)
|
||||
private String half_material_code;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.wms.pdm.workorder.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pdm.workorder.service.dao.vo.AcsWorkOrderVo;
|
||||
import org.nl.wms.pdm.workorder.service.dto.PdmBdWorkorderQuery;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-05-05
|
||||
**/
|
||||
public interface PdmBdWorkorderMapper extends BaseMapper<PdmBdWorkorder> {
|
||||
|
||||
IPage<PdmBdWorkorder> selectPageLeftJoin(IPage<PdmBdWorkorder> pages, PdmBdWorkorderQuery query);
|
||||
|
||||
/**
|
||||
* 获取需要下发的工单
|
||||
* @param workorderId
|
||||
* @return
|
||||
*/
|
||||
AcsWorkOrderVo toAcsWorkOrderById(String workorderId);
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
<?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.pdm.service.dao.mapper.PdmBdWorkorderMapper">
|
||||
<select id="selectPageLeftJoin" resultType="org.nl.wms.pdm.service.dao.PdmBdWorkorder">
|
||||
<mapper namespace="org.nl.wms.pdm.workorder.service.dao.mapper.PdmBdWorkorderMapper">
|
||||
<select id="selectPageLeftJoin" resultType="org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder">
|
||||
SELECT wo.*
|
||||
,ma.material_name
|
||||
,ma.material_code
|
||||
,ma.material_spec
|
||||
,ma.half_material_code
|
||||
FROM pdm_bd_workorder wo
|
||||
LEFT JOIN md_base_material ma ON ma.material_id = wo.material_id
|
||||
<where>
|
||||
@@ -29,4 +30,31 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="toAcsWorkOrderById" resultType="org.nl.wms.pdm.workorder.service.dao.vo.AcsWorkOrderVo">
|
||||
SELECT
|
||||
w.workorder_code,
|
||||
w.point_code AS device_code,
|
||||
w.plan_qty,
|
||||
m.half_material_code AS material_code,
|
||||
m.raw_material_code AS formula,
|
||||
m.material_code AS product_code,
|
||||
0 AS brick_code,
|
||||
0 AS a,
|
||||
0 AS b,
|
||||
0 AS h,
|
||||
0 AS w,
|
||||
0 AS size_error,
|
||||
0 AS single_weight,
|
||||
0 AS drawing_address,
|
||||
0 AS standard_size_height1,
|
||||
0 AS standard_size_height2,
|
||||
0 AS standard_size_height3,
|
||||
0 AS standard_size_height4,
|
||||
0 AS standard_weight,
|
||||
0 AS detection_error
|
||||
FROM
|
||||
`pdm_bd_workorder` w
|
||||
LEFT JOIN md_base_material m ON m.material_id = w.material_id
|
||||
WHERE w.workorder_id = #{workorderId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.nl.wms.pdm.workorder.service.dao.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 下发工单给ACS
|
||||
* @Date: 2023/8/1
|
||||
*/
|
||||
@Data
|
||||
public class AcsWorkOrderVo {
|
||||
private String workorder_code; // 工单编码
|
||||
private String device_code; // 设备编码
|
||||
private String material_code; // 半成品物料编码 - 工单物料编码
|
||||
private String product_code; // 产品代号 - 成品
|
||||
private String formula; // 配方-泥料
|
||||
private String brick_code; // 砖型编码
|
||||
private String plan_qty; // 计划数量
|
||||
private String a; // a边
|
||||
private String b; // b边
|
||||
private String h; // 高度
|
||||
private String w; // 宽度
|
||||
private String size_error; // 尺寸允许误差
|
||||
private String single_weight; // 单重允许误差
|
||||
private String drawing_address; // 图纸地址
|
||||
private String standard_size_height1; // 标准尺寸1
|
||||
private String standard_size_height2; // 标准尺寸2
|
||||
private String standard_size_height3; // 标准尺寸3
|
||||
private String standard_size_height4; // 标准尺寸4
|
||||
private String standard_weight; // 标准重量
|
||||
private String detection_error; // 检测误差值
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.pdm.service.dto;
|
||||
package org.nl.wms.pdm.workorder.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -28,6 +29,9 @@ public class PdmBdWorkorderDto implements Serializable {
|
||||
/** 物料标识 */
|
||||
private String material_id;
|
||||
|
||||
/** 原材料物料标识 */
|
||||
private String raw_material_id;
|
||||
|
||||
/** 载具类型 */
|
||||
private String vehicle_type;
|
||||
|
||||
@@ -76,6 +80,9 @@ public class PdmBdWorkorderDto implements Serializable {
|
||||
/** 外部标识 */
|
||||
private String ext_id;
|
||||
|
||||
/** 外部标识 */
|
||||
private String ext_data;
|
||||
|
||||
/** 是否删除 */
|
||||
private Boolean is_delete;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.pdm.service.dto;
|
||||
package org.nl.wms.pdm.workorder.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
package org.nl.wms.pdm.workorder.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
|
||||
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pdm.workorder.service.dao.mapper.PdmBdWorkorderMapper;
|
||||
import org.nl.wms.pdm.workorder.service.dao.vo.AcsWorkOrderVo;
|
||||
import org.nl.wms.pdm.workorder.service.dto.PdmBdWorkorderQuery;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.WorkOrderStatusEnum;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2023-05-05
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper, PdmBdWorkorder> implements IPdmBdWorkorderService {
|
||||
|
||||
@Autowired
|
||||
private PdmBdWorkorderMapper pdmBdWorkorderMapper;
|
||||
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
@Override
|
||||
public IPage<PdmBdWorkorder> queryAll(PdmBdWorkorderQuery query, PageQuery page){
|
||||
IPage<PdmBdWorkorder> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
pages = pdmBdWorkorderMapper.selectPageLeftJoin(pages, query);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(PdmBdWorkorder entity) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
// 点位编码和点位名称为父点位
|
||||
|
||||
entity.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setWorkorder_code(CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
||||
entity.setCreate_id(currentUserId);
|
||||
entity.setCreate_name(nickName);
|
||||
entity.setCreate_time(now);
|
||||
entity.setUpdate_id(currentUserId);
|
||||
entity.setUpdate_name(nickName);
|
||||
entity.setUpdate_time(now);
|
||||
pdmBdWorkorderMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(PdmBdWorkorder entity) {
|
||||
PdmBdWorkorder dto = pdmBdWorkorderMapper.selectById(entity.getWorkorder_id());
|
||||
if (dto == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_id(GeneralDefinition.ACS_ID);
|
||||
entity.setUpdate_name(GeneralDefinition.ACS_NAME);
|
||||
entity.setUpdate_time(now);
|
||||
|
||||
pdmBdWorkorderMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
pdmBdWorkorderMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdmBdWorkorder getDeviceProductionTask(String deviceCode) {
|
||||
// 只能有一个生产中
|
||||
LambdaQueryWrapper<PdmBdWorkorder> lam = new QueryWrapper<PdmBdWorkorder>().lambda();
|
||||
lam.eq(PdmBdWorkorder::getPoint_code, deviceCode)
|
||||
.eq(PdmBdWorkorder::getWorkorder_status, WorkOrderStatusEnum.PRODUCING.getCode());
|
||||
return pdmBdWorkorderMapper.selectOne(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdmBdWorkorder getByCode(String orderCode) {
|
||||
LambdaQueryWrapper<PdmBdWorkorder> lam = new QueryWrapper<PdmBdWorkorder>().lambda();
|
||||
lam.eq(PdmBdWorkorder::getWorkorder_code, orderCode);
|
||||
return pdmBdWorkorderMapper.selectOne(lam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submits(PdmBdWorkorder entity) {
|
||||
PdmBdWorkorder pdmBdWorkorder = pdmBdWorkorderMapper.selectById(entity.getWorkorder_id());
|
||||
if (ObjectUtil.isEmpty(pdmBdWorkorder)) {
|
||||
throw new BadRequestException("工单编码[" + entity.getWorkorder_code() + "]不存在");
|
||||
}
|
||||
// 检验是否已经开工
|
||||
if (pdmBdWorkorder.getWorkorder_status().equals(WorkOrderStatusEnum.PRODUCING.getCode())) {
|
||||
throw new BadRequestException("工单已生产");
|
||||
}
|
||||
if (pdmBdWorkorder.getWorkorder_status().equals(WorkOrderStatusEnum.COMPLETE.getCode())) {
|
||||
throw new BadRequestException("工单已完工");
|
||||
}
|
||||
// 查找是否有当前设备已经开工的工单
|
||||
LambdaQueryWrapper<PdmBdWorkorder> lam = new QueryWrapper<PdmBdWorkorder>().lambda();
|
||||
lam.eq(PdmBdWorkorder::getPoint_code, entity.getPoint_code())
|
||||
.eq(PdmBdWorkorder::getWorkorder_status, WorkOrderStatusEnum.PRODUCING.getCode())
|
||||
.eq(PdmBdWorkorder::getIs_delete, false);
|
||||
PdmBdWorkorder bdWorkorder = pdmBdWorkorderMapper.selectOne(lam);
|
||||
if (ObjectUtil.isNotEmpty(bdWorkorder)) {
|
||||
throw new BadRequestException("该设备已有生产工单,不能重复下发");
|
||||
}
|
||||
/**
|
||||
* todo: 待优化-虽然一次性下发一个工单,为了方便后续多个一起下发,此处接口设置为list形式
|
||||
*/
|
||||
List<AcsWorkOrderVo> list = new CopyOnWriteArrayList<>();
|
||||
// 重装数据回ACS,重新根据id找一遍,省的改动以上代码
|
||||
AcsWorkOrderVo acsWorkOrderVo = pdmBdWorkorderMapper.toAcsWorkOrderById(pdmBdWorkorder.getWorkorder_id());
|
||||
list.add(acsWorkOrderVo);
|
||||
AcsResponse resultForAcs;
|
||||
try {
|
||||
resultForAcs = wmsToAcsService.order(list);
|
||||
} catch (Exception e) {
|
||||
log.error("工单下发异常:" + e.getMessage());
|
||||
// 通知
|
||||
noticeService.createNotice("工单下发失败: " + e.getMessage(), "工单下发失败: "
|
||||
+ pdmBdWorkorder.getWorkorder_code(), NoticeTypeEnum.EXCEPTION.getCode());
|
||||
throw new BadRequestException("工单下发失败");
|
||||
}
|
||||
if (resultForAcs.getCode() != HttpStatus.HTTP_OK) {
|
||||
// 不成功
|
||||
noticeService.createNotice(resultForAcs.getMessage(), "工单下发失败: " + pdmBdWorkorder.getWorkorder_code(),
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
throw new BadRequestException("工单下发失败");
|
||||
}
|
||||
// 修改工单数据
|
||||
pdmBdWorkorder.setWorkorder_status(WorkOrderStatusEnum.ISSUED.getCode());
|
||||
TaskUtils.setWorkOrderUpdateByAcs(pdmBdWorkorder);
|
||||
pdmBdWorkorderMapper.updateById(pdmBdWorkorder);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,9 +19,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-05-16
|
||||
**/
|
||||
* @author lyd
|
||||
* @date 2023-05-16
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "组盘信息管理管理")
|
||||
@@ -36,7 +36,8 @@ public class SchBaseVehiclematerialgroupController {
|
||||
@ApiOperation("查询组盘信息管理")
|
||||
//@SaCheckPermission("@el.check('schBaseVehiclematerialgroup:list')")
|
||||
public ResponseEntity<Object> query(SchBaseVehiclematerialgroupQuery whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(schBaseVehiclematerialgroupService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
return new ResponseEntity<>(TableDataInfo.build(schBaseVehiclematerialgroupService
|
||||
.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
|
||||
@@ -6,41 +6,42 @@ import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.group.service.dto.SchBaseVehiclematerialgroupQuery;
|
||||
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2023-05-16
|
||||
**/
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2023-05-16
|
||||
**/
|
||||
public interface ISchBaseVehiclematerialgroupService extends IService<SchBaseVehiclematerialgroup> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<SchBaseVehiclematerialgroup>
|
||||
*/
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<SchBaseVehiclematerialgroup>
|
||||
*/
|
||||
IPage<SchBaseVehiclematerialgroup> queryAll(SchBaseVehiclematerialgroupQuery whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(SchBaseVehiclematerialgroup entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(SchBaseVehiclematerialgroup entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
@@ -49,4 +50,31 @@ public interface ISchBaseVehiclematerialgroupService extends IService<SchBaseVeh
|
||||
* @return
|
||||
*/
|
||||
SchBaseVehiclematerialgroup getGroup(JSONObject entity);
|
||||
|
||||
/**
|
||||
* 根据载具编码、载具类型、状态、物料查找组盘信息
|
||||
* @param vehicleCode
|
||||
* @param vehicleType
|
||||
* @param value 物料托盘组盘状态
|
||||
* @param materialId
|
||||
* @return
|
||||
*/
|
||||
SchBaseVehiclematerialgroup getGroupInfo(String vehicleCode, String vehicleType, String value, String materialId);
|
||||
|
||||
/**
|
||||
* 根据载具编码、载具类型、状态、物料查找组盘信息
|
||||
* @param vehicleCode
|
||||
* @param vehicleType
|
||||
* @param value 物料托盘组盘状态
|
||||
* @return
|
||||
*/
|
||||
SchBaseVehiclematerialgroup getGroupInfo(String vehicleCode, String vehicleType, String value);
|
||||
|
||||
/**
|
||||
* 根据载具编码、状态、物料查找组盘信息
|
||||
* @param vehicleCode
|
||||
* @param value 物料托盘组盘状态
|
||||
* @return
|
||||
*/
|
||||
SchBaseVehiclematerialgroup getGroupInfo(String vehicleCode, String value);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ public class SchBaseVehiclematerialgroup implements Serializable {
|
||||
@ApiModelProperty(value = "物料标识")
|
||||
private String material_id;
|
||||
|
||||
@ApiModelProperty(value = "冗余-半成品/泥料")
|
||||
private String redundance_material_code;
|
||||
|
||||
@ApiModelProperty(value = "载具类型")
|
||||
private String vehicle_type;
|
||||
|
||||
@@ -50,8 +53,13 @@ public class SchBaseVehiclematerialgroup implements Serializable {
|
||||
@ApiModelProperty(value = "是否满托")
|
||||
private Boolean is_full;
|
||||
|
||||
@ApiModelProperty(value = "是否已烧制")
|
||||
private Boolean is_firing;
|
||||
|
||||
@ApiModelProperty(value = "批次")
|
||||
private String pcsn;
|
||||
@ApiModelProperty(value = "碾次")
|
||||
private String mix_times;
|
||||
|
||||
@ApiModelProperty(value = "入库时间")
|
||||
private String instorage_time;
|
||||
@@ -82,6 +90,8 @@ public class SchBaseVehiclematerialgroup implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "组盘状态")
|
||||
private String group_status;
|
||||
@ApiModelProperty(value = "移动途径")
|
||||
private String move_way;
|
||||
|
||||
@ApiModelProperty(value = "业务表表名")
|
||||
private String table_name;
|
||||
@@ -136,6 +146,10 @@ public class SchBaseVehiclematerialgroup implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private String update_time;
|
||||
@ApiModelProperty(value = "出窑时间")
|
||||
private String out_kiln_time;
|
||||
@ApiModelProperty(value = "入窑时间")
|
||||
private String into_kiln_time;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package org.nl.wms.sch.group.service.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2023-05-16
|
||||
**/
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2023-05-16
|
||||
**/
|
||||
@Data
|
||||
public class SchBaseVehiclematerialgroupDto implements Serializable {
|
||||
|
||||
@@ -36,6 +38,9 @@ public class SchBaseVehiclematerialgroupDto implements Serializable {
|
||||
/** 是否满托 */
|
||||
private Boolean is_full;
|
||||
|
||||
/** 是否已烧制 */
|
||||
private Boolean is_firing;
|
||||
|
||||
/** 批次 */
|
||||
private String pcsn;
|
||||
|
||||
@@ -119,4 +124,8 @@ public class SchBaseVehiclematerialgroupDto implements Serializable {
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
/** 出窑时间 */
|
||||
private String out_kiln_time;
|
||||
/** 入窑时间 */
|
||||
private String into_kiln_time;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2023-05-16
|
||||
**/
|
||||
* @author lyd
|
||||
* @date 2023-05-16
|
||||
**/
|
||||
@Data
|
||||
public class SchBaseVehiclematerialgroupQuery implements Serializable {
|
||||
private String vehicle_code;
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -23,10 +24,10 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2023-05-16
|
||||
**/
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2023-05-16
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseVehiclematerialgroupMapper, SchBaseVehiclematerialgroup> implements ISchBaseVehiclematerialgroupService {
|
||||
@@ -79,4 +80,37 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
|
||||
return vehiclematerialgroupMapper.getGroup(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchBaseVehiclematerialgroup getGroupInfo(String vehicleCode, String vehicleType, String value, String materialId) {
|
||||
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lambda = new QueryWrapper<SchBaseVehiclematerialgroup>().lambda();
|
||||
lambda.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode)
|
||||
.eq(SchBaseVehiclematerialgroup::getVehicle_type, vehicleType)
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, value)
|
||||
.eq(SchBaseVehiclematerialgroup::getMaterial_id, materialId)
|
||||
.eq(SchBaseVehiclematerialgroup::getIs_delete, false);
|
||||
SchBaseVehiclematerialgroup selectOne = vehiclematerialgroupMapper.selectOne(lambda);
|
||||
return selectOne;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchBaseVehiclematerialgroup getGroupInfo(String vehicleCode, String vehicleType, String value) {
|
||||
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lambda = new QueryWrapper<SchBaseVehiclematerialgroup>().lambda();
|
||||
lambda.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode)
|
||||
.eq(SchBaseVehiclematerialgroup::getVehicle_type, vehicleType)
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, value)
|
||||
.eq(SchBaseVehiclematerialgroup::getIs_delete, false);
|
||||
SchBaseVehiclematerialgroup selectOne = vehiclematerialgroupMapper.selectOne(lambda);
|
||||
return selectOne;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchBaseVehiclematerialgroup getGroupInfo(String vehicleCode, String value) {
|
||||
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lambda = new QueryWrapper<SchBaseVehiclematerialgroup>().lambda();
|
||||
lambda.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode)
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, value)
|
||||
.eq(SchBaseVehiclematerialgroup::getIs_delete, false);
|
||||
SchBaseVehiclematerialgroup selectOne = vehiclematerialgroupMapper.selectOne(lambda);
|
||||
return selectOne;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.annotation.RepeatSubmit;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
@@ -18,7 +17,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
|
||||
@@ -13,10 +13,10 @@ import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("sch_base_point")
|
||||
@@ -137,4 +137,14 @@ public class SchBasePoint implements Serializable {
|
||||
@TableField(exist = false)
|
||||
private String point_status_name;
|
||||
|
||||
// 组盘标识
|
||||
@TableField(exist = false)
|
||||
private String group_id;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String record_id;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String device_code;
|
||||
|
||||
}
|
||||
|
||||
@@ -27,13 +27,14 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2023-05-15
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, SchBasePoint> implements ISchBasePointService {
|
||||
@@ -46,44 +47,58 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
|
||||
@Override
|
||||
public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page){
|
||||
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? whereJson.get("blurry").toString() : null;
|
||||
String workshop_code = ObjectUtil.isNotEmpty(whereJson.get("workshop_code")) ? whereJson.get("workshop_code").toString() : null;
|
||||
String region_code = ObjectUtil.isNotEmpty(whereJson.get("region_code")) ? whereJson.get("region_code").toString() : null;
|
||||
String point_type = ObjectUtil.isNotEmpty(whereJson.get("point_type")) ? whereJson.get("point_type").toString() : null;
|
||||
String point_status = ObjectUtil.isNotEmpty(whereJson.get("point_status")) ? whereJson.get("point_status").toString() : null;
|
||||
Boolean is_used = ObjectUtil.isNotEmpty(whereJson.get("is_used")) ? Boolean.valueOf(whereJson.get("is_used").toString()) : null;
|
||||
Boolean lock_type = ObjectUtil.isNotEmpty(whereJson.get("lock_type")) ? Boolean.valueOf(whereJson.get("lock_type").toString()) : false;
|
||||
Boolean parent_point = ObjectUtil.isNotEmpty(whereJson.get("parent_point")) ? Boolean.valueOf(whereJson.get("parent_point").toString()) : false;
|
||||
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry"))
|
||||
? whereJson.get("blurry").toString() : null;
|
||||
String workshop_code = ObjectUtil.isNotEmpty(whereJson.get("workshop_code"))
|
||||
? whereJson.get("workshop_code").toString() : null;
|
||||
String region_code = ObjectUtil.isNotEmpty(whereJson.get("region_code"))
|
||||
? whereJson.get("region_code").toString() : null;
|
||||
String point_type = ObjectUtil.isNotEmpty(whereJson.get("point_type"))
|
||||
? whereJson.get("point_type").toString() : null;
|
||||
String point_status = ObjectUtil.isNotEmpty(whereJson.get("point_status"))
|
||||
? whereJson.get("point_status").toString() : null;
|
||||
Boolean is_used = ObjectUtil.isNotEmpty(whereJson.get("is_used"))
|
||||
? Boolean.valueOf(whereJson.get("is_used").toString()) : null;
|
||||
Boolean lock_type = ObjectUtil.isNotEmpty(whereJson.get("lock_type"))
|
||||
? Boolean.valueOf(whereJson.get("lock_type").toString()) : false;
|
||||
Boolean parent_point = ObjectUtil.isNotEmpty(whereJson.get("parent_point"))
|
||||
? Boolean.valueOf(whereJson.get("parent_point").toString()) : false;
|
||||
LambdaQueryWrapper<SchBasePoint> lam = new LambdaQueryWrapper<>();
|
||||
lam.like(ObjectUtil.isNotEmpty(blurry), SchBasePoint::getPoint_code, blurry)
|
||||
.or(ObjectUtil.isNotEmpty(blurry), lam1 -> lam1.like(SchBasePoint::getPoint_name, blurry))
|
||||
.eq(ObjectUtil.isNotEmpty(workshop_code), SchBasePoint::getWorkshop_code, workshop_code)
|
||||
lam.eq(ObjectUtil.isNotEmpty(workshop_code), SchBasePoint::getWorkshop_code, workshop_code)
|
||||
.and(ObjectUtil.isNotEmpty(blurry), la -> la.like(SchBasePoint::getPoint_code, blurry)
|
||||
.or().like(SchBasePoint::getPoint_name, blurry))
|
||||
.eq(ObjectUtil.isNotEmpty(region_code), SchBasePoint::getRegion_code, region_code)
|
||||
.eq(ObjectUtil.isNotEmpty(point_type), SchBasePoint::getPoint_type, point_type)
|
||||
.eq(ObjectUtil.isNotEmpty(point_status), SchBasePoint::getPoint_status, point_status)
|
||||
.eq(ObjectUtil.isNotEmpty(is_used), SchBasePoint::getIs_used, is_used)
|
||||
.and(!lock_type, slam -> slam.isNull(SchBasePoint::getIng_task_code)
|
||||
.or()
|
||||
.and(!lock_type, slam -> slam.isNull(SchBasePoint::getIng_task_code).or()
|
||||
.eq(SchBasePoint::getIng_task_code, ""))
|
||||
.and(lock_type, slam -> slam.isNotNull(SchBasePoint::getIng_task_code)
|
||||
.ne(SchBasePoint::getIng_task_code, ""))
|
||||
.orderByAsc(SchBasePoint::getRegion_code)
|
||||
.orderByAsc(SchBasePoint::getPoint_code)
|
||||
.orderByAsc(SchBasePoint::getPoint_type)
|
||||
.apply(parent_point, "point_code = parent_point_code");
|
||||
IPage<SchBasePoint> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
pointMapper.selectPage(pages, lam);
|
||||
// 可以存放的载具类型
|
||||
pages.getRecords().forEach(point -> {
|
||||
point.setCan_vehicle_types(Arrays.asList(point.getCan_vehicle_type().split(",")));
|
||||
if (ObjectUtil.isNotEmpty(point.getCan_vehicle_type())) {
|
||||
point.setCan_vehicle_types(Arrays.asList(point.getCan_vehicle_type().split(",")));
|
||||
}
|
||||
String pointStatus = point.getPoint_status(); // 点位状态
|
||||
String pointType = point.getPoint_type(); // 点位类型
|
||||
SchBaseRegion regionObj = regionMapper.selectById(point.getRegion_code());
|
||||
if (ObjectUtil.isNotEmpty(regionObj)) {
|
||||
if (ObjectUtil.isNotEmpty(pointStatus) && ObjectUtil.isNotEmpty(regionObj.getPoint_status_explain())) {
|
||||
// 设置
|
||||
point.setPoint_status_name(PointUtils.getStatusOrTypeName(regionObj.getPoint_status_explain(), pointStatus));
|
||||
point.setPoint_status_name(PointUtils.getStatusOrTypeName(
|
||||
regionObj.getPoint_status_explain(), pointStatus));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(pointType) && ObjectUtil.isNotEmpty(regionObj.getPoint_type_explain())) {
|
||||
// 设置
|
||||
point.setPoint_type_name(PointUtils.getStatusOrTypeName(regionObj.getPoint_type_explain(), pointType));
|
||||
point.setPoint_type_name(PointUtils.getStatusOrTypeName(
|
||||
regionObj.getPoint_type_explain(), pointType));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,8 +5,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||
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;
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package org.nl.wms.sch.task_manage;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 通用定义类型数据
|
||||
* @Date: 2023/7/13
|
||||
*/
|
||||
public class GeneralDefinition {
|
||||
/** 未知 */
|
||||
public static final String UNKNOWN = "-";
|
||||
// 统一编码定义
|
||||
/** 窑自动任务开启 */
|
||||
public static final String AUTO_KILN_CALL = "auto_kiln_call";
|
||||
// 是否
|
||||
/**是/正确/可用... */
|
||||
public static final String YES = "1";
|
||||
/** 否/错误/不可用... */
|
||||
public static final String NO = "0";
|
||||
// 载具类型
|
||||
/** 料盅 */
|
||||
public static final String MATERIAL_CUP = "1";
|
||||
/** 钢托盘 */
|
||||
public static final String STEEL_TRAY = "2";
|
||||
// 账号定义
|
||||
/** acs系统 */
|
||||
public static final String ACS_ID = "2";
|
||||
/** acs系统 */
|
||||
public static final String ACS_NAME = "ACS系统";
|
||||
/** mes系统 */
|
||||
public static final String MES_ID = "3";
|
||||
/** mes系统 */
|
||||
public static final String MES_NAME = "MES系统";
|
||||
/** erp系统 */
|
||||
public static final String ERP_ID = "4";
|
||||
/** erp系统 */
|
||||
public static final String ERP_NAME = "ERP系统";
|
||||
// 点位类型
|
||||
/** 设备位 */
|
||||
public static final String DEVICE_POINT = "1";
|
||||
/** 对接位 */
|
||||
public static final String DOCKING_POINT = "2";
|
||||
// 出入口
|
||||
/**入口**/
|
||||
public static final String ENTRANCE = "1";
|
||||
/**出口**/
|
||||
public static final String EXIT = "2";
|
||||
// 任务生产方式
|
||||
/**自动创建**/
|
||||
public static final String AUTO_CREATION = "1";
|
||||
/**ACS创建**/
|
||||
public static final String ACS_CREATION = "2";
|
||||
// 请求方向
|
||||
/**ACS->LMS**/
|
||||
public static final String ACS_LMS = "1";
|
||||
/**LMS->ACS**/
|
||||
public static final String LMS_ACS = "2";
|
||||
/**MES->LMS**/
|
||||
public static final String MES_LMS = "3";
|
||||
/**LMS->MES**/
|
||||
public static final String LMS_LMS = "4";
|
||||
// 区域定义
|
||||
/** 料盅睏料线区域 */
|
||||
public static final String LZKLX = "LZKLX";
|
||||
/** 自定义区域:干燥窑区域 */
|
||||
public static final String GZY = "GZY";
|
||||
// 特殊: 1-缓存输送线入口,2-缓存输送线出口,3-上输送线,4-下输送线
|
||||
/** 上输送线 */
|
||||
public static final String UPPER_CONVEYOR_LINE = "3";
|
||||
/** 下输送线 */
|
||||
public static final String LOWER_CONVEYOR_LINE = "4";
|
||||
// 参数名称
|
||||
/** 是否连接 */
|
||||
public static final String IS_CONNECT_ACS = "is_connect_acs";
|
||||
/** ACS路径 */
|
||||
public static final String ACS_URL = "acs_url";
|
||||
// 完成/取消
|
||||
/** 任务完成 */
|
||||
public static final String TASK_FINISH = "任务完成";
|
||||
/** 任务取消 */
|
||||
public static final String TASK_CANCEL = "任务取消";
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.nl.wms.sch.task_manage.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 工单状态枚举
|
||||
* @Date: 2023/6/16
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum WorkOrderStatusEnum {
|
||||
UNPRODUCED("1", "未生产"),
|
||||
ISSUED("2", "已下发"),
|
||||
PRODUCING("3", "生产中"),
|
||||
STOP("4", "暂停"),
|
||||
COMPLETE("5", "完成");
|
||||
private final String code;
|
||||
private final String name;
|
||||
}
|
||||
@@ -1,51 +1,42 @@
|
||||
package org.nl.wms.sch.task_manage.task;
|
||||
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.task.tasks.hn.HNMLTask;
|
||||
import org.nl.wms.sch.task_manage.task.tasks.hn.HNQKTask;
|
||||
import org.nl.wms.sch.task_manage.task.tasks.yz.YZQLTask;
|
||||
import org.nl.wms.sch.task_manage.task.tasks.yz.YZSKTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @version 1.0
|
||||
* @version 2.0
|
||||
* @date 2023年05月16日 16:42
|
||||
* @desc desc
|
||||
* @desc 采用获取注解来标识任务类型,并通过扫描和反射的方式来获取任务实例
|
||||
*/
|
||||
@Component
|
||||
public class TaskFactory {
|
||||
private final Map<String, AbstractTask> taskMap;
|
||||
|
||||
@Autowired
|
||||
private HNMLTask hnmlTask;
|
||||
public TaskFactory(ApplicationContext applicationContext) {
|
||||
taskMap = new HashMap<>();
|
||||
initializeTasks(applicationContext);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private YZQLTask yzqlTask;
|
||||
private void initializeTasks(ApplicationContext applicationContext) {
|
||||
Map<String, Object> taskBeans = applicationContext.getBeansWithAnnotation(TaskType.class);
|
||||
for (Object taskBean : taskBeans.values()) {
|
||||
TaskType taskTypeAnnotation = taskBean.getClass().getAnnotation(TaskType.class);
|
||||
String taskType = taskTypeAnnotation.value();
|
||||
taskMap.put(taskType.toUpperCase(), (AbstractTask) taskBean);
|
||||
}
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private HNQKTask hnqkTask;
|
||||
|
||||
@Autowired
|
||||
private YZSKTask yzskTask;
|
||||
|
||||
//使用 getShape 方法获取形状类型的对象
|
||||
public AbstractTask getTask(String taskType) {
|
||||
if (taskType == null) {
|
||||
return null;
|
||||
}
|
||||
if (taskType.equalsIgnoreCase("HNMLTask")) {
|
||||
return hnmlTask;
|
||||
}
|
||||
if (taskType.equalsIgnoreCase("YZQLTask")) {
|
||||
return yzqlTask;
|
||||
}
|
||||
if (taskType.equalsIgnoreCase("HNQKTask")) {
|
||||
return hnqkTask;
|
||||
}
|
||||
if (taskType.equalsIgnoreCase("YZSKTask")) {
|
||||
return yzskTask;
|
||||
}
|
||||
return null;
|
||||
return taskMap.get(taskType.toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.wms.sch.task_manage.task;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 配置任务类型注解
|
||||
* @Date: 2023/6/21
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface TaskType {
|
||||
String value();
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.Data;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
@@ -20,6 +20,7 @@ import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.enums.*;
|
||||
import org.nl.wms.sch.task_manage.task.TaskType;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -38,6 +39,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Component
|
||||
@Data
|
||||
@TaskType("HNMLTask")
|
||||
public class HNMLTask extends AbstractTask {
|
||||
|
||||
private static String TASK_CONFIG_CODE = "HNMLTask";
|
||||
|
||||
@@ -4,8 +4,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||
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;
|
||||
@@ -14,6 +14,7 @@ import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.enums.PointStatusEnum;
|
||||
import org.nl.wms.sch.task_manage.task.TaskType;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -29,6 +30,7 @@ import java.util.stream.Collectors;
|
||||
* @Date: 2023/5/19
|
||||
*/
|
||||
@Component
|
||||
@TaskType("HNQKTask")
|
||||
public class HNQKTask extends AbstractTask {
|
||||
private static String TASK_CONFIG_CODE = "HNQKTask";
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ 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.pdm.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
@@ -19,6 +19,7 @@ import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.PointStatusEnum;
|
||||
import org.nl.wms.sch.task_manage.task.TaskType;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -35,6 +36,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@TaskType("YZQLTask")
|
||||
public class YZQLTask extends AbstractTask {
|
||||
private static String TASK_CONFIG_CODE = "YZQLTask";
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.pdm.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
@@ -15,6 +15,7 @@ import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.enums.PointStatusEnum;
|
||||
import org.nl.wms.sch.task_manage.task.TaskType;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -29,6 +30,7 @@ import java.util.stream.Collectors;
|
||||
* @Date: 2023/5/25
|
||||
*/
|
||||
@Component
|
||||
@TaskType("YZSKTask")
|
||||
public class YZSKTask extends AbstractTask {
|
||||
private static String TASK_CONFIG_CODE = "YZSKTask";
|
||||
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
package org.nl.wms.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.ext.acs.service.dto.SignalData;
|
||||
import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 通用工具
|
||||
@@ -30,4 +42,38 @@ public class CommonUtils {
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param inStorageTime 入库时间
|
||||
* @param standingTime 静置时间 / 分钟
|
||||
* @return
|
||||
*/
|
||||
public static boolean isStandingFinish(String inStorageTime, Integer standingTime) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime inStorageDateTime = LocalDateTime.parse(inStorageTime, formatter);
|
||||
Duration standingDuration = Duration.ofMinutes(standingTime);
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
LocalDateTime expiryTime = inStorageDateTime.plus(standingDuration);
|
||||
return currentTime.isAfter(expiryTime);
|
||||
}
|
||||
|
||||
public static <T> T toJavaObject(String objectString, Class<T> clazz) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(objectString);
|
||||
return jsonObject.toJavaObject(clazz);
|
||||
}
|
||||
|
||||
// 请求ACS释放一个木托盘
|
||||
public static List<PutActionRequest> requestAcsReleaseVehicle(HashMap<String, String> map, String deviceCode) {
|
||||
List<PutActionRequest> list = new CopyOnWriteArrayList<>();
|
||||
PutActionRequest putActionRequest = PutActionRequest.createRequest();
|
||||
putActionRequest.setDevice_code(deviceCode);
|
||||
List<SignalData> signalList = new CopyOnWriteArrayList<>();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
SignalData signalData = SignalData.buildSignalData(entry.getKey(), entry.getValue());
|
||||
signalList.add(signalData);
|
||||
}
|
||||
putActionRequest.setList(signalList);
|
||||
list.add(putActionRequest);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package org.nl.wms.util;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.point.service.impl.SchBasePointServiceImpl;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.PointStatusEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
@@ -36,6 +41,9 @@ public class PointUtils {
|
||||
* @param point
|
||||
*/
|
||||
public static void clearPoint(SchBasePoint point) {
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
return; // 空直接退出
|
||||
}
|
||||
SchBasePointServiceImpl pointService = SpringContextHolder.getBean(SchBasePointServiceImpl.class);
|
||||
point.setPoint_status(PointStatusEnum.EMPTY_POINT.getCode());
|
||||
point.setVehicle_type("");
|
||||
@@ -45,4 +53,24 @@ public class PointUtils {
|
||||
point.setUpdate_time(DateUtil.now());
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
/** 点位修改更新信息 **/
|
||||
public static void setUpdateByAcs(SchBasePoint pointObj) {
|
||||
pointObj.setUpdate_id(GeneralDefinition.ACS_ID);
|
||||
pointObj.setUpdate_name(GeneralDefinition.ACS_NAME);
|
||||
pointObj.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
/** 点位修改更新信息 **/
|
||||
public static void setUpdateByPC(SchBasePoint pointObj) {
|
||||
pointObj.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
pointObj.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
pointObj.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
public static void setUpdateByType(SchBasePoint pointObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
if (taskFinishedType.equals(TaskFinishedTypeEnum.AUTO_ACS)) {
|
||||
setUpdateByAcs(pointObj);
|
||||
} else {
|
||||
setUpdateByPC(pointObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,101 @@
|
||||
package org.nl.wms.util;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 任务修改抽取的公用方法
|
||||
* @Date: 2023/6/13
|
||||
*/
|
||||
@Slf4j
|
||||
public class TaskUtils {
|
||||
|
||||
public static void setCreateByAcs(SchBaseTask taskObj) {
|
||||
taskObj.setCreate_id(GeneralDefinition.ACS_ID);
|
||||
taskObj.setCreate_name(GeneralDefinition.ACS_NAME);
|
||||
taskObj.setCreate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
public static void setUpdateByAcs(SchBaseTask taskObj) {
|
||||
taskObj.setUpdate_id("2");
|
||||
taskObj.setUpdate_name("ACS系统");
|
||||
taskObj.setUpdate_id(GeneralDefinition.ACS_ID);
|
||||
taskObj.setUpdate_name(GeneralDefinition.ACS_NAME);
|
||||
taskObj.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
public static void setUpdateByPC(SchBaseTask taskObj) {
|
||||
taskObj.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
taskObj.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
taskObj.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
public static void setGroupUpdateByAcs(SchBaseVehiclematerialgroup groupEntity) {
|
||||
groupEntity.setUpdate_id(GeneralDefinition.ACS_ID);
|
||||
groupEntity.setUpdate_name(GeneralDefinition.ACS_NAME);
|
||||
groupEntity.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
public static void setGroupUpdateByPC(SchBaseVehiclematerialgroup groupEntity) {
|
||||
groupEntity.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
groupEntity.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
groupEntity.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
// 根据类型去判断谁修改的
|
||||
public static void setGroupUpdateByType(SchBaseVehiclematerialgroup groupEntity, TaskFinishedTypeEnum taskFinishedType) {
|
||||
if (taskFinishedType.equals(TaskFinishedTypeEnum.AUTO_ACS)) {
|
||||
setGroupUpdateByAcs(groupEntity);
|
||||
} else {
|
||||
setGroupUpdateByPC(groupEntity);
|
||||
}
|
||||
}
|
||||
public static void setWorkOrderUpdateByAcs(PdmBdWorkorder pdmBdWorkorder) {
|
||||
pdmBdWorkorder.setUpdate_id(GeneralDefinition.ACS_ID);
|
||||
pdmBdWorkorder.setUpdate_name(GeneralDefinition.ACS_NAME);
|
||||
pdmBdWorkorder.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
public static void setWorkOrderUpdateByPC(PdmBdWorkorder pdmBdWorkorder) {
|
||||
pdmBdWorkorder.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
pdmBdWorkorder.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
pdmBdWorkorder.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
// 根据类型去判断谁修改的
|
||||
public static void setWorkOrderUpdateByType(PdmBdWorkorder groupEntity, TaskFinishedTypeEnum taskFinishedType) {
|
||||
if (taskFinishedType.equals(TaskFinishedTypeEnum.AUTO_ACS)) {
|
||||
setWorkOrderUpdateByAcs(groupEntity);
|
||||
} else {
|
||||
setWorkOrderUpdateByPC(groupEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void setUpdateAuto(SchBaseTask taskObj) {
|
||||
String currentUserId = ObjectUtil.isNotEmpty(SecurityUtils.getCurrentUserId())
|
||||
? SecurityUtils.getCurrentUserId()
|
||||
: "2";
|
||||
String nickName = ObjectUtil.isNotEmpty(SecurityUtils.getCurrentNickName())
|
||||
? SecurityUtils.getCurrentNickName()
|
||||
: "ACS系统";
|
||||
taskObj.setUpdate_id(currentUserId);
|
||||
taskObj.setUpdate_name(nickName);
|
||||
taskObj.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
// 根据类型去判断谁修改的
|
||||
public static void setUpdateByType(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
if (taskFinishedType.equals(TaskFinishedTypeEnum.AUTO_ACS)) {
|
||||
@@ -31,4 +104,75 @@ public class TaskUtils {
|
||||
setUpdateByPC(taskObj);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否有起点终点的任务
|
||||
*/
|
||||
public static Boolean hasTaskAll(String pointCode) {
|
||||
ISchBaseTaskService taskService = SpringContextHolder.getBean(ISchBaseTaskService.class);
|
||||
final String code = pointCode;
|
||||
List<SchBaseTask> list = taskService.list(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.lt(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode())
|
||||
.eq(SchBaseTask::getIs_delete, false)
|
||||
.and(la -> la.eq(SchBaseTask::getPoint_code1, code)
|
||||
.or()
|
||||
.eq(SchBaseTask::getPoint_code2, code)
|
||||
.or()
|
||||
.eq(SchBaseTask::getPoint_code3, code)
|
||||
.or()
|
||||
.eq(SchBaseTask::getPoint_code4, code)));
|
||||
return list.size() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转成ACS需要的载具类型
|
||||
* ACS载具类型:1 2 3 ...
|
||||
* LMS载具类型:3 4 5 ...
|
||||
* @param acsVehicleType
|
||||
* @return
|
||||
*/
|
||||
public static String toAcsVehicleTypeShift(String acsVehicleType) {
|
||||
if (ObjectUtil.isEmpty(acsVehicleType)) {
|
||||
return null;
|
||||
}
|
||||
String lmsVehicleType = null;
|
||||
try {
|
||||
lmsVehicleType = Integer.parseInt(acsVehicleType) - 2 + "";
|
||||
} catch (Exception e) {
|
||||
log.error("acs载具转换异常: {}", e.getMessage());
|
||||
}
|
||||
return lmsVehicleType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转成LMS需要的载具类型
|
||||
* ACS载具类型:1 2 3 ...
|
||||
* LMS载具类型:3 4 5 ...
|
||||
* @param lmsVehicleType
|
||||
* @return
|
||||
*/
|
||||
public static String toLmsVehicleTypeShift(String lmsVehicleType) {
|
||||
if (ObjectUtil.isEmpty(lmsVehicleType)) {
|
||||
return null;
|
||||
}
|
||||
String acsVehicleType = null;
|
||||
try {
|
||||
acsVehicleType = Integer.parseInt(lmsVehicleType) + 2 + "";
|
||||
} catch (Exception e) {
|
||||
log.error("acs载具转换异常: {}", e.getMessage());
|
||||
}
|
||||
return acsVehicleType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果传来的载具编码是0,就返回null
|
||||
* @param acsVehicleCode
|
||||
* @return
|
||||
*/
|
||||
public static String defaultVehicleCode(String acsVehicleCode) {
|
||||
if (ObjectUtil.isEmpty(acsVehicleCode) || acsVehicleCode.equals(GeneralDefinition.NO)) {
|
||||
return null;
|
||||
}
|
||||
return acsVehicleCode;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user