Merge remote-tracking branch 'origin/master'

master
mengjiao 1 year ago
commit 969897968c

@ -124,9 +124,9 @@ public class DevicePDAController extends BaseController {
/**
*
*/
@GetMapping(value = "/queryEquipment/{equipmentId}")
public AjaxResult queryEquipment(@PathVariable("equipmentId") Long equipmentId) {
return devicePDAService.selectEquEquipmentByEquEquipmentId(equipmentId);
@GetMapping(value = "/queryEquipment/{equipmentCode}")
public AjaxResult queryEquipment(@PathVariable("equipmentCode") String equipmentCode) {
return devicePDAService.selectEquEquipmentByEquEquipmentCode(equipmentCode);
}
/**

@ -17,10 +17,10 @@ public interface EquEquipmentMapper {
/**
*
*
* @param equipmentId
* @param equipmentCode
* @return
*/
public EquEquipment selectEquEquipmentByEquEquipmentId(Long equipmentId);
public EquEquipment selectEquEquipmentByEquEquipmentCode(String equipmentCode);
/**
*

@ -86,10 +86,10 @@ public interface IDevicePDAService {
/**
*
*
* @param equipmentId
* @param equipmentCode
* @return
*/
public AjaxResult selectEquEquipmentByEquEquipmentId(Long equipmentId);
public AjaxResult selectEquEquipmentByEquEquipmentCode(String equipmentCode);
/**
*

@ -22,8 +22,13 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.*;
import static com.op.common.core.web.domain.AjaxResult.error;
@ -81,6 +86,9 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
@Autowired
private EquFaultReasonMapper equFaultReasonMapper;
@Autowired
private EquOperationMapper equOperationMapper;
/**
* list-
@ -627,14 +635,14 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
/**
*
* @param equipmentId
* @param equipmentCode
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult selectEquEquipmentByEquEquipmentId(Long equipmentId) {
public AjaxResult selectEquEquipmentByEquEquipmentCode(String equipmentCode) {
try {
EquEquipment list = equEquipmentMapper.selectEquEquipmentByEquEquipmentId(equipmentId);
EquEquipment list = equEquipmentMapper.selectEquEquipmentByEquEquipmentCode(equipmentCode);
return success(list);
} catch (Exception e) {
return error();
@ -705,7 +713,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
@DS("#header.poolName")
public AjaxResult updateMaintenanceRecords(EquRepairWorkOrder equRepairWorkOrder) {
try {
//判断是否停机
//1.判断是否停机
EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId());
if (list.getWorkDownMachine().equals("1")) {
//维修真正停机时间
@ -714,10 +722,55 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
//维修工单结束时间
equRepairWorkOrder.setWorkEndTime(DateUtils.getNowDate());
//计算维修工单用时
//获取工单的开始时间
////更新每一项点检/巡检检查项信息
//2.计算维修工单用时
if(list.getWorkStartTime()!= null && equRepairWorkOrder.getWorkEndTime()!= null){
//2.1计算日期差值
ZoneId zoneId = ZoneId.systemDefault();
LocalDateTime start = LocalDateTime.ofInstant(list.getWorkStartTime().toInstant(), zoneId);
LocalDateTime end = LocalDateTime.ofInstant(equRepairWorkOrder.getWorkEndTime().toInstant(), zoneId);
LocalDateTime tempDateTime = LocalDateTime.from(start);
// long years = tempDateTime.until(end, ChronoUnit.YEARS);
// tempDateTime = tempDateTime.plusYears(years);
// long months = tempDateTime.until(end, ChronoUnit.MONTHS);
// tempDateTime = tempDateTime.plusMonths(months);
// long days = tempDateTime.until(end, ChronoUnit.DAYS);
// tempDateTime = tempDateTime.plusDays(days);
double hours = tempDateTime.until(end, ChronoUnit.HOURS);
// tempDateTime = tempDateTime.plusHours(hours);
double minutes = ((tempDateTime.until(end, ChronoUnit.MINUTES)*1.0)%60)/60;
// tempDateTime = tempDateTime.plusMinutes(minutes);
double seconds = ((tempDateTime.until(end, ChronoUnit.SECONDS)*1.0)%3600)/3600;
double hour = BigDecimal.valueOf(hours + minutes + seconds).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
//2.2查询完好率报表
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String time = sdf.format(equRepairWorkOrder.getWorkEndTime());
EquOperation equOperation = equOperationMapper.selectEquipmentIntegrityRate(time,equRepairWorkOrder.getEquipmentCode());
//2.3修改完好率报表
if(equOperation != null){
DecimalFormat df = new DecimalFormat("#.##");
//实际运行时间 = 实际运行时间 - 故障时间
double result = Double.parseDouble(equOperation.getActualOperationTime()) - hour;
//故障时间 = 原来的故障时间 + 这次的故障时间
double faultTime = Double.parseDouble(equOperation.getFaultTime()) + hour;
equOperation.setActualOperationTime(String.valueOf(df.format(result)));//实际运行时间
equOperation.setFaultTime(String.valueOf(faultTime));//故障时间
BigDecimal faultTimeBD = new BigDecimal(faultTime);// 故障时间
BigDecimal operationTimeBD = new BigDecimal(equOperation.getOperationTime());// 运行时间
equOperation.setFailureRate(faultTimeBD.multiply(new BigDecimal(100)).divide(operationTimeBD,2, RoundingMode.HALF_UP).toString()+"%");
equOperation.setUpdateBy(SecurityUtils.getUsername());
equOperation.setUpdateTime(DateUtils.getNowDate());
equOperationMapper.updateEquOperation(equOperation);
}
}
////3.更新每一项点检/巡检检查项信息
//判空
if(StringUtils.isNotEmpty(equRepairWorkOrder.getDetailList())){
List<EquOrder> checkLists = equRepairWorkOrder.getDetailList();
@ -758,7 +811,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
}
}
////新建申领单
////4.新建申领单
//判空
if(StringUtils.isNotEmpty(equRepairWorkOrder.getApplyList())){
List<EquSpareApply> equSpareApplies = equRepairWorkOrder.getApplyList();
@ -803,7 +856,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
}
}
////增加多个维修后照片
////5.增加多个维修后照片
//先删除每个维修工单对应图片
equRepairWorkOrderMapper.deleteBaseFileBySourceId(equRepairWorkOrder.getWorkId());
if (StringUtils.isNotEmpty(equRepairWorkOrder.getFileList())) {
@ -825,7 +878,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
equRepairWorkOrderMapper.insertBaseFileBatch(files);
}
////更新维修工单
////6.更新维修工单
//维修状态
equRepairWorkOrder.setWorkStatus("1");
//维修人
@ -843,7 +896,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
// BigDecimal orderCost = BigDecimal.valueOf(Double.valueOf(equRepairWorkOrder.getWorkCost()));
// equRepairWorkOrder.setWorkCost(String.valueOf(sparePartsCost.add(orderCost)));
//修改设备状态 由维修中改为正常运行
//7.修改设备状态 由维修中改为正常运行
EquEquipment equEquipment = new EquEquipment();
equEquipment.setEquipmentCode(example.getEquipmentCode());
equEquipment.setEquipmentStatus("1");

@ -92,9 +92,9 @@
</where>
</select>
<select id="selectEquEquipmentByEquEquipmentId" parameterType="Long" resultMap="EquEquipmentResult">
<select id="selectEquEquipmentByEquEquipmentCode" parameterType="String" resultMap="EquEquipmentResult">
<include refid="selectEquEquipmentVo"/>
where equipment_id = #{equipmentId}
where equipment_code = #{equipmentCode}
</select>
<insert id="insertEquEquipment" parameterType="EquEquipment">

@ -105,13 +105,17 @@
</select>
<select id="selectEquipments" resultType="com.op.device.domain.EquOperation">
select be.equipment_code AS 'equipmentCode',be.equipment_name AS 'equipmentName',zx.equipment_name AS 'groupLine',be.workshop_name AS 'workshop'
select be.equipment_code AS 'equipmentCode',
be.equipment_name AS 'equipmentName',
zx.equipment_name AS 'groupLine',
be.workshop_name AS 'workshop'
from base_equipment be
left join equ_bind_auxiliary_equipment bae
on bae.auxiliary_equipment_code = be.equipment_code
left join base_equipment zx
on bae.equipment_code = zx.equipment_code
where be.del_flag = '0' and be.equipment_category = '0'
where be.del_flag = '0'
and be.equipment_category = '0'
</select>
<select id="checkInsertOperation" resultType="java.lang.Integer">
@ -261,6 +265,7 @@
<include refid="selectEquOperationVo"/>
where CONVERT(varchar,create_time,21) like concat('%',#{time}, '%')
and equipment_code = #{equipmentCode}
and del_flag = '0'
</select>
</mapper>

@ -189,11 +189,53 @@
</select>
<select id="selectTaskRecord" parameterType="String" resultMap="EquOrderResult">
<include refid="selectEquOrderVo"/>
where del_flag = '0' and order_status = '1' and plan_type = #{planType} and plan_person = #{userId} and order_code in (
select order_code from equ_order_person where del_flag = '0' and user_name = #{userId} GROUP BY order_code
)
order by update_time desc
select eo.order_id,
eo.plan_id,
eo.plan_code,
eo.plan_type,
eo.order_code,
eo.plan_workshop,
eo.plan_prod_line,
eo.plan_loop,
eo.plan_loop_type,
eo.plan_loop_start,
eo.plan_loop_end,
eo.order_start,
eo.order_end,
eo.equipment_code,
eo.order_status,
eo.order_cost,
eo.plan_person,
eo.order_cost_time,
eo.order_sign_person,
eo.factory_code,
eo.attr1,
eo.attr2,
eo.attr3,
eo.del_flag,
eo.create_by,
eo.create_time,
eo.update_by,
eo.update_time,
eo.upkeep,
eo.calculation_rule,
eo.shut_down,
eo.order_inspect,
eo.repair_code,
eo.work_code,
eo.outsource_code,
be.equipment_name
from equ_order eo
left join base_equipment be on eo.equipment_code = be.equipment_code
where eo.del_flag = '0'
and eo.order_status = '1'
and eo.plan_type = #{planType}
and eo.plan_person = #{userId}
and eo.order_code in (select order_code
from equ_order_person
where del_flag = '0' and user_name = #{userId}
GROUP BY order_code)
order by eo.update_time desc
</select>
<select id="selectEquipmentNameByEquCode" resultType="java.lang.String">

@ -11,6 +11,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.utils.DateUtils;
import com.op.quality.domain.QcCheckType;
import com.op.system.api.domain.quality.ChartDTO;
import com.op.system.api.domain.quality.ChartSeriesDTO;
import com.op.system.api.domain.quality.FactoryDto;
@ -228,6 +229,10 @@ public class QcStaticTableController extends BaseController {
return qcStaticTableService.getWorkcenterList(factoryDto);
}
@GetMapping("/getCheckTypeList/{typeCode}")
public List<QcCheckType> getCheckTypeList(@PathVariable("typeCode") String typeCode) {
return qcStaticTableService.getCheckTypeList(typeCode);
}
/**
*
*/
@ -266,4 +271,23 @@ public class QcStaticTableController extends BaseController {
ChartSeriesDTO dto = qcStaticTableService.getXJChartData(qcStaticTable);
return dto;
}
/**质检不良率统计**/
@RequiresPermissions("quality:qcProduceAnalysis:list")
@GetMapping("/getQmsRateTable")
public TableDataInfo getQmsRateTable(QcStaticTable qcStaticTable) {
//默认时间范围T 00:00:00~T+1 00:00:00
if(StringUtils.isEmpty(qcStaticTable.getYmArrayStart())){
LocalDate date = LocalDate.now();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String ymStr = dtf.format(date);
qcStaticTable.setYmArrayStart(ymStr);
qcStaticTable.setYmArrayEnd(ymStr);
}
startPage();
List<QcStaticTable> list = qcStaticTableService.getQmsRateTable(qcStaticTable);
return getDataTable(list);
}
}

@ -86,6 +86,15 @@ public class QcStaticTable extends BaseEntity {
private String column200210;
private String startDateStr;
private String endDateStr;
private String checkType;
public String getCheckType() {
return checkType;
}
public void setCheckType(String checkType) {
this.checkType = checkType;
}
public String getStartDateStr() {
return startDateStr;

@ -3,6 +3,7 @@ package com.op.quality.mapper;
import java.util.List;
import java.util.Map;
import com.op.quality.domain.QcCheckType;
import com.op.quality.domain.QcStaticTable;
import com.op.system.api.domain.quality.FactoryDto;
import org.apache.ibatis.annotations.MapKey;
@ -51,4 +52,8 @@ public interface QcStaticTableMapper {
List<QcStaticTable> getLegendData(QcStaticTable qcStaticTable);
@MapKey("ymdms")
Map<String, QcStaticTable> getXJMapData(QcStaticTable qcStaticTable);
List<QcStaticTable> getQmsRateTable(QcStaticTable qcStaticTable);
List<QcCheckType> getCheckTypeList(String typeCode);
}

@ -3,6 +3,7 @@ package com.op.quality.service;
import java.util.List;
import java.util.Map;
import com.op.quality.domain.QcCheckType;
import com.op.quality.domain.QcStaticTable;
import com.op.system.api.domain.quality.ChartSeriesDTO;
import com.op.system.api.domain.quality.FactoryDto;
@ -36,4 +37,8 @@ public interface IQcStaticTableService {
List<QcStaticTable> getXJCheckTableDetail(QcStaticTable qcStaticTable);
ChartSeriesDTO getXJChartData(QcStaticTable qcStaticTable);
List<QcStaticTable> getQmsRateTable(QcStaticTable qcStaticTable);
List<QcCheckType> getCheckTypeList(String typeCode);
}

@ -4,15 +4,11 @@ import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.quality.domain.QcCheckTaskIncome;
import com.op.quality.domain.QcCheckType;
import com.op.system.api.domain.quality.ChartDTO;
import com.op.system.api.domain.quality.ChartSeriesDTO;
import com.op.system.api.domain.quality.FactoryDto;
@ -319,6 +315,45 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
return seriesDTO;
}
@Override
@DS("#header.poolName")
public List<QcStaticTable> getQmsRateTable(QcStaticTable qcStaticTable) {
List<QcStaticTable> dtos = qcStaticTableMapper.getQmsRateTable(qcStaticTable);
for(QcStaticTable dto:dtos){
if(StringUtils.isEmpty(dto.getOrderNo())){
dto.setOrderNo("-");
}
if(StringUtils.isEmpty(dto.getIncomeBatchNo())){
dto.setIncomeBatchNo("-");
}
if(StringUtils.isEmpty(dto.getMaterialCode())){
dto.setMaterialCode("-");
}
if(StringUtils.isEmpty(dto.getMaterialCode())){
dto.setMaterialCode("-");
}
if(StringUtils.isEmpty(dto.getMaterialName())){
dto.setMaterialName("-");
}
if(StringUtils.isNotBlank(dto.getSampleQuality())&&!"0.00".equals(dto.getSampleQuality())){
BigDecimal noOkRate = new BigDecimal(dto.getNoOkNums())
.multiply(new BigDecimal(100))
.divide(new BigDecimal(dto.getSampleQuality()),2,BigDecimal.ROUND_HALF_UP);
dto.setNoOkNumRate(noOkRate.toString()+"%");
}else{
dto.setNoOkNumRate("-");
}
}
return dtos;
}
@Override
@DS("#header.poolName")
public List<QcCheckType> getCheckTypeList(String typeCode) {
return qcStaticTableMapper.getCheckTypeList(typeCode);
}
private List<String> getHourProductionTitle(QcStaticTable qcStaticTable) {
// 返回的日期集合
@ -349,4 +384,6 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
return dayHours;
}
}

@ -182,4 +182,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialCode != null "> and qct.material_code like concat('%',#{materialCode},'%')</if>
group by qct.supplier_code,qct.supplier_name,CONVERT(VARCHAR(2), qct.check_time, 108)
</select>
<select id="getQmsRateTable" resultType="com.op.quality.domain.QcStaticTable">
select qct.supplier_code supplierCode,
qct.supplier_name supplierName,
<if test="orderNo != null ">qct.order_no orderNo, qct.unit,</if>
<if test="incomeBatchNo != null ">qct.income_batch_no,</if>
<if test="materialCode != null ">qct.material_code,qct.material_name,</if>
sum(quality) quality,
sum(qct.sample_quality) sampleQuality,
sum(qct.noOk_quality) noOkNums
from qc_check_task qct
where qct.del_flag = '0'
<if test="orderNo != null ">and qct.order_no = #{orderNo}</if>
<if test="incomeBatchNo != null ">and qct.income_batch_no like concat('%',#{incomeBatchNo},'%')</if>
<if test="materialCode != null ">and qct.material_code like concat('%',#{materialCode},'%')</if>
<if test="supplierCode != null ">and qct.supplier_code = #{supplierCode}</if>
<if test="typeCode != null ">and qct.type_code = #{typeCode}</if>
<if test="checkType != null ">and qct.check_type = #{checkType}</if>
<if test="ymArrayStart != null "> and CONVERT(varchar(10),qct.income_time, 120) >= CONVERT(varchar(10),#{ymArrayStart}, 120)</if>
<if test="ymArrayEnd != null "> and CONVERT(varchar(10),#{ymArrayEnd}, 120)>=CONVERT(varchar(10),qct.income_time, 120)</if>
group by qct.supplier_code,qct.supplier_name
<if test="orderNo != null ">,qct.order_no,qct.unit</if>
<if test="incomeBatchNo != null ">,qct.income_batch_no</if>
<if test="materialCode != null ">,qct.material_code,qct.material_name</if>
</select>
<select id="getCheckTypeList" resultType="com.op.quality.domain.QcCheckType">
select order_code checkType,
check_name checkName
from qc_check_type
where del_flag = '0' and type_code= #{typeCode}
</select>
</mapper>

Loading…
Cancel
Save