fix: 直接入库

This commit is contained in:
2025-12-09 14:24:53 +08:00
parent 0e52c0b9da
commit e04781108e
15 changed files with 201 additions and 51 deletions

View File

@@ -124,4 +124,5 @@ public interface IStructattrService extends IService<Structattr> {
*/ */
List<MdPbStoragevehicleextDto> outBoundSectDiv(StrategyStructParam param); List<MdPbStoragevehicleextDto> outBoundSectDiv(StrategyStructParam param);
List<Structattr> getByVehicleCode(String search, boolean flag);
} }

View File

@@ -426,4 +426,15 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
return list; return list;
} }
@Override
public List<Structattr> getByVehicleCode(String search, boolean flag) {
LambdaQueryWrapper<Structattr> query = new QueryWrapper<Structattr>().lambda()
.eq(Structattr::getIs_used, IOSConstant.IS_DELETE_YES)
.eq(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
.eq(Structattr::getIs_delete, IOSConstant.IS_DELETE_NO)
.eq(Structattr::getStruct_code, search)
.eq(flag, Structattr::getIs_emptyvehicle, "1");
return this.list(query);
}
} }

View File

@@ -99,4 +99,16 @@ public class PdaProductionController {
public ResponseEntity<Object> productionLine(@RequestBody JSONObject whereJson) { public ResponseEntity<Object> productionLine(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(pdaProductionService.productionLine(whereJson), HttpStatus.OK); return new ResponseEntity<>(pdaProductionService.productionLine(whereJson), HttpStatus.OK);
} }
@PostMapping("/receivedIn")
@Log("生产下料-收货入库")
@SaIgnore
public ResponseEntity<Object> receivedIn(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(pdaProductionService.receivedIn(whereJson), HttpStatus.OK);
}
@PostMapping("/getVehicleInfo")
@Log("生产下料-收货入库")
@SaIgnore
public ResponseEntity<Object> getVehicleInfo(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(pdaProductionService.getVehicleInfo(whereJson), HttpStatus.OK);
}
} }

View File

@@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; 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.PdaWarehouseService;
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;
@@ -16,29 +16,29 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
/** /**
* 预处理功能 * 仓库管理
* @Author: lyd * @Author: lyd
* @Date: 2025/11/25 * @Date: 2025/11/25
*/ */
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@RequestMapping("/api/pdaPreTreatment") @RequestMapping("/api/pdaWarehouse")
@Slf4j @Slf4j
public class PdaPreTreatmentController { public class PdaWarehouseController {
@Resource @Resource
private PdaPreTreatmentService pdaPreTreatmentService; private PdaWarehouseService pdaWarehouseService;
@PostMapping("/getPalletAssembly") @PostMapping("/getPalletAssembly")
@Log("原辅料入库(直接入库-获取组袋信息") @Log("直接入库 - 获取组袋信息")
@SaIgnore @SaIgnore
public ResponseEntity<Object> getPalletAssembly(@RequestBody JSONObject param) { public ResponseEntity<Object> getPalletAssembly(@RequestBody JSONObject param) {
return new ResponseEntity<>(pdaPreTreatmentService.getPalletAssembly(param), HttpStatus.OK); return new ResponseEntity<>(pdaWarehouseService.getPalletAssembly(param), HttpStatus.OK);
} }
@PostMapping("/confirmPalletAssemblyIn") @PostMapping("/confirmPalletAssemblyIn")
@Log("原辅料入库(直接入库-入库") @Log("直接入库 - 入库")
@SaIgnore @SaIgnore
public ResponseEntity<Object> confirmPalletAssemblyIn(@RequestBody JSONObject param) { public ResponseEntity<Object> confirmPalletAssemblyIn(@RequestBody JSONObject param) {
return new ResponseEntity<>(pdaPreTreatmentService.confirmPalletAssemblyIn(param), HttpStatus.OK); return new ResponseEntity<>(pdaWarehouseService.confirmPalletAssemblyIn(param), HttpStatus.OK);
} }
} }

View File

