detailDialog_new.vue 82 KB

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