fix:出库调整;todu:出库分配明细单据完成,出库记录
This commit is contained in:
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||||
import org.nl.wms.basedata_manage.service.dao.StructattrVechielDto;
|
import org.nl.wms.basedata_manage.service.dao.StructattrVechielDto;
|
||||||
|
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.StrategyStructParam;
|
||||||
import org.nl.wms.basedata_manage.service.dto.StructattrChangeDto;
|
import org.nl.wms.basedata_manage.service.dto.StructattrChangeDto;
|
||||||
|
|
||||||
@@ -115,7 +116,7 @@ public interface IStructattrService extends IService<Structattr> {
|
|||||||
/**
|
/**
|
||||||
* 出库规则
|
* 出库规则
|
||||||
*/
|
*/
|
||||||
List<StructattrVechielDto> outBoundSectDiv(StrategyStructParam param);
|
List<StrategyStructMaterialVO> outBoundSectDiv(StrategyStructParam param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库规则
|
* 入库规则
|
||||||
|
|||||||
@@ -16,41 +16,21 @@ public class StructattrVechielDto extends GroupPlate {
|
|||||||
/**
|
/**
|
||||||
* 仓位标识
|
* 仓位标识
|
||||||
*/
|
*/
|
||||||
private String id;
|
private String struct_id;
|
||||||
/**
|
|
||||||
* 载具物料id
|
|
||||||
*/
|
|
||||||
private String vm_id;
|
|
||||||
/**
|
|
||||||
* 入库类型
|
|
||||||
*/
|
|
||||||
private String source_form_type;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仓位编码
|
* 仓位编码
|
||||||
*/
|
*/
|
||||||
private String struct_code;
|
private String struct_code;
|
||||||
|
|
||||||
/**
|
|
||||||
* 仓位名称
|
|
||||||
*/
|
|
||||||
private String struct_name;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库区标识
|
* 库区标识
|
||||||
*/
|
*/
|
||||||
private String sect_code;
|
private String sect_code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仓库标识
|
* 仓库标识
|
||||||
*/
|
*/
|
||||||
private String stor_code;
|
private String stor_code;
|
||||||
|
|
||||||
/**
|
|
||||||
* 容量
|
|
||||||
*/
|
|
||||||
private Integer capacity;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 宽度
|
* 宽度
|
||||||
*/
|
*/
|
||||||
@@ -71,21 +51,6 @@ public class StructattrVechielDto extends GroupPlate {
|
|||||||
*/
|
*/
|
||||||
private Integer weight;
|
private Integer weight;
|
||||||
|
|
||||||
/**
|
|
||||||
* 起始X坐标
|
|
||||||
*/
|
|
||||||
private BigDecimal xqty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 起始Y坐标
|
|
||||||
*/
|
|
||||||
private BigDecimal yqty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 起始Z坐标
|
|
||||||
*/
|
|
||||||
private BigDecimal zqty;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排
|
* 排
|
||||||
*/
|
*/
|
||||||
@@ -111,21 +76,6 @@ public class StructattrVechielDto extends GroupPlate {
|
|||||||
*/
|
*/
|
||||||
private String control_code;
|
private String control_code;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建人
|
|
||||||
*/
|
|
||||||
private String create_id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建人姓名
|
|
||||||
*/
|
|
||||||
private String create_name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
private String create_time;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否临时仓位
|
* 是否临时仓位
|
||||||
*/
|
*/
|
||||||
@@ -149,33 +99,7 @@ public class StructattrVechielDto extends GroupPlate {
|
|||||||
/**
|
/**
|
||||||
* 存储载具号
|
* 存储载具号
|
||||||
*/
|
*/
|
||||||
private String vehicle_code;
|
private String storagevehicle_code;
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 背景图片
|
|
||||||
*/
|
|
||||||
private String back_ground_pic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 前景色
|
|
||||||
*/
|
|
||||||
private String front_ground_color;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 背景色
|
|
||||||
*/
|
|
||||||
private String back_ground_color;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字体显示方向
|
|
||||||
*/
|
|
||||||
private String font_direction_scode;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料编码
|
* 物料编码
|
||||||
@@ -188,11 +112,6 @@ public class StructattrVechielDto extends GroupPlate {
|
|||||||
*/
|
*/
|
||||||
private String material_name;
|
private String material_name;
|
||||||
|
|
||||||
/**
|
|
||||||
* 物料规格
|
|
||||||
*/
|
|
||||||
private String material_spec;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,26 +6,37 @@ import java.math.BigDecimal;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class StrategyStructMaterialVO {
|
public class StrategyStructMaterialVO {
|
||||||
|
/**
|
||||||
|
* 分配的货位的仓库库区编码
|
||||||
|
*/
|
||||||
|
private String stor_id;
|
||||||
|
private String stor_code;
|
||||||
|
private String stor_name;
|
||||||
|
private String sect_id;
|
||||||
private String sect_code;
|
private String sect_code;
|
||||||
|
private String sect_name;
|
||||||
/**
|
/**
|
||||||
* 仓位编码
|
* 仓位编码
|
||||||
*/
|
*/
|
||||||
private String struct_code;
|
private String struct_code;
|
||||||
|
private String struct_id;
|
||||||
|
private String struct_name;
|
||||||
/**
|
/**
|
||||||
* 锁定类型
|
* 锁定类型
|
||||||
*/
|
*/
|
||||||
private String lock_type;
|
private String lock_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 载具编码
|
* 分配的载具编码
|
||||||
*/
|
*/
|
||||||
|
private String group_id;
|
||||||
private String storagevehicle_code;
|
private String storagevehicle_code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料标识
|
* 物料标识
|
||||||
*/
|
*/
|
||||||
private String material_code;
|
private String material_code;
|
||||||
|
private String material_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批次
|
* 批次
|
||||||
@@ -33,13 +44,15 @@ public class StrategyStructMaterialVO {
|
|||||||
private String pcsn;
|
private String pcsn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组盘数量
|
* 托盘物料数量
|
||||||
*/
|
*/
|
||||||
private BigDecimal qty;
|
private BigDecimal qty;
|
||||||
/**
|
/**
|
||||||
* 当前仓库冻结数
|
* 当前托盘分配数量
|
||||||
*/
|
*/
|
||||||
private BigDecimal frozen_qty;
|
private BigDecimal frozen_qty;
|
||||||
|
private String qty_unit_id;
|
||||||
|
private String qty_unit_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 来源单据号
|
* 来源单据号
|
||||||
@@ -51,4 +64,5 @@ public class StrategyStructMaterialVO {
|
|||||||
*/
|
*/
|
||||||
private String ext_type;
|
private String ext_type;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public class StrategyStructParam {
|
|||||||
* 物料标识
|
* 物料标识
|
||||||
*/
|
*/
|
||||||
private String material_code;
|
private String material_code;
|
||||||
|
private String material_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批次
|
* 批次
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
|||||||
* 当前分配不会自动锁定货位及冻结出库数量,分配完成后需要手动锁定货位并冻结出库数量
|
* 当前分配不会自动锁定货位及冻结出库数量,分配完成后需要手动锁定货位并冻结出库数量
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<StructattrVechielDto> outBoundSectDiv(StrategyStructParam param) {
|
public List<StrategyStructMaterialVO> outBoundSectDiv(StrategyStructParam param) {
|
||||||
//只校验仓库,库区
|
//只校验仓库,库区
|
||||||
Assert.noNullElements(new Object[]{param.getStor_code(),param.getSect_code()},"请求参数不能为空");
|
Assert.noNullElements(new Object[]{param.getStor_code(),param.getSect_code()},"请求参数不能为空");
|
||||||
StSectStrategy one = iStSectStrategyService.getOne(new LambdaQueryWrapper<StSectStrategy>()
|
StSectStrategy one = iStSectStrategyService.getOne(new LambdaQueryWrapper<StSectStrategy>()
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ import org.nl.common.exception.BadRequestException;
|
|||||||
import org.nl.common.utils.MapOf;
|
import org.nl.common.utils.MapOf;
|
||||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||||
import org.nl.wms.basedata_manage.service.dao.StructattrVechielDto;
|
import org.nl.wms.basedata_manage.service.dao.StructattrVechielDto;
|
||||||
|
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
|
||||||
import org.nl.wms.decision_manage.service.strategyConfig.decisioner.Decisioner;
|
import org.nl.wms.decision_manage.service.strategyConfig.decisioner.Decisioner;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -22,7 +24,7 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Service("fifo")
|
@Service("fifo")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class FIFORuleHandler extends Decisioner<StructattrVechielDto, JSONObject> {
|
public class FIFORuleHandler extends Decisioner<StrategyStructMaterialVO, JSONObject> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 出入库明细服务
|
* 出入库明细服务
|
||||||
@@ -31,66 +33,39 @@ public class FIFORuleHandler extends Decisioner<StructattrVechielDto, JSONObject
|
|||||||
private IStructattrService iStructattrService;
|
private IStructattrService iStructattrService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StructattrVechielDto> handler(List<StructattrVechielDto> list, JSONObject param) {
|
public List<StrategyStructMaterialVO> handler(List<StrategyStructMaterialVO> list, JSONObject param) {
|
||||||
//分配数量
|
//分配数量
|
||||||
int plan_qty = param.getInteger("qty");
|
BigDecimal planQty = param.getBigDecimal("qty");
|
||||||
int finalPlan_qty = plan_qty;
|
|
||||||
//当前条件只有id,批次
|
//当前条件只有id,批次
|
||||||
log.info("---------执行fifo出库分配规则---------");
|
log.info("---------执行fifo出库分配规则---------");
|
||||||
List<StructattrVechielDto> vechielDtos = iStructattrService.collectVechicle(MapOf.of("material_id", param.getString("material_id")
|
List<StructattrVechielDto> vechielDtos = iStructattrService.collectVechicle(MapOf.of("material_id", param.getString("material_id")
|
||||||
, "pcsn", param.getString("pcsn")
|
, "pcsn", param.getString("pcsn")
|
||||||
, "stor_code", param.getString("stor_code")
|
, "stor_code", param.getString("stor_code")
|
||||||
, "plan_qty", plan_qty
|
, "plan_qty", planQty
|
||||||
, "is_lock", "false"
|
, "is_lock", "false"
|
||||||
, "order_by", "gro.pcsn asc")
|
, "order_by", "gro.create_time asc")
|
||||||
);
|
);
|
||||||
if (ObjectUtils.isEmpty(vechielDtos)) {
|
if (ObjectUtils.isEmpty(vechielDtos)) {
|
||||||
throw new BadRequestException("当前出库策略:先进先出,库存分配失败,失败原因:库存不足!");
|
throw new BadRequestException("当前出库策略:先进先出,库存分配失败,失败原因:库存不足!");
|
||||||
}
|
}
|
||||||
List<StructattrVechielDto> disList = new ArrayList<>();
|
List<StrategyStructMaterialVO> divStruct = new ArrayList<>();
|
||||||
Map<String, List<StructattrVechielDto>> groupedMap = vechielDtos.stream()
|
for (StructattrVechielDto vechielDto : vechielDtos) {
|
||||||
.collect(Collectors.groupingBy(
|
if (planQty.intValue()<=0){
|
||||||
StructattrVechielDto::getPcsn,
|
|
||||||
Collectors.collectingAndThen(
|
|
||||||
Collectors.toList(),
|
|
||||||
r -> r.stream()
|
|
||||||
.sorted(Comparator.comparing(StructattrVechielDto::getPcsn))
|
|
||||||
.collect(Collectors.toList())
|
|
||||||
)
|
|
||||||
));
|
|
||||||
LinkedHashMap<String, List<StructattrVechielDto>> sortedGroupMap = groupedMap.entrySet().stream()
|
|
||||||
.sorted(Comparator.comparing(entry -> entry.getValue().get(0).getPcsn()))
|
|
||||||
.collect(Collectors.toMap(
|
|
||||||
Map.Entry::getKey,
|
|
||||||
Map.Entry::getValue,
|
|
||||||
(r, s) -> r,
|
|
||||||
LinkedHashMap::new
|
|
||||||
));
|
|
||||||
for (Map.Entry<String, List<StructattrVechielDto>> entry : sortedGroupMap.entrySet()) {
|
|
||||||
List<StructattrVechielDto> sortedList = new ArrayList<>(entry.getValue());
|
|
||||||
for (StructattrVechielDto structattr : sortedList) {
|
|
||||||
BigDecimal qty = structattr.getQty() != null ? structattr.getQty() : BigDecimal.ZERO;
|
|
||||||
BigDecimal frozen = structattr.getFrozen_qty() != null ? structattr.getFrozen_qty() : BigDecimal.ZERO;
|
|
||||||
int available = qty.subtract(frozen).intValue();
|
|
||||||
if (available <= 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (finalPlan_qty <= available) {
|
|
||||||
structattr.setFrozen_qty(frozen.add(new BigDecimal(finalPlan_qty)));
|
|
||||||
disList.add(structattr);
|
|
||||||
finalPlan_qty = 0;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
structattr.setFrozen_qty(frozen.add(new BigDecimal(available)));
|
|
||||||
disList.add(structattr);
|
|
||||||
finalPlan_qty -= available;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (finalPlan_qty <= 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
BigDecimal qty = vechielDto.getQty();
|
||||||
|
BigDecimal subQty = planQty.subtract(qty);
|
||||||
|
if (subQty.doubleValue()>=0){
|
||||||
|
vechielDto.setFrozen_qty(vechielDto.getQty());
|
||||||
|
}else {
|
||||||
|
vechielDto.setFrozen_qty(planQty);
|
||||||
|
}
|
||||||
|
planQty=subQty;
|
||||||
|
StrategyStructMaterialVO materialVO = new StrategyStructMaterialVO();
|
||||||
|
BeanUtils.copyProperties(vechielDto,materialVO);
|
||||||
|
divStruct.add(materialVO);
|
||||||
}
|
}
|
||||||
return disList;
|
return divStruct;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import org.nl.wms.basedata_manage.service.*;
|
|||||||
import org.nl.wms.basedata_manage.service.dao.*;
|
import org.nl.wms.basedata_manage.service.dao.*;
|
||||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdMeMaterialbaseMapper;
|
import org.nl.wms.basedata_manage.service.dao.mapper.MdMeMaterialbaseMapper;
|
||||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||||
|
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.StrategyStructParam;
|
||||||
import org.nl.wms.pda.ios_manage.service.PdaIosInService;
|
import org.nl.wms.pda.ios_manage.service.PdaIosInService;
|
||||||
import org.nl.wms.pda.ios_manage.service.PdaIosOutService;
|
import org.nl.wms.pda.ios_manage.service.PdaIosOutService;
|
||||||
@@ -358,7 +359,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
|||||||
.material_code(whereJson.getString("material_code"))
|
.material_code(whereJson.getString("material_code"))
|
||||||
.qty(BigDecimal.valueOf(qty))
|
.qty(BigDecimal.valueOf(qty))
|
||||||
.build();
|
.build();
|
||||||
List<StructattrVechielDto> structList = iStructattrService.outBoundSectDiv(strategyStructParam);
|
List<StrategyStructMaterialVO> structList = iStructattrService.outBoundSectDiv(strategyStructParam);
|
||||||
if (CollectionUtils.isEmpty(structList)) {
|
if (CollectionUtils.isEmpty(structList)) {
|
||||||
throw new BadRequestException("无可用库存!");
|
throw new BadRequestException("无可用库存!");
|
||||||
}
|
}
|
||||||
@@ -376,7 +377,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
|||||||
});
|
});
|
||||||
//更新组盘记录表
|
//更新组盘记录表
|
||||||
Set<String> vehicleCodeSet = structList.stream()
|
Set<String> vehicleCodeSet = structList.stream()
|
||||||
.map(StructattrVechielDto::getStoragevehicle_code)
|
.map(StrategyStructMaterialVO::getStoragevehicle_code)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
mdPbGroupplateMapper.update(
|
mdPbGroupplateMapper.update(
|
||||||
new GroupPlate(),
|
new GroupPlate(),
|
||||||
@@ -387,7 +388,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
|||||||
);
|
);
|
||||||
//锁定仓位
|
//锁定仓位
|
||||||
Set<String> structCodeSet = structList.stream()
|
Set<String> structCodeSet = structList.stream()
|
||||||
.map(StructattrVechielDto::getStruct_code)
|
.map(StrategyStructMaterialVO::getStruct_code)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
iStructattrService.update(
|
iStructattrService.update(
|
||||||
new LambdaUpdateWrapper<Structattr>()
|
new LambdaUpdateWrapper<Structattr>()
|
||||||
|
|||||||
@@ -24,8 +24,11 @@ import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
|||||||
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
||||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
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.BsrealStorattr;
|
||||||
|
import org.nl.wms.basedata_manage.service.dao.StructattrVechielDto;
|
||||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
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.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.StructattrChangeDto;
|
||||||
import org.nl.wms.pda.ios_manage.service.PdaIosOutService;
|
import org.nl.wms.pda.ios_manage.service.PdaIosOutService;
|
||||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||||
@@ -345,59 +348,59 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void allDiv(JSONObject whereJson) {
|
public void allDiv(JSONObject whereJson) {
|
||||||
|
|
||||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
String sectCode = whereJson.getString("sect_code");
|
||||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||||
|
|
||||||
//查询主表信息
|
//查询主表信息
|
||||||
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
|
IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id);
|
||||||
if (ObjectUtil.isEmpty(ioStorInv)) {
|
if (ObjectUtil.isEmpty(ioStorInv)) {
|
||||||
throw new BadRequestException("查不到出库单信息");
|
throw new BadRequestException("查不到出库单信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询生成和未分配完的明细
|
//查询生成和未分配完的明细
|
||||||
JSONObject queryDtl = new JSONObject();
|
JSONObject queryDtl = new JSONObject();
|
||||||
queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
|
queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
|
||||||
queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code("是"));
|
queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code("是"));
|
||||||
queryDtl.put("iostorinv_id", iostorinv_id);
|
queryDtl.put("iostorinv_id", iostorinv_id);
|
||||||
List<IOStorInvDtlDto> dtls = ioStorInvMapper.getIODtl(queryDtl);
|
List<IOStorInvDtlDto> dtls = ioStorInvMapper.getIODtl(queryDtl);
|
||||||
// List<IOStorInvDtl> dtls = ioStorInvDtlMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
|
||||||
// .le(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完"))
|
|
||||||
// .gt(IOStorInvDtl::getUnassign_qty,0)
|
|
||||||
// .eq(IOStorInvDtl::getIostorinv_id, iostorinv_id));
|
|
||||||
if (ObjectUtil.isEmpty(dtls)) {
|
if (ObjectUtil.isEmpty(dtls)) {
|
||||||
throw new BadRequestException("当前订单无可分配出库明细");
|
throw new BadRequestException("当前订单无可分配出库明细");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < dtls.size(); i++) {
|
for (int i = 0; i < dtls.size(); i++) {
|
||||||
IOStorInvDtlDto dtl = dtls.get(i);
|
IOStorInvDtlDto dtl = dtls.get(i);
|
||||||
double unassign_qty = dtl.getUnassign_qty().doubleValue();
|
BigDecimal unassign_qty = dtl.getUnassign_qty();
|
||||||
String pcsn = dtl.getPcsn();
|
String pcsn = dtl.getPcsn();
|
||||||
String material_id = dtl.getMaterial_id();
|
String material_id = dtl.getMaterial_id();
|
||||||
String material_code = dtl.getMaterial_code();
|
String material_code = dtl.getMaterial_code();
|
||||||
// 根据物料和批次号查询库存可用
|
// 根据物料和批次号查询库存可用
|
||||||
BigDecimal canuseSum = mdPbStoragevehicleextMapper.queryCanuseSum(pcsn,material_id);
|
List<StrategyStructMaterialVO> structMaterials = iStructattrService.outBoundSectDiv(
|
||||||
if (ObjectUtil.isEmpty(canuseSum) || canuseSum.doubleValue()<unassign_qty){
|
StrategyStructParam.builder()
|
||||||
throw new BadRequestException("物料编号:"+ dtl.getMaterial_code() +"出库分配数量不满足");
|
.qty(unassign_qty)
|
||||||
}
|
.pcsn(pcsn)
|
||||||
/*
|
.material_code(material_code)
|
||||||
* 分配规则:
|
.material_id(material_id)
|
||||||
* 1.按批次先进先出
|
.stor_code(ioStorInv.getStor_code())
|
||||||
* 2.相同批次载具量小优先
|
.sect_code(sectCode)
|
||||||
*/
|
.build()
|
||||||
//出库分配查询货位信息
|
);
|
||||||
List<MdPbStoragevehicleextDto> outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn,material_id);
|
|
||||||
int seq_no = 1;
|
int seq_no = 1;
|
||||||
double allocation_canuse_qty = 0;
|
BigDecimal allocation_canuse_qty=BigDecimal.ZERO;
|
||||||
for (MdPbStoragevehicleextDto outAllocation : outAllocationList) {
|
for (StrategyStructMaterialVO outAllocation : structMaterials) {
|
||||||
//分配明细
|
//分配明细
|
||||||
IOStorInvDis ioStorInvDis = new IOStorInvDis();
|
IOStorInvDis ioStorInvDis = new IOStorInvDis();
|
||||||
ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
|
ioStorInvDis.setIostorinvdis_id(org.nl.common.utils.IdUtil.getStringId());
|
||||||
ioStorInvDis.setIostorinv_id(dtl.getIostorinv_id());
|
ioStorInvDis.setIostorinv_id(dtl.getIostorinv_id());
|
||||||
ioStorInvDis.setIostorinvdtl_id(dtl.getIostorinvdtl_id());
|
ioStorInvDis.setIostorinvdtl_id(dtl.getIostorinvdtl_id());
|
||||||
ioStorInvDis.setSeq_no((seq_no++)+"");
|
ioStorInvDis.setSeq_no((seq_no++)+"");
|
||||||
ioStorInvDis.setSect_id(outAllocation.getSect_id());
|
ioStorInvDis.setSect_id(outAllocation.getSect_id());
|
||||||
ioStorInvDis.setPcsn(outAllocation.getPcsn());
|
ioStorInvDis.setPcsn(outAllocation.getPcsn());
|
||||||
ioStorInvDis.setMaterial_id(material_id);
|
ioStorInvDis.setMaterial_id(outAllocation.getMaterial_id());
|
||||||
ioStorInvDis.setMaterial_code(material_code);
|
ioStorInvDis.setMaterial_code(outAllocation.getMaterial_code());
|
||||||
ioStorInvDis.setSect_name(outAllocation.getSect_name());
|
ioStorInvDis.setSect_name(outAllocation.getSect_name());
|
||||||
ioStorInvDis.setSect_code(outAllocation.getSect_code());
|
ioStorInvDis.setSect_code(outAllocation.getSect_code());
|
||||||
ioStorInvDis.setStruct_id(outAllocation.getStruct_id());
|
ioStorInvDis.setStruct_id(outAllocation.getStruct_id());
|
||||||
@@ -408,20 +411,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
|||||||
ioStorInvDis.setQty_unit_id(outAllocation.getQty_unit_id());
|
ioStorInvDis.setQty_unit_id(outAllocation.getQty_unit_id());
|
||||||
ioStorInvDis.setQty_unit_name(outAllocation.getQty_unit_name());
|
ioStorInvDis.setQty_unit_name(outAllocation.getQty_unit_name());
|
||||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||||
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
|
ioStorInvDis.setPlan_qty(outAllocation.getFrozen_qty());
|
||||||
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
|
|
||||||
// if (unassign_qty-canuse_qty>=0){
|
|
||||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
|
|
||||||
// }else {
|
|
||||||
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty));
|
|
||||||
// }
|
|
||||||
// unassign_qty = unassign_qty-canuse_qty;
|
|
||||||
unassign_qty = unassign_qty - outAllocation.getQty().doubleValue();
|
|
||||||
if (unassign_qty < 0) {
|
|
||||||
unassign_qty = 0;
|
|
||||||
}
|
|
||||||
allocation_canuse_qty = allocation_canuse_qty + outAllocation.getQty().doubleValue();
|
|
||||||
ioStorInvDis.setPlan_qty(outAllocation.getQty());
|
|
||||||
//锁定货位
|
//锁定货位
|
||||||
JSONObject lock_map = new JSONObject();
|
JSONObject lock_map = new JSONObject();
|
||||||
lock_map.put("struct_code", outAllocation.getStruct_code());
|
lock_map.put("struct_code", outAllocation.getStruct_code());
|
||||||
@@ -429,33 +419,34 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
|||||||
lock_map.put("inv_code", ioStorInv.getBill_code());
|
lock_map.put("inv_code", ioStorInv.getBill_code());
|
||||||
lock_map.put("inv_type", ioStorInv.getBill_type());
|
lock_map.put("inv_type", ioStorInv.getBill_type());
|
||||||
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁"));
|
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁"));
|
||||||
iStructattrService.updateStatusByCode("0", lock_map);
|
iStructattrService.updateStatusByCode("0",lock_map);
|
||||||
|
//更新组盘表冻结数量状态
|
||||||
|
LambdaUpdateWrapper<GroupPlate> updateWrapper = new LambdaUpdateWrapper<GroupPlate>()
|
||||||
|
.set(GroupPlate::getFrozen_qty, outAllocation.getFrozen_qty())
|
||||||
|
.set(GroupPlate::getUpdate_time, now)
|
||||||
|
.eq(GroupPlate::getStoragevehicle_code, outAllocation.getStoragevehicle_code())
|
||||||
|
.eq(GroupPlate::getMaterial_id, outAllocation.getMaterial_id())
|
||||||
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"));
|
||||||
|
if (StringUtils.isNotEmpty(outAllocation.getPcsn())){
|
||||||
|
updateWrapper.eq(GroupPlate::getPcsn, outAllocation.getPcsn());
|
||||||
|
}
|
||||||
|
iMdPbGroupPlateService.update(updateWrapper);
|
||||||
//生成分配明细
|
//生成分配明细
|
||||||
ioStorInvDisMapper.insert(ioStorInvDis);
|
ioStorInvDisMapper.insert(ioStorInvDis);
|
||||||
//更新库存 加冻结减可用
|
allocation_canuse_qty = allocation_canuse_qty.add(outAllocation.getFrozen_qty());
|
||||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
|
||||||
JSONObject jsonIvt = new JSONObject();
|
|
||||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_FROZEN);
|
|
||||||
jsonIvt.put("storagevehicle_code", outAllocation.getStoragevehicle_code());
|
|
||||||
jsonIvt.put("material_id", outAllocation.getMaterial_id());
|
|
||||||
jsonIvt.put("pcsn", outAllocation.getPcsn());
|
|
||||||
jsonIvt.put("qty_unit_id", outAllocation.getQty_unit_id());
|
|
||||||
jsonIvt.put("qty_unit_name", outAllocation.getQty_unit_name());
|
|
||||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
|
||||||
updateIvtList.add(jsonIvt);
|
|
||||||
iMdPbGroupPlateService.updateIvt(updateIvtList);
|
|
||||||
//分配完成 结束分配
|
//分配完成 结束分配
|
||||||
if (unassign_qty==0){
|
unassign_qty=unassign_qty.subtract(allocation_canuse_qty);
|
||||||
|
if (unassign_qty.doubleValue() <= 0){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//更新详情
|
//更新详情
|
||||||
dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
|
dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
|
||||||
double assign_qty = allocation_canuse_qty + dtl.getAssign_qty().doubleValue();
|
dtl.setUnassign_qty(unassign_qty);
|
||||||
dtl.setUnassign_qty(BigDecimal.valueOf(unassign_qty));
|
dtl.setAssign_qty(dtl.getAssign_qty().add(allocation_canuse_qty));
|
||||||
dtl.setAssign_qty(BigDecimal.valueOf(assign_qty));
|
|
||||||
ioStorInvDtlMapper.updateById(dtl);
|
ioStorInvDtlMapper.updateById(dtl);
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新主表
|
//更新主表
|
||||||
//根据单据标识判断明细是否都已经分配完成
|
//根据单据标识判断明细是否都已经分配完成
|
||||||
int disCount = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
int disCount = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||||
@@ -808,7 +799,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
|||||||
double allocation_canuse_qty = 0;
|
double allocation_canuse_qty = 0;
|
||||||
for (int i = 0; i < rows.size(); i++){
|
for (int i = 0; i < rows.size(); i++){
|
||||||
JSONObject ivt = rows.getJSONObject(i);
|
JSONObject ivt = rows.getJSONObject(i);
|
||||||
double canuse_qty = ivt.getDoubleValue("canuse_qty");
|
double canuse_qty = ivt.getDoubleValue("qty");
|
||||||
//分配明细
|
//分配明细
|
||||||
IOStorInvDis ioStorInvDis = new IOStorInvDis();
|
IOStorInvDis ioStorInvDis = new IOStorInvDis();
|
||||||
ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
|
ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
|
||||||
@@ -1172,12 +1163,14 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv>
|
|||||||
dtlSet.add(ioStorInvDis.getIostorinvdtl_id());
|
dtlSet.add(ioStorInvDis.getIostorinvdtl_id());
|
||||||
|
|
||||||
//更新组盘记录表
|
//更新组盘记录表
|
||||||
mdPbGroupplateMapper.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
|
LambdaUpdateWrapper<GroupPlate> updateWrapper = new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||||
.set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
|
||||||
.eq(GroupPlate::getPcsn,ioStorInvDis.getPcsn())
|
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
|
||||||
.eq(GroupPlate::getMaterial_id,ioStorInvDis.getMaterial_id())
|
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code());
|
||||||
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code())
|
if (StringUtils.isNotEmpty(ioStorInvDis.getPcsn())){
|
||||||
);
|
updateWrapper.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn());
|
||||||
|
}
|
||||||
|
mdPbGroupplateMapper.update(new GroupPlate(),updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新出库明细单状态
|
//更新出库明细单状态
|
||||||
|
|||||||
@@ -612,12 +612,14 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|||||||
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
||||||
);
|
);
|
||||||
//更新组盘记录表
|
//更新组盘记录表
|
||||||
mdPbGroupplateService.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
|
LambdaUpdateWrapper<GroupPlate> updateWrapper = new LambdaUpdateWrapper<>(GroupPlate.class)
|
||||||
.set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
||||||
.eq(GroupPlate::getPcsn,ioStorInvDis.getPcsn())
|
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
|
||||||
.eq(GroupPlate::getMaterial_id,ioStorInvDis.getMaterial_id())
|
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code());
|
||||||
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code())
|
if (StringUtils.isNotEmpty(ioStorInvDis.getPcsn())){
|
||||||
);
|
updateWrapper.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn());
|
||||||
|
}
|
||||||
|
mdPbGroupplateService.update(new GroupPlate(),updateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新主表状态
|
//更新主表状态
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.NumberUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
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.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -165,9 +166,6 @@ public class UpdateIvtUtils {
|
|||||||
if (ObjectUtil.isEmpty(where.getString("material_id"))) {
|
if (ObjectUtil.isEmpty(where.getString("material_id"))) {
|
||||||
throw new BadRequestException("物料标识不能为空!");
|
throw new BadRequestException("物料标识不能为空!");
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isEmpty(where.getString("pcsn"))) {
|
|
||||||
throw new BadRequestException("批次不能为空!");
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isEmpty(where.getString("qty_unit_id"))) {
|
if (ObjectUtil.isEmpty(where.getString("qty_unit_id"))) {
|
||||||
throw new BadRequestException("计量单位标识不能为空!");
|
throw new BadRequestException("计量单位标识不能为空!");
|
||||||
}
|
}
|
||||||
@@ -214,12 +212,15 @@ public class UpdateIvtUtils {
|
|||||||
*/
|
*/
|
||||||
private void updateAddFrozenIvt(JSONObject where) {
|
private void updateAddFrozenIvt(JSONObject where) {
|
||||||
// 找当前托盘物料库存
|
// 找当前托盘物料库存
|
||||||
GroupPlate extDao = iMdPbGroupPlateService.getOne(
|
|
||||||
new QueryWrapper<GroupPlate>().lambda()
|
LambdaQueryWrapper<GroupPlate> query = new QueryWrapper<GroupPlate>().lambda()
|
||||||
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
||||||
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
|
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
|
||||||
.eq(GroupPlate::getPcsn, where.getString("pcsn"))
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"));
|
||||||
);
|
if (!StringUtils.isEmpty(where.getString("pcsn"))){
|
||||||
|
query.eq(GroupPlate::getPcsn, where.getString("pcsn"));
|
||||||
|
}
|
||||||
|
GroupPlate extDao = iMdPbGroupPlateService.getOne(query);
|
||||||
if (ObjectUtil.isEmpty(extDao)) {
|
if (ObjectUtil.isEmpty(extDao)) {
|
||||||
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
||||||
}
|
}
|
||||||
@@ -246,12 +247,14 @@ public class UpdateIvtUtils {
|
|||||||
*/
|
*/
|
||||||
private void updateSubFrozenIvt(JSONObject where) {
|
private void updateSubFrozenIvt(JSONObject where) {
|
||||||
// 找当前托盘物料库存
|
// 找当前托盘物料库存
|
||||||
GroupPlate extDao = iMdPbGroupPlateService.getOne(
|
LambdaQueryWrapper<GroupPlate> query = new QueryWrapper<GroupPlate>().lambda()
|
||||||
new QueryWrapper<GroupPlate>().lambda()
|
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
||||||
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
|
||||||
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"));
|
||||||
.eq(GroupPlate::getPcsn, where.getString("pcsn"))
|
if (!StringUtils.isEmpty(where.getString("pcsn"))){
|
||||||
);
|
query.eq(GroupPlate::getPcsn, where.getString("pcsn"));
|
||||||
|
}
|
||||||
|
GroupPlate extDao = iMdPbGroupPlateService.getOne(query);
|
||||||
if (ObjectUtil.isEmpty(extDao)) {
|
if (ObjectUtil.isEmpty(extDao)) {
|
||||||
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
||||||
}
|
}
|
||||||
@@ -281,12 +284,14 @@ public class UpdateIvtUtils {
|
|||||||
*/
|
*/
|
||||||
private void updateSubFrozenAddIvt(JSONObject where) {
|
private void updateSubFrozenAddIvt(JSONObject where) {
|
||||||
// 找当前托盘物料库存
|
// 找当前托盘物料库存
|
||||||
GroupPlate extDao = iMdPbGroupPlateService.getOne(
|
LambdaQueryWrapper<GroupPlate> query = new QueryWrapper<GroupPlate>().lambda()
|
||||||
new QueryWrapper<GroupPlate>().lambda()
|
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
||||||
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
|
||||||
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"));
|
||||||
.eq(GroupPlate::getPcsn, where.getString("pcsn")).eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
if (!StringUtils.isEmpty(where.getString("pcsn"))){
|
||||||
);
|
query.eq(GroupPlate::getPcsn,where.getString("pcsn"));
|
||||||
|
}
|
||||||
|
GroupPlate extDao = iMdPbGroupPlateService.getOne(query);
|
||||||
if (ObjectUtil.isEmpty(extDao)) {
|
if (ObjectUtil.isEmpty(extDao)) {
|
||||||
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
||||||
}
|
}
|
||||||
@@ -311,12 +316,14 @@ public class UpdateIvtUtils {
|
|||||||
* @param where 输入参数
|
* @param where 输入参数
|
||||||
*/
|
*/
|
||||||
private void updateAddCanuseIvt(JSONObject where) {
|
private void updateAddCanuseIvt(JSONObject where) {
|
||||||
GroupPlate extDao = iMdPbGroupPlateService.getOne(
|
LambdaQueryWrapper<GroupPlate> query = new QueryWrapper<GroupPlate>().lambda()
|
||||||
new QueryWrapper<GroupPlate>().lambda()
|
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
||||||
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
|
||||||
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"));
|
||||||
.eq(GroupPlate::getPcsn, where.getString("pcsn"))
|
if (!StringUtils.isEmpty(where.getString("pcsn"))){
|
||||||
);
|
query.eq(GroupPlate::getPcsn, where.getString("pcsn"));
|
||||||
|
}
|
||||||
|
GroupPlate extDao = iMdPbGroupPlateService.getOne(query);
|
||||||
if (ObjectUtil.isEmpty(extDao)) {
|
if (ObjectUtil.isEmpty(extDao)) {
|
||||||
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
||||||
}
|
}
|
||||||
@@ -334,12 +341,14 @@ public class UpdateIvtUtils {
|
|||||||
* @param where 输入参数
|
* @param where 输入参数
|
||||||
*/
|
*/
|
||||||
private void updateSubCanuseIvt(JSONObject where) {
|
private void updateSubCanuseIvt(JSONObject where) {
|
||||||
GroupPlate extDao = iMdPbGroupPlateService.getOne(
|
LambdaQueryWrapper<GroupPlate> query = new QueryWrapper<GroupPlate>().lambda()
|
||||||
new QueryWrapper<GroupPlate>().lambda()
|
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
||||||
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
|
||||||
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"));
|
||||||
.eq(GroupPlate::getPcsn, where.getString("pcsn"))
|
if (!StringUtils.isEmpty(where.getString("pcsn"))){
|
||||||
);
|
query.eq(GroupPlate::getPcsn, where.getString("pcsn"));
|
||||||
|
}
|
||||||
|
GroupPlate extDao = iMdPbGroupPlateService.getOne(query);
|
||||||
if (ObjectUtil.isEmpty(extDao)) {
|
if (ObjectUtil.isEmpty(extDao)) {
|
||||||
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
open() {
|
open() {
|
||||||
crudSectattr.getSect({ 'stor_id': this.storId }).then(res => {
|
crudSectattr.getSectCode({ 'stor_id': this.storId }).then(res => {
|
||||||
this.sects = res.content
|
this.sects = res.content
|
||||||
})
|
})
|
||||||
crudRegion.getRegionList(this.mstrow).then(res => {
|
crudRegion.getRegionList(this.mstrow).then(res => {
|
||||||
@@ -355,16 +355,16 @@ export default {
|
|||||||
},
|
},
|
||||||
sectQueryChange(val) {
|
sectQueryChange(val) {
|
||||||
if (val.length === 1) {
|
if (val.length === 1) {
|
||||||
this.mstrow.stor_id = val[0]
|
this.mstrow.stor_code = val[0]
|
||||||
this.mstrow.sect_id = ''
|
this.mstrow.sect_code = ''
|
||||||
}
|
}
|
||||||
if (val.length === 0) {
|
if (val.length === 0) {
|
||||||
this.mstrow.sect_id = ''
|
this.mstrow.sect_code = ''
|
||||||
this.mstrow.stor_id = ''
|
this.mstrow.stor_code = ''
|
||||||
}
|
}
|
||||||
if (val.length === 2) {
|
if (val.length === 2) {
|
||||||
this.mstrow.stor_id = val[0]
|
this.mstrow.stor_code = val[0]
|
||||||
this.mstrow.sect_id = val[1]
|
this.mstrow.sect_code = val[1]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tabledisabled(row) {
|
tabledisabled(row) {
|
||||||
|
|||||||
@@ -93,7 +93,11 @@
|
|||||||
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="托盘编码" align="center" width="250px" />
|
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="托盘编码" align="center" width="250px" />
|
||||||
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
|
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
|
||||||
<el-table-column show-overflow-tooltip sortable prop="pcsn" label="批次号" align="center" width="150px" />
|
<el-table-column show-overflow-tooltip sortable prop="pcsn" label="批次号" align="center" width="150px" />
|
||||||
<el-table-column show-overflow-tooltip prop="qty" label="可出数量" :formatter="crud.formatNum3" align="center" />
|
<el-table-column show-overflow-tooltip prop="qty" label="可出重量" :formatter="crud.formatNum3" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.qty" clearable style="width: 120px" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column align="center" label="操作" width="160" fixed="right">
|
<el-table-column align="center" label="操作" width="160" fixed="right">
|
||||||
<template scope="scope">
|
<template scope="scope">
|
||||||
<el-button v-show="!scope.row.edit" type="primary" class="filter-item" size="mini" icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
<el-button v-show="!scope.row.edit" type="primary" class="filter-item" size="mini" icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
||||||
@@ -204,7 +208,7 @@ export default {
|
|||||||
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) + parseFloat(row.qty)
|
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) + parseFloat(row.qty)
|
||||||
} else {
|
} else {
|
||||||
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) - parseFloat(row.qty)
|
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) - parseFloat(row.qty)
|
||||||
// 如果待分配数量等于0则 明细数量 - 已分配数量
|
// 如果待分配重量等于0则 明细重量 - 已分配重量
|
||||||
if (parseInt(this.queryrow.unassign_qty) === 0) {
|
if (parseInt(this.queryrow.unassign_qty) === 0) {
|
||||||
this.queryrow.unassign_qty = parseFloat(this.goal_unassign_qty) - parseFloat(this.queryrow.assign_qty)
|
this.queryrow.unassign_qty = parseFloat(this.goal_unassign_qty) - parseFloat(this.queryrow.assign_qty)
|
||||||
} else {
|
} else {
|
||||||
@@ -213,7 +217,7 @@ export default {
|
|||||||
if (this.queryrow.unassign_qty > this.goal_unassign_qty) {
|
if (this.queryrow.unassign_qty > this.goal_unassign_qty) {
|
||||||
this.queryrow.unassign_qty = JSON.parse(JSON.stringify(this.goal_unassign_qty))
|
this.queryrow.unassign_qty = JSON.parse(JSON.stringify(this.goal_unassign_qty))
|
||||||
}
|
}
|
||||||
// 如果已分配汇总量 > 明细数量 则待分配数量为0
|
// 如果已分配汇总量 > 明细重量 则待分配重量为0
|
||||||
if (this.queryrow.assign_qty > this.goal_unassign_qty) {
|
if (this.queryrow.assign_qty > this.goal_unassign_qty) {
|
||||||
this.queryrow.unassign_qty = parseFloat('0')
|
this.queryrow.unassign_qty = parseFloat('0')
|
||||||
}
|
}
|
||||||
@@ -245,7 +249,7 @@ export default {
|
|||||||
this.fullscreenLoading = false
|
this.fullscreenLoading = false
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.$confirm('未分配数量不为0,是否继续提交?')
|
this.$confirm('未分配重量不为0,是否继续提交?')
|
||||||
.then(_ => {
|
.then(_ => {
|
||||||
const rows = []
|
const rows = []
|
||||||
this.tableDtl.forEach((item) => {
|
this.tableDtl.forEach((item) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user