You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2661 lines
97 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <div>
  3. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 5px;margin-top: -5px;">
  4. <el-form-item label="BU" prop="bu">
  5. <el-input v-model="modalData.buNo" disabled style="width: 100px"></el-input>
  6. </el-form-item>
  7. <el-form-item prop="partNo">
  8. <span slot="label">物料编码</span>
  9. <el-input v-model="modalData.partNo" disabled style="width: 150px"></el-input>
  10. </el-form-item>
  11. <el-form-item :label="'物料名称'" prop="partDesc">
  12. <el-input v-model="modalData.partDesc" disabled style="width: 340px"></el-input>
  13. </el-form-item>
  14. <el-form-item :label="'物料单位'">
  15. <el-input v-model="modalData.printUnitName" disabled style="width: 100px"></el-input>
  16. </el-form-item>
  17. <el-form-item :label="'制造类型'" prop="bomType">
  18. <el-select v-model="modalData.bomType" :disabled="modalDisableFlag" style="width: 130px">
  19. <el-option label="Manufacturing" value="Manufacturing"></el-option>
  20. <el-option label="Repair" value="Repair"></el-option>
  21. <el-option label="Purchase" value="Purchase"></el-option>
  22. <el-option label="Prototype" value="Prototype"></el-option>
  23. </el-select>
  24. </el-form-item>
  25. </el-form>
  26. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;">
  27. <el-form-item label="生效日期" prop="effPhaseInDate">
  28. <el-date-picker
  29. style="width: 130px"
  30. v-model="modalData.effPhaseInDate"
  31. type="date"
  32. value-format="yyyy-MM-dd"
  33. format="yyyy-MM-dd"
  34. placeholder="请选择日期">
  35. </el-date-picker>
  36. </el-form-item>
  37. <el-form-item label="失效日期">
  38. <el-date-picker
  39. :readonly="!modalDisableFlag"
  40. style="width: 130px"
  41. v-model="modalData.effPhaseOutDate"
  42. type="date"
  43. value-format="yyyy-MM-dd"
  44. format="yyyy-MM-dd"
  45. placeholder="请选择日期">
  46. </el-date-picker>
  47. </el-form-item>
  48. <el-form-item :label="'BOM版本号'" prop="engChgLevel">
  49. <el-input-number :controls="false" :step="0" v-model="modalData.engChgLevel" :disabled="modalDisableFlag" style="width: 80px"></el-input-number>
  50. </el-form-item>
  51. <el-form-item :label="'工程版本号'">
  52. <el-input v-model="modalData.engRevision" style="width: 80px"></el-input>
  53. </el-form-item>
  54. <el-form-item :label="'净重'">
  55. <el-input-number :controls="false" :step="0" v-model="modalData.netWeight" style="width: 80px"></el-input-number>
  56. </el-form-item>
  57. <el-form-item prop="processUnit">
  58. <span slot="label" @click="getBaseList(510)"><a>工序单位</a></span>
  59. <el-input v-model="modalData.processUnitName" readonly style="width: 100px"></el-input>
  60. </el-form-item>
  61. <el-form-item :label="'损耗率%'">
  62. <el-input-number :controls="false" :step="0" disabled v-model="modalData.shrinkageFactor" style="width: 78px"></el-input-number>
  63. </el-form-item>
  64. <el-form-item>
  65. <el-button v-if="modalData.flag === '1' && headerSaveFlag" :loading="saveHeaderLoading" type="primary" @click="saveBomHeader" style="margin-top: 23px;width: 100px">保存</el-button>
  66. </el-form-item>
  67. </el-form>
  68. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;">
  69. <el-form-item label="备注">
  70. <el-input type="textarea" v-model="modalData.noteText" :rows="3" resize='none' show-word-limit style="width: 885px;height: 20px"></el-input>
  71. </el-form-item>
  72. </el-form>
  73. <el-tabs v-model="detailTable" style="margin-top: 50px; width: 100%; min-height: 120px" type="border-card" class="detail-tab">
  74. <!-- BOM明细信息页签 -->
  75. <el-tab-pane label="Product Structure" name="bom_detail">
  76. <el-form label-position="top" style="margin-top: -10px">
  77. <el-form-item>
  78. <el-button type="primary" :loading="alternativeLoading" @click="updateBomDetail" style="margin-left: 7px">编辑</el-button>
  79. <el-button v-if="detailData.status === 'Tentative' || detailData.status === 'Obsolete'" type="primary" :loading="alternativeLoading" @click="updateStatusToBuildable">Build</el-button>
  80. <el-button v-if="detailData.status === 'Buildable' && (modalData.effPhaseOutDate == null || modalData.effPhaseOutDate === '')" type="primary" :loading="alternativeLoading" @click="updateStatusToObsolete">Retire</el-button>
  81. </el-form-item>
  82. </el-form>
  83. <el-form :inline="true" label-position="top" :model="detailData" :rules="rules" style="margin-left: 7px">
  84. <el-form-item :label="'替代编码'">
  85. <el-select v-model="detailData.alternativeNo" @change="alternativeChange" style="width: 165px">
  86. <el-option
  87. v-for = "(i, index) in detailDataList"
  88. :key = "index"
  89. :label = "i.alternativeNo"
  90. :value = "i.alternativeNo">
  91. </el-option>
  92. </el-select>
  93. </el-form-item>
  94. <el-form-item :label="'替代名称'">
  95. <el-input v-model="detailData.alternativeDescription" readonly style="width: 300px"></el-input>
  96. </el-form-item>
  97. <el-form-item :label="'状态'">
  98. <el-input v-model="detailData.status" readonly style="width: 150px"></el-input>
  99. </el-form-item>
  100. <el-form-item :label="'最小订单数'">
  101. <el-input class="inlineNumber numInput" v-model="detailData.minLotQty" readonly type="number" style="width: 100px"></el-input>
  102. </el-form-item>
  103. </el-form>
  104. <el-form :inline="true" label-position="top" :model="detailData" style="margin-left: 7px">
  105. <el-form-item label="备注">
  106. <el-input type="textarea" v-model="detailData.detailNoteText" :rows="3" resize='none' show-word-limit readonly style="width: 885px;height: 20px"></el-input>
  107. </el-form-item>
  108. </el-form>
  109. </el-tab-pane>
  110. </el-tabs>
  111. <el-tabs v-model="subDetailTable" style="width: 100%; min-height: 350px" type="border-card" @tab-click="queryBomComponentTable" class="sub_detail-tab">
  112. <!-- BOM子明细信息页签 -->
  113. <el-tab-pane label="Components" name="bom_sub_detail">
  114. <el-form label-position="top" style="margin-top: 7px">
  115. <el-form-item>
  116. <el-button type="primary" :loading="alternativeLoading" @click="saveComponentModal" style="margin-left: 7px">新增</el-button>
  117. <el-button type="primary" :loading="alternativeLoading" @click="batchSaveComponentModal" style="margin-left: 7px">批量新增</el-button>
  118. <el-button type="primary" :loading="alternativeLoading" @click="batchUpdateOperationModal" style="margin-left: 7px">编辑工序</el-button>
  119. <el-button type="primary" icon="el-icon-upload" @click="bomComponentUpload">导入</el-button>
  120. <el-button type="primary" :loading="alternativeLoading" @click="deleteComponentPart">删除</el-button>
  121. </el-form-item>
  122. </el-form>
  123. <div class="rq ">
  124. <el-table
  125. :data="subDetailList"
  126. height="256px"
  127. border
  128. @selection-change="componentSelectionChange"
  129. style="width:100%">
  130. <el-table-column type="selection" align="center" width="50"></el-table-column>
  131. <el-table-column
  132. v-for="(item,index) in columnSubDetailList1" :key="index"
  133. :sortable="item.columnSortable"
  134. :prop="item.columnProp"
  135. :header-align="item.headerAlign"
  136. :show-overflow-tooltip="item.showOverflowTooltip"
  137. :align="item.align"
  138. :fixed="item.fixed == ''?false:item.fixed"
  139. :min-width="item.columnWidth"
  140. :label="item.columnLabel">
  141. <template slot-scope="scope">
  142. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  143. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  144. </template>
  145. </el-table-column>
  146. <el-table-column
  147. prop=""
  148. header-align="center"
  149. align="right"
  150. min-width="80"
  151. label="单位用量">
  152. <template slot-scope="scope">
  153. <el-input-number :controls="false" :step="0" :ref="`qtyPerAssembly${scope.$index}`" v-model="scope.row.qtyPerAssembly" @keyup.enter.native="focusNextInput(scope.$index, 'qtyPerAssembly')" style="height: 11px; width: 98%"></el-input-number>
  154. </template>
  155. </el-table-column>
  156. <el-table-column
  157. prop=""
  158. header-align="center"
  159. align="right"
  160. min-width="80"
  161. label="调机量">
  162. <template slot-scope="scope">
  163. <el-input-number :controls="false" :step="0" :ref="`componentScrap${scope.$index}`" v-model="scope.row.componentScrap" @keyup.enter.native="focusNextInput(scope.$index, 'componentScrap')" style="height: 11px; width: 98%"></el-input-number>
  164. </template>
  165. </el-table-column>
  166. <el-table-column
  167. prop=""
  168. header-align="center"
  169. align="right"
  170. min-width="80"
  171. label="损耗率">
  172. <template slot-scope="scope">
  173. <el-input-number :controls="false" :step="0" :ref="`shrinkageFactor${scope.$index}`" v-model="scope.row.shrinkageFactor" @keyup.enter.native="focusNextInput(scope.$index, 'shrinkageFactor')" style="height: 11px; width: 98%"></el-input-number>
  174. </template>
  175. </el-table-column>
  176. <el-table-column
  177. v-for="(item,index) in columnSubDetailList2" :key="index"
  178. :sortable="item.columnSortable"
  179. :prop="item.columnProp"
  180. :header-align="item.headerAlign"
  181. :show-overflow-tooltip="item.showOverflowTooltip"
  182. :align="item.align"
  183. :fixed="item.fixed == ''?false:item.fixed"
  184. :min-width="item.columnWidth"
  185. :label="item.columnLabel">
  186. <template slot-scope="scope">
  187. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  188. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  189. </template>
  190. </el-table-column>
  191. <el-table-column
  192. fixed="right"
  193. header-align="center"
  194. align="center"
  195. width="100"
  196. label="操作">
  197. <template slot-scope="scope">
  198. <el-link style="cursor: pointer" @click="updateComponentModal(scope.row)">编辑</el-link>
  199. </template>
  200. </el-table-column>
  201. </el-table>
  202. </div>
  203. </el-tab-pane>
  204. </el-tabs>
  205. <el-footer style="height:15px;margin-top:15px;text-align:center">
  206. <el-button :loading="saveAllLoading" type="primary" @click="packageSaveData">应用</el-button>
  207. </el-footer>
  208. <!-- 子明细新增模态框 -->
  209. <el-dialog title="子物料" :close-on-click-modal="false" top="25vh" v-drag :visible.sync="componentSaveModal" width="800px">
  210. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  211. <el-form-item :label="'序号'" prop="lineSequence">
  212. <el-input-number :controls="false" :step="0" v-model="componentData.lineSequence" style="width: 49px"></el-input-number>
  213. </el-form-item>
  214. <el-form-item prop="componentPart">
  215. <span v-if="!componentDisableFlag" slot="label" @click="queryComponentPartModal"><a herf="#">子物料编码</a></span>
  216. <span v-if="componentDisableFlag" slot="label">子物料编码</span>
  217. <el-input v-model="componentData.componentPart" :disabled="componentDisableFlag" @blur="componentPartBlur" style="width: 130px"></el-input>
  218. </el-form-item>
  219. <el-form-item :label="'子物料名称'">
  220. <el-input v-model="componentData.componentPartDesc" disabled style="width: 249px"></el-input>
  221. </el-form-item>
  222. <el-form-item :label="'物料单位'">
  223. <el-input v-model="componentData.printUnitName" disabled style="width: 110px"></el-input>
  224. </el-form-item>
  225. <el-form-item :label="'消耗项目'" prop="consumptionItem">
  226. <el-select v-model="componentData.consumptionItem" style="width: 167px">
  227. <el-option label="Consumed" value="Consumed"></el-option>
  228. <el-option label="Not Consumed" value="Not Consumed"></el-option>
  229. </el-select>
  230. </el-form-item>
  231. </el-form>
  232. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  233. <el-form-item :label="'单位用量'" prop="qtyPerAssembly">
  234. <el-input-number :controls="false" :step="0" v-model="componentData.qtyPerAssembly" style="width: 144px"></el-input-number>
  235. </el-form-item>
  236. <el-form-item :label="'调机量'" prop="componentScrap">
  237. <el-input-number :controls="false" :step="0" v-model="componentData.componentScrap" style="width: 80px"></el-input-number>
  238. </el-form-item>
  239. <el-form-item :label="'损耗率%'" prop="shrinkageFactor">
  240. <el-input-number :controls="false" :step="0" min="0" max="100" v-model="componentData.shrinkageFactor" style="width: 80px"></el-input-number>
  241. </el-form-item>
  242. <el-form-item>
  243. <span slot="label" @click="queryOperationList"><a>工序</a></span>
  244. <el-input v-model="componentData.operationNo" readonly style="width: 110px"></el-input>
  245. </el-form-item>
  246. <el-form-item>
  247. <span style="cursor: pointer" slot="label" @click="getBaseList(215)"><a herf="#">发料库位</a></span>
  248. <el-input v-model="componentData.issueToLocName" readonly style="width: 110px"></el-input>
  249. </el-form-item>
  250. <el-form-item :label="'生产属性'" prop="issueType">
  251. <el-select v-model="componentData.issueType" style="width: 167px">
  252. <el-option label="Reserve And Backflush" value="Reserve And Backflush"></el-option>
  253. <el-option label="Reserve" value="Reserve"></el-option>
  254. <el-option label="Backflush" value="Backflush"></el-option>
  255. <el-option label="Manual" value="Manual"></el-option>
  256. </el-select>
  257. </el-form-item>
  258. </el-form>
  259. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  260. <el-form-item :label="'实际生产数量'">
  261. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.productionData" :disabled="!productionDataFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  262. </el-form-item>
  263. <el-form-item :label="'材料数量'">
  264. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialData" :disabled="!materialDataFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  265. </el-form-item>
  266. <el-form-item :label="'成品数量'">
  267. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.finishedProductData" :disabled="!finishedProductDataFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  268. </el-form-item>
  269. <el-form-item :label="'用量损耗'">
  270. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.consumptionLoss" :disabled="!consumptionLossFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  271. </el-form-item>
  272. </el-form>
  273. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  274. <el-form-item :label="'涂胶长度'">
  275. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.coatingLength" :disabled="!coatingLengthFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  276. </el-form-item>
  277. <el-form-item :label="'胶水克重'">
  278. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.glueWeight" :disabled="!glueWeightFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  279. </el-form-item>
  280. <el-form-item :label="'材料宽度'">
  281. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialWidth" :disabled="!materialWidthFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  282. </el-form-item>
  283. <el-form-item :label="'宽度换算单位'">
  284. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.widthConversion" :disabled="!widthConversionFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  285. </el-form-item>
  286. </el-form>
  287. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  288. <el-form-item :label="'材料长度1'">
  289. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialLength" :disabled="!materialLengthFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  290. </el-form-item>
  291. <el-form-item :label="'材料厚度'">
  292. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialThickness" :disabled="!materialThicknessFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  293. </el-form-item>
  294. <el-form-item :label="'面积单位换算'">
  295. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.areaConversion" :disabled="!areaConversionFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  296. </el-form-item>
  297. <el-form-item :label="'密度单位换算'">
  298. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.densityConversion" :disabled="!densityConversionFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  299. </el-form-item>
  300. </el-form>
  301. <el-form :inline="true" label-position="top" :model="componentData" :rules="componentRules" style="margin-left: 5px">
  302. <el-form-item :label="'材料克重'">
  303. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialWeight" :disabled="!materialWeightFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  304. </el-form-item>
  305. <el-form-item :label="'材料长度2'">
  306. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.materialLength2" :disabled="!materialLength2Family.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  307. </el-form-item>
  308. <el-form-item :label="'单位换算'">
  309. <el-input-number :controls="false" :step="0" min="0" v-model="componentData.unitConversion" :disabled="!unitConversionFamily.includes(componentData.familyID)" style="width: 115px"></el-input-number>
  310. </el-form-item>
  311. </el-form>
  312. <el-form :inline="true" label-position="top" :model="componentData" style="margin-left: 5px">
  313. <el-form-item label="备注">
  314. <el-input type="textarea" v-model="componentData.noteText" :rows="3" resize='none' show-word-limit style="width: 759px;height: 20px"></el-input>
  315. </el-form-item>
  316. </el-form>
  317. <el-footer style="height:35px;margin-top:65px;text-align:center">
  318. <el-button :loading="computeLoading" type="primary" @click="computeQtyPerAssembly()">计算</el-button>
  319. <el-button v-if="componentData.flag === '1'" type="primary" @click="componentDataSave(true)">应用</el-button>
  320. <el-button type="primary" @click="componentDataSave(false)">保存</el-button>
  321. <el-button type="primary" @click="componentSaveModal = false">关闭</el-button>
  322. </el-footer>
  323. </el-dialog>
  324. <!-- 子明细物料模态框 -->
  325. <el-dialog title="物料清单" top="17vh" :close-on-click-modal="false" v-drag :visible.sync="componentPartModelFlag" width="700px">
  326. <el-form :inline="true" label-position="top" :model="componentPartData">
  327. <el-form-item :label="'物料编码'">
  328. <el-input v-model="componentPartData.partNo" clearable style="width: 120px"></el-input>
  329. </el-form-item>
  330. <el-form-item :label="'物料名称'">
  331. <el-input v-model="componentPartData.partDesc" clearable style="width: 120px"></el-input>
  332. </el-form-item>
  333. <el-form-item :label="' '">
  334. <el-button type="primary" @click="queryComponentPartList">查询</el-button>
  335. </el-form-item>
  336. </el-form>
  337. <el-table
  338. :height="250"
  339. :data="componentPartList"
  340. @row-dblclick="getComponentRowData"
  341. border
  342. style="width: 100%;">
  343. <el-table-column
  344. v-for="(item,index) in componentPartColumnList" :key="index"
  345. :sortable="item.columnSortable"
  346. :prop="item.columnProp"
  347. :header-align="item.headerAlign"
  348. :show-overflow-tooltip="item.showOverflowTooltip"
  349. :align="item.align"
  350. :fixed="item.fixed==''?false:item.fixed"
  351. :min-width="item.columnWidth"
  352. :label="item.columnLabel">
  353. <template slot-scope="scope">
  354. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  355. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  356. </template>
  357. </el-table-column>
  358. </el-table>
  359. <!-- 分页插件 -->
  360. <el-pagination
  361. @size-change="sizeChangeHandle3"
  362. @current-change="currentChangeHandle3"
  363. :current-page="pageIndex3"
  364. :page-sizes="[20, 50, 100, 200, 500]"
  365. :page-size="pageSize3"
  366. :total="totalPage3"
  367. layout="total, sizes, prev, pager, next, jumper">
  368. </el-pagination>
  369. <el-footer style="height:35px;margin-top:10px;text-align:center">
  370. <el-button type="primary" @click="componentPartModelFlag = false">关闭</el-button>
  371. </el-footer>
  372. </el-dialog>
  373. <!-- 批量新增 -->
  374. <el-dialog title="新增" :close-on-click-modal="false" v-drag :visible.sync="batchComponentPartModelFlag" width="1170px">
  375. <div style="font-size: 12px">
  376. <el-form :inline="true" label-position="top" :model="batchComponentPartData">
  377. <el-form-item :label="'物料编码'">
  378. <el-input v-model="batchComponentPartData.partNo" clearable style="width: 120px"></el-input>
  379. </el-form-item>
  380. <el-form-item :label="'物料名称'">
  381. <el-input v-model="batchComponentPartData.partDesc" clearable style="width: 120px"></el-input>
  382. </el-form-item>
  383. <el-form-item :label="' '">
  384. <el-button type="primary" @click="queryBatchComponentPartList">查询</el-button>
  385. </el-form-item>
  386. <el-form-item :label="'损耗率%'" style="margin-left: 725px">
  387. <el-input-number :controls="false" :step="0" min="0" max="100" v-model="batchComponentPartData.shrinkageFactor" style="width: 80px"></el-input-number>
  388. </el-form-item>
  389. </el-form>
  390. </div>
  391. <el-container>
  392. <el-main style="width: 770px; padding: 1px">
  393. <span style="font-size: 12px" >可选物料</span>
  394. <el-table
  395. height="400px"
  396. :data="batchComponentPartList"
  397. border
  398. ref="batchSaveTable"
  399. @row-dblclick="batchAddPartDB"
  400. @selection-change="selectionSaveComponent"
  401. highlight-current-row
  402. style="width: 100%">
  403. <el-table-column
  404. type="selection"
  405. header-align="center"
  406. align="center"
  407. width="50">
  408. </el-table-column>
  409. <el-table-column
  410. v-for="(item,index) in componentPartColumnList" :key="index"
  411. :sortable="item.columnSortable"
  412. :prop="item.columnProp"
  413. :header-align="item.headerAlign"
  414. :show-overflow-tooltip="item.showOverflowTooltip"
  415. :align="item.align"
  416. :fixed="item.fixed==''?false:item.fixed"
  417. :min-width="item.columnWidth"
  418. :label="item.columnLabel">
  419. <template slot-scope="scope">
  420. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  421. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  422. </template>
  423. </el-table-column>
  424. </el-table>
  425. <!-- 分页插件 -->
  426. <el-pagination
  427. @size-change="sizeChangeHandle5"
  428. @current-change="currentChangeHandle5"
  429. :current-page="pageIndex5"
  430. :page-sizes="[20, 50, 100, 200, 500]"
  431. :page-size="pageSize5"
  432. :total="totalPage5"
  433. layout="total, sizes, prev, pager, next, jumper">
  434. </el-pagination>
  435. </el-main>
  436. <el-main style="width: 111px;padding: -1px">
  437. <div style="margin-top: 182px;margin-left: 5px">
  438. <el-button type="primary" @click="batchAddPart">添加>></el-button>
  439. </div>
  440. <div style="margin-top: 15px;margin-left: 5px">
  441. <el-button type="primary" @click="batchDeletePart">删除<<</el-button>
  442. </div>
  443. </el-main>
  444. <el-main style="width: 400px;padding: 1px">
  445. <span style="font-size: 12px" >已选物料</span>
  446. <el-table
  447. height="400px"
  448. :data="choosePartList"
  449. border
  450. ref="batchSaveTable2"
  451. @row-dblclick="batchDeletePartDB"
  452. @selection-change="selectionSaveComponent2"
  453. highlight-current-row
  454. style="width: 100%">
  455. <el-table-column
  456. type="selection"
  457. header-align="center"
  458. align="center"
  459. width="50">
  460. </el-table-column>
  461. <el-table-column
  462. prop="partNo"
  463. header-align="center"
  464. align="center"
  465. min-width="100"
  466. label="物料编码">
  467. </el-table-column>
  468. <el-table-column
  469. prop="partDesc"
  470. header-align="center"
  471. align="center"
  472. min-width="190"
  473. label="物料名称">
  474. </el-table-column>
  475. </el-table>
  476. </el-main>
  477. </el-container>
  478. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  479. <el-button type="primary" @click="batchComponentDataSave">保存</el-button>
  480. <el-button type="primary" @click="batchComponentPartModelFlag = false">关闭</el-button>
  481. </el-footer>
  482. </el-dialog>
  483. <!-- 明细新增模态框 -->
  484. <el-dialog title="替代" :close-on-click-modal="false" v-drag :visible.sync="saveDetailModalFlag" width="530px">
  485. <el-form :inline="true" label-position="top" :model="saveDetailData" :rules="detailRules" style="margin-left: 5px">
  486. <el-form-item :label="'替代编码'" prop="alternativeNo">
  487. <el-input v-model="saveDetailData.alternativeNo" :disabled="saveDetailModalDisable" style="width: 235px"></el-input>
  488. </el-form-item>
  489. <el-form-item :label="'替代名称'" prop="alternativeDescription">
  490. <el-input v-model="saveDetailData.alternativeDescription" style="width: 235px"></el-input>
  491. </el-form-item>
  492. </el-form>
  493. <el-form :inline="true" label-position="top" :model="saveDetailData" :rules="detailRules" style="margin-left: 5px">
  494. <el-form-item :label="'状态'" prop="status">
  495. <el-input v-model="saveDetailData.status" disabled style="width: 235px"></el-input>
  496. </el-form-item>
  497. <el-form-item :label="'最小订单数'" prop="minLotQty">
  498. <el-input-number :controls="false" :step="0" v-model="saveDetailData.minLotQty" style="width: 235px"></el-input-number>
  499. </el-form-item>
  500. </el-form>
  501. <el-form :inline="true" label-position="top" :model="saveDetailData" style="margin-left: 5px">
  502. <el-form-item label="备注">
  503. <el-input type="textarea" v-model="saveDetailData.detailNoteText" :rows="3" resize='none' show-word-limit style="width: 500px;height: 20px"></el-input>
  504. </el-form-item>
  505. </el-form>
  506. <el-footer style="height:35px;margin-top:65px;text-align:center">
  507. <el-button :loading="saveDetailLoading" type="primary" @click="detailDataSave">保存</el-button>
  508. <el-button type="primary" @click="saveDetailModalFlag = false">关闭</el-button>
  509. </el-footer>
  510. </el-dialog>
  511. <!-- 工序 -->
  512. <el-dialog title="工序清单" :close-on-click-modal="false" v-drag :visible.sync="operationModelFlag" width="700px">
  513. <div class="rq">
  514. <el-form :inline="true" label-position="top" :model="operationData">
  515. <el-form-item label="Routing版本号">
  516. <el-input v-model="operationData.routingRevision" clearable style="width: 120px"></el-input>
  517. </el-form-item>
  518. <el-form-item label="工艺类型">
  519. <el-select v-model="operationData.routingType" clearable style="width: 120px">
  520. <el-option label="Manufacturing" value="Manufacturing"></el-option>
  521. <el-option label="Repair" value="Repair"></el-option>
  522. <el-option label="Prototype" value="Prototype"></el-option>
  523. </el-select>
  524. </el-form-item>
  525. <el-form-item label="替代编码">
  526. <el-input v-model="operationData.alternativeNo" clearable style="width: 120px"></el-input>
  527. </el-form-item>
  528. <el-form-item label="工序编码">
  529. <el-input v-model="operationData.operationNo" clearable style="width: 120px"></el-input>
  530. </el-form-item>
  531. <el-form-item :label="' '">
  532. <el-button type="primary" @click="queryOperationList">查询</el-button>
  533. </el-form-item>
  534. </el-form>
  535. <el-table
  536. :height="300"
  537. :data="operationList"
  538. @row-dblclick="getRowOperationData"
  539. border
  540. style="width: 100%;">
  541. <el-table-column
  542. v-for="(item,index) in operationDetailList" :key="index"
  543. :sortable="item.columnSortable"
  544. :prop="item.columnProp"
  545. :header-align="item.headerAlign"
  546. :show-overflow-tooltip="item.showOverflowTooltip"
  547. :align="item.align"
  548. :fixed="item.fixed==''?false:item.fixed"
  549. :min-width="item.columnWidth"
  550. :label="item.columnLabel">
  551. <template slot-scope="scope">
  552. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  553. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  554. </template>
  555. </el-table-column>
  556. </el-table>
  557. </div>
  558. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  559. <el-button type="primary" @click="operationModelFlag=false">关闭</el-button>
  560. </el-footer>
  561. </el-dialog>
  562. <!-- 批量编辑工序 -->
  563. <el-dialog title="工序" top="35vh" :close-on-click-modal="false" v-drag :visible.sync="batchOperationModelFlag" width="350px">
  564. <el-form :inline="true" label-position="top" :model="batchOperationData" style="margin-left: 5px">
  565. <el-form-item label="工序编码">
  566. <span slot="label" @click="queryOperationList"><a>工序</a></span>
  567. <el-input v-model="batchOperationData.operationNo" style="width: 100px"></el-input>
  568. </el-form-item>
  569. <el-form-item label="工序名称">
  570. <el-input v-model="batchOperationData.operationName" disabled style="width: 200px"></el-input>
  571. </el-form-item>
  572. </el-form>
  573. <el-footer style="height:35px;margin-top:20px;text-align:center">
  574. <el-button type="primary" @click="batchOperationEdit">保存</el-button>
  575. <el-button type="primary" @click="batchOperationModelFlag = false">关闭</el-button>
  576. </el-footer>
  577. </el-dialog>
  578. <!-- 导入 -->
  579. <bom-component-upload ref="BomComponentUpload" @refreshPageTables="queryBomComponentTable" v-drag></bom-component-upload>
  580. <!-- chooseList模态框 -->
  581. <ChooseList ref="baseList" @getBaseData="getBaseData"></ChooseList>
  582. </div>
  583. </template>
  584. <script>
  585. import {
  586. getBomInformationByPartNo,
  587. saveBomHeader, // 新增bom主信息
  588. } from "@/api/part/quicklyCreateBom.js"
  589. import {
  590. bomManagementSave, // bom新增
  591. queryBomHeader, // 查询bom主信息
  592. queryBomDetail, // 查bom明细
  593. bomDetailSave, // bom明细新增
  594. bomDetailUpdate, // bom明细编辑
  595. updateAlternativeStatus, // 修改明细状态
  596. queryBomComponent, // 查询bom子明细
  597. saveBomComponent, // 新增bom子明细
  598. updateBomComponent, // 修改bom子明细
  599. deleteBomComponent, // 删除bom子明细
  600. queryOperationList, // 根据物料编码查询工序
  601. getComponentLineSequence, // 获取子料的序号
  602. queryBomComponentTable, // 刷新子物料
  603. queryPartListAll, // 查询包含Purchase(Raw)的物料
  604. batchSaveBomComponent, // 批量新增子件
  605. computeQtyPerAssemblySave, // 计算单位用量(新增)
  606. computeQtyPerAssemblyEdit, // 计算单位用量(修改)
  607. batchOperationEdit, // 批量修改工序
  608. } from "@/api/part/bomManagement.js"
  609. import ChooseList from '@/views/modules/common/Chooselist_eam'
  610. import {Decimal} from "decimal.js"
  611. import BomComponentUpload from "./bom_component_upload.vue"
  612. export default {
  613. components: {
  614. BomComponentUpload,
  615. ChooseList
  616. },
  617. name: 'bomCreate',
  618. data() {
  619. return {
  620. // 初始页签
  621. detailTable: 'bom_detail',
  622. subDetailTable: 'bom_sub_detail',
  623. pageIndex3: 1,
  624. pageSize3: 20,
  625. totalPage3: 0,
  626. pageIndex5: 1,
  627. pageSize5: 20,
  628. totalPage5: 0,
  629. batchComponentSelections: [],
  630. batchComponentSelections2: [],
  631. checkedDetail: [],
  632. detailDataList: [],
  633. subDetailList: [],
  634. componentPartList: [],
  635. batchComponentPartList: [],
  636. choosePartList: [],
  637. operationList: [],
  638. modalData: {
  639. flag: '',
  640. title: '',
  641. site: '',
  642. buNo: '',
  643. partNo: '',
  644. partDesc: '',
  645. engChgLevel: undefined,
  646. bomType: '',
  647. noteText: '',
  648. effPhaseInDate: '',
  649. effPhaseOutDate: '',
  650. engRevision: '',
  651. typeFlag: '',
  652. netWeight: '',
  653. createDate: '',
  654. createBy: '',
  655. updateDate: '',
  656. updateBy: '',
  657. printUnit: '',
  658. printUnitName: '',
  659. yieldRate: '',
  660. shrinkageFactor: '',
  661. processUnit: '',
  662. processUnitName: ''
  663. },
  664. detailData: {
  665. site: this.$store.state.user.site,
  666. partNo: '',
  667. engChgLevel: '',
  668. bomType: '',
  669. alternativeNo: '',
  670. alternativeDescription: '',
  671. minLotQty: '',
  672. defaultFlag: '',
  673. detailNoteText: '',
  674. status: '',
  675. createDate: '',
  676. createBy: '',
  677. updateDate: '',
  678. updateBy: '',
  679. },
  680. componentData: {
  681. flag: '',
  682. site: this.$store.state.user.site,
  683. partNo: '',
  684. engChgLevel: '',
  685. bomType: '',
  686. alternativeNo: '',
  687. componentPart: '',
  688. componentPartDesc: '',
  689. printUnit: '',
  690. printUnitName: '',
  691. qtyPerAssembly: '',
  692. componentScrap: '',
  693. issueType: '',
  694. shrinkageFactor: '',
  695. lineItemNo: '',
  696. operationId: '',
  697. operationNo: '',
  698. issueToLoc: '',
  699. issueToLocName: '',
  700. noteText: '',
  701. createDate: '',
  702. createBy: '',
  703. updateDate: '',
  704. updateBy: '',
  705. lineSequence: '',
  706. consumptionItem: '',
  707. productFlag: '',
  708. familyID: '',
  709. productionData: undefined,
  710. materialData: undefined,
  711. finishedProductData: undefined,
  712. consumptionLoss: undefined,
  713. coatingLength: undefined,
  714. glueWeight: undefined,
  715. materialWidth: undefined,
  716. widthConversion: undefined,
  717. materialLength: undefined,
  718. materialThickness: undefined,
  719. areaConversion: undefined,
  720. densityConversion: undefined,
  721. materialWeight: undefined,
  722. materialLength2: undefined,
  723. unitConversion: undefined
  724. },
  725. componentPartData: {
  726. site: '',
  727. buNo: '',
  728. partNo: '',
  729. partDesc: '',
  730. page: 1,
  731. limit: 10
  732. },
  733. batchComponentPartData: {
  734. site: '',
  735. buNo: '',
  736. partNo: '',
  737. partDesc: '',
  738. shrinkageFactor: '',
  739. page: 1,
  740. limit: 10
  741. },
  742. saveDetailData: {
  743. flag: '',
  744. site: this.$store.state.user.site,
  745. partNo: '',
  746. engChgLevel: '',
  747. bomType: '',
  748. alternativeNo: '',
  749. alternativeDescription: '',
  750. minLotQty: '',
  751. defaultFlag: '',
  752. detailNoteText: '',
  753. status: '',
  754. createDate: '',
  755. createBy: '',
  756. updateDate: '',
  757. updateBy: '',
  758. },
  759. operationData: {
  760. site: '',
  761. buNo: '',
  762. partNo: '',
  763. routingRevision: '',
  764. routingType: '',
  765. alternativeNo: '',
  766. operationNo: '',
  767. operationName: '',
  768. },
  769. batchOperationData: {
  770. operationId: '',
  771. operationNo: '',
  772. operationName: ''
  773. },
  774. // 必填规则
  775. rules: {
  776. partNo: [
  777. {
  778. required: true,
  779. message: ' ',
  780. trigger: ['blur','change']
  781. }
  782. ],
  783. partDesc: [
  784. {
  785. required: true,
  786. message: ' ',
  787. trigger: ['blur','change']
  788. }
  789. ],
  790. bomType: [
  791. {
  792. required: true,
  793. message: ' ',
  794. trigger: ['blur','change']
  795. }
  796. ],
  797. effPhaseInDate: [
  798. {
  799. required: true,
  800. message: ' ',
  801. trigger: ['blur','change']
  802. }
  803. ],
  804. engChgLevel: [
  805. {
  806. required: true,
  807. message: ' ',
  808. trigger: ['blur','change']
  809. }
  810. ],
  811. processUnit: [
  812. {
  813. required: true,
  814. message: ' ',
  815. trigger: ['blur','change']
  816. }
  817. ]
  818. },
  819. componentRules: {
  820. componentPart: [
  821. {
  822. required: true,
  823. message: ' ',
  824. trigger: ['blur','change']
  825. }
  826. ],
  827. lineSequence: [
  828. {
  829. required: true,
  830. message: ' ',
  831. trigger: ['blur','change']
  832. }
  833. ],
  834. qtyPerAssembly: [
  835. {
  836. required: true,
  837. message: ' ',
  838. trigger: ['blur','change']
  839. }
  840. ],
  841. componentScrap: [
  842. {
  843. required: true,
  844. message: ' ',
  845. trigger: ['blur','change']
  846. }
  847. ],
  848. shrinkageFactor: [
  849. {
  850. required: true,
  851. message: ' ',
  852. trigger: ['blur','change']
  853. }
  854. ],
  855. issueType: [
  856. {
  857. required: true,
  858. message: ' ',
  859. trigger: ['blur','change']
  860. }
  861. ],
  862. consumptionItem: [
  863. {
  864. required: true,
  865. message: ' ',
  866. trigger: ['blur','change']
  867. }
  868. ]
  869. },
  870. detailRules: {
  871. alternativeNo: [
  872. {
  873. required: true,
  874. message: ' ',
  875. trigger: ['blur','change']
  876. }
  877. ],
  878. alternativeDescription: [
  879. {
  880. required: true,
  881. message: ' ',
  882. trigger: ['blur','change']
  883. }
  884. ],
  885. minLotQty: [
  886. {
  887. required: true,
  888. message: ' ',
  889. trigger: ['blur','change']
  890. }
  891. ],
  892. status: [
  893. {
  894. required: true,
  895. message: ' ',
  896. trigger: ['blur','change']
  897. }
  898. ]
  899. },
  900. columnList: [
  901. {
  902. columnProp: 'nodeId',
  903. headerAlign: "center",
  904. align: "left",
  905. columnLabel: '节点编码',
  906. columnHidden: false,
  907. columnImage: false,
  908. columnSortable: false,
  909. sortLv: 0,
  910. status: true,
  911. fixed: '',
  912. columnWidth : 100,
  913. },
  914. {
  915. columnProp: 'nodeName',
  916. headerAlign: "center",
  917. align: "left",
  918. columnLabel: '节点名称',
  919. columnHidden: false,
  920. columnImage: false,
  921. columnSortable: false,
  922. sortLv: 0,
  923. status: true,
  924. fixed: '',
  925. columnWidth : 200,
  926. },
  927. {
  928. columnProp: 'createDate',
  929. headerAlign: "center",
  930. align: "center",
  931. columnLabel: '创建时间',
  932. columnHidden: false,
  933. columnImage: false,
  934. columnSortable: false,
  935. sortLv: 0,
  936. status: true,
  937. fixed: '',
  938. columnWidth : 150,
  939. },
  940. {
  941. columnProp: 'createBy',
  942. headerAlign: "center",
  943. align: "left",
  944. columnLabel: '创建人',
  945. columnHidden: false,
  946. columnImage: false,
  947. columnSortable: false,
  948. sortLv: 0,
  949. status: true,
  950. fixed: '',
  951. columnWidth : 100,
  952. },
  953. {
  954. columnProp: 'updateDate',
  955. headerAlign: "center",
  956. align: "center",
  957. columnLabel: '更新时间',
  958. columnHidden: false,
  959. columnImage: false,
  960. columnSortable: false,
  961. sortLv: 0,
  962. status: true,
  963. fixed: '',
  964. columnWidth : 150,
  965. },
  966. {
  967. columnProp: 'updateBy',
  968. headerAlign: "center",
  969. align: "left",
  970. columnLabel: '更新人',
  971. columnHidden: false,
  972. columnImage: false,
  973. columnSortable: false,
  974. sortLv: 0,
  975. status: true,
  976. fixed: '',
  977. columnWidth : 100,
  978. },
  979. ],
  980. partColumnList: [
  981. {
  982. columnProp: 'partNo',
  983. headerAlign: "center",
  984. align: "center",
  985. columnLabel: '物料编码',
  986. columnHidden: false,
  987. columnImage: false,
  988. columnSortable: false,
  989. sortLv: 0,
  990. status: true,
  991. fixed: '',
  992. columnWidth: 120
  993. },
  994. {
  995. columnProp: 'partDesc',
  996. headerAlign: "center",
  997. align: "center",
  998. columnLabel: '物料名称',
  999. columnHidden: false,
  1000. columnImage: false,
  1001. status: true,
  1002. fixed: '',
  1003. columnWidth: 300
  1004. },
  1005. {
  1006. columnProp: 'spec',
  1007. headerAlign: "center",
  1008. align: "center",
  1009. columnLabel: '规格型号',
  1010. columnHidden: false,
  1011. columnImage: false,
  1012. status: true,
  1013. fixed: '',
  1014. columnWidth: 300
  1015. },
  1016. {
  1017. columnProp: 'printUnitName',
  1018. headerAlign: "center",
  1019. align: "center",
  1020. columnLabel: '计量单位',
  1021. columnHidden: false,
  1022. columnImage: false,
  1023. status: true,
  1024. fixed: '',
  1025. columnWidth: 100
  1026. },
  1027. {
  1028. columnProp: 'partType2',
  1029. headerAlign: "center",
  1030. align: "center",
  1031. columnLabel: '零件类型',
  1032. columnHidden: false,
  1033. columnImage: false,
  1034. status: true,
  1035. fixed: '',
  1036. columnWidth: 100
  1037. },
  1038. {
  1039. columnProp: 'yieldRate',
  1040. headerAlign: "center",
  1041. align: "right",
  1042. columnLabel: '良品率',
  1043. columnHidden: false,
  1044. columnImage: false,
  1045. status: true,
  1046. fixed: '',
  1047. columnWidth: 100
  1048. },
  1049. ],
  1050. columnSubDetailList1: [
  1051. {
  1052. userId: this.$store.state.user.name,
  1053. functionId: 601002,
  1054. serialNumber: '601002Table2LineSequence',
  1055. tableId: '601002Table2',
  1056. tableName: 'BOM子物料表',
  1057. columnProp: 'lineSequence',
  1058. headerAlign: 'center',
  1059. align: 'center',
  1060. columnLabel: '序号',
  1061. columnHidden: false,
  1062. columnImage: false,
  1063. columnSortable: false,
  1064. sortLv: 0,
  1065. status: true,
  1066. fixed: '',
  1067. columnWidth: 50
  1068. },
  1069. {
  1070. userId: this.$store.state.user.name,
  1071. functionId: 601002,
  1072. serialNumber: '601002Table2ComponentPart',
  1073. tableId: '601002Table2',
  1074. tableName: 'BOM子物料表',
  1075. columnProp: 'componentPart',
  1076. headerAlign: 'center',
  1077. align: 'left',
  1078. columnLabel: '物料编码',
  1079. columnHidden: false,
  1080. columnImage: false,
  1081. columnSortable: false,
  1082. sortLv: 0,
  1083. status: true,
  1084. fixed: '',
  1085. columnWidth: 120
  1086. },
  1087. {
  1088. userId: this.$store.state.user.name,
  1089. functionId: 601002,
  1090. serialNumber: '601002Table2ComponentPartDesc',
  1091. tableId: '601002Table2',
  1092. tableName: 'BOM子物料表',
  1093. columnProp: 'componentPartDesc',
  1094. headerAlign: 'center',
  1095. align: 'left',
  1096. columnLabel: '物料名称',
  1097. columnHidden: false,
  1098. columnImage: false,
  1099. columnSortable: false,
  1100. sortLv: 0,
  1101. status: true,
  1102. fixed: '',
  1103. columnWidth: 300
  1104. },
  1105. {
  1106. userId: this.$store.state.user.name,
  1107. functionId: 601002,
  1108. serialNumber: '601002Table2PrintUnit',
  1109. tableId: '601002Table2',
  1110. tableName: 'BOM子物料表',
  1111. columnProp: 'printUnitName',
  1112. headerAlign: 'center',
  1113. align: 'center',
  1114. columnLabel: '物料单位',
  1115. columnHidden: false,
  1116. columnImage: false,
  1117. columnSortable: false,
  1118. sortLv: 0,
  1119. status: true,
  1120. fixed: '',
  1121. columnWidth: 60
  1122. },
  1123. ],
  1124. columnSubDetailList2: [
  1125. {
  1126. userId: this.$store.state.user.name,
  1127. functionId: 601002,
  1128. serialNumber: '601002Table2ConsumptionItem',
  1129. tableId: '601002Table2',
  1130. tableName: 'BOM子物料表',
  1131. columnProp: 'consumptionItem',
  1132. headerAlign: 'center',
  1133. align: 'center',
  1134. columnLabel: '消耗项目',
  1135. columnHidden: false,
  1136. columnImage: false,
  1137. columnSortable: false,
  1138. sortLv: 0,
  1139. status: true,
  1140. fixed: '',
  1141. columnWidth: 80
  1142. },
  1143. {
  1144. userId: this.$store.state.user.name,
  1145. functionId: 601002,
  1146. serialNumber: '601002Table2IssueType',
  1147. tableId: '601002Table2',
  1148. tableName: 'BOM子物料表',
  1149. columnProp: 'issueType',
  1150. headerAlign: 'center',
  1151. align: 'center',
  1152. columnLabel: '生产属性',
  1153. columnHidden: false,
  1154. columnImage: false,
  1155. columnSortable: false,
  1156. sortLv: 0,
  1157. status: true,
  1158. fixed: '',
  1159. columnWidth: 140
  1160. },
  1161. {
  1162. userId: this.$store.state.user.name,
  1163. functionId: 601002,
  1164. serialNumber: '601002Table2OperationNo',
  1165. tableId: '601002Table2',
  1166. tableName: 'BOM子物料表',
  1167. columnProp: 'operationNo',
  1168. headerAlign: 'center',
  1169. align: 'center',
  1170. columnLabel: '工序编码',
  1171. columnHidden: false,
  1172. columnImage: false,
  1173. columnSortable: false,
  1174. sortLv: 0,
  1175. status: true,
  1176. fixed: '',
  1177. columnWidth: 80
  1178. },
  1179. {
  1180. userId: this.$store.state.user.name,
  1181. functionId: 601002,
  1182. serialNumber: '601002Table2OperationName',
  1183. tableId: '601002Table2',
  1184. tableName: 'BOM子物料表',
  1185. columnProp: 'operationName',
  1186. headerAlign: 'center',
  1187. align: 'left',
  1188. columnLabel: '工序名称',
  1189. columnHidden: false,
  1190. columnImage: false,
  1191. columnSortable: false,
  1192. sortLv: 0,
  1193. status: true,
  1194. fixed: '',
  1195. columnWidth: 120
  1196. },
  1197. {
  1198. userId: this.$store.state.user.name,
  1199. functionId: 601002,
  1200. serialNumber: '601002Table2IssueToLoc',
  1201. tableId: '601002Table2',
  1202. tableName: 'BOM子物料表',
  1203. columnProp: 'issueToLocName',
  1204. headerAlign: 'center',
  1205. align: 'center',
  1206. columnLabel: '发料库位',
  1207. columnHidden: false,
  1208. columnImage: false,
  1209. columnSortable: false,
  1210. sortLv: 0,
  1211. status: true,
  1212. fixed: '',
  1213. columnWidth: 80
  1214. },
  1215. {
  1216. userId: this.$store.state.user.name,
  1217. functionId: 601002,
  1218. serialNumber: '601002Table2NoteText',
  1219. tableId: '601002Table2',
  1220. tableName: 'BOM子物料表',
  1221. columnProp: 'noteText',
  1222. headerAlign: 'center',
  1223. align: 'center',
  1224. columnLabel: '备注',
  1225. columnHidden: false,
  1226. columnImage: false,
  1227. columnSortable: false,
  1228. sortLv: 0,
  1229. status: true,
  1230. fixed: '',
  1231. columnWidth: 150
  1232. },
  1233. ],
  1234. componentPartColumnList: [
  1235. {
  1236. columnProp: 'partNo',
  1237. headerAlign: "center",
  1238. align: "center",
  1239. columnLabel: '物料编码',
  1240. columnHidden: false,
  1241. columnImage: false,
  1242. status: true,
  1243. fixed: '',
  1244. columnWidth: 120
  1245. },
  1246. {
  1247. columnProp: 'partDesc',
  1248. headerAlign: "center",
  1249. align: "center",
  1250. columnLabel: '物料名称',
  1251. columnHidden: false,
  1252. columnImage: false,
  1253. status: true,
  1254. fixed: '',
  1255. columnWidth: 300
  1256. },
  1257. {
  1258. columnProp: 'spec',
  1259. headerAlign: "center",
  1260. align: "center",
  1261. columnLabel: '规格型号',
  1262. columnHidden: false,
  1263. columnImage: false,
  1264. status: true,
  1265. fixed: '',
  1266. columnWidth: 300
  1267. },
  1268. {
  1269. columnProp: 'printUnitName',
  1270. headerAlign: "center",
  1271. align: "center",
  1272. columnLabel: '计量单位',
  1273. columnHidden: false,
  1274. columnImage: false,
  1275. status: true,
  1276. fixed: '',
  1277. columnWidth: 100
  1278. },
  1279. {
  1280. columnProp: 'partType2',
  1281. headerAlign: "center",
  1282. align: "center",
  1283. columnLabel: '零件类型',
  1284. columnHidden: false,
  1285. columnImage: false,
  1286. status: true,
  1287. fixed: '',
  1288. columnWidth: 100
  1289. }
  1290. ],
  1291. operationDetailList: [
  1292. {
  1293. columnProp: 'routingRevision',
  1294. headerAlign: "center",
  1295. align: "center",
  1296. columnLabel: 'Routing版本号',
  1297. columnHidden: false,
  1298. columnImage: false,
  1299. status: true,
  1300. fixed: '',
  1301. columnWidth: 100
  1302. },
  1303. {
  1304. columnProp: 'routingType',
  1305. headerAlign: "center",
  1306. align: "center",
  1307. columnLabel: '工艺类型',
  1308. columnHidden: false,
  1309. columnImage: false,
  1310. status: true,
  1311. fixed: '',
  1312. columnWidth: 100
  1313. },
  1314. {
  1315. columnProp: 'alternativeNo',
  1316. headerAlign: "center",
  1317. align: "center",
  1318. columnLabel: '替代编码',
  1319. columnHidden: false,
  1320. columnImage: false,
  1321. status: true,
  1322. fixed: '',
  1323. columnWidth: 80
  1324. },
  1325. {
  1326. columnProp: 'alternativeDescription',
  1327. headerAlign: "center",
  1328. align: "center",
  1329. columnLabel: '替代名称',
  1330. columnHidden: false,
  1331. columnImage: false,
  1332. status: true,
  1333. fixed: '',
  1334. columnWidth: 100
  1335. },
  1336. {
  1337. columnProp: 'status',
  1338. headerAlign: "center",
  1339. align: "center",
  1340. columnLabel: '替代状态',
  1341. columnHidden: false,
  1342. columnImage: false,
  1343. status: true,
  1344. fixed: '',
  1345. columnWidth: 80
  1346. },
  1347. {
  1348. columnProp: 'operationNo',
  1349. headerAlign: "center",
  1350. align: "center",
  1351. columnLabel: '工序编码',
  1352. columnHidden: false,
  1353. columnImage: false,
  1354. status: true,
  1355. fixed: '',
  1356. columnWidth: 80
  1357. },
  1358. {
  1359. columnProp: 'operationName',
  1360. headerAlign: "center",
  1361. align: "center",
  1362. columnLabel: '工序名称',
  1363. columnHidden: false,
  1364. columnImage: false,
  1365. status: true,
  1366. fixed: '',
  1367. columnWidth: 100
  1368. }
  1369. ],
  1370. // loading
  1371. saveHeaderLoading: false,
  1372. alternativeLoading: false,
  1373. saveAllLoading: false,
  1374. saveDetailLoading: false,
  1375. computeLoading: false,
  1376. // 控制
  1377. modalFlag: false,
  1378. modalDisableFlag: false,
  1379. authSearch: false,
  1380. authSave: false,
  1381. authUpdate: false,
  1382. authDelete: false,
  1383. headerSaveFlag: false,
  1384. componentDisableFlag: false,
  1385. componentSaveModal: false,
  1386. componentPartModelFlag: false,
  1387. batchComponentPartModelFlag: false,
  1388. saveDetailModalFlag :false,
  1389. saveDetailModalDisable: false,
  1390. operationModelFlag: false,
  1391. batchOperationModelFlag: false,
  1392. // ======== 子物料字段分类集合 ========
  1393. productionDataFamily: ['RFID003', 'RFID004', 'RFID005', 'RFID006', 'RFID007', 'RFID008', 'RFID009', 'RFID012', 'RFID023', 'RFID024', 'RFID025', 'RFID026', 'RFID027'],
  1394. materialDataFamily: ['RFID011', 'RFID020', 'RFID021', 'RFID022'],
  1395. finishedProductDataFamily: ['RFID020', 'RFID021', 'RFID022'],
  1396. consumptionLossFamily: ['RFID001', 'RFID002', 'RFID011', 'RFID014', 'RFID015', 'RFID016', 'RFID017', 'RFID018', 'RFID019'],
  1397. coatingLengthFamily: ['RFID013'],
  1398. glueWeightFamily: ['RFID013'],
  1399. materialWidthFamily: ['RFID014', 'RFID015'],
  1400. widthConversionFamily: ['RFID014', 'RFID015'],
  1401. materialLengthFamily: ['RFID016', 'RFID017'],
  1402. materialThicknessFamily: ['RFID016', 'RFID017', 'RFID018', 'RFID019'],
  1403. areaConversionFamily: ['RFID016', 'RFID017', 'RFID018', 'RFID019'],
  1404. densityConversionFamily: ['RFID016', 'RFID017', 'RFID018', 'RFID019'],
  1405. materialWeightFamily: ['RFID018', 'RFID019'],
  1406. materialLength2Family: ['RFID018', 'RFID019'],
  1407. unitConversionFamily: ['RFID018', 'RFID019'],
  1408. }
  1409. },
  1410. methods: {
  1411. // 初始化组件的参数
  1412. init (tempData) {
  1413. getBomInformationByPartNo(tempData).then(({data}) => {
  1414. if (data && data.code === 0) {
  1415. if (data.rows.partNo != null && data.rows.partNo.length > 0) {
  1416. this.updateModal(data.rows)
  1417. } else {
  1418. this.addModal(tempData)
  1419. }
  1420. if (tempData.offFlag === '1') {
  1421. this.$emit('refreshNode', tempData.partNo)
  1422. }
  1423. } else {
  1424. this.$alert(data.msg, '提示', {
  1425. confirmButtonText: '确定'
  1426. })
  1427. }
  1428. })
  1429. },
  1430. // 初始化组件的参数
  1431. init2 () {
  1432. this.modalData = {}
  1433. this.detailDataList = []
  1434. this.subDetailList = []
  1435. this.detailData = {}
  1436. },
  1437. // 每页数
  1438. sizeChangeHandle3 (val) {
  1439. this.pageSize3 = val
  1440. this.pageIndex3 = 1
  1441. this.queryComponentPartModal()
  1442. },
  1443. // 当前页
  1444. currentChangeHandle3 (val) {
  1445. this.pageIndex3 = val
  1446. this.queryComponentPartModal()
  1447. },
  1448. // 每页数
  1449. sizeChangeHandle5 (val) {
  1450. this.pageSize5 = val
  1451. this.pageIndex5 = 1
  1452. this.queryBatchComponentPartList()
  1453. },
  1454. // 当前页
  1455. currentChangeHandle5 (val) {
  1456. this.pageIndex5 = val
  1457. this.queryBatchComponentPartList()
  1458. },
  1459. // bom新增模态框
  1460. addModal (row) {
  1461. this.modalData = {
  1462. flag: '1',
  1463. title: 'bom新增',
  1464. site: row.site,
  1465. buNo: row.buNo,
  1466. partNo: row.partNo,
  1467. partDesc: row.partDesc,
  1468. engChgLevel: 1,
  1469. bomType: row.bomType,
  1470. noteText: '',
  1471. effPhaseInDate: new Date(+ new Date() + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, ''),
  1472. effPhaseOutDate: '',
  1473. engRevision: '',
  1474. typeFlag: 'B',
  1475. netWeight: '',
  1476. createBy: this.$store.state.user.name,
  1477. printUnit: row.printUnit,
  1478. printUnitName: row.printUnitName,
  1479. yieldRate: '',
  1480. shrinkageFactor: row.shrinkageFactor,
  1481. processUnit: row.printUnit,
  1482. processUnitName: row.printUnitName
  1483. }
  1484. this.detailData = {
  1485. site: row.site,
  1486. buNo: row.buNo,
  1487. partNo: '',
  1488. engChgLevel: '',
  1489. bomType: '',
  1490. alternativeNo: '',
  1491. alternativeDescription: '',
  1492. minLotQty: '',
  1493. defaultFlag: '',
  1494. detailNoteText: '',
  1495. status: '',
  1496. createDate: '',
  1497. createBy: this.$store.state.user.name,
  1498. updateDate: '',
  1499. updateBy: this.$store.state.user.name,
  1500. }
  1501. this.detailDataList = []
  1502. this.subDetailList = []
  1503. this.headerSaveFlag = true
  1504. this.modalDisableFlag = false
  1505. this.$emit('refreshBomLoading')
  1506. },
  1507. // bom编辑模态框
  1508. async updateModal (row) {
  1509. this.modalData = {
  1510. flag: '2',
  1511. site: row.site,
  1512. buNo: row.buNo,
  1513. partNo: row.partNo,
  1514. partDesc: row.partDesc,
  1515. engChgLevel: row.engChgLevel,
  1516. bomType: row.bomType,
  1517. noteText: row.noteText,
  1518. effPhaseInDate: row.effPhaseInDate,
  1519. effPhaseOutDate: row.effPhaseOutDate,
  1520. engRevision: row.engRevision,
  1521. typeFlag: row.typeFlag,
  1522. netWeight: row.netWeight,
  1523. updateBy: this.$store.state.user.name,
  1524. printUnit: row.printUnit,
  1525. printUnitName: row.printUnitName,
  1526. alternativeNo: row.alternativeNo,
  1527. yieldRate: row.yieldRate,
  1528. shrinkageFactor: new Decimal(100).sub(new Decimal(row.yieldRate)).toNumber(),
  1529. processUnit: row.processUnit,
  1530. processUnitName: row.processUnitName
  1531. }
  1532. this.subDetailTable = 'bom_sub_detail'
  1533. // 查bom明细
  1534. queryBomDetail(this.modalData).then(({data}) => {
  1535. if (data && data.code === 0) {
  1536. this.detailDataList = data.rows.detailList
  1537. this.subDetailList = data.rows.componentList
  1538. this.detailData = data.rows.detailData
  1539. this.modalDisableFlag = true
  1540. } else {
  1541. this.$alert(data.msg, '错误', {
  1542. confirmButtonText: '确定'
  1543. })
  1544. }
  1545. this.$emit('refreshBomLoading')
  1546. }).catch(() => {
  1547. this.$emit('refreshBomLoading')
  1548. })
  1549. },
  1550. // 保存主表信息
  1551. saveBomHeader () {
  1552. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  1553. this.$message.warning('请先选择Bom物料!')
  1554. return
  1555. }
  1556. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  1557. this.$message.warning('请先填写Bom版本号!')
  1558. return
  1559. }
  1560. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  1561. this.$message.warning('请先选择制造类型!')
  1562. return
  1563. }
  1564. if (this.modalData.processUnit === '' || this.modalData.processUnit == null) {
  1565. this.$message.warning('请先选择工序单位!')
  1566. return
  1567. }
  1568. this.saveHeaderLoading = true
  1569. // 新增主表信息
  1570. saveBomHeader(this.modalData).then(({data}) => {
  1571. if (data && data.code === 0) {
  1572. this.modalData = {
  1573. flag: '1',
  1574. title: 'bom新增',
  1575. bu: data.rows.modalData.site + '_' + data.rows.modalData.buNo,
  1576. site: data.rows.modalData.site,
  1577. buNo: data.rows.modalData.buNo,
  1578. partNo: data.rows.modalData.partNo,
  1579. partDesc: data.rows.modalData.partDesc,
  1580. engChgLevel: data.rows.modalData.engChgLevel,
  1581. bomType: data.rows.modalData.bomType,
  1582. noteText: data.rows.modalData.noteText,
  1583. effPhaseInDate: data.rows.modalData.effPhaseInDate,
  1584. effPhaseOutDate: data.rows.modalData.effPhaseOutDate,
  1585. engRevision: data.rows.modalData.engRevision,
  1586. typeFlag: data.rows.modalData.typeFlag,
  1587. netWeight: data.rows.modalData.netWeight,
  1588. yieldRate: data.rows.modalData.yieldRate,
  1589. printUnit: data.rows.modalData.printUnit,
  1590. printUnitName: data.rows.modalData.printUnitName,
  1591. shrinkageFactor: new Decimal(100).sub(new Decimal(data.rows.modalData.yieldRate)).toNumber(),
  1592. processUnit: data.rows.modalData.processUnit,
  1593. processUnitName: data.rows.modalData.processUnitName
  1594. }
  1595. this.detailDataList = data.rows.detailDataList
  1596. this.detailData = data.rows.detailData
  1597. this.subDetailList = []
  1598. this.modalDisableFlag = true
  1599. this.headerSaveFlag = false
  1600. this.$message({
  1601. message: '操作成功',
  1602. type: 'success',
  1603. duration: 1500,
  1604. onClose: () => {}
  1605. })
  1606. } else {
  1607. this.$alert(data.msg, '错误', {
  1608. confirmButtonText: '确定'
  1609. })
  1610. }
  1611. this.saveHeaderLoading = false
  1612. })
  1613. },
  1614. // 替代编辑模态框
  1615. updateBomDetail () {
  1616. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  1617. this.$message.warning('请先选择Bom物料!')
  1618. return
  1619. }
  1620. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  1621. this.$message.warning('请先填写Bom版本号!')
  1622. return
  1623. }
  1624. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  1625. this.$message.warning('请先选择制造类型!')
  1626. return
  1627. }
  1628. this.saveDetailData = {
  1629. flag: '2',
  1630. site: this.detailData.site,
  1631. buNo: this.detailData.buNo,
  1632. partNo: this.detailData.partNo,
  1633. engChgLevel: this.detailData.engChgLevel,
  1634. bomType: this.detailData.bomType,
  1635. alternativeNo: this.detailData.alternativeNo,
  1636. alternativeDescription: this.detailData.alternativeDescription,
  1637. minLotQty: this.detailData.minLotQty,
  1638. defaultFlag: '',
  1639. detailNoteText: this.detailData.detailNoteText,
  1640. status: this.detailData.status,
  1641. updateBy: this.$store.state.user.name,
  1642. }
  1643. // 查询bom主信息
  1644. queryBomHeader(this.modalData).then(({data}) => {
  1645. if (data && data.code === 0) {
  1646. if (data.rows.length > 0) {
  1647. this.saveDetailModalFlag = true
  1648. this.saveDetailModalDisable = true
  1649. } else {
  1650. this.$message.warning('请先保存BOM主记录!')
  1651. }
  1652. } else {
  1653. this.$alert(data.msg, '提示', {
  1654. confirmButtonText: '确定'
  1655. })
  1656. }
  1657. })
  1658. },
  1659. // 替代改变事件
  1660. alternativeChange () {
  1661. this.alternativeLoading = true
  1662. queryBomComponent(this.detailData).then(({data}) => {
  1663. if (data && data.code === 0) {
  1664. this.detailDataList = data.rows.detailDataList
  1665. this.detailData = data.rows.detailData
  1666. this.subDetailList = data.rows.subDetailList
  1667. } else {
  1668. this.$alert(data.msg, '错误', {
  1669. confirmButtonText: '确定'
  1670. })
  1671. }
  1672. this.alternativeLoading = false
  1673. }).catch(()=>{
  1674. this.alternativeLoading = false
  1675. })
  1676. },
  1677. // 修改替代状态为 Buildable
  1678. updateStatusToBuildable () {
  1679. this.$confirm(`是否修改状态为Buildable?`, '提示', {
  1680. confirmButtonText: '确定',
  1681. cancelButtonText: '取消',
  1682. type: 'warning'
  1683. }).then(() => {
  1684. updateAlternativeStatus(this.detailData).then(({data}) => {
  1685. if (data && data.code === 0) {
  1686. this.detailDataList = data.rows.detailDataList
  1687. this.detailData = data.rows.detailData
  1688. this.subDetailList = data.rows.subDetailList
  1689. this.$message({
  1690. message: '操作成功',
  1691. type: 'success',
  1692. duration: 1500,
  1693. onClose: () => {}
  1694. })
  1695. } else {
  1696. this.$alert(data.msg, '错误', {confirmButtonText: '确定'})
  1697. // 刷新替代和子明细
  1698. this.alternativeChange()
  1699. }
  1700. })
  1701. })
  1702. },
  1703. // 修改替代状态为 Obsolete
  1704. updateStatusToObsolete () {
  1705. this.$confirm(`是否修改状态为Obsolete?`, '提示', {
  1706. confirmButtonText: '确定',
  1707. cancelButtonText: '取消',
  1708. type: 'warning'
  1709. }).then(() => {
  1710. updateAlternativeStatus(this.detailData).then(({data}) => {
  1711. if (data && data.code === 0) {
  1712. this.detailDataList = data.rows.detailDataList
  1713. this.detailData = data.rows.detailData
  1714. this.subDetailList = data.rows.subDetailList
  1715. this.$message({
  1716. message: '操作成功',
  1717. type: 'success',
  1718. duration: 1500,
  1719. onClose: () => {}
  1720. })
  1721. } else {
  1722. this.$alert(data.msg, '错误', {confirmButtonText: '确定'})
  1723. // 刷新替代和子明细
  1724. this.alternativeChange()
  1725. }
  1726. })
  1727. })
  1728. },
  1729. // 刷新方法
  1730. queryBomComponentTable () {
  1731. queryBomComponentTable(this.detailData).then(({data}) => {
  1732. if (data.code === 0) {
  1733. this.subDetailList = data.rows
  1734. }
  1735. })
  1736. },
  1737. // 子明细新增模态框
  1738. saveComponentModal () {
  1739. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  1740. this.$message.warning('请先选择替代!')
  1741. return
  1742. }
  1743. this.componentData = {
  1744. flag: '1',
  1745. site: this.modalData.site,
  1746. buNo: this.modalData.buNo,
  1747. partNo: this.modalData.partNo,
  1748. engChgLevel: this.modalData.engChgLevel,
  1749. bomType: this.modalData.bomType,
  1750. alternativeNo: this.detailData.alternativeNo,
  1751. componentPart: '',
  1752. componentPartDesc: '',
  1753. printUnit: '',
  1754. printUnitName: '',
  1755. qtyPerAssembly: 0,
  1756. componentScrap: 0,
  1757. issueType: 'Reserve And Backflush',
  1758. shrinkageFactor: this.modalData.shrinkageFactor,
  1759. lineItemNo: '',
  1760. operationId: '',
  1761. operationNo: '',
  1762. issueToLoc: '',
  1763. issueToLocName: '',
  1764. noteText: '',
  1765. createBy: this.$store.state.user.name,
  1766. lineSequence: '',
  1767. consumptionItem: 'Consumed',
  1768. productFlag: 'component',
  1769. familyID: '',
  1770. productionData: undefined,
  1771. materialData: undefined,
  1772. finishedProductData: undefined,
  1773. consumptionLoss: undefined,
  1774. coatingLength: undefined,
  1775. glueWeight: undefined,
  1776. materialWidth: undefined,
  1777. widthConversion: undefined,
  1778. materialLength: undefined,
  1779. materialThickness: undefined,
  1780. areaConversion: undefined,
  1781. densityConversion: undefined,
  1782. materialWeight: undefined,
  1783. materialLength2: undefined,
  1784. unitConversion: undefined
  1785. }
  1786. // 获取子料的序号
  1787. getComponentLineSequence(this.componentData).then(({data}) => {
  1788. if (data && data.code === 0) {
  1789. this.componentData.lineSequence = data.lineSequence
  1790. } else {
  1791. this.$alert(data.msg, '错误', {
  1792. confirmButtonText: '确定'
  1793. })
  1794. }
  1795. })
  1796. this.componentDisableFlag = false
  1797. this.componentSaveModal = true
  1798. },
  1799. // 批量新增子物料模态框
  1800. batchSaveComponentModal () {
  1801. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  1802. this.$message.warning('请先选择替代!')
  1803. return
  1804. }
  1805. this.pageSize5 = 20
  1806. this.pageIndex5 = 1
  1807. this.batchComponentPartData.partNo = ''
  1808. this.batchComponentPartData.partDesc = ''
  1809. this.batchComponentPartData.limit = this.pageSize5
  1810. this.batchComponentPartData.page = this.pageIndex5
  1811. this.batchComponentPartData.site = this.modalData.site
  1812. this.batchComponentPartData.buNo = this.modalData.buNo
  1813. // 查询所有物料
  1814. queryPartListAll(this.batchComponentPartData).then(({data}) => {
  1815. if (data && data.code === 0) {
  1816. this.batchComponentPartList = data.page.list
  1817. this.pageIndex5 = data.page.currPage
  1818. this.pageSize5 = data.page.pageSize
  1819. this.totalPage5 = data.page.totalCount
  1820. this.batchComponentPartModelFlag = true
  1821. } else {
  1822. this.batchComponentPartList = []
  1823. }
  1824. })
  1825. this.batchComponentPartData.shrinkageFactor = this.modalData.shrinkageFactor
  1826. this.choosePartList = []
  1827. },
  1828. // 子物料批量导入
  1829. bomComponentUpload () {
  1830. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  1831. this.$message.warning('请先选择替代!')
  1832. return
  1833. }
  1834. let currentData = {
  1835. site: this.detailData.site,
  1836. buNo: this.detailData.buNo,
  1837. partNo: this.detailData.partNo,
  1838. engChgLevel: this.detailData.engChgLevel,
  1839. bomType: this.detailData.bomType,
  1840. alternativeNo: this.detailData.alternativeNo,
  1841. createBy: this.$store.state.user.name,
  1842. shrinkageFactor: this.modalData.shrinkageFactor
  1843. }
  1844. //打开组件 去做新增业务
  1845. this.$nextTick(() => {
  1846. this.$refs.BomComponentUpload.init(currentData)
  1847. })
  1848. },
  1849. // 删除子物料
  1850. deleteComponentPart () {
  1851. if (this.checkedDetail.length === 0) {
  1852. this.$message.warning('请选择要删除子物料!')
  1853. return
  1854. } else {
  1855. this.$confirm("请是否确认删除该子明细记录?", "提示", {
  1856. confirmButtonText: "确定",
  1857. cancelButtonText: "取消",
  1858. type: "warning"
  1859. }).then(() => {
  1860. let tempData = {
  1861. informationList: this.checkedDetail,
  1862. productFlag: 'component'
  1863. }
  1864. deleteBomComponent(tempData).then(({data}) => {
  1865. if (data && data.code === 0) {
  1866. this.subDetailList = data.rows.subDetailList
  1867. this.$message({
  1868. message: '操作成功',
  1869. type: 'success',
  1870. duration: 1500,
  1871. onClose: () => {}
  1872. })
  1873. } else {
  1874. this.$alert(data.msg, '错误', {
  1875. confirmButtonText: '确定'
  1876. })
  1877. }
  1878. })
  1879. })
  1880. }
  1881. },
  1882. // 选中数据
  1883. componentSelectionChange(selection) {
  1884. this.checkedDetail = selection
  1885. },
  1886. // 子明细编辑模态框
  1887. updateComponentModal (row) {
  1888. this.componentData = {
  1889. flag: '2',
  1890. site: row.site,
  1891. buNo: row.buNo,
  1892. partNo: row.partNo,
  1893. engChgLevel: row.engChgLevel,
  1894. bomType: row.bomType,
  1895. alternativeNo: row.alternativeNo,
  1896. componentPart: row.componentPart,
  1897. componentPartDesc: row.componentPartDesc,
  1898. printUnit: row.printUnit,
  1899. printUnitName: row.printUnitName,
  1900. qtyPerAssembly: row.qtyPerAssembly,
  1901. componentScrap: row.componentScrap,
  1902. issueType: row.issueType,
  1903. shrinkageFactor: row.shrinkageFactor,
  1904. lineItemNo: row.lineItemNo,
  1905. operationId: row.operationId,
  1906. operationNo: row.operationNo,
  1907. issueToLoc: row.issueToLoc,
  1908. issueToLocName: row.issueToLocName,
  1909. noteText: row.noteText,
  1910. updateBy: this.$store.state.user.name,
  1911. lineSequence: row.lineSequence,
  1912. consumptionItem: row.consumptionItem,
  1913. productFlag: 'component',
  1914. familyID: row.familyID,
  1915. productionData: row.productionData == null ? undefined : row.productionData,
  1916. materialData: row.materialData == null ? undefined : row.materialData,
  1917. finishedProductData: row.finishedProductData == null ? undefined : row.finishedProductData,
  1918. consumptionLoss: row.consumptionLoss == null ? undefined : row.consumptionLoss,
  1919. coatingLength: row.coatingLength == null ? undefined : row.coatingLength,
  1920. glueWeight: row.glueWeight == null ? undefined : row.glueWeight,
  1921. materialWidth: row.materialWidth == null ? undefined : row.materialWidth,
  1922. widthConversion: row.widthConversion == null ? undefined : row.widthConversion,
  1923. materialLength: row.materialLength == null ? undefined : row.materialLength,
  1924. materialThickness: row.materialThickness == null ? undefined : row.materialThickness,
  1925. areaConversion: row.areaConversion == null ? undefined : row.areaConversion,
  1926. densityConversion: row.densityConversion == null ? undefined : row.densityConversion,
  1927. materialWeight: row.materialWeight == null ? undefined : row.materialWeight,
  1928. materialLength2: row.materialLength2 == null ? undefined : row.materialLength2,
  1929. unitConversion: row.unitConversion == null ? undefined : row.unitConversion,
  1930. }
  1931. this.componentDisableFlag = true
  1932. this.componentSaveModal = true
  1933. },
  1934. // 判断子物料工序是否选择
  1935. packageSaveData () {
  1936. const allAHasValue = this.subDetailList.every(item => item.operationId !== null && item.operationId !== '')
  1937. if (!allAHasValue) {
  1938. this.$confirm(`存在未选择工序的子物料,是否确认保存数据?`, '提示', {
  1939. confirmButtonText: '确定',
  1940. cancelButtonText: '取消',
  1941. type: 'warning'
  1942. }).then(() => {
  1943. this.saveData()
  1944. })
  1945. } else {
  1946. this.saveData()
  1947. }
  1948. },
  1949. // bom新增/编辑
  1950. saveData () {
  1951. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  1952. this.$message.warning('请选择物料编码!')
  1953. return
  1954. }
  1955. if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
  1956. this.$message.warning('请选择物料名称!')
  1957. return
  1958. }
  1959. if (this.modalData.bomType === '' || this.modalData.bomType == null) {
  1960. this.$message.warning('请选择制造类型!')
  1961. return
  1962. }
  1963. if (this.modalData.effPhaseInDate === '' || this.modalData.effPhaseInDate == null) {
  1964. this.$message.warning('请选择生效日期!')
  1965. return
  1966. }
  1967. if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) {
  1968. this.$message.warning('请填写BOM版本号!')
  1969. return
  1970. }
  1971. if (this.modalData.processUnit === '' || this.modalData.processUnit == null) {
  1972. this.$message.warning('请选择工序单位!')
  1973. return
  1974. }
  1975. if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) {
  1976. this.$message.warning('请选择替代!')
  1977. return
  1978. }
  1979. if (this.detailData.status === '' || this.detailData.status == null) {
  1980. this.$message.warning('请选择替代状态!')
  1981. return
  1982. }
  1983. let tempData = {
  1984. site: this.modalData.site,
  1985. buNo: this.modalData.buNo,
  1986. partNo: this.modalData.partNo,
  1987. partDesc: this.modalData.partDesc,
  1988. engChgLevel: this.modalData.engChgLevel,
  1989. bomType: this.modalData.bomType,
  1990. noteText: this.modalData.noteText,
  1991. effPhaseInDate: this.modalData.effPhaseInDate,
  1992. effPhaseOutDate: this.modalData.effPhaseOutDate,
  1993. engRevision: this.modalData.engRevision,
  1994. typeFlag: this.modalData.typeFlag,
  1995. netWeight: this.modalData.netWeight,
  1996. alternativeNo: this.detailData.alternativeNo,
  1997. alternativeDescription: this.detailData.alternativeDescription,
  1998. minLotQty: this.detailData.minLotQty,
  1999. defaultFlag: this.detailData.defaultFlag,
  2000. detailNoteText: this.detailData.detailNoteText,
  2001. status: this.detailData.status,
  2002. createBy: this.$store.state.user.name,
  2003. updateBy: this.$store.state.user.name,
  2004. informationList: this.subDetailList,
  2005. processUnit: this.modalData.processUnit
  2006. }
  2007. this.saveAllLoading = true
  2008. bomManagementSave(tempData).then(({data}) => {
  2009. if (data && data.code === 0) {
  2010. this.updateModal(data.rows)
  2011. this.$message({
  2012. message: '操作成功',
  2013. type: 'success',
  2014. duration: 1500,
  2015. onClose: () => {}
  2016. })
  2017. } else {
  2018. this.$alert(data.msg, '错误', {
  2019. confirmButtonText: '确定'
  2020. })
  2021. }
  2022. this.saveAllLoading = false
  2023. }).catch(() => {
  2024. this.saveAllLoading = false
  2025. })
  2026. },
  2027. // 子物料列表
  2028. queryComponentPartModal () {
  2029. this.componentPartData.limit = this.pageSize3
  2030. this.componentPartData.page = this.pageIndex3
  2031. this.componentPartData.site = this.modalData.site
  2032. this.componentPartData.buNo = this.modalData.buNo
  2033. // 查询所有物料
  2034. queryPartListAll(this.componentPartData).then(({data}) => {
  2035. if (data && data.code === 0) {
  2036. this.componentPartList = data.page.list
  2037. this.pageIndex3 = data.page.currPage
  2038. this.pageSize3 = data.page.pageSize
  2039. this.totalPage3 = data.page.totalCount
  2040. this.componentPartModelFlag = true
  2041. } else {
  2042. this.componentPartList = []
  2043. }
  2044. })
  2045. },
  2046. // 子物料查询列表
  2047. queryComponentPartList () {
  2048. this.componentPartData.limit = this.pageSize3
  2049. this.componentPartData.page = this.pageIndex3
  2050. // 查询所有物料
  2051. queryPartListAll(this.componentPartData).then(({data}) => {
  2052. if (data && data.code === 0) {
  2053. this.componentPartList = data.page.list
  2054. this.pageIndex3 = data.page.currPage
  2055. this.pageSize3 = data.page.pageSize
  2056. this.totalPage3 = data.page.totalCount
  2057. } else {
  2058. this.componentPartList = []
  2059. }
  2060. })
  2061. },
  2062. // 双击选中子物料
  2063. getComponentRowData (row) {
  2064. this.componentData.componentPart = row.partNo
  2065. this.componentData.componentPartDesc = row.partDesc
  2066. this.componentData.printUnit = row.printUnit
  2067. this.componentData.printUnitName = row.printUnitName
  2068. this.componentData.familyID = row.familyID
  2069. if (this.widthConversionFamily.includes(row.familyID)) {
  2070. this.componentData.widthConversion = 1
  2071. } else if (this.areaConversionFamily.includes(row.familyID)) {
  2072. this.componentData.areaConversion = 1
  2073. } else if (this.densityConversionFamily.includes(row.familyID)) {
  2074. this.componentData.densityConversion = 1
  2075. } else if (this.unitConversionFamily.includes(row.familyID)) {
  2076. this.componentData.unitConversion = 1
  2077. } else if (this.consumptionLossFamily.includes(row.familyID)) {
  2078. this.componentData.consumptionLoss = 1
  2079. }
  2080. this.componentPartModelFlag = false
  2081. },
  2082. // 子物料编码失焦事件
  2083. componentPartBlur () {
  2084. if (this.componentData.componentPart != null && this.componentData.componentPart !== '') {
  2085. this.componentPartData.limit = this.pageSize3
  2086. this.componentPartData.page = this.pageIndex3
  2087. this.componentPartData.site = this.modalData.site
  2088. this.componentPartData.buNo = this.modalData.buNo
  2089. this.componentPartData.partNo = this.componentData.componentPart
  2090. queryPartListAll(this.componentPartData).then(({data}) => {
  2091. if (data && data.code === 0) {
  2092. if (data.page.list.length > 0) {
  2093. this.componentData.componentPartDesc = data.page.list[0].partDesc
  2094. this.componentData.printUnit = data.page.list[0].printUnit
  2095. this.componentData.printUnitName = data.page.list[0].printUnitName
  2096. this.componentData.familyID = data.page.list[0].familyID
  2097. if (this.widthConversionFamily.includes(data.page.list[0].familyID)) {
  2098. this.componentData.widthConversion = 1
  2099. } else if (this.areaConversionFamily.includes(data.page.list[0].familyID)) {
  2100. this.componentData.areaConversion = 1
  2101. } else if (this.densityConversionFamily.includes(data.page.list[0].familyID)) {
  2102. this.componentData.densityConversion = 1
  2103. } else if (this.unitConversionFamily.includes(data.page.list[0].familyID)) {
  2104. this.componentData.unitConversion = 1
  2105. } else if (this.consumptionLossFamily.includes(data.page.list[0].familyID)) {
  2106. this.componentData.consumptionLoss = 1
  2107. }
  2108. return
  2109. }
  2110. }
  2111. })
  2112. }
  2113. this.componentData.componentPartDesc = ''
  2114. this.componentData.printUnit = ''
  2115. this.componentData.printUnitName = ''
  2116. this.componentData.familyID = ''
  2117. },
  2118. // 根据物料编码查询工序
  2119. queryOperationList () {
  2120. this.operationData.site = this.modalData.site
  2121. this.operationData.buNo = this.modalData.buNo
  2122. this.operationData.partNo = this.modalData.partNo
  2123. // 查询所有
  2124. queryOperationList(this.operationData).then(({data}) => {
  2125. if (data && data.code === 0) {
  2126. this.operationList = data.rows
  2127. this.operationData = {
  2128. site: this.modalData.site,
  2129. buNo: this.modalData.buNo,
  2130. partNo: this.modalData.partNo,
  2131. routingRevision: '',
  2132. routingType: '',
  2133. alternativeNo: '',
  2134. operationNo: '',
  2135. operationName: '',
  2136. }
  2137. this.operationModelFlag = true
  2138. } else {
  2139. this.$alert(data.msg, '错误', {
  2140. confirmButtonText: '确定'
  2141. })
  2142. }
  2143. })
  2144. },
  2145. // 双击选中工序
  2146. getRowOperationData (row) {
  2147. if (this.batchOperationModelFlag) {
  2148. this.batchOperationData.operationId = row.operationId
  2149. this.batchOperationData.operationNo = row.operationNo
  2150. this.batchOperationData.operationName = row.operationName
  2151. } else {
  2152. this.componentData.operationId = row.operationId
  2153. this.componentData.operationNo = row.operationNo
  2154. }
  2155. this.operationModelFlag = false
  2156. },
  2157. // 新增子明细方法
  2158. componentDataSave (isClose) {
  2159. if (this.componentData.lineSequence === '' || this.componentData.lineSequence == null) {
  2160. this.$message.warning('序号不能为空!')
  2161. return
  2162. }
  2163. if (this.componentData.partNo === '' || this.componentData.partNo == null) {
  2164. this.$message.warning('请选择主记录物料编码!')
  2165. return
  2166. }
  2167. if (this.componentData.bomType === '' || this.componentData.bomType == null) {
  2168. this.$message.warning('请选择主记录制造类型!')
  2169. return
  2170. }
  2171. if (this.componentData.engChgLevel === '' || this.componentData.engChgLevel == null) {
  2172. this.$message.warning('请填写主记录BOM版本号!')
  2173. return
  2174. }
  2175. if (this.componentData.componentPart === '' || this.componentData.componentPart == null) {
  2176. this.$message.warning('请选择子物料编码!')
  2177. return
  2178. }
  2179. if (this.componentData.productFlag === 'component' && (this.componentData.consumptionItem === '' || this.componentData.consumptionItem == null)) {
  2180. this.$message.warning('请选择消耗项目!')
  2181. return
  2182. }
  2183. if (this.componentData.qtyPerAssembly === '' || this.componentData.qtyPerAssembly == null) {
  2184. this.$message.warning('请填写单位用量!')
  2185. return
  2186. }
  2187. if (this.componentData.qtyPerAssembly === 0) {
  2188. this.$message.warning('单位用量不能为0!')
  2189. return
  2190. }
  2191. if (this.componentData.componentScrap === '' || this.componentData.componentScrap == null) {
  2192. this.$message.warning('请填写调机量!')
  2193. return
  2194. }
  2195. if (this.componentData.shrinkageFactor === '' || this.componentData.shrinkageFactor == null) {
  2196. this.$message.warning('请填写损耗率!')
  2197. return
  2198. }
  2199. if (this.componentData.issueType === '' || this.componentData.issueType == null) {
  2200. this.$message.warning('请选择生产属性!')
  2201. return
  2202. }
  2203. if (this.componentData.flag === '1') {
  2204. saveBomComponent(this.componentData).then(({data}) => {
  2205. if (data && data.code === 0) {
  2206. this.subDetailList = data.rows.subDetailList
  2207. if (isClose) {
  2208. if (this.subDetailTable === 'by_products') {
  2209. this.saveByProductModal()
  2210. } else {
  2211. this.saveComponentModal()
  2212. }
  2213. } else {
  2214. this.componentSaveModal = false
  2215. }
  2216. this.$message({
  2217. message: '操作成功',
  2218. type: 'success',
  2219. duration: 1500,
  2220. onClose: () => {}
  2221. })
  2222. } else {
  2223. this.$alert(data.msg, '错误', {
  2224. confirmButtonText: '确定'
  2225. })
  2226. }
  2227. })
  2228. } else if (this.componentData.flag === '2') {
  2229. updateBomComponent(this.componentData).then(({data}) => {
  2230. if (data && data.code === 0) {
  2231. this.subDetailList = data.rows.subDetailList
  2232. this.componentSaveModal = false
  2233. this.$message({
  2234. message: '操作成功',
  2235. type: 'success',
  2236. duration: 1500,
  2237. onClose: () => {}
  2238. })
  2239. } else {
  2240. this.$alert(data.msg, '错误', {
  2241. confirmButtonText: '确定'
  2242. })
  2243. }
  2244. })
  2245. }
  2246. },
  2247. // 计算单位用量
  2248. computeQtyPerAssembly () {
  2249. if (this.componentData.lineSequence === '' || this.componentData.lineSequence == null) {
  2250. this.$message.warning('序号不能为空!')
  2251. return
  2252. }
  2253. if (this.componentData.partNo === '' || this.componentData.partNo == null) {
  2254. this.$message.warning('请选择主记录物料编码!')
  2255. return
  2256. }
  2257. if (this.componentData.bomType === '' || this.componentData.bomType == null) {
  2258. this.$message.warning('请选择主记录制造类型!')
  2259. return
  2260. }
  2261. if (this.componentData.engChgLevel === '' || this.componentData.engChgLevel == null) {
  2262. this.$message.warning('请填写主记录BOM版本号!')
  2263. return
  2264. }
  2265. if (this.componentData.componentPart === '' || this.componentData.componentPart == null) {
  2266. this.$message.warning('请选择子物料编码!')
  2267. return
  2268. }
  2269. if (this.componentData.productFlag === 'component' && (this.componentData.consumptionItem === '' || this.componentData.consumptionItem == null)) {
  2270. this.$message.warning('请选择消耗项目!')
  2271. return
  2272. }
  2273. if (this.componentData.componentScrap === '' || this.componentData.componentScrap == null) {
  2274. this.$message.warning('请填写调机量!')
  2275. return
  2276. }
  2277. if (this.componentData.shrinkageFactor === '' || this.componentData.shrinkageFactor == null) {
  2278. this.$message.warning('请填写损耗率!')
  2279. return
  2280. }
  2281. if (this.componentData.issueType === '' || this.componentData.issueType == null) {
  2282. this.$message.warning('请选择生产属性!')
  2283. return
  2284. }
  2285. this.computeLoading = true
  2286. if (this.componentData.flag === '1') {
  2287. computeQtyPerAssemblySave(this.componentData).then(({data}) => {
  2288. if (data && data.code === 0) {
  2289. this.subDetailList = data.rows.subDetailList
  2290. // 换成修改子物料模态框
  2291. this.updateComponentModal(data.rows.rowData)
  2292. this.$message({
  2293. message: '操作成功',
  2294. type: 'success',
  2295. duration: 1500,
  2296. onClose: () => {}
  2297. })
  2298. } else {
  2299. this.$alert(data.msg, '错误', {
  2300. confirmButtonText: '确定'
  2301. })
  2302. }
  2303. this.computeLoading = false
  2304. }).catch(() => {
  2305. this.computeLoading = false
  2306. })
  2307. } else if (this.componentData.flag === '2') {
  2308. computeQtyPerAssemblyEdit(this.componentData).then(({data}) => {
  2309. if (data && data.code === 0) {
  2310. this.subDetailList = data.rows.subDetailList
  2311. // 换成修改子物料模态框
  2312. this.updateComponentModal(data.rows.rowData)
  2313. this.$message({
  2314. message: '操作成功',
  2315. type: 'success',
  2316. duration: 1500,
  2317. onClose: () => {}
  2318. })
  2319. } else {
  2320. this.$alert(data.msg, '错误', {
  2321. confirmButtonText: '确定'
  2322. })
  2323. }
  2324. this.computeLoading = false
  2325. }).catch(() => {
  2326. this.computeLoading = false
  2327. })
  2328. }
  2329. },
  2330. // 子物料查询列表
  2331. queryBatchComponentPartList () {
  2332. this.batchComponentPartData.limit = this.pageSize5
  2333. this.batchComponentPartData.page = this.pageIndex5
  2334. // 查询所有物料
  2335. queryPartListAll(this.batchComponentPartData).then(({data}) => {
  2336. if (data && data.code === 0) {
  2337. this.batchComponentPartList = data.page.list
  2338. this.pageIndex5 = data.page.currPage
  2339. this.pageSize5 = data.page.pageSize
  2340. this.totalPage5 = data.page.totalCount
  2341. } else {
  2342. this.batchComponentPartList = []
  2343. }
  2344. })
  2345. },
  2346. // 复选子物料信息
  2347. selectionSaveComponent (val) {
  2348. this.batchComponentSelections = val
  2349. },
  2350. // 复选子物料信息
  2351. selectionSaveComponent2 (val) {
  2352. this.batchComponentSelections2 = val
  2353. },
  2354. // 双击添加
  2355. batchAddPartDB (row) {
  2356. this.batchComponentSelections = []
  2357. this.batchComponentSelections.push(row)
  2358. this.batchAddPart()
  2359. },
  2360. // 双击删除
  2361. batchDeletePartDB (row) {
  2362. this.batchComponentSelections2 = []
  2363. this.batchComponentSelections2.push(row)
  2364. this.batchDeletePart()
  2365. },
  2366. batchAddPart () {
  2367. if (this.batchComponentSelections == null || this.batchComponentSelections.length === 0) {
  2368. this.$message.warning('请选择可选物料!')
  2369. return
  2370. }
  2371. // 创建一个 Set 来存储已选择的元素
  2372. const chosenSet = new Set(this.choosePartList.map(item => `${item.site}-${item.partNo}`))
  2373. // 检查是否有重复元素
  2374. const hasDuplicates = this.batchComponentSelections.some(item => chosenSet.has(`${item.site}-${item.partNo}`))
  2375. if (hasDuplicates) {
  2376. this.$message.warning('所选物料中包含已存在的物料,请重新选择!')
  2377. return
  2378. }
  2379. this.choosePartList = [...this.choosePartList, ...this.batchComponentSelections]
  2380. },
  2381. batchDeletePart () {
  2382. if (this.batchComponentSelections2 == null || this.batchComponentSelections2.length === 0) {
  2383. this.$message.warning('请选择已选物料!')
  2384. return
  2385. }
  2386. // 创建一个 Set 来存储 batchComponentSelections 中的键值对
  2387. const set = new Set(this.batchComponentSelections2.map(item => `${item.site}-${item.partNo}`))
  2388. // 过滤 choosePartList,移除与 batchComponentSelections 匹配的元素
  2389. this.choosePartList = this.choosePartList.filter(item => !set.has(`${item.site}-${item.partNo}`))
  2390. },
  2391. // 批量新增子件
  2392. batchComponentDataSave () {
  2393. this.$confirm("是否确认添加该"+ this.choosePartList.length +"条子件记录?", "提示", {
  2394. confirmButtonText: "确定",
  2395. cancelButtonText: "取消",
  2396. type: "warning"
  2397. }).then(() => {
  2398. let tempData = {
  2399. site: this.modalData.site,
  2400. buNo: this.modalData.buNo,
  2401. partNo: this.modalData.partNo,
  2402. engChgLevel: this.modalData.engChgLevel,
  2403. bomType: this.modalData.bomType,
  2404. alternativeNo: this.detailData.alternativeNo,
  2405. consumptionItem: 'Consumed',
  2406. qtyPerAssembly: 0,
  2407. componentScrap: 0,
  2408. shrinkageFactor: this.batchComponentPartData.shrinkageFactor,
  2409. lineItemNo: '',
  2410. operationId: '',
  2411. operationNo: '',
  2412. issueToLoc: '',
  2413. issueToLocName: '',
  2414. noteText: '',
  2415. createBy: this.$store.state.user.name,
  2416. lineSequence: '',
  2417. issueType: 'Reserve And Backflush',
  2418. productFlag: 'component',
  2419. batchSaveList: this.choosePartList
  2420. }
  2421. batchSaveBomComponent(tempData).then(({data}) => {
  2422. if (data && data.code === 0) {
  2423. this.subDetailList = data.rows.subDetailList
  2424. this.batchComponentPartModelFlag = false
  2425. this.$message({
  2426. message: '操作成功',
  2427. type: 'success',
  2428. duration: 1500,
  2429. onClose: () => {}
  2430. })
  2431. } else {
  2432. this.$alert(data.msg, '错误', {
  2433. confirmButtonText: '确定'
  2434. })
  2435. }
  2436. this.batchComponentPartData = {
  2437. site: '',
  2438. buNo: '',
  2439. partNo: '',
  2440. partDesc: '',
  2441. shrinkageFactor: '',
  2442. page: 1,
  2443. limit: 10
  2444. }
  2445. })
  2446. })
  2447. },
  2448. // 新增替代方法
  2449. detailDataSave () {
  2450. if (this.saveDetailData.partNo === '' || this.saveDetailData.partNo == null) {
  2451. this.$message.warning('请先选择Bom物料!')
  2452. return
  2453. }
  2454. if (this.saveDetailData.engChgLevel === '' || this.saveDetailData.engChgLevel == null) {
  2455. this.$message.warning('请先填写Bom版本号!')
  2456. return
  2457. }
  2458. if (this.saveDetailData.bomType === '' || this.saveDetailData.bomType == null) {
  2459. this.$message.warning('请先选择制造类型!')
  2460. return
  2461. }
  2462. if (this.saveDetailData.alternativeNo === '' || this.saveDetailData.alternativeNo == null) {
  2463. this.$message.warning('请填写替代编码!')
  2464. return
  2465. }
  2466. if (this.saveDetailData.alternativeDescription === '' || this.saveDetailData.alternativeDescription == null) {
  2467. this.$message.warning('请填写替代名称!')
  2468. return
  2469. }
  2470. if (this.saveDetailData.status === '' || this.saveDetailData.status == null) {
  2471. this.$message.warning('请选择替代状态!')
  2472. return
  2473. }
  2474. if (this.saveDetailData.minLotQty === '' || this.saveDetailData.minLotQty == null) {
  2475. this.$message.warning('请填写最小订单数!')
  2476. return
  2477. }
  2478. this.saveDetailLoading = true
  2479. if (this.saveDetailData.flag === '1') {
  2480. bomDetailSave(this.saveDetailData).then(({data}) => {
  2481. if (data && data.code === 0) {
  2482. this.detailDataList = data.rows
  2483. this.detailData = this.saveDetailData
  2484. this.subDetailList = []
  2485. this.saveDetailModalFlag = false
  2486. this.$message({
  2487. message: '操作成功',
  2488. type: 'success',
  2489. duration: 1500,
  2490. onClose: () => {}
  2491. })
  2492. } else {
  2493. this.$alert(data.msg, '错误', {
  2494. confirmButtonText: '确定'
  2495. })
  2496. }
  2497. this.saveDetailLoading = false
  2498. })
  2499. } else {
  2500. bomDetailUpdate(this.saveDetailData).then(({data}) => {
  2501. if (data && data.code === 0) {
  2502. this.detailDataList = data.rows.detailDataList
  2503. this.detailData = data.rows.detailData
  2504. this.subDetailList = data.rows.subDetailList
  2505. this.saveDetailModalFlag = false
  2506. this.$message({
  2507. message: '操作成功',
  2508. type: 'success',
  2509. duration: 1500,
  2510. onClose: () => {}
  2511. })
  2512. } else {
  2513. this.$alert(data.msg, '错误', {
  2514. confirmButtonText: '确定'
  2515. })
  2516. }
  2517. this.saveDetailLoading = false
  2518. })
  2519. }
  2520. },
  2521. // 批量修改工序模态框
  2522. batchUpdateOperationModal () {
  2523. if (this.checkedDetail.length === 0) {
  2524. this.$message.warning('请选择要编辑子物料!')
  2525. return
  2526. }
  2527. this.batchOperationData = {
  2528. operationId: '',
  2529. operationNo: '',
  2530. operationName: ''
  2531. }
  2532. this.batchOperationModelFlag = true
  2533. },
  2534. // 批量修改工序
  2535. batchOperationEdit () {
  2536. let tempData = {
  2537. informationList: this.checkedDetail,
  2538. operationId: this.batchOperationData.operationId,
  2539. updateBy: this.$store.state.user.name,
  2540. }
  2541. batchOperationEdit(tempData).then(({data}) => {
  2542. if (data && data.code === 0) {
  2543. this.subDetailList = data.rows.subDetailList
  2544. this.batchOperationModelFlag = false
  2545. this.$message({
  2546. message: '操作成功',
  2547. type: 'success',
  2548. duration: 1500,
  2549. onClose: () => {}
  2550. })
  2551. } else {
  2552. this.$alert(data.msg, '错误', {
  2553. confirmButtonText: '确定'
  2554. })
  2555. }
  2556. })
  2557. },
  2558. // 获取基础数据列表S
  2559. getBaseList (val, type) {
  2560. this.tagNo = val
  2561. this.$nextTick(() => {
  2562. let strVal = ''
  2563. let conSql = ''
  2564. if (val === 215) {
  2565. strVal = this.componentData.issueToLoc
  2566. }
  2567. if (val === 510) {
  2568. conSql = " and site = '" + this.modalData.site + "'"
  2569. }
  2570. this.$refs.baseList.init(val, strVal, conSql)
  2571. })
  2572. },
  2573. // 列表方法的回调
  2574. getBaseData (val) {
  2575. if (this.tagNo === 215) {
  2576. this.componentData.issueToLoc = val.location_id
  2577. this.componentData.issueToLocName = val.location_name
  2578. }
  2579. if (this.tagNo === 510) {
  2580. this.modalData.processUnit = val.UMID
  2581. this.modalData.processUnitName = val.UMName
  2582. }
  2583. },
  2584. // 回车事件
  2585. focusNextInput (index, type) {
  2586. let aaa = ''
  2587. if (this.subDetailList.length - 1 === index) {
  2588. aaa = `${type}0`
  2589. } else {
  2590. aaa = `${type}${index + 1}`
  2591. }
  2592. this.$nextTick(() => {
  2593. this.$refs[aaa].focus()
  2594. })
  2595. },
  2596. }
  2597. }
  2598. </script>
  2599. <style lang="scss" scoped>
  2600. /deep/ .detail-tab .el-tabs__content {
  2601. height: 165px;
  2602. padding: 15px 0px 0px 0px;
  2603. }
  2604. /deep/ .sub_detail-tab .el-tabs__content {
  2605. height: 280px;
  2606. padding: 0px;
  2607. }
  2608. </style>