Merge remote-tracking branch 'origin/master'

master
Yangwl 7 months ago
commit 6e30ae994e

@ -97,7 +97,15 @@ public class MesDailyReportVo extends BaseEntity {
private String machineCode; private String machineCode;
@Excel(name = "工厂编码") @Excel(name = "工厂编码")
private String factoryCode; private String factoryCode;
private BigDecimal reportRate;
public BigDecimal getReportRate() {
return reportRate;
}
public void setReportRate(BigDecimal reportRate) {
this.reportRate = reportRate;
}
public String getProductDateStart() { public String getProductDateStart() {
return productDateStart; return productDateStart;

@ -9,6 +9,7 @@ import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.csp.sentinel.util.StringUtil;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
@ -424,9 +425,9 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
quantityDto.setWorkorderCode(workorderCode); quantityDto.setWorkorderCode(workorderCode);
quantityDto.setMachineCode(machineCode); quantityDto.setMachineCode(machineCode);
QuantityDto realQuantity = mesReportWorkMapper.getRealQuantity(quantityDto); QuantityDto parentMesReport = mesReportWorkMapper.getRealQuantity(quantityDto);
List<QuantityDto> sumQuantityList = mesReportWorkMapper.getSumQuantity(quantityDto); List<QuantityDto> sonMesReportList = mesReportWorkMapper.getSumQuantity(quantityDto);
QuantityDto sumQuantity = sumQuantityList.stream().max(Comparator.comparingLong(QuantityDto::getUseMan)).orElse(null); QuantityDto sonMesReport = sonMesReportList.stream().max(Comparator.comparingLong(QuantityDto::getUseMan)).orElse(null);
// 产量 // 产量
Long sumQua = 0L; Long sumQua = 0L;
@ -436,27 +437,29 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
BigDecimal workTime = BigDecimal.ZERO; BigDecimal workTime = BigDecimal.ZERO;
// 实际用人 // 实际用人
Long useMan = 0L; Long useMan = 0L;
if (realQuantity != null && sumQuantity != null) { if (sonMesReport != null && sonMesReport != null) {
sumQua = sumQuantity.getQuantityFeedbackSum(); sumQua = sonMesReport.getQuantityFeedbackSum();
realQua = realQuantity.getQuantityFeedbackSum(); realQua = parentMesReport.getQuantityFeedbackSum();
workTime = sumQuantity.getWorkTime(); workTime = sonMesReport.getWorkTime();
useMan = sumQuantity.getUseMan(); useMan = sonMesReport.getUseMan();
dto.setQuantityAct(String.valueOf(sumQua)); dto.setQuantityAct(String.valueOf(sumQua));
dto.setQuantityFeedback(String.valueOf(realQua)); dto.setQuantityFeedback(String.valueOf(realQua));
dto.setWorkTime(workTime); dto.setWorkTime(workTime);
dto.setManStandard(useMan.toString()); //实际用人
dto.setUseMan(useMan);
// 计算规格 // 计算规格
dto.setSpec(sumQua / realQua); //dto.setSpec(sumQua / realQua);
// 订单完成率 实际产量/计划产量 // 订单完成率 实际产量/计划产量
BigDecimal completeRate = new BigDecimal(realQua) BigDecimal completeRate = new BigDecimal(realQua)
.multiply(new BigDecimal("100.00")) .multiply(new BigDecimal("100.00"))
.divide(new BigDecimal(dto.getQuantitySplit()),2,BigDecimal.ROUND_HALF_UP); .divide(new BigDecimal(dto.getQuantitySplit()),2,BigDecimal.ROUND_HALF_UP);
dto.setCompleteRate(completeRate.toString()+"%"); dto.setCompleteRate(completeRate.toString()+"%");
// 标准工时 产量/产线标准效率 //标准工时=母单数量*规格/产线标准效率
BigDecimal workTimeStandard = new BigDecimal(sumQua) BigDecimal workTimeStandard = new BigDecimal(realQua)
.divide(dto.getEfficiency(),1,BigDecimal.ROUND_HALF_UP); .multiply(new BigDecimal(dto.getSpec()))
.divide(dto.getEfficiency(),2,BigDecimal.ROUND_HALF_UP);
dto.setWorkTimeStandard(workTimeStandard.toString()); dto.setWorkTimeStandard(workTimeStandard.toString());
// 产线效率 标准工时/实际工时 // 产线效率 标准工时/实际工时
BigDecimal productivity = workTimeStandard BigDecimal productivity = workTimeStandard
.multiply(new BigDecimal("100.00")) .multiply(new BigDecimal("100.00"))
@ -468,17 +471,17 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
dto.setTotalWorkTime(totalWorkTime.toString()); dto.setTotalWorkTime(totalWorkTime.toString());
// 标准人均效率 实际产量/标准用人/标准工时 // 标准人均效率 实际产量/标准用人/标准工时
BigDecimal manAvgStandard = new BigDecimal(realQua) BigDecimal manAvgStandard = new BigDecimal(realQua)
.divide(new BigDecimal(dto.getUseMan()),2,BigDecimal.ROUND_HALF_UP) .divide(new BigDecimal(dto.getManStandard()),4,BigDecimal.ROUND_HALF_UP)
.divide(workTimeStandard,2,BigDecimal.ROUND_HALF_UP); .divide(workTimeStandard,2,BigDecimal.ROUND_HALF_UP);
dto.setManAvgStandard(manAvgStandard.toString()); dto.setManAvgStandard(manAvgStandard.toString());
// 实际人均效率 实际产量/总工时 // 实际人均效率 实际产量/总工时
BigDecimal manAvgActual = new BigDecimal(realQua) BigDecimal manAvgActual = new BigDecimal(realQua)
.divide(totalWorkTime,2,BigDecimal.ROUND_HALF_UP); .divide(totalWorkTime,2,BigDecimal.ROUND_HALF_UP);
dto.setManAvgActual(manAvgActual.toString()); dto.setManAvgActual(manAvgActual.toString());
// 人均效率达成率 标准人均效率/实际人均效率 // 人均效率达成率 实际人均效率/标准人均效率
BigDecimal manAvgDo = manAvgStandard BigDecimal manAvgDo = manAvgActual
.multiply(new BigDecimal("100.00")) .multiply(new BigDecimal("100.00"))
.divide(manAvgActual,2,BigDecimal.ROUND_HALF_UP); .divide(manAvgStandard,2,BigDecimal.ROUND_HALF_UP);
dto.setManAvgDo(manAvgDo.toString()+"%"); dto.setManAvgDo(manAvgDo.toString()+"%");
} }

@ -679,14 +679,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
pow.product_name productName, pow.product_name productName,
pow.unit unit, pow.unit unit,
pow.quantity_split quantitySplit, pow.quantity_split quantitySplit,
mlp.use_man useMan, pow.attr3 teamLeaderName,
mlp.use_man manStandard,
mlp.efficiency efficiency, mlp.efficiency efficiency,
mlp.attr1 unitWorkingHours, mlp.attr1 unitWorkingHours,
pow.workorder_code workorderCode, pow.workorder_code workorderCode,
pow.workorder_name workorderName pow.workorder_name workorderName,
bp.umrez spec,
bp.report_rate reportRate
from base_equipment be from base_equipment be
left join pro_order_workorder pow on be.equipment_code = pow.workorder_name left join pro_order_workorder pow on be.equipment_code = pow.workorder_name
left join mes_line_product mlp on pow.workorder_name = mlp.line_code and pow.product_code = mlp.product_code left join mes_line_product mlp on pow.workorder_name = mlp.line_code and pow.product_code = mlp.product_code
left join base_product bp on bp.product_code = pow.product_code
where be.del_flag = '0' and be.sap_code is not null and pow.status = 'w3' and mlp.del_flag='0' where be.del_flag = '0' and be.sap_code is not null and pow.status = 'w3' and mlp.del_flag='0'
and pow.parent_order = '0' and pow.del_flag='0' and pow.parent_order = '0' and pow.del_flag='0'
<if test="sapName != null and sapName != ''">and be.sap_name like concat('%', #{sapName}, '%')</if> <if test="sapName != null and sapName != ''">and be.sap_name like concat('%', #{sapName}, '%')</if>

@ -386,7 +386,7 @@ public class OpenServiceImpl implements OpenService {
@Override @Override
public int insertQcCheckTaskProduce(QcCheckTaskProduceDTO qcCheckTaskProduce) { public int insertQcCheckTaskProduce(QcCheckTaskProduceDTO qcCheckTaskProduce) {
DynamicDataSourceContextHolder.push("ds_" + qcCheckTaskProduce.getFactoryCode()); DynamicDataSourceContextHolder.push("ds_" + qcCheckTaskProduce.getFactoryCode());
logger.info("创建检验任务"+qcCheckTaskProduce.getCheckType()+":"+JSONObject.toJSONString(qcCheckTaskProduce));
// 1分钟不允许存在两条 // 1分钟不允许存在两条
Date lastData = openMapper.getLastTask(qcCheckTaskProduce); Date lastData = openMapper.getLastTask(qcCheckTaskProduce);
if(this.oneMinHas(lastData)){ if(this.oneMinHas(lastData)){
@ -457,14 +457,14 @@ public class OpenServiceImpl implements OpenService {
return 0;//没有找到检测项目 return 0;//没有找到检测项目
} }
/**qc_sample_rule**/ // /**qc_sample_rule**/
QcCheckTaskProduceDTO sampQua = new QcCheckTaskProduceDTO(); // QcCheckTaskProduceDTO sampQua = new QcCheckTaskProduceDTO();
sampQua.setCheckType(qcCheckTaskProduce.getCheckType()); // sampQua.setCheckType(qcCheckTaskProduce.getCheckType());
sampQua.setQuality(qcCheckTaskProduce.getQuality()); // sampQua.setQuality(qcCheckTaskProduce.getQuality());
String sampNum = openMapper.getSampNum(sampQua); // String sampNum = openMapper.getSampNum(sampQua);
if(StringUtils.isNotBlank(sampNum)){ // if(StringUtils.isNotBlank(sampNum)){
qcCheckTaskProduce.setSampleQuality(new BigDecimal(sampNum)); // qcCheckTaskProduce.setSampleQuality(new BigDecimal(sampNum));
} // }
/**qc_check_task**/ /**qc_check_task**/
qcCheckTaskProduce.setRecordId(beLongId); qcCheckTaskProduce.setRecordId(beLongId);

@ -198,6 +198,24 @@ public class QcCheckTaskIncome extends BaseEntity {
private String materialType;//来料类别 private String materialType;//来料类别
private String materialFrom;//物料来源 private String materialFrom;//物料来源
private String startOA;//发起oa 1是 0否 private String startOA;//发起oa 1是 0否
private String checkLevel;
private String checkAql;
public String getCheckLevel() {
return checkLevel;
}
public void setCheckLevel(String checkLevel) {
this.checkLevel = checkLevel;
}
public String getCheckAql() {
return checkAql;
}
public void setCheckAql(String checkAql) {
this.checkAql = checkAql;
}
public String getOrderCode() { public String getOrderCode() {
return orderCode; return orderCode;

@ -26,26 +26,21 @@ private static final long serialVersionUID=1L;
private String sampleAql; private String sampleAql;
/** 预留字段1 */ /** 预留字段1 */
@Excel(name = "预留字段1")
private String attr1; private String attr1;
/** 工厂编码 */ /** 工厂编码 */
@Excel(name = "工厂编码")
private String factoryCode; private String factoryCode;
/** 删除标识1删除0正常 */ /** 删除标识1删除0正常 */
private String delFlag; private String delFlag;
/** 最大坏量 */ /** 最大坏量 */
@Excel(name = "最大坏量")
private Long maxBadQuality; private Long maxBadQuality;
/** 小节点 */ /** 小节点 */
@Excel(name = "小节点")
private String checkType; private String checkType;
/** 大节点 */ /** 大节点 */
@Excel(name = "大节点")
private String typeCode; private String typeCode;
/** 0.010 */ /** 0.010 */

@ -189,14 +189,14 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
return 0;//没有找到检测项目 return 0;//没有找到检测项目
} }
/**qc_sample_rule**/ // /**qc_sample_rule**/
QcCheckTaskIncome sampQua = new QcCheckTaskIncome(); // QcCheckTaskIncome sampQua = new QcCheckTaskIncome();
sampQua.setCheckType(qcCheckTaskIncome.getCheckType()); // sampQua.setCheckType(qcCheckTaskIncome.getCheckType());
sampQua.setQuality(qcCheckTaskIncome.getQuality()); // sampQua.setQuality(qcCheckTaskIncome.getQuality());
String sampNum = qcSampleRuleMapper.getSampNum(sampQua); // String sampNum = qcSampleRuleMapper.getSampNum(sampQua);
if(StringUtils.isNotBlank(sampNum)){ // if(StringUtils.isNotBlank(sampNum)){
qcCheckTaskIncome.setSampleQuality(new BigDecimal(sampNum)); // qcCheckTaskIncome.setSampleQuality(new BigDecimal(sampNum));
} // }
/**qc_check_task**/ /**qc_check_task**/
String beLongId = IdUtils.fastSimpleUUID(); String beLongId = IdUtils.fastSimpleUUID();
@ -659,9 +659,12 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
result = qcCheckTaskIncome.getCheckResult(); result = qcCheckTaskIncome.getCheckResult();
} }
//抽样方案
BigDecimal sampleQua = this.getSampleQua(qcCheckTaskIncome);
int n = 0; int n = 0;
QcCheckTaskIncome qcCheckTask = new QcCheckTaskIncome(); QcCheckTaskIncome qcCheckTask = new QcCheckTaskIncome();
qcCheckTask.setSampleQuality(sampleQua);
qcCheckTask.setUpdateBy(updateBy); qcCheckTask.setUpdateBy(updateBy);
qcCheckTask.setRecordId(belongId); qcCheckTask.setRecordId(belongId);
qcCheckTask.setCheckStatus("2");//检测状态0待检测1检测中2检测完成 qcCheckTask.setCheckStatus("2");//检测状态0待检测1检测中2检测完成
@ -830,7 +833,13 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
unqualified.setUser("999999"); unqualified.setUser("999999");
qcCheckUnqualifiedService.updateQcCheckUnqualified(unqualified); qcCheckUnqualifiedService.updateQcCheckUnqualified(unqualified);
} }
//发送企业微信
this.sendWX(qcCheckTaskIncome);
}
return 1 ;
}
protected void sendWX(QcCheckTaskIncome qcCheckTaskIncome){
//发企业微信--------------------开始(跟班组有关) //发企业微信--------------------开始(跟班组有关)
SysNoticeGroup noticeQo = new SysNoticeGroup(); SysNoticeGroup noticeQo = new SysNoticeGroup();
if(qcCheckTaskIncome.getCheckType().equals("checkTypeLL")){ if(qcCheckTaskIncome.getCheckType().equals("checkTypeLL")){
@ -879,7 +888,11 @@ public class QcCheckTaskIncomeServiceImpl<QcCheckUnqualifiedService> implements
//发企业微信--------------------结束 //发企业微信--------------------结束
} }
} }
return 1 ; //抽样方案
protected BigDecimal getSampleQua(QcCheckTaskIncome qcCheckTaskIncome){
BigDecimal sampleQua = BigDecimal.ZERO;
return sampleQua;
} }
@Override @Override

@ -192,16 +192,16 @@ public class QcCheckTaskInventoryServiceImpl implements IQcCheckTaskInventorySer
} }
qcCheckTaskInventory.setNoOkQuality(noOkQuality); qcCheckTaskInventory.setNoOkQuality(noOkQuality);
/**qc_sample_rule**/ // /**qc_sample_rule**/
if(qcCheckTaskInventory.getNoOkQuality()==null) { // if(qcCheckTaskInventory.getNoOkQuality()==null) {
QcCheckTaskIncome sampQua = new QcCheckTaskIncome(); // QcCheckTaskIncome sampQua = new QcCheckTaskIncome();
sampQua.setCheckType(qcCheckTaskInventory.getCheckType()); // sampQua.setCheckType(qcCheckTaskInventory.getCheckType());
sampQua.setQuality(qcCheckTaskInventory.getQuality()); // sampQua.setQuality(qcCheckTaskInventory.getQuality());
String sampNum = qcSampleRuleMapper.getSampNum(sampQua); // String sampNum = qcSampleRuleMapper.getSampNum(sampQua);
if (StringUtils.isNotBlank(sampNum)) { // if (StringUtils.isNotBlank(sampNum)) {
qcCheckTaskInventory.setSampleQuality(new BigDecimal(sampNum)); // qcCheckTaskInventory.setSampleQuality(new BigDecimal(sampNum));
} // }
} // }
/**qc_check_task**/ /**qc_check_task**/
qcCheckTaskInventoryMapper.insertQcCheckTaskInventory(qcCheckTaskInventory); qcCheckTaskInventoryMapper.insertQcCheckTaskInventory(qcCheckTaskInventory);

