diff --git a/lms/nladmin-system/doc/wms.xls b/lms/nladmin-system/doc/wms.xls index 1ecfd51..38c5808 100644 Binary files a/lms/nladmin-system/doc/wms.xls and b/lms/nladmin-system/doc/wms.xls differ diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoClearInteractionData.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoClearInteractionData.java new file mode 100644 index 0000000..8fd4731 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoClearInteractionData.java @@ -0,0 +1,27 @@ +package org.nl.system.service.quartz.task; + +import lombok.extern.slf4j.Slf4j; +import org.nl.system.service.param.ISysParamService; +import org.nl.system.service.param.dao.Param; +import org.nl.wms.ext.record.service.ISysInteractRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @Author: lyd + * @Description: 自动清理交互数据 + * @Date: 2023/8/11 + */ +@Slf4j +@Component +public class AutoClearInteractionData { + @Autowired + private ISysInteractRecordService recordService; + @Autowired + private ISysParamService paramService; + public void run(){ + Param interactionDay = paramService.findByCode("interaction_day"); + recordService.deleteByDay(interactionDay.getValue()); + log.info("run 执行成功"); + } +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java index 8d02c53..6ebfd19 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java @@ -24,14 +24,14 @@ public interface AcsToWmsService { ApplyTaskResponse applyTakeFullVehicle(JSONObject param); /** 任务:申请强制取走满料盅托盘(强制入库) */ ApplyTaskResponse applyForceTakeFullVehicle(JSONObject param); - /** 任务:分拣回收剩料 todo: 暂时 */ + /** 任务:分拣回收剩料 */ ApplyTaskResponse applyForceTakeFullVehicleInStorage(JSONObject param); /** 强制去包装位(半托) 记录不包装 --- 业务不需要*/ String forceNoPackage(JSONObject param); /** 质检记录 */ BaseResponse qualityInspection(JSONObject param); /** 分拣 - 记录钢托与木托的绑定 */ - BaseResponse recordVehicleBiding(JSONObject param); + BaseResponse applyGetPutStation(JSONObject param); /** 反馈压机残留重量*/ BaseResponse applyFeedbackWeight(JSONObject param); /** 申请贴标 */ diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/BrickInfoDto.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/BrickInfoDto.java index 5428505..e53a48c 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/BrickInfoDto.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/BrickInfoDto.java @@ -1,6 +1,7 @@ package org.nl.wms.ext.acs.service.dto; import lombok.Data; +import org.nl.wms.ext.acs.service.dto.to.BaseRequest; /** * @Author: lyd @@ -8,7 +9,7 @@ import lombok.Data; * @Date: 2023/7/18 */ @Data -public class BrickInfoDto { +public class BrickInfoDto extends BaseRequest { /** 当前抓取工位 **/ private String get_station; /** 当前放置工位 **/ diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/ResultForAcs.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/ResultForAcs.java index a578c53..424377c 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/ResultForAcs.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/ResultForAcs.java @@ -2,12 +2,13 @@ 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返回的数据类型 + * @Description: 统一接口返回 - 请求ACS返回的数据类型 - 以前不做处理的类型 * @Date: 2023/7/28 */ @Data @@ -16,6 +17,7 @@ public class ResultForAcs { private String message; private String timestamp; private JSONObject data; + private JSONArray errArr; public static ResultForAcs requestRefuse(String message) { ResultForAcs result = new ResultForAcs(); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/acs/CreateTaskRequest.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/acs/CreateTaskRequest.java index 00b2c43..14dc059 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/acs/CreateTaskRequest.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/acs/CreateTaskRequest.java @@ -1,8 +1,12 @@ 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.to.BaseRequest; +import org.nl.wms.sch.task_manage.AcsTaskDto; +import java.util.List; import java.util.Map; /** @@ -12,119 +16,17 @@ import java.util.Map; */ @Data public class CreateTaskRequest extends BaseRequest { - - /** - * 任务标识 - */ - private String ext_task_id; - - /** - * 任务编号 - */ - private String task_code; - - /** - * 取货点1 - */ - String start_device_code; - - /** - * 放货点1 - */ - String next_device_code; - - /** - * 取货点2 - */ - String start_device_code2; - - /** - * 放货点2 - */ - String next_device_code2; - - /** - * 对接位 - */ - String put_device_code; - - /** - * 优先级 - */ - String priority; - - /** - * 载具号 - */ - String vehicle_code; - - /** - * 载具号2 - */ - String vehicle_code2; - - /** - * 载具类型 - */ - String vehicle_type; - - /** - * 路由方案 - */ - String route_plan_code; - - /** - * 任务类型 - */ - String task_type; - - /** - * 立库任务类型 - * - */ - String dtl_type; - - /** - * Agv系统类型 - * 1:1楼叉车系统 - * 2:2楼1区域AGV系统 - * 3:2楼2区域AGV系统 - */ - String agv_system_type; - - /** - * 备注 - */ - String remark; - - /** - * 烘箱时间 - */ - String oven_time; - - /** - * 烘箱温度 - */ - String temperature; - - /** - * agv取货高度 - */ - private String start_height; - - /** - * agv放货高度 - */ - private String next_height; - - /** - * 方向 1往左 2往右 - */ - private String direction; - /** - * 扩展属性 + * 任务数组 */ - Map params; + private List list = null; + public static CreateTaskRequest buildRequestObj(String name, List list) { + CreateTaskRequest request = new CreateTaskRequest(); + request.setRequest_medthod_name(name); + request.setRequestNo(IdUtil.simpleUUID()); + request.setRequestDate(DateUtil.now()); + request.setList(list); + return request; + } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/ApplyDeviceDto.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/ApplyDeviceDto.java new file mode 100644 index 0000000..68a7c18 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/ApplyDeviceDto.java @@ -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; +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/ApplySignalStatusRequest.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/ApplySignalStatusRequest.java new file mode 100644 index 0000000..efb8852 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/ApplySignalStatusRequest.java @@ -0,0 +1,27 @@ +package org.nl.wms.ext.acs.service.dto.to.wms; + +import lombok.Data; +import org.nl.wms.ext.acs.service.dto.to.BaseRequest; + +/** + * @Author: lyd + * @Description: 光电信号实时反馈 + * @Date: 2023/8/10 + */ +@Data +public class ApplySignalStatusRequest extends BaseRequest { + /** + * 光电信号 0无货 1有货 + */ + private String move; + + /** + * 载具类型 + */ + private String vehicle_type; + + /** + * 是否允许 0不允许 1允许 + */ + private String action; +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/ApplyTaskRequest.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/ApplyTaskRequest.java index 93a7ee2..576ca84 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/ApplyTaskRequest.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/ApplyTaskRequest.java @@ -4,6 +4,8 @@ import lombok.Data; import org.nl.wms.ext.acs.service.dto.to.BaseRequest; import org.nl.wms.ext.acs.service.dto.PalletizeDto; +import java.util.List; + /** * ACS 任务申请请求实体 */ @@ -44,5 +46,8 @@ public class ApplyTaskRequest extends BaseRequest { * 砖型 */ private PalletizeDto palletizeDto; - + /** + * 关联设备属性 + */ + private List list; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/CreateTaskResponse.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/CreateTaskResponse.java index a2f917f..a8dcfb4 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/CreateTaskResponse.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/CreateTaskResponse.java @@ -1,5 +1,8 @@ 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; @@ -10,6 +13,22 @@ import org.nl.wms.ext.acs.service.dto.to.BaseResponse; */ @Data public class CreateTaskResponse extends BaseResponse { + private JSONArray errArr = new JSONArray(); + public static CreateTaskResponse requestRefuse(String message) { + CreateTaskResponse result = new CreateTaskResponse(); + result.setCode(HttpStatus.HTTP_BAD_REQUEST); + result.setMessage(message); + result.setResponseDate(DateUtil.now()); + return result; + } + + public static CreateTaskResponse requestOk() { + CreateTaskResponse result = new CreateTaskResponse(); + result.setCode(HttpStatus.HTTP_OK); + result.setMessage("请求成功"); + result.setResponseDate(DateUtil.now()); + return result; + } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 897a9cf..7cabdb5 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -17,16 +17,14 @@ import org.nl.wms.database.brick.service.IMdBaseBrickInfoService; import org.nl.wms.database.material.service.IMdBaseMaterialService; import org.nl.wms.database.material.service.dao.MdBaseMaterial; import org.nl.wms.ext.acs.service.dto.*; -import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest; -import org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest; -import org.nl.wms.ext.acs.service.dto.to.wms.FeedBackSplitPalletStationRequest; -import org.nl.wms.ext.acs.service.dto.to.wms.FeedBackTaskStatusRequest; -import org.nl.wms.ext.acs.service.dto.to.wms.GetPalletizeRequest; +import org.nl.wms.ext.acs.service.dto.to.wms.*; import org.nl.wms.ext.acs.service.dto.to.BaseResponse; import org.nl.wms.ext.acs.service.AcsToWmsService; import org.nl.wms.ext.acs.service.dto.to.acs.ApplyTaskResponse; import org.nl.wms.ext.acs.service.dto.to.acs.GetPalletizeResponse; import org.nl.wms.ext.record.service.ISysInteractRecordService; +import org.nl.wms.pdm.consumption.service.IPdmBdMudConsumptionService; +import org.nl.wms.pdm.consumption.service.dao.PdmBdMudConsumption; import org.nl.wms.pdm.record.service.IPdmBdRequestMaterialRecordService; import org.nl.wms.pdm.record.service.dao.PdmBdRequestMaterialRecord; import org.nl.wms.pdm.residue.service.IPdmBdMaterialResidueService; @@ -61,7 +59,6 @@ import org.springframework.transaction.annotation.Transactional; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.List; import java.util.concurrent.TimeUnit; /** @@ -104,6 +101,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { private IPdmBdMaterialResidueService materialResidueService; @Autowired private IPdmBdVehicleBindingService vehicleBindingService; + @Autowired + private IPdmBdMudConsumptionService mudConsumptionService; @Override public BaseResponse acsApply(JSONObject param) { @@ -136,9 +135,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { /** * 任务:申请补满料盅托盘(叫料) - * @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest + * * @param param: ApplyTaskRequest的json形式 * @return + * @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest */ @Override @SneakyThrows @@ -169,9 +169,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { /** * 任务:申请补空料盅托盘(叫空盘) - * @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest + * * @param param: ApplyTaskRequest的json形式 * @return + * @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest */ @Override @SneakyThrows @@ -202,9 +203,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { /** * 任务:申请取走空料盅托盘(送空盘) - * @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest + * * @param param: ApplyTaskRequest的json形式 * @return + * @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest */ @Override @SneakyThrows @@ -235,9 +237,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { /** * 任务:申请取走满料盅托盘(入库) - * @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest + * * @param param: ApplyTaskRequest的json形式 * @return + * @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest */ @Override @SneakyThrows @@ -268,9 +271,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { /** * 任务:申请强制取走满料盅托盘(强制入库) - * @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest + * * @param param: ApplyTaskRequest的json形式 * @return + * @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest */ @Override @SneakyThrows @@ -300,9 +304,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { /** * 任务:申请强制满托入缓存 todo: 暂时 - * @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest + * * @param param: ApplyTaskRequest的json形式 * @return + * @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest */ public ApplyTaskResponse applyForceTakeFullVehicleInStorage(JSONObject param) { // 找到当前的设备 @@ -319,7 +324,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return ApplyTaskResponse.responseOk(requestNo); } - /** 强制去包装位(半托) 记录不包装 --- 业务不需要*/ + /** + * 强制去包装位(半托) 记录不包装 --- 业务不需要 + */ @Override @Deprecated public String forceNoPackage(JSONObject param) { @@ -327,7 +334,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return requestNo; } - /** 质检记录 */ + /** + * 质检记录 + */ @Override public BaseResponse qualityInspection(JSONObject param) { ApplyTaskRequest applyTaskRequest = param.toJavaObject(ApplyTaskRequest.class); @@ -336,19 +345,21 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return BaseResponse.responseOk(applyTaskRequest.getRequestNo()); } - /** 分拣 - 记录钢托与木托的绑定 */ + /** + * 分拣 - 记录钢托与木托的绑定 + */ @Override - public BaseResponse recordVehicleBiding(JSONObject param) { + public BaseResponse applyGetPutStation(JSONObject param) { FeedBackSplitPalletStationRequest request = param.toJavaObject(FeedBackSplitPalletStationRequest.class); String getStation = request.getGet_station(); // 取货点 String putStation = request.getPut_station(); // 放货点 // 查找当前点位中的信息,如果acs没有提供,就获取点位上的数据,如果点位没有,则数据失效 SchBasePoint pickupPoint = pointService.getById(getStation); SchBasePoint putPoint = pointService.getById(putStation); - if (request.getGet_station_vehicle_code() == null) { + if (request.getGet_station_vehicle_code() == null || request.getGet_station_vehicle_code().equals("0")) { request.setGet_station_vehicle_code(pickupPoint.getVehicle_code()); } - if (request.getPut_station_vehicle_code() == null) { + if (request.getPut_station_vehicle_code() == null || request.getPut_station_vehicle_code().equals("0")) { request.setPut_station_vehicle_code(putPoint.getVehicle_code()); } // 获取工单 @@ -356,11 +367,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { // 插入数据 PdmBdVehicleBinding vehicleBinding = new PdmBdVehicleBinding(); vehicleBinding.setOrigin_vehicle_code(request.getGet_station_vehicle_code()); - vehicleBinding.setOrigin_vehicle_type(pickupPoint.getVehicle_type()); + vehicleBinding.setOrigin_vehicle_type(GeneralDefinition.STEEL_TRAY); vehicleBinding.setOrigin_qty(request.getGet_station_qty()); // 当前码垛位的数量 vehicleBinding.setTarget_vehicle_code(request.getPut_station_vehicle_code()); vehicleBinding.setTarget_vehicle_type(putPoint.getVehicle_type()); vehicleBinding.setTarget_qty(request.getPut_station_qty()); // 当前拆垛位的数量 + vehicleBinding.setGet_station(request.getGet_station()); + vehicleBinding.setPut_station(request.getPut_station()); if (productionTask != null) { vehicleBinding.setOrder_code(productionTask.getWorkorder_code()); } @@ -369,7 +382,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } - /** 反馈压机残留重量*/ + /** + * 反馈压机残留重量 + */ @Override public BaseResponse applyFeedbackWeight(JSONObject param) { ApplyTaskRequest applyTaskRequest = param.toJavaObject(ApplyTaskRequest.class); @@ -377,7 +392,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return BaseResponse.responseOk(applyTaskRequest.getRequestNo()); } - /** 申请贴标 */ + /** + * 申请贴标 + */ @Override public BaseResponse applyLabelling(JSONObject param) { // 木托盘号##物料编码##数量##吨量(单重X数量)##生产日期## todo: 成型工单号(未添加) @@ -399,17 +416,19 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return BaseResponse.responseOk(requestNo, MapOf.of("labelling", sb.toString())); } - /** 单次放置完成 - 每块砖的信息 */ + /** + * 单次放置完成 - 每块砖的信息 + */ @Override public BaseResponse applyOneGrab(JSONObject param) { - String requestNo = param.getString("requestNo"); - JSONObject brickInfo = param.getJSONObject("brick_info"); - BrickInfoDto brickInfoDto = brickInfo.toJavaObject(BrickInfoDto.class); + BrickInfoDto brickInfoDto = param.toJavaObject(BrickInfoDto.class); baseBrickInfoService.addBrickInfo(brickInfoDto); // 添加数据 - return BaseResponse.responseOk(requestNo); + return BaseResponse.responseOk(brickInfoDto.getRequestNo()); } - /** 人工排产确认 */ + /** + * 人工排产确认 + */ @Override public BaseResponse orderVerify(JSONObject param) { // 执行中 String requestNo = param.getString("requestNo"); @@ -428,7 +447,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return BaseResponse.responseOk(requestNo); } - /** 工单完成 */ + /** + * 工单完成 + */ @Override public BaseResponse orderFinish(JSONObject param) { // 完成 String requestNo = param.getString("requestNo"); @@ -447,7 +468,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return BaseResponse.responseOk(requestNo); } - /** 扫码成功申请 - 判断是否静置完成 */ + /** + * 扫码成功申请 - 判断是否静置完成 + */ @Override public ApplyTaskResponse barcodeSuccessApply(JSONObject param) { ApplyTaskRequest baseRequest = param.toJavaObject(ApplyTaskRequest.class); @@ -467,7 +490,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } - /** 扫码成功申请 - 判断是否静置完成 */ + /** + * 扫码成功申请 - 判断是否静置完成 + */ @Override public ApplyTaskResponse isStandingFinish(ApplyTaskRequest baseRequest) { String requestNo = baseRequest.getRequestNo(); @@ -517,6 +542,16 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue()); TaskUtils.setGroupUpdateByAcs(one); vehiclematerialgroupService.updateById(one); + // 记录泥料 + PdmBdMudConsumption mudConsumption = new PdmBdMudConsumption(); + mudConsumption.setDevice_code(productionTask.getPoint_code()); + mudConsumption.setGroup_id(one.getGroup_id()); + mudConsumption.setMaterial_id(one.getMaterial_id()); + mudConsumption.setWeight(one.getMaterial_weight()); + mudConsumption.setCurrent_point(basePoint.getPoint_code()); + mudConsumption.setWorkorder_code(productionTask.getWorkorder_code()); + mudConsumption.setRaw_material_code(rawMaterialCode); + mudConsumptionService.create(mudConsumption); taskResponse.setMix_number(one.getMix_times()); taskResponse.setIs_standing_finish(GeneralDefinition.YES); taskResponse.setMessage("静置完成"); @@ -528,7 +563,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } } - /** 扫码成功申请 - 入窑记录时间 */ + /** + * 扫码成功申请 - 入窑记录时间 + */ @Override public ApplyTaskResponse recordKilnTime(ApplyTaskRequest baseRequest) { if (ObjectUtil.isEmpty(baseRequest.getVehicle_code())) { @@ -541,6 +578,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { // 入窑记录时间 SchBaseVehiclematerialgroup groupInfo = vehiclematerialgroupService.getGroupInfo(baseRequest.getVehicle_code(), baseRequest.getVehicle_type(), GroupBindMaterialStatusEnum.BOUND.getValue()); + if (ObjectUtil.isNotEmpty(groupInfo.getInto_kiln_time())) { + // 如果已经记录就跳过 + return ApplyTaskResponse.responseOk(baseRequest.getRequestNo()); + } groupInfo.setInto_kiln_time(DateUtil.now()); if (ObjectUtil.isNotEmpty(basePoint)) { // 记录当前位置 @@ -562,6 +603,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { /** * 压机请求要料 + * * @param param * @return */ @@ -569,14 +611,24 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { public BaseResponse pressRequestMaterial(JSONObject param) { // todo: 换成acs请求 String requestNo = param.getString("requestNo"); + String deviceCode = param.getString("device_code"); + SchBasePoint basePoint = pointService.getById(deviceCode); + if (ObjectUtil.isEmpty(basePoint)) { + throw new BadRequestException("设备[" + deviceCode + "]不存在"); + } + // 获取设备位 + SchBasePoint devicePoint = pointService.getById(basePoint.getParent_point_code()); // todo: 1、校验是否有工单,是否需要叫料 // todo: 2、通知混碾机生产泥料 // todo: 3、修改设备点位为空位,并且更新时间 + PointUtils.setUpdateByAcs(devicePoint); + PointUtils.clearPoint(devicePoint); return null; } /** * 提前要料 + * * @param param * @return */ @@ -601,7 +653,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } // 获取原材料物料 PdmBdRequestMaterialRecord requestMaterialRecord = new PdmBdRequestMaterialRecord(); - requestMaterialRecord.setRecord_id(IdUtil.getSnowflake(1,1).nextIdStr()); + requestMaterialRecord.setRecord_id(IdUtil.getSnowflake(1, 1).nextIdStr()); // requestMaterialRecord.setMaterial_id(workOrder.getRaw_material_id()); requestMaterialRecord.setWorkorder_id(workOrder.getWorkorder_id()); requestMaterialRecord.setDevice_code(parentPointCode); @@ -611,7 +663,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return BaseResponse.responseOk(requestNo); } - /** 任务反馈 */ + /** + * 任务反馈 + */ @Override public BaseResponse feedbackTaskStatus(JSONObject param) { // todo: action暂未维护 @@ -656,7 +710,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return BaseResponse.responseOk(requestNo, "任务状态反馈成功!"); } - /** 获取组盘信息 */ + /** + * 获取组盘信息 + */ @Override public GetPalletizeResponse getVehicleInfo(JSONObject param) { // 校验组盘信息 @@ -678,43 +734,46 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return GetPalletizeResponse.responseOk(palletizeRequest.getRequestNo(), palletizeDto); } - /** 实时修改点位状态 */ + /** + * 实时修改点位状态 + */ @Override public BaseResponse realTimeSetPoint(JSONObject param) { - // todo: 实体错误 - PutActionRequest actionRequest = param.toJavaObject(PutActionRequest.class); - String requestNo = actionRequest.getRequestNo(); + ApplySignalStatusRequest actionRequest = param.toJavaObject(ApplySignalStatusRequest.class); String deviceCode = actionRequest.getDevice_code(); - List list = actionRequest.getList(); + String move = null; + if (ObjectUtil.isNotEmpty(actionRequest.getMove())) { + move = (Integer.parseInt(actionRequest.getMove()) + 1) + ""; + } + String action = actionRequest.getAction(); String vehicleType = actionRequest.getVehicle_type(); if (deviceCode == null) { - return BaseResponse.responseError(requestNo, "设备编码不能为空"); - } - String move = ""; - // move 根据链表数据来 - for (SignalData signalData : list) { - if (signalData.getCode().equals("move")) { - move = (Integer.parseInt(signalData.getValue()) + 1) + ""; - } + return BaseResponse.responseError(actionRequest.getRequestNo(), "设备编码不能为空"); } // 找到点位 SchBasePoint schBasePoint = pointService.getById(deviceCode); if (ObjectUtil.isEmpty(schBasePoint)) { - return BaseResponse.responseError(requestNo, "设备: [" + deviceCode + "]未找到"); + return BaseResponse.responseError(actionRequest.getRequestNo(), "设备: [" + deviceCode + "]未找到"); } + // 点位的状态如果是null,就默认是空位置 String pointStatus = ObjectUtil.isNotEmpty(schBasePoint.getPoint_status()) ? schBasePoint.getPoint_status() : PointStatusEnum.EMPTY_POINT.getCode(); if ((pointStatus.equals(PointStatusEnum.FULL_POINT.getCode()) && move.equals(PointStatusEnum.EMPTY_VEHICLE.getCode())) || (pointStatus.equals(move))) { // 不做操作 - return BaseResponse.responseOk(requestNo); + return BaseResponse.responseOk(actionRequest.getRequestNo()); + } + // 载具类型不为空,并且不是0的情况,lmsVehicleTypeShift:转成lms的载具类型 + if (ObjectUtil.isNotEmpty(vehicleType) && !vehicleType.equals(GeneralDefinition.NO)) { + schBasePoint.setVehicle_type(TaskUtils.toLmsVehicleTypeShift(vehicleType)); } - if (vehicleType != null) { - schBasePoint.setVehicle_type(vehicleType); + if (ObjectUtil.isNotEmpty(action)) { + schBasePoint.setIs_used(action.equals(GeneralDefinition.YES)); } - schBasePoint.setPoint_status(move); + // move为空则表示无货 + schBasePoint.setPoint_status(move == null ? PointStatusEnum.EMPTY_POINT.getCode() : move); PointUtils.setUpdateByAcs(schBasePoint); pointService.updateById(schBasePoint); - return BaseResponse.responseOk(requestNo); + return BaseResponse.responseOk(actionRequest.getRequestNo()); } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java index 788c946..9240df9 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java @@ -40,7 +40,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Override public ResultForAcs getVehicleForLaminatingMachine(List list) { - String api = "api/wms/order"; // todo: 地址未确认 + String api = "/api/wms/action"; ResultForAcs resultForAcs = AcsUtil.notifyAcs(api, list); // 记录日志 interactRecordService.saveRecord("下发信号传送空木托盘", list, resultForAcs, GeneralDefinition.LMS_ACS); @@ -49,7 +49,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Override public ResultForAcs getDeviceStatusByCode(List list) { - String api = "api/wms/order"; // todo: 地址未确认 + String api = "api/"; // todo: 地址未确认 ResultForAcs resultForAcs = AcsUtil.notifyAcs(api, list); // 记录日志 interactRecordService.saveRecord("获取设备状态", list, resultForAcs, GeneralDefinition.LMS_ACS); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/ISysInteractRecordService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/ISysInteractRecordService.java index f4a2c3e..cb383e6 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/ISysInteractRecordService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/ISysInteractRecordService.java @@ -67,4 +67,6 @@ public interface ISysInteractRecordService extends IService { * @param direction */ void saveRecord(String name, K request, V response, String direction); + + void deleteByDay(String day); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/dao/mapper/SysInteractRecordMapper.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/dao/mapper/SysInteractRecordMapper.java index c7d1a0d..944417b 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/dao/mapper/SysInteractRecordMapper.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/dao/mapper/SysInteractRecordMapper.java @@ -9,4 +9,5 @@ import org.nl.wms.ext.record.service.dao.SysInteractRecord; **/ public interface SysInteractRecordMapper extends BaseMapper { + void deleteByDay(String day); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/dao/mapper/SysInteractRecordMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/dao/mapper/SysInteractRecordMapper.xml index 55417d8..2b30e1b 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/dao/mapper/SysInteractRecordMapper.xml +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/dao/mapper/SysInteractRecordMapper.xml @@ -2,4 +2,8 @@ + + DELETE FROM sys_interact_record + WHERE record_time DATE_SUB(NOW(), INTERVAL #{day} DAY); + diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/impl/SysInteractRecordServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/impl/SysInteractRecordServiceImpl.java index 037e763..c5e902f 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/impl/SysInteractRecordServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/impl/SysInteractRecordServiceImpl.java @@ -14,6 +14,7 @@ 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.CreateTaskResponse; import org.nl.wms.ext.record.service.ISysInteractRecordService; import org.nl.wms.ext.record.service.dao.mapper.SysInteractRecordMapper; import org.nl.wms.ext.record.service.dao.SysInteractRecord; @@ -128,7 +129,18 @@ public class SysInteractRecordServiceImpl extends ServiceImpl query(@RequestParam Map whereJson, PageQuery page){ + return new ResponseEntity<>(TableDataInfo.build(pdmBdMudConsumptionService.queryAll(whereJson,page)),HttpStatus.OK); + } + + @PostMapping + @Log("新增泥料消耗记录") + @ApiOperation("新增泥料消耗记录") + //@SaCheckPermission("@el.check('pdmBdMudConsumption:add')") + public ResponseEntity create(@Validated @RequestBody PdmBdMudConsumption entity){ + pdmBdMudConsumptionService.create(entity); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改泥料消耗记录") + @ApiOperation("修改泥料消耗记录") + //@SaCheckPermission("@el.check('pdmBdMudConsumption:edit')") + public ResponseEntity update(@Validated @RequestBody PdmBdMudConsumption entity){ + pdmBdMudConsumptionService.update(entity); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除泥料消耗记录") + @ApiOperation("删除泥料消耗记录") + //@SaCheckPermission("@el.check('pdmBdMudConsumption:del')") + @DeleteMapping + public ResponseEntity delete(@RequestBody Set ids) { + pdmBdMudConsumptionService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/IPdmBdMudConsumptionService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/IPdmBdMudConsumptionService.java new file mode 100644 index 0000000..a92e414 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/IPdmBdMudConsumptionService.java @@ -0,0 +1,43 @@ +package org.nl.wms.pdm.consumption.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.nl.common.domain.query.PageQuery; +import com.baomidou.mybatisplus.extension.service.IService; +import org.nl.wms.pdm.consumption.service.dao.PdmBdMudConsumption; + +import java.util.Map; +import java.util.Set; + +/** +* @description 服务接口 +* @author lyd +* @date 2023-08-11 +**/ +public interface IPdmBdMudConsumptionService extends IService { + + /** + * 查询数据分页 + * @param whereJson 条件 + * @param pageable 分页参数 + * @return IPage + */ + IPage queryAll(Map whereJson, PageQuery pageable); + + /** + * 创建 + * @param entity / + */ + void create(PdmBdMudConsumption entity); + + /** + * 编辑 + * @param entity / + */ + void update(PdmBdMudConsumption entity); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(Set ids); +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dao/PdmBdMudConsumption.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dao/PdmBdMudConsumption.java new file mode 100644 index 0000000..21fb772 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dao/PdmBdMudConsumption.java @@ -0,0 +1,53 @@ +package org.nl.wms.pdm.consumption.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.math.BigDecimal; +import java.io.Serializable; + +/** +* @description / +* @author lyd +* @date 2023-08-11 +**/ +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("pdm_bd_mud_consumption") +public class PdmBdMudConsumption implements Serializable { + + private static final long serialVersionUID = 1L; + + @TableId(value = "record_id", type = IdType.NONE) + @ApiModelProperty(value = "记录标识") + private String record_id; + + @ApiModelProperty(value = "泥料编码") + private String raw_material_code; + + @ApiModelProperty(value = "设备编码") + private String device_code; + + @ApiModelProperty(value = "泥料重量") + private BigDecimal weight; + + @ApiModelProperty(value = "工单号") + private String workorder_code; + + @ApiModelProperty(value = "物料id") + private String material_id; + + @ApiModelProperty(value = "记录时间") + private String record_time; + + @ApiModelProperty(value = "组盘标识") + private String group_id; + + @ApiModelProperty(value = "下料位编码") + private String current_point; + +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dao/mapper/PdmBdMudConsumptionMapper.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dao/mapper/PdmBdMudConsumptionMapper.java new file mode 100644 index 0000000..4e6c41e --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dao/mapper/PdmBdMudConsumptionMapper.java @@ -0,0 +1,12 @@ +package org.nl.wms.pdm.consumption.service.dao.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.nl.wms.pdm.consumption.service.dao.PdmBdMudConsumption; + +/** +* @author lyd +* @date 2023-08-11 +**/ +public interface PdmBdMudConsumptionMapper extends BaseMapper { + +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dao/mapper/PdmBdMudConsumptionMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dao/mapper/PdmBdMudConsumptionMapper.xml new file mode 100644 index 0000000..7ef7304 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dao/mapper/PdmBdMudConsumptionMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dto/PdmBdMudConsumptionDto.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dto/PdmBdMudConsumptionDto.java new file mode 100644 index 0000000..57cc820 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dto/PdmBdMudConsumptionDto.java @@ -0,0 +1,41 @@ +package org.nl.wms.pdm.consumption.service.dto; + +import java.math.BigDecimal; +import lombok.Data; +import java.io.Serializable; + +/** +* @description / +* @author lyd +* @date 2023-08-11 +**/ +@Data +public class PdmBdMudConsumptionDto implements Serializable { + + /** 记录标识 */ + private String record_id; + + /** 泥料编码 */ + private String raw_material_code; + + /** 设备编码 */ + private String device_code; + + /** 泥料重量 */ + private BigDecimal weight; + + /** 工单号 */ + private String workorder_code; + + /** 物料id */ + private String material_id; + + /** 记录时间 */ + private String record_time; + + /** 组盘标识 */ + private String group_id; + + /** 下料位编码 */ + private String current_point; +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dto/PdmBdMudConsumptionQuery.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dto/PdmBdMudConsumptionQuery.java new file mode 100644 index 0000000..4ae6a5a --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/dto/PdmBdMudConsumptionQuery.java @@ -0,0 +1,12 @@ +package org.nl.wms.pdm.consumption.service.dto; + +import org.nl.common.domain.query.BaseQuery; +import org.nl.wms.pdm.consumption.service.dao.PdmBdMudConsumption; + +/** +* @author lyd +* @date 2023-08-11 +**/ +public class PdmBdMudConsumptionQuery extends BaseQuery { + +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/impl/PdmBdMudConsumptionServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/impl/PdmBdMudConsumptionServiceImpl.java new file mode 100644 index 0000000..bff3784 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/consumption/service/impl/PdmBdMudConsumptionServiceImpl.java @@ -0,0 +1,68 @@ +package org.nl.wms.pdm.consumption.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +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.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.common.domain.query.PageQuery; +import org.nl.common.exception.BadRequestException; +import org.nl.common.utils.SecurityUtils; +import org.nl.wms.pdm.consumption.service.IPdmBdMudConsumptionService; +import org.nl.wms.pdm.consumption.service.dao.mapper.PdmBdMudConsumptionMapper; +import org.nl.wms.pdm.consumption.service.dao.PdmBdMudConsumption; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Map; +import java.util.Set; + +/** +* @description 服务实现 +* @author lyd +* @date 2023-08-11 +**/ +@Slf4j +@Service +public class PdmBdMudConsumptionServiceImpl extends ServiceImpl implements IPdmBdMudConsumptionService { + + @Autowired + private PdmBdMudConsumptionMapper pdmBdMudConsumptionMapper; + + @Override + public IPage queryAll(Map whereJson, PageQuery page){ + LambdaQueryWrapper lam = new LambdaQueryWrapper<>(); + IPage pages = new Page<>(page.getPage() + 1, page.getSize()); + pdmBdMudConsumptionMapper.selectPage(pages, lam); + return pages; + } + + @Override + public void create(PdmBdMudConsumption entity) { + String now = DateUtil.now(); + + entity.setRecord_id(IdUtil.getSnowflake(1, 1).nextIdStr()); + entity.setRecord_time(now); + pdmBdMudConsumptionMapper.insert(entity); + } + + @Override + public void update(PdmBdMudConsumption entity) { + PdmBdMudConsumption dto = pdmBdMudConsumptionMapper.selectById(entity.getRecord_id()); + if (dto == null) throw new BadRequestException("被删除或无权限,操作失败!"); + String now = DateUtil.now(); + entity.setRecord_time(now); + + pdmBdMudConsumptionMapper.updateById(entity); + } + + @Override + public void deleteAll(Set ids) { + // 真删除 + pdmBdMudConsumptionMapper.deleteBatchIds(ids); + } + +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java index 8498c23..e51f7a5 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java @@ -27,6 +27,7 @@ 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; /** @@ -63,15 +64,14 @@ public class SchBasePointServiceImpl extends ServiceImpl 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, "")) diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java index 2a65660..dcb0425 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java @@ -5,11 +5,14 @@ import cn.hutool.core.lang.Assert; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.http.HttpStatus; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; import org.nl.wms.ext.acs.service.dto.ResultForAcs; +import org.nl.wms.ext.acs.service.dto.to.acs.CreateTaskRequest; +import org.nl.wms.ext.acs.service.dto.to.wms.CreateTaskResponse; import org.nl.wms.ext.record.service.ISysInteractRecordService; import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService; import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; @@ -63,7 +66,7 @@ public abstract class AbstractTask { * @author ldjun * @created 2020年6月12日 下午5:52:28 */ - protected ResultForAcs renotifyAcs(SchBaseTask task) { + protected CreateTaskResponse renotifyAcs(SchBaseTask task) { Assert.notNull(task); List taskList = new ArrayList<>(); taskList.add(task); @@ -76,8 +79,8 @@ public abstract class AbstractTask { * @author ldjun * @created 2020年6月12日 下午5:52:28 */ - protected ResultForAcs renotifyAcs(List taskList) { - ResultForAcs resultForAcs = ResultForAcs.requestOk(); + protected CreateTaskResponse renotifyAcs(List taskList) { + CreateTaskResponse resultForAcs = CreateTaskResponse.requestOk(); //1、获取任务 //2、根据任务配置补全任务 //3、下发 @@ -89,9 +92,7 @@ public abstract class AbstractTask { JSONObject jsonObject = JSONObject.parseObject(responseParam); taskDto.setDirection(jsonObject.getString("direction")); } - taskDto.setRequestNo(IdUtil.simpleUUID());// todo - taskDto.setRequestDate(DateUtil.now()); - taskDto.setExt_task_id(task.getTask_id()); + taskDto.setExt_task_uuid(task.getTask_id()); taskDto.setTask_code(task.getTask_code()); taskDto.setRoute_plan_code("normal"); taskDto.setStart_device_code(task.getPoint_code1()); @@ -104,17 +105,36 @@ public abstract class AbstractTask { list.add(taskDto); } try { - resultForAcs = AcsUtil.notifyAcs("api/wms/task", list); + // 创建下发对象 + resultForAcs = AcsUtil.notifyAcs2("api/wms/task", + CreateTaskRequest.buildRequestObj("下发任务", list)); } catch (Exception e) { log.error("任务下发异常: {}", e.getMessage()); - resultForAcs.setTimestamp(DateUtil.now()); - resultForAcs.setStatus(HttpStatus.HTTP_BAD_REQUEST); + resultForAcs.setResponseDate(DateUtil.now()); + resultForAcs.setCode(HttpStatus.HTTP_BAD_REQUEST); resultForAcs.setMessage(e.getMessage()); } // 如果下发完毕,就修改状态 - if (resultForAcs.getStatus() == 200) { + if (resultForAcs.getCode() == 200) { + // 解析 + JSONArray errArr = resultForAcs.getErrArr(); for (SchBaseTask schBaseTask : taskList) { - schBaseTask.setTask_status(TaskStatus.ISSUED.getCode()); + if (errArr == null) { + schBaseTask.setTask_status(TaskStatus.ISSUED.getCode()); + } else { + schBaseTask.setTask_status(TaskStatus.ISSUED.getCode()); + // 判断是否是出错的任务 + for (int i = 0; i < errArr.size(); i++) { + JSONObject errObj = errArr.getJSONObject(i); + String taskCode = errObj.getString("task_code"); + if (taskCode.equals(schBaseTask.getTask_code())) { + // 出错的任务就设置出错信息为备注,不是出错就设置下发 + schBaseTask.setTask_status(TaskStatus.CREATED.getCode()); + schBaseTask.setRemark(errObj.getString("message")); + break; + } + } + } } taskService.updateBatchById(taskList); } @@ -221,7 +241,7 @@ public abstract class AbstractTask { String apply_point_code = param.getString("device_code"); // 请求点 String config_code = param.getString("config_code"); String requestNo = param.getString("requestNo"); - String vehicleType = TaskUtils.acsVehicleTypeShift(param.getString("vehicle_type")); + String vehicleType = TaskUtils.toAcsVehicleTypeShift(param.getString("vehicle_type")); String vehicleCode = TaskUtils.defaultVehicleCode(param.getString("vehicle_code")); // 1、校验数据 SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper() diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AcsTaskDto.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AcsTaskDto.java index b99039b..0ee6ec0 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AcsTaskDto.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AcsTaskDto.java @@ -3,7 +3,122 @@ package org.nl.wms.sch.task_manage; import lombok.Data; import org.nl.wms.ext.acs.service.dto.to.acs.CreateTaskRequest; +import java.util.Map; + @Data -public class AcsTaskDto extends CreateTaskRequest { +public class AcsTaskDto { + /** + * 任务标识 + */ + private String ext_task_uuid; + + /** + * 任务编号 + */ + private String task_code; + + + /** + * 取货点1 + */ + String start_device_code; + + /** + * 放货点1 + */ + String next_device_code; + + /** + * 取货点2 + */ + String start_device_code2; + + /** + * 放货点2 + */ + String next_device_code2; + + /** + * 对接位 + */ + String put_device_code; + + /** + * 优先级 + */ + String priority; + + /** + * 载具号 + */ + String vehicle_code; + + /** + * 载具号2 + */ + String vehicle_code2; + + /** + * 载具类型 + */ + String vehicle_type; + + /** + * 路由方案 + */ + String route_plan_code; + + /** + * 任务类型 + */ + String task_type; + + /** + * 立库任务类型 + * + */ + String dtl_type; + + /** + * Agv系统类型 + * 1:1楼叉车系统 + * 2:2楼1区域AGV系统 + * 3:2楼2区域AGV系统 + */ + String agv_system_type; + + /** + * 备注 + */ + String remark; + + /** + * 烘箱时间 + */ + String oven_time; + + /** + * 烘箱温度 + */ + String temperature; + + /** + * agv取货高度 + */ + private String start_height; + + /** + * agv放货高度 + */ + private String next_height; + + /** + * 方向 1往左 2往右 + */ + private String direction; + /** + * 扩展属性 + */ + Map params; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/AcsUtil.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/AcsUtil.java index 4469ea7..ec7b382 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/AcsUtil.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/AcsUtil.java @@ -11,6 +11,8 @@ import org.nl.config.SpringContextHolder; import org.nl.system.service.param.dao.Param; import org.nl.system.service.param.impl.SysParamServiceImpl; import org.nl.wms.ext.acs.service.dto.ResultForAcs; +import org.nl.wms.ext.acs.service.dto.to.acs.CreateTaskRequest; +import org.nl.wms.ext.acs.service.dto.to.wms.CreateTaskResponse; import org.nl.wms.sch.task_manage.GeneralDefinition; import java.util.List; @@ -64,4 +66,40 @@ public class AcsUtil { } return resultForAcs; } + + public static CreateTaskResponse notifyAcs2(String api, T object) { + SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class); + //判断是否连接ACS系统 + Param isConnectAcs = sysParamService.findByCode(GeneralDefinition.IS_CONNECT_ACS); + if (ObjectUtil.isEmpty(isConnectAcs)) { + return CreateTaskResponse.requestRefuse("参数表中:" + GeneralDefinition.IS_CONNECT_ACS + "不存在"); + } + String isConnect = isConnectAcs.getValue(); + //ACS地址:127.0.0.1:8010 + Param acsUrlObj = sysParamService.findByCode(GeneralDefinition.ACS_URL); + if (ObjectUtil.isEmpty(acsUrlObj)) { + return CreateTaskResponse.requestRefuse("参数表中:" + GeneralDefinition.ACS_URL + "不存在"); + } + String acsUrl = acsUrlObj.getValue(); + JSONObject result; + if (StrUtil.equals(GeneralDefinition.NO, isConnect)) { + return CreateTaskResponse.requestRefuse("未连接ACS!"); + } + String url = acsUrl + api; + log.info("下发acs任务的参数为:{}", object.toString()); + CreateTaskResponse resultForAcs; + try { + String resultMsg = HttpRequest.post(url) + .body(JSON.toJSONString(object)) + .execute().body(); + result = JSONObject.parseObject(resultMsg); + resultForAcs = JSONObject.toJavaObject(result, CreateTaskResponse.class); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + log.error("连接失败:{}", msg); + return CreateTaskResponse.requestRefuse("网络不通,操作失败!"); + } + return resultForAcs; + } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java index 03e4ad6..5aef859 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java @@ -3,6 +3,7 @@ package org.nl.wms.sch.task_manage.task.tasks.fj; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.nl.common.exception.BadRequestException; @@ -10,6 +11,7 @@ import org.nl.common.utils.CodeUtil; import org.nl.config.MapOf; 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.ApplyDeviceDto; 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; @@ -77,6 +79,10 @@ public class FJMKTask extends AbstractTask { .collect(Collectors.toList()); String requestParam = task.getRequest_param();// 任务的其他数据 JSONObject jsonObject = JSONObject.parseObject(requestParam); + String startPoint = task.getPoint_code1(); + // 获取起点 回写载具编码 + SchBasePoint startPointObj = pointService.getById(startPoint); + task.setVehicle_code(startPointObj.getVehicle_code()); // 起点的木托盘编码 // 找终点 /** 包装位 */ SchBasePoint packagePoint = findNextPoint(nextRegionStr, jsonObject); @@ -90,9 +96,14 @@ public class FJMKTask extends AbstractTask { } task.setPoint_code2(packagePoint.getPoint_code()); // 包装线 // todo: 校验是否够码满一托 + List list = JSONArray.parseArray(jsonObject.getString("list"), ApplyDeviceDto.class); // 1 获取点位相应数量 + int sum = 0; + for (ApplyDeviceDto applyDeviceDto : list) { + sum += Integer.parseInt(applyDeviceDto.getQty()); + } // 2 获取库存数量 - // 3 木托盘需要多少块 + // 3 获取木托盘需要多少块 /** 覆膜机木托盘位 */ SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject); if (ObjectUtil.isEmpty(LaminatePoint)) { @@ -107,7 +118,7 @@ public class FJMKTask extends AbstractTask { String vehicleCode = CodeUtil.getNewCode("VEHICLE_CODE"); // 设置终点并修改创建成功状态 task.setPoint_code3(LaminatePoint.getParent_point_code()); - task.setPoint_code4(task.getPoint_code1()); + task.setPoint_code4(startPoint); task.setVehicle_code2(vehicleCode); // 覆膜机下的木托盘编码 task.setTask_status(TaskStatus.CREATED.getCode()); task.setRemark(""); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJQLTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJQLTask.java index 50aa426..85fad62 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJQLTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJQLTask.java @@ -71,6 +71,8 @@ public class FJQLTask extends AbstractTask { .eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); for (SchBaseTask task : tasks) { TaskUtils.setUpdateByAcs(task); + // 钢托盘 + task.setVehicle_type(GeneralDefinition.STEEL_TRAY); List startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")) .collect(Collectors.toList()); // 找起点 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJRKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJRKTask.java index 1a570b0..d5400a5 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJRKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJRKTask.java @@ -63,6 +63,10 @@ public class FJRKTask extends AbstractTask { .eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); for (SchBaseTask task : tasks) { TaskUtils.setUpdateByAcs(task); + // 获取起点 回写载具编码 + String startPoint = task.getPoint_code1(); + SchBasePoint startPointObj = pointService.getById(startPoint); + task.setVehicle_code(startPointObj.getVehicle_code()); List nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(",")).collect(Collectors.toList()); // 找终点 SchBasePoint point = findNextPoint(nextRegionStr); @@ -110,33 +114,26 @@ public class FJRKTask extends AbstractTask { public String setGroupPlate(JSONObject param) { // 强制入库组盘 // 组盘,返回组盘标识,设置待绑定,搬运结束就设置已绑定 - String vehicleCode = param.getString("vehicle_code"); - if (vehicleCode == null) { - throw new BadRequestException("载具编码不能为空"); - } + String deviceCode = param.getString("device_code"); String vehicleType = param.getString("vehicle_type"); - String workorderCode = param.getString("workorder_code"); JSONObject stackParameters = param.getJSONObject("palletize"); if (vehicleType == null) { vehicleType = GeneralDefinition.STEEL_TRAY; } - String deviceCode = param.getString("device_code"); // 砖块数量 Integer qty = param.getInteger("qty"); SchBasePoint basePoint = pointService.getById(deviceCode); - PdmBdWorkorder workorderObject = ObjectUtil.isNotEmpty(workorderCode) - ? workorderService.getOne(new LambdaQueryWrapper() - .eq(PdmBdWorkorder::getWorkorder_code, workorderCode)) - : null; + String vehicleCode = basePoint.getVehicle_code(); + PdmBdWorkorder workorderObject = workorderService.getDeviceProductionTask(basePoint.getParent_point_code()); // 找到相同组盘信息就直接返回id,避免任务取消组盘信息还存在,重复插入 + SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup(); + groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr()); SchBaseVehiclematerialgroup groupObject = vehiclematerialgroupService.getGroupInfo(vehicleCode, vehicleType, GroupBindMaterialStatusEnum.BOUND.getValue(), workorderObject.getMaterial_id()); if (groupObject != null) { - return groupObject.getGroup_id(); + groupEntity = groupObject; } // 要把数据存到组盘表 - SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup(); - groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr()); groupEntity.setMaterial_id(ObjectUtil.isNotEmpty(workorderObject) ? workorderObject.getMaterial_id() : ""); @@ -162,7 +159,7 @@ public class FJRKTask extends AbstractTask { groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); // 绑定 groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。 groupEntity.setIs_delete(false); - vehiclematerialgroupService.save(groupEntity); + vehiclematerialgroupService.saveOrUpdate(groupEntity); // 将所有当前位置的砖块设置组盘标识 // baseBrickInfoService.setGroupByCurrentAllBrick(deviceCode, groupEntity.getGroup_id()); // 返回组盘id记录任务中 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java index cb40f89..001183b 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java @@ -104,7 +104,8 @@ public class HNMLTask extends AbstractTask { .eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); for (SchBaseTask task : tasks) { TaskUtils.setUpdateByAcs(task); // 修改修改者 - List nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(",")).collect(Collectors.toList()); + List nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(",")) + .collect(Collectors.toList()); String requestParam = task.getRequest_param();// 任务的其他数据 JSONObject jsonObject = JSONObject.parseObject(requestParam); // 找终点 @@ -284,7 +285,7 @@ public class HNMLTask extends AbstractTask { SchBasePoint basePoint = pointService.getOne(new LambdaQueryWrapper() .eq(SchBasePoint::getPoint_code, deviceCode) .eq(SchBasePoint::getIs_used, true)); - if (vehicleCode == null) { + if (vehicleCode == null || vehicleCode.equals(GeneralDefinition.NO)) { throw new BadRequestException("载具编码不能为空"); } SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup(); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZQKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZQKTask.java index 37c4305..5b0eb28 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZQKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZQKTask.java @@ -66,7 +66,7 @@ public class YZQKTask extends AbstractTask { SchBasePoint point = findStartPoint(startRegionStr, jsonObject); if (ObjectUtil.isEmpty(point)) { task.setRemark("未找到所需点位!"); - taskService.update(task); + taskService.updateById(task); // 消息通知 noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(), NoticeTypeEnum.WARN.getCode()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/PointUtils.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/PointUtils.java index 0d52fa1..a903347 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/PointUtils.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/PointUtils.java @@ -8,6 +8,7 @@ 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; @@ -55,8 +56,8 @@ public class PointUtils { /** 点位修改更新信息 **/ public static void setUpdateByAcs(SchBasePoint pointObj) { - pointObj.setUpdate_id("2"); - pointObj.setUpdate_name("ACS系统"); + pointObj.setUpdate_id(GeneralDefinition.ACS_ID); + pointObj.setUpdate_name(GeneralDefinition.ACS_NAME); pointObj.setUpdate_time(DateUtil.now()); } /** 点位修改更新信息 **/ diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/TaskUtils.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/TaskUtils.java index 6a2380f..35db0a3 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/TaskUtils.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/TaskUtils.java @@ -10,15 +10,11 @@ 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.service.impl.SchBaseTaskServiceImpl; 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 org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; import java.util.List; -import java.util.function.Consumer; /** * @Author: lyd @@ -129,12 +125,13 @@ public class TaskUtils { } /** + * 转成ACS需要的载具类型 * ACS载具类型:1 2 3 ... * LMS载具类型:3 4 5 ... * @param acsVehicleType * @return */ - public static String acsVehicleTypeShift(String acsVehicleType) { + public static String toAcsVehicleTypeShift(String acsVehicleType) { if (ObjectUtil.isEmpty(acsVehicleType)) { return null; } @@ -148,12 +145,13 @@ public class TaskUtils { } /** + * 转成LMS需要的载具类型 * ACS载具类型:1 2 3 ... * LMS载具类型:3 4 5 ... * @param lmsVehicleType * @return */ - public static String lmsVehicleTypeShift(String lmsVehicleType) { + public static String toLmsVehicleTypeShift(String lmsVehicleType) { if (ObjectUtil.isEmpty(lmsVehicleType)) { return null; } diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index b233cd0..1a0a1e0 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -54,7 +54,6 @@ spring: multi-statement-allow: true redis: #数据库索引 - database: ${REDIS_DB:2} host: ${REDIS_HOST:127.0.0.1} port: ${REDIS_PORT:6379} password: ${REDIS_PWD:} @@ -63,6 +62,7 @@ spring: threads: 4 nettyThreads: 4 singleServerConfig: + database: 3 connectionMinimumIdleSize: 8 connectionPoolSize: 8 address: redis://127.0.0.1:6379 @@ -163,7 +163,7 @@ sa-token: token-session-check-login: false alone-redis: # Redis数据库索引(默认为0) - database: 2 + database: 8 # Redis服务器地址 host: 127.0.0.1 # Redis服务器连接端口 diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml index 5c671f7..53955f1 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml @@ -53,7 +53,6 @@ spring: multi-statement-allow: true redis: #数据库索引 - database: ${REDIS_DB:15} host: ${REDIS_HOST:127.0.0.1} port: ${REDIS_PORT:6379} password: ${REDIS_PWD:} @@ -62,6 +61,7 @@ spring: threads: 4 nettyThreads: 4 singleServerConfig: + database: 15 connectionMinimumIdleSize: 8 connectionPoolSize: 8 address: redis://127.0.0.1:6379 @@ -165,5 +165,32 @@ sa-token: jwt-secret-key: opsjajisdnnca0sdkksdfaaasdfwwq # token 前缀 token-prefix: Bearer - is-read-cookie: false - is-read-body: false + sso: + # Ticket有效期 (单位: 秒),默认五分钟 + ticket-timeout: 300 + # 所有允许的授权回调地址 + allow-url: "*" + # 是否打开单点注销功能 + is-slo: true + + # ------- SSO-模式三相关配置 (下面的配置在SSO模式三并且 is-slo=true 时打开) + # 是否打开模式三 + isHttp: true + # 接口调用秘钥(用于SSO模式三的单点注销功能) + secretkey: kQwIOrYvnXmSDkwEiFngrKidMcdrgKor + # ---- 除了以上配置项,你还需要为 Sa-Token 配置http请求处理器(文档有步骤说明) + is-read-cookie: true + is-print: false + # 未登录 StpUtil.getTokenSession() 设置值,获取值 @SaIgnore 得忽略接口 + token-session-check-login: false + alone-redis: + # Redis数据库索引(默认为0) + database: 9 + # Redis服务器地址 + host: 127.0.0.1 + # Redis服务器连接端口 + port: 6379 + # Redis服务器连接密码(默认为空) + password: + # 连接超时时间 + timeout: 10s diff --git a/lms/nladmin-system/nlsso-server/src/test/java/org/nl/point/test.java b/lms/nladmin-system/nlsso-server/src/test/java/org/nl/point/test.java index 266e1d7..6eea692 100644 --- a/lms/nladmin-system/nlsso-server/src/test/java/org/nl/point/test.java +++ b/lms/nladmin-system/nlsso-server/src/test/java/org/nl/point/test.java @@ -1,15 +1,23 @@ package org.nl.point; import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.checkerframework.checker.units.qual.A; import org.junit.jupiter.api.Test; import org.nl.common.exception.BadRequestException; +import org.nl.wms.ext.acs.service.dto.to.wms.ApplyDeviceDto; +import org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest; import org.nl.wms.sch.region.service.ISchBaseRegionService; import org.nl.wms.sch.region.service.dao.SchBaseRegion; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; +import java.util.List; + /** * @Author: lyd * @Description: @@ -72,4 +80,23 @@ public class test { } } + @Test + public void test04() { + List list = new ArrayList<>(); + for (int i = 0; i < 2; i++) { + ApplyDeviceDto applyDeviceDto = new ApplyDeviceDto(); + applyDeviceDto.setDevice_code("t" + i); + applyDeviceDto.setVehicle_code("v" + i); + applyDeviceDto.setVehicle_type("1"); + applyDeviceDto.setQty(String.valueOf(12 + i)); + list.add(applyDeviceDto); + } + ApplyTaskRequest a = new ApplyTaskRequest(); + a.setList(list); + a.setRequestNo("sfasdf"); + String s = JSON.toJSONString(a); + JSONObject jsonObject = JSONObject.parseObject(s); + System.out.println(jsonObject); + } + } diff --git a/lms/nladmin-system/nlsso-server/src/test/java/org/nl/task/MapperTest.java b/lms/nladmin-system/nlsso-server/src/test/java/org/nl/task/MapperTest.java index 902ab17..26eab6b 100644 --- a/lms/nladmin-system/nlsso-server/src/test/java/org/nl/task/MapperTest.java +++ b/lms/nladmin-system/nlsso-server/src/test/java/org/nl/task/MapperTest.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.junit.jupiter.api.Test; +import org.nl.common.exception.BadRequestException; import org.nl.config.MapOf; import org.nl.wms.sch.point.service.ISchBasePointService; import org.nl.wms.sch.point.service.dao.SchBasePoint; @@ -172,4 +173,59 @@ public class MapperTest { jsonObject.put("point_name", "测试"); testMapper.updateByObject(jsonObject); } + + + @Test + void test111() { + try { + for (int i = 0; i < 5; i++) { + // 参数处理 + if (i == 1) { + throw new BadRequestException("出错了 - 1"); + } + try { + // 创建 + if (i == 2) { + throw new BadRequestException("出错了 - 2"); + } + }catch (Exception e) { + // 记录 + System.out.println("捕获 - 2"); + } + + // 成功 + System.out.println(i); + } + } catch (Exception e) { + System.out.println("捕获 - 1"); + } + } + @Test + void test112() { + try { + // 转换 + for (int i = 0; i < 5; i++) { + try { + // 参数处理 + if (i == 1) { + throw new BadRequestException("出错了 - 1"); + } + // 创建任务 + if (i == 2) { + throw new BadRequestException("出错了 - 2"); + } + + // 成功 + System.out.println(i); + } catch (Exception e) { + // add + System.out.println("ssssssss"); + } + } + } catch (Exception e) { + // x 400 + } + // 200 errArray() + + } } diff --git a/lms/nladmin-ui/src/views/wms/pdm/consumption/index.vue b/lms/nladmin-ui/src/views/wms/pdm/consumption/index.vue new file mode 100644 index 0000000..d7d390a --- /dev/null +++ b/lms/nladmin-ui/src/views/wms/pdm/consumption/index.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/lms/nladmin-ui/src/views/wms/pdm/consumption/pdmBdMudConsumption.js b/lms/nladmin-ui/src/views/wms/pdm/consumption/pdmBdMudConsumption.js new file mode 100644 index 0000000..a9605a7 --- /dev/null +++ b/lms/nladmin-ui/src/views/wms/pdm/consumption/pdmBdMudConsumption.js @@ -0,0 +1,27 @@ +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/pdmBdMudConsumption', + method: 'post', + data + }) +} + +export function del(ids) { + return request({ + url: 'api/pdmBdMudConsumption/', + method: 'delete', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/pdmBdMudConsumption', + method: 'put', + data + }) +} + +export default { add, edit, del }