PDA接口:
原材料质检:根据条码类型,如果是合并条码类型需要找到任意一个物料的质检规则
master
xs 2 weeks ago
parent b29811e7da
commit 02a6be177d

@ -77,6 +77,10 @@
<groupId>com.hw</groupId>
<artifactId>hw-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.hw</groupId>
<artifactId>hw-api-mes</artifactId>
</dependency>
</dependencies>

@ -72,25 +72,16 @@ public class QmsMobileController extends BaseController {
//扫描物料条码进入获取
String materialBarcode = qmsMaterialCheckVo.getMaterialBarcode();
QmsCheckResultDetail qmsCheckResultDetail = qmsCheckResultDetailService.getCheckResultDetail(materialBarcode);
if (qmsCheckResultDetail != null) {//如果有质检结果,则返回已经保存的质检结果,否则返回需要质检的项目
return success(qmsCheckResultDetail);
} else {
MesBaseBarcodeInfo baseBarcodeInfo = mesBaseBarcodeInfoService.selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode);
if (baseBarcodeInfo == null) {
throw new ServiceException("物料条码有误");
}
Long materialId = baseBarcodeInfo.getMaterialId();
QmsCheckRuleDetail queryCheckRuleDetail = new QmsCheckRuleDetail();
queryCheckRuleDetail.setTargetId(materialId);
queryCheckRuleDetail.setTargetType(QmsConstants.QMS_CHECK_RULE_DETAIL_TARGET_TYPE_MATERIAL);
QmsCheckRule qmsCheckRule = qmsCheckRuleService.selectQmsCheckRuleByTarget(queryCheckRuleDetail);
if (qmsCheckRule == null) {
throw new ServiceException("无此物料的质检规则");
}
qmsCheckRule.setMaterialId(materialId);
qmsCheckRule.setMaterialCode(baseBarcodeInfo.getMaterialCode());
qmsCheckRule.setMaterialName(baseBarcodeInfo.getMaterialName());
QmsCheckResultDetail qmsCheckResultDetail = qmsCheckResultDetailService.getCheckResultDetail(materialBarcode);
if (qmsCheckResultDetail != null) {//如果有质检结果,则返回已经保存的质检结果,否则返回需要质检的项目
return success(qmsCheckResultDetail);
} else {
QmsCheckRule qmsCheckRule = qmsCheckRuleService.selectQmsCheckRuleByBarcode(baseBarcodeInfo);
Long checkResultId = qmsCheckResultService.insertCheckResult(baseBarcodeInfo, qmsCheckRule);
qmsCheckRule.setCheckResultId(checkResultId);
return success(qmsCheckRule);

@ -95,7 +95,7 @@ public class MesBaseBarcodeInfo extends BaseEntity
private String planDetailCode;
/** 销售订单ID;适合生产出入库等 */
private String saleOrderId;
private Long saleOrderId;
/** 销售订单编号;适合生产出入库等 */
@Excel(name = "销售订单编号;适合生产出入库等")
@ -126,6 +126,9 @@ public class MesBaseBarcodeInfo extends BaseEntity
private String materialName;
private String singleFlag;
public void setBarcodeId(Long barcodeId)
{
this.barcodeId = barcodeId;
@ -289,11 +292,11 @@ public class MesBaseBarcodeInfo extends BaseEntity
return planDetailCode;
}
public String getSaleOrderId() {
public Long getSaleOrderId() {
return saleOrderId;
}
public void setSaleOrderId(String saleOrderId) {
public void setSaleOrderId(Long saleOrderId) {
this.saleOrderId = saleOrderId;
}
@ -368,6 +371,14 @@ public class MesBaseBarcodeInfo extends BaseEntity
this.materialName = materialName;
}
public String getSingleFlag() {
return singleFlag;
}
public void setSingleFlag(String singleFlag) {
this.singleFlag = singleFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -1,6 +1,8 @@
package com.hw.qms.service;
import java.util.List;
import com.hw.qms.domain.MesBaseBarcodeInfo;
import com.hw.qms.domain.QmsCheckRule;
import com.hw.qms.domain.QmsCheckRuleDetail;
import com.hw.qms.domain.QmsCheckRuleProject;
@ -81,4 +83,13 @@ public interface IQmsCheckRuleService
* @return
*/
public QmsCheckRule selectQmsCheckRuleByTarget(QmsCheckRuleDetail qmsCheckRuleDetail);
/**
* check_rule_project
*
* @param baseBarcodeInfo
* @return
*/
public QmsCheckRule selectQmsCheckRuleByBarcode(MesBaseBarcodeInfo baseBarcodeInfo);
}

@ -156,7 +156,7 @@ public class QmsCheckResultServiceImpl implements IQmsCheckResultService {
qmsCheckResult.setCheckSample(qmsCheckRule.getCheckSample());
qmsCheckResult.setPlanCode(mesBaseBarcodeInfo.getPlanCode());
qmsCheckResult.setPlanDetailCode(mesBaseBarcodeInfo.getPlanDetailCode());
qmsCheckResult.setSaleOrderId(mesBaseBarcodeInfo.getSaleOrderId());
qmsCheckResult.setSaleOrderId(mesBaseBarcodeInfo.getSaleOrderId() == null ? "" : String.valueOf(mesBaseBarcodeInfo.getSaleOrderId()));
qmsCheckResult.setSaleorderCode(mesBaseBarcodeInfo.getSaleorderCode());
qmsCheckResult.setPoNo(mesBaseBarcodeInfo.getPoNo());
qmsCheckResult.setCheckStatus(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_CHECKED);

@ -3,10 +3,16 @@ package com.hw.qms.service.impl;
import java.util.Date;
import java.util.List;
import com.hw.common.core.constant.MesConstants;
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.domain.R;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
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.vo.QmsMaterialCheckVo;
import com.hw.qms.mapper.*;
@ -19,6 +25,8 @@ import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.qms.service.IQmsCheckRuleService;
import javax.annotation.Resource;
/**
* Service
*
@ -33,6 +41,12 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
@Autowired
private QmsCheckResultDetailMapper qmsCheckResultDetailMapper;
@Autowired
private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper;
@Resource
private RemoteMesService remoteMesService;
/**
*
@ -127,20 +141,16 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
*
* @param qmsCheckRule
*/
public void insertQmsCheckRuleProject(QmsCheckRule qmsCheckRule)
{
public void insertQmsCheckRuleProject(QmsCheckRule qmsCheckRule) {
List<QmsCheckRuleProject> qmsCheckRuleProjectList = qmsCheckRule.getQmsCheckRuleProjectList();
Long checkRuleId = qmsCheckRule.getCheckRuleId();
if (StringUtils.isNotNull(qmsCheckRuleProjectList))
{
if (StringUtils.isNotNull(qmsCheckRuleProjectList)) {
List<QmsCheckRuleProject> list = new ArrayList<QmsCheckRuleProject>();
for (QmsCheckRuleProject qmsCheckRuleProject : qmsCheckRuleProjectList)
{
for (QmsCheckRuleProject qmsCheckRuleProject : qmsCheckRuleProjectList) {
qmsCheckRuleProject.setCheckRuleId(checkRuleId);
list.add(qmsCheckRuleProject);
}
if (list.size() > 0)
{
if (list.size() > 0) {
qmsCheckRuleMapper.batchQmsCheckRuleProject(list);
}
}
@ -149,6 +159,7 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
/**
*
*
* @param checkRuleDetailList
*/
@Override
@ -159,6 +170,7 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
/**
*
*
* @param checkRuleProjectList
*/
@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;
}
}

@ -75,7 +75,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService
* @param qmsQualityInstance
* @return
*/
@Transactional
@Transactional(rollbackFor = Exception.class)
@Override
public int insertQmsQualityInstance(QmsQualityInstance qmsQualityInstance) {
qmsQualityInstance.setCreateTime(DateUtils.getNowDate());

@ -35,10 +35,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="singleFlag" column="single_flag" />
</resultMap>
<sql id="selectMesBaseBarcodeInfoVo">
select barcode_id, print_time, print_person, batch_flag, barcode_type, barcode_info, batch_code, pallet_info_code, material_id, manufacturer_id, amount, machine_name, po_no, production_date, accepted_date, last_outstock_date, plan_code, plan_detail_code, sale_order_id, saleorder_code, project_no, serial_number, remark, bind_status, bind_by, bind_time, update_by, update_time from mes_base_barcode_info
select barcode_id, print_time, print_person, batch_flag, barcode_type, barcode_info, batch_code, pallet_info_code, material_id, manufacturer_id, amount, machine_name, po_no, production_date, accepted_date, last_outstock_date, plan_code, plan_detail_code, sale_order_id, saleorder_code, project_no, serial_number, remark, bind_status, bind_by, bind_time, update_by, update_time,single_flag from mes_base_barcode_info
</sql>
<select id="selectMesBaseBarcodeInfoList" parameterType="MesBaseBarcodeInfo" resultMap="MesBaseBarcodeInfoResult">
@ -182,7 +183,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMesBaseBarcodeInfoByBarcodeInfo" parameterType="String" resultMap="MesBaseBarcodeInfoResult">
select mbbi.barcode_id, mbbi.batch_flag, mbbi.barcode_type, mbbi.barcode_info, mbbi.batch_code,
select mbbi.barcode_id, mbbi.batch_flag, mbbi.barcode_type, mbbi.barcode_info, mbbi.batch_code,mbbi.single_flag,
mbbi.material_id, mbbi.amount, mbbi.po_no,mbbi.plan_code, mbbi.plan_detail_code, mbbi.sale_order_id, mbbi.saleorder_code,
mbmi.material_code,mbmi.material_name
from mes_base_barcode_info mbbi left join mes_base_material_info mbmi on mbbi.material_id = mbmi.material_id

Loading…
Cancel
Save