| | |
| | | package com.example.erp.service.mm; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.example.erp.common.Constants; |
| | | import com.example.erp.dto.mm.FinishedOperateLogDTO; |
| | | import com.example.erp.dto.mm.MaterialLogDTO; |
| | | import com.example.erp.entity.mm.*; |
| | | import com.example.erp.entity.pp.*; |
| | | import com.example.erp.entity.sd.Delivery; |
| | | import com.example.erp.entity.sd.DeliveryDetail; |
| | | import com.example.erp.entity.sd.OrderDetail; |
| | | import com.example.erp.entity.sd.OrderProcessDetail; |
| | | import com.example.erp.entity.userInfo.Log; |
| | | import com.example.erp.entity.userInfo.SysError; |
| | | import com.example.erp.exception.ServiceException; |
| | | import com.example.erp.mapper.mm.BasicWarehouseTypeMapper; |
| | | import com.example.erp.mapper.mm.MaterialInventoryMapper; |
| | | import com.example.erp.mapper.mm.MaterialLogMapper; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.ArrayList; |
| | | |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | |
| | | MaterialInventory materialInventory = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), MaterialInventory.class); |
| | | |
| | | |
| | | if(materialInventory.getProducer()==null){ |
| | | materialInventory.setProducer(""); |
| | | } |
| | | //查询物料是否存在 |
| | | List<MaterialInventory> MaterialInventoryCount; |
| | | if (materialInventory.getDateOfManufacture()!=null){ |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(materialCode,materialInventory.getDateOfManufacture()); |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(materialCode,materialInventory.getDateOfManufacture(),materialInventory.getProducer()); |
| | | }else{ |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull(materialCode); |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull(materialCode,materialInventory.getProducer()); |
| | | } |
| | | |
| | | if(MaterialInventoryCount.size()==1){ |
| | |
| | | totalArea= Double.parseDouble(decimalFormat.format(singlePieceArea * returningWarehouseDetail.getReturnQuantity())); |
| | | |
| | | |
| | | if(returningWarehouseDetail.getProducer()==null){ |
| | | returningWarehouseDetail.setProducer(""); |
| | | } |
| | | //查询物料是否存在 |
| | | List<MaterialInventory> MaterialInventoryCount; |
| | | if (returningWarehouseDetail.getDateOfManufacture()!=null){ |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(returningWarehouseDetail.getId(),returningWarehouseDetail.getDateOfManufacture()); |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(returningWarehouseDetail.getId(),returningWarehouseDetail.getDateOfManufacture(),returningWarehouseDetail.getProducer()); |
| | | }else{ |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull(returningWarehouseDetail.getId()); |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull(returningWarehouseDetail.getId(),returningWarehouseDetail.getProducer()); |
| | | } |
| | | |
| | | |
| | |
| | | //获取库存编号添加到返库明细表 |
| | | List<MaterialInventory> MaterialInventoryId; |
| | | if (returningWarehouseDetail.getDateOfManufacture()!=null){ |
| | | MaterialInventoryId = materialInventoryMapper.getMaterialInventoryCountId(returningWarehouseDetail.getId(),returningWarehouseDetail.getDateOfManufacture()); |
| | | MaterialInventoryId = materialInventoryMapper.getMaterialInventoryCountId(returningWarehouseDetail.getId(),returningWarehouseDetail.getDateOfManufacture(),returningWarehouseDetail.getProducer()); |
| | | }else{ |
| | | MaterialInventoryId = materialInventoryMapper.getMaterialInventoryCountNullId(returningWarehouseDetail.getId()); |
| | | MaterialInventoryId = materialInventoryMapper.getMaterialInventoryCountNullId(returningWarehouseDetail.getId(),returningWarehouseDetail.getProducer()); |
| | | } |
| | | materialInventoryMapper.updateReturningWarehouseDetail(oddNumber, returningWarehouseDetailMaximum + 1,MaterialInventoryId.get(0).getId()); |
| | | |
| | |
| | | return map; |
| | | } |
| | | |
| | | public List<MaterialLog> exportMaterialLogReport(List<LocalDate> dates, String type) { |
| | | return materialInventoryMapper.exportMaterialLogReport(dates,type); |
| | | public List<MaterialLogDTO> exportMaterialLogReport(List<LocalDate> dates, String type) { |
| | | if(type.equals("物料出库")){ |
| | | return materialInventoryMapper.exportMaterialLogReport(dates,type); |
| | | }else if(type.equals("优化出库")){ |
| | | return materialInventoryMapper.exportMaterialLogOptimizeOutboundReport(dates,type); |
| | | }else{ |
| | | return materialInventoryMapper.exportMaterialLogReports(dates,type); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | List<MaterialOutbound> materialOutboundList=materialInventoryMapper.getSelectMaterialOutboundProjectNo(projectNo); |
| | | OptimizeUse optimizeUses=materialInventoryMapper.getSelectOptimizeUses(projectNo,width,height); |
| | | |
| | | |
| | | MaterialInventory materialInventory=materialInventoryMapper.getMaterialInventoryById(Long.valueOf(optimizeUses.getRawStockCode())); |
| | | if(materialOutboundList.size()==1){ |
| | | List<MaterialOutboundDetail> materialOutboundDetailList=materialInventoryMapper.getSelectMaterialOutboundOptimizeUses(materialOutboundList.get(0).getMaterialOutboundId(),optimizeUses.getId()); |
| | | List<MaterialOutboundDetail> materialOutboundDetailList1=materialInventoryMapper.getSelectMaterialOutboundOptimizeUses(materialOutboundList.get(0).getMaterialOutboundId(),null); |
| | | if(materialOutboundDetailList.size()==1){ |
| | | materialInventoryMapper.updateMaterialOutboundOptimizeUses(optimizeUses.getId(),quantity); |
| | | }else{ |
| | | materialInventoryMapper.insertMaterialOutboundDetailOptimizeUses(materialOutboundList.get(0).getMaterialOutboundId(), |
| | | materialOutboundDetailList1.size()+1,Long.valueOf(optimizeUses.getRawStockCode()),materialInventory.getMaterialCode(),materialInventory.getInventoryArea(), |
| | | if(optimizeUses.getNotUseCount()>0){ |
| | | MaterialInventory materialInventory=materialInventoryMapper.getMaterialInventoryById(Long.valueOf(optimizeUses.getRawStockCode())); |
| | | if(materialOutboundList.size()==1){ |
| | | List<MaterialOutboundDetail> materialOutboundDetailList=materialInventoryMapper.getSelectMaterialOutboundOptimizeUses(materialOutboundList.get(0).getMaterialOutboundId(),optimizeUses.getId()); |
| | | List<MaterialOutboundDetail> materialOutboundDetailList1=materialInventoryMapper.getSelectMaterialOutboundOptimizeUses(materialOutboundList.get(0).getMaterialOutboundId(),null); |
| | | if(materialOutboundDetailList.size()==1){ |
| | | materialInventoryMapper.updateMaterialOutboundOptimizeUses(optimizeUses.getId(),quantity); |
| | | }else{ |
| | | materialInventoryMapper.insertMaterialOutboundDetailOptimizeUses(materialOutboundList.get(0).getMaterialOutboundId(), |
| | | materialOutboundDetailList1.size()+1,Long.valueOf(optimizeUses.getRawStockCode()),materialInventory.getMaterialCode(),materialInventory.getInventoryArea(), |
| | | optimizeUses.getId(),quantity,materialInventory.getSinglePieceArea(),materialInventory.getDateOfManufacture()); |
| | | } |
| | | }else if(materialOutboundList.isEmpty()){ |
| | | String oddNumber = orderNumberSetting("出库"); |
| | | materialInventoryMapper.insertMaterialOutboundOptimizeUses(oddNumber,projectNo,reportingWorkJson.get("userName").toString()); |
| | | materialInventoryMapper.insertMaterialOutboundDetailOptimizeUses(oddNumber, 1,Long.valueOf(optimizeUses.getRawStockCode()),materialInventory.getMaterialCode(),materialInventory.getInventoryArea(), |
| | | optimizeUses.getId(),quantity,materialInventory.getSinglePieceArea(),materialInventory.getDateOfManufacture()); |
| | | }else{ |
| | | return false; |
| | | } |
| | | }else if(materialOutboundList.isEmpty()){ |
| | | String oddNumber = orderNumberSetting("出库"); |
| | | materialInventoryMapper.insertMaterialOutboundOptimizeUses(oddNumber,projectNo,reportingWorkJson.get("userName").toString()); |
| | | materialInventoryMapper.insertMaterialOutboundDetailOptimizeUses(oddNumber, 1,Long.valueOf(optimizeUses.getRawStockCode()),materialInventory.getMaterialCode(),materialInventory.getInventoryArea(), |
| | | optimizeUses.getId(),quantity,materialInventory.getSinglePieceArea(),materialInventory.getDateOfManufacture()); |
| | | materialInventoryMapper.updateMaterialInventoryAvailableInventoryOutMes(Long.valueOf(optimizeUses.getRawStockCode()),quantity); |
| | | materialInventoryMapper.updateOptimizeUsesMes(optimizeUses.getId(),quantity); |
| | | }else{ |
| | | return false; |
| | | } |
| | | materialInventoryMapper.updateMaterialInventoryAvailableInventoryOutMes(Long.valueOf(optimizeUses.getRawStockCode()),quantity); |
| | | materialInventoryMapper.updateOptimizeUsesMes(optimizeUses.getId(),quantity); |
| | | |
| | | //保存日志 |
| | | Log log = new Log(); |
| | |
| | | if (!materialLoglist.isEmpty()){ |
| | | for (MaterialLog materialLog : materialLoglist) { |
| | | |
| | | if(materialLog.getProducer()==null){ |
| | | materialLog.setProducer(""); |
| | | } |
| | | //查询物料是否存在 |
| | | List<MaterialInventory> MaterialInventoryList; |
| | | if (materialLog.getOperationOrderNumber()!=null){ |
| | | MaterialInventoryList = materialInventoryMapper.getMaterialInventoryCount(materialLog.getMaterialCode(), LocalDate.parse(materialLog.getOperationOrderNumber())); |
| | | MaterialInventoryList = materialInventoryMapper.getMaterialInventoryCount(materialLog.getMaterialCode(), LocalDate.parse(materialLog.getOperationOrderNumber()),materialLog.getProducer()); |
| | | }else{ |
| | | MaterialInventoryList = materialInventoryMapper.getMaterialInventoryCountNull(materialLog.getMaterialCode()); |
| | | MaterialInventoryList = materialInventoryMapper.getMaterialInventoryCountNull(materialLog.getMaterialCode(),materialLog.getProducer()); |
| | | } |
| | | |
| | | if(MaterialInventoryList.size()==1){ |
| | | if(MaterialInventoryList.get(0).getAvailableQuantity()>=materialLog.getQuantity()){ |
| | | if (materialLog.getOperationOrderNumber()!=null){ |
| | | materialInventoryMapper.updateMaterialInventoryOut(materialLog.getMaterialCode(),materialLog.getQuantity(),materialLog.getOperationOrderNumber()); |
| | | materialInventoryMapper.updateMaterialInventoryOut(materialLog.getMaterialCode(),materialLog.getQuantity(), |
| | | materialLog.getOperationOrderNumber(),materialLog.getProducer()); |
| | | }else{ |
| | | materialInventoryMapper.updateMaterialInventoryNullOut(materialLog.getMaterialCode(),materialLog.getQuantity()); |
| | | materialInventoryMapper.updateMaterialInventoryNullOut(materialLog.getMaterialCode(),materialLog.getQuantity(), |
| | | materialLog.getProducer()); |
| | | } |
| | | materialInventoryMapper.deleteMaterialLogById(materialLog.getId()); |
| | | }else{ |
| | |
| | | map.put("selectDate",list); |
| | | return map; |
| | | } |
| | | |
| | | public List<Map<String,Object>> mesOriginalSelect() { |
| | | return materialInventoryMapper.getSelectMaterialInventoryMes(); |
| | | } |
| | | |
| | | public String saveToExamineMaterialOutbound(Map<String,Object> object) { |
| | | String saveState = "true"; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | String materialOutboundId = ""; |
| | | String oddNumber; |
| | | if (object.get("materialOutboundId") != null) { |
| | | materialOutboundId = object.get("materialOutboundId").toString(); |
| | | } |
| | | Log log = new Log(); |
| | | log.setOperatorId(object.get("userId").toString()); |
| | | log.setOperator(object.get("userName").toString()); |
| | | log.setContent(object.toString()); |
| | | try { |
| | | MaterialOutbound materialOutbound = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), MaterialOutbound.class); |
| | | List<MaterialOutboundDetail> materialOutboundDetailList = JSONArray.parseArray(JSONObject.toJSONString(object.get("materialOutboundDetail")), MaterialOutboundDetail.class); |
| | | //查询出库单是否存在 |
| | | Integer MaterialOutboundConut = materialInventoryMapper.getMaterialOutboundCount(materialOutboundId); |
| | | if (MaterialOutboundConut != 0) { |
| | | |
| | | List<MaterialOutboundDetail> materialOutboundDetailLists = materialInventoryMapper.getIsNotMaterialOutboundDetail(materialOutboundId); |
| | | if (!materialOutboundDetailLists.isEmpty()) { |
| | | for (MaterialOutboundDetail materialOutboundDetail : materialOutboundDetailLists) { |
| | | //还原物料库存数 |
| | | materialInventoryMapper.updateMaterialInventoryAvailableInt(materialOutboundDetail.getInventoryId(), materialOutboundDetail.getOutboundQuantity()); |
| | | if(materialOutboundDetail.getUseId()!=null){ |
| | | //还原优化工程库存数 |
| | | materialInventoryMapper.updateMaterialInventoryAvailableOptInt(materialOutboundDetail.getUseId(), materialOutboundDetail.getOutboundQuantity()); |
| | | }/*else{ |
| | | //还原物料库存数 |
| | | materialInventoryMapper.updateMaterialInventoryAvailableInt(materialOutboundDetail.getId(), materialOutboundDetail.getOutboundQuantity()); |
| | | }*/ |
| | | |
| | | } |
| | | } |
| | | //删除材料出库明细的数据 |
| | | materialInventoryMapper.deleteMaterialOutboundDetail(materialOutboundId); |
| | | materialInventoryMapper.updateMaterialOutbound(materialOutbound, materialOutboundId); |
| | | materialInventoryMapper.deleteMaterialLog(materialOutboundId); |
| | | oddNumber = materialOutboundId; |
| | | log.setFunction("saveMaterialOutbound修改:"+oddNumber); |
| | | } else { |
| | | //获取单号 |
| | | oddNumber = orderNumberSetting("出库"); |
| | | //新增材料出库表数据 |
| | | materialInventoryMapper.insertMaterialOutbound(materialOutbound, oddNumber); |
| | | log.setFunction("saveMaterialOutbound新增:"+oddNumber); |
| | | } |
| | | |
| | | //获取对象集合循环进行新增修改 |
| | | |
| | | if (!materialOutboundDetailList.isEmpty()) { |
| | | for (MaterialOutboundDetail materialOutboundDetail : materialOutboundDetailList) { |
| | | MaterialInventory materialInventory = materialInventoryMapper.getMaterialInventoryById(materialOutboundDetail.getId()); |
| | | if(materialInventory.getAvailableQuantity()>=materialOutboundDetail.getOutboundQuantity()){ |
| | | Integer materialOutboundDetailMaximum = materialInventoryMapper.getMaterialOutboundDetailMaximum(oddNumber); |
| | | //新增材料出库明细数据 |
| | | materialInventoryMapper.insertMaterialOutboundDetail(materialOutboundDetail, oddNumber, materialOutboundDetailMaximum + 1); |
| | | //修改物料库存表出库数量 |
| | | materialInventoryMapper.updateMaterialInventoryAvailableOut(materialOutboundDetail.getId(), materialOutboundDetail.getOutboundQuantity()); |
| | | |
| | | String projectNo=""; |
| | | if(materialOutboundDetail.getUseId()!=null){ |
| | | projectNo = materialInventoryMapper.selectProjectNo(materialOutboundDetail.getUseId()); |
| | | //修改优化工程表出库数量 |
| | | materialInventoryMapper.updateMaterialInventoryAvailableOptOut(materialOutboundDetail.getUseId(), materialOutboundDetail.getOutboundQuantity()); |
| | | |
| | | }/*else{ |
| | | //修改物料库存表出库数量 |
| | | materialInventoryMapper.updateMaterialInventoryAvailableOut(materialOutboundDetail.getId(), materialOutboundDetail.getOutboundQuantity()); |
| | | }*/ |
| | | |
| | | if(materialOutboundDetail.getUseId()!=null){ |
| | | //修改物料库存数量 |
| | | materialInventoryMapper.updateMaterialInventoryInventoryPlanQuantityOut(materialOutboundDetail.getId(), materialOutboundDetail.getOutboundQuantity()); |
| | | }else{ |
| | | materialInventoryMapper.updateMaterialInventoryInventoryOut(materialOutboundDetail.getId(), materialOutboundDetail.getOutboundQuantity()); |
| | | } |
| | | |
| | | materialInventoryMapper.updateMaterialOutboundToExamine(oddNumber,1,object.get("userName").toString()); |
| | | String json=""; |
| | | MaterialStore materialStore=materialStoreMapper.getSelectMaterialStoreById(Long.valueOf(materialOutboundDetail.getMaterialCode())); |
| | | json=materialStore.getJson().substring(1, materialStore.getJson().length() - 1); |
| | | MaterialLog materialLog=new MaterialLog(); |
| | | materialLog.setOperationOrderNumber(oddNumber); |
| | | materialLog.setOperationNumber(materialOutboundDetailMaximum + 1); |
| | | materialLog.setOperateType("物料出库"); |
| | | materialLog.setMaterialCode(Long.valueOf(materialOutboundDetail.getMaterialCode())); |
| | | materialLog.setMaterialName(convertString(json,"\"name\"")); |
| | | materialLog.setProducer(materialInventory.getProducer()); |
| | | materialLog.setUnit(convertString(json,"\"unit\"")); |
| | | materialLog.setWidth(convertDouble(json,"\"width\"")); |
| | | materialLog.setHeight(convertDouble(json,"\"height\"")); |
| | | materialLog.setThickness(convertDouble(json,"\"thickness\"")); |
| | | materialLog.setQuantity(materialOutboundDetail.getOutboundQuantity()); |
| | | materialLog.setSinglePieceArea(materialOutboundDetail.getSinglePieceArea()); |
| | | materialLog.setInventoryId(materialOutboundDetail.getId()); |
| | | materialLog.setInventoryArea(materialInventory.getInventoryArea()); |
| | | materialLog.setRemarks(materialOutboundDetail.getRemarks()); |
| | | materialLog.setProjectNo(projectNo); |
| | | materialLog.setOperator(object.get("userName").toString()); |
| | | materialLog.setOperateTime(LocalDate.now()); |
| | | materialLogMapper.insert(materialLog); |
| | | }else{ |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | return "false1"; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | logService.saveLog(log); |
| | | |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | //将异常传入数据库 |
| | | SysError sysError = new SysError(); |
| | | sysError.setError(e+Arrays.toString(e.getStackTrace())); |
| | | sysError.setFunc("saveMaterialOutbound"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = "false"; |
| | | |
| | | } |
| | | return saveState; |
| | | |
| | | } |
| | | |
| | | |
| | | public String updateMaterialInventory(Map<String,Object> object) { |
| | | String saveState = "true"; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | | |
| | | long materialInventoryId = 0L; |
| | | if (object.get("materialInventoryId") != null) { |
| | | materialInventoryId = Long.parseLong(object.get("materialInventoryId").toString()); |
| | | } |
| | | Log log = new Log(); |
| | | log.setOperatorId(object.get("userId").toString()); |
| | | log.setOperator(object.get("userName").toString()); |
| | | log.setContent(object.toString()); |
| | | log.setFunction("updateMaterialInventory物料库存修改"); |
| | | MaterialInventory materialInventory = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), MaterialInventory.class); |
| | | |
| | | if(materialInventory.getProducer()==null){ |
| | | materialInventory.setProducer(""); |
| | | } |
| | | //查询物料是否存在 |
| | | List<MaterialInventory> MaterialInventoryCount; |
| | | if (materialInventory.getDateOfManufacture()!=null){ |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount1(materialInventory.getMaterialCode(),materialInventory.getDateOfManufacture(),materialInventory.getProducer(),materialInventory.getId()); |
| | | }else{ |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull1(materialInventory.getMaterialCode(),materialInventory.getProducer(),materialInventory.getId()); |
| | | } |
| | | |
| | | if(MaterialInventoryCount.size()==1){ |
| | | materialInventoryMapper.updateMaterialInventoryOne(MaterialInventoryCount.get(0).getId(),materialInventory); |
| | | List<Long> id=new ArrayList<>(); |
| | | id.add(materialInventoryId); |
| | | materialInventoryMapper.deleteMaterialInventory(id); |
| | | }else{ |
| | | materialInventoryMapper.updateMaterialInventoryAll(materialInventoryId,materialInventory); |
| | | } |
| | | |
| | | |
| | | |
| | | logService.saveLog(log); |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | //将异常传入数据库 |
| | | SysError sysError = new SysError(); |
| | | sysError.setError(e+Arrays.toString(e.getStackTrace())); |
| | | sysError.setFunc("saveMaterialInventory"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = "false"; |
| | | |
| | | } |
| | | return saveState; |
| | | |
| | | } |
| | | |
| | | public Object appGetStockList() { |
| | | ExecutorService executor = Executors.newFixedThreadPool(2); |
| | | AtomicReference<List<MaterialInventory>> materialInventoryList = new AtomicReference<>(new ArrayList<MaterialInventory>()); |
| | | executor.execute(() -> { |
| | | materialInventoryList.set(materialInventoryMapper.selectGetStockList()); |
| | | }); |
| | | List<Object> list = new ArrayList<>(); |
| | | executor.shutdown(); |
| | | |
| | | Map<String, Object> totalSum = new HashMap<>(); |
| | | |
| | | Integer inventoryQuantity = 0; |
| | | Integer availableQuantity = 0; |
| | | Double totalArea = 0.00; |
| | | for (MaterialInventory materialInventory : materialInventoryList.get()) { |
| | | inventoryQuantity += materialInventory.getInventoryQuantity(); |
| | | availableQuantity += materialInventory.getAvailableQuantity(); |
| | | totalArea += materialInventory.getTotalArea(); |
| | | } |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | totalSum.put("inventoryQuantity",inventoryQuantity); |
| | | totalSum.put("availableQuantity",availableQuantity); |
| | | totalSum.put("totalArea", df.format(totalArea)); |
| | | |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("glassStock", materialInventoryList); |
| | | map.put("totalSum", totalSum); |
| | | return map; |
| | | } |
| | | } |