details.vue 11 KB

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