details.vue 11 KB

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