Merge branch 'technology-init-lhj1119' into technology/rakor-202503
This commit is contained in:
commit
123597ceb4
|
|
@ -372,6 +372,16 @@ public class MaterialMainApi extends BaseApi {
|
||||||
materialMainService.materialStockTask();
|
materialMainService.materialStockTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动从SAP获取物料的最近出库时间、最近采购价格、最近采购日期、物料价格
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@GetMapping("materialPurchaseInfo")
|
||||||
|
public void materialPurchaseInfo() throws Exception {
|
||||||
|
materialMainService.materialPurchaseInfo();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据物料编码获取外形图片
|
* 根据物料编码获取外形图片
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|
|
||||||
|
|
@ -84,4 +84,6 @@ public interface MaterialMainMapper extends BaseMapper<MaterialMainEntity> {
|
||||||
void updateBatchTwoYearsUsage(@Param("list") List<MaterialMainEntity> list);
|
void updateBatchTwoYearsUsage(@Param("list") List<MaterialMainEntity> list);
|
||||||
|
|
||||||
List<Map<String,Object>> getMaterialNoListDataMap(@Param("query") MaterialMainQuery query, @Param("startIndex") Long startIndex, @Param("pageSize")Long pageSize );
|
List<Map<String,Object>> getMaterialNoListDataMap(@Param("query") MaterialMainQuery query, @Param("startIndex") Long startIndex, @Param("pageSize")Long pageSize );
|
||||||
|
|
||||||
|
void saveBatchMaterialPrice(@Param("list") List<Map<String, Object>> list);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2264,6 +2264,7 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
||||||
if (CollUtil.isEmpty(mResult)) {
|
if (CollUtil.isEmpty(mResult)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
saveMaterialPriceWhenLastDayOfMonth(mResult);
|
||||||
// 过滤掉几个字段都没有值的数据,降低数据库的负担
|
// 过滤掉几个字段都没有值的数据,降低数据库的负担
|
||||||
List<MaterialMainEntity> filterList = mResult.stream().filter(item -> Objects.nonNull(item.getLastOutWarehouseTime())).collect(Collectors.toList());
|
List<MaterialMainEntity> filterList = mResult.stream().filter(item -> Objects.nonNull(item.getLastOutWarehouseTime())).collect(Collectors.toList());
|
||||||
if (CollUtil.isEmpty(filterList)) {
|
if (CollUtil.isEmpty(filterList)) {
|
||||||
|
|
@ -2275,6 +2276,36 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
||||||
log.info("获取物料的最近出库时间、最近采购价格、最近采购日期、物料价格结束");
|
log.info("获取物料的最近出库时间、最近采购价格、最近采购日期、物料价格结束");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 如果是月末最后一天,则保存物料价格月度版本
|
||||||
|
* @param list
|
||||||
|
*/
|
||||||
|
private void saveMaterialPriceWhenLastDayOfMonth(List<MaterialMainEntity> list) {
|
||||||
|
LocalDate localDate = LocalDate.now(); // 当前日期
|
||||||
|
int now = localDate.getDayOfMonth();
|
||||||
|
int length = localDate.lengthOfMonth();
|
||||||
|
// 如果是月末最后一天
|
||||||
|
if (now == length/*true*/) {
|
||||||
|
// 采购大类
|
||||||
|
List<MaterialMainEntity> purList = list.stream().filter(item -> ObjectUtil.isNotEmpty(item.getMaterialCategoryCode())
|
||||||
|
&& item.getMaterialCategoryCode().startsWith("10")).collect(Collectors.toList());
|
||||||
|
if (CollectionUtil.isNotEmpty(purList)) {
|
||||||
|
String storageDate = localDate.format(DateTimeFormatter.ofPattern("yyyyMM"));
|
||||||
|
List<Map<String, Object>> mapList = new ArrayList<>(purList.size());
|
||||||
|
purList.forEach(pur -> {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("rowId", IdWorker.getId());
|
||||||
|
map.put("materialNo", pur.getMaterialNo());
|
||||||
|
map.put("materialPrice", pur.getMaterialPrice());
|
||||||
|
map.put("materialUnit", ""); // 价格单位暂且位空
|
||||||
|
map.put("storageDate", storageDate);
|
||||||
|
mapList.add(map);
|
||||||
|
});
|
||||||
|
materialMainMapper.saveBatchMaterialPrice(mapList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateMaterialPurchaseInfo(List<MaterialMainEntity> filterList) {
|
private void updateMaterialPurchaseInfo(List<MaterialMainEntity> filterList) {
|
||||||
if (CollUtil.isEmpty(filterList)) {
|
if (CollUtil.isEmpty(filterList)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -584,4 +584,11 @@
|
||||||
order by rowId desc
|
order by rowId desc
|
||||||
limit #{startIndex} ,#{pageSize}
|
limit #{startIndex} ,#{pageSize}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<insert id="saveBatchMaterialPrice" keyProperty="rowId" useGeneratedKeys="true">
|
||||||
|
insert into t_material_main_price (`row_id`, `material_no`, `material_price`, `material_unit`, `storage_date`) values
|
||||||
|
<foreach collection="list" item="item" index="index" separator=",">
|
||||||
|
(#{item.rowId}, #{item.materialNo}, #{item.materialPrice}, #{item.materialUnit}, #{item.storageDate})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue