|
|
@ -1,17 +1,27 @@
|
|
|
|
package com.op.quality.service.impl;
|
|
|
|
package com.op.quality.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
import com.op.common.core.utils.DateUtils;
|
|
|
|
import com.op.common.core.utils.DateUtils;
|
|
|
|
import com.op.quality.domain.QcBomComponent;
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
import com.op.quality.domain.QcSupplier;
|
|
|
|
import com.op.common.security.utils.SecurityUtils;
|
|
|
|
|
|
|
|
import com.op.quality.domain.*;
|
|
|
|
|
|
|
|
import com.op.quality.mapper.QcCheckTaskDetailMapper;
|
|
|
|
|
|
|
|
import com.op.quality.mapper.QcCheckTypeProjectMapper;
|
|
|
|
|
|
|
|
import com.op.quality.mapper.QcMaterialGroupDetailMapper;
|
|
|
|
import com.op.system.api.domain.SysUser;
|
|
|
|
import com.op.system.api.domain.SysUser;
|
|
|
|
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.op.quality.mapper.QcCheckTaskIncomeMapper;
|
|
|
|
import com.op.quality.mapper.QcCheckTaskIncomeMapper;
|
|
|
|
import com.op.quality.domain.QcCheckTaskIncome;
|
|
|
|
|
|
|
|
import com.op.quality.service.IQcCheckTaskIncomeService;
|
|
|
|
import com.op.quality.service.IQcCheckTaskIncomeService;
|
|
|
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
|
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 来料检验Service业务层处理
|
|
|
|
* 来料检验Service业务层处理
|
|
|
@ -24,6 +34,15 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private QcCheckTaskIncomeMapper qcCheckTaskIncomeMapper;
|
|
|
|
private QcCheckTaskIncomeMapper qcCheckTaskIncomeMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private QcCheckTypeProjectMapper qcCheckTypeProjectMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private QcMaterialGroupDetailMapper qcMaterialGroupDetailMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private QcCheckTaskDetailMapper qcCheckTaskDetailMapper;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询来料检验
|
|
|
|
* 查询来料检验
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -57,8 +76,55 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@DS("#header.poolName")
|
|
|
|
@DS("#header.poolName")
|
|
|
|
public int insertQcCheckTaskIncome(QcCheckTaskIncome qcCheckTaskIncome) {
|
|
|
|
public int insertQcCheckTaskIncome(QcCheckTaskIncome qcCheckTaskIncome) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String bpDD = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate());
|
|
|
|
|
|
|
|
int liushuiNum = qcCheckTaskIncomeMapper.getTodayMaxNum(qcCheckTaskIncome);
|
|
|
|
|
|
|
|
String liushuiStr = String.format("%04d", liushuiNum);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String createBy = SecurityUtils.getUsername();
|
|
|
|
|
|
|
|
//获取当前所选工厂
|
|
|
|
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
|
|
|
|
String key = "#header.poolName";
|
|
|
|
|
|
|
|
String factoryCode = request.getHeader(key.substring(8)).replace("ds_","");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qcCheckTaskIncome.setCheckNo(bpDD+liushuiStr);
|
|
|
|
qcCheckTaskIncome.setCreateTime(DateUtils.getNowDate());
|
|
|
|
qcCheckTaskIncome.setCreateTime(DateUtils.getNowDate());
|
|
|
|
return qcCheckTaskIncomeMapper.insertQcCheckTaskIncome(qcCheckTaskIncome);
|
|
|
|
|
|
|
|
|
|
|
|
/**qc_check_task_income**/
|
|
|
|
|
|
|
|
String beLongId = IdUtils.fastSimpleUUID();
|
|
|
|
|
|
|
|
qcCheckTaskIncome.setRecordId(beLongId);
|
|
|
|
|
|
|
|
qcCheckTaskIncomeMapper.insertQcCheckTaskIncome(qcCheckTaskIncome);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**取检测项**/
|
|
|
|
|
|
|
|
QcCheckTypeProject qctp= new QcCheckTypeProject();
|
|
|
|
|
|
|
|
qctp.setTypeId("checkTypeLL");//来料检验
|
|
|
|
|
|
|
|
qctp.setMaterialCode(qcCheckTaskIncome.getMaterialCode());//特性
|
|
|
|
|
|
|
|
/**qc_check_type_project**/
|
|
|
|
|
|
|
|
List<QcCheckTaskDetail> items = qcCheckTypeProjectMapper.getTPByTypeMaterial(qctp);
|
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(items)){
|
|
|
|
|
|
|
|
/**qc_material_group_detail**/
|
|
|
|
|
|
|
|
QcMaterialGroupDetail group = qcMaterialGroupDetailMapper.getGroupByMaterial(qcCheckTaskIncome.getMaterialCode());
|
|
|
|
|
|
|
|
if(group == null){
|
|
|
|
|
|
|
|
return 0;//没有找到检测项目
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
qctp.setGroupId(group.getGroupId());//共性
|
|
|
|
|
|
|
|
items = qcCheckTypeProjectMapper.getTPByTypeGroup(qctp);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**qc_check_task_detail**/
|
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(items)){
|
|
|
|
|
|
|
|
return 0;//没有找到检测项目
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Date nowDate= DateUtils.getNowDate();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(QcCheckTaskDetail item:items){
|
|
|
|
|
|
|
|
item.setRecordId(IdUtils.fastSimpleUUID());
|
|
|
|
|
|
|
|
item.setBelongTo(beLongId);
|
|
|
|
|
|
|
|
item.setCreateTime(nowDate);
|
|
|
|
|
|
|
|
item.setCreateBy(createBy);
|
|
|
|
|
|
|
|
item.setFactoryCode(factoryCode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return qcCheckTaskDetailMapper.addBatch(items);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|