details.vue 12 KB

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