opt:托盘库逻辑优化;

This commit is contained in:
2026-03-26 10:48:27 +08:00
parent b0ce90c187
commit 84b2eb0d99
17 changed files with 237 additions and 83 deletions

View File

@@ -87,6 +87,7 @@
<where>
1 = 1
AND ext.status = '02'
AND ext.qty > 0
<if test="param.stor_id != null and param.stor_id != ''">
AND
attr.stor_id = #{param.stor_id}
@@ -257,6 +258,7 @@
INNER JOIN md_me_materialbase mater ON mater.material_id = ext.material_id
<where>
1 = 1
AND ext.`status` &lt; '03'
<if test="params.stor_id != null and params.stor_id != ''">
AND
attr.stor_id = #{params.stor_id}

View File

@@ -394,20 +394,20 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
.set(Structattr::getUpdate_optname, nickName)
.set(Structattr::getUpdate_time, now)
.eq(Structattr::getStruct_id, struct.getStruct_id()));
//锁定新库存
iStructattrService.update(new LambdaUpdateWrapper<>(Structattr.class)
.set(Structattr::getStoragevehicle_code, m3)
.set(Structattr::getUpdate_optid, currentUserId)
.set(Structattr::getUpdate_optname, nickName)
.set(Structattr::getUpdate_time, now)
.set(Structattr::getLock_type, "0")
.eq(Structattr::getStruct_id, structattr.getStruct_id())
);
}
//锁定新库存
iStructattrService.update(new LambdaUpdateWrapper<>(Structattr.class)
.set(Structattr::getStoragevehicle_code, m3)
.set(Structattr::getUpdate_optid, currentUserId)
.set(Structattr::getUpdate_optname, nickName)
.set(Structattr::getUpdate_time, now)
.set(Structattr::getLock_type, "0")
.eq(Structattr::getStruct_id, structattr.getStruct_id())
);
}
}
} catch (Exception ex) {
throw new BadRequestException("导入失败" + ex.getMessage() + ":" + in);
throw new BadRequestException("导入失败" + ex.getMessage() + ",在表格第" + in+"行,请检查一下。");
}
}
@@ -512,7 +512,7 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
}
}
} catch (Exception ex) {
throw new BadRequestException("导入失败" + ex.getMessage() + ":" + in);
throw new BadRequestException("导入失败" + ex.getMessage() + ",在表格第" + in+"行,请检查一下。");
}
}

View File

