opt: 分切任务代码
This commit is contained in:
@@ -116,7 +116,7 @@ public class AcsToWmsController {
|
||||
}
|
||||
|
||||
/*@PostMapping("/getQZZInfo")
|
||||
|
||||
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getQZZInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.getQZZInfo(jo), HttpStatus.OK);
|
||||
@@ -177,5 +177,10 @@ public class AcsToWmsController {
|
||||
return new ResponseEntity<>(acsToWmsService.deviceApplyExceptional(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/slitterApply")
|
||||
@Log(value = "二期分切请求", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> slitterApply(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(acsToWmsService.slitterApply(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,4 +167,11 @@ public interface AcsToWmsService {
|
||||
* }
|
||||
*/
|
||||
JSONObject deviceApplyExceptional(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 二期分切请求
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject slitterApply(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.nl.b_lms.sch.task.dao.SchBaseTask;
|
||||
import org.nl.b_lms.sch.task.service.IschBaseTaskService;
|
||||
import org.nl.b_lms.sch.tasks.TwoBoxExcepTask;
|
||||
import org.nl.b_lms.sch.tasks.first_floor_area.MzhcwTask;
|
||||
import org.nl.b_lms.sch.tasks.slitter.service.SlitterService;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.b_lms.storage_manage.ios.enums.TASKEnum;
|
||||
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.*;
|
||||
@@ -47,6 +48,7 @@ import org.nl.wms.st.inbill.service.RawAssistIStorService;
|
||||
import org.nl.wms.st.inbill.service.StorPublicService;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -126,6 +128,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Resource
|
||||
private MzhcwTask mzhcwTask;
|
||||
|
||||
private final SlitterService slitterService;
|
||||
|
||||
|
||||
/**
|
||||
* task_id:任务标识
|
||||
@@ -2029,4 +2033,56 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public JSONObject slitterApply(JSONObject param) {
|
||||
log.info("slitterApply请求参数:---------------------------------------------{}", param);
|
||||
JSONObject res = new JSONObject();
|
||||
String deviceCode = param.getString("device_code");
|
||||
String type = param.getString("type");
|
||||
if (ObjectUtil.isEmpty(type)) {
|
||||
throw new BadRequestException("任务类型「type」不能为空");
|
||||
}
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
switch (type) {
|
||||
case "1":
|
||||
// 申请套管
|
||||
res = slitterService.acsRequestShaftLoadTube(param);
|
||||
break;
|
||||
case "2":
|
||||
// 套管完成
|
||||
res = slitterService.acsFinishLoadShaft(param);
|
||||
break;
|
||||
case "3":
|
||||
// 拔轴完成
|
||||
res = slitterService.acsFinishShaftPluckTube(param);
|
||||
break;
|
||||
case "4":
|
||||
// 申请拔轴
|
||||
res = slitterService.acsRequestShaftPluckTube(param);
|
||||
break;
|
||||
case "5":
|
||||
// 缓存线已满,生产桁架任务
|
||||
res = slitterService.acsSendShaftToCache(param);
|
||||
break;
|
||||
default:
|
||||
log.error("slitterApply任务类型「{}」无效!,参数:---------------------------------------------{}", type, param);
|
||||
throw new BadRequestException("任务类型「" + type + "」无效!");
|
||||
}
|
||||
} else {
|
||||
log.error("slitterApply系统繁忙,参数:---------------------------------------------{}", param);
|
||||
throw new BadRequestException("系统繁忙,请稍后再试!");
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
log.info("slitterApply返回参数:---------------------------------------------{}", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user