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;
@Excel(name = "工厂编码")
private String factoryCode;
private BigDecimal reportRate;
public BigDecimal getReportRate() {
return reportRate;
}
public void setReportRate(BigDecimal reportRate) {
this.reportRate = reportRate;
}
public String getProductDateStart() {
return productDateStart;

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

@ -679,14 +679,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
pow.product_name productName,
pow.unit unit,
pow.quantity_split quantitySplit,
mlp.use_man useMan,
pow.attr3 teamLeaderName,
mlp.use_man manStandard,
mlp.efficiency efficiency,
mlp.attr1 unitWorkingHours,
pow.workorder_code workorderCode,
pow.workorder_name workorderName
pow.workorder_name workorderName,
bp.umrez spec,
bp.report_rate reportRate
from base_equipment be
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 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'
and pow.parent_order = '0' and pow.del_flag='0'
<if test="sapName != null and sapName != ''">and be.sap_name like concat('%', #{sapName}, '%')</if>

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

@ -198,6 +198,24 @@ public class QcCheckTaskIncome extends BaseEntity {
private String materialType;//来料类别
private String materialFrom;//物料来源
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() {
return orderCode;

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

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

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

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

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

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

@ -44,7 +44,11 @@ public class QcSampleRuleAqlServiceImpl implements IQcSampleRuleAqlService {
@Override
@DS("#header.poolName")
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