details.vue 10 KB

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