|
@@ -14,6 +14,7 @@ import jxl.Workbook;
|
|
|
import jxl.read.biff.BiffException;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.httpclient.util.DateUtil;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -22,6 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@@ -50,6 +52,10 @@ public class BiInfoController {
|
|
|
private ITranCarInfoService tranCarInfoService;
|
|
|
@Autowired
|
|
|
private IContractProcessInfoService contractProcessInfoService;
|
|
|
+ @Autowired
|
|
|
+ private ICostManagementInfoService costManagementInfoService;
|
|
|
+ @Autowired
|
|
|
+ private IWarehouseBaseInfoService warehouseBaseInfoService;
|
|
|
|
|
|
/**
|
|
|
* 查询
|
|
@@ -68,10 +74,123 @@ public class BiInfoController {
|
|
|
getBuyInfo(contractManagementInfos, biViewInfos);
|
|
|
// 车辆
|
|
|
getTranCount(biViewInfos);
|
|
|
+ // 库存成本
|
|
|
+ getCostCount(biViewInfos);
|
|
|
+ // 库点流向
|
|
|
+ getMapInfo(biViewInfos);
|
|
|
|
|
|
return biViewInfos;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 库点流向
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<BiViewInfo> getMapInfo(List<BiViewInfo> biViewInfos) {
|
|
|
+ List<BiViewInfo> biViewInfoList = new ArrayList<>();
|
|
|
+ BiViewInfo biViewInfoa = new BiViewInfo();
|
|
|
+ List<TranTaskInfo> tranTaskInfos = tranTaskInfoService.selectList(new EntityWrapper<TranTaskInfo>()
|
|
|
+ .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId()));
|
|
|
+ if (CollectionUtils.isNotEmpty(tranTaskInfos)) {
|
|
|
+ for (int i = 0; i < tranTaskInfos.size(); i++) {
|
|
|
+ TranTaskInfo tranTaskInfo = tranTaskInfos.get(i);
|
|
|
+ if (StringUtils.isNotBlank(tranTaskInfo.getReceiveWarehouse())) {
|
|
|
+ if ("1".equals(tranTaskInfo.getWarehouseType())) {
|
|
|
+ BiViewInfo biViewInfo = new BiViewInfo();
|
|
|
+ WarehouseBaseInfo warehouseBaseInfo = warehouseBaseInfoService.selectOne(new EntityWrapper<WarehouseBaseInfo>()
|
|
|
+ .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId())
|
|
|
+ .eq("warehouse_name", tranTaskInfo.getSendWarehouse()));
|
|
|
+ WarehouseBaseInfo warehouseBaseInfo1 = warehouseBaseInfoService.selectOne(new EntityWrapper<WarehouseBaseInfo>()
|
|
|
+ .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId())
|
|
|
+ .eq("warehouse_name", tranTaskInfo.getReceiveWarehouse()));
|
|
|
+ if (warehouseBaseInfo != null && warehouseBaseInfo1 != null) {
|
|
|
+ biViewInfo.setStartPlace(warehouseBaseInfo.getWarehousePositioning());
|
|
|
+ biViewInfo.setEndPlace(warehouseBaseInfo1.getWarehousePositioning());
|
|
|
+ biViewInfoList.add(biViewInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if ("2".equals(tranTaskInfo.getWarehouseType())) {
|
|
|
+ BiViewInfo biViewInfo = new BiViewInfo();
|
|
|
+ ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
|
|
|
+ .eq("contract_no", tranTaskInfo.getSendWarehouse())
|
|
|
+ .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId()));
|
|
|
+ if (contractManagementInfo != null) {
|
|
|
+ biViewInfo.setStartPlace(contractManagementInfo.getSourceLocation());
|
|
|
+ biViewInfo.setEndPlace(contractManagementInfo.getDeliveryLocation());
|
|
|
+ biViewInfoList.add(biViewInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ biViewInfoa.setBiType("10-库点流向分布");
|
|
|
+ biViewInfoa.setBiViewInfoList(biViewInfoList);
|
|
|
+ biViewInfos.add(biViewInfoa);
|
|
|
+
|
|
|
+ return biViewInfos;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 车辆 粮食储存总量
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<BiViewInfo> getCostCount(List<BiViewInfo> biViewInfos) {
|
|
|
+ List<CostManagementInfo> costManagementInfos = costManagementInfoService.selectList(new EntityWrapper<CostManagementInfo>().eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId()));
|
|
|
+ Float sumTotal = 0f;
|
|
|
+ Float sumCost = 0f;
|
|
|
+ if (CollectionUtils.isNotEmpty(costManagementInfos)) {
|
|
|
+ for (int i = 0; i < costManagementInfos.size(); i++) {
|
|
|
+ CostManagementInfo costManagementInfo = costManagementInfos.get(i);
|
|
|
+ sumTotal = sumTotal + costManagementInfo.getStorage();
|
|
|
+ sumCost = sumCost + (costManagementInfo.getStorage() * costManagementInfo.getCost());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<BiViewInfo> biViewInfoList = new ArrayList<>();
|
|
|
+ BiViewInfo biViewInfo = new BiViewInfo();
|
|
|
+ BiViewInfo biViewInfo1 = new BiViewInfo();
|
|
|
+ BiViewInfo biViewInfo2 = new BiViewInfo();
|
|
|
+ biViewInfo.setBiType("8-库存成本");
|
|
|
+ biViewInfo1.setName("总库存量");
|
|
|
+ biViewInfo1.setCount(String.valueOf(sumTotal));
|
|
|
+ biViewInfo2.setName("库存价值");
|
|
|
+ biViewInfo2.setCount(String.valueOf(sumCost));
|
|
|
+ biViewInfoList.add(biViewInfo1);
|
|
|
+ biViewInfoList.add(biViewInfo2);
|
|
|
+ biViewInfo.setBiViewInfoList(biViewInfoList);
|
|
|
+ biViewInfos.add(biViewInfo);
|
|
|
+
|
|
|
+ // 粮食储存总量
|
|
|
+ List<CostManagementInfo> costManagementInfoList = costManagementInfoService.selectList(new EntityWrapper<CostManagementInfo>()
|
|
|
+ .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId())
|
|
|
+ .groupBy("goods_name_key"));
|
|
|
+ BiViewInfo biViewInfo4 = new BiViewInfo();
|
|
|
+ List<BiViewInfo> biViewInfos1 = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(costManagementInfoList)) {
|
|
|
+ for (int i = 0; i < costManagementInfoList.size(); i++) {
|
|
|
+ CostManagementInfo costManagementInfo = costManagementInfoList.get(i);
|
|
|
+ BiViewInfo biViewInfo3 = new BiViewInfo();
|
|
|
+ List<CostManagementInfo> costManagementInfoList1 = costManagementInfoService.selectList(new EntityWrapper<CostManagementInfo>()
|
|
|
+ .eq("comp_id", AuthSecurityUtils.getCurrentUserInfo().getCompId())
|
|
|
+ .eq("goods_name_key", costManagementInfo.getGoodsNameKey()));
|
|
|
+ Float weight = 0f;
|
|
|
+ for (int j = 0; j < costManagementInfoList1.size(); j++) {
|
|
|
+ CostManagementInfo costManagementInfo1 = costManagementInfoList.get(i);
|
|
|
+ weight = weight + costManagementInfo1.getStorage();
|
|
|
+ }
|
|
|
+ biViewInfo3.setName(costManagementInfo.getGoodsName());
|
|
|
+ biViewInfo3.setCount(String.valueOf(weight));
|
|
|
+ biViewInfos1.add(biViewInfo3);
|
|
|
+ }
|
|
|
+ biViewInfo4.setBiType("9-粮食总储存量");
|
|
|
+ biViewInfo4.setBiViewInfoList(biViewInfos1);
|
|
|
+ biViewInfos.add(biViewInfo4);
|
|
|
+ }
|
|
|
+ return biViewInfos;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 车辆
|
|
@@ -108,6 +227,7 @@ public class BiInfoController {
|
|
|
biViewInfoList.add(biViewInfo3);
|
|
|
biViewInfo.setBiViewInfoList(biViewInfoList);
|
|
|
biViewInfos.add(biViewInfo);
|
|
|
+
|
|
|
return biViewInfos;
|
|
|
}
|
|
|
|
|
@@ -185,7 +305,8 @@ public class BiInfoController {
|
|
|
// 执行中的所有合同量求和-- 已完成量、待完成量
|
|
|
BiViewInfo biViewInfo = new BiViewInfo();
|
|
|
biViewInfo.setBiType("4-采购合同(已完成量、待完成量)");
|
|
|
- biViewInfo.setTotal(String.valueOf(sumTotal));
|
|
|
+ BigDecimal bg = new BigDecimal(sumTotal);
|
|
|
+ biViewInfo.setTotal(String.valueOf(bg));
|
|
|
List<BiViewInfo> biViewInfos1 = new ArrayList<>();
|
|
|
BiViewInfo biViewInfo1 = new BiViewInfo();
|
|
|
biViewInfo1.setName("已完成量");
|
|
@@ -203,7 +324,8 @@ public class BiInfoController {
|
|
|
// 执行中的合同额 -已开票、待开票
|
|
|
BiViewInfo biViewInfoa = new BiViewInfo();
|
|
|
biViewInfoa.setBiType("5-采购合同(已开票、待开票)");
|
|
|
- biViewInfoa.setTotal(String.valueOf(moneyTotal));
|
|
|
+ BigDecimal bg1 = new BigDecimal(moneyTotal);
|
|
|
+ biViewInfoa.setTotal(String.valueOf(bg1));
|
|
|
List<BiViewInfo> biViewInfosa1 = new ArrayList<>();
|
|
|
BiViewInfo biViewInfoa1 = new BiViewInfo();
|
|
|
biViewInfoa1.setName("已开票");
|
|
@@ -222,7 +344,7 @@ public class BiInfoController {
|
|
|
// 执行中的合同额 -已付款、待付款
|
|
|
BiViewInfo biViewInfob = new BiViewInfo();
|
|
|
biViewInfob.setBiType("6-采购合同(已回款、待回款)");
|
|
|
- biViewInfob.setTotal(String.valueOf(moneyTotal));
|
|
|
+ biViewInfob.setTotal(String.valueOf(bg1));
|
|
|
List<BiViewInfo> biViewInfosb1 = new ArrayList<>();
|
|
|
BiViewInfo biViewInfob1 = new BiViewInfo();
|
|
|
biViewInfob1.setName("已付款");
|
|
@@ -331,7 +453,8 @@ public class BiInfoController {
|
|
|
// 执行中的所有合同量求和-- 已完成量、待完成量
|
|
|
BiViewInfo biViewInfo = new BiViewInfo();
|
|
|
biViewInfo.setBiType("1-销售合同(已完成量、待完成量)");
|
|
|
- biViewInfo.setTotal(String.valueOf(sumTotal));
|
|
|
+ BigDecimal bg = new BigDecimal(sumTotal);
|
|
|
+ biViewInfo.setTotal(String.valueOf(bg));
|
|
|
List<BiViewInfo> biViewInfos1 = new ArrayList<>();
|
|
|
BiViewInfo biViewInfo1 = new BiViewInfo();
|
|
|
biViewInfo1.setName("已完成量");
|
|
@@ -349,7 +472,8 @@ public class BiInfoController {
|
|
|
// 执行中的合同额 -已开票、待开票
|
|
|
BiViewInfo biViewInfoa = new BiViewInfo();
|
|
|
biViewInfoa.setBiType("2-销售合同(已开票、待开票)");
|
|
|
- biViewInfoa.setTotal(String.valueOf(moneyTotal));
|
|
|
+ BigDecimal bg1 = new BigDecimal(moneyTotal);
|
|
|
+ biViewInfoa.setTotal(String.valueOf(bg1));
|
|
|
List<BiViewInfo> biViewInfosa1 = new ArrayList<>();
|
|
|
BiViewInfo biViewInfoa1 = new BiViewInfo();
|
|
|
biViewInfoa1.setName("已开票");
|
|
@@ -368,7 +492,7 @@ public class BiInfoController {
|
|
|
// 执行中的合同额 -已付款、待付款
|
|
|
BiViewInfo biViewInfob = new BiViewInfo();
|
|
|
biViewInfob.setBiType("3-销售合同(已付款、待付款)");
|
|
|
- biViewInfob.setTotal(String.valueOf(moneyTotal));
|
|
|
+ biViewInfob.setTotal(String.valueOf(bg1));
|
|
|
List<BiViewInfo> biViewInfosb1 = new ArrayList<>();
|
|
|
BiViewInfo biViewInfob1 = new BiViewInfo();
|
|
|
biViewInfob1.setName("已付款");
|