diff --git a/src/Add-on/ShareView/Entry.tsx b/src/Add-on/ShareView/Entry.tsx index 09dd92e10..a74eddbc3 100644 --- a/src/Add-on/ShareView/Entry.tsx +++ b/src/Add-on/ShareView/Entry.tsx @@ -264,6 +264,8 @@ async function LoadData() let data = JSON.parse(await res.text()); if (data.err_code === RequestStatus.Ok) { + // userConfig.uese = data.fileInfo.uese; + let file = JSON.parse(inflateBase64(data.fileInfo.file)); document.title = data.fileInfo.name; return new CADFiler(file); diff --git a/src/Add-on/ShareView/Util.ts b/src/Add-on/ShareView/Util.ts index e1407b01a..886cd408d 100644 --- a/src/Add-on/ShareView/Util.ts +++ b/src/Add-on/ShareView/Util.ts @@ -135,6 +135,8 @@ export function GetBoxItemInfo(entites: Entity[]) let boardList: Board[] = []; let hardwareCompositeList: ICompHardwareOption[] = []; let hardwareToplineList: IToplineOption[] = []; + + let hardWareGroup: { [key: string]: ICompHardwareOption; } = {}; for (const entity of entites) { if (entity instanceof Board) @@ -142,12 +144,27 @@ export function GetBoxItemInfo(entites: Entity[]) boardList.push(entity); } else if (entity instanceof HardwareCompositeEntity) { - hardwareCompositeList.push(entity.HardwareOption); + var option = Production.GetHardwareCompositeData(entity).metalsOption; + var key = [option.roomName, option.cabinetName, option.name, option.spec, option.unit].join('_'); + if (hardWareGroup[key]) + { + hardWareGroup[key].count = (Number(hardWareGroup[key].count) + Number(entity.HardwareOption.count)).toString(); + } else + { + hardWareGroup[key] = Object.assign({}, option as ICompHardwareOption); + } + // hardwareCompositeList.push(hardWareOption); } else if (entity instanceof HardwareTopline) { hardwareToplineList.push(entity.HardwareOption); } } + + for (const key in hardWareGroup) + { + hardwareCompositeList.push(hardWareGroup[key]); + } + return { boardList, hardwareCompositeList, hardwareToplineList }; } diff --git a/src/Add-on/ShareView/components/MaterialBottomSheet.tsx b/src/Add-on/ShareView/components/MaterialBottomSheet.tsx index 48dbcaf53..f94204a6e 100644 --- a/src/Add-on/ShareView/components/MaterialBottomSheet.tsx +++ b/src/Add-on/ShareView/components/MaterialBottomSheet.tsx @@ -2,7 +2,7 @@ import { Icon } from "@blueprintjs/core"; import { useObserver } from "mobx-react"; import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react"; import { Board } from "../../../DatabaseServices/Entity/Board"; -import { ICompHardwareOption, IToplineOption } from "../../../UI/Components/RightPanel/RightPanelInterface"; +import { ICompHardwareOption, IHardwareOption, IToplineOption } from "../../../UI/Components/RightPanel/RightPanelInterface"; import { shareViewApp } from "../Service"; import { BoxStore } from "../Store"; import { GetBoxItemInfo, MaterialDetailScrollTo, SPGetSpiteSize } from "../Util"; @@ -19,7 +19,7 @@ const MaterialBottomSheet: React.FC = forwardRef((props, ref) => { const [visible, setVisible] = useState(false); const [list, setList] = useState<{ - boardList: Board[], hardwareCompositeList: ICompHardwareOption[], hardwareToplineList: IToplineOption[], + boardList: Board[], hardwareCompositeList: IHardwareOption[], hardwareToplineList: IToplineOption[], cabinetName: string; }[]>([]); const startDragRef = useRef(false); @@ -244,6 +244,7 @@ const MaterialBottomSheet: React.FC = forwardRef((props, ref) => 编号 配件 + 规格 数量 单位 @@ -257,8 +258,9 @@ const MaterialBottomSheet: React.FC = forwardRef((props, ref) => > {i + 1} {item.name} - {item.count} {item.spec} + {item.count} + {item.unit} ); })}