|
@@ -63,7 +63,11 @@ public class ShowListController extends BaseController {
|
|
|
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());
|
|
@@ -71,7 +75,7 @@ public class ShowListController extends BaseController {
|
|
|
newShowList.setMdUnits(showList1.getMdUnits());
|
|
|
newShowList.setMeTheParty(showList1.getMeTheParty());
|
|
|
newShowList.setMdText(showList1.getMdText());
|
|
|
- newShowList.setMdTotalAmount(number);
|
|
|
+ newShowList.setMdTotalAmount(v);
|
|
|
newShowList.setMdSingleWeight(showList1.getMdSingleWeight());
|
|
|
BigDecimal b = new BigDecimal(i);
|
|
|
BigDecimal a = new BigDecimal(1000);
|
|
@@ -88,9 +92,19 @@ public class ShowListController extends BaseController {
|
|
|
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();
|
|
|
|
|
|
- list1.setMdTotalAmount(list1.getMdTotalAmount() + turn.getMdTotalAmount());
|
|
|
- list1.setMdTotalWeight(list1.getMdTotalWeight() + turn.getMdTotalWeight());
|
|
|
+ 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;
|
|
|
}
|
|
@@ -119,4 +133,76 @@ public class ShowListController extends BaseController {
|
|
|
return getBootstrapData(page);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 模块
|
|
|
+ * */
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping(value ="mkData")
|
|
|
+ public Map<String, Object> mkData(ShowList showList,String item, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
+ ArrayList<String> objects = new ArrayList<>();
|
|
|
+ ArrayList<String> findList = 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);
|
|
|
+ Page<ShowList> page = showListService.findPage(new Page<ShowList>(request, response), showList);
|
|
|
+ //查询出来所有的模块清单数据
|
|
|
+ List<ShowList> list = page.getList();
|
|
|
+ //前端传来选择的模块与数量
|
|
|
+ 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.setMeTheParty(showList1.getMeTheParty());
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ page.setList(returnList);
|
|
|
+ return getBootstrapData(page);
|
|
|
+ } else {
|
|
|
+ findList.add("没有数据");
|
|
|
+ showList.setFindList(findList);
|
|
|
+ Page<ShowList> page = showListService.findPage(new Page<ShowList>(request, response), showList);
|
|
|
+ return getBootstrapData(page);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|