Merge remote-tracking branch 'origin/dev_New' into dev_New
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | |
| | | |
| | | @ApiModelProperty(value = "报废数量") |
| | | @Excel(name = "报废数量") |
| | | private BigDecimal scrapQty; |
| | | private BigDecimal scrapQty = BigDecimal.ZERO; |
| | | |
| | | //产品名称 |
| | | @Excel(name = "产品名称") |
| | |
| | | @Excel(name = "销售合同号") |
| | | private String salesContractNo; |
| | | |
| | | private LocalDate scheduleDate; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate schedulingDate; |
| | | private String schedulingUserName; |
| | | private String customerName; |
| | | private String process; |
| | | private BigDecimal workHours; |
| | | private BigDecimal wages; |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.production.dto; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | */ |
| | | @ApiModelProperty(value = "排产日期") |
| | | @Excel(name = "生产日期") |
| | | private String schedulingDate; |
| | | private LocalDate schedulingDate; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | private String entryDateStart; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate entryDateStart; |
| | | @ApiModelProperty(value = "结束时间") |
| | | private String entryDateEnd; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate entryDateEnd; |
| | | |
| | | |
| | | private BigDecimal outputNum; |
| | | |
| | | private BigDecimal outputRate; |
| | | private String outputRate; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate entryDate; |
| | | |
| | | private String dateType; |
| | | |
| | | |
| | | } |
| | |
| | | //合格数量=报工数量-报废数量 |
| | | BigDecimal productQty = productionProductOutput.getQuantity().subtract(productionProductOutput.getScrapQty()); |
| | | //只有合格数量>0才能增加相应数据 |
| | | if (productQty.compareTo(BigDecimal.ZERO)>0) { |
| | | if (productQty.compareTo(BigDecimal.ZERO) > 0) { |
| | | /*新增质检*/ |
| | | //对应的过程检或者出厂检 |
| | | List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(Wrappers.<ProductProcessRouteItem>lambdaQuery().eq(ProductProcessRouteItem::getProductRouteId, productProcessRouteItem.getProductRouteId())); |
| | |
| | | qualityInspect.setTestStandardId(qualityTestStandard.get(0).getId()); |
| | | qualityInspectMapper.updateById(qualityInspect); |
| | | qualityTestStandardParamMapper.selectList(Wrappers.<QualityTestStandardParam>lambdaQuery() |
| | | .eq(QualityTestStandardParam::getTestStandardId, qualityTestStandard.get(0).getId()))//默认获取最新的 |
| | | .eq(QualityTestStandardParam::getTestStandardId, qualityTestStandard.get(0).getId()))//默认获取最新的 |
| | | .forEach(qualityTestStandardParam -> { |
| | | QualityInspectParam param = new QualityInspectParam(); |
| | | BeanUtils.copyProperties(qualityTestStandardParam, param); |
| | |
| | | salesLedgerProductionAccountingMapper.insert(salesLedgerProductionAccounting); |
| | | } |
| | | //如果报废数量>0,需要进入报废的库存 |
| | | if (dto.getScrapQty().compareTo(BigDecimal.ZERO) > 0) { |
| | | stockUtils.addUnStock(productModel.getId(), dto.getScrapQty(), StockUnQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode(), productionProductMain.getId()); |
| | | if (ObjectUtils.isNotEmpty(dto.getScrapQty())) { |
| | | if (BigDecimal.ZERO.compareTo(dto.getScrapQty()) > 0) { |
| | | stockUtils.addUnStock(productModel.getId(), dto.getScrapQty(), StockUnQualifiedRecordTypeEnum.PRODUCTION_SCRAP.getCode(), productionProductMain.getId()); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | |
| | | productWorkOrderMapper.updateById(productWorkOrder); |
| | | //判断是否是最后一道工序 |
| | | List<ProductProcessRouteItem> productProcessRouteItems = productProcessRouteItemMapper.selectList(Wrappers.<ProductProcessRouteItem>lambdaQuery().eq(ProductProcessRouteItem::getProductRouteId, productProcessRouteItem.getProductRouteId())); |
| | | if (productProcessRouteItem.getDragSort() == productProcessRouteItems.size()){ |
| | | if (productProcessRouteItem.getDragSort() == productProcessRouteItems.size()) { |
| | | ProductOrder productOrder = productOrderMapper.selectById(productWorkOrder.getProductOrderId()); |
| | | productOrder.setCompleteQuantity(productOrder.getCompleteQuantity().subtract(productionProductOutput.getQuantity())); |
| | | productOrder.setEndTime(null); |
| | |
| | | @Override |
| | | public IPage<SalesLedgerProductionAccountingDto> pageProductionAccounting(SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page) { |
| | | // TODO 管理员查询所有,其他人只能查自己 |
| | | if (salesLedgerProductionAccountingDto.getDateType().equals("month")) { |
| | | salesLedgerProductionAccountingDto.setEntryDate(null); |
| | | }else { |
| | | salesLedgerProductionAccountingDto.setEntryDateStart(null); |
| | | salesLedgerProductionAccountingDto.setEntryDateEnd(null); |
| | | } |
| | | return salesLedgerProductionAccountingMapper.pageProductionAccounting(page, salesLedgerProductionAccountingDto); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ProductionProductMainDto> listProductionDetails(SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page) { |
| | | if (salesLedgerProductionAccountingDto.getDateType().equals("month")) { |
| | | salesLedgerProductionAccountingDto.setEntryDate(null); |
| | | }else { |
| | | salesLedgerProductionAccountingDto.setEntryDateStart(null); |
| | | salesLedgerProductionAccountingDto.setEntryDateEnd(null); |
| | | } |
| | | return productionProductMainMapper.listProductionDetails(salesLedgerProductionAccountingDto, page); |
| | | } |
| | | |
| | |
| | | sl.sales_contract_no, |
| | | sl.customer_name, |
| | | p.product_name, |
| | | pm.model, |
| | | pm.model as product_model_name, |
| | | pm.unit, |
| | | slpa.process, |
| | | ppo.quantity, |
| | |
| | | <if test="ew.schedulingUserName != null and ew.schedulingUserName !=''"> |
| | | and slpa.scheduling_user_name = #{ew.schedulingUserName} |
| | | </if> |
| | | <if test="ew.entryDate != null " > |
| | | and slpa.scheduling_date >= #{ew.entryDate} |
| | | and slpa.scheduling_date < DATE_ADD(#{ew.entryDate}, INTERVAL 1 DAY) |
| | | </if> |
| | | <if test="ew.entryDateStart != null and ew.entryDateEnd != null" > |
| | | and slpa.scheduling_date >= #{ew.entryDateStart} |
| | | and slpa.scheduling_date < date_add(#{ew.entryDateEnd}, INTERVAL 1 DAY) |
| | | </if> |
| | | </where> |
| | | </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, |
| | | SUM(slpa.finished_num) / SUM(ppout.quantity) as output_rate |
| | | slpa.scheduling_user_id, |
| | | slpa.scheduling_user_name, |
| | | sum(ppout.quantity) as output_num, |
| | | sum(slpa.finished_num * 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 |
| | | ), |
| | | '%' |
| | | ) as output_rate |
| | | FROM sales_ledger_production_accounting slpa |
| | | LEFT JOIN production_product_main ppm ON slpa.sales_ledger_work_id = ppm.id |
| | | LEFT JOIN production_product_output ppout ON ppm.id = ppout.product_main_id |
| | | LEFT JOIN production_product_main ppm ON slpa.sales_ledger_work_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 test="ew.schedulingUserName != null and ew.schedulingUserName !=''"> |
| | | and slpa.scheduling_user_name = #{ew.schedulingUserName} |
| | | </if> |
| | | <if test="ew.entryDate != null "> |
| | | and slpa.scheduling_date >= #{ew.entryDate} |
| | | and slpa.scheduling_date < DATE_ADD(DATE(#{ew.entryDate}), INTERVAL 1 DAY) |
| | | </if> |
| | | <if test="ew.entryDateStart != null and ew.entryDateEnd != null"> |
| | | and slpa.scheduling_date >= #{ew.entryDateStart} |
| | | and slpa.scheduling_date < DATE_ADD(DATE(#{ew.entryDateEnd}), INTERVAL 1 DAY) |
| | | </if> |
| | | |
| | | </where> |
| | | GROUP BY slpa.scheduling_user_name |
| | | |