@ -188,14 +188,14 @@ public class QcCheckTaskMarketServiceImpl implements IQcCheckTaskMarketService {
qcCheckTaskMarket.setNoOkQuality(noOkQuality); qcCheckTaskMarket.setNoOkQuality(noOkQuality);
} }
/**qc_sample_rule**/ // /**qc_sample_rule**/
QcCheckTaskIncome sampQua = new QcCheckTaskIncome(); // QcCheckTaskIncome sampQua = new QcCheckTaskIncome();
sampQua.setCheckType(qcCheckTaskMarket.getCheckType()); // sampQua.setCheckType(qcCheckTaskMarket.getCheckType());
sampQua.setQuality(qcCheckTaskMarket.getQuality()); // sampQua.setQuality(qcCheckTaskMarket.getQuality());
String sampNum = qcSampleRuleMapper.getSampNum(sampQua); // String sampNum = qcSampleRuleMapper.getSampNum(sampQua);
if(StringUtils.isNotBlank(sampNum)){ // if(StringUtils.isNotBlank(sampNum)){
qcCheckTaskMarket.setSampleQuality(new BigDecimal(sampNum)); // qcCheckTaskMarket.setSampleQuality(new BigDecimal(sampNum));
} // }
/**qc_check_task**/ /**qc_check_task**/
qcCheckTaskMarketMapper.insertQcCheckTaskMarket(qcCheckTaskMarket); qcCheckTaskMarketMapper.insertQcCheckTaskMarket(qcCheckTaskMarket);

