0826-需求变更问题修改

This commit is contained in:
2025-08-26 10:25:45 +08:00
parent c320999eba
commit 7ab70d6ba1
10 changed files with 82 additions and 15 deletions

View File

@@ -55,7 +55,15 @@ public class ProMonthReportServiceImpl extends ServiceImpl<ProMonthReportMapper,
report.setGas(consumeReport.getGas());
report.setGasProduce(consumeReport.getGasProduce());
report.setPower(consumeReport.getPower());
// report.setPowerProduce(consumeReport.getPowerProduce());
if (report.getPower() != null
&& report.getPower().compareTo(new BigDecimal(0)) > 0
&& report.getProductQuantity() != null
&& report.getProductQuantity().compareTo(new BigDecimal(0)) > 0
&& report.getMachineShopPower() !=null
&& report.getMachineShopPower().compareTo(new BigDecimal(0)) > 0) {
BigDecimal produce = (report.getPower().add(report.getMachinePower())).divide(report.getProductQuantity(), 4, BigDecimal.ROUND_HALF_UP);
report.setPowerProduce(produce);
}
report.setXSale(saleReport.getXSale());
report.setXdSale(saleReport.getXdSale());
this.saveOrUpdate(report);

View File

@@ -7,11 +7,16 @@ import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils;
import com.ktg.mes.pro.domain.ProPowerConsume;
import com.ktg.mes.pro.mapper.ProPowerConsumeMapper;
import com.ktg.mes.pro.service.IProMonthReportService;
import com.ktg.mes.pro.service.IProPowerConsumeService;
import com.ktg.mes.pro.service.IProYearReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.Year;
import java.time.YearMonth;
import java.util.List;
/**
@@ -23,6 +28,11 @@ import java.util.List;
@Service
public class ProPowerConsumeServiceImpl extends ServiceImpl<ProPowerConsumeMapper, ProPowerConsume> implements IProPowerConsumeService {
@Autowired
private IProMonthReportService proMonthReportService;
@Autowired
private IProYearReportService proYearReportService;
@Override
public List<ProPowerConsume> getPageList(ProPowerConsume proPowerConsume) {
LambdaQueryWrapper<ProPowerConsume> lqw = new LambdaQueryWrapper<>();
@@ -89,5 +99,7 @@ public class ProPowerConsumeServiceImpl extends ServiceImpl<ProPowerConsumeMappe
powerConsume.setPowerUsed(southPower.add(northPower));
}
this.updateById(powerConsume);
proMonthReportService.computeReport(YearMonth.now());
proYearReportService.computeReport(Year.now());
}
}

View File

@@ -40,21 +40,21 @@ public class ProConsumeTask {
@Autowired
private IProYearReportService proYearReportService;
// @PostConstruct
// public void init() {
// run();
// }
// 任务处理入口每日23点生成当天记录
@Scheduled(cron = "0 0 23 * * ?")
public void run1() {
proMonthReportService.computeReport(YearMonth.now());
proYearReportService.computeReport(Year.now());
}
// 任务处理入口每日0点生成当天记录
@Scheduled(cron = "1 0 0 * * ?")
// @Scheduled(cron = "* 0/1 * * * ?")
public void run() {
public void run2() {
Date now = DateUtils.getNowDate();
genPower(now);
genGas(now);
genMeterial(now);
proMonthReportService.computeReport(YearMonth.now());
proYearReportService.computeReport(Year.now());
}
private void genPower(Date now) {

View File

@@ -36,6 +36,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -87,6 +88,14 @@ public class WmIssueHeaderController extends BaseController
public void export(HttpServletResponse response, WmIssueHeader wmIssueHeader)
{
List<WmIssueHeaderExportVo> list = wmIssueHeaderService.selectWmIssueHeaderListForExport(wmIssueHeader);
WmIssueHeaderExportVo sum = new WmIssueHeaderExportVo();
sum.setItemCode("合计");
sum.setQuantityIssued(new BigDecimal(0));
for(WmIssueHeaderExportVo vo : list){
if (vo.getQuantityIssued() != null)
sum.setQuantityIssued(sum.getQuantityIssued().add(vo.getQuantityIssued()));
}
list.add(sum);
ExcelUtil<WmIssueHeaderExportVo> util = new ExcelUtil<WmIssueHeaderExportVo>(WmIssueHeaderExportVo.class);
util.exportExcel(response, list, "生产领料数据");
}

View File

@@ -1,5 +1,6 @@
package com.ktg.mes.wm.controller;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -80,6 +81,20 @@ public class WmItemRecptController extends BaseController
public void export(HttpServletResponse response, WmItemRecpt wmItemRecpt)
{
List<WmItemRecptExportVO> list = wmItemRecptService.selectWmItemRecptExportList(wmItemRecpt);
WmItemRecptExportVO sum = new WmItemRecptExportVO();
sum.setRecptCode("合计");
sum.setQuantity(0);
sum.setQuantityRecived(new BigDecimal(0));
sum.setAmount(new BigDecimal(0));
for(WmItemRecptExportVO vo : list){
if (vo.getQuantity() != null)
sum.setQuantity(vo.getQuantity() + sum.getQuantity());
if (vo.getQuantityRecived() != null)
sum.setQuantityRecived(vo.getQuantityRecived().add(sum.getQuantityRecived()));
if (vo.getAmount() != null)
sum.setAmount(vo.getAmount().add(sum.getAmount()));
}
list.add(sum);
ExcelUtil<WmItemRecptExportVO> util = new ExcelUtil<>(WmItemRecptExportVO.class);
util.exportExcel(response, list, "物料入库单数据");
}

View File

@@ -1,5 +1,6 @@
package com.ktg.mes.wm.controller;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -80,6 +81,14 @@ public class WmProductRecptController extends BaseController
public void export(HttpServletResponse response, WmProductRecpt wmProductRecpt)
{
List<WmProductRecptExportVO> list = wmProductRecptService.selectWmProductRecptExportVOList(wmProductRecpt);
WmProductRecptExportVO sum = new WmProductRecptExportVO();
sum.setRecptCode("合计");
sum.setQuantityRecived(new BigDecimal(0));
for (WmProductRecptExportVO vo : list) {
if (vo.getQuantityRecived() != null)
sum.setQuantityRecived(sum.getQuantityRecived().add(vo.getQuantityRecived()));
}
list.add(sum);
ExcelUtil<WmProductRecptExportVO> util = new ExcelUtil<>(WmProductRecptExportVO.class);
util.exportExcel(response, list, "产品入库录数据");
}

View File

@@ -1,5 +1,6 @@
package com.ktg.mes.wm.controller;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
import javax.annotation.Resource;
@@ -85,6 +86,14 @@ public class WmProductSalseController extends BaseController
public void export(HttpServletResponse response, WmProductSalse wmProductSalse)
{
List<WmProductSalseExportVO> list = wmProductSalseService.selectWmProductSalseExportVOList(wmProductSalse);
WmProductSalseExportVO sum = new WmProductSalseExportVO();
sum.setSalseCode("合计");
sum.setQuantitySalse(new BigDecimal(0));
for (WmProductSalseExportVO vo : list){
if (vo.getQuantitySalse() != null)
sum.setQuantitySalse(sum.getQuantitySalse().add(vo.getQuantitySalse()));
}
list.add(sum);
ExcelUtil<WmProductSalseExportVO> util = new ExcelUtil<>(WmProductSalseExportVO.class);
util.exportExcel(response, list, "销售出库单数据");
}

View File

@@ -17,15 +17,15 @@ import java.util.Date;
@Data
public class WmIssueHeaderExportVo
{
/** 产品物料编码 */
@Excel(name = "产品物料编码")
private String itemCode;
/** 领料日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "领料日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date issueDate;
/** 产品物料编码 */
@Excel(name = "产品物料编码")
private String itemCode;
/** 产品物料名称 */
@Excel(name = "产品物料名称")
private String itemName;

View File

@@ -118,7 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
workorder_code as workorderCode,
product_name as productName,
client_name as clientName,
product_code as productSpc,
product_spc as productSpc,
machinery_no as machineryNo,
remark
from pro_workorder

View File

@@ -183,8 +183,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="areaId != null "> and wps.area_id = #{areaId}</if>
<if test="areaCode != null and areaCode != ''"> and wps.area_code = #{areaCode}</if>
<if test="areaName != null and areaName != ''"> and wps.area_name like concat('%', #{areaName}, '%')</if>
<if test="salseDate != null "> and wps.salse_date = #{salseDate}</if>
<if test="status != null and status != ''"> and wps.status = #{status}</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(salse_date,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(salse_date,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
order by wps.create_time desc
</select>