Browse Source

完善代码

yuansh 3 tháng trước cách đây
mục cha
commit
c4d4e33b83

+ 1 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurInquiryFormController.java

@@ -375,6 +375,7 @@ public class PurInquiryFormController {
                         a.setSourceId2(o.getId());
                         a.setCurrency(o.getCurrency());
                         a.setDeliveryDayChild(o.getDeliveryDayChild());
+                        a.setQualityGrade(o.getQualityGrade());
 
                         a.setTaxPriceUsd(o.getTaxPriceUsd());
                         a.setTaxAmountUsd(o.getTaxAmountUsd());

+ 15 - 1
srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleDeliveryController.java

@@ -114,8 +114,22 @@ public class SaleDeliveryController {
         return Result.OK(pageList);
     }
 
+    @ApiOperation(value = "发货通知单弹框明细", notes = "发货通知单弹框明细")
+    @GetMapping(value = "/selectSaleDeliveryAlertInvoice")
+    @PermissionData(pageComponent="saleCode/deliveryNotice/deliveryNoticeList")
+    public Result<IPage<SaleDeliveryAlert>> selectSaleDeliveryAlertInvoice(SaleDeliveryAlert saleInquiryForm,
+                                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                    HttpServletRequest req) {
+
+        QueryWrapper<SaleDeliveryAlert> queryWrapper = QueryGenerator.initQueryWrapper(saleInquiryForm, req.getParameterMap());
+        Page<SaleDeliveryAlert> page = new Page<SaleDeliveryAlert>(pageNo, pageSize);
+        IPage<SaleDeliveryAlert> pageList = saleDeliveryDetailsService.selectSaleDeliveryAlertInvoice(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
 
-    @ApiOperation(value = "发货通知单弹框明细(运费采购订单)", notes = "发货通知单弹框明细")
+    @ApiOperation(value = "发货通知单弹框明细(运费采购订单) 无用", notes = "发货通知单弹框明细")
     @GetMapping(value = "/selectSaleDeliveryAlertFee")
     public Result<IPage<SaleDeliveryAlert>> selectSaleDeliveryAlertFee(SaleDeliveryAlert saleInquiryForm,
                                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,

+ 3 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/entity/SaleDelivery.java

@@ -197,6 +197,9 @@ public class SaleDelivery implements Serializable {
     //是否已被运费参照
     private String carriageUsed;
 
+    //是否收取客户运费(是/否)
+    private String customerFee;
+
     @Excel(name = "包装详情(packingDetails)", width = 15)
     @ApiModelProperty(value = "包装详情(packingDetails)")
     private String packingDetails;

+ 5 - 3
srm-module-code/src/main/java/org/jeecg/modules/saleCode/entity/SaleOrderProduct.java

@@ -116,10 +116,12 @@ public class SaleOrderProduct implements Serializable {
 	@Excel(name = "质量等级", width = 15)
     @ApiModelProperty(value = "质量等级")
     private String qualityGrade;
-	/**数量*/
-	@Excel(name = "数量", width = 15)
+    /**数量*/
+    @Excel(name = "数量", width = 15)
     @ApiModelProperty(value = "数量")
-    private Double quantity;
+    private java.math.BigDecimal quantity;
+    @ApiModelProperty(value = "到货数量")
+    private java.math.BigDecimal deliveryQuantity;
 	/**税率(tax rate)*/
 	@Excel(name = "税率(tax rate)", width = 15)
     @ApiModelProperty(value = "税率(tax rate)")

+ 3 - 1
srm-module-code/src/main/java/org/jeecg/modules/saleCode/entity/SaleOrderProductHis.java

@@ -121,7 +121,9 @@ public class SaleOrderProductHis implements Serializable {
 	/**数量*/
 	@Excel(name = "数量", width = 15)
     @ApiModelProperty(value = "数量")
-    private Double quantity;
+    private java.math.BigDecimal quantity;
+    @ApiModelProperty(value = "数量")
+    private java.math.BigDecimal deliveryQuantity;
 	/**税率(tax rate)*/
 	@Excel(name = "税率(tax rate)", width = 15)
     @ApiModelProperty(value = "税率(tax rate)")

+ 1 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/mapper/SaleDeliveryDetailsMapper.java

@@ -35,5 +35,6 @@ public interface SaleDeliveryDetailsMapper extends BaseMapper<SaleDeliveryDetail
 	public List<SaleDeliveryDetails> selectByMainId(@Param("mainId") String mainId);
 
 	public IPage<SaleDeliveryAlert> selectSaleDeliveryAlert(Page<SaleDeliveryAlert> page, @Param("ew") QueryWrapper<SaleDeliveryAlert> queryWrapper);
+	public IPage<SaleDeliveryAlert> selectSaleDeliveryAlertInvoice(Page<SaleDeliveryAlert> page, @Param("ew") QueryWrapper<SaleDeliveryAlert> queryWrapper);
 
 }

+ 42 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/mapper/xml/SaleDeliveryDetailsMapper.xml

@@ -55,4 +55,46 @@
             ${ew.customSqlSegment}
 
     </select>
+    <select id="selectSaleDeliveryAlertInvoice" parameterType="java.lang.String"
+            resultType="org.jeecg.modules.saleCode.vo.SaleDeliveryAlert">
+        select *
+        from (select a.id            headId
+                   , b.id            child_id
+                   , a.model         head_model
+                   , b.model         child_model
+
+                   , b.delivery_time delivery_time
+                   , a.*
+                   , b.product_id
+                   , b.product_class
+                   , b.product_code
+                   , b.chinese_name
+                   , b.english_name
+                   , b.specifications
+                   , b.partno
+                   , b.drawingno
+                   , b.orderno
+                   , b.factory
+                   , b.quality_grade
+                   , b.quantity
+                   , b.tax_price
+                   , b.tax_rate
+                   , b.money
+                   , b.delivery_money
+                   , b.delivery_quantity
+                   , b.order_money
+                   , b.order_quantity
+                   , b.notes         childNotes
+              from sale_delivery a
+                       left join sale_delivery_details b on a.id = b.head_id
+                       left join base_product_archive c on b.product_id = c.id
+              where a.del_flag = 0
+                and a.submit = 1
+                and a.close = 0
+                and b.del_flag = 0
+
+             ) a
+            ${ew.customSqlSegment}
+
+    </select>
 </mapper>

+ 1 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/ISaleDeliveryDetailsService.java

@@ -27,4 +27,5 @@ public interface ISaleDeliveryDetailsService extends IService<SaleDeliveryDetail
 
 
 	public IPage<SaleDeliveryAlert> selectSaleDeliveryAlert(Page<SaleDeliveryAlert> page, QueryWrapper<SaleDeliveryAlert> queryWrapper);
+	public IPage<SaleDeliveryAlert> selectSaleDeliveryAlertInvoice(Page<SaleDeliveryAlert> page, QueryWrapper<SaleDeliveryAlert> queryWrapper);
 }

+ 5 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/impl/SaleDeliveryDetailsServiceImpl.java

@@ -36,4 +36,9 @@ public class SaleDeliveryDetailsServiceImpl extends ServiceImpl<SaleDeliveryDeta
 		return saleDeliveryDetailsMapper.selectSaleDeliveryAlert(page,queryWrapper);
 	}
 
+	@Override
+	public IPage<SaleDeliveryAlert> selectSaleDeliveryAlertInvoice(Page<SaleDeliveryAlert> page,QueryWrapper<SaleDeliveryAlert> queryWrapper) {
+		return saleDeliveryDetailsMapper.selectSaleDeliveryAlertInvoice(page,queryWrapper);
+	}
+
 }

+ 153 - 76
srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/impl/SaleDeliveryServiceImpl.java

@@ -1,102 +1,179 @@
 package org.jeecg.modules.saleCode.service.impl;
 
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.modules.purCode.entity.PurDeliveryNoteArrival;
 import org.jeecg.modules.saleCode.entity.SaleDelivery;
 import org.jeecg.modules.saleCode.entity.SaleDeliveryShip;
 import org.jeecg.modules.saleCode.entity.SaleDeliveryDetails;
+import org.jeecg.modules.saleCode.entity.SaleOrderProduct;
 import org.jeecg.modules.saleCode.mapper.SaleDeliveryShipMapper;
 import org.jeecg.modules.saleCode.mapper.SaleDeliveryDetailsMapper;
 import org.jeecg.modules.saleCode.mapper.SaleDeliveryMapper;
+import org.jeecg.modules.saleCode.mapper.SaleOrderProductMapper;
 import org.jeecg.modules.saleCode.service.ISaleDeliveryService;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
+
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Collection;
 
 /**
  * @Description: 发货通知单(delivery notice)
  * @Author: jeecg-boot
- * @Date:   2024-12-11
+ * @Date: 2024-12-11
  * @Version: V1.0
  */
 @Service
 public class SaleDeliveryServiceImpl extends ServiceImpl<SaleDeliveryMapper, SaleDelivery> implements ISaleDeliveryService {
 
-	@Autowired
-	private SaleDeliveryMapper saleDeliveryMapper;
-	@Autowired
-	private SaleDeliveryShipMapper saleDeliveryShipMapper;
-	@Autowired
-	private SaleDeliveryDetailsMapper saleDeliveryDetailsMapper;
-	
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void saveMain(SaleDelivery saleDelivery, List<SaleDeliveryShip> saleDeliveryShipList,List<SaleDeliveryDetails> saleDeliveryDetailsList) {
-		saleDeliveryMapper.insert(saleDelivery);
-		if(saleDeliveryShipList!=null && saleDeliveryShipList.size()>0) {
-			for(SaleDeliveryShip entity:saleDeliveryShipList) {
-				entity.setId(null);
-				//外键设置
-				entity.setHeadId(saleDelivery.getId());
-				saleDeliveryShipMapper.insert(entity);
-			}
-		}
-		if(saleDeliveryDetailsList!=null && saleDeliveryDetailsList.size()>0) {
-			for(SaleDeliveryDetails entity:saleDeliveryDetailsList) {
-				entity.setId(null);
-				//外键设置
-				entity.setHeadId(saleDelivery.getId());
-				saleDeliveryDetailsMapper.insert(entity);
-			}
-		}
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void updateMain(SaleDelivery saleDelivery,List<SaleDeliveryShip> saleDeliveryShipList,List<SaleDeliveryDetails> saleDeliveryDetailsList) {
-		saleDeliveryMapper.updateById(saleDelivery);
-		
-		//1.先删除子表数据
-		saleDeliveryShipMapper.deleteByMainId(saleDelivery.getId());
-		saleDeliveryDetailsMapper.deleteByMainId(saleDelivery.getId());
-		
-		//2.子表数据重新插入
-		if(saleDeliveryShipList!=null && saleDeliveryShipList.size()>0) {
-			for(SaleDeliveryShip entity:saleDeliveryShipList) {
-				entity.setId(null);
-				//外键设置
-				entity.setHeadId(saleDelivery.getId());
-				saleDeliveryShipMapper.insert(entity);
-			}
-		}
-		if(saleDeliveryDetailsList!=null && saleDeliveryDetailsList.size()>0) {
-			for(SaleDeliveryDetails entity:saleDeliveryDetailsList) {
-				entity.setId(null);
-				//外键设置
-				entity.setHeadId(saleDelivery.getId());
-				saleDeliveryDetailsMapper.insert(entity);
-			}
-		}
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void delMain(String id) {
-		saleDeliveryShipMapper.deleteByMainId(id);
-		saleDeliveryDetailsMapper.deleteByMainId(id);
-		saleDeliveryMapper.deleteById(id);
-	}
-
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public void delBatchMain(Collection<? extends Serializable> idList) {
-		for(Serializable id:idList) {
-			saleDeliveryShipMapper.deleteByMainId(id.toString());
-			saleDeliveryDetailsMapper.deleteByMainId(id.toString());
-			saleDeliveryMapper.deleteById(id);
-		}
-	}
-	
+    @Autowired
+    private SaleDeliveryMapper saleDeliveryMapper;
+    @Autowired
+    private SaleDeliveryShipMapper saleDeliveryShipMapper;
+    @Autowired
+    private SaleDeliveryDetailsMapper saleDeliveryDetailsMapper;
+    @Autowired
+    private SaleOrderProductMapper saleOrderProductMapper;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void saveMain(SaleDelivery saleDelivery, List<SaleDeliveryShip> saleDeliveryShipList, List<SaleDeliveryDetails> saleDeliveryDetailsList) {
+        saleDeliveryMapper.insert(saleDelivery);
+        if (saleDeliveryShipList != null && saleDeliveryShipList.size() > 0) {
+            for (SaleDeliveryShip entity : saleDeliveryShipList) {
+                entity.setId(null);
+                //外键设置
+                entity.setHeadId(saleDelivery.getId());
+                saleDeliveryShipMapper.insert(entity);
+            }
+        }
+        if (saleDeliveryDetailsList != null && saleDeliveryDetailsList.size() > 0) {
+            for (SaleDeliveryDetails entity : saleDeliveryDetailsList) {
+                entity.setId(null);
+                //外键设置
+                entity.setHeadId(saleDelivery.getId());
+                saleDeliveryDetailsMapper.insert(entity);
+
+
+                String sourceId = entity.getSourceId();
+
+                if (StringUtils.isNotBlank(sourceId)) {
+
+                    BigDecimal stockInQuantity = entity.getQuantity() == null ? BigDecimal.ZERO : entity.getQuantity();//入库数量
+
+                    SaleOrderProduct arrival = saleOrderProductMapper.selectById(sourceId);
+                    if (arrival != null) {
+                        BigDecimal arrivalQuantity = arrival.getDeliveryQuantity() == null ? BigDecimal.ZERO : arrival.getDeliveryQuantity();//到货数量
+
+                        arrivalQuantity = arrivalQuantity.add(stockInQuantity);
+                        arrival.setDeliveryQuantity(arrivalQuantity);
+                        saleOrderProductMapper.updateById(arrival);
+                    }
+                }
+
+
+            }
+        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void updateMain(SaleDelivery saleDelivery, List<SaleDeliveryShip> saleDeliveryShipList, List<SaleDeliveryDetails> saleDeliveryDetailsList) {
+
+        List<SaleDeliveryDetails> detailsList = saleDeliveryDetailsMapper.selectByMainId(saleDelivery.getId());
+
+        if (detailsList != null && detailsList.size() > 0) {
+
+            for (SaleDeliveryDetails entity : detailsList) {
+
+                String sourceId = entity.getSourceId();
+                if (StringUtils.isNotBlank(sourceId)) {
+
+                    BigDecimal deliveryQuantity = entity.getDeliveryQuantity() == null ? BigDecimal.ZERO : entity.getDeliveryQuantity();//入库数量
+                    SaleOrderProduct arrival = saleOrderProductMapper.selectById(sourceId);
+
+                    if (arrival != null) {
+                        BigDecimal arrivalQuantity = arrival.getDeliveryQuantity() == null ? BigDecimal.ZERO : arrival.getDeliveryQuantity();//到货数量
+
+                        arrivalQuantity = arrivalQuantity.subtract(deliveryQuantity);
+
+                        if (arrivalQuantity.compareTo(BigDecimal.ZERO) < 1) {
+                            arrival.setDeliveryQuantity(BigDecimal.ZERO);
+                        } else {
+
+                            arrival.setDeliveryQuantity(arrivalQuantity);
+                        }
+                        saleOrderProductMapper.updateById(arrival);
+
+                    }
+                }
+
+
+            }
+        }
+
+
+        saleDeliveryMapper.updateById(saleDelivery);
+
+        //1.先删除子表数据
+        saleDeliveryShipMapper.deleteByMainId(saleDelivery.getId());
+        saleDeliveryDetailsMapper.deleteByMainId(saleDelivery.getId());
+
+        //2.子表数据重新插入
+        if (saleDeliveryShipList != null && saleDeliveryShipList.size() > 0) {
+            for (SaleDeliveryShip entity : saleDeliveryShipList) {
+                entity.setId(null);
+                //外键设置
+                entity.setHeadId(saleDelivery.getId());
+                saleDeliveryShipMapper.insert(entity);
+            }
+        }
+        if (saleDeliveryDetailsList != null && saleDeliveryDetailsList.size() > 0) {
+            for (SaleDeliveryDetails entity : saleDeliveryDetailsList) {
+                entity.setId(null);
+                //外键设置
+                entity.setHeadId(saleDelivery.getId());
+                saleDeliveryDetailsMapper.insert(entity);
+
+                String sourceId = entity.getSourceId();
+                if(StringUtils.isNotBlank(sourceId)){
+
+                    BigDecimal stockInQuantity = entity.getQuantity() == null ? BigDecimal.ZERO : entity.getQuantity();//入库数量
+
+                    SaleOrderProduct arrival = saleOrderProductMapper.selectById(sourceId);
+                    if (arrival != null) {
+                        BigDecimal arrivalQuantity = arrival.getDeliveryQuantity() == null ? BigDecimal.ZERO : arrival.getDeliveryQuantity();//到货数量
+
+                        arrivalQuantity = arrivalQuantity.add(stockInQuantity);
+                        arrival.setDeliveryQuantity(arrivalQuantity);
+                        saleOrderProductMapper.updateById(arrival);
+                    }
+                }
+
+            }
+        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void delMain(String id) {
+        saleDeliveryShipMapper.deleteByMainId(id);
+        saleDeliveryDetailsMapper.deleteByMainId(id);
+        saleDeliveryMapper.deleteById(id);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void delBatchMain(Collection<? extends Serializable> idList) {
+        for (Serializable id : idList) {
+            saleDeliveryShipMapper.deleteByMainId(id.toString());
+            saleDeliveryDetailsMapper.deleteByMainId(id.toString());
+            saleDeliveryMapper.deleteById(id);
+        }
+    }
+
 }

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/vo/SaleDeliveryAlert.java

@@ -275,6 +275,8 @@ public class SaleDeliveryAlert implements Serializable {
     @ApiModelProperty(value = "备注(notes)")
     private String childNotes;
 
+    //是否收取客户运费(是/否)
+    private String customerFee;
     //是否有第三方运费
     private String otherFee;
     //是否已被运费参照

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/vo/SaleDeliveryPage.java

@@ -193,6 +193,8 @@ public class SaleDeliveryPage {
 	@Excel(name = "包装详情(packingDetails)", width = 15)
 	@ApiModelProperty(value = "包装详情(packingDetails)")
 	private String packingDetails;
+	//是否收取客户运费(是/否)
+	private String customerFee;
 
 	@ExcelCollection(name="发货通知单 - 船明细")
 	@ApiModelProperty(value = "发货通知单 - 船明细")