diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java index 74f7fa9c..a49af649 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java @@ -1,6 +1,10 @@ package com.ruoyi.purchase.controller; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import com.ruoyi.quality.domain.QualityOrderDetail; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -99,7 +103,6 @@ public class PurchaseOrderChildController extends BaseController mmap.put("purchaseOrderChild", purchaseOrderChild); return prefix + "/edit"; } - /** * 修改保存采购订单子表 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java index cdbefe30..2f042caa 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java @@ -22,8 +22,10 @@ import com.ruoyi.purchase.domain.PurchaseOrderChild; import com.ruoyi.purchase.domain.PurchaseQuoteChild; import com.ruoyi.purchase.domain.exportDto.PurchaseMaterialDto; import com.ruoyi.purchase.domain.exportDto.PurchaseOrderDto; +import com.ruoyi.purchase.mapper.PurchaseOrderChildMapper; import com.ruoyi.purchase.service.IPurchaseMaterialService; import com.ruoyi.purchase.service.IPurchaseOrderService; +import com.ruoyi.quality.domain.QualityOrderDetail; import com.ruoyi.storehouse.utils.CustomRowWriteCellHandler; import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -37,6 +39,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.math.BigDecimal; import java.util.*; +import java.util.stream.Collectors; import static com.ruoyi.common.config.datasource.DynamicDataSourceContextHolder.log; @@ -56,7 +59,8 @@ public class PurchaseOrderController extends BaseController private IPurchaseOrderService purchaseOrderService; @Autowired private IPurchaseMaterialService purchaseMaterialService; - + @Autowired + private PurchaseOrderChildMapper purchaseOrderChildService;; @Autowired private RedisCache redisCache; @@ -120,7 +124,7 @@ public class PurchaseOrderController extends BaseController BigDecimal materialRmbSum = BigDecimal.valueOf(0.0); BigDecimal materialSum = BigDecimal.valueOf(0.0); Long materialNum = 0L; - Long supplierNum = 0L; + int supplierNum = 0; for (PurchaseOrderChild purchaseOrderChild : purchaseMaterials) { purchaseOrderChild.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); for (PurchaseQuoteChild purchaseSupplierQuote : purchaseOrderChild.getPurchaseQuoteChildList()){ @@ -143,7 +147,7 @@ public class PurchaseOrderController extends BaseController purchaseOrderChild.setMaterialRmb(materialRmb); purchaseOrderChild.setMaterialNum(materialNum); } - purchaseOrder.setSupplierNum(Math.toIntExact(supplierNum)); + purchaseOrder.setSupplierNum(supplierNum); return toAjax(purchaseOrderService.insertPurchaseOrder(purchaseOrder)); } @@ -157,7 +161,24 @@ public class PurchaseOrderController extends BaseController mmap.put("purchaseOrder", purchaseOrder); return prefix + "/edit"; } + @GetMapping("/detail/{purchaseOrderChildId}") + public String detail(@PathVariable("purchaseOrderChildId") Long purchaseOrderChildId, ModelMap mmap) + { + PurchaseOrderChild purchaseOrderChild = purchaseOrderChildService.selectPurchaseOrderChildById(purchaseOrderChildId); + mmap.put("purchaseOrderChild", purchaseOrderChild); + return prefix + "/detail"; + } + @ResponseBody + @RequestMapping("/detailListGroupedBySupplier") + public Map> detailListGroupedBySupplier(String qualityOrderCode) { + PurchaseOrderChild purchaseOrderChild = new PurchaseOrderChild(); + purchaseOrderChild.setPurchaseOrderCode(qualityOrderCode); + List allDetails = purchaseOrderChildService.selectPurchaseOrderChildList(purchaseOrderChild); + Map> groupedDetails = allDetails.stream() + .collect(Collectors.groupingBy(PurchaseOrderChild::getSupplierCode)); + return groupedDetails; + } /** * 修改保存采购订单 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java index 0ff3a2c4..c7af76bd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java @@ -97,7 +97,6 @@ public class PurchaseOrderChild extends BaseEntity /** 备用二 */ @Excel(name = "备用二") private String standbyTwo; - private List purchaseQuoteChildList; public List getPurchaseQuoteChildList() { diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/add.html b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/add.html index 5f2ab474..526da708 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/add.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/add.html @@ -21,34 +21,35 @@
- + + - 代码生成请选择字典属性
- +
- +
- +
- +
@@ -62,6 +63,18 @@
diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html index 13fcbaeb..2c2727a8 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html @@ -90,10 +90,8 @@ fixedColumns: true, // 启用冻结列 rightFixedColumns:1, fixedRightNumber: 1, // 冻结右列个数 - onExpandRow:function(index,row,$detail){ - $detail.html( - '
' - ).find('table'); + onExpandRow : function(index,row,$detail){ + $detail.html('
').find('table'); // 一阶 initChildTable(index,row,$detail); }, @@ -105,7 +103,7 @@ }, {title: '采购计划单号',field: 'purchasePlanCode'}, {title: '关联单号', field: 'correlationCode',}, - {title: '采购来源',field: 'purchasePlanType',}, + {title: '采购来源',field: 'purchasePlanType',formatter: function(value, row, index) {return $.table.selectDictLabel(purchasePlanTypeDatas, value);}}, {title: '物料合计',field: 'materialAmount',}, {title: '数量总计', field: 'materialSum',}, {title: '不含税总价(RMB)',field: 'noRmbSum',},