index.vue 7.6 KB

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