| | |
| | | //获取数据库原始数据 |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append("WITH outbound AS(") |
| | | .append(" SELECT A.project_uuid,A.project_itemize,C.material_type,B.material_code,SUM(B.outbound_weight)outbound_weight ") |
| | | .append(" SELECT A.project_uuid,D.itemize project_itemize,C.material_type,B.material_code,SUM(B.outbound_weight)outbound_weight ") |
| | | .append(" FROM product_project_outbound A ") |
| | | .append(" LEFT JOIN product_project_outbound_sub B ON A.uuid=B.outbound_uuid ") |
| | | .append(" LEFT JOIN product_project_base_material C ON B.material_uuid = C.uuid ") |
| | | .append(" WHERE project_uuid = ? ") |
| | | .append(" GROUP BY A.project_uuid,A.project_itemize,C.material_type,B.material_code ") |
| | | .append(" LEFT JOIN product_project_item D ON A.project_itemize = D.uuid ") |
| | | .append(" WHERE A.flow_flag=2 AND A.project_uuid = ? ") |
| | | .append(" GROUP BY A.project_uuid,D.itemize,C.material_type,B.material_code ") |
| | | .append(" ) ") |
| | | .append(" SELECT A.project_uuid,A.project_itemize,A.total_outbound_weight,B.material_type,B.material_code,B.outbound_weight ") |
| | | .append(" FROM ( ") |
| | |
| | | .append(" FROM outbound ") |
| | | .append(" GROUP BY project_uuid,project_itemize ") |
| | | .append(" )A ") |
| | | .append(" RIGHT JOIN outbound B ON A.project_uuid=B.project_uuid AND A.project_itemize=B.project_itemize "); |
| | | .append(" RIGHT JOIN outbound B ON A.project_uuid=B.project_uuid AND A.project_itemize=B.project_itemize ") |
| | | .append(" ORDER BY project_itemize,material_code"); |
| | | DataTableEntity dtItemizeInfo = baseDao.listTable(sb.toString(), new Object[]{project_uuid}); |
| | | if (!BaseUtil.dataTableIsEmpty(dtItemizeInfo)) { |
| | | |
| | |
| | | if (BaseUtil.strIsNull(materialTypes[materialType])) { |
| | | materialTypes[materialType] = materialCode; |
| | | } else { |
| | | materialTypes[fseItemize.getInteger(Cmnconst.MATERIAL_TYPE)] += "," + materialCode; |
| | | if(materialTypes[fseItemize.getInteger(Cmnconst.MATERIAL_TYPE)].indexOf(materialCode)<0) { |
| | | materialTypes[fseItemize.getInteger(Cmnconst.MATERIAL_TYPE)] += "," + materialCode; |
| | | } |
| | | } |
| | | |
| | | //收集行转列数据 |
| | |
| | | return dtItemizeBudget; |
| | | } |
| | | |
| | | /** |
| | | * 更具项目分项uuid获取项目分项下的材料 |
| | | * @param uuid |
| | | * @param capge |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public DataTableEntity listMaterialV(String uuid, Integer capge, Integer pageSize) { |
| | | return baseDao.listTable("product_project_base_material_v","project_itemize_uuid=?",new String[]{uuid},null,null,pageSize, capge); |
| | | } |
| | | /** |
| | | * 更具仓库和材料获取库存 |
| | | * @return |
| | | */ |
| | | public FieldSetEntity findInventoryV(String warehouse_uuid, String material_uuid) { |
| | | return baseDao.getFieldSetByFilter("product_project_inventory_v","warehouse_uuid=? and uuid=?",new String[]{warehouse_uuid,material_uuid},false); |
| | | } |
| | | /** |
| | | * 根据项目uuid获取项目分项树结构 |
| | | * @param uuid |
| | | * @return |
| | | */ |
| | | |
| | | public JSONArray getTreeProjectItem(String uuid) { |
| | | FieldSetEntity fseProject = baseDao.getFieldSetEntity(Cmnconst.PRODUCT_PROJECT_QXLW, uuid, true); |
| | | DataTableEntity newDtProjectItem = BaseUtil.dataTableToTreeTable(fseProject.getSubDataTable(Cmnconst.PRODUCT_PROJECT_ITEM), Cmnconst.ITEMIZE_CODE, Cmnconst.ITEMIZE_PARENT_CODE, null); |
| | | DataTableEntity dtProjectItemize = baseDao.listTable(Cmnconst.PRODUCT_PROJECT_ITEM, "project_uuid=?", new Object[]{uuid}, new Object[]{CoreConst.UUID, Cmnconst.ITEMIZE, Cmnconst.ITEMIZE_CODE, Cmnconst.ITEMIZE_PARENT_CODE}); |
| | | DataTableEntity newDtProjectItem = BaseUtil.dataTableToTreeTable(dtProjectItemize, Cmnconst.ITEMIZE_CODE, Cmnconst.ITEMIZE_PARENT_CODE, null); |
| | | JSONArray objects = BaseUtil.dataTableEntityToJson(newDtProjectItem); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("itemize", "项目分部分项"); |
| | | json.put("children", objects); |
| | | json.put("type", 1); |
| | | |
| | | json.set("itemize", "项目分部分项"); |
| | | json.set("children", objects); |
| | | json.set("type", 1); |
| | | JSONArray array = new JSONArray(); |
| | | array.add(json); |
| | | |
| | | return array; |
| | | } |
| | | } |