Compare commits

..

No commits in common. "89b03eb93bf9e6a1d0b8aa38786403c150530199" and "005be7233abed7b1d0ffc341bec39775e76d3d7b" have entirely different histories.

14 changed files with 256 additions and 172 deletions

View File

@ -38,6 +38,7 @@ import com.ktg.common.enums.BusinessType;
import com.ktg.common.utils.poi.ExcelUtil; import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo; import com.ktg.common.core.page.TableDataInfo;
import static com.ktg.common.utils.SecurityUtils.getUsername;
import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode; import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode;
/** /**
@ -1093,30 +1094,30 @@ public class BaseKnifeController extends BaseController {
wmsInPlanTemp.setCreateTime(DateUtils.getNowDate()); wmsInPlanTemp.setCreateTime(DateUtils.getNowDate());
// 入库任务明细 // 入库任务明细
List<WmsInPlanDetail> wmsInPlanDetailList = new ArrayList<>(); List<WmsInPlanDetails> wmsInPlanDetailsList = new ArrayList<>();
WmsInPlanDetail wmsInPlanDetail = new WmsInPlanDetail(); WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails();
wmsInPlanDetail.setMaterialId(zdTask.getmProductId().toString()); wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString());
wmsInPlanDetail.setBatch(batchNum); wmsInPlanDetails.setBatch(batchNum);
wmsInPlanDetail.setCellId(1L); wmsInPlanDetails.setCellId(1L);
wmsInPlanDetail.setQuantity(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString());
wmsInPlanDetail.setQuantityIn(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString());
wmsInPlanDetail.setPlanInStatus("0"); wmsInPlanDetails.setPlanInStatus("0");
wmsInPlanDetailList.add(wmsInPlanDetail); wmsInPlanDetailsList.add(wmsInPlanDetails);
wmsInPlanTemp.setWmsInPlanDetailsList(wmsInPlanDetailList); wmsInPlanTemp.setWmsInPlanDetailsList(wmsInPlanDetailsList);
wmsInPlanService.insertWmsInPlan(wmsInPlanTemp); wmsInPlanService.insertWmsInPlan(wmsInPlanTemp);
wmsInPlan = wmsInPlanTemp; wmsInPlan = wmsInPlanTemp;
} else { } else {
// 入库任务明细 // 入库任务明细
List<WmsInPlanDetail> wmsInPlanDetailList = wmsInPlan.getWmsInPlanDetailsList(); List<WmsInPlanDetails> wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList();
WmsInPlanDetail wmsInPlanDetail = new WmsInPlanDetail(); WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails();
wmsInPlanDetail.setMaterialId(zdTask.getmProductId().toString()); wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString());
wmsInPlanDetail.setBatch(batchNum); wmsInPlanDetails.setBatch(batchNum);
wmsInPlanDetail.setCellId(1L); wmsInPlanDetails.setCellId(1L);
wmsInPlanDetail.setQuantity(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString());
wmsInPlanDetail.setQuantityIn(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString());
wmsInPlanDetail.setPlanInStatus("0"); wmsInPlanDetails.setPlanInStatus("0");
wmsInPlanDetailList.add(wmsInPlanDetail); wmsInPlanDetailsList.add(wmsInPlanDetails);
wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailList); wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList);
wmsInPlanService.updateWmsInPlan(wmsInPlan); wmsInPlanService.updateWmsInPlan(wmsInPlan);
} }

View File

@ -64,11 +64,7 @@ public class WmsOutTaskController extends BaseController {
@PutMapping("/open/run/{wmsOutTaskIds}") @PutMapping("/open/run/{wmsOutTaskIds}")
public AjaxResult openRun(@PathVariable Long[] wmsOutTaskIds) throws JAXBException { public AjaxResult openRun(@PathVariable Long[] wmsOutTaskIds) throws JAXBException {
try { return toAjax(wmsOutTaskService.runWmsOutTask(wmsOutTaskIds));
return toAjax(wmsOutTaskService.runWmsOutTask(wmsOutTaskIds));
} catch (JAXBException e) {
throw new RuntimeException(e);
}
} }
/** /**

View File

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

View File

@ -1,15 +1,27 @@
package com.ktg.mes.md.service.impl; package com.ktg.mes.md.service.impl;
import com.ktg.common.annotation.DataSource;
import com.ktg.common.enums.DataSourceType;
import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.md.domain.AP0AE; import com.ktg.mes.md.domain.AP0AE;
import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.md.mapper.AP0AEMapper; import com.ktg.mes.md.mapper.AP0AEMapper;
import com.ktg.mes.md.service.IAP0AEService; import com.ktg.mes.md.service.IAP0AEService;
import com.ktg.mes.md.service.IMdItemService; import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.domain.WmsInPlanDetails;
import com.ktg.mes.wm.domain.WmsInTask;
import com.ktg.mes.wm.service.IWmStorageAreaService; import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.service.IWmsInPlanService; import com.ktg.mes.wm.service.IWmsInPlanService;
import com.ktg.mes.wm.service.IWmsInTaskService; import com.ktg.mes.wm.service.IWmsInTaskService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**

View File

@ -12,7 +12,6 @@ import com.ktg.mes.wm.service.impl.WmsInPlanDetailEntityServiceImpl;
import jcifs.smb.NtlmPasswordAuthentication; import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile; import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileInputStream; import jcifs.smb.SmbFileInputStream;
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.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -37,14 +36,37 @@ import java.util.*;
* @date 2024-10-31 * @date 2024-10-31
*/ */
@Service @Service
@RequiredArgsConstructor
public class BaseKnifeServiceImpl implements IBaseKnifeService { public class BaseKnifeServiceImpl implements IBaseKnifeService {
private final BaseKnifeMapper baseKnifeMapper; @Autowired
private final WmsOutPlanMapper wmsOutPlanMapper; private BaseKnifeMapper baseKnifeMapper;
private final WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
private final WmsBusinessTypeMapper wmsBusinessTypeMapper;
private final WmsInPlanDetailEntityServiceImpl wmsInPlanDetailEntityService;
@Autowired
private WmsOutPlanMapper wmsOutPlanMapper;
@Autowired
private WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper;
@Autowired
private WmsOutTaskMapper wmsOutTaskMapper;
@Autowired
private WmsBusinessTypeMapper wmsBusinessTypeMapper;
@Autowired
private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
@Autowired
private WmsInPlanDetailEntityServiceImpl wmsInPlanDetailEntityService;
@Autowired
private MyConfig myConfig;
/**
* 查询工具台账
*
* @param baseKnifeId 工具台账主键
* @return 工具台账
*/
@Override @Override
public BaseKnife selectBaseKnifeByBaseKnifeId(Long baseKnifeId) { public BaseKnife selectBaseKnifeByBaseKnifeId(Long baseKnifeId) {
BaseKnife baseKnife = baseKnifeMapper.selectBaseKnifeByBaseKnifeId(baseKnifeId); BaseKnife baseKnife = baseKnifeMapper.selectBaseKnifeByBaseKnifeId(baseKnifeId);
@ -57,17 +79,6 @@ public class BaseKnifeServiceImpl implements IBaseKnifeService {
return baseKnife; return baseKnife;
} }
/**
* 查询工具台账
*
* @param rfid 工具台账主键
* @return 工具台账
*/
@Override
public BaseKnife selectBaseKnifeByRfid(String rfid) {
return baseKnifeMapper.selectBaseKnifeByRfid(rfid);
}
/** /**
* 查询工具台账列表 * 查询工具台账列表
* *

View File

@ -88,7 +88,22 @@ public class WmsInPlanController extends BaseController {
@Log(title = "入库计划", businessType = BusinessType.INSERT) @Log(title = "入库计划", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody WmsInPlan wmsInPlan) { public AjaxResult add(@RequestBody WmsInPlan wmsInPlan) {
wmsInPlanService.autoCell(wmsInPlan); // 校验是否指定了库区
if (wmsInPlan.getLocationCode() != null && !wmsInPlan.getLocationCode().isEmpty()) {
wmsInPlan.getWmsInPlanDetailsList().forEach(wmsInPlanDetails -> {
// 获得物料ID
MdItem mdItemById = mdItemMapper.selectMdItemById(Long.parseLong(wmsInPlanDetails.getMaterialId()));
if (mdItemById == null) throw new RuntimeException("操作失败,该物料不存在");
// 根据限定条件自动获取库位
WmStorageArea wmStorageArea = wmStorageLocationService.queryOneAreaByLocationCode(wmsInPlan.getLocationCode(), mdItemById.getAttr3() == 1);
if (wmStorageArea == null) throw new RuntimeException("操作失败,缺少空闲库位");
// 设定库位
wmsInPlanDetails.setCellId(wmStorageArea.getAreaId());
});
}
return toAjax(wmsInPlanService.insertWmsInPlan(wmsInPlan)); return toAjax(wmsInPlanService.insertWmsInPlan(wmsInPlan));
} }

View File

@ -167,7 +167,7 @@ public class WmsInPlan extends BaseEntity {
/** /**
* 入库计划明细信息 * 入库计划明细信息
*/ */
private List<WmsInPlanDetail> wmsInPlanDetailList; private List<WmsInPlanDetails> wmsInPlanDetailsList;
public void setPlanId(Long planId) { public void setPlanId(Long planId) {
this.planId = planId; this.planId = planId;
@ -361,12 +361,12 @@ public class WmsInPlan extends BaseEntity {
this.planTypeCode = planTypeCode; this.planTypeCode = planTypeCode;
} }
public List<WmsInPlanDetail> getWmsInPlanDetailsList() { public List<WmsInPlanDetails> getWmsInPlanDetailsList() {
return wmsInPlanDetailList; return wmsInPlanDetailsList;
} }
public void setWmsInPlanDetailsList(List<WmsInPlanDetail> wmsInPlanDetailList) { public void setWmsInPlanDetailsList(List<WmsInPlanDetails> wmsInPlanDetailsList) {
this.wmsInPlanDetailList = wmsInPlanDetailList; this.wmsInPlanDetailsList = wmsInPlanDetailsList;
} }
public String getLocationCode() { public String getLocationCode() {

View File

@ -1,7 +1,5 @@
package com.ktg.mes.wm.domain; package com.ktg.mes.wm.domain;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel; import com.ktg.common.annotation.Excel;
@ -15,9 +13,7 @@ import java.util.List;
* @author yinjinlu * @author yinjinlu
* @date 2024-10-31 * @date 2024-10-31
*/ */
@Setter public class WmsInPlanDetails extends BaseEntity
@Getter
public class WmsInPlanDetail extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -64,6 +60,103 @@ public class WmsInPlanDetail extends BaseEntity
private List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList; private List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList;
public void setDetailsId(Long detailsId) {
this.detailsId = detailsId;
}
public Long getDetailsId()
{
return detailsId;
}
public void setPlanId(Long planId) {
this.planId = planId;
}
public Long getPlanId() {
return planId;
}
public void setMaterialId(String materialId)
{
this.materialId = materialId;
}
public String getMaterialId()
{
return materialId;
}
public void setBatch(String batch)
{
this.batch = batch;
}
public String getBatch()
{
return batch;
}
public void setCellId(Long cellId)
{
this.cellId = cellId;
}
public Long getCellId()
{
return cellId;
}
public void setQuantity(String quantity)
{
this.quantity = quantity;
}
public String getQuantity()
{
return quantity;
}
public void setQuantityIn(String quantityIn)
{
this.quantityIn = quantityIn;
}
public String getQuantityIn()
{
return quantityIn;
}
public void setPlanInStatus(String planInStatus)
{
this.planInStatus = planInStatus;
}
public String getPlanInStatus()
{
return planInStatus;
}
public void setIsActivy(String isActivy)
{
this.isActivy = isActivy;
}
public String getIsActivy()
{
return isActivy;
}
public void setIsDelete(String isDelete)
{
this.isDelete = isDelete;
}
public String getIsDelete()
{
return isDelete;
}
public List<WmsInPlanDetailEntity> getWmsInPlanDetailEntityList() {
return wmsInPlanDetailEntityList;
}
public void setWmsInPlanDetailEntityList(List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList) {
this.wmsInPlanDetailEntityList = wmsInPlanDetailEntityList;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -2,7 +2,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List; import java.util.List;
import com.ktg.mes.wm.domain.WmsInPlan; import com.ktg.mes.wm.domain.WmsInPlan;
import com.ktg.mes.wm.domain.WmsInPlanDetail; import com.ktg.mes.wm.domain.WmsInPlanDetails;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
@ -73,10 +73,10 @@ public interface WmsInPlanMapper
/** /**
* 批量新增入库计划明细 * 批量新增入库计划明细
* *
* @param wmsInPlanDetailList 入库计划明细列表 * @param wmsInPlanDetailsList 入库计划明细列表
* @return 结果 * @return 结果
*/ */
public int batchWmsInPlanDetails(List<WmsInPlanDetail> wmsInPlanDetailList); public int batchWmsInPlanDetails(List<WmsInPlanDetails> wmsInPlanDetailsList);
/** /**
@ -96,5 +96,5 @@ public interface WmsInPlanMapper
*/ */
public Boolean isDuplicatePlanCode(String planCode); public Boolean isDuplicatePlanCode(String planCode);
WmsInPlanDetail selectWmsInPlanDetailById(Long planDetailsId); WmsInPlanDetails selectWmsInPlanDetailById(Long planDetailsId);
} }

View File

@ -72,20 +72,8 @@ public interface IWmsInPlanService
/** /**
* 执行入库计划 * 执行入库计划
*
* @param planId 入库计划ID * @param planId 入库计划ID
* @return 结果
*/ */
public void issueWmsInPlan(Long planId); public int issueWmsInPlan(Long planId);
/**
* 创建并执行入库计划
* @param wmsInPlan 入库计划
*/
public void insertAndIssueWmsInPlan(WmsInPlan wmsInPlan);
/**
* 分配库位
* @param wmsInPlan 入库计划
*/
public void autoCell(WmsInPlan wmsInPlan);
} }

View File

@ -70,7 +70,7 @@ public class WmsInPlanDetailEntityServiceImpl implements IWmsInPlanDetailEntityS
// 获取入库计划 // 获取入库计划
WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsInPlan.getPlanTypeId().toString()); WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsInPlan.getPlanTypeId().toString());
for (WmsInPlanDetail detail : wmsInPlan.getWmsInPlanDetailsList()) { for (WmsInPlanDetails detail : wmsInPlan.getWmsInPlanDetailsList()) {
// 匹配入库明细 // 匹配入库明细
if (detail.getDetailsId().equals(entity.getPlanDetailsId())) { if (detail.getDetailsId().equals(entity.getPlanDetailsId())) {
System.out.println("---" + detail.getDetailsId() + "+测试+" + entity.getPlanDetailsId()); System.out.println("---" + detail.getDetailsId() + "+测试+" + entity.getPlanDetailsId());

View File

@ -52,15 +52,15 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
@Override @Override
public WmsInPlan selectWmsInPlanByPlanId(Long planId) { public WmsInPlan selectWmsInPlanByPlanId(Long planId) {
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(planId); WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(planId);
List<WmsInPlanDetail> wmsInPlanDetailList = new ArrayList<>(); List<WmsInPlanDetails> wmsInPlanDetailsList = new ArrayList<>();
wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> { wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> {
WmsInPlanDetailEntity wmsInPlanDetailEntityQuery = new WmsInPlanDetailEntity(); WmsInPlanDetailEntity wmsInPlanDetailEntityQuery = new WmsInPlanDetailEntity();
wmsInPlanDetailEntityQuery.setPlanDetailsId(detail.getDetailsId()); wmsInPlanDetailEntityQuery.setPlanDetailsId(detail.getDetailsId());
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntityQuery); List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntityQuery);
detail.setWmsInPlanDetailEntityList(wmsInPlanDetailEntityList); detail.setWmsInPlanDetailEntityList(wmsInPlanDetailEntityList);
wmsInPlanDetailList.add(detail); wmsInPlanDetailsList.add(detail);
}); });
wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailList); wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList);
return wmsInPlan; return wmsInPlan;
} }
@ -83,7 +83,6 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
/** /**
* 同步小型刀具库数据 * 同步小型刀具库数据
*/ */
@Transactional
@Override @Override
public int asyncSmallKnifeData() { public int asyncSmallKnifeData() {
// List<AP0AE> ap0aeList = ap0AEMapper.selectInNewData(); // List<AP0AE> ap0aeList = ap0AEMapper.selectInNewData();
@ -91,6 +90,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
int count = 0; int count = 0;
inventoryAdjustments.stream().filter(adjustment -> adjustment.getBillDate() != null).forEach(ap0ae -> { inventoryAdjustments.stream().filter(adjustment -> adjustment.getBillDate() != null).forEach(ap0ae -> {
WmsInPlan wmsInPlan = new WmsInPlan(); WmsInPlan wmsInPlan = new WmsInPlan();
wmsInPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("RKP"));
// 发布人 // 发布人
wmsInPlan.setPublishName(ap0ae.getDataEntryClerk()); wmsInPlan.setPublishName(ap0ae.getDataEntryClerk());
// 计划日期 // 计划日期
@ -109,16 +109,16 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
MdItem mdItem = mdItemService.selectMdItemByCode(ap0ae.getProductNumber()); MdItem mdItem = mdItemService.selectMdItemByCode(ap0ae.getProductNumber());
//-- 入库计划详情 //-- 入库计划详情
WmsInPlanDetail wmsInPlanDetail = new WmsInPlanDetail(); WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails();
// 状态-待执行 // 状态-待执行
wmsInPlanDetail.setPlanInStatus("0"); wmsInPlanDetails.setPlanInStatus("0");
// 库位ID // 库位ID
wmsInPlanDetail.setCellId(wmStorageArea.getAreaId()); wmsInPlanDetails.setCellId(wmStorageArea.getAreaId());
wmsInPlanDetail.setQuantity(ap0ae.getQuantity().toString()); wmsInPlanDetails.setQuantity(ap0ae.getQuantity().toString());
wmsInPlanDetail.setQuantityIn(ap0ae.getQuantity().toString()); wmsInPlanDetails.setQuantityIn(ap0ae.getQuantity().toString());
wmsInPlanDetail.setMaterialId(mdItem.getItemId().toString()); wmsInPlanDetails.setMaterialId(mdItem.getItemId().toString());
wmsInPlan.setWmsInPlanDetailsList(Collections.singletonList(wmsInPlanDetail)); wmsInPlan.setWmsInPlanDetailsList(Collections.singletonList(wmsInPlanDetails));
this.insertWmsInPlan(wmsInPlan); this.insertWmsInPlan(wmsInPlan);
// 执行入库计划 // 执行入库计划
@ -206,24 +206,24 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
* @param wmsInPlan 入库计划对象 * @param wmsInPlan 入库计划对象
*/ */
public void insertWmsInPlanDetails(WmsInPlan wmsInPlan) { public void insertWmsInPlanDetails(WmsInPlan wmsInPlan) {
List<WmsInPlanDetail> wmsInPlanDetailList = wmsInPlan.getWmsInPlanDetailsList(); List<WmsInPlanDetails> wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList();
Long planId = wmsInPlan.getPlanId(); Long planId = wmsInPlan.getPlanId();
if (StringUtils.isNotNull(wmsInPlanDetailList)) { if (StringUtils.isNotNull(wmsInPlanDetailsList)) {
List<WmsInPlanDetail> list = new ArrayList<>(); List<WmsInPlanDetails> list = new ArrayList<>();
for (WmsInPlanDetail wmsInPlanDetail : wmsInPlanDetailList) { for (WmsInPlanDetails wmsInPlanDetails : wmsInPlanDetailsList) {
wmsInPlanDetail.setPlanId(planId); wmsInPlanDetails.setPlanId(planId);
list.add(wmsInPlanDetail); list.add(wmsInPlanDetails);
} }
if (!list.isEmpty()) { if (!list.isEmpty()) {
wmsInPlanMapper.batchWmsInPlanDetails(list); wmsInPlanMapper.batchWmsInPlanDetails(list);
WmsInPlan wmsInPlan1 = selectWmsInPlanByPlanId(planId); WmsInPlan wmsInPlan1 = selectWmsInPlanByPlanId(planId);
List<WmsInPlanDetail> wmsInPlanDetailList1 = wmsInPlan1.getWmsInPlanDetailsList(); List<WmsInPlanDetails> wmsInPlanDetailsList1 = wmsInPlan1.getWmsInPlanDetailsList();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = list.get(i).getWmsInPlanDetailEntityList(); List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = list.get(i).getWmsInPlanDetailEntityList();
wmsInPlanDetailList1.get(i).setWmsInPlanDetailEntityList(wmsInPlanDetailEntityList); wmsInPlanDetailsList1.get(i).setWmsInPlanDetailEntityList(wmsInPlanDetailEntityList);
wmsInPlanDetailEntityMapper.deleteWmsInPlanDetailEntityByPlanDetailsId(wmsInPlanDetailList1.get(i).getDetailsId()); wmsInPlanDetailEntityMapper.deleteWmsInPlanDetailEntityByPlanDetailsId(wmsInPlanDetailsList1.get(i).getDetailsId());
// 插入实例 // 插入实例
insertWmsInPlanDetailEntity(wmsInPlanDetailList1.get(i)); insertWmsInPlanDetailEntity(wmsInPlanDetailsList1.get(i));
} }
} }
} }
@ -232,12 +232,12 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
/** /**
* 新增入库计划明细实例 * 新增入库计划明细实例
* *
* @param wmsInPlanDetail 入库计划明细对象 * @param wmsInPlanDetails 入库计划明细对象
*/ */
public void insertWmsInPlanDetailEntity(WmsInPlanDetail wmsInPlanDetail) { public void insertWmsInPlanDetailEntity(WmsInPlanDetails wmsInPlanDetails) {
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetail.getWmsInPlanDetailEntityList(); List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetails.getWmsInPlanDetailEntityList();
Long planId = wmsInPlanDetail.getPlanId(); Long planId = wmsInPlanDetails.getPlanId();
Long planDetailsId = wmsInPlanDetail.getDetailsId(); Long planDetailsId = wmsInPlanDetails.getDetailsId();
if (StringUtils.isNotNull(wmsInPlanDetailEntityList)) { if (StringUtils.isNotNull(wmsInPlanDetailEntityList)) {
ArrayList<WmsInPlanDetailEntity> list = new ArrayList<>(); ArrayList<WmsInPlanDetailEntity> list = new ArrayList<>();
for (WmsInPlanDetailEntity wmsInPlanDetailEntity : wmsInPlanDetailEntityList) { for (WmsInPlanDetailEntity wmsInPlanDetailEntity : wmsInPlanDetailEntityList) {
@ -268,10 +268,10 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
* 执行入库计划 * 执行入库计划
* *
* @param planId 入库计划ID * @param planId 入库计划ID
* @return 结果
*/ */
@Override @Override
@Transactional public int issueWmsInPlan(Long planId) {
public void issueWmsInPlan(Long planId) {
WmsInPlan wmsInPlan = selectWmsInPlanByPlanId(planId); WmsInPlan wmsInPlan = selectWmsInPlanByPlanId(planId);
WmsInTask wmsInTask = new WmsInTask(); WmsInTask wmsInTask = new WmsInTask();
@ -299,42 +299,6 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
}); });
wmsInPlan.setState("1"); wmsInPlan.setState("1");
wmsInPlanMapper.updateWmsInPlan(wmsInPlan); return wmsInPlanMapper.updateWmsInPlan(wmsInPlan);
}
/**
* 创建并执行入库计划
*
* @param wmsInPlan 入库计划
*/
@Transactional
@Override
public void insertAndIssueWmsInPlan(WmsInPlan wmsInPlan) {
this.insertWmsInPlan(wmsInPlan);
this.issueWmsInPlan(wmsInPlan.getPlanId());
}
/**
* 自动分配库位
*
* @param wmsInPlan 入库计划
*/
@Override
public void autoCell(WmsInPlan wmsInPlan) {
// 校验是否指定了库区
if (StringUtils.isNotEmpty(wmsInPlan.getLocationCode())) {
wmsInPlan.getWmsInPlanDetailsList().forEach(wmsInPlanDetails -> {
// 获得物料ID
MdItem mdItemById = mdItemService.selectMdItemById(Long.parseLong(wmsInPlanDetails.getMaterialId()));
if (mdItemById == null) throw new RuntimeException("操作失败,该物料不存在");
// 根据限定条件自动获取库位
WmStorageArea wmStorageArea = wmStorageLocationService.queryOneAreaByLocationCode(wmsInPlan.getLocationCode(), mdItemById.getAttr3() == 1);
if (wmStorageArea == null) throw new RuntimeException("操作失败,缺少空闲库位");
// 设定库位
wmsInPlanDetails.setCellId(wmStorageArea.getAreaId());
});
}
} }
} }

View File

@ -1,17 +1,29 @@
package com.ktg.mes.wm.service.impl; package com.ktg.mes.wm.service.impl;
import java.io.IOException;
import java.util.*; import java.util.*;
import com.alibaba.fastjson.JSON;
import com.ktg.common.constant.UserConstants; import com.ktg.common.constant.UserConstants;
import com.ktg.common.core.domain.AjaxResult; import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.utils.DateUtils; import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils; import com.ktg.common.utils.StringUtils;
import com.ktg.generator.util.MultiModuleCodeGenerator; import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.cal.utils.CalendarUtil;
import com.ktg.mes.md.domain.*; import com.ktg.mes.md.domain.*;
import com.ktg.mes.md.mapper.*; import com.ktg.mes.md.mapper.*;
import com.ktg.mes.md.service.IBaseKnifeService;
import com.ktg.mes.md.service.IBaseTechnologyBomService;
import com.ktg.mes.md.service.IBomRouteService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.wm.domain.*; import com.ktg.mes.wm.domain.*;
import com.ktg.mes.wm.mapper.*; import com.ktg.mes.wm.mapper.*;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.service.IWmsInPlanService; import com.ktg.mes.wm.service.IWmsInPlanService;
import com.ktg.mes.wm.service.IWmsInTaskService;
import com.ktg.system.mapper.SysOperLogMapper;
import com.ktg.system.service.ISysOperLogService;
import okhttp3.*;
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 com.ktg.mes.wm.service.IWmsZdTaskService; import com.ktg.mes.wm.service.IWmsZdTaskService;
@ -424,14 +436,14 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
wmsInPlanTemp.setCreateTime(DateUtils.getNowDate()); wmsInPlanTemp.setCreateTime(DateUtils.getNowDate());
// 入库任务明细 // 入库任务明细
List<WmsInPlanDetail> wmsInPlanDetailList = new ArrayList<>(); List<WmsInPlanDetails> wmsInPlanDetailsList = new ArrayList<>();
WmsInPlanDetail wmsInPlanDetail = new WmsInPlanDetail(); WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails();
wmsInPlanDetail.setMaterialId(zdTask.getmProductId().toString()); wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString());
wmsInPlanDetail.setBatch(batchNum); wmsInPlanDetails.setBatch(batchNum);
wmsInPlanDetail.setCellId(wmStorageArea.getAreaId()); wmsInPlanDetails.setCellId(wmStorageArea.getAreaId());
wmsInPlanDetail.setQuantity(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString());
wmsInPlanDetail.setQuantityIn(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString());
wmsInPlanDetail.setPlanInStatus("0"); wmsInPlanDetails.setPlanInStatus("0");
// 构建入库明细实体 // 构建入库明细实体
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = new ArrayList<>(); List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = new ArrayList<>();
baseKnifeList.forEach(baseKnife -> { baseKnifeList.forEach(baseKnife -> {
@ -439,23 +451,23 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
wmsInPlanDetailEntity.setKnifeId(baseKnife.getBaseKnifeId()); wmsInPlanDetailEntity.setKnifeId(baseKnife.getBaseKnifeId());
wmsInPlanDetailEntityList.add(wmsInPlanDetailEntity); wmsInPlanDetailEntityList.add(wmsInPlanDetailEntity);
}); });
wmsInPlanDetail.setWmsInPlanDetailEntityList(wmsInPlanDetailEntityList); wmsInPlanDetails.setWmsInPlanDetailEntityList(wmsInPlanDetailEntityList);
wmsInPlanDetailList.add(wmsInPlanDetail); wmsInPlanDetailsList.add(wmsInPlanDetails);
wmsInPlanTemp.setWmsInPlanDetailsList(wmsInPlanDetailList); wmsInPlanTemp.setWmsInPlanDetailsList(wmsInPlanDetailsList);
wmsInPlanService.insertWmsInPlan(wmsInPlanTemp); wmsInPlanService.insertWmsInPlan(wmsInPlanTemp);
wmsInPlan = wmsInPlanTemp; wmsInPlan = wmsInPlanTemp;
} else { } else {
// 入库任务明细 // 入库任务明细
List<WmsInPlanDetail> wmsInPlanDetailList = wmsInPlan.getWmsInPlanDetailsList(); List<WmsInPlanDetails> wmsInPlanDetailsList = wmsInPlan.getWmsInPlanDetailsList();
WmsInPlanDetail wmsInPlanDetail = new WmsInPlanDetail(); WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails();
wmsInPlanDetail.setMaterialId(zdTask.getmProductId().toString()); wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString());
wmsInPlanDetail.setBatch(batchNum); wmsInPlanDetails.setBatch(batchNum);
wmsInPlanDetail.setCellId(wmStorageArea.getAreaId()); wmsInPlanDetails.setCellId(wmStorageArea.getAreaId());
wmsInPlanDetail.setQuantity(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString());
wmsInPlanDetail.setQuantityIn(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString());
wmsInPlanDetail.setPlanInStatus("0"); wmsInPlanDetails.setPlanInStatus("0");
wmsInPlanDetailList.add(wmsInPlanDetail); wmsInPlanDetailsList.add(wmsInPlanDetails);
wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailList); wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList);
wmsInPlanService.updateWmsInPlan(wmsInPlan); wmsInPlanService.updateWmsInPlan(wmsInPlan);
} }

