| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- <template>
- <view class="content-box">
- <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="入库" background-color="#F7F9FA" color="#000"
- @clickLeft="back">
- </uni-nav-bar>
- <view class="list_box">
- <u-list @scrolltolower="scrolltolower">
- <view class="card_box">
- <workOrderBom :item='objData' v-if='objData' @handleScan='handleScan'></workOrderBom>
- <jobBom v-if="clientEnvironmentId == 2" :item='objData' ref='jobRef'
- :notFormed='objData.notFormedList' @penalize='penalize' @modeNum='modeNum'></jobBom>
- <view class="select_box">
- <zxz-uni-data-select :localdata="warehouseList" placeholder="请选择入库仓库" v-model="warehouseId"
- dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
- </view>
- <view class="select_box" v-if="clientEnvironmentId !== 3">
- <zxz-uni-data-select :localdata="WarehouseSpecTypeList" placeholder="请选择入库规格" v-model="inWarehouseSpecType"
- dataValue='value' dataKey="text" filterable format='{text}' disabled></zxz-uni-data-select>
- </view>
- <view class="list_box" v-for="(item, index) in List" :key="index" v-if="clientEnvironmentId != 3">
- <view class="time" style="margin-bottom: 10rpx;">打包时间: {{ item.createTime }}</view>
- <packingBom :objData="item.extInfo" :measuringUnit='item.measuringUnit'></packingBom>
- </view>
- <view class="list_box" v-for="(it, index) in tgList" :key="index" v-if="clientEnvironmentId == 3">
- <view class="time">打包时间: {{ it.createTime }}</view>
- <packingTgBom :list='it.extInfo.pickOutInList' :isWarehousing='true' :item='it'></packingTgBom>
- </view>
- </view>
- </u-list>
- </view>
- <view class="bottom-wrapper">
- <view class="btn_box" @click="save">一键报工</view>
- </view>
- </view>
- </template>
- <script>
- import {
- getByIdReport,
- jobSave
- } from '@/api/pda/jobBooking.js'
- import {
- getWarehouseList,
- listPDAToWarehouse,
- listPDAToWarehouseTG,
- productReceiveCreate
- } from '@/api/pda/workOrder.js'
- import jobBom from './components/jobBom.vue'
- import packingBom from './components/packingBom.vue'
- import workOrderBom from '../feeding/components/workOrderBom.vue'
- import packingTgBom from '../jobBooking/components/packingTgBom.vue'
- export default {
- components: {
- workOrderBom,
- packingBom,
- packingTgBom,
- jobBom
- },
- data() {
- return {
- id: null,
- taskId: null,
- objData: {
- workReportInfo:{
- formedNum:''
- }
- },
- warehouseList: [],
- warehouseId: null,
- delta: -1,
- List: [],
- tgList: [],
- inWarehouseSpecType:'2',
- WarehouseSpecTypeList:[
- {
- text:'按计量入库',
- value:'1'
- },{
- text:'最小包装入库',
- value:'2'
- },
- {
- text:'内包装入库',
- value:'3'
- },
- {
- text:'外包装入库',
- value:'4'
- }
- ],
- clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
- .clientEnvironmentId, // *1 主环境-601环境 2 soll-索尔环境 3 tg-碳谷环境
- inWarehouseType: null,
- }
- },
- onLoad(options) {
- this.id = options.workOrderId
- this.taskId = options.taskId
- this.workReportId = options.workReportId
- this.delta = options.delta
- this.getList()
- this.getWarehouseListFn()
- if (this.clientEnvironmentId == 3) {
- this.getTgWarehouse()
- } else {
- this.getWarehouse()
- }
- },
- methods: {
- getList() {
- getByIdReport(this.id, this.taskId).then(res => {
- this.objData = res
- // console.log(this.objData,'222222222222222222222');
- if (res.workOrderType == 1) {
- this.inWarehouseType = 1
- } else if (res.workOrderType == 2) {
- this.inWarehouseType = 8 // "1入库类型1生产入库2半成品入库"
- }
- // workReportInfo.formedNum
- this.objData.notFormedList = [{
- notFormedNum: null,
- notFormedWeight: null,
- weightUnit: res.weightUnit,
- unit: res.unit,
- warehouseId: null, // 处置 仓库id
- }]
-
- this.objData.workReportInfo = {
- formingNum: null,
- formingWeight: null,
- formedNum: this.objData.product[0] && this.objData.product[0].feedQuantity||'',
- formedWeight: null,
- taskId: this.taskId
- }
- console.log(this.objData.workReportInfo.formedNum );
- })
- },
- getWarehouseListFn() {
- getWarehouseList().then(res => {
- this.warehouseList = res
- })
- },
- getWarehouse() {
- let param = {
- workOrderId: this.id,
- taskId: this.taskId,
- workReportId: this.workReportId
- }
- listPDAToWarehouse(param).then(res => {
- this.List = res
- })
- },
- getTgWarehouse() {
- let param = {
- workOrderId: this.id,
- taskId: this.taskId,
- workReportId: this.workReportId
- }
- listPDAToWarehouseTG(param).then(res => {
- this.tgList = res
- })
- },
- handleScan() {
- },
- scrolltolower() { },
- save() {
- if (!this.warehouseId) {
- uni.showToast({
- icon: 'none',
- title: '请先选择入库仓库'
- })
- return false
- }
- // if (this.clientEnvironmentId == 21) {
- // // /pda/mes/workreport/productReceiveCreate/{workId}
- // productReceiveCreate(this.objData.workOrderId).then(v=>{
- // uni.navigateBack();
- // })
- // } else {
- let categoryId = '',rootCategoryLevelId='';
- if (this.objData.product.length) {
- categoryId = this.objData.product[0].categoryId;
- rootCategoryLevelId = this.objData.product[0].rootCategoryLevelId;
- }
-
- let storageInfo = {
- inWarehouseSpecType: this.clientEnvironmentId !== 3||this.clientEnvironmentId !== 2 ?Number(this.inWarehouseSpecType):'',
- warehouseId: this.warehouseId,
- inWarehouseType: this.inWarehouseType,
- toWarehouseList: this.clientEnvironmentId == 3 ? this.tgList : this.List,
- }
- if (this.clientEnvironmentId==2) {
- let num = '';
- if(this.objData.workReportInfo&&this.objData.workReportInfo?.formedNum){
- num = this.objData.workReportInfo.formedNum;
- }
- storageInfo.packingReportList= [{
- code: this.objData.productCode,
- categoryId: categoryId,
- workOrderId: this.objData.workOrderId,
- rootCategoryLevelId: rootCategoryLevelId,
- totalQuantity: num,
- quantity: num,
- unit: this.objData.unit,
- packingNum: 1,
- taskId: -1
- }]
- }
- this.objData['storageInfo'] = storageInfo
-
- jobSave(this.objData).then(res => {
- uni.navigateBack();
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .content-box {
- height: 100vh;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- }
- .list_box {
- flex: 1;
- overflow: hidden;
- padding: 4rpx 0;
- .u-list {
- height: 100% !important;
- }
- .card_box {
- padding: 16rpx 24rpx;
- }
- }
- .bottom-wrapper {
- .btn_box {
- width: 750rpx;
- height: 88rpx;
- line-height: 88rpx;
- background: $theme-color;
- text-align: center;
- font-size: 36rpx;
- font-style: normal;
- font-weight: 400;
- color: #fff;
- }
- }
- .select_box {
- margin-top: 20rpx;
- }
- .list_box {
- margin-top: 40rpx;
- .time {
- font-size: 28rpx;
- }
- }
- </style>
|