batchProductJobBom.vue 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name"> 报工信息: ({{ list.length || 0 }})个</view>
  5. </view>
  6. <view
  7. :class="[
  8. 'material',
  9. it.extInfo.reportWeight && it.extInfo.reportWeight && 'materialBor',
  10. ]"
  11. v-for="(it, idx) in list"
  12. :key="idx"
  13. >
  14. <view class="content_table">
  15. <view class="item rx-sc">
  16. <view class="rx">
  17. <view class="lable lable190 rx-cc" v-if="isDetails">
  18. <view class="round">{{ idx + 1 }}</view>
  19. <uni-icons
  20. custom-prefix="iconfont"
  21. type="icon-shanchu"
  22. size="16"
  23. color="#fa3534"
  24. ></uni-icons>
  25. 物料编码
  26. </view>
  27. <view class="lable lable190 rx-cc" @click="getDelete2(idx)" v-else>
  28. <view class="round">{{ idx + 1 }}</view>
  29. <uni-icons
  30. custom-prefix="iconfont"
  31. type="icon-shanchu"
  32. size="16"
  33. color="#fa3534"
  34. ></uni-icons>
  35. 物料编码
  36. </view>
  37. <view class="content rx-bc">
  38. <view>{{ it.code }} </view>
  39. <view
  40. class="tag_box"
  41. v-if="
  42. Object.prototype.hasOwnProperty.call(it, 'extInfo') &&
  43. Object.prototype.hasOwnProperty.call(
  44. it.extInfo,
  45. 'productionTimes'
  46. ) &&
  47. Object.prototype.hasOwnProperty.call(
  48. it.extInfo.productionTimes,
  49. item.currentTaskDiagram.taskId
  50. )
  51. "
  52. >
  53. {{ it.extInfo.productionTimes[item.currentTaskDiagram.taskId] }}
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="item rx-sc">
  59. <view class="rx">
  60. <view class="lable lable150 rx-cc">名称</view>
  61. <view class="content rx-bc">
  62. <view
  63. >{{ it.name }}
  64. <text
  65. v-if="[2, 23, 9, 28].includes(Number(it.rootCategoryLevelId))"
  66. >
  67. ({{
  68. it.rootCategoryLevelId == 2
  69. ? "在制品"
  70. : it.rootCategoryLevelId == 23
  71. ? "半成品"
  72. : it.rootCategoryLevelId == 9
  73. ? "产品"
  74. : it.rootCategoryLevelId == 28
  75. ? "废品"
  76. : ""
  77. }})
  78. </text>
  79. </view>
  80. <view class="rx-ec">
  81. <view
  82. class="tag_box"
  83. v-if="it.isCache"
  84. style="margin-right: -36rpx; margin-right: 4rpx"
  85. >缓</view
  86. >
  87. <view
  88. class="tag_box"
  89. v-if="
  90. Object.prototype.hasOwnProperty.call(
  91. it.extInfo,
  92. 'isOutsource'
  93. ) && it.extInfo.isOutsource == 1
  94. "
  95. style="margin-right: -36rpx"
  96. >委外</view
  97. >
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. <view class="item rx-sc">
  103. <view class="rx">
  104. <view class="lable lable150 rx-cc">型号</view>
  105. <view class="content rx-sc">
  106. <view>{{ it.modelType }}</view>
  107. </view>
  108. </view>
  109. </view>
  110. <view class="item rx-sc">
  111. <view class="rx ww50">
  112. <view class="lable lable150 rx-cc">批次号</view>
  113. <view class="content content_num">
  114. <view v-if="isDetails">{{ it.batchNo }}</view>
  115. <input class="uni-input" v-else v-model="it.batchNo" />
  116. </view>
  117. </view>
  118. <view class="rx ww50">
  119. <view class="lable lable150 rx-cc">牌号</view>
  120. <view class="content content_num">
  121. <view>{{ it.brandNum }}</view>
  122. </view>
  123. </view>
  124. </view>
  125. <view class="item rx-sc">
  126. <view class="rx ww50">
  127. <view class="lable lable150 rx-cc">物料代号</view>
  128. <view class="content content_num">
  129. <view v-if="isDetails">{{ it.extInfo.materielCode }}</view>
  130. <input
  131. class="uni-input"
  132. v-else
  133. v-model="it.extInfo.materielCode"
  134. />
  135. </view>
  136. </view>
  137. <view class="rx ww50">
  138. <view class="lable lable150 rx-cc">客户代号</view>
  139. <view class="content content_num">
  140. <view v-if="isDetails">{{ it.extInfo.clientCode }}</view>
  141. <input class="uni-input" v-else v-model="it.extInfo.clientCode" />
  142. </view>
  143. </view>
  144. </view>
  145. <view class="item rx-sc">
  146. <view class="rx ww50">
  147. <view class="lable lable150 rx-cc" v-if="clientEnvironmentId != 5"
  148. >刻码</view
  149. >
  150. <view class="lable lable150 rx-cc" v-if="clientEnvironmentId == 5"
  151. >识别码</view
  152. >
  153. <view class="content content_num">
  154. <view v-if="isDetails">{{ it.extInfo.engrave }}</view>
  155. <input class="uni-input" v-else v-model="it.extInfo.engrave" />
  156. </view>
  157. </view>
  158. <view class="rx ww50">
  159. <view class="lable lable150 rx-cc">序列号</view>
  160. <view class="content content_num">
  161. <view v-if="isDetails">{{ it.extInfo.productSequence }}</view>
  162. </view>
  163. </view>
  164. </view>
  165. <view class="item rx-sc">
  166. <view class="rx ww50">
  167. <view class="lable lable150 rx-cc">设备</view>
  168. <view class="content content_num">
  169. <view v-if="isDetails">{{ it.deviceName }}</view>
  170. <zxz-uni-data-select
  171. :localdata="deviceList"
  172. v-model="it.deviceId"
  173. dataValue="instanceId"
  174. format="{name}"
  175. dataKey="instanceId"
  176. filterable
  177. :clear="false"
  178. v-else
  179. ></zxz-uni-data-select>
  180. </view>
  181. <!-- <view class="content ">
  182. <view>{{ it.deviceName || it.extInfo.deviceName }}</view>
  183. </view> -->
  184. </view>
  185. <view class="rx ww50">
  186. <view class="lable lable150 rx-cc">炉次号</view>
  187. <view class="content content_num">
  188. <view v-if="isDetails">{{ it.extInfo.heatNumber }}</view>
  189. <input class="uni-input" v-else v-model="it.extInfo.heatNumber" />
  190. </view>
  191. </view>
  192. </view>
  193. <view class="item rx-sc">
  194. <view class="rx ww50">
  195. <view class="lable lable150 rx-cc">位置</view>
  196. <view class="content content_num">
  197. <view v-if="isDetails">{{ it.extInfo.position }}</view>
  198. <input class="uni-input" v-else v-model="it.extInfo.position" />
  199. </view>
  200. </view>
  201. <view class="rx ww50">
  202. <view class="lable lable150 rx-cc">数量</view>
  203. <view class="content content_num">
  204. <view v-if="isDetails">{{ it.feedQuantity }}</view>
  205. <view>{{ it.feedQuantity }}</view>
  206. </view>
  207. </view>
  208. </view>
  209. <view class="item rx-sc">
  210. <view class="rx ww50">
  211. <view class="lable lable150 rx-cc">是否合格</view>
  212. <view class="content content_num">
  213. <zxz-uni-data-select
  214. :localdata="isQualifiedList"
  215. v-model="it.extInfo.isQualified"
  216. dataValue="code"
  217. format="{name}"
  218. dataKey="code"
  219. filterable
  220. :disabled="isDetails"
  221. :clear="false"
  222. ></zxz-uni-data-select>
  223. </view>
  224. </view>
  225. <view
  226. class="rx ww50"
  227. v-if="it.extInfo.isQualified && it.extInfo.isQualified == 2"
  228. >
  229. <view class="lable lable150 rx-cc">处置类型</view>
  230. <view class="content">
  231. <zxz-uni-data-select
  232. :localdata="notTypeList"
  233. v-model="it.extInfo.notType"
  234. dataValue="code"
  235. format="{name}"
  236. dataKey="code"
  237. filterable
  238. :disabled="isDetails"
  239. :clear="false"
  240. ></zxz-uni-data-select>
  241. </view>
  242. </view>
  243. </view>
  244. <view class="item rx-sc">
  245. <view class="rx ww50">
  246. <view class="lable lable150 rx-cc">原因/处置</view>
  247. <view
  248. class="content"
  249. v-if="
  250. it.extInfo.isQualified != 1 &&
  251. it.extInfo.notType != 5 &&
  252. it.extInfo.notType != 8 &&
  253. it.extInfo.notType
  254. "
  255. >
  256. <view v-if="isDetails">{{ it.extInfo.notReason }}</view>
  257. <input
  258. class="uni-input content_num"
  259. v-else
  260. v-model="it.extInfo.notReason"
  261. />
  262. </view>
  263. <view
  264. v-if="![1, 2, 3, 4, 6, 9, 7].includes(Number(it.extInfo.notType))"
  265. class="content"
  266. >
  267. <span v-if="isDetails">{{ it.extInfo.taskName }}</span>
  268. <zxz-uni-data-select
  269. :localdata="stepsList"
  270. v-model="it.extInfo.taskId"
  271. dataValue="taskId"
  272. format="{taskTypeName}"
  273. dataKey="taskId"
  274. filterable
  275. :disabled="isDetails"
  276. :clear="false"
  277. >
  278. </zxz-uni-data-select>
  279. </view>
  280. </view>
  281. <view class="rx ww50">
  282. <view class="lable lable150 rx-cc">报工重量</view>
  283. <view class="content content_num">
  284. <view v-if="isDetails">{{ it.extInfo.reportWeight }}</view>
  285. <input
  286. class="uni-input"
  287. v-else
  288. v-model="it.extInfo.reportWeight"
  289. @input="handleInput"
  290. />
  291. </view>
  292. </view>
  293. </view>
  294. <view class="item rx-sc">
  295. <view class="rx">
  296. <view class="lable lable150 rx-cc">操作</view>
  297. <view class="content rx-bc">
  298. <view style="display: flex">
  299. <u-button
  300. size="small"
  301. class="u-reset-button"
  302. type="primary"
  303. @click="batchClick(it, idx)"
  304. v-if="it.extInfo.sourceQuantity > 1"
  305. >拆批</u-button
  306. >
  307. <u-button
  308. size="small"
  309. class="u-reset-button"
  310. type="error"
  311. @click="deleteBatch(idx)"
  312. style="margin-left: 20px"
  313. >删除</u-button
  314. >
  315. </view>
  316. </view>
  317. </view>
  318. </view>
  319. </view>
  320. <view
  321. class="content_table2"
  322. v-if="
  323. ![1, 2, 3, 4].includes(Number(it.extInfo.notType)) &&
  324. clientEnvironmentId == 3
  325. "
  326. >
  327. <view class="head row rx-sc">
  328. <view class="item ww25" style="font-size: 20rpx"
  329. >{{ it.extInfo.newWeight ? "上道工序重量" : "物料重量" }}
  330. {{ it.extInfo.weightUnit }}
  331. </view>
  332. <view class="item ww25">报工重量{{ it.extInfo.weightUnit }}</view>
  333. <view class="item ww25" v-if="isFirstTask == 1">质检结果 </view>
  334. <view class="item ww25" :class="[isFirstTask == 1 ? 'ww25' : 'ww50']"
  335. >处置
  336. </view>
  337. </view>
  338. <view class="table">
  339. <view class="tr row rx-sc">
  340. <view
  341. class="item ww25"
  342. v-if="
  343. Object.prototype.hasOwnProperty.call(it.extInfo, 'newWeight') &&
  344. it.extInfo.newWeight
  345. "
  346. >
  347. {{ it.extInfo.newWeight }}
  348. </view>
  349. <view
  350. class="item ww25 content_num"
  351. v-if="
  352. !Object.prototype.hasOwnProperty.call(
  353. it.extInfo,
  354. 'newWeight'
  355. ) ||
  356. it.extInfo.newWeight == null ||
  357. it.extInfo.newWeight == 0
  358. "
  359. >
  360. <input
  361. class="uni-input"
  362. v-model="it.extInfo.weight"
  363. type="digit"
  364. />
  365. </view>
  366. <view class="item ww25 content_num">
  367. <view v-if="isDetails">{{ it.extInfo.reportWeight }}</view>
  368. <input
  369. class="uni-input"
  370. v-else
  371. v-model="it.extInfo.reportWeight"
  372. type="digit"
  373. @input="handleInput"
  374. />
  375. </view>
  376. <view
  377. class="item ww25"
  378. @click="openNumerate(it, idx)"
  379. v-if="isFirstTask == 1"
  380. >
  381. <view class="numerate">点击计算</view>
  382. </view>
  383. <view
  384. class="item"
  385. v-if="isDetails"
  386. :class="[isFirstTask == 1 ? 'ww25' : 'ww50']"
  387. >
  388. {{ it.extInfo.taskName }}
  389. </view>
  390. <view
  391. class="item"
  392. v-else
  393. :class="[isFirstTask == 1 ? 'ww25' : 'ww50']"
  394. >
  395. <zxz-uni-data-select
  396. :localdata="stepsList"
  397. v-model="it.extInfo.taskId"
  398. dataValue="taskId"
  399. format="{taskTypeName}"
  400. dataKey="taskId"
  401. filterable
  402. @change="(e) => (it.extInfo.taskName = e.taskTypeName)"
  403. :clear="false"
  404. ></zxz-uni-data-select>
  405. </view>
  406. </view>
  407. </view>
  408. </view>
  409. </view>
  410. <u-popup
  411. :show="show"
  412. mode="center"
  413. v-if="show"
  414. :closeOnClickOverlay="false"
  415. >
  416. <view class="popup_box">
  417. <view class="title_box rx-bc">
  418. <view class="name">工序计算列表</view>
  419. <view class="btn_box rx-ec">
  420. <view class="btn" @click="handAddParam">新增</view>
  421. </view>
  422. </view>
  423. <view class="content_table2">
  424. <view class="head row rx-sc">
  425. <view class="item ww30">工序名称</view>
  426. <view class="item ww20">坯体密度</view>
  427. <view class="item ww20">密度系数</view>
  428. <view class="item ww20">重量</view>
  429. <view class="item ww10">操作</view>
  430. </view>
  431. <view class="table">
  432. <view
  433. class="tr row rx-sc"
  434. v-for="(it, idx) in paramList"
  435. :key="idx"
  436. >
  437. <view class="item rx-bc ww30">
  438. <zxz-uni-data-select
  439. :localdata="stepsList"
  440. v-model="it.taskId"
  441. dataValue="taskId"
  442. format="{taskTypeName}"
  443. dataKey="taskId"
  444. filterable
  445. @change="(e) => (it.taskName = e.taskTypeName)"
  446. :clear="false"
  447. ></zxz-uni-data-select>
  448. </view>
  449. <view class="item ww20 content_num">
  450. <input
  451. class="uni-input"
  452. v-model="it.billet"
  453. type="digit"
  454. @input="changeInp(it, idx)"
  455. />
  456. </view>
  457. <view class="item ww20 content_num">
  458. <input
  459. class="uni-input"
  460. v-model="it.density"
  461. type="digit"
  462. @input="changeInp(it, idx)"
  463. />
  464. </view>
  465. <view
  466. class="item ww20"
  467. v-if="idx == 0 || idx != paramList.length - 1"
  468. >
  469. < {{ it.CVIWeight }}
  470. </view>
  471. <view
  472. class="item ww20"
  473. v-if="paramList.length > 1 && idx == paramList.length - 1"
  474. >
  475. ≥ {{ it.CVIWeight }}
  476. </view>
  477. <view class="item ww10 rx-cc" @click="getDelete(idx)">
  478. <uni-icons
  479. custom-prefix="iconfont"
  480. type="icon-shanchu"
  481. size="20"
  482. color="#fa3534"
  483. ></uni-icons>
  484. </view>
  485. </view>
  486. </view>
  487. <view class="formula_box"
  488. >计算公式: 物料重量/坯体密度*密度系数
  489. </view>
  490. <view class="rx-cc">
  491. <u-button
  492. size="small"
  493. class="u-reset-button"
  494. style="width: 300rpx; margin: 20rpx"
  495. type="success"
  496. @click="paramSave"
  497. >工序列表保存</u-button
  498. >
  499. </view>
  500. <view class="reportWeight rx-sc">
  501. 物料重量: {{ weight }} ; 报工重量: {{ reportWeight }}
  502. </view>
  503. </view>
  504. <view class="operate_box rx-sc">
  505. <u-button size="small" class="u-reset-button" @click="cancel"
  506. >取消</u-button
  507. >
  508. <u-button
  509. size="small"
  510. class="u-reset-button"
  511. type="success"
  512. @click="save"
  513. >确定</u-button
  514. >
  515. </view>
  516. </view>
  517. </u-popup>
  518. <uni-popup ref="inputDialog" type="center" :animation="false">
  519. <view class="popup-content">
  520. <view style="font-size: 18px; margin-bottom: 10px">拆批</view>
  521. <uni-forms
  522. ref="baseForm"
  523. :modelValue="batchForm"
  524. label-position="left"
  525. label-align="center"
  526. >
  527. <uni-forms-item label="批次号:" label-width="100" prop="batchNo">
  528. <uni-easyinput
  529. v-model="batchForm.batchNo"
  530. placeholder="请输入批次号"
  531. />
  532. </uni-forms-item>
  533. <uni-forms-item label="拆批数:" label-width="100" prop="quantity">
  534. <uni-easyinput
  535. v-model="batchForm.quantity"
  536. placeholder="请输入拆批数"
  537. />
  538. </uni-forms-item>
  539. <uni-forms-item
  540. label="是否合格:"
  541. label-width="100"
  542. prop="isQualified"
  543. >
  544. <zxz-uni-data-select
  545. :localdata="isQualifiedList"
  546. v-model="batchForm.isQualified"
  547. dataValue="code"
  548. format="{name}"
  549. dataKey="code"
  550. filterable
  551. :clear="false"
  552. @change="isChange"
  553. ></zxz-uni-data-select>
  554. </uni-forms-item>
  555. <uni-forms-item
  556. label="不合格类型:"
  557. label-width="100"
  558. prop="notType"
  559. v-if="batchForm.isQualified == 2"
  560. >
  561. <zxz-uni-data-select
  562. :localdata="notTypeList"
  563. v-model="batchForm.notType"
  564. dataValue="code"
  565. format="{name}"
  566. dataKey="code"
  567. filterable
  568. :clear="false"
  569. ></zxz-uni-data-select>
  570. </uni-forms-item>
  571. <uni-forms-item
  572. label="不良原因:"
  573. v-if="
  574. batchForm.isQualified != 1 &&
  575. batchForm.notType &&
  576. batchForm.notType != 5 &&
  577. batchForm.notType != 8
  578. "
  579. prop="notReason"
  580. >
  581. <uni-easyinput
  582. v-model="batchForm.notReason"
  583. placeholder="请输入不良原因"
  584. />
  585. </uni-forms-item>
  586. </uni-forms>
  587. <view class="button-group">
  588. <button type="primary" size="mini" @click="handleClose">取消</button>
  589. <button type="primary" size="mini" @click="timeoutCauseConfirm">
  590. 确定
  591. </button>
  592. </view>
  593. </view>
  594. </uni-popup>
  595. </view>
  596. </template>
  597. <script>
  598. import { getTaskInstanceList } from "@/api/pda/workOrder.js";
  599. import { saveParam, getComputeParam } from "@/api/pda/tangu.js";
  600. import { splitBatch } from "@/api/pda/feeding";
  601. import SearchPopup from "./searchPopup.vue";
  602. export default {
  603. props: {
  604. item: {
  605. type: Object,
  606. default: () => {},
  607. },
  608. list: {
  609. type: Array,
  610. default: () => [],
  611. },
  612. isDetails: {
  613. type: Boolean,
  614. default: false,
  615. },
  616. equipmentList: {
  617. type: Array,
  618. default: () => [],
  619. },
  620. },
  621. components: {
  622. SearchPopup,
  623. },
  624. watch: {
  625. equipmentList: {
  626. immediate: true,
  627. deep: true,
  628. handler(newVal) {
  629. this.deviceList = newVal;
  630. this.changeHeatNumber();
  631. },
  632. },
  633. list: {
  634. immediate: true,
  635. deep: true,
  636. handler(newVal) {
  637. if (newVal.length) {
  638. console.log(newVal);
  639. this.newList = newVal;
  640. this.sumweight(newVal);
  641. this.sunTj();
  642. }
  643. },
  644. },
  645. },
  646. mounted() {
  647. if (this.deviceList.length > 0) {
  648. this.list.forEach((item) => {
  649. item.deviceId = this.deviceList[0].id
  650. ? this.deviceList[0].id
  651. : this.deviceList[0].instanceId;
  652. });
  653. }
  654. },
  655. data() {
  656. return {
  657. taskTypeName: null,
  658. isFirstTask: null,
  659. stepsList: [],
  660. clientEnvironmentId:
  661. uni.getStorageSync("userInfo") &&
  662. uni.getStorageSync("userInfo").clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  663. show: false,
  664. rowIt: [],
  665. paramList: [],
  666. paramObj: {},
  667. weight: 0,
  668. reportWeight: 0,
  669. resultObj: {},
  670. resultIdx: 0,
  671. deviceList: [],
  672. isQualifiedList: [
  673. {
  674. code: 1,
  675. name: "合格",
  676. },
  677. {
  678. code: 2,
  679. name: "不合格",
  680. },
  681. ],
  682. notTypeList: [
  683. {
  684. code: 1,
  685. name: "返工",
  686. },
  687. {
  688. code: 2,
  689. name: "返修",
  690. },
  691. {
  692. code: 3,
  693. name: "报废",
  694. },
  695. {
  696. code: 4,
  697. name: "降级使用",
  698. },
  699. {
  700. code: 5,
  701. name: "让步接收",
  702. },
  703. {
  704. code: 6,
  705. name: "留样",
  706. },
  707. {
  708. code: 7,
  709. name: "消耗",
  710. },
  711. {
  712. code: 8,
  713. name: "回用",
  714. },
  715. {
  716. code: 9,
  717. name: "转试销",
  718. },
  719. ],
  720. batchShow: false,
  721. batchForm: {
  722. quantity: "",
  723. batchNo: "",
  724. notReason: "",
  725. isQualified: 1,
  726. notType: "",
  727. },
  728. bacthData: {},
  729. bacthIndex: "",
  730. };
  731. },
  732. created() {
  733. this.taskTypeName = this.item.currentTaskDiagram.taskTypeName;
  734. this.isFirstTask = this.item.currentTaskDiagram.isFirstTask;
  735. console.log(this.list, "this.list");
  736. this.getSteps();
  737. this.getCompute();
  738. setTimeout(() => {
  739. this.handleInput();
  740. }, 800);
  741. },
  742. methods: {
  743. getSteps() {
  744. getTaskInstanceList(this.item.workOrderId).then((res) => {
  745. res.pop();
  746. this.stepsList = res;
  747. });
  748. },
  749. getCompute() {
  750. getComputeParam(
  751. this.item.workOrderId,
  752. this.item.currentTaskDiagram.taskId
  753. ).then((res) => {
  754. this.paramList = [];
  755. this.paramList = (res && res.paramList) || [];
  756. this.paramObj = res || {};
  757. });
  758. },
  759. handAddParam() {
  760. // billet: null,
  761. // density: null,
  762. // result: null,
  763. // PIPDensity: null,
  764. // volume: null,
  765. // coefficient: null
  766. if (this.isFirstTask == 1) {
  767. this.paramList.push({
  768. taskId: null,
  769. taskName: null,
  770. });
  771. }
  772. },
  773. getDelete(idx) {
  774. this.paramList.splice(idx, 1);
  775. },
  776. changeInp(item, index) {
  777. if (Number(item.billet) && Number(item.density)) {
  778. this.paramList[index].CVIWeight = (
  779. (Number(this.weight) / item.billet) *
  780. item.density
  781. ).toFixed(2);
  782. }
  783. },
  784. paramSave() {
  785. if (this.isFirstTask == 1 && this.paramList.length > 0) {
  786. let bol;
  787. let _i;
  788. bol = this.paramList.every((e, i) => {
  789. _i = i + 1;
  790. return e.taskId && e.billet && e.density;
  791. });
  792. if (!bol) {
  793. uni.showToast({
  794. title: `请完善第${_i}计算数据`,
  795. icon: "none",
  796. });
  797. return false;
  798. }
  799. if (this.paramList.length < 1) {
  800. uni.showToast({
  801. title: `请输入二个以上计算数据`,
  802. icon: "none",
  803. });
  804. return false;
  805. }
  806. }
  807. let param = {};
  808. if (!Object.prototype.hasOwnProperty.call(this.paramObj, "id")) {
  809. param = {
  810. paramList: this.paramList,
  811. workOrderId: this.item.workOrderId,
  812. taskId: this.item.currentTaskDiagram.taskId,
  813. };
  814. } else {
  815. this.paramObj.paramList = this.paramList;
  816. param = this.paramObj;
  817. }
  818. saveParam(param).then((res) => {
  819. uni.showToast({
  820. icon: "none",
  821. title: "操作成功",
  822. });
  823. this.getCompute();
  824. });
  825. },
  826. openNumerate(row, idx) {
  827. if (!row.extInfo.reportWeight) {
  828. uni.showToast({
  829. icon: "none",
  830. title: "请先输入报工重量",
  831. });
  832. return false;
  833. }
  834. this.weight = row.extInfo.weight;
  835. this.reportWeight = row.extInfo.reportWeight;
  836. this.resultIdx = idx;
  837. this.show = true;
  838. },
  839. handleInput() {
  840. let arr = JSON.parse(JSON.stringify(this.list));
  841. this.sumweight(arr);
  842. this.sunTj();
  843. console.log("arr11111112222", this.item);
  844. // console.log('this.list33333',this.list)
  845. },
  846. sumweight(arr) {
  847. let formedWeight = 0;
  848. let noFormedWeight = 0;
  849. arr.map((s, i) => {
  850. if (s.extInfo.reportWeight) {
  851. if (s.extInfo.isQualified == 1) {
  852. formedWeight += s.extInfo.reportWeight * 1;
  853. } else {
  854. noFormedWeight += s.extInfo.reportWeight * 1;
  855. }
  856. } else {
  857. s.extInfo.reportWeight = null;
  858. }
  859. this.$set(this.list[i].extInfo, "reportWeight", s.extInfo.reportWeight);
  860. });
  861. if (this.item.workReportInfo) {
  862. this.item.workReportInfo.formedWeight = parseFloat(
  863. formedWeight.toFixed(2)
  864. );
  865. this.item.workReportInfo.notFormedWeight = parseFloat(
  866. noFormedWeight.toFixed(2)
  867. );
  868. }
  869. },
  870. sunTj() {
  871. if (this.item.workReportInfo && this.item.singleReport == 1) {
  872. this.item.workReportInfo.formedNum = this.newList.filter(
  873. (v) => v.extInfo.isQualified == 1
  874. ).length;
  875. this.item.workReportInfo.notFormedNum = this.newList.filter(
  876. (v) => v.extInfo.isQualified !== 1
  877. ).length;
  878. }
  879. },
  880. cancel() {
  881. this.show = false;
  882. this.reportWeight = 0;
  883. this.weight = 0;
  884. },
  885. taskChange(e) {
  886. console.log(e);
  887. },
  888. getDelete2(idx) {
  889. uni.showModal({
  890. title: "删除",
  891. content: "是否确实删除此物料!",
  892. confirmText: "确认", //这块是确定按钮的文字
  893. success: (rr) => {
  894. if (rr.confirm) {
  895. this.list.splice(idx, 1);
  896. }
  897. if (this.list.length == 0) {
  898. this.$set(this.item.workReportInfo, "formedNum", 0);
  899. this.$set(this.item.workReportInfo, "notFormedNum", 0);
  900. }
  901. this.$forceUpdate();
  902. },
  903. });
  904. },
  905. batchClick(item, index) {
  906. this.batchForm.quantity = "";
  907. this.batchForm.notType = "";
  908. this.batchForm.notReason = "";
  909. this.batchForm.isQualified = 1;
  910. this.bacthData = item;
  911. this.bacthIndex = index;
  912. this.batchForm.batchNo = item.batchNo;
  913. this.$refs.inputDialog.open();
  914. },
  915. deleteBatch(index) {
  916. uni.showModal({
  917. title: "删除",
  918. content: "是否确实删除此物料!",
  919. confirmText: "确认", //这块是确定按钮的文字
  920. success: (rr) => {
  921. this.list.splice(index, 1);
  922. this.$set(this.item, "product", this.list);
  923. if (this.list.length == 0) {
  924. this.$set(this.item.workReportInfo, "formedNum", 0);
  925. this.$set(this.item.workReportInfo, "notFormedNum", 0);
  926. }
  927. this.$forceUpdate();
  928. },
  929. });
  930. },
  931. handleClose() {
  932. this.$refs.inputDialog.close();
  933. },
  934. async timeoutCauseConfirm() {
  935. if (!this.batchForm.quantity) {
  936. uni.showToast({
  937. title: "请输入拆批的数量",
  938. icon: "none",
  939. });
  940. return;
  941. }
  942. if (this.batchForm.quantity == 0) {
  943. uni.showToast({
  944. title: "拆批数不能等于0",
  945. icon: "none",
  946. });
  947. return;
  948. }
  949. if (!this.batchForm.quantity) {
  950. uni.showToast({
  951. title: "拆批数不能为空",
  952. icon: "none",
  953. });
  954. return;
  955. }
  956. if (this.bacthData.extInfo.sourceQuantity < this.batchForm.quantity) {
  957. uni.showToast({
  958. title: "拆批数不能大于数量",
  959. icon: "none",
  960. });
  961. return;
  962. }
  963. if (this.batchForm.isQualified == 2 && !this.batchForm.notType) {
  964. uni.showToast({
  965. title: "请选择不合格类型",
  966. icon: "none",
  967. });
  968. return;
  969. }
  970. let dataList = [];
  971. await splitBatch({
  972. product: this.bacthData,
  973. splitQt: Number(this.batchForm.quantity),
  974. batchNo: this.batchForm.batchNo,
  975. isQualified: this.batchForm.isQualified,
  976. notType: this.batchForm.notType,
  977. notReason: this.batchForm.notReason,
  978. }).then((res) => {
  979. res.forEach((item) => {
  980. dataList.push(this.deepCopy(item));
  981. });
  982. this.refreshData(dataList, this.batchForm.quantity);
  983. });
  984. // this.$refs.inputDialog.close()
  985. },
  986. refreshData(list, feedQuantity) {
  987. const number =
  988. Number(this.list[this.bacthIndex].extInfo.sourceQuantity) -
  989. Number(feedQuantity);
  990. this.list[this.bacthIndex].extInfo.sourceQuantity = number;
  991. this.list[this.bacthIndex].feedQuantity = number;
  992. this.list[this.bacthIndex].extInfo.newWeight =
  993. (Number(this.list[this.bacthIndex].extInfo.newWeight) * 100000) /
  994. 100000 -
  995. (Number(list[0].extInfo.newWeight) * 100000) / 100000;
  996. list.forEach((item) => {
  997. item.childBatch = 1;
  998. });
  999. let _arr = [...this.list, ...list];
  1000. this.$set(this.list, this.list.length, ...list);
  1001. this.$set(this.item, "product", _arr);
  1002. this.$forceUpdate();
  1003. this.$refs.inputDialog.close();
  1004. },
  1005. isChange(val) {
  1006. if (val == "合格") {
  1007. this.batchForm.notType = "";
  1008. this.batchForm.notReason = "";
  1009. }
  1010. },
  1011. deepCopy(obj, hash = new WeakMap()) {
  1012. if (obj === null) return null;
  1013. if (obj instanceof Date) return new Date(obj);
  1014. if (obj instanceof RegExp) return new RegExp(obj);
  1015. if (typeof obj !== "object" && typeof obj !== "function") return obj;
  1016. if (hash.has(obj)) return hash.get(obj);
  1017. const result = Array.isArray(obj) ? [] : {};
  1018. hash.set(obj, result);
  1019. return Object.keys(obj).reduce((acc, key) => {
  1020. acc[key] = this.deepCopy(obj[key], hash);
  1021. return acc;
  1022. }, result);
  1023. },
  1024. save() {
  1025. if (this.isFirstTask == 1) {
  1026. this.resultObj = {};
  1027. if (Number(this.reportWeight) < Number(this.paramList[0].CVIWeight)) {
  1028. this.resultObj = this.paramList[0];
  1029. this.setDataSave();
  1030. return false;
  1031. }
  1032. if (
  1033. Number(this.reportWeight) >=
  1034. this.paramList[this.paramList.length - 1].CVIWeight
  1035. ) {
  1036. this.resultObj = this.paramList[this.paramList.length - 1];
  1037. this.setDataSave();
  1038. return false;
  1039. }
  1040. for (let i = 1; i < this.paramList.length; i++) {
  1041. console.log(i);
  1042. console.log(
  1043. 11,
  1044. Number(this.paramList[i - 1].CVIWeight),
  1045. Number(this.reportWeight)
  1046. );
  1047. if (
  1048. Number(this.paramList[i - 1].CVIWeight) <
  1049. Number(this.reportWeight) &&
  1050. Number(this.reportWeight) < Number(this.paramList[i].CVIWeight)
  1051. ) {
  1052. this.resultObj = this.paramList[i];
  1053. break;
  1054. }
  1055. }
  1056. this.setDataSave();
  1057. }
  1058. },
  1059. setDataSave() {
  1060. this.$set(
  1061. this.list[this.resultIdx].extInfo,
  1062. "taskId",
  1063. this.resultObj.taskId
  1064. );
  1065. this.$set(
  1066. this.list[this.resultIdx].extInfo,
  1067. "density",
  1068. this.resultObj.density
  1069. );
  1070. this.$set(
  1071. this.list[this.resultIdx].extInfo,
  1072. "billet",
  1073. this.resultObj.billet
  1074. );
  1075. this.$set(
  1076. this.list[this.resultIdx].extInfo,
  1077. "taskName",
  1078. this.resultObj.taskName
  1079. );
  1080. this.cancel();
  1081. },
  1082. changeHeatNumber() {
  1083. if (this.deviceList.length != 0) {
  1084. this.deviceList.forEach((f) => {
  1085. this.list.forEach((o) => {
  1086. if (
  1087. o.deviceId &&
  1088. f.instanceId == o.deviceId &&
  1089. this.deviceList.length > 1
  1090. ) {
  1091. o.extInfo.heatNumber = f.extInfo.heatNumber;
  1092. o.deviceId = f.instanceId;
  1093. this.$forceUpdate();
  1094. } else if (this.deviceList.length == 1) {
  1095. o.extInfo.heatNumber = this.deviceList[0].extInfo.heatNumber;
  1096. o.deviceId = this.deviceList[0].instanceId;
  1097. this.$forceUpdate();
  1098. } else if (this.deviceList.length > 1) {
  1099. o.extInfo.heatNumber = f.extInfo.heatNumber;
  1100. o.deviceId = f.instanceId;
  1101. this.$forceUpdate();
  1102. }
  1103. });
  1104. });
  1105. }
  1106. },
  1107. },
  1108. };
  1109. </script>
  1110. <style lang="scss" scoped>
  1111. .title_box {
  1112. margin-top: 20rpx;
  1113. .name {
  1114. font-size: 28rpx;
  1115. font-style: normal;
  1116. font-weight: 400;
  1117. color: $theme-color;
  1118. padding-left: 20rpx;
  1119. position: relative;
  1120. &:before {
  1121. position: absolute;
  1122. content: "";
  1123. left: 0rpx;
  1124. top: 0rpx;
  1125. bottom: 0rpx;
  1126. width: 4rpx;
  1127. height: 28rpx;
  1128. background: $theme-color;
  1129. margin: auto;
  1130. }
  1131. }
  1132. .btn_box {
  1133. .btn {
  1134. padding: 0 18rpx;
  1135. height: 50rpx;
  1136. line-height: 50rpx;
  1137. background: $theme-color;
  1138. font-size: 26rpx;
  1139. font-style: normal;
  1140. font-weight: 400;
  1141. font-size: 24rpx;
  1142. color: #fff;
  1143. border-radius: 4rpx;
  1144. margin-left: 24rpx;
  1145. }
  1146. }
  1147. }
  1148. .material {
  1149. margin-top: 16rpx;
  1150. border: 1rpx solid transparent;
  1151. .content_table {
  1152. width: 100%;
  1153. border: 2rpx solid $border-color;
  1154. box-sizing: border-box;
  1155. .item {
  1156. display: flex;
  1157. border-bottom: 2rpx solid $border-color;
  1158. .lable {
  1159. width: 132rpx;
  1160. text-align: center;
  1161. background-color: #f7f9fa;
  1162. font-size: 26rpx;
  1163. border-right: 2rpx solid $border-color;
  1164. flex-shrink: 0;
  1165. }
  1166. .lable150 {
  1167. width: 156rpx !important;
  1168. font-size: 24rpx;
  1169. }
  1170. .lable190 {
  1171. width: 200rpx !important;
  1172. font-size: 24rpx;
  1173. }
  1174. .ww80 {
  1175. width: 80rpx;
  1176. }
  1177. .content {
  1178. width: 518rpx;
  1179. min-height: 64rpx;
  1180. font-size: 28rpx;
  1181. line-height: 28rpx;
  1182. font-style: normal;
  1183. font-weight: 400;
  1184. padding: 18rpx 8rpx;
  1185. box-sizing: border-box;
  1186. word-wrap: break-word;
  1187. flex-grow: 1 !important;
  1188. .unit {
  1189. padding: 0 4rpx;
  1190. font-size: 24rpx;
  1191. color: #404446;
  1192. }
  1193. .penalize {
  1194. width: 160rpx;
  1195. line-height: 60rpx;
  1196. background: $theme-color;
  1197. font-size: 24rpx;
  1198. text-align: center;
  1199. color: #fff;
  1200. }
  1201. }
  1202. .content_H {
  1203. min-height: 92rpx;
  1204. }
  1205. .pd4 {
  1206. padding: 4rpx 8rpx;
  1207. }
  1208. &:last-child {
  1209. border-bottom: none;
  1210. }
  1211. }
  1212. .ww55 {
  1213. width: 55%;
  1214. }
  1215. .ww50 {
  1216. width: 50%;
  1217. }
  1218. .ww45 {
  1219. width: 45%;
  1220. }
  1221. .tag_box {
  1222. padding: 2rpx 10rpx;
  1223. margin-right: 12rpx;
  1224. background: #e6a23c;
  1225. font-size: 22rpx;
  1226. color: #fff;
  1227. border-radius: 4rpx;
  1228. }
  1229. }
  1230. }
  1231. .button-group {
  1232. margin-top: 15px;
  1233. display: flex;
  1234. width: 100%;
  1235. justify-content: space-around;
  1236. }
  1237. .materialBor {
  1238. border: 1rpx solid #157a2c;
  1239. }
  1240. .content_table2 {
  1241. width: 100%;
  1242. .row {
  1243. width: 100%;
  1244. .item {
  1245. color: #404446;
  1246. font-size: 28rpx;
  1247. padding-left: 12rpx;
  1248. }
  1249. .color157 {
  1250. color: $theme-color;
  1251. }
  1252. .ww30 {
  1253. width: 30%;
  1254. }
  1255. .ww20 {
  1256. width: 20%;
  1257. }
  1258. .ww15 {
  1259. width: 15%;
  1260. }
  1261. .ww25 {
  1262. width: 25%;
  1263. }
  1264. .ww50 {
  1265. width: 50%;
  1266. }
  1267. .ww10 {
  1268. width: 10%;
  1269. }
  1270. }
  1271. .head {
  1272. height: 64rpx;
  1273. background: #f7f9fa;
  1274. // border-top: 2rpx solid #E3E5E5;
  1275. border-left: 2rpx solid #e3e5e5;
  1276. box-sizing: border-box;
  1277. .item {
  1278. height: 64rpx;
  1279. line-height: 64rpx;
  1280. border-right: 2rpx solid #e3e5e5;
  1281. box-sizing: border-box;
  1282. font-size: 22rpx;
  1283. }
  1284. }
  1285. .tr {
  1286. border-top: 2rpx solid #e3e5e5;
  1287. border-left: 2rpx solid #e3e5e5;
  1288. .item {
  1289. font-size: 24rpx;
  1290. min-height: 74rpx;
  1291. display: flex;
  1292. align-items: center;
  1293. border-right: 2rpx solid #e3e5e5;
  1294. box-sizing: border-box;
  1295. white-space: normal;
  1296. word-break: break-all;
  1297. }
  1298. &:last-child {
  1299. border-bottom: 2rpx solid #e3e5e5;
  1300. }
  1301. .numerate {
  1302. font-size: 22rpx;
  1303. color: $theme-color;
  1304. }
  1305. }
  1306. }
  1307. .content_num {
  1308. display: flex;
  1309. align-items: center;
  1310. padding: 0 4rpx;
  1311. /deep/ .uni-input-input {
  1312. border: 2rpx solid #f0f8f2;
  1313. background: #f0f8f2;
  1314. color: $theme-color;
  1315. }
  1316. }
  1317. .popup-content {
  1318. @include flex;
  1319. align-items: center;
  1320. justify-content: center;
  1321. flex-direction: column;
  1322. padding: 15px;
  1323. background-color: #fff;
  1324. box-sizing: border-box;
  1325. border-radius: 10px 10px 10px 10px;
  1326. }
  1327. .round {
  1328. width: 32rpx;
  1329. height: 32rpx;
  1330. line-height: 30rpx;
  1331. text-align: center;
  1332. border-radius: 50%;
  1333. background: $theme-color;
  1334. font-size: 24rpx;
  1335. font-style: normal;
  1336. font-weight: 400;
  1337. color: #fff;
  1338. margin-right: 10rpx;
  1339. }
  1340. .popup_box {
  1341. width: 94vw;
  1342. padding: 16rpx 12rpx;
  1343. box-sizing: border-box;
  1344. }
  1345. .operate_box {
  1346. margin-top: 32rpx;
  1347. padding: 10rpx 100rpx;
  1348. /deep/ .u-button {
  1349. width: 160rpx;
  1350. }
  1351. }
  1352. .formula_box {
  1353. font-size: 24rpx;
  1354. font-style: normal;
  1355. font-weight: 400;
  1356. margin-top: 12rpx;
  1357. }
  1358. .reportWeight {
  1359. font-size: 24rpx;
  1360. font-style: normal;
  1361. font-weight: 400;
  1362. margin-top: 30rpx;
  1363. text {
  1364. color: $theme-color;
  1365. }
  1366. }
  1367. ::v-deep .uni-forms-item__label {
  1368. font-size: 12px;
  1369. }
  1370. </style>