|
|
@ -5,6 +5,7 @@ import com.dreamchaser.depository_manage.config.PublicConfig; |
|
|
import com.dreamchaser.depository_manage.config.QyWxConfig; |
|
|
import com.dreamchaser.depository_manage.config.QyWxConfig; |
|
|
import com.dreamchaser.depository_manage.entity.*; |
|
|
import com.dreamchaser.depository_manage.entity.*; |
|
|
import com.dreamchaser.depository_manage.entity.MaterialAndPlace; |
|
|
import com.dreamchaser.depository_manage.entity.MaterialAndPlace; |
|
|
|
|
|
import com.dreamchaser.depository_manage.exception.MyException; |
|
|
import com.dreamchaser.depository_manage.mapper.*; |
|
|
import com.dreamchaser.depository_manage.mapper.*; |
|
|
import com.dreamchaser.depository_manage.pojo.*; |
|
|
import com.dreamchaser.depository_manage.pojo.*; |
|
|
import com.dreamchaser.depository_manage.pojo.callBackXml.approvalCallBackXml.ApprovalInfo_Details; |
|
|
import com.dreamchaser.depository_manage.pojo.callBackXml.approvalCallBackXml.ApprovalInfo_Details; |
|
|
@ -2706,8 +2707,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 将当前redis中存储的spno删除
|
|
|
// 将当前redis中存储的spno删除
|
|
|
redisPool.getRedisTemplateByDb(14).delete("wms_QyWxMessage_" + spNo); |
|
|
redisPool.getRedisTemplateByDb(14).delete("wms_QyWxMessage_" + spNo); |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
// 如果是前两个审批节点
|
|
|
// 如果是前两个审批节点
|
|
|
|
|
|
|
|
|
//定义处理时间
|
|
|
//定义处理时间
|
|
|
@ -5818,65 +5818,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 用于计算当前主记录下的总额与数量 |
|
|
|
|
|
*/ |
|
|
|
|
|
class CalcApplicationOutInfo implements Callable<Object> { |
|
|
|
|
|
|
|
|
|
|
|
ApplicationOutRecord mainRecord; |
|
|
|
|
|
|
|
|
|
|
|
CalcApplicationOutInfo(ApplicationOutRecord mainRecord) { |
|
|
|
|
|
this.mainRecord = mainRecord; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Object call() throws Exception { |
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
// 获取当前订单的子订单
|
|
|
|
|
|
List<ApplicationOutRecordMin> minList = depositoryRecordMapper.findApplicationOutRecordMinByParent(mainRecord.getId()); |
|
|
|
|
|
// 额度
|
|
|
|
|
|
double price = 0.0; |
|
|
|
|
|
// 数量
|
|
|
|
|
|
double count = 0; |
|
|
|
|
|
for (ApplicationOutRecordMin recordMin : minList) { |
|
|
|
|
|
double quantity = (double) recordMin.getQuantity() / 100; |
|
|
|
|
|
count += quantity; |
|
|
|
|
|
// 获取当前出库物料
|
|
|
|
|
|
Inventory materialById = materialMapper.findInventoryById(recordMin.getMid()); |
|
|
|
|
|
// 计算当前出库金额
|
|
|
|
|
|
double price_out = 0.0; |
|
|
|
|
|
if (recordMin.getUnit().equals(materialById.getUnit()) || "-1".equals(recordMin.getUnit())) { |
|
|
|
|
|
if (materialById.getPrice() != null) { |
|
|
|
|
|
price_out = materialById.getPrice() * quantity; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
Map<String, Object> paramForSplitInfo = new HashMap<>(); |
|
|
|
|
|
paramForSplitInfo.put("newUnit", recordMin.getUnit()); |
|
|
|
|
|
paramForSplitInfo.put("mid", materialById.getMid()); |
|
|
|
|
|
SplitInfo splitInfo = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo); |
|
|
|
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); |
|
|
|
|
|
if (materialById.getPrice() != null) { |
|
|
|
|
|
price_out = materialById.getPrice() / scale * quantity; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal bg = new BigDecimal(price_out / 100); |
|
|
|
|
|
price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
|
|
price = ObjectFormatUtil.sum(price, price_out); |
|
|
|
|
|
} |
|
|
|
|
|
result.put("count", count); |
|
|
|
|
|
result.put("price", price); |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 获取折线图数据 |
|
|
* 获取折线图数据 |
|
|
|
|
|
* |
|
|
* @param depositoryId 待获取仓库Id |
|
|
* @param depositoryId 待获取仓库Id |
|
|
* @param type 查看类型(1入库2出库) |
|
|
* @param type 查看类型(1入库2出库) |
|
|
* @param dateType 日期类型(day按天month按月) |
|
|
* @param dateType 日期类型(day按天month按月) |
|
|
@ -5919,6 +5863,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 获取当前折线图的具体数据 |
|
|
* 获取当前折线图的具体数据 |
|
|
|
|
|
* |
|
|
* @param type 查看类型(1入库2出库) |
|
|
* @param type 查看类型(1入库2出库) |
|
|
* @param days 查询日期 |
|
|
* @param days 查询日期 |
|
|
* @param depositoryId 仓库id |
|
|
* @param depositoryId 仓库id |
|
|
@ -5952,17 +5897,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
return map; |
|
|
return map; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 用于获取出入库的旭日图数据 |
|
|
* 用于获取出入库的旭日图数据 |
|
|
* @param dateName 当前月份名称 |
|
|
* |
|
|
|
|
|
* @param name 当前月份名称 |
|
|
* @param type 查看类型 |
|
|
* @param type 查看类型 |
|
|
* @param start 开始时间 |
|
|
* @param start 开始时间 |
|
|
* @param end 结束时间 |
|
|
* @param end 结束时间 |
|
|
* @param materialTypeAll 当前查看物料类型 |
|
|
* @param materialTypeAll 当前查看物料类型 |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
public Map<String, Object> getSunBurstDataByForApplication(String dateName, String type, Long start, Long end, List<MaterialType> materialTypeAll,Integer depositoryId) { |
|
|
public Map<String, Object> getSunBurstDataByForApplication(String name, String type, Long start, Long end, List<MaterialType> materialTypeAll, Integer depositoryId) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
@ -5998,7 +5943,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
result.put("children", resultForData); |
|
|
result.put("children", resultForData); |
|
|
result.put("name", dateName); |
|
|
result.put("name", name); |
|
|
result.remove("month"); |
|
|
result.remove("month"); |
|
|
result.put("value", sum); |
|
|
result.put("value", sum); |
|
|
// 用于生产随机的颜色
|
|
|
// 用于生产随机的颜色
|
|
|
@ -6012,6 +5957,140 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 用于获取当前类别名称下当前月份的出入库的旭日图数据 |
|
|
|
|
|
* |
|
|
|
|
|
* @param name 当前月份 |
|
|
|
|
|
* @param type 类型(1入库2出库) |
|
|
|
|
|
* @param start 开始 |
|
|
|
|
|
* @param end 结束 |
|
|
|
|
|
* @param mtName 类别名称 |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
public Map<String, Object> getSunBurstDataByMtName(String name, String type, Long start, Long end, String mtName, Integer depositoryId) { |
|
|
|
|
|
List<MaterialType> materialTypeByNames = materialTypeMapper.findMaterialTypeByName(mtName); |
|
|
|
|
|
MaterialType materialType = null; |
|
|
|
|
|
if (materialTypeByNames.size() > 0) { |
|
|
|
|
|
materialType = materialTypeByNames.get(0); |
|
|
|
|
|
} else { |
|
|
|
|
|
throw new MyException("错误,不存在当前名称的类型"); |
|
|
|
|
|
} |
|
|
|
|
|
List<MaterialType> childMaterialTypeList = materialTypeMapper.findMaterialTypeByParent(materialType.getOldId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double sum = 0.0; |
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
if (childMaterialTypeList != null && childMaterialTypeList.size() > 0) { |
|
|
|
|
|
int threadSize = PublicConfig.availableVirtualMachine; |
|
|
|
|
|
|
|
|
|
|
|
int maxThreadSize = childMaterialTypeList.size(); |
|
|
|
|
|
if (maxThreadSize < threadSize) { |
|
|
|
|
|
maxThreadSize = threadSize * 2; |
|
|
|
|
|
} |
|
|
|
|
|
ExecutorService exs = new ThreadPoolExecutor(threadSize, maxThreadSize, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(maxThreadSize)); |
|
|
|
|
|
|
|
|
|
|
|
// 结果集
|
|
|
|
|
|
List<Future<Object>> futureList = new ArrayList<Future<Object>>(); |
|
|
|
|
|
// 1.定义CompletionService
|
|
|
|
|
|
CompletionService<Object> completionService = new ExecutorCompletionService<Object>(exs); |
|
|
|
|
|
|
|
|
|
|
|
int runThreadSize = 0; |
|
|
|
|
|
for (MaterialType value : childMaterialTypeList) { |
|
|
|
|
|
Future<Object> submit = completionService.submit(new getSunBurstDataForApplicationByDepository(type, start, end, value, depositoryId)); |
|
|
|
|
|
runThreadSize++; |
|
|
|
|
|
futureList.add(submit); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Object> resultForData = new ArrayList<>(); |
|
|
|
|
|
for (int i = 0; i < runThreadSize; i++) { |
|
|
|
|
|
Object obj = null; |
|
|
|
|
|
try { |
|
|
|
|
|
obj = completionService.take().get(); |
|
|
|
|
|
resultForData.add(obj); |
|
|
|
|
|
sum = ObjectFormatUtil.sum(sum, ObjectFormatUtil.toDouble(ObjectFormatUtil.objToMap(obj, String.class, Object.class).get("value"))); |
|
|
|
|
|
} catch (InterruptedException | ExecutionException e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
result.put("children", resultForData); |
|
|
|
|
|
}else{ |
|
|
|
|
|
try { |
|
|
|
|
|
Object call = new getSunBurstDataForApplicationByDepository(type, start, end, materialType, depositoryId).call(); |
|
|
|
|
|
sum = ObjectFormatUtil.sum(sum, ObjectFormatUtil.toDouble(ObjectFormatUtil.objToMap(call, String.class, Object.class).get("value"))); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
result.put("name", name); |
|
|
|
|
|
result.remove("month"); |
|
|
|
|
|
result.put("value", sum); |
|
|
|
|
|
// 用于生产随机的颜色
|
|
|
|
|
|
Random random = new Random(); |
|
|
|
|
|
Map<String, String> itemStyle = new HashMap<>(); |
|
|
|
|
|
int r = random.nextInt(256); |
|
|
|
|
|
int g = random.nextInt(256); |
|
|
|
|
|
int b = random.nextInt(256); |
|
|
|
|
|
itemStyle.put("color", "rgb(" + r + "," + g + "," + b + ")"); |
|
|
|
|
|
result.put("itemStyle", itemStyle); |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 用于计算当前主记录下的总额与数量 |
|
|
|
|
|
*/ |
|
|
|
|
|
class CalcApplicationOutInfo implements Callable<Object> { |
|
|
|
|
|
|
|
|
|
|
|
ApplicationOutRecord mainRecord; |
|
|
|
|
|
|
|
|
|
|
|
CalcApplicationOutInfo(ApplicationOutRecord mainRecord) { |
|
|
|
|
|
this.mainRecord = mainRecord; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Object call() throws Exception { |
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
// 获取当前订单的子订单
|
|
|
|
|
|
List<ApplicationOutRecordMin> minList = depositoryRecordMapper.findApplicationOutRecordMinByParent(mainRecord.getId()); |
|
|
|
|
|
// 额度
|
|
|
|
|
|
double price = 0.0; |
|
|
|
|
|
// 数量
|
|
|
|
|
|
double count = 0; |
|
|
|
|
|
for (ApplicationOutRecordMin recordMin : minList) { |
|
|
|
|
|
double quantity = (double) recordMin.getQuantity() / 100; |
|
|
|
|
|
count += quantity; |
|
|
|
|
|
// 获取当前出库物料
|
|
|
|
|
|
Inventory materialById = materialMapper.findInventoryById(recordMin.getMid()); |
|
|
|
|
|
// 计算当前出库金额
|
|
|
|
|
|
double price_out = 0.0; |
|
|
|
|
|
if (recordMin.getUnit().equals(materialById.getUnit()) || "-1".equals(recordMin.getUnit())) { |
|
|
|
|
|
if (materialById.getPrice() != null) { |
|
|
|
|
|
price_out = materialById.getPrice() * quantity; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
Map<String, Object> paramForSplitInfo = new HashMap<>(); |
|
|
|
|
|
paramForSplitInfo.put("newUnit", recordMin.getUnit()); |
|
|
|
|
|
paramForSplitInfo.put("mid", materialById.getMid()); |
|
|
|
|
|
SplitInfo splitInfo = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo); |
|
|
|
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); |
|
|
|
|
|
if (materialById.getPrice() != null) { |
|
|
|
|
|
price_out = materialById.getPrice() / scale * quantity; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal bg = new BigDecimal(price_out / 100); |
|
|
|
|
|
price_out = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
|
|
price = ObjectFormatUtil.sum(price, price_out); |
|
|
|
|
|
} |
|
|
|
|
|
result.put("count", count); |
|
|
|
|
|
result.put("price", price); |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 用于具体执行查询旭日图的多线程类 |
|
|
* 用于具体执行查询旭日图的多线程类 |
|
|
*/ |
|
|
*/ |
|
|
@ -6057,7 +6136,4 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|