Compare commits
4 Commits
6df503cf41
...
866cac140d
Author | SHA1 | Date | |
---|---|---|---|
866cac140d | |||
c985a22b5a | |||
c294457ccb | |||
3765bfcc8b |
@ -62,7 +62,7 @@ public class WmsInPlanController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('wm:PLAN:query')")
|
||||
@GetMapping(value = "/{planId}")
|
||||
public AjaxResult getInfo(@PathVariable("planId") String planId) {
|
||||
public AjaxResult getInfo(@PathVariable("planId") Long planId) {
|
||||
return AjaxResult.success(wmsInPlanService.selectWmsInPlanByPlanId(planId));
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ import com.ktg.mes.wm.domain.WmsInTask;
|
||||
import com.ktg.mes.wm.service.IWmStorageAreaService;
|
||||
import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService;
|
||||
import com.ktg.mes.wm.service.IWmsInTaskService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -34,18 +35,14 @@ import java.util.stream.Stream;
|
||||
* @date 2024-11-01
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/wm/wmsInTask")
|
||||
public class WmsInTaskController extends BaseController {
|
||||
@Autowired
|
||||
private IWmsInTaskService wmsInTaskService;
|
||||
@Autowired
|
||||
private IMdItemService mdItemService;
|
||||
@Autowired
|
||||
private IBaseKnifeService baseKnifeService;
|
||||
@Autowired
|
||||
private IWmStorageAreaService wmStorageAreaService;
|
||||
@Autowired
|
||||
private IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
|
||||
private final IWmsInTaskService wmsInTaskService;
|
||||
private final IMdItemService mdItemService;
|
||||
private final IBaseKnifeService baseKnifeService;
|
||||
private final IWmStorageAreaService wmStorageAreaService;
|
||||
private final IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
|
||||
|
||||
/**
|
||||
* 查询入库任务列表
|
||||
@ -89,6 +86,18 @@ public class WmsInTaskController extends BaseController {
|
||||
return AjaxResult.success(wmsInTaskService.selectWmsInTaskById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据料箱rfid查询入库任务信息
|
||||
*/
|
||||
@GetMapping(value = "/open/box/{rfid}")
|
||||
public AjaxResult getInfoByBox(@PathVariable("rfid") String rfid) {
|
||||
WmsInTask wmsInTask = wmsInTaskService.selectWmsInTaskByBoxRfid(rfid);
|
||||
if (wmsInTask == null) {
|
||||
return AjaxResult.error("未查询到相关任务");
|
||||
}
|
||||
return AjaxResult.success(wmsInTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入库任务
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@ public interface WmsInPlanMapper
|
||||
* @param planId 入库计划主键
|
||||
* @return 入库计划
|
||||
*/
|
||||
public WmsInPlan selectWmsInPlanByPlanId(String planId);
|
||||
public WmsInPlan selectWmsInPlanByPlanId(Long planId);
|
||||
|
||||
/**
|
||||
* 查询入库计划列表
|
||||
|
@ -22,6 +22,14 @@ public interface IUcmCtBaseService
|
||||
*/
|
||||
public UcmCtBase selectUcmCtBaseByCtBaseId(String ctBaseId);
|
||||
|
||||
/**
|
||||
* 查询料箱管理
|
||||
*
|
||||
* @param code 料箱code rfid
|
||||
* @return 料箱管理
|
||||
*/
|
||||
public UcmCtBase selectUcmCtBaseByCode(String code);
|
||||
|
||||
/**
|
||||
* 查询料箱管理列表
|
||||
*
|
||||
|
@ -17,7 +17,7 @@ public interface IWmsInPlanService
|
||||
* @param planId 入库计划主键
|
||||
* @return 入库计划
|
||||
*/
|
||||
public WmsInPlan selectWmsInPlanByPlanId(String planId);
|
||||
public WmsInPlan selectWmsInPlanByPlanId(Long planId);
|
||||
|
||||
WmsInPlan selectWmsInPlanByPlanCode(String planCode);
|
||||
|
||||
|
@ -19,6 +19,14 @@ public interface IWmsInTaskService
|
||||
*/
|
||||
public WmsInTask selectWmsInTaskById(String id);
|
||||
|
||||
/**
|
||||
* 查询入库任务
|
||||
*
|
||||
* @param rfid 料箱 RFID
|
||||
* @return 入库任务
|
||||
*/
|
||||
public WmsInTask selectWmsInTaskByBoxRfid(String rfid);
|
||||
|
||||
/**
|
||||
* 查询入库任务列表
|
||||
*
|
||||
|
@ -46,6 +46,17 @@ public class UcmCtBaseServiceImpl implements IUcmCtBaseService {
|
||||
return ucmCtBaseMapper.selectUcmCtBaseByCtBaseId(ctBaseId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询料箱管理
|
||||
*
|
||||
* @param code 料箱code rfid
|
||||
* @return 料箱管理
|
||||
*/
|
||||
@Override
|
||||
public UcmCtBase selectUcmCtBaseByCode(String code) {
|
||||
return ucmCtBaseMapper.selectUcmCtBaseByCode(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询料箱管理列表
|
||||
*
|
||||
|
@ -66,7 +66,7 @@ public class WmsInPlanDetailEntityServiceImpl implements IWmsInPlanDetailEntityS
|
||||
List<WmsInPlanDetailEntity> handleWmsInPlanDetailEntityList = new ArrayList<>();
|
||||
wmsInPlanDetailEntityList.forEach(entity -> {
|
||||
// 获取入库计划信息
|
||||
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(entity.getPlanId().toString());
|
||||
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(entity.getPlanId());
|
||||
// 获取入库计划
|
||||
WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsInPlan.getPlanTypeId().toString());
|
||||
|
||||
|
@ -3,7 +3,13 @@ package com.ktg.mes.wm.service.impl;
|
||||
import java.util.List;
|
||||
|
||||
import com.ktg.common.utils.DateUtils;
|
||||
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
|
||||
import com.ktg.generator.util.MultiModuleCodeGenerator;
|
||||
import com.ktg.mes.md.domain.BaseKnife;
|
||||
import com.ktg.mes.md.domain.MdItem;
|
||||
import com.ktg.mes.md.service.IMdItemService;
|
||||
import com.ktg.mes.md.service.impl.BaseKnifeServiceImpl;
|
||||
import com.ktg.mes.wm.domain.*;
|
||||
import com.ktg.mes.wm.mapper.UcmCtBaseMapper;
|
||||
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -13,9 +19,7 @@ import java.util.ArrayList;
|
||||
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ktg.mes.wm.domain.WmsInPlanDetails;
|
||||
import com.ktg.mes.wm.mapper.WmsInPlanMapper;
|
||||
import com.ktg.mes.wm.domain.WmsInPlan;
|
||||
import com.ktg.mes.wm.service.IWmsInPlanService;
|
||||
|
||||
/**
|
||||
@ -41,7 +45,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
|
||||
* @return 入库计划
|
||||
*/
|
||||
@Override
|
||||
public WmsInPlan selectWmsInPlanByPlanId(String planId) {
|
||||
public WmsInPlan selectWmsInPlanByPlanId(Long planId) {
|
||||
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(planId);
|
||||
List<WmsInPlanDetails> wmsInPlanDetailsList = new ArrayList<>();
|
||||
wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> {
|
||||
@ -81,6 +85,10 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
|
||||
@Override
|
||||
public int insertWmsInPlan(WmsInPlan wmsInPlan) {
|
||||
wmsInPlan.setCreateTime(DateUtils.getNowDate());
|
||||
// 设置计划编码
|
||||
if (wmsInPlan.getPlanCode() == null) {
|
||||
wmsInPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("RKP"));
|
||||
}
|
||||
int rows = wmsInPlanMapper.insertWmsInPlan(wmsInPlan);
|
||||
insertWmsInPlanDetails(wmsInPlan);
|
||||
return rows;
|
||||
@ -132,6 +140,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
|
||||
*
|
||||
* @param wmsInPlan 入库计划对象
|
||||
*/
|
||||
@Transactional
|
||||
public void insertWmsInPlanDetails(WmsInPlan wmsInPlan) {
|
||||
List<WmsInPlanDetails> wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList();
|
||||
Long planId = wmsInPlan.getPlanId();
|
||||
@ -143,7 +152,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
|
||||
}
|
||||
if (!list.isEmpty()) {
|
||||
wmsInPlanMapper.batchWmsInPlanDetails(list);
|
||||
WmsInPlan wmsInPlan1 = selectWmsInPlanByPlanId(planId.toString());
|
||||
WmsInPlan wmsInPlan1 = selectWmsInPlanByPlanId(planId);
|
||||
List<WmsInPlanDetails> wmsInPlanDetailsList1 = wmsInPlan1.getWmsInPlanDetailsList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = list.get(i).getWmsInPlanDetailEntityList();
|
||||
@ -160,17 +169,49 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
|
||||
*
|
||||
* @param wmsInPlanDetails 入库计划明细对象
|
||||
*/
|
||||
@Transactional
|
||||
public void insertWmsInPlanDetailEntity(WmsInPlanDetails wmsInPlanDetails) {
|
||||
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetails.getWmsInPlanDetailEntityList();
|
||||
Long planId = wmsInPlanDetails.getPlanId();
|
||||
Long planDetailsId = wmsInPlanDetails.getDetailsId();
|
||||
|
||||
// 查询物料信息
|
||||
MdItem mdItem = mdItemService.selectMdItemById(Long.parseLong(wmsInPlanDetails.getMaterialId()));
|
||||
// 查询库位信息
|
||||
WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaId(wmsInPlanDetails.getCellId());
|
||||
|
||||
if (StringUtils.isNotNull(wmsInPlanDetailEntityList)) {
|
||||
ArrayList<WmsInPlanDetailEntity> list = new ArrayList<>();
|
||||
for (WmsInPlanDetailEntity wmsInPlanDetailEntity : wmsInPlanDetailEntityList) {
|
||||
if (wmsInPlanDetailEntity.getKnifeId() == null) {
|
||||
// 生成台账
|
||||
BaseKnife baseKnife = new BaseKnife();
|
||||
baseKnife.setMbbBdMrlId(mdItem.getItemId());
|
||||
baseKnife.setKnifeCode(mdItem.getItemCode());
|
||||
baseKnife.setKnifeName(mdItem.getItemName());
|
||||
baseKnife.setKnifeUnit(mdItem.getUnitName());
|
||||
baseKnife.setKnifeType(mdItem.getItemTypeName());
|
||||
baseKnife.setAreaCode(wmStorageArea.getAreaCode());
|
||||
baseKnife.setSafeStock(mdItem.getMinStock());
|
||||
baseKnife.setStandardQuantity("1");
|
||||
baseKnife.setKnifeLife(100);
|
||||
baseKnife.setRfid(wmsInPlanDetailEntity.getRfid());
|
||||
// 设置台账状态 入库
|
||||
baseKnife.setKnifeFineState(1);
|
||||
// 设置为失效
|
||||
baseKnife.setIsValid(1);
|
||||
baseKnife.setPlanSheet("");
|
||||
baseKnife.setResetCount(mdItem.getAttr1());
|
||||
baseKnife.setItemOrProduct(mdItem.getItemOrProduct());
|
||||
baseKnifeService.insertBaseKnife(baseKnife);
|
||||
// 插入实例中台账ID
|
||||
wmsInPlanDetailEntity.setKnifeId(baseKnife.getBaseKnifeId());
|
||||
}
|
||||
|
||||
// 实例
|
||||
wmsInPlanDetailEntity.setPlanId(planId);
|
||||
wmsInPlanDetailEntity.setPlanDetailsId(planDetailsId);
|
||||
wmsInPlanDetailEntity.setCreateTime(DateUtils.getNowDate());
|
||||
|
||||
list.add(wmsInPlanDetailEntity);
|
||||
}
|
||||
if (!list.isEmpty()) {
|
||||
@ -184,6 +225,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
|
||||
* @param planCode 入库计划ID
|
||||
* @return 是否重复
|
||||
*/
|
||||
@Override
|
||||
public Boolean isDuplicatePlanCode(String planCode) {
|
||||
return wmsInPlanMapper.isDuplicatePlanCode(planCode);
|
||||
}
|
||||
|
@ -1,17 +1,18 @@
|
||||
package com.ktg.mes.wm.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import com.ktg.common.utils.DateUtils;
|
||||
import com.ktg.generator.util.MultiModuleCodeGenerator;
|
||||
import com.ktg.mes.md.domain.BaseKnife;
|
||||
import com.ktg.mes.md.domain.MdItem;
|
||||
import com.ktg.mes.md.mapper.MdItemMapper;
|
||||
import com.ktg.mes.md.service.IMdItemService;
|
||||
import com.ktg.mes.wm.domain.UcmCtBase;
|
||||
import com.ktg.mes.wm.domain.WmStorageArea;
|
||||
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
|
||||
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
|
||||
import com.ktg.mes.wm.service.IUcmCtBaseService;
|
||||
import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -33,6 +34,7 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
|
||||
private final MdItemMapper mdItemMapper;
|
||||
private final IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
|
||||
private final WmStorageAreaMapper wmStorageAreaMapper;
|
||||
private final IUcmCtBaseService ucmCtBaseService;
|
||||
|
||||
/**
|
||||
* 查询入库任务
|
||||
@ -45,6 +47,50 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
|
||||
return wmsInTaskMapper.selectWmsInTaskById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询入库任务
|
||||
*
|
||||
* @param rfid 料箱 RFID
|
||||
* @return 入库任务
|
||||
*/
|
||||
@Override
|
||||
public WmsInTask selectWmsInTaskByBoxRfid(String rfid) {
|
||||
List<WmsInTask> wmsInTaskList = new ArrayList<>();
|
||||
|
||||
UcmCtBase ucmCtBase = ucmCtBaseService.selectUcmCtBaseByCode(rfid);
|
||||
if (ucmCtBase == null) {
|
||||
return null;
|
||||
}
|
||||
for (BaseKnife baseKnife : ucmCtBase.getBaseKnifeList()) {
|
||||
WmsInPlanDetailEntity wmsInPlanDetailEntityQuery = new WmsInPlanDetailEntity();
|
||||
wmsInPlanDetailEntityQuery.setRfid(baseKnife.getRfid());
|
||||
|
||||
// 查询所有符合条件的计划明细
|
||||
List<WmsInPlanDetailEntity> planDetailEntities = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntityQuery);
|
||||
|
||||
// 遍历所有明细,查询相应的WmsInTask
|
||||
for (WmsInPlanDetailEntity entity : planDetailEntities) {
|
||||
WmsInTask wmsInTaskQuery = new WmsInTask();
|
||||
wmsInTaskQuery.setDetailInId(entity.getPlanDetailsId());
|
||||
wmsInTaskQuery.setPlanInId(entity.getPlanId());
|
||||
wmsInTaskQuery.setPlanInStatus("0");
|
||||
|
||||
// 查询并加入符合条件的任务
|
||||
List<WmsInTask> tasks = selectWmsInTaskList(wmsInTaskQuery);
|
||||
if (tasks != null && !tasks.isEmpty()) {
|
||||
wmsInTaskList.addAll(tasks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 返回第一个符合条件的任务
|
||||
if (!wmsInTaskList.isEmpty()) {
|
||||
return wmsInTaskList.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询入库任务列表
|
||||
*
|
||||
|
@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUcmCtBaseByCtBaseId" parameterType="String" resultMap="UcmCtBaseBaseKnifeResult">
|
||||
<select id="selectUcmCtBaseByCode" parameterType="String" resultMap="UcmCtBaseBaseKnifeResult">
|
||||
select ucb.CT_BASE_ID, ucb.CODE, ucb.TYPE, ucb.REMARK, ucb.CREATE_BY, ucb.CREATE_TIME, ucb.UPDATE_BY, ucb.UPDATE_TIME,
|
||||
bk.base_knife_id, mi.item_name as knife_name, mi.item_code as knife_code, mi.unit_name as knife_unit
|
||||
from UCM_CT_BASE ucb
|
||||
@ -56,6 +56,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
on ucm.base_knife_id = bk.base_knife_id
|
||||
left join md_item mi
|
||||
on bk.mbb_bd_mrl_id = mi.item_id
|
||||
where ucb.CODE = #{code}
|
||||
</select>
|
||||
|
||||
<select id="selectUcmCtBaseByCtBaseId" parameterType="String" resultMap="UcmCtBaseBaseKnifeResult">
|
||||
select ucb.CT_BASE_ID, ucb.CODE, ucb.TYPE, ucb.REMARK, ucb.CREATE_BY, ucb.CREATE_TIME, ucb.UPDATE_BY, ucb.UPDATE_TIME,
|
||||
bk.base_knife_id, mi.item_name as knife_name, mi.item_code as knife_code, mi.unit_name as knife_unit
|
||||
from UCM_CT_BASE ucb
|
||||
left join ucm_ct_material ucm
|
||||
on ucb.ct_base_id = ucm.ct_base_id
|
||||
left join base_knife bk
|
||||
on ucm.base_knife_id = bk.base_knife_id
|
||||
left join md_item mi
|
||||
on bk.mbb_bd_mrl_id = mi.item_id
|
||||
where ucb.CT_BASE_ID = #{ctBaseId}
|
||||
</select>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user