rev:出库分配库存修改
This commit is contained in:
@@ -175,7 +175,7 @@ public class DevicerepairitemsServiceImpl implements DevicerepairitemsService {
|
||||
ExcelReader excelReader = ExcelUtil.getReader(file.getInputStream(), 0);
|
||||
// 从第1行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列
|
||||
ColumnInfoService columnInfoService = SpringContextHolder.getBean(ColumnInfoService.class);
|
||||
Map<String, String> tableColumn = columnInfoService.TableColumn2("em_bi_devicerepairitems");
|
||||
Map<String, String> tableColumn = columnInfoService.TableColumn2("6345");
|
||||
List<List<Object>> read = excelReader.read(0, excelReader.getRowCount());
|
||||
Map<Integer, String> IndexValue = new HashMap<>();
|
||||
for (int i = 0; i < read.get(0).size(); i++) {
|
||||
|
||||
@@ -231,6 +231,10 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
if(StringUtils.isEmpty(pdmProduceWorkorder.getWorkorder_code()) || pdmProduceWorkorder.getWorkorder_code().equals("0")) {
|
||||
this.update(new UpdateWrapper<PdmProduceWorkorder>().eq("workorder_id", pdmProduceWorkorder.getWorkorder_id()).set("workorder_code", CodeUtil.getNewCode("PDM_SHIFTORDER")));
|
||||
}
|
||||
BigDecimal report_qty = pdmProduceWorkorder.getReport_qty();
|
||||
if (report_qty == null){
|
||||
report_qty = new BigDecimal(0);
|
||||
}
|
||||
this.update(new UpdateWrapper<PdmProduceWorkorder>().set("workorder_status", WorkerOrderEnum.FORCE_COMPLETE.getCode()).set("confirm_id", SecurityUtils.getCurrentUserId()).set("confirm_name", SecurityUtils.getCurrentNickName()).set("confirm_time", new Date()).set("aps_workorder_status", "B").set("realproduceend_date", DateUtil.now().replace("-", "/")).set("aps_update_flag", "M").set("aps_update_inner_flag", "M").set("aps_update_time", DateUtil.now()).set("update_time", DateUtil.now()).set("update_id", SecurityUtils.getCurrentUserId()).set("update_name", SecurityUtils.getCurrentNickName()).in("workorder_id", workorder_id));
|
||||
JSONArray array = new JSONArray();
|
||||
JSONObject map = new JSONObject();
|
||||
@@ -688,6 +692,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
workOrder.setUpdate_time(new Date());
|
||||
workOrder.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
workOrder.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
workOrder.setRepare_qty(new BigDecimal(0));
|
||||
workOrder.setReal_qty(null);
|
||||
workOrder.setOpen_time(DateUtil.now());
|
||||
this.update(workOrder, new QueryWrapper<PdmProduceWorkorder>().eq("workorder_id", param.getString("workorder_id")));
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -20,6 +21,7 @@ import org.nl.common.enums.AcsTaskEnum;
|
||||
import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.publish.BussEventMulticaster;
|
||||
import org.nl.common.publish.event.PointEvent;
|
||||
import org.nl.common.utils.CopyUtil;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
@@ -56,6 +58,7 @@ import org.nl.wms.storage_manage.productmanage.service.moreOrLess.IStIfDeliveryo
|
||||
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIfDeliveryorderCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.structIvt.IStIvtStructivtCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.structIvt.dao.StIvtStructivtCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.structIvt.dto.StIvtStructivtCpAndSort;
|
||||
import org.nl.wms.storage_manage.productmanage.util.ChangeIvtUtil;
|
||||
import org.nl.wms.storage_manage.productmanage.util.DivRuleCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.util.RuleUtil;
|
||||
@@ -65,10 +68,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -81,6 +81,7 @@ import java.util.stream.Collectors;
|
||||
* @since 2023-05-04
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCpMapper, StIvtIostorinvCp> implements IStIvtIostorinvCpOutService {
|
||||
|
||||
@Autowired
|
||||
@@ -268,24 +269,31 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
|
||||
param.put("rule_type", RuleUtil.PRODUCTION_OUT_1);
|
||||
}
|
||||
|
||||
List<StIvtStructivtCp> ivtList = new ArrayList<>(); // 需要更新库存、仓位、插入分配明细的集合
|
||||
|
||||
|
||||
List<StIvtStructivtCp> cps = divRuleCpService.divRuleOut(param);
|
||||
if (CollectionUtils.isEmpty(cps)){
|
||||
throw new BadRequestException("库存不足");
|
||||
}
|
||||
for (StIvtStructivtCp ivtDao : cps) {//分配规则需要考虑托盘跟数量 100 200 500 --200
|
||||
log.info("未分配数量:{},库存数量:{}",unassign_qty,cps.stream().map(a->a.getStruct_code()+"_"+a.getCanuse_qty()).collect(Collectors.joining(",")));
|
||||
List<StIvtStructivtCpAndSort> sorts = CopyUtil.copyList(cps, StIvtStructivtCpAndSort.class);
|
||||
for (StIvtStructivtCpAndSort sort : sorts) {
|
||||
sort.setDiff(Math.abs(sort.getCanuse_qty().subtract(dtlDao.getUnassign_qty()).intValue()));
|
||||
}
|
||||
sorts.sort(Comparator.comparingInt(StIvtStructivtCpAndSort::getDiff));
|
||||
|
||||
List<StIvtStructivtCpAndSort> ivtsortList = new ArrayList<>(); // 需要更新库存、仓位、插入分配明细的集合
|
||||
for (StIvtStructivtCpAndSort ivtDao : sorts) {//分配规则需要考虑托盘跟数量 100 200 500 --200
|
||||
if (unassign_qty<=0){
|
||||
break;
|
||||
}
|
||||
// 更新未分配数
|
||||
unassign_qty = NumberUtil.sub(unassign_qty,ivtDao.getCanuse_qty().doubleValue());
|
||||
ivtList.add(ivtDao);
|
||||
ivtsortList.add(ivtDao);
|
||||
}
|
||||
|
||||
// 3.插入分配表
|
||||
iostorinvdisCpService.onductDataOutDis(ivtList,dtlDao);
|
||||
List<StIvtStructivtCp> ivtList = CopyUtil.copyList(ivtsortList, StIvtStructivtCp.class);
|
||||
iostorinvdisCpService.onductDataOutDis(CopyUtil.copyList(ivtList,StIvtStructivtCp.class),dtlDao);
|
||||
|
||||
// 4.更新明细状态
|
||||
BigDecimal assign_qty = ivtList.stream()
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
package org.nl.wms.storage_manage.productmanage.service.structIvt.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓位库存表:半成品/成品公用
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-04
|
||||
*/
|
||||
@Data
|
||||
public class StIvtStructivtCpAndSort implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 库存记录标识
|
||||
*/
|
||||
@TableId
|
||||
private String stockrecord_id;
|
||||
|
||||
/**
|
||||
* 仓位标识
|
||||
*/
|
||||
private String struct_id;
|
||||
|
||||
/**
|
||||
* 仓位编码
|
||||
*/
|
||||
private String struct_code;
|
||||
|
||||
/**
|
||||
* 仓位名称
|
||||
*/
|
||||
private String struct_name;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 品质类型
|
||||
*/
|
||||
private String quality_scode;
|
||||
|
||||
/**
|
||||
* 库存等级
|
||||
*/
|
||||
private String ivt_level;
|
||||
|
||||
/**
|
||||
* 是否可用
|
||||
*/
|
||||
private Boolean is_active;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String pcsn;
|
||||
|
||||
/**
|
||||
* 可用数
|
||||
*/
|
||||
private BigDecimal canuse_qty;
|
||||
|
||||
/**
|
||||
* 冻结数
|
||||
*/
|
||||
private BigDecimal frozen_qty;
|
||||
|
||||
/**
|
||||
* 库存数
|
||||
*/
|
||||
private BigDecimal ivt_qty;
|
||||
|
||||
/**
|
||||
* 待入数
|
||||
*/
|
||||
private BigDecimal warehousing_qty;
|
||||
|
||||
/**
|
||||
* 计量单位标识
|
||||
*/
|
||||
private String qty_unit_id;
|
||||
|
||||
/**
|
||||
* 入库时间
|
||||
*/
|
||||
private String instorage_time;
|
||||
|
||||
/**
|
||||
* 销售单标识
|
||||
*/
|
||||
private String sale_id;
|
||||
|
||||
/**
|
||||
* 仓库标识
|
||||
*/
|
||||
private String stor_id;
|
||||
|
||||
/**
|
||||
* 车间标识
|
||||
*/
|
||||
private String product_area;
|
||||
|
||||
/**
|
||||
* 单重
|
||||
*/
|
||||
private BigDecimal unit_weight;
|
||||
|
||||
/**
|
||||
* 单据类型
|
||||
*/
|
||||
private String bill_type;
|
||||
|
||||
|
||||
/**
|
||||
* 单据类型
|
||||
*/
|
||||
private Integer diff;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user