diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 9ee5a8db..65eef206 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -9,8 +9,12 @@
-
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index e862d07d..4db70e18 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -2,6 +2,7 @@
+
diff --git a/pom.xml b/pom.xml
index 2c1a56a5..c1696bc8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,6 +72,10 @@
+
+ org.springframework.boot
+ spring-boot-starter-test
+
org.springframework.boot
spring-boot-configuration-processor
@@ -153,6 +157,7 @@
+
org.springframework.boot
diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java
index 2d3cea85..eac497fa 100644
--- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java
+++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java
@@ -104,21 +104,25 @@ public class DepositoryController {
Map depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId();
Iterator it = depositoryAllNameAndId.keySet().iterator();
Map map = new HashMap<>();
- // 获取当周仓库库存
+ // 获取本周仓库库存
Map thisWeekInventoryByDName = getThisWeekInventoryByDName(depositoryService, depositoryRecordService);
while (it.hasNext()){
int i;
Object key = it.next();
Double thisDayInventory = 0.0;
+ // 本周周一的总量
thisDayInventory = ((List)thisWeekInventoryByDName.get(key.toString())).get(0);
result.add(thisDayInventory);
int j = 0;
for (i = days.size() - 1; i > 0; i--) {
// 遍历 Map并计算各仓库的入库数
Integer val = (Integer) depositoryAllNameAndId.get(key);
- Double depositoryRecordByDateByIn = depositoryRecordService.findDepositoryRecordByDate(days.get(i), days.get(i - 1), 1, val);
- Double depositoryRecordByDateByOut = depositoryRecordService.findDepositoryRecordByDate(days.get(i), days.get(i - 1), 0, val);
- result.add(result.get(j++) - depositoryRecordByDateByIn + depositoryRecordByDateByOut);
+ // 获取一段时间内的入库额度
+ Double depositoryRecordByDateByIn1 = depositoryRecordService.findApplicationInRecordByDate(days.get(i), days.get(i - 1), val);
+ // 获取一段时间内的出库库额度
+ Double depositoryRecordByDateByOut1 = depositoryRecordService.findApplicationOutRecordByDate(days.get(i), days.get(i - 1), val);
+ Double wareHouseCount1 = result.get(j++) - depositoryRecordByDateByIn1 + depositoryRecordByDateByOut1;
+ result.add(wareHouseCount1);
}
result.remove(0);
Collections.reverse(result);
@@ -159,11 +163,7 @@ public class DepositoryController {
}else {
int now = instance.get(Calendar.DAY_OF_WEEK) - 1;
List days = new ArrayList<>();
- instance.add(Calendar.DATE, 1);
days.add(DateUtil.DateTimeByMonthToTimeStamp(formatter.format(instance.getTime())));
- instance.add(Calendar.DATE, -1);
- days.add(DateUtil.DateTimeByMonthToTimeStamp(formatter.format(instance.getTime())));
-
while (now - 1 > 0) {
now--;
instance.add(Calendar.DATE, -1);
@@ -174,20 +174,40 @@ public class DepositoryController {
int i;
Object key = it.next();
int j =0;
+ // 获取今天容量
Double toDayInventoryByDName = depositoryService.getToDayInventoryByDName(key.toString());
result.add(toDayInventoryByDName);
- for (i = days.size() - 1; i > 0; i--) {
+ for (i = 0;i 0; i--) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE,1);
- String format = formatter.format(calendar.getTime());
- if(days.get(i - 1).equals(format)){
+ String format = formatter.format(calendar.getTime()) + " 00:00:00";
+ if(Long.compare(days.get(i - 1),DateUtil.DateTimeToTimeStamp(format)) == 0){
continue;
}
Integer val = (Integer) depositoryAllNameAndId.get(key);
- Double depositoryRecordByDateByIn = depositoryRecordService.findDepositoryRecordByDate(days.get(i - 1), days.get(i), 1, val);
- Double depositoryRecordByDateByOut = depositoryRecordService.findDepositoryRecordByDate(days.get(i - 1), days.get(i), 0, val);
- result.add(result.get(j++) - depositoryRecordByDateByIn + depositoryRecordByDateByOut);
- }
+ // 获取一段时间内的入库额度
+ //测试
+ Double depositoryRecordByDateByIn1 = depositoryRecordService.findApplicationInRecordByDate(days.get(i - 1), days.get(i), val);
+ // 获取一段时间内的入库额度
+ Double depositoryRecordByDateByOut1 = depositoryRecordService.findApplicationOutRecordByDate(days.get(i - 1), days.get(i), val);
+ Double warehouserCount1 = result.get(j++) - depositoryRecordByDateByIn1 + depositoryRecordByDateByOut1;
+ result.add(warehouserCount1);
+ }*/
Collections.reverse(result);
map.put(key.toString(), ((ArrayList) result).clone());
result.clear();
@@ -236,19 +256,23 @@ public class DepositoryController {
parmOut.put("depository_id",depositoryAll.get(j).getId());
parmOut.put("start", months.get(num + 1));
parmOut.put("end", months.get(num));
- Double wareHouseInCountByMonth = depositoryRecordService.findMaterialCountByMonth(parmIn);
- Double wareHouseOutCountByMonth = depositoryRecordService.findMaterialCountByMonth(parmOut);
- Double wareHouseCount = result.get(k++) - wareHouseInCountByMonth + wareHouseOutCountByMonth;
- result.add(wareHouseCount);
- ((Map) sourceList.get(num)).put(depositoryAll.get(j).getDname(), wareHouseCount);
+ // 获取月份中入库材料的总额
+ // 测试
+ Double wareHouseInCountByMonth1 = depositoryRecordService.findMaterialCountByMonth1(parmIn);
+ // 获取月份中出库材料的总额
+ // 测试
+ Double wareHouseOutCountByMonth1 = depositoryRecordService.findMaterialCountByMonth1(parmOut);
+ // 获取当前月库存容量
+ // 测试
+ Double wareHouseCount1 = result.get(k++) - wareHouseInCountByMonth1 + wareHouseOutCountByMonth1;
+ result.add(wareHouseCount1);
+ ((Map) sourceList.get(num)).put(depositoryAll.get(j).getDname(), wareHouseCount1);
}
for (int i = 0; i < depositoryAll.size(); i++) {
result.remove(0);
}
-// Double last = result.get(result.size() - 1);
-// result.clear();
-// result.add(last);
}
+
for (int i = 0; i < depositoryAll.size(); i++) {
((Map) sourceList.get(0)).put(depositoryAll.get(i).getDname(), depositoryService.getToDayInventoryByDName(depositoryAll.get(i).getDname()));
}
@@ -308,17 +332,20 @@ public class DepositoryController {
parmOut.put("start", months.get(j + 1));
parmOut.put("end", months.get(j));
parmOut.put("dname", depositoryAll.get(i).getDname());
- Double wareHouseInCountByMonth = depositoryRecordService.findMaterialCountByMonth(parmIn);
- Double wareHouseOutCountByMonth = depositoryRecordService.findMaterialCountByMonth(parmOut);
- Double wareHouseCount = (Double) productData.get(k++) - wareHouseInCountByMonth + wareHouseOutCountByMonth;
- productData.add(wareHouseCount);
+ // 获取某个月某材料入库总额
+ // 测试
+ Double wareHouseInCountByMonth1 = depositoryRecordService.findMaterialCountByMonth1(parmIn);
+ // 获取某个月某材料出库总额
+ // 测试
+ Double wareHouseOutCountByMonth1 = depositoryRecordService.findMaterialCountByMonth1(parmOut);
+ Double wareHouseCount1 = (Double) productData.get(k++) - wareHouseInCountByMonth1 + wareHouseOutCountByMonth1;
+ productData.add(wareHouseCount1);
}
List