add:手持入库确认
This commit is contained in:
@@ -51,4 +51,11 @@ public interface IMdMeMaterialbaseService extends IService<MdMeMaterialbase> {
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
void materialSync(JSONObject whereJson);
|
void materialSync(JSONObject whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码获取物料
|
||||||
|
* @param material_code 物料编码
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
MdMeMaterialbase getByCode(String material_code);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,4 +44,11 @@ public interface IMdPbMeasureunitService extends IService<MdPbMeasureunit> {
|
|||||||
*/
|
*/
|
||||||
void delete(Set<String> ids);
|
void delete(Set<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码查询
|
||||||
|
* @param unit_code 编码
|
||||||
|
* @return 实体类
|
||||||
|
*/
|
||||||
|
MdPbMeasureunit getByCode(String unit_code);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,4 +43,11 @@ public interface IMdPbStoragevehicleinfoService extends IService<MdPbStoragevehi
|
|||||||
* @param ids 载具标识集合
|
* @param ids 载具标识集合
|
||||||
*/
|
*/
|
||||||
void delete(Set<String> ids);
|
void delete(Set<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码获取载具
|
||||||
|
* @param storagevehicle_code 载具编码
|
||||||
|
* @return 实体类
|
||||||
|
*/
|
||||||
|
MdPbStoragevehicleinfo getByCode(String storagevehicle_code);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,4 +143,16 @@ public class MdMeMaterialbaseServiceImpl extends ServiceImpl<MdMeMaterialbaseMap
|
|||||||
}
|
}
|
||||||
this.saveBatch(materDaoList);
|
this.saveBatch(materDaoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MdMeMaterialbase getByCode(String material_code) {
|
||||||
|
MdMeMaterialbase one = this.getOne(
|
||||||
|
new QueryWrapper<MdMeMaterialbase>().lambda()
|
||||||
|
.eq(MdMeMaterialbase::getMaterial_code, material_code)
|
||||||
|
);
|
||||||
|
if (ObjectUtil.isEmpty(one)) {
|
||||||
|
throw new BadRequestException("物料编码为【"+material_code+"】不存在!");
|
||||||
|
}
|
||||||
|
return one;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,4 +93,16 @@ public class MdPbMeasureunitServiceImpl extends ServiceImpl<MdPbMeasureunitMappe
|
|||||||
public void delete(Set<String> ids) {
|
public void delete(Set<String> ids) {
|
||||||
this.baseMapper.deleteBatchIds(ids);
|
this.baseMapper.deleteBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MdPbMeasureunit getByCode(String unit_code) {
|
||||||
|
MdPbMeasureunit one = this.getOne(
|
||||||
|
new QueryWrapper<MdPbMeasureunit>().lambda()
|
||||||
|
.eq(MdPbMeasureunit::getUnit_code, unit_code)
|
||||||
|
);
|
||||||
|
if (ObjectUtil.isEmpty(one)) {
|
||||||
|
throw new BadRequestException("计量单位编码为【"+unit_code+"】不存在!");
|
||||||
|
}
|
||||||
|
return one;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,4 +99,16 @@ public class MdPbStoragevehicleinfoServiceImpl extends ServiceImpl<MdPbStorageve
|
|||||||
public void delete(Set<String> ids) {
|
public void delete(Set<String> ids) {
|
||||||
this.baseMapper.deleteBatchIds(ids);
|
this.baseMapper.deleteBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MdPbStoragevehicleinfo getByCode(String storagevehicle_code) {
|
||||||
|
MdPbStoragevehicleinfo one = this.getOne(
|
||||||
|
new QueryWrapper<MdPbStoragevehicleinfo>().lambda()
|
||||||
|
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code, storagevehicle_code)
|
||||||
|
);
|
||||||
|
if (ObjectUtil.isEmpty(one)) {
|
||||||
|
throw new BadRequestException("载具编码为【"+storagevehicle_code+"】的载具不存在!");
|
||||||
|
}
|
||||||
|
return one;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package org.nl.wms.pda.ios_manage.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaIgnore;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.common.logging.annotation.Log;
|
||||||
|
import org.nl.wms.pda.ios_manage.service.PdaIosInService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 手持入库确认 控制层
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Liuxy
|
||||||
|
* @since 2025-06-05
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/pda/iosIn")
|
||||||
|
@Slf4j
|
||||||
|
public class PdaIosInController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PdaIosInService pdaIosInService;
|
||||||
|
|
||||||
|
@PostMapping("/sweepCode")
|
||||||
|
@Log("扫码解析")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> sweepCode(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(pdaIosInService.sweepCode(whereJson),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/groupPlate")
|
||||||
|
@Log("组盘")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> groupPlate(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(pdaIosInService.groupPlate(whereJson),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getPlateDtl")
|
||||||
|
@Log("查询明细")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> getPlateDtl(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(pdaIosInService.getPlateDtl(whereJson),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/deleteDtl")
|
||||||
|
@Log("删除明细")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> deleteDtl(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(pdaIosInService.deleteDtl(whereJson),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getSect")
|
||||||
|
@Log("获取库区")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> getSect() {
|
||||||
|
return new ResponseEntity<>(pdaIosInService.getSect(),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/confirmIn")
|
||||||
|
@Log("入库确认")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> confirmIn(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(pdaIosInService.confirmIn(whereJson),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package org.nl.wms.pda.ios_manage.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.nl.wms.pda.util.PdaResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 手持IOS 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Liuxy
|
||||||
|
* @since 2025-06-05
|
||||||
|
*/
|
||||||
|
public interface PdaIosInService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param whereJson {
|
||||||
|
* code: 二维码内容
|
||||||
|
* }
|
||||||
|
* @return PdaResponse
|
||||||
|
*/
|
||||||
|
PdaResponse sweepCode(JSONObject whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组盘
|
||||||
|
* @param whereJson {
|
||||||
|
* storagevehicle_code: 载具编码
|
||||||
|
* group_id: 组盘记录id
|
||||||
|
* }
|
||||||
|
* @return PdaResponse
|
||||||
|
*/
|
||||||
|
PdaResponse groupPlate(JSONObject whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询明细
|
||||||
|
* @param whereJson {
|
||||||
|
* storagevehicle_code : 载具编码
|
||||||
|
* }
|
||||||
|
* @return PdaResponse
|
||||||
|
*/
|
||||||
|
PdaResponse getPlateDtl(JSONObject whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除明细
|
||||||
|
* @param whereJson {
|
||||||
|
* group_id: 组盘标识
|
||||||
|
* material_code: 物料编码
|
||||||
|
* material_name: 物料名称
|
||||||
|
* pcsn: 批次
|
||||||
|
* qty: 数量
|
||||||
|
* qty_unit_name: 单位
|
||||||
|
* }
|
||||||
|
* @return PdaResponse
|
||||||
|
*/
|
||||||
|
PdaResponse deleteDtl(JSONObject whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询库区
|
||||||
|
* @return PdaResponse
|
||||||
|
*/
|
||||||
|
PdaResponse getSect();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库确认
|
||||||
|
* @param whereJson {
|
||||||
|
* storagevehicle_code:载具编码
|
||||||
|
* point_code:点位编码
|
||||||
|
* sect_id:库区
|
||||||
|
* }
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PdaResponse confirmIn(JSONObject whereJson);
|
||||||
|
}
|
||||||
@@ -0,0 +1,348 @@
|
|||||||
|
package org.nl.wms.pda.ios_manage.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
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.pda.ios_manage.service.PdaIosInService;
|
||||||
|
import org.nl.wms.pda.util.PdaResponse;
|
||||||
|
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||||
|
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||||
|
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
||||||
|
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.IOStorInvDtl;
|
||||||
|
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDtlMapper;
|
||||||
|
import org.nl.wms.warehouse_management.service.dao.mapper.MdPbGroupplateMapper;
|
||||||
|
import org.nl.wms.warehouse_management.service.dto.IOStorInvDisDto;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 手持IOS 实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Liuxy
|
||||||
|
* @since 2025-06-05
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PdaIosInServiceImpl implements PdaIosInService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组盘记录mapper
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private MdPbGroupplateMapper mdPbGroupplateMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组盘记录服务
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基础物料服务
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private IMdMeMaterialbaseService iMdMeMaterialbaseService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计量单位服务
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private IMdPbMeasureunitService iMdPbMeasureunitService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 载具服务
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private IMdPbStoragevehicleinfoService iMdPbStoragevehicleinfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 库区服务
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private ISectattrService iSectattrService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库服务
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private IRawAssistIStorService iRawAssistIStorService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库明细服务
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private IOStorInvDtlMapper ioStorInvDtlMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public PdaResponse sweepCode(JSONObject whereJson) {
|
||||||
|
// 解析二维码内容:"wl0001##pc050401##1000##kg##dj000001##01"
|
||||||
|
String code = whereJson.getString("code");
|
||||||
|
String[] split = code.split("##");
|
||||||
|
// 物料编码
|
||||||
|
String material_code = split[0];
|
||||||
|
// 批次
|
||||||
|
String pcsn = split[1];
|
||||||
|
// 数量
|
||||||
|
String qty = split[2];
|
||||||
|
// 计量单位
|
||||||
|
String unit_code = split[3];
|
||||||
|
// 单据号
|
||||||
|
String ext_code = split[4];
|
||||||
|
// 业务类型
|
||||||
|
String ext_type = split[5];
|
||||||
|
|
||||||
|
// 校验
|
||||||
|
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(material_code);
|
||||||
|
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getByCode(unit_code);
|
||||||
|
GroupPlate groupDao = iMdPbGroupplateService.getOne(
|
||||||
|
new QueryWrapper<GroupPlate>().lambda()
|
||||||
|
.eq(GroupPlate::getMaterial_id, materDao.getMaterial_id())
|
||||||
|
.eq(GroupPlate::getPcsn, pcsn)
|
||||||
|
.eq(GroupPlate::getQty, qty)
|
||||||
|
.eq(GroupPlate::getQty_unit_id, unitDao.getMeasure_unit_id())
|
||||||
|
.eq(GroupPlate::getExt_code, ext_code)
|
||||||
|
.eq(GroupPlate::getExt_type, ext_type)
|
||||||
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("生成"))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(groupDao)) {
|
||||||
|
// 插入组盘记录表
|
||||||
|
groupDao = new GroupPlate();
|
||||||
|
groupDao.setGroup_id(IdUtil.getStringId());
|
||||||
|
groupDao.setMaterial_id(materDao.getMaterial_id());
|
||||||
|
groupDao.setPcsn(pcsn);
|
||||||
|
groupDao.setQty_unit_id(unitDao.getMeasure_unit_id());
|
||||||
|
groupDao.setQty_unit_name(unitDao.getUnit_name());
|
||||||
|
groupDao.setQty(BigDecimal.valueOf(Double.parseDouble(qty)));
|
||||||
|
groupDao.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("生成"));
|
||||||
|
groupDao.setExt_code(ext_code);
|
||||||
|
groupDao.setExt_type(ext_type);
|
||||||
|
groupDao.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||||
|
groupDao.setCreate_name(SecurityUtils.getCurrentUsername());
|
||||||
|
groupDao.setCreate_time(DateUtil.now());
|
||||||
|
iMdPbGroupplateService.save(groupDao);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 组织返回数据
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("group_id", groupDao.getGroup_id());
|
||||||
|
result.put("material_code", material_code);
|
||||||
|
result.put("pcsn", pcsn);
|
||||||
|
result.put("qty", qty);
|
||||||
|
result.put("qty_unit_name", unitDao.getUnit_name());
|
||||||
|
return PdaResponse.requestParamOk(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public PdaResponse groupPlate(JSONObject whereJson) {
|
||||||
|
// 校验载具
|
||||||
|
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(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")+"】");
|
||||||
|
}
|
||||||
|
// 校验组盘物料批次是否一样
|
||||||
|
List<GroupPlate> plateDaoList = iMdPbGroupplateService.list(
|
||||||
|
new QueryWrapper<GroupPlate>().lambda()
|
||||||
|
.eq(GroupPlate::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
|
||||||
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
|
||||||
|
);
|
||||||
|
if (ObjectUtil.isNotEmpty(plateDaoList)) {
|
||||||
|
boolean is_like = plateDaoList.stream()
|
||||||
|
.allMatch(row -> row.getMaterial_id().equals(groupDao.getMaterial_id()) &&
|
||||||
|
row.getPcsn().equals(groupDao.getPcsn())
|
||||||
|
);
|
||||||
|
if (!is_like) {
|
||||||
|
throw new BadRequestException("当前托盘所绑物料批次与当前组盘物料批次不一致!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新数据
|
||||||
|
groupDao.setStoragevehicle_code(vehicleDao.getStoragevehicle_code());
|
||||||
|
groupDao.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("组盘"));
|
||||||
|
iMdPbGroupplateService.updateById(groupDao);
|
||||||
|
return PdaResponse.requestOk();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PdaResponse getPlateDtl(JSONObject whereJson) {
|
||||||
|
return PdaResponse.requestParamOk(mdPbGroupplateMapper.getDtl(whereJson));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public PdaResponse deleteDtl(JSONObject whereJson) {
|
||||||
|
iMdPbGroupplateService.removeById(whereJson.getString("group_id"));
|
||||||
|
return PdaResponse.requestOk();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PdaResponse getSect() {
|
||||||
|
List<Sectattr> sectList = iSectattrService.list(
|
||||||
|
new QueryWrapper<Sectattr>().lambda()
|
||||||
|
.eq(Sectattr::getIs_delete, IOSConstant.IS_DELETE_NO)
|
||||||
|
.eq(Sectattr::getIs_used, IOSConstant.IS_DELETE_YES)
|
||||||
|
);
|
||||||
|
return PdaResponse.requestParamOk(sectList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public PdaResponse confirmIn(JSONObject whereJson) {
|
||||||
|
// 组织新增数据
|
||||||
|
Map<String, Object> jsonMst = organizeInsertData(whereJson);
|
||||||
|
// 调用服务新增数据
|
||||||
|
String iostorinv_id = iRawAssistIStorService.insertDtl(jsonMst);
|
||||||
|
// 组织分配数据
|
||||||
|
whereJson.put("iostorinv_id",iostorinv_id);
|
||||||
|
Map<String, Object> jsonDtl = organizeDivData(whereJson);
|
||||||
|
// 调用分配
|
||||||
|
iRawAssistIStorService.divStruct(jsonDtl);
|
||||||
|
// 下发任务
|
||||||
|
sendTask(whereJson);
|
||||||
|
return PdaResponse.requestOk();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织入库插入数据
|
||||||
|
* @param whereJson {
|
||||||
|
* storagevehicle_code:载具编码
|
||||||
|
* point_code:点位编码
|
||||||
|
* sect_id:库区
|
||||||
|
* }
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
private Map<String, Object> organizeInsertData(JSONObject whereJson) {
|
||||||
|
// 查询组盘明细
|
||||||
|
List<GroupPlate> plateDaoList = iMdPbGroupplateService.list(
|
||||||
|
new QueryWrapper<GroupPlate>().lambda()
|
||||||
|
.eq(GroupPlate::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
|
||||||
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
|
||||||
|
);
|
||||||
|
if (ObjectUtil.isEmpty(plateDaoList)) {
|
||||||
|
throw new BadRequestException("当前没有可入库的物料!");
|
||||||
|
}
|
||||||
|
// 总数量
|
||||||
|
Double total_qty = plateDaoList.stream()
|
||||||
|
.map(row -> row.getQty().doubleValue())
|
||||||
|
.reduce(Double::sum).orElse(0.0);
|
||||||
|
|
||||||
|
// 查询库区
|
||||||
|
Sectattr sectDao = iSectattrService.getById(whereJson.getString("sect_id"));
|
||||||
|
// 组织主表数据
|
||||||
|
Map<String, Object> jsonMst = new HashMap<>();
|
||||||
|
jsonMst.put("stor_id", sectDao.getStor_id());
|
||||||
|
jsonMst.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
||||||
|
jsonMst.put("total_qty", total_qty);
|
||||||
|
jsonMst.put("detail_count", 1);
|
||||||
|
jsonMst.put("bill_type", IOSEnum.BILL_TYPE.code("生产入库"));
|
||||||
|
jsonMst.put("biz_date", DateUtil.now());
|
||||||
|
// 组织明细数据
|
||||||
|
ArrayList<HashMap> tableData = new ArrayList<>();
|
||||||
|
HashMap<String, String> dtl = new HashMap<>();
|
||||||
|
GroupPlate plateDao = plateDaoList.get(0);
|
||||||
|
dtl.put("storagevehicle_code", plateDao.getStoragevehicle_code());
|
||||||
|
dtl.put("material_id", plateDao.getMaterial_id());
|
||||||
|
dtl.put("pcsn", plateDao.getPcsn());
|
||||||
|
dtl.put("qty_unit_id", plateDao.getQty_unit_id());
|
||||||
|
dtl.put("qty_unit_name", plateDao.getQty_unit_name());
|
||||||
|
dtl.put("qty", String.valueOf(total_qty));
|
||||||
|
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(plateDao.getMaterial_id());
|
||||||
|
dtl.put("material_code", materDao.getMaterial_code());
|
||||||
|
dtl.put("material_name", materDao.getMaterial_name());
|
||||||
|
dtl.put("plan_qty", String.valueOf(total_qty));
|
||||||
|
// 调用新增
|
||||||
|
tableData.add(dtl);
|
||||||
|
jsonMst.put("tableData",tableData);
|
||||||
|
return jsonMst;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织分配数据
|
||||||
|
* @param whereJson {
|
||||||
|
* iostorinv_id
|
||||||
|
* sect_id
|
||||||
|
* }
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
private Map<String, Object> organizeDivData(JSONObject whereJson) {
|
||||||
|
// 查询库区
|
||||||
|
Sectattr sectDao = iSectattrService.getById(whereJson.getString("sect_id"));
|
||||||
|
// 组织主数据
|
||||||
|
Map<String, Object> jsonMst = new HashMap<>();
|
||||||
|
jsonMst.put("checked", true);
|
||||||
|
jsonMst.put("sect_id", sectDao.getSect_id());
|
||||||
|
jsonMst.put("stor_id", sectDao.getStor_id());
|
||||||
|
// 组织明细数据
|
||||||
|
IOStorInvDtl dtlDao = ioStorInvDtlMapper.selectOne(
|
||||||
|
new QueryWrapper<IOStorInvDtl>().lambda()
|
||||||
|
.eq(IOStorInvDtl::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||||
|
);
|
||||||
|
// 查找分配明细
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("iostorinvdtl_id",dtlDao.getIostorinvdtl_id());
|
||||||
|
List<IOStorInvDisDto> disDtl = iRawAssistIStorService.getDisDtl(map);
|
||||||
|
// 类型转换
|
||||||
|
ArrayList<LinkedHashMap> tableMater = new ArrayList<>();
|
||||||
|
disDtl.forEach(item -> {
|
||||||
|
tableMater.add(JSONObject.parseObject(JSONObject.toJSONString(item), LinkedHashMap.class));
|
||||||
|
});
|
||||||
|
jsonMst.put("tableMater", tableMater);
|
||||||
|
|
||||||
|
return jsonMst;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下发任务
|
||||||
|
* @param whereJson {
|
||||||
|
* storagevehicle_code:载具编码
|
||||||
|
* point_code:点位编码
|
||||||
|
* sect_id:库区
|
||||||
|
* iostorinv_id: id
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
private void sendTask(JSONObject whereJson) {
|
||||||
|
// 组织主数据
|
||||||
|
Map<String, Object> jsonMst = new HashMap<>();
|
||||||
|
jsonMst.put("point_code", whereJson.getString("point_code"));
|
||||||
|
// 组织明细数据
|
||||||
|
IOStorInvDtl dtlDao = ioStorInvDtlMapper.selectOne(
|
||||||
|
new QueryWrapper<IOStorInvDtl>().lambda()
|
||||||
|
.eq(IOStorInvDtl::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||||
|
);
|
||||||
|
// 查找分配明细
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("iostorinvdtl_id",dtlDao.getIostorinvdtl_id());
|
||||||
|
List<IOStorInvDisDto> disDtl = iRawAssistIStorService.getDisDtl(map);
|
||||||
|
// 类型转换
|
||||||
|
ArrayList<LinkedHashMap> tableMater = new ArrayList<>();
|
||||||
|
disDtl.forEach(item -> {
|
||||||
|
tableMater.add(JSONObject.parseObject(JSONObject.toJSONString(item), LinkedHashMap.class));
|
||||||
|
});
|
||||||
|
jsonMst.put("tableMater", tableMater);
|
||||||
|
|
||||||
|
iRawAssistIStorService.divPoint(jsonMst);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package org.nl.wms.pda.util;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 手持 返回结果
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Liuxy
|
||||||
|
* @since 2025-06-05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class PdaResponse<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 信息
|
||||||
|
*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回数据
|
||||||
|
*/
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不带数据反馈
|
||||||
|
* @return ErpResponse
|
||||||
|
*/
|
||||||
|
public static PdaResponse requestOk() {
|
||||||
|
return PdaResponse.builder()
|
||||||
|
.message("操作成功!")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 带数据反馈
|
||||||
|
* @return ErpResponse
|
||||||
|
*/
|
||||||
|
public static <T> PdaResponse requestParamOk(T data) {
|
||||||
|
return PdaResponse.builder()
|
||||||
|
.message("操作成功!")
|
||||||
|
.data(data)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -27,11 +27,14 @@ public enum IOSEnum {
|
|||||||
//单据状态
|
//单据状态
|
||||||
BILL_STATUS(MapOf.of("生成","10", "分配中", "20", "分配完", "30", "完成", "99")),
|
BILL_STATUS(MapOf.of("生成","10", "分配中", "20", "分配完", "30", "完成", "99")),
|
||||||
|
|
||||||
|
// 入库业务类型
|
||||||
|
BILL_TYPE(MapOf.of("生产入库","0001", "手工入库", "0009")),
|
||||||
|
|
||||||
//入库分配明细状态
|
//入库分配明细状态
|
||||||
INBILL_DIS_STATUS(MapOf.of("生成", "00", "执行中", "01", "完成", "99")),
|
INBILL_DIS_STATUS(MapOf.of("生成", "00", "执行中", "01", "完成", "99")),
|
||||||
|
|
||||||
//组盘记录状态
|
//组盘记录状态
|
||||||
GROUP_PLATE_STATUS(MapOf.of("组盘", "01", "入库", "02", "出库", "03")),
|
GROUP_PLATE_STATUS(MapOf.of("生成", "00", "组盘", "01", "入库", "02", "出库", "03")),
|
||||||
|
|
||||||
// 锁类型
|
// 锁类型
|
||||||
LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2"
|
LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2"
|
||||||
|
|||||||
@@ -76,4 +76,14 @@ public class GroupPlate implements Serializable {
|
|||||||
* 组盘时间
|
* 组盘时间
|
||||||
*/
|
*/
|
||||||
private String create_time;
|
private String create_time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 来源单据号
|
||||||
|
*/
|
||||||
|
private String ext_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 来源单据类型
|
||||||
|
*/
|
||||||
|
private String ext_type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
package org.nl.wms.warehouse_management.service.dao.mapper;
|
package org.nl.wms.warehouse_management.service.dao.mapper;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 组盘记录表 Mapper 接口
|
* 组盘记录表 Mapper 接口
|
||||||
@@ -13,4 +17,11 @@ import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
|||||||
*/
|
*/
|
||||||
public interface MdPbGroupplateMapper extends BaseMapper<GroupPlate> {
|
public interface MdPbGroupplateMapper extends BaseMapper<GroupPlate> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取明细
|
||||||
|
* @param whereJson {
|
||||||
|
* storagevehicle_code : 载具编码
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
List<JSONObject> getDtl(@Param("param") JSONObject whereJson);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,20 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.nl.wms.warehouse_management.service.dao.mapper.MdPbGroupplateMapper">
|
<mapper namespace="org.nl.wms.warehouse_management.service.dao.mapper.MdPbGroupplateMapper">
|
||||||
|
|
||||||
|
<select id="getDtl" resultType="com.alibaba.fastjson.JSONObject">
|
||||||
|
SELECT
|
||||||
|
late.*,
|
||||||
|
mater.material_code,
|
||||||
|
mater.material_name
|
||||||
|
FROM
|
||||||
|
md_pb_groupplate late
|
||||||
|
LEFT JOIN md_me_materialbase mater ON mater.material_id = late.material_id
|
||||||
|
<where>
|
||||||
|
late.status = '01'
|
||||||
|
<if test="param.storagevehicle_code != null and param.storagevehicle_code != ''">
|
||||||
|
AND
|
||||||
|
late.storagevehicle_code = #{param.storagevehicle_code}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|||||||
public String insertDtl(Map whereJson) {
|
public String insertDtl(Map whereJson) {
|
||||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableData");
|
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableData");
|
||||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
double total_qty = 0;
|
double total_qty = 0;
|
||||||
JSONObject io_mst = new JSONObject();
|
JSONObject io_mst = new JSONObject();
|
||||||
@@ -630,7 +630,9 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|||||||
List<Structattr> structattrList = iStructattrService.list(new LambdaQueryWrapper<>(Structattr.class)
|
List<Structattr> structattrList = iStructattrService.list(new LambdaQueryWrapper<>(Structattr.class)
|
||||||
.eq(Structattr::getSect_id,sect_id)
|
.eq(Structattr::getSect_id,sect_id)
|
||||||
.eq(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
|
.eq(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||||
.isNull(Structattr::getStoragevehicle_code).or().eq(Structattr::getStoragevehicle_code,"")
|
.and(row -> row.isNull(Structattr::getStoragevehicle_code).or(
|
||||||
|
it -> it.eq(Structattr::getStoragevehicle_code,"")
|
||||||
|
))
|
||||||
);
|
);
|
||||||
if (ObjectUtil.isEmpty(structattrList)){
|
if (ObjectUtil.isEmpty(structattrList)){
|
||||||
throw new BadRequestException("该库区没有仓位");
|
throw new BadRequestException("该库区没有仓位");
|
||||||
|
|||||||
Reference in New Issue
Block a user