|
@@ -4,6 +4,7 @@ import java.text.DecimalFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import com.zkqy.business.domain.*;
|
|
|
import com.zkqy.business.domain.vo.ProductCodeListVO;
|
|
@@ -137,130 +138,106 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
|
|
|
// 查询销售单信息
|
|
|
SaleOrder saleOrder = saleOrderMapper.selectSaleOrderBySaleNo(saleOrderNo);
|
|
|
|
|
|
- if(saleOrder.getOrderType().equals("1")){
|
|
|
+// if(saleOrder.getOrderType().equals("1")){
|
|
|
+// List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(saleOrderNo);
|
|
|
+// if(productInvoice != null){
|
|
|
+// for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
|
|
|
+//
|
|
|
+// //获取已出库箱数和重量
|
|
|
+// ProductOutboundRecord productOutboundRecord = productOutboundRecordMapper
|
|
|
+// .statisticsBoxNumSuttle1(saleProductInfo.getProductId(), productInvoice.getNoticeNumber(),saleProductInfo.getProductColor());
|
|
|
+//
|
|
|
+// if(productOutboundRecord != null){
|
|
|
+// saleProductInfo.setBoxNum(productOutboundRecord.getBoxNum());
|
|
|
+// saleProductInfo.setWeight(handlingWeight(productOutboundRecord.getSuttle() == null ? 0 : productOutboundRecord.getSuttle()));
|
|
|
+// }else {
|
|
|
+// saleProductInfo.setBoxNum(0);
|
|
|
+// saleProductInfo.setWeight(0.0);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }else {
|
|
|
+// for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
|
|
|
+// saleProductInfo.setBoxNum(0);
|
|
|
+// saleProductInfo.setWeight(0.0);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// //查询当前批号库存箱数,重量
|
|
|
+// ProductInventory productInventory1 = new ProductInventory();
|
|
|
+// productInventory1.setProductId(saleProductInfoList.get(0).getProductId());
|
|
|
+// productInventory1.setLotNum(saleProductInfoList.get(0).getLotNum());
|
|
|
+// ProductInventory productInventory = productInventoryMapper.selectProductInventoryByLotNumAndProductId(productInventory1);
|
|
|
+// if(productInventory != null){
|
|
|
+// vo.setInventoryBoxNum(productInventory.getTotalBoxNum());
|
|
|
+// vo.setInventoryWeight(handlingWeight(productInventory.getTotalSuttle()));
|
|
|
+// }else {
|
|
|
+// vo.setInventoryBoxNum(0);
|
|
|
+// vo.setInventoryWeight(0.0);
|
|
|
+// }
|
|
|
+//
|
|
|
+// //客户编号
|
|
|
+// vo.setCustomerId(saleOrderMapper.selectCustomerIdBySaleNo(saleOrderNo));
|
|
|
+// vo.setSaleProductInfoList(saleProductInfoList);
|
|
|
+//
|
|
|
+//
|
|
|
+// }else {
|
|
|
+
|
|
|
+ //表格数据
|
|
|
+
|
|
|
+ //查询所有订单货品信息
|
|
|
List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(saleOrderNo);
|
|
|
+
|
|
|
if(productInvoice != null){
|
|
|
- for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
|
|
|
+ //根据通知单号查询货品信息
|
|
|
+ List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList1 = saleProductsMapper.selectSaleProductsInfo2(productInvoice.getNoticeNumber());
|
|
|
|
|
|
- //获取已出库箱数和重量
|
|
|
- ProductOutboundRecord productOutboundRecord = productOutboundRecordMapper
|
|
|
- .statisticsBoxNumSuttle1(saleProductInfo.getProductId(), productInvoice.getNoticeNumber(),saleProductInfo.getProductColor());
|
|
|
+ List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList2 = new ArrayList<>();
|
|
|
+ saleProductInfoList2.addAll(saleProductInfoList);
|
|
|
|
|
|
- if(productOutboundRecord != null){
|
|
|
- saleProductInfo.setBoxNum(productOutboundRecord.getBoxNum());
|
|
|
- saleProductInfo.setWeight(handlingWeight(productOutboundRecord.getSuttle() == null ? 0 : productOutboundRecord.getSuttle()));
|
|
|
- }else {
|
|
|
- saleProductInfo.setBoxNum(0);
|
|
|
- saleProductInfo.setWeight(0.0);
|
|
|
+ for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList2){
|
|
|
+ for (ProductInvoiceVO.SaleProductInfo saleProductInfo1 : saleProductInfoList1){
|
|
|
+ if(saleProductInfo1.getProductId().equals(saleProductInfo.getProductId()) && saleProductInfo1.getProductColor().equals(saleProductInfo.getProductColor())){
|
|
|
+ saleProductInfoList.remove(saleProductInfo);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
- for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
|
|
|
- saleProductInfo.setBoxNum(0);
|
|
|
- saleProductInfo.setWeight(0.0);
|
|
|
+ if(saleProductInfoList.size() > 0){
|
|
|
+ saleProductInfoList.forEach(saleProductInfo -> {
|
|
|
+ saleProductInfo.setBoxNum(0);
|
|
|
+ saleProductInfo.setWeight(0.0);
|
|
|
+ });
|
|
|
+ saleProductInfoList1.addAll(saleProductInfoList);
|
|
|
}
|
|
|
- }
|
|
|
- //查询当前批号库存箱数,重量
|
|
|
- ProductInventory productInventory1 = new ProductInventory();
|
|
|
- productInventory1.setProductId(saleProductInfoList.get(0).getProductId());
|
|
|
- productInventory1.setLotNum(saleProductInfoList.get(0).getLotNum());
|
|
|
- ProductInventory productInventory = productInventoryMapper.selectProductInventoryByLotNumAndProductId(productInventory1);
|
|
|
- if(productInventory != null){
|
|
|
- vo.setInventoryBoxNum(productInventory.getTotalBoxNum());
|
|
|
- vo.setInventoryWeight(handlingWeight(productInventory.getTotalSuttle()));
|
|
|
- }else {
|
|
|
- vo.setInventoryBoxNum(0);
|
|
|
- vo.setInventoryWeight(0.0);
|
|
|
- }
|
|
|
|
|
|
- //客户编号
|
|
|
- vo.setCustomerId(saleOrderMapper.selectCustomerIdBySaleNo(saleOrderNo));
|
|
|
- vo.setSaleProductInfoList(saleProductInfoList);
|
|
|
-
|
|
|
-
|
|
|
- }else {
|
|
|
- //表格数据
|
|
|
- //根据销售单编号查询货品信息
|
|
|
-// List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo(saleOrderNo);
|
|
|
- List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(saleOrderNo);
|
|
|
-
|
|
|
- for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
|
|
|
- //查询库存信息
|
|
|
- if(saleProductInfo.getLotNum() != null){
|
|
|
+ vo.setSaleProductInfoList(saleProductInfoList1);
|
|
|
+ if(saleProductInfoList1.size() > 0){
|
|
|
ProductInventory productInventory1 = new ProductInventory();
|
|
|
- productInventory1.setProductId(saleProductInfo.getProductId());
|
|
|
- productInventory1.setLotNum(saleProductInfo.getLotNum());
|
|
|
- productInventory1.setProductColour(saleProductInfo.getProductColor());
|
|
|
-
|
|
|
- ProductInventory productInventory = productInventoryMapper.selectProductInventoryInfo(productInventory1);
|
|
|
-
|
|
|
+ productInventory1.setProductId(saleProductInfoList1.get(0).getProductId());
|
|
|
+ productInventory1.setLotNum(saleProductInfoList1.get(0).getLotNum());
|
|
|
+ ProductInventory productInventory = productInventoryMapper.selectProductInventoryByLotNumAndProductId(productInventory1);
|
|
|
if(productInventory != null){
|
|
|
- saleProductInfo.setLevels(productInventory.getLevels());
|
|
|
- saleProductInfo.setQrCode(productInventory.getQrCode());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if(productInvoice != null){
|
|
|
- for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
|
|
|
-
|
|
|
- //查询库存信息
|
|
|
-// if(saleProductInfo.getLotNum() != null){
|
|
|
-// ProductInventory productInventory1 = new ProductInventory();
|
|
|
-// productInventory1.setProductId(saleProductInfo.getProductId());
|
|
|
-// productInventory1.setLotNum(saleProductInfo.getLotNum());
|
|
|
-// productInventory1.setProductColour(saleProductInfo.getProductColor());
|
|
|
-//
|
|
|
-// ProductInventory productInventory = productInventoryMapper.selectProductInventoryInfo(productInventory1);
|
|
|
-//
|
|
|
-// if(productInventory != null){
|
|
|
-// saleProductInfo.setLevels(productInventory.getLevels());
|
|
|
-// saleProductInfo.setQrCode(productInventory.getQrCode());
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
- //获取已出库箱数和重量
|
|
|
- ProductOutboundRecord productOutboundRecord = productOutboundRecordMapper
|
|
|
- .statisticsBoxNumSuttle1(saleProductInfo.getProductId(), productInvoice.getNoticeNumber(),saleProductInfo.getProductColor());
|
|
|
-
|
|
|
- if(productOutboundRecord != null){
|
|
|
- saleProductInfo.setBoxNum(productOutboundRecord.getBoxNum());
|
|
|
- saleProductInfo.setWeight(handlingWeight(productOutboundRecord.getSuttle() == null ? 0 : productOutboundRecord.getSuttle()));
|
|
|
+ vo.setInventoryBoxNum(productInventory.getTotalBoxNum());
|
|
|
+ vo.setInventoryWeight(handlingWeight(productInventory.getTotalSuttle()));
|
|
|
}else {
|
|
|
- saleProductInfo.setBoxNum(0);
|
|
|
- saleProductInfo.setWeight(0.0);
|
|
|
+ vo.setInventoryBoxNum(0);
|
|
|
+ vo.setInventoryWeight(0.0);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}else {
|
|
|
for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
|
|
|
saleProductInfo.setBoxNum(0);
|
|
|
saleProductInfo.setWeight(0.0);
|
|
|
}
|
|
|
- }
|
|
|
- //查询当前批号库存箱数,重量
|
|
|
- if(saleProductInfoList.size() > 0){
|
|
|
- ProductInventory productInventory1 = new ProductInventory();
|
|
|
- productInventory1.setProductId(saleProductInfoList.get(0).getProductId());
|
|
|
- productInventory1.setLotNum(saleProductInfoList.get(0).getLotNum());
|
|
|
- ProductInventory productInventory = productInventoryMapper.selectProductInventoryByLotNumAndProductId(productInventory1);
|
|
|
- if(productInventory != null){
|
|
|
- vo.setInventoryBoxNum(productInventory.getTotalBoxNum());
|
|
|
- vo.setInventoryWeight(handlingWeight(productInventory.getTotalSuttle()));
|
|
|
- }else {
|
|
|
- vo.setInventoryBoxNum(0);
|
|
|
- vo.setInventoryWeight(0.0);
|
|
|
- }
|
|
|
- }else {
|
|
|
vo.setInventoryBoxNum(0);
|
|
|
vo.setInventoryWeight(0.0);
|
|
|
+ vo.setSaleProductInfoList(saleProductInfoList);
|
|
|
}
|
|
|
|
|
|
|
|
|
//客户编号
|
|
|
vo.setCustomerId(saleOrderMapper.selectCustomerIdBySaleNo(saleOrderNo));
|
|
|
- vo.setSaleProductInfoList(saleProductInfoList);
|
|
|
- }
|
|
|
+
|
|
|
+// }
|
|
|
|
|
|
return vo;
|
|
|
}
|
|
@@ -332,28 +309,56 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
|
|
|
|
|
|
// 查询销售单信息
|
|
|
SaleOrder saleOrder = saleOrderMapper.selectSaleOrderBySaleNo(productInvoice.getSaleOrderNo());
|
|
|
- List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = new ArrayList<>();
|
|
|
|
|
|
- if(saleOrder.getOrderType().equals("1")){
|
|
|
- //查询发货单货品详情,循环得到货品实发箱数、重量
|
|
|
- saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(productInvoice.getSaleOrderNo());
|
|
|
- }else {
|
|
|
- saleProductInfoList = saleProductsMapper.selectSaleProductsInfo(productInvoice.getSaleOrderNo());
|
|
|
- }
|
|
|
+ //查询所有订单货品信息
|
|
|
+ List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(saleOrder.getSaleNo());
|
|
|
+
|
|
|
+ //根据通知单号查询货品信息
|
|
|
+ List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList1 = saleProductsMapper.selectSaleProductsInfo3(productInvoice.getNoticeNumber());
|
|
|
+ List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList2 = new ArrayList<>();
|
|
|
+ saleProductInfoList2.addAll(saleProductInfoList);
|
|
|
|
|
|
- for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
|
|
|
- //实发箱数、重量
|
|
|
- ProductHandsetOutboundRecord productHandsetOutboundRecord =
|
|
|
- productHandsetOutboundRecordMapper.selectBoxNumSuttle1(saleProductInfo.getProductId(), productInvoice.getNoticeNumber(),saleProductInfo.getProductColor());
|
|
|
- if(productHandsetOutboundRecord != null){
|
|
|
- saleProductInfo.setBoxNum(productHandsetOutboundRecord.getBoxNum());
|
|
|
- saleProductInfo.setWeight(handlingWeight(productHandsetOutboundRecord.getSuttle() == null ? 0 : productHandsetOutboundRecord.getSuttle()));
|
|
|
+ for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList2){
|
|
|
+ for (ProductInvoiceVO.SaleProductInfo saleProductInfo1 : saleProductInfoList1){
|
|
|
+ if(saleProductInfo1.getProductId().equals(saleProductInfo.getProductId()) && saleProductInfo1.getProductColor().equals(saleProductInfo.getProductColor())){
|
|
|
+ saleProductInfoList.remove(saleProductInfo);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ if(saleProductInfoList.size() > 0){
|
|
|
+ saleProductInfoList.forEach(saleProductInfo -> {
|
|
|
+ saleProductInfo.setBoxNum(0);
|
|
|
+ saleProductInfo.setWeight(0.0);
|
|
|
+ });
|
|
|
+ saleProductInfoList1.addAll(saleProductInfoList);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = new ArrayList<>();
|
|
|
+//
|
|
|
+// if(saleOrder.getOrderType().equals("1")){
|
|
|
+// //查询发货单货品详情,循环得到货品实发箱数、重量
|
|
|
+// saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(productInvoice.getSaleOrderNo());
|
|
|
+// }else {
|
|
|
+//
|
|
|
+//
|
|
|
+// saleProductInfoList = saleProductsMapper.selectSaleProductsInfo(productInvoice.getSaleOrderNo());
|
|
|
+// }
|
|
|
+//
|
|
|
+// for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
|
|
|
+// //实发箱数、重量
|
|
|
+// ProductHandsetOutboundRecord productHandsetOutboundRecord =
|
|
|
+// productHandsetOutboundRecordMapper.selectBoxNumSuttle1(saleProductInfo.getProductId(), productInvoice.getNoticeNumber(),saleProductInfo.getProductColor());
|
|
|
+// if(productHandsetOutboundRecord != null){
|
|
|
+// saleProductInfo.setBoxNum(productHandsetOutboundRecord.getBoxNum());
|
|
|
+// saleProductInfo.setWeight(handlingWeight(productHandsetOutboundRecord.getSuttle() == null ? 0 : productHandsetOutboundRecord.getSuttle()));
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
//客户编号
|
|
|
vo.setCustomerId(saleOrderMapper.selectCustomerIdBySaleNo(productInvoice.getSaleOrderNo()));
|
|
|
- vo.setSaleProductInfoList(saleProductInfoList);
|
|
|
+ vo.setSaleProductInfoList(saleProductInfoList1);
|
|
|
return vo;
|
|
|
}
|
|
|
|