日生产效率报表

master
zhaoxiaolin 1 week ago
parent 19af92449e
commit dfde288e87

@ -0,0 +1,164 @@
package com.op.common.core.utils.poi;
import com.alibaba.fastjson2.JSONObject;
import com.op.common.core.domain.ExcelCol;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.Iterator;
import java.util.List;
/**
* Excel
*
* @author OP
*/
public class ExcelMesDayEffMapUtil {
//下载
public static <T> SXSSFWorkbook initWorkbook(String sheetName, String title, List<ExcelCol> excelCol, List<T> data) {
SXSSFWorkbook workbook = new SXSSFWorkbook();
int colSize = excelCol.size();
//创建Sheet工作簿
Sheet sheet = null;
if (!StringUtils.hasText(sheetName)) {
sheet = workbook.createSheet();
} else {
sheet = workbook.createSheet(sheetName);
}
Row sheetHeadRow0 = sheet.createRow(0);
Row sheetHeadRow1 = sheet.createRow(1);
Row sheetHeadRow2 = sheet.createRow(2);
//遍历表头名称,创建表头单元格
//遍历表头名称,创建表头单元格
for (int i = 0; i < colSize; i++) {
sheet.setColumnWidth(i, (excelCol.get(i).getWidth()) * 256);//宽度单位是字符的256分之一
Cell headCell = sheetHeadRow1.createCell(i);
headCell.setCellValue(excelCol.get(i).getTitle());//传值
headCell.setCellStyle(getHeaderFont(sheet.getWorkbook()));//设置样式
}
mergeAndStyleCells2(sheet, sheetHeadRow0, new CellRangeAddress(4, 5, 0, 1), "产品名称", true, true, IndexedColors.GREY_25_PERCENT);
//将data中的值填充到excel
int rowNum = sheet.getLastRowNum() + 1;
if (!CollectionUtils.isEmpty(data)) {
Iterator<T> iterator = data.iterator();
//遍历数据
for (; iterator.hasNext(); ) {
Row dataRow = sheet.createRow(rowNum);//创建行
T obj = iterator.next();//获取当前行对应的数据
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(obj));
for (int i = 0; i < colSize; i++) {
Cell dataCell = dataRow.createCell(i);
dataCell.setCellStyle(getDataFont(workbook));
if (title != null) {//定量分析
dataCell.setCellValue(getValue(jsonObject.get(excelCol.get(i).getField())));
} else {
if (i >= 2) {
dataCell.setCellValue(getValueNum(jsonObject.get(excelCol.get(i).getField())));
} else {
dataCell.setCellValue(getValue(jsonObject.get(excelCol.get(i).getField())));
}
}
}
iterator.remove();
rowNum++;
}
}
return workbook;
}
//标题样式
public static CellStyle getHeaderFont(Workbook workbook) {
Font font = workbook.createFont();
font.setFontHeightInPoints((short) 15);//字体大小
font.setBold(true);//加粗
CellStyle cellStyle = workbook.createCellStyle();
cellStyle.setFont(font);
cellStyle.setAlignment(HorizontalAlignment.CENTER_SELECTION);//设置水平居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//设置垂直居中
// 设置上边框
cellStyle.setBorderTop(BorderStyle.THIN);
// 设置下边框
cellStyle.setBorderBottom(BorderStyle.THIN);
// 设置左边框
cellStyle.setBorderLeft(BorderStyle.THIN);
// 设置右边框
cellStyle.setBorderRight(BorderStyle.THIN);
cellStyle.setFillBackgroundColor(IndexedColors.AQUA.getIndex());
return cellStyle;
}
//内容样式
public static CellStyle getDataFont(Workbook workbook) {
Font font = workbook.createFont();
font.setFontHeightInPoints((short) 12);//字体大小
font.setBold(false);//不加粗
CellStyle cellStyle = workbook.createCellStyle();
cellStyle.setFont(font);
cellStyle.setAlignment(HorizontalAlignment.CENTER_SELECTION);//设置水平居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//设置垂直居中
cellStyle.setWrapText(true);//设置单元格内容自动换行
return cellStyle;
}
//处理数据
public static String getValue(Object object) {
if (object == null) {
return "";
} else {
return object.toString();
}
}
//处理数据
public static Integer getValueNum(Object object) {
if (object == null) {
return 0;
} else {
return Integer.parseInt(object.toString());
}
}
private static void mergeAndStyleCells2(Sheet sheet, Row row, CellRangeAddress cellRangeAddress, String cellValue, boolean centered, boolean hasBackground, IndexedColors backgroundColor) {
// 合并单元格
sheet.addMergedRegion(cellRangeAddress);
// 创建一个单元格样式
CellStyle style = sheet.getWorkbook().createCellStyle();
// 设置字体居中
if (centered) {
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
}
// 设置背景颜色(如果有)
if (hasBackground && backgroundColor != null) {
style.setFillForegroundColor(backgroundColor.getIndex());
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
}
// 设置边框线
style.setBorderBottom(BorderStyle.THIN);
style.setBorderLeft(BorderStyle.THIN);
style.setBorderRight(BorderStyle.THIN);
style.setBorderTop(BorderStyle.THIN);
// 获取合并后的单元格的第一个单元格,并设置值
Cell cell = row.getCell(cellRangeAddress.getFirstColumn());
if (cell == null) {
cell = row.createCell(cellRangeAddress.getFirstColumn());
}
cell.setCellValue(cellValue); // 设置单元格的值
cell.setCellStyle(style); // 应用样式到单元格
}
}

