|
@@ -2,12 +2,15 @@ package com.jeeplus.modules.sg.managementcenter.activiti.utils;
|
|
|
|
|
|
import com.jeeplus.common.utils.SpringContextHolder;
|
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
|
+import com.jeeplus.core.persistence.Page;
|
|
|
import com.jeeplus.modules.sg.audit.information.service.InformationService;
|
|
|
import com.jeeplus.modules.sg.managementcenter.activiti.entity.FindTask;
|
|
|
import com.jeeplus.modules.sg.managementcenter.activiti.entity.MyNeedList;
|
|
|
import com.jeeplus.modules.sg.managementcenter.activiti.service.ConstructionService;
|
|
|
import com.jeeplus.modules.sg.managementcenter.project.entity.Project;
|
|
|
import com.jeeplus.modules.sg.managementcenter.project.service.ProjectService;
|
|
|
+import com.jeeplus.modules.sg.picking.activiti.entity.ShowList;
|
|
|
+import com.jeeplus.modules.sg.picking.activiti.service.ShowListService;
|
|
|
import com.jeeplus.modules.sys.entity.DictType;
|
|
|
import com.jeeplus.modules.sys.entity.DictValue;
|
|
|
import com.jeeplus.modules.sys.service.DictTypeService;
|
|
@@ -38,6 +41,7 @@ import org.ehcache.core.spi.service.ExecutionService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
|
|
|
public class MyActiviUtils {
|
|
@@ -51,6 +55,8 @@ public class MyActiviUtils {
|
|
|
private static ProjectService projectService = SpringContextHolder.getBean(ProjectService.class);
|
|
|
@Autowired
|
|
|
private static DictTypeService dictTypeService = SpringContextHolder.getBean(DictTypeService.class);
|
|
|
+ @Autowired
|
|
|
+ private static ShowListService showListService = SpringContextHolder.getBean(ShowListService.class);
|
|
|
|
|
|
/**
|
|
|
* 获取下一个用户任务信息
|
|
@@ -233,4 +239,102 @@ public class MyActiviUtils {
|
|
|
DictValue dictValue = dictTypeService.getDictValue("1010101010");
|
|
|
return dictValue;
|
|
|
}
|
|
|
+
|
|
|
+ public static List<ShowList> finaList(String item) {
|
|
|
+ ShowList showList = new ShowList();
|
|
|
+ ArrayList<String> objects = new ArrayList<>();
|
|
|
+ ArrayList<String> findList = new ArrayList<>();
|
|
|
+ List<ShowList> finalList = new ArrayList<>();
|
|
|
+ //返回给页面的list
|
|
|
+ List<ShowList> myList = new ArrayList<>();
|
|
|
+ if (item != null&&!"".equals(item)) {
|
|
|
+ String[] split = item.split(";");
|
|
|
+ //回显list
|
|
|
+ List<ShowList> returnList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ objects.add(split[i]);
|
|
|
+ }
|
|
|
+ for (String s : objects) {
|
|
|
+ String[] split1 = s.split(":");
|
|
|
+ ShowList myShow = new ShowList();
|
|
|
+ myShow.setId(split1[0]);
|
|
|
+ String s1 = split1[1];
|
|
|
+ myShow.setNumber(Double.parseDouble(s1));
|
|
|
+ findList.add(split1[0]);
|
|
|
+ myList.add(myShow);
|
|
|
+ }
|
|
|
+ showList.setFindList(findList);
|
|
|
+ List<ShowList> list = showListService.findList(showList);
|
|
|
+ //前端传来选择的模块与数量
|
|
|
+ for (ShowList my : myList) {
|
|
|
+ //循环遍历
|
|
|
+ for (ShowList showList1 : list) {
|
|
|
+ //选择的模块与查出来的一致
|
|
|
+ if (my.getId().equals(showList1.getBlockId())) {
|
|
|
+ Double mdSingleWeight = showList1.getMdSingleWeight();
|
|
|
+ Double number = my.getNumber();
|
|
|
+ Double mdCount = showList1.getMdCount();
|
|
|
+ Double i = mdSingleWeight * number;
|
|
|
+ BigDecimal b1 = new BigDecimal(Double.toString(number));
|
|
|
+ BigDecimal b2 = new BigDecimal(Double.toString(mdCount));
|
|
|
+ double v = b1.multiply(b2).doubleValue();
|
|
|
+ ShowList newShowList = new ShowList();
|
|
|
+ newShowList.setMaterialCode(showList1.getMaterialCode());
|
|
|
+ newShowList.setMaterialDescription(showList1.getMaterialDescription());
|
|
|
+ newShowList.setExtensionDescription(showList1.getExtensionDescription());
|
|
|
+ newShowList.setMdUnits(showList1.getMdUnits());
|
|
|
+ newShowList.setMdTheParty(showList1.getMdTheParty());
|
|
|
+ newShowList.setMdText(showList1.getMdText());
|
|
|
+ newShowList.setMdTotalAmount(v);
|
|
|
+ newShowList.setMdSingleWeight(showList1.getMdSingleWeight());
|
|
|
+ BigDecimal b = new BigDecimal(i);
|
|
|
+ BigDecimal a = new BigDecimal(1000);
|
|
|
+ BigDecimal divide = b.divide(a, 4, BigDecimal.ROUND_HALF_UP);
|
|
|
+ newShowList.setMdTotalWeight(Double.valueOf(divide.toString()));
|
|
|
+ newShowList.setBlockId(showList1.getBlockId());
|
|
|
+ returnList.add(newShowList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ boolean flag;
|
|
|
+ for (ShowList turn:returnList){
|
|
|
+ flag = true;
|
|
|
+ for (ShowList list1:finalList){
|
|
|
+ if (turn.getMaterialCode().equals(list1.getMaterialCode()) && turn.getMaterialDescription().equals(list1.getMaterialDescription()) && turn.getExtensionDescription().equals(list1.getExtensionDescription())) {
|
|
|
+ Double mdTotalAmount = list1.getMdTotalAmount();
|
|
|
+ Double mdTotalAmount1 = turn.getMdTotalAmount();
|
|
|
+ BigDecimal b1 = new BigDecimal(Double.toString(mdTotalAmount));
|
|
|
+ BigDecimal b2 = new BigDecimal(Double.toString(mdTotalAmount1));
|
|
|
+ double v = b1.add(b2).doubleValue();
|
|
|
+ Double mdTotalWeight = list1.getMdTotalWeight();
|
|
|
+ Double mdTotalWeight1 = turn.getMdTotalWeight();
|
|
|
+ BigDecimal a1 = new BigDecimal(Double.toString(mdTotalWeight));
|
|
|
+ BigDecimal a2 = new BigDecimal(Double.toString(mdTotalWeight1));
|
|
|
+ double b= a1.add(a2).doubleValue();
|
|
|
+ list1.setMdTotalAmount(v);
|
|
|
+ list1.setMdTotalWeight(b);
|
|
|
+ flag = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag){
|
|
|
+ showList = new ShowList();
|
|
|
+ showList.setMaterialCode(turn.getMaterialCode());
|
|
|
+ showList.setMaterialDescription(turn.getMaterialDescription());
|
|
|
+ showList.setExtensionDescription(turn.getExtensionDescription());
|
|
|
+ showList.setMdUnits(turn.getMdUnits());
|
|
|
+ showList.setMdTheParty(turn.getMdTheParty());
|
|
|
+ showList.setMdText(turn.getMdText());
|
|
|
+ showList.setMdTotalAmount(turn.getMdTotalAmount());
|
|
|
+ showList.setMdSingleWeight(turn.getMdSingleWeight());
|
|
|
+ showList.setMdTotalWeight(turn.getMdTotalWeight());
|
|
|
+ showList.setBlockId(turn.getBlockId());
|
|
|
+ finalList.add(showList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Collections.sort(finalList);
|
|
|
+ }
|
|
|
+ return finalList;
|
|
|
+ }
|
|
|
}
|
|
|
+
|