Browse Source

完善代码

yuansh 1 month ago
parent
commit
645f07fe65

+ 4 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrder.java

@@ -221,6 +221,10 @@ public class PurOrder implements Serializable {
     private BigDecimal totalAmount;
     //订单总金额(已被付款申请参照金额)
     private BigDecimal totalAmountUsed;
+    //采购整单折扣
+    private BigDecimal discountHead;
+    //折后金额
+    private BigDecimal discountAmount;
 
 
     //导出字段使用

+ 4 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderHis.java

@@ -222,5 +222,9 @@ public class PurOrderHis implements Serializable {
     private BigDecimal totalAmount;
     //订单总金额(已被付款申请参照金额)
     private BigDecimal totalAmountUsed;
+    //采购整单折扣
+    private BigDecimal discountHead;
+    //折后金额
+    private BigDecimal discountAmount;
 
 }

+ 13 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/service/impl/PurOrderServiceImpl.java

@@ -62,6 +62,11 @@ public class PurOrderServiceImpl extends ServiceImpl<PurOrderMapper, PurOrder> i
 		purOrder.setTotalAmount(totalAmount);
 		purOrder.setTotalAmountUsed(BigDecimal.ZERO);
 
+		if(purOrder.getDiscountHead() == null){
+			purOrder.setDiscountHead(BigDecimal.ZERO);
+			purOrder.setDiscountAmount(totalAmount);
+		}
+
 		purOrderMapper.insert(purOrder);
 		if(purOrderShipList!=null && purOrderShipList.size()>0) {
 			for(PurOrderShip entity:purOrderShipList) {
@@ -143,6 +148,10 @@ public class PurOrderServiceImpl extends ServiceImpl<PurOrderMapper, PurOrder> i
 		}
 		purOrder.setTotalAmount(totalAmount);
 
+		if(purOrder.getDiscountHead() == null){
+			purOrder.setDiscountHead(BigDecimal.ZERO);
+			purOrder.setDiscountAmount(totalAmount);
+		}
 		purOrderMapper.updateById(purOrder);
 		
 		//1.先删除子表数据
@@ -231,6 +240,10 @@ public class PurOrderServiceImpl extends ServiceImpl<PurOrderMapper, PurOrder> i
 		}
 		purOrder.setTotalAmount(totalAmount);
 
+		if(purOrder.getDiscountHead() == null){
+			purOrder.setDiscountHead(BigDecimal.ZERO);
+			purOrder.setDiscountAmount(totalAmount);
+		}
 		purOrderMapper.updateById(purOrder);
 
 		//1.先删除子表数据

+ 5 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurOrderAlert.java

@@ -44,6 +44,11 @@ public class PurOrderAlert implements Serializable {
     private BigDecimal totalAmountUsed;
 
 
+    //采购整单折扣
+    private BigDecimal discountHead;
+    //折后金额
+    private BigDecimal discountAmount;
+
 //    /**创建时间*/
 //	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
 //    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")

+ 5 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurOrderHisPage.java

@@ -36,6 +36,11 @@ public class PurOrderHisPage {
 	private BigDecimal totalAmount;
 	//订单总金额(已被付款申请参照金额)
 	private BigDecimal totalAmountUsed;
+	//采购整单折扣
+	private BigDecimal discountHead;
+	//折后金额
+	private BigDecimal discountAmount;
+
 
 	private String purchaseDepartmentName;
 	private String purchasemanName;

+ 4 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurOrderPage.java

@@ -214,6 +214,10 @@ public class PurOrderPage {
 	@Excel(name = "来源2", width = 15)
 	@ApiModelProperty(value = "来源2")
     private String sourceCode2;
+	//采购整单折扣
+	private BigDecimal discountHead;
+	//折后金额
+	private BigDecimal discountAmount;
 
 	@ExcelCollection(name="采购订单子表 - 船明细")
 	@ApiModelProperty(value = "采购订单子表 - 船明细")

+ 13 - 9
srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleInvoiceController.java

@@ -712,9 +712,9 @@ public class SaleInvoiceController {
                     }
                 }
 
-                if(saleOrder != null){
-                    saleInvoice.setContacts(saleOrder.getSalesmanName());
-                }
+//                if(saleOrder != null){
+//                    saleInvoice.setContacts(saleOrder.getSalesmanName());
+//                }
 
 //                if (StringUtils.isNotBlank(orderCode)) {
 //                    LambdaQueryWrapper<SaleDelivery> saleDeliveryQueryWrapper = new LambdaQueryWrapper<>();
@@ -736,7 +736,7 @@ public class SaleInvoiceController {
 //                    }
 //                }
 
-                /*
+
                 String customerId = saleInvoice.getCustomer();
                 if (StringUtils.isNotBlank(customerId)) {
 
@@ -747,7 +747,8 @@ public class SaleInvoiceController {
                         saleInvoice.setPhone(classEnt.getPhone());
                         saleInvoice.setEmail(classEnt.getEmail());
                     }
-                }*/
+                }
+
                 // 获取计产品档案
                 List<BaseProductArchive> productArchiveList = new ArrayList<>();
                 if (oConvertUtils.listIsNotEmpty(productList)){
@@ -858,10 +859,13 @@ public class SaleInvoiceController {
                 saleInvoice.setOrderMoney(orderMoney.setScale(2));
                 saleInvoice.setAgreementTerms(saleOrder.getAgreementTerms());
                 // 制单人信息
-                SysUser sysUser = sysUserService.getUserByName(saleInvoice.getCreateBy());
-                saleInvoice.setSalesPhone(sysUser.getPhone());
-                saleInvoice.setSalesEmail(sysUser.getEmail());
-                saleInvoice.setSalesmanName(sysUser.getRealname());
+//                SysUser sysUser = sysUserService.getUserByName(saleInvoice.getCreateBy());
+                if(saleOrder !=null){
+                    SysUser sysUser = sysUserService.getUserByName(saleOrder.getCreateBy());
+                    saleInvoice.setSalesPhone(sysUser.getPhone());
+                    saleInvoice.setSalesEmail(sysUser.getEmail());
+                    saleInvoice.setSalesmanName(sysUser.getRealname());
+                }
 
                 String templateFilePath = uploadpath + templates.getTemplateFile();
                 String tempFilePath = uploadpath + "/"+ UUIDGenerator.generate()+".xlsx";