|
|
|
@ -4932,24 +4932,93 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
List<ApplicationOutRecord> list = depositoryRecordMapper.findApplicationOutRecordPByUser(map); |
|
|
|
List<ApplicationOutRecordP> result = new ArrayList<>(); |
|
|
|
Map<Long, UserByPort> userByPortMap = new HashMap<>(); |
|
|
|
for (ApplicationOutRecord record : list) { |
|
|
|
Long applicantId = record.getApplicantId(); |
|
|
|
for (ApplicationOutRecord recordP : list) { |
|
|
|
if (recordP.getQuantity() == null || 0 == recordP.getQuantity()) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
String unit = recordP.getUnit(); |
|
|
|
// 当前单的总额
|
|
|
|
double amounts = 0.0; |
|
|
|
// 当前物料单价
|
|
|
|
double mprice = ObjectFormatUtil.divide(recordP.getMprice(),100.0,2); |
|
|
|
// 当前出库数
|
|
|
|
double quantity = ObjectFormatUtil.divide(recordP.getQuantity(),100.0,2); |
|
|
|
if ("-1".equals(unit) || unit.equals("")) { |
|
|
|
amounts = ObjectFormatUtil.multiply(mprice, quantity); |
|
|
|
} else { |
|
|
|
// // 获取当前对应的拆单记录
|
|
|
|
Map<String, Object> paramForSplitInfo = new HashMap<>(); |
|
|
|
paramForSplitInfo.put("mid", recordP.getMid()); |
|
|
|
paramForSplitInfo.put("newUnit", unit); |
|
|
|
SplitInfo splitInfo = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo); |
|
|
|
// // 获取当前拆单记录与基础单位进制
|
|
|
|
int splitInfoScaleQuantity = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1L); |
|
|
|
BigDecimal bg = new BigDecimal(mprice / splitInfoScaleQuantity * quantity); |
|
|
|
amounts = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
} |
|
|
|
recordP.setPrice(amounts); |
|
|
|
|
|
|
|
// 获取当前申请人id
|
|
|
|
Long applicantId = recordP.getApplicantId(); |
|
|
|
// 声明申请人信息
|
|
|
|
UserByPort userByPortById = null; |
|
|
|
if (userByPortMap.containsKey(applicantId)) { |
|
|
|
userByPortById = userByPortMap.get(applicantId); |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
userByPortById = userMapper.findUserById(applicantId); |
|
|
|
Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById); |
|
|
|
userByPortById.setMaindeparmentname(departmentByUser.getName()); |
|
|
|
userByPortMap.put(applicantId, userByPortById); |
|
|
|
} |
|
|
|
String time = DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(record.getApplicantTime())); |
|
|
|
record.setApplicantName(userByPortById.getName()); |
|
|
|
record.setApplicantTime(time); |
|
|
|
record.setApplyRemark(record.getApplyRemark() == null ? "" : record.getApplyRemark()); |
|
|
|
ApplicationOutRecordP recordP = new ApplicationOutRecordP(record); |
|
|
|
recordP.setAdminorgName(userByPortById.getMaindeparmentname()); |
|
|
|
result.add(recordP); |
|
|
|
|
|
|
|
|
|
|
|
// 部门负责人
|
|
|
|
String departmentHead = recordP.getDepartmenthead(); |
|
|
|
String[] split = departmentHead.split(","); |
|
|
|
if ("".equals(departmentHead) || departmentHead.isEmpty()) { |
|
|
|
// 如果当前没有部门负责人
|
|
|
|
split = new String[0]; |
|
|
|
} |
|
|
|
String useAdminorgName = ""; |
|
|
|
for (String value : split) { |
|
|
|
if ("".equals(value)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
UserByPort departmenthead = null; |
|
|
|
Long departmentheadId = ObjectFormatUtil.toLong(value); |
|
|
|
if (userByPortMap.containsKey(departmentheadId)) { |
|
|
|
departmenthead = userByPortMap.get(departmentheadId); |
|
|
|
} else { |
|
|
|
departmenthead = userMapper.findUserById(departmentheadId); |
|
|
|
Administration departmentByUser = administrativeService.getDepartmentByUser(departmenthead); |
|
|
|
departmenthead.setMaindeparmentname(departmentByUser.getName()); |
|
|
|
userByPortMap.put(departmentheadId, departmenthead); |
|
|
|
} |
|
|
|
// 获取用户的用工关系
|
|
|
|
int emptype = departmenthead.getEmptype(); |
|
|
|
if (emptype > 10) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
if ("".equals(useAdminorgName)) { |
|
|
|
useAdminorgName = departmenthead.getMaindeparmentname(); |
|
|
|
} else { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
String time = DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(recordP.getApplicantTime())); |
|
|
|
recordP.setApplicantName(userByPortById.getName()); |
|
|
|
recordP.setApplicantTime(time); |
|
|
|
recordP.setApplyRemark(recordP.getApplyRemark() == null ? "" : recordP.getApplyRemark()); |
|
|
|
ApplicationOutRecordP aorp = new ApplicationOutRecordP(recordP); |
|
|
|
aorp.setAdminorgName(userByPortById.getMaindeparmentname()); |
|
|
|
if ("3".equals(aorp.getDepartmentheadPass()) || "3".equals(aorp.getDepositoryManagerPass()) || (aorp.getBalancePosterPass() != null && "3".equals(aorp.getBalancePosterPass()))) { |
|
|
|
aorp.setAllApproval(false); |
|
|
|
} else { |
|
|
|
aorp.setAllApproval(true); |
|
|
|
} |
|
|
|
aorp.setUseAdminorgName(useAdminorgName); |
|
|
|
result.add(aorp); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
@ -5023,23 +5092,88 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
if (recordP.getQuantity() == null || 0 == recordP.getQuantity()) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
String unit = recordP.getUnit(); |
|
|
|
// 当前单的总额
|
|
|
|
double amounts = 0.0; |
|
|
|
// 当前物料单价
|
|
|
|
double mprice = ObjectFormatUtil.divide(recordP.getMprice(),100.0,2); |
|
|
|
// 当前出库数
|
|
|
|
double quantity = ObjectFormatUtil.divide(recordP.getQuantity(),100.0,2); |
|
|
|
if ("-1".equals(unit) || unit.equals("")) { |
|
|
|
amounts = ObjectFormatUtil.multiply(mprice, quantity); |
|
|
|
} else { |
|
|
|
// // 获取当前对应的拆单记录
|
|
|
|
Map<String, Object> paramForSplitInfo = new HashMap<>(); |
|
|
|
paramForSplitInfo.put("mid", recordP.getMid()); |
|
|
|
paramForSplitInfo.put("newUnit", unit); |
|
|
|
SplitInfo splitInfo = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo); |
|
|
|
// // 获取当前拆单记录与基础单位进制
|
|
|
|
int splitInfoScaleQuantity = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1L); |
|
|
|
BigDecimal bg = new BigDecimal(mprice / splitInfoScaleQuantity * quantity); |
|
|
|
amounts = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
} |
|
|
|
recordP.setPrice(amounts); |
|
|
|
|
|
|
|
// 获取当前申请人id
|
|
|
|
Long applicantId = recordP.getApplicantId(); |
|
|
|
// 声明申请人信息
|
|
|
|
UserByPort userByPortById = null; |
|
|
|
if (userByPortMap.containsKey(applicantId)) { |
|
|
|
userByPortById = userByPortMap.get(applicantId); |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
userByPortById = userMapper.findUserById(applicantId); |
|
|
|
Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById); |
|
|
|
userByPortById.setMaindeparmentname(departmentByUser.getName()); |
|
|
|
userByPortMap.put(applicantId, userByPortById); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 部门负责人
|
|
|
|
String departmentHead = recordP.getDepartmenthead(); |
|
|
|
String[] split = departmentHead.split(","); |
|
|
|
if ("".equals(departmentHead) || departmentHead.isEmpty()) { |
|
|
|
// 如果当前没有部门负责人
|
|
|
|
split = new String[0]; |
|
|
|
} |
|
|
|
String useAdminorgName = ""; |
|
|
|
for (String value : split) { |
|
|
|
if ("".equals(value)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
UserByPort departmenthead = null; |
|
|
|
Long departmentheadId = ObjectFormatUtil.toLong(value); |
|
|
|
if (userByPortMap.containsKey(departmentheadId)) { |
|
|
|
departmenthead = userByPortMap.get(departmentheadId); |
|
|
|
} else { |
|
|
|
departmenthead = userMapper.findUserById(departmentheadId); |
|
|
|
Administration departmentByUser = administrativeService.getDepartmentByUser(departmenthead); |
|
|
|
departmenthead.setMaindeparmentname(departmentByUser.getName()); |
|
|
|
userByPortMap.put(departmentheadId, departmenthead); |
|
|
|
} |
|
|
|
// 获取用户的用工关系
|
|
|
|
int emptype = departmenthead.getEmptype(); |
|
|
|
if (emptype > 10) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
if ("".equals(useAdminorgName)) { |
|
|
|
useAdminorgName = departmenthead.getMaindeparmentname(); |
|
|
|
} else { |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
String time = DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(recordP.getApplicantTime())); |
|
|
|
recordP.setApplicantName(userByPortById.getName()); |
|
|
|
recordP.setApplicantTime(time); |
|
|
|
recordP.setApplyRemark(recordP.getApplyRemark() == null ? "" : recordP.getApplyRemark()); |
|
|
|
ApplicationOutRecordP aorp = new ApplicationOutRecordP(recordP); |
|
|
|
aorp.setAdminorgName(userByPortById.getMaindeparmentname()); |
|
|
|
|
|
|
|
if ("3".equals(aorp.getDepartmentheadPass()) || "3".equals(aorp.getDepositoryManagerPass()) || (aorp.getBalancePosterPass() != null && "3".equals(aorp.getBalancePosterPass()))) { |
|
|
|
aorp.setAllApproval(false); |
|
|
|
} else { |
|
|
|
aorp.setAllApproval(true); |
|
|
|
} |
|
|
|
aorp.setUseAdminorgName(useAdminorgName); |
|
|
|
result.add(aorp); |
|
|
|
} |
|
|
|
return result; |
|
|
|
|