index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="入库" background-color="#F7F9FA" color="#000"
  4. @clickLeft="back">
  5. </uni-nav-bar>
  6. <view class="list_box">
  7. <u-list @scrolltolower="scrolltolower">
  8. <view class="card_box">
  9. <workOrderBom :item='objData' v-if='objData' @handleScan='handleScan'></workOrderBom>
  10. <jobBom v-if="clientEnvironmentId == 2" :item='objData' ref='jobRef'
  11. :notFormed='objData.notFormedList' @penalize='penalize' @modeNum='modeNum'></jobBom>
  12. <view class="select_box">
  13. <zxz-uni-data-select :localdata="warehouseList" placeholder="请选择入库仓库" v-model="warehouseId"
  14. dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
  15. </view>
  16. <view class="list_box" v-for="(item, index) in List" :key="index" v-if="clientEnvironmentId != 3">
  17. <view class="time">打包时间: {{ item.createTime }}</view>
  18. <packingBom :objData="item.extInfo" :measuringUnit='item.measuringUnit'></packingBom>
  19. </view>
  20. <view class="list_box" v-for="(it, index) in tgList" :key="index" v-if="clientEnvironmentId == 3">
  21. <view class="time">打包时间: {{ it.createTime }}</view>
  22. <packingTgBom :list='it.extInfo.pickOutInList' :isWarehousing='true' :item='it'></packingTgBom>
  23. </view>
  24. </view>
  25. </u-list>
  26. </view>
  27. <view class="bottom-wrapper">
  28. <view class="btn_box" @click="save">一键报工</view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import {
  34. getByIdReport,
  35. jobSave
  36. } from '@/api/pda/jobBooking.js'
  37. import {
  38. getWarehouseList,
  39. listPDAToWarehouse,
  40. listPDAToWarehouseTG,
  41. productReceiveCreate
  42. } from '@/api/pda/workOrder.js'
  43. import jobBom from './components/jobBom.vue'
  44. import packingBom from './components/packingBom.vue'
  45. import workOrderBom from '../feeding/components/workOrderBom.vue'
  46. import packingTgBom from '../jobBooking/components/packingTgBom.vue'
  47. export default {
  48. components: {
  49. workOrderBom,
  50. packingBom,
  51. packingTgBom,
  52. jobBom
  53. },
  54. data() {
  55. return {
  56. id: null,
  57. taskId: null,
  58. objData: {},
  59. warehouseList: [],
  60. warehouseId: null,
  61. delta: -1,
  62. List: [],
  63. tgList: [],
  64. clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
  65. .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
  66. inWarehouseType: null,
  67. }
  68. },
  69. onLoad(options) {
  70. this.id = options.workOrderId
  71. this.taskId = options.taskId
  72. this.workReportId = options.workReportId
  73. this.delta = options.delta
  74. this.getList()
  75. this.getWarehouseListFn()
  76. if (this.clientEnvironmentId == 3) {
  77. this.getTgWarehouse()
  78. } else {
  79. this.getWarehouse()
  80. }
  81. },
  82. methods: {
  83. getList() {
  84. getByIdReport(this.id, this.taskId).then(res => {
  85. this.objData = res
  86. // console.log(this.objData,'222222222222222222222');
  87. if (res.workOrderType == 1) {
  88. this.inWarehouseType = 1
  89. } else if (res.workOrderType == 2) {
  90. this.inWarehouseType = 8 // "1入库类型1生产入库2半成品入库"
  91. }
  92. // workReportInfo.formedNum
  93. this.objData.notFormedList = [{
  94. notFormedNum: null,
  95. notFormedWeight: null,
  96. weightUnit: res.weightUnit,
  97. unit: res.unit,
  98. warehouseId: null, // 处置 仓库id
  99. }]
  100. this.objData.workReportInfo = {
  101. formingNum: null,
  102. formingWeight: null,
  103. formedNum: this.objData.product[0] && this.objData.product[0].feedQuantity,
  104. formedWeight: null,
  105. taskId: this.taskId
  106. }
  107. })
  108. },
  109. getWarehouseListFn() {
  110. getWarehouseList().then(res => {
  111. this.warehouseList = res
  112. })
  113. },
  114. getWarehouse() {
  115. let param = {
  116. workOrderId: this.id,
  117. taskId: this.taskId,
  118. workReportId: this.workReportId
  119. }
  120. listPDAToWarehouse(param).then(res => {
  121. this.List = res
  122. })
  123. },
  124. getTgWarehouse() {
  125. let param = {
  126. workOrderId: this.id,
  127. taskId: this.taskId,
  128. workReportId: this.workReportId
  129. }
  130. listPDAToWarehouseTG(param).then(res => {
  131. this.tgList = res
  132. })
  133. },
  134. handleScan() {
  135. },
  136. scrolltolower() { },
  137. save() {
  138. if (!this.warehouseId) {
  139. uni.showToast({
  140. icon: 'none',
  141. title: '请先选择入库仓库'
  142. })
  143. return false
  144. }
  145. // if (this.clientEnvironmentId == 21) {
  146. // // /pda/mes/workreport/productReceiveCreate/{workId}
  147. // productReceiveCreate(this.objData.workOrderId).then(v=>{
  148. // uni.navigateBack();
  149. // })
  150. // } else {
  151. let categoryId = '',rootCategoryLevelId='';
  152. if (this.objData.product.length) {
  153. categoryId = this.objData.product[0].categoryId;
  154. rootCategoryLevelId = this.objData.product[0].rootCategoryLevelId;
  155. }
  156. let storageInfo = {
  157. warehouseId: this.warehouseId,
  158. inWarehouseType: this.inWarehouseType,
  159. toWarehouseList: this.clientEnvironmentId == 3 ? this.tgList : this.List,
  160. }
  161. if (this.clientEnvironmentId==2) {
  162. storageInfo.packingReportList= [{
  163. code: this.objData.productCode,
  164. categoryId: categoryId,
  165. workOrderId: this.objData.workOrderId,
  166. rootCategoryLevelId: rootCategoryLevelId,
  167. totalQuantity: this.objData.workReportInfo.formedNum,
  168. quantity: this.objData.workReportInfo.formedNum,
  169. unit: this.objData.unit,
  170. packingNum: 1,
  171. taskId: -1
  172. }]
  173. }
  174. this.objData['storageInfo'] = storageInfo
  175. jobSave(this.objData).then(res => {
  176. uni.navigateBack();
  177. })
  178. // }
  179. },
  180. }
  181. }
  182. </script>
  183. <style lang="scss" scoped>
  184. .content-box {
  185. height: 100vh;
  186. overflow: hidden;
  187. display: flex;
  188. flex-direction: column;
  189. }
  190. .list_box {
  191. flex: 1;
  192. overflow: hidden;
  193. padding: 4rpx 0;
  194. .u-list {
  195. height: 100% !important;
  196. }
  197. .card_box {
  198. padding: 16rpx 24rpx;
  199. }
  200. }
  201. .bottom-wrapper {
  202. .btn_box {
  203. width: 750rpx;
  204. height: 88rpx;
  205. line-height: 88rpx;
  206. background: $theme-color;
  207. text-align: center;
  208. font-size: 36rpx;
  209. font-style: normal;
  210. font-weight: 400;
  211. color: #fff;
  212. }
  213. }
  214. .select_box {
  215. margin-top: 20rpx;
  216. }
  217. .list_box {
  218. margin-top: 40rpx;
  219. .time {
  220. font-size: 28rpx;
  221. }
  222. }
  223. </style>