【生产订单】优化
This commit is contained in:
parent
fc13cf3700
commit
0e3c3c3186
|
|
@ -5,8 +5,8 @@ import com.nflg.product.base.core.api.BaseApi;
|
|||
import com.nflg.product.bomnew.pojo.query.ProductionOrderQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.ProductionOrderSaveQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.QueryMaterialsQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.EbomQueryMaterialsVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ProductionOrderItemVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ProductionOrderMaterialsVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ProductionOrderVO;
|
||||
import com.nflg.product.bomnew.service.ProductionOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -123,7 +123,7 @@ public class ProductionOrderApi extends BaseApi {
|
|||
*/
|
||||
@PostMapping("queryMaterials")
|
||||
@ApiOperation("批量查询物料信息")
|
||||
public ResultVO<List<EbomQueryMaterialsVO>> queryMaterials(@Valid @RequestBody @NotEmpty List<QueryMaterialsQuery> query) {
|
||||
public ResultVO<List<ProductionOrderMaterialsVO>> queryMaterials(@Valid @RequestBody @NotEmpty List<QueryMaterialsQuery> query) {
|
||||
return ResultVO.success(productionOrderService.queryMaterials(query));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,13 @@ public class ProductionOrderItemSapEntity implements Serializable {
|
|||
* BDTER=Tue Jan 02 00:00:00 CST 2024, 组件的需求日期
|
||||
* SORTF=, 排序字符串
|
||||
* MATNR=000000002100330331 物料号
|
||||
*
|
||||
* VORNR=, 操作/活动编号
|
||||
* POTX1=, BOM 项目文本(行1)
|
||||
* POTX2=, BOM 项目文本 (行 2)
|
||||
* CUD=, 字符字段长度 = 10
|
||||
* XLOEK=, 已删除项目
|
||||
* RGEKZ=, 标识:反冲(有值X)
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -116,6 +123,24 @@ public class ProductionOrderItemSapEntity implements Serializable {
|
|||
@TableField(value = "MATNR")
|
||||
private String MATNR;
|
||||
|
||||
@TableField(value = "VORNR")
|
||||
private String VORNR;
|
||||
|
||||
@TableField(value = "POTX1")
|
||||
private String POTX1;
|
||||
|
||||
@TableField(value = "POTX2")
|
||||
private String POTX2;
|
||||
|
||||
@TableField(value = "CUD")
|
||||
private String CUD;
|
||||
|
||||
@TableField(value = "XLOEK")
|
||||
private String XLOEK;
|
||||
|
||||
@TableField(value = "RGEKZ")
|
||||
private String RGEKZ;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class ProductionOrderSapEntity implements Serializable {
|
|||
* GMEIN=ST, 基本计量单位
|
||||
* STLBEZ=000000002120230002, 物料号
|
||||
* GAMNG=1.000, 订单数量总计
|
||||
* AUTYP=10, 订单类型
|
||||
* AUART=NF01, 订单类型
|
||||
* AUFNR=000010435564, 订单号
|
||||
* RSNUM=0001308129, 预留/相关需求的编号
|
||||
* ERFZEIT=Thu Jan 01 21:59:00 CST 1970, 创建的时间
|
||||
|
|
@ -73,8 +73,8 @@ public class ProductionOrderSapEntity implements Serializable {
|
|||
@TableField(value = "GAMNG")
|
||||
private String GAMNG;
|
||||
|
||||
@TableField(value = "AUTYP")
|
||||
private String AUTYP;
|
||||
@TableField(value = "AUART")
|
||||
private String AUART;
|
||||
|
||||
@TableField(value = "AUFNR")
|
||||
private String AUFNR;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,12 @@ public class ProductionOrderQuery extends BasePageQuery implements Serializable
|
|||
@ApiModelProperty(value = "结束时间")
|
||||
private String endDate;
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
@ApiModelProperty(value = "工厂")
|
||||
private String factory;
|
||||
|
||||
/**
|
||||
* 确认情况 0设计待确认 1供应链待确认 2计划待确认 3计划已确认
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -45,4 +45,16 @@ public class QueryMaterialsQuery {
|
|||
*/
|
||||
@ApiModelProperty("项目类别")
|
||||
private String projectType;
|
||||
|
||||
/**
|
||||
* 工厂
|
||||
*/
|
||||
@ApiModelProperty(value = "工厂")
|
||||
private String factory;
|
||||
|
||||
/**
|
||||
* 存储地点
|
||||
*/
|
||||
@ApiModelProperty(value = "存储地点")
|
||||
private String storage;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author makejava
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductionOrderMaterialsVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("物料主数据行ID")
|
||||
private Long materialRowId;
|
||||
|
||||
@ApiModelProperty("物料编码")
|
||||
private String materialNo;
|
||||
|
||||
@ApiModelProperty("物料名称")
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("物料描述")
|
||||
private String materialDesc;
|
||||
|
||||
@ApiModelProperty("物料分类编码")
|
||||
private String materialCategoryCode;
|
||||
|
||||
@ApiModelProperty("制作物料获取类型:1=自制、2=外协、3=采购")
|
||||
private Integer materialGetType;
|
||||
|
||||
@ApiModelProperty("采购类型")
|
||||
private String procureType;
|
||||
|
||||
@ApiModelProperty("物料状态 1:激活 2:禁止采购 3:售后专用 4:冻结 5:完全弃用")
|
||||
private Integer materialState;
|
||||
|
||||
@ApiModelProperty("图号")
|
||||
protected String drawingNo;
|
||||
|
||||
/**
|
||||
* 材料
|
||||
*/
|
||||
@ApiModelProperty(value = "材料")
|
||||
private String material;
|
||||
|
||||
@ApiModelProperty("材质")
|
||||
private String materialTexture;
|
||||
|
||||
@ApiModelProperty("物料大类别")
|
||||
private String relCategoryCode;
|
||||
|
||||
@ApiModelProperty("物料分类编码名称")
|
||||
private String categoryName;
|
||||
|
||||
@ApiModelProperty("单位")
|
||||
private String materialUnit;
|
||||
|
||||
@ApiModelProperty("单重")
|
||||
private BigDecimal materialWeight;
|
||||
|
||||
/**
|
||||
* 前端行序号
|
||||
*/
|
||||
@ApiModelProperty(value = "前端行序号")
|
||||
private String orderNumber;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createdTime = LocalDateTime.now();
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private LocalDateTime modifyTime;
|
||||
|
||||
/**
|
||||
* 存储地点
|
||||
*/
|
||||
@ApiModelProperty(value = "存储地点")
|
||||
private String storage;
|
||||
|
||||
}
|
||||
|
|
@ -3,8 +3,8 @@ package com.nflg.product.bomnew.service;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.convert.Converter;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
|
@ -23,7 +23,6 @@ import com.nflg.product.bomnew.mapper.master.ProductionOrderMapper;
|
|||
import com.nflg.product.bomnew.mapper.master.ProductionOrderSapMapper;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.SapReqParams;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.SapResult;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.production.ProImportSapParamDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.sap.production.ProT1DTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.ProductionOrderEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.ProductionOrderItemEntity;
|
||||
|
|
@ -33,15 +32,13 @@ import com.nflg.product.bomnew.pojo.query.ProductionOrderQuery;
|
|||
import com.nflg.product.bomnew.pojo.query.ProductionOrderSaveQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.QueryMaterialsQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.EbomQueryMaterialsVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ProductionOrderItemVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ProductionOrderMaterialsVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.ProductionOrderVO;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
@ -51,7 +48,6 @@ import java.time.LocalDateTime;
|
|||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
|
@ -89,6 +85,13 @@ public class ProductionOrderService extends ServiceImpl<ProductionOrderMapper, P
|
|||
List<ProductionOrderItemVO> itemVOList = Convert.toList(ProductionOrderItemVO.class, itemList);
|
||||
if (CollUtil.isNotEmpty(itemVOList)) {
|
||||
materialMainService.intiMaterialInfo(itemVOList, "projectType");
|
||||
// List<String> materialNoList = itemVOList.stream().map(ProductionOrderItemVO::getMaterialNo).collect(Collectors.toList());
|
||||
// List<String> factoryList = Collections.singletonList(itemVOList.get(0).getFactory());
|
||||
// List<Map<String, Object>> storageList = sapService.lgproByList(materialNoList, factoryList);
|
||||
// if (CollUtil.isNotEmpty(storageList)) {
|
||||
// Map<String, String> storageMap = storageList.stream().collect(Collectors.toMap(item -> item.get("MATNR").toString(), item -> item.get("LGPRO").toString(), (k1, k2) -> k2));
|
||||
// itemVOList.forEach(itemVO -> itemVO.setStorage(storageMap.get(StrUtil.padPre(itemVO.getMaterialNo(), 18, "0"))));
|
||||
// }
|
||||
}
|
||||
return itemVOList;
|
||||
}
|
||||
|
|
@ -345,7 +348,7 @@ public class ProductionOrderService extends ServiceImpl<ProductionOrderMapper, P
|
|||
* GMEIN=ST, 基本计量单位
|
||||
* STLBEZ=000000002120230002, 物料号
|
||||
* GAMNG=1.000, 订单数量总计
|
||||
* AUTYP=10, 订单类型
|
||||
* AUART=10, 订单类型
|
||||
* AUFNR=000010435564, 订单号
|
||||
* RSNUM=0001308129, 预留/相关需求的编号
|
||||
* ERFZEIT=Thu Jan 01 21:59:00 CST 1970, 创建的时间
|
||||
|
|
@ -383,7 +386,7 @@ public class ProductionOrderService extends ServiceImpl<ProductionOrderMapper, P
|
|||
save.setMaterialNo(ObjectUtil.isNotEmpty(head.get("STLBEZ")) ? head.get("STLBEZ").toString().replaceAll("^0+", "") : "");
|
||||
save.setNum(ObjectUtil.isNotEmpty(head.get("GAMNG")) ? new BigDecimal(head.get("GAMNG").toString()) : null);
|
||||
save.setUnit(ObjectUtil.isNotEmpty(head.get("GMEIN")) ? head.get("GMEIN").toString() : "");
|
||||
save.setOrderType(ObjectUtil.isNotEmpty(head.get("AUTYP")) ? head.get("AUTYP").toString() : "");
|
||||
save.setOrderType(ObjectUtil.isNotEmpty(head.get("AUART")) ? head.get("AUART").toString() : "");
|
||||
save.setLongText("");
|
||||
save.setContractNo("");
|
||||
save.setFindId("");
|
||||
|
|
@ -445,6 +448,7 @@ public class ProductionOrderService extends ServiceImpl<ProductionOrderMapper, P
|
|||
productionOrderItemEntity.setBatchNo(ObjectUtil.isNotEmpty(filterItem.get("CHARG")) ? filterItem.get("CHARG").toString() : "");
|
||||
productionOrderItemEntity.setFactory(ObjectUtil.isNotEmpty(filterItem.get("WERKS")) ? filterItem.get("WERKS").toString() : "");
|
||||
productionOrderItemEntity.setStorage(ObjectUtil.isNotEmpty(filterItem.get("LGORT")) ? filterItem.get("LGORT").toString() : "");
|
||||
productionOrderItemEntity.setFanchong(ObjectUtil.isNotEmpty(filterItem.get("RGEKZ")) && "X".equalsIgnoreCase(filterItem.get("RGEKZ").toString()) ? 1 : 0);
|
||||
|
||||
productionOrderItemEntity.setCreatedBy(SessionUtil.getUserCode());
|
||||
productionOrderItemEntity.setCreatedTime(LocalDateTime.now());
|
||||
|
|
@ -468,7 +472,7 @@ public class ProductionOrderService extends ServiceImpl<ProductionOrderMapper, P
|
|||
return ResultVO.success();
|
||||
}
|
||||
|
||||
public List<EbomQueryMaterialsVO> queryMaterials(List<QueryMaterialsQuery> query) {
|
||||
public List<ProductionOrderMaterialsVO> queryMaterials(List<QueryMaterialsQuery> query) {
|
||||
List<BaseMaterialVO> datas = new ArrayList<>();
|
||||
List<String> keys = query.stream().map(QueryMaterialsQuery::getMaterialNo)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
|
|
@ -477,22 +481,33 @@ public class ProductionOrderService extends ServiceImpl<ProductionOrderMapper, P
|
|||
if (CollUtil.isNotEmpty(keys)) {
|
||||
datas.addAll(SpringUtil.getBean(MaterialMainMapper.class).getMaterialBaseInfo(keys));
|
||||
}
|
||||
return query.stream().map(q -> {
|
||||
List<ProductionOrderMaterialsVO> resultList = query.stream().map(q -> {
|
||||
BaseMaterialVO mVO = datas.stream()
|
||||
.filter(m -> StrUtil.isNotBlank(q.getMaterialNo()) ? StrUtil.equals(m.getMaterialNo(), q.getMaterialNo())
|
||||
: StrUtil.equals(m.getDrawingNo(), q.getDrawingNo()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
EbomQueryMaterialsVO vo = new EbomQueryMaterialsVO();
|
||||
ProductionOrderMaterialsVO vo = new ProductionOrderMaterialsVO();
|
||||
vo.setOrderNumber(q.getOrderNumber());
|
||||
vo.setMaterialNo(q.getMaterialNo());
|
||||
if (Objects.nonNull(mVO)) {
|
||||
vo.setMaterialNo(mVO.getMaterialNo());
|
||||
vo.setMaterialName(mVO.getMaterialName());
|
||||
vo.setMaterialDesc(mVO.getMaterialDesc());
|
||||
vo.setMaterialUnit(mVO.getMaterialUnit());
|
||||
}
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(resultList)) {
|
||||
List<String> materialNoList = resultList.stream().map(ProductionOrderMaterialsVO::getMaterialNo).collect(Collectors.toList());
|
||||
List<String> factoryList = Collections.singletonList(query.get(0).getFactory());
|
||||
List<Map<String, Object>> storageList = sapService.lgproByList(materialNoList, factoryList);
|
||||
if (CollUtil.isNotEmpty(storageList)) {
|
||||
Map<String, String> storageMap = storageList.stream().collect(Collectors.toMap(item -> item.get("MATNR").toString(), item -> item.get("LGPRO").toString(), (k1, k2) -> k2));
|
||||
resultList.forEach(itemVO -> itemVO.setStorage(storageMap.get(StrUtil.padPre(itemVO.getMaterialNo(), 18, "0"))));
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@
|
|||
<if test="query.endDate!=null and query.endDate!=''">
|
||||
and created_time <= #{query.endDate}
|
||||
</if>
|
||||
<if test="query.factory!=null and query.factory!=''">
|
||||
and factory = #{query.factory}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getListByPage" resultType="com.nflg.product.bomnew.pojo.vo.ProductionOrderVO">
|
||||
|
|
|
|||
Loading…
Reference in New Issue