currTask列表总览及操作方式修改
This commit is contained in:
李广豪 2022-09-09 16:46:26 +08:00
parent d107699d2c
commit 18590dafb9
8 changed files with 291 additions and 61 deletions

View File

@ -0,0 +1,38 @@
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.IdParam;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.service.StockInfoService;
import com.mt.wms.empty.vo.CurrTaskDetVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Author: LGH
* @Date: 2022/9/9
*/
@RestController
@RequestMapping(CommonConstant.API_MODULE_BASE + "inStockInfo")
@Slf4j
@Api(value = "缓存库位相关接口", tags = "缓存库位相关接口", hidden = false)
public class InStockInfoController extends BaseController {
@Autowired
private StockInfoService stockInfoService;
@PostMapping(value = "top")
@ApiOperation(value = "置顶改缓存库位")
private R<String> top(@Validated @RequestBody IdParam idParam) {
return stockInfoService.top(idParam);
}
}

View File

@ -0,0 +1,28 @@
package com.mt.wms.empty.params;
import com.mt.wms.core.base.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Author: LGH
* @Date: 2022/9/5
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "任务参数对象", description = "任务参数对象")
public class CurrTaskParam extends BaseParam {
@ApiModelProperty(value = "id", required = true)
private Long id;
@ApiModelProperty(value = "状态", required = false)
private Integer status;
@ApiModelProperty(value = "加工炉", required = false)
private Long kilnId;
}

View File

@ -29,4 +29,8 @@ public interface StockInfoService {
* @return xx列表 * @return xx列表
*/ */
R<List<StockInfoVo>> list(); R<List<StockInfoVo>> list();
/**
* 置顶缓存库位顺序
*/
R<String> top(IdParam idParam);
} }

View File

@ -177,6 +177,14 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
nowStep=currTask.getLocationName(); nowStep=currTask.getLocationName();
} }
allStep=allStep.concat("->").concat(currTask1.getTargetPosition()); allStep=allStep.concat("->").concat(currTask1.getTargetPosition());
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask1.getId()));
if (inStockInfo!=null){
List<InStockInfoVo> inStockInfoVoList=new ArrayList<>();
InStockInfoVo inStockInfoVo=InStockInfoVo.builder().build();
BeanUtils.copyProperties(inStockInfo,inStockInfoVo);
inStockInfoVoList.add(inStockInfoVo);
currTaskInfoVo.setInStockInfoVoList(inStockInfoVoList);
}
} }
// //
currTaskInfoVo.setAllStep(allStep); currTaskInfoVo.setAllStep(allStep);
@ -190,6 +198,14 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
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()));
if (inStockInfo!=null){
List<InStockInfoVo> inStockInfoVoList=new ArrayList<>();
InStockInfoVo inStockInfoVo=InStockInfoVo.builder().build();
BeanUtils.copyProperties(inStockInfo,inStockInfoVo);
inStockInfoVoList.add(inStockInfoVo);
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()));
@ -205,6 +221,9 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
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();
//修改任务状态
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()));
@ -234,7 +253,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
currTask1.setStatus(2); currTask1.setStatus(2);
currTask1.setIsIn(2); currTask1.setIsIn(2);
//99代表该条记录手动修改过 //99代表该条记录手动修改过
currTask1.setCreatorId(99); currTask1.setUpdaterId(99);
currTask1.setUpdateTime(LocalDateTime.now());
currTaskServiceBiz.updateById(currTask1); currTaskServiceBiz.updateById(currTask1);
}else if (currTask.getId().equals(autoExeTask.getThTaskId())){ }else if (currTask.getId().equals(autoExeTask.getThTaskId())){
//该任务为自动任务第三条,修改自动任务第二条的状态 //该任务为自动任务第三条,修改自动任务第二条的状态
@ -242,15 +262,17 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
currTask2.setStatus(2); currTask2.setStatus(2);
currTask2.setIsIn(2); currTask2.setIsIn(2);
//99代表该条记录手动修改过 //99代表该条记录手动修改过
currTask2.setCreatorId(99); currTask2.setUpdaterId(99);
currTask2.setUpdateTime(LocalDateTime.now());
currTaskServiceBiz.updateById(currTask2); currTaskServiceBiz.updateById(currTask2);
} }
} }
currTask.setStatus(1); currTask.setStatus(1);
currTask.setCreatorId(99); currTask.setUpdaterId(99);
currTask.setUpdateTime(LocalDateTime.now());
currTask.setBeginTime(LocalDateTime.now()); currTask.setBeginTime(LocalDateTime.now());
currTaskServiceBiz.updateById(currTask); currTaskServiceBiz.updateById(currTask);
return successful("修改任务状态为加工中成功"); logger.info("修改任务"+currTask.getId()+"状态为加工中成功");
} }
//修改为加工完成,查询缓存,并修改 //修改为加工完成,查询缓存,并修改
if (status==2){ if (status==2){
@ -267,13 +289,57 @@ 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);
return successful("修改任务状态为加工完成成功"); 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);
return successful("修改任务状态为未加工成功"); logger.info("修改任务"+currTask.getId()+"状态为未加工成功");
}
//修改目标加工炉
if (!kilnId.equals(currTask.getKilnId())){
KilnInfo kiln = kilnInfoServiceBiz.getById(kilnId);
//修改目标加工炉,修改终点
currTask.setKilnId(kilnId);
currTask.setTargetPosition(kiln.getCode());
currTask.setUpdaterId(99);
currTask.setUpdateTime(LocalDateTime.now());
currTaskServiceBiz.updateById(currTask);
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.TASK_ID, currTask.getId()));
//是否存在缓存
if (inStockInfo!=null){
//修改缓存后目标加工炉
inStockInfo.setKilnId(kilnId);
inStockInfo.setKilnName(kiln.getKilnName());
inStockInfo.setUpdaterId(99);
inStockInfo.setUpdateTime(LocalDateTime.now());
inStockInfoServiceBiz.updateById(inStockInfo);
}
//任务为多步骤任务
if (currTask.getIsAuto()==1){
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getById(currTask.getAutoExeTaskId());
//任务为多步骤任务第一步
if (currTask.getId().equals(autoExeTask.getFTaskId())){
//修改多步骤第二步的起点
CurrTask currTask2 = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
currTask2.setStartPosition(kiln.getCode());
currTask2.setUpdateTime(LocalDateTime.now());
currTask2.setUpdaterId(99);
currTaskServiceBiz.updateById(currTask2);
}else if (currTask.getId().equals(autoExeTask.getTTaskId())){
//任务为多步骤任务第二步且有第三步,修改第三步起点
if (autoExeTask.getProcessFlowType()==2){
CurrTask currTask3 = currTaskServiceBiz.getById(autoExeTask.getThTaskId());
currTask3.setStartPosition(kiln.getCode());
currTask3.setUpdateTime(LocalDateTime.now());
currTask3.setUpdaterId(99);
currTaskServiceBiz.updateById(currTask3);
}
}
}
}
return successful("操作成功!");
} }

