diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkController.java index 9cc450ff..542aefee 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkController.java @@ -1,10 +1,12 @@ package com.op.mes.controller; import java.io.IOException; + import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; +import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.*; import javax.annotation.Resource; @@ -17,6 +19,7 @@ import com.op.common.core.domain.ExcelCol; import com.op.common.core.domain.R; import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.bean.BeanUtils; + import com.op.common.core.utils.poi.ExcelMapUtil; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.datasource.creator.DynamicDatasourceCreator; @@ -52,6 +55,9 @@ import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.utils.poi.ExcelUtil; import com.op.common.core.web.page.TableDataInfo; import com.op.common.core.utils.poi.ExcelUtilDailyReport; + +import static com.op.common.core.utils.poi.ExcelUtil.exportToExcel; + /** * 报工报表Controller * @@ -651,6 +657,62 @@ public class MesReportWorkController extends BaseController { Map resultMap = mesReportWorkService.getmonthProductionSut(mesMonthReportVo); return success(resultMap); } + + /** + * 黑蚊香车间月度汇总表 + * @param response + * @param mesMonthReportVo + */ + @Log(title = "黑蚊香车间月度汇总表", businessType = BusinessType.EXPORT) + @PostMapping("/getmonthProductionSut/export") + public void export(HttpServletResponse response, MesMonthReportVo mesMonthReportVo) throws Exception { + SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd"); + Date today = mesMonthReportVo.getMonthValue(); + // 设置日历到本月1号 + Calendar calendar = Calendar.getInstance(); + calendar.setTime(today); + calendar.set(Calendar.DAY_OF_MONTH, 1); + String beginTime = simpleDateFormat.format(mesMonthReportVo.getMonthValue()); + // 设置日历到下个月1号 + calendar.add(Calendar.MONTH, 1); + String endTime = simpleDateFormat.format(calendar.getTime()); + Map parammap =new HashMap(); + parammap.put("beginTime",beginTime); + parammap.put("endTime",endTime); + mesMonthReportVo.setParams(parammap); + Map> resultMap = mesReportWorkService.getmonthProductionSut(mesMonthReportVo); + + List dates = getDatesOfMonth(today); + for (String date : dates) { + System.out.println(date); + } + } + + public static List getDatesOfMonth(java.util.Date monthValue) { + // 将 java.util.Date 转换为 LocalDate + LocalDate localDate = monthValue.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + + // 获取本月的第一天和最后一天 + LocalDate firstDayOfMonth = localDate.withDayOfMonth(1); + LocalDate lastDayOfMonth = localDate.withDayOfMonth(localDate.lengthOfMonth()); + + // 创建一个列表来存储日期 + List dates = new ArrayList<>(); + + // 循环从本月1号到本月最后一天 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + LocalDate date = firstDayOfMonth; + while (!date.isAfter(lastDayOfMonth)) { + // 按照指定格式添加到列表中 + dates.add(date.format(formatter)); + date = date.plusDays(1); + } + + return dates; + } + + + } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesUnitPriceReportController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesUnitPriceReportController.java index a8d917c7..f960cbbd 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesUnitPriceReportController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesUnitPriceReportController.java @@ -65,48 +65,39 @@ public class MesUnitPriceReportController extends BaseController { } /** - * 获取计件工资统计详细信息 + * 获取【计件工资统计】详细信息 */ @RequiresPermissions("unitPriceReport:report:query") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") String id) { - - MesUnitpriceReport mup=mesUnitpriceReportService.selectMesUnitpriceReportById(id); - MesUnitPrice mesUnitPrice=new MesUnitPrice(); - mesUnitPrice.setProductCode(mup.getProductCode().substring(mup.getProductCode().length() - 11)); - mesUnitPrice.setLineCode(mup.getLineCode()); - List list = mesUnitPriceService.selectMesUnitPriceList(mesUnitPrice); - Map map=new HashMap(); - map.put("MesUnitpriceReport",mup); - map.put("MesUnitPriceInfo",list); - return success(map); + return success(mesUnitpriceReportService.selectMesUnitpriceReportById(id)); } /** - * 新增计件工资统计 + * 新增【计件工资统计】 */ @RequiresPermissions("unitPriceReport:report:add") - @Log(title = "计件工资统计", businessType = BusinessType.INSERT) + @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody MesUnitpriceReport mesUnitpriceReport) { return toAjax(mesUnitpriceReportService.insertMesUnitpriceReport(mesUnitpriceReport)); } /** - * 修改计件工资统计 + * 修改【计件工资统计】 */ @RequiresPermissions("unitPriceReport:report:edit") - @Log(title = "计件工资统计", businessType = BusinessType.UPDATE) + @Log(title = "【计件工资统计】", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody MesUnitpriceReport mesUnitpriceReport) { return toAjax(mesUnitpriceReportService.updateMesUnitpriceReport(mesUnitpriceReport)); } /** - * 删除计件工资统计 + * 删除【计件工资统计】 */ @RequiresPermissions("unitPriceReport:report:remove") - @Log(title = "计件工资统计", businessType = BusinessType.DELETE) + @Log(title = "【计件工资统计】", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable String[] ids) { return toAjax(mesUnitpriceReportService.deleteMesUnitpriceReportByIds(ids)); diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesUnitPrice.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesUnitPrice.java index 76a87c98..e84c274b 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesUnitPrice.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesUnitPrice.java @@ -4,7 +4,7 @@ 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; -import org.apache.poi.hpsf.Decimal; + import java.math.BigDecimal; @@ -26,7 +26,7 @@ public class MesUnitPrice extends BaseEntity { * 工厂 */ @Excel(name = "工厂") - private Integer factoryId; + private String factoryId; /** * 物料码 @@ -102,11 +102,11 @@ public class MesUnitPrice extends BaseEntity { return picId; } - public void setFactoryId(Integer factoryId) { + public void setFactoryId(String factoryId) { this.factoryId = factoryId; } - public Integer getFactoryId() { + public String getFactoryId() { return factoryId; } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesUnitpriceReport.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesUnitpriceReport.java index 132bb19a..e0da23f5 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesUnitpriceReport.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesUnitpriceReport.java @@ -1,11 +1,13 @@ package com.op.mes.domain; +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; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.Date; /** @@ -25,14 +27,22 @@ public class MesUnitpriceReport extends BaseEntity { /** * 工单编码 */ - @Excel(name = "工单编码") + @Excel(name = "工单号") private String workorderCode; + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "工单生产日期", width = 30, dateFormat = "yyyy-MM-dd", sort = 1) + private Date workOrderProductDate; + /** * SAP订单编码 */ + @Excel(name = "SAP订单编码") private String workorderCodeSap; + + + /** * 产品编号 */ @@ -44,45 +54,92 @@ public class MesUnitpriceReport extends BaseEntity { @Excel(name = "产品名称") private String productName; - +// @Excel(name = "产线编码") +// private String sapCode; @Excel(name = "产线编码") private String lineCode; - @Excel(name = "SAP产线编码") - private String sapCode; + @Excel(name = "产线名称") private String equipmentName; + + + /** + * 工号 + */ + @Excel(name = "工号") + private String userName; /** * 用户昵称 */ @Excel(name = "操作者") private String nickName; + + @Excel(name = "岗位") + private String post; + /** * 子工序名称 */ @Excel(name = "子工序名称") private String childprocessName; + + /** + * 当日工单报工总数 + */ + @Excel(name = "当日工单报工总数") + private String orderQuantityP; + /** + * 规格 + */ + @Excel(name = "规格") + private String umrez; + + + /** + * 全组数量 + */ + @Excel(name = "全组数量") + private String orderQuantity; + @Excel(name = "工序单价") private String attr1; - @Excel(name = "件数") + + @Excel(name = "个人产量") private String totalQuantity; - @Excel(name = " 薪酬(元)") + @Excel(name = " 计件薪酬(元)") private BigDecimal result; - @Excel(name = "人数") - private String headCount; - // @Excel(name = "平均工资") - private String avgResult; - @Excel(name = "工时工资") - private String realWages; - - /** - * 用户账号 - */ - // @Excel(name = "用户账号") - private String userName; + @Excel(name = "工时") + private String attr2; + @Excel(name = "扣款") + private BigDecimal kk; + @Excel(name = "保底") + private BigDecimal bd; + @Excel(name = "转岗") + private BigDecimal zg; + @Excel(name = "返工") + private BigDecimal fg; + @Excel(name = "试产") + private BigDecimal sc; + @Excel(name = "试机") + private BigDecimal sj; + @Excel(name = "特殊费用") + private BigDecimal tsfy; + @Excel(name = "夜班补贴") + private BigDecimal ybbt; + @Excel(name = "协产补贴") + private BigDecimal xcbt; + @Excel(name = "合计") + private BigDecimal hj; +// @Excel(name = "人数") +// private String headCount; + // @Excel(name = "平均工资") +// private String avgResult; + @Excel(name = "工时工资") + private String realWages; /** * 子工序编码 @@ -96,45 +153,176 @@ public class MesUnitpriceReport extends BaseEntity { */ + public BigDecimal getKk() { + return kk; + } + + public void setKk(BigDecimal kk) { + this.kk = kk; + } + + public BigDecimal getBd() { + return bd; + } + + public void setBd(BigDecimal bd) { + this.bd = bd; + } + + public BigDecimal getZg() { + return zg; + } + + public void setZg(BigDecimal zg) { + this.zg = zg; + } + + public BigDecimal getFg() { + return fg; + } + + public void setFg(BigDecimal fg) { + this.fg = fg; + } + + public BigDecimal getSc() { + return sc; + } + + public void setSc(BigDecimal sc) { + this.sc = sc; + } + + public BigDecimal getSj() { + return sj; + } + + public void setSj(BigDecimal sj) { + this.sj = sj; + } + + public BigDecimal getTsfy() { + return tsfy; + } + + public void setTsfy(BigDecimal tsfy) { + this.tsfy = tsfy; + } + + public BigDecimal getYbbt() { + return ybbt; + } + + public void setYbbt(BigDecimal ybbt) { + this.ybbt = ybbt; + } + + public BigDecimal getXcbt() { + return xcbt; + } + + public void setXcbt(BigDecimal xcbt) { + this.xcbt = xcbt; + } + + public BigDecimal getHj() { + return hj; + } + + public void setHj(BigDecimal hj) { + this.hj = hj; + } + /** * $column.columnComment */ // @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") - @Excel(name = "工时") - private String attr2; - public String getSapCode() { - return sapCode; + + + + + public Date getWorkOrderProductDate() { + return workOrderProductDate; } - public void setSapCode(String sapCode) { - this.sapCode = sapCode; + public void setWorkOrderProductDate(Date workOrderProductDate) { + this.workOrderProductDate = workOrderProductDate; } - public String getRealWages() { - return realWages; + public String getUmrez() { + return umrez; } - public void setRealWages(String realWages) { - this.realWages = realWages; + public void setUmrez(String umrez) { + this.umrez = umrez; + } + + public String getOrderQuantityP() { + return orderQuantityP; + } + + public void setOrderQuantityP(String orderQuantityP) { + this.orderQuantityP = orderQuantityP; + } + + public String getOrderQuantity() { + return orderQuantity; + } + + public void setOrderQuantity(String orderQuantity) { + this.orderQuantity = orderQuantity; } - public String getHeadCount() { - return headCount; + public String getPost() { + return post; } - public void setHeadCount(String headCount) { - this.headCount = headCount; + public void setPost(String post) { + this.post = post; } - public String getAvgResult() { - return avgResult; +// public String getSapCode() { +// return sapCode; +// } +// +// public void setSapCode(String sapCode) { +// this.sapCode = sapCode; +// } + + public String getRealWages() { + if (realWages == null) { + return null; + } + try { + BigDecimal bd = new BigDecimal(realWages); + bd = bd.setScale(2, RoundingMode.HALF_UP); // 四舍五入保留两位小数 + return bd.toString(); + } catch (NumberFormatException e) { + return realWages; // 如果 realWages 不是一个有效的数字,直接返回原始值 + } } - public void setAvgResult(String avgResult) { - this.avgResult = avgResult; + public void setRealWages(String realWages) { + this.realWages = realWages; } +// public String getHeadCount() { +// return headCount; +// } +// +// public void setHeadCount(String headCount) { +// this.headCount = headCount; +// } +// +// public String getAvgResult() { +// return avgResult; +// } +// +// public void setAvgResult(String avgResult) { +// this.avgResult = avgResult; +// } + public BigDecimal getResult() { return result; diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/MesMonthReportVo.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/MesMonthReportVo.java index d1dc40c6..9ac73264 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/MesMonthReportVo.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/MesMonthReportVo.java @@ -1,15 +1,74 @@ 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 javax.xml.crypto.Data; +import java.lang.reflect.Field; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; import java.util.Date; +import java.util.List; public class MesMonthReportVo extends BaseEntity { @JsonFormat(pattern = "yyyy-MM") private Date monthValue; + @Excel(name = "产线") + private String equipment_name; + @Excel(name = "类别") + private String category; + @Excel(name = "当月汇总") + private String total_monthly_summary; + + // 动态生成的日期字段 + private List dynamicDates; + + + // 生成当月1号到31号的日期列表,格式为 yyyy-MM-dd + private List generateDynamicDates() { + List dates = new ArrayList<>(); + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.DAY_OF_MONTH, 1); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + int month = calendar.get(Calendar.MONTH); + while (calendar.get(Calendar.MONTH) == month) { + dates.add(dateFormat.format(calendar.getTime())); + calendar.add(Calendar.DAY_OF_MONTH, 1); + } + return dates; + } + + + + + public String getEquipment_name() { + return equipment_name; + } + + public void setEquipment_name(String equipment_name) { + this.equipment_name = equipment_name; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getTotal_monthly_summary() { + return total_monthly_summary; + } + + public void setTotal_monthly_summary(String total_monthly_summary) { + this.total_monthly_summary = total_monthly_summary; + } + public Date getMonthValue() { return monthValue; } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java index b1cff1c3..4c6bc814 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java @@ -12,8 +12,8 @@ import java.util.stream.Collectors; import com.alibaba.csp.sentinel.util.StringUtil; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; +import com.alibaba.nacos.shaded.com.google.common.collect.Lists; import com.baomidou.dynamic.datasource.annotation.DS; -import com.google.common.collect.Lists; import com.op.common.core.domain.R; import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.ServletUtils; diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesUnitPriceServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesUnitPriceServiceImpl.java index 47b8c2d1..df1e3f5b 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesUnitPriceServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesUnitPriceServiceImpl.java @@ -60,7 +60,6 @@ public class MesUnitPriceServiceImpl implements IMesUnitPriceService { @Override @DS("#header.poolName") public List selectMesUnitPriceList(MesUnitPrice mesUnitPrice) { - mesUnitPrice.setCreateBy(SecurityUtils.getUsername()); return mesUnitPriceMapper.selectMesUnitPriceList(mesUnitPrice); } @@ -144,7 +143,7 @@ public class MesUnitPriceServiceImpl implements IMesUnitPriceService { } } else { failureNum++; - failureMsg.append("
" + failureNum + "、产品 " + mesUnitPrice.getProductName() + " 已存在"); + failureMsg.append("
" + failureNum + "、产品 " + mesUnitPrice.getProductName() + "的工序"+mesUnitPrice.getChildprocessName()+" 已存在"); } } catch (Exception e) { failureNum++; diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesUnitpriceReportMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesUnitpriceReportMapper.xml index e9e42c62..e6ea172e 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesUnitpriceReportMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesUnitpriceReportMapper.xml @@ -8,6 +8,7 @@ + @@ -15,6 +16,7 @@ + @@ -30,10 +32,23 @@ + + + + + + + + + + + + + - select id, workorder_code, workorder_code_sap, product_name, product_code, user_name, nick_name, childprocess_code, childprocess_name, attr1, attr2, attr3, create_by, create_time, update_by, update_time, remark from mes_unitprice_report + select id, workorder_code, workorder_code_sap, product_name, product_code, user_name, nick_name, childprocess_code, childprocess_name, attr1, attr2, attr3,kk,bd,zg,fg,sc,sj,tsfy,ybbt,xcbt,create_by, create_time, update_by, update_time, remark from mes_unitprice_report @@ -170,11 +228,23 @@ - childprocess_code = #{childprocessCode}, - childprocess_name = #{childprocessName}, + + attr1 = #{attr1}, attr2 = #{attr2}, attr3 = #{attr3}, + + bd = #{bd}, + kk = #{kk}, + zg = #{zg}, + + fg = #{fg}, + sc = #{sc}, + sj = #{sj}, + + tsfy = #{tsfy}, + ybbt = #{ybbt}, + xcbt = #{xcbt}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy},