优化创建任务时的参数和逻辑流程
优化订单完成信息。
This commit is contained in:
parent
db04b83481
commit
9f6d45bd91
@ -67,11 +67,11 @@ public class CurrTaskController extends BaseController {
|
|||||||
String kilnCode = kilnInfoVoR.getData().getCode();
|
String kilnCode = kilnInfoVoR.getData().getCode();
|
||||||
R<ApmsStoveVo> bm = apmsControl.getStoveCodeByWorkShopCode("BM");
|
R<ApmsStoveVo> bm = apmsControl.getStoveCodeByWorkShopCode("BM");
|
||||||
ArrayList<Map<String, String>> stoveCodes = bm.getData().getStoveCodes();
|
ArrayList<Map<String, String>> stoveCodes = bm.getData().getStoveCodes();
|
||||||
//验证apms存在这个炉子
|
//验证apms数据中存在这个炉子
|
||||||
boolean verifyCodes = false;
|
boolean verifyCodes = false;
|
||||||
ArrayList<String> codeStr = new ArrayList<>();
|
ArrayList<String> codeStr = new ArrayList<>();
|
||||||
stoveCodes.forEach(kilnMap -> {
|
stoveCodes.forEach(kilnMap -> {
|
||||||
codeStr.addAll(kilnMap.keySet());
|
codeStr.add(kilnMap.get("code"));
|
||||||
});
|
});
|
||||||
for (String s : codeStr)
|
for (String s : codeStr)
|
||||||
{
|
{
|
||||||
@ -83,7 +83,7 @@ public class CurrTaskController extends BaseController {
|
|||||||
}
|
}
|
||||||
if (!verifyCodes)
|
if (!verifyCodes)
|
||||||
{
|
{
|
||||||
return failed(kilnCode + " 验证APMS炉号失败!");
|
return failed("创建失败,APMS中验证炉号" + kilnCode + "失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
//通知apms创建一个生产单
|
//通知apms创建一个生产单
|
||||||
@ -91,8 +91,8 @@ public class CurrTaskController extends BaseController {
|
|||||||
apmsCreateSheet.setWorkShopCode("BM");
|
apmsCreateSheet.setWorkShopCode("BM");
|
||||||
apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
apmsCreateSheet.setTechCode(param.getCraftCode());
|
apmsCreateSheet.setTechCode(param.getCraftCode());
|
||||||
//fixme 暂时没有user信息
|
//fixme 暂时没有正式user,使用测试账户
|
||||||
apmsCreateSheet.setStartUser("");
|
apmsCreateSheet.setStartUser("QJJP03");
|
||||||
ArrayList<CreateItem> createItems = new ArrayList<>();
|
ArrayList<CreateItem> createItems = new ArrayList<>();
|
||||||
param.getDetParams().forEach(e -> {
|
param.getDetParams().forEach(e -> {
|
||||||
CreateItem createItem = new CreateItem();
|
CreateItem createItem = new CreateItem();
|
||||||
@ -101,6 +101,7 @@ public class CurrTaskController extends BaseController {
|
|||||||
createItem.setWeight(e.getWeight().doubleValue());
|
createItem.setWeight(e.getWeight().doubleValue());
|
||||||
createItems.add(createItem);
|
createItems.add(createItem);
|
||||||
});
|
});
|
||||||
|
apmsCreateSheet.setStoveCode(kilnCode);
|
||||||
apmsCreateSheet.setItems(createItems);
|
apmsCreateSheet.setItems(createItems);
|
||||||
R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
|
R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
|
||||||
|
|
||||||
@ -114,11 +115,12 @@ public class CurrTaskController extends BaseController {
|
|||||||
CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
|
CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
|
||||||
currTaskById.setSheetNo(sheetNo);
|
currTaskById.setSheetNo(sheetNo);
|
||||||
currTaskService.updateCurrTaskById(currTaskById);
|
currTaskService.updateCurrTaskById(currTaskById);
|
||||||
|
//生成详细任务中的检验结果数据在apms推送生产单结果时创建
|
||||||
return successful("创建成功,任务添加至等待执行队列。");
|
return successful("创建成功,任务添加至等待执行队列。");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return failed("创建失败,APMS报错:" + processSheet.getMsg());
|
return failed("创建失败,APMS报错:" + processSheet.getData().getMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public class OrderInfoController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
@PostMapping(value = "completeOrder")
|
@PostMapping(value = "completeOrder")
|
||||||
@ApiOperation(value = "完成订单")
|
@ApiOperation(value = "人工完成订单(不需通知apms,仅在wms完成)")
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private R<String> completeOrder(@Validated @RequestBody IdParam idParam) {
|
private R<String> completeOrder(@Validated @RequestBody IdParam idParam) {
|
||||||
return orderInfoService.completeOrder(idParam);
|
return orderInfoService.completeOrder(idParam);
|
||||||
|
@ -22,13 +22,13 @@ public class TaskCreateParam extends BaseParam {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ApiModelProperty(value = "托盘号")
|
// @ApiModelProperty(value = "托盘号")
|
||||||
private String palletCode;
|
// private String palletCode;
|
||||||
@ApiModelProperty(value = "起点", required = true)
|
@ApiModelProperty(value = "起点(提升平台)", required = true)
|
||||||
private String startPosition;
|
private String startPosition;
|
||||||
@ApiModelProperty(value = "终点位置", required = true)
|
@ApiModelProperty(value = "终点位置", required = true)
|
||||||
private String targetPosition;
|
private String targetPosition;
|
||||||
@ApiModelProperty(value = "加工类型:0 初始加工,1 复加工 ,2 追加加工", required = true)
|
@ApiModelProperty(value = "加工类型:0 初始加工,1 复加工", required = true)
|
||||||
private Integer processType;
|
private Integer processType;
|
||||||
@ApiModelProperty(value = "窑炉Id", example = "1", required = true)
|
@ApiModelProperty(value = "窑炉Id", example = "1", required = true)
|
||||||
private Long kilnId;
|
private Long kilnId;
|
||||||
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.mt.wms.core.api.Assert;
|
import com.mt.wms.core.api.Assert;
|
||||||
import com.mt.wms.core.base.BaseService;
|
import com.mt.wms.core.base.BaseService;
|
||||||
import com.mt.wms.core.dal.entity.*;
|
import com.mt.wms.core.dal.entity.*;
|
||||||
|
import com.mt.wms.core.dal.service.CraftInfoServiceBiz;
|
||||||
import com.mt.wms.core.dal.service.CurrTaskServiceBiz;
|
import com.mt.wms.core.dal.service.CurrTaskServiceBiz;
|
||||||
import com.mt.wms.core.dal.service.OrderInfoServiceBiz;
|
import com.mt.wms.core.dal.service.OrderInfoServiceBiz;
|
||||||
import com.mt.wms.core.params.BasePageParam;
|
import com.mt.wms.core.params.BasePageParam;
|
||||||
@ -61,6 +62,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
OrderInfoServiceBiz orderInfoServiceBiz;
|
OrderInfoServiceBiz orderInfoServiceBiz;
|
||||||
|
@Autowired
|
||||||
|
CraftInfoServiceBiz craftInfoServiceBiz;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CurrTaskVo getCurrTask(IdParam idParam) {
|
public CurrTaskVo getCurrTask(IdParam idParam) {
|
||||||
@ -87,6 +90,10 @@ 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());
|
||||||
currTask.setTaskSource(0);
|
currTask.setTaskSource(0);
|
||||||
|
//根据工艺号查询工艺id以及工艺plc值
|
||||||
|
CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper<CraftInfo>().eq(CraftInfo.CREATOR_ID, param.getCraftCode()));
|
||||||
|
currTask.setFCraftCodeId(one.getId());
|
||||||
|
currTask.setFPlcValue(one.getPlcValue());
|
||||||
setCommonField(currTask);
|
setCommonField(currTask);
|
||||||
currTaskServiceBiz.save(currTask);
|
currTaskServiceBiz.save(currTask);
|
||||||
return successful(IdVo.builder().id(currTask.getId()).build());
|
return successful(IdVo.builder().id(currTask.getId()).build());
|
||||||
|
@ -17,6 +17,7 @@ import com.mt.wms.core.dal.entity.OrderInfo;
|
|||||||
import com.mt.wms.core.dal.service.ApmsCheckResultServiceBiz;
|
import com.mt.wms.core.dal.service.ApmsCheckResultServiceBiz;
|
||||||
import com.mt.wms.core.dal.service.CommunicationLogServiceBiz;
|
import com.mt.wms.core.dal.service.CommunicationLogServiceBiz;
|
||||||
import com.mt.wms.core.dal.service.OrderInfoServiceBiz;
|
import com.mt.wms.core.dal.service.OrderInfoServiceBiz;
|
||||||
|
import com.mt.wms.core.enums.WhetherEnum;
|
||||||
import com.mt.wms.core.params.IdParam;
|
import com.mt.wms.core.params.IdParam;
|
||||||
import com.mt.wms.core.vo.PageVo;
|
import com.mt.wms.core.vo.PageVo;
|
||||||
import com.mt.wms.core.vo.R;
|
import com.mt.wms.core.vo.R;
|
||||||
@ -37,6 +38,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,7 +100,18 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
|||||||
.eq(OrderInfo.VALID, 1)
|
.eq(OrderInfo.VALID, 1)
|
||||||
.orderByDesc(OrderInfo.CREATE_TIME);
|
.orderByDesc(OrderInfo.CREATE_TIME);
|
||||||
Page<OrderInfo> page = orderInfoService.page(new Page<>(param.getCurrent(), param.getSize()), wrapper);
|
Page<OrderInfo> page = orderInfoService.page(new Page<>(param.getCurrent(), param.getSize()), wrapper);
|
||||||
return successful(new PageVo<>(page,OrderInfoVo.class));
|
PageVo<OrderInfoVo> orderInfoVoPageVo = new PageVo<>(page, OrderInfoVo.class);
|
||||||
|
orderInfoVoPageVo.getRecords().forEach(e ->
|
||||||
|
{
|
||||||
|
R<OrderInfoVo> info = getTaskInfoByIdenCardNum(e.getIdenCardNum());
|
||||||
|
e.setFinishWeight(info.getData().getFinishWeight());
|
||||||
|
e.setFinishQuantity(info.getData().getQuantity());
|
||||||
|
e.setWaitWeight(info.getData().getWaitWeight());
|
||||||
|
e.setWaitQuantity(info.getData().getWaitQuantity());
|
||||||
|
e.setReProcessQuantity(info.getData().getReProcessQuantity());
|
||||||
|
e.setReProcessWeight(info.getData().getReProcessWeight());
|
||||||
|
});
|
||||||
|
return successful(orderInfoVoPageVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -118,6 +131,13 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
|||||||
OrderInfo byId = orderInfoService.getById(idParam.getId());
|
OrderInfo byId = orderInfoService.getById(idParam.getId());
|
||||||
OrderInfoVo build = OrderInfoVo.builder().build();
|
OrderInfoVo build = OrderInfoVo.builder().build();
|
||||||
BeanUtils.copyProperties(byId, build);
|
BeanUtils.copyProperties(byId, build);
|
||||||
|
R<OrderInfoVo> info = getTaskInfoByIdenCardNum(build.getIdenCardNum());
|
||||||
|
build.setFinishWeight(info.getData().getFinishWeight());
|
||||||
|
build.setFinishQuantity(info.getData().getQuantity());
|
||||||
|
build.setWaitWeight(info.getData().getWaitWeight());
|
||||||
|
build.setWaitQuantity(info.getData().getWaitQuantity());
|
||||||
|
build.setReProcessQuantity(info.getData().getReProcessQuantity());
|
||||||
|
build.setReProcessWeight(info.getData().getReProcessWeight());
|
||||||
return successful(build);
|
return successful(build);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,8 +199,26 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
|||||||
build.setFinishQuantity(sumTaskHis.get("quantity").floatValue());
|
build.setFinishQuantity(sumTaskHis.get("quantity").floatValue());
|
||||||
build.setFinishWeight(sumTaskHis.get("weight").floatValue());
|
build.setFinishWeight(sumTaskHis.get("weight").floatValue());
|
||||||
|
|
||||||
build.setLastQuantity(build.getQuantity() - build.getFinishQuantity() - build.getWaitQuantity());
|
// 考虑返工单的加工情况,添加到返工统计信息中。
|
||||||
build.setLastWeight(build.getWeight() - build.getFinishWeight() - build.getWaitWeight());
|
if (Objects.nonNull(one.getOldOrderNo()))
|
||||||
|
{
|
||||||
|
List<OrderInfo> list = orderInfoService.list(new QueryWrapper<OrderInfo>().eq(OrderInfo.VALID, 1).eq(OrderInfo.ORDER_NO, one.getOldOrderNo()));
|
||||||
|
float reQuantity = 0;
|
||||||
|
float reWeight = 0;
|
||||||
|
for (OrderInfo orderInfo : list)
|
||||||
|
{
|
||||||
|
HashMap<String, Double> reCurrTask = currTaskDetService.getSumByIdCard(orderInfo.getIdenCardNum());
|
||||||
|
reQuantity += reCurrTask.get("quantity").floatValue();
|
||||||
|
reWeight += reCurrTask.get("weight").floatValue();
|
||||||
|
|
||||||
|
HashMap<String, Double> reTaskHis = taskDetHisService.getSumByIdCard(orderInfo.getIdenCardNum());
|
||||||
|
reQuantity += reTaskHis.get("quantity").floatValue();
|
||||||
|
reWeight += reTaskHis.get("weight").floatValue();
|
||||||
|
}
|
||||||
|
build.setReProcessQuantity(reQuantity);
|
||||||
|
build.setReProcessWeight(reWeight);
|
||||||
|
}
|
||||||
|
|
||||||
return successful(build);
|
return successful(build);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +240,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
|||||||
byId.setValid(0);
|
byId.setValid(0);
|
||||||
byId.setStatus(2);
|
byId.setStatus(2);
|
||||||
orderInfoService.updateById(byId);
|
orderInfoService.updateById(byId);
|
||||||
return successful("操作成功。");
|
return successful("订单状态成功置为完成。");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -210,7 +248,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
|||||||
OrderInfo byId = orderInfoService.getById(idParam.getId());
|
OrderInfo byId = orderInfoService.getById(idParam.getId());
|
||||||
byId.setValid(0);
|
byId.setValid(0);
|
||||||
orderInfoService.updateById(byId);
|
orderInfoService.updateById(byId);
|
||||||
return successful("操作成功。");
|
return successful("订单状态成功置为作废。");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -231,13 +269,17 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
|||||||
@Override
|
@Override
|
||||||
public R<String> apmsCompleteOrder(ApmsCompleteOrder apmsCompleteOrder) {
|
public R<String> apmsCompleteOrder(ApmsCompleteOrder apmsCompleteOrder) {
|
||||||
//通过标识卡号与生产单号进行更新检验结果
|
//通过标识卡号与生产单号进行更新检验结果
|
||||||
ApmsCheckResult one = apmsCheckResultServiceBiz.getOne(new QueryWrapper<ApmsCheckResult>().eq(ApmsCheckResult.IDEN_CARD_NUM, apmsCompleteOrder.getIdenCardNum()).eq(ApmsCheckResult.SHEET_NO, apmsCompleteOrder.getSheetNo()));
|
ApmsCheckResult one = new ApmsCheckResult();
|
||||||
|
one.setIdenCardNum(apmsCompleteOrder.getIdenCardNum());
|
||||||
|
one.setSheetNo(apmsCompleteOrder.getSheetNo());
|
||||||
|
one.setCreateTime(LocalDateTime.now());
|
||||||
|
one.setValid(WhetherEnum.YES.getValue());
|
||||||
one.setMetallography(apmsCompleteOrder.getMetallographic());
|
one.setMetallography(apmsCompleteOrder.getMetallographic());
|
||||||
one.setHeartHardness(apmsCompleteOrder.getHeartHardness());
|
one.setHeartHardness(apmsCompleteOrder.getHeartHardness());
|
||||||
one.setHardness(apmsCompleteOrder.getHardness());
|
one.setHardness(apmsCompleteOrder.getHardness());
|
||||||
one.setUpdateTime(LocalDateTime.now());
|
one.setUpdateTime(LocalDateTime.now());
|
||||||
apmsCheckResultServiceBiz.updateById(one);
|
apmsCheckResultServiceBiz.save(one);
|
||||||
OrderInfo one1 = orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.IDEN_CARD_NUM, apmsCompleteOrder.getIdenCardNum()));
|
//订单不应该在该地方完成,额外提供一个完成接口供人工完成,不通知apms
|
||||||
return completeOrder(IdParam.builder().id(one1.getId()).build());
|
return successful("任务执行完成。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,6 @@ public class OrderInfoVo extends BaseVo implements PageVo.ConvertVo {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "主键")
|
@ApiModelProperty(value = "主键")
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
|
||||||
* 删除标志,是否有效:1 可用 0不可用,2停止
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("删除标志")
|
|
||||||
private Integer valid;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 来源:1.APMS 2.人工输入
|
* 来源:1.APMS 2.人工输入
|
||||||
*/
|
*/
|
||||||
@ -45,18 +39,6 @@ public class OrderInfoVo extends BaseVo implements PageVo.ConvertVo {
|
|||||||
@ApiModelProperty(value = "添加时间")
|
@ApiModelProperty(value = "添加时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建人id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "创建人id")
|
|
||||||
private Integer creatorId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新人id
|
|
||||||
*/
|
|
||||||
@ApiModelProperty(value = "更新人id")
|
|
||||||
private Integer updaterId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改时间,更具修改时间来判断下次执行顺序,第一次修改时间和新增时间相同
|
* 修改时间,更具修改时间来判断下次执行顺序,第一次修改时间和新增时间相同
|
||||||
*/
|
*/
|
||||||
@ -164,15 +146,15 @@ public class OrderInfoVo extends BaseVo implements PageVo.ConvertVo {
|
|||||||
private Float waitQuantity;
|
private Float waitQuantity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 剩余重量 完全未处理
|
* 返工重量 返工单中计算的值
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "剩余重量")
|
@ApiModelProperty(value = "返工重量")
|
||||||
private Float lastWeight;
|
private Float reProcessWeight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 剩余数量 完全未处理
|
* 返工数量 返工单中计算的值
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "剩余数量")
|
@ApiModelProperty(value = "返工数量")
|
||||||
private Float lastQuantity;
|
private Float reProcessQuantity;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user