Merge remote-tracking branch 'origin/master'

This commit is contained in:
汤锦科 2024-12-03 17:23:23 +08:00
commit ecc4090ec6
18 changed files with 299 additions and 37 deletions

View File

@ -963,7 +963,7 @@ public class BaseKnifeController extends BaseController {
// 生成任务号 // 生成任务号
String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT"); String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT");
wmsInTask.setTaskInCode(taskInCode); wmsInTask.setTaskInCode(taskInCode);
wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString()); wmsInTask.setPlanInId(wmsInPlan.getPlanId());
wmsInTask.setPlanInCode(wmsInPlan.getPlanCode()); wmsInTask.setPlanInCode(wmsInPlan.getPlanCode());
wmsInTask.setMaterialCode(mdItem.getItemCode()); wmsInTask.setMaterialCode(mdItem.getItemCode());
wmsInTask.setTaskInQuantity(zdTask.getProductIdQty()); wmsInTask.setTaskInQuantity(zdTask.getProductIdQty());

View File

@ -6,10 +6,19 @@ import com.ktg.mes.md.domain.AP0AE;
import java.util.List; import java.util.List;
/**
* @author Kelvin
*/
public interface AP0AEMapper { public interface AP0AEMapper {
@DataSource(DataSourceType.SQLSERVER) @DataSource(DataSourceType.SQLSERVER)
List<AP0AE> selectOutNewData(); List<AP0AE> selectOutNewData();
@DataSource(DataSourceType.SQLSERVER) @DataSource(DataSourceType.SQLSERVER)
int updateOutDataToOld(AP0AE ap0ae); int updateOutDataToOld(AP0AE ap0ae);
@DataSource(DataSourceType.SQLSERVER)
List<AP0AE> selectInNewData();
@DataSource(DataSourceType.SQLSERVER)
int updateInDataToOld(AP0AE ap0ae);
} }

View File

@ -4,6 +4,12 @@ import com.ktg.mes.md.domain.AP0AE;
import java.util.List; import java.util.List;
/**
* @author luo26
*/
public interface IAP0AEService { public interface IAP0AEService {
public List<AP0AE> selectOutNewData(); public List<AP0AE> selectOutNewData();
public List<AP0AE> selectInNewData();
} }

View File

@ -2,21 +2,106 @@ package com.ktg.mes.md.service.impl;
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.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.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.IWmsInPlanService;
import com.ktg.mes.wm.service.IWmsInTaskService;
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 java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
/**
* 小型刀具库-借领退还表
*
* @author Kelvin
*/
@Service @Service
public class AP0AEServiceImpl implements IAP0AEService { public class AP0AEServiceImpl implements IAP0AEService {
@Autowired @Autowired
private AP0AEMapper aP0AEMapper; private AP0AEMapper aP0AEMapper;
@Autowired
private IWmsInPlanService wmsInPlanService;
@Autowired
private IWmsInTaskService wmsInTaskService;
@Autowired
private IWmStorageAreaService wmStorageAreaService;
@Autowired
private IMdItemService mdItemService;
@Override @Override
public List<AP0AE> selectOutNewData() { public List<AP0AE> selectOutNewData() {
return this.aP0AEMapper.selectOutNewData(); return this.aP0AEMapper.selectOutNewData();
} }
@Override
public List<AP0AE> selectInNewData() {
List<AP0AE> ap0aeList = aP0AEMapper.selectInNewData();
ap0aeList.stream().filter(ap0ae -> ap0ae.getAE003() != null).forEach(ap0ae -> {
WmsInPlan wmsInPlan = new WmsInPlan();
wmsInPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("RKP"));
// 发布人
wmsInPlan.setPublishName(ap0ae.getAE004());
// 计划日期
wmsInPlan.setExpectDate(ap0ae.getAE003());
// 入库类型编码 刀片入库
wmsInPlan.setPlanTypeCode("DPRK");
// 库位编码
wmsInPlan.setCellCode(ap0ae.getAE020());
// 业务类型 自动生成
wmsInPlan.setSourceType("XTTB");
// 已执行
wmsInPlan.setState("1");
// 查询库位信息
WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaCode(ap0ae.getAE020());
MdItem mdItem = mdItemService.selectMdItemByCode(ap0ae.getAE014());
//-- 入库计划详情
WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails();
// 状态-待执行
wmsInPlanDetails.setPlanInStatus("0");
// 库位ID
wmsInPlanDetails.setCellId(wmStorageArea.getAreaId());
wmsInPlanDetails.setQuantity(ap0ae.getAE022().toString());
wmsInPlanDetails.setQuantityIn(ap0ae.getAE022().toString());
wmsInPlanDetails.setMaterialId(mdItem.getItemId().toString());
wmsInPlan.setWmsInPlanDetailsList(Collections.singletonList(wmsInPlanDetails));
wmsInPlanService.insertWmsInPlan(wmsInPlan);
// 执行入库计划
wmsInPlanService.issueWmsInPlan(wmsInPlan.getPlanId());
WmsInTask wmsInTask = new WmsInTask();
wmsInTask.setPlanInId(wmsInPlan.getPlanId());
wmsInTask.setPlanInStatus("0");
List<WmsInTask> wmsInTaskList = wmsInTaskService.selectWmsInTaskList(wmsInTask);
List<String> taskId = new ArrayList<>();
wmsInTaskList.forEach(wmsInTask1 -> {
taskId.add(wmsInTask1.getId().toString());
});
wmsInTaskService.issueBatch(taskId.toArray(new String[0]));
ap0ae.setUDF06("ED");
int i = aP0AEMapper.updateInDataToOld(ap0ae);
System.out.println("小型刀具库----" + i);
});
return Collections.emptyList();
}
} }

