| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProductProcessRouteItemDto; |
| | | import com.ruoyi.production.dto.ProductionProductMainDto; |
| | | import com.ruoyi.production.dto.SalesLedgerProductionAccountingDto; |
| | | import com.ruoyi.production.service.ProductionProductMainService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @RequestMapping("productionProductMain") |
| | |
| | | return R.ok(productionProductMainService.removeProductMain(productionProductMainDto.getId())); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出 |
| | | */ |
| | |
| | | ExcelUtil<ProductionProductMainDto> util = new ExcelUtil<ProductionProductMainDto>(ProductionProductMainDto.class); |
| | | util.exportExcel(response, list, "生产报工数据"); |
| | | } |
| | | |
| | | @GetMapping("/queryProductInputAndOutput") |
| | | public R queryProductInputAndOutput(Page page, ProductionProductMainDto productionProductMainDto) { |
| | | return R.ok(productionProductMainService.queryProductInputAndOutput(page, productionProductMainDto)); |
| | | } |
| | | } |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | |
| | | private BigDecimal workHours; |
| | | private BigDecimal wages; |
| | | |
| | | |
| | | private String startTime; |
| | | private String endTime; |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | |
| | | IPage<ProductionProductMainDto> listProductionDetails(@Param("ew") SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page); |
| | | |
| | | ArrayList<Long> listMain(List<Long> idList); |
| | | |
| | | IPage<HashMap<String, Object>> queryProductInputAndOutput(Page page, @Param("ew") ProductionProductMainDto productionProductMainDto); |
| | | } |
| | |
| | | import com.ruoyi.production.pojo.ProductionProductMain; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | public interface ProductionProductMainService extends IService<ProductionProductMain> { |
| | |
| | | Boolean removeProductMain(Long id); |
| | | |
| | | ArrayList<Long> listMain(List<Long> idList); |
| | | |
| | | /** |
| | | * 按天查询产品的投入和产出 |
| | | * @param page |
| | | * @param productionProductMainDto |
| | | * @return |
| | | */ |
| | | IPage<HashMap<String, Object>> queryProductInputAndOutput(Page page, ProductionProductMainDto productionProductMainDto); |
| | | } |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | public ArrayList<Long> listMain(List<Long> idList) { |
| | | return productionProductMainMapper.listMain(idList); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<HashMap<String, Object>> queryProductInputAndOutput(Page page, ProductionProductMainDto productionProductMainDto) { |
| | | return productionProductMainMapper.queryProductInputAndOutput(page, productionProductMainDto); |
| | | } |
| | | } |
| | |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="queryProductInputAndOutput" resultType="Hashmap"> |
| | | select * |
| | | from (select p.product_name as productName, |
| | | pm.model as model, |
| | | pm.unit as unit, |
| | | temp.inputQuantity as inputQuantity, |
| | | temp.outputQuantity as outputQuantity |
| | | from (select product_model_id, |
| | | coalesce(sum(inputQuantity), 0) as inputQuantity, |
| | | coalesce(sum(outputQuantity), 0) as outputQuantity |
| | | from ((select product_model_id, coalesce(sum(quantity), 0) as inputQuantity, 0 as outputQuantity |
| | | from production_product_input |
| | | where create_time >= #{ew.startTime} |
| | | and create_time < #{ew.endTime} |
| | | group by product_model_id) |
| | | union all |
| | | (select product_model_id, 0 as inputQuantity, coalesce(sum(quantity), 0) as outputQuantity |
| | | from production_product_output |
| | | where create_time >= #{ew.startTime} |
| | | and create_time < #{ew.endTime} |
| | | group by product_model_id)) t |
| | | group by product_model_id) temp |
| | | left join product_model pm on temp.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id) tmp |
| | | </select> |
| | | </mapper> |