Compare commits

...

8 Commits

16 changed files with 243 additions and 26 deletions

View File

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

View File

@ -6,10 +6,19 @@ import com.ktg.mes.md.domain.AP0AE;
import java.util.List;
/**
* @author Kelvin
*/
public interface AP0AEMapper {
@DataSource(DataSourceType.SQLSERVER)
List<AP0AE> selectOutNewData();
@DataSource(DataSourceType.SQLSERVER)
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;
/**
* @author luo26
*/
public interface IAP0AEService {
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.enums.DataSourceType;
import com.ktg.generator.util.MultiModuleCodeGenerator;
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.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.stereotype.Service;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* 小型刀具库-借领退还表
*
* @author Kelvin
*/
@Service
public class AP0AEServiceImpl implements IAP0AEService {
@Autowired
private AP0AEMapper aP0AEMapper;
@Autowired
private IWmsInPlanService wmsInPlanService;
@Autowired
private IWmsInTaskService wmsInTaskService;
@Autowired
private IWmStorageAreaService wmStorageAreaService;
@Autowired
private IMdItemService mdItemService;
@Override
public List<AP0AE> 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<>();
WmsInPlanDetailEntity entityQuery = new WmsInPlanDetailEntity();
entityQuery.setPlanId(Long.parseLong(inTask.getPlanInId()));
entityQuery.setPlanId(inTask.getPlanInId());
// entityQuery.setKnifeId(Long.parseLong(inTask.getPlanInId()));
List<WmsInPlanDetailEntity> wmsInPlanDetailEntityList = wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityList(entityQuery);
wmsInPlanDetailEntityList.forEach(inPlanDetailEntity -> {

View File

@ -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));
}

View File

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

View File

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

View File

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

View File

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

View File

@ -58,4 +58,6 @@ public interface IWmsInTaskService
* @return 结果
*/
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<>();
wmsInPlanDetailEntityList.forEach(entity -> {
// 获取入库计划信息
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(entity.getPlanId().toString());
WmsInPlan wmsInPlan = wmsInPlanMapper.selectWmsInPlanByPlanId(entity.getPlanId());
// 获取入库计划
WmsBusinessType wmsBusinessType = wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsInPlan.getPlanTypeId().toString());

View File

@ -1,14 +1,20 @@
package com.ktg.mes.wm.service.impl;
import java.util.Date;
import java.util.List;
import com.ktg.common.utils.DateUtils;
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.WmsInTask;
import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper;
import com.ktg.mes.wm.service.IWmsInTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import com.ktg.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
@ -31,6 +37,12 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
@Autowired
private WmsInPlanDetailEntityMapper wmsInPlanDetailEntityMapper;
@Autowired
private IWmsInTaskService wmsInTaskService;
@Autowired
private IMdItemService mdItemService;
/**
* 查询入库计划
*
@ -38,7 +50,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 -> {
@ -140,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();
@ -178,10 +190,51 @@ public class WmsInPlanServiceImpl implements IWmsInPlanService {
/**
* 入库计划ID是否重复
*
* @param planCode 入库计划ID
* @return 是否重复
*/
@Override
public Boolean isDuplicatePlanCode(String 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.setPlanTypeId(wmsInPlan.getPlanTypeId().toString());
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;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.*;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.utils.DateUtils;
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.mapper.MdItemMapper;
import com.ktg.mes.md.service.IBaseKnifeService;
import com.ktg.mes.md.service.IMdItemService;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmsInPlanDetailEntity;
import com.ktg.mes.wm.domain.*;
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.stereotype.Service;
import com.ktg.mes.wm.mapper.WmsInTaskMapper;
import com.ktg.mes.wm.domain.WmsInTask;
import com.ktg.mes.wm.service.IWmsInTaskService;
/**
* 入库任务Service业务层处理
@ -30,11 +29,19 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
@Autowired
private WmsInTaskMapper wmsInTaskMapper;
@Autowired
private MdItemMapper mdItemMapper;
private IMdItemService mdItemService;
@Autowired
private IWmsInPlanDetailEntityService wmsInPlanDetailEntityService;
@Autowired
private WmStorageAreaMapper wmStorageAreaMapper;
@Autowired
private IWmsInPlanService wmsInPlanService;
@Autowired
private IWmStorageAreaService wmStorageAreaService;
@Autowired
private IWmsZdTaskService wmsZdTaskService;
@Autowired
private IBaseKnifeService baseKnifeService;
/**
* 查询入库任务
@ -57,7 +64,7 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
public List<WmsInTask> selectWmsInTaskList(WmsInTask wmsInTask) {
List<WmsInTask> wmsInTaskList = new ArrayList<>();
wmsInTaskMapper.selectWmsInTaskList(wmsInTask).forEach(task -> {
MdItem mdItem = mdItemMapper.selectMdItemByCode(task.getMaterialCode());
MdItem mdItem = mdItemService.selectMdItemByCode(task.getMaterialCode());
task.setMaterialName(mdItem.getItemName());
WmsInPlanDetailEntity wmsInPlanDetailEntityQuery = new WmsInPlanDetailEntity();
@ -123,4 +130,33 @@ public class WmsInTaskServiceImpl implements IWmsInTaskService {
public int deleteWmsInTaskById(String 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

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

View File

@ -113,6 +113,15 @@
AND AE020 IS NOT NULL
</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 AP0AE
set UDF07 = 'ED'
@ -121,4 +130,13 @@
AND AE003 = #{AE003}
AND AE012 = #{AE012}
</update>
<update id="updateInDataToOld">
update AP0AE
set UDF06 = 'ED'
where AE001 = #{AE001}
AND AE002 = #{AE002}
AND AE003 = #{AE003}
AND AE012 = #{AE012}
</update>
</mapper>