View File

@ -189,7 +189,7 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService {
// 获取当期入库明细数据 // 获取当期入库明细数据
List<HashMap<String, Object>> hashMapList = new ArrayList<>(); List<HashMap<String, Object>> hashMapList = new ArrayList<>();
WmsInPlanDetailEntity entityQuery = new WmsInPlanDetailEntity(); WmsInPlanDetailEntity entityQuery = new WmsInPlanDetailEntity();
entityQuery.setPlanId(Long.parseLong(inTask.getPlanInId())); entityQuery.setPlanId(inTask.getPlanInId());
// entityQuery.setKnifeId(Long.parseLong(inTask.getPlanInId())); // entityQuery.setKnifeId(Long.parseLong(inTask.getPlanInId()));
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityList(entityQuery); List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityList(entityQuery);
wmsInPlanDetailEntityList.forEach(inPlanDetailEntity -> { wmsInPlanDetailEntityList.forEach(inPlanDetailEntity -> {

View File

@ -3,6 +3,7 @@ package com.ktg.mes.wm.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ktg.mes.md.service.IAP0AEService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -34,6 +35,9 @@ public class WmsInPlanController extends BaseController {
@Autowired @Autowired
private IWmsInPlanService wmsInPlanService; private IWmsInPlanService wmsInPlanService;
@Autowired
private IAP0AEService iAP0AEService;
/** /**
* 查询入库计划列表 * 查询入库计划列表
*/ */
@ -42,6 +46,7 @@ public class WmsInPlanController extends BaseController {
public TableDataInfo list(WmsInPlan wmsInPlan) { public TableDataInfo list(WmsInPlan wmsInPlan) {
startPage(); startPage();
List<WmsInPlan> list = wmsInPlanService.selectWmsInPlanList(wmsInPlan); List<WmsInPlan> list = wmsInPlanService.selectWmsInPlanList(wmsInPlan);
iAP0AEService.selectInNewData();
return getDataTable(list); return getDataTable(list);
} }
@ -62,7 +67,7 @@ public class WmsInPlanController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('wm:PLAN:query')") @PreAuthorize("@ss.hasPermi('wm:PLAN:query')")
@GetMapping(value = "/{planId}") @GetMapping(value = "/{planId}")
public AjaxResult getInfo(@PathVariable("planId") String planId) { public AjaxResult getInfo(@PathVariable("planId") Long planId) {
return AjaxResult.success(wmsInPlanService.selectWmsInPlanByPlanId(planId)); return AjaxResult.success(wmsInPlanService.selectWmsInPlanByPlanId(planId));
} }

View File

@ -17,11 +17,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode; import static com.ktg.generator.util.MultiModuleCodeGenerator.generateTaskCode;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.*; import java.util.*;
import java.util.stream.Stream; import java.util.stream.Stream;
import com.ktg.mes.wm.mapper.*; import com.ktg.mes.wm.mapper.*;
import com.ktg.mes.md.mapper.*; import com.ktg.mes.md.mapper.*;
@ -90,6 +92,14 @@ public class WmsInTaskController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/**
* 查询入库任务
*/
@GetMapping("/open/rfid/{rfid}")
public AjaxResult byRfid(@PathVariable String rfid) {
return AjaxResult.success(wmsInTaskService.selectWmsInTaskByRfid(rfid));
}
/** /**
* 查询入库任务列表 * 查询入库任务列表
*/ */
@ -177,7 +187,7 @@ public class WmsInTaskController extends BaseController {
// 如果是自动生成的组刀任务入库 // 如果是自动生成的组刀任务入库
WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanId(wmsInTask.getPlanInId()); WmsInPlan wmsInPlan = wmsInPlanService.selectWmsInPlanByPlanId(wmsInTask.getPlanInId());
if (Objects.equals("SCZB", wmsInPlan.getSourceType())){ if (Objects.equals("SCZB", wmsInPlan.getSourceType())) {
// 查询组装任务 // 查询组装任务
WmsZdTask wmsZdTaskWrapper = new WmsZdTask(); WmsZdTask wmsZdTaskWrapper = new WmsZdTask();
wmsZdTaskWrapper.setPlanSheet(wmsInPlan.getPlanCode()); wmsZdTaskWrapper.setPlanSheet(wmsInPlan.getPlanCode());
@ -200,8 +210,8 @@ public class WmsInTaskController extends BaseController {
// 检测订单是否完成完成则出库整刀 // 检测订单是否完成完成则出库整刀
if (this.checkFinal(wmsInPlan.getPlanCode())) this.createOutTask(wmsInPlan.getPlanCode()); if (this.checkFinal(wmsInPlan.getPlanCode())) this.createOutTask(wmsInPlan.getPlanCode());
} else if (Objects.equals("ZZRW", wmsInPlan.getSourceType())){ } else if (Objects.equals("ZZRW", wmsInPlan.getSourceType())) {
// 查询组装任务 // 查询组装任务
WmsZdTask wmsZdTaskWrapper = new WmsZdTask(); WmsZdTask wmsZdTaskWrapper = new WmsZdTask();
wmsZdTaskWrapper.setCode(wmsInPlan.getPlanCode()); wmsZdTaskWrapper.setCode(wmsInPlan.getPlanCode());
wmsZdTaskWrapper.setmProductId(Long.parseLong(wmsInTask.getMaterialId())); wmsZdTaskWrapper.setmProductId(Long.parseLong(wmsInTask.getMaterialId()));
@ -312,8 +322,8 @@ public class WmsInTaskController extends BaseController {
} }
// 检查订单完成状态 // 检查订单完成状态
public Boolean checkFinal(String planSheet){ public Boolean checkFinal(String planSheet) {
// 获取订单记录 // 获取订单记录
ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet); ProductionArrangements productionArrangements = productionArrangementsMapper.selectProductionArrangementsByPlanSheet(planSheet);
BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom(); BaseTechnologyBom baseTechnologyBomWrapper = new BaseTechnologyBom();
@ -334,7 +344,7 @@ public class WmsInTaskController extends BaseController {
// 检查订单完成状态 // 检查订单完成状态
@Transactional @Transactional
public void createOutTask(String planSheet){ public void createOutTask(String planSheet) {
// 构建出库计划 // 构建出库计划
WmsOutPlan outPlan = new WmsOutPlan(); WmsOutPlan outPlan = new WmsOutPlan();
outPlan.setPlanCode(planSheet); outPlan.setPlanCode(planSheet);
@ -360,7 +370,8 @@ public class WmsInTaskController extends BaseController {
baseKnifeWrapper.setPlanSheet(planSheet); baseKnifeWrapper.setPlanSheet(planSheet);
baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode()); baseKnifeWrapper.setKnifeCode(technologyBom.getKnifeCode());
List<BaseKnife> baseKnifeLockedList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper); List<BaseKnife> baseKnifeLockedList = baseKnifeMapper.selectBaseKnifeList(baseKnifeWrapper);
if (baseKnifeLockedList.size() == technologyBom.getKnifeCount()) baseKnifeResultList.addAll(baseKnifeLockedList); if (baseKnifeLockedList.size() == technologyBom.getKnifeCount())
baseKnifeResultList.addAll(baseKnifeLockedList);
} }
String batchNum = "SCZBPC01"; String batchNum = "SCZBPC01";

View File

@ -1,5 +1,6 @@
package com.ktg.mes.wm.domain; package com.ktg.mes.wm.domain;
import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
@ -55,7 +56,7 @@ public class WmsInPlan extends BaseEntity {
* 计划日期 * 计划日期
*/ */
@Excel(name = "计划日期") @Excel(name = "计划日期")
private String expectDate; private Date expectDate;
/** /**
* 发布人 * 发布人
@ -211,11 +212,11 @@ public class WmsInPlan extends BaseEntity {
return workOrderCode; return workOrderCode;
} }
public void setExpectDate(String expectDate) { public void setExpectDate(Date expectDate) {
this.expectDate = expectDate; this.expectDate = expectDate;
} }
public String getExpectDate() { public Date getExpectDate() {
return expectDate; return expectDate;
} }

View File

@ -31,7 +31,7 @@ public class WmsInTask extends BaseEntity {
* 入库计划id * 入库计划id
*/ */
@Excel(name = "入库计划id") @Excel(name = "入库计划id")
private String planInId; private Long planInId;
/** /**
* 任务数量 * 任务数量
@ -157,11 +157,11 @@ public class WmsInTask extends BaseEntity {
return taskInCode; return taskInCode;
} }
public void setPlanInId(String planInId) { public void setPlanInId(Long planInId) {
this.planInId = planInId; this.planInId = planInId;
} }
public String getPlanInId() { public Long getPlanInId() {
return planInId; return planInId;
} }

View File

@ -18,7 +18,7 @@ public interface WmsInPlanMapper
* @param planId 入库计划主键 * @param planId 入库计划主键
* @return 入库计划 * @return 入库计划
*/ */
public WmsInPlan selectWmsInPlanByPlanId(String planId); public WmsInPlan selectWmsInPlanByPlanId(Long planId);
/** /**
* 查询入库计划列表 * 查询入库计划列表

View File

@ -17,7 +17,7 @@ public interface IWmsInPlanService
* @param planId 入库计划主键 * @param planId 入库计划主键
* @return 入库计划 * @return 入库计划
*/ */
public WmsInPlan selectWmsInPlanByPlanId(String planId); public WmsInPlan selectWmsInPlanByPlanId(Long planId);
WmsInPlan selectWmsInPlanByPlanCode(String planCode); WmsInPlan selectWmsInPlanByPlanCode(String planCode);
@ -67,4 +67,11 @@ public interface IWmsInPlanService
* @return 是否重复 * @return 是否重复
*/ */
public Boolean isDuplicatePlanCode(String planCode); public Boolean isDuplicatePlanCode(String planCode);
/**
* 执行入库计划
* @param planId 入库计划ID
* @return 结果
*/
public int issueWmsInPlan(Long planId);
} }

View File

@ -19,6 +19,14 @@ public interface IWmsInTaskService
*/ */
public WmsInTask selectWmsInTaskById(String id); public WmsInTask selectWmsInTaskById(String id);
/**
* 查询入库任务
*
* @param rfid rfid
* @return 入库任务
*/
public WmsInTask selectWmsInTaskByRfid(String rfid);
/** /**
* 查询入库任务列表 * 查询入库任务列表
* *
@ -66,4 +74,6 @@ public interface IWmsInTaskService
* @return 结果 * @return 结果
*/ */
public int deleteWmsInTaskById(String id); public int deleteWmsInTaskById(String id);
public int issueBatch(String[] ids);
} }

View File

@ -66,7 +66,7 @@ public class WmsInPlanDetailEntityServiceImpl implements IWmsInPlanDetailEntityS
List<WmsInPlanDetailEntity> handleWmsInPlanDetailEntityList = new ArrayList<>(); List<WmsInPlanDetailEntity> handleWmsInPlanDetailEntityList = new ArrayList<>();
wmsInPlanDetailEntityList.forEach(entity -> { wmsInPlanDetailEntityList.forEach(entity -> {
// 获取入库计划信息 // 获取入库计划信息
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(entity.getPlanId().toString()); WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(entity.getPlanId());
// 获取入库计划 // 获取入库计划
WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsInPlan.getPlanTypeId().toString()); WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsInPlan.getPlanTypeId().toString());

View File

@ -1,14 +1,21 @@
package com.ktg.mes.wm.service.impl; package com.ktg.mes.wm.service.impl;
import java.util.Date;
import java.util.List; import java.util.List;
import com.ktg.common.utils.DateUtils; import com.ktg.common.utils.DateUtils;
import com.ktg.generator.util.MultiModuleCodeGenerator;
import com.ktg.mes.md.domain.MdItem;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity; import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.domain.WmsInTask;
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper; import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
import com.ktg.mes.wm.service.IWmsInTaskService;
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 java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import com.ktg.common.utils.StringUtils; import com.ktg.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -31,6 +38,12 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
@Autowired @Autowired
private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper; private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
@Autowired
private IWmsInTaskService wmsInTaskService;
@Autowired
private IMdItemService mdItemService;
/** /**
* 查询入库计划 * 查询入库计划
* *
@ -38,7 +51,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
* @return 入库计划 * @return 入库计划
*/ */
@Override @Override
public WmsInPlan selectWmsInPlanByPlanId(String planId) { public WmsInPlan selectWmsInPlanByPlanId(Long planId) {
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(planId); WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(planId);
List<WmsInPlanDetails> wmsInPlanDetailsList = new ArrayList<>(); List<WmsInPlanDetails> wmsInPlanDetailsList = new ArrayList<>();
wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> { wmsInPlan.getWmsInPlanDetailsList().forEach(detail -> {
@ -78,6 +91,8 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
@Override @Override
public int insertWmsInPlan(WmsInPlan wmsInPlan) { public int insertWmsInPlan(WmsInPlan wmsInPlan) {
wmsInPlan.setCreateTime(DateUtils.getNowDate()); wmsInPlan.setCreateTime(DateUtils.getNowDate());
// 设置计划编码
wmsInPlan.setPlanCode(MultiModuleCodeGenerator.generateTaskCode("RKP"));
int rows = wmsInPlanMapper.insertWmsInPlan(wmsInPlan); int rows = wmsInPlanMapper.insertWmsInPlan(wmsInPlan);
insertWmsInPlanDetails(wmsInPlan); insertWmsInPlanDetails(wmsInPlan);
return rows; return rows;
@ -140,7 +155,7 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
} }
if (!list.isEmpty()) { if (!list.isEmpty()) {
wmsInPlanMapper.batchWmsInPlanDetails(list); wmsInPlanMapper.batchWmsInPlanDetails(list);
WmsInPlan wmsInPlan1 = selectWmsInPlanByPlanId(planId.toString()); WmsInPlan wmsInPlan1 = selectWmsInPlanByPlanId(planId);
List<WmsInPlanDetails> wmsInPlanDetailsList1 = 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();
@ -178,10 +193,50 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
/** /**
* 入库计划ID是否重复 * 入库计划ID是否重复
*
* @param planCode 入库计划ID * @param planCode 入库计划ID
* @return 是否重复 * @return 是否重复
*/ */
@Override
public Boolean isDuplicatePlanCode(String planCode) { public Boolean isDuplicatePlanCode(String planCode) {
return wmsInPlanMapper.isDuplicatePlanCode(planCode); return wmsInPlanMapper.isDuplicatePlanCode(planCode);
} }
/**
* 执行入库计划
*
* @param planId 入库计划ID
* @return 结果
*/
@Override
public int 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");
return wmsInPlanMapper.updateWmsInPlan(wmsInPlan);
}
} }

View File

@ -1,23 +1,22 @@
package com.ktg.mes.wm.service.impl; package com.ktg.mes.wm.service.impl;
import java.util.ArrayList; import java.util.*;
import java.util.Collections;
import java.util.List;
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.generator.util.MultiModuleCodeGenerator; 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.MdItem;
import com.ktg.mes.md.mapper.MdItemMapper; import com.ktg.mes.md.service.IBaseKnifeService;
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.*;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper; import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import com.ktg.mes.wm.service.IWmsInPlanDetailEntityService; import com.ktg.mes.wm.service.*;
import org.checkerframework.checker.units.qual.A;
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.mapper.WmsInTaskMapper; import com.ktg.mes.wm.mapper.WmsInTaskMapper;
import com.ktg.mes.wm.domain.WmsInTask;
import com.ktg.mes.wm.service.IWmsInTaskService;
/** /**
* 入库任务Service业务层处理 * 入库任务Service业务层处理
@ -30,11 +29,19 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
@Autowired @Autowired
private WmsInTaskMapper wmsInTaskMapper; private WmsInTaskMapper wmsInTaskMapper;
@Autowired @Autowired
private MdItemMapper mdItemMapper; private IMdItemService mdItemService;
@Autowired @Autowired
private IWmsInPlanDetailEntityService wmsInPlanDetailEntityService; private IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
@Autowired @Autowired
private WmStorageAreaMapper wmStorageAreaMapper; private WmStorageAreaMapper wmStorageAreaMapper;
@Autowired
private IWmsInPlanService wmsInPlanService;
@Autowired
private IWmStorageAreaService wmStorageAreaService;
@Autowired
private IWmsZdTaskService wmsZdTaskService;
@Autowired
private IBaseKnifeService baseKnifeService;
/** /**
* 查询入库任务 * 查询入库任务
@ -47,6 +54,25 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
return wmsInTaskMapper.selectWmsInTaskById(id); return wmsInTaskMapper.selectWmsInTaskById(id);
} }
@Override
public WmsInTask selectWmsInTaskByRfid(String rfid) {
WmsInPlanDetailEntity wmsInPlanDetailEntity = new WmsInPlanDetailEntity();
WmsInTask wmsInTask = null;
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityService.selectWmsInPlanDetailEntityList(wmsInPlanDetailEntity);
for (WmsInPlanDetailEntity entity : wmsInPlanDetailEntityList) {
WmsInTask wmsInTaskQuery = new WmsInTask();
wmsInTaskQuery.setDetailInId(entity.getPlanDetailsId());
wmsInTaskQuery.setPlanInStatus("0");
List<WmsInTask> wmsInTaskList = selectWmsInTaskList(wmsInTaskQuery);
if (!wmsInTaskList.isEmpty()) {
wmsInTask = wmsInTaskList.get(0);
break;
}
}
return wmsInTask;
}
/** /**
* 查询入库任务列表 * 查询入库任务列表
* *
@ -57,7 +83,7 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
public List<WmsInTask> selectWmsInTaskList(WmsInTask wmsInTask) { public List<WmsInTask> selectWmsInTaskList(WmsInTask wmsInTask) {
List<WmsInTask> wmsInTaskList = new ArrayList<>(); List<WmsInTask> wmsInTaskList = new ArrayList<>();
wmsInTaskMapper.selectWmsInTaskList(wmsInTask).forEach(task -> { wmsInTaskMapper.selectWmsInTaskList(wmsInTask).forEach(task -> {
MdItem mdItem = mdItemMapper.selectMdItemByCode(task.getMaterialCode()); MdItem mdItem = mdItemService.selectMdItemByCode(task.getMaterialCode());
task.setMaterialName(mdItem.getItemName()); task.setMaterialName(mdItem.getItemName());
WmsInPlanDetailEntity wmsInPlanDetailEntityQuery = new WmsInPlanDetailEntity(); WmsInPlanDetailEntity wmsInPlanDetailEntityQuery = new WmsInPlanDetailEntity();
@ -134,4 +160,33 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
public int deleteWmsInTaskById(String id) { public int deleteWmsInTaskById(String id) {
return wmsInTaskMapper.deleteWmsInTaskById(id); return wmsInTaskMapper.deleteWmsInTaskById(id);
} }
@Override
public int issueBatch(String[] ids) {
for (String taskId : ids) {
// 获取任务信息
WmsInTask wmsInTask = selectWmsInTaskById(taskId);
// 更新任务状态
wmsInTask.setPlanInStatus("1");
updateWmsInTask(wmsInTask);
MdItem mbbBdMrlMitm = mdItemService.selectMdItemByCode(wmsInTask.getMaterialCode());
BaseKnife baseKnifeQuery = new BaseKnife();
baseKnifeQuery.setKnifeCode(mbbBdMrlMitm.getItemCode());
baseKnifeQuery.setKnifeFineState(2);
List<BaseKnife> baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeQuery);
for (int i = 0; i < wmsInTask.getActualInQuantity(); i++) {
BaseKnife baseKnife = baseKnifeList.get(i);
// 设置状态为 解锁
baseKnife.setIsLocked(0);
// 设置工具状态 已入库
baseKnife.setKnifeFineState(1);
// 更新台账状态
baseKnifeService.updateBaseKnife(baseKnife);
}
}
return 0;
}
} }

View File

@ -442,7 +442,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService
// 生成任务号 // 生成任务号
String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT"); String taskInCode = MultiModuleCodeGenerator.generateTaskCode("RKT");
wmsInTask.setTaskInCode(taskInCode); wmsInTask.setTaskInCode(taskInCode);
wmsInTask.setPlanInId(wmsInPlan.getPlanId().toString()); wmsInTask.setPlanInId(wmsInPlan.getPlanId());
wmsInTask.setPlanInCode(wmsInPlan.getPlanCode()); wmsInTask.setPlanInCode(wmsInPlan.getPlanCode());
wmsInTask.setMaterialCode(mdItem.getItemCode()); wmsInTask.setMaterialCode(mdItem.getItemCode());
wmsInTask.setTaskInQuantity(zdTask.getProductIdQty()); wmsInTask.setTaskInQuantity(zdTask.getProductIdQty());

View File

@ -113,6 +113,15 @@
AND AE020 IS NOT NULL AND AE020 IS NOT NULL
</select> </select>
<select id="selectInNewData" resultMap="AP0AEResult">
<include refid="AP0AESelectAllCol"/>
WHERE UDF06 != 'ED'
AND AE025 = '归还单'
AND AE022 > 0
AND AE014 IS NOT NULL
AND AE020 IS NOT NULL
</select>
<update id="updateOutDataToOld"> <update id="updateOutDataToOld">
update AP0AE update AP0AE
set UDF07 = 'ED' set UDF07 = 'ED'
@ -121,4 +130,13 @@
AND AE003 = #{AE003} AND AE003 = #{AE003}
AND AE012 = #{AE012} AND AE012 = #{AE012}
</update> </update>
<update id="updateInDataToOld">
update AP0AE
set UDF06 = 'ED'
where AE001 = #{AE001}
AND AE002 = #{AE002}
AND AE003 = #{AE003}
AND AE012 = #{AE012}
</update>
</mapper> </mapper>

View File

@ -55,7 +55,7 @@
<result property="createTime" column="sub_CREATE_TIME"/> <result property="createTime" column="sub_CREATE_TIME"/>
<result property="updateBy" column="sub_UPDATE_BY"/> <result property="updateBy" column="sub_UPDATE_BY"/>
<result property="updateTime" column="sub_UPDATE_TIME"/> <result property="updateTime" column="sub_UPDATE_TIME"/>
<result property="isActivy" column="sub_IS_ACTIVY"/> <result property="isActive" column="sub_IS_ACTIVE"/>
<result property="isDelete" column="sub_IS_DELETE"/> <result property="isDelete" column="sub_IS_DELETE"/>
</resultMap> </resultMap>
@ -73,7 +73,7 @@
<result property="createTime" column="sub_CREATE_TIME"/> <result property="createTime" column="sub_CREATE_TIME"/>
<result property="updateBy" column="sub_UPDATE_BY"/> <result property="updateBy" column="sub_UPDATE_BY"/>
<result property="updateTime" column="sub_UPDATE_TIME"/> <result property="updateTime" column="sub_UPDATE_TIME"/>
<result property="isActivy" column="sub_IS_ACTIVY"/> <result property="isActive" column="sub_IS_ACTIVE"/>
<result property="isDelete" column="sub_IS_DELETE"/> <result property="isDelete" column="sub_IS_DELETE"/>
</resultMap> </resultMap>
@ -105,7 +105,7 @@
IS_ACTIVE, IS_ACTIVE,
IS_DELETE, IS_DELETE,
PLAN_CODE, PLAN_CODE,
PLAN_TYPE_ID PLAN_TYPE_ID,
PLAN_TYPE_CODE PLAN_TYPE_CODE
from WMS_IN_PLAN from WMS_IN_PLAN
</sql> </sql>
@ -147,7 +147,7 @@
order by CREATE_TIME desc order by CREATE_TIME desc
</select> </select>
<select id="selectWmsInPlanByPlanId" parameterType="String" resultMap="WmsInPlanWmsInPlanDetailsResult"> <select id="selectWmsInPlanByPlanId" parameterType="LONG" resultMap="WmsInPlanWmsInPlanDetailsResult">
select a.PLAN_ID, select a.PLAN_ID,
a.STATE, a.STATE,
a.SOURCE_TYPE, a.SOURCE_TYPE,