@ -0,0 +1,220 @@
package com.op.mes.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import com.op.common.core.domain.ExcelCol;
import com.op.common.core.utils.poi.ExcelMapUtil;
import com.op.common.core.utils.poi.ExcelMesDayEffMapUtil;
import com.op.mes.domain.MesLineAssistant;
import com.op.mes.domain.vo.DynamicColumnVo;
import com.op.mes.domain.vo.MesDailyEfficiencyVo;
import com.op.mes.domain.vo.MesLineAssistantQtyVo;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.mes.domain.MesLineAssistantQty;
import com.op.mes.service.IMesLineAssistantQtyService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author Open Platform
* @date 2025-03-21
*/
@RestController
@RequestMapping("/reportWorks/assistqty")
public class MesLineAssistantQtyController extends BaseController {
@Autowired
private IMesLineAssistantQtyService mesLineAssistantQtyService;
/**
*
*/
@GetMapping("/list")
public TableDataInfo list(MesLineAssistantQty mesLineAssistantQty) {
startPage();
List<MesLineAssistantQty> list = mesLineAssistantQtyService.selectMesLineAssistantQtyList(mesLineAssistantQty);
return getDataTable(list);
}
/**
*
*/
@Log(title = "辅助工时摊分", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MesLineAssistantQty mesLineAssistantQty) {
List<MesLineAssistantQty> list = mesLineAssistantQtyService.selectMesLineAssistantQtyList(mesLineAssistantQty);
ExcelUtil<MesLineAssistantQty> util = new ExcelUtil<MesLineAssistantQty>(MesLineAssistantQty. class);
util.exportExcel(response, list, "辅助工时摊分数据");
}
/**
*
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(mesLineAssistantQtyService.selectMesLineAssistantQtyById(id));
}
/**
*
*/
@Log(title = "辅助工时摊分", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesLineAssistantQty mesLineAssistantQty) {
return toAjax(mesLineAssistantQtyService.insertMesLineAssistantQty(mesLineAssistantQty));
}
/**
*
*/
@Log(title = "辅助工时摊分", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesLineAssistantQty mesLineAssistantQty) {
return toAjax(mesLineAssistantQtyService.updateMesLineAssistantQty(mesLineAssistantQty));
}
/**
*
*/
@Log(title = "辅助工时摊分", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(mesLineAssistantQtyService.deleteMesLineAssistantQtyByIds(ids));
}
@Log(title = "辅助工时摊分报表查询", businessType = BusinessType.QUERY)
@GetMapping("/listAssistHour")
public List<MesLineAssistantQtyVo> listAssistHour(MesLineAssistant mesLineAssistant) {
List<MesLineAssistantQtyVo> list = mesLineAssistantQtyService.selectEfficiencyHourList(mesLineAssistant);
return list;
}
@Log(title = "辅助工时摊分导出", businessType = BusinessType.EXPORT)
@PostMapping("/listAssistHourExport")
public void listAssistHourExport(HttpServletResponse response, MesLineAssistant mesLineAssistant) {
List<MesLineAssistantQtyVo> list = mesLineAssistantQtyService.selectEfficiencyHourList(mesLineAssistant);
ExcelUtil<MesLineAssistantQtyVo> util = new ExcelUtil<MesLineAssistantQtyVo>(MesLineAssistantQtyVo. class);
util.exportExcel(response, list, "辅助工时摊分数据");
}
@Log(title = "生产日效率报表查询", businessType = BusinessType.QUERY)
@GetMapping("/listEfficiencyDayList")
public List<MesDailyEfficiencyVo> listEfficiencyHourList(MesLineAssistant mesLineAssistant) {
List<MesDailyEfficiencyVo> list = mesLineAssistantQtyService.selectEfficiencyDayList(mesLineAssistant);
return list;
}
@Log(title = "生产日效率报表导出", businessType = BusinessType.EXPORT)
@PostMapping("/listEfficiencyDayExport")
public void listEfficiencyHourExport(HttpServletResponse response, MesLineAssistant mesLineAssistant) {
List<MesDailyEfficiencyVo> list = mesLineAssistantQtyService.selectEfficiencyDayList(mesLineAssistant);
// List<Map<String, Object>> list = mesReportWorksService.getHFProductionList(dto);
//
// ArrayList<ExcelCol> excelCols = new ArrayList<>();
// excelCols.add(new ExcelCol("日期","productDate",20));
// excelCols.add(new ExcelCol("工厂","factoryCode",20));
// excelCols.add(new ExcelCol("车间","totalQuantity",20));
// excelCols.add(new ExcelCol("产线编码","totalQuantity",20));
// excelCols.add(new ExcelCol("品类","productDate",20));
// excelCols.add(new ExcelCol("产品名称","factoryCode",20));
// excelCols.add(new ExcelCol("规格","totalQuantity",20));
// excelCols.add(new ExcelCol("单位","totalQuantity",20));
// excelCols.add(new ExcelCol("计划产量(件/PC","productDate",20));
// excelCols.add(new ExcelCol("实际产量(件)","factoryCode",20));
// excelCols.add(new ExcelCol("实际产量PC","totalQuantity",20));
// excelCols.add(new ExcelCol("产量达成率","totalQuantity",20));
// excelCols.add(new ExcelCol("标准工艺效率PC/H","productDate",20));
// excelCols.add(new ExcelCol("标准用人","factoryCode",20));
// excelCols.add(new ExcelCol("实际用人","totalQuantity",20));
// excelCols.add(new ExcelCol("产品标准工时","totalQuantity",20));
// excelCols.add(new ExcelCol("产品实际工时","factoryCode",20));
// excelCols.add(new ExcelCol("一线工时合计","totalQuantity",20));
// excelCols.add(new ExcelCol("一线标准效率","totalQuantity",20));
// excelCols.add(new ExcelCol("一线实际效率","productDate",20));
// excelCols.add(new ExcelCol("效率达成率","factoryCode",20));
//
// excelCols.add(new ExcelCol("辅助用人合计","totalQuantity",20));
// excelCols.add(new ExcelCol("班长","totalQuantity",20));
// excelCols.add(new ExcelCol("组长","totalQuantity",20));
// excelCols.add(new ExcelCol("机操工","totalQuantity",20));
// excelCols.add(new ExcelCol("物料员","totalQuantity",20));
// excelCols.add(new ExcelCol("配料员","totalQuantity",20));
// excelCols.add(new ExcelCol("配药员","totalQuantity",20));
// excelCols.add(new ExcelCol("药管员","totalQuantity",20));
// excelCols.add(new ExcelCol("锅炉工","totalQuantity",20));
// excelCols.add(new ExcelCol("石油气看管员","totalQuantity",20));
// excelCols.add(new ExcelCol("库区管理员","totalQuantity",20));
// excelCols.add(new ExcelCol("机修工","totalQuantity",20));
// excelCols.add(new ExcelCol("清洁工","totalQuantity",20));
//
// excelCols.add(new ExcelCol("辅助工时合计","totalQuantity",20));
// excelCols.add(new ExcelCol("班长","totalQuantity",20));
// excelCols.add(new ExcelCol("组长","totalQuantity",20));
// excelCols.add(new ExcelCol("机操工","totalQuantity",20));
// excelCols.add(new ExcelCol("物料员","totalQuantity",20));
// excelCols.add(new ExcelCol("配料员","totalQuantity",20));
// excelCols.add(new ExcelCol("配药员","totalQuantity",20));
// excelCols.add(new ExcelCol("药管员","totalQuantity",20));
// excelCols.add(new ExcelCol("锅炉工","totalQuantity",20));
// excelCols.add(new ExcelCol("石油气看管员","totalQuantity",20));
// excelCols.add(new ExcelCol("库区管理员","totalQuantity",20));
// excelCols.add(new ExcelCol("机修工","totalQuantity",20));
// excelCols.add(new ExcelCol("清洁工","totalQuantity",20));
//
// excelCols.add(new ExcelCol("总工时","totalQuantity",20));
// excelCols.add(new ExcelCol("效率提升基数","totalQuantity",20));
// excelCols.add(new ExcelCol("提升目标","totalQuantity",20));
// excelCols.add(new ExcelCol("目标效率","totalQuantity",20));
// excelCols.add(new ExcelCol("实际效率","totalQuantity",20));
// excelCols.add(new ExcelCol("效率提升率","totalQuantity",20));
//
// excelCols.add(new ExcelCol("原因分析","totalQuantity",20));
//
// String titleName = "日生产效率统计报表";
// SXSSFWorkbook workbook = null;
//
// try {
// //设置响应头
// response.setHeader("Content-disposition",
// "attachment; filename="+ titleName);
// response.setContentType("application/octet-stream;charset=UTF-8");
// ServletOutputStream outputStream = response.getOutputStream();
// //调用工具类
// workbook = ExcelMesDayEffMapUtil.initWorkbook(titleName, null, excelCols, list);
// workbook.write(outputStream);
// } catch (IOException e) {
// e.printStackTrace();
// }finally {
// if (workbook!=null){
// workbook.dispose();
// }
// }
ExcelUtil<MesDailyEfficiencyVo> util = new ExcelUtil<MesDailyEfficiencyVo>(MesDailyEfficiencyVo. class);
util.exportExcel(response, list, "生产日效率报表");
}
}