@ -250,14 +250,14 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService
} }
qcCheckTaskProduce.setNoOkQuality(noOkQuality); qcCheckTaskProduce.setNoOkQuality(noOkQuality);
/**qc_sample_rule**/ // /**qc_sample_rule**/
QcCheckTaskIncome sampQua = new QcCheckTaskIncome(); // QcCheckTaskIncome sampQua = new QcCheckTaskIncome();
sampQua.setCheckType(qcCheckTaskProduce.getCheckType()); // sampQua.setCheckType(qcCheckTaskProduce.getCheckType());
sampQua.setQuality(qcCheckTaskProduce.getQuality()); // sampQua.setQuality(qcCheckTaskProduce.getQuality());
String sampNum = qcSampleRuleMapper.getSampNum(sampQua); // String sampNum = qcSampleRuleMapper.getSampNum(sampQua);
if(StringUtils.isNotBlank(sampNum)){ // if(StringUtils.isNotBlank(sampNum)){
qcCheckTaskProduce.setSampleQuality(new BigDecimal(sampNum)); // qcCheckTaskProduce.setSampleQuality(new BigDecimal(sampNum));
} // }
/**qc_check_task**/ /**qc_check_task**/
if("LJ01".equals(qcCheckTaskProduce.getProductType())){ if("LJ01".equals(qcCheckTaskProduce.getProductType())){

@ -242,14 +242,14 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin
} }
} }
qcCheckTaskWarehousing.setNoOkQuality(noOkQuality); qcCheckTaskWarehousing.setNoOkQuality(noOkQuality);
/**qc_sample_rule**/ // /**qc_sample_rule**/
QcCheckTaskIncome sampQua = new QcCheckTaskIncome(); // QcCheckTaskIncome sampQua = new QcCheckTaskIncome();
sampQua.setCheckType(qcCheckTaskWarehousing.getCheckType()); // sampQua.setCheckType(qcCheckTaskWarehousing.getCheckType());
sampQua.setQuality(qcCheckTaskWarehousing.getQuality()); // sampQua.setQuality(qcCheckTaskWarehousing.getQuality());
String sampNum = qcSampleRuleMapper.getSampNum(sampQua); // String sampNum = qcSampleRuleMapper.getSampNum(sampQua);
if(StringUtils.isNotBlank(sampNum)){ // if(StringUtils.isNotBlank(sampNum)){
qcCheckTaskWarehousing.setSampleQuality(new BigDecimal(sampNum)); // qcCheckTaskWarehousing.setSampleQuality(new BigDecimal(sampNum));
} // }
/**qc_check_task**/ /**qc_check_task**/
qcCheckTaskWarehousing.setIncomeTime(DateUtils.getNowDate());//检验任务日期 qcCheckTaskWarehousing.setIncomeTime(DateUtils.getNowDate());//检验任务日期
int n = qcCheckTaskWarehousingMapper.insertQcCheckTaskWarehousing(qcCheckTaskWarehousing); int n = qcCheckTaskWarehousingMapper.insertQcCheckTaskWarehousing(qcCheckTaskWarehousing);

@ -44,7 +44,11 @@ public class QcSampleRuleAqlServiceImpl implements IQcSampleRuleAqlService {
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public List<QcSampleRuleAql> selectQcSampleRuleAqlList(QcSampleRuleAql qcSampleRuleAql) { public List<QcSampleRuleAql> selectQcSampleRuleAqlList(QcSampleRuleAql qcSampleRuleAql) {
return qcSampleRuleAqlMapper.selectQcSampleRuleAqlList(qcSampleRuleAql); List<QcSampleRuleAql> dtos = qcSampleRuleAqlMapper.selectQcSampleRuleAqlList(qcSampleRuleAql);
for(QcSampleRuleAql aql:dtos){
aql.setSampleAql(aql.getSampleCode().split("-")[1]);
}
return dtos;
} }
/** /**

Loading…
Cancel
Save