add:增加手持手工入库、手工出库

This commit is contained in:
2025-12-01 10:29:17 +08:00
parent d14d7c40c1
commit 38862db0fb
8 changed files with 185 additions and 33 deletions

View File

@@ -273,6 +273,11 @@
(attr.struct_code LIKE CONCAT('%', #{params.struct_code}, '%')
</if>
<if test="params.storagevehicle_code != null and params.storagevehicle_code != ''">
AND
ext.storagevehicle_code = #{params.storagevehicle_code}
</if>
<if test="params.pcsn != null and params.pcsn != ''">
AND
ext.pcsn LIKE #{params.pcsn}

View File

@@ -74,6 +74,13 @@ public class PdaIosInController {
return new ResponseEntity<>(pdaIosInService.confirmIn(whereJson),HttpStatus.OK);
}
@PostMapping("/handIn")
@Log("手工入库确认")
@SaIgnore
public ResponseEntity<Object> handIn(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(pdaIosInService.handIn(whereJson),HttpStatus.OK);
}
@PostMapping("/getMaterCode")
@Log("获取物料信息")
@SaIgnore

View File

@@ -46,4 +46,11 @@ public class PdaIosOutController {
return new ResponseEntity<>(pdaIosOutService.confirm(whereJson), HttpStatus.OK);
}
@PostMapping("/handOut")
@Log("手工出库")
@SaIgnore
public ResponseEntity<Object> handOut(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(pdaIosOutService.handOut(whereJson), HttpStatus.OK);
}
}

View File

@@ -95,4 +95,14 @@ public interface PdaIosInService {
* @return PdaResponse
*/
PdaResponse groupPlateTwo(JSONObject whereJson);
/**
* 入库确认
* @param whereJson {
* storagevehicle_code载具编码
* point_code点位编码
* }
* @return PdaResponse
*/
PdaResponse handIn(JSONObject whereJson);
}

View File

@@ -32,9 +32,20 @@ public interface PdaIosOutService {
*/
PdaResponse confirm(JSONObject whereJson);
/**
* 手工出库确认
* @param whereJson {
* storagevehicle_code 载具码
* point_code 点位编码
* }
* @return PdaResponse
*/
PdaResponse handOut(JSONObject whereJson);
/**
* 创建出库单并下发
* @param whereJson 、
*/
void createIos(JSONObject whereJson);
}

View File

@@ -7,14 +7,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
import org.nl.wms.basedata_manage.service.IMdPbMeasureunitService;
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService;
import org.nl.wms.basedata_manage.service.ISectattrService;
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
import org.nl.wms.basedata_manage.service.dao.MdPbMeasureunit;
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo;
import org.nl.wms.basedata_manage.service.dao.Sectattr;
import org.nl.wms.basedata_manage.service.*;
import org.nl.wms.basedata_manage.service.dao.*;
import org.nl.wms.pda.ios_manage.service.PdaIosInService;
import org.nl.wms.pda.util.PdaResponse;
import org.nl.wms.sch_manage.service.ISchBasePointService;
@@ -100,6 +94,12 @@ public class PdaIosInServiceImpl implements PdaIosInService {
@Autowired
private ISchBasePointService iSchBasePointService;
/**
* 仓位服务
*/
@Autowired
private IStructattrService iStructattrService;
@Override
@Transactional
public PdaResponse sweepCode(JSONObject whereJson) {
@@ -175,13 +175,13 @@ public class PdaIosInServiceImpl implements PdaIosInService {
).stream()
.anyMatch(row -> row.getStatus().equals(IOSEnum.GROUP_PLATE_STATUS.code("入库")));
if (is_in) {
throw new BadRequestException("当前载具已经入库,请检查数据!【"+whereJson.getString("storagevehicle_code")+"");
throw new BadRequestException("当前载具已经入库,请检查数据!【" + whereJson.getString("storagevehicle_code") + "");
}
// 校验组盘记录
GroupPlate groupDao = iMdPbGroupplateService.getById(whereJson.getString("group_id"));
if (!groupDao.getStatus().equals(IOSEnum.GROUP_PLATE_STATUS.code("生成"))) {
throw new BadRequestException("当前信息已经组盘!【"+whereJson.getString("group_id")+"");
throw new BadRequestException("当前信息已经组盘!【" + whereJson.getString("group_id") + "");
}
// 校验组盘物料、批次、原单据号、原单据类型是否一样
@@ -237,7 +237,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
// 判断点位编码是否存在
SchBasePoint point_code = iSchBasePointService.getById(whereJson.getString("point_code"));
if (ObjectUtil.isEmpty(point_code)) {
throw new BadRequestException("当前入库点位不存在【"+point_code+"");
throw new BadRequestException("当前入库点位不存在【" + point_code + "");
}
// 组织新增数据
@@ -245,7 +245,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
// 调用服务新增数据
String iostorinv_id = iRawAssistIStorService.insertDtl(jsonMst);
// 组织分配数据
whereJson.put("iostorinv_id",iostorinv_id);
whereJson.put("iostorinv_id", iostorinv_id);
Map<String, Object> jsonDtl = organizeDivData(whereJson);
// 调用分配
iRawAssistIStorService.divStruct(jsonDtl);
@@ -265,7 +265,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
// 校验载具
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(whereJson.getString("storagevehicle_code"));
if (ObjectUtil.isEmpty(vehicleDao)) {
throw new BadRequestException("载具不存在!【"+whereJson.getString("storagevehicle_code")+"");
throw new BadRequestException("载具不存在!【" + whereJson.getString("storagevehicle_code") + "");
}
// 校验此载具是否有入库状态的组盘信息
boolean is_in = iMdPbGroupplateService.list(
@@ -274,7 +274,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
).stream()
.anyMatch(row -> row.getStatus().equals(IOSEnum.GROUP_PLATE_STATUS.code("入库")));
if (is_in) {
throw new BadRequestException("当前载具已经入库,请检查数据!【"+whereJson.getString("storagevehicle_code")+"");
throw new BadRequestException("当前载具已经入库,请检查数据!【" + whereJson.getString("storagevehicle_code") + "");
}
// 获取物料信息
@@ -317,13 +317,40 @@ public class PdaIosInServiceImpl implements PdaIosInService {
return PdaResponse.requestOk();
}
@Override
@Transactional
public PdaResponse handIn(JSONObject whereJson) {
// 判断当前仓位
Structattr attrDao = iStructattrService.getByCode(whereJson.getString("point_code"));
if (!attrDao.getLock_type().equals(IOSEnum.LOCK_TYPE.code("未锁定"))) {
throw new BadRequestException("当前点位已被锁定!");
}
if (ObjectUtil.isNotEmpty(attrDao.getStoragevehicle_code())) {
throw new BadRequestException("当前点位已存在托盘!【" + attrDao.getStoragevehicle_code() + "");
}
// 组织新增数据
Map<String, Object> jsonMst = organizeInsertData(whereJson);
// 调用服务新增数据
String iostorinv_id = iRawAssistIStorService.insertDtl(jsonMst);
// 组织分配数据
whereJson.put("iostorinv_id", iostorinv_id);
whereJson.put("struct_code", attrDao.getStruct_code());
Map<String, Object> jsonDtl = organizeDivData(whereJson);
// 调用分配
iRawAssistIStorService.divStruct(jsonDtl);
// 调用完成
iRawAssistIStorService.confirm(whereJson);
return PdaResponse.requestOk();
}
/**
* 组织入库插入数据
*
* @param whereJson {
* storagevehicle_code载具编码
* point_code点位编码
* sect_id库区
* }
* }
* @return Map<String, Object>
*/
private Map<String, Object> organizeInsertData(JSONObject whereJson) {
@@ -370,16 +397,17 @@ public class PdaIosInServiceImpl implements PdaIosInService {
dtl.put("plan_qty", String.valueOf(total_qty));
// 调用新增
tableData.add(dtl);
jsonMst.put("tableData",tableData);
jsonMst.put("tableData", tableData);
return jsonMst;
}
/**
* 组织分配数据
*
* @param whereJson {
* iostorinv_id
* sect_id
* }
* }
* @return Map<String, Object>
*/
private Map<String, Object> organizeDivData(JSONObject whereJson) {
@@ -402,7 +430,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
);
// 查找分配明细
Map<String, Object> map = new HashMap<>();
map.put("iostorinvdtl_id",dtlDao.getIostorinvdtl_id());
map.put("iostorinvdtl_id", dtlDao.getIostorinvdtl_id());
List<IOStorInvDisDto> disDtl = iRawAssistIStorService.getDisDtl(map);
// 类型转换
ArrayList<LinkedHashMap> tableMater = new ArrayList<>();
@@ -424,12 +452,13 @@ public class PdaIosInServiceImpl implements PdaIosInService {
/**
* 下发任务
*
* @param whereJson {
* storagevehicle_code载具编码
* point_code点位编码
* sect_id库区
* iostorinv_id: id
* }
* }
*/
private void sendTask(JSONObject whereJson) {
// 组织主数据
@@ -442,7 +471,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
);
// 查找分配明细
Map<String, Object> map = new HashMap<>();
map.put("iostorinvdtl_id",dtlDao.getIostorinvdtl_id());
map.put("iostorinvdtl_id", dtlDao.getIostorinvdtl_id());
List<IOStorInvDisDto> disDtl = iRawAssistIStorService.getDisDtl(map);
// 类型转换
ArrayList<LinkedHashMap> tableMater = new ArrayList<>();

View File

@@ -8,12 +8,10 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.nl.common.exception.BadRequestException;
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
import org.nl.wms.basedata_manage.service.IStructattrService;
import org.nl.wms.basedata_manage.service.*;
import org.nl.wms.basedata_manage.service.dao.*;
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
import org.nl.wms.pda.ios_manage.service.PdaIosOutService;
import org.nl.wms.pda.util.PdaResponse;
import org.nl.wms.sch_manage.enums.TaskEnum;
@@ -119,6 +117,12 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
@Resource
private IOutBillService iOutBillService;
/**
* 库区服务
*/
@Autowired
private ISectattrService iSectattrService;
@Override
public PdaResponse getDtl(JSONObject whereJson) {
return PdaResponse.requestParamOk(mdPbStoragevehicleextMapper.getIosDtl(whereJson));
@@ -134,7 +138,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
}
// 获取出入库单明细信息
IOStorInvDis disDao = ioStorInvDisMapper.selectById(pointDao.getIos_id());
if(ObjectUtil.isEmpty(disDao)) {
if (ObjectUtil.isEmpty(disDao)) {
throw new BadRequestException("未查询到出库单分配明细!");
}
IOStorInvDtl dtlDao = ioStorInvDtlMapper.selectById(disDao.getIostorinvdtl_id());
@@ -163,10 +167,10 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
// 删除组盘信息
groupPlateMapper.delete(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getPcsn,disDao.getPcsn())
.eq(GroupPlate::getMaterial_id,disDao.getMaterial_id())
.eq(GroupPlate::getStoragevehicle_code,disDao.getStoragevehicle_code())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getPcsn, disDao.getPcsn())
.eq(GroupPlate::getMaterial_id, disDao.getMaterial_id())
.eq(GroupPlate::getStoragevehicle_code, disDao.getStoragevehicle_code())
);
} else {
// ------剩余回库------
@@ -205,13 +209,92 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
// 更新起点绑定id
iSchBasePointService.update(
new UpdateWrapper<SchBasePoint>().lambda()
.set(SchBasePoint::getIos_id, null)
.eq(SchBasePoint::getPoint_code, pointDao.getPoint_code())
.set(SchBasePoint::getIos_id, null)
.eq(SchBasePoint::getPoint_code, pointDao.getPoint_code())
);
}
return PdaResponse.requestOk();
}
@Override
@Transactional
public PdaResponse handOut(JSONObject whereJson) {
JSONObject jsonMst = new JSONObject();
jsonMst.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
jsonMst.put("bill_type", IOSEnum.BILL_TYPE_OUT.code("手工出库"));
jsonMst.put("biz_date", DateUtil.now());
jsonMst.put("detail_count", 1);
BsrealStorattr storDao = iBsrealStorattrService.getById(IOSConstant.STOR_ID);
jsonMst.put("stor_id", storDao.getStor_id());
jsonMst.put("stor_code", storDao.getStor_code());
jsonMst.put("stor_name", storDao.getStor_name());
// --------------- 组织明细数据 ---------------
JSONArray tableData = new JSONArray();
JSONObject jsonDtl = new JSONObject();
// 查询库存信息
MdPbStoragevehicleext ivtDao = iMdPbStoragevehicleextService.getOne(
new QueryWrapper<MdPbStoragevehicleext>().lambda()
.eq(MdPbStoragevehicleext::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
);
if (ObjectUtil.isEmpty(ivtDao)) {
throw new BadRequestException("当前载具【"+whereJson.getString("storagevehicle_code")+"】没有库存信息!");
}
jsonDtl.put("frozen_qty", ivtDao.getFrozen_qty());
// 查询物料信息
MdMeMaterialbase materialDao = iMdMeMaterialbaseService.getById(ivtDao.getMaterial_id());
jsonDtl.put("material_id", materialDao.getMaterial_id());
jsonDtl.put("material_code", materialDao.getMaterial_code());
jsonDtl.put("material_name", materialDao.getMaterial_name());
jsonDtl.put("pcsn", ivtDao.getPcsn());
jsonDtl.put("plan_qty", ivtDao.getCanuse_qty());
jsonDtl.put("qty", ivtDao.getCanuse_qty());
jsonDtl.put("qty_unit_id", ivtDao.getQty_unit_id());
jsonDtl.put("qty_unit_name", ivtDao.getQty_unit_name());
jsonDtl.put("storagevehicleext_id", ivtDao.getStoragevehicleext_id());
jsonDtl.put("storagevehicle_code", ivtDao.getStoragevehicle_code());
// 查询仓位
Structattr attrDao = iStructattrService.getByCode(whereJson.getString("point_code"));
// 判断是否被锁定
if (!attrDao.getLock_type().equals(IOSEnum.LOCK_TYPE.code("未锁定"))) {
throw new BadRequestException("当前仓位与已被锁定!");
}
// 校验此仓位上的载具是否相同
if (!attrDao.getStoragevehicle_code().equals(whereJson.getString("storagevehicle_code"))) {
throw new BadRequestException("当前仓位与当前载具不符请检查!当前仓位载具为【"+attrDao.getStoragevehicle_code()+"");
}
jsonDtl.put("sect_id", attrDao.getSect_id());
jsonDtl.put("struct_id", attrDao.getStruct_id());
jsonDtl.put("turnout_sect_code", attrDao.getSect_code());
jsonDtl.put("turnout_sect_name", attrDao.getSect_name());
jsonDtl.put("turnout_struct_code", attrDao.getStruct_code());
tableData.add(jsonDtl);
jsonMst.put("total_qty", ivtDao.getCanuse_qty());
jsonMst.put("tableData", tableData);
// 调用新增
String iostorinv_id = iOutBillService.insertDtl(jsonMst);
// --------------- 调用分配 ---------------
whereJson.put("iostorinv_id", iostorinv_id);
iOutBillService.allDiv(whereJson);
// --------------- 调用强制 ---------------
iOutBillService.confirm(whereJson);
// 删除组盘信息
groupPlateMapper.delete(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
.eq(GroupPlate::getMaterial_id, ivtDao.getMaterial_id())
.eq(GroupPlate::getPcsn, ivtDao.getPcsn())
);
return PdaResponse.requestOk();
}
@Override
@Transactional
public void createIos(JSONObject whereJson) {
@@ -263,7 +346,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
String iostorinv_id = iOutBillService.insertDtl(jsonMst);
// --------------- 调用分配 ---------------
whereJson.put("iostorinv_id",iostorinv_id);
whereJson.put("iostorinv_id", iostorinv_id);
iOutBillService.allDiv(whereJson);
// --------------- 调用下发 ---------------

View File

@@ -379,7 +379,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
struct_name = struct.getStruct_name();
} else {
Structattr structattr = iStructattrService.findById(map.get("struct_id"));
Structattr structattr = iStructattrService.getByCode(map.get("struct_code"));
MdPbStoragevehicleinfo mdPbStoragevehicleinfo = mdPbStoragevehicleinfoMapper.selectOne(new LambdaQueryWrapper<>(MdPbStoragevehicleinfo.class)
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code,map.get("storagevehicle_code"))
);