|
|
|
@ -1,14 +1,28 @@
|
|
|
|
|
package com.op.quality.service.impl;
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
|
import com.op.common.core.utils.DateUtils;
|
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
|
import com.op.common.security.utils.SecurityUtils;
|
|
|
|
|
import com.op.quality.domain.QcCheckTaskDetail;
|
|
|
|
|
import com.op.quality.domain.QcCheckTypeProject;
|
|
|
|
|
import com.op.quality.domain.QcMaterialGroupDetail;
|
|
|
|
|
import com.op.quality.mapper.QcCheckTaskDetailMapper;
|
|
|
|
|
import com.op.quality.mapper.QcCheckTypeProjectMapper;
|
|
|
|
|
import com.op.quality.mapper.QcMaterialGroupDetailMapper;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import com.op.quality.mapper.QcCheckTaskWarehousingMapper;
|
|
|
|
|
import com.op.quality.domain.QcCheckTaskWarehousing;
|
|
|
|
|
import com.op.quality.service.IQcCheckTaskWarehousingService;
|
|
|
|
|
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业务层处理
|
|
|
|
@ -21,6 +35,15 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin
|
|
|
|
|
@Autowired
|
|
|
|
|
private QcCheckTaskWarehousingMapper qcCheckTaskWarehousingMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private QcCheckTypeProjectMapper qcCheckTypeProjectMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private QcMaterialGroupDetailMapper qcMaterialGroupDetailMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private QcCheckTaskDetailMapper qcCheckTaskDetailMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询成品入库检验任务
|
|
|
|
|
*
|
|
|
|
@ -42,6 +65,7 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List<QcCheckTaskWarehousing> selectQcCheckTaskWarehousingList(QcCheckTaskWarehousing qcCheckTaskWarehousing) {
|
|
|
|
|
qcCheckTaskWarehousing.setDelFlag("0");
|
|
|
|
|
return qcCheckTaskWarehousingMapper.selectQcCheckTaskWarehousingList(qcCheckTaskWarehousing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -54,8 +78,57 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public int insertQcCheckTaskWarehousing(QcCheckTaskWarehousing qcCheckTaskWarehousing) {
|
|
|
|
|
qcCheckTaskWarehousing.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
return qcCheckTaskWarehousingMapper.insertQcCheckTaskWarehousing(qcCheckTaskWarehousing);
|
|
|
|
|
|
|
|
|
|
String bpDD = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate());
|
|
|
|
|
int liushuiNum = qcCheckTaskWarehousingMapper.getTodayMaxNum(qcCheckTaskWarehousing);
|
|
|
|
|
String liushuiStr = String.format("%04d", liushuiNum);
|
|
|
|
|
|
|
|
|
|
String createBy = SecurityUtils.getUsername();
|
|
|
|
|
Date nowDate= DateUtils.getNowDate();
|
|
|
|
|
//获取当前所选工厂
|
|
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
|
|
String key = "#header.poolName";
|
|
|
|
|
String factoryCode = request.getHeader(key.substring(8)).replace("ds_","");
|
|
|
|
|
|
|
|
|
|
qcCheckTaskWarehousing.setCheckNo(bpDD+liushuiStr);
|
|
|
|
|
|
|
|
|
|
/**qc_check_task_warehousing**/
|
|
|
|
|
String beLongId = IdUtils.fastSimpleUUID();
|
|
|
|
|
qcCheckTaskWarehousing.setRecordId(beLongId);
|
|
|
|
|
qcCheckTaskWarehousing.setFactoryCode(factoryCode);
|
|
|
|
|
qcCheckTaskWarehousing.setCreateTime(nowDate);
|
|
|
|
|
qcCheckTaskWarehousingMapper.insertQcCheckTaskWarehousing(qcCheckTaskWarehousing);
|
|
|
|
|
|
|
|
|
|
/**取检测项**/
|
|
|
|
|
QcCheckTypeProject qctp= new QcCheckTypeProject();
|
|
|
|
|
qctp.setTypeId(qcCheckTaskWarehousing.getCheckType());//生产过程检验
|
|
|
|
|
qctp.setMaterialCode(qcCheckTaskWarehousing.getMaterialCode());//特性
|
|
|
|
|
/**qc_check_type_project**/
|
|
|
|
|
List<QcCheckTaskDetail> items = qcCheckTypeProjectMapper.getTPByTypeMaterial(qctp);
|
|
|
|
|
if(CollectionUtils.isEmpty(items)){
|
|
|
|
|
/**qc_material_group_detail**/
|
|
|
|
|
QcMaterialGroupDetail group = qcMaterialGroupDetailMapper.getGroupByMaterial(qcCheckTaskWarehousing.getMaterialCode());
|
|
|
|
|
if(group == null){
|
|
|
|
|
return 0;//没有找到检测项目
|
|
|
|
|
}
|
|
|
|
|
qctp.setGroupId(group.getGroupId());//共性
|
|
|
|
|
items = qcCheckTypeProjectMapper.getTPByTypeGroup(qctp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**qc_check_task_detail**/
|
|
|
|
|
if(CollectionUtils.isEmpty(items)){
|
|
|
|
|
return 0;//没有找到检测项目
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(QcCheckTaskDetail item:items){
|
|
|
|
|
item.setRecordId(IdUtils.fastSimpleUUID());
|
|
|
|
|
item.setBelongTo(beLongId);
|
|
|
|
|
item.setCreateTime(nowDate);
|
|
|
|
|
item.setCreateBy(createBy);
|
|
|
|
|
item.setFactoryCode(factoryCode);
|
|
|
|
|
item.setStatus("Y");
|
|
|
|
|
}
|
|
|
|
|
return qcCheckTaskDetailMapper.addBatch(items);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -94,4 +167,12 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin
|
|
|
|
|
public int deleteQcCheckTaskWarehousingByRecordId(String recordId) {
|
|
|
|
|
return qcCheckTaskWarehousingMapper.deleteQcCheckTaskWarehousingByRecordId(recordId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List<QcCheckTaskWarehousing> getQcListLoc(QcCheckTaskWarehousing qcCheckTaskWarehousing) {
|
|
|
|
|
return qcCheckTaskWarehousingMapper.getQcListLoc(qcCheckTaskWarehousing);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|