|
|
@ -3,10 +3,16 @@ package com.hw.qms.service.impl;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.hw.common.core.constant.MesConstants;
|
|
|
|
import com.hw.common.core.constant.QmsConstants;
|
|
|
|
import com.hw.common.core.constant.QmsConstants;
|
|
|
|
|
|
|
|
import com.hw.common.core.constant.SecurityConstants;
|
|
|
|
import com.hw.common.core.constant.WmsConstants;
|
|
|
|
import com.hw.common.core.constant.WmsConstants;
|
|
|
|
|
|
|
|
import com.hw.common.core.domain.R;
|
|
|
|
|
|
|
|
import com.hw.common.core.exception.ServiceException;
|
|
|
|
import com.hw.common.core.utils.DateUtils;
|
|
|
|
import com.hw.common.core.utils.DateUtils;
|
|
|
|
import com.hw.common.security.utils.SecurityUtils;
|
|
|
|
import com.hw.common.security.utils.SecurityUtils;
|
|
|
|
|
|
|
|
import com.hw.mes.api.RemoteMesService;
|
|
|
|
|
|
|
|
import com.hw.mes.api.domain.MesSaleOrderRelate;
|
|
|
|
import com.hw.qms.domain.*;
|
|
|
|
import com.hw.qms.domain.*;
|
|
|
|
import com.hw.qms.domain.vo.QmsMaterialCheckVo;
|
|
|
|
import com.hw.qms.domain.vo.QmsMaterialCheckVo;
|
|
|
|
import com.hw.qms.mapper.*;
|
|
|
|
import com.hw.qms.mapper.*;
|
|
|
@ -19,6 +25,8 @@ import com.hw.common.core.utils.StringUtils;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import com.hw.qms.service.IQmsCheckRuleService;
|
|
|
|
import com.hw.qms.service.IQmsCheckRuleService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 检验规则维护Service业务层处理
|
|
|
|
* 检验规则维护Service业务层处理
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -33,6 +41,12 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private QmsCheckResultDetailMapper qmsCheckResultDetailMapper;
|
|
|
|
private QmsCheckResultDetailMapper qmsCheckResultDetailMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private RemoteMesService remoteMesService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询检验规则维护
|
|
|
|
* 查询检验规则维护
|
|
|
@ -127,20 +141,16 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param qmsCheckRule 检验规则维护对象
|
|
|
|
* @param qmsCheckRule 检验规则维护对象
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void insertQmsCheckRuleProject(QmsCheckRule qmsCheckRule)
|
|
|
|
public void insertQmsCheckRuleProject(QmsCheckRule qmsCheckRule) {
|
|
|
|
{
|
|
|
|
|
|
|
|
List<QmsCheckRuleProject> qmsCheckRuleProjectList = qmsCheckRule.getQmsCheckRuleProjectList();
|
|
|
|
List<QmsCheckRuleProject> qmsCheckRuleProjectList = qmsCheckRule.getQmsCheckRuleProjectList();
|
|
|
|
Long checkRuleId = qmsCheckRule.getCheckRuleId();
|
|
|
|
Long checkRuleId = qmsCheckRule.getCheckRuleId();
|
|
|
|
if (StringUtils.isNotNull(qmsCheckRuleProjectList))
|
|
|
|
if (StringUtils.isNotNull(qmsCheckRuleProjectList)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
List<QmsCheckRuleProject> list = new ArrayList<QmsCheckRuleProject>();
|
|
|
|
List<QmsCheckRuleProject> list = new ArrayList<QmsCheckRuleProject>();
|
|
|
|
for (QmsCheckRuleProject qmsCheckRuleProject : qmsCheckRuleProjectList)
|
|
|
|
for (QmsCheckRuleProject qmsCheckRuleProject : qmsCheckRuleProjectList) {
|
|
|
|
{
|
|
|
|
|
|
|
|
qmsCheckRuleProject.setCheckRuleId(checkRuleId);
|
|
|
|
qmsCheckRuleProject.setCheckRuleId(checkRuleId);
|
|
|
|
list.add(qmsCheckRuleProject);
|
|
|
|
list.add(qmsCheckRuleProject);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (list.size() > 0)
|
|
|
|
if (list.size() > 0) {
|
|
|
|
{
|
|
|
|
|
|
|
|
qmsCheckRuleMapper.batchQmsCheckRuleProject(list);
|
|
|
|
qmsCheckRuleMapper.batchQmsCheckRuleProject(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -149,6 +159,7 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 批量插入检验规则明细
|
|
|
|
* 批量插入检验规则明细
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param checkRuleDetailList
|
|
|
|
* @param checkRuleDetailList
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -159,6 +170,7 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 批量插入检验规则项目
|
|
|
|
* 批量插入检验规则项目
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param checkRuleProjectList
|
|
|
|
* @param checkRuleProjectList
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -179,4 +191,59 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 查询检验规则维护,连接check_rule_project
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param baseBarcodeInfo 物料条码
|
|
|
|
|
|
|
|
* @return 检验规则维护
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public QmsCheckRule selectQmsCheckRuleByBarcode(MesBaseBarcodeInfo baseBarcodeInfo) {
|
|
|
|
|
|
|
|
Long materialId = 0L;
|
|
|
|
|
|
|
|
if (baseBarcodeInfo.getSingleFlag().equals(MesConstants.MES_BARCODE_SINGLE_FLAG_MERGE)) {//如果是合并的物料
|
|
|
|
|
|
|
|
if (baseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_RAW)) {
|
|
|
|
|
|
|
|
R<List<MesSaleOrderRelate>> materialSaleOrderRelateListData = remoteMesService.getRelateMaterialsBySaleOrderId(baseBarcodeInfo.getSaleOrderId(), SecurityConstants.INNER);
|
|
|
|
|
|
|
|
if (materialSaleOrderRelateListData == null) {
|
|
|
|
|
|
|
|
throw new ServiceException("未找到拆分物料信息");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<MesSaleOrderRelate> materialSaleOrderRelateList = materialSaleOrderRelateListData.getData();
|
|
|
|
|
|
|
|
if (materialSaleOrderRelateList == null || materialSaleOrderRelateList.isEmpty()) {
|
|
|
|
|
|
|
|
throw new ServiceException("未找到拆分物料信息!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
MesSaleOrderRelate materialSaleOrderRelate = materialSaleOrderRelateList.get(0);
|
|
|
|
|
|
|
|
materialId = materialSaleOrderRelate.getMaterialId();
|
|
|
|
|
|
|
|
} else if (baseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_PRODUCT)) {
|
|
|
|
|
|
|
|
R<List<MesSaleOrderRelate>> productSaleOrderRelateListData = remoteMesService.getRelateProductsBySaleOrderId(baseBarcodeInfo.getSaleOrderId(), SecurityConstants.INNER);
|
|
|
|
|
|
|
|
if (productSaleOrderRelateListData == null) {
|
|
|
|
|
|
|
|
throw new ServiceException("未找到拆分成品信息");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<MesSaleOrderRelate> productSaleOrderRelateList = productSaleOrderRelateListData.getData();
|
|
|
|
|
|
|
|
if (productSaleOrderRelateList == null || productSaleOrderRelateList.isEmpty()) {
|
|
|
|
|
|
|
|
throw new ServiceException("未找到拆分成品信息");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesSaleOrderRelate productSaleOrderRelate = productSaleOrderRelateList.get(0);
|
|
|
|
|
|
|
|
materialId = productSaleOrderRelate.getProductId();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
materialId = baseBarcodeInfo.getMaterialId();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QmsCheckRuleDetail queryCheckRuleDetail = new QmsCheckRuleDetail();
|
|
|
|
|
|
|
|
queryCheckRuleDetail.setTargetId(materialId);
|
|
|
|
|
|
|
|
queryCheckRuleDetail.setTargetType(QmsConstants.QMS_CHECK_RULE_DETAIL_TARGET_TYPE_MATERIAL);
|
|
|
|
|
|
|
|
QmsCheckRule qmsCheckRule = qmsCheckRuleMapper.selectQmsCheckRuleByTarget(queryCheckRuleDetail);
|
|
|
|
|
|
|
|
if (qmsCheckRule == null) {
|
|
|
|
|
|
|
|
throw new ServiceException("无此物料的质检规则");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
qmsCheckRule.setMaterialId(materialId);
|
|
|
|
|
|
|
|
qmsCheckRule.setMaterialCode(baseBarcodeInfo.getMaterialCode());
|
|
|
|
|
|
|
|
qmsCheckRule.setMaterialName(baseBarcodeInfo.getMaterialName());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return qmsCheckRule;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|