details.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  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">
  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. workorderList,
  94. listOutsourceInWarehouse,
  95. listOutsource
  96. } from '@/api/pda/workOrder.js'
  97. import {
  98. batchSave,
  99. pickDetails
  100. } from '@/api/pda/picking.js'
  101. export default {
  102. components: {
  103. instanceBom,
  104. modelBom,
  105. boatBom,
  106. packingBom,
  107. semiProductBom,
  108. outsourceOrder
  109. },
  110. data() {
  111. return {
  112. idsList: [],
  113. List: [],
  114. classificationList: [], //分类数据
  115. taskId: null,
  116. isPick: false,
  117. isOutsource: 0,
  118. }
  119. },
  120. onLoad(options) {
  121. let queryArray = decodeURIComponent(options.arr);
  122. this.idsList = JSON.parse(queryArray);
  123. this.isOutsource = Number(options.isOutsource) || 0
  124. this.taskId = options.taskId
  125. this.getList()
  126. if (this.idsList.length == 1) {
  127. this.getPick()
  128. }
  129. if(this.isOutsource == 1) {
  130. this.getListOutsource()
  131. }
  132. },
  133. onShow() {
  134. uni.$off("setSelectList");
  135. uni.$on("setSelectList", (selectList, id) => {
  136. this.List.forEach(m => {
  137. if (m.workOrderId == id) {
  138. let instanceList2 = [] // 投料
  139. let modelList2 = [] // 模具
  140. let palletList2 = []
  141. let packingList2 = [] // 包装
  142. let semiProductList2 = [] //半成品
  143. let productList2 = [] // 产品
  144. let junkProductList2 = [] //废品
  145. selectList.forEach(f => {
  146. if (![5, 8, 13, 23, 9, 28].includes(f.rootCategoryLevelId)) {
  147. f.automatic = 1
  148. instanceList2 = instanceList2.concat(f)
  149. } else if (f.rootCategoryLevelId == 5) { // 模具
  150. f.automatic = 1
  151. modelList2 = modelList2.concat(f)
  152. } else if (f.rootCategoryLevelId == 8) { // 舟皿
  153. f.automatic = 1
  154. palletList2 = palletList2.concat(f)
  155. } else if (f.rootCategoryLevelId == 13) {
  156. f.automatic = 1
  157. packingList2 = packingList2.concat(f)
  158. } else if (f.rootCategoryLevelId == 23) {
  159. f.automatic = 1
  160. semiProductList2 = semiProductList2.concat(f)
  161. } else if (f.rootCategoryLevelId == 9) {
  162. f.automatic = 1
  163. productList2 = productList2.concat(f)
  164. } else if (f.rootCategoryLevelId == 28) {
  165. f.automatic = 1
  166. junkProductList2 = junkProductList2.concat(f)
  167. }
  168. })
  169. this.$set(m, 'instanceList2', instanceList2)
  170. this.$set(m, 'modelList2', modelList2)
  171. this.$set(m, 'palletList2', palletList2)
  172. this.$set(m, 'packingList2', packingList2)
  173. this.$set(m, 'semiProductList2', semiProductList2)
  174. this.$set(m, 'productList2', productList2)
  175. this.$set(m, 'junkProductList2', junkProductList2)
  176. }
  177. })
  178. });
  179. },
  180. methods: {
  181. scrolltolower() {},
  182. save() {
  183. let _arr = []
  184. _arr = this.List.map(m => {
  185. if (m.bomList.length > 0) {
  186. let bomList = m.bomList.filter(f => f.checked)
  187. m['bomDetailDTOSList'] = [...bomList, ...m.modelList, ...m.palletList]
  188. }
  189. m.instanceList = [...m.instanceList2, ...m.modelList2, ...m.palletList2, ...m.packingList2, ...
  190. m.semiProductList2, ...m.productList2, ...m.junkProductList2
  191. ]
  192. m.isOutsource = this.isOutsource
  193. return {
  194. ...m
  195. }
  196. })
  197. batchSave(_arr).then(res => {
  198. uni.navigateTo({
  199. url: `/pages/pda/picking/index/index?pickStatus=1`,
  200. });
  201. })
  202. },
  203. getList() {
  204. workorderList({
  205. ids: this.idsList,
  206. taskId: this.taskId
  207. }).then(res => {
  208. console.log('领料列表', res)
  209. this.List = res.map(m => {
  210. m.workOrderId = m.id
  211. let modelList = []
  212. let palletList = []
  213. let bomList = []
  214. m.bomDetailDTOS.forEach((f, i) => {
  215. if (f.rootCategoryLevelId == 5) {
  216. f.automatic = 2
  217. modelList = modelList.concat(f)
  218. }
  219. if (f.rootCategoryLevelId == 8) {
  220. f.automatic = 2
  221. palletList = palletList.concat(f)
  222. }
  223. if (f.rootCategoryLevelId != 5 && f.rootCategoryLevelId != 8) {
  224. f.automatic = 2
  225. bomList = bomList.concat(f)
  226. }
  227. })
  228. m['modelList'] = modelList
  229. m['palletList'] = palletList
  230. m['bomList'] = bomList
  231. m['modelList2'] = []
  232. m['instanceList2'] = []
  233. m['palletList2'] = []
  234. m['packingList2'] = []
  235. m['semiProductList2'] = []
  236. m['productList2'] = []
  237. m['junkProductList2'] = []
  238. delete m.id
  239. return {
  240. ...m
  241. }
  242. })
  243. })
  244. },
  245. hendDel(type, code, list) {
  246. if (type == 'modelBom') {
  247. console.log(list.length)
  248. if (list.length == 0) {
  249. }
  250. this.List.forEach(f => {
  251. if (f.code == code) {
  252. if (list.length == 0) {
  253. f.modelList2 = []
  254. f.modelList = []
  255. return false
  256. }
  257. f.modelList2 = list.filter(t => t.automatic == 1)
  258. f.modelList = list.filter(t => t.automatic == 2)
  259. }
  260. })
  261. }
  262. if (type == 'boatBom') {
  263. this.List.forEach(f => {
  264. if (f.code == code) {
  265. if (list.length == 0) {
  266. f.palletList2 = []
  267. f.palletList = []
  268. return false
  269. }
  270. f.palletList2 = list.filter(t => t.automatic == 1)
  271. f.palletList = list.filter(t => t.automatic == 2)
  272. }
  273. })
  274. }
  275. this.$forceUpdate()
  276. },
  277. getListOutsource(list) {
  278. let param = {
  279. workOrderId: this.idsList,
  280. taskId: this.taskId
  281. }
  282. listOutsource(param).then(res => {
  283. if(res) {
  284. this.$refs.outsourceRef.open(res)
  285. } else {
  286. uni.showToast({
  287. title: '暂无委外申请单',
  288. icon: 'none'
  289. })
  290. }
  291. })
  292. },
  293. outsourceFn(list) {
  294. this.outsourceInWarehouseFn(list)
  295. },
  296. addPicking(id, item) {
  297. const storageKey = Date.now() + "";
  298. let arr = [...item.instanceList2, ...item.modelList2, ...item.palletList2, ...item.packingList2, ...item
  299. .semiProductList2, ...item.productList2, ...item.junkProductList2
  300. ]
  301. uni.setStorageSync(storageKey, arr);
  302. uni.navigateTo({
  303. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=pick&taskId=${this.taskId}`
  304. })
  305. },
  306. getPick() {
  307. pickDetails(this.idsList).then(res => {
  308. if (res && res.length > 0) {
  309. this.isPick = true
  310. }
  311. })
  312. },
  313. outsourceInWarehouseFn(list) {
  314. let param = {
  315. outsourceOrder: list || [],
  316. workOrderId: this.idsList[0],
  317. taskId: this.taskId
  318. }
  319. listOutsourceInWarehouse(param).then(res => {
  320. res.list.map(m => {
  321. m.isOut = 1
  322. return {
  323. ...m
  324. }
  325. })
  326. let _arr = [...this.List[0].instanceList2, ...res.list]
  327. this.$set(this.List[0], 'instanceList2', _arr)
  328. this.$forceUpdate()
  329. })
  330. },
  331. openDetails() {
  332. let url = `/pages/pda/picking/bill/index?id=${this.idsList[0]}`
  333. uni.navigateTo({
  334. url
  335. })
  336. },
  337. },
  338. beforeDestroy() {
  339. uni.hideLoading();
  340. },
  341. }
  342. </script>
  343. <style lang="scss" scoped>
  344. .content-box {
  345. height: 100vh;
  346. overflow: hidden;
  347. display: flex;
  348. flex-direction: column;
  349. }
  350. .list_box {
  351. flex: 1;
  352. overflow: hidden;
  353. padding: 4rpx 0;
  354. .u-list {
  355. height: 100% !important;
  356. }
  357. .card_box {
  358. padding: 16rpx 24rpx;
  359. }
  360. .title_box {
  361. .round {
  362. width: 32rpx;
  363. height: 32rpx;
  364. line-height: 32rpx;
  365. border-radius: 50%;
  366. background: $theme-color;
  367. color: #fff;
  368. text-align: center;
  369. font-size: 20rpx;
  370. }
  371. .code {
  372. margin-left: 16rpx;
  373. font-family: PingFang SC;
  374. font-size: 28rpx;
  375. font-style: normal;
  376. font-weight: 400;
  377. color: $theme-color;
  378. }
  379. }
  380. .right_box {}
  381. .material {
  382. margin-top: 10rpx;
  383. .left {
  384. width: 40rpx;
  385. }
  386. .zdy_check {
  387. width: 30rpx;
  388. height: 30rpx;
  389. border: 2rpx solid #c8c9cc;
  390. border-radius: 4rpx;
  391. }
  392. .check_active {
  393. background: $theme-color;
  394. border: 2rpx solid $theme-color;
  395. /deep/ .u-icon__icon {
  396. color: #fff !important;
  397. }
  398. }
  399. .content_table {
  400. width: 652rpx;
  401. border: 2rpx solid $border-color;
  402. .item {
  403. display: flex;
  404. border-bottom: 2rpx solid $border-color;
  405. .lable {
  406. width: 132rpx;
  407. text-align: center;
  408. background-color: #F7F9FA;
  409. font-size: 26rpx;
  410. border-right: 2rpx solid $border-color;
  411. flex-shrink: 0;
  412. }
  413. .ww80 {
  414. width: 80rpx;
  415. }
  416. .content {
  417. width: 518rpx;
  418. min-height: 64rpx;
  419. font-size: 28rpx;
  420. line-height: 28rpx;
  421. font-style: normal;
  422. font-weight: 400;
  423. padding: 18rpx 8rpx;
  424. box-sizing: border-box;
  425. word-wrap: break-word;
  426. flex-grow: 1 !important;
  427. }
  428. .content_num {
  429. display: flex;
  430. align-items: center;
  431. padding: 0 4rpx;
  432. /deep/ .uni-input-input {
  433. border: 2rpx solid #F0F8F2;
  434. background: #F0F8F2;
  435. color: $theme-color;
  436. }
  437. .unit {
  438. width: 90rpx;
  439. text-align: center;
  440. font-size: 24rpx;
  441. color: #404446;
  442. }
  443. }
  444. .pd4 {
  445. padding: 4rpx 8rpx;
  446. }
  447. &:last-child {
  448. border-bottom: none;
  449. }
  450. }
  451. .ww55 {
  452. width: 55%;
  453. }
  454. .ww45 {
  455. width: 45%;
  456. }
  457. }
  458. }
  459. }
  460. .bottom-wrapper {
  461. .btn_box {
  462. width: 750rpx;
  463. height: 88rpx;
  464. line-height: 88rpx;
  465. background: $theme-color;
  466. text-align: center;
  467. font-size: 36rpx;
  468. font-style: normal;
  469. font-weight: 400;
  470. color: #fff;
  471. }
  472. }
  473. .flex_btn {
  474. position: fixed;
  475. right: 0;
  476. bottom: 160rpx;
  477. width: 140rpx;
  478. height: 66rpx;
  479. line-height: 66rpx;
  480. border-radius: 22rpx 0 0 22rpx;
  481. background: $theme-color;
  482. text-align: center;
  483. font-size: 22rpx;
  484. font-style: normal;
  485. font-weight: 400;
  486. color: #fff;
  487. }
  488. .out_box{
  489. margin: 20rpx ;
  490. display: flex;
  491. justify-content: center;
  492. color: $theme-color;
  493. font-size: 28rpx;
  494. }
  495. </style>