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