detailDialog_new.vue 82 KB

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