Merge remote-tracking branch 'origin/dev_天津_阳光彩印' into dev_天津_阳光彩印
| | |
| | | private Long auditUserId; |
| | | private String auditUserName; |
| | | |
| | | private Long deviceId; |
| | | private String deviceName; |
| | | private String workMinutes; |
| | | |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import org.apache.commons.lang3.tuple.Pair; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | |
| | | private String dateType; |
| | | |
| | | private String deviceWorkInfo; |
| | | |
| | | private List<Pair<String,Integer>> deviceWorkInfoPairList; |
| | | |
| | | |
| | | } |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(value = "end_time") |
| | | private LocalDateTime endTime; |
| | | |
| | | @TableField(value = "device_id") |
| | | private Long deviceId; |
| | | |
| | | @TableField(value = "device_name") |
| | | private String deviceName; |
| | | } |
| | |
| | | productionProductMain.setAuditUserId(dto.getAuditUserId()); |
| | | productionProductMain.setAuditUserName(dto.getAuditUserName()); |
| | | productionProductMain.setStatus(0); |
| | | productionProductMain.setStartTime(dto.getStartTime()); |
| | | productionProductMain.setEndTime(dto.getEndTime()); |
| | | productionProductMain.setDeviceId(productProcess.getDeviceId()); |
| | | productionProductMain.setDeviceName(productProcess.getDeviceName()); |
| | | productionProductMainMapper.insert(productionProductMain); |
| | | /*新增报工投入表*/ |
| | | List<ProductStructureDto> productStructureDtos = productStructureMapper.listBybomAndProcess(productProcessRoute.getBomId(), productProcess.getId()); |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.ruoyi.production.service.SalesLedgerProductionAccountingService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.tuple.Pair; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | salesLedgerProductionAccountingDto.setEntryDateStart(null); |
| | | salesLedgerProductionAccountingDto.setEntryDateEnd(null); |
| | | } |
| | | return salesLedgerProductionAccountingMapper.pageProductionAccounting(page, salesLedgerProductionAccountingDto); |
| | | IPage<SalesLedgerProductionAccountingDto> salesLedgerProductionAccountingDtoIPage = salesLedgerProductionAccountingMapper.pageProductionAccounting(page, salesLedgerProductionAccountingDto); |
| | | salesLedgerProductionAccountingDtoIPage.getRecords().forEach(it->{ |
| | | // 拿到机台统计 分钟-机台, 这样排列 |
| | | String deviceWorkInfo = it.getDeviceWorkInfo(); |
| | | List<String> str = StrUtil.split(deviceWorkInfo, ">>>"); |
| | | List<Pair<String,Integer>> collect = str.stream().map(n1 -> { |
| | | List<String> strPair = StrUtil.split(n1, "|$|"); |
| | | if (strPair.size() == 2) { |
| | | return Pair.of(strPair.get(1),Integer.parseInt(strPair.get(0))); |
| | | } |
| | | return null; |
| | | }).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | it.setDeviceWorkInfoPairList(collect); |
| | | }); |
| | | return salesLedgerProductionAccountingDtoIPage; |
| | | } |
| | | |
| | | @Override |
| | |
| | | slpa.process, |
| | | ppo.quantity, |
| | | slpa.work_hours, |
| | | slpa.work_hours * slpa.finished_num AS wages |
| | | slpa.work_hours * slpa.finished_num AS wages, |
| | | ppm.device_name, |
| | | ppm.device_id, |
| | | IFNULL( |
| | | TIMESTAMPDIFF(MINUTE, ppm.start_time, ppm.end_time), |
| | | 0 |
| | | ) AS work_minutes |
| | | FROM |
| | | production_product_main ppm |
| | | LEFT JOIN sales_ledger_production_accounting slpa ON slpa.product_main_id = ppm.id |
| | |
| | | LEFT JOIN product_model pm ON po.product_model_id = pm.id |
| | | LEFT JOIN product p ON p.id = pm.product_id |
| | | LEFT JOIN sales_ledger sl ON po.sales_ledger_id = sl.id |
| | | <where> |
| | | where ppm.audit_status = 1 |
| | | <if test="ew.schedulingUserName != null and ew.schedulingUserName !=''"> |
| | | and slpa.scheduling_user_name = #{ew.schedulingUserName} |
| | | </if> |
| | |
| | | and slpa.scheduling_date >= #{ew.entryDateStart} |
| | | and slpa.scheduling_date < date_add(#{ew.entryDateEnd}, INTERVAL 1 DAY) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="listMain" resultType="java.lang.Long"> |
| | | SELECT ppm.id FROM production_product_main ppm |
| | |
| | | </select> |
| | | <select id="pageProductionAccounting" |
| | | resultType="com.ruoyi.production.dto.SalesLedgerProductionAccountingDto"> |
| | | |
| | | SELECT |
| | | slpa.scheduling_user_id, |
| | | slpa.scheduling_user_name, |
| | | sum(ppout.quantity) as output_num, |
| | | sum(slpa.finished_num * work_hours) as wages, |
| | | MIN(slpa.scheduling_user_name) AS scheduling_user_name, |
| | | |
| | | SUM(ppout.quantity) AS output_num, |
| | | |
| | | SUM(slpa.finished_num * slpa.work_hours) AS wages, |
| | | |
| | | CONCAT( |
| | | ROUND( |
| | | CASE |
| | | WHEN SUM(ppout.quantity) = 0 OR SUM(ppout.quantity) IS NULL THEN 0 |
| | | ELSE SUM(slpa.finished_num) * 100.0 / SUM(ppout.quantity) |
| | | END, |
| | | 2 |
| | | END, 2 |
| | | ), |
| | | '%' |
| | | ) as output_rate |
| | | ) AS output_rate, |
| | | GROUP_CONCAT( |
| | | CONCAT( |
| | | IFNULL( |
| | | TIMESTAMPDIFF(MINUTE, ppm.start_time, ppm.end_time), |
| | | 0 |
| | | ), |
| | | '|$|', |
| | | IFNULL(ppm.device_name, '未知机台') |
| | | ) |
| | | ORDER BY ppm.start_time |
| | | SEPARATOR '>>>' |
| | | ) AS device_work_info |
| | | |
| | | FROM sales_ledger_production_accounting slpa |
| | | LEFT JOIN production_product_main ppm ON slpa.product_main_id = ppm.id |
| | | LEFT JOIN production_product_output ppout ON ppm.id = ppout.product_main_id |
| | | |
| | | LEFT JOIN production_product_main ppm |
| | | ON slpa.product_main_id = ppm.id |
| | | |
| | | LEFT JOIN production_product_output ppout |
| | | ON ppm.id = ppout.product_main_id |
| | | |
| | | <where> |
| | | <if test="ew.schedulingUserName != null and ew.schedulingUserName !=''"> |
| | | and slpa.scheduling_user_name = #{ew.schedulingUserName} |
| | |
| | | </if> |
| | | |
| | | </where> |
| | | GROUP BY slpa.scheduling_user_name |
| | | GROUP BY slpa.scheduling_user_id |
| | | |
| | | </select> |
| | | |