Merge remote-tracking branch 'origin/master'

This commit is contained in:
刘名喜 2024-12-13 14:39:13 +08:00
commit 5d7374e50a
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.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());
}
/**
* 导出物料列表
*/

View File

@ -89,7 +89,7 @@ public class WmsOutPlanController extends BaseController {
// 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.setCreateBy(getUsername());

View File

@ -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 {
/**

View File

@ -20,6 +20,12 @@ public interface IMdItemService {
*/
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.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);

View File

@ -98,7 +98,7 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
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<>();
@ -119,8 +119,8 @@ public class WmsOutTaskServiceImpl implements IWmsOutTaskService {
/* 来自计划明细 */
hashMap.put("detailBatchNum", wmsOutPlanDetail.getDetailBatchNum()); // 明细批次
hashMap.put("wmStorageAreaId", wmsOutPlanDetail.getWmStorageAreaId()); // 库位ID
hashMap.put("wmStorageAreaCode", wmsOutPlanDetail.getWmStorageAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmsOutPlanDetail.getWmStorageAreaName()); // 库位名称
hashMap.put("wmStorageAreaCode", wmStorageArea.getAreaCode()); // 库位编码
hashMap.put("wmStorageAreaName", wmStorageArea.getAreaName()); // 库位名称
hashMap.put("cellX", wmStorageArea.getPositionX().toString());
hashMap.put("cellY", wmStorageArea.getPositionY().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.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();
}

View File

@ -171,15 +171,35 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
baseKnifeQuery.setKnifeFineState(2);
List<BaseKnife> baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeQuery);
// 获取库位信息
WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaId(wmsInTask.getCellTgt());
for (int i = 0; i < wmsInTask.getActualInQuantity(); i++) {
BaseKnife baseKnife = baseKnifeList.get(i);
// 设置状态为 解锁
baseKnife.setIsLocked(0);
// 设置工具状态 已入库
// BaseKnife baseKnife = baseKnifeList.get(i);
// // 设置状态为 解锁
// 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);
// 更新台账状态
baseKnifeService.updateBaseKnife(baseKnife);
baseKnife.setPlanSheet("");
baseKnife.setResetCount(mbbBdMrlMitm.getAttr1());
baseKnife.setItemOrProduct(mbbBdMrlMitm.getItemOrProduct());
baseKnifeService.insertBaseKnife(baseKnife);
}
}
return 0;

View File

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