生产日报表

master
shaoyong 8 months ago
parent 5ebb81a661
commit 959b9dbe19

@ -22,9 +22,9 @@ import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.datasource.creator.DynamicDatasourceCreator;
import com.op.mes.domain.*;
import com.op.mes.domain.dto.LineChartDto;
import com.op.mes.domain.dto.LineChartSeriesDto;
import com.op.mes.domain.dto.SysFactoryDto;
import com.op.mes.domain.vo.DynamicColumnVo;
import com.op.mes.domain.vo.MesDailyReportVo;
import com.op.system.api.domain.DataSourcePropertyDTO;
import com.op.system.api.domain.SysUser;
import com.op.system.api.domain.device.EquEquipmentDTO;
@ -228,15 +228,21 @@ public class MesReportWorkController extends BaseController {
@RequiresPermissions("mes:dailyReport:list")
@GetMapping("/getDailyReport")
public TableDataInfo getDailyReport(MesDailyReport mesDailyReport) {
if(!StringUtils.isNotBlank(mesDailyReport.getWorkCenter())){
return null;
}
startPage();
List<MesDailyReport> list = mesReportWorkService.getDailyReport(mesDailyReport);
return getDataTable(list);
}
@RequiresPermissions("mes:dailyReport:list")
@GetMapping("/getDailyReportNew")
public TableDataInfo getDailyReportNew(MesDailyReportVo mesDailyReportVo) {
startPage();
List<MesDailyReportVo> list = mesReportWorkService.getDailyReportNew(mesDailyReportVo);
return getDataTable(list);
}
@RequiresPermissions("mes:dailyReport:list")
@PostMapping("/getDailyReportExport")
public void getDailyReportExport(HttpServletResponse response,MesDailyReport mesDailyReport) {
@ -246,6 +252,18 @@ public class MesReportWorkController extends BaseController {
ExcelUtilDailyReport<MesDailyReport> util = new ExcelUtilDailyReport<MesDailyReport>(MesDailyReport.class);
util.exportExcel(response, list, ymd+"生产日报表",titleName);
}
@RequiresPermissions("mes:dailyReportNew:export")
@PostMapping("/getDailyReportNewExport")
public void getDailyReportNewExport(HttpServletResponse response,MesDailyReportVo mesDailyReportVo) {
List<MesDailyReportVo> list = mesReportWorkService.getDailyReportNew(mesDailyReportVo);
String start = mesDailyReportVo.getProductDateStart();
String end = mesDailyReportVo.getProductDateEnd();
ExcelUtil<MesDailyReportVo> util = new ExcelUtil<>(MesDailyReportVo.class);
util.exportExcel(response, list, start+"至"+end+"生产日报表");
}
@GetMapping("/getWorkcenterList")
public List<SysFactoryDto> getWorkcenterList(MesDailyReport mesDailyReport) {

@ -0,0 +1,51 @@
package com.op.mes.domain.dto;
import java.math.BigDecimal;
public class QuantityDto {
private Long quantityFeedbackSum;
private BigDecimal workTime;
private Long useMan;
private String workorderCode;
private String machineCode;
public Long getQuantityFeedbackSum() {
return quantityFeedbackSum;
}
public void setQuantityFeedbackSum(Long quantityFeedbackSum) {
this.quantityFeedbackSum = quantityFeedbackSum;
}
public BigDecimal getWorkTime() {
return workTime;
}
public void setWorkTime(BigDecimal workTime) {
this.workTime = workTime;
}
public Long getUseMan() {
return useMan;
}
public void setUseMan(Long useMan) {
this.useMan = useMan;
}
public String getWorkorderCode() {
return workorderCode;
}
public void setWorkorderCode(String workorderCode) {
this.workorderCode = workorderCode;
}
public String getMachineCode() {
return machineCode;
}
public void setMachineCode(String machineCode) {
this.machineCode = machineCode;
}
}

@ -6,7 +6,9 @@ import java.util.Map;
import com.op.mes.domain.*;
import com.op.mes.domain.dto.LineChartSeriesDto;
import com.op.mes.domain.dto.QuantityDto;
import com.op.mes.domain.dto.SysFactoryDto;
import com.op.mes.domain.vo.MesDailyReportVo;
import com.op.system.api.domain.SysUser;
import com.op.system.api.domain.device.EquEquipmentDTO;
import com.op.system.api.domain.mes.ProOrderWorkorderDTO;
@ -82,6 +84,8 @@ public interface MesReportWorkMapper {
String getTitleName(MesDailyReport mesDailyReport);
String getTitleNewName(MesDailyReportVo mesDailyReportVo);
List<SysFactoryDto> getWorkcenterList(MesDailyReport mesDailyReport);
public void updateOrderWorkStatus(MesReportWork work);
@ -170,4 +174,10 @@ public interface MesReportWorkMapper {
void updatePreReportAttr1(MesReportWork workOrder);
MesReportWork getReportWorkHzAttr1(MesReportWork mesReportWork);
List<MesDailyReportVo> getDailyReportUp(MesDailyReportVo mesDailyReportVo);
QuantityDto getRealQuantity(QuantityDto quantityDto);
List<QuantityDto> getSumQuantity(QuantityDto quantityDto);
}

@ -11,6 +11,7 @@ import com.op.mes.domain.dto.LineChartDto;
import com.op.mes.domain.dto.LineChartSeriesDto;
import com.op.mes.domain.dto.SysFactoryDto;
import com.op.mes.domain.vo.DynamicColumnVo;
import com.op.mes.domain.vo.MesDailyReportVo;
import com.op.system.api.domain.SysUser;
import com.op.system.api.domain.device.EquEquipmentDTO;
import com.op.system.api.domain.dto.MesPrepareDetailDTO;
@ -78,6 +79,7 @@ public interface IMesReportWorkService {
public List<MesDailyReport> getDailyReport(MesDailyReport mesDailyReport);
String getTitleName(MesDailyReport mesDailyReport);
String getTitleNewName(MesDailyReportVo mesDailyReportVo);
List<SysFactoryDto> getWorkcenterList(MesDailyReport mesDailyReport);
@ -131,4 +133,6 @@ public interface IMesReportWorkService {
int deleteReportNow(String reportCode);
R preReportRow(MesReportWork mesReportWork);
List<MesDailyReportVo> getDailyReportNew(MesDailyReportVo mesDailyReportVo);
}

@ -20,8 +20,10 @@ import com.op.common.security.utils.SecurityUtils;
import com.op.mes.domain.*;
import com.op.mes.domain.dto.LineChartDto;
import com.op.mes.domain.dto.LineChartSeriesDto;
import com.op.mes.domain.dto.QuantityDto;
import com.op.mes.domain.dto.SysFactoryDto;
import com.op.mes.domain.vo.DynamicColumnVo;
import com.op.mes.domain.vo.MesDailyReportVo;
import com.op.mes.service.IWCSInterfaceService;
import com.op.system.api.RemoteSapService;
import com.op.system.api.domain.SysUser;
@ -37,6 +39,10 @@ import org.springframework.stereotype.Service;
import com.op.mes.mapper.MesReportWorkMapper;
import com.op.mes.service.IMesReportWorkService;
import org.springframework.util.CollectionUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* Service
@ -399,12 +405,99 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
return dtos;
}
@Override
@DS("#header.poolName")
public List<MesDailyReportVo> getDailyReportNew(MesDailyReportVo mesDailyReportVo){
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
String factoryCode = request.getHeader(key.substring(8)).replace("ds_", "");
List<MesDailyReportVo> dtos = mesReportWorkMapper.getDailyReportUp(mesDailyReportVo);
for (MesDailyReportVo dto : dtos) {
dto.setFactoryCode(factoryCode);
QuantityDto quantityDto = new QuantityDto();
String workorderCode = dto.getWorkorderCode();
String machineCode = dto.getEquipmentCode();
quantityDto.setWorkorderCode(workorderCode);
quantityDto.setMachineCode(machineCode);
QuantityDto realQuantity = mesReportWorkMapper.getRealQuantity(quantityDto);
List<QuantityDto> sumQuantityList = mesReportWorkMapper.getSumQuantity(quantityDto);
QuantityDto sumQuantity = sumQuantityList.get(0);
// 产量
Long sumQua = 0L;
// 实际产量
Long realQua = 0L;
// 实际工时
BigDecimal workTime = BigDecimal.ZERO;
// 实际用人
Long useMan = 0L;
if (realQuantity != null && sumQuantity != null) {
sumQua = sumQuantity.getQuantityFeedbackSum();
realQua = realQuantity.getQuantityFeedbackSum();
workTime = sumQuantity.getWorkTime();
useMan = sumQuantity.getUseMan();
dto.setQuantityAct(String.valueOf(sumQua));
dto.setQuantityFeedback(String.valueOf(realQua));
dto.setWorkTime(workTime);
dto.setManStandard(useMan.toString());
// 计算规格
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);
dto.setWorkTimeStandard(workTimeStandard.toString());
// 产线效率 标准工时/实际工时
BigDecimal productivity = workTimeStandard
.multiply(new BigDecimal("100.00"))
.divide(workTime,2,BigDecimal.ROUND_HALF_UP);
dto.setProductivity(productivity.toString()+"%");
// 总工时 实际用人*实际工时
BigDecimal totalWorkTime = new BigDecimal(useMan)
.multiply(workTime);
dto.setTotalWorkTime(totalWorkTime.toString());
// 标准人均效率 实际产量/标准用人/标准工时
BigDecimal manAvgStandard = new BigDecimal(realQua)
.divide(new BigDecimal(dto.getUseMan()),2,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
.multiply(new BigDecimal("100.00"))
.divide(manAvgActual,2,BigDecimal.ROUND_HALF_UP);
dto.setManAvgDo(manAvgDo.toString()+"%");
}
}
return dtos;
}
@Override
@DS("#header.poolName")
public String getTitleName(MesDailyReport mesDailyReport) {
return mesReportWorkMapper.getTitleName(mesDailyReport);
}
@Override
@DS("#header.poolName")
public String getTitleNewName(MesDailyReportVo mesDailyReportVo) {
return mesReportWorkMapper.getTitleNewName(mesDailyReportVo);
}
@Override
@DS("#header.poolName")
public List<SysFactoryDto> getWorkcenterList(MesDailyReport mesDailyReport) {

@ -281,6 +281,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getTitleName" resultType="java.lang.String">
select factory_name from sys_factory where factory_code = #{workCenter}
</select>
<select id="getTitleNewName" resultType="java.lang.String">
select factory_name from sys_factory where factory_code = #{workCenter}
</select>
<select id="getWorkcenterList" resultType="com.op.mes.domain.dto.SysFactoryDto">
select factory_name factoryName,
factory_code factoryCode
@ -663,6 +666,56 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join base_equipment equ on equ.equipment_code = ow.workorder_name
where ow.del_flag='0' and equ.del_flag='0'
</select>
<select id="getDailyReportUp" resultType="com.op.mes.domain.vo.MesDailyReportVo">
select be.workshop_code workshopCode,
be.workshop_name workshopName,
pow.product_date productDate,
be.sap_code sapCode,
be.sap_name sapName,
be.equipment_code equipmentCode,
be.equipment_name equipmentName,
be.unit_working_hours unitWorkingHours,
pow.workorder_code_sap workorderCodeSap,
pow.product_code productCode,
pow.product_name productName,
pow.unit unit,
pow.quantity_split quantitySplit,
ml.use_man useMan,
ml.efficiency efficiency,
pow.workorder_code workorderCode,
pow.workorder_name workorderName
from base_equipment be
left join pro_order_workorder pow on be.equipment_code = pow.workorder_name
left join mes_line ml on be.equipment_code = ml.line_code
where be.del_flag = '0' and be.sap_code is not null and pow.status = 'w3'
and pow.parent_order = '0' and pow.del_flag='0' and ml.del_flag='0'
<if test="sapName != null and sapName != ''">and be.sap_name like concat('%', #{sapName}, '%')</if>
<if test="workCenter != null and workCenter != ''">and be.workshop_code = #{workCenter}</if>
<if test="equipmentTypeCode != null and equipmentTypeCode != ''">and be.equipment_type_code = #{equipmentTypeCode}</if>
<if test="productDateStart != null and productDateStart != ''">
and CONVERT(varchar(10),pow.product_date, 23) > CONVERT(varchar(10), #{productDateStart}, 23)
</if>
<if test="productDateEnd != null and productDateEnd != ''">
and CONVERT(varchar(10), #{productDateEnd}, 23) > CONVERT(varchar(10),pow.product_date, 23)
</if>
order by be.equipment_code
</select>
<select id="getRealQuantity" resultType="com.op.mes.domain.dto.QuantityDto">
select sum(quantity_feedback) quantityFeedbackSum
from mes_report_work
where workorder_code = #{workorderCode} and del_flag = '0' and machine_code = #{machineCode}
</select>
<select id="getSumQuantity" resultType="com.op.mes.domain.dto.QuantityDto">
select
sum(quantity_feedback) quantityFeedbackSum,
sum(work_time) workTime,
use_man useMan
from mes_report_work
where parent_order = #{workorderCode} and del_flag = '0' and machine_code = #{machineCode}
group by use_man
</select>
<select id="selectMesReportWorkList_S" parameterType="MesReportWork" resultMap="MesReportWorkResult">
SELECT

@ -0,0 +1,360 @@
package com.op.quality.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
/**
* qc_market_feedback
*
* @author Open Platform
* @date 2024-03-19
*/
public class QcMarketFeedback extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String recordId;
/**
*
*/
@Excel(name = "产品编码")
private String productCode;
/**
*
*/
@Excel(name = "产品名称")
private String productName;
/**
* ()
*/
@Excel(name = "市场不良类型(字典维护)")
private String marketType;
@Excel(name = "市场不良类型名称")
private String marketTypeName;
/**
*
*/
@Excel(name = "订单号")
private String orderCode;
/**
*
*/
@Excel(name = "批次号")
private String batchCode;
/**
* 线
*/
@Excel(name = "线体编码")
private String lineCode;
/**
* 线
*/
@Excel(name = "线体名称")
private String lineName;
/**
*
*/
@Excel(name = "车间编码")
private String carCode;
/**
*
*/
@Excel(name = "车间名称")
private String carName;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date productDate;
/**
*
*/
@Excel(name = "整改单编码")
private String rectificationCode;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "整改时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date rectificationTime;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String attr1;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String attr2;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String attr3;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String attr4;
/**
* $column.columnComment
*/
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String factoryCode;
/**
* $column.columnComment
*/
private String delFlag;
/**
* 1
*/
@Excel(name = "1导入0输入")
private String dataSource;
private String feedbackTimeStart;
private String feedbackTimeEnd;
public String getMarketTypeName() {
return marketTypeName;
}
public void setMarketTypeName(String marketTypeName) {
this.marketTypeName = marketTypeName;
}
public void setRecordId(String recordId) {
this.recordId = recordId;
}
public String getRecordId() {
return recordId;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductCode() {
return productCode;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductName() {
return productName;
}
public void setMarketType(String marketType) {
this.marketType = marketType;
}
public String getMarketType() {
return marketType;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getOrderCode() {
return orderCode;
}
public void setBatchCode(String batchCode) {
this.batchCode = batchCode;
}
public String getBatchCode() {
return batchCode;
}
public void setLineCode(String lineCode) {
this.lineCode = lineCode;
}
public String getLineCode() {
return lineCode;
}
public void setLineName(String lineName) {
this.lineName = lineName;
}
public String getLineName() {
return lineName;
}
public void setCarCode(String carCode) {
this.carCode = carCode;
}
public String getCarCode() {
return carCode;
}
public void setCarName(String carName) {
this.carName = carName;
}
public String getCarName() {
return carName;
}
public void setProductDate(Date productDate) {
this.productDate = productDate;
}
public Date getProductDate() {
return productDate;
}
public void setRectificationCode(String rectificationCode) {
this.rectificationCode = rectificationCode;
}
public String getRectificationCode() {
return rectificationCode;
}
public void setRectificationTime(Date rectificationTime) {
this.rectificationTime = rectificationTime;
}
public Date getRectificationTime() {
return rectificationTime;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2() {
return attr2;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public String getAttr3() {
return attr3;
}
public void setAttr4(String attr4) {
this.attr4 = attr4;
}
public String getAttr4() {
return attr4;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag() {
return delFlag;
}
public void setDataSource(String dataSource) {
this.dataSource = dataSource;
}
public String getDataSource() {
return dataSource;
}
public String getFeedbackTimeStart() {
return feedbackTimeStart;
}
public void setFeedbackTimeStart(String feedbackTimeStart) {
this.feedbackTimeStart = feedbackTimeStart;
}
public String getFeedbackTimeEnd() {
return feedbackTimeEnd;
}
public void setFeedbackTimeEnd(String feedbackTimeEnd) {
this.feedbackTimeEnd = feedbackTimeEnd;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("recordId", getRecordId())
.append("productCode", getProductCode())
.append("productName", getProductName())
.append("marketType", getMarketType())
.append("orderCode", getOrderCode())
.append("batchCode", getBatchCode())
.append("lineCode", getLineCode())
.append("lineName", getLineName())
.append("carCode", getCarCode())
.append("carName", getCarName())
.append("productDate", getProductDate())
.append("rectificationCode", getRectificationCode())
.append("rectificationTime", getRectificationTime())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("factoryCode", getFactoryCode())
.append("delFlag", getDelFlag())
.append("dataSource", getDataSource())
.toString();
}
}
Loading…
Cancel
Save