View File

@ -2,10 +2,7 @@ package com.mt.wms.empty.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mt.wms.core.base.BaseService; import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.CurrTaskDet; import com.mt.wms.core.dal.entity.*;
import com.mt.wms.core.dal.entity.InStockInfo;
import com.mt.wms.core.dal.entity.Location;
import com.mt.wms.core.dal.entity.OrderInfo;
import com.mt.wms.core.dal.service.CurrTaskDetServiceBiz; import com.mt.wms.core.dal.service.CurrTaskDetServiceBiz;
import com.mt.wms.core.dal.service.InStockInfoServiceBiz; import com.mt.wms.core.dal.service.InStockInfoServiceBiz;
import com.mt.wms.core.dal.service.LocationServiceBiz; import com.mt.wms.core.dal.service.LocationServiceBiz;
@ -21,6 +18,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -76,4 +74,24 @@ public class StockInfoServiceImpl extends BaseService implements StockInfoServic
} }
return successful(stockInfoVoList); return successful(stockInfoVoList);
} }
@Override
public R<String> top(IdParam idParam) {
InStockInfo inStockInfo = inStockInfoServiceBiz.getById(idParam.getId());
Long kilnId = inStockInfo.getKilnId();
List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>()
.eq(InStockInfo.KILN_ID, kilnId)
.eq(InStockInfo.TYPE,1)
.eq(InStockInfo.STATUS,2)
.orderByAsc(InStockInfo.IN_TIME));
if (inStockInfoList.size()<2){
return R.failed("当前加工炉等待队列只有一个任务,无需置顶");
}
LocalDateTime inTime=null;
inTime = inStockInfoList.get(0).getInTime();
inStockInfo.setInTime(inTime.minusHours(1));
inStockInfoServiceBiz.updateById(inStockInfo);
return R.ok("当前任务置顶成功","");
}
} }

View File

@ -80,4 +80,10 @@ public class CurrTaskInfoVo extends BaseVo implements PageVo.ConvertVo{
*/ */
@ApiModelProperty("任务步骤详情") @ApiModelProperty("任务步骤详情")
private List<CurrTaskVo> currTaskVoList; private List<CurrTaskVo> currTaskVoList;
/**
* 缓存详情
*/
@ApiModelProperty("任务步骤详情")
private List<InStockInfoVo> inStockInfoVoList;
} }

View File

@ -111,6 +111,11 @@ public class CurrTaskVo extends BaseVo implements PageVo.ConvertVo {
*/ */
@ApiModelProperty("目标工业炉id") @ApiModelProperty("目标工业炉id")
private Long kilnId; private Long kilnId;
/**
* 目标工业炉id
*/
@ApiModelProperty("目标工业炉name")
private String kilnName;
/** /**
* 车辆id关联车辆表t_vehicle_info * 车辆id关联车辆表t_vehicle_info

View File

@ -0,0 +1,65 @@
package com.mt.wms.empty.vo;
import com.baomidou.mybatisplus.annotation.TableField;
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.time.LocalDateTime;
/**
* @Author: LGH
* @Date: 2022/9/9
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@ApiModel(value = "缓存信息视图对象", description = "用于查询缓存信息")
public class InStockInfoVo extends BaseVo implements PageVo.ConvertVo{
/**
* 主键自增
*/
@ApiModelProperty(value = "主键", example = "1")
private Long id;
/**
* 库位id
*/
@ApiModelProperty(value = "库位id",example = "0")
private Long locationId;
/**
* 库位名称
*/
@ApiModelProperty(value = "库位名称",example = "0")
private String locationName;
/**
* 任务id
*/
@ApiModelProperty(value = "任务id",example = "0")
private Long taskId;
/**
* 进入缓存区的时间插单任务按倒叙执行正常任务按顺序执行
*/
@ApiModelProperty(value = "进入缓存区的时间",example = "0")
private LocalDateTime inTime;
/**
* 工业炉id
*/
@ApiModelProperty(value = "工业炉id",example = "0")
private Long kilnId;
/**
* 工业炉名称
*/
@ApiModelProperty(value = "工业炉名称",example = "0")
private String kilnName;
}