diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java index ab2f690..67e607f 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java @@ -9,6 +9,7 @@ import com.mt.wms.core.base.BaseController; import com.mt.wms.core.constants.CommonConstant; import com.mt.wms.core.dal.entity.CommunicationLog; import com.mt.wms.core.dal.service.CommunicationLogServiceBiz; +import com.mt.wms.core.enums.WhetherEnum; import com.mt.wms.core.vo.R; import com.mt.wms.empty.params.*; import com.mt.wms.empty.service.OrderInfoService; @@ -96,7 +97,7 @@ public class ApmsController extends BaseController { * 通过生产单编号删除生产单,如果生产单加工完成,不允许删除 * * @param sheetNo 生产单编号 - * @return + * @return 删除结果 */ @PostMapping(value = "deleteBySheetNo") @ApiOperation(value = "通知APMS删除生产单") @@ -234,4 +235,10 @@ public class ApmsController extends BaseController { getApmsToken(); } } + + private void setCommonField(CommunicationLog communicationLog) { + communicationLog.setValid(WhetherEnum.YES.getValue()); + communicationLog.setCreateTime(LocalDateTime.now()); + communicationLog.setUpdateTime(LocalDateTime.now()); + } } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java index 023943f..a821c5c 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java @@ -2,6 +2,7 @@ package com.mt.wms.empty.controller; import com.mt.wms.core.base.BaseController; import com.mt.wms.core.constants.CommonConstant; +import com.mt.wms.core.params.BasePageParam; import com.mt.wms.core.params.IdParam; import com.mt.wms.core.vo.IdVo; import com.mt.wms.core.vo.PageVo; @@ -11,6 +12,7 @@ import com.mt.wms.empty.params.TaskCreateParam; import com.mt.wms.empty.service.CurrTaskDetService; import com.mt.wms.empty.service.CurrTaskService; import com.mt.wms.empty.service.OrderInfoService; +import com.mt.wms.empty.vo.CurrTaskMainQueryVo; import com.mt.wms.empty.vo.CurrTaskQueryVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -50,6 +52,12 @@ public class CurrTaskController extends BaseController { } + @PostMapping(value = "mainCurrentTaskNow") + @ApiOperation(value = "首页-获取当前执行中的任务") + public R> mainCurrentTaskNow(BasePageParam param) { + return currTaskService.currentTaskMainPage(param); + } + @PostMapping(value = "currentTaskNow") @ApiOperation(value = "获取当前执行的任务 (车辆名称传id)") public R> currentTask(@Validated @RequestBody CurrTaskQueryParam param) { diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskDetHisController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskDetHisController.java index 902844d..a429dfe 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskDetHisController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskDetHisController.java @@ -32,7 +32,7 @@ public class TaskDetHisController extends BaseController { @PostMapping(value = "getTaskDet") @ApiOperation(value = "历史执行任务-查看详情") - public R> getTaskDetailsPage(@Validated @RequestBody CurrTaskDetQueryParam currTaskId) { - return taskDetHisService.getTaskDetailsPage(currTaskId); + public R> getTaskDetailsPage(@Validated @RequestBody CurrTaskDetQueryParam param) { + return taskDetHisService.getTaskDetailsPage(param); } } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskHisController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskHisController.java index 2194755..6f6f2e5 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskHisController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/TaskHisController.java @@ -2,6 +2,7 @@ package com.mt.wms.empty.controller; import com.mt.wms.core.base.BaseController; import com.mt.wms.core.constants.CommonConstant; +import com.mt.wms.core.utils.LocalDateTimeUtils; import com.mt.wms.core.vo.PageVo; import com.mt.wms.core.vo.R; import com.mt.wms.empty.params.TaskHisQueryParam; @@ -17,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.Objects; + /** * @author xcc * @date 2021年11月16日 @@ -33,6 +36,14 @@ public class TaskHisController extends BaseController { @PostMapping(value = "taskHis") @ApiOperation(value = "获取历史执行的任务 (车辆名称传id)") public R> currentTask(@Validated @RequestBody TaskHisQueryParam param) { + if (Objects.nonNull(param.getStartTime())) + { + param.setStartTime(LocalDateTimeUtils.getDayStart(param.getStartTime())); + } + if (Objects.nonNull(param.getEndTime())) + { + param.setEndTime(LocalDateTimeUtils.getDayEnd(param.getEndTime())); + } return taskHisService.taskHisPage(param); } } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/ApmsFinishProcessSheet.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/ApmsFinishProcessSheet.java index eb77ea5..131bb3d 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/ApmsFinishProcessSheet.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/ApmsFinishProcessSheet.java @@ -13,7 +13,7 @@ import java.util.List; @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) -@ApiModel(value = "Apms创建生产单", description = "Apms创建生产单") +@ApiModel(value = "Apms结束生产单", description = "Apms结束生产单") public class ApmsFinishProcessSheet extends BaseParam { private static final long serialVersionUID = 1L; diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/CurrTaskDetQueryParam.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/CurrTaskDetQueryParam.java index 7c7801c..5d1250e 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/CurrTaskDetQueryParam.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/CurrTaskDetQueryParam.java @@ -15,12 +15,11 @@ import lombok.experimental.Accessors; @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) -@ApiModel(value = "获取任务信息", description = "获取任务信息") +@ApiModel(value = "获取任务详细信息", description = "获取任务详细信息") public class CurrTaskDetQueryParam extends BasePageParam { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "主任务id",required = true) private Long currTaskId; - } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/TaskHisQueryParam.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/TaskHisQueryParam.java index 1fc02db..bb428f9 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/TaskHisQueryParam.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/TaskHisQueryParam.java @@ -24,8 +24,8 @@ public class TaskHisQueryParam extends BasePageParam { @ApiModelProperty(value = "车辆id") private String vehicleId; - @ApiModelProperty(value = "开始时间") + @ApiModelProperty(value = "开始时间", example = "2021-11-20T12:05:20") private LocalDateTime startTime; - @ApiModelProperty(value = "开始时间") + @ApiModelProperty(value = "结束时间", example = "2021-11-25T12:05:20") private LocalDateTime endTime; } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java index a1343e3..53cd413 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java @@ -1,11 +1,13 @@ package com.mt.wms.empty.service; +import com.mt.wms.core.params.BasePageParam; import com.mt.wms.core.params.IdParam; import com.mt.wms.core.vo.IdVo; import com.mt.wms.core.vo.PageVo; import com.mt.wms.core.vo.R; import com.mt.wms.empty.params.CurrTaskQueryParam; import com.mt.wms.empty.params.TaskCreateParam; +import com.mt.wms.empty.vo.CurrTaskMainQueryVo; import com.mt.wms.empty.vo.CurrTaskQueryVo; import com.mt.wms.empty.vo.CurrTaskVo; @@ -57,4 +59,11 @@ public interface CurrTaskService { * @return 结果 */ R deleteBySheetNo(String sheetNo); + + /** + * 首页 获取当前执行的任务 + * + * @return 结果 + */ + R> currentTaskMainPage(BasePageParam param); } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java index fa136b6..ab7da2e 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java @@ -4,11 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mt.wms.core.api.Assert; import com.mt.wms.core.base.BaseService; -import com.mt.wms.core.dal.entity.CurrTask; -import com.mt.wms.core.dal.entity.CurrTaskDet; -import com.mt.wms.core.dal.entity.TaskDetHis; -import com.mt.wms.core.dal.entity.TaskHis; +import com.mt.wms.core.dal.entity.*; import com.mt.wms.core.dal.service.CurrTaskServiceBiz; +import com.mt.wms.core.dal.service.OrderInfoServiceBiz; +import com.mt.wms.core.params.BasePageParam; import com.mt.wms.core.params.IdParam; import com.mt.wms.core.vo.IdVo; import com.mt.wms.core.vo.PageVo; @@ -22,6 +21,7 @@ import com.mt.wms.empty.service.CurrTaskService; import com.mt.wms.empty.service.TaskDetHisService; import com.mt.wms.empty.service.TaskHisService; import com.mt.wms.empty.vo.ApmsEndProcessVo; +import com.mt.wms.empty.vo.CurrTaskMainQueryVo; import com.mt.wms.empty.vo.CurrTaskQueryVo; import com.mt.wms.empty.vo.CurrTaskVo; import org.apache.commons.lang.StringUtils; @@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.List; /** @@ -58,6 +59,9 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService @Autowired ApmsController apmsControl; + @Autowired + OrderInfoServiceBiz orderInfoServiceBiz; + @Override public CurrTaskVo getCurrTask(IdParam idParam) { CurrTask byId = currTaskServiceBiz.getById(idParam.getId()); @@ -131,4 +135,36 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService return failed("无法删除,任务正在执行中。"); } + + @Override + public R> currentTaskMainPage(BasePageParam param) { + QueryWrapper currTaskQueryWrapper = new QueryWrapper<>(); + currTaskQueryWrapper.eq(CurrTask.STATUS, 1); + currTaskQueryWrapper.eq(CurrTask.VALID, 1); + Page page = currTaskServiceBiz.page(new Page<>(param.getCurrent(), param.getSize()), currTaskQueryWrapper); + PageVo pageVo = new PageVo<>(page, CurrTaskMainQueryVo.class); + pageVo.getRecords().forEach(e -> + { + //根据当前主任务查详细任务 + List taskDetailsByMainId = currTaskDetService.getTaskDetailsByMainId(IdParam.builder().id(e.getId()).build()); + ArrayList materialDes = new ArrayList<>(); + ArrayList iden = new ArrayList<>(); + //写入材料名与标识卡号 + taskDetailsByMainId.forEach(a -> { + materialDes.add(a.getMaterialDes()); + iden.add(a.getIdenCardNum()); + }); + e.setMaterials(materialDes); + e.setCustomers(iden); + ArrayList customers = new ArrayList<>(); + //根据标识卡号查订单的客户名并写入 + e.getIdens().forEach(id -> { + OrderInfo one = orderInfoServiceBiz.getOne(new QueryWrapper().eq(OrderInfo.IDEN_CARD_NUM, id)); + customers.add(one.getCustomerName()); + } + ); + e.setCustomers(customers); + }); + return successful(pageVo); + } } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/CurrTaskMainQueryVo.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/CurrTaskMainQueryVo.java new file mode 100644 index 0000000..80043c1 --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/CurrTaskMainQueryVo.java @@ -0,0 +1,80 @@ +package com.mt.wms.empty.vo; + +import com.mt.wms.core.base.BaseVo; +import com.mt.wms.core.vo.PageVo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.ArrayList; + +/** + * @author xcc + * @date 2021年11月8日 + * @since 1.0 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@Builder +@ApiModel(value = "首页当前任务信息", description = "首页当前任务信息") +public class CurrTaskMainQueryVo extends BaseVo implements PageVo.ConvertVo { + @ApiModelProperty(value = "id") + private Long id; + + /** + * 任务编码, 查看任务编码规则 + */ + @ApiModelProperty("任务编码") + private String taskCode; + /** + * 标识卡集 + */ + @ApiModelProperty("标识卡集") + private ArrayList idens; + /** + * 物料集 材料集? + */ + @ApiModelProperty("物料集") + private ArrayList materials; + /** + * 客户集 + */ + @ApiModelProperty("客户集") + private ArrayList customers; + + /** + * 状态: 0等待执行,1执行中,2执行完成,3追加后完成(追加后就按完成来算) + */ + private Integer status; + + /** + * 任务类型:0:入库到窑炉,1:入库到缓存区,2出库到 窑炉到缓存区,3缓存区出库 + */ + @ApiModelProperty("任务类型") + private Integer taskType; + /** + * 开始位置 + */ + @ApiModelProperty("开始位置") + private String startPosition; + + /** + * 目标位置指的是窑炉的位置 + */ + @ApiModelProperty("窑炉位置") + private String targetPosition; + /** + * 库位 + */ + @ApiModelProperty("库位") + private String locationName; + /** + * 窑炉名称 + */ + @ApiModelProperty("窑炉名称") + private String kilnName; +} diff --git a/6.program/wms-gateway/src/main/resources/config/application.yml b/6.program/wms-gateway/src/main/resources/config/application.yml index 4f5a514..9348986 100644 --- a/6.program/wms-gateway/src/main/resources/config/application.yml +++ b/6.program/wms-gateway/src/main/resources/config/application.yml @@ -88,6 +88,7 @@ wms: - /*/login - /*/wechatLogin - /*/mobileLogin + - /apms #公共配置 common: