procurementWarehousing copy 2.vue 86 KB

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