Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -282,7 +282,11 @@ public class DefaultPdaBuildParamService implements PdaBuildParamService {
|
||||
// 创建主表
|
||||
JSONObject jsonMst = new JSONObject();
|
||||
jsonMst.put("iostorinv_id", IdUtil.getStringId());
|
||||
jsonMst.put("bill_code", CodeUtil.getNewCode("OUT_STORE_CODE"));
|
||||
if (io_type.equals(IOSEnum.IO_TYPE.code("入库"))) {
|
||||
jsonMst.put("bill_code", CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
} else {
|
||||
jsonMst.put("bill_code", CodeUtil.getNewCode("OUT_STORE_CODE"));
|
||||
}
|
||||
jsonMst.put("biz_date", DateUtil.today());
|
||||
jsonMst.put("buss_type", bill_type);
|
||||
jsonMst.put("bill_type", bill_type);
|
||||
@@ -325,7 +329,7 @@ public class DefaultPdaBuildParamService implements PdaBuildParamService {
|
||||
JSONObject jsonDis = new JSONObject();
|
||||
jsonDis.put("iostorinvdis_id", IdUtil.getStringId());
|
||||
jsonDis.put("iostorinvdtl_id", jsonDtl.getString("iostorinvdtl_id"));
|
||||
jsonDis.put("iostorinv_id", jsonMst.getString("iostorinvdtl_id"));
|
||||
jsonDis.put("iostorinv_id", jsonMst.getString("iostorinv_id"));
|
||||
jsonDis.put("seq_no", 1);
|
||||
jsonDis.put("sect_id", row.getString("sect_id"));
|
||||
jsonDis.put("sect_code", row.getString("sect_code"));
|
||||
|
||||
@@ -10,13 +10,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.vo.PdaSelectVo;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CollectionUtils;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService;
|
||||
import org.nl.wms.basedata_manage.service.IMdPdGroupbucketService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
@@ -149,18 +146,7 @@ public class PdaCommonServiceImpl implements PdaCommonService {
|
||||
|
||||
@Override
|
||||
public PdaResponse getSectList(JSONObject param) {
|
||||
String code = param.getString("code");
|
||||
if (null == code) {
|
||||
code = "EP_SECT_CODE";
|
||||
}
|
||||
List<Dict> epSectCode = dictService.getDictByName(code);
|
||||
List<PdaSelectVo> collect = CollectionUtils.convertList(epSectCode, dict -> {
|
||||
PdaSelectVo selectVo = new PdaSelectVo();
|
||||
selectVo.setText(dict.getLabel());
|
||||
selectVo.setValue(dict.getValue());
|
||||
return selectVo;
|
||||
});
|
||||
return PdaResponse.requestParamOk(collect);
|
||||
return PdaResponse.requestParamOk(IOSEnum.SECT_CODE.getDict());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -258,7 +244,7 @@ public class PdaCommonServiceImpl implements PdaCommonService {
|
||||
.collect(Collectors.toList());
|
||||
json.put("execution_task", ObjectUtil.isNotEmpty(collectQtyList) ? collectQtyList.size() : 0);
|
||||
// 计算剩余可堆叠数量
|
||||
json.put("remaining_qty", NumberUtil.sub(pointDao.getVehicle_max_qty(), pointDao.getVehicle_qty(),json.getIntValue("execution_task")));
|
||||
json.put("remaining_qty", NumberUtil.sub(pointDao.getVehicle_max_qty(), pointDao.getVehicle_qty(), json.getIntValue("execution_task")));
|
||||
resultList.add(json);
|
||||
}
|
||||
return PdaResponse.requestParamOk(resultList);
|
||||
@@ -270,13 +256,13 @@ public class PdaCommonServiceImpl implements PdaCommonService {
|
||||
// 判断起点点位是否存在
|
||||
SchBasePoint startPointDao = iSchBasePointService.getById(whereJson.getString("point_code"));
|
||||
if (ObjectUtil.isEmpty(startPointDao)) {
|
||||
throw new BadRequestException("当前点位不存在【"+whereJson.getString("point_code")+"】");
|
||||
throw new BadRequestException("当前点位不存在【" + whereJson.getString("point_code") + "】");
|
||||
}
|
||||
|
||||
// 计算叠盘位是否还能继续叠盘
|
||||
JSONObject row = whereJson.getJSONObject("row");
|
||||
if (row.getIntValue("remaining_qty") == 0) {
|
||||
throw new BadRequestException("当前堆叠位空托盘数量已满【"+row.getString("point_code")+"】");
|
||||
throw new BadRequestException("当前堆叠位空托盘数量已满【" + row.getString("point_code") + "】");
|
||||
}
|
||||
|
||||
// 生成任务
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
@@ -88,6 +89,11 @@ public class PdaWarehouseServiceImpl implements PdaWarehouseService {
|
||||
|
||||
@Override
|
||||
public PdaResponse getPalletAssembly(JSONObject param) {
|
||||
String bag_code = param.getString("bag_code");
|
||||
if (ObjectUtil.isNotEmpty(bag_code)) {
|
||||
param.put("search",bag_code);
|
||||
}
|
||||
|
||||
String search = param.getString("search");
|
||||
if (ObjectUtil.isEmpty(search)) {
|
||||
throw new BadRequestException("请输入袋号编码!");
|
||||
@@ -101,6 +107,7 @@ public class PdaWarehouseServiceImpl implements PdaWarehouseService {
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
@Transactional
|
||||
public PdaResponse confirmPalletAssemblyIn(JSONObject param) {
|
||||
log.info("直接入库:{}", param);
|
||||
RLock lock = redissonClient.getLock("lock:confirmPalletAssemblyIn");
|
||||
@@ -114,7 +121,10 @@ public class PdaWarehouseServiceImpl implements PdaWarehouseService {
|
||||
if (ObjectUtil.isEmpty(search)) {
|
||||
throw new BadRequestException("请输入点位/载具编码!");
|
||||
}
|
||||
Structattr startStruct = structattrService.getByCode(search);
|
||||
Structattr startStruct = structattrService.getOne(
|
||||
new QueryWrapper<Structattr>().lambda()
|
||||
.eq(Structattr::getStruct_code, search)
|
||||
);
|
||||
if (ObjectUtil.isEmpty(startStruct)) {
|
||||
vehicleCode = search;
|
||||
List<Structattr> points = structattrService.getByVehicleCode(search, IOSEnum.LOCK_TYPE.code("未锁定"), true);
|
||||
@@ -130,40 +140,83 @@ public class PdaWarehouseServiceImpl implements PdaWarehouseService {
|
||||
vehicleCode = startStruct.getStoragevehicle_code();
|
||||
}
|
||||
if (ObjectUtil.isEmpty(vehicleCode)) {
|
||||
throw new BadRequestException("点位载具号为空!");
|
||||
throw new BadRequestException("当前点位没有载具!");
|
||||
}
|
||||
|
||||
// 判断任务是否创建
|
||||
List<SchBaseTask> tasks = taskService.getTaskByQuery(new LambdaQueryWrapper<SchBaseTask>()
|
||||
.eq(SchBaseTask::getPoint_code1, pointCode));
|
||||
if (tasks.size() > 0) {
|
||||
throw new BadRequestException("该点位已创建过任务!");
|
||||
}
|
||||
Sectattr sectattr = sectattrService.findByCode(startStruct.getSect_code(), true);
|
||||
if (ObjectUtil.isEmpty(sectattr)) {
|
||||
throw new BadRequestException("库区不存在或者被禁用!");
|
||||
|
||||
List<JSONObject> rows = param.getJSONArray("rows").toJavaList(JSONObject.class);
|
||||
// 查询所选所有组盘信息
|
||||
List<JSONObject> lateList = groupplateService.list(
|
||||
new QueryWrapper<GroupPlate>().lambda()
|
||||
.in(GroupPlate::getGroup_id, rows.stream()
|
||||
.map(row -> row.getString("group_id"))
|
||||
.collect(Collectors.toList()))
|
||||
).stream()
|
||||
.map(item -> JSONObject.parseObject(JSONObject.toJSONString(item)))
|
||||
.collect(Collectors.toList());
|
||||
// 查询此托盘下所有已绑定未入库的组盘信息
|
||||
List<JSONObject> vehicleLateList = groupplateService.list(
|
||||
new QueryWrapper<GroupPlate>().lambda()
|
||||
.eq(GroupPlate::getVehicle_code, vehicleCode)
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
|
||||
).stream()
|
||||
.map(item -> JSONObject.parseObject(JSONObject.toJSONString(item)))
|
||||
.collect(Collectors.toList());
|
||||
lateList.addAll(vehicleLateList);
|
||||
|
||||
// 组织入库参数
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
for (JSONObject json : lateList) {
|
||||
json.put("canuse_qty", json.getString("qty"));
|
||||
json.put("sect_id", startStruct.getSect_id());
|
||||
json.put("sect_code", startStruct.getSect_code());
|
||||
json.put("sect_name", startStruct.getSect_name());
|
||||
json.put("struct_id", startStruct.getStruct_id());
|
||||
json.put("struct_code", startStruct.getStruct_code());
|
||||
json.put("struct_name", startStruct.getStruct_name());
|
||||
json.put("stor_id", startStruct.getStor_id());
|
||||
json.put("stor_code", startStruct.getStor_code());
|
||||
json.put("stor_name", startStruct.getStor_name());
|
||||
json.put("vehicle_code", vehicleCode);
|
||||
json.put("status", IOSEnum.GROUP_PLATE_STATUS.code("入库"));
|
||||
|
||||
// 新增新载具库存信息
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_CANUSE);
|
||||
jsonIvt.put("storagevehicle_code", json.getString("vehicle_code"));
|
||||
jsonIvt.put("bag_code", json.getString("bag_code"));
|
||||
jsonIvt.put("material_id", json.getString("material_id"));
|
||||
jsonIvt.put("pcsn", json.getString("pcsn"));
|
||||
jsonIvt.put("qty_unit_id", json.getString("qty_unit_id"));
|
||||
jsonIvt.put("qty_unit_name", json.getString("qty_unit_name"));
|
||||
jsonIvt.put("change_qty", json.getString("canuse_qty"));
|
||||
updateIvtList.add(jsonIvt);
|
||||
}
|
||||
// 点位释放
|
||||
structattrService.update(new LambdaUpdateWrapper<Structattr>()
|
||||
.set(Structattr::getStoragevehicle_code, "")
|
||||
.set(Structattr::getIs_emptyvehicle, "0")
|
||||
.eq(Structattr::getStruct_code, startStruct.getStruct_code()));
|
||||
// 0 组盘
|
||||
defaultPdaBuildParam.doGroupPallet(param, vehicleCode);
|
||||
param.put("bill_type", IOSEnum.IN_BILL_TYPE.code("直接入库"));
|
||||
param.put("vehicle_code", vehicleCode);
|
||||
// 1 创建入库单、明细、分配明细
|
||||
Map<String, Object> invObj = defaultPdaBuildParam.doBuildInvObj(param, null, sectattr);
|
||||
String invId = rawAssistIStorService.insertDtl(invObj);
|
||||
// 2 调用指定分配
|
||||
param.put("sect_code", startStruct.getSect_code());
|
||||
param.put("sect_name", startStruct.getSect_name());
|
||||
param.put("struct_id", startStruct.getStruct_id());
|
||||
param.put("struct_name", startStruct.getStruct_name());
|
||||
param.put("struct_code", startStruct.getStruct_code());
|
||||
Map<String, Object> divObj = defaultPdaBuildParam.buildDivStructData(param, sectattr, invId, false);
|
||||
rawAssistIStorService.divStruct(divObj);
|
||||
// 3、强制确认
|
||||
rawAssistIStorService.confirm(MapOf.of("iostorinv_id", invId));
|
||||
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
|
||||
|
||||
// 计算总重量
|
||||
Double total_qty = lateList.stream()
|
||||
.map(row -> row.getDoubleValue("qty"))
|
||||
.reduce(Double::sum).orElse(0.0);
|
||||
param.put("total_qty",total_qty);
|
||||
param.put("rows",lateList);
|
||||
// 调用新增
|
||||
defaultPdaBuildParam.createIOS(param,IOSEnum.IO_TYPE.code("入库"),IOSEnum.IN_BILL_TYPE.code("直接入库"));
|
||||
|
||||
// 更新所有此载具下的组盘信息
|
||||
List<GroupPlate> collect = lateList.stream()
|
||||
.map(row -> JSONObject.parseObject(JSONObject.toJSONString(row), GroupPlate.class))
|
||||
.collect(Collectors.toList());
|
||||
groupplateService.updateBatchById(collect);
|
||||
// 更新此仓位载具为不是【空载具】
|
||||
startStruct.setIs_emptyvehicle(IOSConstant.ZERO);
|
||||
structattrService.updateById(startStruct);
|
||||
} else {
|
||||
throw new BadRequestException("速度太快啦,稍后再试...");
|
||||
}
|
||||
|
||||
@@ -121,9 +121,7 @@ public class EmpStackPlatesTask extends AbstractTask {
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("已完成");
|
||||
taskService.updateById(taskObj);
|
||||
this.finishTask(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.IdUtil;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.sch_manage.enums.TaskEnum;
|
||||
@@ -68,18 +67,6 @@ public class EmpVehicleInTask extends AbstractTask {
|
||||
@Resource
|
||||
private GroupPlateMapper groupPlateMapper;
|
||||
|
||||
/*
|
||||
* 载具信息服务
|
||||
*/
|
||||
@Resource
|
||||
private IMdPbStoragevehicleinfoService iMdPbStoragevehicleinfoService;
|
||||
|
||||
/**
|
||||
* 点对点任务类
|
||||
*/
|
||||
@Autowired
|
||||
private PdaPointTask pdaPointTask;
|
||||
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
SchBaseTask task = new SchBaseTask();
|
||||
@@ -211,7 +198,6 @@ public class EmpVehicleInTask extends AbstractTask {
|
||||
iStructattrService.update(
|
||||
new UpdateWrapper<Structattr>().lambda()
|
||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code2())
|
||||
.set(Structattr::getTaskdtl_id, null)
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
);
|
||||
// 更新任务
|
||||
|
||||
@@ -228,7 +228,6 @@ public class HandOutTask extends AbstractTask {
|
||||
groupPlateMapper.delete(
|
||||
new QueryWrapper<GroupPlate>().lambda()
|
||||
.eq(GroupPlate::getVehicle_code, taskObj.getVehicle_code())
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,9 @@ public enum IOSEnum {
|
||||
STOR_ID(MapOf.of("物料室仓库", "1582991156504039424","内包材仓库","1582991156504039425")),
|
||||
|
||||
// 库区编码
|
||||
SECT_CODE(MapOf.of("合格区", "HG01", "待检区", "DJ01", "不合格区", "BHG01", "大料箱区", "DLX01")),
|
||||
SECT_CODE(MapOf.of("内包材区", "NBC01", "批料室区", "PZC01",
|
||||
"中间站区", "ZZC01", "物料间区", "WZC01", "辅料区", "WFL01", "原料区", "WYL01"
|
||||
)),
|
||||
|
||||
// 存放载具类型
|
||||
VEHICLE_TYPE_PUT(MapOf.of("大料架(短边)", "1", "大料架(长边)", "2", "金属托盘", "3"
|
||||
|
||||
@@ -19,11 +19,9 @@ import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.IdUtil;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.basedata_manage.service.ISectattrService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.*;
|
||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPdGroupbucket;
|
||||
import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||
@@ -137,6 +135,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
||||
@Autowired
|
||||
private TaskFactory taskFactory;
|
||||
|
||||
/**
|
||||
* 桶记录服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPdGroupbucketService iMdPdGroupbucketService;
|
||||
|
||||
@Override
|
||||
public IPage<IOStorInv> pageQuery(Map whereJson, PageQuery page, String[] stor_id, String[] bill_status, String[] bill_type) {
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
@@ -1328,20 +1332,28 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||
);
|
||||
if (ObjectUtil.isEmpty(lateList)) {
|
||||
throw new BadRequestException("此载具没有组盘【"+ioStorInvDis.getStoragevehicle_code()+"】");
|
||||
}
|
||||
// 查询桶码
|
||||
MdPdGroupbucket bucket = iMdPdGroupbucketService.getOne(
|
||||
new QueryWrapper<MdPdGroupbucket>().lambda()
|
||||
.eq(MdPdGroupbucket::getBucket_code, ioStorInvDis.getStoragevehicle_code())
|
||||
);
|
||||
|
||||
// 如果有袋码则不更新组盘信息,由手持进行更新
|
||||
boolean is_emp = lateList.stream()
|
||||
.anyMatch(row -> ObjectUtil.isEmpty(row.getBag_code()));
|
||||
if (is_emp) {
|
||||
GroupPlate groupPlate = lateList.get(0);
|
||||
double sub_qty = NumberUtil.sub(groupPlate.getQty(), ioStorInvDis.getPlan_qty()).doubleValue();
|
||||
if (sub_qty != 0) {
|
||||
groupPlate.setQty(BigDecimal.valueOf(sub_qty));
|
||||
if (ObjectUtil.isEmpty(bucket)) {
|
||||
throw new BadRequestException("此桶码不存在【"+ioStorInvDis.getStoragevehicle_code()+"】");
|
||||
}
|
||||
} else {
|
||||
// 如果有袋码则不更新组盘信息,由手持进行更新
|
||||
boolean is_emp = lateList.stream()
|
||||
.anyMatch(row -> ObjectUtil.isEmpty(row.getBag_code()));
|
||||
if (is_emp) {
|
||||
GroupPlate groupPlate = lateList.get(0);
|
||||
double sub_qty = NumberUtil.sub(groupPlate.getQty(), ioStorInvDis.getPlan_qty()).doubleValue();
|
||||
if (sub_qty != 0) {
|
||||
groupPlate.setQty(BigDecimal.valueOf(sub_qty));
|
||||
}
|
||||
groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("出库"));
|
||||
groupPlateMapper.updateById(groupPlate);
|
||||
}
|
||||
groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("出库"));
|
||||
groupPlateMapper.updateById(groupPlate);
|
||||
}
|
||||
|
||||
// 查询该明细下是否还有未完成的分配明细
|
||||
|
||||
@@ -324,13 +324,15 @@ public class UpdateIvtUtils {
|
||||
.eq(GroupPlate::getPcsn, extDao.getPcsn())
|
||||
.eq(ObjectUtil.isNotEmpty(extDao.getBag_code()),GroupPlate::getBag_code,extDao.getBag_code())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(extDao.getBag_code())) {
|
||||
groupPlate.setQty(groupPlate.getQty());
|
||||
} else {
|
||||
groupPlate.setQty(extDao.getCanuse_qty());
|
||||
}
|
||||
|
||||
groupPlateMapper.updateById(groupPlate);
|
||||
if (ObjectUtil.isNotEmpty(groupPlate)) {
|
||||
if (ObjectUtil.isNotEmpty(extDao.getBag_code())) {
|
||||
groupPlate.setQty(groupPlate.getQty());
|
||||
} else {
|
||||
groupPlate.setQty(extDao.getCanuse_qty());
|
||||
}
|
||||
groupPlateMapper.updateById(groupPlate);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user