|
|
|
@ -104,21 +104,25 @@ public class DepositoryController { |
|
|
|
Map<String, Integer> depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(); |
|
|
|
Iterator it = depositoryAllNameAndId.keySet().iterator(); |
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
// 获取当周仓库库存
|
|
|
|
// 获取本周仓库库存
|
|
|
|
Map<String, Object> thisWeekInventoryByDName = getThisWeekInventoryByDName(depositoryService, depositoryRecordService); |
|
|
|
while (it.hasNext()){ |
|
|
|
int i; |
|
|
|
Object key = it.next(); |
|
|
|
Double thisDayInventory = 0.0; |
|
|
|
// 本周周一的总量
|
|
|
|
thisDayInventory = ((List<Double>)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<Long> 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<days.size() - 1;i++) { |
|
|
|
// 获取本周周一日期
|
|
|
|
String mondayOnThisWeek = DateUtil.getMondayOnThisWeek(); |
|
|
|
if(mondayOnThisWeek.equals(DateUtil.TimeStampToDateTime(days.get(i)))){ |
|
|
|
break; |
|
|
|
} |
|
|
|
Integer val = (Integer) depositoryAllNameAndId.get(key); |
|
|
|
// 获取一段时间内的入库额度
|
|
|
|
//测试
|
|
|
|
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 warehouserCount1 = result.get(j++) - depositoryRecordByDateByIn1 + depositoryRecordByDateByOut1; |
|
|
|
result.add(warehouserCount1); |
|
|
|
} |
|
|
|
/* for (i = days.size() - 1; 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<Double>) 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<String, Object>) 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<String, Object>) 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<String, Object>) 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<Object> result = new ArrayList<>(); |
|
|
|
result.add(productData.get(0)); |
|
|
|
for (int j = productData.size() - 2; j > 0;j--) { |
|
|
|
result.add(productData.get(j)); |
|
|
|
} |
|
|
|
// mapDataList.add(((ArrayList<Object>) productData).clone());
|
|
|
|
mapDataList.add(result); |
|
|
|
productData.clear(); |
|
|
|
} |
|
|
|
@ -326,6 +353,7 @@ public class DepositoryController { |
|
|
|
return mapData; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 根据条件查询仓库 |
|
|
|
* |
|
|
|
@ -654,16 +682,20 @@ public class DepositoryController { |
|
|
|
depositoryName.add(key.toString()); |
|
|
|
} |
|
|
|
Integer val = (Integer) depositoryAllNameAndId.get(key); |
|
|
|
Double depositoryRecordByDateAndType = depositoryRecordService.findDepositoryRecordByDate(days.get(i), days.get(i - 1), Integer.parseInt(type), val); |
|
|
|
drCountbyDrName.add(depositoryRecordByDateAndType); |
|
|
|
// 获取一段时间内的库存额度
|
|
|
|
// 测试
|
|
|
|
Double depositoryRecordByDateAndType1 = depositoryRecordService.findApplicationRecordByDate(days.get(i), days.get(i - 1), Integer.parseInt(type), val); |
|
|
|
drCountbyDrName.add(depositoryRecordByDateAndType1); |
|
|
|
if (i == 2 && flag) { |
|
|
|
yesterdayData.put(key.toString(), depositoryRecordByDateAndType); |
|
|
|
yesterdayData.put(key.toString(), depositoryRecordByDateAndType1); |
|
|
|
} |
|
|
|
} |
|
|
|
Collections.reverse(drCountbyDrName); |
|
|
|
show_data.put(key.toString(), ((ArrayList<Double>) drCountbyDrName).clone()); |
|
|
|
drCountbyDrName.clear(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
if (weekDay == 1) { |
|
|
|
//只获取今天
|
|
|
|
Long now = DateUtil.DateTimeByMonthToTimeStamp(formatter.format(instance.getTime())); |
|
|
|
@ -676,12 +708,13 @@ public class DepositoryController { |
|
|
|
Object key = it.next(); |
|
|
|
depositoryName.add(key.toString()); |
|
|
|
Integer val = (Integer) depositoryAllNameAndId.get(key); |
|
|
|
Double depositoryRecordByDate = depositoryRecordService.findDepositoryRecordByDate(tomorrow,now , Integer.parseInt(type), val); |
|
|
|
// 获取一段时间内的库存额度
|
|
|
|
Double depositoryRecordByDate1 = depositoryRecordService.findApplicationRecordByDate(tomorrow,now , Integer.parseInt(type), val); |
|
|
|
Double toDayInventoryByDName = depositoryService.getToDayInventoryByDName(key.toString()); |
|
|
|
todayInventory.put(key.toString(),toDayInventoryByDName); |
|
|
|
yesterdayData.put(key.toString(), depositoryRecordByDate); |
|
|
|
yesterdayData.put(key.toString(), depositoryRecordByDate1); |
|
|
|
List<Double> drCountbyDrName = new ArrayList<>(); |
|
|
|
drCountbyDrName.add(depositoryRecordByDate); |
|
|
|
drCountbyDrName.add(depositoryRecordByDate1); |
|
|
|
show_data.put(key.toString(), ((ArrayList<Double>) drCountbyDrName).clone()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
@ -709,10 +742,12 @@ public class DepositoryController { |
|
|
|
depositoryName.add(key.toString()); |
|
|
|
} |
|
|
|
Integer val = (Integer) depositoryAllNameAndId.get(key); |
|
|
|
Double depositoryRecordByDate = depositoryRecordService.findDepositoryRecordByDate(days.get(i - 1), days.get(i), Integer.parseInt(type), val); |
|
|
|
drCountbyDrName.add(depositoryRecordByDate); |
|
|
|
// 获取一段时间内的库存额度
|
|
|
|
// 测试
|
|
|
|
Double depositoryRecordByDate1 = depositoryRecordService.findApplicationRecordByDate(days.get(i - 1), days.get(i), Integer.parseInt(type), val); |
|
|
|
drCountbyDrName.add(depositoryRecordByDate1); |
|
|
|
if (i == 2 && flag) { |
|
|
|
yesterdayData.put(key.toString(), depositoryRecordByDate); |
|
|
|
yesterdayData.put(key.toString(), depositoryRecordByDate1); |
|
|
|
} |
|
|
|
} |
|
|
|
show_data.put(key.toString(), ((ArrayList<Double>) drCountbyDrName).clone()); |
|
|
|
@ -737,8 +772,11 @@ public class DepositoryController { |
|
|
|
parm.put("start", months.get(num + 1)); |
|
|
|
parm.put("end", months.get(num)); |
|
|
|
parm.put("tname", materialTypeAll.get(j).getTname()); |
|
|
|
//根据条件获取月份中材料的总额
|
|
|
|
Double materialCountByMonth = depositoryRecordService.findMaterialCountByMonth(parm); |
|
|
|
((Map<String, Object>) sourceList.get(num)).put(materialTypeAll.get(j).getTname(), materialCountByMonth); |
|
|
|
// 测试
|
|
|
|
Double materialCountByMonth1 = depositoryRecordService.findMaterialCountByMonth1(parm); |
|
|
|
((Map<String, Object>) sourceList.get(num)).put(materialTypeAll.get(j).getTname(), materialCountByMonth1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -777,8 +815,10 @@ public class DepositoryController { |
|
|
|
parm.put("start", months1.get(j)); |
|
|
|
parm.put("end", months1.get(j - 1)); |
|
|
|
parm.put("tname", materialTypeAll.get(i).getTname()); |
|
|
|
Double materialCountByMonth = depositoryRecordService.findMaterialCountByMonth(parm); |
|
|
|
productData.add(materialCountByMonth); |
|
|
|
//根据条件获取月份中材料的总额
|
|
|
|
// 测试
|
|
|
|
Double materialCountByMonth1 = depositoryRecordService.findMaterialCountByMonth1(parm); |
|
|
|
productData.add(materialCountByMonth1); |
|
|
|
} |
|
|
|
mapDataList.add(((ArrayList<Object>) productData).clone()); |
|
|
|
productData.clear(); |
|
|
|
@ -987,4 +1027,11 @@ public class DepositoryController { |
|
|
|
return new RestResponse(administrationPList,size, 200); |
|
|
|
} |
|
|
|
|
|
|
|
// 构造树选择框
|
|
|
|
@GetMapping("/treeMenus") |
|
|
|
public RestResponse InitTreeMenus(){ |
|
|
|
List<Object> list = depositoryService.InitTreeMenus(); |
|
|
|
return new RestResponse(list); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|