rev:更新
This commit is contained in:
@@ -28,4 +28,12 @@ public interface AcsToWmsService {
|
||||
*/
|
||||
ApplyTaskResponse applyPutEmptyVehicle(JSONObject param);
|
||||
|
||||
/**
|
||||
* 任务反馈
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
BaseResponse feedbackTaskStatus(JSONObject param);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,12 +11,17 @@ import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.ext.acs.service.dto.to.acs.ApplyTaskResponse;
|
||||
import org.nl.wms.ext.acs.service.dto.to.wms.FeedBackTaskStatusRequest;
|
||||
import org.nl.wms.ext.record.service.ISysInteractRecordService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.TaskFactory;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -51,6 +56,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
private RedissonClient redissonClient;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private TaskFactory taskFactory;
|
||||
|
||||
// 初始化反射方法
|
||||
@PostConstruct
|
||||
@@ -129,4 +136,48 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return ApplyTaskResponse.responseOk(requestNo);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BaseResponse feedbackTaskStatus(JSONObject param) {
|
||||
String requestNo = param.getString("requestNo");
|
||||
FeedBackTaskStatusRequest taskStatusRequest = param.toJavaObject(FeedBackTaskStatusRequest.class);
|
||||
String taskCode = taskStatusRequest.getTask_code();
|
||||
if (ObjectUtil.isEmpty(taskCode)) {
|
||||
throw new BadRequestException("任务编码不能为空!");
|
||||
}
|
||||
SchBaseTask taskObj = taskService.getByCode(taskCode);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("未找到任务编码为 [" + taskCode + "] 的任务");
|
||||
}
|
||||
// 任务处理类
|
||||
String processingClass = taskObj.getConfig_code();
|
||||
//1:执行中,2:完成 ,3:acs取消
|
||||
String acsTaskStatus = param.getString("task_status");
|
||||
String message = "";
|
||||
TaskStatus status = TaskStatus.APPLY;
|
||||
switch (acsTaskStatus) {
|
||||
case "1":
|
||||
status = TaskStatus.EXECUTING;
|
||||
break;
|
||||
case "2":
|
||||
status = TaskStatus.FINISHED;
|
||||
break;
|
||||
case "3":
|
||||
status = TaskStatus.CANCELED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// 根据配置去工厂类获得类对象
|
||||
AbstractTask abstractTask = taskFactory.getTask(processingClass);
|
||||
// 更新任务
|
||||
try {
|
||||
abstractTask.updateTaskStatus(taskCode, status);
|
||||
} catch (Exception e) {
|
||||
log.error("任务状态更新失败: {}", e.getMessage());
|
||||
return BaseResponse.responseError(requestNo, "任务:[" + taskCode + "]状态更新失败," + message);
|
||||
}
|
||||
return BaseResponse.responseOk(requestNo, "任务状态反馈成功!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class PdaController {
|
||||
|
||||
@PostMapping("/group/printf")
|
||||
@Log("打印标签")
|
||||
public ResponseEntity<PrintTagVo> printf(@Validated @RequestBody CommonPointQueryDto requestParam) {
|
||||
public ResponseEntity<PrintTagVo> printf(@Validated @RequestBody CommonVehicleInfoDto requestParam) {
|
||||
return new ResponseEntity<>(pdaService.printf(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public interface PdaService {
|
||||
* @param requestParam
|
||||
* @return
|
||||
*/
|
||||
PrintTagVo printf(CommonPointQueryDto requestParam);
|
||||
PrintTagVo printf(CommonVehicleInfoDto requestParam);
|
||||
|
||||
/**
|
||||
* 呼叫空托
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.nl.wms.pda.service.dao.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 通用实体
|
||||
* @Date: 2023/10/16
|
||||
*/
|
||||
@Data
|
||||
public class CommonVehicleInfoDto {
|
||||
private String vehicle_code;
|
||||
}
|
||||
@@ -17,5 +17,5 @@ public class ManualGroupDto {
|
||||
private String material_id;
|
||||
private String material_code;
|
||||
private String material_qty;
|
||||
private boolean is_link;
|
||||
private Boolean is_link;
|
||||
}
|
||||
|
||||
@@ -24,13 +24,17 @@
|
||||
</select>
|
||||
|
||||
<select id="queryVehicleGroup" resultType="org.nl.wms.pda.service.dao.vo.VehicleLinkVo">
|
||||
select group_id,
|
||||
material_id,
|
||||
material_name,
|
||||
point_code,
|
||||
vehicle_code,
|
||||
vehicle_type
|
||||
from `sch_base_vehiclematerialgroup`
|
||||
select g.group_id,
|
||||
g.material_id,
|
||||
m.material_code,
|
||||
m.material_name,
|
||||
g.point_code,
|
||||
g.vehicle_code,
|
||||
g.vehicle_type,
|
||||
g.material_qty
|
||||
from `sch_base_vehiclematerialgroup` g
|
||||
left join md_base_material m
|
||||
on g.material_id = m.material_id
|
||||
where link_status = '0'
|
||||
and group_status = '2'
|
||||
and group_bind_material_status = '2'
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
public class PointVo {
|
||||
private String point_id;
|
||||
private String point_code;
|
||||
private String point_name;
|
||||
private List<PointVo> end_points = new ArrayList<>();
|
||||
|
||||
@@ -11,9 +11,12 @@ import lombok.Data;
|
||||
public class VehicleLinkVo {
|
||||
private String group_id;
|
||||
private String material_code;
|
||||
private String material_qty;
|
||||
private String material_id;
|
||||
private String material_name;
|
||||
private String point_code;
|
||||
private String point_name;
|
||||
private String vehicle_code;
|
||||
private String vehicle_type;
|
||||
private String pcsn;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.pda.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.CopyUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.database.material.service.IMdBaseMaterialService;
|
||||
import org.nl.wms.database.material.service.dao.MdBaseMaterial;
|
||||
@@ -102,6 +104,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PdaResponseVo manualCreateByPda(ManualGroupDto entity) {
|
||||
Assert.notNull(entity, "参数不能为空!");
|
||||
SchBaseVehiclematerialgroup groupInfo = vehiclematerialgroupService.getGroupInfo(entity.getVehicle_code(),
|
||||
@@ -124,14 +127,21 @@ public class PdaServiceImpl implements PdaService {
|
||||
group.setInstorage_time(DateUtil.now());
|
||||
group.setGroup_status(GroupStatusEnum.IN_STORAGE.getType());
|
||||
//判断是否需要配盘
|
||||
group.setLink_status(!entity.is_link() ? LinkStatusEnum.LINK_FINISH.getType() : LinkStatusEnum.LINK_READY.getType());
|
||||
group.setPcsn(!entity.is_link() ? CodeUtil.getNewCode("PCSN_CODE") : null);
|
||||
group.setLink_status(!entity.getIs_link() ? LinkStatusEnum.LINK_FINISH.getType() : LinkStatusEnum.LINK_READY.getType());
|
||||
group.setPcsn(!entity.getIs_link() ? CodeUtil.getNewCode("PCSN_CODE") : null);
|
||||
group.setMove_way(basePoint.getPoint_code());
|
||||
group.setBuss_move_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
group.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
group.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
group.setCreate_time(DateUtil.now());
|
||||
vehiclematerialgroupService.save(group);
|
||||
|
||||
//同时更新组盘点位的载具信息
|
||||
basePoint.setVehicle_code(entity.getVehicle_code());
|
||||
basePoint.setVehicle_type(entity.getVehicle_type());
|
||||
basePoint.setVehicle_qty(1);
|
||||
basePoint.setPoint_status(PointStatusEnum.FULL_POINT.getCode());
|
||||
pointService.updateById(basePoint);
|
||||
return PdaResponseVo.pdaResultOk("组盘成功");
|
||||
}
|
||||
|
||||
@@ -159,15 +169,16 @@ public class PdaServiceImpl implements PdaService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrintTagVo printf(CommonPointQueryDto requestParam) {
|
||||
public PrintTagVo printf(CommonVehicleInfoDto requestParam) {
|
||||
Assert.notNull(requestParam, "参数不能为空!");
|
||||
String point_code = requestParam.getPoint_code();
|
||||
String vehicle_code = requestParam.getVehicle_code();
|
||||
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(SchBaseVehiclematerialgroup::getPoint_code, point_code)
|
||||
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)
|
||||
.eq(SchBaseVehiclematerialgroup::getLink_status, LinkStatusEnum.LINK_FINISH.getType())
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_status, GroupStatusEnum.IN_STORAGE.getType());
|
||||
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getOne(lqw);
|
||||
Assert.notNull(vehiclematerialgroup, "点位:" + point_code + ",未找到对应的组盘信息,组盘或配盘未完成!");
|
||||
Assert.notNull(vehiclematerialgroup, "载具:" + vehicle_code + ",未进行配盘!");
|
||||
PrintTagVo printTagVo = new PrintTagVo();
|
||||
printTagVo.setVehicle_code(vehiclematerialgroup.getVehicle_code());
|
||||
printTagVo.setMaterial_code(vehiclematerialgroup.getMaterial_code());
|
||||
@@ -193,8 +204,17 @@ public class PdaServiceImpl implements PdaService {
|
||||
@Override
|
||||
public PdaResponseVo fullVehicleIn(CommonPointQueryDto requestParam) {
|
||||
Assert.notNull(requestParam, "参数不能为空!");
|
||||
String point_code = requestParam.getPoint_code();
|
||||
LambdaQueryWrapper<SchBasePoint> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(SchBasePoint::getPoint_code, point_code)
|
||||
.eq(SchBasePoint::getPoint_status, PointStatusEnum.FULL_POINT.getCode())
|
||||
.eq(SchBasePoint::getIs_used, true);
|
||||
SchBasePoint point = pointService.getOne(lqw);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("点位:" + point_code + ",状态不是有料状态!");
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", requestParam.getPoint_code());
|
||||
param.put("device_code", point_code);
|
||||
param.put("config_code", "ZPRKTask");
|
||||
param.put("requestNo", IdUtil.simpleUUID());
|
||||
param.put("user_id", "1");
|
||||
@@ -226,10 +246,12 @@ public class PdaServiceImpl implements PdaService {
|
||||
new LambdaQueryWrapper<>();
|
||||
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_status, GroupStatusEnum.IN_STORAGE.getType())
|
||||
.eq(SchBaseVehiclematerialgroup::getLink_status, LinkStatusEnum.LINK_FINISH);
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())
|
||||
.eq(SchBaseVehiclematerialgroup::getLink_status, LinkStatusEnum.LINK_FINISH.getType());
|
||||
SchBaseVehiclematerialgroup groupOne = vehiclematerialgroupService.getOne(lqw);
|
||||
Assert.notNull(groupOne, "载具号:'" + vehicle_code + "',对应的组盘信息不存在!");
|
||||
this.checkQty(groupOne, residue_num);
|
||||
if (ObjectUtil.isNotEmpty(groupOne)) {
|
||||
this.checkQty(groupOne, residue_num);
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", requestParam.getPoint_code());
|
||||
param.put("config_code", "JLHCHKTask");
|
||||
@@ -252,30 +274,40 @@ public class PdaServiceImpl implements PdaService {
|
||||
new LambdaQueryWrapper<>();
|
||||
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_status, GroupStatusEnum.IN_STORAGE.getType())
|
||||
.eq(SchBaseVehiclematerialgroup::getLink_status, LinkStatusEnum.LINK_FINISH);
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())
|
||||
.eq(SchBaseVehiclematerialgroup::getLink_status, LinkStatusEnum.LINK_FINISH.getType());
|
||||
SchBaseVehiclematerialgroup groupOne = vehiclematerialgroupService.getOne(lqw);
|
||||
Assert.notNull(groupOne, "载具号:'" + vehicle_code + "',对应的组盘信息不存在!");
|
||||
this.checkQty(groupOne, residue_num);
|
||||
//如果余料数量为0
|
||||
if (residue_num.matches("^0*(\\.\\d+)?$")) {
|
||||
groupOne.setLink_status(LinkStatusEnum.LINK_READY.getType());
|
||||
groupOne.setPcsn("");
|
||||
groupOne.setMaterial_code("");
|
||||
groupOne.setMaterial_id("");
|
||||
groupOne.setMaterial_name("");
|
||||
groupOne.setInstorage_time(DateUtil.now());
|
||||
groupOne.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
groupOne.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
groupOne.setUpdate_time(DateUtil.now());
|
||||
groupOne.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue());
|
||||
vehiclematerialgroupService.update(groupOne);
|
||||
|
||||
SchBasePoint point = pointService.getById(point_code);
|
||||
point.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
|
||||
pointService.update(point);
|
||||
} else {
|
||||
//如果余料数量不为0
|
||||
groupOne.setMaterial_qty(residue_num);
|
||||
SchBaseVehiclematerialgroup copyGroup = BeanUtil.copyProperties(groupOne, SchBaseVehiclematerialgroup.class);
|
||||
double originalNum = Double.parseDouble(groupOne.getMaterial_qty());
|
||||
double residueNum = Double.parseDouble(residue_num);
|
||||
double outNum = originalNum - residueNum;
|
||||
//解绑原有的组盘信息
|
||||
groupOne.setMaterial_qty(String.valueOf(outNum));
|
||||
groupOne.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue());
|
||||
groupOne.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
groupOne.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
groupOne.setUpdate_time(DateUtil.now());
|
||||
vehiclematerialgroupService.update(groupOne);
|
||||
//新增一条新的组盘信息
|
||||
copyGroup.setGroup_id(IdUtil.simpleUUID());
|
||||
copyGroup.setMaterial_qty(residue_num);
|
||||
vehiclematerialgroupService.create(copyGroup);
|
||||
}
|
||||
return PdaResponseVo.pdaResultOk("满托出库确认请求成功");
|
||||
}
|
||||
@@ -292,14 +324,23 @@ public class PdaServiceImpl implements PdaService {
|
||||
List<SchBaseVehiclematerialgroup> list = vehiclematerialgroupService.list(lqw);
|
||||
List<VehicleLinkVo> vehicleLinkVoList = new ArrayList<>();
|
||||
for (SchBaseVehiclematerialgroup group : list) {
|
||||
SchBasePoint point = pointService.getById(group.getPoint_code());
|
||||
if (!point.getRegion_code().equals("YCL")) {
|
||||
continue;
|
||||
}
|
||||
MdBaseMaterial material = materialService.getById(group.getMaterial_id());
|
||||
Assert.notNull(material, "物料信息有误!未查询出对应的物料信息,物料id:" + group.getMaterial_id());
|
||||
VehicleLinkVo vehicleLinkVo = new VehicleLinkVo();
|
||||
vehicleLinkVo.setMaterial_id(group.getMaterial_id());
|
||||
vehicleLinkVo.setGroup_id(group.getGroup_id());
|
||||
vehicleLinkVo.setVehicle_code(group.getVehicle_code());
|
||||
vehicleLinkVo.setMaterial_name(group.getMaterial_name());
|
||||
vehicleLinkVo.setMaterial_name(material.getMaterial_name());
|
||||
vehicleLinkVo.setPoint_code(group.getPoint_code());
|
||||
vehicleLinkVo.setPoint_name(group.getPoint_name());
|
||||
vehicleLinkVo.setPcsn(group.getPcsn());
|
||||
vehicleLinkVo.setVehicle_type(group.getVehicle_type());
|
||||
vehicleLinkVo.setMaterial_code(group.getMaterial_code());
|
||||
vehicleLinkVo.setMaterial_code(material.getMaterial_code());
|
||||
vehicleLinkVo.setMaterial_qty(group.getMaterial_qty());
|
||||
vehicleLinkVoList.add(vehicleLinkVo);
|
||||
}
|
||||
return vehicleLinkVoList;
|
||||
@@ -311,19 +352,23 @@ public class PdaServiceImpl implements PdaService {
|
||||
//除这些区域外 其它区域都存在定点流转任务
|
||||
//叫料缓存区、组盘区、空托盘缓存区1、空托盘缓存区2、原材料
|
||||
lqw.notIn(SchBasePoint::getRegion_code, "JLHC", "ZP", "KTPHC1", "KTPHC2", "YCL")
|
||||
.and(la -> la.isNotNull(SchBasePoint::getNext_point_code))
|
||||
.eq(SchBasePoint::getIs_used, true);
|
||||
List<PointVo> list = this.copyPointVoList(pointService.list(lqw));
|
||||
for (PointVo pointVo : list) {
|
||||
List<PointVo> end_points = pointVo.getEnd_points();
|
||||
SchBasePoint point = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, pointVo.getPoint_code()).eq(SchBasePoint::getIs_used, true));
|
||||
String[] nextPointCodes = point.getNext_point_code().split(",");
|
||||
for (int i = 0; i < nextPointCodes.length; i++) {
|
||||
String nextPointCode = nextPointCodes[i];
|
||||
SchBasePoint one = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, nextPointCode).eq(SchBasePoint::getIs_used, true));
|
||||
PointVo pv = new PointVo();
|
||||
pv.setPoint_code(one.getPoint_code());
|
||||
pv.setPoint_name(one.getPoint_name());
|
||||
end_points.add(pv);
|
||||
if (StrUtil.isNotEmpty(point.getNext_point_code())) {
|
||||
String[] nextPointCodes = point.getNext_point_code().split(",");
|
||||
for (int i = 0; i < nextPointCodes.length; i++) {
|
||||
String nextPointCode = nextPointCodes[i];
|
||||
SchBasePoint one = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, nextPointCode).eq(SchBasePoint::getIs_used, true));
|
||||
PointVo pv = new PointVo();
|
||||
pv.setPoint_id(IdUtil.simpleUUID());
|
||||
pv.setPoint_code(one.getPoint_code());
|
||||
pv.setPoint_name(one.getPoint_name());
|
||||
end_points.add(pv);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@@ -348,6 +393,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
List<PointVo> pointVoList = new ArrayList<>();
|
||||
for (SchBasePoint point : list) {
|
||||
PointVo pointVo = new PointVo();
|
||||
pointVo.setPoint_id(IdUtil.simpleUUID());
|
||||
pointVo.setPoint_code(point.getPoint_code());
|
||||
pointVo.setPoint_name(point.getPoint_name());
|
||||
pointVoList.add(pointVo);
|
||||
@@ -381,7 +427,8 @@ public class PdaServiceImpl implements PdaService {
|
||||
*/
|
||||
private void checkQty(SchBaseVehiclematerialgroup groupOne, String residue_num) {
|
||||
String regex = "^\\d+(\\.\\d+)?0*$";
|
||||
Assert.isFalse(Pattern.matches(regex, residue_num), "余料数量有误,不是0.5的整数倍");
|
||||
//String regex = "^(0|([1-9]\\d*))(\\.5)?0*$";
|
||||
Assert.isTrue(Pattern.matches(regex, residue_num), "余料数量有误,不是0.5的整数倍");
|
||||
try {
|
||||
double residueNum = Double.parseDouble(residue_num);
|
||||
double material_qty = Double.parseDouble(groupOne.getMaterial_qty());
|
||||
@@ -389,7 +436,7 @@ public class PdaServiceImpl implements PdaService {
|
||||
throw new BadRequestException("回库余料数量不符合要求,大于原有数量或者小于0!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("输入数据有误: " + residue_num, e);
|
||||
throw new BadRequestException("输入数据有误:{},{} " + residue_num + "," + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -164,4 +164,5 @@ public class SchBaseVehiclematerialgroup implements Serializable {
|
||||
private String group_bind_material_status_name;
|
||||
@TableField(exist = false)
|
||||
private String raw_material_code;
|
||||
|
||||
}
|
||||
|
||||
@@ -113,6 +113,10 @@ public class GeneralDefinition {
|
||||
* ACS创建
|
||||
**/
|
||||
public static final String ACS_CREATION = "2";
|
||||
/**
|
||||
* 手持创建
|
||||
*/
|
||||
public static final String HAND_CREATION = "3";
|
||||
// 请求方向
|
||||
/**
|
||||
* ACS->LMS
|
||||
|
||||
@@ -81,6 +81,7 @@ public class P2PTask extends AbstractTask {
|
||||
task.setVehicle_qty(endPoint.getVehicle_qty());
|
||||
task.setVehicle_type(endPoint.getCan_vehicle_type());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setCreate_mode(GeneralDefinition.HAND_CREATION);
|
||||
taskService.save(task);
|
||||
// 点位更新
|
||||
endPoint.setIng_task_code(task.getTask_code());
|
||||
@@ -169,6 +170,7 @@ public class P2PTask extends AbstractTask {
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
|
||||
PointUtils.clearPoint(startPointObj);
|
||||
pointService.updateById(startPointObj);
|
||||
//终点不需要记录点位状态和载具信息
|
||||
//如果终点是空托盘缓存1区或者空托盘缓存2区 则更改终点点位的状态
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
@@ -177,10 +179,11 @@ public class P2PTask extends AbstractTask {
|
||||
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
|
||||
//endPointObj.setVehicle_type(GeneralDefinition.VEHICLE_TYPE_1500_1500);
|
||||
//endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
|
||||
endPointObj.setUpdate_time(DateUtil.now());
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
endPointObj.setIng_task_code("");
|
||||
endPointObj.setUpdate_time(DateUtil.now());
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
}
|
||||
// 任务完成
|
||||
@@ -194,12 +197,12 @@ public class P2PTask extends AbstractTask {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1());
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
// 起点解锁
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
startPointObj.setIng_task_code("");
|
||||
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
|
||||
pointService.updateById(startPointObj);
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
endPointObj.setIng_task_code("");
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
@@ -72,9 +73,17 @@ public class JLHCHKTask extends AbstractTask {
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setRemark("");
|
||||
task.setVehicle_qty(point.getVehicle_qty());
|
||||
task.setVehicle_type(point.getCan_vehicle_type());
|
||||
//判断组盘信息中对应的物料信息是否为0 为0就不记录载具信息
|
||||
//不为0 就记录载具信息
|
||||
SchBasePoint startPointObj = pointService.getById(task.getPoint_code1());
|
||||
boolean flag = this.isZero(startPointObj.getVehicle_code(), startPointObj.getPoint_code());
|
||||
if (!flag) {
|
||||
task.setVehicle_qty(startPointObj.getVehicle_qty());
|
||||
task.setVehicle_type(startPointObj.getVehicle_type());
|
||||
task.setVehicle_code(startPointObj.getVehicle_code());
|
||||
}
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setCreate_mode(GeneralDefinition.HAND_CREATION);
|
||||
taskService.save(task);
|
||||
// 点位更新
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
@@ -82,6 +91,18 @@ public class JLHCHKTask extends AbstractTask {
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
private boolean isZero(String vehicle_code, String point_code) {
|
||||
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code)
|
||||
.eq(SchBaseVehiclematerialgroup::getPoint_code, point_code)
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue());
|
||||
SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(lqw);
|
||||
if (ObjectUtil.isNotEmpty(one)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从终点区域查询空位
|
||||
*
|
||||
@@ -154,26 +175,36 @@ public class JLHCHKTask extends AbstractTask {
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
|
||||
PointUtils.clearPoint(startPointObj);
|
||||
//更新终点的点位信息
|
||||
//更新组盘表载具对应的点位信息
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
endPointObj.setPoint_status(PointStatusEnum.FULL_POINT.getCode());
|
||||
endPointObj.setVehicle_type(endPointObj.getCan_vehicle_type());
|
||||
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
|
||||
endPointObj.setUpdate_time(DateUtil.now());
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
pointService.updateById(startPointObj);
|
||||
}
|
||||
|
||||
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getById(taskObj.getGroup_id());
|
||||
TaskUtils.setGroupUpdateByType(vehiclematerialgroup, taskFinishedType);
|
||||
vehiclematerialgroup.setTask_code(taskObj.getTask_code());
|
||||
vehiclematerialgroup.setBuss_move_id(taskObj.getTask_code());
|
||||
//更新终点的点位信息
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
endPointObj.setIng_task_code("");
|
||||
boolean flag = this.isZero(taskObj.getVehicle_code(), taskObj.getPoint_code1());
|
||||
if (!flag) {
|
||||
endPointObj.setPoint_status(PointStatusEnum.FULL_POINT.getCode());
|
||||
endPointObj.setVehicle_type(taskObj.getVehicle_type());
|
||||
endPointObj.setVehicle_code(taskObj.getVehicle_code());
|
||||
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
|
||||
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code,taskObj.getVehicle_code())
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status,GroupBindMaterialStatusEnum.BOUND.getValue());
|
||||
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getOne(lqw);
|
||||
vehiclematerialgroup.setPoint_code(endPointObj.getPoint_code());
|
||||
vehiclematerialgroup.setPoint_name(endPointObj.getPoint_name());
|
||||
vehiclematerialgroup.setMove_way(taskObj.getPoint_code1() + "->" + taskObj.getPoint_code2());
|
||||
vehiclematerialgroupService.updateById(vehiclematerialgroup);
|
||||
vehiclematerialgroup.setMove_way(vehiclematerialgroup.getMove_way() + " -> " + endPointObj.getPoint_code());
|
||||
vehiclematerialgroup.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
vehiclematerialgroup.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
vehiclematerialgroup.setUpdate_time(DateUtil.now());
|
||||
vehiclematerialgroupService.update(vehiclematerialgroup);
|
||||
} else {
|
||||
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
|
||||
}
|
||||
endPointObj.setUpdate_time(DateUtil.now());
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
@@ -186,12 +217,12 @@ public class JLHCHKTask extends AbstractTask {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1());
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
// 起点解锁
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
startPointObj.setIng_task_code("");
|
||||
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
|
||||
pointService.updateById(startPointObj);
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
endPointObj.setIng_task_code("");
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package org.nl.wms.sch.task_manage.task.tasks.ycl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.*;
|
||||
@@ -23,9 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 叫料缓存区取满托任务
|
||||
@@ -41,8 +39,6 @@ public class JLHCQMTask extends AbstractTask {
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
|
||||
@@ -54,45 +50,52 @@ public class JLHCQMTask extends AbstractTask {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找起点
|
||||
SchBasePoint point = findStartPoint(startRegionStr);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 判断起点是否存在任务
|
||||
SchBasePoint startPointObj = findPoint(task.getPoint_code1());
|
||||
if (ObjectUtil.isEmpty(startPointObj)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("原材料库没有满托!", TASK_CONFIG_CODE + task.getPoint_code2(),
|
||||
noticeService.createNotice(task.getPoint_code1() + "点位存在任务!", TASK_CONFIG_CODE + task.getPoint_code2(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("原材料库没有满托!");
|
||||
throw new BadRequestException(task.getPoint_code1() + "点位存在任务!");
|
||||
}
|
||||
|
||||
// 判断终点是否存在任务
|
||||
SchBasePoint endPointObj = findPoint(task.getPoint_code2());
|
||||
if (ObjectUtil.isEmpty(endPointObj)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice(task.getPoint_code2() + "出库对接位存在任务!", TASK_CONFIG_CODE + task.getPoint_code2(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException(task.getPoint_code2() + "出库对接位存在任务!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code1(point.getPoint_code());
|
||||
task.setPoint_code2(endPointObj.getPoint_code());
|
||||
task.setRemark("");
|
||||
task.setVehicle_qty(point.getVehicle_qty());
|
||||
task.setVehicle_type(point.getCan_vehicle_type());
|
||||
task.setVehicle_qty(startPointObj.getVehicle_qty());
|
||||
task.setVehicle_type(startPointObj.getVehicle_type());
|
||||
task.setVehicle_code(startPointObj.getVehicle_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setCreate_mode(GeneralDefinition.HAND_CREATION);
|
||||
taskService.save(task);
|
||||
// 点位更新
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
startPointObj.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(startPointObj);
|
||||
pointService.updateById(startPointObj);
|
||||
endPointObj.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(endPointObj);
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从起点区域获取空托位
|
||||
* 查询
|
||||
*
|
||||
* @param startRegionStr
|
||||
* @param point_code
|
||||
* @return
|
||||
*/
|
||||
private SchBasePoint findStartPoint(List<String> startRegionStr) {
|
||||
private SchBasePoint findPoint(String point_code) {
|
||||
LambdaQueryWrapper<SchBasePoint> lam = new LambdaQueryWrapper<>();
|
||||
// 默认一直都有载具
|
||||
lam.in(SchBasePoint::getRegion_code, startRegionStr)
|
||||
// 点位状态是空托
|
||||
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_VEHICLE.getCode())
|
||||
lam.eq(SchBasePoint::getPoint_code, point_code)
|
||||
// 当前执行的任务为空或者NULL,有数据表示锁住
|
||||
.and(la -> la.isNull(SchBasePoint::getIng_task_code)
|
||||
.or()
|
||||
@@ -151,21 +154,35 @@ public class JLHCQMTask extends AbstractTask {
|
||||
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1());
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
startPointObj.setIng_task_code("");
|
||||
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
|
||||
PointUtils.clearPoint(startPointObj);
|
||||
//终点不需要记录点位状态和载具信息
|
||||
//但是需要更新组盘表中载具所在的点位信息
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getById(taskObj.getGroup_id());
|
||||
TaskUtils.setGroupUpdateByType(vehiclematerialgroup, taskFinishedType);
|
||||
vehiclematerialgroup.setTask_code(taskObj.getTask_code());
|
||||
vehiclematerialgroup.setBuss_move_id(taskObj.getTask_code());
|
||||
vehiclematerialgroup.setPoint_code(endPointObj.getPoint_code());
|
||||
vehiclematerialgroup.setPoint_name(endPointObj.getPoint_name());
|
||||
vehiclematerialgroup.setMove_way(taskObj.getPoint_code1() + "->" + taskObj.getPoint_code2());
|
||||
vehiclematerialgroupService.updateById(vehiclematerialgroup);
|
||||
}
|
||||
pointService.updateById(startPointObj);
|
||||
}
|
||||
|
||||
//终点不需要记录点位状态和载具信息
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
endPointObj.setIng_task_code("");
|
||||
endPointObj.setPoint_status(PointStatusEnum.FULL_POINT.getCode());
|
||||
endPointObj.setVehicle_code(taskObj.getVehicle_code());
|
||||
endPointObj.setVehicle_type(taskObj.getVehicle_type());
|
||||
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
|
||||
endPointObj.setUpdate_time(DateUtil.now());
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
|
||||
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code,taskObj.getVehicle_code())
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status,GroupBindMaterialStatusEnum.BOUND.getValue());
|
||||
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getOne(lqw);
|
||||
vehiclematerialgroup.setPoint_code(endPointObj.getPoint_code());
|
||||
vehiclematerialgroup.setPoint_name(endPointObj.getPoint_name());
|
||||
vehiclematerialgroup.setMove_way(vehiclematerialgroup.getMove_way() + " -> " + endPointObj.getPoint_code());
|
||||
vehiclematerialgroup.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
vehiclematerialgroup.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
vehiclematerialgroup.setUpdate_time(DateUtil.now());
|
||||
vehiclematerialgroupService.update(vehiclematerialgroup);
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
@@ -185,6 +202,14 @@ public class JLHCQMTask extends AbstractTask {
|
||||
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
|
||||
pointService.updateById(startPointObj);
|
||||
}
|
||||
// 获取参数
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
// 终点解锁
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
endPointObj.setIng_task_code("");
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
|
||||
@@ -4,8 +4,6 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
@@ -44,8 +42,6 @@ public class ZPQKTask extends AbstractTask {
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
|
||||
|
||||
@Override
|
||||
public void create() throws BadRequestException {
|
||||
@@ -71,11 +67,13 @@ public class ZPQKTask extends AbstractTask {
|
||||
// 设置起点并修改创建成功状态
|
||||
task.setPoint_code1(point.getPoint_code());
|
||||
task.setRemark("");
|
||||
task.setVehicle_qty(point.getVehicle_qty());
|
||||
task.setVehicle_type(point.getCan_vehicle_type());
|
||||
//task.setVehicle_code(point.getVehicle_code());
|
||||
//task.setVehicle_qty(point.getVehicle_qty());
|
||||
//task.setVehicle_type(point.getCan_vehicle_type());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setCreate_mode(GeneralDefinition.HAND_CREATION);
|
||||
taskService.save(task);
|
||||
// 点位更新
|
||||
//点位更新
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
@@ -151,21 +149,17 @@ public class ZPQKTask extends AbstractTask {
|
||||
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1());
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
startPointObj.setIng_task_code("");
|
||||
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
|
||||
PointUtils.clearPoint(startPointObj);
|
||||
//终点不需要记录点位状态和载具信息
|
||||
//但是需要更新组盘表中载具所在的点位信息
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getById(taskObj.getGroup_id());
|
||||
TaskUtils.setGroupUpdateByType(vehiclematerialgroup, taskFinishedType);
|
||||
vehiclematerialgroup.setTask_code(taskObj.getTask_code());
|
||||
vehiclematerialgroup.setBuss_move_id(taskObj.getTask_code());
|
||||
vehiclematerialgroup.setPoint_code(endPointObj.getPoint_code());
|
||||
vehiclematerialgroup.setPoint_name(endPointObj.getPoint_name());
|
||||
vehiclematerialgroup.setMove_way(taskObj.getPoint_code1() + "->" + taskObj.getPoint_code2());
|
||||
vehiclematerialgroupService.updateById(vehiclematerialgroup);
|
||||
}
|
||||
pointService.updateById(startPointObj);
|
||||
}
|
||||
//终点更新
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
|
||||
@@ -4,9 +4,11 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.group.service.impl.SchBaseVehiclematerialgroupServiceImpl;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
@@ -73,9 +75,12 @@ public class ZPRKTask extends AbstractTask {
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setRemark("");
|
||||
task.setVehicle_qty(point.getVehicle_qty());
|
||||
task.setVehicle_type(point.getCan_vehicle_type());
|
||||
SchBasePoint startPointObj = pointService.getById(task.getPoint_code1());
|
||||
task.setVehicle_qty(startPointObj.getVehicle_qty());
|
||||
task.setVehicle_type(startPointObj.getVehicle_type());
|
||||
task.setVehicle_code(startPointObj.getVehicle_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setCreate_mode(GeneralDefinition.HAND_CREATION);
|
||||
taskService.save(task);
|
||||
// 点位更新
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
@@ -93,7 +98,7 @@ public class ZPRKTask extends AbstractTask {
|
||||
LambdaQueryWrapper<SchBasePoint> lam = new LambdaQueryWrapper<>();
|
||||
// 默认一直都有载具
|
||||
lam.in(SchBasePoint::getRegion_code, nextRegionStr)
|
||||
// 点位状态是空托
|
||||
// 点位状态是空位
|
||||
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_POINT.getCode())
|
||||
// 当前执行的任务为空或者NULL,有数据表示锁住
|
||||
.and(la -> la.isNull(SchBasePoint::getIng_task_code)
|
||||
@@ -155,26 +160,31 @@ public class ZPRKTask extends AbstractTask {
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
|
||||
PointUtils.clearPoint(startPointObj);
|
||||
//更新终点的点位信息
|
||||
//更新组盘表载具对应的点位信息
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
endPointObj.setPoint_status(PointStatusEnum.FULL_POINT.getCode());
|
||||
endPointObj.setVehicle_type(endPointObj.getCan_vehicle_type());
|
||||
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
|
||||
endPointObj.setUpdate_time(DateUtil.now());
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
pointService.updateById(startPointObj);
|
||||
}
|
||||
//更新终点的点位信息
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
endPointObj.setIng_task_code("");
|
||||
endPointObj.setPoint_status(PointStatusEnum.FULL_POINT.getCode());
|
||||
endPointObj.setVehicle_code(taskObj.getVehicle_code());
|
||||
endPointObj.setVehicle_type(taskObj.getVehicle_type());
|
||||
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
|
||||
endPointObj.setUpdate_time(DateUtil.now());
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
|
||||
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getById(taskObj.getGroup_id());
|
||||
TaskUtils.setGroupUpdateByType(vehiclematerialgroup, taskFinishedType);
|
||||
vehiclematerialgroup.setTask_code(taskObj.getTask_code());
|
||||
vehiclematerialgroup.setBuss_move_id(taskObj.getTask_code());
|
||||
vehiclematerialgroup.setPoint_code(endPointObj.getPoint_code());
|
||||
vehiclematerialgroup.setPoint_name(endPointObj.getPoint_name());
|
||||
vehiclematerialgroup.setMove_way(taskObj.getPoint_code1() + "->" + taskObj.getPoint_code2());
|
||||
vehiclematerialgroupService.updateById(vehiclematerialgroup);
|
||||
}
|
||||
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code,taskObj.getVehicle_code())
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status,GroupBindMaterialStatusEnum.BOUND.getValue());
|
||||
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getOne(lqw);
|
||||
vehiclematerialgroup.setPoint_code(endPointObj.getPoint_code());
|
||||
vehiclematerialgroup.setPoint_name(endPointObj.getPoint_name());
|
||||
vehiclematerialgroup.setMove_way(vehiclematerialgroup.getMove_way() + " -> " + endPointObj.getPoint_code());
|
||||
vehiclematerialgroup.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
vehiclematerialgroup.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
vehiclematerialgroup.setUpdate_time(DateUtil.now());
|
||||
vehiclematerialgroupService.update(vehiclematerialgroup);
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
@@ -187,12 +197,12 @@ public class ZPRKTask extends AbstractTask {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1());
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
// 起点解锁
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
startPointObj.setIng_task_code("");
|
||||
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
|
||||
pointService.updateById(startPointObj);
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
endPointObj.setIng_task_code("");
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
|
||||
@@ -76,16 +76,16 @@
|
||||
label-width="125px"
|
||||
label-suffix=":">
|
||||
<el-form-item label="物料编码">
|
||||
<el-input disabled v-model="form.material_code" style="width: 240px;" />
|
||||
<el-input v-model="form.material_code" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称 ">
|
||||
<el-input disabled v-model="form.material_name" style="width: 240px;" />
|
||||
<el-input v-model="form.material_name" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料规格">
|
||||
<el-input disabled v-model="form.material_spec" style="width: 240px;" />
|
||||
<el-input v-model="form.material_spec" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料型号">
|
||||
<el-input disabled v-model="form.material_model" style="width: 240px;" />
|
||||
<el-input v-model="form.material_model" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="A长边">-->
|
||||
<!-- <el-input-number-->
|
||||
|
||||
@@ -317,7 +317,7 @@
|
||||
<!-- {{scope.row.is_full?'是':'否'}}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column prop="pcsn" label="批次" :min-width="flexWidth('pcsn',crud.data,'批次')" />
|
||||
<el-table-column prop="pcsn" label="配盘批次" :min-width="flexWidth('pcsn',crud.data,'批次')" />
|
||||
<!-- <el-table-column prop="workorder_code" label="工单编码" :min-width="flexWidth('workorder_code',crud.data,'工单编码')" />-->
|
||||
<el-table-column prop="instorage_time" label="入库时间" :min-width="flexWidth('instorage_time',crud.data,'入库时间')" />
|
||||
<el-table-column prop="group_bind_material_status" label="绑定状态" :min-width="flexWidth('group_bind_material_status',crud.data,'入库时间')">
|
||||
@@ -422,7 +422,7 @@ const defaultForm = {
|
||||
out_kiln_time: null,
|
||||
into_kiln_time: null,
|
||||
is_delete: false,
|
||||
link_status: '0'
|
||||
link_status: null
|
||||
}
|
||||
export default {
|
||||
name: 'VehicleMaterialGroup',
|
||||
|
||||
Reference in New Issue
Block a user