Merge remote-tracking branch 'origin/dev_西宁_湟水峡' into dev_西宁_湟水峡
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | Navicat Premium Data Transfer |
| | | |
| | | Source Server : localhost |
| | | Source Server Type : MySQL |
| | | Source Server Version : 80030 (8.0.30) |
| | | Source Host : localhost:3306 |
| | | Source Schema : product-inventory-management-hsxny |
| | | |
| | | Target Server Type : MySQL |
| | | Target Server Version : 80030 (8.0.30) |
| | | File Encoding : 65001 |
| | | |
| | | Date: 23/07/2026 14:42:04 |
| | | */ |
| | | |
| | | SET NAMES utf8mb4; |
| | | SET FOREIGN_KEY_CHECKS = 0; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for sales_ledger_production_ref |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `sales_ledger_production_ref`; |
| | | CREATE TABLE `sales_ledger_production_ref` ( |
| | | `id` bigint NOT NULL, |
| | | `sales_ledger_id` int NOT NULL COMMENT 'éå®å°è´¦id', |
| | | `product_order_id` int NOT NULL COMMENT 'ç产订åid', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; |
| | | |
| | | SET FOREIGN_KEY_CHECKS = 1; |
| | |
| | | return R.ok(productOrderService.pageProductOrder(page, productOrder)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®äº§åä¿¡æ¯idè·åç产订å") |
| | | @PostMapping("listByProductModelId") |
| | | public R listByProductModelId(@RequestBody List<Long> productModelIds) { |
| | | return R.ok(productOrderService.listByProductModelId(productModelIds)); |
| | | } |
| | | |
| | | @ApiOperation("ç»å®å·¥èºè·¯çº¿") |
| | | @PostMapping("/bindingRoute") |
| | | public R bindingRoute(@RequestBody ProductOrder productOrder) { |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("listPage") |
| | | @ApiOperation("æ¥å·¥æ¥è¯¢") |
| | | public R page(Page<ProductionProductMainDto> page, ProductionProductMainDto productionProductMainDto) { |
| | | return R.ok(productionProductMainService.listPageProductionProductMainDto(page, productionProductMainDto)); |
| | | } |
| | |
| | | } |
| | | //---------------------------------------------------------------------------------------------------------------------------------------------------- |
| | | @GetMapping("/page") |
| | | @ApiModelProperty("æ¥è¯¢å·¥äººç产工èµä¿¡æ¯") |
| | | @ApiOperation("æ¥è¯¢å·¥äººç产工èµä¿¡æ¯") |
| | | public R pageProductionAccounting(SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page){ |
| | | return R.ok(salesLedgerProductionAccountingService.pageProductionAccounting(salesLedgerProductionAccountingDto, page)); |
| | | } |
| | | |
| | | @GetMapping("/listProductionDetails") |
| | | @ApiModelProperty("æ¥è¯¢å·¥äººç产工èµä¿¡æ¯") |
| | | @ApiOperation("æ¥è¯¢å·¥äººç产工èµä¿¡æ¯") |
| | | public R listProductionDetails(SalesLedgerProductionAccountingDto salesLedgerProductionAccountingDto, Page page){ |
| | | return R.ok(salesLedgerProductionAccountingService.listProductionDetails(salesLedgerProductionAccountingDto,page)); |
| | | } |
| | | |
| | | @GetMapping("getByUserId") |
| | | @ApiModelProperty("æ¥è¯¢å·¥äººç产工èµä¿¡æ¯") |
| | | @ApiOperation("æ¥è¯¢å·¥äººç产工èµä¿¡æ¯") |
| | | public R getByUserId(UserProductionAccountingDto userProductionAccountingDto){ |
| | | return R.ok(salesLedgerProductionAccountingService.getByUserId(userProductionAccountingDto)); |
| | | } |
| | |
| | | Integer countCompleted(@Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | Integer countPending(@Param("startDate") String startDate, @Param("endDate") String endDate); |
| | | |
| | | List<ProductOrderDto> listByProductModelId(@Param("productModelIds") List<Long> productModelIds); |
| | | |
| | | List<ProductOrderDto> listByProductOrderId(@Param("productOrderIds") List<Long> productOrderIds); |
| | | } |
| | |
| | | Boolean addProductOrder(ProductOrder productOrder); |
| | | |
| | | Boolean delete(Long[] id); |
| | | |
| | | List<ProductOrderDto> listByProductModelId(List<Long> productModelIds); |
| | | |
| | | } |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @Override |
| | | public IPage<ProductOrderDto> pageProductOrder(Page page, ProductOrderDto productOrder) { |
| | | return productOrderMapper.pageProductOrder(page, productOrder); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductOrderDto> listByProductModelId(List<Long> productModelIds) { |
| | | if (productModelIds == null || productModelIds.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return productOrderMapper.listByProductModelId(productModelIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | //妿已ç»å¼å§ç产,ä¸è½å é¤ |
| | | //æ¥è¯¢ç产订åä¸çå·¥å |
| | | List<ProductWorkOrder> productWorkOrders = productWorkOrderMapper.selectList(Wrappers.<ProductWorkOrder>lambdaQuery().in(ProductWorkOrder::getProductOrderId, ids)); |
| | | if (productWorkOrders.size()>0){ |
| | | if (productWorkOrders.size() > 0) { |
| | | //夿æ¯å¦ææ¥å·¥æ°æ® |
| | | List<ProductionProductMain> productionProductMains = productionProductMainMapper.selectList(Wrappers.<ProductionProductMain>lambdaQuery() |
| | | .in(ProductionProductMain::getWorkOrderId, productWorkOrders.stream().map(ProductWorkOrder::getId).collect(Collectors.toList()))); |
| | | if (productionProductMains.size()>0){ |
| | | if (productionProductMains.size() > 0) { |
| | | throw new RuntimeException("ç产订åå·²ç»å¼å§ç产,ä¸è½å é¤"); |
| | | } |
| | | //å é¤å·¥å |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | //è·åå½åç产订åå· |
| | | public String getMaxOrderNoByDate(String datePrefix) { |
| | | QueryWrapper<ProductOrder> queryWrapper = new QueryWrapper<>(); |
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.sales.dto.InvoiceLedgerDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.mapper.InvoiceLedgerMapper; |
| | |
| | | startPage(); |
| | | List<SalesLedger> list = salesLedgerService.selectSalesLedgerList(salesLedgerDto); |
| | | // 计ç®å·²å¼ç¥¨éé¢/æªå¼ç¥¨éé¢(已填åå票éé¢ä¸ºå) |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return getDataTable(list); |
| | | } |
| | | List<Long> salesLedgerIds = list.stream().map(SalesLedger::getId).collect(Collectors.toList()); |
| | | List<InvoiceLedgerDto> invoiceLedgerDtoList = invoiceLedgerMapper.invoicedTotal(salesLedgerIds); |
| | | if(CollectionUtils.isEmpty(invoiceLedgerDtoList)){ |
| | | if (CollectionUtils.isEmpty(invoiceLedgerDtoList)) { |
| | | return getDataTable(list); |
| | | } |
| | | for (SalesLedger salesLedger : list) { |
| | |
| | | @Log(title = "éå®å°è´¦", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SalesLedgerDto salesLedgerDto) { |
| | | Page page = new Page(-1,-1); |
| | | Page page = new Page(-1, -1); |
| | | IPage<SalesLedger> salesLedgerIPage = listPage(page, salesLedgerDto); |
| | | ExcelUtil<SalesLedger> util = new ExcelUtil<SalesLedger>(SalesLedger.class); |
| | | if(salesLedgerIPage == null){ |
| | | if (salesLedgerIPage == null) { |
| | | util.exportExcel(response, new ArrayList<>(), "éå®å°è´¦æ°æ®"); |
| | | return; |
| | | } |
| | |
| | | * æ°å¢ä¿®æ¹éå®å°è´¦ |
| | | */ |
| | | @Log(title = "éå®å°è´¦", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "æ°å¢ä¿®æ¹éå®å°è´¦", notes = "æ°å¢ä¿®æ¹éå®å°è´¦") |
| | | @PostMapping("/addOrUpdateSalesLedger") |
| | | public AjaxResult add(@RequestBody SalesLedgerDto salesLedgerDto) { |
| | | return toAjax(salesLedgerService.addOrUpdateSalesLedger(salesLedgerDto)); |
| | |
| | | * è¿åå¹´å¼ç¥¨,忬¾éé¢ |
| | | */ |
| | | @GetMapping("/getAmountHalfYear") |
| | | public AjaxResult getAmountHalfYear(@RequestParam(value = "type",defaultValue = "1") Integer type) { |
| | | public AjaxResult getAmountHalfYear(@RequestParam(value = "type", defaultValue = "1") Integer type) { |
| | | return AjaxResult.success(salesLedgerService.getAmountHalfYear(type)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢éå®å°è´¦å表 |
| | | */ |
| | | @ApiOperation(value = "æ¥è¯¢éå®å°è´¦å表", notes = "æ¥è¯¢éå®å°è´¦å表") |
| | | @GetMapping("/listPage") |
| | | public IPage<SalesLedger> listPage(Page page, SalesLedgerDto salesLedgerDto) { |
| | | IPage<SalesLedger> iPage = salesLedgerService.selectSalesLedgerListPage(page, salesLedgerDto); |
| | |
| | | return iPage; |
| | | } |
| | | |
| | | for (SalesLedger record : iPage.getRecords()) { |
| | | Long salesLedgerId = record.getId(); |
| | | List<ProductOrderDto> productionOrdersBySalesLedgerId = salesLedgerService.getProductionOrdersBySalesLedgerId(salesLedgerId); |
| | | record.setProductionOrders(productionOrdersBySalesLedgerId); |
| | | } |
| | | |
| | | // è·åå½å页ææå°è´¦è®°å½ç ID éå |
| | | List<Long> salesLedgerIds = iPage.getRecords().stream().map(SalesLedger::getId).collect(Collectors.toList()); |
| | | |
| | |
| | | public class SalesQuotationController { |
| | | @Autowired |
| | | private SalesQuotationService salesQuotationService; |
| | | |
| | | @GetMapping("/list") |
| | | public AjaxResult getList(Page page, SalesQuotationDto salesQuotationDto) { |
| | | return AjaxResult.success(salesQuotationService.listPage(page, salesQuotationDto)); |
| | |
| | | |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response) { |
| | | Page page = new Page(-1,-1); |
| | | Page page = new Page(-1, -1); |
| | | SalesQuotationDto afterSalesService = new SalesQuotationDto(); |
| | | IPage<SalesQuotationDto> listPage = salesQuotationService.listPage(page, afterSalesService); |
| | | ExcelUtil<SalesQuotationDto> util = new ExcelUtil<SalesQuotationDto>(SalesQuotationDto.class); |
| | | util.exportExcel(response, listPage.getRecords() , "åé¦ç»è®°"); |
| | | util.exportExcel(response, listPage.getRecords(), "åé¦ç»è®°"); |
| | | } |
| | | |
| | | |
| | |
| | | public AjaxResult add(@RequestBody SalesQuotationDto salesQuotationDto) { |
| | | return AjaxResult.success(salesQuotationService.add(salesQuotationDto)); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | public AjaxResult update(@RequestBody SalesQuotationDto salesQuotationDto) { |
| | | return AjaxResult.success(salesQuotationService.edit(salesQuotationDto)); |
| | |
| | | |
| | | /** |
| | | * 详æ
æ ¹æ®å®¢æ·ç±»åå产åè¿åæ¥ä»·åä»· |
| | | * @param type 客æ·ç±»å |
| | | * @param productName 产ååç§° |
| | | * @param specification è§æ ¼ |
| | | * |
| | | * @param type 客æ·ç±»å |
| | | * @param productName 产ååç§° |
| | | * @param specification è§æ ¼ |
| | | * @return |
| | | */ |
| | | @ApiOperation("详æ
") |
| | | @GetMapping("/detail") |
| | | public AjaxResult detail(@RequestParam("type") String type, |
| | | @RequestParam("productName")String productName, |
| | | @RequestParam("specification")String specification) { |
| | | public AjaxResult detail(@RequestParam(value = "type", required = false) String type, |
| | | @RequestParam("productName") String productName, |
| | | @RequestParam("specification") String specification) { |
| | | return AjaxResult.success(salesQuotationService.detail(type, productName, specification)); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | public AjaxResult delete(@RequestBody Long id) { |
| | | return AjaxResult.success(salesQuotationService.delete(id)); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | @ApiModelProperty(value = "审æ¹äººids") |
| | | private String approveUserIds; |
| | | |
| | | @ApiModelProperty(value = "ç产订åids") |
| | | private List<Long> productionOrderIds; |
| | | |
| | | @ApiModelProperty(value = "å·²ç»å®å®¡æ¹è®¢åå表") |
| | | private List<ProductOrderDto> productionOrders; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProductionRef; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface SalesLedgerProductionRefMapper extends BaseMapper<SalesLedgerProductionRef> { |
| | | List<Long> getProductionOrderIdsBySalesLedgerId(@Param("salesLedgerId") Long salesLedgerId); |
| | | |
| | | } |
| | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | |
| | | @TableField(exist = false) |
| | | private String approveUserIds; |
| | | |
| | | @ApiModelProperty(value = "å·²ç»å®å®¡æ¹è®¢åå表") |
| | | @TableField(exist = false) |
| | | private List<ProductOrderDto> productionOrders; |
| | | |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * éå®å°è´¦ç产订åå
³è表 |
| | | */ |
| | | @TableName(value = "sales_ledger_production_ref") |
| | | @Data |
| | | public class SalesLedgerProductionRef implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(name = "主é®") |
| | | @TableId(value = "id", type = IdType.ASSIGN_ID) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(name = "éå®å°è´¦ID") |
| | | private Long salesLedgerId; |
| | | |
| | | @ApiModelProperty(name = "ç产订åID") |
| | | private Long productOrderId; |
| | | } |
| | |
| | | import com.ruoyi.aftersalesservice.pojo.AfterSalesService; |
| | | import com.ruoyi.common.enums.SaleEnum; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.sales.dto.AfterSalesLedgerDto; |
| | | import com.ruoyi.sales.dto.LossProductModelDto; |
| | | import com.ruoyi.sales.dto.MonthlyAmountDto; |
| | |
| | | IPage<AfterSalesLedgerDto> listSalesLedger(AfterSalesLedgerDto salesLedgerDto, Page page); |
| | | |
| | | SalesLedgerDto getSalesByCode(SalesLedgerDto salesLedgerDto); |
| | | |
| | | List<ProductOrderDto> getProductionOrdersBySalesLedgerId(Long salesLedgerId); |
| | | |
| | | void getProductionOrders(List<SalesLedger> records); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProductionRef; |
| | | |
| | | public interface SalesLedgerProductionRefService extends IService<SalesLedgerProductionRef> { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.sales.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductionRefMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProductionRef; |
| | | import com.ruoyi.sales.service.SalesLedgerProductionRefService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class SalesLedgerProductionRefServiceImpl extends ServiceImpl<SalesLedgerProductionRefMapper, SalesLedgerProductionRef> implements SalesLedgerProductionRefService { |
| | | } |
| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.other.mapper.TempFileMapper; |
| | | import com.ruoyi.other.pojo.TempFile; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.service.ProductionProductMainService; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | |
| | | import com.ruoyi.sales.mapper.*; |
| | | import com.ruoyi.sales.pojo.*; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import com.ruoyi.sales.service.SalesLedgerProductionRefService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.FilenameUtils; |
| | |
| | | private SysUserMapper sysUserMapper; |
| | | @Autowired |
| | | private CustomerPrivatePoolMapper customerPrivatePoolMapper; |
| | | @Autowired |
| | | private SalesLedgerProductionRefService salesLedgerProductionRefService; |
| | | @Autowired |
| | | private SalesLedgerProductionRefMapper salesLedgerProductionRefMapper; |
| | | |
| | | @Override |
| | | public List<SalesLedger> selectSalesLedgerList(SalesLedgerDto salesLedgerDto) { |
| | |
| | | if (salesLedger == null) { |
| | | throw new BaseException("å°è´¦ä¸åå¨"); |
| | | } |
| | | |
| | | List<ProductOrderDto> productionOrdersBySalesLedgerId = getProductionOrdersBySalesLedgerId(salesLedger.getId()); |
| | | salesLedger.setProductionOrders(productionOrdersBySalesLedgerId); |
| | | // 2. æ¥è¯¢å表 |
| | | LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>(); |
| | | productWrapper.eq(SalesLedgerProduct::getSalesLedgerId, salesLedger.getId()); |
| | |
| | | return resultDto; |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductOrderDto> getProductionOrdersBySalesLedgerId(Long salesLedgerId) { |
| | | List<Long> productOrderIds = salesLedgerProductionRefMapper.getProductionOrderIdsBySalesLedgerId(salesLedgerId); |
| | | if (productOrderIds == null || productOrderIds.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return productOrderMapper.listByProductOrderId(productOrderIds); |
| | | } |
| | | |
| | | @Override |
| | | public void getProductionOrders(List<SalesLedger> records) { |
| | | List<Long> ledgerIdList = records.stream() |
| | | .map(SalesLedger::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * ä¸å线å½å转驼峰å½å |
| | | */ |
| | |
| | | ); |
| | | } |
| | | |
| | | // 5. è¿ç§»ä¸´æ¶æä»¶å°æ£å¼ç®å½ |
| | | //5. ç»å®éå®è®¢ååç产订å |
| | | bindSalesOrderAndProductionOrder(salesLedgerDto.getProductionOrderIds(), salesLedger.getId()); |
| | | |
| | | // 6. è¿ç§»ä¸´æ¶æä»¶å°æ£å¼ç®å½ |
| | | if (salesLedgerDto.getTempFileIds() != null && !salesLedgerDto.getTempFileIds().isEmpty()) { |
| | | migrateTempFilesToFormal(salesLedger.getId(), salesLedgerDto.getTempFileIds()); |
| | | } |
| | |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | private void bindSalesOrderAndProductionOrder(List<Long> productionOrderIds, Long salesLedgerId) { |
| | | // å
å é¤è¯¥éå®å°è´¦æææ§å
³è |
| | | LambdaQueryWrapper<SalesLedgerProductionRef> deleteWrapper = Wrappers.lambdaQuery(); |
| | | deleteWrapper.eq(SalesLedgerProductionRef::getSalesLedgerId, salesLedgerId); |
| | | salesLedgerProductionRefMapper.delete(deleteWrapper); |
| | | |
| | | if (productionOrderIds == null || productionOrderIds.isEmpty()) { |
| | | return; |
| | | } |
| | | List<SalesLedgerProductionRef> refList = productionOrderIds.stream() |
| | | .map(productOrderId -> { |
| | | SalesLedgerProductionRef ref = new SalesLedgerProductionRef(); |
| | | ref.setSalesLedgerId(salesLedgerId); |
| | | ref.setProductOrderId(productOrderId); |
| | | return ref; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | salesLedgerProductionRefService.saveBatch(refList); |
| | | } |
| | | |
| | | public void addApproveByPurchase(LoginUser loginUser, SalesLedger salesLedger) throws Exception { |
| | |
| | | salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice()); |
| | | salesLedgerProductMapper.insert(salesLedgerProduct); |
| | | // æ·»å çäº§æ°æ® |
| | | salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct); |
| | | //salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct); |
| | | } |
| | | } |
| | | } |
| | |
| | | <if test="req.approveType != null "> |
| | | and approve_type = #{req.approveType} |
| | | </if> |
| | | order by approve_time desc |
| | | </select> |
| | | </mapper> |
| | |
| | | and dr.maintenance_time like concat('%',#{deviceRepairDto.maintenanceTimeStr},'%') |
| | | </if> |
| | | </where> |
| | | order by dr.repair_time desc |
| | | </select> |
| | | <select id="detailById" resultType="com.ruoyi.device.dto.DeviceRepairDto"> |
| | | select dr.id, |
| | |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | </resultMap> |
| | | |
| | | <!-- æ§sql--> |
| | | <!-- <select id="pageProductOrder" resultType="com.ruoyi.production.dto.ProductOrderDto">--> |
| | | <!-- select po.*,--> |
| | | <!-- sl.sales_contract_no,--> |
| | | <!-- sl.customer_name,--> |
| | | <!-- p.product_name as product_category,--> |
| | | <!-- pm.model as specification_model,--> |
| | | <!-- pm.unit,--> |
| | | <!-- ppr.process_route_code,--> |
| | | <!-- pb.bom_no,--> |
| | | <!-- ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus,--> |
| | | <!-- DATEDIFF(sl.delivery_date, CURDATE()) AS delivery_days_diff,--> |
| | | <!-- sl.delivery_date,--> |
| | | <!-- CASE--> |
| | | <!-- WHEN shipping_status_counts.total_count = 0 THEN false--> |
| | | <!-- WHEN shipping_status_counts.unshipped_count = 0 THEN true--> |
| | | <!-- ELSE false--> |
| | | <!-- END AS is_fh--> |
| | | <!-- from product_order po--> |
| | | <!-- left join sales_ledger sl on po.sales_ledger_id = sl.id--> |
| | | <!-- LEFT JOIN (--> |
| | | <!-- SELECT sales_ledger_id,--> |
| | | <!-- COUNT(*) as total_count,--> |
| | | <!-- SUM(CASE WHEN status != 'å·²åè´§' THEN 1 ELSE 0 END) as unshipped_count--> |
| | | <!-- FROM shipping_info--> |
| | | <!-- GROUP BY sales_ledger_id--> |
| | | <!-- ) shipping_status_counts ON sl.id = shipping_status_counts.sales_ledger_id--> |
| | | <!-- left join product_model pm on po.product_model_id = pm.id--> |
| | | <!-- left join product p on pm.product_id = p.id--> |
| | | <!-- left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id and slp.type = 1--> |
| | | <!-- left join (--> |
| | | <!-- select max(id) as id, product_order_id--> |
| | | <!-- from product_process_route--> |
| | | <!-- group by product_order_id--> |
| | | <!-- ) ppr_latest on po.id = ppr_latest.product_order_id--> |
| | | <!-- left join product_process_route ppr on ppr.id = ppr_latest.id--> |
| | | <!-- left join product_bom pb on pb.id = ppr.bom_id--> |
| | | <!-- <where>--> |
| | | <!-- <if test="c.npsNo != null and c.npsNo != ''">--> |
| | | <!-- and po.nps_no like concat('%',#{c.npsNo},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="c.salesContractNo != null and c.salesContractNo != ''">--> |
| | | <!-- and sl.sales_contract_no like concat('%',#{c.salesContractNo},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="c.customerName != null and c.customerName != ''">--> |
| | | <!-- and sl.customer_name like concat('%',#{c.customerName},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="c.productCategory != null and c.productCategory != ''">--> |
| | | <!-- and slp.product_category like concat('%',#{c.productCategory},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="c.specificationModel != null and c.specificationModel != ''">--> |
| | | <!-- and slp.specification_model like concat('%',#{c.specificationModel},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="c.startTime != null and c.endTime != null">--> |
| | | <!-- and po.create_time between #{c.startTime} and #{c.endTime}--> |
| | | <!-- </if>--> |
| | | <!-- </where>--> |
| | | <!-- </select>--> |
| | | |
| | | <!-- æ°sql ç¨ä¸é´è¡¨sales_ledger_production_refè¿è¡å
³èsales_ledgeråproduct_orderï¼æ¥è¯¢åºææå
³èçsales_ledger_noåcustomer_nameã交æï¼äº¤æåå·®ï¼æ¯å¦åè´§ç±äºä¸ä¸ªç产订å对åºå¤ä¸ªéå®è®¢åï¼å¯¼è´æ æ³æ£å¸¸æ¾ç¤ºï¼ææ¶çç¥--> |
| | | <select id="pageProductOrder" resultType="com.ruoyi.production.dto.ProductOrderDto"> |
| | | select po.*, |
| | | sl.sales_contract_no, |
| | | sl.customer_name, |
| | | GROUP_CONCAT(DISTINCT sl.sales_contract_no SEPARATOR ',') AS sales_contract_no, |
| | | GROUP_CONCAT(DISTINCT sl.customer_name SEPARATOR ',') AS customer_name, |
| | | p.product_name as product_category, |
| | | pm.model as specification_model, |
| | | pm.unit, |
| | | ppr.process_route_code, |
| | | pb.bom_no, |
| | | ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus, |
| | | DATEDIFF(sl.delivery_date, CURDATE()) AS delivery_days_diff, |
| | | sl.delivery_date, |
| | | CASE |
| | | WHEN shipping_status_counts.total_count = 0 THEN false |
| | | WHEN shipping_status_counts.unshipped_count = 0 THEN true |
| | | ELSE false |
| | | END AS is_fh |
| | | ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus |
| | | |
| | | |
| | | from product_order po |
| | | left join sales_ledger sl on po.sales_ledger_id = sl.id |
| | | left join sales_ledger_production_ref ref on po.id = ref.product_order_id |
| | | left join sales_ledger sl on ref.sales_ledger_id = sl.id |
| | | LEFT JOIN ( |
| | | SELECT sales_ledger_id, |
| | | COUNT(*) as total_count, |
| | | SUM(CASE WHEN status != 'å·²åè´§' THEN 1 ELSE 0 END) as unshipped_count |
| | | FROM shipping_info |
| | | GROUP BY sales_ledger_id |
| | | ) shipping_status_counts ON sl.id = shipping_status_counts.sales_ledger_id |
| | | left join product_model pm on po.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | GROUP BY sales_ledger_id) shipping_status_counts |
| | | ON sl.id = shipping_status_counts.sales_ledger_id |
| | | left join product_model pm on po.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id and slp.type = 1 |
| | | left join ( |
| | | select max(id) as id, product_order_id |
| | | from product_process_route |
| | | group by product_order_id |
| | | ) ppr_latest on po.id = ppr_latest.product_order_id |
| | | group by product_order_id) ppr_latest on po.id = ppr_latest.product_order_id |
| | | left join product_process_route ppr on ppr.id = ppr_latest.id |
| | | left join product_bom pb on pb.id = ppr.bom_id |
| | | <where> |
| | |
| | | and po.create_time between #{c.startTime} and #{c.endTime} |
| | | </if> |
| | | </where> |
| | | GROUP BY po.id |
| | | order by po.create_time desc |
| | | </select> |
| | | |
| | | |
| | | <select id="listProcessRoute" resultType="com.ruoyi.production.pojo.ProcessRoute"> |
| | | select pr.* |
| | | from process_route pr |
| | |
| | | ps.unit_quantity * po.quantity as demandedQuantity, |
| | | ps.unit, |
| | | p.product_name, |
| | | pp.name as process_name, |
| | | pp.name as process_name, |
| | | pm.product_id, |
| | | pm.model |
| | | from |
| | | product_structure ps |
| | | left join product_model pm on ps.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join product_process pp on ps.process_id = pp.id |
| | | left join product_process_route ppr on ps.bom_id = ppr.bom_id |
| | | left join product_order po on po.id = ppr.product_order_id |
| | | from product_structure ps |
| | | left join product_model pm on ps.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join product_process pp on ps.process_id = pp.id |
| | | left join product_process_route ppr on ps.bom_id = ppr.bom_id |
| | | left join product_order po on po.id = ppr.product_order_id |
| | | where ppr.product_order_id = #{orderId} |
| | | order by ps.id |
| | | </select> |
| | | |
| | | |
| | | <select id="countCreated" resultType="java.lang.Integer"> |
| | | SELECT count(1) FROM product_order |
| | | WHERE create_time >= #{startDate} AND create_time <= #{endDate} |
| | | SELECT count(1) |
| | | FROM product_order |
| | | WHERE create_time >= #{startDate} |
| | | AND create_time <= #{endDate} |
| | | </select> |
| | | |
| | | <select id="countCompleted" resultType="java.lang.Integer"> |
| | | SELECT count(1) FROM product_order |
| | | WHERE end_time >= #{startDate} AND end_time <= #{endDate} |
| | | SELECT count(1) |
| | | FROM product_order |
| | | WHERE end_time >= #{startDate} |
| | | AND end_time <= #{endDate} |
| | | AND complete_quantity >= quantity |
| | | </select> |
| | | |
| | | <select id="countPending" resultType="java.lang.Integer"> |
| | | SELECT count(1) FROM product_order |
| | | WHERE create_time >= #{startDate} AND create_time <= #{endDate} |
| | | SELECT count(1) |
| | | FROM product_order |
| | | WHERE create_time >= #{startDate} |
| | | AND create_time <= #{endDate} |
| | | AND complete_quantity < quantity |
| | | </select> |
| | | <select id="listByProductModelId" resultType="com.ruoyi.production.dto.ProductOrderDto"> |
| | | select po.*, |
| | | sl.sales_contract_no, |
| | | sl.customer_name, |
| | | p.product_name as product_category, |
| | | pm.model as specification_model, |
| | | pm.unit, |
| | | ppr.process_route_code, |
| | | pb.bom_no, |
| | | ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus, |
| | | DATEDIFF(sl.delivery_date, CURDATE()) AS delivery_days_diff, |
| | | sl.delivery_date, |
| | | CASE |
| | | WHEN shipping_status_counts.total_count = 0 THEN false |
| | | WHEN shipping_status_counts.unshipped_count = 0 THEN true |
| | | ELSE false |
| | | END AS is_fh |
| | | from product_order po |
| | | left join sales_ledger sl on po.sales_ledger_id = sl.id |
| | | LEFT JOIN (SELECT sales_ledger_id, |
| | | COUNT(*) as total_count, |
| | | SUM(CASE WHEN status != 'å·²åè´§' THEN 1 ELSE 0 END) as unshipped_count |
| | | FROM shipping_info |
| | | GROUP BY sales_ledger_id) shipping_status_counts |
| | | ON sl.id = shipping_status_counts.sales_ledger_id |
| | | left join product_model pm on po.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id and slp.type = 1 |
| | | left join (select max(id) as id, product_order_id |
| | | from product_process_route |
| | | group by product_order_id) ppr_latest on po.id = ppr_latest.product_order_id |
| | | left join product_process_route ppr on ppr.id = ppr_latest.id |
| | | left join product_bom pb on pb.id = ppr.bom_id |
| | | <where> |
| | | <if test="productModelIds != null and productModelIds.size() > 0"> |
| | | po.product_model_id IN |
| | | <foreach collection="productModelIds" open="(" separator="," close=")" item="item"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="listByProductOrderId" resultType="com.ruoyi.production.dto.ProductOrderDto"> |
| | | select po.*, |
| | | sl.sales_contract_no, |
| | | sl.customer_name, |
| | | p.product_name as product_category, |
| | | pm.model as specification_model, |
| | | pm.unit, |
| | | ppr.process_route_code, |
| | | pb.bom_no, |
| | | ROUND(po.complete_quantity / po.quantity * 100, 2) AS completionStatus, |
| | | DATEDIFF(sl.delivery_date, CURDATE()) AS delivery_days_diff, |
| | | sl.delivery_date, |
| | | CASE |
| | | WHEN shipping_status_counts.total_count = 0 THEN false |
| | | WHEN shipping_status_counts.unshipped_count = 0 THEN true |
| | | ELSE false |
| | | END AS is_fh |
| | | from product_order po |
| | | left join sales_ledger sl on po.sales_ledger_id = sl.id |
| | | LEFT JOIN (SELECT sales_ledger_id, |
| | | COUNT(*) as total_count, |
| | | SUM(CASE WHEN status != 'å·²åè´§' THEN 1 ELSE 0 END) as unshipped_count |
| | | FROM shipping_info |
| | | GROUP BY sales_ledger_id) shipping_status_counts |
| | | ON sl.id = shipping_status_counts.sales_ledger_id |
| | | left join product_model pm on po.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join sales_ledger_product slp on po.sale_ledger_product_id = slp.id and slp.type = 1 |
| | | left join (select max(id) as id, product_order_id |
| | | from product_process_route |
| | | group by product_order_id) ppr_latest on po.id = ppr_latest.product_order_id |
| | | left join product_process_route ppr on ppr.id = ppr_latest.id |
| | | left join product_bom pb on pb.id = ppr.bom_id |
| | | <where> |
| | | <if test="productOrderIds != null and productOrderIds.size() > 0"> |
| | | po.id IN |
| | | <foreach collection="productOrderIds" open="(" separator="," close=")" item="item"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | and po.nps_no like concat('%',#{c.productOrderNpsNo},'%') |
| | | </if> |
| | | </where> |
| | | order by pwo.id desc |
| | | ORDER BY MAX(pwo.id) OVER (PARTITION BY po.nps_no) DESC, ppri.drag_sort ASC |
| | | </select> |
| | | <select id="getProductWorkOrderFlowCard" resultType="com.ruoyi.production.dto.ProductWorkOrderDto"> |
| | | SELECT |
| | |
| | | <result property="status" column="status"/> |
| | | </resultMap> |
| | | |
| | | <!-- <select id="listPageProductionProductMainDto" resultType="com.ruoyi.production.dto.ProductionProductMainDto">--> |
| | | <!-- select ppm.*,--> |
| | | <!-- pwo.work_order_no as workOrderNo,--> |
| | | <!-- pwo.status as workOrderStatus,--> |
| | | <!-- u.nick_name as nickName,--> |
| | | <!-- p.product_name as productName,--> |
| | | <!-- pp.name as process,--> |
| | | <!-- pm.model as productModelName,--> |
| | | <!-- ppo.quantity,--> |
| | | <!-- ppo.scrap_qty,--> |
| | | <!-- pm.unit,--> |
| | | <!-- sl.sales_contract_no salesContractNo--> |
| | | <!-- from--> |
| | | <!-- production_product_main ppm--> |
| | | <!-- left join product_work_order pwo on pwo.id = ppm.work_order_id--> |
| | | <!-- left join product_process_route_item ppri on ppri.id = pwo.product_process_route_item_id--> |
| | | <!-- left join product_process pp on pp.id = ppri.process_id--> |
| | | <!-- left join product_order po on po.id = pwo.product_order_id--> |
| | | <!-- left join production_product_output ppo on ppm.id = ppo.product_main_id--> |
| | | <!-- left join product_model pm on pm.id = ppo.product_model_id--> |
| | | <!-- left join product p on p.id = pm.product_id--> |
| | | <!-- left join sales_ledger sl on sl.id = po.sales_ledger_id--> |
| | | <!-- left join sys_user u on u.user_id = ppm.user_id--> |
| | | <!-- <where>--> |
| | | <!-- <if test="c.nickName != null and c.nickName != ''">--> |
| | | <!-- and u.nick_name like concat('%',#{c.nickName},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="c.workOrderNo != null and c.workOrderNo != ''">--> |
| | | <!-- and pwo.work_order_no like concat('%',#{c.workOrderNo},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="c.workOrderStatus != null and c.workOrderStatus != ''">--> |
| | | <!-- and pwo.status = #{c.workOrderStatus}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="c.status != null and c.status != ''">--> |
| | | <!-- and ppm.status = #{c.status}--> |
| | | <!-- </if>--> |
| | | <!-- </where>--> |
| | | <!-- order by ppm.id--> |
| | | <!-- </select>--> |
| | | |
| | | <!-- æ°sql ç¨ä¸é´è¡¨sales_ledger_production_refè¿è¡å
³èsales_ledgeråproduct_orderï¼æ¥è¯¢åºææå
³èçsales_ledger_no--> |
| | | <select id="listPageProductionProductMainDto" resultType="com.ruoyi.production.dto.ProductionProductMainDto"> |
| | | select ppm.*, |
| | | pwo.work_order_no as workOrderNo, |
| | |
| | | ppo.quantity, |
| | | ppo.scrap_qty, |
| | | pm.unit, |
| | | sl.sales_contract_no salesContractNo |
| | | ( |
| | | SELECT GROUP_CONCAT(DISTINCT sl.sales_contract_no SEPARATOR ',') |
| | | FROM sales_ledger sl |
| | | INNER JOIN sales_ledger_production_ref ref ON sl.id = ref.sales_ledger_id |
| | | WHERE ref.product_order_id = po.id |
| | | ) AS salesContractNo |
| | | from |
| | | production_product_main ppm |
| | | left join product_work_order pwo on pwo.id = ppm.work_order_id |
| | |
| | | left join production_product_output ppo on ppm.id = ppo.product_main_id |
| | | left join product_model pm on pm.id = ppo.product_model_id |
| | | left join product p on p.id = pm.product_id |
| | | left join sales_ledger sl on sl.id = po.sales_ledger_id |
| | | left join sys_user u on u.user_id = ppm.user_id |
| | | <where> |
| | | <if test="c.nickName != null and c.nickName != ''"> |
| | |
| | | and ppm.status = #{c.status} |
| | | </if> |
| | | </where> |
| | | order by ppm.id |
| | | |
| | | order by ppm.create_time desc |
| | | </select> |
| | | |
| | | <select id="getOrderByMainId" resultType="com.ruoyi.production.pojo.ProductOrder"> |
| | | select po.* |
| | | from product_order po |
| | |
| | | left join production_product_main pm on work_order_id = pwo.id |
| | | where pm.id = #{productMainId} |
| | | </select> |
| | | |
| | | <!-- <select id="listProductionDetails" resultType="com.ruoyi.production.dto.ProductionProductMainDto">--> |
| | | <!-- SELECT--> |
| | | <!-- slpa.scheduling_date,--> |
| | | <!-- slpa.scheduling_user_name,--> |
| | | <!-- sl.sales_contract_no,--> |
| | | <!-- sl.customer_name,--> |
| | | <!-- p.product_name,--> |
| | | <!-- pm.model as product_model_name,--> |
| | | <!-- pm.unit,--> |
| | | <!-- slpa.process,--> |
| | | <!-- slpa.finished_num as quantity,--> |
| | | <!-- slpa.work_hours,--> |
| | | <!-- slpa.work_hours * slpa.finished_num AS wages--> |
| | | <!-- FROM--> |
| | | <!-- production_product_main ppm--> |
| | | <!-- LEFT JOIN sales_ledger_production_accounting slpa ON slpa.product_main_id = ppm.id--> |
| | | <!-- LEFT JOIN production_product_output ppo ON ppm.id = ppo.product_main_id--> |
| | | <!-- LEFT JOIN product_work_order pwo ON pwo.id = ppm.work_order_id--> |
| | | <!-- LEFT JOIN product_order po ON po.id = pwo.product_order_id--> |
| | | <!-- LEFT JOIN process_route pr ON pr.id = po.route_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>--> |
| | | <!-- <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>--> |
| | | <!-- order by ppm.id desc--> |
| | | <!-- </select>--> |
| | | |
| | | <!-- æ°sql ç¨ä¸é´è¡¨sales_ledger_production_refè¿è¡å
³èsales_ledgeråproduct_orderï¼æ¥è¯¢åºææå
³èçsales_ledger_noåcustomer_name--> |
| | | <select id="listProductionDetails" resultType="com.ruoyi.production.dto.ProductionProductMainDto"> |
| | | SELECT |
| | | slpa.scheduling_date, |
| | | slpa.scheduling_user_name, |
| | | sl.sales_contract_no, |
| | | sl.customer_name, |
| | | |
| | | (SELECT GROUP_CONCAT(DISTINCT sl_inner.sales_contract_no SEPARATOR ',') |
| | | FROM sales_ledger sl_inner |
| | | INNER JOIN sales_ledger_production_ref ref ON sl_inner.id = ref.sales_ledger_id |
| | | WHERE ref.product_order_id = po.id) AS sales_contract_no, |
| | | (SELECT GROUP_CONCAT(DISTINCT sl_inner.customer_name SEPARATOR ',') |
| | | FROM sales_ledger sl_inner |
| | | INNER JOIN sales_ledger_production_ref ref ON sl_inner.id = ref.sales_ledger_id |
| | | WHERE ref.product_order_id = po.id) AS customer_name, |
| | | |
| | | p.product_name, |
| | | pm.model as product_model_name, |
| | | pm.unit, |
| | |
| | | LEFT JOIN process_route pr ON pr.id = po.route_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> |
| | | <if test="ew.schedulingUserName != null and ew.schedulingUserName !=''"> |
| | | and slpa.scheduling_user_name = #{ew.schedulingUserName} |
| | |
| | | and slpa.scheduling_date < date_add(#{ew.entryDateEnd}, INTERVAL 1 DAY) |
| | | </if> |
| | | </where> |
| | | order by ppm.id desc |
| | | order by ppm.id desc |
| | | </select> |
| | | |
| | | <select id="listMain" resultType="java.lang.Long"> |
| | | SELECT ppm.id FROM production_product_main ppm |
| | | left join product_work_order pwo on pwo.id = ppm.work_order_id |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.ruoyi.quality.mapper.QualityInspectMapper"> |
| | | <!-- <select id="qualityInspectListPage" resultType="com.ruoyi.quality.dto.QualityInspectDto">--> |
| | | <!-- SELECT--> |
| | | <!-- qi.*,--> |
| | | <!-- <choose>--> |
| | | <!-- <when test="qualityInspect.inspectType == 0">--> |
| | | <!-- pl.purchase_contract_number as purchase_contract_no--> |
| | | <!-- </when>--> |
| | | <!-- <otherwise>--> |
| | | <!-- pwo.work_order_no,--> |
| | | <!-- sl.sales_contract_no--> |
| | | <!-- </otherwise>--> |
| | | <!-- </choose>--> |
| | | <!-- FROM--> |
| | | <!-- quality_inspect qi--> |
| | | <!-- <choose>--> |
| | | <!-- <when test="qualityInspect.inspectType == 0 ">--> |
| | | <!-- LEFT JOIN purchase_ledger pl ON pl.id = qi.purchase_ledger_id--> |
| | | <!-- </when>--> |
| | | <!-- <otherwise>--> |
| | | <!-- LEFT JOIN production_product_main ppm ON qi.product_main_id = ppm.id--> |
| | | <!-- LEFT JOIN product_work_order pwo ON ppm.work_order_id = pwo.id--> |
| | | <!-- left join product_order po ON po.id = pwo.product_order_id--> |
| | | <!-- left join sales_ledger sl ON sl.id = po.sales_ledger_id--> |
| | | <!-- </otherwise>--> |
| | | <!-- </choose>--> |
| | | <!-- WHERE--> |
| | | <!-- inspect_type=#{qualityInspect.inspectType}--> |
| | | <!-- <if test="qualityInspect.supplier != null and qualityInspect.supplier != '' ">--> |
| | | <!-- AND qi.supplier like concat('%',#{qualityInspect.supplier},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="qualityInspect.customer != null and qualityInspect.customer != '' ">--> |
| | | <!-- AND qi.customer like concat('%',#{qualityInspect.customer},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="qualityInspect.process != null and qualityInspect.process != '' ">--> |
| | | <!-- AND qi.process like concat('%',#{qualityInspect.process},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="qualityInspect.productName != null and qualityInspect.productName != '' ">--> |
| | | <!-- AND qi.product_name like concat('%',#{qualityInspect.productName},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="qualityInspect.entryDateStart != null and qualityInspect.entryDateStart != '' ">--> |
| | | <!-- AND qi.check_time >= DATE_FORMAT(#{qualityInspect.entryDateStart},'%Y-%m-%d')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="qualityInspect.entryDateEnd != null and qualityInspect.entryDateEnd != '' ">--> |
| | | <!-- AND qi.check_time <= DATE_FORMAT(#{qualityInspect.entryDateEnd},'%Y-%m-%d')--> |
| | | <!-- </if>--> |
| | | <!-- ORDER BY qi.check_time DESC--> |
| | | <!-- </select>--> |
| | | <!-- æ°sql ç¨ä¸é´è¡¨sales_ledger_production_refè¿è¡å
³èsales_ledgeråproduct_orderï¼æ¥è¯¢åºææå
³èçsales_ledger_no--> |
| | | <select id="qualityInspectListPage" resultType="com.ruoyi.quality.dto.QualityInspectDto"> |
| | | SELECT |
| | | qi.*, |
| | |
| | | </when> |
| | | <otherwise> |
| | | pwo.work_order_no, |
| | | sl.sales_contract_no |
| | | (SELECT GROUP_CONCAT(DISTINCT sl_inner.sales_contract_no SEPARATOR ',') |
| | | FROM sales_ledger sl_inner |
| | | INNER JOIN sales_ledger_production_ref ref ON sl_inner.id = ref.sales_ledger_id |
| | | WHERE ref.product_order_id = po.id) AS sales_contract_no |
| | | </otherwise> |
| | | </choose> |
| | | FROM |
| | |
| | | LEFT JOIN production_product_main ppm ON qi.product_main_id = ppm.id |
| | | LEFT JOIN product_work_order pwo ON ppm.work_order_id = pwo.id |
| | | left join product_order po ON po.id = pwo.product_order_id |
| | | left join sales_ledger sl ON sl.id = po.sales_ledger_id |
| | | </otherwise> |
| | | </choose> |
| | | WHERE |
| | |
| | | <if test="qualityInspect.entryDateEnd != null and qualityInspect.entryDateEnd != '' "> |
| | | AND qi.check_time <= DATE_FORMAT(#{qualityInspect.entryDateEnd},'%Y-%m-%d') |
| | | </if> |
| | | ORDER BY qi.check_time DESC |
| | | ORDER BY IF(qi.check_time IS NULL, 1, 0) ASC, qi.check_time DESC, qi.create_time DESC |
| | | </select> |
| | | |
| | | <select id="qualityInspectExport" resultType="com.ruoyi.quality.pojo.QualityInspect"> |
| | |
| | | qu.deal_result, |
| | | qu.deal_name, |
| | | qu.deal_time, |
| | | |
| | | CASE |
| | | WHEN qu.model = pm.id THEN pm.model |
| | | WHEN qu.model REGEXP '^[0-9]+$' AND qu.model = pm.id THEN pm.model |
| | | ELSE qu.model |
| | | END AS model, |
| | | CASE |
| | | WHEN qu.model = pm.id THEN true |
| | | WHEN qu.model REGEXP '^[0-9]+$' AND qu.model = pm.id THEN true |
| | | ELSE false |
| | | END AS method |
| | | |
| | | FROM quality_unqualified qu |
| | | LEFT JOIN product_model pm ON qu.model = pm.id |
| | | where |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.sales.mapper.SalesLedgerProductionRefMapper"> |
| | | |
| | | <select id="getProductionOrderIdsBySalesLedgerId" resultType="java.lang.Long"> |
| | | SELECT product_order_id |
| | | FROM sales_ledger_production_ref |
| | | WHERE sales_ledger_id = #{salesLedgerId} |
| | | </select> |
| | | |
| | | </mapper> |