add:增加所有库存分配规则
This commit is contained in:
@@ -69,4 +69,11 @@ public interface ISectattrService extends IService<Sectattr> {
|
||||
*/
|
||||
void changeActive(JSONObject json);
|
||||
|
||||
/**
|
||||
* 获取库区类型:
|
||||
* key:库区类型
|
||||
* value:库区sectCode集合
|
||||
*/
|
||||
Map<String,List<String>> getSectType();
|
||||
|
||||
}
|
||||
|
||||
@@ -23,12 +23,15 @@ import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.SectattrDto;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.SectattrMapper;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 库区实现类
|
||||
@@ -85,9 +88,8 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@CacheEvict(value = "sectType", key = "'allSectType'")
|
||||
public void create(Sectattr dto) {
|
||||
|
||||
Sectattr sectattr = sectattrMapper.selectOne(new LambdaQueryWrapper<>(Sectattr.class)
|
||||
.eq(Sectattr::getSect_id, dto.getSect_code())
|
||||
.eq(Sectattr::getStor_id, dto.getStor_id())
|
||||
@@ -113,7 +115,7 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@CacheEvict(value = "sectType", key = "'allSectType'")
|
||||
public void update(Sectattr dto) {
|
||||
Sectattr entity = this.findById(dto.getSect_id());
|
||||
if (entity == null) {
|
||||
@@ -121,17 +123,6 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
}
|
||||
|
||||
String sect_code = dto.getSect_code();
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
sectattrMapper.updateById(dto);
|
||||
|
||||
List<Sectattr> sectattrList = sectattrMapper.selectList(new LambdaQueryWrapper<Sectattr>()
|
||||
.eq(Sectattr::getSect_code,sect_code)
|
||||
.eq(Sectattr::getStor_id,dto.getStor_id())
|
||||
@@ -139,9 +130,19 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
if (sectattrList.size() > 1) {
|
||||
throw new BadRequestException("存在相同仓库的库区编号");
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
sectattrMapper.updateById(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = "sectType", key = "'allSectType'")
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
@@ -280,11 +281,8 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void changeActive(JSONObject json) {
|
||||
|
||||
String stor_id = json.getString("stor_id");
|
||||
|
||||
BsrealStorattr bsrealStorattr = iBsrealStorattrService.list(new LambdaQueryWrapper<>(BsrealStorattr.class)
|
||||
.eq(BsrealStorattr::getStor_id,stor_id)
|
||||
.eq(BsrealStorattr::getIs_used,BaseDataEnum.IS_YES_NOT.code("是")))
|
||||
@@ -292,22 +290,16 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
if (ObjectUtil.isEmpty(bsrealStorattr)) {
|
||||
throw new BadRequestException("该库区所属的仓库已禁用,请先启用该仓库!");
|
||||
}
|
||||
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
String is_used = BaseDataEnum.IS_YES_NOT.code("是").equals(json.getString("is_used")) ? BaseDataEnum.IS_YES_NOT.code("否") : BaseDataEnum.IS_YES_NOT.code("是");
|
||||
|
||||
json.put("is_used", is_used);
|
||||
json.put("update_optid", currentUserId);
|
||||
json.put("update_optname", nickName);
|
||||
json.put("update_time", now);
|
||||
|
||||
sectattrMapper.updateById(json.toJavaObject(Sectattr.class));
|
||||
|
||||
String sect_id = json.getString("sect_id");
|
||||
|
||||
iStructattrService.update(new LambdaUpdateWrapper<>(Structattr.class)
|
||||
.set(Structattr::getIs_used, is_used)
|
||||
.set(Structattr::getUpdate_id, currentUserId)
|
||||
@@ -316,4 +308,17 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
.eq(Structattr::getSect_id, sect_id)
|
||||
);
|
||||
}
|
||||
@Override
|
||||
@Cacheable(value = "sectType", key = "'allSectType'")
|
||||
public Map<String, List<String>> getSectType() {
|
||||
final List<Sectattr> list = this.list(new LambdaQueryWrapper<Sectattr>()
|
||||
.eq(Sectattr::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.eq(Sectattr::getIs_used, BaseDataEnum.IS_YES_NOT.code("是"))
|
||||
.select(Sectattr::getSect_type_attr, Sectattr::getSect_code));
|
||||
return list.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
Sectattr::getSect_type_attr,
|
||||
Collectors.mapping(Sectattr::getSect_code, Collectors.toList())
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
Sectattr sectattr = iSectattrService.findByCode(dto.getSect_code());
|
||||
Sectattr sectattr = iSectattrService.findById(dto.getSect_id());
|
||||
BsrealStorattr bsrealStorattr = iBsrealStorattrService.findById(sectattr.getStor_id());
|
||||
dto.setSect_code(sectattr.getSect_code());
|
||||
dto.setSect_id(sectattr.getSect_id());
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package org.nl.wms.decision_manage.service.strategyConfig.decisioner.impl.diy;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
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;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2024/4/6 16:18
|
||||
* 先进先出策略
|
||||
*/
|
||||
@Service("fIfONoStor")
|
||||
@Slf4j
|
||||
public class FIFONoStorHandler extends Decisioner<StrategyStructMaterialVO, StrategyStructParam> {
|
||||
|
||||
/**
|
||||
* 出入库明细服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStructattrService iStructattrService;
|
||||
|
||||
@Override
|
||||
public List<StrategyStructMaterialVO> handler(List<StrategyStructMaterialVO> list, StrategyStructParam param) {
|
||||
//分配数量
|
||||
//当前条件只有id,批次
|
||||
log.info("---------执行fifo出库分配规则---------");
|
||||
List<StrategyMater> maters = param.getStrategyMaters();
|
||||
StrategyMater strategyMater = maters.get(0);
|
||||
BigDecimal planQty = strategyMater.getQty();
|
||||
List<StructattrVechielDto> vechielDtos =
|
||||
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
|
||||
, "is_lock", "false"
|
||||
, "order_by", "gro.update_time asc")
|
||||
);
|
||||
if (ObjectUtils.isEmpty(vechielDtos)) {
|
||||
throw new BadRequestException("当前出库策略:先进先出,库存分配失败,失败原因:库存不足!");
|
||||
}
|
||||
List<StrategyStructMaterialVO> divStruct = new ArrayList<>();
|
||||
for (StructattrVechielDto vechielDto : vechielDtos) {
|
||||
if (planQty.intValue()<=0){
|
||||
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 divStruct;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,7 +40,10 @@ public enum IOSEnum {
|
||||
LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2"
|
||||
, "移入锁", "3", "移出锁", "4", "其他锁","9"
|
||||
)),
|
||||
|
||||
//库区类型
|
||||
ST_SECT_TYPE(MapOf.of("主存区", "00", "暂存区", "10", "平库", "90"
|
||||
, "移入锁", "3", "移出锁", "4", "其他锁","9"
|
||||
)),
|
||||
// 点位状态
|
||||
POINT_STATUS(MapOf.of("无货", "1", "有货", "2" )),
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.AddInvParam;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.enums.InventoryChangeType;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.OutDisParam;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.OutDisReverseParam;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.IOutBillService;
|
||||
@@ -592,17 +593,17 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
break;
|
||||
}
|
||||
}
|
||||
ioStorInvDisMapper.insert(ioStorInvDis);
|
||||
ioStorInvDisMapper.batchSave(disSet);
|
||||
|
||||
//锁定货位
|
||||
JSONObject lock_map = new JSONObject();
|
||||
lock_map.put("struct_code", outAllocation.getStruct_code());
|
||||
lock_map.put("inv_id", ioStorInv.getIostorinv_id());
|
||||
lock_map.put("inv_code", ioStorInv.getBill_code());
|
||||
lock_map.put("inv_type", ioStorInv.getBill_type());
|
||||
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁"));
|
||||
iStructattrService.updateStatusByCode("0",lock_map);
|
||||
|
||||
final Set<String> structs = disSet.stream().map(IOStorInvDis::getStruct_code).collect(Collectors.toSet());
|
||||
iStructattrService.update(new LambdaUpdateWrapper<>(Structattr.class)
|
||||
.set(Structattr::getInv_id,ioStorInv.getIostorinv_id())
|
||||
.set(Structattr::getInv_code,ioStorInv.getBill_code())
|
||||
.set(Structattr::getInv_type,ioStorInv.getBill_type())
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("出库锁"))
|
||||
.in(Structattr::getStruct_code,structs)
|
||||
);
|
||||
//更新详情
|
||||
dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
|
||||
dtl.setUnassign_qty(unassign_qty);
|
||||
@@ -727,7 +728,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
if (ObjectUtil.isEmpty(ioStorInv)) {
|
||||
throw new BadRequestException("当前订单无可分配出库明细");
|
||||
}
|
||||
|
||||
//查询生成和未分配完的明细
|
||||
JSONObject queryDtl = new JSONObject();
|
||||
queryDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完"));
|
||||
@@ -738,14 +738,22 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
if (ObjectUtil.isEmpty(dtls)) {
|
||||
throw new BadRequestException("当前订单无可分配出库明细");
|
||||
}
|
||||
|
||||
for (IOStorInvDtlDto dtl:dtls){
|
||||
double unassign_qty = dtl.getUnassign_qty().doubleValue();
|
||||
BigDecimal unassign_qty = dtl.getUnassign_qty();
|
||||
if (unassign_qty.intValue() <= 0){
|
||||
throw new BadRequestException("当前明细已全部分配,未分配数量已经为0");
|
||||
}
|
||||
//分配数量
|
||||
double allocation_canuse_qty = 0;
|
||||
BigDecimal allocation_canuse_qty = BigDecimal.ZERO;
|
||||
List<OutDisParam> outDisParams = new ArrayList<>();
|
||||
List<IOStorInvDis> invDis = new ArrayList<>();
|
||||
for (int i = 0; i < rows.size(); i++){
|
||||
JSONObject ivt = rows.getJSONObject(i);
|
||||
double canuse_qty = ivt.getDoubleValue("qty");
|
||||
//库存可用
|
||||
BigDecimal canuse_qty = ivt.getBigDecimal("qty");
|
||||
// BigDecimal frozen_qty = ivt.getBigDecimal("frozen_qty");
|
||||
//库存分配数:为负数
|
||||
BigDecimal change_qty = ivt.getBigDecimal("change_qty");
|
||||
//分配明细
|
||||
IOStorInvDis ioStorInvDis = new IOStorInvDis();
|
||||
ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
|
||||
@@ -758,6 +766,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setMaterial_code(dtl.getMaterial_code());
|
||||
ioStorInvDis.setSect_name(ivt.getString("sect_name"));
|
||||
ioStorInvDis.setSect_code(ivt.getString("sect_code"));
|
||||
//判断是不是平库
|
||||
ioStorInvDis.setStruct_id(ivt.getString("struct_id"));
|
||||
ioStorInvDis.setStruct_name(ivt.getString("struct_name"));
|
||||
ioStorInvDis.setStruct_code(ivt.getString("struct_code"));
|
||||
@@ -766,57 +775,44 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setQty_unit_id(dtl.getQty_unit_id());
|
||||
ioStorInvDis.setQty_unit_name(dtl.getQty_unit_name());
|
||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
if (unassign_qty <= 0){
|
||||
throw new BadRequestException("已全部分配完,未分配数量为0");
|
||||
unassign_qty = unassign_qty.subtract(change_qty);
|
||||
if (unassign_qty.intValue()<0){
|
||||
unassign_qty = BigDecimal.ZERO;
|
||||
}
|
||||
unassign_qty = unassign_qty-canuse_qty;
|
||||
if (unassign_qty<0){
|
||||
unassign_qty=0;
|
||||
allocation_canuse_qty = allocation_canuse_qty.add(change_qty);
|
||||
ioStorInvDis.setPlan_qty(change_qty);
|
||||
invDis.add(ioStorInvDis);
|
||||
outDisParams.add(OutDisParam.builder()
|
||||
.storagevehicleCode(ivt.getString("storagevehicle_code"))
|
||||
.materialCode(ivt.getString("material_code"))
|
||||
.pcsn(ivt.getString("pcsn"))
|
||||
.frozenQty(change_qty).build());
|
||||
}
|
||||
allocation_canuse_qty = allocation_canuse_qty + canuse_qty;
|
||||
ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
|
||||
|
||||
//锁定货位
|
||||
JSONObject lock_map = new JSONObject();
|
||||
lock_map.put("struct_code", ivt.getString("struct_code"));
|
||||
lock_map.put("inv_id", ioStorInv.getIostorinv_id());
|
||||
lock_map.put("inv_code", ioStorInv.getBill_code());
|
||||
lock_map.put("inv_type", ioStorInv.getBill_type());
|
||||
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁"));
|
||||
iStructattrService.updateStatusByCode("0",lock_map);
|
||||
|
||||
//生成分配明细
|
||||
ioStorInvDisMapper.insert(ioStorInvDis);
|
||||
|
||||
//更新库存 加冻结减可用
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_FROZEN);
|
||||
jsonIvt.put("storagevehicle_code", ivt.getString("storagevehicle_code"));
|
||||
jsonIvt.put("material_id", dtl.getMaterial_id());
|
||||
jsonIvt.put("pcsn", ivt.getString("pcsn"));
|
||||
jsonIvt.put("qty_unit_id", dtl.getQty_unit_id());
|
||||
jsonIvt.put("qty_unit_name", dtl.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
iMdPbGroupPlateService.updateIvt(updateIvtList);
|
||||
}
|
||||
|
||||
//锁定货位.生成分配明细,更新库存 加冻结减可用,锁定货位
|
||||
final Set<String> structs = invDis.stream().map(IOStorInvDis::getStruct_code).collect(Collectors.toSet());
|
||||
iStructattrService.update(new LambdaUpdateWrapper<>(Structattr.class)
|
||||
.set(Structattr::getInv_id,ioStorInv.getIostorinv_id())
|
||||
.set(Structattr::getInv_code,ioStorInv.getBill_code())
|
||||
.set(Structattr::getInv_type,ioStorInv.getBill_type())
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("出库锁"))
|
||||
.in(Structattr::getStruct_code,structs)
|
||||
);
|
||||
iStInventoryService.changeInventory(InventoryChangeType.OUT_DIS, outDisParams);
|
||||
ioStorInvDisMapper.batchSave(invDis);
|
||||
//更新详情
|
||||
dtl.setBill_status(unassign_qty==0 ? IOSEnum.BILL_STATUS.code("分配完"): IOSEnum.BILL_STATUS.code("分配中"));
|
||||
double assign_qty = allocation_canuse_qty + dtl.getAssign_qty().doubleValue();
|
||||
dtl.setUnassign_qty(BigDecimal.valueOf(unassign_qty));
|
||||
dtl.setAssign_qty(BigDecimal.valueOf(assign_qty));
|
||||
ioStorInvDtlMapper.updateById(dtl);
|
||||
final IOStorInvDtlDto dto = new IOStorInvDtlDto();
|
||||
dto.setBill_status(unassign_qty.intValue() == 0 ? IOSEnum.BILL_STATUS.code("分配完"): IOSEnum.BILL_STATUS.code("分配中"));
|
||||
dto.setUnassign_qty(unassign_qty);
|
||||
dto.setAssign_qty(allocation_canuse_qty.add(dtl.getAssign_qty()));
|
||||
dto.setIostorinvdtl_id(dtl.getIostorinvdtl_id());
|
||||
ioStorInvDtlMapper.updateById(dto);
|
||||
}
|
||||
|
||||
//更新主表
|
||||
//根据单据标识判断明细是否都已经分配完成
|
||||
int disCount = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
.eq(IOStorInvDtl::getIostorinv_id,iostorinv_id)
|
||||
.lt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完"))
|
||||
);
|
||||
|
||||
// 根据分配货位情况 更新主表单据状态
|
||||
IOStorInv ios = new IOStorInv();
|
||||
ios.setIostorinv_id(iostorinv_id);
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
package org.nl.wms.warehouse_manage.inventory.core.param.impl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.InventoryParam;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OutDisParam implements InventoryParam {
|
||||
private String storagevehicleCode;
|
||||
private String materialCode;
|
||||
private String pcsn;
|
||||
private BigDecimal qty;
|
||||
private String extCode;
|
||||
private String extType;
|
||||
private String unitName;
|
||||
private BigDecimal frozenQty;
|
||||
private String remark;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -105,11 +105,11 @@ public class StInventoryServiceImpl implements IStInventoryService {
|
||||
if (groupPlate == null){
|
||||
throw new BadRequestException("库存增加失败,当前库存不存在");
|
||||
}
|
||||
final BigDecimal qty = groupPlate.getQty().subtract(outDisParam.getQty());
|
||||
final BigDecimal qty = groupPlate.getQty().subtract(outDisParam.getFrozenQty());
|
||||
if (qty.intValue() < 0) {
|
||||
throw new BadRequestException("库存变动失败,可用数量-变动数量为负数"+groupPlate.getStoragevehicle_code());
|
||||
}
|
||||
final BigDecimal frozenQty = groupPlate.getFrozen_qty().add(outDisParam.getQty());
|
||||
final BigDecimal frozenQty = groupPlate.getFrozen_qty().add(outDisParam.getFrozenQty());
|
||||
iMdPbGroupplateService.update(new LambdaUpdateWrapper<GroupPlate>()
|
||||
.set(GroupPlate::getQty, qty)
|
||||
.set(GroupPlate::getFrozen_qty,frozenQty)
|
||||
|
||||
@@ -211,6 +211,7 @@
|
||||
<span v-show="mstrow.bill_type !== '1011'">{{ parseFloat(scope.row.plan_qty).toFixed(3) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column show-overflow-tooltip prop="sect_code" width="150px" label="库区" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="struct_code" width="150px" label="仓位编码" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="struct_name" width="150px" label="仓位名称" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="insert_time" width="150px" label="入库时间" align="center" />
|
||||
@@ -224,7 +225,7 @@
|
||||
</el-table>
|
||||
</el-card>
|
||||
<pointDialog ref="child" :dialog-show.sync="pointshow" :dialog-typedisable="typedisable" :dialog-areatype="areatype" @PointChanged="PointChanged" />
|
||||
<StructIvt :dialog-show.sync="structshow" :stor-id="storId" :open-array="openParam" :rowmst="openRow" @StructIvtClosed="queryTableDtl2" />
|
||||
<StructIvt :dialog-show.sync="structshow" :stor-id="storId" :open-array="openParam" :rowmst="openRow" @StructIvtClosed="queryTableDtl" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@@ -494,9 +495,6 @@ export default {
|
||||
this.tableDtl = res
|
||||
})
|
||||
},
|
||||
queryTableDtl2() {
|
||||
this.queryTableDtl()
|
||||
},
|
||||
queryTableDdis(iostorinvdtl_id) {
|
||||
checkoutbill.getOutBillDis({ 'iostorinvdtl_id': iostorinvdtl_id, 'bill_status': '01' }).then(res => {
|
||||
this.tabledis = res
|
||||
|
||||
@@ -93,9 +93,11 @@
|
||||
<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 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 sortable prop="qty" label="库存数量" align="center" width="150px" />
|
||||
<el-table-column show-overflow-tooltip sortable prop="frozen_qty" label="冻结数量" align="center" width="150px" />
|
||||
<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"></el-input>
|
||||
<el-input v-model="scope.row.change_qty" clearable style="width: 120px" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" width="160" fixed="right">
|
||||
@@ -204,15 +206,15 @@ export default {
|
||||
}
|
||||
row.edit = !row.edit
|
||||
if (row.edit) {
|
||||
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) - parseFloat(row.qty)
|
||||
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) + parseFloat(row.qty)
|
||||
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) - parseFloat(row.change_qty)
|
||||
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) + parseFloat(row.change_qty)
|
||||
} else {
|
||||
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) - parseFloat(row.qty)
|
||||
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) - parseFloat(row.change_qty)
|
||||
// 如果待分配重量等于0则 明细重量 - 已分配重量
|
||||
if (parseInt(this.queryrow.unassign_qty) === 0) {
|
||||
this.queryrow.unassign_qty = parseFloat(this.goal_unassign_qty) - parseFloat(this.queryrow.assign_qty)
|
||||
} else {
|
||||
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + parseFloat(row.qty)
|
||||
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + parseFloat(row.change_qty)
|
||||
}
|
||||
if (this.queryrow.unassign_qty > this.goal_unassign_qty) {
|
||||
this.queryrow.unassign_qty = JSON.parse(JSON.stringify(this.goal_unassign_qty))
|
||||
|
||||
Reference in New Issue
Block a user