details.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="领料" background-color="#F7F9FA"
  4. color="#404446" @clickLeft="back"></uni-nav-bar>
  5. <view class="list_box">
  6. <u-list @scrolltolower="scrolltolower">
  7. <view v-for="(item, index) in List" :key="index" class="card_box">
  8. <view class="title_box rx-bc">
  9. <view class="left rx-sc">
  10. <view class="round">{{ index + 1 }}</view>
  11. <view class="code">工单编号:{{ item.code }}</view>
  12. </view>
  13. <view class="right_box rx-ec">
  14. <u-button type="success" size="small" class="u-reset-button" v-if="isOutsource == 0"
  15. @click="addPicking(item.workOrderId, item)" text="添加物料"></u-button>
  16. </view>
  17. </view>
  18. <view class="material rx-ss" v-for="(mate, idx) in item.bomList" :key="idx">
  19. <view class="left rx-ss" @click="mate.checked = !mate.checked">
  20. <view class="zdy_check rx-cc" :class="{ check_active: mate.checked }">
  21. <u-icon size="28" v-if='mate.checked' name='checkbox-mark'></u-icon>
  22. </view>
  23. </view>
  24. <view class="content_table">
  25. <view class="item">
  26. <view class="lable rx-cc">物料编码</view>
  27. <view class="content">
  28. {{ mate.categoryCode }}
  29. </view>
  30. </view>
  31. <view class="item">
  32. <view class="lable rx-cc">名称</view>
  33. <view class="content">{{ mate.categoryName }}</view>
  34. </view>
  35. <view class="item rx-sc">
  36. <view class="rx ww55 ">
  37. <view class="lable rx-cc">牌号</view>
  38. <view class="content ">{{ mate.brandNum }}</view>
  39. </view>
  40. <view class="rx ww45">
  41. <view class="lable rx-cc ww80">数量</view>
  42. <view class="content content_num">
  43. <input class="uni-input" v-model="mate.demandQuantity" type="digit"></input>
  44. <view class="unit">{{ mate.unit }}</view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="item">
  49. <view class="lable rx-cc">领料仓库</view>
  50. <view class="content pd4">
  51. <zxz-uni-data-select :localdata="mate.warehouseList" v-model="mate.warehouseId"
  52. dataValue='id' format='{name}' dataKey="name" filterable
  53. :clear='false'></zxz-uni-data-select>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view>
  59. <instanceBom :list='item.instanceList2'></instanceBom>
  60. <modelBom :workOrderId='item.workOrderId' :modelList='item.modelList'
  61. :modelList2='item.modelList2' :code='item.code' @hendDel='hendDel'>
  62. </modelBom>
  63. <boatBom :palletList='item.palletList' :palletList2='item.palletList2' :code='item.code'
  64. :resObj='item' @hendDel='hendDel'>
  65. </boatBom>
  66. <packingBom :list='item.packingList2'></packingBom>
  67. <semiProductBom
  68. :list="[...item.semiProductList2, ...item.productList2, ...item.junkProductList2]">
  69. </semiProductBom>
  70. <view style="height: 80rpx;"></view>
  71. <view class='flex_btn' v-if='isPick' @click="openDetails">已有领料单</view>
  72. </view>
  73. </view>
  74. <view class="out_box" v-if="isOutsource == 1">
  75. <view class="out_text" @click="getListOutsource()">重新获取委外领料单</view>
  76. </view>
  77. </u-list>
  78. </view>
  79. <view class="bottom-wrapper">
  80. <view class="btn_box" @click="save">提交</view>
  81. </view>
  82. <outsourceOrder ref="outsourceRef" @outsourceEmit="outsourceFn"></outsourceOrder>
  83. </view>
  84. </template>
  85. <script>
  86. import instanceBom from './components/instanceBom.vue'
  87. import modelBom from './components/modelBom.vue'
  88. import boatBom from './components/boatBom.vue'
  89. import packingBom from './components/packingBom'
  90. import semiProductBom from './components/semiProductBom'
  91. import outsourceOrder from './components/outsourceOrder'
  92. import {
  93. znPdaPage,
  94. workorderList,
  95. listOutsourceInWarehouse,
  96. listOutsource
  97. } from '@/api/pda/workOrder.js'
  98. import {
  99. batchSave,
  100. pickDetails,
  101. findVoucherList
  102. } from '@/api/pda/picking.js'
  103. export default {
  104. components: {
  105. instanceBom,
  106. modelBom,
  107. boatBom,
  108. packingBom,
  109. semiProductBom,
  110. outsourceOrder
  111. },
  112. data() {
  113. return {
  114. idsList: [],
  115. List: [],
  116. classificationList: [], //分类数据
  117. taskId: null,
  118. isPick: false,
  119. isOutsource: 0,
  120. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
  121. .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  122. }
  123. },
  124. onLoad(options) {
  125. let queryArray = decodeURIComponent(options.arr);
  126. this.idsList = JSON.parse(queryArray);
  127. this.isOutsource = Number(options.isOutsource) || 0
  128. this.taskId = options.taskId
  129. console.log(this.clientEnvironmentId, 'this.clientEnvironmentId');
  130. if (this.clientEnvironmentId == 21) {
  131. this.getZnList()
  132. } else {
  133. this.getList()
  134. }
  135. if (this.idsList.length == 1) {
  136. this.getPick()
  137. }
  138. if (this.isOutsource == 1) {
  139. this.getListOutsource()
  140. }
  141. },
  142. onShow() {
  143. uni.$off("setSelectList");
  144. uni.$on("setSelectList", (selectList, id) => {
  145. this.List.forEach(m => {
  146. if (m.workOrderId == id) {
  147. let instanceList2 = [] // 投料
  148. let modelList2 = [] // 模具
  149. let palletList2 = []
  150. let packingList2 = [] // 包装
  151. let semiProductList2 = [] //半成品
  152. let productList2 = [] // 产品
  153. let junkProductList2 = [] //废品
  154. selectList.forEach(f => {
  155. if (![5, 8, 13, 23, 9, 28].includes(f.rootCategoryLevelId)) {
  156. f.automatic = 1
  157. instanceList2 = instanceList2.concat(f)
  158. } else if (f.rootCategoryLevelId == 5) { // 模具
  159. f.automatic = 1
  160. modelList2 = modelList2.concat(f)
  161. } else if (f.rootCategoryLevelId == 8) { // 舟皿
  162. f.automatic = 1
  163. palletList2 = palletList2.concat(f)
  164. } else if (f.rootCategoryLevelId == 13) {
  165. f.automatic = 1
  166. packingList2 = packingList2.concat(f)
  167. } else if (f.rootCategoryLevelId == 23) {
  168. f.automatic = 1
  169. semiProductList2 = semiProductList2.concat(f)
  170. } else if (f.rootCategoryLevelId == 9) {
  171. f.automatic = 1
  172. productList2 = productList2.concat(f)
  173. } else if (f.rootCategoryLevelId == 28) {
  174. f.automatic = 1
  175. junkProductList2 = junkProductList2.concat(f)
  176. }
  177. })
  178. this.$set(m, 'instanceList2', instanceList2)
  179. this.$set(m, 'modelList2', modelList2)
  180. this.$set(m, 'palletList2', palletList2)
  181. this.$set(m, 'packingList2', packingList2)
  182. this.$set(m, 'semiProductList2', semiProductList2)
  183. this.$set(m, 'productList2', productList2)
  184. this.$set(m, 'junkProductList2', junkProductList2)
  185. }
  186. })
  187. });
  188. },
  189. methods: {
  190. scrolltolower() { },
  191. save() {
  192. let _arr = []
  193. _arr = this.List.map(m => {
  194. if (m.bomList.length > 0) {
  195. let bomList = m.bomList.filter(f => f.checked)
  196. m['bomDetailDTOSList'] = [...bomList, ...m.modelList, ...m.palletList]
  197. }
  198. m.instanceList = [...m.instanceList2, ...m.modelList2, ...m.palletList2, ...m.packingList2, ...
  199. m.semiProductList2, ...m.productList2, ...m.junkProductList2
  200. ]
  201. m.isOutsource = this.isOutsource
  202. return {
  203. ...m
  204. }
  205. })
  206. console.log(this.clientEnvironmentId,'this.clientEnvironmentId');
  207. if (this.clientEnvironmentId == 21) {
  208. console.log(1111111111111111111);
  209. findVoucherList({workOrderId:this.idsList[0]}).then(res => {
  210. uni.navigateTo({
  211. url: `/pages/pda/picking/index/index?pickStatus=1`,
  212. });
  213. })
  214. } else {
  215. batchSave(_arr).then(res => {
  216. uni.navigateTo({
  217. url: `/pages/pda/picking/index/index?pickStatus=1`,
  218. });
  219. })
  220. }
  221. },
  222. // 中赢保存
  223. getZnList() {
  224. znPdaPage({
  225. // ids: ,
  226. workId: this.idsList[0]
  227. }).then(res => {
  228. console.log(res, 'res');
  229. if (res?.length) {
  230. this.List = res.map(m => {
  231. m.workOrderId = m.id
  232. let modelList = []
  233. let palletList = []
  234. // let bomList = []
  235. // m.bomDetailDTOS.forEach((f, i) => {
  236. // if (f.rootCategoryLevelId == 5) {
  237. // f.automatic = 2
  238. // modelList = modelList.concat(f)
  239. // }
  240. // if (f.rootCategoryLevelId == 8) {
  241. // f.automatic = 2
  242. // palletList = palletList.concat(f)
  243. // }
  244. // if (f.rootCategoryLevelId != 5 && f.rootCategoryLevelId != 8) {
  245. // f.automatic = 2
  246. // bomList = bomList.concat(f)
  247. // }
  248. // })
  249. m['modelList'] = modelList
  250. m['palletList'] = palletList
  251. // m['bomList'] = bomList
  252. m['modelList2'] = []
  253. m['instanceList2'] = []
  254. m['palletList2'] = []
  255. m['packingList2'] = []
  256. m['semiProductList2'] = []
  257. m['productList2'] = []
  258. m['junkProductList2'] = []
  259. delete m.id
  260. return {
  261. ...m
  262. }
  263. })
  264. console.log(this.List,'1111111111111111');
  265. }
  266. })
  267. },
  268. getList() {
  269. workorderList({
  270. ids: this.idsList,
  271. taskId: this.taskId
  272. }).then(res => {
  273. console.log('领料列表', res)
  274. this.List = res.map(m => {
  275. m.workOrderId = m.id
  276. let modelList = []
  277. let palletList = []
  278. let bomList = []
  279. m.bomDetailDTOS.forEach((f, i) => {
  280. if (f.rootCategoryLevelId == 5) {
  281. f.automatic = 2
  282. modelList = modelList.concat(f)
  283. }
  284. if (f.rootCategoryLevelId == 8) {
  285. f.automatic = 2
  286. palletList = palletList.concat(f)
  287. }
  288. if (f.rootCategoryLevelId != 5 && f.rootCategoryLevelId != 8) {
  289. f.automatic = 2
  290. bomList = bomList.concat(f)
  291. }
  292. })
  293. m['modelList'] = modelList
  294. m['palletList'] = palletList
  295. m['bomList'] = bomList
  296. m['modelList2'] = []
  297. m['instanceList2'] = []
  298. m['palletList2'] = []
  299. m['packingList2'] = []
  300. m['semiProductList2'] = []
  301. m['productList2'] = []
  302. m['junkProductList2'] = []
  303. delete m.id
  304. return {
  305. ...m
  306. }
  307. })
  308. })
  309. },
  310. hendDel(type, code, list) {
  311. if (type == 'modelBom') {
  312. console.log(list.length)
  313. if (list.length == 0) {
  314. }
  315. this.List.forEach(f => {
  316. if (f.code == code) {
  317. if (list.length == 0) {
  318. f.modelList2 = []
  319. f.modelList = []
  320. return false
  321. }
  322. f.modelList2 = list.filter(t => t.automatic == 1)
  323. f.modelList = list.filter(t => t.automatic == 2)
  324. }
  325. })
  326. }
  327. if (type == 'boatBom') {
  328. this.List.forEach(f => {
  329. if (f.code == code) {
  330. if (list.length == 0) {
  331. f.palletList2 = []
  332. f.palletList = []
  333. return false
  334. }
  335. f.palletList2 = list.filter(t => t.automatic == 1)
  336. f.palletList = list.filter(t => t.automatic == 2)
  337. }
  338. })
  339. }
  340. this.$forceUpdate()
  341. },
  342. getListOutsource(list) {
  343. let param = {
  344. workOrderId: this.idsList,
  345. taskId: this.taskId
  346. }
  347. listOutsource(param).then(res => {
  348. if (res) {
  349. this.$refs.outsourceRef.open(res)
  350. } else {
  351. uni.showToast({
  352. title: '暂无委外申请单',
  353. icon: 'none'
  354. })
  355. }
  356. })
  357. },
  358. outsourceFn(list) {
  359. this.outsourceInWarehouseFn(list)
  360. },
  361. addPicking(id, item) {
  362. const storageKey = Date.now() + "";
  363. let arr = [...item.instanceList2, ...item.modelList2, ...item.palletList2, ...item.packingList2, ...item
  364. .semiProductList2, ...item.productList2, ...item.junkProductList2
  365. ]
  366. uni.setStorageSync(storageKey, arr);
  367. uni.navigateTo({
  368. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=pick&taskId=${this.taskId}`
  369. })
  370. },
  371. getPick() {
  372. pickDetails(this.idsList).then(res => {
  373. if (res && res.length > 0) {
  374. this.isPick = true
  375. }
  376. })
  377. },
  378. outsourceInWarehouseFn(list) {
  379. let param = {
  380. outsourceOrder: list || [],
  381. workOrderId: this.idsList[0],
  382. taskId: this.taskId
  383. }
  384. listOutsourceInWarehouse(param).then(res => {
  385. res.list.map(m => {
  386. m.isOut = 1
  387. return {
  388. ...m
  389. }
  390. })
  391. let _arr = [...this.List[0].instanceList2, ...res.list]
  392. this.$set(this.List[0], 'instanceList2', _arr)
  393. this.$forceUpdate()
  394. })
  395. },
  396. openDetails() {
  397. let url = `/pages/pda/picking/bill/index?id=${this.idsList[0]}`
  398. uni.navigateTo({
  399. url
  400. })
  401. },
  402. },
  403. beforeDestroy() {
  404. uni.hideLoading();
  405. },
  406. }
  407. </script>
  408. <style lang="scss" scoped>
  409. .content-box {
  410. height: 100vh;
  411. overflow: hidden;
  412. display: flex;
  413. flex-direction: column;
  414. }
  415. .list_box {
  416. flex: 1;
  417. overflow: hidden;
  418. padding: 4rpx 0;
  419. .u-list {
  420. height: 100% !important;
  421. }
  422. .card_box {
  423. padding: 16rpx 24rpx;
  424. }
  425. .title_box {
  426. .round {
  427. width: 32rpx;
  428. height: 32rpx;
  429. line-height: 32rpx;
  430. border-radius: 50%;
  431. background: $theme-color;
  432. color: #fff;
  433. text-align: center;
  434. font-size: 20rpx;
  435. }
  436. .code {
  437. margin-left: 16rpx;
  438. font-family: PingFang SC;
  439. font-size: 28rpx;
  440. font-style: normal;
  441. font-weight: 400;
  442. color: $theme-color;
  443. }
  444. }
  445. .right_box {}
  446. .material {
  447. margin-top: 10rpx;
  448. .left {
  449. width: 40rpx;
  450. }
  451. .zdy_check {
  452. width: 30rpx;
  453. height: 30rpx;
  454. border: 2rpx solid #c8c9cc;
  455. border-radius: 4rpx;
  456. }
  457. .check_active {
  458. background: $theme-color;
  459. border: 2rpx solid $theme-color;
  460. /deep/ .u-icon__icon {
  461. color: #fff !important;
  462. }
  463. }
  464. .content_table {
  465. width: 652rpx;
  466. border: 2rpx solid $border-color;
  467. .item {
  468. display: flex;
  469. border-bottom: 2rpx solid $border-color;
  470. .lable {
  471. width: 132rpx;
  472. text-align: center;
  473. background-color: #F7F9FA;
  474. font-size: 26rpx;
  475. border-right: 2rpx solid $border-color;
  476. flex-shrink: 0;
  477. }
  478. .ww80 {
  479. width: 80rpx;
  480. }
  481. .content {
  482. width: 518rpx;
  483. min-height: 64rpx;
  484. font-size: 28rpx;
  485. line-height: 28rpx;
  486. font-style: normal;
  487. font-weight: 400;
  488. padding: 18rpx 8rpx;
  489. box-sizing: border-box;
  490. word-wrap: break-word;
  491. flex-grow: 1 !important;
  492. }
  493. .content_num {
  494. display: flex;
  495. align-items: center;
  496. padding: 0 4rpx;
  497. /deep/ .uni-input-input {
  498. border: 2rpx solid #F0F8F2;
  499. background: #F0F8F2;
  500. color: $theme-color;
  501. }
  502. .unit {
  503. width: 90rpx;
  504. text-align: center;
  505. font-size: 24rpx;
  506. color: #404446;
  507. }
  508. }
  509. .pd4 {
  510. padding: 4rpx 8rpx;
  511. }
  512. &:last-child {
  513. border-bottom: none;
  514. }
  515. }
  516. .ww55 {
  517. width: 55%;
  518. }
  519. .ww45 {
  520. width: 45%;
  521. }
  522. }
  523. }
  524. }
  525. .bottom-wrapper {
  526. .btn_box {
  527. width: 750rpx;
  528. height: 88rpx;
  529. line-height: 88rpx;
  530. background: $theme-color;
  531. text-align: center;
  532. font-size: 36rpx;
  533. font-style: normal;
  534. font-weight: 400;
  535. color: #fff;
  536. }
  537. }
  538. .flex_btn {
  539. position: fixed;
  540. right: 0;
  541. bottom: 160rpx;
  542. width: 140rpx;
  543. height: 66rpx;
  544. line-height: 66rpx;
  545. border-radius: 22rpx 0 0 22rpx;
  546. background: $theme-color;
  547. text-align: center;
  548. font-size: 22rpx;
  549. font-style: normal;
  550. font-weight: 400;
  551. color: #fff;
  552. }
  553. .out_box {
  554. margin: 20rpx;
  555. display: flex;
  556. justify-content: center;
  557. color: $theme-color;
  558. font-size: 28rpx;
  559. }
  560. </style>