fix: 手持直接入库
This commit is contained in:
@@ -6,7 +6,6 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.common.logging.annotation.Log;
|
import org.nl.common.logging.annotation.Log;
|
||||||
import org.nl.wms.pda.general_management.service.PdaPreTreatmentService;
|
import org.nl.wms.pda.general_management.service.PdaPreTreatmentService;
|
||||||
import org.nl.wms.pda.general_management.service.dto.AssemblyPalletParam;
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -15,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预处理功能
|
* 预处理功能
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public class PdaCommonServiceImpl implements PdaCommonService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PdaResponse confirmPalletAssembly(AssemblyPalletParam param) {
|
public PdaResponse confirmPalletAssembly(AssemblyPalletParam param) {
|
||||||
storagevehicleinfoService.getByCode(param.getVehicle_code());
|
// storagevehicleinfoService.getByCode(param.getVehicle_code());
|
||||||
List<GroupPlate> groupPlates = param.getGroup_plates();
|
List<GroupPlate> groupPlates = param.getGroup_plates();
|
||||||
for (GroupPlate groupPlate : groupPlates) {
|
for (GroupPlate groupPlate : groupPlates) {
|
||||||
groupPlate.setVehicle_code(param.getVehicle_code());
|
groupPlate.setVehicle_code(param.getVehicle_code());
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.nl.wms.pda.general_management.service.impl;
|
package org.nl.wms.pda.general_management.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@@ -11,12 +12,17 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.wms.basedata_manage.service.ISectattrService;
|
import org.nl.wms.basedata_manage.service.ISectattrService;
|
||||||
import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
||||||
|
import org.nl.wms.pda.general_management.service.PdaCommonService;
|
||||||
import org.nl.wms.pda.general_management.service.PdaPreTreatmentService;
|
import org.nl.wms.pda.general_management.service.PdaPreTreatmentService;
|
||||||
|
import org.nl.wms.pda.general_management.service.dto.AssemblyPalletParam;
|
||||||
import org.nl.wms.pda.util.PdaResponse;
|
import org.nl.wms.pda.util.PdaResponse;
|
||||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||||
|
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.SchBasePoint;
|
||||||
|
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||||
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
||||||
import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
|
import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
|
||||||
|
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||||
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
|
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
|
||||||
import org.nl.wms.warehouse_management.service.dao.IOStorInvDtl;
|
import org.nl.wms.warehouse_management.service.dao.IOStorInvDtl;
|
||||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
|
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
|
||||||
@@ -25,10 +31,12 @@ import org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto;
|
|||||||
import org.redisson.api.RLock;
|
import org.redisson.api.RLock;
|
||||||
import org.redisson.api.RedissonClient;
|
import org.redisson.api.RedissonClient;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: lyd
|
* @Author: lyd
|
||||||
@@ -51,21 +59,21 @@ public class PdaPreTreatmentServiceImpl implements PdaPreTreatmentService {
|
|||||||
private IOStorInvDtlMapper ioStorInvDtlMapper;
|
private IOStorInvDtlMapper ioStorInvDtlMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private RedissonClient redissonClient;
|
private RedissonClient redissonClient;
|
||||||
|
@Resource
|
||||||
|
private PdaCommonService pdaCommonService;
|
||||||
|
@Resource
|
||||||
|
private ISchBaseTaskService taskService;
|
||||||
@Override
|
@Override
|
||||||
public PdaResponse getPalletAssembly(JSONObject param) {
|
public PdaResponse getPalletAssembly(JSONObject param) {
|
||||||
String search = param.getString("search");
|
String search = param.getString("search");
|
||||||
if (ObjectUtil.isEmpty(search)) {
|
if (ObjectUtil.isEmpty(search)) {
|
||||||
throw new BadRequestException("请输入点位编码或者托盘编码!");
|
throw new BadRequestException("请输入袋号编码!");
|
||||||
}
|
|
||||||
SchBasePoint point = pointService.getByPointCode(search, false);
|
|
||||||
if (ObjectUtil.isNotEmpty(point)) {
|
|
||||||
search = point.getVehicle_code();
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isEmpty(search)) {
|
|
||||||
throw new BadRequestException("输入内容有误或者点位未绑定托盘号,请检查!");
|
|
||||||
}
|
}
|
||||||
List<JSONObject> groups = groupplateService.getPalletView(search);
|
List<JSONObject> groups = groupplateService.getPalletView(search);
|
||||||
return PdaResponse.requestParamOk(groups);
|
if (groups.size() != 1) {
|
||||||
|
throw new BadRequestException(groups.size() == 0 ? "组袋记录不存在,请先组袋!" : "组袋记录信息有误,请查询并清理后重试!");
|
||||||
|
}
|
||||||
|
return PdaResponse.requestParamOk(groups.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@@ -85,12 +93,24 @@ public class PdaPreTreatmentServiceImpl implements PdaPreTreatmentService {
|
|||||||
if (ObjectUtil.isEmpty(startPoint)) {
|
if (ObjectUtil.isEmpty(startPoint)) {
|
||||||
throw new BadRequestException("输入的点位不存在或者点位已被禁用, 请检查输入点位是否正确或是否被禁用!");
|
throw new BadRequestException("输入的点位不存在或者点位已被禁用, 请检查输入点位是否正确或是否被禁用!");
|
||||||
}
|
}
|
||||||
|
if (ObjectUtil.isEmpty(startPoint.getVehicle_code())) {
|
||||||
|
throw new BadRequestException("点位载具号为空!");
|
||||||
|
}
|
||||||
Sectattr sectattr = sectattrService.findByCode("WYL01", true);
|
Sectattr sectattr = sectattrService.findByCode("WYL01", true);
|
||||||
if (ObjectUtil.isEmpty(sectattr)) {
|
if (ObjectUtil.isEmpty(sectattr)) {
|
||||||
throw new BadRequestException("库区【物料室原料区】不存在或者被禁用!");
|
throw new BadRequestException("库区【物料室原料区】不存在或者被禁用!");
|
||||||
}
|
}
|
||||||
|
// 判断任务是否创建
|
||||||
|
List<SchBaseTask> tasks = taskService.getTaskByQuery(new LambdaQueryWrapper<SchBaseTask>()
|
||||||
|
.eq(SchBaseTask::getPoint_code1, search));
|
||||||
|
if (tasks.size() > 0) {
|
||||||
|
throw new BadRequestException("该点位已创建过任务!");
|
||||||
|
}
|
||||||
|
// 0 组盘
|
||||||
|
doGroupPallat(param, startPoint);
|
||||||
|
|
||||||
// 1 创建入库单、明细、分配明细
|
// 1 创建入库单、明细、分配明细
|
||||||
Map<String, Object> invObj = doBuildInvObj(param.getJSONArray("rows"));
|
Map<String, Object> invObj = doBuildInvObj(param, startPoint);
|
||||||
String invId = rawAssistIStorService.insertDtl(invObj);
|
String invId = rawAssistIStorService.insertDtl(invObj);
|
||||||
// 2 调用分配 (WYL01)
|
// 2 调用分配 (WYL01)
|
||||||
Map<String, Object> divObj = buildDivStructData(sectattr, invId);
|
Map<String, Object> divObj = buildDivStructData(sectattr, invId);
|
||||||
@@ -109,6 +129,22 @@ public class PdaPreTreatmentServiceImpl implements PdaPreTreatmentService {
|
|||||||
return PdaResponse.requestOk();
|
return PdaResponse.requestOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doGroupPallat(JSONObject param, SchBasePoint startPoint) {
|
||||||
|
JSONArray rows = param.getJSONArray("rows");
|
||||||
|
List<String> bagCode = rows
|
||||||
|
.stream()
|
||||||
|
.map(HashMap.class::cast)
|
||||||
|
.map(p -> MapUtil.getStr(p, "bag_code"))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<GroupPlate> list = groupplateService.list(new LambdaQueryWrapper<GroupPlate>()
|
||||||
|
.in(GroupPlate::getBag_code, bagCode)
|
||||||
|
.eq(GroupPlate::getStatus, "0"));
|
||||||
|
AssemblyPalletParam palletParam = new AssemblyPalletParam();
|
||||||
|
palletParam.setVehicle_code(startPoint.getVehicle_code());
|
||||||
|
palletParam.setGroup_plates(list);
|
||||||
|
pdaCommonService.confirmPalletAssembly(palletParam);
|
||||||
|
}
|
||||||
|
|
||||||
private Map<String, Object> buildTaskData(SchBasePoint startPoint, String invId) {
|
private Map<String, Object> buildTaskData(SchBasePoint startPoint, String invId) {
|
||||||
Map<String, Object> jsonMst = new HashMap<>();
|
Map<String, Object> jsonMst = new HashMap<>();
|
||||||
jsonMst.put("point_code", startPoint.getPoint_code());
|
jsonMst.put("point_code", startPoint.getPoint_code());
|
||||||
@@ -144,7 +180,8 @@ public class PdaPreTreatmentServiceImpl implements PdaPreTreatmentService {
|
|||||||
return divObj;
|
return divObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> doBuildInvObj(JSONArray rows) {
|
private Map<String, Object> doBuildInvObj(JSONObject param, SchBasePoint startPoint) {
|
||||||
|
JSONArray rows = param.getJSONArray("rows");
|
||||||
Map<String, Object> res = new HashMap<>();
|
Map<String, Object> res = new HashMap<>();
|
||||||
ArrayList<HashMap> tableData = new ArrayList<>();
|
ArrayList<HashMap> tableData = new ArrayList<>();
|
||||||
res.put("tableData", tableData);
|
res.put("tableData", tableData);
|
||||||
@@ -158,7 +195,7 @@ public class PdaPreTreatmentServiceImpl implements PdaPreTreatmentService {
|
|||||||
HashMap<String, Object> table = new HashMap<>();
|
HashMap<String, Object> table = new HashMap<>();
|
||||||
JSONObject row = rows.getJSONObject(i);
|
JSONObject row = rows.getJSONObject(i);
|
||||||
table.put("group_id", row.getString("group_id"));
|
table.put("group_id", row.getString("group_id"));
|
||||||
table.put("storagevehicle_code", row.getString("storagevehicle_code"));
|
table.put("storagevehicle_code", startPoint.getVehicle_code());
|
||||||
table.put("material_id", row.getString("material_id"));
|
table.put("material_id", row.getString("material_id"));
|
||||||
table.put("pcsn", row.getString("pcsn"));
|
table.put("pcsn", row.getString("pcsn"));
|
||||||
table.put("qty", row.getBigDecimal("qty"));
|
table.put("qty", row.getBigDecimal("qty"));
|
||||||
|
|||||||
@@ -144,12 +144,11 @@
|
|||||||
m.material_spec,
|
m.material_spec,
|
||||||
m.material_model,
|
m.material_model,
|
||||||
m.material_type_id,
|
m.material_type_id,
|
||||||
s.supp_name,
|
s.supp_name
|
||||||
g.vehicle_code AS storagevehicle_code
|
|
||||||
FROM
|
FROM
|
||||||
`md_pb_groupplate` g
|
`md_pb_groupplate` g
|
||||||
LEFT JOIN md_me_materialbase m ON m.material_id = g.material_id
|
LEFT JOIN md_me_materialbase m ON m.material_id = g.material_id
|
||||||
LEFT JOIN md_cs_supplierbase s ON s.supp_code = g.supp_code
|
LEFT JOIN md_cs_supplierbase s ON s.supp_code = g.supp_code
|
||||||
WHERE g.vehicle_code = #{search} AND g.`status` = '1'
|
WHERE g.bag_code = #{search} AND g.`status` = '0'
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|||||||
dis.put("material_id", row.get("material_id"));
|
dis.put("material_id", row.get("material_id"));
|
||||||
dis.put("pcsn", row.get("pcsn"));
|
dis.put("pcsn", row.get("pcsn"));
|
||||||
dis.put("storagevehicle_code", row.get("storagevehicle_code"));
|
dis.put("storagevehicle_code", row.get("storagevehicle_code"));
|
||||||
|
dis.put("bag_code", row.get("bag_code"));
|
||||||
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||||
dis.put("is_issued", BaseDataEnum.IS_YES_NOT.code("否"));
|
dis.put("is_issued", BaseDataEnum.IS_YES_NOT.code("否"));
|
||||||
dis.put("qty_unit_id", row.get("qty_unit_id"));
|
dis.put("qty_unit_id", row.get("qty_unit_id"));
|
||||||
|
|||||||
Reference in New Issue
Block a user