@@ -259,7 +259,6 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
.eq(Structattr::getStruct_code,jsonObject.getString("struct_code"))
);
break;
case "2":
//解锁仓位
this.update(new LambdaUpdateWrapper<>(Structattr.class)
@@ -421,7 +420,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
.set("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
.set("storagevehicle_code", changeDto.getStoragevehicleCode())
.eq("struct_code", changeDto.getStructCode());
//如果是整出
//自动确认出库
if (!changeDto.getInBound()) {
wrapper.set("storagevehicle_code", null);
}

View File

@@ -8,10 +8,13 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.base.TableDataInfo;
import org.nl.common.domain.vo.SelectItemVo;
import org.nl.common.enums.NoticeTypeEnum;
import org.nl.common.exception.BadRequestException;
import org.nl.common.logging.annotation.Log;
import org.nl.common.utils.MapOf;
import org.nl.common.utils.RedissonUtils;
import org.nl.config.SpringContextHolder;
import org.nl.system.service.notice.impl.SysNoticeServiceImpl;
import org.nl.system.service.param.ISysParamService;
import org.nl.system.service.param.dao.Param;
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
@@ -107,10 +110,10 @@ public class PdaIosOutController {
public ResponseEntity<Object> bindOrUnbind(@RequestBody JSONObject whereJson) {
assertNotBlankJson(whereJson, "请求参数不能为空", "mode");
RedissonUtils.lock(() -> {
if (StringUtils.isBlank(whereJson.getString("siteCode"))&&StringUtils.isBlank( whereJson.getString("shelfCode"))) {
if (StringUtils.isBlank(whereJson.getString("siteCode")) && StringUtils.isBlank(whereJson.getString("shelfCode"))) {
throw new BadRequestException("点位编号和载具编号需要扫其中一个,不能同时为空");
}
pdaIosOutService.bindOrUnbind(whereJson.getString("siteCode"), whereJson.getString("shelfCode"), whereJson.getString("mode"),true);
pdaIosOutService.bindOrUnbind(whereJson.getString("siteCode"), whereJson.getString("shelfCode"), whereJson.getString("mode"), true);
}, "bindOrUnbind" , null);
return new ResponseEntity<>(PdaResponse.requestParamOk(whereJson), HttpStatus.OK);
}

View File

@@ -33,10 +33,13 @@ import org.nl.wms.pda.ios_manage.service.PdaIosInService;
import org.nl.wms.pda.ios_manage.service.PdaIosOutService;
import org.nl.wms.pda.util.PdaResponse;
import org.nl.wms.sch_manage.enums.StatusEnum;
import org.nl.wms.sch_manage.enums.TaskStatus;
import org.nl.wms.sch_manage.service.ISchBasePointService;
import org.nl.wms.sch_manage.service.ISchBaseRegionService;
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
import org.nl.wms.sch_manage.service.dao.SchBaseRegion;
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
import org.nl.wms.sch_manage.service.util.AbstractTask;
import org.nl.wms.warehouse_management.enums.IOSConstant;
import org.nl.wms.warehouse_management.enums.IOSEnum;
@@ -70,7 +73,8 @@ import static org.nl.wms.warehouse_management.enums.IOSEnum.GROUP_PLATE_STATUS;
@Service
@Slf4j
public class PdaIosInServiceImpl implements PdaIosInService {
@Autowired
private ISchBaseTaskService iSchBaseTaskService;
@Autowired
private Map<String, AbstractTask> applyTaskMap;
/**
@@ -294,7 +298,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
throw new BadRequestException("物料信息错误:" + dataArray.getJSONObject(0).getString("material_id"));
}
if (StringUtils.isBlank(materInfo.getPlacement_type())) {
throw new BadRequestException("该物料:" + materInfo.getMaterial_name() + ",未绑定货架,请在物料维护界面进行绑定操作");
throw new BadRequestException("该物料:" + materInfo.getMaterial_name() + "物料编码为:" + materInfo.getMaterial_code() + "未绑定货架,请在物料维护界面进行绑定操作");
}
//货架人员管理校验,admin不校验
if (!"admin".equals(userName)) {
@@ -312,7 +316,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
List<String> rowList = list.stream().map(Structattr::getPlacement_type).map(String::valueOf).collect(Collectors.toList());
//检查物料的用户ID是否在用户绑定的货架行号中
if (!rowList.contains(materInfo.getPlacement_type())) {
throw new BadRequestException("该物料:" + materInfo.getMaterial_name() + ",归属的货架:" + materInfo.getPlacement_type() + ",不属于用户:" + userName + " 的管理范畴或货架库位已满,请检查或修改用户的货架或物料权限!");
throw new BadRequestException("该物料:" + materInfo.getMaterial_name() + "物料编码为:" + materInfo.getMaterial_code() + "归属的货架:" + materInfo.getPlacement_type() + ",不属于用户:" + userName + " 的管理范畴或货架库位已满,请检查或修改用户的货架或物料权限!");
}
}
}
@@ -332,7 +336,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
.set(GroupPlate::getUpdate_time, DateUtil.now())
.set(GroupPlate::getUpdate_optid, userId)
.set(GroupPlate::getUpdate_optname, userName)
.set(GroupPlate::getRemark, "载具:" + vehicleDao.getStoragevehicle_code() + "存在物料," + DateUtil.now() + "新组盘,该物料强制清空出库。")
.set(GroupPlate::getRemark, "载具:" + vehicleDao.getStoragevehicle_code() + "" + DateUtil.now() + "置,重新入库。")
.in(GroupPlate::getGroup_id, groupPlateList.stream().map(GroupPlate::getGroup_id).collect(Collectors.toSet()))
);
}
@@ -433,8 +437,8 @@ public class PdaIosInServiceImpl implements PdaIosInService {
LambdaQueryWrapper<MdMeMaterialbase> queryWrapper = new QueryWrapper<MdMeMaterialbase>().lambda();
String search = MapUtil.getStr(whereJson, "search");
if (ObjectUtil.isNotEmpty(search)) {
queryWrapper.likeRight(MdMeMaterialbase::getMaterial_code, search)
.or(item -> item.likeRight(MdMeMaterialbase::getMaterial_name, search));
queryWrapper.like(MdMeMaterialbase::getMaterial_code, search)
.or(item -> item.like(MdMeMaterialbase::getMaterial_name, search));
}
String regionCode = MapUtil.getStr(whereJson, "region");
if (ObjectUtil.isNotEmpty(regionCode)) {
@@ -463,9 +467,55 @@ public class PdaIosInServiceImpl implements PdaIosInService {
PageQuery pageQuery = new PageQuery();
IPage<SchBaseRegion> regionList = iSchBaseRegionService.queryAll(whereJson, pageQuery);
List<SelectItemVo> selectList = new ArrayList<>();
String regionCode = "YZHJ01";
String regionName = "预装线货架区";
if (ObjectUtil.isNotEmpty(whereJson.getString("storagevehicle_code"))) {
List<SchBaseTask> taskList = iSchBaseTaskService.list(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getVehicle_code, whereJson.getString("storagevehicle_code")).lt(SchBaseTask::getTask_status, TaskStatus.UNFINISHED.getCode()).orderByDesc(SchBaseTask::getCreate_time).last("LIMIT 50"));
if (ObjectUtil.isNotEmpty(taskList)) {
//去除相同区域转运
taskList = taskList.stream()
.filter(task -> {
String pointCodeStart = task.getPoint_code1();
String pointCodeEnd = task.getPoint_code2();
return StringUtils.isNotBlank(pointCodeStart) &&
StringUtils.isNotBlank(pointCodeEnd) &&
pointCodeStart.charAt(0) != pointCodeEnd.charAt(0);
})
.collect(Collectors.toList());
if (ObjectUtil.isNotEmpty(whereJson.getString("pointCode"))) {
//提取与起点相同的终点任务的区域
taskList = taskList.stream()
.filter(task -> {
String pointCodeStart = whereJson.getString("pointCode");
String pointCodeEnd = task.getPoint_code2();
return StringUtils.isNotBlank(pointCodeStart) &&
StringUtils.isNotBlank(pointCodeEnd) &&
pointCodeStart.charAt(0) == pointCodeEnd.charAt(0);
})
.collect(Collectors.toList());
}
//获取区域
if (ObjectUtil.isNotEmpty(taskList)) {
List<SchBasePoint> schBasePointList = iSchBasePointService.list(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, taskList.get(0).getPoint_code1()).eq(SchBasePoint::getIs_used, true));
regionCode = schBasePointList.get(0).getRegion_code();
regionName = schBasePointList.get(0).getRegion_name();
}
}
}
selectList.add(SelectItemVo.builder().text(regionName).value(regionCode).build());
List<SelectItemVo> finalSelectList = selectList;
regionList.getRecords().forEach(r ->
selectList.add(SelectItemVo.builder().text(r.getRegion_name()).value(r.getRegion_code()).build())
finalSelectList.add(SelectItemVo.builder().text(r.getRegion_name()).value(r.getRegion_code()).build())
);
Set<String> seenValues = new HashSet<>();
selectList = selectList.stream()
.filter(item -> {
if ("YZHJ01".equals(item.getValue())) {
return seenValues.add(item.getValue());
}
return true;
})
.collect(Collectors.toList());
return selectList;
}

View File

@@ -16,12 +16,14 @@ import org.apache.commons.lang3.StringUtils;
import org.nl.common.base.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.domain.vo.SelectItemVo;
import org.nl.common.enums.NoticeTypeEnum;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.MapOf;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
import org.nl.system.service.notice.impl.SysNoticeServiceImpl;
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
import org.nl.wms.basedata_manage.service.*;
import org.nl.wms.basedata_manage.service.dao.*;
@@ -492,13 +494,12 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
PageQuery pageQuery = new PageQuery();
pageQuery.setPage(whereJson.getInteger("page") - 1);
pageQuery.setSize(100);
whereJson.put("region", "YZHJ");
// 查询条件
LambdaQueryWrapper<MdMeMaterialbase> queryWrapper = new QueryWrapper<MdMeMaterialbase>().lambda();
String search = MapUtil.getStr(whereJson, "search");
if (ObjectUtil.isNotEmpty(search)) {
queryWrapper.likeRight(MdMeMaterialbase::getMaterial_code, search)
.or(item -> item.likeRight(MdMeMaterialbase::getMaterial_name, search));
queryWrapper.like(MdMeMaterialbase::getMaterial_code, search)
.or(item -> item.like(MdMeMaterialbase::getMaterial_name, search));
}
String regionCode = MapUtil.getStr(whereJson, "region");
if (ObjectUtil.isNotEmpty(regionCode)) {
@@ -516,6 +517,8 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
@Transactional(rollbackFor = Exception.class)
public PdaResponse bindOrUnbind(String siteCode, String shelfCode, String mode, boolean dealGroupPlate) {
SchBasePoint sitePoint = new SchBasePoint();
String siteCode1 = "";
String shelfCode1 = "";
// 校验站点是否存在、是否可用
if (StringUtils.isNotBlank(siteCode)) {
sitePoint = iSchBasePointService.getOne(
@@ -526,6 +529,8 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
if (sitePoint == null) {
throw new BadRequestException("输入的站点编号有误或被禁用,请检查!");
}
siteCode1 = siteCode;
shelfCode1 = sitePoint.getVehicle_code() == null ? ",并清空了该站点货物" : sitePoint.getVehicle_code();
}
//绑定
if (IOSEnum.BIND_OR_UNBIND.code("绑定").equals(mode)) {
@@ -562,9 +567,13 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
dealGroupPlateStatus(shelfCode, sitePoint.getRegion_code());
}
doBind(siteCode, shelfCode);
shelfCode1 = shelfCode;
} else {
doUnbind(siteCode, sitePoint.getParent_point_code());
siteCode1 =siteCode;
}
String operation = "0".equals(mode) ? "解绑" : "绑定";
SpringContextHolder.getBean(SysNoticeServiceImpl.class).createNotice(DateUtil.now() + ",手持端操作通知:站点" + siteCode1 + operation + shelfCode1, "操作信息", NoticeTypeEnum.NOTIFICATION.getCode());
return PdaResponse.requestOk();
}
@@ -586,6 +595,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName());
;
iSchBasePointService.update(wrapper1);
SpringContextHolder.getBean(SysNoticeServiceImpl.class).createNotice(DateUtil.now() + ",手持端操作通知:载具:" + shelfCode + "在新位置:" + siteCode + "重新组盘,旧站点:" + boundPoint.getPoint_code() + "被解绑释放。", "操作信息", NoticeTypeEnum.NOTIFICATION.getCode());
//throw new BadRequestException("当前货架:" + shelfCode + "已绑定在站点:" + boundPoint.getPoint_code() + ",请扫描站点:" + boundPoint.getPoint_code() + "进行解绑,再绑定。");
}
wrapper.eq(SchBasePoint::getPoint_code, siteCode)
@@ -884,9 +894,20 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有货"))
.eq(SchBasePoint::getPoint_code, startPointCode)
);
SpringContextHolder.getBean(SysNoticeServiceImpl.class).createNotice(DateUtil.now() + ",手持端操作通知:生成点对点任务,站点:" + vehiclePoint.getPoint_code() + "强制解绑载具:" + vehicleCode+",重新绑定到站点:"+startPointCode, "操作信息", NoticeTypeEnum.NOTIFICATION.getCode());
}
//只有空载具才会自动回原来区域
int has = iMdPbGroupplateService.count(new LambdaUpdateWrapper<GroupPlate>()
.eq(GroupPlate::getStoragevehicle_code, vehicleCode)
.lt(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")));
if (has > 0) {
isCheckIvt = "0";
}
//终点为站点
if (StringUtils.isNotBlank(pointCode2)) {
if (startPointCode.equals(pointCode2)) {
throw new BadRequestException("起点和终点不能相同,请检查!");
}
SchBasePoint schBasePoint = iSchBasePointService.getOne(
new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, pointCode2).eq(SchBasePoint::getIs_used, true)
@@ -898,13 +919,32 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
} else {
if ("1".equals(isCheckIvt)) {
//终点为区域
List<SchBaseTask> taskList = iSchBaseTaskService.list(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getVehicle_code, vehicleCode).eq(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode()).orderByDesc(SchBaseTask::getCreate_time).last("LIMIT 50"));
List<SchBaseTask> taskList = iSchBaseTaskService.list(new LambdaQueryWrapper<SchBaseTask>().eq(SchBaseTask::getVehicle_code, vehicleCode).lt(SchBaseTask::getTask_status, TaskStatus.UNFINISHED.getCode()).orderByDesc(SchBaseTask::getCreate_time).last("LIMIT 50"));
if (ObjectUtil.isNotEmpty(taskList)) {
List<SchBasePoint> schBasePointList = iSchBasePointService.list(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, taskList.get(0).getPoint_code1()).eq(SchBasePoint::getIs_used, true));
if (ObjectUtil.isNotEmpty(schBasePointList)) {
if (!point.getRegion_code().equals(schBasePointList.get(0).getRegion_code())) {
regionCode = schBasePointList.get(0).getRegion_code();
}
//去除相同区域转运
taskList = taskList.stream()
.filter(task -> {
String pointCodeStart = task.getPoint_code1();
String pointCodeEnd = task.getPoint_code2();
return StringUtils.isNotBlank(pointCodeStart) &&
StringUtils.isNotBlank(pointCodeEnd) &&
pointCodeStart.charAt(0) != pointCodeEnd.charAt(0);
})
.collect(Collectors.toList());
//提取与起点相同的终点任务的区域
taskList = taskList.stream()
.filter(task -> {
String pointCodeStart = point.getPoint_code();
String pointCodeEnd = task.getPoint_code2();
return StringUtils.isNotBlank(pointCodeStart) &&
StringUtils.isNotBlank(pointCodeEnd) &&
pointCodeStart.charAt(0) == pointCodeEnd.charAt(0);
})
.collect(Collectors.toList());
//获取区域
if (ObjectUtil.isNotEmpty(taskList)) {
List<SchBasePoint> schBasePointList = iSchBasePointService.list(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, taskList.get(0).getPoint_code1()).eq(SchBasePoint::getIs_used, true));
regionCode = schBasePointList.get(0).getRegion_code();
}
}
}
@@ -933,7 +973,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
//入库分配
SpringContextHolder.getBean(PdaIosInServiceImpl.class).divStructNoBills(whereJson);
return PdaResponse.requestOk();
}else{
} else {
throw new BadRequestException("该区域暂无空闲货位,请及时取走该区域的物料!");
}
}
@@ -942,6 +982,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
JSONObject task = new JSONObject();
task.put("task_type", IOSConstant.PDA_POINT_TASK);
task.put("config_code", IOSConstant.PDA_POINT_TASK);
task.put("vehicle_type", vehicleDao.getStoragevehicle_type());
task.put("point_code1", startPointCode);
task.put("point_code2", endPointCode);
task.put("vehicle_code", vehicleCode);

View File

@@ -74,7 +74,7 @@ public enum StatusEnum {
TASK_TYPE(ForkMap.pushAll(IOBILL_TYPE_IN.code, IOBILL_TYPE_OUT.code, IOBILL_TYPE_MOVE.code, EXT_TASK_TYPE.code, OTHER_TASK_TYPE.code)),
ACS_TASK_TYPE(ForkMap.of(
"叉车", "1", "ccbyrw01", "CTU入库", "2", "ctubyru01", "潜伏车", "3", "qfbyrw01", "CTU出库", "4", "ctubyru02"
"叉车", "1", "ccbyrw01", "CTU入库", "2", "ctubyru01", "潜伏车", "3", "qfbyrw01", "CTU出库", "4", "ctubyru02", "普通托盘转运", "5", "DNBJBY", "钣金托盘转运", "6", "DNZBBYRW", "高位库普通托盘", "7", "ccbyrw02"
)),
/**
@@ -95,7 +95,7 @@ public enum StatusEnum {
PRODUCT_AREA(ForkMap.of("一层车间", "A1", null, "二层车间", "A2", null, "三层车间", "A3", null)),
REGION_INFO(ForkMap.of("商用线5号线", "SYCX01", null, "预装暂存区", "YZZC01", null, "预装线货架区", "YZHJ01", null, "铜管仓", "TGCK01", null,
REGION_INFO(ForkMap.of("商用线5号线", "SYCX01", null, "预装托盘暂存区", "YZZC01", null, "预装线货架区", "YZHJ01", null, "铜管仓", "TGCK01", null,
"铜管-烧焊车间", "SHCJ01", null,"两器-烧焊车间", "SHCJ02", null, "来料检验区", "LLJY01", null, "空托存放区", "KTCF01", null, "两器仓", "LQHJ01", null, "满托存放区", "MTCF01", null, "焊接货架区", "LQSH01", null, "原料入库区", "RKQ01", null,"CTU入库点", "CTU01", null,"CTU出库点", "CTU02", null)),

View File

@@ -15,8 +15,11 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.enums.NoticeTypeEnum;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
import org.nl.system.service.notice.impl.SysNoticeServiceImpl;
import org.nl.wms.sch_manage.enums.StatusEnum;
import org.nl.wms.sch_manage.service.ISchBasePointService;
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
@@ -32,7 +35,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -135,6 +141,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
@Override
@Transactional
public void update(SchBasePoint entity) {
String status = "";
String vehicleCode;
LambdaUpdateWrapper<SchBasePoint> updateWrapper = new LambdaUpdateWrapper<SchBasePoint>();
updateWrapper.eq(SchBasePoint::getPoint_code, entity.getPoint_code());
// 获取region_name
@@ -155,8 +163,12 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
if (pointStatus.equals(IOSEnum.POINT_STATUS.code("无货"))) {
updateWrapper.set(SchBasePoint::getVehicle_type, null);
updateWrapper.set(SchBasePoint::getPoint_status, pointStatus);
status = "无货";
}
status = StringUtils.isBlank(status) ? pointStatus.equals(IOSEnum.POINT_STATUS.code("有货")) ? "有货" : "空载具" : "无货";
vehicleCode = StringUtils.isBlank(entity.getVehicle_code()) ? "清空载具" : entity.getVehicle_code();
pointMapper.update(null, updateWrapper);
SpringContextHolder.getBean(SysNoticeServiceImpl.class).createNotice(DateUtil.now() + "PC端操作通知站点" + entity.getPoint_code() + "被修改,载具信息被修改为:" + vehicleCode + ",点位信息被修改为:" + status, "操作信息", NoticeTypeEnum.NOTIFICATION.getCode());
}
@Override
@@ -246,35 +258,36 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
.findFirst()
.orElseThrow(() -> new BadRequestException("该区域暂无空闲货位,请及时取走该区域的物料!"))
.getPoint_code();
} else if ((regionCode.equals(StatusEnum.REGION_INFO.code("预装暂存区")))) {
Map<String, List<SchBasePoint>> pointMap = pointList.stream().collect(Collectors.groupingBy(SchBasePoint::getParent_point_code));
if (ObjectUtils.isEmpty(pointMap)) {
throw new RuntimeException("该暂存区已分配或放满了,请及时取走暂存区的物料!");
}
for (Map.Entry<String, List<SchBasePoint>> entry : pointMap.entrySet()) {
List<SchBasePoint> filteredSortedList = entry.getValue();
filteredSortedList.sort(Comparator.comparingInt(SchBasePoint::getCol_num).reversed());
boolean hasEmptyVehicle = true;
Optional<SchBasePoint> emptyList = filteredSortedList.stream()
.filter(n -> n.getPoint_status().equals(IOSEnum.POINT_STATUS.code("无货")))
.findFirst();
//判断点位外层是否有空载具
if (emptyList.isPresent()) {
Integer sortSeq = emptyList.get().getCol_num();
//外层存在有货的阻挡,那么这一列都不能用了
hasEmptyVehicle = filteredSortedList.stream()
.anyMatch(r -> r.getCol_num() < sortSeq &&
r.getPoint_status().equals(IOSEnum.POINT_STATUS.code("有货")));
}
if (!hasEmptyVehicle) {
pointCode = emptyList.get().getPoint_code();
break;
}
}
if (StringUtils.isBlank(pointCode)) {
throw new BadRequestException("该暂存区暂无空闲货位,请检查暂存区是否存在同一列有物料阻挡未取走!");
}
} else {
}
// else if ((regionCode.equals(StatusEnum.REGION_INFO.code("预装托盘暂存区")))) {
// Map<String, List<SchBasePoint>> pointMap = pointList.stream().collect(Collectors.groupingBy(SchBasePoint::getParent_point_code));
// if (ObjectUtils.isEmpty(pointMap)) {
// throw new RuntimeException("该暂存区已分配或放满了,请及时取走暂存区的物料!");
// }
// for (Map.Entry<String, List<SchBasePoint>> entry : pointMap.entrySet()) {
// List<SchBasePoint> filteredSortedList = entry.getValue();
// filteredSortedList.sort(Comparator.comparingInt(SchBasePoint::getCol_num).reversed());
// boolean hasEmptyVehicle = true;
// Optional<SchBasePoint> emptyList = filteredSortedList.stream()
// .filter(n -> n.getPoint_status().equals(IOSEnum.POINT_STATUS.code("无货")))
// .findFirst();
// //判断点位外层是否有空载具
// if (emptyList.isPresent()) {
// Integer sortSeq = emptyList.get().getCol_num();
// //外层存在有货的阻挡,那么这一列都不能用了
// hasEmptyVehicle = filteredSortedList.stream()
// .anyMatch(r -> r.getCol_num() < sortSeq &&
// r.getPoint_status().equals(IOSEnum.POINT_STATUS.code("有货")));
// }
// if (!hasEmptyVehicle) {
// pointCode = emptyList.get().getPoint_code();
// break;
// }
// }
// if (StringUtils.isBlank(pointCode)) {
// throw new BadRequestException("该暂存区暂无空闲货位,请检查暂存区是否存在同一列有物料阻挡未取走!");
// }}
else {
//默认升序
pointCode = pointList.stream()
.findFirst()

View File

@@ -17,6 +17,7 @@ import org.nl.wms.sch_manage.service.dao.mapper.SchBaseRegionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -95,7 +96,7 @@ public class SchBaseRegionServiceImpl extends ServiceImpl<SchBaseRegionMapper, S
public List<SchBaseRegion> getRegionList(SchBaseRegion region) {
LambdaQueryWrapper<SchBaseRegion> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if (region != null) {
lambdaQueryWrapper.eq(SchBaseRegion::getStor_code, region.getStor_code());
lambdaQueryWrapper.like(SchBaseRegion::getStor_code, region.getStor_code());
}
lambdaQueryWrapper.orderByAsc(SchBaseRegion::getOrder_seq);
return schBaseRegionMapper.selectList(lambdaQueryWrapper);

View File

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
import org.nl.wms.ext.service.WmsToAcsService;
@@ -24,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -86,17 +88,40 @@ public abstract class AbstractTask {
/**
* 获取任务扩展信息
* 设置任务扩展信息(物料编码、名称、入库数量、出库数量、批次信息)
*/
public void getExtInfo(SchBaseTask task) {
List<GroupPlate> groupPlateList = iMdPbGroupplateService.list(
new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getStoragevehicle_code, task.getVehicle_code())
.lt(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")));
if (ObjectUtil.isNotEmpty(groupPlateList)) {
MdMeMaterialbase mdMeMaterialbase = iMdMeMaterialbaseService.getById(groupPlateList.get(0).getMaterial_id());
task.setExt_group_data("物料编码:"+mdMeMaterialbase.getMaterial_code() + "-" + "物料名称:"+mdMeMaterialbase.getMaterial_name() + "-" +"入库数量:"+ groupPlateList.get(0).getQty() + "-" +"出库数量:"+ groupPlateList.get(0).getFrozen_qty() + "-" +"批次信息:"+ groupPlateList.get(0).getPcsn());
if (CollectionUtils.isEmpty(groupPlateList)) {
return;
}
// 确定用于构建扩展信息的 GroupPlate 记录
GroupPlate targetPlate;
if (groupPlateList.size() > 1) {
targetPlate = groupPlateList.stream()
.filter(r -> r.getFrozen_qty().compareTo(BigDecimal.ZERO) > 0)
.findFirst()
.orElse(groupPlateList.get(0));
} else {
targetPlate = groupPlateList.get(0);
}
MdMeMaterialbase material = iMdMeMaterialbaseService.getById(targetPlate.getMaterial_id());
if (material == null) {
return;
}
// 获取数量
BigDecimal outQty = targetPlate.getFrozen_qty();
BigDecimal inQty = targetPlate.getFrozen_qty().compareTo(BigDecimal.ZERO) > 0 ? BigDecimal.ZERO : targetPlate.getQty();
String extInfo = String.format("物料编码:%s-物料名称:%s-入库数量:%s-出库数量:%s-批次信息:%s",
material.getMaterial_code(),
material.getMaterial_name(),
inQty,
outQty,
targetPlate.getPcsn());
task.setExt_group_data(extInfo);
}
/**

View File

@@ -1,7 +1,6 @@
package org.nl.wms.sch_manage.service.util;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.sch_manage.enums.StatusEnum;
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
/**
@@ -32,7 +31,19 @@ public class PointUtils {
public static String getRcsTraceId(SchBaseTask task) {
if (task.getVehicle_code().contains("T")) {
return "ccbyrw01";
if (task.getPoint_code1().contains("A") || task.getPoint_code2().contains("A")) {
//普通托盘
return "ccbyrw02";
} else {
//tofix 产线转运 叉车钣金铁托盘 ccbyrw01
//普通托盘
if ("1".equals(task.getVehicle_type())) {
return "DNZBBYRW";
} else {
//钣金托盘
return "DNBJBY";
}
}
} else if (task.getVehicle_code().contains("LX")) {
return task.getConfig_code().contains("In") ?"ctubyru01":"ctubyru02";
} else {

View File

@@ -825,7 +825,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
ioStorInvDis.setQty_unit_id(dtl.getQty_unit_id());
ioStorInvDis.setQty_unit_name(dtl.getQty_unit_name());
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
// if (unassign_qty-canuse_qty>=0){
@@ -838,7 +837,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
// unassign_qty=0;
// }
if (unassign_qty <= 0){
throw new BadRequestException("已全部分配完未分配数量为0");
continue;
}
unassign_qty = unassign_qty-canuse_qty;
if (unassign_qty<0){
@@ -1199,6 +1198,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
finish_map.put("inv_type", null);
finish_map.put("inv_id", null);
finish_map.put("inv_code", null);
String now = DateUtil.now();
iStructattrService.updateStatusByCode("1", finish_map);
//更新终点
LambdaUpdateWrapper<SchBasePoint> wrapper = new LambdaUpdateWrapper<>();
@@ -1231,13 +1231,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName());
iSchBasePointService.update(wrapper);
//绑定载具
pdaIosOutService.bindOrUnbind(task.getPoint_code2(), task.getVehicle_code(), IOSEnum.BIND_OR_UNBIND.code("绑定"),false);
//绑定目标点位载具
pdaIosOutService.bindOrUnbind(task.getPoint_code2(), task.getVehicle_code(), IOSEnum.BIND_OR_UNBIND.code("绑定"), false);
//是否处理单据及分配信息
if (BaseDataEnum.IS_YES_NOT.code("").equals(task.getHandle_status())) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
List<IOStorInvDis> ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getTask_id, task.getTask_id())
);
@@ -1248,15 +1247,20 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
ioStorInvDisMapper.update(null, new LambdaUpdateWrapper<>(IOStorInvDis.class)
.set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
.in(IOStorInvDis::getIostorinvdis_id, ioStorInvDisList.stream().map(IOStorInvDis::getIostorinvdis_id).collect(Collectors.toList())));
ioStorInvDisList.forEach(r -> {
//库存变动:根据冻结数更新物料库存
//库存变动:根据冻结数更新物料库存,潜伏车和叉车都是自动确认
boolean inBound = true;
if (!"qfbyrw01".equals(task.getAcs_trace_id())) {
inBound = false;
} else if (!task.getVehicle_code().contains("T")) {
inBound = false;
}
StructattrChangeDto changeDto = StructattrChangeDto.builder()
.inv(r.getIostorinv_id())
.storagevehicleCode(r.getStoragevehicle_code())
.structCode(r.getStruct_code())
.taskType(task.getConfig_code())
.inBound(!"qfbyrw01".equals(task.getAcs_trace_id())).build();
.inBound(inBound).build();
iStructattrService.changeStruct(changeDto);
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getIostorinvdtl_id, r.getIostorinvdtl_id())

View File

@@ -82,8 +82,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
@Resource
private MdPbStoragevehicleinfoMapper mdPbStoragevehicleinfoMapper;
@Resource
private IMdPbGroupplateService iMdPbGroupPlateService;
@Resource
private MdPbGroupplateServiceImpl mdPbGroupplateService;

View File

@@ -373,7 +373,11 @@ public class UpdateIvtUtils {
acsTaskDto.setPriority(taskDao.getPriority());
TaskOrderDetail detail = new TaskOrderDetail();
detail.setTaskPath(taskDao.getPoint_code1() + "," + taskDao.getPoint_code2());
detail.setShelfNumber(taskDao.getVehicle_code());
if (taskDao.getVehicle_code().contains("T")) {
detail.setShelfNumber(null);
} else {
detail.setShelfNumber(taskDao.getVehicle_code());
}
// Map<String, String> extraInfo = new HashMap<>();
// extraInfo.put("s", "1");
// extraInfo.put("d", "2");

View File

@@ -11,7 +11,7 @@ spring:
freemarker:
check-template-location: false
profiles:
active: prod
active: dev
jackson:
time-zone: GMT+8730 885 969
data:

View File

@@ -6,6 +6,7 @@
"license": "Apache-2.0",
"scripts": {
"dev": "vue-cli-service serve",
"dev1": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"dev_mac": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",

View File

@@ -17,6 +17,7 @@
回首页
</router-link>
</li>
</ul>
</el-col>
<el-col :span="12">