add:acstolms 接口

This commit is contained in:
2024-02-22 19:11:38 +08:00
parent 64e3d286cc
commit 621fe7362e
13 changed files with 600 additions and 10 deletions

View File

@@ -149,5 +149,26 @@ public class AcsToWmsController {
return new ResponseEntity<>(acsToWmsService.sendProductToFirstFloor(json), HttpStatus.OK);
}
@PostMapping("/applyTwo")
@Log(value = "二期入库申请任务", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
@SaIgnore
public ResponseEntity<Object> applyTwo(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(acsToWmsService.applyTwo(whereJson), HttpStatus.OK);
}
@PostMapping("/applySendOutTwo")
@Log(value = "二期发货申请任务", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
@SaIgnore
public ResponseEntity<Object> applySendOutTwo(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(acsToWmsService.applySendOutTwo(whereJson), HttpStatus.OK);
}
@PostMapping("/deviceApplyTwo")
@Log(value = "二期发货申请捆扎、贴标", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
@SaIgnore
public ResponseEntity<Object> deviceApplyTwo(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(acsToWmsService.deviceApplyTwo(whereJson), HttpStatus.OK);
}
}

View File

@@ -121,4 +121,38 @@ public interface AcsToWmsService {
JSONObject sendProductToFirstFloor(JSONObject whereJson);
/**
* 二期入库任务申请
* @param whereJson {
* type任务类型1-成品入库任务 2-空盘入库 3-空盘出库 4-异常处理位)
* device_code设备号
* vehicle_code载具号
* material_barcode子卷编码a,b,c
* container_type托盘类型1-小托盘 2-大托盘)
*
* }
* @return JSONObject 反馈状态
*/
JSONObject applyTwo(JSONObject whereJson);
/**
* 二期发货申请任务
* @param whereJson {
* device_code: 设备号
* vehicle_code: 载具号
* }
* @return JSONObject 反馈状态
*/
JSONObject applySendOutTwo(JSONObject whereJson);
/**
* 二期申请捆扎、贴标
* @param whereJson {
* device_code: 设备号
* vehicle_code: 载具号
* type: 任务类型1-贴标 2-捆扎)
* }
* @return
*/
JSONObject deviceApplyTwo(JSONObject whereJson);
}

View File

@@ -27,7 +27,13 @@ import org.nl.b_lms.sch.task.dao.SchBaseTask;
import org.nl.b_lms.sch.task.dao.mapper.SchBaseTaskMapper;
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
import org.nl.b_lms.sch.task.service.impl.SchBaseTaskServiceImpl;
import org.nl.b_lms.sch.tasks.TwoEmpExcepTask;
import org.nl.b_lms.sch.tasks.packingArea.MzhcwTask;
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InBussManageService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InVehicleManageService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.OutVehicleManageService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.SendOutManageService;
import org.nl.common.enums.PackageInfoIvtEnum;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
@@ -86,6 +92,25 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
private final ISysNoticeService noticeService;
/**
* 入库处理类服务
*/
private final InBussManageService inBussManageService;
/**
* 空载具入库处理服务
*/
private final InVehicleManageService inVehicleManageService;
/**
* 空载具出库处理服务
*/
private final OutVehicleManageService outVehicleManageService;
/**
* 发货处理服务
*/
private final SendOutManageService sendOutManageService;
@Resource
private IschBaseTaskService taskService;
@@ -1756,4 +1781,165 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
}
@Override
@Transactional(rollbackFor = Exception.class)
@SneakyThrows
public JSONObject applyTwo(JSONObject whereJson) {
log.info("applyTwo请求参数---------------------------------------------" + whereJson.toString());
JSONObject result = new JSONObject();
String type = whereJson.getString("type");
RLock lock = redissonClient.getLock("acs_to_wms_two_a:" + type);
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
try {
if (tryLock) {
// 基础校验
if (ObjectUtil.isEmpty(whereJson.getString("device_code"))) {
throw new BadRequestException("设备不能为空!");
}
if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("空盘入库")) || type.equals(IOSEnum.ACSTOLMS_TYPE.code("异常处理位"))) {
if (ObjectUtil.isEmpty(whereJson.getString("container_type"))) {
throw new BadRequestException("载具类型不能为空!");
}
if (ObjectUtil.isEmpty(whereJson.getString("vehicle_code"))) {
throw new BadRequestException("载具不能为空!");
}
}
// 1-成品入库任务
if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("成品入库任务"))) {
// 调用服务处理
if (ObjectUtil.isEmpty(whereJson.getString("material_barcode"))) {
throw new BadRequestException("子卷号不能为空!");
}
inBussManageService.inTask(whereJson);
} else if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("空盘入库"))) {
// 2-空盘入库
whereJson.put("vehicle_type",whereJson.getString("container_type"));
inVehicleManageService.inVehicle(whereJson);
} else if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("空盘出库"))) {
// 3-空盘出库
if (ObjectUtil.isEmpty(whereJson.getString("container_type"))) {
throw new BadRequestException("载具类型不能为空!");
}
whereJson.put("vehicle_type",whereJson.getString("container_type"));
outVehicleManageService.outVehicle(whereJson);
} else if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("异常处理位"))) {
// 4-异常处理
JSONObject jsonTaskParam = new JSONObject();
jsonTaskParam.put("task_type", "010504");
jsonTaskParam.put("start_device_code", whereJson.getString("device_code"));
jsonTaskParam.put("next_device_code", "");
jsonTaskParam.put("vehicle_code", whereJson.getString("vehicle_code"));
jsonTaskParam.put("vehicle_type", whereJson.getString("container_type"));
TwoEmpExcepTask taskBean = new TwoEmpExcepTask();
taskBean.createTask(jsonTaskParam);
}
result.put("status", HttpStatus.OK.value());
result.put("message", "下发成功!");
log.info("applyTwo返回参数---------------------------------------------" + result.toString());
return result;
}
} finally {
if (tryLock) {
lock.unlock();
}
}
result.put("status", HttpStatus.BAD_REQUEST.value());
result.put("message", "申请任务超时!" + type);
log.info("applyTwo返回参数---------------------------------------------" + result.toString());
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject applySendOutTwo(JSONObject whereJson) {
log.info("applySendOutTwo输入参数---------------------------------------------" + whereJson.toString());
// 校验
if (ObjectUtil.isEmpty(whereJson.getString("device_code"))) {
throw new BadRequestException("设备号不能为空!");
}
if (ObjectUtil.isEmpty(whereJson.getString("vehicle_code"))) {
throw new BadRequestException("载具号不能为空!");
}
JSONObject result = new JSONObject();
try {
// 调用服务
sendOutManageService.createSendOutTask(whereJson);
result.put("status", HttpStatus.OK.value());
result.put("message", "下发成功!");
return result;
} catch (Exception e) {
result.put("status", HttpStatus.BAD_REQUEST.value());
result.put("message", e.getMessage());
}
log.info("applySendOutTwo返回参数---------------------------------------------" + result.toString());
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
@SneakyThrows
public JSONObject deviceApplyTwo(JSONObject whereJson) {
log.info("deviceApplyTwo请求参数---------------------------------------------" + whereJson.toString());
JSONObject result = new JSONObject();
String type = whereJson.getString("type");
RLock lock = redissonClient.getLock("acs_to_wms_two_b:" + type);
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
try {
if (tryLock) {
// 校验
if (ObjectUtil.isEmpty(whereJson.getString("device_code"))) {
throw new BadRequestException("设备号不能为空!");
}
if (ObjectUtil.isEmpty(whereJson.getString("vehicle_code"))) {
throw new BadRequestException("载具号不能为空!");
}
// 1-贴标
if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("贴标"))) {
} else if (type.equals(IOSEnum.ACSTOLMS_TYPE.code("贴标"))) {
// 2-捆扎
}
result.put("status", HttpStatus.OK.value());
result.put("message", "下发成功!");
log.info("deviceApplyTwo返回参数---------------------------------------------" + result.toString());
return result;
}
} finally {
if (tryLock) {
lock.unlock();
}
}
result.put("status", HttpStatus.BAD_REQUEST.value());
result.put("message", "申请任务超时!" + type);
log.info("deviceApplyTwo返回参数---------------------------------------------" + result.toString());
return result;
}
}

View File

@@ -5,7 +5,9 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvOutService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.impl.*;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InBussManageService;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.LashManageService;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.st.inbill.service.CheckOutBillService;
@@ -38,6 +40,8 @@ public class CheckOutBillController {
private final LashManageService lashManageService;
private final InBussManageService inBussManageService;
private final SendOutManageServiceImpl sendOutManageService;
@GetMapping
@@ -409,4 +413,11 @@ public class CheckOutBillController {
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/testIn")
@Log("申请入库")
public ResponseEntity<Object> testIn(@RequestBody JSONObject whereJson) {
inBussManageService.inTask(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
}