(弃用)CAD 集成参数规范
<h1>CAD 集成参数规范</h1>
<p>> <strong>导入/检入/校验</strong> 等功能都围绕该数据包展开
> 以下是 JSON 包参数的具体说明,完整示例可跳到:<a href="#jsonDemo">完整 JSON 示例</a></p>
<h2>1.基本说明</h2>
<table>
<thead>
<tr>
<th>key</th>
<th>type</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>cadType</td>
<td>string</td>
<td>cad枚举类型(<strong>全小写</strong>),如:solidworks/creo,对应系统的文件类型</td>
</tr>
<tr>
<td>abstractCadType</td>
<td>string</td>
<td>cad抽象类型(<strong>全小写</strong>),可选值:_3d/_2d,相同类型会走相同的通用业务</td>
</tr>
<tr>
<td><a href="#cadCommand">++cadCommand++</a></td>
<td>string</td>
<td>操作命令代码,详见 <a href="#cadCommand">++cadCommand说明++</a></td>
</tr>
<tr>
<td><a href="#dataModel">++dataModel++</a></td>
<td>object</td>
<td>数据模型,主要包含 文档模型 和 物料属性 模型</td>
</tr>
</tbody>
</table>
<p>示例:</p>
<pre><code class="language-json">{
&quot;cadType&quot;: &quot;solidworks&quot;,
&quot;abstractCadType&quot;: &quot;_3d&quot;,
&quot;cadCommand&quot;: &quot;1&quot;,
&quot;dataModel&quot;: {...}
}</code></pre>
<h4><span id="cadCommand">1.1 cadCommand说明</span></h4>
<table>
<thead>
<tr>
<th>命令代码</th>
<th>命令枚举值</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>ImportDocument</td>
<td>导入文档</td>
</tr>
<tr>
<td>3</td>
<td>CheckInDocument</td>
<td>检入文档</td>
</tr>
<tr>
<td>52</td>
<td>EditBomLibarary</td>
<td>浏览bom表</td>
</tr>
<tr>
<td>53</td>
<td>Library</td>
<td>编辑新增状态的文档</td>
</tr>
<tr>
<td>54</td>
<td>ImportDocument</td>
<td>编辑已导入状态的文档</td>
</tr>
</tbody>
</table>
<h2><span id="dataModel">2.dataModel</span></h2>
<table>
<thead>
<tr>
<th>key</th>
<th>type</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="#fileModels">++fileModels++</a></td>
<td>array</td>
<td>CAD文档模型数组</td>
</tr>
<tr>
<td><a href="#propModels">++propModels++</a></td>
<td>array</td>
<td>物料属性模型数组</td>
</tr>
<tr>
<td>useRootPropId</td>
<td>string</td>
<td>当前根文档使用的物料属性模型ID</td>
</tr>
</tbody>
</table>
<p>示例:</p>
<pre><code class="language-json">{
&quot;fileModels&quot;: [...],
&quot;propModels&quot;: [...],
&quot;useRootPropId&quot;: &quot;&quot;,
}</code></pre>
<h2><span id="fileModels">3.fileModels(文档模型)</span></h2>
<p>> 图纸文档模型数组,包含 零件图、装配图、工程图
> PS:一张图纸只有一个fileModel</p>
<table>
<thead>
<tr>
<th>key</th>
<th>type</th>
<th>说明</th>
<th style="text-align: left;"></th>
</tr>
</thead>
<tbody>
<tr>
<td>cadId</td>
<td>string</td>
<td><strong>主键</strong>,图纸模型ID</td>
<td style="text-align: left;"></td>
</tr>
<tr>
<td>isRoot</td>
<td>bool</td>
<td>是否根节点</td>
<td style="text-align: left;"></td>
</tr>
<tr>
<td>directoryPath</td>
<td>string</td>
<td>图纸所在目录,导入/检入时从该目录获取图纸文件进行操作</td>
<td style="text-align: left;"></td>
</tr>
<tr>
<td>fileName</td>
<td>string</td>
<td>图纸的名称,在fileModels中<strong>唯一</strong></td>
<td style="text-align: left;"></td>
</tr>
<tr>
<td>displayName</td>
<td>string</td>
<td>显示名称,默认值为fileName</td>
<td style="text-align: left;"></td>
</tr>
<tr>
<td>fileHash</td>
<td>string</td>
<td>图纸hash值,程序中将用来判断文件是否有更改</td>
<td style="text-align: left;"></td>
</tr>
<tr>
<td>createDate</td>
<td>string</td>
<td>创建日期</td>
<td style="text-align: left;"></td>
</tr>
<tr>
<td>modifyDate</td>
<td>string</td>
<td>修改日期</td>
<td style="text-align: left;"></td>
</tr>
<tr>
<td>fileType</td>
<td>int</td>
<td>文件类型枚举,1:零件;2:装配;3:工程图;99:pdf</td>
<td style="text-align: left;"></td>
</tr>
<tr>
<td>fileLevel</td>
<td>string</td>
<td>文件级别,0:正常;1:轻化;2:压缩;3:虚文档;4:物料;5:内部保存;6:光板物料</td>
<td style="text-align: left;"></td>
</tr>
<tr>
<td>==hasBeenRecord==</td>
<td>bool</td>
<td>系统是否已有相同数据(一般从系统接口获取),如已存在则propModel与下层数据包自动从系统中获取</td>
<td style="text-align: left;"></td>
</tr>
<tr>
<td><a href="#fileModel-bizData">==bizData==</a></td>
<td>object</td>
<td>业务数据模型,存在系统中映射的对象信息,包含文档、物料、bom的信息</td>
<td style="text-align: left;"></td>
</tr>
<tr>
<td>drawingDocs</td>
<td>array</td>
<td>关联的 <strong>工程图cadId</strong> 列表</td>
<td style="text-align: left;"></td>
</tr>
<tr>
<td>pdfDocs</td>
<td>array</td>
<td>关联的 <strong>pdf 的 cadId</strong> 列表</td>
<td style="text-align: left;">pdf</td>
</tr>
<tr>
<td><a href="#fileModel-child">++child++</a></td>
<td>array</td>
<td>直接下层图纸关系对象</td>
<td style="text-align: left;"></td>
</tr>
</tbody>
</table>
<h4><span id="fileModel-child">3.1 child</span></h4>
<table>
<thead>
<tr>
<th>key</th>
<th>type</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>relationId</td>
<td>string</td>
<td>关系的<strong>唯一</strong>id</td>
</tr>
<tr>
<td>cadId</td>
<td>string</td>
<td>子图纸模型ID</td>
</tr>
<tr>
<td>fileName</td>
<td>string</td>
<td>子图纸的名称</td>
</tr>
</tbody>
</table>
<h4><span id="fileModel-bizData">3.2 bizData</span></h4>
<p>> 业务数据模型,存在系统中映射的对象信息,包含文档、物料、bom的信息</p>
<h5>3.2.1 doc</h5>
<table>
<thead>
<tr>
<th>key</th>
<th>type</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>string</td>
<td>系统中对应文档的id</td>
</tr>
<tr>
<td>isModifiable</td>
<td>bool</td>
<td>系统中对应文档是否可修改</td>
</tr>
<tr>
<td>docCategory</td>
<td>object</td>
<td>系统文档业务模型</td>
</tr>
<tr>
<td>docFolder</td>
<td>object</td>
<td>系统文档文件夹</td>
</tr>
</tbody>
</table>
<h5>3.2.2 mat</h5>
<table>
<thead>
<tr>
<th>key</th>
<th>type</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>string</td>
<td>系统中对应物料的id</td>
</tr>
<tr>
<td>isModifiable</td>
<td>bool</td>
<td>系统中对应物料是否可修改</td>
</tr>
<tr>
<td>linkMatType</td>
<td>string</td>
<td>文档物料关联类型,'drived':描述驱动关联,'index':索引关联</td>
</tr>
<tr>
<td>matCategory</td>
<td>object</td>
<td>物料业务模型</td>
</tr>
<tr>
<td>matClassify</td>
<td>object</td>
<td>物料分类</td>
</tr>
</tbody>
</table>
<h5>3.2.3 bom</h5>
<table>
<thead>
<tr>
<th>key</th>
<th>type</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>bomFolder</td>
<td>object</td>
<td>bom文件夹</td>
</tr>
</tbody>
</table>
<p>示例:</p>
<pre><code class="language-json"> {
&quot;cadId&quot;: &quot;ffda0e30-ddbd-40ec-99c3-24965dbb81f8&quot;,
&quot;isRoot&quot;: true,
&quot;directoryPath&quot;: &quot;D:\\WX&quot;,
&quot;fileName&quot;: &quot;SW01.SLDASM&quot;,
&quot;size&quot;: 53653,
&quot;fileHash&quot;: &quot;AFB940A246A36B97A93E4746A0CE3BBA0E67D136&quot;,
&quot;fileLevel&quot;: 0,
&quot;fileType&quot;: 2,
&quot;activeConfigPropId&quot;: &quot;e10962a4-d34e-432c-a529-07fe73916f27&quot;,
&quot;drawingDocs&quot;: [],
&quot;bizData&quot;:{
&quot;doc&quot;:{
&quot;id&quot;:&quot;10086&quot;,
&quot;isModifiable&quot;:true,
&quot;docCategory&quot;:{&quot;code&quot;:&quot;&quot;,&quot;name&quot;:&quot;&quot;,&quot;value&quot;:&quot;&quot;},
&quot;docFolder&quot;:{&quot;code&quot;:&quot;&quot;,&quot;name&quot;:&quot;&quot;,&quot;value&quot;:&quot;&quot;},
},
&quot;mat&quot;:{
&quot;id&quot;:&quot;12345&quot;,
&quot;isModifiable&quot;:true,
&quot;matCategory&quot;:{&quot;code&quot;:&quot;&quot;,&quot;name&quot;:&quot;&quot;,&quot;value&quot;:&quot;&quot;},
&quot;matClassify&quot;:{&quot;code&quot;:&quot;&quot;,&quot;name&quot;:&quot;&quot;,&quot;value&quot;:&quot;&quot;}
},
&quot;bom&quot;:{
&quot;bomFolder&quot;:{&quot;code&quot;:&quot;&quot;,&quot;name&quot;:&quot;&quot;,&quot;value&quot;:&quot;&quot;}
}
},
&quot;child&quot;: [
{
&quot;relationId&quot;: &quot;f3c09867-b024-4a70-b7d1-afd0b53ffd20&quot;,
&quot;fileName&quot;: &quot;零件1.SLDPRT&quot;,
&quot;cadId&quot;: &quot;3605dbb7-acee-4833-84e1-767d924b758e&quot;
}
}</code></pre>
<h2><span id="propModels">4.propModels(物料属性模型)</span></h2>
<p>> <strong>一个</strong> 图纸模型 可以对应 <strong>多个</strong> 物料属性模型(支持多配置)</p>
<table>
<thead>
<tr>
<th>key</th>
<th>type</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>propModelId</td>
<td>string</td>
<td><strong>唯一</strong>,物料属性模型 ID</td>
</tr>
<tr>
<td>cadId</td>
<td>string</td>
<td>指向 fileModels 的 cadId</td>
</tr>
<tr>
<td>propInfoType</td>
<td>string</td>
<td>属性类型名称,<strong>cadId + propInfoType 也是唯一的</strong></td>
</tr>
<tr>
<td><strong>propInfo</strong></td>
<td>object</td>
<td>具体物料属性信息</td>
</tr>
<tr>
<td>propPriority</td>
<td>string</td>
<td>属性优先级枚举,doc/mat,该属性将告诉后台当索引物料与图纸属性不一致时以谁为准</td>
</tr>
<tr>
<td><a href="#propModel-child">++child++</a></td>
<td>array</td>
<td>子项物料属性模型数组</td>
</tr>
</tbody>
</table>
<h4><span id="propModel-child">4.1 child</span></h4>
<p>> 为了减少数据包的大小,重复的子项(关系属性全部相同)在前端会进行<strong>合并</strong>处理</p>
<table>
<thead>
<tr>
<th>key</th>
<th>type</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>relationId</td>
<td>string</td>
<td>关系的<strong>唯一</strong>id,<strong>指向 fileModels 中 child 的 relationId</strong></td>
</tr>
<tr>
<td>propModelId</td>
<td>string</td>
<td>子图纸模型ID</td>
</tr>
<tr>
<td>excludeFromBom</td>
<td>bool</td>
<td>是否不在明细表中</td>
</tr>
<tr>
<td>compressState</td>
<td>string</td>
<td>压缩状态,枚举类型,正常/压缩/轻化</td>
</tr>
<tr>
<td><strong>relatedProp</strong></td>
<td>object</td>
<td>关系属性,包含了数量等</td>
</tr>
<tr>
<td>==repeatItemSeq==</td>
<td>array</td>
<td>为优化性能而进行数据包合并的项的<strong>序号</strong></td>
</tr>
</tbody>
</table>
<p>示例:</p>
<pre><code class="language-json">{
&quot;propModelId&quot;: &quot;e10962a4-d34e-432c-a529-07fe73916f27&quot;,
&quot;cadId&quot;: &quot;ffda0e30-ddbd-40ec-99c3-24965dbb81f8&quot;,
&quot;propInfoType&quot;: &quot;默认&quot;,
&quot;propInfo&quot;: {
&quot;Description&quot;: &quot;&quot;,
&quot;Weight&quot;: &quot;0.122&quot;
},
&quot;child&quot;: [{
&quot;relationId&quot;: &quot;f3c09867-b024-4a70-b7d1-afd0b53ffd20&quot;,
&quot;propModelId&quot;: &quot;7b7de974-c113-4fae-b200-118d3eebce56&quot;,
&quot;excludeFromBom&quot;: false,
&quot;compressState&quot;: &quot;Normal&quot;,
&quot;relatedProp&quot;: {
&quot;count&quot;: 1,
&quot;remark&quot;: &quot;&quot;
},
&quot;repeatItemSeq&quot;:[0,3,5]
}]
}</code></pre>
<h2><span id="jsonDemo">完整 JSON 示例</h2>
<pre><code class="language-json">{
&quot;cadType&quot;: &quot;solidworks&quot;,
&quot;abstractCadType&quot;: &quot;_3d&quot;,
&quot;uniqueKey&quot;:&quot;e10962a4-d34e-432c-a529-07fe73916abc&quot;,
&quot;isCreateMaterial&quot;:false,
&quot;cadCommand&quot;: &quot;1&quot;,
&quot;dataModel&quot;: {
&quot;fileModels&quot;: [
{
&quot;cadId&quot;: &quot;ffda0e30-ddbd-40ec-99c3-24965dbb81f8&quot;,
&quot;isRoot&quot;: true,
&quot;directoryPath&quot;: &quot;D:\\WX&quot;,
&quot;fileName&quot;: &quot;SW01.SLDASM&quot;,
&quot;fileNameEx&quot;: &quot;SW01.SLDASM.1&quot;,
&quot;size&quot;: 53653,
&quot;fileHash&quot;: &quot;AFB940A246A36B97A93E4746A0CE3BBA0E67D136&quot;,
&quot;fileLevel&quot;: 0,
&quot;fileType&quot;: 2,
&quot;activeConfigPropId&quot;: &quot;e10962a4-d34e-432c-a529-07fe73916f27&quot;,
&quot;drawingDocs&quot;: [],
&quot;hasBeenRecord&quot;: false,
&quot;bizData&quot;:{
&quot;doc&quot;:{
&quot;id&quot;:&quot;10086&quot;,
&quot;isModifiable&quot;:true,
&quot;docCategory&quot;:{&quot;code&quot;:&quot;&quot;,&quot;name&quot;:&quot;&quot;,&quot;value&quot;:&quot;&quot;},
&quot;docFolder&quot;:{&quot;code&quot;:&quot;&quot;,&quot;name&quot;:&quot;&quot;,&quot;value&quot;:&quot;&quot;}
},
&quot;mat&quot;:{
&quot;id&quot;:&quot;12345&quot;,
&quot;linkMatType&quot;:&quot;drived&quot;,
&quot;matCategory&quot;:{&quot;code&quot;:&quot;&quot;,&quot;name&quot;:&quot;&quot;,&quot;value&quot;:&quot;&quot;},
&quot;matClassify&quot;:{&quot;code&quot;:&quot;&quot;,&quot;name&quot;:&quot;&quot;,&quot;value&quot;:&quot;&quot;}
},
&quot;bom&quot;:{
&quot;bomFolder&quot;:{&quot;code&quot;:&quot;&quot;,&quot;name&quot;:&quot;&quot;,&quot;value&quot;:&quot;&quot;}
}
},
&quot;child&quot;: [{
&quot;relationId&quot;: &quot;f3c09867-b024-4a70-b7d1-afd0b53ffd20&quot;,
&quot;fileName&quot;: &quot;零件1.SLDPRT&quot;,
&quot;cadId&quot;: &quot;3605dbb7-acee-4833-84e1-767d924b758e&quot;
}]
},
{
&quot;cadId&quot;: &quot;3605dbb7-acee-4833-84e1-767d924b758e&quot;,
&quot;isRoot&quot;: false,
&quot;directoryPath&quot;: &quot;D:\\WX&quot;,
&quot;fileName&quot;: &quot;零件1.SLDPRT&quot;,
&quot;size&quot;: 53653,
&quot;fileHash&quot;: &quot;AFB940A246A36B97A93E4746A0CE3BBA0E67D136&quot;,
&quot;fileLevel&quot;: 0,
&quot;fileType&quot;: 1,
&quot;activeConfigPropId&quot;: &quot;7b7de974-c113-4fae-b200-118d3eebce56&quot;,
&quot;drawingDocs&quot;: [],
&quot;hasBeenRecord&quot;: false,
&quot;bizData&quot;: {
&quot;doc&quot;: {},
&quot;mat&quot;: {},
&quot;bom&quot;: {}
},
&quot;child&quot;: []
}
],
&quot;useRootPropId&quot;:&quot;e10962a4-d34e-432c-a529-07fe73916f27&quot;,
&quot;propModels&quot;:[{
&quot;propModelId&quot;: &quot;e10962a4-d34e-432c-a529-07fe73916f27&quot;,
&quot;cadId&quot;: &quot;ffda0e30-ddbd-40ec-99c3-24965dbb81f8&quot;,
&quot;propInfoType&quot;: &quot;默认&quot;,
&quot;propPriority&quot;:&quot;doc&quot;,
&quot;propInfo&quot;: {
&quot;Description&quot;: &quot;&quot;,
&quot;Weight&quot;: &quot;0.122&quot;
},
&quot;child&quot;: [{
&quot;relationId&quot;: &quot;f3c09867-b024-4a70-b7d1-afd0b53ffd20&quot;,
&quot;propModelId&quot;: &quot;7b7de974-c113-4fae-b200-118d3eebce56&quot;,
&quot;excludeFromBom&quot;: false,
&quot;compressState&quot;: &quot;Normal&quot;,
&quot;relatedProp&quot;: {
&quot;count&quot;: 1,
&quot;remark&quot;: &quot;&quot;
},
&quot;repeatItemSeq&quot;:[0,1,2]
}]
},
{
&quot;propModelId&quot;: &quot;7b7de974-c113-4fae-b200-118d3eebce56&quot;,
&quot;cadId&quot;: &quot;3605dbb7-acee-4833-84e1-767d924b758e&quot;,
&quot;propInfoType&quot;: &quot;默认&quot;,
&quot;propPriority&quot;:&quot;doc&quot;,
&quot;propInfo&quot;: {
&quot;Description&quot;: &quot;&quot;,
&quot;Weight&quot;: &quot;0.122&quot;
},
&quot;child&quot;: []
}
]
}
}</code></pre>