View File

@ -37,11 +37,11 @@
</resultMap> </resultMap>
<resultMap id="WmsInPlanWmsInPlanDetailsResult" type="WmsInPlan" extends="WmsInPlanResult"> <resultMap id="WmsInPlanWmsInPlanDetailsResult" type="WmsInPlan" extends="WmsInPlanResult">
<collection property="wmsInPlanDetailList" notNullColumn="sub_DETAILS_ID" javaType="java.util.List" <collection property="wmsInPlanDetailsList" notNullColumn="sub_DETAILS_ID" javaType="java.util.List"
resultMap="WmsInPlanDetailsResult"/> resultMap="WmsInPlanDetailsResult"/>
</resultMap> </resultMap>
<resultMap type="WmsInPlanDetail" id="WmsInPlanDetailsResult"> <resultMap type="WmsInPlanDetails" id="WmsInPlanDetailsResult">
<result property="detailsId" column="sub_DETAILS_ID"/> <result property="detailsId" column="sub_DETAILS_ID"/>
<result property="planId" column="sub_PLAN_ID"/> <result property="planId" column="sub_PLAN_ID"/>
<result property="materialId" column="sub_MATERIAL_ID"/> <result property="materialId" column="sub_MATERIAL_ID"/>
@ -59,7 +59,7 @@
<result property="isDelete" column="sub_IS_DELETE"/> <result property="isDelete" column="sub_IS_DELETE"/>
</resultMap> </resultMap>
<resultMap type="WmsInPlanDetail" id="BizWmsInPlanDetailsResult"> <resultMap type="WmsInPlanDetails" id="BizWmsInPlanDetailsResult">
<result property="detailsId" column="sub_DETAILS_ID"/> <result property="detailsId" column="sub_DETAILS_ID"/>
<result property="planId" column="sub_PLAN_ID"/> <result property="planId" column="sub_PLAN_ID"/>
<result property="materialId" column="sub_MATERIAL_ID"/> <result property="materialId" column="sub_MATERIAL_ID"/>