|
|
|
@ -276,7 +276,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
@Override |
|
|
|
public Integer deleteApplicationOutRecordById(Integer id, UserByPort userByPort) { |
|
|
|
// 获取主单
|
|
|
|
ApplicationOutRecordP recordP = depositoryRecordMapper.findApplicationOutRecordPById(id); |
|
|
|
ApplicationOutRecord recordP = depositoryRecordMapper.findApplicationOutRecordPById(id); |
|
|
|
|
|
|
|
// 删除主单
|
|
|
|
Integer integer = depositoryRecordMapper.deleteApplicationOutRecordById(id); |
|
|
|
@ -329,7 +329,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
@Override |
|
|
|
public Integer deleteApplicationOutRecordByIds(List<Integer> list, UserByPort userByPort) { |
|
|
|
// 获取出库单列表
|
|
|
|
List<ApplicationOutRecordP> recordPList = depositoryRecordMapper.findApplicationOutRecordPByIds(list); |
|
|
|
List<ApplicationOutRecord> recordPList = depositoryRecordMapper.findApplicationOutRecordPByIds(list); |
|
|
|
|
|
|
|
Integer integer = depositoryRecordMapper.deleteApplicationOutRecordByIds(list); |
|
|
|
|
|
|
|
@ -339,7 +339,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
public void run() { |
|
|
|
|
|
|
|
|
|
|
|
for (ApplicationOutRecordP recordP : recordPList |
|
|
|
for (ApplicationOutRecord recordP : recordPList |
|
|
|
) { |
|
|
|
// 获取该用户在redis中的订单记录
|
|
|
|
String key = "user:" + recordP.getApplicantId(); |
|
|
|
@ -493,22 +493,22 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
// 获取今天的额度
|
|
|
|
Double priceForToday = 0.0; |
|
|
|
double priceForToday = 0.0; |
|
|
|
|
|
|
|
// 获取今天的总数
|
|
|
|
Integer countForToday = 0; |
|
|
|
Double countForToday = 0.0; |
|
|
|
// 获取昨天的额度
|
|
|
|
Double priceForYesterday = 0.0; |
|
|
|
double priceForYesterday = 0.0; |
|
|
|
|
|
|
|
// 获取昨天的总数
|
|
|
|
Integer countForYesterday = 0; |
|
|
|
Double countForYesterday = 0.0; |
|
|
|
if (state.isEmpty()) { |
|
|
|
// 获取今天为止的出库记录
|
|
|
|
List<ApplicationOutRecordP> applicationOutRecordPForToday = depositoryRecordMapper.findApplicationOutRecordPForAPeriodOfTime(mapForToday); |
|
|
|
List<ApplicationOutRecord> applicationOutRecordPForToday = depositoryRecordMapper.findApplicationOutRecordPForAPeriodOfTime(mapForToday); |
|
|
|
// 今天的出库记录数
|
|
|
|
int todaySize = applicationOutRecordPForToday.size(); |
|
|
|
// 获取昨天的出库记录
|
|
|
|
List<ApplicationOutRecordP> applicationOutRecordPForYesterday = depositoryRecordMapper.findApplicationOutRecordPForAPeriodOfTime(mapForYesterday); |
|
|
|
List<ApplicationOutRecord> applicationOutRecordPForYesterday = depositoryRecordMapper.findApplicationOutRecordPForAPeriodOfTime(mapForYesterday); |
|
|
|
|
|
|
|
// 昨天的出库记录数
|
|
|
|
int yesterdaySize = applicationOutRecordPForYesterday.size(); |
|
|
|
@ -521,9 +521,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
CompletionService<Object> completionServiceForToday = new ExecutorCompletionService<Object>(exsForToday); |
|
|
|
|
|
|
|
// 开启线程计算今天的额度
|
|
|
|
for (int i = 0; i < todaySize; i++) { |
|
|
|
for (ApplicationOutRecord recordP : applicationOutRecordPForToday) { |
|
|
|
// 获取当前主记录
|
|
|
|
ApplicationOutRecordP recordP = applicationOutRecordPForToday.get(i); |
|
|
|
Future<Object> submit = completionServiceForToday.submit(new CalcApplicationOutInfo(recordP)); |
|
|
|
futureListForToday.add(submit); |
|
|
|
} |
|
|
|
@ -549,8 +548,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 1.定义CompletionService
|
|
|
|
CompletionService<Object> completionServiceForYesterday = new ExecutorCompletionService<Object>(exsForYesterday); |
|
|
|
// 开启线程计算昨天的额度
|
|
|
|
for (int i = 0; i < yesterdaySize; i++) { |
|
|
|
ApplicationOutRecordP recordP = applicationOutRecordPForYesterday.get(i); |
|
|
|
for (ApplicationOutRecord recordP : applicationOutRecordPForYesterday) { |
|
|
|
Future<Object> submit = completionServiceForYesterday.submit(new CalcApplicationOutInfo(recordP)); |
|
|
|
futureListForYesterday.add(submit); |
|
|
|
} |
|
|
|
@ -576,10 +574,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
Double ratioForCount = 0.0; |
|
|
|
Double ratioForPrice = 0.0; |
|
|
|
if (Double.compare(countForYesterday, 0.0) != 0) { |
|
|
|
ratioForCount = ((countForToday - countForYesterday) / Double.parseDouble(countForYesterday.toString())); |
|
|
|
ratioForCount = ((countForToday - countForYesterday) / countForYesterday); |
|
|
|
} |
|
|
|
if (Double.compare(priceForYesterday, 0.0) != 0) { |
|
|
|
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(priceForYesterday.toString()); |
|
|
|
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(Double.toString(priceForYesterday)); |
|
|
|
} |
|
|
|
BigDecimal bgForSum = new BigDecimal(ratioForCount); |
|
|
|
BigDecimal bgForPrice = new BigDecimal(ratioForPrice); |
|
|
|
@ -623,10 +621,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
Double ratioForCount = 0.0; |
|
|
|
Double ratioForPrice = 0.0; |
|
|
|
if (Double.compare(countForYesterday, 0.0) != 0) { |
|
|
|
ratioForCount = ((countForToday - countForYesterday) / Double.parseDouble(countForYesterday.toString())); |
|
|
|
ratioForCount = ((countForToday - countForYesterday) / countForYesterday); |
|
|
|
} |
|
|
|
if (Double.compare(priceForYesterday, 0.0) != 0) { |
|
|
|
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(priceForYesterday.toString()); |
|
|
|
ratioForPrice = (priceForToday - priceForYesterday) / Double.parseDouble(Double.toString(priceForYesterday)); |
|
|
|
} |
|
|
|
BigDecimal bgForSum = new BigDecimal(ratioForCount); |
|
|
|
BigDecimal bgForPrice = new BigDecimal(ratioForPrice); |
|
|
|
@ -848,13 +846,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
String unit = (String) map.get("unit"); |
|
|
|
if ("-1".equals(unit)) { |
|
|
|
// 获取出库数量
|
|
|
|
Integer quantity = ObjectFormatUtil.toInteger(map.get("quantity")); |
|
|
|
Double quantity = ObjectFormatUtil.toDouble(map.get("quantity")); |
|
|
|
// 设置当前暂时出库数量
|
|
|
|
inventoryById.setNumberOfTemporary(inventoryById.getNumberOfTemporary() + quantity); |
|
|
|
inventoryById.setNumberOfTemporary(inventoryById.getNumberOfTemporary() + quantity.intValue()); |
|
|
|
// 修改库存记录
|
|
|
|
materialMapper.updateInventory(inventoryById); |
|
|
|
} |
|
|
|
map.put("quantity",ObjectFormatUtil.toDouble(map.get("quantity")) * 100); |
|
|
|
return depositoryRecordMapper.insertApplicationOutRecordMin(map); |
|
|
|
} |
|
|
|
|
|
|
|
@ -865,8 +862,15 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<ApplicationOutRecordMin> findApplicationOutRecordMinByParent(Integer id) { |
|
|
|
return depositoryRecordMapper.findApplicationOutRecordMinByParent(id); |
|
|
|
public List<ApplicationOutRecordMinP> findApplicationOutRecordMinByParent(Integer id) { |
|
|
|
List<ApplicationOutRecordMin> outRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(id); |
|
|
|
List<ApplicationOutRecordMinP> recordMinPList = new ArrayList<>(); |
|
|
|
for (ApplicationOutRecordMin aorm:outRecordMinByParent |
|
|
|
) { |
|
|
|
ApplicationOutRecordMinP aormP = new ApplicationOutRecordMinP(aorm); |
|
|
|
recordMinPList.add(aormP); |
|
|
|
} |
|
|
|
return recordMinPList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -876,8 +880,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public ApplicationOutRecordMin findApplicationOutMinById(Integer id) { |
|
|
|
return depositoryRecordMapper.findApplicationOutMinById(id); |
|
|
|
public ApplicationOutRecordMinP findApplicationOutMinById(Integer id) { |
|
|
|
return new ApplicationOutRecordMinP(depositoryRecordMapper.findApplicationOutMinById(id)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -887,8 +891,14 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<ApplicationOutRecordMin> findApplicationOutMinByCondition(Map<String, Object> map) { |
|
|
|
return depositoryRecordMapper.findApplicationOutMinByCondition(map); |
|
|
|
public List<ApplicationOutRecordMinP> findApplicationOutMinByCondition(Map<String, Object> map) { |
|
|
|
List<ApplicationOutRecordMin> condition = depositoryRecordMapper.findApplicationOutMinByCondition(map); |
|
|
|
List<ApplicationOutRecordMinP> result = new ArrayList<>(); |
|
|
|
for (ApplicationOutRecordMin aorm:condition |
|
|
|
) { |
|
|
|
result.add(new ApplicationOutRecordMinP(aorm)); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -898,10 +908,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<ApplicationOutRecordMin> findApplicationOutMinByParentId(Integer parentId) { |
|
|
|
public List<ApplicationOutRecordMinP> findApplicationOutMinByParentId(Integer parentId) { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("parentId", parentId); |
|
|
|
return depositoryRecordMapper.findApplicationOutMinByCondition(map); |
|
|
|
List<ApplicationOutRecordMin> applicationOutMinByCondition = depositoryRecordMapper.findApplicationOutMinByCondition(map); |
|
|
|
List<ApplicationOutRecordMinP> applicationOutRecordMinPList = new ArrayList<>(); |
|
|
|
for (ApplicationOutRecordMin recordMin:applicationOutMinByCondition |
|
|
|
) { |
|
|
|
ApplicationOutRecordMinP recordMinP = new ApplicationOutRecordMinP(recordMin); |
|
|
|
applicationOutRecordMinPList.add(recordMinP); |
|
|
|
} |
|
|
|
return applicationOutRecordMinPList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -927,7 +944,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取库存信息
|
|
|
|
Inventory inventory = materialMapper.findInventoryById(mid); |
|
|
|
// 获取子订单对应的主订单
|
|
|
|
ApplicationOutRecordP record = depositoryRecordMapper.findApplicationOutRecordPById(applicationOutMinById.getParentId()); |
|
|
|
ApplicationOutRecord record = depositoryRecordMapper.findApplicationOutRecordPById(applicationOutMinById.getParentId()); |
|
|
|
// 设置标志位
|
|
|
|
boolean flag = true; |
|
|
|
// 设置最终返回值
|
|
|
|
@ -1656,7 +1673,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @param userAgent user-agent |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecordP record, Integer trueOut, UserByPort userByPort, Integer placeId, String userAgent) { |
|
|
|
void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Integer trueOut, UserByPort userByPort, Integer placeId, String userAgent) { |
|
|
|
String redisMinRecordKey = "minRecord:" + id; // 设置redis中子订单键值
|
|
|
|
// 修改redis中本子订单状态
|
|
|
|
// redisTemplate.opsForHash().put(redisMinRecordKey,"state","2");
|
|
|
|
@ -1822,7 +1839,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取审核订单
|
|
|
|
Integer outId = ObjectFormatUtil.toInteger(mainId); |
|
|
|
// 获取对应的出库订单
|
|
|
|
ApplicationOutRecordP recordP = depositoryRecordMapper.findApplicationOutRecordPById(outId); |
|
|
|
ApplicationOutRecord recordP = depositoryRecordMapper.findApplicationOutRecordPById(outId); |
|
|
|
|
|
|
|
// 获取当前审批所在部门
|
|
|
|
// Integer maindeparment = userByPort.getMaindeparment();
|
|
|
|
@ -2016,7 +2033,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
@Override |
|
|
|
public boolean judgeApplicationOutRecordStatus(Integer id) { |
|
|
|
// 获取当前出库记录
|
|
|
|
ApplicationOutRecordP recordPById = depositoryRecordMapper.findApplicationOutRecordPById(id); |
|
|
|
ApplicationOutRecord recordPById = depositoryRecordMapper.findApplicationOutRecordPById(id); |
|
|
|
Integer pass = recordPById.getPass(); |
|
|
|
if (Integer.compare(pass, 2) == 0) { |
|
|
|
// 如果审核未通过
|
|
|
|
@ -2278,7 +2295,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* |
|
|
|
* @param recordP 拒绝的订单 |
|
|
|
*/ |
|
|
|
private void updateInventoryForOutRefused(ApplicationOutRecordP recordP) { |
|
|
|
private void updateInventoryForOutRefused(ApplicationOutRecord recordP) { |
|
|
|
// 获取该订单下的子订单
|
|
|
|
List<ApplicationOutRecordMin> recordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(recordP.getId()); |
|
|
|
// 循环该记录
|
|
|
|
@ -2314,7 +2331,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Integer review(Map<String, Object> map, Integer userid, UserByPort userToken, String userAgent) { |
|
|
|
Object id = map.get("id"); // 主订单编号
|
|
|
|
ApplicationOutRecordP record = depositoryRecordMapper.findApplicationOutRecordPById(ObjectFormatUtil.toInteger(id)); |
|
|
|
ApplicationOutRecord record = depositoryRecordMapper.findApplicationOutRecordPById(ObjectFormatUtil.toInteger(id)); |
|
|
|
map.remove("id"); |
|
|
|
|
|
|
|
List<ApplicationOutRecordMin> minByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(record.getId()); |
|
|
|
@ -2718,7 +2735,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取审核订单
|
|
|
|
Integer outId = ObjectFormatUtil.toInteger(clickKeys[2].split("outId")[1]); |
|
|
|
// 获取对应的出库订单
|
|
|
|
ApplicationOutRecordP recordP = depositoryRecordMapper.findApplicationOutRecordPById(outId); |
|
|
|
ApplicationOutRecord recordP = depositoryRecordMapper.findApplicationOutRecordPById(outId); |
|
|
|
// 获取当前用户的身份
|
|
|
|
String optionId = templateCard.getSelectedItems().getSelectedItem().getOptionIds().getOptionId(); |
|
|
|
String[] optionsKey = optionId.split("_"); |
|
|
|
@ -3397,7 +3414,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
applicationInRecord.setMcode(group.getCode()); |
|
|
|
applicationInRecord.setMversion("组合"); |
|
|
|
} |
|
|
|
ApplicationInRecordP ap = new ApplicationInRecordP(); |
|
|
|
ApplicationInRecordP ap = new ApplicationInRecordP(applicationInRecord); |
|
|
|
result.add(ap); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
@ -3508,15 +3526,18 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} |
|
|
|
map.put("depositoryIdList", depositoryIdList); |
|
|
|
map.put("applicantId", userByPort.getId()); |
|
|
|
List<ApplicationOutRecordP> list = depositoryRecordMapper.findApplicationOutRecordPByUser(map); |
|
|
|
for (ApplicationOutRecordP recordP : list) { |
|
|
|
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(recordP.getApplicantId(), userByPort); |
|
|
|
String time = DateUtil.TimeStampToDateTime(Long.valueOf(recordP.getApplicantTime())); |
|
|
|
recordP.setApplicantName(userByPortById.getName()); |
|
|
|
recordP.setApplicantTime(time); |
|
|
|
recordP.setApplyRemark(recordP.getApplyRemark() == null ? "" : recordP.getApplyRemark()); |
|
|
|
List<ApplicationOutRecord> list = depositoryRecordMapper.findApplicationOutRecordPByUser(map); |
|
|
|
List<ApplicationOutRecordP> result = new ArrayList<>(); |
|
|
|
for (ApplicationOutRecord record : list) { |
|
|
|
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userByPort); |
|
|
|
String time = DateUtil.TimeStampToDateTime(Long.valueOf(record.getApplicantTime())); |
|
|
|
record.setApplicantName(userByPortById.getName()); |
|
|
|
record.setApplicantTime(time); |
|
|
|
record.setApplyRemark(record.getApplyRemark() == null ? "" : record.getApplyRemark()); |
|
|
|
ApplicationOutRecordP recordP = new ApplicationOutRecordP(record); |
|
|
|
result.add(recordP); |
|
|
|
} |
|
|
|
return list; |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -3567,15 +3588,18 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
String applyTime = (String) map.get("applyTime"); |
|
|
|
map.put("applicantTime", DateUtil.DateTimeByDayToTimeStamp(applyTime)); |
|
|
|
} |
|
|
|
List<ApplicationOutRecordP> list = depositoryRecordMapper.findApplicationOutRecordPByCondition(map); |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(list.get(i).getApplicantId(), userToken); |
|
|
|
String time = DateUtil.TimeStampToDateTime(Long.valueOf(list.get(i).getApplicantTime())); |
|
|
|
list.get(i).setApplicantName(userByPortById.getName()); |
|
|
|
list.get(i).setApplicantTime(time); |
|
|
|
list.get(i).setApplyRemark(list.get(i).getApplyRemark() == null ? "" : list.get(i).getApplyRemark()); |
|
|
|
List<ApplicationOutRecord> list = depositoryRecordMapper.findApplicationOutRecordPByCondition(map); |
|
|
|
List<ApplicationOutRecordP> result = new ArrayList<>(); |
|
|
|
for (ApplicationOutRecord recordP : list) { |
|
|
|
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(recordP.getApplicantId(), userToken); |
|
|
|
String time = DateUtil.TimeStampToDateTime(Long.valueOf(recordP.getApplicantTime())); |
|
|
|
recordP.setApplicantName(userByPortById.getName()); |
|
|
|
recordP.setApplicantTime(time); |
|
|
|
recordP.setApplyRemark(recordP.getApplyRemark() == null ? "" : recordP.getApplyRemark()); |
|
|
|
ApplicationOutRecordP aorp = new ApplicationOutRecordP(recordP); |
|
|
|
result.add(aorp); |
|
|
|
} |
|
|
|
return list; |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -3604,7 +3628,14 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<ApplicationOutRecordP> findApplicationOutRecordByDepository(String depositoryId) { |
|
|
|
return depositoryRecordMapper.findApplicationOutRecordByDepository(depositoryId); |
|
|
|
List<ApplicationOutRecord> recordList = depositoryRecordMapper.findApplicationOutRecordByDepository(depositoryId); |
|
|
|
List<ApplicationOutRecordP> result = new ArrayList<>(); |
|
|
|
for (ApplicationOutRecord record:recordList |
|
|
|
) { |
|
|
|
ApplicationOutRecordP recordP = new ApplicationOutRecordP(record); |
|
|
|
result.add(recordP); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -3626,7 +3657,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public ApplicationOutRecordP findApplicationOutRecordPById(Integer id) { |
|
|
|
return depositoryRecordMapper.findApplicationOutRecordPById(id); |
|
|
|
ApplicationOutRecord record = depositoryRecordMapper.findApplicationOutRecordPById(id); |
|
|
|
ApplicationOutRecordP recordP = new ApplicationOutRecordP(record); |
|
|
|
return recordP; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -3843,11 +3876,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Double CalculateAllApplicationOutPrice(String state) { |
|
|
|
List<ApplicationOutRecordP> applicationOutRecordPAll = depositoryRecordMapper.findApplicationOutRecordPAll(); |
|
|
|
List<ApplicationOutRecord> applicationOutRecordPAll = depositoryRecordMapper.findApplicationOutRecordPAll(); |
|
|
|
double sum = 0.0; |
|
|
|
if (state.isEmpty()) { |
|
|
|
// 如果要获取所有待出库的金额
|
|
|
|
for (ApplicationOutRecordP applicationOutRecordP : applicationOutRecordPAll) { |
|
|
|
for (ApplicationOutRecord applicationOutRecordP : applicationOutRecordPAll) { |
|
|
|
// 获取所有子物料
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("parentId", applicationOutRecordP.getId()); |
|
|
|
@ -3857,7 +3890,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
Material materialById = materialMapper.findMaterialById(mid); |
|
|
|
if (materialById.getPrice() != null) { |
|
|
|
|
|
|
|
sum += (materialById.getPrice() / 100) * applicationOutRecordMin.getQuantity(); |
|
|
|
sum += (materialById.getPrice() / 100) * ((double)applicationOutRecordMin.getQuantity() / 100); |
|
|
|
} else { |
|
|
|
sum += 0; |
|
|
|
} |
|
|
|
@ -4543,9 +4576,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
*/ |
|
|
|
class CalcApplicationOutInfo implements Callable<Object> { |
|
|
|
|
|
|
|
ApplicationOutRecordP mainRecord; |
|
|
|
ApplicationOutRecord mainRecord; |
|
|
|
|
|
|
|
CalcApplicationOutInfo(ApplicationOutRecordP mainRecord) { |
|
|
|
CalcApplicationOutInfo(ApplicationOutRecord mainRecord) { |
|
|
|
this.mainRecord = mainRecord; |
|
|
|
} |
|
|
|
|
|
|
|
@ -4555,17 +4588,18 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取当前订单的子订单
|
|
|
|
List<ApplicationOutRecordMin> minList = depositoryRecordMapper.findApplicationOutRecordMinByParent(mainRecord.getId()); |
|
|
|
// 额度
|
|
|
|
Double price = 0.0; |
|
|
|
double price = 0.0; |
|
|
|
// 数量
|
|
|
|
Integer count = 0; |
|
|
|
double count = 0; |
|
|
|
for (ApplicationOutRecordMin recordMin : minList) { |
|
|
|
count += recordMin.getQuantity(); |
|
|
|
double quantity =(double) recordMin.getQuantity() / 100; |
|
|
|
count += quantity ; |
|
|
|
// 获取当前出库物料
|
|
|
|
Inventory materialById = materialMapper.findInventoryById(recordMin.getMid()); |
|
|
|
// 计算当前出库金额
|
|
|
|
double price_out = 0.0; |
|
|
|
if (materialById.getPrice() != null) { |
|
|
|
price_out = materialById.getPrice() * recordMin.getQuantity(); |
|
|
|
price_out = materialById.getPrice() * quantity; |
|
|
|
} |
|
|
|
BigDecimal bg = new BigDecimal(price_out / 100); |
|
|
|
price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
|