details.vue 10 KB

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