@ -27,7 +27,7 @@ import java.util.List;
import java.util.Map;
import static com.op.common.core.utils.PageUtils.startPage;
/**mes综合分析报表**/
@RestController
@RequestMapping("/reportWorks")
public class MesReportWorksController extends BaseController {

@ -0,0 +1,278 @@
package com.op.mes.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* mes_line_assistant_qty
*
* @author Open Platform
* @date 2025-03-21
*/
public class MesLineAssistant extends BaseEntity {
private static final long serialVersionUID=1L;
/** 主键 */
private String id;
/** 工厂 */
@Excel(name = "工厂")
private String factoryCode;
@Excel(name = "车间")
private String carCode;
@Excel(name = "线体")
private String lineCode;
@Excel(name = "产品编码")
private String productCode;
@Excel(name = "产品名称")
private String productName;
@Excel(name = "产品工时")
private String productHour;
@Excel(name = "工时占比")
private String hourRatio;
@Excel(name = "辅助工时合计")
private String assistHourSum;
@Excel(name = "班长工时")
private String monitorHour;
@Excel(name = "组长工时")
private String groupLeaderHour;
@Excel(name = "物料员工时")
private String materialHour;
@Excel(name = "药管员工时")
private String pillMgrHour;
@Excel(name = "配药员工时")
private String pillDisHour;
/** 生产日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date productDate;
private String productDateStr;
/** 班长人数 */
@Excel(name = "班长人数")
private Long monitorQty;
/** 组长人数 */
@Excel(name = "组长人数")
private Long groupleaderQty;
/** 物料员人数 */
@Excel(name = "物料员人数")
private Long materialQty;
/** 药管员人数 */
@Excel(name = "药管员人数")
private Long pillMgrQty;
/** 配药员人数 */
@Excel(name = "配药员人数")
private Long pillDisQty;
//班长10000150 车间组长10000168 物料员10000478 药管员10000271 配药员10000155
private String postId;
public String getPostId() {
return postId;
}
public void setPostId(String postId) {
this.postId = postId;
}
public void setId(String id){
this.id = id;
}
public String getId(){
return id;
}
public void setFactoryCode(String factoryCode){
this.factoryCode = factoryCode;
}
public String getFactoryCode(){
return factoryCode;
}
public void setProductDate(Date productDate){
this.productDate = productDate;
}
public Date getProductDate(){
return productDate;
}
public void setMonitorQty(Long monitorQty){
this.monitorQty = monitorQty;
}
public Long getMonitorQty(){
return monitorQty;
}
public void setGroupleaderQty(Long groupleaderQty){
this.groupleaderQty = groupleaderQty;
}
public Long getGroupleaderQty(){
return groupleaderQty;
}
public void setMaterialQty(Long materialQty){
this.materialQty = materialQty;
}
public Long getMaterialQty(){
return materialQty;
}
public void setPillMgrQty(Long pillMgrQty){
this.pillMgrQty = pillMgrQty;
}
public Long getPillMgrQty(){
return pillMgrQty;
}
public void setPillDisQty(Long pillDisQty){
this.pillDisQty = pillDisQty;
}
public Long getPillDisQty(){
return pillDisQty;
}
public String getCarCode() {
return carCode;
}
public void setCarCode(String carCode) {
this.carCode = carCode;
}
public String getLineCode() {
return lineCode;
}
public void setLineCode(String lineCode) {
this.lineCode = lineCode;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductHour() {
return productHour;
}
public void setProductHour(String productHour) {
this.productHour = productHour;
}
public String getHourRatio() {
return hourRatio;
}
public void setHourRatio(String hourRatio) {
this.hourRatio = hourRatio;
}
public String getAssistHourSum() {
return assistHourSum;
}
public void setAssistHourSum(String assistHourSum) {
this.assistHourSum = assistHourSum;
}
public String getMonitorHour() {
return monitorHour;
}
public void setMonitorHour(String monitorHour) {
this.monitorHour = monitorHour;
}
public String getGroupLeaderHour() {
return groupLeaderHour;
}
public void setGroupLeaderHour(String groupLeaderHour) {
this.groupLeaderHour = groupLeaderHour;
}
public String getMaterialHour() {
return materialHour;
}
public void setMaterialHour(String materialHour) {
this.materialHour = materialHour;
}
public String getPillMgrHour() {
return pillMgrHour;
}
public void setPillMgrHour(String pillMgrHour) {
this.pillMgrHour = pillMgrHour;
}
public String getPillDisHour() {
return pillDisHour;
}
public void setPillDisHour(String pillDisHour) {
this.pillDisHour = pillDisHour;
}
public String getProductDateStr() {
return productDateStr;
}
public void setProductDateStr(String productDateStr) {
this.productDateStr = productDateStr;
}
@Override
public String toString(){
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id",getId())
.append("factoryCode",getFactoryCode())
.append("productDate",getProductDate())
.append("monitorQty",getMonitorQty())
.append("groupleaderQty",getGroupleaderQty())
.append("materialQty",getMaterialQty())
.append("pillMgrQty",getPillMgrQty())
.append("pillDisQty",getPillDisQty())
.append("createBy",getCreateBy())
.append("createTime",getCreateTime())
.append("updateBy",getUpdateBy())
.append("updateTime",getUpdateTime())
.toString();
}
}

@ -0,0 +1,181 @@
package com.op.mes.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;
/**
* mes_line_assistant_qty
*
* @author Open Platform
* @date 2025-03-21
*/
public class MesLineAssistantQty extends BaseEntity {
private static final long serialVersionUID=1L;
/** 主键 */
private String id;
/** 工厂 */
@Excel(name = "工厂")
private String factoryCode;
/** 生产日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date productDate;
private String productDateStr;
/** 班长人数 */
@Excel(name = "班长人数")
private Long monitorQty;
/** 组长人数 */
@Excel(name = "组长人数")
private Long groupleaderQty;
/** 物料员人数 */
@Excel(name = "物料员人数")
private Long materialQty;
/** 药管员人数 */
@Excel(name = "药管员人数")
private Long pillMgrQty;
/** 配药员人数 */
@Excel(name = "配药员人数")
private Long pillDisQty;
/** 预留字段1 */
@Excel(name = "预留字段1")
private String attr1;
/** 预留字段2 */
@Excel(name = "预留字段2")
private String attr2;
/** 预留字段3 */
@Excel(name = "预留字段3")
private String attr3;
/** 预留字段4 */
@Excel(name = "预留字段4")
private String attr4;
public String getProductDateStr() {
return productDateStr;
}
public void setProductDateStr(String productDateStr) {
this.productDateStr = productDateStr;
}
public void setId(String id){
this.id = id;
}
public String getId(){
return id;
}
public void setFactoryCode(String factoryCode){
this.factoryCode = factoryCode;
}
public String getFactoryCode(){
return factoryCode;
}
public void setProductDate(Date productDate){
this.productDate = productDate;
}
public Date getProductDate(){
return productDate;
}
public void setMonitorQty(Long monitorQty){
this.monitorQty = monitorQty;
}
public Long getMonitorQty(){
return monitorQty;
}
public void setGroupleaderQty(Long groupleaderQty){
this.groupleaderQty = groupleaderQty;
}
public Long getGroupleaderQty(){
return groupleaderQty;
}
public void setMaterialQty(Long materialQty){
this.materialQty = materialQty;
}
public Long getMaterialQty(){
return materialQty;
}
public void setPillMgrQty(Long pillMgrQty){
this.pillMgrQty = pillMgrQty;
}
public Long getPillMgrQty(){
return pillMgrQty;
}
public void setPillDisQty(Long pillDisQty){
this.pillDisQty = pillDisQty;
}
public Long getPillDisQty(){
return pillDisQty;
}
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;
}
@Override
public String toString(){
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id",getId())
.append("factoryCode",getFactoryCode())
.append("productDate",getProductDate())
.append("monitorQty",getMonitorQty())
.append("groupleaderQty",getGroupleaderQty())
.append("materialQty",getMaterialQty())
.append("pillMgrQty",getPillMgrQty())
.append("pillDisQty",getPillDisQty())
.append("attr1",getAttr1())
.append("attr2",getAttr2())
.append("attr3",getAttr3())
.append("attr4",getAttr4())
.append("createBy",getCreateBy())
.append("createTime",getCreateTime())
.append("updateBy",getUpdateBy())
.append("updateTime",getUpdateTime())
.toString();
}
}

@ -2,6 +2,8 @@ package com.op.mes.domain;
import com.op.common.core.web.domain.BaseEntity;
import java.math.BigDecimal;
public class MesLineProduct extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -21,6 +23,34 @@ public class MesLineProduct extends BaseEntity {
private String attr2;
private String lineCode;
private BigDecimal hourEfficiency;
private BigDecimal useMan;
public BigDecimal getHourEfficiency() {
return hourEfficiency;
}
public void setHourEfficiency(BigDecimal hourEfficiency) {
this.hourEfficiency = hourEfficiency;
}
public BigDecimal getUseMan() {
return useMan;
}
public void setUseMan(BigDecimal useMan) {
this.useMan = useMan;
}
public String getLineCode() {
return lineCode;
}
public void setLineCode(String lineCode) {
this.lineCode = lineCode;
}
public String getProductCode() {
return productCode;
}

@ -0,0 +1,636 @@
package com.op.mes.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
*
*
* @author Open Platform
* @date 2025-03-21
*/
public class MesDailyEfficiencyVo extends BaseEntity {
private static final long serialVersionUID=1L;
/** 主键 */
private String id;
/** 生产日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date productDate;
/** 工厂 */
@Excel(name = "工厂")
private String factoryCode;
@Excel(name = "车间")
private String carCode;
@Excel(name = "SAP线体编码")
private String lineCode;
private String productCode;
@Excel(name = "品类")
private String category;
@Excel(name = "产品名称")
private String productName;
@Excel(name = "规格")
private String spec;
@Excel(name = "单位")
private String unit;
@Excel(name = "计划产量(件/PC")
private String planQty;
@Excel(name = "实际产量(件/PC")
private String actQty;
@Excel(name = "实际产量PC")
private String actQtySon;
@Excel(name = "产量达成率")
private String completeRate;
//一线
@Excel(name = "标准工艺效率PC/H")
private String standEff;
@Excel(name = "标准用人")
private String standMan;
@Excel(name = "实际用人")
private String actMan;
@Excel(name = "产品标准工时")
private String standHour;
@Excel(name = "产品实际工时")
private String actHour;
@Excel(name = "一线工时合计")
private String oneHourSum;
@Excel(name = "一线标准效率")
private String oneStandEff;
@Excel(name = "一线实际效率")
private String oneActEff;
@Excel(name = "效率达成率")
private String effRate;
//辅助
////辅助用人数
@Excel(name = "辅助用人合计")
private String assisManSum;
@Excel(name = "班长人数")
private String monitorQty;
@Excel(name = "组长人数")
private String groupleaderQty;
@Excel(name = "机操工人数")
private String operateMachineQty;
@Excel(name = "物料员人数")
private String materialQty;
@Excel(name = "配料员人数")
private String materialDisQty;
@Excel(name = "配药员人数")
private String pillDisQty;
@Excel(name = "药管员人数")
private String pillMgrQty;
@Excel(name = "锅炉工人数")
private String boilerQty;
@Excel(name = "石油气看管员人数")
private String oilQty;
@Excel(name = "库区管理员人数")
private String wareMgrQty;
@Excel(name = "机修工人数")
private String repairQty;
@Excel(name = "清洁工人数")
private String cleanerQty;
////辅助工时数
@Excel(name = "辅助工时合计")
private String assisHourSum;
@Excel(name = "班长工时")
private String monitorHour;
@Excel(name = "组长工时")
private String groupleaderHour;
@Excel(name = "机操工工时")
private String operateMachineHour;
@Excel(name = "物料员工时")
private String materialHour;
@Excel(name = "配料员工时")
private String materialDisHour;
@Excel(name = "配药员工时")
private String pillDisHour;
@Excel(name = "药管员工时")
private String pillMgrHour;
@Excel(name = "锅炉工工时")
private String boilerHour;
@Excel(name = "石油气看管员工时")
private String oilHour;
@Excel(name = "库区管理员工时")
private String wareMgrHour;
@Excel(name = "机修工工时")
private String repairHour;
@Excel(name = "清洁工工时")
private String cleanerHour;
//一线+辅助
@Excel(name = "总工时")
private String hourSum;
@Excel(name = "效率提升基数")
private String effUpBase;
@Excel(name = "提升目标")
private String upGoal;
@Excel(name = "目标效率")
private String goalRate;
@Excel(name = "实际效率")
private String actRate;
@Excel(name = "效率提升率")
private String effUpRate;
@Excel(name = "原因分析")
private String reasonAnalysis;
private String workorderCode;
//班长10000150 车间组长10000168 物料员10000478 药管员10000271 配药员10000155
private String postId;
public String getPostId() {
return postId;
}
public void setPostId(String postId) {
this.postId = postId;
}
public void setId(String id){
this.id = id;
}
public String getId(){
return id;
}
public void setFactoryCode(String factoryCode){
this.factoryCode = factoryCode;
}
public String getFactoryCode(){
return factoryCode;
}
public void setProductDate(Date productDate){
this.productDate = productDate;
}
public Date getProductDate(){
return productDate;
}
public String getMonitorQty() {
return monitorQty;
}
public void setMonitorQty(String monitorQty) {
this.monitorQty = monitorQty;
}
public String getGroupleaderQty() {
return groupleaderQty;
}
public void setGroupleaderQty(String groupleaderQty) {
this.groupleaderQty = groupleaderQty;
}
public String getMaterialQty() {
return materialQty;
}
public void setMaterialQty(String materialQty) {
this.materialQty = materialQty;
}
public String getPillMgrQty() {
return pillMgrQty;
}
public void setPillMgrQty(String pillMgrQty) {
this.pillMgrQty = pillMgrQty;
}
public String getPillDisQty() {
return pillDisQty;
}
public void setPillDisQty(String pillDisQty) {
this.pillDisQty = pillDisQty;
}
public String getCarCode() {
return carCode;
}
public void setCarCode(String carCode) {
this.carCode = carCode;
}
public String getLineCode() {
return lineCode;
}
public void setLineCode(String lineCode) {
this.lineCode = lineCode;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getMonitorHour() {
return monitorHour;
}
public void setMonitorHour(String monitorHour) {
this.monitorHour = monitorHour;
}
public String getMaterialHour() {
return materialHour;
}
public void setMaterialHour(String materialHour) {
this.materialHour = materialHour;
}
public String getPillMgrHour() {
return pillMgrHour;
}
public void setPillMgrHour(String pillMgrHour) {
this.pillMgrHour = pillMgrHour;
}
public String getPillDisHour() {
return pillDisHour;
}
public void setPillDisHour(String pillDisHour) {
this.pillDisHour = pillDisHour;
}
public String getWorkorderCode() {
return workorderCode;
}
public void setWorkorderCode(String workorderCode) {
this.workorderCode = workorderCode;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getPlanQty() {
return planQty;
}
public void setPlanQty(String planQty) {
this.planQty = planQty;
}
public String getActQty() {
return actQty;
}
public void setActQty(String actQty) {
this.actQty = actQty;
}
public String getActQtySon() {
return actQtySon;
}
public void setActQtySon(String actQtySon) {
this.actQtySon = actQtySon;
}
public String getCompleteRate() {
return completeRate;
}
public void setCompleteRate(String completeRate) {
this.completeRate = completeRate;
}
public String getStandEff() {
return standEff;
}
public void setStandEff(String standEff) {
this.standEff = standEff;
}
public String getStandMan() {
return standMan;
}
public void setStandMan(String standMan) {
this.standMan = standMan;
}
public String getActMan() {
return actMan;
}
public void setActMan(String actMan) {
this.actMan = actMan;
}
public String getStandHour() {
return standHour;
}
public void setStandHour(String standHour) {
this.standHour = standHour;
}
public String getActHour() {
return actHour;
}
public void setActHour(String actHour) {
this.actHour = actHour;
}
public String getOneHourSum() {
return oneHourSum;
}
public void setOneHourSum(String oneHourSum) {
this.oneHourSum = oneHourSum;
}
public String getOneStandEff() {
return oneStandEff;
}
public void setOneStandEff(String oneStandEff) {
this.oneStandEff = oneStandEff;
}
public String getOneActEff() {
return oneActEff;
}
public void setOneActEff(String oneActEff) {
this.oneActEff = oneActEff;
}
public String getEffRate() {
return effRate;
}
public void setEffRate(String effRate) {
this.effRate = effRate;
}
public String getAssisManSum() {
return assisManSum;
}
public void setAssisManSum(String assisManSum) {
this.assisManSum = assisManSum;
}
public String getOperateMachineQty() {
return operateMachineQty;
}
public void setOperateMachineQty(String operateMachineQty) {
this.operateMachineQty = operateMachineQty;
}
public String getMaterialDisQty() {
return materialDisQty;
}
public void setMaterialDisQty(String materialDisQty) {
this.materialDisQty = materialDisQty;
}
public String getBoilerQty() {
return boilerQty;
}
public void setBoilerQty(String boilerQty) {
this.boilerQty = boilerQty;
}
public String getOilQty() {
return oilQty;
}
public void setOilQty(String oilQty) {
this.oilQty = oilQty;
}
public String getWareMgrQty() {
return wareMgrQty;
}
public void setWareMgrQty(String wareMgrQty) {
this.wareMgrQty = wareMgrQty;
}
public String getRepairQty() {
return repairQty;
}
public void setRepairQty(String repairQty) {
this.repairQty = repairQty;
}
public String getCleanerQty() {
return cleanerQty;
}
public void setCleanerQty(String cleanerQty) {
this.cleanerQty = cleanerQty;
}
public String getAssisHourSum() {
return assisHourSum;
}
public void setAssisHourSum(String assisHourSum) {
this.assisHourSum = assisHourSum;
}
public String getGroupleaderHour() {
return groupleaderHour;
}
public void setGroupleaderHour(String groupleaderHour) {
this.groupleaderHour = groupleaderHour;
}
public String getOperateMachineHour() {
return operateMachineHour;
}
public void setOperateMachineHour(String operateMachineHour) {
this.operateMachineHour = operateMachineHour;
}
public String getMaterialDisHour() {
return materialDisHour;
}
public void setMaterialDisHour(String materialDisHour) {
this.materialDisHour = materialDisHour;
}
public String getBoilerHour() {
return boilerHour;
}
public void setBoilerHour(String boilerHour) {
this.boilerHour = boilerHour;
}
public String getOilHour() {
return oilHour;
}
public void setOilHour(String oilHour) {
this.oilHour = oilHour;
}
public String getWareMgrHour() {
return wareMgrHour;
}
public void setWareMgrHour(String wareMgrHour) {
this.wareMgrHour = wareMgrHour;
}
public String getRepairHour() {
return repairHour;
}
public void setRepairHour(String repairHour) {
this.repairHour = repairHour;
}
public String getCleanerHour() {
return cleanerHour;
}
public void setCleanerHour(String cleanerHour) {
this.cleanerHour = cleanerHour;
}
public String getHourSum() {
return hourSum;
}
public void setHourSum(String hourSum) {
this.hourSum = hourSum;
}
public String getEffUpBase() {
return effUpBase;
}
public void setEffUpBase(String effUpBase) {
this.effUpBase = effUpBase;
}
public String getUpGoal() {
return upGoal;
}
public void setUpGoal(String upGoal) {
this.upGoal = upGoal;
}
public String getGoalRate() {
return goalRate;
}
public void setGoalRate(String goalRate) {
this.goalRate = goalRate;
}
public String getActRate() {
return actRate;
}
public void setActRate(String actRate) {
this.actRate = actRate;
}
public String getEffUpRate() {
return effUpRate;
}
public void setEffUpRate(String effUpRate) {
this.effUpRate = effUpRate;
}
public String getReasonAnalysis() {
return reasonAnalysis;
}
public void setReasonAnalysis(String reasonAnalysis) {
this.reasonAnalysis = reasonAnalysis;
}
@Override
public String toString(){
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id",getId())
.append("factoryCode",getFactoryCode())
.append("productDate",getProductDate())
.append("monitorQty",getMonitorQty())
.append("groupleaderQty",getGroupleaderQty())
.append("materialQty",getMaterialQty())
.append("pillMgrQty",getPillMgrQty())
.append("pillDisQty",getPillDisQty())
.append("createBy",getCreateBy())
.append("createTime",getCreateTime())
.append("updateBy",getUpdateBy())
.append("updateTime",getUpdateTime())
.toString();
}
}

@ -0,0 +1,278 @@
package com.op.mes.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* mes_line_assistant_qty
*
* @author Open Platform
* @date 2025-03-21
*/
public class MesLineAssistantQtyVo extends BaseEntity {
private static final long serialVersionUID=1L;
/** 主键 */
private String id;
/** 生产日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date productDate;
/** 工厂 */
@Excel(name = "工厂")
private String factoryCode;
@Excel(name = "车间")
private String carCode;
@Excel(name = "SAP线体编码")
private String lineCode;
private String productCode;
@Excel(name = "产品名称")
private String productName;
@Excel(name = "产品工时")
private String productHour;
@Excel(name = "工时占比")
private String hourRatio;
@Excel(name = "辅助工时合计")
private String assistHourSum;
@Excel(name = "班长人数")
private String monitorQty;
@Excel(name = "班长工时")
private String monitorHour;
@Excel(name = "组长人数")
private String groupleaderQty;
@Excel(name = "组长工时")
private String groupLeaderHour;
@Excel(name = "物料员人数")
private String materialQty;
@Excel(name = "物料员工时")
private String materialHour;
@Excel(name = "药管员人数")
private String pillMgrQty;
@Excel(name = "药管员工时")
private String pillMgrHour;
@Excel(name = "配药员人数")
private String pillDisQty;
@Excel(name = "配药员工时")
private String pillDisHour;
private String workorderCode;
//班长10000150 车间组长10000168 物料员10000478 药管员10000271 配药员10000155
private String postId;
public String getPostId() {
return postId;
}
public void setPostId(String postId) {
this.postId = postId;
}
public void setId(String id){
this.id = id;
}
public String getId(){
return id;
}
public void setFactoryCode(String factoryCode){
this.factoryCode = factoryCode;
}
public String getFactoryCode(){
return factoryCode;
}
public void setProductDate(Date productDate){
this.productDate = productDate;
}
public Date getProductDate(){
return productDate;
}
public String getMonitorQty() {
return monitorQty;
}
public void setMonitorQty(String monitorQty) {
this.monitorQty = monitorQty;
}
public String getGroupleaderQty() {
return groupleaderQty;
}
public void setGroupleaderQty(String groupleaderQty) {
this.groupleaderQty = groupleaderQty;
}
public String getMaterialQty() {
return materialQty;
}
public void setMaterialQty(String materialQty) {
this.materialQty = materialQty;
}
public String getPillMgrQty() {
return pillMgrQty;
}
public void setPillMgrQty(String pillMgrQty) {
this.pillMgrQty = pillMgrQty;
}
public String getPillDisQty() {
return pillDisQty;
}
public void setPillDisQty(String pillDisQty) {
this.pillDisQty = pillDisQty;
}
public String getCarCode() {
return carCode;
}
public void setCarCode(String carCode) {
this.carCode = carCode;
}
public String getLineCode() {
return lineCode;
}
public void setLineCode(String lineCode) {
this.lineCode = lineCode;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductHour() {
return productHour;
}
public void setProductHour(String productHour) {
this.productHour = productHour;
}
public String getHourRatio() {
return hourRatio;
}
public void setHourRatio(String hourRatio) {
this.hourRatio = hourRatio;
}
public String getAssistHourSum() {
return assistHourSum;
}
public void setAssistHourSum(String assistHourSum) {
this.assistHourSum = assistHourSum;
}
public String getMonitorHour() {
return monitorHour;
}
public void setMonitorHour(String monitorHour) {
this.monitorHour = monitorHour;
}
public String getGroupLeaderHour() {
return groupLeaderHour;
}
public void setGroupLeaderHour(String groupLeaderHour) {
this.groupLeaderHour = groupLeaderHour;
}
public String getMaterialHour() {
return materialHour;
}
public void setMaterialHour(String materialHour) {
this.materialHour = materialHour;
}
public String getPillMgrHour() {
return pillMgrHour;
}
public void setPillMgrHour(String pillMgrHour) {
this.pillMgrHour = pillMgrHour;
}
public String getPillDisHour() {
return pillDisHour;
}
public void setPillDisHour(String pillDisHour) {
this.pillDisHour = pillDisHour;
}
public String getWorkorderCode() {
return workorderCode;
}
public void setWorkorderCode(String workorderCode) {
this.workorderCode = workorderCode;
}
@Override
public String toString(){
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id",getId())
.append("factoryCode",getFactoryCode())
.append("productDate",getProductDate())
.append("monitorQty",getMonitorQty())
.append("groupleaderQty",getGroupleaderQty())
.append("materialQty",getMaterialQty())
.append("pillMgrQty",getPillMgrQty())
.append("pillDisQty",getPillDisQty())
.append("createBy",getCreateBy())
.append("createTime",getCreateTime())
.append("updateBy",getUpdateBy())
.append("updateTime",getUpdateTime())
.toString();
}
}

@ -0,0 +1,87 @@
package com.op.mes.mapper;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import com.op.mes.domain.MesLineAssistant;
import com.op.mes.domain.MesLineAssistantQty;
import com.op.mes.domain.MesLineProduct;
import com.op.mes.domain.MesReportWork;
import com.op.mes.domain.vo.MesDailyEfficiencyVo;
import com.op.mes.domain.vo.MesLineAssistantQtyVo;
import org.apache.ibatis.annotations.MapKey;
/**
* Mapper
*
* @author Open Platform
* @date 2025-03-21
*/
public interface MesLineAssistantQtyMapper {
/**
*
*
* @param id
* @return
*/
public MesLineAssistantQty selectMesLineAssistantQtyById(String id);
/**
*
*
* @param mesLineAssistantQty
* @return
*/
public List<MesLineAssistantQty> selectMesLineAssistantQtyList(MesLineAssistantQty mesLineAssistantQty);
/**
*
*
* @param mesLineAssistantQty
* @return
*/
public int insertMesLineAssistantQty(MesLineAssistantQty mesLineAssistantQty);
/**
*
*
* @param mesLineAssistantQty
* @return
*/
public int updateMesLineAssistantQty(MesLineAssistantQty mesLineAssistantQty);
/**
*
*
* @param id
* @return
*/
public int deleteMesLineAssistantQtyById(String id);
/**
*
*
* @param ids
* @return
*/
public int deleteMesLineAssistantQtyByIds(String[] ids);
String getHasdate(MesLineAssistantQty mesLineAssistantQty);
public List<MesLineAssistantQtyVo> selectEfficiencyHourList(MesLineAssistant mesLineAssistant);
BigDecimal getHoursByOrderCode(String workorderCode);
@MapKey("productDateStr")
Map<String, MesLineAssistantQty> getAssistMaps(MesLineAssistant mesLineAssistant);
BigDecimal getKqHourMaps(MesLineAssistant mesLineAssistant);
public List<MesDailyEfficiencyVo> selectEfficiencyDayList(MesLineAssistant mesLineAssistant);
BigDecimal getPlanQtyByOrderCode(String workorderCode);
BigDecimal getActQtyByOrderCode(String workorderCode);
MesLineProduct getStandarInfo(MesDailyEfficiencyVo effdto);
MesReportWork getSonActManByOrderCode(String workorderCode);
}

@ -0,0 +1,69 @@
package com.op.mes.service;
import java.util.List;
import com.op.mes.domain.MesLineAssistant;
import com.op.mes.domain.MesLineAssistantQty;
import com.op.mes.domain.vo.MesDailyEfficiencyVo;
import com.op.mes.domain.vo.MesLineAssistantQtyVo;
/**
* Service
*
* @author Open Platform
* @date 2025-03-21
*/
public interface IMesLineAssistantQtyService {
/**
*
*
* @param id
* @return
*/
public MesLineAssistantQty selectMesLineAssistantQtyById(String id);
/**
*
*
* @param mesLineAssistantQty
* @return
*/
public List<MesLineAssistantQty> selectMesLineAssistantQtyList(MesLineAssistantQty mesLineAssistantQty);
/**
*
*
* @param mesLineAssistantQty
* @return
*/
public int insertMesLineAssistantQty(MesLineAssistantQty mesLineAssistantQty);
/**
*
*
* @param mesLineAssistantQty
* @return
*/
public int updateMesLineAssistantQty(MesLineAssistantQty mesLineAssistantQty);
/**
*
*
* @param ids
* @return
*/
public int deleteMesLineAssistantQtyByIds(String[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteMesLineAssistantQtyById(String id);
public List<MesLineAssistantQtyVo> selectEfficiencyHourList(MesLineAssistant mesLineAssistant);
public List<MesDailyEfficiencyVo> selectEfficiencyDayList(MesLineAssistant mesLineAssistant);
}

@ -0,0 +1,439 @@
package com.op.mes.service.impl;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.mes.domain.MesLineAssistant;
import com.op.mes.domain.MesLineProduct;
import com.op.mes.domain.MesReportWork;
import com.op.mes.domain.vo.MesDailyEfficiencyVo;
import com.op.mes.domain.vo.MesLineAssistantQtyVo;
import com.op.system.api.domain.mes.ProOrderWorkorderDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.mes.mapper.MesLineAssistantQtyMapper;
import com.op.mes.domain.MesLineAssistantQty;
import com.op.mes.service.IMesLineAssistantQtyService;
/**
* Service
*
* @author Open Platform
* @date 2025-03-21
*/
@Service
public class MesLineAssistantQtyServiceImpl implements IMesLineAssistantQtyService {
@Autowired
private MesLineAssistantQtyMapper mesLineAssistantQtyMapper;
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public MesLineAssistantQty selectMesLineAssistantQtyById(String id) {
return mesLineAssistantQtyMapper.selectMesLineAssistantQtyById(id);
}
/**
*
*
* @param mesLineAssistantQty
* @return
*/
@Override
@DS("#header.poolName")
public List<MesLineAssistantQty> selectMesLineAssistantQtyList(MesLineAssistantQty mesLineAssistantQty) {
return mesLineAssistantQtyMapper.selectMesLineAssistantQtyList(mesLineAssistantQty);
}
/**
*
*
* @param mesLineAssistantQty
* @return
*/
@Override
@DS("#header.poolName")
public int insertMesLineAssistantQty(MesLineAssistantQty mesLineAssistantQty) {
mesLineAssistantQty.setCreateTime(DateUtils.getNowDate());
mesLineAssistantQty.setId(IdUtils.fastSimpleUUID());
mesLineAssistantQty.setCreateBy(SecurityContextHolder.getUserName());
//一个日期只能存一条
String dateStr = mesLineAssistantQtyMapper.getHasdate(mesLineAssistantQty);
if(StringUtils.isNotBlank(dateStr)){
return 0;
}
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
// String key = "#header.poolName";
// mesLineAssistantQty.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", ""));
return mesLineAssistantQtyMapper.insertMesLineAssistantQty(mesLineAssistantQty);
}
/**
*
*
* @param mesLineAssistantQty
* @return
*/
@Override
@DS("#header.poolName")
public int updateMesLineAssistantQty(MesLineAssistantQty mesLineAssistantQty) {
mesLineAssistantQty.setUpdateTime(DateUtils.getNowDate());
return mesLineAssistantQtyMapper.updateMesLineAssistantQty(mesLineAssistantQty);
}
/**
*
*
* @param ids
* @return
*/
@Override
@DS("#header.poolName")
public int deleteMesLineAssistantQtyByIds(String[] ids) {
return mesLineAssistantQtyMapper.deleteMesLineAssistantQtyByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public int deleteMesLineAssistantQtyById(String id) {
return mesLineAssistantQtyMapper.deleteMesLineAssistantQtyById(id);
}
/**辅助工时摊分方式**/
@Override
@DS("#header.poolName")
public List<MesLineAssistantQtyVo> selectEfficiencyHourList(MesLineAssistant mesLineAssistant) {
List<MesLineAssistantQtyVo> dtos = mesLineAssistantQtyMapper.selectEfficiencyHourList(mesLineAssistant);
if(CollectionUtils.isEmpty(dtos)){
return null;
}
Map<String,MesLineAssistantQty> assistMaps = mesLineAssistantQtyMapper.getAssistMaps(mesLineAssistant);
if(assistMaps.isEmpty()){
return dtos;
}
//班长10000150 车间组长10000168 物料员10000478 药管员10000271 配药员10000155
mesLineAssistant.setPostId("10000150");
BigDecimal monitorHour = mesLineAssistantQtyMapper.getKqHourMaps(mesLineAssistant);
mesLineAssistant.setPostId("10000168");
BigDecimal groupleadeHour = mesLineAssistantQtyMapper.getKqHourMaps(mesLineAssistant);
mesLineAssistant.setPostId("10000478");
BigDecimal materialHour= mesLineAssistantQtyMapper.getKqHourMaps(mesLineAssistant);
mesLineAssistant.setPostId("10000271");
BigDecimal pillMgrHour = mesLineAssistantQtyMapper.getKqHourMaps(mesLineAssistant);
mesLineAssistant.setPostId("10000155");
BigDecimal pillDisHour = mesLineAssistantQtyMapper.getKqHourMaps(mesLineAssistant);
BigDecimal allProHours = BigDecimal.ZERO;
for(MesLineAssistantQtyVo assistdto:dtos){
//产品工时(用母单的)
BigDecimal hours = mesLineAssistantQtyMapper.getHoursByOrderCode(assistdto.getWorkorderCode());
hours = hours==null?BigDecimal.ZERO:hours;
assistdto.setProductHour(hours.toString());
allProHours = allProHours.add(hours);
if(!assistMaps.isEmpty()){
MesLineAssistantQty manQty = assistMaps.get(mesLineAssistant.getProductDateStr());
if(manQty!=null){
//班长用人=当日人数/线体数
assistdto.setMonitorQty(new BigDecimal(manQty.getMonitorQty())
.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP)
.toString()
);
//班长工时=当日考勤小时数/线体数
assistdto.setMonitorHour(
monitorHour.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP).toString());
//组长用人=当日人数/线体数
assistdto.setGroupleaderQty(new BigDecimal(manQty.getGroupleaderQty())
.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP)
.toString()
);
//组长工时=当日考勤小时数/线体数
assistdto.setGroupLeaderHour(
groupleadeHour.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP).toString());
//物料员用人=当日人数/线体数
assistdto.setMaterialQty(new BigDecimal(manQty.getMaterialQty())
.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP)
.toString()
);
//物料员工时=当日考勤小时数/线体数
assistdto.setMaterialHour(
materialHour.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP).toString());
//药管员用人=当日人数/线体数
assistdto.setPillMgrQty(new BigDecimal(manQty.getPillMgrQty())
.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP)
.toString()
);
//药管员工时=当日考勤小时数/线体数
assistdto.setPillMgrHour(
pillMgrHour.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP).toString());
//配药员用人=当日人数/线体数
assistdto.setPillDisQty(new BigDecimal(manQty.getPillDisQty())
.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP)
.toString()
);
//配药员工时=当日考勤小时数/线体数
assistdto.setPillDisHour(
pillDisHour.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP).toString());
}
}
}
for(MesLineAssistantQtyVo assistdto:dtos){
//工时占比
assistdto.setHourRatio(new BigDecimal(assistdto.getProductHour())
.multiply(new BigDecimal("100.00"))
.divide(allProHours,2,BigDecimal.ROUND_HALF_UP)
.toString()+"%"
);
//辅助工时合计
assistdto.setMonitorHour(StringUtils.isEmpty(assistdto.getMonitorHour())?"0":assistdto.getMonitorHour());
assistdto.setGroupLeaderHour(StringUtils.isEmpty(assistdto.getGroupLeaderHour())?"0":assistdto.getGroupLeaderHour());
assistdto.setMaterialHour(StringUtils.isEmpty(assistdto.getMaterialHour())?"0":assistdto.getMaterialHour());
assistdto.setPillMgrHour(StringUtils.isEmpty(assistdto.getPillMgrHour())?"0":assistdto.getPillMgrHour());
assistdto.setPillDisHour(StringUtils.isEmpty(assistdto.getPillDisHour())?"0":assistdto.getPillDisHour());
assistdto.setAssistHourSum(
new BigDecimal(assistdto.getMonitorHour())
.add(new BigDecimal(assistdto.getGroupLeaderHour()))
.add(new BigDecimal(assistdto.getMaterialHour()))
.add(new BigDecimal(assistdto.getPillMgrHour()))
.add(new BigDecimal(assistdto.getPillDisHour()))
.toString()
);
}
MesLineAssistantQtyVo assistdto0 = new MesLineAssistantQtyVo();
//assistdto0.setProductDate(dtos.get(0).getProductDate());
//assistdto0.setFactoryCode(dtos.get(0).getFactoryCode());
//assistdto0.setCarCode(dtos.get(0).getCarCode());
assistdto0.setLineCode(dtos.size()+"");
assistdto0.setProductName(dtos.size()+"");
assistdto0.setProductHour(allProHours.toString());
assistdto0.setHourRatio("100%");
assistdto0.setAssistHourSum(
monitorHour.add(groupleadeHour).add(materialHour).add(pillMgrHour).add(pillDisHour).toString()
);
MesLineAssistantQty manQty = assistMaps.get(mesLineAssistant.getProductDateStr());
assistdto0.setMonitorQty(manQty.getMonitorQty().toString());
assistdto0.setMonitorHour(monitorHour.toString());
assistdto0.setGroupleaderQty(manQty.getGroupleaderQty().toString());
assistdto0.setGroupLeaderHour(groupleadeHour.toString());
assistdto0.setMaterialQty(manQty.getMaterialQty().toString());
assistdto0.setMaterialHour(materialHour.toString());
assistdto0.setPillMgrQty(manQty.getPillMgrQty().toString());
assistdto0.setPillMgrHour(pillMgrHour.toString());
assistdto0.setPillDisQty(manQty.getPillDisQty().toString());
assistdto0.setPillDisHour(pillDisHour.toString());
dtos.add(assistdto0);
return dtos;
}
/**生产日效率报表**/
@Override
@DS("#header.poolName")
public List<MesDailyEfficiencyVo> selectEfficiencyDayList(MesLineAssistant mesLineAssistant) {
List<MesDailyEfficiencyVo> dtos = mesLineAssistantQtyMapper.selectEfficiencyDayList(mesLineAssistant);
if (CollectionUtils.isEmpty(dtos)) {
return null;
}
Map<String, MesLineAssistantQty> assistMaps = mesLineAssistantQtyMapper.getAssistMaps(mesLineAssistant);
if (assistMaps.isEmpty()) {
return dtos;
}
for(MesDailyEfficiencyVo effdto:dtos) {
//计划产量(件/PC用母单的
BigDecimal planQty = mesLineAssistantQtyMapper.getPlanQtyByOrderCode(effdto.getWorkorderCode());
effdto.setPlanQty(planQty.toString());
//实际产量(件)
BigDecimal actQty = mesLineAssistantQtyMapper.getActQtyByOrderCode(effdto.getWorkorderCode());
actQty = actQty==null?BigDecimal.ZERO:actQty;
effdto.setActQty(actQty.toString());
//实际产量PC=规格*实际产量(件)
effdto.setActQtySon(actQty.multiply(new BigDecimal(effdto.getSpec())).toString());
//产量达成率 = 实际产量(件)/计划产量(件/PC
effdto.setCompleteRate(
actQty.multiply(new BigDecimal("100"))
.divide(planQty,2,BigDecimal.ROUND_HALF_UP).toString());
//标准效率、标准用人、标准工时
MesLineProduct mesStandar = mesLineAssistantQtyMapper.getStandarInfo(effdto);
if(mesStandar != null){
/****************一线****************/
//一线标准效率PC/H
effdto.setStandEff(mesStandar.getHourEfficiency().toString());
//一线标准用人
effdto.setStandMan(mesStandar.getUseMan().toString());
//一线标准工时=实际产量PC/标准工艺效率PC/H
effdto.setStandHour(
new BigDecimal(effdto.getActQtySon())
.divide(mesStandar.getHourEfficiency(),2,BigDecimal.ROUND_HALF_UP).toString()
);
//一线实际用人(子单)
MesReportWork actManSon = mesLineAssistantQtyMapper.getSonActManByOrderCode(effdto.getWorkorderCode());
if(actManSon != null){
effdto.setActMan(actManSon.getUseMan().toString());
//一线实际工时(子单)
effdto.setActHour(actManSon.getWorkTime().toString());
//一线工时合计=实际用人*产品实际工时
effdto.setOneHourSum(
new BigDecimal(actManSon.getUseMan())
.multiply(actManSon.getWorkTime()).toString()
);
}
//一线标准效率=实际产量(件)/标准用人/产品标准工时
if(new BigDecimal(effdto.getStandMan()).compareTo(BigDecimal.ZERO)!=0
&&new BigDecimal(effdto.getStandHour()).compareTo(BigDecimal.ZERO)!=0){
effdto.setOneStandEff(actQty
.divide(new BigDecimal(effdto.getStandMan()),4,BigDecimal.ROUND_HALF_UP)
.divide(new BigDecimal(effdto.getStandHour()),2,BigDecimal.ROUND_HALF_UP)
.toString()
);
}else{
effdto.setOneStandEff("0");
}
//一线实际效率=实际产量(件)/一线工时合计
if(StringUtils.isNotBlank(effdto.getOneHourSum())&&
new BigDecimal(effdto.getOneHourSum()).compareTo(BigDecimal.ZERO) !=0){
effdto.setOneActEff(actQty.divide(new BigDecimal(effdto.getOneHourSum()),2,BigDecimal.ROUND_HALF_UP).toString());
}else{
effdto.setOneActEff("0");
}
//效率达成率=一线实际效率/一线标准效率
if(new BigDecimal(effdto.getOneStandEff().replace("%","")).compareTo(BigDecimal.ZERO)!=0){
effdto.setEffRate(
(new BigDecimal(effdto.getOneActEff().replace("%","")))
.multiply(new BigDecimal("100"))
.divide(new BigDecimal(effdto.getOneStandEff().replace("%","")),2,BigDecimal.ROUND_HALF_UP)
+"%"
);
}else{
effdto.setEffRate("0");
}
}
}
/****************辅助****************/
//班长10000150 车间组长10000168 物料员10000478 药管员10000271 配药员10000155
mesLineAssistant.setPostId("10000150");
BigDecimal monitorHour = mesLineAssistantQtyMapper.getKqHourMaps(mesLineAssistant);
mesLineAssistant.setPostId("10000168");
BigDecimal groupleadeHour = mesLineAssistantQtyMapper.getKqHourMaps(mesLineAssistant);
mesLineAssistant.setPostId("10000478");
BigDecimal materialHour= mesLineAssistantQtyMapper.getKqHourMaps(mesLineAssistant);
mesLineAssistant.setPostId("10000271");
BigDecimal pillMgrHour = mesLineAssistantQtyMapper.getKqHourMaps(mesLineAssistant);
mesLineAssistant.setPostId("10000155");
BigDecimal pillDisHour = mesLineAssistantQtyMapper.getKqHourMaps(mesLineAssistant);
//辅助用人合计
BigDecimal assisManSum = BigDecimal.ZERO;
//辅助工时合计
BigDecimal assisHourSum = BigDecimal.ZERO;
for(MesDailyEfficiencyVo effdto:dtos){
//产品工时(用母单的)
if(!assistMaps.isEmpty()){
MesLineAssistantQty manQty = assistMaps.get(mesLineAssistant.getProductDateStr());
if(manQty!=null){
//班长用人=当日人数/线体数
effdto.setMonitorQty(new BigDecimal(manQty.getMonitorQty())
.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP)
.toString()
);
assisManSum = assisManSum.add(new BigDecimal(effdto.getMonitorQty()));//DOSUM;
//班长工时=当日考勤小时数/线体数
effdto.setMonitorHour(
monitorHour.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP).toString());
assisHourSum = assisHourSum.add(new BigDecimal(effdto.getMonitorHour()));//DOSUM;
//组长用人=当日人数/线体数
effdto.setGroupleaderQty(new BigDecimal(manQty.getGroupleaderQty())
.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP)
.toString()
);
assisManSum = assisManSum.add(new BigDecimal(effdto.getGroupleaderQty()));//DOSUM;
//组长工时=当日考勤小时数/线体数
effdto.setGroupleaderHour(
groupleadeHour.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP).toString());
assisHourSum = assisHourSum.add(new BigDecimal(effdto.getGroupleaderHour()));//DOSUM;
//物料员用人=当日人数/线体数
effdto.setMaterialQty(new BigDecimal(manQty.getMaterialQty())
.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP)
.toString()
);
assisManSum = assisManSum.add(new BigDecimal(effdto.getMaterialQty()));//DOSUM;
//物料员工时=当日考勤小时数/线体数
effdto.setMaterialHour(
materialHour.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP).toString());
assisHourSum = assisHourSum.add(new BigDecimal(effdto.getMaterialHour()));//DOSUM;
//药管员用人=当日人数/线体数
effdto.setPillMgrQty(new BigDecimal(manQty.getPillMgrQty())
.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP)
.toString()
);
assisManSum = assisManSum.add(new BigDecimal(effdto.getPillMgrQty()));//DOSUM;
//药管员工时=当日考勤小时数/线体数
effdto.setPillMgrHour(
pillMgrHour.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP).toString());
assisHourSum = assisHourSum.add(new BigDecimal(effdto.getPillMgrHour()));//DOSUM;
//配药员用人=当日人数/线体数
effdto.setPillDisQty(new BigDecimal(manQty.getPillDisQty())
.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP)
.toString()
);
assisManSum = assisManSum.add(new BigDecimal(effdto.getPillDisQty()));//DOSUM;
//配药员工时=当日考勤小时数/线体数
effdto.setPillDisHour(
pillDisHour.divide(new BigDecimal(dtos.size()),2,BigDecimal.ROUND_HALF_UP).toString());
assisHourSum = assisHourSum.add(new BigDecimal(effdto.getPillDisHour()));//DOSUM;
//辅助用人合计
effdto.setAssisManSum(assisManSum.toString());
//辅助工时合计
effdto.setAssisHourSum(assisHourSum.toString());
/******************一线+辅助******************/
//总工时=一线合计工时+辅助工时合计
effdto.setOneHourSum(StringUtils.isEmpty(effdto.getOneHourSum())?"0":effdto.getOneHourSum());
effdto.setAssisHourSum(StringUtils.isEmpty(effdto.getAssisHourSum())?"0":effdto.getAssisHourSum());
effdto.setHourSum(new BigDecimal(effdto.getOneHourSum()).add(new BigDecimal(effdto.getAssisHourSum())).toString());
//目标效率=效率提升基数*(提升目标+1
effdto.setEffUpBase(StringUtils.isEmpty(effdto.getEffUpBase())?"0":effdto.getEffUpBase());
effdto.setUpGoal(StringUtils.isEmpty(effdto.getUpGoal())?"0":effdto.getUpGoal());
effdto.setGoalRate(new BigDecimal(effdto.getEffUpBase())
.multiply(new BigDecimal(effdto.getUpGoal()).add(new BigDecimal("1"))).toString());
//实际效率=实际产量(件)/总工时
if(new BigDecimal(effdto.getHourSum()).compareTo(BigDecimal.ZERO)!=0){
effdto.setActRate(new BigDecimal(effdto.getActQty())
.divide(new BigDecimal(effdto.getHourSum()),2,BigDecimal.ROUND_HALF_UP).toString());
}else{
effdto.setActRate("0");
}
//效率提升率=实际效率/效率提升基数-1
if(StringUtils.isNotBlank(effdto.getEffUpBase())&&
new BigDecimal(effdto.getEffUpBase()).compareTo(BigDecimal.ZERO)!=0
){
effdto.setEffUpRate(
new BigDecimal(effdto.getActRate())
.multiply(new BigDecimal("100"))
.divide(new BigDecimal(effdto.getEffUpBase()),2,BigDecimal.ROUND_HALF_UP)
.subtract(new BigDecimal("100"))+"%"
);
}
}
}
}
return dtos;
}
}