@@ -2,6 +2,7 @@ package org.nl.wms.pda.general_management.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.nl.wms.basedata_manage.service.dao.Sectattr; import org.nl.wms.basedata_manage.service.dao.Sectattr;
import org.nl.wms.basedata_manage.service.dao.Structattr;
import org.nl.wms.sch_manage.service.dao.SchBasePoint; import org.nl.wms.sch_manage.service.dao.SchBasePoint;
import java.util.Map; import java.util.Map;
@@ -17,7 +18,7 @@ public interface PdaBuildParamService {
* @param param * @param param
* @param startPoint * @param startPoint
*/ */
void doGroupPallet(JSONObject param, SchBasePoint startPoint); void doGroupPallet(JSONObject param, String vehicleCode);
/** /**
* 构建创建任务参数 * 构建创建任务参数
@@ -34,7 +35,7 @@ public interface PdaBuildParamService {
* @param invId * @param invId
* @return * @return
*/ */
Map<String, Object> buildDivStructData(JSONObject param, Sectattr sect, String invId); Map<String, Object> buildDivStructData(JSONObject param, Sectattr sect, String invId, boolean checked);
/** /**
* 构建创建入库单参数 * 构建创建入库单参数

View File

@@ -69,4 +69,13 @@ public interface PdaProductionService {
PdaResponse getGroupBucketInfo(JSONObject param); PdaResponse getGroupBucketInfo(JSONObject param);
PdaResponse productionLine(JSONObject param); PdaResponse productionLine(JSONObject param);
/**
* 收货入库
* @param param
* @return
*/
PdaResponse receivedIn(JSONObject param);
PdaResponse getVehicleInfo(JSONObject param);
} }

View File

