|
|
@ -409,43 +409,43 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
double priceForYesterDay = 0.0; |
|
|
double priceForYesterDay = 0.0; |
|
|
for (ApplicationInRecord applicationInRecordP : applicationInRecordPForToday) { |
|
|
for (ApplicationInRecord applicationInRecordP : applicationInRecordPForToday) { |
|
|
// 获取当前入库类型(1物料2组合)
|
|
|
// 获取当前入库类型(1物料2组合)
|
|
|
sumForToday += (double) applicationInRecordP.getQuantity() / 100; |
|
|
sumForToday = ObjectFormatUtil.sum(sumForToday, (double) applicationInRecordP.getQuantity() / 100); |
|
|
|
|
|
|
|
|
Integer mid = applicationInRecordP.getMid(); |
|
|
Integer mid = applicationInRecordP.getMid(); |
|
|
Material materialById = materialMapper.findMaterialById(mid); |
|
|
Material materialById = materialMapper.findMaterialById(mid); |
|
|
if (materialById.getPrice() != null) { |
|
|
if (materialById.getPrice() == null) { |
|
|
priceForToday += 0; |
|
|
priceForToday += 0; |
|
|
} else { |
|
|
} else { |
|
|
if ("-1".equals(applicationInRecordP.getAirUnit()) || materialById.getUnit().equals(applicationInRecordP.getAirUnit())) { |
|
|
if ("-1".equals(applicationInRecordP.getAirUnit()) || materialById.getUnit().equals(applicationInRecordP.getAirUnit())) { |
|
|
priceForToday += materialById.getPrice() * (double) applicationInRecordP.getQuantity() / 100; |
|
|
priceForToday = ObjectFormatUtil.sum(priceForToday, materialById.getPrice() * (double) applicationInRecordP.getQuantity() / 100); |
|
|
} else { |
|
|
} else { |
|
|
Map<String, Object> paramForSplitInfo = new HashMap<>(); |
|
|
Map<String, Object> paramForSplitInfo = new HashMap<>(); |
|
|
paramForSplitInfo.put("newUnit", applicationInRecordP.getAirUnit()); |
|
|
paramForSplitInfo.put("newUnit", applicationInRecordP.getAirUnit()); |
|
|
paramForSplitInfo.put("mid", mid); |
|
|
paramForSplitInfo.put("mid", mid); |
|
|
SplitInfo splitInfoByMidAndUnit = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo); |
|
|
SplitInfo splitInfoByMidAndUnit = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo); |
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfoByMidAndUnit, -1); |
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfoByMidAndUnit, -1); |
|
|
priceForToday += materialById.getPrice() / scale * (double) applicationInRecordP.getQuantity() / 100; |
|
|
priceForToday = ObjectFormatUtil.sum(priceForToday, materialById.getPrice() / scale * (double) applicationInRecordP.getQuantity() / 100); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for (ApplicationInRecord applicationInRecordP : applicationInRecordPForYesterday) { |
|
|
for (ApplicationInRecord applicationInRecordP : applicationInRecordPForYesterday) { |
|
|
sumForYesterDay += (double) applicationInRecordP.getQuantity() / 100; |
|
|
sumForYesterDay = ObjectFormatUtil.sum(sumForYesterDay, (double) applicationInRecordP.getQuantity() / 100); |
|
|
Integer mid = applicationInRecordP.getMid(); |
|
|
Integer mid = applicationInRecordP.getMid(); |
|
|
Material materialById = materialMapper.findMaterialById(mid); |
|
|
Material materialById = materialMapper.findMaterialById(mid); |
|
|
if (materialById.getPrice() != null) { |
|
|
if (materialById.getPrice() == null) { |
|
|
priceForYesterDay += 0; |
|
|
priceForYesterDay += 0; |
|
|
} else { |
|
|
} else { |
|
|
if ("-1".equals(applicationInRecordP.getAirUnit()) || materialById.getUnit().equals(applicationInRecordP.getAirUnit())) { |
|
|
if ("-1".equals(applicationInRecordP.getAirUnit()) || materialById.getUnit().equals(applicationInRecordP.getAirUnit())) { |
|
|
priceForYesterDay += materialById.getPrice() * (double) applicationInRecordP.getQuantity() / 100; |
|
|
priceForYesterDay = ObjectFormatUtil.sum(priceForYesterDay, materialById.getPrice() * (double) applicationInRecordP.getQuantity() / 100); |
|
|
} else { |
|
|
} else { |
|
|
Map<String, Object> paramForSplitInfo = new HashMap<>(); |
|
|
Map<String, Object> paramForSplitInfo = new HashMap<>(); |
|
|
paramForSplitInfo.put("newUnit", applicationInRecordP.getAirUnit()); |
|
|
paramForSplitInfo.put("newUnit", applicationInRecordP.getAirUnit()); |
|
|
paramForSplitInfo.put("mid", mid); |
|
|
paramForSplitInfo.put("mid", mid); |
|
|
SplitInfo splitInfoByMidAndUnit = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo); |
|
|
SplitInfo splitInfoByMidAndUnit = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo); |
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfoByMidAndUnit, -1); |
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfoByMidAndUnit, -1); |
|
|
priceForYesterDay += materialById.getPrice() / scale * (double) applicationInRecordP.getQuantity() / 100; |
|
|
priceForYesterDay = ObjectFormatUtil.sum(priceForYesterDay, materialById.getPrice() / scale * (double) applicationInRecordP.getQuantity() / 100); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -548,8 +548,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} catch (ExecutionException e) { |
|
|
} catch (ExecutionException e) { |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
} |
|
|
} |
|
|
countForToday += ObjectFormatUtil.toDouble(((Map<String, Object>) o).get("count")); |
|
|
countForToday = ObjectFormatUtil.sum(countForToday, ObjectFormatUtil.toDouble(((Map<String, Object>) o).get("count"))); |
|
|
priceForToday += ObjectFormatUtil.toDouble(((Map<String, Object>) o).get("price")); |
|
|
priceForToday = ObjectFormatUtil.sum(priceForToday, ObjectFormatUtil.toDouble(((Map<String, Object>) o).get("price"))); |
|
|
} |
|
|
} |
|
|
// 关闭线程池
|
|
|
// 关闭线程池
|
|
|
PublicConfig.closeThreadPool(exsForToday); |
|
|
PublicConfig.closeThreadPool(exsForToday); |
|
|
@ -578,8 +578,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} catch (ExecutionException e) { |
|
|
} catch (ExecutionException e) { |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
} |
|
|
} |
|
|
countForYesterday += ObjectFormatUtil.toDouble(((Map<String, Object>) o).get("count")); |
|
|
countForYesterday = ObjectFormatUtil.sum(countForYesterday, ObjectFormatUtil.toDouble(((Map<String, Object>) o).get("count"))); |
|
|
priceForYesterday += ObjectFormatUtil.toDouble(((Map<String, Object>) o).get("price")); |
|
|
priceForYesterday = ObjectFormatUtil.sum(priceForYesterday, ObjectFormatUtil.toDouble(((Map<String, Object>) o).get("price"))); |
|
|
} |
|
|
} |
|
|
// 关闭线程池
|
|
|
// 关闭线程池
|
|
|
PublicConfig.closeThreadPool(exsForYesterday); |
|
|
PublicConfig.closeThreadPool(exsForYesterday); |
|
|
@ -592,6 +592,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
Double ratioForPrice = 0.0; |
|
|
Double ratioForPrice = 0.0; |
|
|
if (Double.compare(countForYesterday, 0.0) != 0) { |
|
|
if (Double.compare(countForYesterday, 0.0) != 0) { |
|
|
ratioForCount = ((countForToday - countForYesterday) / countForYesterday); |
|
|
ratioForCount = ((countForToday - countForYesterday) / countForYesterday); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if (Double.compare(priceForYesterday, 0.0) != 0) { |
|
|
if (Double.compare(priceForYesterday, 0.0) != 0) { |
|
|
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(Double.toString(priceForYesterday)); |
|
|
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(Double.toString(priceForYesterday)); |
|
|
@ -605,6 +606,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 获取金额比值
|
|
|
// 获取金额比值
|
|
|
result.put("radioForPrice", ratioForPrice * 100); |
|
|
result.put("radioForPrice", ratioForPrice * 100); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
|
|
|
// 如果获取已经出库的数量(今天)
|
|
|
// 如果获取已经出库的数量(今天)
|
|
|
List<ApplicationOutRecordMin> applicationOutMinForCompleteForToday = depositoryRecordMapper.findApplicationOutMinForComplete(mapForToday); |
|
|
List<ApplicationOutRecordMin> applicationOutMinForCompleteForToday = depositoryRecordMapper.findApplicationOutMinForComplete(mapForToday); |
|
|
// 如果获取已经出库的数量(昨天)
|
|
|
// 如果获取已经出库的数量(昨天)
|
|
|
@ -4377,7 +4379,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
if (map.containsKey("depositoryId")) { |
|
|
if (map.containsKey("depositoryId")) { |
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
} else if(!map.containsKey("depositoryIdList")){ |
|
|
} else if (!map.containsKey("depositoryIdList")) { |
|
|
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId()); |
|
|
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId()); |
|
|
depositoryAndRole.addAll(roleService.findDepositoryAndRole(userByPort.getPosition())); |
|
|
depositoryAndRole.addAll(roleService.findDepositoryAndRole(userByPort.getPosition())); |
|
|
|
|
|
|
|
|
@ -4630,17 +4632,20 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
double count = 0; |
|
|
double count = 0; |
|
|
for (ApplicationInRecord applicationInRecordP : applicationInRecordPAll) { |
|
|
for (ApplicationInRecord applicationInRecordP : applicationInRecordPAll) { |
|
|
Material materialById = materialMapper.findMaterialById(applicationInRecordP.getMid()); |
|
|
Material materialById = materialMapper.findMaterialById(applicationInRecordP.getMid()); |
|
|
if ("-1".equals(applicationInRecordP.getAirUnit()) || materialById.getUnit().equals(applicationInRecordP.getAirUnit())) { |
|
|
if (materialById.getPrice() != null) { |
|
|
sum += materialById.getPrice() / 100 * (double) applicationInRecordP.getQuantity() / 100; |
|
|
if ("-1".equals(applicationInRecordP.getAirUnit()) || materialById.getUnit().equals(applicationInRecordP.getAirUnit())) { |
|
|
} else { |
|
|
sum = ObjectFormatUtil.sum(sum, (materialById.getPrice() / 100 * (double) applicationInRecordP.getQuantity() / 100)); |
|
|
Map<String, Object> paramForSplitInfo = new HashMap<>(); |
|
|
} else { |
|
|
paramForSplitInfo.put("newUnit", applicationInRecordP.getAirUnit()); |
|
|
Map<String, Object> paramForSplitInfo = new HashMap<>(); |
|
|
paramForSplitInfo.put("mid", applicationInRecordP.getMid()); |
|
|
paramForSplitInfo.put("newUnit", applicationInRecordP.getAirUnit()); |
|
|
SplitInfo splitInfoByMidAndUnit = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo); |
|
|
paramForSplitInfo.put("mid", applicationInRecordP.getMid()); |
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfoByMidAndUnit, -1); |
|
|
SplitInfo splitInfoByMidAndUnit = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo); |
|
|
sum += materialById.getPrice() / scale / 100 * (double) applicationInRecordP.getQuantity() / 100; |
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfoByMidAndUnit, -1); |
|
|
|
|
|
sum = ObjectFormatUtil.sum(sum, (materialById.getPrice() / scale / 100 * (double) applicationInRecordP.getQuantity() / 100)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
count += (double) applicationInRecordP.getQuantity() / 100; |
|
|
count = ObjectFormatUtil.sum(count, (double) applicationInRecordP.getQuantity() / 100); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
BigDecimal bg = new BigDecimal(sum); |
|
|
BigDecimal bg = new BigDecimal(sum); |
|
|
sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|