@ -0,0 +1,337 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.mes.mapper.MesLineAssistantQtyMapper">
<resultMap type="MesLineAssistantQty" id="MesLineAssistantQtyResult">
<result property="id" column="id"/>
<result property="factoryCode" column="factory_code"/>
<result property="productDate" column="product_date"/>
<result property="monitorQty" column="monitor_qty"/>
<result property="groupleaderQty" column="groupLeader_qty"/>
<result property="materialQty" column="material_qty"/>
<result property="pillMgrQty" column="pill_mgr_qty"/>
<result property="pillDisQty" column="pill_dis_qty"/>
<result property="attr1" column="attr1"/>
<result property="attr2" column="attr2"/>
<result property="attr3" column="attr3"/>
<result property="attr4" column="attr4"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectMesLineAssistantQtyVo">
select id, factory_code, product_date, monitor_qty, groupLeader_qty,
material_qty, pill_mgr_qty, pill_dis_qty, attr1, attr2, attr3, attr4, create_by,
create_time, update_by, update_time
from mes_line_assistant_qty
</sql>
<select id="selectMesLineAssistantQtyList" parameterType="MesLineAssistantQty" resultMap="MesLineAssistantQtyResult">
<include refid="selectMesLineAssistantQtyVo"/>
<where>
<if test="factoryCode != null ">
and factory_code = #{factoryCode}
</if>
<if test="productDate != null ">
and product_date = #{productDate}
</if>
<if test="monitorQty != null ">
and monitor_qty = #{monitorQty}
</if>
<if test="groupleaderQty != null ">
and groupLeader_qty = #{groupleaderQty}
</if>
<if test="materialQty != null ">
and material_qty = #{materialQty}
</if>
<if test="pillMgrQty != null ">
and pill_mgr_qty = #{pillMgrQty}
</if>
<if test="pillDisQty != null ">
and pill_dis_qty = #{pillDisQty}
</if>
<if test="attr1 != null and attr1 != ''">
and attr1 = #{attr1}
</if>
<if test="attr2 != null and attr2 != ''">
and attr2 = #{attr2}
</if>
<if test="attr3 != null and attr3 != ''">
and attr3 = #{attr3}
</if>
<if test="attr4 != null and attr4 != ''">
and attr4 = #{attr4}
</if>
</where>
order by create_time
</select>
<select id="selectMesLineAssistantQtyById" parameterType="String"
resultMap="MesLineAssistantQtyResult">
<include refid="selectMesLineAssistantQtyVo"/>
where id = #{id}
</select>
<select id="getHasdate" resultType="java.lang.String">
select product_date
from mes_line_assistant_qty
where product_date = #{productDate}
</select>
<select id="selectEfficiencyHourList" resultType="com.op.mes.domain.vo.MesLineAssistantQtyVo">
select pow.product_date productDate,
'小榄' factoryCode,
be.department carCode,
be.sap_code lineCode,
pow.product_name productName,
pow.workorder_code workorderCode
from pro_order_workorder pow
left join base_equipment be on be.equipment_code = pow.workorder_name
where pow.parent_order = '0'
and pow.del_flag = '0'
<if test="productDateStr != null">
and pow.product_date = #{productDateStr}
</if>
<if test="carCode != null">
and be.department like concat('%',#{carCode},'%')
</if>
<if test="lineCode != null">
and be.sap_code like concat('%',#{lineCode},'%')
</if>
<if test="productName != null">
and pow.product_name like concat('%',#{productName},'%')
</if>
and pow.workorder_name is not null and pow.status in('w3','w4')
</select>
<select id="getHoursByOrderCode" resultType="java.math.BigDecimal">
select sum(work_time) from mes_report_work
where workorder_code = #{workorderCode}
and del_flag ='0' and parent_order = '0'
</select>
<select id="getAssistMaps" resultType="com.op.mes.domain.MesLineAssistantQty">
select
product_date productDateStr,
monitor_qty monitorQty,
groupLeader_qty groupLeaderQty,
material_qty materialQty,
pill_mgr_qty pillMgrQty,
pill_dis_qty pillDisQty
from mes_line_assistant_qty
where product_date = #{productDateStr}
</select>
<select id="getKqHourMaps" resultType="java.math.BigDecimal">
select sum(
case when DATEDIFF ( hour , stime.time0 , etime.time0 ) is null then '0'
else DATEDIFF ( hour , stime.time0 , etime.time0 ) end) productHour
from lanju_op_cloud.dbo.sys_user su
left join lanju_op_cloud.dbo.sys_user_post sup on su.user_id = sup.user_id
left join (
select min(clock_time) time0,workno from mes_clock_record where convert(char(10),clock_time,120) = #{productDateStr} GROUP BY workno
) stime on stime.workno = su.user_name
left join (
select max(clock_time) time0,workno from mes_clock_record where convert(char(10),clock_time,120) = #{productDateStr} GROUP BY workno
) etime on etime.workno = su.user_name
where su.del_flag = '0' and sup.post_id = #{postId}
</select>
<select id="selectEfficiencyDayList" resultType="com.op.mes.domain.vo.MesDailyEfficiencyVo">
select pow.product_date productDate,
'小榄' factoryCode,
be.department carCode,
be.sap_code lineCode,
bpa.category,
pow.product_code productCode,
pow.product_name productName,
bp.umrez spec,
'件' unit,
pow.workorder_code workorderCode,
sdd.remark effUpBase,
sdd2.dict_value upGoal
from pro_order_workorder pow
left join base_equipment be on be.equipment_code = pow.workorder_name
left join base_product bp on bp.product_code = pow.product_code
left join base_product_attached bpa on concat('0000000',bpa.product_code) = pow.product_code
left join lanju_op_cloud.dbo.sys_dict_data sdd on sdd.dict_label = bpa.category and sdd.dict_type = 'sys_category'
left join base_dict_data sdd2 on sdd2.dict_label = convert(char(4),pow.product_date,120) and sdd2.dict_type = 'year_goal'
where pow.parent_order = '0'
and pow.del_flag = '0'
<if test="productDateStr != null">
and pow.product_date = #{productDateStr}
</if>
<if test="carCode != null">
and be.department like concat('%',#{carCode},'%')
</if>
<if test="lineCode != null">
and be.sap_code like concat('%',#{lineCode},'%')
</if>
<if test="productName != null">
and pow.product_name like concat('%',#{productName},'%')
</if>
and pow.workorder_name is not null and pow.status in('w3','w4')
</select>
<select id="getPlanQtyByOrderCode" resultType="java.math.BigDecimal">
select sum(quantity_split) from pro_order_workorder
where workorder_code = #{workorderCode}
and del_flag ='0' and parent_order = '0'
</select>
<select id="getActQtyByOrderCode" resultType="java.math.BigDecimal">
select sum(quantity_feedback) from mes_report_work
where workorder_code = #{workorderCode}
and del_flag ='0' and parent_order = '0'
</select>
<select id="getStandarInfo" resultType="com.op.mes.domain.MesLineProduct">
SELECT
mlp.hour_efficiency hourEfficiency,
mlp.use_man useMan
FROM
mes_line_product mlp
left join base_equipment be on mlp.line_code = be.equipment_code
WHERE
mlp.product_code = #{productCode}
AND be.sap_code = #{lineCode}
AND mlp.del_flag = '0'
</select>
<select id="getSonActManByOrderCode" resultType="com.op.mes.domain.MesReportWork">
select use_man useMan,
sum(work_time) workTime
from mes_report_work
where del_flag ='0' and parent_order = #{workorderCode}
group by use_man
</select>
<insert id="insertMesLineAssistantQty" parameterType="MesLineAssistantQty">
insert into mes_line_assistant_qty
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,
</if>
<if test="factoryCode != null">factory_code,
</if>
<if test="productDate != null">product_date,
</if>
<if test="monitorQty != null">monitor_qty,
</if>
<if test="groupleaderQty != null">groupLeader_qty,
</if>
<if test="materialQty != null">material_qty,
</if>
<if test="pillMgrQty != null">pill_mgr_qty,
</if>
<if test="pillDisQty != null">pill_dis_qty,
</if>
<if test="attr1 != null">attr1,
</if>
<if test="attr2 != null">attr2,
</if>
<if test="attr3 != null">attr3,
</if>
<if test="attr4 != null">attr4,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},
</if>
<if test="factoryCode != null">#{factoryCode},
</if>
<if test="productDate != null">#{productDate},
</if>
<if test="monitorQty != null">#{monitorQty},
</if>
<if test="groupleaderQty != null">#{groupleaderQty},
</if>
<if test="materialQty != null">#{materialQty},
</if>
<if test="pillMgrQty != null">#{pillMgrQty},
</if>
<if test="pillDisQty != null">#{pillDisQty},
</if>
<if test="attr1 != null">#{attr1},
</if>
<if test="attr2 != null">#{attr2},
</if>
<if test="attr3 != null">#{attr3},
</if>
<if test="attr4 != null">#{attr4},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updateMesLineAssistantQty" parameterType="MesLineAssistantQty">
update mes_line_assistant_qty
<trim prefix="SET" suffixOverrides=",">
<if test="factoryCode != null">factory_code =
#{factoryCode},
</if>
<if test="productDate != null">product_date =
#{productDate},
</if>
<if test="monitorQty != null">monitor_qty =
#{monitorQty},
</if>
<if test="groupleaderQty != null">groupLeader_qty =
#{groupleaderQty},
</if>
<if test="materialQty != null">material_qty =
#{materialQty},
</if>
<if test="pillMgrQty != null">pill_mgr_qty =
#{pillMgrQty},
</if>
<if test="pillDisQty != null">pill_dis_qty =
#{pillDisQty},
</if>
<if test="attr1 != null">attr1 =
#{attr1},
</if>
<if test="attr2 != null">attr2 =
#{attr2},
</if>
<if test="attr3 != null">attr3 =
#{attr3},
</if>
<if test="attr4 != null">attr4 =
#{attr4},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMesLineAssistantQtyById" parameterType="String">
delete from mes_line_assistant_qty where id = #{id}
</delete>
<delete id="deleteMesLineAssistantQtyByIds" parameterType="String">
delete from mes_line_assistant_qty where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -130,7 +130,7 @@ public class QcCheckTaskInventoryServiceImpl implements IQcCheckTaskInventorySer
@Override
@DS("#header.poolName")
public int insertQcCheckTaskInventory(QcCheckTaskInventory qcCheckTaskInventory) {
logger.info("库存检验任务创建参数:"+JSONObject.toJSONString(qcCheckTaskInventory));
//logger.info("库存检验任务创建参数:"+JSONObject.toJSONString(qcCheckTaskInventory));
String factoryCode = "";
if (StringUtils.isNotBlank(qcCheckTaskInventory.getFactoryCode())) {
DynamicDataSourceContextHolder.push("ds_" + qcCheckTaskInventory.getFactoryCode());
@ -433,7 +433,7 @@ public class QcCheckTaskInventoryServiceImpl implements IQcCheckTaskInventorySer
dto.setCreateBy(dto.getApplicant());//创建人
qcCheckTaskInventoryMapper.insertQcCheckOaTask(dto);
logger.info("++++++++++++oa发起仓库检验任务生成" + m + "++++++++++++++");
//logger.info("++++++++++++oa发起仓库检验任务生成" + m + "++++++++++++++");
return success();
}
@ -449,9 +449,9 @@ public class QcCheckTaskInventoryServiceImpl implements IQcCheckTaskInventorySer
ccTask.setCheckType("checkTypeCC");//库存检验
ccTask.setFactoryCode(poolName.replace("ds_",""));
int m = insertQcCheckTaskInventory(ccTask);
logger.info("++++++++++++仓库检验任务生成" + m + "++++++++++++++");
//logger.info("++++++++++++仓库检验任务生成" + m + "++++++++++++++");
}
logger.info("++++++++++++" + poolName + "++++仓库检验任务结束++++++++++");
//logger.info("++++++++++++" + poolName + "++++仓库检验任务结束++++++++++");
}
}

Loading…
Cancel
Save