index.vue 6.9 KB

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