Compare commits

...

4 Commits

9 changed files with 98 additions and 47 deletions

View File

@ -18,6 +18,7 @@ import com.ktg.mes.md.service.IMdUnitMeasureService;
import com.ktg.mes.wm.utils.WmBarCodeUtil; import com.ktg.mes.wm.utils.WmBarCodeUtil;
import com.ktg.system.domain.SysOperLog; import com.ktg.system.domain.SysOperLog;
import com.ktg.system.service.ISysOperLogService; import com.ktg.system.service.ISysOperLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -29,22 +30,13 @@ import java.util.*;
@RestController @RestController
@RequestMapping("/mes/md/mditem") @RequestMapping("/mes/md/mditem")
@RequiredArgsConstructor
public class MdItemController extends BaseController { public class MdItemController extends BaseController {
private final IMdItemService mdItemService;
@Autowired private final IItemTypeService iItemTypeService;
private IMdItemService mdItemService; private final IMdUnitMeasureService mdUnitMeasureService;
private final WmBarCodeUtil barcodeUtil;
@Autowired private final ISysOperLogService operLogService;
private IItemTypeService iItemTypeService;
@Autowired
private IMdUnitMeasureService mdUnitMeasureService;
@Autowired
private WmBarCodeUtil barcodeUtil;
@Autowired
private ISysOperLogService operLogService;
/** /**
* 列表查询 * 列表查询
@ -140,6 +132,15 @@ public class MdItemController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/**
* 同步小型刀具库 物料数据
* @return
*/
@GetMapping("/asyncSmallKnife")
public AjaxResult asyncSmallKnifeData() {
return AjaxResult.success(mdItemService.asyncSmallKnifeData());
}
/** /**
* 导出物料列表 * 导出物料列表
*/ */

View File

@ -89,7 +89,7 @@ public class WmsOutPlanController extends BaseController {
// return AjaxResult.error("新增出库计划失败,出库计划编码“" + wmsOutPlan.getPlanCode() + "”已存在"); // return AjaxResult.error("新增出库计划失败,出库计划编码“" + wmsOutPlan.getPlanCode() + "”已存在");
// } // }
// 出库计划编码自动生成 // 出库计划编码自动生成
if (wmsOutPlan.getPlanCode().isEmpty() || wmsOutPlan.getPlanCode() == null) { if (wmsOutPlan.getPlanCode() == null || wmsOutPlan.getPlanCode().isEmpty()) {
wmsOutPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("CKP")); wmsOutPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("CKP"));
} }
wmsOutPlan.setCreateBy(getUsername()); wmsOutPlan.setCreateBy(getUsername());

View File

@ -1,10 +1,12 @@
package com.ktg.mes.md.mapper; package com.ktg.mes.md.mapper;
import com.ktg.common.core.domain.entity.ItemType; import com.ktg.common.core.domain.entity.ItemType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@Mapper
public interface ItemTypeMapper { public interface ItemTypeMapper {
/** /**

View File

@ -20,6 +20,12 @@ public interface IMdItemService {
*/ */
public List<MdItem> selectMdItemAll(); public List<MdItem> selectMdItemAll();
/**
* 同步小型刀具库数据
* @return
*/
public int asyncSmallKnifeData();
/** /**
* 获取导出格式的物料产品清单 * 获取导出格式的物料产品清单
* 主要区别是物料分类会以父级分类/子集分类的方式组合 * 主要区别是物料分类会以父级分类/子集分类的方式组合

View File

@ -10,8 +10,11 @@ import com.ktg.mes.md.mapper.BaseKnifeMapper;
import com.ktg.mes.md.mapper.ItemTypeMapper; import com.ktg.mes.md.mapper.ItemTypeMapper;
import com.ktg.mes.md.mapper.MdItemMapper; import com.ktg.mes.md.mapper.MdItemMapper;
import com.ktg.mes.md.service.IMdItemService; 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.mes.wm.utils.WmBarCodeUtil;
import com.ktg.system.strategy.AutoCodeUtil; import com.ktg.system.strategy.AutoCodeUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -20,24 +23,15 @@ import javax.validation.Validator;
import java.util.List; import java.util.List;
@Service @Service
@RequiredArgsConstructor
public class MdItemServiceImpl implements IMdItemService { public class MdItemServiceImpl implements IMdItemService {
@Autowired private final BaseKnifeMapper baseKnifeMapper;
private BaseKnifeMapper baseKnifeMapper; private final MdItemMapper mdItemMapper;
private final ItemTypeMapper itemTypeMapper;
@Autowired protected final Validator validator;
private MdItemMapper mdItemMapper; private final WmBarCodeUtil barCodeUtil;
private final AutoCodeUtil autoCodeUtil;
@Autowired private final StlMaterialMapper stlMaterialMapper;
private ItemTypeMapper itemTypeMapper;
@Autowired
protected Validator validator;
@Autowired
private WmBarCodeUtil barCodeUtil;
@Autowired
private AutoCodeUtil autoCodeUtil;
@Override @Override
public List<MdItem> selectMdItemList(MdItem mdItem) { public List<MdItem> selectMdItemList(MdItem mdItem) {
@ -53,6 +47,36 @@ public class MdItemServiceImpl implements IMdItemService {
return mdItemMapper.selectMdItemAll(); 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 @Override
public List<MdItem> getExeportList(MdItem mdItem) { public List<MdItem> getExeportList(MdItem mdItem) {
return mdItemMapper.getExeportList(mdItem); return mdItemMapper.getExeportList(mdItem);

View File

@ -98,7 +98,7 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsOutPlan.getWmsBusinessTypeId().toString()); WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsOutPlan.getWmsBusinessTypeId().toString());
// 获取库位信息 // 获取库位信息
WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(wmsOutPlanDetail.getWmStorageAreaId()); WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(wmsOutTask.getWmStorageAreaId());
// 设定出库信息数据 // 设定出库信息数据
HashMap<String, Object> hashMap = new HashMap<>(); HashMap<String, Object> hashMap = new HashMap<>();
@ -119,8 +119,8 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
/* 来自计划明细 */ /* 来自计划明细 */
hashMap.put("detailBatchNum", wmsOutPlanDetail.getDetailBatchNum()); // 明细批次 hashMap.put("detailBatchNum", wmsOutPlanDetail.getDetailBatchNum()); // 明细批次
hashMap.put("wmStorageAreaId", wmsOutPlanDetail.getWmStorageAreaId()); // 库位ID hashMap.put("wmStorageAreaId", wmsOutPlanDetail.getWmStorageAreaId()); // 库位ID
hashMap.put("wmStorageAreaCode", wmsOutPlanDetail.getWmStorageAreaCode()); // 库位编码 hashMap.put("wmStorageAreaCode", wmStorageArea.getAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmsOutPlanDetail.getWmStorageAreaName()); // 库位名称 hashMap.put("wmStorageAreaName", wmStorageArea.getAreaName()); // 库位名称
hashMap.put("cellX", wmStorageArea.getPositionX().toString()); hashMap.put("cellX", wmStorageArea.getPositionX().toString());
hashMap.put("cellY", wmStorageArea.getPositionY().toString()); hashMap.put("cellY", wmStorageArea.getPositionY().toString());
hashMap.put("cellZ", wmStorageArea.getPositionZ().toString()); hashMap.put("cellZ", wmStorageArea.getPositionZ().toString());

View File

@ -3,6 +3,7 @@ package com.ktg.mes.stl.mapper;
import com.ktg.common.annotation.DataSource; import com.ktg.common.annotation.DataSource;
import com.ktg.common.enums.DataSourceType; import com.ktg.common.enums.DataSourceType;
import com.ktg.mes.md.domain.AP0AD; import com.ktg.mes.md.domain.AP0AD;
import com.ktg.mes.stl.domain.StlMaterial;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
@ -13,8 +14,5 @@ import java.util.List;
@Mapper @Mapper
public interface StlMaterialMapper { public interface StlMaterialMapper {
@DataSource(DataSourceType.SQLSERVER) @DataSource(DataSourceType.SQLSERVER)
List<AP0AD> selectOutNewData(); List<StlMaterial> selectList();
@DataSource(DataSourceType.SQLSERVER)
int updateOutDataToOld(AP0AD ap0ad);
} }

View File

@ -171,15 +171,35 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
baseKnifeQuery.setKnifeFineState(2); baseKnifeQuery.setKnifeFineState(2);
List<BaseKnife> baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeQuery); List<BaseKnife> baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeQuery);
// 获取库位信息
WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaId(wmsInTask.getCellTgt());
for (int i = 0; i < wmsInTask.getActualInQuantity(); i++) { for (int i = 0; i < wmsInTask.getActualInQuantity(); i++) {
BaseKnife baseKnife = baseKnifeList.get(i); // BaseKnife baseKnife = baseKnifeList.get(i);
// 设置状态为 解锁 // // 设置状态为 解锁
baseKnife.setIsLocked(0); // baseKnife.setIsLocked(0);
// 设置工具状态 已入库 // // 设置工具状态 已入库
// baseKnife.setKnifeFineState(1);
// // 更新台账状态
// baseKnifeService.updateBaseKnife(baseKnife);
// 生成台账
BaseKnife baseKnife = new BaseKnife();
baseKnife.setMbbBdMrlId(mbbBdMrlMitm.getItemId());
baseKnife.setKnifeCode(mbbBdMrlMitm.getItemCode());
baseKnife.setKnifeName(mbbBdMrlMitm.getItemName());
baseKnife.setKnifeUnit(mbbBdMrlMitm.getUnitName());
baseKnife.setKnifeType(mbbBdMrlMitm.getItemTypeName());
baseKnife.setAreaCode(wmStorageArea.getAreaCode());
baseKnife.setSafeStock(mbbBdMrlMitm.getMinStock());
baseKnife.setStandardQuantity("1");
baseKnife.setKnifeLife(100);
// 设置台账状态 入库
baseKnife.setKnifeFineState(1); baseKnife.setKnifeFineState(1);
// 更新台账状态 baseKnife.setPlanSheet("");
baseKnifeService.updateBaseKnife(baseKnife); baseKnife.setResetCount(mbbBdMrlMitm.getAttr1());
baseKnife.setItemOrProduct(mbbBdMrlMitm.getItemOrProduct());
baseKnifeService.insertBaseKnife(baseKnife);
} }
} }
return 0; return 0;

View File

@ -106,7 +106,7 @@
UDF54, UDF54,
UDF55, UDF55,
USER01, USER01,
DATE01, DATE01
from AP0AA from AP0AA
</sql> </sql>