Compare commits

...

4 Commits

10 changed files with 205 additions and 408 deletions

View File

@ -1,5 +1,7 @@
package com.ktg.mes.md.domain;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
@ -11,13 +13,15 @@ import com.ktg.common.core.domain.BaseEntity;
* @author yinjinlu
* @date 2024-10-31
*/
@Setter
@Getter
public class WmsBusinessType extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String typeId;
private Long typeId;
/**
* 修改日期
@ -120,190 +124,6 @@ public class WmsBusinessType extends BaseEntity {
@Excel(name = "是否记录入库时间:0否1是")
private String isRecordInboundTime;
public void setTypeId(String typeId) {
this.typeId = typeId;
}
public String getTypeId() {
return typeId;
}
public void setModifyDate(String modifyDate) {
this.modifyDate = modifyDate;
}
public String getModifyDate() {
return modifyDate;
}
public void setIsActive(String isActive) {
this.isActive = isActive;
}
public String getIsActive() {
return isActive;
}
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
public String getIsDelete() {
return isDelete;
}
public void setCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getFlag() {
return flag;
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public void setIsDefault(String isDefault) {
this.isDefault = isDefault;
}
public String getIsDefault() {
return isDefault;
}
public void setIsGlobal(String isGlobal) {
this.isGlobal = isGlobal;
}
public String getIsGlobal() {
return isGlobal;
}
public void setIsNeedUp(String isNeedUp) {
this.isNeedUp = isNeedUp;
}
public String getIsNeedUp() {
return isNeedUp;
}
public void setQualityType(String qualityType) {
this.qualityType = qualityType;
}
public String getQualityType() {
return qualityType;
}
public void setIsOutboundReview(String isOutboundReview) {
this.isOutboundReview = isOutboundReview;
}
public String getIsOutboundReview() {
return isOutboundReview;
}
public void setWaveStrategy(String waveStrategy) {
this.waveStrategy = waveStrategy;
}
public String getWaveStrategy() {
return waveStrategy;
}
public void setIsMultipleAllowed(String isMultipleAllowed) {
this.isMultipleAllowed = isMultipleAllowed;
}
public String getIsMultipleAllowed() {
return isMultipleAllowed;
}
public void setIsShortageAllowed(String isShortageAllowed) {
this.isShortageAllowed = isShortageAllowed;
}
public String getIsShortageAllowed() {
return isShortageAllowed;
}
public void setIsExcessAllowed(String isExcessAllowed) {
this.isExcessAllowed = isExcessAllowed;
}
public String getIsExcessAllowed() {
return isExcessAllowed;
}
public void setIsWholeOrderPost(String isWholeOrderPost) {
this.isWholeOrderPost = isWholeOrderPost;
}
public String getIsWholeOrderPost() {
return isWholeOrderPost;
}
public void setIsManuallyCreate(String isManuallyCreate) {
this.isManuallyCreate = isManuallyCreate;
}
public String getIsManuallyCreate() {
return isManuallyCreate;
}
public void setIsNoTask(String isNoTask) {
this.isNoTask = isNoTask;
}
public String getIsNoTask() {
return isNoTask;
}
public void setIsNegativeInv(String isNegativeInv) {
this.isNegativeInv = isNegativeInv;
}
public String getIsNegativeInv() {
return isNegativeInv;
}
public void setIsCheckSafetyStock(String isCheckSafetyStock) {
this.isCheckSafetyStock = isCheckSafetyStock;
}
public String getIsCheckSafetyStock() {
return isCheckSafetyStock;
}
public void setIsRecordInboundTime(String isRecordInboundTime) {
this.isRecordInboundTime = isRecordInboundTime;
}
public String getIsRecordInboundTime() {
return isRecordInboundTime;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -1,6 +1,7 @@
package com.ktg.mes.md.mapper;
import com.ktg.mes.md.domain.WmsBusinessType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -11,6 +12,7 @@ import java.util.List;
* @author yinjinlu
* @date 2024-10-31
*/
@Mapper
public interface WmsBusinessTypeMapper
{
/**

View File

@ -19,6 +19,14 @@ public interface IBaseKnifeService
*/
public BaseKnife selectBaseKnifeByBaseKnifeId(Long baseKnifeId);
/**
* 查询工具台账
*
* @param rfid 工具台账主键
* @return 工具台账 包含物料基础信息
*/
public BaseKnife selectBaseKnifeByRfid(String rfid);
/**
* 查询工具台账列表
*

View File

@ -65,6 +65,11 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
return baseKnife;
}
@Override
public BaseKnife selectBaseKnifeByRfid(String rfid) {
return baseKnifeMapper.selectBaseKnifeByRfid(rfid);
}
/**
* 查询工具台账列表
*

View File

@ -2,7 +2,9 @@ package com.ktg.mes.wm.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import com.ktg.mes.wm.domain.dto.WmsInboundOrderDto;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -82,6 +84,13 @@ public class WmsInPlanController extends BaseController {
return toAjax(wmsInPlanService.insertWmsInPlan(wmsInPlan));
}
@Log(title = "入库计划", businessType = BusinessType.INSERT)
@PostMapping("/open/order/add")
public AjaxResult openOrderAdd(@RequestBody @Valid WmsInboundOrderDto wmsInboundOrderDto) {
wmsInPlanService.insertOrderWmsInPlan(wmsInboundOrderDto);
return AjaxResult.success("入库任务创建成功");
}
/**
* 修改入库计划
*/

View File

@ -135,6 +135,11 @@ public class WmsInTaskController extends BaseController {
// 将料箱rfid绑定至任务
wmsInTask.setBoxRfid(rfid);
// 将库位信息填充至料箱
UcmCtBase ucmCtBase = ucmCtBaseService.selectUcmCtBaseByCode(wmsInTask.getBoxRfid());
ucmCtBase.setAttr1(wmsInTask.getCellTgt().toString());
ucmCtBaseService.updateUcmCtBase(ucmCtBase);
wmsInTaskService.updateWmsInTask(wmsInTask);
return AjaxResult.success(wmsInTask);
}
@ -194,10 +199,6 @@ public class WmsInTaskController extends BaseController {
// 入库类型为整刀回库
if (Objects.equals(wmsInTask.getPlanTypeId(), "9")) {
// 将库位信息填充至料箱
UcmCtBase ucmCtBase = ucmCtBaseService.selectUcmCtBaseByCode(wmsInTask.getBoxRfid());
ucmCtBase.setAttr1(wmsInTask.getCellTgt().toString());
ucmCtBaseService.updateUcmCtBase(ucmCtBase);
// 插入台账数据
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
@ -301,10 +302,6 @@ public class WmsInTaskController extends BaseController {
});
mdItemService.updateMdItem(mbbBdMrlMitm);
} else if (Objects.equals(wmsInTask.getPlanTypeCode(), "CGRK")) {
// 将库位信息填充至料箱
UcmCtBase ucmCtBase = ucmCtBaseService.selectUcmCtBaseByCode(wmsInTask.getBoxRfid());
ucmCtBase.setAttr1(wmsInTask.getCellTgt().toString());
ucmCtBaseService.updateUcmCtBase(ucmCtBase);
// 插入台账数据
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());
@ -321,10 +318,6 @@ public class WmsInTaskController extends BaseController {
baseKnifeService.updateBaseKnife(baseKnife);
});
} else if (Objects.equals(wmsInTask.getPlanTypeCode(), "GJHK")) {
// 将库位信息填充至料箱
UcmCtBase ucmCtBase = ucmCtBaseService.selectUcmCtBaseByCode(wmsInTask.getBoxRfid());
ucmCtBase.setAttr1(wmsInTask.getCellTgt().toString());
ucmCtBaseService.updateUcmCtBase(ucmCtBase);
// 插入台账数据
wmsInPlanDetailEntityList.forEach(planDetailEntity -> {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByBaseKnifeId(planDetailEntity.getKnifeId());

View File

@ -3,6 +3,8 @@ package com.ktg.mes.wm.domain;
import java.util.Date;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
@ -14,6 +16,8 @@ import com.ktg.common.core.domain.BaseEntity;
* @author yinjinlu
* @date 2024-10-31
*/
@Getter
@Setter
public class WmsInPlan extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -159,211 +163,17 @@ public class WmsInPlan extends BaseEntity {
*/
private String planTypeCode;
/**
* 库区编码
*/
private String locationCode;
/**
* 入库计划明细信息
*/
private List<WmsInPlanDetails> wmsInPlanDetailsList;
public void setPlanId(Long planId) {
this.planId = planId;
}
public Long getPlanId() {
return planId;
}
public void setState(String state) {
this.state = state;
}
public String getState() {
return state;
}
public void setSourceType(String sourceType) {
this.sourceType = sourceType;
}
public String getSourceType() {
return sourceType;
}
public void setWareId(String wareId) {
this.wareId = wareId;
}
public String getWareId() {
return wareId;
}
public void setCellCode(String cellCode) {
this.cellCode = cellCode;
}
public String getCellCode() {
return cellCode;
}
public void setWorkOrderCode(String workOrderCode) {
this.workOrderCode = workOrderCode;
}
public String getWorkOrderCode() {
return workOrderCode;
}
public void setExpectDate(Date expectDate) {
this.expectDate = expectDate;
}
public Date getExpectDate() {
return expectDate;
}
public void setPublishName(String publishName) {
this.publishName = publishName;
}
public String getPublishName() {
return publishName;
}
public void setPublishTime(String publishTime) {
this.publishTime = publishTime;
}
public String getPublishTime() {
return publishTime;
}
public void setCloserId(String closerId) {
this.closerId = closerId;
}
public String getCloserId() {
return closerId;
}
public void setCloseTime(String closeTime) {
this.closeTime = closeTime;
}
public String getCloseTime() {
return closeTime;
}
public void setRelBillCode(String relBillCode) {
this.relBillCode = relBillCode;
}
public String getRelBillCode() {
return relBillCode;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getCustomerId() {
return customerId;
}
public void setPoCode(String poCode) {
this.poCode = poCode;
}
public String getPoCode() {
return poCode;
}
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentId() {
return departmentId;
}
public void setContractNo(String contractNo) {
this.contractNo = contractNo;
}
public String getContractNo() {
return contractNo;
}
public void setSupplierId(String supplierId) {
this.supplierId = supplierId;
}
public String getSupplierId() {
return supplierId;
}
public void setBusinessTypeId(String businessTypeId) {
this.businessTypeId = businessTypeId;
}
public String getBusinessTypeId() {
return businessTypeId;
}
public void setSrcOutTaskId(String srcOutTaskId) {
this.srcOutTaskId = srcOutTaskId;
}
public String getSrcOutTaskId() {
return srcOutTaskId;
}
public void setIsActive(String isActive) {
this.isActive = isActive;
}
public String getIsActive() {
return isActive;
}
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
public String getIsDelete() {
return isDelete;
}
public void setPlanCode(String planCode) {
this.planCode = planCode;
}
public String getPlanCode() {
return planCode;
}
public void setPlanTypeId(Long planTypeId) {
this.planTypeId = planTypeId;
}
public Long getPlanTypeId() {
return planTypeId;
}
public String getPlanTypeCode() {
return planTypeCode;
}
public void setPlanTypeCode(String planTypeCode) {
this.planTypeCode = planTypeCode;
}
public List<WmsInPlanDetails> getWmsInPlanDetailsList() {
return wmsInPlanDetailsList;
}
public void setWmsInPlanDetailsList(List<WmsInPlanDetails> wmsInPlanDetailsList) {
this.wmsInPlanDetailsList = wmsInPlanDetailsList;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -0,0 +1,25 @@
package com.ktg.mes.wm.domain.dto;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
// 根据订单入库
@Getter
@Setter
public class WmsInboundOrderDto {
// 订单号
@NotBlank(message = "订单号不能为空")
private String orderId;
// 物料编码
@NotBlank(message = "物料编码不能为空")
private String materialCode;
@NotBlank(message = "RFID不能为空")
private String rfid;
// 入库类型编码
@NotBlank(message = "入库类型编码不能为空")
private String typeCode;
}

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.service;
import java.util.List;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.domain.dto.WmsInboundOrderDto;
/**
* 入库计划Service接口
@ -67,4 +68,23 @@ public interface IWmsInPlanService
* @return 是否重复
*/
public Boolean isDuplicatePlanCode(String planCode);
/**
* 执行入库计划
*
* @param planId 入库计划ID
*/
public void issueWmsInPlan(Long planId);
/**
* 创建并执行入库计划
* @param wmsInPlan 入库计划
*/
public void insertAndIssueWmsInPlan(WmsInPlan wmsInPlan);
/**
* 根据订单创建入库计划
* @param wmsInboundOrderDto 入库计划参数
*/
public void insertOrderWmsInPlan(WmsInboundOrderDto wmsInboundOrderDto);
}

View File

@ -5,23 +5,26 @@ import com.ktg.common.utils.StringUtils;
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.domain.WmsBusinessType;
import com.ktg.mes.md.mapper.WmsBusinessTypeMapper;
import com.ktg.mes.md.service.IBaseKnifeService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.md.service.impl.BaseKnifeServiceImpl;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.domain.WmsInPlanDetails;
import com.ktg.mes.md.service.impl.WmsBusinessTypeServiceImpl;
import com.ktg.mes.wm.domain.*;
import com.ktg.mes.wm.domain.dto.WmsInboundOrderDto;
import com.ktg.mes.wm.mapper.UcmCtBaseMapper;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
import com.ktg.mes.wm.mapper.WmsInPlanMapper;
import com.ktg.mes.wm.service.IWmsInPlanService;
import com.ktg.mes.wm.service.IWmsInTaskService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 入库计划Service业务层处理
@ -32,13 +35,14 @@ import java.util.List;
@Service
@RequiredArgsConstructor
public class WmsInPlanServiceImpl implements IWmsInPlanService {
private final IWmsInTaskService wmsInTaskService;
private final IMdItemService mdItemService;
private final IBaseKnifeService baseKnifeService;
private final WmsInPlanMapper wmsInPlanMapper;
private final WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
private final UcmCtBaseMapper ucmCtBaseMapper;
private final BaseKnifeServiceImpl baseKnifeService;
private final IMdItemService mdItemService;
private final WmStorageAreaServiceImpl wmStorageAreaService;
private final WmStorageAreaMapper wmStorageAreaMapper;
private final WmsBusinessTypeMapper wmsBusinessTypeMapper;
/**
* 查询入库计划
@ -190,7 +194,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
// 查询库位信息
WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaId(wmsInPlanDetails.getCellId());
if (StringUtils.isNotNull(wmsInPlanDetailEntityList)) {
if (!Objects.isNull(wmsInPlanDetailEntityList)) {
ArrayList<WmsInPlanDetailEntity> list = new ArrayList<>();
for (WmsInPlanDetailEntity wmsInPlanDetailEntity : wmsInPlanDetailEntityList) {
if (wmsInPlanDetailEntity.getKnifeId() == null) {
@ -240,4 +244,105 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
public Boolean isDuplicatePlanCode(String planCode) {
return wmsInPlanMapper.isDuplicatePlanCode(planCode);
}
/**
* 执行入库计划
*
* @param planId 入库计划ID
*/
@Override
@Transactional
public void issueWmsInPlan(Long planId) {
WmsInPlan wmsInPlan = selectWmsInPlanByPlanId(planId);
WmsInTask wmsInTask = new WmsInTask();
AtomicInteger atomicInteger = new AtomicInteger();
wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> {
int index = atomicInteger.getAndIncrement();
wmsInTask.setPlanInId(wmsInPlan.getPlanId());
wmsInTask.setPlanInCode(wmsInPlan.getPlanCode());
wmsInTask.setTaskInQuantity(Integer.parseInt(detail.getQuantity()));
wmsInTask.setActualInQuantity(Integer.parseInt(detail.getQuantityIn()));
wmsInTask.setCellTgt(detail.getCellId());
wmsInTask.setCellOrig(new Date().toString() + index);
wmsInTask.setRemark(detail.getRemark());
wmsInTask.setBatch(detail.getBatch());
wmsInTask.setMaterialId(detail.getMaterialId());
MdItem mdItem = mdItemService.selectMdItemById(Long.parseLong(wmsInTask.getMaterialId()));
wmsInTask.setMaterialCode(mdItem.getItemCode());
wmsInTask.setPlanTypeCode(wmsInPlan.getPlanTypeCode());
wmsInTask.setPlanInStatus("0");
wmsInTask.setDetailInId(detail.getDetailsId());
wmsInTaskService.insertWmsInTask(wmsInTask);
});
wmsInPlan.setState("1");
wmsInPlanMapper.updateWmsInPlan(wmsInPlan);
}
/**
* 创建并执行入库计划
*
* @param wmsInPlan 入库计划
*/
@Transactional
@Override
public void insertAndIssueWmsInPlan(WmsInPlan wmsInPlan) {
this.insertWmsInPlan(wmsInPlan);
this.issueWmsInPlan(wmsInPlan.getPlanId());
}
@Transactional
@Override
public void insertOrderWmsInPlan(WmsInboundOrderDto wmsInboundOrderDto) {
// 查询业务类型
WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByCode(wmsInboundOrderDto.getTypeCode());
if (wmsBusinessType == null) {
throw new RuntimeException("出库类型编码错误: " + wmsInboundOrderDto.getTypeCode());
}
// 查询物料信息
MdItem mdItem = mdItemService.selectMdItemByCode(wmsInboundOrderDto.getMaterialCode());
if (mdItem == null) {
throw new RuntimeException("物料编码错误: " + wmsInboundOrderDto.getMaterialCode());
}
// 创建入库计划
WmsInPlan wmsInPlan = new WmsInPlan();
wmsInPlan.setState("0");
// 业务类型
wmsInPlan.setSourceType("SGLR");
wmsInPlan.setPlanTypeCode(wmsBusinessType.getCode());
wmsInPlan.setPlanTypeId(wmsBusinessType.getTypeId());
wmsInPlan.setRemark("订单号: " + wmsInboundOrderDto.getOrderId());
//-- 入库计划详情
WmsInPlanDetails wmsInPlanDetail = new WmsInPlanDetails();
// 状态-待执行
wmsInPlanDetail.setPlanInStatus("0");
// 数量
wmsInPlanDetail.setQuantity("1");
wmsInPlanDetail.setQuantityIn("1");
wmsInPlanDetail.setMaterialId(mdItem.getItemId().toString());
wmsInPlan.setWmsInPlanDetailsList(Collections.singletonList(wmsInPlanDetail));
// 创建入库计划详情实例
WmsInPlanDetailEntity wmsInPlanDetailEntity = new WmsInPlanDetailEntity();
// 工具回库
if (StringUtils.equals(wmsInboundOrderDto.getTypeCode(), "GJHK")) {
BaseKnife baseKnife = baseKnifeService.selectBaseKnifeByRfid(wmsInboundOrderDto.getRfid());
if (baseKnife == null) {
throw new RuntimeException("RFID错误" + wmsInboundOrderDto.getRfid());
}
wmsInPlanDetailEntity.setKnifeId(baseKnife.getBaseKnifeId());
// 采购入库
} else if (StringUtils.equals(wmsInboundOrderDto.getTypeCode(), "DPRK")) {
}
wmsInPlanDetailEntity.setRfid(wmsInboundOrderDto.getRfid());
wmsInPlanDetail.setWmsInPlanDetailEntityList(Collections.singletonList(wmsInPlanDetailEntity));
this.insertAndIssueWmsInPlan(wmsInPlan);
}
}