mdf:入库兼容混料
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package org.nl.wms.basedata_manage.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public
|
||||
class StrategyMater {
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_code;
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String material_id;
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String pcsn;
|
||||
/**
|
||||
* 计量单位标识
|
||||
*/
|
||||
private String qty_unit_id;
|
||||
/**
|
||||
* 组盘数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@@ -20,33 +20,10 @@ public class StrategyStructParam {
|
||||
* 仓位编码
|
||||
*/
|
||||
private String stor_code;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_code;
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String pcsn;
|
||||
|
||||
/**
|
||||
* 计量单位标识
|
||||
*/
|
||||
private String qty_unit_id;
|
||||
|
||||
/**
|
||||
* 组盘数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
|
||||
/**
|
||||
* 同步单号
|
||||
*/
|
||||
private String ext_code;
|
||||
|
||||
/**
|
||||
* 来源单据类型
|
||||
*/
|
||||
@@ -56,4 +33,15 @@ public class StrategyStructParam {
|
||||
* 出入库类型
|
||||
*/
|
||||
private String ioType;
|
||||
/**
|
||||
* 载具编码
|
||||
*/
|
||||
private String storagevehicle_code;
|
||||
|
||||
/**
|
||||
* 载具明细:混料的话则是数组
|
||||
*/
|
||||
private List<StrategyMater> strategyMaters;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
@Override
|
||||
public List<Structattr> inBoundSectDiv(StrategyStructParam param) {
|
||||
//批号,单据暂时不校验,具体业务具体校验
|
||||
Assert.noNullElements(new Object[]{param.getQty(),param.getMaterial_code(),param.getSect_code()},"请求参数不能为空");
|
||||
Assert.noNullElements(new Object[]{param.getStrategyMaters(),param.getStor_code(),param.getSect_code()},"请求参数不能为空");
|
||||
StSectStrategy one = iStSectStrategyService.getOne(new LambdaQueryWrapper<StSectStrategy>()
|
||||
.eq(StSectStrategy::getSect_code, param.getSect_code())
|
||||
.eq(StSectStrategy::getStrategy_type, StatusEnum.STRATEGY_TYPE.code("入库")));
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.StructattrVechielDto;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyMater;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.decision_manage.service.strategyConfig.decisioner.Decisioner;
|
||||
@@ -38,10 +39,12 @@ public class FIFORuleHandler extends Decisioner<StrategyStructMaterialVO, Strate
|
||||
//分配数量
|
||||
//当前条件只有id,批次
|
||||
log.info("---------执行fifo出库分配规则---------");
|
||||
BigDecimal planQty = param.getQty();
|
||||
List<StrategyMater> maters = param.getStrategyMaters();
|
||||
StrategyMater strategyMater = maters.get(0);
|
||||
BigDecimal planQty = strategyMater.getQty();
|
||||
List<StructattrVechielDto> vechielDtos =
|
||||
iStructattrService.collectVechicle(MapOf.of("material_id", param.getMaterial_id()
|
||||
, "pcsn", param.getPcsn()
|
||||
iStructattrService.collectVechicle(MapOf.of("material_id", strategyMater.getMaterial_id()
|
||||
, "pcsn", strategyMater.getPcsn()
|
||||
, "stor_code", param.getStor_code()
|
||||
, "sect_code", param.getSect_code()
|
||||
, "plan_qty", planQty
|
||||
|
||||
@@ -20,6 +20,8 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.service.*;
|
||||
import org.nl.wms.basedata_manage.service.dao.*;
|
||||
import org.nl.wms.basedata_manage.service.dto.MaterialQuery;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyMater;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.pda_manage.ios_manage.service.PdaIosInService;
|
||||
import org.nl.wms.pda_manage.util.PdaResponse;
|
||||
import org.nl.wms.sch_manage.enums.StatusEnum;
|
||||
@@ -317,15 +319,25 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
throw new BadRequestException("该库区未找到对应仓库信息,请检查");
|
||||
}
|
||||
//分配仓位
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("ioType", StatusEnum.STRATEGY_TYPE.code("入库"));
|
||||
params.put("storagevehicle_code", vehicleDao.getStoragevehicle_code());
|
||||
params.put("stor_code", storeDao.getStor_code());
|
||||
params.put("sect_code", whereJson.getString("sect_code"));
|
||||
params.put("material_code", whereJson.getString("material_code"));
|
||||
params.put("qty", whereJson.getString("qty"));
|
||||
params.put("pcsn", whereJson.getString("pcsn"));
|
||||
Structattr attrDao = iRawAssistIStorService.getStructattr(whereJson);
|
||||
StrategyMater mater = new StrategyMater();
|
||||
mater.setMaterial_code(whereJson.getString("material_code"));
|
||||
mater.setMaterial_id(whereJson.getString("material_id"));
|
||||
mater.setQty(whereJson.getBigDecimal("qty"));
|
||||
mater.setPcsn(whereJson.getString("pcsn"));
|
||||
List<StrategyMater> materss = new ArrayList<>();
|
||||
|
||||
List<Structattr> structattrs = iStructattrService.inBoundSectDiv(
|
||||
StrategyStructParam.builder()
|
||||
.ioType(StatusEnum.STRATEGY_TYPE.code("入库"))
|
||||
.sect_code(whereJson.getString("sect_code"))
|
||||
.stor_code(storeDao.getStor_code())
|
||||
.storagevehicle_code(vehicleDao.getStoragevehicle_code())
|
||||
.strategyMaters(materss)
|
||||
.build());
|
||||
if (CollectionUtils.isEmpty(structattrs)) {
|
||||
throw new BadRequestException("无可用货位");
|
||||
}
|
||||
Structattr attrDao = structattrs.get(0);
|
||||
//确定起点
|
||||
SchBasePoint schBasePoint = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, whereJson.getString("site_code")));
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.nl.wms.basedata_manage.service.ISectattrService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
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.StrategyMater;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.pda_manage.ios_manage.service.PdaIosOutService;
|
||||
@@ -52,6 +53,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -268,13 +270,18 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
BsrealStorattr storeDao = iSrealStorattrService.getById(sectattr.getStor_id());
|
||||
whereJson.put("stor_code", storeDao.getStor_code());
|
||||
whereJson.put("sect_code", sectattr.getSect_code());
|
||||
|
||||
StrategyMater mater = new StrategyMater();
|
||||
mater.setQty(BigDecimal.valueOf(qty));
|
||||
mater.setMaterial_id(whereJson.getString("material_id"));
|
||||
mater.setMaterial_code(whereJson.getString("material_code"));
|
||||
List<StrategyMater> maters = new ArrayList<>();
|
||||
maters.add(mater);
|
||||
StrategyStructParam strategyStructParam = StrategyStructParam.builder()
|
||||
.ioType(whereJson.getString(StatusEnum.STRATEGY_TYPE.code("出库")))
|
||||
.sect_code(whereJson.getString("sect_code"))
|
||||
.stor_code(whereJson.getString("stor_code"))
|
||||
.material_code(whereJson.getString("material_id"))
|
||||
.material_code(whereJson.getString("material_code"))
|
||||
.qty(BigDecimal.valueOf(qty))
|
||||
.strategyMaters(maters)
|
||||
.build();
|
||||
List<StrategyStructMaterialVO> structList = iStructattrService.outBoundSectDiv(strategyStructParam);
|
||||
if (CollectionUtils.isEmpty(structList)) {
|
||||
|
||||
@@ -56,5 +56,4 @@ public interface IInBillService extends IService<IOStorInv> {
|
||||
|
||||
List<IOStorInvDisDto> getInBillTaskDtl(Map whereJson);
|
||||
|
||||
Structattr getStructattr(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleinfoMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyMater;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.basedata_manage.service.dto.StructattrChangeDto;
|
||||
import org.nl.wms.sch_manage.enums.StatusEnum;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.StInTask;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
||||
@@ -53,6 +53,7 @@ import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author dsh
|
||||
@@ -327,11 +328,14 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
ArrayList<HashMap> rows = (ArrayList<HashMap>) param.get("tableMater");
|
||||
JSONObject mst = JSONObject.parseObject(JSON.toJSONString(param));
|
||||
HashMap<String, String> map = rows.get(0);
|
||||
String iostorinvId = map.get("iostorinv_id");
|
||||
String storagevehicleCode = map.get("storagevehicle_code");
|
||||
//判断该分配明细是否已经分配货位
|
||||
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
|
||||
List<IOStorInvDis> disList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinv_id, iostorinvId)
|
||||
.eq(IOStorInvDis::getStoragevehicle_code, storagevehicleCode)
|
||||
.isNull(IOStorInvDis::getStruct_code));
|
||||
if (ioStorInvDis ==null){
|
||||
if (CollectionUtils.isEmpty(disList)){
|
||||
throw new BadRequestException("当前明细已经分配过库位");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
@@ -346,18 +350,23 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
//是否自动分配仓位
|
||||
Boolean checked = mst.getBoolean("checked");
|
||||
if (ObjectUtil.isNotEmpty(checked) && checked) {
|
||||
param.put("qty", map.get("plan_qty"));
|
||||
param.put("material_code", map.get("material_code"));
|
||||
param.put("pcsn", map.get("pcsn"));
|
||||
param.put("ioType", StatusEnum.STRATEGY_TYPE.code("入库"));
|
||||
//根据载具进行分配货位
|
||||
List<StrategyMater> maters = new ArrayList<>();
|
||||
for (IOStorInvDis dis : disList) {
|
||||
StrategyMater mater = new StrategyMater();
|
||||
mater.setPcsn(dis.getPcsn());
|
||||
mater.setMaterial_code(dis.getMaterial_code());
|
||||
mater.setMaterial_id(dis.getMaterial_id());
|
||||
mater.setQty(dis.getPlan_qty());
|
||||
maters.add(mater);
|
||||
}
|
||||
List<Structattr> structattrs = iStructattrService.inBoundSectDiv(
|
||||
StrategyStructParam.builder()
|
||||
.ioType(param.getString("ioType"))
|
||||
.sect_code(param.getString("sect_code"))
|
||||
.stor_code(param.getString("stor_code"))
|
||||
.material_code(param.getString("material_code"))
|
||||
.qty(new BigDecimal(param.getString("qty")))
|
||||
.pcsn(param.getString("pcsn"))
|
||||
.storagevehicle_code(param.getString("storagevehicle_code"))
|
||||
.strategyMaters(maters)
|
||||
.build());
|
||||
Structattr struct = structattrs.get(0);
|
||||
sect_id = struct.getSect_id();
|
||||
@@ -386,7 +395,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
dis_map.put("struct_code", struct_code);
|
||||
dis_map.put("struct_name", struct_name);
|
||||
//锁定货位
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(map.get("iostorinv_id"));
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinvId);
|
||||
JSONObject lock_map = new JSONObject();
|
||||
lock_map.put("struct_code", struct_code);
|
||||
lock_map.put("inv_id", ioStorInv.getIostorinv_id());
|
||||
@@ -407,7 +416,8 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
.set(IOStorInvDis::getStruct_id,dis_map.getString("struct_id"))
|
||||
.set(IOStorInvDis::getStruct_code,dis_map.getString("struct_code"))
|
||||
.set(IOStorInvDis::getStruct_name,dis_map.getString("struct_name"))
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
|
||||
.eq(IOStorInvDis::getIostorinv_id,iostorinvId)
|
||||
.eq(IOStorInvDis::getStoragevehicle_code,storagevehicleCode)
|
||||
);
|
||||
//维护单据明细表里 分配数量
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
@@ -418,11 +428,11 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
ioStorInvDtlMapper.updateById(jsonObject.toJavaObject(IOStorInvDtl.class));
|
||||
//根据单据标识判断分配明细是否都已经分配完成
|
||||
int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinv_id, map.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getIostorinv_id, iostorinvId)
|
||||
.and(wrapper -> wrapper.isNull(IOStorInvDis::getStruct_code).or().eq(IOStorInvDis::getStruct_code, "")));
|
||||
// 根据分配货位情况 更新主表单据状态
|
||||
IOStorInv ios = new IOStorInv();
|
||||
ios.setIostorinv_id(map.get("iostorinv_id"));
|
||||
ios.setIostorinv_id(iostorinvId);
|
||||
ios.setUpdate_optid(currentUserId);
|
||||
ios.setUpdate_optname(nickName);
|
||||
ios.setUpdate_time(now);
|
||||
@@ -431,33 +441,6 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据库区策略获取仓位
|
||||
* ioType 出入库类型
|
||||
* sect_code 库区编码
|
||||
* stor_code 仓库编码
|
||||
* material_code 物料编码
|
||||
* qty 计划数量
|
||||
* pcsn 批次号
|
||||
*/
|
||||
@Override
|
||||
public Structattr getStructattr(JSONObject param) {
|
||||
List<Structattr> structattrs = iStructattrService.inBoundSectDiv(
|
||||
StrategyStructParam.builder()
|
||||
.ioType(param.getString("ioType"))
|
||||
.sect_code(param.getString("sect_code"))
|
||||
.stor_code(param.getString("stor_code"))
|
||||
.material_code(param.getString("material_code"))
|
||||
.qty(new BigDecimal(param.getString("qty")))
|
||||
.pcsn(param.getString("pcsn"))
|
||||
.build());
|
||||
if (CollectionUtils.isEmpty(structattrs)) {
|
||||
throw new BadRequestException("无可用货位");
|
||||
}
|
||||
return structattrs.get(0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void unDivStruct(Map whereJson) {
|
||||
@@ -485,7 +468,8 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
.set(IOStorInvDis::getStruct_id,null)
|
||||
.set(IOStorInvDis::getStruct_code,null)
|
||||
.set(IOStorInvDis::getStruct_name,null)
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,jo.get("iostorinvdis_id"))
|
||||
.eq(IOStorInvDis::getIostorinv_id,jo.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getStoragevehicle_code,jo.get("storagevehicle_code"))
|
||||
);
|
||||
|
||||
//维护单据明细表里 分配数量
|
||||
@@ -519,24 +503,20 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
HashMap<String, String> map = rows.get(0);
|
||||
|
||||
//判断是否已经分配好货位
|
||||
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
|
||||
List<IOStorInvDis> ioStorInvDis = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinv_id,map.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getStoragevehicle_code,map.get("storagevehicle_code"))
|
||||
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code,"")));
|
||||
if (ObjectUtil.isEmpty(ioStorInvDis)){
|
||||
if (CollectionUtils.isEmpty(ioStorInvDis)){
|
||||
throw new BadRequestException("该明细还没分配货位,请先分配货位");
|
||||
}
|
||||
|
||||
//创建任务
|
||||
JSONObject task_form = new JSONObject();
|
||||
task_form.put("task_type", "STInTask");
|
||||
task_form.put("TaskCode", CodeUtil.getNewCode("TASK_CODE"));
|
||||
task_form.put("PickingLocation", point_code);
|
||||
task_form.put("PlacedLocation", ioStorInvDis.getStruct_code());
|
||||
task_form.put("PlacedLocation", ioStorInvDis.get(0).getStruct_code());
|
||||
task_form.put("vehicle_code", map.get("storagevehicle_code"));
|
||||
// GroupPlate groupPlate = mdPbGroupplateMapper.selectOne(new LambdaQueryWrapper<>(GroupPlate.class)
|
||||
// .eq(GroupPlate::getStoragevehicle_code,map.get("storagevehicle_code"))
|
||||
// );
|
||||
// task_form.put("group_id", groupPlate.getGroup_id());
|
||||
StInTask stInTask = SpringContextHolder.getBean("STInTask");
|
||||
|
||||
String task_id = stInTask.create(task_form);
|
||||
@@ -548,7 +528,15 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
dis.setTask_id(task_id);
|
||||
dis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("是"));
|
||||
dis.setPoint_code(point_code);
|
||||
ioStorInvDisMapper.updateById(dis);
|
||||
//更新详情数据
|
||||
ioStorInvDisMapper.update(dis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("生成"))
|
||||
.set(IOStorInvDis::getTask_id,task_id)
|
||||
.set(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("是"))
|
||||
.set(IOStorInvDis::getPoint_code,point_code)
|
||||
.eq(IOStorInvDis::getIostorinv_id,map.get("iostorinv_id"))
|
||||
.eq(IOStorInvDis::getStoragevehicle_code,map.get("storagevehicle_code"))
|
||||
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成")));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -633,77 +621,66 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void taskFinish(SchBaseTask task) {
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
List<IOStorInvDis> ioStorInvDis = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getTask_id,task.getTask_id())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(ioStorInvDis)){
|
||||
if (CollectionUtils.isEmpty(ioStorInvDis)){
|
||||
throw new BadRequestException("未找到任务对应的分配明细");
|
||||
}
|
||||
// 明细
|
||||
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id());
|
||||
if (ObjectUtil.isEmpty(ioStorInvDtl)){
|
||||
throw new BadRequestException("未找到明细");
|
||||
}
|
||||
// 明细
|
||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(ioStorInvDis.getIostorinv_id());
|
||||
if (ObjectUtil.isEmpty(ioStorInv)){
|
||||
throw new BadRequestException("未找到明细");
|
||||
}
|
||||
// 完成当前分配明细
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.set(IOStorInvDis::getReal_qty,ioStorInvDis.getPlan_qty())
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id())
|
||||
);
|
||||
|
||||
String iostorinvId = ioStorInvDis.get(0).getIostorinv_id();
|
||||
String storagevehicleCode = ioStorInvDis.get(0).getStoragevehicle_code();
|
||||
String structCode = ioStorInvDis.get(0).getStruct_code();
|
||||
//解锁库位
|
||||
JSONObject finish_map = new JSONObject();
|
||||
finish_map.put("struct_code",ioStorInvDis.getStruct_code());
|
||||
finish_map.put("storagevehicle_code",ioStorInvDis.getStoragevehicle_code());
|
||||
finish_map.put("struct_code", structCode);
|
||||
finish_map.put("storagevehicle_code", storagevehicleCode);
|
||||
finish_map.put("inv_type", null);
|
||||
finish_map.put("inv_id", null);
|
||||
finish_map.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("1",finish_map);
|
||||
//库存变动
|
||||
StructattrChangeDto changeDto = StructattrChangeDto.builder()
|
||||
.inv(ioStorInv.getIostorinv_id())
|
||||
.storagevehicleCode(ioStorInvDis.getStoragevehicle_code())
|
||||
.structCode(ioStorInvDis.getStruct_code()).taskType(task.getConfig_code()).inBound(true).build();
|
||||
.inv(iostorinvId)
|
||||
.storagevehicleCode(storagevehicleCode)
|
||||
.structCode(structCode).taskType(task.getConfig_code()).inBound(true).build();
|
||||
iStructattrService.changeStruct(changeDto);
|
||||
|
||||
// 查询该明细下是否还有未完成的分配明细
|
||||
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id,ioStorInvDis.getIostorinvdtl_id())
|
||||
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
);
|
||||
// 如果分配明细全部完成则更新明细表状态
|
||||
if (countDis == 0){
|
||||
// 更新明细表状态
|
||||
ioStorInvDtl.setReal_qty(ioStorInvDis.getPlan_qty());
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInvDtlMapper.updateById(ioStorInvDtl);
|
||||
// 查看明细是否全部完成
|
||||
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
.eq(IOStorInvDtl::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
|
||||
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
);
|
||||
// 如果明细全部完成则更新主表状态
|
||||
if (countDtl == 0){
|
||||
//更新主表状态
|
||||
ioStorInvMapper.update(new IOStorInv(),new LambdaUpdateWrapper<>(IOStorInv.class)
|
||||
.set(IOStorInv::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInv::getConfirm_optid,currentUserId)
|
||||
.set(IOStorInv::getConfirm_optname,nickName)
|
||||
.set(IOStorInv::getConfirm_time,now)
|
||||
.eq(IOStorInv::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
|
||||
);
|
||||
}
|
||||
// 完成当前分配明细
|
||||
Map<String, BigDecimal> dtlMap = new HashMap<>();
|
||||
for (IOStorInvDis item : ioStorInvDis) {
|
||||
ioStorInvDisMapper.update(item,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.set(IOStorInvDis::getReal_qty,item.getPlan_qty())
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,item.getIostorinvdis_id()));
|
||||
dtlMap.put(item.getIostorinvdtl_id(),item.getPlan_qty());
|
||||
}
|
||||
//更新明细
|
||||
for (String dtl_id : dtlMap.keySet()) {
|
||||
IOStorInvDtl invDtl = new IOStorInvDtl();
|
||||
invDtl.setIostorinvdtl_id(dtl_id);
|
||||
invDtl.setReal_qty(dtlMap.get(dtl_id));
|
||||
invDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInvDtlMapper.updateById(invDtl);
|
||||
}
|
||||
// 查看明细是否全部完成
|
||||
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
.eq(IOStorInvDtl::getIostorinv_id, iostorinvId)
|
||||
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
);
|
||||
// 如果明细全部完成则更新主表状态
|
||||
if (countDtl == 0){
|
||||
//更新主表状态
|
||||
ioStorInvMapper.update(new IOStorInv(),new LambdaUpdateWrapper<>(IOStorInv.class)
|
||||
.set(IOStorInv::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||
.set(IOStorInv::getConfirm_optid,currentUserId)
|
||||
.set(IOStorInv::getConfirm_optname,nickName)
|
||||
.set(IOStorInv::getConfirm_time,now)
|
||||
.eq(IOStorInv::getIostorinv_id,iostorinvId)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,10 +23,7 @@ import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
|
||||
import org.nl.wms.basedata_manage.service.dto.StructattrChangeDto;
|
||||
import org.nl.wms.basedata_manage.service.dto.*;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
@@ -369,13 +366,17 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
String material_id = dtl.getMaterial_id();
|
||||
String material_code = dtl.getMaterial_code();
|
||||
// 根据物料和批次号查询库存可用
|
||||
StrategyMater mater = new StrategyMater();
|
||||
mater.setQty(unassign_qty);
|
||||
mater.setPcsn(pcsn);
|
||||
mater.setMaterial_code(material_code);
|
||||
List<StrategyMater> list = new ArrayList<>();
|
||||
list.add(mater);
|
||||
List<StrategyStructMaterialVO> structMaterials = iStructattrService.outBoundSectDiv(
|
||||
StrategyStructParam.builder()
|
||||
.qty(unassign_qty)
|
||||
.pcsn(pcsn)
|
||||
.material_code(material_code)
|
||||
.stor_code(ioStorInv.getStor_code())
|
||||
.sect_code(sectCode)
|
||||
.strategyMaters(list)
|
||||
.build()
|
||||
);
|
||||
int seq_no = 1;
|
||||
@@ -553,14 +554,18 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
BigDecimal unassign_qty = dtl.getUnassign_qty();
|
||||
String pcsn = dtl.getPcsn();
|
||||
String material_code = dtl.getMaterial_code();
|
||||
StrategyMater mater = new StrategyMater();
|
||||
mater.setQty(unassign_qty);
|
||||
mater.setPcsn(pcsn);
|
||||
mater.setMaterial_code(material_code);
|
||||
List<StrategyMater> list = new ArrayList<>();
|
||||
list.add(mater);
|
||||
//调用分配规则获取分配的库位:如果库存不足则直接报错
|
||||
List<StrategyStructMaterialVO> structMaterials = iStructattrService.outBoundSectDiv(
|
||||
StrategyStructParam.builder()
|
||||
.qty(unassign_qty)
|
||||
.pcsn(pcsn)
|
||||
.material_code(material_code)
|
||||
.stor_code(ioStorInv.getStor_code())
|
||||
.sect_code(sectCode)
|
||||
.strategyMaters(list)
|
||||
.build()
|
||||
);
|
||||
int seq_no = 1;
|
||||
|
||||
Reference in New Issue
Block a user