details.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  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"></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. console.log(selectList)
  129. selectList.forEach(f => {
  130. if (f.rootCategoryLevelId != 5 && f.rootCategoryLevelId != 8 && f
  131. .rootCategoryLevelId != 13 && f.rootCategoryLevelId != 23) {
  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. }
  147. })
  148. this.$set(m, 'instanceList2', instanceList2)
  149. this.$set(m, 'modelList2', modelList2)
  150. this.$set(m, 'palletList2', palletList2)
  151. this.$set(m, 'packingList2', packingList2)
  152. this.$set(m, 'semiProductList2', semiProductList2)
  153. }
  154. })
  155. });
  156. },
  157. methods: {
  158. scrolltolower() {},
  159. save() {
  160. let _arr = []
  161. _arr = this.List.map(m => {
  162. if (m.bomList.length > 0) {
  163. let bomList = m.bomList.filter(f => f.checked)
  164. m['bomDetailDTOSList'] = [...bomList, ...m.modelList, ...m.palletList]
  165. }
  166. m.instanceList = [...m.instanceList2, ...m.modelList2, ...m.palletList2, ...m.packingList2, ...m.semiProductList2]
  167. return {
  168. ...m
  169. }
  170. })
  171. batchSave(_arr).then(res => {
  172. uni.navigateTo({
  173. url: `/pages/pda/picking/index/index?pickStatus=1`,
  174. });
  175. })
  176. },
  177. getList() {
  178. workorderList({
  179. ids: this.idsList,
  180. taskId: this.taskId
  181. }).then(res => {
  182. console.log(2,res)
  183. this.List = res.map(m => {
  184. m.workOrderId = m.id
  185. let modelList = []
  186. let palletList = []
  187. let bomList = []
  188. m.bomDetailDTOS.forEach((f, i) => {
  189. if (f.rootCategoryLevelId == 5) {
  190. f.automatic = 2
  191. modelList = modelList.concat(f)
  192. }
  193. if (f.rootCategoryLevelId == 8) {
  194. f.automatic = 2
  195. palletList = palletList.concat(f)
  196. }
  197. if (f.rootCategoryLevelId != 5 && f.rootCategoryLevelId != 8) {
  198. f.automatic = 2
  199. bomList = bomList.concat(f)
  200. }
  201. })
  202. m['modelList'] = modelList
  203. m['palletList'] = palletList
  204. m['bomList'] = bomList
  205. m['modelList2'] = []
  206. m['instanceList2'] = []
  207. m['palletList2'] = []
  208. m['packingList2'] = []
  209. m['semiProductList2'] = []
  210. delete m.id
  211. return {
  212. ...m
  213. }
  214. })
  215. })
  216. },
  217. hendDel(type, code, list) {
  218. if (type == 'modelBom') {
  219. console.log(list.length)
  220. if (list.length == 0) {
  221. }
  222. this.List.forEach(f => {
  223. if (f.code == code) {
  224. if (list.length == 0) {
  225. f.modelList2 = []
  226. f.modelList = []
  227. return false
  228. }
  229. f.modelList2 = list.filter(t => t.automatic == 1)
  230. f.modelList = list.filter(t => t.automatic == 2)
  231. }
  232. })
  233. }
  234. if (type == 'boatBom') {
  235. this.List.forEach(f => {
  236. if (f.code == code) {
  237. if (list.length == 0) {
  238. f.palletList2 = []
  239. f.palletList = []
  240. return false
  241. }
  242. f.palletList2 = list.filter(t => t.automatic == 1)
  243. f.palletList = list.filter(t => t.automatic == 2)
  244. }
  245. })
  246. }
  247. this.$forceUpdate()
  248. },
  249. addPicking(id, item) {
  250. const storageKey = Date.now() + "";
  251. console.log(item)
  252. let arr = [...item.instanceList2, ...item.modelList2, ...item.palletList2, ...item.packingList2]
  253. uni.setStorageSync(storageKey, arr);
  254. uni.navigateTo({
  255. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=pick&taskId=${this.taskId}`
  256. })
  257. },
  258. getPick() {
  259. pickDetails(this.idsList).then(res => {
  260. if (res && res.length > 0) {
  261. this.isPick = true
  262. }
  263. })
  264. },
  265. openDetails() {
  266. let url = `/pages/pda/picking/bill/index?id=${this.idsList[0]}`
  267. uni.navigateTo({
  268. url
  269. })
  270. },
  271. },
  272. }
  273. </script>
  274. <style lang="scss" scoped>
  275. .content-box {
  276. height: 100vh;
  277. overflow: hidden;
  278. display: flex;
  279. flex-direction: column;
  280. }
  281. .list_box {
  282. flex: 1;
  283. overflow: hidden;
  284. padding: 4rpx 0;
  285. .u-list {
  286. height: 100% !important;
  287. }
  288. .card_box {
  289. padding: 16rpx 24rpx;
  290. }
  291. .title_box {
  292. .round {
  293. width: 32rpx;
  294. height: 32rpx;
  295. line-height: 32rpx;
  296. border-radius: 50%;
  297. background: $theme-color;
  298. color: #fff;
  299. text-align: center;
  300. font-size: 20rpx;
  301. }
  302. .code {
  303. margin-left: 16rpx;
  304. font-family: PingFang SC;
  305. font-size: 28rpx;
  306. font-style: normal;
  307. font-weight: 400;
  308. color: $theme-color;
  309. }
  310. }
  311. .right_box {}
  312. .material {
  313. margin-top: 10rpx;
  314. .left {
  315. width: 40rpx;
  316. }
  317. .zdy_check {
  318. width: 30rpx;
  319. height: 30rpx;
  320. border: 2rpx solid #c8c9cc;
  321. border-radius: 4rpx;
  322. }
  323. .check_active {
  324. background: $theme-color;
  325. border: 2rpx solid $theme-color;
  326. /deep/ .u-icon__icon {
  327. color: #fff !important;
  328. }
  329. }
  330. .content_table {
  331. width: 652rpx;
  332. border: 2rpx solid $border-color;
  333. .item {
  334. display: flex;
  335. border-bottom: 2rpx solid $border-color;
  336. .lable {
  337. width: 132rpx;
  338. text-align: center;
  339. background-color: #F7F9FA;
  340. font-size: 26rpx;
  341. border-right: 2rpx solid $border-color;
  342. flex-shrink: 0;
  343. }
  344. .ww80 {
  345. width: 80rpx;
  346. }
  347. .content {
  348. width: 518rpx;
  349. min-height: 64rpx;
  350. font-size: 28rpx;
  351. line-height: 28rpx;
  352. font-style: normal;
  353. font-weight: 400;
  354. padding: 18rpx 8rpx;
  355. box-sizing: border-box;
  356. word-wrap: break-word;
  357. flex-grow: 1 !important;
  358. }
  359. .content_num {
  360. display: flex;
  361. align-items: center;
  362. padding: 0 4rpx;
  363. /deep/ .uni-input-input {
  364. border: 2rpx solid #F0F8F2;
  365. background: #F0F8F2;
  366. color: $theme-color;
  367. }
  368. .unit {
  369. width: 90rpx;
  370. text-align: center;
  371. font-size: 24rpx;
  372. color: #404446;
  373. }
  374. }
  375. .pd4 {
  376. padding: 4rpx 8rpx;
  377. }
  378. &:last-child {
  379. border-bottom: none;
  380. }
  381. }
  382. .ww55 {
  383. width: 55%;
  384. }
  385. .ww45 {
  386. width: 45%;
  387. }
  388. }
  389. }
  390. }
  391. .bottom-wrapper {
  392. .btn_box {
  393. width: 750rpx;
  394. height: 88rpx;
  395. line-height: 88rpx;
  396. background: $theme-color;
  397. text-align: center;
  398. font-size: 36rpx;
  399. font-style: normal;
  400. font-weight: 400;
  401. color: #fff;
  402. }
  403. }
  404. .flex_btn {
  405. position: fixed;
  406. right: 0;
  407. bottom: 160rpx;
  408. width: 140rpx;
  409. height: 66rpx;
  410. line-height: 66rpx;
  411. border-radius: 22rpx 0 0 22rpx;
  412. background: $theme-color;
  413. text-align: center;
  414. font-size: 22rpx;
  415. font-style: normal;
  416. font-weight: 400;
  417. color: #fff;
  418. }
  419. </style>