details.vue 13 KB

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