Compare commits

...

3 Commits

Author SHA1 Message Date
LGH
bcff5830f4 Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd
 Conflicts:
	6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java
	6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java
2022-11-21 15:59:56 +08:00
LGH
75471b7166 update:
炉号生成规则修改;
新增未成功报工列表接口;
新增报工接口;
2022-11-21 15:55:19 +08:00
LGH
ec7f364ccf update:
炉号生成规则修改;
新增未成功报工列表接口;
新增报工接口;
2022-11-21 15:54:43 +08:00
5 changed files with 397 additions and 249 deletions

View File

@ -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 + "失败!");
} }
@ -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 + "失败!");
} }
/* /*
@ -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,18 +313,21 @@ 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 {
@ -324,6 +335,7 @@ public class CurrTaskController extends BaseController {
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 搬运

View File

@ -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)));
} }
} }

View File

@ -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删除生产单
* *

View File

@ -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) {
@ -199,11 +195,6 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
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());
@ -238,6 +229,157 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
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());
@ -417,7 +559,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
} }
if (currTask.getStatus() == 2) { if (currTask.getStatus() == 2) {
return failed("无法删除,任务已加工完成。"); return failed("无法删除,任务已加工完成。");
}if (currTask.getStatus()==1){ }
if (currTask.getStatus() == 1) {
return failed("无法删除,任务正在执行中。"); return failed("无法删除,任务正在执行中。");
} }
} }
@ -427,8 +570,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
) { ) {
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()));
@ -445,15 +587,14 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
} }
} }
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("无法删除,任务正在执行中。");
} }
@ -555,6 +696,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
/** /**
* 传入任务id,查询任务炉子然后根据炉子查询等待列表然后时间置为早 * 传入任务id,查询任务炉子然后根据炉子查询等待列表然后时间置为早
*
* @param idParam * @param idParam
* @return * @return
*/ */
@ -582,6 +724,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
inStockInfoServiceBiz.updateById(inStockInfo); inStockInfoServiceBiz.updateById(inStockInfo);
return R.ok("当前任务置顶成功", ""); return R.ok("当前任务置顶成功", "");
} }
/** /**
* 上报apms创建生产单并开始处理 * 上报apms创建生产单并开始处理
* *

View File

@ -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());
//防止float转doule精度丢失
BigDecimal b = new BigDecimal(String.valueOf(e.getWeight())); 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);