From 30ef534fcffe0520bebe7a34abe69d7afbbf227f Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 13 八月 2026 13:53:31 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_西宁_湟水峡' into dev_西宁_湟水峡
---
src/main/resources/mapper/production/ProductWorkOrderMapper.xml | 2
src/main/java/com/ruoyi/sales/dto/SalesLedgerDto.java | 7
src/main/java/com/ruoyi/sales/pojo/SalesLedgerProductionRef.java | 29 ++
src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml | 6
src/main/java/com/ruoyi/production/service/ProductOrderService.java | 3
src/main/java/com/ruoyi/sales/pojo/SalesLedger.java | 6
src/main/java/com/ruoyi/production/controller/ProductionProductMainController.java | 1
doc/sales_ledger_production_ref.sql | 31 ++
src/main/java/com/ruoyi/production/mapper/ProductOrderMapper.java | 4
src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java | 19 +
src/main/resources/mapper/production/ProductOrderMapper.xml | 211 ++++++++++++++++--
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductionRefServiceImpl.java | 11 +
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 54 ++++
src/main/java/com/ruoyi/production/controller/SalesLedgerProductionAccountingController.java | 6
src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java | 14 +
src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java | 20 +
src/main/java/com/ruoyi/sales/service/SalesLedgerProductionRefService.java | 7
src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductionRefMapper.java | 14 +
src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java | 5
src/main/resources/mapper/approve/ApproveProcessMapper.xml | 1
src/main/resources/mapper/quality/QualityInspectMapper.xml | 56 ++++
src/main/java/com/ruoyi/production/controller/ProductOrderController.java | 6
src/main/resources/mapper/device/DeviceRepairMapper.xml | 1
src/main/resources/mapper/production/ProductionProductMainMapper.xml | 111 +++++++++
src/main/resources/mapper/sales/SalesLedgerProductionRefMapper.xml | 11 +
25 files changed, 570 insertions(+), 66 deletions(-)
diff --git a/doc/sales_ledger_production_ref.sql b/doc/sales_ledger_production_ref.sql
new file mode 100644
index 0000000..ce9f65a
--- /dev/null
+++ b/doc/sales_ledger_production_ref.sql
@@ -0,0 +1,31 @@
+/*
+ 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 '閿�鍞彴璐d',
+ `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;
diff --git a/src/main/java/com/ruoyi/production/controller/ProductOrderController.java b/src/main/java/com/ruoyi/production/controller/ProductOrderController.java
index 611a64a..79ea947 100644
--- a/src/main/java/com/ruoyi/production/controller/ProductOrderController.java
+++ b/src/main/java/com/ruoyi/production/controller/ProductOrderController.java
@@ -31,6 +31,12 @@
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) {
diff --git a/src/main/java/com/ruoyi/production/controller/ProductionProductMainController.java b/src/main/java/com/ruoyi/production/controller/ProductionProductMainController.java
index 504ef5f..143f347 100644
--- a/src/main/java/com/ruoyi/production/controller/ProductionProductMainController.java
+++ b/src/main/java/com/ruoyi/production/controller/ProductionProductMainController.java
@@ -28,6 +28,7 @@
* @return
*/
@GetMapping("listPage")
+ @ApiOperation("鎶ュ伐鏌ヨ")
public R page(Page<ProductionProductMainDto> page, ProductionProductMainDto productionProductMainDto) {
return R.ok(productionProductMainService.listPageProductionProductMainDto(page, productionProductMainDto));
}
diff --git a/src/main/java/com/ruoyi/production/controller/SalesLedgerProductionAccountingController.java b/src/main/java/com/ruoyi/production/controller/SalesLedgerProductionAccountingController.java
index 02d36c8..1f496f6 100644
--- a/src/main/java/com/ruoyi/production/controller/SalesLedgerProductionAccountingController.java
+++ b/src/main/java/com/ruoyi/production/controller/SalesLedgerProductionAccountingController.java
@@ -59,19 +59,19 @@
}
//----------------------------------------------------------------------------------------------------------------------------------------------------
@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));
}
diff --git a/src/main/java/com/ruoyi/production/mapper/ProductOrderMapper.java b/src/main/java/com/ruoyi/production/mapper/ProductOrderMapper.java
index 72aa6cd..adecd25 100644
--- a/src/main/java/com/ruoyi/production/mapper/ProductOrderMapper.java
+++ b/src/main/java/com/ruoyi/production/mapper/ProductOrderMapper.java
@@ -27,4 +27,8 @@
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);
}
diff --git a/src/main/java/com/ruoyi/production/service/ProductOrderService.java b/src/main/java/com/ruoyi/production/service/ProductOrderService.java
index 5a714a6..3328b00 100644
--- a/src/main/java/com/ruoyi/production/service/ProductOrderService.java
+++ b/src/main/java/com/ruoyi/production/service/ProductOrderService.java
@@ -25,4 +25,7 @@
Boolean addProductOrder(ProductOrder productOrder);
Boolean delete(Long[] id);
+
+ List<ProductOrderDto> listByProductModelId(List<Long> productModelIds);
+
}
diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
index 8a1099c..dbd377d 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductOrderServiceImpl.java
@@ -23,6 +23,7 @@
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;
@@ -68,6 +69,14 @@
@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
@@ -149,11 +158,11 @@
//濡傛灉宸茬粡寮�濮嬬敓浜�,涓嶈兘鍒犻櫎
//鏌ヨ鐢熶骇璁㈠崟涓嬬殑宸ュ崟
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("鐢熶骇璁㈠崟宸茬粡寮�濮嬬敓浜�,涓嶈兘鍒犻櫎");
}
//鍒犻櫎宸ュ崟
@@ -170,6 +179,7 @@
return true;
}
+
//鑾峰彇褰撳墠鐢熶骇璁㈠崟鍙�
public String getMaxOrderNoByDate(String datePrefix) {
QueryWrapper<ProductOrder> queryWrapper = new QueryWrapper<>();
diff --git a/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java b/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
index cbef46f..677ea42 100644
--- a/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
+++ b/src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
@@ -11,6 +11,7 @@
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;
@@ -120,12 +121,12 @@
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) {
@@ -154,10 +155,10 @@
@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;
}
@@ -183,6 +184,7 @@
* 鏂板淇敼閿�鍞彴璐�
*/
@Log(title = "閿�鍞彴璐�", businessType = BusinessType.INSERT)
+ @ApiOperation(value = "鏂板淇敼閿�鍞彴璐�", notes = "鏂板淇敼閿�鍞彴璐�")
@PostMapping("/addOrUpdateSalesLedger")
public AjaxResult add(@RequestBody SalesLedgerDto salesLedgerDto) {
return toAjax(salesLedgerService.addOrUpdateSalesLedger(salesLedgerDto));
@@ -249,13 +251,14 @@
* 杩戝崐骞村紑绁�,鍥炴閲戦
*/
@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);
@@ -265,6 +268,12 @@
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());
diff --git a/src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java b/src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java
index d29730f..40a490e 100644
--- a/src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java
+++ b/src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java
@@ -19,6 +19,7 @@
public class SalesQuotationController {
@Autowired
private SalesQuotationService salesQuotationService;
+
@GetMapping("/list")
public AjaxResult getList(Page page, SalesQuotationDto salesQuotationDto) {
return AjaxResult.success(salesQuotationService.listPage(page, salesQuotationDto));
@@ -27,11 +28,11 @@
@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(), "鍙嶉鐧昏");
}
@@ -39,6 +40,7 @@
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));
@@ -46,18 +48,20 @@
/**
* 璇︽儏 鏍规嵁瀹㈡埛绫诲瀷鍜屼骇鍝佽繑鍥炴姤浠峰崟浠�
- * @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));
diff --git a/src/main/java/com/ruoyi/sales/dto/SalesLedgerDto.java b/src/main/java/com/ruoyi/sales/dto/SalesLedgerDto.java
index 462169d..c138f56 100644
--- a/src/main/java/com/ruoyi/sales/dto/SalesLedgerDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/SalesLedgerDto.java
@@ -2,6 +2,7 @@
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;
@@ -62,4 +63,10 @@
@ApiModelProperty(value = "瀹℃壒浜篿ds")
private String approveUserIds;
+
+ @ApiModelProperty(value = "鐢熶骇璁㈠崟ids")
+ private List<Long> productionOrderIds;
+
+ @ApiModelProperty(value = "宸茬粦瀹氬鎵硅鍗曞垪琛�")
+ private List<ProductOrderDto> productionOrders;
}
diff --git a/src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductionRefMapper.java b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductionRefMapper.java
new file mode 100644
index 0000000..84eaa48
--- /dev/null
+++ b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerProductionRefMapper.java
@@ -0,0 +1,14 @@
+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);
+
+}
diff --git a/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java b/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java
index b658cf1..5a9c90a 100644
--- a/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java
+++ b/src/main/java/com/ruoyi/sales/pojo/SalesLedger.java
@@ -3,10 +3,12 @@
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;
@@ -166,6 +168,10 @@
@TableField(exist = false)
private String approveUserIds;
+ @ApiModelProperty(value = "宸茬粦瀹氬鎵硅鍗曞垪琛�")
+ @TableField(exist = false)
+ private List<ProductOrderDto> productionOrders;
+
}
diff --git a/src/main/java/com/ruoyi/sales/pojo/SalesLedgerProductionRef.java b/src/main/java/com/ruoyi/sales/pojo/SalesLedgerProductionRef.java
new file mode 100644
index 0000000..dda6643
--- /dev/null
+++ b/src/main/java/com/ruoyi/sales/pojo/SalesLedgerProductionRef.java
@@ -0,0 +1,29 @@
+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 = "閿�鍞彴璐D")
+ private Long salesLedgerId;
+
+ @ApiModelProperty(name = "鐢熶骇璁㈠崟ID")
+ private Long productOrderId;
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java b/src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java
index 1bcedd8..087eae6 100644
--- a/src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java
+++ b/src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java
@@ -6,6 +6,7 @@
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;
@@ -57,4 +58,8 @@
IPage<AfterSalesLedgerDto> listSalesLedger(AfterSalesLedgerDto salesLedgerDto, Page page);
SalesLedgerDto getSalesByCode(SalesLedgerDto salesLedgerDto);
+
+ List<ProductOrderDto> getProductionOrdersBySalesLedgerId(Long salesLedgerId);
+
+ void getProductionOrders(List<SalesLedger> records);
}
diff --git a/src/main/java/com/ruoyi/sales/service/SalesLedgerProductionRefService.java b/src/main/java/com/ruoyi/sales/service/SalesLedgerProductionRefService.java
new file mode 100644
index 0000000..e663ba6
--- /dev/null
+++ b/src/main/java/com/ruoyi/sales/service/SalesLedgerProductionRefService.java
@@ -0,0 +1,7 @@
+package com.ruoyi.sales.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.sales.pojo.SalesLedgerProductionRef;
+
+public interface SalesLedgerProductionRefService extends IService<SalesLedgerProductionRef> {
+}
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductionRefServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductionRefServiceImpl.java
new file mode 100644
index 0000000..385b507
--- /dev/null
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductionRefServiceImpl.java
@@ -0,0 +1,11 @@
+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 {
+}
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index 30a7690..40836c8 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -31,6 +31,7 @@
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;
@@ -44,6 +45,7 @@
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;
@@ -166,6 +168,10 @@
private SysUserMapper sysUserMapper;
@Autowired
private CustomerPrivatePoolMapper customerPrivatePoolMapper;
+ @Autowired
+ private SalesLedgerProductionRefService salesLedgerProductionRefService;
+ @Autowired
+ private SalesLedgerProductionRefMapper salesLedgerProductionRefMapper;
@Override
public List<SalesLedger> selectSalesLedgerList(SalesLedgerDto salesLedgerDto) {
@@ -212,7 +218,8 @@
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());
@@ -551,6 +558,24 @@
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());
+
+
+ }
+
/**
* 涓嬪垝绾垮懡鍚嶈浆椹煎嘲鍛藉悕
*/
@@ -691,7 +716,10 @@
);
}
- // 5. 杩佺Щ涓存椂鏂囦欢鍒版寮忕洰褰�
+ //5. 缁戝畾閿�鍞鍗曞拰鐢熶骇璁㈠崟
+ bindSalesOrderAndProductionOrder(salesLedgerDto.getProductionOrderIds(), salesLedger.getId());
+
+ // 6. 杩佺Щ涓存椂鏂囦欢鍒版寮忕洰褰�
if (salesLedgerDto.getTempFileIds() != null && !salesLedgerDto.getTempFileIds().isEmpty()) {
migrateTempFilesToFormal(salesLedger.getId(), salesLedgerDto.getTempFileIds());
}
@@ -701,6 +729,26 @@
} 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 {
@@ -817,7 +865,7 @@
salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice());
salesLedgerProductMapper.insert(salesLedgerProduct);
// 娣诲姞鐢熶骇鏁版嵁
- salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct);
+ //salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct);
}
}
}
diff --git a/src/main/resources/mapper/approve/ApproveProcessMapper.xml b/src/main/resources/mapper/approve/ApproveProcessMapper.xml
index 33b29a9..ca02119 100644
--- a/src/main/resources/mapper/approve/ApproveProcessMapper.xml
+++ b/src/main/resources/mapper/approve/ApproveProcessMapper.xml
@@ -38,5 +38,6 @@
<if test="req.approveType != null ">
and approve_type = #{req.approveType}
</if>
+ order by approve_time desc
</select>
</mapper>
diff --git a/src/main/resources/mapper/device/DeviceRepairMapper.xml b/src/main/resources/mapper/device/DeviceRepairMapper.xml
index aeb87a8..8578e7c 100644
--- a/src/main/resources/mapper/device/DeviceRepairMapper.xml
+++ b/src/main/resources/mapper/device/DeviceRepairMapper.xml
@@ -50,6 +50,7 @@
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,
diff --git a/src/main/resources/mapper/production/ProductOrderMapper.xml b/src/main/resources/mapper/production/ProductOrderMapper.xml
index eb8831f..dfbdcd1 100644
--- a/src/main/resources/mapper/production/ProductOrderMapper.xml
+++ b/src/main/resources/mapper/production/ProductOrderMapper.xml
@@ -13,40 +13,96 @@
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
+
+<!-- 鏃ql-->
+ <!-- <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>-->
+
+<!-- 鏂皊ql 鐢ㄤ腑闂磋〃sales_ledger_production_ref杩涜鍏宠仈sales_ledger鍜宲roduct_order锛屾煡璇㈠嚭鎵�鏈夊叧鑱旂殑sales_ledger_no鍜宑ustomer_name銆備氦鏈燂紝浜ゆ湡鍋忓樊锛屾槸鍚﹀彂璐х敱浜庝竴涓敓浜ц鍗曞搴斿涓攢鍞鍗曪紝瀵艰嚧鏃犳硶姝e父鏄剧ず锛屾殏鏃剁渷鐣�-->
<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>
@@ -69,7 +125,11 @@
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
@@ -84,35 +144,124 @@
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>
diff --git a/src/main/resources/mapper/production/ProductWorkOrderMapper.xml b/src/main/resources/mapper/production/ProductWorkOrderMapper.xml
index ecf0143..fcbf818 100644
--- a/src/main/resources/mapper/production/ProductWorkOrderMapper.xml
+++ b/src/main/resources/mapper/production/ProductWorkOrderMapper.xml
@@ -49,7 +49,7 @@
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
diff --git a/src/main/resources/mapper/production/ProductionProductMainMapper.xml b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
index eff9edf..322b2df 100644
--- a/src/main/resources/mapper/production/ProductionProductMainMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
@@ -12,6 +12,47 @@
<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>-->
+
+ <!-- 鏂皊ql 鐢ㄤ腑闂磋〃sales_ledger_production_ref杩涜鍏宠仈sales_ledger鍜宲roduct_order锛屾煡璇㈠嚭鎵�鏈夊叧鑱旂殑sales_ledger_no-->
<select id="listPageProductionProductMainDto" resultType="com.ruoyi.production.dto.ProductionProductMainDto">
select ppm.*,
pwo.work_order_no as workOrderNo,
@@ -23,7 +64,12 @@
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
@@ -33,7 +79,6 @@
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 != ''">
@@ -49,9 +94,9 @@
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
@@ -59,12 +104,61 @@
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>-->
+
+ <!-- 鏂皊ql 鐢ㄤ腑闂磋〃sales_ledger_production_ref杩涜鍏宠仈sales_ledger鍜宲roduct_order锛屾煡璇㈠嚭鎵�鏈夊叧鑱旂殑sales_ledger_no鍜宑ustomer_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,
@@ -81,7 +175,7 @@
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}
@@ -95,8 +189,9 @@
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
diff --git a/src/main/resources/mapper/quality/QualityInspectMapper.xml b/src/main/resources/mapper/quality/QualityInspectMapper.xml
index e5ce119..2aeed4f 100644
--- a/src/main/resources/mapper/quality/QualityInspectMapper.xml
+++ b/src/main/resources/mapper/quality/QualityInspectMapper.xml
@@ -1,6 +1,54 @@
<?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>-->
+ <!-- 鏂皊ql 鐢ㄤ腑闂磋〃sales_ledger_production_ref杩涜鍏宠仈sales_ledger鍜宲roduct_order锛屾煡璇㈠嚭鎵�鏈夊叧鑱旂殑sales_ledger_no-->
<select id="qualityInspectListPage" resultType="com.ruoyi.quality.dto.QualityInspectDto">
SELECT
qi.*,
@@ -10,7 +58,10 @@
</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
@@ -23,7 +74,6 @@
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
@@ -46,7 +96,7 @@
<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">
diff --git a/src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml b/src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml
index 5bda4f6..9af977a 100644
--- a/src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml
+++ b/src/main/resources/mapper/quality/QualityUnqualifiedMapper.xml
@@ -16,14 +16,16 @@
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
diff --git a/src/main/resources/mapper/sales/SalesLedgerProductionRefMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductionRefMapper.xml
new file mode 100644
index 0000000..40aa4f2
--- /dev/null
+++ b/src/main/resources/mapper/sales/SalesLedgerProductionRefMapper.xml
@@ -0,0 +1,11 @@
+<?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>
\ No newline at end of file
--
Gitblit v1.9.3