Compare commits
3 Commits
5582a6929c
...
bcff5830f4
Author | SHA1 | Date | |
---|---|---|---|
bcff5830f4 | |||
75471b7166 | |||
ec7f364ccf |
@ -86,16 +86,13 @@ public class CurrTaskController extends BaseController {
|
|||||||
stoveCodes.forEach(kilnMap -> {
|
stoveCodes.forEach(kilnMap -> {
|
||||||
codeStr.add(kilnMap.get("code"));
|
codeStr.add(kilnMap.get("code"));
|
||||||
});
|
});
|
||||||
for (String s : codeStr)
|
for (String s : codeStr) {
|
||||||
{
|
if (s.equals(kilnCode)) {
|
||||||
if (s.equals(kilnCode))
|
|
||||||
{
|
|
||||||
verifyCodes = true;
|
verifyCodes = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!verifyCodes)
|
if (!verifyCodes) {
|
||||||
{
|
|
||||||
return failed("创建失败,APMS中验证炉号" + kilnCode + "失败!");
|
return failed("创建失败,APMS中验证炉号" + kilnCode + "失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +127,7 @@ public class CurrTaskController extends BaseController {
|
|||||||
//currTaskById.setSheetNo(sheetNo);
|
//currTaskById.setSheetNo(sheetNo);
|
||||||
//currTaskService.updateCurrTaskById(currTaskById);
|
//currTaskService.updateCurrTaskById(currTaskById);
|
||||||
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
|
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
|
||||||
return successful(0,"创建成功,任务添加至等待执行队列。详情请在订单加工管理下当前任务列表查看","");
|
return successful(0, "创建成功,任务添加至等待执行队列。详情请在订单加工管理下当前任务列表查看", "");
|
||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
@ -140,18 +137,18 @@ public class CurrTaskController extends BaseController {
|
|||||||
|
|
||||||
@PostMapping(value = "createAutoTask")
|
@PostMapping(value = "createAutoTask")
|
||||||
@ApiOperation(value = "订单加工-创建多个个分步骤加工任务至任务队列")
|
@ApiOperation(value = "订单加工-创建多个个分步骤加工任务至任务队列")
|
||||||
public R<String> createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam){
|
public R<String> createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam) {
|
||||||
List<TaskCreateParam> detParams = autoCurrTaskParam.getTaskCreateParamList();
|
List<TaskCreateParam> detParams = autoCurrTaskParam.getTaskCreateParamList();
|
||||||
if (detParams.size()==0){
|
if (detParams.size() == 0) {
|
||||||
return failed("请添加至少一个标识卡!");
|
return failed("请添加至少一个标识卡!");
|
||||||
}
|
}
|
||||||
Boolean apmsCreateProcessSheet=false;
|
Boolean apmsCreateProcessSheet = false;
|
||||||
String sheetNo=null;
|
String sheetNo = null;
|
||||||
int i=1;
|
int i = 1;
|
||||||
R<ApmsCreateProcessSheetVo> processSheet=null;
|
R<ApmsCreateProcessSheetVo> processSheet = null;
|
||||||
//自动任务循环添加多条currTask
|
//自动任务循环添加多条currTask
|
||||||
AutoExeTask autoExeTask=new AutoExeTask();
|
AutoExeTask autoExeTask = new AutoExeTask();
|
||||||
for (TaskCreateParam param:detParams
|
for (TaskCreateParam param : detParams
|
||||||
) {
|
) {
|
||||||
//验证标识卡号正确无误。
|
//验证标识卡号正确无误。
|
||||||
orderInfoService.verifyTaskInfoByIdenCardNum(param.getDetParams());
|
orderInfoService.verifyTaskInfoByIdenCardNum(param.getDetParams());
|
||||||
@ -166,16 +163,13 @@ public class CurrTaskController extends BaseController {
|
|||||||
stoveCodes.forEach(kilnMap -> {
|
stoveCodes.forEach(kilnMap -> {
|
||||||
codeStr.add(kilnMap.get("code"));
|
codeStr.add(kilnMap.get("code"));
|
||||||
});
|
});
|
||||||
for (String s : codeStr)
|
for (String s : codeStr) {
|
||||||
{
|
if (s.equals(kilnCode)) {
|
||||||
if (s.equals(kilnCode))
|
|
||||||
{
|
|
||||||
verifyCodes = true;
|
verifyCodes = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!verifyCodes)
|
if (!verifyCodes) {
|
||||||
{
|
|
||||||
return failed("创建失败,APMS中验证炉号" + kilnCode + "失败!");
|
return failed("创建失败,APMS中验证炉号" + kilnCode + "失败!");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -210,7 +204,7 @@ public class CurrTaskController extends BaseController {
|
|||||||
currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
|
currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
|
||||||
CurrTask currTask = currTaskServiceBiz.getById(mainTask.getData().getId());
|
CurrTask currTask = currTaskServiceBiz.getById(mainTask.getData().getId());
|
||||||
//工艺步骤中第一步
|
//工艺步骤中第一步
|
||||||
if (param.getAutoTaskStep()==1){
|
if (param.getAutoTaskStep() == 1) {
|
||||||
autoExeTask.setInterCode(CodeGeneratorHelper.getAutoTaskCode());
|
autoExeTask.setInterCode(CodeGeneratorHelper.getAutoTaskCode());
|
||||||
autoExeTask.setProcessFlowType(param.getAutoTaskType());
|
autoExeTask.setProcessFlowType(param.getAutoTaskType());
|
||||||
autoExeTask.setFTaskId(currTask.getId());
|
autoExeTask.setFTaskId(currTask.getId());
|
||||||
@ -222,7 +216,7 @@ public class CurrTaskController extends BaseController {
|
|||||||
setCommonField(autoExeTask);
|
setCommonField(autoExeTask);
|
||||||
autoExeTaskServiceBiz.save(autoExeTask);
|
autoExeTaskServiceBiz.save(autoExeTask);
|
||||||
}
|
}
|
||||||
if (param.getAutoTaskStep()==2){
|
if (param.getAutoTaskStep() == 2) {
|
||||||
autoExeTask.setTTaskId(currTask.getId());
|
autoExeTask.setTTaskId(currTask.getId());
|
||||||
autoExeTask.setTDetTaskCode(currTask.getTaskCode());
|
autoExeTask.setTDetTaskCode(currTask.getTaskCode());
|
||||||
autoExeTask.setTEquipmentId(currTask.getKilnId());
|
autoExeTask.setTEquipmentId(currTask.getKilnId());
|
||||||
@ -232,7 +226,7 @@ public class CurrTaskController extends BaseController {
|
|||||||
setUpdateCommonField(autoExeTask);
|
setUpdateCommonField(autoExeTask);
|
||||||
autoExeTaskServiceBiz.updateById(autoExeTask);
|
autoExeTaskServiceBiz.updateById(autoExeTask);
|
||||||
}
|
}
|
||||||
if (param.getAutoTaskStep()==3){
|
if (param.getAutoTaskStep() == 3) {
|
||||||
autoExeTask.setThTaskId(currTask.getId());
|
autoExeTask.setThTaskId(currTask.getId());
|
||||||
autoExeTask.setThDetTaskCode(currTask.getTaskCode());
|
autoExeTask.setThDetTaskCode(currTask.getTaskCode());
|
||||||
autoExeTask.setThEquipmentId(currTask.getKilnId());
|
autoExeTask.setThEquipmentId(currTask.getKilnId());
|
||||||
@ -257,7 +251,7 @@ public class CurrTaskController extends BaseController {
|
|||||||
//}
|
//}
|
||||||
//i++;
|
//i++;
|
||||||
}
|
}
|
||||||
return successful(0,"操作成功,任务加入待执行队列,详情请在订单加工管理下当前任务列表查看!","");
|
return successful(0, "操作成功,任务加入待执行队列,详情请在订单加工管理下当前任务列表查看!", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "mainCurrentTaskNow")
|
@PostMapping(value = "mainCurrentTaskNow")
|
||||||
@ -277,11 +271,25 @@ public class CurrTaskController extends BaseController {
|
|||||||
public R<List<CurrTaskInfoVo>> currentTaskInfo(@Validated @RequestBody CurrTaskQueryParam param) {
|
public R<List<CurrTaskInfoVo>> currentTaskInfo(@Validated @RequestBody CurrTaskQueryParam param) {
|
||||||
return currTaskService.currentTaskInfoPage(param);
|
return currTaskService.currentTaskInfoPage(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "taskInfoNotToApms")
|
||||||
|
@ApiOperation(value = "获取未报工任务列表以及详情")
|
||||||
|
public R<List<CurrTaskInfoVo>> taskInfoNotToApms(@Validated @RequestBody CurrTaskQueryParam param) {
|
||||||
|
return currTaskService.currentTaskInfoPageForNotToApms(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "oneStepToApms")
|
||||||
|
@ApiOperation(value = "手动报工")
|
||||||
|
public R<String> oneStepToApms(@Validated @RequestBody CurrTaskInfoVo currTaskInfoVo) {
|
||||||
|
return currTaskService.oneStepToApms(currTaskInfoVo);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping(value = "updateCurrTaskStatus")
|
@PostMapping(value = "updateCurrTaskStatus")
|
||||||
@ApiOperation(value = "更新任务状态")
|
@ApiOperation(value = "更新任务状态")
|
||||||
public R<String> updateCurrTaskStatus(@Validated @RequestBody CurrTaskParam param){
|
public R<String> updateCurrTaskStatus(@Validated @RequestBody CurrTaskParam param) {
|
||||||
return currTaskService.updateCurrTaskStatus(param);
|
return currTaskService.updateCurrTaskStatus(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "completeTask")
|
@PostMapping(value = "completeTask")
|
||||||
@ApiOperation(value = "执行任务完成(仅wms,不通知apms)")
|
@ApiOperation(value = "执行任务完成(仅wms,不通知apms)")
|
||||||
public R<String> completeTask(@Validated @RequestBody IdParam param) {
|
public R<String> completeTask(@Validated @RequestBody IdParam param) {
|
||||||
@ -305,26 +313,30 @@ public class CurrTaskController extends BaseController {
|
|||||||
public R<String> top(@Validated @RequestBody IdParam param) {
|
public R<String> top(@Validated @RequestBody IdParam param) {
|
||||||
return currTaskService.top(param);
|
return currTaskService.top(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "runTask")
|
@PostMapping(value = "runTask")
|
||||||
@ApiOperation(value = "执行任务")
|
@ApiOperation(value = "执行任务")
|
||||||
public R<String> runTask(@Validated @RequestBody IdParam param) throws InterruptedException, IOException {
|
public R<String> runTask(@Validated @RequestBody IdParam param) throws InterruptedException, IOException {
|
||||||
//点击执行按钮会判断当前任务是否为自动任务,如果是自动任务会去自动任务查一下该自动任务的上一步是否已完成(仅非一步时)
|
//点击执行按钮会判断当前任务是否为自动任务,如果是自动任务会去自动任务查一下该自动任务的上一步是否已完成(仅非一步时)
|
||||||
return currTaskService.runTask(param.getId());
|
return currTaskService.runTask(param.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "testRunTask")
|
@PostMapping(value = "testRunTask")
|
||||||
@ApiOperation(value = "执行任务")
|
@ApiOperation(value = "执行任务")
|
||||||
public R<String> testRunTask(@RequestBody RGVTask rgvTask){
|
public R<String> testRunTask(@RequestBody RGVTask rgvTask) {
|
||||||
sendTaskToRgv(rgvTask.getTaskType(),rgvTask.getVehicleId(),rgvTask.getTaskNo(),rgvTask.getPickRow(),rgvTask.getSendRow(),rgvTask.getProcessNumber());
|
sendTaskToRgv(rgvTask.getTaskType(), rgvTask.getVehicleId(), rgvTask.getTaskNo(), rgvTask.getPickRow(), rgvTask.getSendRow(), rgvTask.getProcessNumber());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "testRgv")
|
@PostMapping(value = "testRgv")
|
||||||
@ApiOperation(value = "测试rgv避让逻辑")
|
@ApiOperation(value = "测试rgv避让逻辑")
|
||||||
private String testRgv(@RequestBody TestRgv testRgv) throws IOException {
|
private String testRgv(@RequestBody TestRgv testRgv) throws IOException {
|
||||||
Long aLong = taskDistanceUtils.chooseVehicle(testRgv.getStartPoint(), testRgv.getEndPoint());
|
Long aLong = taskDistanceUtils.chooseVehicle(testRgv.getStartPoint(), testRgv.getEndPoint());
|
||||||
Boolean aBoolean = taskDistanceUtils.conflictForVehicle(testRgv.getVehicleId(), testRgv.getStartPoint(), testRgv.getEndPoint(), testRgv.getOtherVehicle());
|
Boolean aBoolean = taskDistanceUtils.conflictForVehicle(testRgv.getVehicleId(), testRgv.getStartPoint(), testRgv.getEndPoint(), testRgv.getOtherVehicle());
|
||||||
return String.valueOf(aLong)+String.valueOf(aBoolean);
|
return String.valueOf(aLong) + String.valueOf(aBoolean);
|
||||||
}
|
}
|
||||||
private Integer sendTaskToRgv(Integer taskType,Long vehicleId, Long currTaskId, Long startPoint, Long endPoint, Integer processNumber) {
|
|
||||||
|
private Integer sendTaskToRgv(Integer taskType, Long vehicleId, Long currTaskId, Long startPoint, Long endPoint, Integer processNumber) {
|
||||||
Map<String, Object> json = new HashMap();
|
Map<String, Object> json = new HashMap();
|
||||||
// taskType 1 搬运
|
// taskType 1 搬运
|
||||||
json.put("taskType", taskType);
|
json.put("taskType", taskType);
|
||||||
@ -351,7 +363,7 @@ public class CurrTaskController extends BaseController {
|
|||||||
|
|
||||||
@PostMapping(value = "testStoveCode")
|
@PostMapping(value = "testStoveCode")
|
||||||
@ApiOperation(value = "测试炉号生成")
|
@ApiOperation(value = "测试炉号生成")
|
||||||
public String testStoveCode(@RequestBody TestStoveCode testStoveCode){
|
public String testStoveCode(@RequestBody TestStoveCode testStoveCode) {
|
||||||
return StoveCodeUtils.getStoveCode(testStoveCode.getKilnName(),testStoveCode.getCraft());
|
return StoveCodeUtils.getStoveCode(testStoveCode.getKilnName(), testStoveCode.getCraft());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -477,11 +477,15 @@ public class EnergyController extends BaseController {
|
|||||||
//获取检验结果
|
//获取检验结果
|
||||||
List<ApmsCheckResult> apmsCheckResults = apmsCheckResultServiceBiz.list(new QueryWrapper<ApmsCheckResult>()
|
List<ApmsCheckResult> apmsCheckResults = apmsCheckResultServiceBiz.list(new QueryWrapper<ApmsCheckResult>()
|
||||||
.eq(ApmsCheckResult.SHEET_NO, currTask.getSheetNo()));
|
.eq(ApmsCheckResult.SHEET_NO, currTask.getSheetNo()));
|
||||||
|
if (apmsCheckResults.size() != 0) {
|
||||||
List<ApmsCheckResultVo> apmsCheckResultVos = BeanUtils.copyList(apmsCheckResults, ApmsCheckResultVo.class);
|
List<ApmsCheckResultVo> apmsCheckResultVos = BeanUtils.copyList(apmsCheckResults, ApmsCheckResultVo.class);
|
||||||
for (ApmsCheckResultVo apmsCheckResultVo : apmsCheckResultVos
|
for (ApmsCheckResultVo apmsCheckResultVo : apmsCheckResultVos
|
||||||
) {
|
) {
|
||||||
apmsCheckResultVo.setStoveCode(currTask.getStoveCode());
|
apmsCheckResultVo.setStoveCode(currTask.getStoveCode());
|
||||||
}
|
}
|
||||||
|
checkResultList.add(apmsCheckResultVos);
|
||||||
|
}
|
||||||
|
|
||||||
Long kilnId = currTask.getKilnId();
|
Long kilnId = currTask.getKilnId();
|
||||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
|
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(kilnId);
|
||||||
Integer kilnType = kilnInfo.getType();
|
Integer kilnType = kilnInfo.getType();
|
||||||
@ -717,7 +721,6 @@ public class EnergyController extends BaseController {
|
|||||||
if (parRotSpeedValueList.size() > 0) {
|
if (parRotSpeedValueList.size() > 0) {
|
||||||
if (kilnType == 1) {
|
if (kilnType == 1) {
|
||||||
List<EnergyVo> rot1Consume = new ArrayList<>();
|
List<EnergyVo> rot1Consume = new ArrayList<>();
|
||||||
List<EnergyVo> rot2Consume = new ArrayList<>();
|
|
||||||
for (ParRotSpeedValue parRotSpeedValue : parRotSpeedValueList
|
for (ParRotSpeedValue parRotSpeedValue : parRotSpeedValueList
|
||||||
) {
|
) {
|
||||||
EnergyVo rot1Vo = EnergyVo.builder().build();
|
EnergyVo rot1Vo = EnergyVo.builder().build();
|
||||||
@ -727,17 +730,8 @@ public class EnergyController extends BaseController {
|
|||||||
rot1Vo.setValue(parRotSpeedValue.getOilStiSpeedAValue());
|
rot1Vo.setValue(parRotSpeedValue.getOilStiSpeedAValue());
|
||||||
rot1Vo.setTime(parRotSpeedValue.getCreateTime());
|
rot1Vo.setTime(parRotSpeedValue.getCreateTime());
|
||||||
rot1Consume.add(rot1Vo);
|
rot1Consume.add(rot1Vo);
|
||||||
|
|
||||||
EnergyVo rot2Vo = EnergyVo.builder().build();
|
|
||||||
rot2Vo.setCode(currTask.getStoveCode());
|
|
||||||
rot2Vo.setUnit("转/min");
|
|
||||||
rot2Vo.setName("2号油搅拌转速");
|
|
||||||
rot2Vo.setValue(parRotSpeedValue.getOilStiSpeedBValue());
|
|
||||||
rot2Vo.setTime(parRotSpeedValue.getCreateTime());
|
|
||||||
rot1Consume.add(rot2Vo);
|
|
||||||
}
|
}
|
||||||
rot1ConsumeList.add(rot1Consume);
|
rot1ConsumeList.add(rot1Consume);
|
||||||
rot2ConsumeList.add(rot2Consume);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//温度趋势(实际温度、设定温度)油槽温度外区温度
|
//温度趋势(实际温度、设定温度)油槽温度外区温度
|
||||||
@ -839,30 +833,11 @@ public class EnergyController extends BaseController {
|
|||||||
setTempVo.setName("设定温度");
|
setTempVo.setName("设定温度");
|
||||||
setupTempConsume.add(setTempVo);
|
setupTempConsume.add(setTempVo);
|
||||||
|
|
||||||
EnergyVo outer1TempVo = EnergyVo.builder().build();
|
|
||||||
outer1TempVo.setTime(parTemValue.getCreateTime());
|
|
||||||
outer1TempVo.setCode(currTask.getStoveCode());
|
|
||||||
outer1TempVo.setUnit("℃");
|
|
||||||
outer1TempVo.setValue(parTemValue.getOuterZone1Temp());
|
|
||||||
outer1TempVo.setName("外一区温度");
|
|
||||||
setupTempConsume.add(outer1TempVo);
|
|
||||||
|
|
||||||
EnergyVo outer2TempVo = EnergyVo.builder().build();
|
|
||||||
outer2TempVo.setTime(parTemValue.getCreateTime());
|
|
||||||
outer2TempVo.setCode(currTask.getStoveCode());
|
|
||||||
outer2TempVo.setUnit("℃");
|
|
||||||
outer2TempVo.setValue(parTemValue.getOuterZone2Temp());
|
|
||||||
outer2TempVo.setName("外二区温度");
|
|
||||||
setupTempConsume.add(outer2TempVo);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
tempConsumeList.add(actualTempConsume);
|
tempConsumeList.add(actualTempConsume);
|
||||||
tempConsumeList.add(setupTempConsume);
|
tempConsumeList.add(setupTempConsume);
|
||||||
outerZone1TempConsumeList.add(outerZone1TempConsume);
|
|
||||||
outerZone2TempConsumeList.add(outerZone2TempConsume);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkResultList.add(apmsCheckResultVos);
|
|
||||||
}
|
}
|
||||||
map.put("checkResult", checkResultList);
|
map.put("checkResult", checkResultList);
|
||||||
map.put("ele", eleConsumeList);
|
map.put("ele", eleConsumeList);
|
||||||
@ -879,11 +854,8 @@ public class EnergyController extends BaseController {
|
|||||||
map.put("ammon", ammoniaConsumeList);
|
map.put("ammon", ammoniaConsumeList);
|
||||||
map.put("car", carbonConsumeList);
|
map.put("car", carbonConsumeList);
|
||||||
map.put("rot1", rot1ConsumeList);
|
map.put("rot1", rot1ConsumeList);
|
||||||
map.put("rot2", rot2ConsumeList);
|
|
||||||
map.put("temp", tempConsumeList);
|
map.put("temp", tempConsumeList);
|
||||||
map.put("oilTemp", oilTempConsumeList);
|
map.put("oilTemp", oilTempConsumeList);
|
||||||
map.put("outer1Temp", outerZone1TempConsumeList);
|
|
||||||
map.put("outer2Temp", outerZone2TempConsumeList);
|
|
||||||
return successful(JSONObject.parseObject(JSON.toJSONString(map)));
|
return successful(JSONObject.parseObject(JSON.toJSONString(map)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,22 @@ public interface CurrTaskService {
|
|||||||
*/
|
*/
|
||||||
R<List<CurrTaskInfoVo>> currentTaskInfoPage(CurrTaskQueryParam param);
|
R<List<CurrTaskInfoVo>> currentTaskInfoPage(CurrTaskQueryParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未成功报工任务查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
R<List<CurrTaskInfoVo>> currentTaskInfoPageForNotToApms(CurrTaskQueryParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未成功报工任务查询
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
R<String> oneStepToApms(CurrTaskInfoVo currTaskInfoVo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新任务状态
|
* 更新任务状态
|
||||||
*
|
*
|
||||||
@ -97,6 +113,7 @@ public interface CurrTaskService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
R<String> deleteBySheetNo(String sheetNo);
|
R<String> deleteBySheetNo(String sheetNo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除生产单
|
* 通过id删除生产单
|
||||||
*
|
*
|
||||||
|
@ -29,6 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -45,24 +46,18 @@ import java.util.stream.Collectors;
|
|||||||
@Transactional
|
@Transactional
|
||||||
public class CurrTaskServiceImpl extends BaseService implements CurrTaskService {
|
public class CurrTaskServiceImpl extends BaseService implements CurrTaskService {
|
||||||
|
|
||||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
||||||
@Autowired
|
@Autowired
|
||||||
CurrTaskServiceBiz currTaskServiceBiz;
|
CurrTaskServiceBiz currTaskServiceBiz;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
CurrTaskDetService currTaskDetService;
|
CurrTaskDetService currTaskDetService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TaskHisService taskHisService;
|
TaskHisService taskHisService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TaskDetHisService taskDetHisService;
|
TaskDetHisService taskDetHisService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ApmsController apmsControl;
|
ApmsController apmsControl;
|
||||||
@Autowired
|
@Autowired
|
||||||
WebSocketServer webSocketServer;
|
WebSocketServer webSocketServer;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
OrderInfoServiceBiz orderInfoServiceBiz;
|
OrderInfoServiceBiz orderInfoServiceBiz;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -83,6 +78,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
CurrTaskDetServiceBiz currTaskDetServiceBiz;
|
CurrTaskDetServiceBiz currTaskDetServiceBiz;
|
||||||
@Autowired
|
@Autowired
|
||||||
InStockInfoServiceBiz inStockInfoServiceBiz;
|
InStockInfoServiceBiz inStockInfoServiceBiz;
|
||||||
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CurrTaskVo getCurrTask(IdParam idParam) {
|
public CurrTaskVo getCurrTask(IdParam idParam) {
|
||||||
@ -109,7 +105,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
BeanUtils.copyProperties(param, currTask);
|
BeanUtils.copyProperties(param, currTask);
|
||||||
currTask.setTaskType(TaskTypeEnum.WTK.getValue());
|
currTask.setTaskType(TaskTypeEnum.WTK.getValue());
|
||||||
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
|
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
|
||||||
if (param.getAutoTaskType()!=0){
|
if (param.getAutoTaskType() != 0) {
|
||||||
currTask.setIsAuto(1);
|
currTask.setIsAuto(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +125,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
public R<PageVo<CurrTaskQueryVo>> currentTaskPage(CurrTaskQueryParam param) {
|
public R<PageVo<CurrTaskQueryVo>> currentTaskPage(CurrTaskQueryParam param) {
|
||||||
QueryWrapper<CurrTask> currTaskQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CurrTask> currTaskQueryWrapper = new QueryWrapper<>();
|
||||||
currTaskQueryWrapper.eq(CurrTask.VALID, 1);
|
currTaskQueryWrapper.eq(CurrTask.VALID, 1);
|
||||||
currTaskQueryWrapper.in(CurrTask.STATUS,0,1);
|
currTaskQueryWrapper.in(CurrTask.STATUS, 0, 1);
|
||||||
Page<CurrTask> page = currTaskServiceBiz.page(new Page<>(param.getCurrent(), param.getSize()), currTaskQueryWrapper);
|
Page<CurrTask> page = currTaskServiceBiz.page(new Page<>(param.getCurrent(), param.getSize()), currTaskQueryWrapper);
|
||||||
return successful(new PageVo<>(page, CurrTaskQueryVo.class));
|
return successful(new PageVo<>(page, CurrTaskQueryVo.class));
|
||||||
}
|
}
|
||||||
@ -138,92 +134,87 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
public R<List<CurrTaskInfoVo>> currentTaskInfoPage(CurrTaskQueryParam param) {
|
public R<List<CurrTaskInfoVo>> currentTaskInfoPage(CurrTaskQueryParam param) {
|
||||||
QueryWrapper<CurrTask> wrapper = new QueryWrapper<>();
|
QueryWrapper<CurrTask> wrapper = new QueryWrapper<>();
|
||||||
wrapper.eq(CurrTask.VALID, 1);
|
wrapper.eq(CurrTask.VALID, 1);
|
||||||
wrapper.in(CurrTask.STATUS,0,1);
|
wrapper.in(CurrTask.STATUS, 0, 1);
|
||||||
List<CurrTask> currTaskList = currTaskServiceBiz.list(wrapper);
|
List<CurrTask> currTaskList = currTaskServiceBiz.list(wrapper);
|
||||||
List<CurrTaskInfoVo> list=new ArrayList<>();
|
List<CurrTaskInfoVo> list = new ArrayList<>();
|
||||||
for (CurrTask currTask:currTaskList
|
for (CurrTask currTask : currTaskList
|
||||||
) {
|
) {
|
||||||
CurrTaskInfoVo currTaskInfoVo=CurrTaskInfoVo.builder().build();
|
CurrTaskInfoVo currTaskInfoVo = CurrTaskInfoVo.builder().build();
|
||||||
//是否多步骤任务
|
//是否多步骤任务
|
||||||
currTaskInfoVo.setIsAuto(currTask.getIsAuto());
|
currTaskInfoVo.setIsAuto(currTask.getIsAuto());
|
||||||
//任务状态
|
//任务状态
|
||||||
if (currTask.getStatus()==1){
|
if (currTask.getStatus() == 1) {
|
||||||
currTaskInfoVo.setStatus(currTask.getStatus());
|
currTaskInfoVo.setStatus(currTask.getStatus());
|
||||||
}else if (currTask.getIsCache()==1){
|
} else if (currTask.getIsCache() == 1) {
|
||||||
currTaskInfoVo.setStatus(2);
|
currTaskInfoVo.setStatus(2);
|
||||||
}else {
|
} else {
|
||||||
currTaskInfoVo.setStatus(0);
|
currTaskInfoVo.setStatus(0);
|
||||||
}
|
}
|
||||||
//生产单号
|
//生产单号
|
||||||
if (currTask.getSheetNo()!=null){
|
if (currTask.getSheetNo() != null) {
|
||||||
currTaskInfoVo.setSheetNo(currTask.getSheetNo());
|
currTaskInfoVo.setSheetNo(currTask.getSheetNo());
|
||||||
}
|
}
|
||||||
currTaskInfoVo.setCreateTime(currTask.getCreateTime());
|
currTaskInfoVo.setCreateTime(currTask.getCreateTime());
|
||||||
//开始位置
|
//开始位置
|
||||||
currTaskInfoVo.setStartPosition(currTask.getStartPosition());
|
currTaskInfoVo.setStartPosition(currTask.getStartPosition());
|
||||||
//currTask
|
//currTask
|
||||||
if (currTask.getIsAuto()==1){
|
if (currTask.getIsAuto() == 1) {
|
||||||
List<CurrTask> currTasks = currTaskServiceBiz
|
List<CurrTask> currTasks = currTaskServiceBiz
|
||||||
.list(new QueryWrapper<CurrTask>()
|
.list(new QueryWrapper<CurrTask>()
|
||||||
.eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId())
|
.eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId())
|
||||||
.orderByAsc(CurrTask.ID));
|
.orderByAsc(CurrTask.ID));
|
||||||
List<CurrTaskVo> currTaskVos = com.mt.wms.core.utils.BeanUtils.copyList(currTasks, CurrTaskVo.class);
|
List<CurrTaskVo> currTaskVos = com.mt.wms.core.utils.BeanUtils.copyList(currTasks, CurrTaskVo.class);
|
||||||
currTaskInfoVo.setCurrTaskVoList(currTaskVos);
|
currTaskInfoVo.setCurrTaskVoList(currTaskVos);
|
||||||
String allStep="液压台";
|
String allStep = "液压台";
|
||||||
String nowStep="未开始";
|
String nowStep = "未开始";
|
||||||
for (CurrTask currTask1:currTasks
|
for (CurrTask currTask1 : currTasks
|
||||||
) {
|
) {
|
||||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask1.getId()));
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask1.getId()));
|
||||||
if (inStockInfo!=null){
|
if (inStockInfo != null) {
|
||||||
List<InStockInfoVo> inStockInfoVoList=new ArrayList<>();
|
List<InStockInfoVo> inStockInfoVoList = new ArrayList<>();
|
||||||
InStockInfoVo inStockInfoVo=InStockInfoVo.builder().build();
|
InStockInfoVo inStockInfoVo = InStockInfoVo.builder().build();
|
||||||
BeanUtils.copyProperties(inStockInfo,inStockInfoVo);
|
BeanUtils.copyProperties(inStockInfo, inStockInfoVo);
|
||||||
inStockInfoVoList.add(inStockInfoVo);
|
inStockInfoVoList.add(inStockInfoVo);
|
||||||
currTaskInfoVo.setInStockInfoVoList(inStockInfoVoList);
|
currTaskInfoVo.setInStockInfoVoList(inStockInfoVoList);
|
||||||
}
|
}
|
||||||
if (currTask1.getStatus()==1){
|
if (currTask1.getStatus() == 1) {
|
||||||
nowStep=currTask1.getTargetPosition();
|
nowStep = currTask1.getTargetPosition();
|
||||||
}else if (currTask1.getIsCache()==1){
|
} else if (currTask1.getIsCache() == 1) {
|
||||||
nowStep=currTask.getLocationName();
|
nowStep = currTask.getLocationName();
|
||||||
}
|
}
|
||||||
if (currTaskInfoVo.getInStockInfoVoList()!=null){
|
if (currTaskInfoVo.getInStockInfoVoList() != null) {
|
||||||
if (currTaskInfoVo.getCurrTaskVoList().size()>0){
|
if (currTaskInfoVo.getCurrTaskVoList().size() > 0) {
|
||||||
|
|
||||||
nowStep=currTaskInfoVo.getInStockInfoVoList().get(0).getLocationName();
|
nowStep = currTaskInfoVo.getInStockInfoVoList().get(0).getLocationName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
allStep=allStep.concat("->").concat(currTask1.getTargetPosition());
|
allStep = allStep.concat("->").concat(currTask1.getTargetPosition());
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
currTaskInfoVo.setAllStep(allStep);
|
currTaskInfoVo.setAllStep(allStep);
|
||||||
currTaskInfoVo.setNowStep(nowStep);
|
currTaskInfoVo.setNowStep(nowStep);
|
||||||
currTaskInfoVo.setAutoExeTaskId(currTask.getAutoExeTaskId());
|
currTaskInfoVo.setAutoExeTaskId(currTask.getAutoExeTaskId());
|
||||||
}else {
|
} else {
|
||||||
List<CurrTaskVo> currTaskVos=new ArrayList<>();
|
|
||||||
CurrTaskVo currTaskVo=CurrTaskVo.builder().build();
|
|
||||||
BeanUtils.copyProperties(currTask,currTaskVo);
|
|
||||||
currTaskVos.add(currTaskVo);
|
|
||||||
currTaskInfoVo.setCurrTaskVoList(currTaskVos);
|
|
||||||
currTaskInfoVo.setAllStep(currTask.getTargetPosition());
|
currTaskInfoVo.setAllStep(currTask.getTargetPosition());
|
||||||
if (currTask.getStatus()==1){
|
if (currTask.getStatus() == 1) {
|
||||||
currTaskInfoVo.setNowStep(currTask.getTargetPosition());
|
currTaskInfoVo.setNowStep(currTask.getTargetPosition());
|
||||||
}else if (currTask.getIsCache()==1){
|
} else if (currTask.getIsCache() == 1) {
|
||||||
currTaskInfoVo.setNowStep(currTask.getLocationName());
|
currTaskInfoVo.setNowStep(currTask.getLocationName());
|
||||||
}
|
}
|
||||||
currTaskInfoVo.setAutoExeTaskId(currTask.getId());
|
currTaskInfoVo.setAutoExeTaskId(currTask.getId());
|
||||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId()));
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId()));
|
||||||
if (inStockInfo!=null){
|
if (inStockInfo != null) {
|
||||||
List<InStockInfoVo> inStockInfoVoList=new ArrayList<>();
|
List<InStockInfoVo> inStockInfoVoList = new ArrayList<>();
|
||||||
InStockInfoVo inStockInfoVo=InStockInfoVo.builder().build();
|
InStockInfoVo inStockInfoVo = InStockInfoVo.builder().build();
|
||||||
BeanUtils.copyProperties(inStockInfo,inStockInfoVo);
|
BeanUtils.copyProperties(inStockInfo, inStockInfoVo);
|
||||||
inStockInfoVoList.add(inStockInfoVo);
|
inStockInfoVoList.add(inStockInfoVo);
|
||||||
currTaskInfoVo.setInStockInfoVoList(inStockInfoVoList);
|
currTaskInfoVo.setInStockInfoVoList(inStockInfoVoList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//currTaskDet
|
//currTaskDet
|
||||||
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
|
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
|
||||||
currTaskInfoVo.setCurrTaskDetVoList(com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList,CurrTaskDetVo.class));
|
currTaskInfoVo.setCurrTaskDetVoList(com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class));
|
||||||
for (CurrTaskDetVo currTaskDetVo:currTaskInfoVo.getCurrTaskDetVoList()
|
for (CurrTaskDetVo currTaskDetVo : currTaskInfoVo.getCurrTaskDetVoList()
|
||||||
) {
|
) {
|
||||||
String idenCardNum = currTaskDetVo.getIdenCardNum();
|
String idenCardNum = currTaskDetVo.getIdenCardNum();
|
||||||
OrderInfo orderInfo = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum));
|
OrderInfo orderInfo = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum));
|
||||||
@ -233,22 +224,173 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
}
|
}
|
||||||
list.add(currTaskInfoVo);
|
list.add(currTaskInfoVo);
|
||||||
}
|
}
|
||||||
list = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CurrTaskInfoVo :: getAutoExeTaskId))), ArrayList::new));
|
list = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CurrTaskInfoVo::getAutoExeTaskId))), ArrayList::new));
|
||||||
|
|
||||||
return successful(list);
|
return successful(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取未成功报工apms的任务,判定标准:没有生产单号,状态为完成
|
||||||
|
@Override
|
||||||
|
public R<List<CurrTaskInfoVo>> currentTaskInfoPageForNotToApms(CurrTaskQueryParam param) {
|
||||||
|
QueryWrapper<CurrTask> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq(CurrTask.VALID, 1);
|
||||||
|
wrapper.in(CurrTask.STATUS, 2);
|
||||||
|
wrapper.isNull(CurrTask.SHEET_NO);
|
||||||
|
wrapper.between(CurrTask.CREATE_TIME, "2022-11-19 05:14:11", LocalDateTime.now());
|
||||||
|
List<CurrTask> currTaskList = currTaskServiceBiz.list(wrapper);
|
||||||
|
List<CurrTaskInfoVo> list = new ArrayList<>();
|
||||||
|
for (CurrTask currTask : currTaskList
|
||||||
|
) {
|
||||||
|
CurrTaskInfoVo currTaskInfoVo = CurrTaskInfoVo.builder().build();
|
||||||
|
//currTask
|
||||||
|
if (currTask.getIsAuto() == 1) {
|
||||||
|
|
||||||
|
|
||||||
|
currTaskInfoVo.setAutoExeTaskId(currTask.getAutoExeTaskId());
|
||||||
|
List<CurrTask> currTasks = currTaskServiceBiz
|
||||||
|
.list(new QueryWrapper<CurrTask>()
|
||||||
|
.eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId())
|
||||||
|
.orderByAsc(CurrTask.ID));
|
||||||
|
List<CurrTaskVo> currTaskVos = com.mt.wms.core.utils.BeanUtils.copyList(currTasks, CurrTaskVo.class);
|
||||||
|
currTaskInfoVo.setCurrTaskVoList(currTaskVos);
|
||||||
|
String allStep = "";
|
||||||
|
for (CurrTask currTask1 : currTasks
|
||||||
|
) {
|
||||||
|
|
||||||
|
allStep = allStep.concat("->").concat(currTask1.getTargetPosition());
|
||||||
|
}
|
||||||
|
currTaskInfoVo.setAllStep(allStep);
|
||||||
|
} else {
|
||||||
|
currTaskInfoVo.setAllStep(currTask.getTargetPosition());
|
||||||
|
}
|
||||||
|
//currTaskDet
|
||||||
|
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
|
||||||
|
currTaskInfoVo.setCurrTaskDetVoList(com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList, CurrTaskDetVo.class));
|
||||||
|
for (CurrTaskDetVo currTaskDetVo : currTaskInfoVo.getCurrTaskDetVoList()
|
||||||
|
) {
|
||||||
|
String idenCardNum = currTaskDetVo.getIdenCardNum();
|
||||||
|
OrderInfo orderInfo = orderInfoServiceBiz.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, idenCardNum));
|
||||||
|
currTaskDetVo.setCustomer(orderInfo.getCustomerName());
|
||||||
|
currTaskDetVo.setCraftIll(orderInfo.getCraftIll());
|
||||||
|
currTaskDetVo.setProductModel(orderInfo.getProductModel());
|
||||||
|
}
|
||||||
|
list.add(currTaskInfoVo);
|
||||||
|
}
|
||||||
|
list = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CurrTaskInfoVo::getAutoExeTaskId))), ArrayList::new));
|
||||||
|
|
||||||
|
return successful(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<String> oneStepToApms(CurrTaskInfoVo currTaskInfoVo) {
|
||||||
|
List<CurrTaskDetVo> currTaskDetVoList = currTaskInfoVo.getCurrTaskDetVoList();
|
||||||
|
List<CurrTaskVo> currTaskVoList = currTaskInfoVo.getCurrTaskVoList();
|
||||||
|
//报工apms
|
||||||
|
List<CurrTaskDet> currTaskDetList = com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetVoList, CurrTaskDet.class);
|
||||||
|
List<CurrTask> currTasks = com.mt.wms.core.utils.BeanUtils.copyList(currTaskVoList, CurrTask.class);
|
||||||
|
for (CurrTask currTask1 : currTasks
|
||||||
|
) {
|
||||||
|
if (currTask1.getIsAuto() == 1) {
|
||||||
|
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTaskInfoVo.getAutoExeTaskId());
|
||||||
|
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask1.getKilnId());
|
||||||
|
//加工炉为BMA或BMB时上报apms,其他的不需要上报
|
||||||
|
if (kilnInfo.getType() == 1 || kilnInfo.getType() == 3) {
|
||||||
|
if (currTask1.getStoveCode() == null) {
|
||||||
|
return failed("该任务没有正常进炉加工生成炉号,不能上报apms!");
|
||||||
|
}
|
||||||
|
//通知apms创建一个生产单
|
||||||
|
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
|
||||||
|
apmsCreateSheet.setWorkShopCode("BM");
|
||||||
|
apmsCreateSheet.setStartTime(currTask1.getBeginTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
|
apmsCreateSheet.setTechCode(currTask1.getCraftCodeId().toString());
|
||||||
|
//fixme 暂时没有正式user,使用测试账户
|
||||||
|
apmsCreateSheet.setStartUser("QJJP03");
|
||||||
|
ArrayList<CreateItem> createItems = new ArrayList<>();
|
||||||
|
currTaskDetList.forEach(e -> {
|
||||||
|
CreateItem createItem = new CreateItem();
|
||||||
|
createItem.setItemCode(e.getIdenCardNum());
|
||||||
|
createItem.setQuantity(e.getQuantity().intValue());
|
||||||
|
BigDecimal b = new BigDecimal(String.valueOf(e.getWeight()));
|
||||||
|
createItem.setWeight(b.doubleValue());
|
||||||
|
createItems.add(createItem);
|
||||||
|
});
|
||||||
|
//apmsCreateSheet.setStoveCode(code);
|
||||||
|
if (currTask1.getStoveCode() != null) {
|
||||||
|
apmsCreateSheet.setStoveCode(currTask1.getStoveCode());
|
||||||
|
}
|
||||||
|
apmsCreateSheet.setItems(createItems);
|
||||||
|
logger.info(currTask1.getId() + "开始创建apms生产单号-手动上报");
|
||||||
|
R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
|
||||||
|
if (!processSheet.getData().getSuccess()) {
|
||||||
|
logger.info(currTask1.getId() + "创建失败,APMS报错:" + processSheet.getData().getMsg());
|
||||||
|
return failed(processSheet.getData().getMsg());
|
||||||
|
} else {
|
||||||
|
logger.info(currTask1.getId() + "创建apms生产单号成功");
|
||||||
|
currTask1.setSheetNo(processSheet.getData().getSheetNo());
|
||||||
|
currTaskServiceBiz.updateById(currTask1);
|
||||||
|
//多步骤任务除了第一步写入sheetNo
|
||||||
|
if (currTask1.getIsAuto() == 1) {
|
||||||
|
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
|
||||||
|
secondCurrTask.setSheetNo(currTask1.getSheetNo());
|
||||||
|
currTaskServiceBiz.updateById(secondCurrTask);
|
||||||
|
//三步任务
|
||||||
|
if (autoExeTask.getProcessFlowType() == 2) {
|
||||||
|
CurrTask threeCurrTask = currTaskServiceBiz.getById(autoExeTask.getThTaskId());
|
||||||
|
threeCurrTask.setSheetNo(currTask1.getSheetNo());
|
||||||
|
currTaskServiceBiz.updateById(threeCurrTask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return successful("上报APMS成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//通知apms创建一个生产单
|
||||||
|
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
|
||||||
|
apmsCreateSheet.setWorkShopCode("BM");
|
||||||
|
apmsCreateSheet.setStartTime(currTask1.getBeginTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
|
apmsCreateSheet.setTechCode(currTask1.getCraftCodeId().toString());
|
||||||
|
//fixme 暂时没有正式user,使用测试账户
|
||||||
|
apmsCreateSheet.setStartUser("QJJP03");
|
||||||
|
ArrayList<CreateItem> createItems = new ArrayList<>();
|
||||||
|
currTaskDetList.forEach(e -> {
|
||||||
|
CreateItem createItem = new CreateItem();
|
||||||
|
createItem.setItemCode(e.getIdenCardNum());
|
||||||
|
createItem.setQuantity(e.getQuantity().intValue());
|
||||||
|
BigDecimal b = new BigDecimal(String.valueOf(e.getWeight()));
|
||||||
|
createItem.setWeight(b.doubleValue());
|
||||||
|
createItems.add(createItem);
|
||||||
|
});
|
||||||
|
//apmsCreateSheet.setStoveCode(code);
|
||||||
|
if (currTask1.getStoveCode() != null) {
|
||||||
|
apmsCreateSheet.setStoveCode(currTask1.getStoveCode());
|
||||||
|
}
|
||||||
|
apmsCreateSheet.setItems(createItems);
|
||||||
|
logger.info(currTask1.getId() + "开始创建apms生产单号-手动上报");
|
||||||
|
R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
|
||||||
|
if (!processSheet.getData().getSuccess()) {
|
||||||
|
logger.info(currTask1.getId() + "创建失败,APMS报错:" + processSheet.getData().getMsg());
|
||||||
|
return failed(processSheet.getData().getMsg());
|
||||||
|
} else {
|
||||||
|
logger.info(currTask1.getId() + "创建apms生产单号成功");
|
||||||
|
currTask1.setSheetNo(processSheet.getData().getSheetNo());
|
||||||
|
currTaskServiceBiz.updateById(currTask1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<String> updateCurrTaskStatus(CurrTaskParam param) {
|
public R<String> updateCurrTaskStatus(CurrTaskParam param) {
|
||||||
CurrTask currTask = currTaskServiceBiz.getById(param.getId());
|
CurrTask currTask = currTaskServiceBiz.getById(param.getId());
|
||||||
Integer status = param.getStatus();
|
Integer status = param.getStatus();
|
||||||
Long kilnId = param.getKilnId();
|
Long kilnId = param.getKilnId();
|
||||||
//修改任务状态
|
//修改任务状态
|
||||||
if(!status.equals(currTask.getStatus())){
|
if (!status.equals(currTask.getStatus())) {
|
||||||
//修改为加工中,多步骤任务修改为加工中,查询缓存区,查询前置任务状态,并修改
|
//修改为加工中,多步骤任务修改为加工中,查询缓存区,查询前置任务状态,并修改
|
||||||
if (status==1){
|
if (status == 1) {
|
||||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId()));
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId()));
|
||||||
if (inStockInfo!=null){
|
if (inStockInfo != null) {
|
||||||
//更新库位状态为未占用
|
//更新库位状态为未占用
|
||||||
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
|
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
|
||||||
location.setStatus(0);
|
location.setStatus(0);
|
||||||
@ -256,11 +398,11 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
//删除库位缓存
|
//删除库位缓存
|
||||||
inStockInfoServiceBiz.removeById(inStockInfo);
|
inStockInfoServiceBiz.removeById(inStockInfo);
|
||||||
}
|
}
|
||||||
if (currTask.getIsAuto()==1){
|
if (currTask.getIsAuto() == 1) {
|
||||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId());
|
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId());
|
||||||
if (currTask.getId().equals(autoExeTask.getFTaskId())){
|
if (currTask.getId().equals(autoExeTask.getFTaskId())) {
|
||||||
//该任务为自动任务第一条,是否有sheetNo,若无上报apms
|
//该任务为自动任务第一条,是否有sheetNo,若无上报apms
|
||||||
if (currTask.getSheetNo()==null){
|
if (currTask.getSheetNo() == null) {
|
||||||
try {
|
try {
|
||||||
apmsCreateProcess(currTask);
|
apmsCreateProcess(currTask);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -268,7 +410,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currTask.getId().equals(autoExeTask.getTTaskId())){
|
if (currTask.getId().equals(autoExeTask.getTTaskId())) {
|
||||||
//该任务为自动任务第二条,修改自动任务第一条的状态
|
//该任务为自动任务第二条,修改自动任务第一条的状态
|
||||||
CurrTask currTask1 = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
|
CurrTask currTask1 = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
|
||||||
currTask1.setStatus(2);
|
currTask1.setStatus(2);
|
||||||
@ -277,7 +419,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
currTask1.setUpdaterId(99);
|
currTask1.setUpdaterId(99);
|
||||||
currTask1.setUpdateTime(LocalDateTime.now());
|
currTask1.setUpdateTime(LocalDateTime.now());
|
||||||
currTaskServiceBiz.updateById(currTask1);
|
currTaskServiceBiz.updateById(currTask1);
|
||||||
}else if (currTask.getId().equals(autoExeTask.getThTaskId())){
|
} else if (currTask.getId().equals(autoExeTask.getThTaskId())) {
|
||||||
//该任务为自动任务第三条,修改自动任务第二条的状态
|
//该任务为自动任务第三条,修改自动任务第二条的状态
|
||||||
CurrTask currTask2 = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
|
CurrTask currTask2 = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
|
||||||
currTask2.setStatus(2);
|
currTask2.setStatus(2);
|
||||||
@ -294,12 +436,12 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
currTask.setUpdateTime(LocalDateTime.now());
|
currTask.setUpdateTime(LocalDateTime.now());
|
||||||
currTask.setBeginTime(LocalDateTime.now());
|
currTask.setBeginTime(LocalDateTime.now());
|
||||||
currTaskServiceBiz.updateById(currTask);
|
currTaskServiceBiz.updateById(currTask);
|
||||||
logger.info("修改任务"+currTask.getId()+"状态为加工中成功");
|
logger.info("修改任务" + currTask.getId() + "状态为加工中成功");
|
||||||
}
|
}
|
||||||
//修改为加工完成,查询缓存,并修改
|
//修改为加工完成,查询缓存,并修改
|
||||||
if (status==2){
|
if (status == 2) {
|
||||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId()));
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId()));
|
||||||
if (inStockInfo!=null){
|
if (inStockInfo != null) {
|
||||||
//更新库位状态为未占用
|
//更新库位状态为未占用
|
||||||
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
|
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
|
||||||
location.setStatus(0);
|
location.setStatus(0);
|
||||||
@ -311,16 +453,16 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
currTask.setCreatorId(99);
|
currTask.setCreatorId(99);
|
||||||
currTask.setBeginTime(LocalDateTime.now());
|
currTask.setBeginTime(LocalDateTime.now());
|
||||||
currTaskServiceBiz.updateById(currTask);
|
currTaskServiceBiz.updateById(currTask);
|
||||||
logger.info("修改任务"+currTask.getId()+"状态为加工完成成功");
|
logger.info("修改任务" + currTask.getId() + "状态为加工完成成功");
|
||||||
}
|
}
|
||||||
currTask.setStatus(status);
|
currTask.setStatus(status);
|
||||||
currTask.setCreatorId(99);
|
currTask.setCreatorId(99);
|
||||||
currTask.setBeginTime(LocalDateTime.now());
|
currTask.setBeginTime(LocalDateTime.now());
|
||||||
currTaskServiceBiz.updateById(currTask);
|
currTaskServiceBiz.updateById(currTask);
|
||||||
logger.info("修改任务"+currTask.getId()+"状态为未加工成功");
|
logger.info("修改任务" + currTask.getId() + "状态为未加工成功");
|
||||||
}
|
}
|
||||||
//修改目标加工炉
|
//修改目标加工炉
|
||||||
if (!kilnId.equals(currTask.getKilnId())){
|
if (!kilnId.equals(currTask.getKilnId())) {
|
||||||
KilnInfo kiln = kilnInfoServiceBiz.getById(kilnId);
|
KilnInfo kiln = kilnInfoServiceBiz.getById(kilnId);
|
||||||
//修改目标加工炉,修改终点
|
//修改目标加工炉,修改终点
|
||||||
currTask.setKilnId(kilnId);
|
currTask.setKilnId(kilnId);
|
||||||
@ -330,7 +472,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
currTaskServiceBiz.updateById(currTask);
|
currTaskServiceBiz.updateById(currTask);
|
||||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId()));
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId()));
|
||||||
//是否存在缓存
|
//是否存在缓存
|
||||||
if (inStockInfo!=null){
|
if (inStockInfo != null) {
|
||||||
//修改缓存后目标加工炉
|
//修改缓存后目标加工炉
|
||||||
inStockInfo.setKilnId(kilnId);
|
inStockInfo.setKilnId(kilnId);
|
||||||
inStockInfo.setKilnName(kiln.getKilnName());
|
inStockInfo.setKilnName(kiln.getKilnName());
|
||||||
@ -339,19 +481,19 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
inStockInfoServiceBiz.updateById(inStockInfo);
|
inStockInfoServiceBiz.updateById(inStockInfo);
|
||||||
}
|
}
|
||||||
//任务为多步骤任务
|
//任务为多步骤任务
|
||||||
if (currTask.getIsAuto()==1){
|
if (currTask.getIsAuto() == 1) {
|
||||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId());
|
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId());
|
||||||
//任务为多步骤任务第一步
|
//任务为多步骤任务第一步
|
||||||
if (currTask.getId().equals(autoExeTask.getFTaskId())){
|
if (currTask.getId().equals(autoExeTask.getFTaskId())) {
|
||||||
//修改多步骤第二步的起点
|
//修改多步骤第二步的起点
|
||||||
CurrTask currTask2 = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
|
CurrTask currTask2 = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
|
||||||
currTask2.setStartPosition(kiln.getCode());
|
currTask2.setStartPosition(kiln.getCode());
|
||||||
currTask2.setUpdateTime(LocalDateTime.now());
|
currTask2.setUpdateTime(LocalDateTime.now());
|
||||||
currTask2.setUpdaterId(99);
|
currTask2.setUpdaterId(99);
|
||||||
currTaskServiceBiz.updateById(currTask2);
|
currTaskServiceBiz.updateById(currTask2);
|
||||||
}else if (currTask.getId().equals(autoExeTask.getTTaskId())){
|
} else if (currTask.getId().equals(autoExeTask.getTTaskId())) {
|
||||||
//任务为多步骤任务第二步且有第三步,修改第三步起点
|
//任务为多步骤任务第二步且有第三步,修改第三步起点
|
||||||
if (autoExeTask.getProcessFlowType()==2){
|
if (autoExeTask.getProcessFlowType() == 2) {
|
||||||
CurrTask currTask3 = currTaskServiceBiz.getById(autoExeTask.getThTaskId());
|
CurrTask currTask3 = currTaskServiceBiz.getById(autoExeTask.getThTaskId());
|
||||||
currTask3.setStartPosition(kiln.getCode());
|
currTask3.setStartPosition(kiln.getCode());
|
||||||
currTask3.setUpdateTime(LocalDateTime.now());
|
currTask3.setUpdateTime(LocalDateTime.now());
|
||||||
@ -392,22 +534,22 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
public R<String> deleteBySheetNo(String sheetNo) {
|
public R<String> deleteBySheetNo(String sheetNo) {
|
||||||
//一个生产单可能对应多个currTask,删除的时候查询是否对应多个,如果对应多个,自动循环删除所有currTask,当删除最后一条currTask时上报apms
|
//一个生产单可能对应多个currTask,删除的时候查询是否对应多个,如果对应多个,自动循环删除所有currTask,当删除最后一条currTask时上报apms
|
||||||
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.SHEET_NO, sheetNo));
|
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.SHEET_NO, sheetNo));
|
||||||
if (currTaskList.size()>1){
|
if (currTaskList.size() > 1) {
|
||||||
int i=0;
|
int i = 0;
|
||||||
for (CurrTask currTask:currTaskList
|
for (CurrTask currTask : currTaskList
|
||||||
) {
|
) {
|
||||||
i++;
|
i++;
|
||||||
if(currTask.getStatus()==0){
|
if (currTask.getStatus() == 0) {
|
||||||
if (i==currTaskList.size()){
|
if (i == currTaskList.size()) {
|
||||||
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
|
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
|
||||||
if (!apmsStartProcessR.getData().getSuccess()){
|
if (!apmsStartProcessR.getData().getSuccess()) {
|
||||||
return failed(apmsStartProcessR.getData().getMsg());
|
return failed(apmsStartProcessR.getData().getMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Long currTaskId = currTask.getId();
|
Long currTaskId = currTask.getId();
|
||||||
if (currTask.getIsAuto()==1){
|
if (currTask.getIsAuto() == 1) {
|
||||||
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
|
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
|
||||||
if (currTaskList2.size()==1){
|
if (currTaskList2.size() == 1) {
|
||||||
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
|
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -415,45 +557,44 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
currTaskDetService.deleteByCurrTaskId(currTaskId);
|
currTaskDetService.deleteByCurrTaskId(currTaskId);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (currTask.getStatus()==2){
|
if (currTask.getStatus() == 2) {
|
||||||
return failed("无法删除,任务已加工完成。");
|
return failed("无法删除,任务已加工完成。");
|
||||||
}if (currTask.getStatus()==1){
|
}
|
||||||
|
if (currTask.getStatus() == 1) {
|
||||||
return failed("无法删除,任务正在执行中。");
|
return failed("无法删除,任务正在执行中。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return successful(0,"APMS生产单删除成功。","");
|
return successful(0, "APMS生产单删除成功。", "");
|
||||||
}else {
|
} else {
|
||||||
for (CurrTask currTask:currTaskList
|
for (CurrTask currTask : currTaskList
|
||||||
) {
|
) {
|
||||||
if (currTask.getStatus()==0){
|
if (currTask.getStatus() == 0) {
|
||||||
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
|
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
|
||||||
if (apmsStartProcessR.getData().getSuccess())
|
if (apmsStartProcessR.getData().getSuccess()) {
|
||||||
{
|
|
||||||
Long currTaskId = currTask.getId();
|
Long currTaskId = currTask.getId();
|
||||||
if (currTask.getIsAuto()==1){
|
if (currTask.getIsAuto() == 1) {
|
||||||
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
|
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
|
||||||
if (currTaskList2.size()==1){
|
if (currTaskList2.size() == 1) {
|
||||||
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
|
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currTaskServiceBiz.removeById(currTaskId);
|
currTaskServiceBiz.removeById(currTaskId);
|
||||||
currTaskDetService.deleteByCurrTaskId(currTaskId);
|
currTaskDetService.deleteByCurrTaskId(currTaskId);
|
||||||
if (currTask.getIsAuto()==1){
|
if (currTask.getIsAuto() == 1) {
|
||||||
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
|
List<CurrTask> currTaskList2 = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
|
||||||
if (currTaskList2.size()==0){
|
if (currTaskList2.size() == 0) {
|
||||||
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
|
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return successful(0,"APMS生产单删除成功。","");
|
return successful(0, "APMS生产单删除成功。", "");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return failed(apmsStartProcessR.getData().getMsg());
|
return failed(apmsStartProcessR.getData().getMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currTask.getStatus()==2){
|
if (currTask.getStatus() == 2) {
|
||||||
return failed("无法删除,任务已加工完成。");
|
return failed("无法删除,任务已加工完成。");
|
||||||
}if (currTask.getStatus()==1){
|
}
|
||||||
|
if (currTask.getStatus() == 1) {
|
||||||
return failed("无法删除,任务正在执行中。");
|
return failed("无法删除,任务正在执行中。");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,31 +607,31 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
@Override
|
@Override
|
||||||
public R<String> deleteById(IdParam idParam) {
|
public R<String> deleteById(IdParam idParam) {
|
||||||
CurrTask currTask = currTaskServiceBiz.getById(idParam.getId());
|
CurrTask currTask = currTaskServiceBiz.getById(idParam.getId());
|
||||||
if (currTask.getIsAuto()==1){
|
if (currTask.getIsAuto() == 1) {
|
||||||
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
|
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
|
||||||
for (CurrTask currTask1:currTaskList
|
for (CurrTask currTask1 : currTaskList
|
||||||
) {
|
) {
|
||||||
if (currTask1.getStatus()!=0){
|
if (currTask1.getStatus() != 0) {
|
||||||
return R.failed("该自动任务已有步骤在执行中或执行完成,不能删除!");
|
return R.failed("该自动任务已有步骤在执行中或执行完成,不能删除!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//能删除
|
//能删除
|
||||||
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
|
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
|
||||||
for (CurrTask currTask1:currTaskList
|
for (CurrTask currTask1 : currTaskList
|
||||||
) {
|
) {
|
||||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask1.getId()));
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask1.getId()));
|
||||||
if (inStockInfo!=null){
|
if (inStockInfo != null) {
|
||||||
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
|
Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
|
||||||
location.setStatus(0);
|
location.setStatus(0);
|
||||||
locationServiceBiz.updateById(location);
|
locationServiceBiz.updateById(location);
|
||||||
inStockInfoServiceBiz.removeById(inStockInfo);
|
inStockInfoServiceBiz.removeById(inStockInfo);
|
||||||
}
|
}
|
||||||
currTaskDetServiceBiz.remove(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID,currTask1.getId()));
|
currTaskDetServiceBiz.remove(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask1.getId()));
|
||||||
currTaskServiceBiz.removeById(currTask1);
|
currTaskServiceBiz.removeById(currTask1);
|
||||||
}
|
}
|
||||||
return R.ok(idParam.getId().toString());
|
return R.ok(idParam.getId().toString());
|
||||||
}else {
|
} else {
|
||||||
currTaskDetServiceBiz.remove(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID,currTask.getId()));
|
currTaskDetServiceBiz.remove(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
|
||||||
currTaskServiceBiz.removeById(idParam);
|
currTaskServiceBiz.removeById(idParam);
|
||||||
return R.ok(idParam.getId().toString());
|
return R.ok(idParam.getId().toString());
|
||||||
}
|
}
|
||||||
@ -535,13 +676,13 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
@Override
|
@Override
|
||||||
public R runTask(Long taskId) throws InterruptedException, IOException {
|
public R runTask(Long taskId) throws InterruptedException, IOException {
|
||||||
CurrTask currTask = currTaskServiceBiz.getById(taskId);
|
CurrTask currTask = currTaskServiceBiz.getById(taskId);
|
||||||
if (currTask.getStatus()!=0){
|
if (currTask.getStatus() != 0) {
|
||||||
return R.failed("该任务状态不为未执行,无法执行!");
|
return R.failed("该任务状态不为未执行,无法执行!");
|
||||||
}
|
}
|
||||||
//是否为自动任务
|
//是否为自动任务
|
||||||
if (currTask.getIsAuto()==1){
|
if (currTask.getIsAuto() == 1) {
|
||||||
List<AutoExeTask> exeTaskList = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, taskId));
|
List<AutoExeTask> exeTaskList = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, taskId));
|
||||||
if (exeTaskList.size()==0){
|
if (exeTaskList.size() == 0) {
|
||||||
return R.failed("该任务为多步骤加工任务且该步骤不是第一步,请选择第一步骤任务执行!");
|
return R.failed("该任务为多步骤加工任务且该步骤不是第一步,请选择第一步骤任务执行!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -555,6 +696,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 传入任务id,查询任务炉子,然后根据炉子查询等待列表,然后时间置为早
|
* 传入任务id,查询任务炉子,然后根据炉子查询等待列表,然后时间置为早
|
||||||
|
*
|
||||||
* @param idParam
|
* @param idParam
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -562,26 +704,27 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
public R<String> top(IdParam idParam) {
|
public R<String> top(IdParam idParam) {
|
||||||
CurrTask currTask = currTaskServiceBiz.getById(idParam.getId());
|
CurrTask currTask = currTaskServiceBiz.getById(idParam.getId());
|
||||||
currTask.getIsCache();
|
currTask.getIsCache();
|
||||||
if (currTask.getIsCache()==0){
|
if (currTask.getIsCache() == 0) {
|
||||||
return R.failed("当前任务未进入等待队列,不能置顶");
|
return R.failed("当前任务未进入等待队列,不能置顶");
|
||||||
}
|
}
|
||||||
Long kilnId = currTask.getKilnId();
|
Long kilnId = currTask.getKilnId();
|
||||||
List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>()
|
List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>()
|
||||||
.eq(InStockInfo.KILN_ID, kilnId)
|
.eq(InStockInfo.KILN_ID, kilnId)
|
||||||
.eq(InStockInfo.TYPE,1)
|
.eq(InStockInfo.TYPE, 1)
|
||||||
.eq(InStockInfo.STATUS,2)
|
.eq(InStockInfo.STATUS, 2)
|
||||||
.orderByAsc(InStockInfo.IN_TIME));
|
.orderByAsc(InStockInfo.IN_TIME));
|
||||||
|
|
||||||
if (inStockInfoList.size()<2){
|
if (inStockInfoList.size() < 2) {
|
||||||
return R.failed("当前加工炉等待队列只有一个任务,无需置顶");
|
return R.failed("当前加工炉等待队列只有一个任务,无需置顶");
|
||||||
}
|
}
|
||||||
LocalDateTime inTime=null;
|
LocalDateTime inTime = null;
|
||||||
inTime = inStockInfoList.get(0).getInTime();
|
inTime = inStockInfoList.get(0).getInTime();
|
||||||
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.LOCATION_ID, currTask.getLocationId()));
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.LOCATION_ID, currTask.getLocationId()));
|
||||||
inStockInfo.setInTime(inTime.minusHours(1));
|
inStockInfo.setInTime(inTime.minusHours(1));
|
||||||
inStockInfoServiceBiz.updateById(inStockInfo);
|
inStockInfoServiceBiz.updateById(inStockInfo);
|
||||||
return R.ok("当前任务置顶成功","");
|
return R.ok("当前任务置顶成功", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上报apms创建生产单并开始处理
|
* 上报apms创建生产单并开始处理
|
||||||
*
|
*
|
||||||
@ -620,13 +763,13 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
currTask.setSheetNo(processSheet.getData().getSheetNo());
|
currTask.setSheetNo(processSheet.getData().getSheetNo());
|
||||||
currTaskServiceBiz.updateById(currTask);
|
currTaskServiceBiz.updateById(currTask);
|
||||||
//多步骤任务除了第一步写入sheetNo
|
//多步骤任务除了第一步写入sheetNo
|
||||||
if (currTask.getIsAuto()==1){
|
if (currTask.getIsAuto() == 1) {
|
||||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId());
|
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId());
|
||||||
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
|
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
|
||||||
secondCurrTask.setSheetNo(currTask.getSheetNo());
|
secondCurrTask.setSheetNo(currTask.getSheetNo());
|
||||||
currTaskServiceBiz.updateById(secondCurrTask);
|
currTaskServiceBiz.updateById(secondCurrTask);
|
||||||
//三步任务
|
//三步任务
|
||||||
if (autoExeTask.getProcessFlowType()==2){
|
if (autoExeTask.getProcessFlowType() == 2) {
|
||||||
CurrTask threeCurrTask = currTaskServiceBiz.getById(autoExeTask.getThTaskId());
|
CurrTask threeCurrTask = currTaskServiceBiz.getById(autoExeTask.getThTaskId());
|
||||||
threeCurrTask.setSheetNo(currTask.getSheetNo());
|
threeCurrTask.setSheetNo(currTask.getSheetNo());
|
||||||
currTaskServiceBiz.updateById(threeCurrTask);
|
currTaskServiceBiz.updateById(threeCurrTask);
|
||||||
|
@ -1218,20 +1218,25 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
* 单步骤任务都生成炉号
|
* 单步骤任务都生成炉号
|
||||||
*/
|
*/
|
||||||
private void createStoveCode(CurrTask currTask) {
|
private void createStoveCode(CurrTask currTask) {
|
||||||
//单步骤任务
|
//单步骤任务,直接生成炉号
|
||||||
if (currTask.getIsAuto() == 0) {
|
if (currTask.getIsAuto() == 0) {
|
||||||
String stoveCode = StoveCodeUtils.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue());
|
String stoveCode = StoveCodeUtils.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue());
|
||||||
currTask.setStoveCode(stoveCode);
|
currTask.setStoveCode(stoveCode);
|
||||||
currTaskServiceBiz.updateById(currTask);
|
currTaskServiceBiz.updateById(currTask);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(isFirstTask(currTask) && currTask.getKilnId() == 3)) {
|
//多步骤任务,只有BMA,BMB步骤生成炉号
|
||||||
//String stoveCode = CodeGeneratorHelper.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue().toString());
|
else {
|
||||||
|
//获取加工炉
|
||||||
|
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
|
||||||
|
//只有BMA,BMB生成炉号
|
||||||
|
if (kilnInfo.getType() == 1 || kilnInfo.getType() == 3) {
|
||||||
String stoveCode = StoveCodeUtils.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue());
|
String stoveCode = StoveCodeUtils.getStoveCode(currTask.getTargetPosition(), currTask.getPlcValue());
|
||||||
currTask.setStoveCode(stoveCode);
|
currTask.setStoveCode(stoveCode);
|
||||||
currTaskServiceBiz.updateById(currTask);
|
currTaskServiceBiz.updateById(currTask);
|
||||||
} else {
|
} else {
|
||||||
logger.info(currTask.getId() + "任务为多步骤任务且第一步为清洗,不生成洗炉炉号.");
|
logger.info(currTask.getId() + "任务为多步骤任务但该步骤不生成洗炉炉号.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1256,10 +1261,9 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
currTaskDetList.forEach(e -> {
|
currTaskDetList.forEach(e -> {
|
||||||
CreateItem createItem = new CreateItem();
|
CreateItem createItem = new CreateItem();
|
||||||
createItem.setItemCode(e.getIdenCardNum());
|
createItem.setItemCode(e.getIdenCardNum());
|
||||||
createItem.setQuantity(e.getQuantity().intValue());
|
BigDecimal b = new BigDecimal(String.valueOf(e.getWeight()));
|
||||||
//防止float转doule精度丢失
|
|
||||||
BigDecimal b=new BigDecimal(String.valueOf(e.getWeight()));
|
|
||||||
createItem.setWeight(b.doubleValue());
|
createItem.setWeight(b.doubleValue());
|
||||||
|
createItem.setQuantity(e.getQuantity().intValue());
|
||||||
createItems.add(createItem);
|
createItems.add(createItem);
|
||||||
});
|
});
|
||||||
//apmsCreateSheet.setStoveCode(code);
|
//apmsCreateSheet.setStoveCode(code);
|
||||||
|
Loading…
Reference in New Issue
Block a user