|
|
@ -1,8 +1,10 @@
|
|
|
|
package org.dromara.mes.service.impl;
|
|
|
|
package org.dromara.mes.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.dromara.common.constant.DatabaseConstants;
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
import org.dromara.common.core.utils.uuid.Seq;
|
|
|
|
import org.dromara.common.core.utils.uuid.Seq;
|
|
|
|
|
|
|
|
import org.dromara.common.mapper.DynamicBaseSqlMapper;
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
@ -32,6 +34,8 @@ public class ProdPlanInfoServiceImpl implements IProdPlanInfoService {
|
|
|
|
|
|
|
|
|
|
|
|
private final ProdPlanInfoMapper baseMapper;
|
|
|
|
private final ProdPlanInfoMapper baseMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final DynamicBaseSqlMapper dynamicBaseSqlMapper;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询生产工单信息
|
|
|
|
* 查询生产工单信息
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -39,7 +43,7 @@ public class ProdPlanInfoServiceImpl implements IProdPlanInfoService {
|
|
|
|
* @return 生产工单信息
|
|
|
|
* @return 生产工单信息
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ProdPlanInfoVo queryById(Long planId){
|
|
|
|
public ProdPlanInfoVo queryById(Long planId) {
|
|
|
|
return baseMapper.selectVoById(planId);
|
|
|
|
return baseMapper.selectVoById(planId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -53,10 +57,13 @@ public class ProdPlanInfoServiceImpl implements IProdPlanInfoService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public TableDataInfo<ProdPlanInfoVo> queryPageList(ProdPlanInfoBo bo, PageQuery pageQuery) {
|
|
|
|
public TableDataInfo<ProdPlanInfoVo> queryPageList(ProdPlanInfoBo bo, PageQuery pageQuery) {
|
|
|
|
MPJLambdaWrapper<ProdPlanInfo> lqw = buildQueryWrapper(bo);
|
|
|
|
MPJLambdaWrapper<ProdPlanInfo> lqw = buildQueryWrapper(bo);
|
|
|
|
Page<ProdPlanInfoVo> result = baseMapper.selectProdPlanInfoList(pageQuery.build(), lqw);
|
|
|
|
Long workshopId = bo.getWorkshopId();
|
|
|
|
|
|
|
|
String tableName = DatabaseConstants.TABLE_NAME_PROD_PLAN_INFO_PREFIX + "_" + workshopId;
|
|
|
|
|
|
|
|
Page<ProdPlanInfoVo> result = baseMapper.selectProdPlanInfoList(pageQuery.build(), tableName, lqw);
|
|
|
|
return TableDataInfo.build(result);
|
|
|
|
return TableDataInfo.build(result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询符合条件的生产工单信息列表
|
|
|
|
* 查询符合条件的生产工单信息列表
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -70,40 +77,41 @@ public class ProdPlanInfoServiceImpl implements IProdPlanInfoService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private MPJLambdaWrapper<ProdPlanInfo> buildQueryWrapper(ProdPlanInfoBo bo) {
|
|
|
|
private MPJLambdaWrapper<ProdPlanInfo> buildQueryWrapper(ProdPlanInfoBo bo) {
|
|
|
|
|
|
|
|
System.out.println("wo;" + bo.getWorkshopId());
|
|
|
|
Map<String, Object> params = bo.getParams();
|
|
|
|
Map<String, Object> params = bo.getParams();
|
|
|
|
MPJLambdaWrapper<ProdPlanInfo> lqw = JoinWrappers.lambda(ProdPlanInfo.class)
|
|
|
|
MPJLambdaWrapper<ProdPlanInfo> lqw = JoinWrappers.lambda(ProdPlanInfo.class)
|
|
|
|
.selectAll(ProdPlanInfo.class)
|
|
|
|
.selectAll(ProdPlanInfo.class)
|
|
|
|
.eq(bo.getPlanId() != null, ProdPlanInfo::getPlanId, bo.getPlanId())
|
|
|
|
.eq(bo.getPlanId() != null, ProdPlanInfo::getPlanId, bo.getPlanId())
|
|
|
|
.eq(bo.getProductOrderId() != null, ProdPlanInfo::getProductOrderId, bo.getProductOrderId())
|
|
|
|
.eq(bo.getProductOrderId() != null, ProdPlanInfo::getProductOrderId, bo.getProductOrderId())
|
|
|
|
.eq(bo.getSaleOrderId() != null, ProdPlanInfo::getSaleOrderId, bo.getSaleOrderId())
|
|
|
|
.eq(bo.getSaleOrderId() != null, ProdPlanInfo::getSaleOrderId, bo.getSaleOrderId())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getSaleorderCode()), ProdPlanInfo::getSaleorderCode, bo.getSaleorderCode())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getSaleorderCode()), ProdPlanInfo::getSaleorderCode, bo.getSaleorderCode())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getPlanCode()), ProdPlanInfo::getPlanCode, bo.getPlanCode())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getPlanCode()), ProdPlanInfo::getPlanCode, bo.getPlanCode())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getDispatchCode()), ProdPlanInfo::getDispatchCode, bo.getDispatchCode())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getDispatchCode()), ProdPlanInfo::getDispatchCode, bo.getDispatchCode())
|
|
|
|
.eq(bo.getMaterialId() != null, ProdPlanInfo::getMaterialId, bo.getMaterialId())
|
|
|
|
.eq(bo.getMaterialId() != null, ProdPlanInfo::getMaterialId, bo.getMaterialId())
|
|
|
|
.eq(bo.getMaterialBomId() != null, ProdPlanInfo::getMaterialBomId, bo.getMaterialBomId())
|
|
|
|
.eq(bo.getMaterialBomId() != null, ProdPlanInfo::getMaterialBomId, bo.getMaterialBomId())
|
|
|
|
.eq(bo.getProcessId() != null, ProdPlanInfo::getProcessId, bo.getProcessId())
|
|
|
|
.eq(bo.getProcessId() != null, ProdPlanInfo::getProcessId, bo.getProcessId())
|
|
|
|
.eq(bo.getProcessOrder() != null, ProdPlanInfo::getProcessOrder, bo.getProcessOrder())
|
|
|
|
.eq(bo.getProcessOrder() != null, ProdPlanInfo::getProcessOrder, bo.getProcessOrder())
|
|
|
|
.eq(bo.getLastProcessId() != null, ProdPlanInfo::getLastProcessId, bo.getLastProcessId())
|
|
|
|
.eq(bo.getLastProcessId() != null, ProdPlanInfo::getLastProcessId, bo.getLastProcessId())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getFinalProcessFlag()), ProdPlanInfo::getFinalProcessFlag, bo.getFinalProcessFlag())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getFinalProcessFlag()), ProdPlanInfo::getFinalProcessFlag, bo.getFinalProcessFlag())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getReleaseType()), ProdPlanInfo::getReleaseType, bo.getReleaseType())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getReleaseType()), ProdPlanInfo::getReleaseType, bo.getReleaseType())
|
|
|
|
.eq(bo.getReleaseId() != null, ProdPlanInfo::getReleaseId, bo.getReleaseId())
|
|
|
|
.eq(bo.getReleaseId() != null, ProdPlanInfo::getReleaseId, bo.getReleaseId())
|
|
|
|
.eq(bo.getProductionTime() != null, ProdPlanInfo::getProductionTime, bo.getProductionTime())
|
|
|
|
.eq(bo.getProductionTime() != null, ProdPlanInfo::getProductionTime, bo.getProductionTime())
|
|
|
|
.eq(bo.getPlanAmount() != null, ProdPlanInfo::getPlanAmount, bo.getPlanAmount())
|
|
|
|
.eq(bo.getPlanAmount() != null, ProdPlanInfo::getPlanAmount, bo.getPlanAmount())
|
|
|
|
.eq(bo.getDispatchAmount() != null, ProdPlanInfo::getDispatchAmount, bo.getDispatchAmount())
|
|
|
|
.eq(bo.getDispatchAmount() != null, ProdPlanInfo::getDispatchAmount, bo.getDispatchAmount())
|
|
|
|
.eq(bo.getCompleteAmount() != null, ProdPlanInfo::getCompleteAmount, bo.getCompleteAmount())
|
|
|
|
.eq(bo.getCompleteAmount() != null, ProdPlanInfo::getCompleteAmount, bo.getCompleteAmount())
|
|
|
|
.eq(bo.getPlanBeginTime() != null, ProdPlanInfo::getPlanBeginTime, bo.getPlanBeginTime())
|
|
|
|
.eq(bo.getPlanBeginTime() != null, ProdPlanInfo::getPlanBeginTime, bo.getPlanBeginTime())
|
|
|
|
.eq(bo.getPlanEndTime() != null, ProdPlanInfo::getPlanEndTime, bo.getPlanEndTime())
|
|
|
|
.eq(bo.getPlanEndTime() != null, ProdPlanInfo::getPlanEndTime, bo.getPlanEndTime())
|
|
|
|
.eq(bo.getRealBeginTime() != null, ProdPlanInfo::getRealBeginTime, bo.getRealBeginTime())
|
|
|
|
.eq(bo.getRealBeginTime() != null, ProdPlanInfo::getRealBeginTime, bo.getRealBeginTime())
|
|
|
|
.eq(bo.getRealEndTime() != null, ProdPlanInfo::getRealEndTime, bo.getRealEndTime())
|
|
|
|
.eq(bo.getRealEndTime() != null, ProdPlanInfo::getRealEndTime, bo.getRealEndTime())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getAttachId()), ProdPlanInfo::getAttachId, bo.getAttachId())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getAttachId()), ProdPlanInfo::getAttachId, bo.getAttachId())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getPlanStatus()), ProdPlanInfo::getPlanStatus, bo.getPlanStatus())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getPlanStatus()), ProdPlanInfo::getPlanStatus, bo.getPlanStatus())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getImportFlag()), ProdPlanInfo::getImportFlag, bo.getImportFlag())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getImportFlag()), ProdPlanInfo::getImportFlag, bo.getImportFlag())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getFinishFlag()), ProdPlanInfo::getFinishFlag, bo.getFinishFlag())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getFinishFlag()), ProdPlanInfo::getFinishFlag, bo.getFinishFlag())
|
|
|
|
.eq(bo.getPriority() != null, ProdPlanInfo::getPriority, bo.getPriority())
|
|
|
|
.eq(bo.getPriority() != null, ProdPlanInfo::getPriority, bo.getPriority())
|
|
|
|
.eq(bo.getShiftId() != null, ProdPlanInfo::getShiftId, bo.getShiftId())
|
|
|
|
.eq(bo.getShiftId() != null, ProdPlanInfo::getShiftId, bo.getShiftId())
|
|
|
|
.eq(bo.getClassTeamId() != null, ProdPlanInfo::getClassTeamId, bo.getClassTeamId())
|
|
|
|
.eq(bo.getClassTeamId() != null, ProdPlanInfo::getClassTeamId, bo.getClassTeamId())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getModelCode()), ProdPlanInfo::getModelCode, bo.getModelCode())
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getModelCode()), ProdPlanInfo::getModelCode, bo.getModelCode())
|
|
|
|
.orderByDesc(ProdPlanInfo::getCreateTime);
|
|
|
|
.orderByDesc(ProdPlanInfo::getCreateTime);
|
|
|
|
return lqw;
|
|
|
|
return lqw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -119,10 +127,12 @@ public class ProdPlanInfoServiceImpl implements IProdPlanInfoService {
|
|
|
|
bo.setPlanCode(planCode);
|
|
|
|
bo.setPlanCode(planCode);
|
|
|
|
ProdPlanInfo add = MapstructUtils.convert(bo, ProdPlanInfo.class);
|
|
|
|
ProdPlanInfo add = MapstructUtils.convert(bo, ProdPlanInfo.class);
|
|
|
|
validEntityBeforeSave(add);
|
|
|
|
validEntityBeforeSave(add);
|
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
String tableName = DatabaseConstants.TABLE_NAME_PROD_PLAN_INFO_PREFIX + "_" + bo.getWorkshopId();
|
|
|
|
if (flag) {
|
|
|
|
boolean flag = dynamicBaseSqlMapper.dynamicInsert(tableName, DatabaseConstants.TABLE_NAME_PROD_PLAN_INFO_PREFIX, add) >0;
|
|
|
|
bo.setPlanId(add.getPlanId());
|
|
|
|
// boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
}
|
|
|
|
// if (flag) {
|
|
|
|
|
|
|
|
// bo.setPlanId(add.getPlanId());
|
|
|
|
|
|
|
|
// }
|
|
|
|
return flag;
|
|
|
|
return flag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -142,7 +152,7 @@ public class ProdPlanInfoServiceImpl implements IProdPlanInfoService {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 保存前的数据校验
|
|
|
|
* 保存前的数据校验
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void validEntityBeforeSave(ProdPlanInfo entity){
|
|
|
|
private void validEntityBeforeSave(ProdPlanInfo entity) {
|
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -155,7 +165,7 @@ public class ProdPlanInfoServiceImpl implements IProdPlanInfoService {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
|
if(isValid){
|
|
|
|
if (isValid) {
|
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
|
@ -183,4 +193,4 @@ public class ProdPlanInfoServiceImpl implements IProdPlanInfoService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|