details.vue 12 KB

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