details.vue 12 KB

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