refactor(物料管理): 同步小型刀具库功能完善
This commit is contained in:
parent
36fdaa5687
commit
b608fcb2bf
@ -18,6 +18,7 @@ import com.ktg.mes.md.service.IMdUnitMeasureService;
|
||||
import com.ktg.mes.wm.utils.WmBarCodeUtil;
|
||||
import com.ktg.system.domain.SysOperLog;
|
||||
import com.ktg.system.service.ISysOperLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -29,22 +30,13 @@ import java.util.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/mes/md/mditem")
|
||||
@RequiredArgsConstructor
|
||||
public class MdItemController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IMdItemService mdItemService;
|
||||
|
||||
@Autowired
|
||||
private IItemTypeService iItemTypeService;
|
||||
|
||||
@Autowired
|
||||
private IMdUnitMeasureService mdUnitMeasureService;
|
||||
|
||||
@Autowired
|
||||
private WmBarCodeUtil barcodeUtil;
|
||||
|
||||
@Autowired
|
||||
private ISysOperLogService operLogService;
|
||||
private final IMdItemService mdItemService;
|
||||
private final IItemTypeService iItemTypeService;
|
||||
private final IMdUnitMeasureService mdUnitMeasureService;
|
||||
private final WmBarCodeUtil barcodeUtil;
|
||||
private final ISysOperLogService operLogService;
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
@ -140,6 +132,15 @@ public class MdItemController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步小型刀具库 物料数据
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/asyncSmallKnife")
|
||||
public AjaxResult asyncSmallKnifeData() {
|
||||
return AjaxResult.success(mdItemService.asyncSmallKnifeData());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出物料列表
|
||||
*/
|
||||
|
@ -1,10 +1,12 @@
|
||||
package com.ktg.mes.md.mapper;
|
||||
|
||||
import com.ktg.common.core.domain.entity.ItemType;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ItemTypeMapper {
|
||||
|
||||
/**
|
||||
|
@ -20,6 +20,12 @@ public interface IMdItemService {
|
||||
*/
|
||||
public List<MdItem> selectMdItemAll();
|
||||
|
||||
/**
|
||||
* 同步小型刀具库数据
|
||||
* @return
|
||||
*/
|
||||
public int asyncSmallKnifeData();
|
||||
|
||||
/**
|
||||
* 获取导出格式的物料产品清单
|
||||
* 主要区别是物料分类会以【父级分类】/【子集分类】的方式组合
|
||||
|
@ -10,8 +10,11 @@ import com.ktg.mes.md.mapper.BaseKnifeMapper;
|
||||
import com.ktg.mes.md.mapper.ItemTypeMapper;
|
||||
import com.ktg.mes.md.mapper.MdItemMapper;
|
||||
import com.ktg.mes.md.service.IMdItemService;
|
||||
import com.ktg.mes.stl.domain.StlMaterial;
|
||||
import com.ktg.mes.stl.mapper.StlMaterialMapper;
|
||||
import com.ktg.mes.wm.utils.WmBarCodeUtil;
|
||||
import com.ktg.system.strategy.AutoCodeUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@ -20,24 +23,15 @@ import javax.validation.Validator;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class MdItemServiceImpl implements IMdItemService {
|
||||
@Autowired
|
||||
private BaseKnifeMapper baseKnifeMapper;
|
||||
|
||||
@Autowired
|
||||
private MdItemMapper mdItemMapper;
|
||||
|
||||
@Autowired
|
||||
private ItemTypeMapper itemTypeMapper;
|
||||
|
||||
@Autowired
|
||||
protected Validator validator;
|
||||
|
||||
@Autowired
|
||||
private WmBarCodeUtil barCodeUtil;
|
||||
|
||||
@Autowired
|
||||
private AutoCodeUtil autoCodeUtil;
|
||||
private final BaseKnifeMapper baseKnifeMapper;
|
||||
private final MdItemMapper mdItemMapper;
|
||||
private final ItemTypeMapper itemTypeMapper;
|
||||
protected final Validator validator;
|
||||
private final WmBarCodeUtil barCodeUtil;
|
||||
private final AutoCodeUtil autoCodeUtil;
|
||||
private final StlMaterialMapper stlMaterialMapper;
|
||||
|
||||
@Override
|
||||
public List<MdItem> selectMdItemList(MdItem mdItem) {
|
||||
@ -53,6 +47,36 @@ public class MdItemServiceImpl implements IMdItemService {
|
||||
return mdItemMapper.selectMdItemAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int asyncSmallKnifeData() {
|
||||
List<StlMaterial> stlMaterials = stlMaterialMapper.selectList();
|
||||
int count = 0;
|
||||
for (StlMaterial stlMaterial : stlMaterials) {
|
||||
MdItem mdItem = new MdItem();
|
||||
mdItem.setItemCode(stlMaterial.getProductNumber());
|
||||
mdItem.setItemName(stlMaterial.getProductName());
|
||||
mdItem.setUnitName(stlMaterial.getSpecification());
|
||||
mdItem.setUnitOfMeasure(stlMaterial.getSpecification());
|
||||
// 产品物料标识 设置为 刀片
|
||||
mdItem.setItemOrProduct("BLADE");
|
||||
// 物料类型
|
||||
mdItem.setItemTypeId(298L);
|
||||
mdItem.setItemTypeCode("XXDJK");
|
||||
mdItem.setItemTypeName("小型刀具库");
|
||||
// 是否设置安全库存
|
||||
mdItem.setSafeStockFlag("N");
|
||||
|
||||
// 查重
|
||||
List<MdItem> mdItems = this.selectMdItemList(mdItem);
|
||||
if (!mdItems.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
this.insertMdItem(mdItem);
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MdItem> getExeportList(MdItem mdItem) {
|
||||
return mdItemMapper.getExeportList(mdItem);
|
||||
|
@ -3,6 +3,7 @@ package com.ktg.mes.stl.mapper;
|
||||
import com.ktg.common.annotation.DataSource;
|
||||
import com.ktg.common.enums.DataSourceType;
|
||||
import com.ktg.mes.md.domain.AP0AD;
|
||||
import com.ktg.mes.stl.domain.StlMaterial;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@ -13,8 +14,5 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface StlMaterialMapper {
|
||||
@DataSource(DataSourceType.SQLSERVER)
|
||||
List<AP0AD> selectOutNewData();
|
||||
|
||||
@DataSource(DataSourceType.SQLSERVER)
|
||||
int updateOutDataToOld(AP0AD ap0ad);
|
||||
List<StlMaterial> selectList();
|
||||
}
|
||||
|
@ -106,7 +106,7 @@
|
||||
UDF54,
|
||||
UDF55,
|
||||
USER01,
|
||||
DATE01,
|
||||
DATE01
|
||||
from AP0AA
|
||||
</sql>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user