detailDialog_new.vue 82 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <header-title title="基本信息"></header-title>
  5. <div class="mt20">
  6. <el-form label-width="120px">
  7. <el-col :span="8">
  8. <el-form-item label="入库单:">
  9. <span>{{ infoData.bizNo }}</span>
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="8">
  13. <el-form-item label="入库物品类型:">
  14. <span>{{ handleAssetType(infoData.extInfo.assetType) }}</span>
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="8">
  18. <el-form-item label="入库场景:">
  19. <span>{{ getSceneState(infoData.bizType) }}</span>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="8">
  23. <el-form-item label="销售订单:">
  24. <span>{{ infoData.extInfo.documentSource }}</span>
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="8">
  28. <el-form-item label="权属部门:">
  29. <span>{{ infoData.extInfo.deptName }}</span>
  30. </el-form-item>
  31. </el-col>
  32. <el-col :span="8">
  33. <el-form-item label="入库登记人:">
  34. <span>{{ infoData.extInfo.createUserName }}</span>
  35. </el-form-item>
  36. </el-col>
  37. <!-- <el-col :span="8">
  38. <el-form-item label="创建时间:">
  39. <span>{{ infoData.createTime }}</span>
  40. </el-form-item>
  41. </el-col> -->
  42. <el-col :span="8">
  43. <el-form-item label="入库时间:">
  44. <span>{{ infoData.createTime }}</span>
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="8">
  48. <el-form-item label="状态:">
  49. <span>{{ getAuditStatus(infoData.verifyStatus) }}</span>
  50. </el-form-item>
  51. </el-col>
  52. <el-col :span="8">
  53. <el-form-item label="审核人:">
  54. <span>{{ infoData.verifyName }}</span>
  55. </el-form-item>
  56. </el-col>
  57. <el-col :span="8" v-if="infoData.bizType == 2">
  58. <el-form-item label="客户:">
  59. <span>{{ infoData.clientName }}</span>
  60. </el-form-item>
  61. </el-col>
  62. <el-col :span="8" v-if="infoData.bizType == 2">
  63. <el-form-item label="供应商:">
  64. <span>{{ infoData.extInfo.supplierName }}</span>
  65. </el-form-item>
  66. </el-col>
  67. <el-col :span="8">
  68. <el-form-item label="送货人:">
  69. <span>{{ infoData.fromUser }}</span>
  70. </el-form-item>
  71. </el-col>
  72. <el-col :span="8">
  73. <el-form-item label="送货人联系方式:">
  74. <span>{{ infoData.extInfo.deliveryPhone }}</span>
  75. </el-form-item>
  76. </el-col>
  77. <el-col :span="8">
  78. <el-form-item label="附件:">
  79. <!-- <el-link
  80. type="primary"
  81. v-for="(item, index) in infoData.contentImage"
  82. @click="contentImageDownload(item)"
  83. :key="item.name"
  84. >{{ item.name }}</el-link
  85. > -->
  86. </el-form-item>
  87. </el-col>
  88. <el-col :span="8">
  89. <el-form-item
  90. prop="qualityFile"
  91. label="回执附件"
  92. :rules="{
  93. required: true,
  94. trigger: 'blur'
  95. }"
  96. >
  97. <fileUpload
  98. v-model="qualityFile"
  99. module="main"
  100. :showLib="false"
  101. :limit="10"
  102. />
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="24">
  106. <el-form-item label="备注:">
  107. <span>{{ infoData.remark }}</span>
  108. </el-form-item>
  109. </el-col>
  110. </el-form>
  111. </div>
  112. <div class="material">
  113. <header-title title="产品信息">
  114. <el-button type="primary" @click="addStock" v-if="!isTask"
  115. >添加</el-button
  116. >
  117. </header-title>
  118. <div class="mt10 form-table">
  119. <el-form
  120. ref="warehousingMaterialListRef"
  121. :model="{ warehousingMaterialList: warehousingMaterialList }"
  122. :show-message="false"
  123. >
  124. <el-button
  125. v-if="warehousingMaterialList.length != 0"
  126. type="success"
  127. plain
  128. style="margin-bottom: 20px; float: right; margin-right: 20px"
  129. size="mini"
  130. @click="listSaveArrs"
  131. >批量保存</el-button
  132. >
  133. <el-table
  134. v-if="isWeight"
  135. :header-cell-style="rowClass"
  136. ref="warehousingMaterialListTable"
  137. :key="formData.extInfo.assetType"
  138. :data="warehousingMaterialList"
  139. tooltip-effect="dark"
  140. style="width: 100%"
  141. stripe
  142. >
  143. <el-table-column
  144. label="序号"
  145. type="index"
  146. width="50"
  147. align="center"
  148. >
  149. </el-table-column>
  150. <el-table-column
  151. label="编码"
  152. prop="assetCode"
  153. align="center"
  154. width="130"
  155. ></el-table-column>
  156. <el-table-column
  157. label="名称"
  158. align="center"
  159. width="200"
  160. prop="assetName"
  161. ></el-table-column>
  162. <!-- <el-table-column
  163. label="客户编码"
  164. align="center"
  165. width="150"
  166. prop="customCode"
  167. v-if="formData.bizType == 1"
  168. >
  169. <template slot-scope="{ row, $index }">
  170. <template v-if="row.isSave">
  171. {{ row.customCode }}
  172. </template>
  173. <el-form-item
  174. v-else
  175. :prop="`warehousingMaterialList.${$index}.customCode`"
  176. required
  177. >
  178. <el-input v-model="row.customCode"> </el-input>
  179. </el-form-item>
  180. </template>
  181. </el-table-column>
  182. <el-table-column
  183. label="供应商编码"
  184. align="center"
  185. width="150"
  186. prop="customCode"
  187. v-if="formData.bizType == 2"
  188. >
  189. <template slot-scope="{ row, $index }">
  190. <template v-if="row.isSave">
  191. {{ row.supplierCode }}
  192. </template>
  193. <el-form-item
  194. v-else
  195. :prop="`warehousingMaterialList.${$index}.supplierCode`"
  196. required
  197. >
  198. <el-input v-model="row.supplierCode"> </el-input>
  199. </el-form-item>
  200. </template>
  201. </el-table-column> -->
  202. <el-table-column
  203. v-for="(item, index) in tableHeader"
  204. :key="index"
  205. align="center"
  206. :label="item.label"
  207. width="150"
  208. :prop="item.prop"
  209. >
  210. <template slot-scope="{ row }">
  211. <template v-if="item.formatter">{{
  212. item.formatter(row)
  213. }}</template>
  214. <template v-else>{{ row[item.prop] }}</template>
  215. </template>
  216. </el-table-column>
  217. <el-table-column
  218. label="批次号"
  219. prop="batchNo"
  220. width="70"
  221. align="center"
  222. >
  223. <template slot-scope="{ row, $index }">
  224. <template v-if="row.isSave">
  225. {{ row.batchNo }}
  226. </template>
  227. <el-form-item
  228. v-else
  229. :prop="`warehousingMaterialList.${$index}.batchNo`"
  230. required
  231. >
  232. <!-- <el-input v-model="row.batchNo"></el-input> -->
  233. {{ row.batchNo }}
  234. </el-form-item>
  235. </template>
  236. </el-table-column>
  237. <el-table-column
  238. label="最小包装单元"
  239. align="center"
  240. prop="minPackingCount"
  241. width="100"
  242. >
  243. <el-table-column label="" prop="minPackingCount" width="100">
  244. <template slot-scope="{ row, $index }">
  245. <template v-if="row.isSave">
  246. {{ row.minPackingCount }}
  247. </template>
  248. <el-form-item
  249. v-else
  250. :prop="`warehousingMaterialList.${$index}.minPackingCount`"
  251. required
  252. >
  253. <el-input
  254. v-model="row.minPackingCount"
  255. @input="minPackingCountChange(row, $event)"
  256. >
  257. </el-input>
  258. </el-form-item>
  259. </template>
  260. </el-table-column>
  261. <el-table-column label="" prop="minPackingCount">
  262. <template slot-scope="{ row, $index }">
  263. {{ handleRowUnit(row) }} /{{ row.minPackUnit }}
  264. </template>
  265. </el-table-column>
  266. </el-table-column>
  267. <el-table-column
  268. label="包装数量"
  269. prop="outInNum"
  270. width="150"
  271. align="center"
  272. >
  273. <template slot-scope="{ row, $index }">
  274. <template v-if="row.isSave || formData.bizType == 5">
  275. {{ row.outInNum }} {{ row.minPackUnit }}
  276. </template>
  277. <el-form-item
  278. v-else
  279. :prop="`warehousingMaterialList.${$index}.outInNum`"
  280. required
  281. >
  282. <el-input
  283. v-model="row.outInNum"
  284. @input="packNum(row, $event)"
  285. >
  286. <template slot="append">
  287. {{ row.minPackUnit ? row.minPackUnit : '/' }}
  288. </template>
  289. </el-input>
  290. </el-form-item>
  291. </template>
  292. </el-table-column>
  293. <el-table-column label="计量数量" prop="counts">
  294. <template slot-scope="{ row, $index }">
  295. {{ row.minPackingCount * row.outInNum }}
  296. </template>
  297. </el-table-column>
  298. <el-table-column
  299. label="计量单位"
  300. prop="batchNo"
  301. width="100"
  302. align="center"
  303. >
  304. <!-- v-if="formData.extInfo.assetType == 1" -->
  305. <template slot-scope="{ row, $index }">
  306. <template>
  307. {{ row.measuringUnit }}
  308. </template>
  309. </template>
  310. </el-table-column>
  311. <!-- <el-table-column
  312. label="计量单位"
  313. prop="batchNo"
  314. width="100"
  315. align="center"
  316. v-if="formData.extInfo.assetType == 4"
  317. >
  318. <template slot-scope="{ row, $index }">
  319. <template>
  320. {{ row.measuringUnit }}
  321. </template>
  322. </template>
  323. </el-table-column> -->
  324. <!-- <el-table-column
  325. label="数量"
  326. prop="batchNo"
  327. width="150"
  328. align="center"
  329. v-if="formData.extInfo.assetType == 1"
  330. >
  331. <template slot-scope="{ row, $index }">
  332. <template> {{ row.outInNum }} </template>
  333. </template>
  334. </el-table-column>
  335. <el-table-column
  336. label="数量"
  337. prop="batchNo"
  338. width="150"
  339. align="center"
  340. v-if="formData.extInfo.assetType == 4"
  341. >
  342. <template slot-scope="{ row, $index }">
  343. <template>
  344. {{ row.minPackingCount * row.outInNum }}
  345. </template>
  346. </template>
  347. </el-table-column> -->
  348. <el-table-column
  349. label="重量"
  350. align="center"
  351. prop="contentImage"
  352. :show-overflow-tooltip="true"
  353. >
  354. <!-- v-if="formData.extInfo.assetType == 1" -->
  355. <template slot-scope="{ row, $index }">
  356. {{ row.weight }}
  357. <template slot="append">
  358. {{ handleRowUnit(row) }}
  359. <!-- {{
  360. { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
  361. }} -->
  362. </template>
  363. </template>
  364. </el-table-column>
  365. <!-- <el-table-column
  366. label="重量"
  367. align="center"
  368. prop="contentImage"
  369. :show-overflow-tooltip="true"
  370. v-if="formData.extInfo.assetType == 4"
  371. >
  372. <template slot-scope="{ row, $index }">
  373. {{
  374. deviceWeight(
  375. row.roughWeight,
  376. row.minPackingCount * row.outInNum
  377. )
  378. }}
  379. <template slot="append"> -->
  380. <!-- {{ handleRowUnit(row) }} -->
  381. <!-- {{
  382. { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
  383. }} -->
  384. <!-- </template>
  385. </template>
  386. </el-table-column> -->
  387. <el-table-column
  388. label="重量单位"
  389. align="center"
  390. prop="contentImage"
  391. :show-overflow-tooltip="true"
  392. >
  393. <template slot-scope="{ row, $index }">
  394. {{ row.weightUnit }}
  395. <template slot="append"> </template>
  396. </template>
  397. </el-table-column>
  398. <el-table-column
  399. label="单价"
  400. prop="univalence"
  401. width="150"
  402. align="center"
  403. >
  404. <template slot-scope="{ row, $index }">
  405. <!-- <template v-if="row.isSave || formData.bizType == 5">
  406. <template v-if="row.univalence || row.univalence === 0">
  407. {{ row.univalence
  408. }}{{
  409. { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
  410. }}
  411. </template>
  412. </template> -->
  413. <!-- v-else -->
  414. <el-form-item
  415. :prop="`warehousingMaterialList.${$index}.univalence`"
  416. >
  417. <el-input
  418. v-model="row.univalence"
  419. placeholder="非必填"
  420. @input="
  421. (value) =>
  422. (row.univalence = value.replace(/[^0-9.]+/g, ''))
  423. "
  424. >
  425. <template slot="append">
  426. 元/{{ handleRowUnit(row) }}
  427. <!-- {{
  428. { yuan: '元', wanyuan: '万元' }[row.univalenceUnit]
  429. }} -->
  430. </template>
  431. </el-input>
  432. </el-form-item>
  433. </template>
  434. </el-table-column>
  435. <el-table-column
  436. label="金额"
  437. align="center"
  438. prop="contentImage"
  439. :show-overflow-tooltip="true"
  440. >
  441. <template slot-scope="{ row, $index }">
  442. {{
  443. calcSumTotal(
  444. row.outInNum,
  445. row.minPackingCount,
  446. row.univalence,
  447. row
  448. )
  449. }}
  450. </template>
  451. </el-table-column>
  452. <el-table-column
  453. label="货位"
  454. prop="warehouseName"
  455. :show-overflow-tooltip="true"
  456. width="250"
  457. required
  458. >
  459. <template slot-scope="{ row, $index }">
  460. <el-form-item
  461. :prop="`warehousingMaterialList.${$index}.houseList`"
  462. :required="true"
  463. >
  464. <div @click="handleWareHouse(row, $index)">
  465. <div
  466. style="color: #ff4949"
  467. v-if="row.houseList.length == 0"
  468. >
  469. ---(必填)
  470. </div>
  471. <div v-else>
  472. <div
  473. class="fontOmitted"
  474. v-for="(item, index) in row.houseList"
  475. :key="index"
  476. >
  477. {{ item.warehouseName }}- {{ item.areaName }}-
  478. {{ item.shelfCode }}- {{ item.cargoSpaceCode
  479. }}<span style="color: #ff4949" v-if="item.num">
  480. - {{ item.num }}(数)</span
  481. >
  482. <br />
  483. </div>
  484. </div>
  485. </div>
  486. </el-form-item>
  487. </template>
  488. </el-table-column>
  489. <el-table-column
  490. label="质检单"
  491. v-if="formData.extInfo.assetType === 3"
  492. prop="contentImage"
  493. :show-overflow-tooltip="true"
  494. >
  495. <template slot-scope="{ row, $index }">
  496. <upload @on-success="(data) => (row.contentImage = [data])"
  497. ><template slot="placeholder">上传</template></upload
  498. >
  499. </template>
  500. </el-table-column>
  501. <el-table-column
  502. label="操作"
  503. width="200"
  504. fixed="right"
  505. align="center"
  506. >
  507. <template slot="header" slot-scope="scope"> 操作 </template>
  508. <template slot-scope="{ row, $index }">
  509. <el-button
  510. type="text"
  511. v-show="!row.isSave"
  512. @click="listSave(row, $index)"
  513. >保存</el-button
  514. >
  515. <el-button
  516. type="text"
  517. v-show="row.isSave"
  518. @click="listEdit(row, $index)"
  519. >编辑</el-button
  520. >
  521. <el-button
  522. type="text"
  523. v-if="formData.bizType == 5"
  524. v-show="!row.isSave"
  525. @click="chooseAssets(row, $index)"
  526. >选择资产编号</el-button
  527. >
  528. <el-button
  529. type="text"
  530. @click="listDel(row, $index)"
  531. v-if="!isTask"
  532. >删除</el-button
  533. >
  534. </template>
  535. </el-table-column>
  536. </el-table>
  537. </el-form>
  538. </div>
  539. <div class="mt20">
  540. <header-title :title="`包装明细`">
  541. <div class="switch_right">
  542. <span v-if="materialCodeReqList.length != 0">
  543. 分拆<el-switch
  544. v-model="isDetail"
  545. active-color="#13ce66"
  546. inactive-color="#ff4949"
  547. @change="handleIsDetail"
  548. style="margin-left: 10px"
  549. >
  550. </el-switch>
  551. </span>
  552. <el-button
  553. style="margin-left: 20px"
  554. type="text"
  555. @click="dateSetting"
  556. v-if="formData.bizType != 5"
  557. >批量设置{{
  558. curDateType === 'manufactureTime' ? '生产日期' : '采购日期'
  559. }}</el-button
  560. >
  561. </div>
  562. </header-title>
  563. <el-table
  564. ref="materialCodeReqListTable"
  565. :data="materialCodeReqList"
  566. tooltip-effect="dark"
  567. :key="formData.bizType"
  568. :header-cell-style="rowClass"
  569. style="width: 100%"
  570. stripe
  571. height="300px"
  572. @selection-change="handleSelectionChange"
  573. >
  574. <el-table-column
  575. label=""
  576. type="selection"
  577. align="center"
  578. width="50"
  579. v-if="formData.bizType != 5"
  580. >
  581. </el-table-column>
  582. <el-table-column label="序号" type="index" width="50">
  583. </el-table-column>
  584. <el-table-column
  585. label="编码"
  586. prop="assetCode"
  587. width="130"
  588. :show-overflow-tooltip="true"
  589. ></el-table-column>
  590. <el-table-column
  591. label="名称"
  592. prop="assetName"
  593. width="150"
  594. :show-overflow-tooltip="true"
  595. ></el-table-column>
  596. <el-table-column
  597. label="批次号"
  598. prop="batchNo"
  599. width="70"
  600. ></el-table-column>
  601. <el-table-column
  602. :label="`包装编码`"
  603. prop="onlyCode"
  604. width="130"
  605. :show-overflow-tooltip="true"
  606. ></el-table-column>
  607. <el-table-column
  608. label="包装数量"
  609. prop="packingCount"
  610. width="80"
  611. ></el-table-column>
  612. <el-table-column
  613. label="包装单位"
  614. prop="packingUnit"
  615. ></el-table-column>
  616. <el-table-column
  617. label="计量数量"
  618. prop="minPackingCount"
  619. ></el-table-column>
  620. <el-table-column
  621. label="计量单位"
  622. prop="measuringUnit"
  623. ></el-table-column>
  624. <el-table-column
  625. v-if="formData.bizType == 2 || formData.bizType == 1"
  626. label="物料代号"
  627. prop="materielCode"
  628. >
  629. <template slot-scope="{ row }">
  630. <el-input
  631. v-if="!row.isPack"
  632. v-model="row.materielCode"
  633. ></el-input>
  634. <span v-else>{{ row.materielCode }}</span>
  635. </template>
  636. </el-table-column>
  637. <el-table-column
  638. v-if="formData.bizType == 2 || formData.bizType == 1"
  639. label="客户代号"
  640. prop="clientCode"
  641. >
  642. <template slot-scope="{ row }">
  643. <el-input
  644. v-if="!row.isPack"
  645. v-model="row.clientCode"
  646. ></el-input>
  647. <span v-else> {{ row.clientCode }}</span>
  648. </template>
  649. </el-table-column>
  650. <el-table-column
  651. v-if="formData.bizType == 1"
  652. label="刻码"
  653. prop="engrave"
  654. >
  655. <template slot-scope="{ row }">
  656. <el-input v-if="!row.isPack" v-model="row.engrave"></el-input>
  657. <span v-else>{{ row.engrave }}</span>
  658. </template>
  659. </el-table-column>
  660. <el-table-column
  661. v-if="formData.bizType == 2 || formData.bizType == 1"
  662. label="重量"
  663. prop="weight"
  664. width="100"
  665. >
  666. <template slot-scope="{ row }">
  667. <el-input
  668. v-if="!row.isPack"
  669. v-model="row.weight"
  670. @input="weightInput($event, row)"
  671. ></el-input>
  672. <span v-else>{{ row.weight }}</span>
  673. </template>
  674. </el-table-column>
  675. <el-table-column
  676. v-if="formData.bizType == 2 || formData.bizType == 1"
  677. label="重量单位"
  678. prop="weightUtil"
  679. >
  680. <template slot-scope="{ row }">
  681. {{ row.weightUtil }}
  682. </template>
  683. </el-table-column>
  684. <el-table-column label="质检结果" prop="result" width="120">
  685. <template slot-scope="{ row }">
  686. <DictSelection
  687. dictName="质检结果"
  688. clearable
  689. v-model="row.result"
  690. v-if="!row.isPack"
  691. @updateVal="changeWrapStatus($event, row)"
  692. />
  693. <span v-else>{{ qualityResults[row.result] }}</span>
  694. </template>
  695. </el-table-column>
  696. <el-table-column label="质检状态" prop="status" width="120">
  697. <template slot-scope="{ row }">
  698. <span>{{ qualityStatus[row.status] }}</span>
  699. </template>
  700. </el-table-column>
  701. <el-table-column
  702. v-if="formData.bizType != 5"
  703. label="生产日期"
  704. prop=""
  705. width="220"
  706. >
  707. <template slot="header" slot-scope="scope">
  708. <el-select filterable v-model="curDateType">
  709. <el-option
  710. value="manufactureTime"
  711. label="生产日期"
  712. ></el-option>
  713. <el-option
  714. value="procurementTime"
  715. label="采购日期"
  716. ></el-option>
  717. </el-select>
  718. </template>
  719. <template slot-scope="{ row }">
  720. <template v-if="formData.bizType == 5">
  721. {{ row[curDateType] }}
  722. </template>
  723. <el-date-picker
  724. v-else
  725. :disabled="row.ispack"
  726. size="small"
  727. v-model="row[curDateType]"
  728. type="datetime"
  729. value-format="yyyy-MM-dd HH:mm:ss"
  730. placeholder="选择日期"
  731. >
  732. </el-date-picker>
  733. </template>
  734. </el-table-column>
  735. <template v-else>
  736. <el-table-column
  737. label="生产日期"
  738. prop="manufactureTime"
  739. width="200"
  740. ></el-table-column>
  741. <el-table-column
  742. label="采购日期"
  743. prop="procurementTime"
  744. width="200"
  745. ></el-table-column>
  746. </template>
  747. <el-table-column label="操作" width="80" fixed="right">
  748. <template slot-scope="{ row }">
  749. <el-button type="text" @click="packCout(row)">
  750. {{ !row.isPack ? '保存' : '编辑' }}
  751. </el-button>
  752. </template>
  753. </el-table-column>
  754. </el-table>
  755. <!-- </el-tab-pane>
  756. </el-tabs> -->
  757. </div>
  758. <div class="mt20" v-if="isDetail">
  759. <header-title :title="`物料明细`"> </header-title>
  760. <el-table
  761. ref="resultArrayTable"
  762. :data="resultArray"
  763. tooltip-effect="dark"
  764. :key="formData.bizType"
  765. :header-cell-style="rowClass"
  766. style="width: 100%"
  767. stripe
  768. height="300px"
  769. @selection-change="handleSelectionChange"
  770. >
  771. <el-table-column label="序号" type="index" width="50">
  772. </el-table-column>
  773. <el-table-column
  774. label="编码"
  775. prop="assetCode"
  776. :show-overflow-tooltip="true"
  777. ></el-table-column>
  778. <el-table-column
  779. label="名称"
  780. prop="assetName"
  781. width="200"
  782. :show-overflow-tooltip="true"
  783. ></el-table-column>
  784. <el-table-column
  785. label="批次号"
  786. prop="batchNo"
  787. width="80"
  788. ></el-table-column>
  789. <el-table-column
  790. label="物料编码"
  791. prop="no"
  792. width="200"
  793. :show-overflow-tooltip="true"
  794. ></el-table-column>
  795. <el-table-column
  796. label="计量数量"
  797. prop="minPackingCount"
  798. width="90"
  799. ></el-table-column>
  800. <el-table-column
  801. width="80"
  802. label="计量单位"
  803. prop="measuringUnit"
  804. ></el-table-column>
  805. <el-table-column
  806. v-if="formData.bizType == 2"
  807. label="物料代号"
  808. prop="meterielCode"
  809. >
  810. <template slot-scope="{ row }">
  811. <el-input
  812. v-model="row.materielCode"
  813. v-if="!row.isPack"
  814. ></el-input>
  815. <span v-else>{{ row.materialCode }}</span>
  816. </template>
  817. </el-table-column>
  818. <el-table-column
  819. v-if="formData.bizType == 2 || formData.bizType == 1"
  820. label="客户代号"
  821. prop="clientCode"
  822. >
  823. <template slot-scope="{ row }">
  824. <el-input
  825. v-model="row.clientCode"
  826. v-if="!row.isPack"
  827. ></el-input>
  828. <span v-else> {{ row.clientCode }}</span>
  829. </template>
  830. </el-table-column>
  831. <el-table-column
  832. v-if="formData.bizType == 1"
  833. label="刻码"
  834. prop="engrave"
  835. >
  836. <template slot-scope="{ row }">
  837. <el-input v-model="row.engrave" v-if="!row.isPack"></el-input>
  838. <span v-else> {{ row.engrave }}</span>
  839. </template>
  840. </el-table-column>
  841. <el-table-column
  842. width="100"
  843. v-if="formData.bizType == 2 || formData.bizType == 1"
  844. label="重量"
  845. prop="weight"
  846. >
  847. <template slot-scope="{ row }">
  848. <el-input v-model="row.weight" v-if="!row.isPack"></el-input>
  849. <span v-else>{{ row.weight }}</span>
  850. </template>
  851. </el-table-column>
  852. <el-table-column
  853. v-if="formData.bizType == 2 || formData.bizType == 1"
  854. label="重量单位"
  855. prop="weightUnit"
  856. width="100"
  857. >
  858. </el-table-column>
  859. <el-table-column label="质检结果" prop="result" width="120">
  860. <template slot-scope="{ row }">
  861. <DictSelection
  862. dictName="质检结果"
  863. clearable
  864. v-model="row.result"
  865. v-if="!row.isPack"
  866. @updateVal="changeWrapStatus($event, row)"
  867. />
  868. <span v-else>{{ qualityResults[row.result] }}</span>
  869. </template>
  870. </el-table-column>
  871. <el-table-column label="质检状态" prop="status" width="120">
  872. <template slot-scope="{ row }">
  873. <span>{{ qualityStatus[row.status] }}</span>
  874. </template>
  875. </el-table-column>
  876. <el-table-column label="操作" width="80" fixed="right">
  877. <template slot-scope="{ row }">
  878. <el-button type="text" @click="materialBtn(row)">
  879. {{ !row.isPack ? '保存' : '编辑' }}
  880. </el-button>
  881. </template>
  882. </el-table-column>
  883. </el-table>
  884. </div>
  885. </div>
  886. <div class="center mt20">
  887. <el-button
  888. type="primary"
  889. v-if="!isTask"
  890. @click="handleSave"
  891. :loading="saveLoading"
  892. >保存</el-button
  893. >
  894. <el-button @click="$router.go(-1)" v-if="!isTask">返回</el-button>
  895. </div>
  896. </el-card>
  897. <selectType
  898. :visibleDialog.sync="visibleDialog"
  899. :title="title"
  900. :tableHeader="tableHeader"
  901. :bizScene="formData.bizType"
  902. :type="[selectEquiType]"
  903. :loadTree.sync="loadTree"
  904. @selectTableData="onSelectTableData"
  905. />
  906. <WareHouseDailog
  907. ref="wareHouseDailogRef"
  908. @houseData="houseData"
  909. ></WareHouseDailog>
  910. <ReturnSelect
  911. ref="returnSelectRef"
  912. :tableHeader="tableHeader"
  913. :curDateType="curDateType"
  914. ></ReturnSelect>
  915. <el-dialog :visible.sync="dateVisible" title="选择日期" width="400px">
  916. <el-date-picker
  917. size="small"
  918. v-model="batchTime"
  919. type="datetime"
  920. style="width: 320px"
  921. value-format="yyyy-MM-dd HH:mm:ss"
  922. placeholder="选择日期"
  923. >
  924. </el-date-picker>
  925. <div style="text-align: right; margin-top: 20px">
  926. <el-button @click="dateVisible = false">取消</el-button>
  927. <el-button type="primary" @click="dateConfirm" :disabled="!batchTime"
  928. >确认</el-button
  929. >
  930. </div>
  931. </el-dialog>
  932. <!-- 销售订单 -->
  933. <picker ref="pickerRef" @success="pickerSuccess" />
  934. </div>
  935. </template>
  936. <script>
  937. import { approveTaskWithVariables } from '@/api/bpm/task';
  938. import { getProductList } from '@/api/bpm/components/saleManage/contact';
  939. import { getLoginUser } from '@/api/login';
  940. import picker from '@/views/bpm/stockManagement/components/picker.vue';
  941. import outin from '@/api/warehouseManagement/outin';
  942. import { getTreeByPid, getTreeByGroup } from '@/api/classifyManage';
  943. import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
  944. import selectUpload from '@/components/selectUpload';
  945. import upload from '@/components/uploadImg';
  946. import { auditStatus } from '@/utils/dict/common';
  947. import {
  948. materialType,
  949. warehousingType,
  950. useDict,
  951. useDictLabel,
  952. inputStatus,
  953. emergencyState,
  954. sceneState
  955. } from '@/utils/dict/index';
  956. // import { getInfo, warehousingAdd, getAssetNum } from '@/api/stockManagement';
  957. import selectTree from '@/components/selectTree';
  958. import selectType from '@/views/bpm/stockManagement/components/selectType.vue';
  959. import WareHouseDailog from '@/views/bpm/stockManagement/components/WareHouseDailog.vue';
  960. import ReturnSelect from '@/views/bpm/stockManagement/components/ReturnSelect.vue';
  961. // import supplier from '@/api/main/supplier';
  962. // import org from '@/api/main/org';
  963. // import user from '@/api/main/user';
  964. import { tableHeader } from '@/views/bpm/handleTask/components/inoutBound/common';
  965. import { getCode } from '@/api/codeManagement/index.js';
  966. import { number } from 'echarts/core';
  967. // import { purchaseorderGetById, contactlink } from '@/api/mes';
  968. import { getReceiveSaleOrderrecordDetail } from '@/api/bpm/components/purchasingManage/purchaseorderreceive';
  969. export default {
  970. components: {
  971. selectUpload,
  972. selectTree,
  973. selectType,
  974. WareHouseDailog,
  975. upload,
  976. ReturnSelect,
  977. picker
  978. },
  979. props: {
  980. businessId: {
  981. default: ''
  982. },
  983. type: {
  984. default: ''
  985. },
  986. taskDefinitionKey: {
  987. default: ''
  988. },
  989. form: {
  990. default: {}
  991. }
  992. },
  993. data() {
  994. return {
  995. formData: {
  996. extInfo: {
  997. assetType: '', //物品类型
  998. deptCode: '', //部门code
  999. deptName: '', //部门名称
  1000. verifyDeptCode: '', //审核部门编码
  1001. verifyDeptName: '', //审核部门名称
  1002. deliveryName: '', //送货人名称
  1003. deliveryPhone: '', //送货人电话
  1004. documentSource: '', //销售订单
  1005. urgent: '', //紧急状态
  1006. supplierId: '', //供应商ID
  1007. supplierName: '', //供应商名称
  1008. createUserName: '', //创建人名字
  1009. contentImage: [] //图片数组
  1010. },
  1011. fromUser: '', //送货人
  1012. bizType: '', //物品类型
  1013. verifyId: '', //审核人Id
  1014. verifyName: '', //审核人名称
  1015. createUserId: '',
  1016. remark: ''
  1017. },
  1018. qualityFile: '', // 回执附件文件
  1019. auditStatus,
  1020. showMaterialTable: true, // 缓存包装明细列表
  1021. isSplit: false, // 是否拆分到物料明细
  1022. qualityStatus: {
  1023. 0: '未检',
  1024. 1: '已检',
  1025. 2: '部分检'
  1026. }, // 质检状态 0未检 1已检
  1027. qualityResults: {
  1028. 0: '合格',
  1029. 1: '不合格',
  1030. 3: '让步接收'
  1031. }, // 质检结果 0合格 1不合格 3让步接收
  1032. isTask: false,
  1033. isWeight: true,
  1034. resultArray: [],
  1035. isDetail: false,
  1036. contactList: [],
  1037. pickerRow: {},
  1038. fromUserList: [],
  1039. codeList: [],
  1040. materialType,
  1041. warehousingType,
  1042. sceneState,
  1043. emergencyState,
  1044. saveLoading: false,
  1045. visibleDialog: false,
  1046. curDateType: 'manufactureTime',
  1047. materialCodeReqListSelected: [],
  1048. // warehouseList: [], //仓库数组
  1049. // warehouse: {},
  1050. title: '',
  1051. tableData2: [],
  1052. uploadList: [],
  1053. supplierList: [],
  1054. warehousingMaterialList: [],
  1055. activeName: 'a',
  1056. loadTree: true,
  1057. selectEquiType: '',
  1058. batchTime: '',
  1059. dateVisible: false,
  1060. treeList: [],
  1061. staffList: [],
  1062. rules: {
  1063. 'extInfo.assetType': {
  1064. required: true,
  1065. message: '请选择物品类型',
  1066. trigger: 'change'
  1067. },
  1068. bizType: {
  1069. required: true,
  1070. message: '请选择入库场景',
  1071. trigger: 'change'
  1072. }
  1073. }
  1074. };
  1075. },
  1076. computed: {
  1077. //获取回执附件
  1078. getQualityFile() {
  1079. return { qualityFile: this.qualityFile, id: this.infoData.id };
  1080. },
  1081. // 条码信息
  1082. materialCodeReqList() {
  1083. return this.warehousingMaterialList
  1084. .map((i) => i.warehouseLedgerDetails || [])
  1085. .flat();
  1086. },
  1087. tableHeader() {
  1088. return tableHeader(this.selectEquiType);
  1089. }
  1090. },
  1091. created() {
  1092. console.log(this.infoData);
  1093. this.getcode();
  1094. // if (this.$route.query.id) {
  1095. // // this._getInfo()
  1096. // } else {
  1097. // let obj = localStorage.getItem('orgInfo')
  1098. // ? JSON.parse(localStorage.getItem('orgInfo'))
  1099. // : {};
  1100. // this.formData.createUserName = obj.name;
  1101. // this.formData.extInfo.deptName = obj.dept?.name;
  1102. // this.formData.deptCode = obj.dept?.code;
  1103. // }
  1104. // this.initData();
  1105. },
  1106. methods: {
  1107. initData() {
  1108. this.formData.bizNo = this.infoData.receiveNo; // 入库单
  1109. this.formData.extInfo.assetType = this.infoData.categoryLevelTopId; // 入库物品类型
  1110. this.formData.bizType = '2'; // 入库场景(销售入库)
  1111. // this.formData.extInfo.documentSource = this.infoData.receiveNo // 销售订单
  1112. this.formData.extInfo.deptName = ''; // 权属部门
  1113. this.formData.extInfo.createUserName = ''; // 入库登记人
  1114. //this.formData.createTime = '' // 入库时间
  1115. //this.formData.verifyStatus = '' // 状态
  1116. //this.formData.verifyName = '' // 审核人
  1117. //this.formData.clientName = '' // 客户
  1118. this.formData.extInfo.supplierName = this.infoData.supplierName; // 供应商
  1119. this.formData.fromUser = ''; // 送货人
  1120. this.formData.extInfo.deliveryPhone = ''; // 送货人联系方式
  1121. this.formData.remark = ''; // 备注
  1122. // 添加物品明细
  1123. if (this.form.productList?.length > 0) {
  1124. this.form.productList.forEach((item) => {
  1125. let obj = {};
  1126. obj.assetCode = item.productCode; // 编码
  1127. obj.assetName = item.productName; // 名称
  1128. obj.modelType = item.modelType; // 型号
  1129. obj.specification = item.specification; // 规格
  1130. obj.brandNum = item.productBrand; // 牌号
  1131. obj.batchNo = ''; // 批次号
  1132. obj.minPackingCount = ''; // 最小包装单元
  1133. obj.measuringUnit = item.measuringUnit; // 包装单位
  1134. obj.minPackUnit = ''; // 最小包装单位
  1135. obj.outInNum = ''; // 包装数量
  1136. obj.weight = ''; // 重量
  1137. obj.weightUnit = ''; // 重量单位
  1138. obj.univalence = item.singlePrice; // 单价
  1139. });
  1140. }
  1141. this.warehousingMaterialList.push(
  1142. ...val.map((next) => {
  1143. next.batchNo = res;
  1144. let cur = {};
  1145. next.realInventoryAmount = next.realInventoryAmount || 0;
  1146. cur = {
  1147. ...next,
  1148. cargoSpaceCode: '', //货位编码
  1149. cargoSpaceId: '', //货位id
  1150. shelfId: '', //货架id
  1151. shelfCode: '', //货架名称
  1152. areaId: '', //库区id
  1153. areaName: '', //库区名称
  1154. warehouseId: '', //仓库id
  1155. warehouseName: '', //仓库名称
  1156. assetType: this.formData.extInfo.assetType,
  1157. expirationDate: '',
  1158. outInNum: '',
  1159. minPackingCount: '',
  1160. bizStatus: 1,
  1161. contentImage: [],
  1162. warehouseLedgerDetails: [],
  1163. houseList: []
  1164. };
  1165. return cur;
  1166. })
  1167. );
  1168. },
  1169. async getcode() {
  1170. const { data } = await getTreeByPid(0);
  1171. this.codeList = data.map((item) => {
  1172. return { dictCode: item.id, dictValue: item.name };
  1173. });
  1174. },
  1175. handleAssetType(r) {
  1176. const code = this.codeList.find((item) => item.dictCode == r);
  1177. return code?.dictValue;
  1178. },
  1179. getAuditStatus: useDictLabel(auditStatus),
  1180. // 包装维度最小包装单元改变——>总重量
  1181. minPackingCountChange(row, value) {
  1182. row.minPackingCount = value.replace(/^(0+)|[^\d]+/g, '');
  1183. if (row.outInNum >= 0 && value >= 0) {
  1184. this.packNum(row, row.outInNum);
  1185. }
  1186. },
  1187. // 选择质检结果改变质检状态
  1188. changeWrapStatus(resultValue, row) {
  1189. switch (resultValue) {
  1190. case '':
  1191. // 清空质检状态
  1192. row.status = '0';
  1193. break;
  1194. default:
  1195. // 默认已检质检状态
  1196. row.status = '1';
  1197. break;
  1198. }
  1199. },
  1200. cancel() {
  1201. this.$emit('cancel');
  1202. },
  1203. weightInput(value, row) {
  1204. const newValue = value.replace(/[^\d.]/g, ''); // 保留数字和小数点
  1205. const decimalCount = (newValue.match(/\./g) || []).length; // 计算小数点的个数
  1206. if (decimalCount > 1) {
  1207. // 如果小数点个数大于1,移除多余的小数点
  1208. const lastIndex = newValue.lastIndexOf('.');
  1209. row.weight =
  1210. newValue.slice(0, lastIndex) + newValue.slice(lastIndex + 1);
  1211. } else if (decimalCount === 1) {
  1212. // 如果小数点个数等于1,允许小数点的输入
  1213. row.weight = newValue;
  1214. } else {
  1215. row.weight = newValue === '' ? 0 : parseFloat(newValue); // 如果输入为空,则设为0
  1216. }
  1217. },
  1218. handleIsDetail(event) {
  1219. this.isSplit = event;
  1220. const list = this.materialCodeReqList;
  1221. if (event) {
  1222. let resultArray = [];
  1223. list.forEach((item) => {
  1224. // 包装维度改成已保存状态
  1225. item.isPack = true;
  1226. // 拆分物料维度并生成列表
  1227. for (let i = 1; i <= Number(item.minPackingCount); i++) {
  1228. resultArray.push({
  1229. onlyCode: item.onlyCode,
  1230. no: item.onlyCode + i.toString().padStart(4, '0'),
  1231. assetCode: item.assetCode,
  1232. assetName: item.assetName,
  1233. batchNo: item.batchNo,
  1234. minPackingCount: 1,
  1235. measuringUnit: item.measuringUnit,
  1236. materielCode: item.materielCode,
  1237. clientCode: item.clientCode,
  1238. weight: item.weight / Number(item.minPackingCount),
  1239. weightUnit: item.weightUnit,
  1240. engrave: item.engrave,
  1241. result: item.result,
  1242. status: item.status,
  1243. isPack: false
  1244. });
  1245. }
  1246. });
  1247. this.resultArray = resultArray;
  1248. // 批量修改包装明细
  1249. this.isWeight = false;
  1250. this.bulkEditingWrap();
  1251. this.$nextTick(() => {
  1252. this.isWeight = true;
  1253. });
  1254. } else {
  1255. // 包装维度改成编辑状态
  1256. list.forEach((item) => {
  1257. item.isPack = false;
  1258. });
  1259. // 清空物料维度列表
  1260. this.resultArray = [];
  1261. }
  1262. },
  1263. //包装明细保存
  1264. packCout(row) {
  1265. //true保存==》反之
  1266. if (!row.isPack) {
  1267. row.isPack = true;
  1268. const code = row.assetCode;
  1269. const batchNo = row.batchNo;
  1270. //做防护,防止weight字符串类型
  1271. this.materialCodeReqList.forEach((ele) => {
  1272. ele.weight = Number(ele.weight);
  1273. });
  1274. // const count = this.materialCodeReqList.reduce(
  1275. // (acc, curr) => acc + curr.weight,
  1276. // 0
  1277. // );
  1278. // 修改产品信息重量(包装维度累计)
  1279. this.isWeight = false;
  1280. this.warehousingMaterialList.forEach((item) => {
  1281. if (item.assetCode == code && item.batchNo == batchNo) {
  1282. let arr = [];
  1283. for (const key in this.materialCodeReqList) {
  1284. if (
  1285. this.materialCodeReqList[key].assetCode == item.assetCode &&
  1286. this.materialCodeReqList[key].batchNo == item.batchNo
  1287. ) {
  1288. arr.push({ ...this.materialCodeReqList[key] });
  1289. }
  1290. }
  1291. const count = arr.reduce(
  1292. (acc, curr) =>
  1293. Number(this.$math.format(+acc + +curr.weight, 14)),
  1294. 0
  1295. );
  1296. this.$set(item, 'weight', count);
  1297. }
  1298. });
  1299. this.$nextTick(() => {
  1300. this.isWeight = true;
  1301. });
  1302. } else {
  1303. row.isPack = false;
  1304. }
  1305. // setTimeout(() => {
  1306. // }, 100);
  1307. },
  1308. // 批量修改包装明细
  1309. bulkEditingWrap() {
  1310. // 批量修改包装明细列表状态(已保存)
  1311. this.materialCodeReqList.forEach((item) => {
  1312. item.isPack = true;
  1313. });
  1314. // 改变产品明细重量
  1315. this.warehousingMaterialList.forEach((outItem) => {
  1316. let arr = [];
  1317. this.materialCodeReqList.forEach((inneritem) => {
  1318. if (
  1319. inneritem.assetCode == outItem.assetCode &&
  1320. inneritem.batchNo == outItem.batchNo
  1321. ) {
  1322. arr.push(inneritem);
  1323. }
  1324. });
  1325. const count = arr.reduce(
  1326. (acc, curr) => Number(this.$math.format(+acc + +curr.weight, 14)),
  1327. 0
  1328. );
  1329. this.$set(outItem, 'weight', count);
  1330. });
  1331. },
  1332. // 批量修改物料明细
  1333. bulkEditingMaterial() {
  1334. // 批量修改物料明细列表状态(已保存)
  1335. this.resultArray.forEach((item) => {
  1336. item.isPack = true;
  1337. });
  1338. // 改变包装明细重量
  1339. this.materialCodeReqList.forEach((outItem) => {
  1340. let arr = [];
  1341. this.resultArray.forEach((inneritem) => {
  1342. if (
  1343. inneritem.assetCode == outItem.assetCode &&
  1344. inneritem.batchNo == outItem.batchNo
  1345. ) {
  1346. arr.push(inneritem);
  1347. }
  1348. });
  1349. const count = arr.reduce(
  1350. (acc, curr) => Number(this.$math.format(+acc + +curr.weight, 14)),
  1351. 0
  1352. );
  1353. this.$set(outItem, 'weight', count);
  1354. });
  1355. },
  1356. // 物料明细保存
  1357. materialBtn(row) {
  1358. console.log(row);
  1359. console.log(this.resultArray);
  1360. console.log(this.materialCodeReqList);
  1361. // true保存 false编辑
  1362. if (!row.isPack) {
  1363. row.isPack = true;
  1364. // 物料维度修改质检改变包装维度质检(结果和状态)
  1365. this.materialCodeReqList.forEach((outItem) => {
  1366. let arr = [];
  1367. this.resultArray.forEach((inneritem) => {
  1368. if (inneritem.onlyCode == outItem.onlyCode) {
  1369. arr.push(inneritem);
  1370. }
  1371. });
  1372. console.log(arr);
  1373. // 首先判断是未填/合格不合格
  1374. let boolen = arr.every((item) => {
  1375. return item.result === '' || item.result === undefined;
  1376. });
  1377. // 判断只要物料全部质检结果(未填)——>包装质检结果(未填) 状态(未检)
  1378. if (boolen) {
  1379. this.$set(outItem, 'result', '');
  1380. this.$set(outItem, 'status', '0');
  1381. } else {
  1382. // 判断只要物料有一个质检结果(不合格)——>包装质检结果(不合格) 状态(已检)
  1383. let boolen = arr.some((item) => {
  1384. return item.result === '1';
  1385. });
  1386. if (boolen) {
  1387. this.$set(outItem, 'result', '1');
  1388. this.$set(outItem, 'status', '1');
  1389. } else {
  1390. // 判断只要物料有一个质检结果(让步接收)——>包装质检结果(让步接收) 状态(已检)
  1391. let boolen = arr.some((item) => {
  1392. return item.result === '3';
  1393. });
  1394. if (boolen) {
  1395. // 让步接收 已检
  1396. this.$set(outItem, 'result', '3');
  1397. this.$set(outItem, 'status', '1');
  1398. } else {
  1399. // 判断只要物料有全部质检结果(合格)——>包装质检结果(合格) 状态(已检)
  1400. let boolen = arr.every((item) => {
  1401. return item.result === '0';
  1402. });
  1403. if (boolen) {
  1404. // 合格 已检
  1405. this.$set(outItem, 'result', '0');
  1406. this.$set(outItem, 'status', '1');
  1407. } else {
  1408. // 合格 部分检
  1409. this.$set(outItem, 'result', '0');
  1410. this.$set(outItem, 'status', '2');
  1411. }
  1412. }
  1413. }
  1414. }
  1415. // this.$set(outItem, 'result', boolen ? '1' : '0');
  1416. });
  1417. // 物料维度修改重量改变包装维度重量
  1418. let onlyCode = row.onlyCode;
  1419. this.materialCodeReqList.forEach((item) => {
  1420. if (item.onlyCode === onlyCode) {
  1421. let arr = [];
  1422. for (const key in this.resultArray) {
  1423. if (this.resultArray[key].onlyCode == item.onlyCode) {
  1424. arr.push({ ...this.resultArray[key] });
  1425. }
  1426. }
  1427. const count = arr.reduce(
  1428. (acc, curr) =>
  1429. Number(this.$math.format(+acc + +curr.weight, 14)),
  1430. 0
  1431. );
  1432. this.$set(item, 'weight', count);
  1433. }
  1434. });
  1435. // 包装维度修改重量改变产品信息
  1436. this.isWeight = false;
  1437. // 批量修改包装明细
  1438. this.bulkEditingWrap();
  1439. this.$nextTick(() => {
  1440. this.isWeight = true;
  1441. });
  1442. } else {
  1443. row.isPack = false;
  1444. }
  1445. },
  1446. packNum(row, value) {
  1447. const total = {
  1448. packingCount: Number(row.minPackingCount),
  1449. outInNum: Number(row.outInNum)
  1450. };
  1451. if (row.measuringUnit == row.weightUnit) {
  1452. row.weight = Number(
  1453. this.$math.format(
  1454. total.packingCount * 1 * total.outInNum.toFixed(2),
  1455. 14
  1456. )
  1457. );
  1458. } else {
  1459. const totals = Number(
  1460. this.$math.format(total.packingCount * total.outInNum, 14)
  1461. );
  1462. row.weight = Number(
  1463. this.$math.format(totals * row.netWeight.toFixed(2), 14)
  1464. );
  1465. }
  1466. return (row.outInNum = value.replace(/^(0+)|[^\d]+/g, ''));
  1467. },
  1468. async searchContact(id) {
  1469. const data = await contactlink({ contactId: id });
  1470. this.contactList = data.data;
  1471. },
  1472. async pickerSuccess(row) {
  1473. this.formData.bizType = '2';
  1474. this.codeListValue(row.categoryLevelTopId);
  1475. this.isTask = true;
  1476. this.pickerRow = row;
  1477. this.formData.extInfo.documentSource = row.orderNo;
  1478. this.formData.sourceBizNo = row.receiveNo;
  1479. this.formData.fromId = row.id;
  1480. this.formData.clientName = row.partaName;
  1481. this.formData.clientCode = row.partaId;
  1482. this.formData.extInfo.supplierName = row.supplierName;
  1483. this.formData.extInfo.supplierId = row.supplierId;
  1484. // await this.searchContact(row.partbId);
  1485. const data = await getReceiveSaleOrderrecordDetail(row.id);
  1486. if (this.warehousingMaterialList.length == 0) {
  1487. let list = data.productList.map((item) => {
  1488. return {
  1489. ...item,
  1490. assetName: item.productName,
  1491. assetCode: item.productCode,
  1492. categoryId: item.productCategoryId,
  1493. minPackUnit: item.packingUnit
  1494. };
  1495. });
  1496. this.onSelectTableData(await this.serachMainCode(list));
  1497. }
  1498. },
  1499. async serachMainCode(arr) {
  1500. let newArr = [];
  1501. // 使用 Promise.all 来等待所有异步操作完成
  1502. await Promise.all(
  1503. arr.map(async (item) => {
  1504. const data = await getProductList({
  1505. pageNum: 1,
  1506. size: 10,
  1507. categoryLevelId: item.categoryLevelPathIdParent,
  1508. code: item.assetCode
  1509. });
  1510. newArr.push(data.list); // 将结果存储到 newArr 中
  1511. })
  1512. );
  1513. let re = [];
  1514. for (const item of newArr) {
  1515. for (const it of item) {
  1516. re.push(it);
  1517. }
  1518. }
  1519. return re.map((item) => {
  1520. return {
  1521. ...item,
  1522. minPackUnit: item.packingUnit,
  1523. assetCode: item.code,
  1524. assetName: item.name
  1525. };
  1526. });
  1527. },
  1528. onClear() {
  1529. this.formData.extInfo.documentSource = '';
  1530. this.pickerRow = {};
  1531. this.formData.clientName = '';
  1532. this.formData.clientCode = '';
  1533. this.formData.extInfo.supplierName = '';
  1534. this.formData.extInfo.supplierId = '';
  1535. this.$forceUpdate();
  1536. },
  1537. handlePicker() {
  1538. this.$refs.pickerRef.open();
  1539. },
  1540. codeListValue(val) {
  1541. this.formData.extInfo.assetType = val.id || val;
  1542. this.$forceUpdate();
  1543. this.title = val?.name;
  1544. this.selectEquiType = val?.id || val;
  1545. },
  1546. //计算生产设备重量
  1547. deviceWeight(row, num) {
  1548. if (row) {
  1549. return Number(row * num);
  1550. } else {
  1551. return row;
  1552. }
  1553. },
  1554. //计算金额
  1555. calcSumTotal(PackingCount, outInNum, univalence) {
  1556. //最小包装单元,包装数量,单价
  1557. const total = {
  1558. PackingCount: Number(PackingCount),
  1559. outInNum: Number(outInNum),
  1560. univalence: Number(univalence == undefined ? 0 : univalence)
  1561. };
  1562. return total.PackingCount * total.outInNum * total.univalence;
  1563. },
  1564. handleRowUnit(row) {
  1565. return row.measuringUnit;
  1566. // if (this.formData.extInfo.assetType == 1) {
  1567. // return row.weightUnit;
  1568. // } else if (this.formData.extInfo.assetType == 4) {
  1569. // return row.measuringUnit;
  1570. // } else {
  1571. // return row.measuringUnit;
  1572. // }
  1573. },
  1574. changeVerfy(it) {
  1575. this.formData.verifyName = it.name;
  1576. },
  1577. //选择供应啥的操作
  1578. ChangeSupplier(data) {
  1579. this.formData.extInfo.supplierName = data.dictValue;
  1580. },
  1581. ChangeSuppliers(data) {
  1582. this.formData.clientName = data.dictValue;
  1583. },
  1584. rowClass({ row, column, rowIndex, columnIndex }) {
  1585. if (rowIndex === 1) {
  1586. return {
  1587. display: 'none',
  1588. background: '#EEEEEE',
  1589. border: 'none'
  1590. };
  1591. }
  1592. return { background: '#EEEEEE', border: 'none' };
  1593. },
  1594. calcSum(a, b, c, row) {
  1595. if (
  1596. (Number.isNaN(+a) && a !== '') ||
  1597. (Number.isNaN(+b) && b !== '') ||
  1598. (Number.isNaN(+c) && c !== '')
  1599. ) {
  1600. return '';
  1601. }
  1602. return a * b * c + { yuan: '元', wanyuan: '万元' }[row.univalenceUnit];
  1603. // return a * b * c;
  1604. },
  1605. // 部门 点击事件
  1606. async auditorDeptClick(data) {
  1607. this.formData.extInfo.verifyDeptCode = data?.id;
  1608. this.formData.extInfo.verifyDeptName = data?.name;
  1609. this.formData.verifyId = '';
  1610. this.formData.verifyName = '';
  1611. this.$refs.formName.validateField('verifyDeptName');
  1612. if (data) {
  1613. this.getStaffList(data);
  1614. }
  1615. },
  1616. async getStaffList(data) {
  1617. let res = await warehouseDefinition.getUserPage({
  1618. groupId: data.id,
  1619. size: 9999,
  1620. page: 1
  1621. });
  1622. this.staffList = res.list;
  1623. },
  1624. // 详情接口
  1625. // async _getInfo () {
  1626. // const res = await getInfo({ id: this.$route.query.id })
  1627. // if (res?.success) {
  1628. // this.warehousingMaterialList = res.data.warehouseLedgerInfos.map(i => {
  1629. // i.isSave = true
  1630. // return i
  1631. // })
  1632. // this.formData = res.data.outInWarehouse
  1633. // this.uploadList = this.formData.contentImage
  1634. // }
  1635. // },
  1636. chooseAssets(row, index) {
  1637. this.$refs.returnSelectRef.open(row, (res) => {
  1638. row.outInNum = res.length;
  1639. this.$set(
  1640. row,
  1641. 'selfWarehouseLedgerDetails',
  1642. res.map((i) => {
  1643. delete i.updateTime;
  1644. delete i.createTime;
  1645. return i;
  1646. })
  1647. );
  1648. });
  1649. },
  1650. // 仓库编辑
  1651. handleWareHouse(row, idx) {
  1652. this.$refs.wareHouseDailogRef.open(row, idx);
  1653. },
  1654. // 入库操作
  1655. listEdit(row) {
  1656. this.$set(row, 'isSave', false);
  1657. row.selfWarehouseLedgerDetails = row.warehouseLedgerDetails;
  1658. row.warehouseLedgerDetails = [];
  1659. },
  1660. listSave(row, index) {
  1661. const fileds = [
  1662. // `warehousingMaterialList.${index}.cargoSpaceCode`,
  1663. `warehousingMaterialList.${index}.batchNo`,
  1664. `warehousingMaterialList.${index}.houseList`
  1665. ];
  1666. if (this.formData.bizType == 1) {
  1667. // fileds.push(...[`warehousingMaterialList.${index}.customCode`]);
  1668. } else if (this.formData.bizType == 2) {
  1669. // fileds.push(...[`warehousingMaterialList.${index}.supplierCode`]);
  1670. }
  1671. if (this.formData.bizType != 5) {
  1672. fileds.push(
  1673. ...[
  1674. `warehousingMaterialList.${index}.outInNum`,
  1675. `warehousingMaterialList.${index}.minPackingCount`
  1676. ]
  1677. );
  1678. } else if (
  1679. this.warehousingMaterialList.some(
  1680. (i) => !i.selfWarehouseLedgerDetails?.length
  1681. )
  1682. ) {
  1683. this.$message.error('请选择资产编号!');
  1684. return;
  1685. }
  1686. Promise.all(
  1687. fileds.map(
  1688. (item) =>
  1689. new Promise(async (resolve, rej) => {
  1690. this.$refs.warehousingMaterialListRef.validateField(
  1691. item,
  1692. (err) => {
  1693. if (err) {
  1694. rej(err);
  1695. } else {
  1696. resolve();
  1697. }
  1698. }
  1699. );
  1700. })
  1701. )
  1702. )
  1703. .then((res) => {
  1704. this.$set(row, 'isSave', true);
  1705. if (this.formData.bizType != 5) {
  1706. this.createMaterialCode(row);
  1707. } else {
  1708. // 退还
  1709. this.createMaterialCodeReturn(row);
  1710. }
  1711. })
  1712. .catch((err) => {
  1713. this.$message.error('请填入必填项!');
  1714. });
  1715. },
  1716. listSaveArrs() {
  1717. const rows = this.warehousingMaterialList;
  1718. const indexes = Array.from(
  1719. { length: this.warehousingMaterialList.length },
  1720. (_, index) => index
  1721. );
  1722. rows.forEach((row, i) => {
  1723. const index = indexes[i];
  1724. const fileds = [
  1725. // `warehousingMaterialList.${index}.cargoSpaceCode`,
  1726. `warehousingMaterialList.${index}.batchNo`,
  1727. `warehousingMaterialList.${index}.houseList`
  1728. ];
  1729. if (this.formData.bizType == 1) {
  1730. // fileds.push(...[`warehousingMaterialList.${index}.customCode`]);
  1731. } else if (this.formData.bizType == 2) {
  1732. // fileds.push(...[`warehousingMaterialList.${index}.supplierCode`]);
  1733. }
  1734. if (this.formData.bizType != 5) {
  1735. fileds.push(
  1736. ...[
  1737. `warehousingMaterialList.${index}.outInNum`,
  1738. `warehousingMaterialList.${index}.minPackingCount`
  1739. ]
  1740. );
  1741. } else if (
  1742. this.warehousingMaterialList.some(
  1743. (i) => !i.selfWarehouseLedgerDetails?.length
  1744. )
  1745. ) {
  1746. this.$message.error('请选择资产编号!');
  1747. return;
  1748. }
  1749. Promise.all(
  1750. fileds.map(
  1751. (item) =>
  1752. new Promise(async (resolve, rej) => {
  1753. this.$refs.warehousingMaterialListRef.validateField(
  1754. item,
  1755. (err) => {
  1756. if (err) {
  1757. rej(err);
  1758. } else {
  1759. resolve();
  1760. }
  1761. }
  1762. );
  1763. })
  1764. )
  1765. )
  1766. .then((res) => {
  1767. this.$set(row, 'isSave', true);
  1768. if (this.formData.bizType != 5) {
  1769. this.createMaterialCode(row);
  1770. } else {
  1771. // 退还
  1772. this.createMaterialCodeReturn(row);
  1773. }
  1774. })
  1775. .catch((err) => {
  1776. // this.$message.error('请填入必填项!');
  1777. });
  1778. });
  1779. },
  1780. // listSaveArrs() {
  1781. // console.log(this.warehousingMaterialList);
  1782. // },
  1783. // 批量设置生产日期
  1784. handleSelectionChange(val) {
  1785. this.materialCodeReqListSelected = val;
  1786. },
  1787. dateSetting() {
  1788. if (!this.materialCodeReqListSelected.length) {
  1789. return this.$message.error(`请选择${this.title}明细!`);
  1790. }
  1791. this.dateVisible = true;
  1792. },
  1793. dateConfirm() {
  1794. this.materialCodeReqListSelected.forEach((item) => {
  1795. this.$set(item, this.curDateType, this.batchTime);
  1796. });
  1797. this.dateVisible = false;
  1798. },
  1799. //入库明细删除
  1800. listDel(row, index) {
  1801. this.warehousingMaterialList.splice(index, 1);
  1802. this.resultArray = [];
  1803. this.isDetail = false;
  1804. },
  1805. // 入库明细生成条码信息
  1806. async createMaterialCode(row) {
  1807. // 添加相同物品、批次号重新更新明细 原料编码
  1808. const list = this.warehousingMaterialList.filter(
  1809. (i) =>
  1810. i.assetCode === row.assetCode &&
  1811. i.batchNo === row.batchNo &&
  1812. i.isSave
  1813. );
  1814. const num = list.reduce((num, pre) => {
  1815. num += row.isUnpack
  1816. ? pre.outInNum * pre.minPackingCount
  1817. : pre.outInNum - 0;
  1818. return num;
  1819. }, 0);
  1820. const nums = list.reduce((num, pre) => {
  1821. num += pre.outInNum * pre.minPackingCount;
  1822. return num;
  1823. }, 0);
  1824. const res = await outin.getAssetNum({
  1825. assetCode: row.assetCode,
  1826. batchNum: row.batchNo,
  1827. num: num
  1828. });
  1829. // row.measuringUnit == 'PCS' ? nums :
  1830. list.forEach((item) => {
  1831. if (item.warehouseLedgerDetails?.length) {
  1832. item.warehouseLedgerDetails.forEach((i) => {
  1833. i.onlyCode = res.shift().onlyCode;
  1834. });
  1835. } else {
  1836. this.$set(
  1837. item,
  1838. 'warehouseLedgerDetails',
  1839. Array.from(
  1840. new Array(
  1841. item.isUnpack
  1842. ? item.outInNum * item.minPackingCount
  1843. : // : item.measuringUnit == 'PCS'
  1844. // ? +item.outInNum * parseInt(item.minPackingCount)
  1845. +item.outInNum
  1846. ),
  1847. (val, idx) => {
  1848. return {
  1849. ...item,
  1850. onlyCode: res.shift().onlyCode,
  1851. bizStatus: 1,
  1852. contentImage: []
  1853. };
  1854. }
  1855. )
  1856. );
  1857. }
  1858. });
  1859. // 添加相同物品,重复批次号 重新更新明细 包装编码
  1860. const batchList = this.warehousingMaterialList.filter(
  1861. (i) => i.batchNo === row.batchNo && i.isSave
  1862. );
  1863. if (batchList.length) {
  1864. const num = batchList.reduce((num, pre) => {
  1865. num += +pre.outInNum;
  1866. return num;
  1867. }, 0);
  1868. const res1 = await outin.getAssetNum({
  1869. batchNum: row.batchNo,
  1870. num
  1871. });
  1872. if (res1) {
  1873. batchList.forEach((item) => {
  1874. let num = res1.shift()?.num;
  1875. let minPackingCount = item.minPackingCount;
  1876. if (item.warehouseLedgerDetails?.length) {
  1877. item.warehouseLedgerDetails.forEach((i, index) => {
  1878. this.$set(i, 'num', num);
  1879. if (item.measuringUnit == item.weightUnit) {
  1880. this.$set(i, 'weight', item.minPackingCount);
  1881. } else {
  1882. this.$set(
  1883. i,
  1884. 'weight',
  1885. typeof 1 * item.minPackingCount * item.netWeight ===
  1886. number
  1887. ? 1
  1888. : 1 * item.minPackingCount * item.netWeight
  1889. );
  1890. }
  1891. this.$set(i, 'weightUtil', item.weightUnit);
  1892. this.$set(i, 'packingCount', 1);
  1893. this.$set(i, 'packingUnit ', item.packingUnit);
  1894. this.$set(i, 'minPackingCount ', item.minPackingCount);
  1895. this.$set(i, 'measuringUnit', item.measuringUnit);
  1896. this.$set(i, 'isPack', false);
  1897. if (this.formData.extInfo.assetType == 1) {
  1898. this.$set(i, 'status', '0');
  1899. } else {
  1900. this.$set(i, 'result', '0');
  1901. this.$set(i, 'status', '1');
  1902. }
  1903. if (!item.isUnpack) {
  1904. if (index < item.warehouseLedgerDetails.length - 1) {
  1905. num = res1.shift()?.num;
  1906. }
  1907. } else {
  1908. // 拆包的包装编码一致
  1909. minPackingCount--;
  1910. if (
  1911. minPackingCount === 0 &&
  1912. index < item.warehouseLedgerDetails.length - 1
  1913. ) {
  1914. minPackingCount = item.minPackingCount;
  1915. num = res1.shift()?.num;
  1916. }
  1917. }
  1918. });
  1919. }
  1920. });
  1921. }
  1922. }
  1923. },
  1924. // 入库明细生成条码信息 退还
  1925. async createMaterialCodeReturn(row) {
  1926. // 添加相同物品重新更新明细 原料编码
  1927. const list = this.warehousingMaterialList.filter(
  1928. (i) => i.batchNo === row.batchNo && i.isSave
  1929. );
  1930. // 退还
  1931. const res = await getAssetNum({
  1932. batchNo: row.batchNo,
  1933. num: list.reduce((num, pre) => {
  1934. num += pre.selfWarehouseLedgerDetails.length;
  1935. return num;
  1936. }, 0)
  1937. });
  1938. if (res?.success) {
  1939. list.forEach((item) => {
  1940. let num = res.data.shift().num;
  1941. let minPackingCount = item.minPackingCount;
  1942. if (item.warehouseLedgerDetails?.length) {
  1943. item.warehouseLedgerDetails.forEach((i, index) => {
  1944. Object.assign(i, {
  1945. num,
  1946. batchNo: item.batchNo,
  1947. cargoSpaceCode: item.cargoSpaceCode, //货位编码
  1948. cargoSpaceId: item.cargoSpaceId, //货位id
  1949. shelfId: item.shelfId, //货架id
  1950. shelfCode: item.shelfCode, //货架名称
  1951. areaId: item.areaId, //库区id
  1952. areaName: item.areaName, //库区名称
  1953. warehouseId: item.warehouseId, //仓库id
  1954. warehouseName: item.warehouseName //仓库名称
  1955. });
  1956. if (!item.isUnpack) {
  1957. // 拆包的包装编码一致
  1958. if (index < item.warehouseLedgerDetails.length - 1) {
  1959. num = res.data.shift()?.num;
  1960. }
  1961. } else {
  1962. minPackingCount--;
  1963. if (
  1964. minPackingCount === 0 &&
  1965. index < item.warehouseLedgerDetails.length - 1
  1966. ) {
  1967. minPackingCount = item.minPackingCount;
  1968. num = res1.data.shift()?.num;
  1969. }
  1970. }
  1971. });
  1972. } else {
  1973. this.$set(
  1974. item,
  1975. 'warehouseLedgerDetails',
  1976. item.selfWarehouseLedgerDetails.map((val, idx) => {
  1977. let obj = {
  1978. ...val,
  1979. bizStatus: 1,
  1980. minPackingCount: item.minPackingCount,
  1981. batchNo: item.batchNo,
  1982. cargoSpaceCode: item.cargoSpaceCode, //货位编码
  1983. cargoSpaceId: item.cargoSpaceId, //货位id
  1984. shelfId: item.shelfId, //货架id
  1985. shelfCode: item.shelfCode, //货架名称
  1986. areaId: item.areaId, //库区id
  1987. areaName: item.areaName, //库区名称
  1988. warehouseId: item.warehouseId, //仓库id
  1989. warehouseName: item.warehouseName, //仓库名称
  1990. materialId: item.materialId,
  1991. num
  1992. };
  1993. if (!item.isUnpack) {
  1994. // 拆包的包装编码一致
  1995. if (idx < item.warehouseLedgerDetails.length - 1) {
  1996. num = res.data.shift()?.num;
  1997. }
  1998. } else {
  1999. minPackingCount--;
  2000. if (
  2001. minPackingCount === 0 &&
  2002. idx < item.warehouseLedgerDetails.length - 1
  2003. ) {
  2004. minPackingCount = item.minPackingCount;
  2005. num = res1.data.shift()?.num;
  2006. }
  2007. }
  2008. return obj;
  2009. })
  2010. );
  2011. }
  2012. });
  2013. }
  2014. },
  2015. handleSave(data) {
  2016. this.$refs.formName.validate(async (valid) => {
  2017. if (valid) {
  2018. if (!this.warehousingMaterialList?.length) {
  2019. return this.$message.error('请添加入库明细!');
  2020. } else if (
  2021. this.warehousingMaterialList.some((item) => !item.isSave)
  2022. ) {
  2023. return this.$message.error('请保存入库明细!');
  2024. }
  2025. this.formatWarehouseMaterialList();
  2026. let arr = this.warehousingMaterialList.map((item) => {
  2027. console.log(item, 'item');
  2028. return {
  2029. netWeight: item.netWeight,
  2030. num: item.num,
  2031. batchNo: item.batchNo,
  2032. code: item.productCode,
  2033. categoryId:
  2034. this.formData.bizType == 2
  2035. ? item.categoryId
  2036. ? item.categoryId
  2037. : item.id
  2038. : item.id,
  2039. count: parseInt(item.outInNum) * parseInt(item.minPackingCount),
  2040. minPackingCount: item.minPackingCount,
  2041. packingCount: item.outInNum,
  2042. price: item.univalence,
  2043. outInDetailRecordAddPOList: item.warehouseLedgerDetails,
  2044. position: `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`,
  2045. remark: '',
  2046. pathIds: `${item.warehouseId},${item.areaId},${item.shelfId},${item.cargoSpaceId}`,
  2047. pathName: `${item.warehouseName},${item.areaName},${item.shelfCode},${item.cargoSpaceCode}`,
  2048. totalMoney:
  2049. item.outInNum * item.minPackingCount * item.univalence,
  2050. weightUnit: item.weightUnit,
  2051. customCode: item.customCode,
  2052. supplierCode: item.supplierCode,
  2053. weight: item.weight
  2054. };
  2055. });
  2056. arr.forEach((item) => {
  2057. if (item.outInDetailRecordAddPOList.length > 0) {
  2058. let list = item.outInDetailRecordAddPOList.map((it) => {
  2059. return this.formatOutInDetailRecordAddPO(it, item);
  2060. });
  2061. item.outInDetailRecordAddPOList = list;
  2062. }
  2063. });
  2064. let obj = { ...this.formData, type: 1 };
  2065. obj.outInDetailAddPOList = arr;
  2066. this.saveLoading = true;
  2067. // 入库来源storageSource 0-正常 1-外部
  2068. obj.storageSource = 1;
  2069. try {
  2070. const res = await outin.save(obj);
  2071. // if (res.code == 0) {
  2072. approveTaskWithVariables(data).then((res) => {
  2073. console.log(res);
  2074. if (res.data.code == 0) {
  2075. this.$message.success('保存成功!');
  2076. this.$emit('success');
  2077. }
  2078. });
  2079. // await outin.outApproves({ outInId: res.data });
  2080. // this.$message.success('保存成功!');
  2081. // this.$emit('success');
  2082. // }
  2083. } catch (error) {
  2084. console.error('保存失败:', error);
  2085. }
  2086. this.saveLoading = false;
  2087. // this.$router.push('/warehouseManagement/stockManagement');
  2088. }
  2089. });
  2090. },
  2091. formatWarehouseMaterialList() {
  2092. for (let key in this.warehousingMaterialList) {
  2093. for (let k in this.warehousingMaterialList[key].houseList) {
  2094. let house = this.warehousingMaterialList[key].houseList[k];
  2095. this.warehousingMaterialList[key].warehouseName =
  2096. house.warehouseName;
  2097. this.warehousingMaterialList[key].areaName = house.areaName;
  2098. this.warehousingMaterialList[key].shelfCode = house.shelfCode;
  2099. this.warehousingMaterialList[key].cargoSpaceCode =
  2100. house.cargoSpaceCode;
  2101. this.warehousingMaterialList[key].warehouseId = house.warehouseId;
  2102. this.warehousingMaterialList[key].areaId = house.areaId;
  2103. this.warehousingMaterialList[key].shelfId = house.shelfId;
  2104. this.warehousingMaterialList[key].cargoSpaceId = house.cargoSpaceId;
  2105. this.warehousingMaterialList[key].num = house.num;
  2106. }
  2107. }
  2108. },
  2109. formatOutInDetailRecordAddPO(it, item) {
  2110. return {
  2111. code: it.onlyCode,
  2112. dateType: this.curDateType === 'manufactureTime' ? 2 : 1,
  2113. dateValue: it[this.curDateType],
  2114. minUnit: it.minPackingCount,
  2115. minPositionId: it.cargoSpaceId,
  2116. name: it.assetName,
  2117. pathIds: item.pathIds,
  2118. unit: it.unit,
  2119. packageNo: it.num,
  2120. clientCode: it.clientCode,
  2121. materielCode: it.materielCode,
  2122. weight: it.weight,
  2123. weightUtil: it.weightUtil,
  2124. engrave: it.engrave,
  2125. materialDetails: this.materialDetails(it.onlyCode),
  2126. packingCount: it.packingCount,
  2127. status: it.status,
  2128. result: it.result
  2129. };
  2130. },
  2131. materialDetails(onlyCode) {
  2132. return this.resultArray.filter((item) => item.onlyCode === onlyCode);
  2133. },
  2134. async getOrderCode() {
  2135. const data = await getCode('in_warehouse');
  2136. return data;
  2137. },
  2138. //添加明细
  2139. async onSelectTableData(val) {
  2140. console.log('===ssa', val);
  2141. const res = await getCode('lot_number_code');
  2142. this.warehousingMaterialList.push(
  2143. ...val.map((next) => {
  2144. next.batchNo = res;
  2145. let cur = {};
  2146. next.realInventoryAmount = next.realInventoryAmount || 0;
  2147. cur = {
  2148. ...next,
  2149. cargoSpaceCode: '', //货位编码
  2150. cargoSpaceId: '', //货位id
  2151. shelfId: '', //货架id
  2152. shelfCode: '', //货架名称
  2153. areaId: '', //库区id
  2154. areaName: '', //库区名称
  2155. warehouseId: '', //仓库id
  2156. warehouseName: '', //仓库名称
  2157. assetType: this.formData.extInfo.assetType,
  2158. expirationDate: '',
  2159. outInNum: '',
  2160. minPackingCount: '',
  2161. bizStatus: 1,
  2162. contentImage: [],
  2163. warehouseLedgerDetails: [],
  2164. houseList: []
  2165. };
  2166. return cur;
  2167. })
  2168. );
  2169. },
  2170. // async initData() {
  2171. // const { data } = await getTreeByGroup({ type: 1 });
  2172. // this.codeList = data;
  2173. // // .map((item) => {
  2174. // // return { dictCode: item.id, dictValue: item.name };
  2175. // // });
  2176. // const res = await warehouseDefinition.tree();
  2177. // this.treeList = this.$util.toTreeData({
  2178. // data: res,
  2179. // idField: 'id',
  2180. // parentIdField: 'parentId'
  2181. // });
  2182. // // const res111 = await warehouseDefinition.list();
  2183. // // this.warehouseList = res111.list;
  2184. // let res22 = await warehouseDefinition.getUserPage({
  2185. // size: -1,
  2186. // page: 1
  2187. // });
  2188. // this.fromUserList = res22.list;
  2189. // const info = await getLoginUser();
  2190. // // const info = JSON.parse(localStorage.getItem('info'));
  2191. // let obj = res.find(
  2192. // (item) => item.id === info.deptId[info.deptId.length - 1]
  2193. // );
  2194. // if (!obj) return;
  2195. // this.formData.extInfo.deptCode = obj.id;
  2196. // this.formData.extInfo.deptName = obj.name;
  2197. // this.formData.extInfo.createUserName = info.name;
  2198. // this.formData.createUserId = info.id;
  2199. // // this.treeList = res;
  2200. // // this.formData.extInfo.deptCode =
  2201. // // this.getTreeList().then((res) => {
  2202. // // if (res?.success) {
  2203. // // this.treeList = res.data;
  2204. // // }
  2205. // // });
  2206. // // this.getSupplier().then((res) => {
  2207. // // if (res?.success) {
  2208. // // this.supplierList = res.data.items;
  2209. // // }
  2210. // // });
  2211. // // this.getStaffList();
  2212. // },
  2213. addStock() {
  2214. // this.$refs.wareHouseDailogRef.open({});
  2215. // return;
  2216. if (!this.title) return this.$message.error('请选择入库产品类型');
  2217. if (!this.formData.bizType)
  2218. return this.$message.error('请选择入库场景');
  2219. this.visibleDialog = true;
  2220. },
  2221. handleChange(data) {
  2222. this.title = data?.dictValue;
  2223. this.selectEquiType = data?.dictCode;
  2224. },
  2225. handleChanges(code) {
  2226. const data = this.codeList.find((item) => item.dictCode == code);
  2227. this.title = data?.dictValue;
  2228. this.selectEquiType = data?.dictCode;
  2229. },
  2230. getSupplier() {
  2231. return new Promise((resolve, reject) => {
  2232. supplier.list({ page: 1, size: 999 }).then((res) => {
  2233. if (res.success) {
  2234. resolve(res);
  2235. }
  2236. });
  2237. });
  2238. },
  2239. getTreeList() {
  2240. return new Promise((resolve, reject) => {
  2241. org.tree().then((res) => {
  2242. if (res.success) {
  2243. resolve(res);
  2244. }
  2245. });
  2246. });
  2247. },
  2248. upload(data) {
  2249. this.formData.contentImage = data;
  2250. this.$refs.formName.validateField('contentImage');
  2251. },
  2252. houseData(argum, idx) {
  2253. this.$set(this.warehousingMaterialList[idx], 'houseList', argum);
  2254. }
  2255. },
  2256. watch: {
  2257. // 解决右侧悬浮操作栏不对称问题
  2258. warehousingMaterialList: {
  2259. handler() {
  2260. this.$nextTick(() => {
  2261. this.$refs.warehousingMaterialListTable.doLayout();
  2262. });
  2263. },
  2264. deep: true
  2265. },
  2266. // 解决右侧悬浮操作栏不对称问题
  2267. materialCodeReqList: {
  2268. handler() {
  2269. this.$nextTick(() => {
  2270. this.$refs.materialCodeReqListTable.doLayout();
  2271. });
  2272. },
  2273. deep: true
  2274. },
  2275. // 解决右侧悬浮操作栏不对称问题
  2276. resultArray: {
  2277. handler() {
  2278. this.$nextTick(() => {
  2279. this.$refs.resultArrayTable.doLayout();
  2280. });
  2281. },
  2282. deep: true
  2283. }
  2284. }
  2285. };
  2286. </script>
  2287. <style lang="scss" scoped>
  2288. ::v-deep.form-table {
  2289. .el-form-item {
  2290. margin-bottom: 0;
  2291. }
  2292. .el-input__inner {
  2293. padding: 0 10px;
  2294. }
  2295. ::-webkit-scrollbar {
  2296. width: 8px;
  2297. height: 8px;
  2298. background-color: transparent;
  2299. }
  2300. }
  2301. .p20 {
  2302. padding: 20px;
  2303. }
  2304. .el-select,
  2305. .el-date-editor {
  2306. width: 100%;
  2307. }
  2308. .el-form-item {
  2309. margin-bottom: 22px;
  2310. }
  2311. .material {
  2312. margin-top: 20px;
  2313. .flex {
  2314. display: flex;
  2315. justify-content: space-between;
  2316. font-size: 14px;
  2317. align-items: center;
  2318. .red {
  2319. color: #ff4949;
  2320. }
  2321. }
  2322. }
  2323. .mt10 {
  2324. margin-top: 10px;
  2325. }
  2326. .mt20 {
  2327. margin-top: 20px;
  2328. }
  2329. .center {
  2330. text-align: center;
  2331. }
  2332. .switch_left li {
  2333. border-right: 1px solid rgba(222, 222, 222, 1);
  2334. border-left: 1px solid rgba(222, 222, 222, 1);
  2335. }
  2336. .fontOmitted {
  2337. text-overflow: ellipsis;
  2338. overflow: hidden;
  2339. word-break: break-all;
  2340. white-space: nowrap;
  2341. }
  2342. .table-fixed {
  2343. .el-table__fixed-right {
  2344. height: 100% !important;
  2345. }
  2346. .el-table__fixed-left {
  2347. height: 100% !important;
  2348. }
  2349. .el-table__fixed {
  2350. height: 100% !important;
  2351. }
  2352. }
  2353. </style>