@@ -1,17 +1,13 @@
package org.nl.wms.pda.general_management.service; package org.nl.wms.pda.general_management.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.nl.wms.basedata_manage.service.dao.Sectattr;
import org.nl.wms.pda.util.PdaResponse; import org.nl.wms.pda.util.PdaResponse;
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
import java.util.Map;
/** /**
* @Author: lyd * @Author: lyd
* @Date: 2025/11/25 * @Date: 2025/11/25
*/ */
public interface PdaPreTreatmentService { public interface PdaWarehouseService {
PdaResponse getPalletAssembly(JSONObject param); PdaResponse getPalletAssembly(JSONObject param);
/** /**

View File

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
import org.nl.wms.basedata_manage.service.dao.Sectattr; import org.nl.wms.basedata_manage.service.dao.Sectattr;
import org.nl.wms.basedata_manage.service.dao.Structattr;
import org.nl.wms.pda.general_management.service.PdaBuildParamService; import org.nl.wms.pda.general_management.service.PdaBuildParamService;
import org.nl.wms.pda.general_management.service.PdaCommonService; import org.nl.wms.pda.general_management.service.PdaCommonService;
import org.nl.wms.pda.general_management.service.dto.AssemblyPalletParam; import org.nl.wms.pda.general_management.service.dto.AssemblyPalletParam;
@@ -48,7 +49,7 @@ public class DefaultPdaBuildParamService implements PdaBuildParamService {
private IRawAssistIStorService rawAssistIStorService; private IRawAssistIStorService rawAssistIStorService;
@Override @Override
public void doGroupPallet(JSONObject param, SchBasePoint startPoint) { public void doGroupPallet(JSONObject param, String vehicleCode) {
JSONArray rows = param.getJSONArray("rows"); JSONArray rows = param.getJSONArray("rows");
List<String> bagCode = rows List<String> bagCode = rows
.stream() .stream()
@@ -59,7 +60,7 @@ public class DefaultPdaBuildParamService implements PdaBuildParamService {
.in(GroupPlate::getBag_code, bagCode) .in(GroupPlate::getBag_code, bagCode)
.eq(GroupPlate::getStatus, "0")); .eq(GroupPlate::getStatus, "0"));
AssemblyPalletParam palletParam = new AssemblyPalletParam(); AssemblyPalletParam palletParam = new AssemblyPalletParam();
palletParam.setVehicle_code(startPoint.getVehicle_code()); palletParam.setVehicle_code(vehicleCode);
palletParam.setGroup_plates(list); palletParam.setGroup_plates(list);
pdaCommonService.confirmPalletAssembly(palletParam); pdaCommonService.confirmPalletAssembly(palletParam);
} }
@@ -85,7 +86,7 @@ public class DefaultPdaBuildParamService implements PdaBuildParamService {
} }
@Override @Override
public Map<String, Object> buildDivStructData(JSONObject param, Sectattr sect, String invId) { public Map<String, Object> buildDivStructData(JSONObject param, Sectattr sect, String invId, boolean checked) {
Map<String, Object> divObj = new HashMap<>(); Map<String, Object> divObj = new HashMap<>();
divObj.put("sect_id", sect.getSect_id()); divObj.put("sect_id", sect.getSect_id());
divObj.put("sect_code", param.getString("sect_code")); divObj.put("sect_code", param.getString("sect_code"));
@@ -93,9 +94,17 @@ public class DefaultPdaBuildParamService implements PdaBuildParamService {
divObj.put("struct_id", param.getString("struct_id")); divObj.put("struct_id", param.getString("struct_id"));
divObj.put("struct_name", param.getString("struct_name")); divObj.put("struct_name", param.getString("struct_name"));
divObj.put("struct_code", param.getString("struct_code")); divObj.put("struct_code", param.getString("struct_code"));
divObj.put("checked", true); divObj.put("checked", checked);
List<IOStorInvDis> ioStorInvDis = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<IOStorInvDis>() List<IOStorInvDis> ioStorInvDis = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<IOStorInvDis>()
.eq(IOStorInvDis::getIostorinv_id, invId)); .eq(IOStorInvDis::getIostorinv_id, invId));
for (IOStorInvDis ioStorInvDi : ioStorInvDis) {
ioStorInvDi.setSect_id(sect.getSect_id());
ioStorInvDi.setSect_code(param.getString("sect_code"));
ioStorInvDi.setSect_name(param.getString("sect_name"));
ioStorInvDi.setStruct_id(param.getString("struct_id"));
ioStorInvDi.setStruct_code(param.getString("struct_name"));
ioStorInvDi.setStruct_name(param.getString("struct_code"));
}
if (ioStorInvDis.size() == 0) { if (ioStorInvDis.size() == 0) {
throw new BadRequestException("分配明细不存在!"); throw new BadRequestException("分配明细不存在!");
} }

View File

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils; import org.nl.common.utils.SecurityUtils;
@@ -16,7 +17,7 @@ import org.nl.wms.basedata_manage.service.ISectattrService;
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext; import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
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.PdaBuildParamService; import org.nl.wms.pda.general_management.service.PdaBuildParamService;
import org.nl.wms.pda.general_management.service.PdaPreTreatmentService; import org.nl.wms.pda.general_management.service.PdaWarehouseService;
import org.nl.wms.pda.general_management.service.PdaProductionService; import org.nl.wms.pda.general_management.service.PdaProductionService;
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;
@@ -32,6 +33,8 @@ import org.nl.wms.warehouse_management.service.IOutBillService;
import org.nl.wms.warehouse_management.service.IRawAssistIStorService; import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
import org.nl.wms.warehouse_management.service.VehicleInService; import org.nl.wms.warehouse_management.service.VehicleInService;
import org.nl.wms.warehouse_management.service.dao.GroupPlate; import org.nl.wms.warehouse_management.service.dao.GroupPlate;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -40,6 +43,7 @@ import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
import static org.nl.common.utils.ValidationUtil.*; import static org.nl.common.utils.ValidationUtil.*;
@@ -55,7 +59,7 @@ public class PdaProductionServiceImpl implements PdaProductionService {
@Resource @Resource
private ISchBasePointService pointService; private ISchBasePointService pointService;
@Resource @Resource
private PdaPreTreatmentService pdaPreTreatmentService; private PdaWarehouseService pdaWarehouseService;
@Resource @Resource
private ISectattrService sectattrService; private ISectattrService sectattrService;
@Resource @Resource
@@ -78,6 +82,8 @@ public class PdaProductionServiceImpl implements PdaProductionService {
private IMdPdGroupbucketService groupbucketService; private IMdPdGroupbucketService groupbucketService;
@Resource @Resource
private TaskFactory taskFactory; private TaskFactory taskFactory;
@Resource
private RedissonClient redissonClient;
@Override @Override
public PdaResponse getGroupInfo(JSONObject param) { public PdaResponse getGroupInfo(JSONObject param) {
// search; // search;
@@ -250,7 +256,7 @@ public class PdaProductionServiceImpl implements PdaProductionService {
Map<String, Object> invObj = defaultPdaBuildParam.doBuildInvObj(param, startPoint, sectattr); Map<String, Object> invObj = defaultPdaBuildParam.doBuildInvObj(param, startPoint, sectattr);
String invId = rawAssistIStorService.insertDtl(invObj); String invId = rawAssistIStorService.insertDtl(invObj);
// 2 调用分配 // 2 调用分配
Map<String, Object> divObj = defaultPdaBuildParam.buildDivStructData(param, sectattr, invId); Map<String, Object> divObj = defaultPdaBuildParam.buildDivStructData(param, sectattr, invId, true);
rawAssistIStorService.divStruct(divObj); rawAssistIStorService.divStruct(divObj);
// 3 创建任务 // 3 创建任务
Map<String, Object> jsonMst = defaultPdaBuildParam.buildTaskData(startPoint, invId); Map<String, Object> jsonMst = defaultPdaBuildParam.buildTaskData(startPoint, invId);
@@ -322,4 +328,70 @@ public class PdaProductionServiceImpl implements PdaProductionService {
task.create(param); task.create(param);
return PdaResponse.requestOk(); return PdaResponse.requestOk();
} }
@SneakyThrows
@Override
public PdaResponse receivedIn(JSONObject param) {
log.info("拆包缓冲间确认入库:{}", param);
RLock lock = redissonClient.getLock("lock:confirmPalletAssemblyIn");
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try {
if (tryLock) {
// parampoint_code点位, vehicle_code, sect_coderows
String search = param.getString("point_code");
String sect_code = param.getString("sect_code");
if (ObjectUtil.isEmpty(search)) {
throw new BadRequestException("请输入点位编码!");
}
SchBasePoint startPoint = pointService.getByPointCode(search, true);
if (ObjectUtil.isEmpty(startPoint)) {
throw new BadRequestException("输入的点位不存在或者点位已被禁用, 请检查输入点位是否正确或是否被禁用!");
}
if (ObjectUtil.isEmpty(startPoint.getVehicle_code())) {
throw new BadRequestException("点位载具号为空!");
}
if (ObjectUtil.isEmpty(sect_code)) {
throw new BadRequestException("请选择入库库区!");
}
Sectattr sectattr = sectattrService.findByCode(sect_code, true);
if (ObjectUtil.isEmpty(sectattr)) {
throw new BadRequestException("库区不存在或者被禁用!");
}
// 判断任务是否创建
List<SchBaseTask> tasks = taskService.getTaskByQuery(new LambdaQueryWrapper<SchBaseTask>()
.eq(SchBaseTask::getPoint_code1, search));
if (tasks.size() > 0) {
throw new BadRequestException("该点位已创建过任务!");
}
param.put("bill_type", IOSEnum.IN_BILL_TYPE.code("原辅料入库"));
// 1 创建入库单、明细、分配明细
Map<String, Object> invObj = defaultPdaBuildParam.doBuildInvObj(param, startPoint, sectattr);
String invId = rawAssistIStorService.insertDtl(invObj);
// 2 调用分配
Map<String, Object> divObj = defaultPdaBuildParam.buildDivStructData(param, sectattr, invId, true);
rawAssistIStorService.divStruct(divObj);
// 3 创建任务
Map<String, Object> jsonMst = defaultPdaBuildParam.buildTaskData(startPoint, invId);
rawAssistIStorService.divPoint(jsonMst);
} else {
throw new BadRequestException("速度太快啦,稍后再试...");
}
} finally {
if (tryLock) {
lock.unlock();
}
}
return PdaResponse.requestOk();
}
@Override
public PdaResponse getVehicleInfo(JSONObject param) {
// search;
String search = param.getString("vehicle_code").trim();
if (ObjectUtil.isEmpty(search)) {
throw new BadRequestException("载具不存在!");
}
List<JSONObject> res = groupplateService.getPalletViewByVehicleCode(search);
return PdaResponse.requestParamOk(res);
}
} }

View File

@@ -3,13 +3,17 @@ package org.nl.wms.pda.general_management.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
import org.nl.config.MapOf;
import org.nl.wms.basedata_manage.service.ISectattrService; import org.nl.wms.basedata_manage.service.ISectattrService;
import org.nl.wms.basedata_manage.service.IStructattrService;
import org.nl.wms.basedata_manage.service.dao.Sectattr; import org.nl.wms.basedata_manage.service.dao.Sectattr;
import org.nl.wms.basedata_manage.service.dao.Structattr;
import org.nl.wms.pda.general_management.service.PdaBuildParamService; import org.nl.wms.pda.general_management.service.PdaBuildParamService;
import org.nl.wms.pda.general_management.service.PdaPreTreatmentService; import org.nl.wms.pda.general_management.service.PdaWarehouseService;
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.ISchBaseTaskService;
@@ -23,9 +27,11 @@ import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/** /**
* @Author: lyd * @Author: lyd
@@ -33,7 +39,7 @@ import java.util.concurrent.TimeUnit;
*/ */
@Slf4j @Slf4j
@Service @Service
public class PdaPreTreatmentServiceImpl implements PdaPreTreatmentService { public class PdaWarehouseServiceImpl implements PdaWarehouseService {
@Resource @Resource
private ISchBasePointService pointService; private ISchBasePointService pointService;
@Resource @Resource
@@ -48,6 +54,9 @@ public class PdaPreTreatmentServiceImpl implements PdaPreTreatmentService {
private ISchBaseTaskService taskService; private ISchBaseTaskService taskService;
@Resource @Resource
private PdaBuildParamService defaultPdaBuildParam; private PdaBuildParamService defaultPdaBuildParam;
@Resource
private IStructattrService structattrService;
@Override @Override
public PdaResponse getPalletAssembly(JSONObject param) { public PdaResponse getPalletAssembly(JSONObject param) {
String search = param.getString("search"); String search = param.getString("search");
@@ -64,49 +73,68 @@ public class PdaPreTreatmentServiceImpl implements PdaPreTreatmentService {
@SneakyThrows @SneakyThrows
@Override @Override
public PdaResponse confirmPalletAssemblyIn(JSONObject param) { public PdaResponse confirmPalletAssemblyIn(JSONObject param) {
log.info("拆包缓冲间确认入库:{}", param); log.info("直接入库:{}", param);
RLock lock = redissonClient.getLock("lock:confirmPalletAssemblyIn"); RLock lock = redissonClient.getLock("lock:confirmPalletAssemblyIn");
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try { try {
if (tryLock) { if (tryLock) {
// paramsearch点位, rows // paramsearch仓位/载具号, rows
String search = param.getString("search"); String search = param.getString("search");
String pointCode;
String vehicleCode;
if (ObjectUtil.isEmpty(search)) { if (ObjectUtil.isEmpty(search)) {
throw new BadRequestException("请输入点位编码!"); throw new BadRequestException("请输入点位/载具编码!");
} }
SchBasePoint startPoint = pointService.getByPointCode(search, true); Structattr startStruct = structattrService.getByCode(search);
if (ObjectUtil.isEmpty(startPoint)) { if (ObjectUtil.isEmpty(startStruct)) {
throw new BadRequestException("输入的点位不存在或者点位已被禁用, 请检查输入点位是否正确或是否被禁用!"); vehicleCode = search;
List<Structattr> points = structattrService.getByVehicleCode(search, true);
if (points.size() != 1) {
throw new BadRequestException(points.size() > 1
? "该托盘号绑定在多个点位" + points.stream().map(Structattr::getStruct_code).collect(Collectors.toList()) + ",请检查!"
: "该托盘号未绑定到点位或者点位被禁用或者点位以上锁,请检查!");
} }
if (ObjectUtil.isEmpty(startPoint.getVehicle_code())) { startStruct = points.get(0);
pointCode = startStruct.getStruct_code();
} else {
pointCode = search;
vehicleCode = startStruct.getStoragevehicle_code();
}
if (ObjectUtil.isEmpty(vehicleCode)) {
throw new BadRequestException("点位载具号为空!"); throw new BadRequestException("点位载具号为空!");
} }
if (ObjectUtil.isEmpty(startPoint.getIn_sect())) {
throw new BadRequestException("该点位未配置入库库区,请到点位管理配置!");
}
Sectattr sectattr = sectattrService.findByCode(startPoint.getIn_sect(), true);
if (ObjectUtil.isEmpty(sectattr)) {
throw new BadRequestException("库区不存在或者被禁用!");
}
// 判断任务是否创建 // 判断任务是否创建
List<SchBaseTask> tasks = taskService.getTaskByQuery(new LambdaQueryWrapper<SchBaseTask>() List<SchBaseTask> tasks = taskService.getTaskByQuery(new LambdaQueryWrapper<SchBaseTask>()
.eq(SchBaseTask::getPoint_code1, search)); .eq(SchBaseTask::getPoint_code1, pointCode));
if (tasks.size() > 0) { if (tasks.size() > 0) {
throw new BadRequestException("该点位已创建过任务!"); throw new BadRequestException("该点位已创建过任务!");
} }
Sectattr sectattr = sectattrService.findByCode(startStruct.getSect_code(), true);
if (ObjectUtil.isEmpty(sectattr)) {
throw new BadRequestException("库区不存在或者被禁用!");
}
// 点位释放
structattrService.update(new LambdaUpdateWrapper<Structattr>()
.set(Structattr::getStoragevehicle_code, "")
.set(Structattr::getIs_emptyvehicle, "0")
.eq(Structattr::getStruct_code, startStruct.getStruct_code()));
// 0 组盘 // 0 组盘
defaultPdaBuildParam.doGroupPallet(param, startPoint); defaultPdaBuildParam.doGroupPallet(param, vehicleCode);
param.put("vehicle_code", startPoint.getVehicle_code()); param.put("bill_type", IOSEnum.IN_BILL_TYPE.code("直接入库"));
param.put("bill_type", IOSEnum.IN_BILL_TYPE.code("原辅料入库")); param.put("vehicle_code", vehicleCode);
// 1 创建入库单明细分配明细 // 1 创建入库单明细分配明细
Map<String, Object> invObj = defaultPdaBuildParam.doBuildInvObj(param, startPoint, sectattr); Map<String, Object> invObj = defaultPdaBuildParam.doBuildInvObj(param, null, sectattr);
String invId = rawAssistIStorService.insertDtl(invObj); String invId = rawAssistIStorService.insertDtl(invObj);
// 2 调用分配 // 2 调用指定分配
Map<String, Object> divObj = defaultPdaBuildParam.buildDivStructData(param, sectattr, invId); 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); rawAssistIStorService.divStruct(divObj);
// 3 创建任务 // 3强制确认
Map<String, Object> jsonMst = defaultPdaBuildParam.buildTaskData(startPoint, invId); rawAssistIStorService.confirm(MapOf.of("iostorinv_id", invId));
rawAssistIStorService.divPoint(jsonMst);
} else { } else {
throw new BadRequestException("速度太快啦,稍后再试..."); throw new BadRequestException("速度太快啦,稍后再试...");
} }

View File

@@ -139,4 +139,6 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
* @return * @return
*/ */
List<SchBasePoint> getCanUsePointByRegion(String regionCode); List<SchBasePoint> getCanUsePointByRegion(String regionCode);
List<SchBasePoint> getByVehicleCode(String search);
} }

View File

@@ -322,4 +322,11 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
public List<SchBasePoint> getCanUsePointByRegion(String regionCode) { public List<SchBasePoint> getCanUsePointByRegion(String regionCode) {
return this.baseMapper.getCanUsePointByRegion(regionCode); return this.baseMapper.getCanUsePointByRegion(regionCode);
} }
@Override
public List<SchBasePoint> getByVehicleCode(String search) {
LambdaQueryWrapper<SchBasePoint> lam = new QueryWrapper<SchBasePoint>().lambda();
lam.eq(SchBasePoint::getVehicle_code, search);
return list(lam);
}
} }

View File

@@ -185,7 +185,7 @@ public class TabletingInTask extends AbstractTask {
Map<String, Object> invObj = defaultPdaBuildParam.doBuildInvObj(param, startPoint, sectattr); Map<String, Object> invObj = defaultPdaBuildParam.doBuildInvObj(param, startPoint, sectattr);
String invId = rawAssistIStorService.insertDtl(invObj); String invId = rawAssistIStorService.insertDtl(invObj);
// 2 调用分配 // 2 调用分配
Map<String, Object> divObj = defaultPdaBuildParam.buildDivStructData(param, sectattr, invId); Map<String, Object> divObj = defaultPdaBuildParam.buildDivStructData(param, sectattr, invId, true);
rawAssistIStorService.divStruct(divObj); rawAssistIStorService.divStruct(divObj);
// 3 创建任务 // 3 创建任务
Map<String, Object> jsonMst = defaultPdaBuildParam.buildTaskData(startPoint, invId); Map<String, Object> jsonMst = defaultPdaBuildParam.buildTaskData(startPoint, invId);

View File

@@ -34,7 +34,8 @@ public enum IOSEnum {
IN_BILL_TYPE(MapOf.of( "手工入库", "0009", IN_BILL_TYPE(MapOf.of( "手工入库", "0009",
"原辅料入库", "0001", "原辅料入库", "0001",
"剩料回库", "0002", "剩料回库", "0002",
"中间站入库", "0003" "中间站入库", "0003",
"直接入库", "0004"
)), )),
// 出库业务类型 // 出库业务类型

View File

@@ -665,6 +665,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
JSONObject jsonIvt = new JSONObject(); JSONObject jsonIvt = new JSONObject();
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_CANUSE); jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_CANUSE);
jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code()); jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
jsonIvt.put("bag_code", ioStorInvDis.getBag_code());
jsonIvt.put("material_id", ioStorInvDis.getMaterial_id()); jsonIvt.put("material_id", ioStorInvDis.getMaterial_id());
jsonIvt.put("pcsn", ioStorInvDis.getPcsn()); jsonIvt.put("pcsn", ioStorInvDis.getPcsn());
jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id()); jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id());