1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123 |
- <template>
- <view class="mask" v-if="isLoading"></view>
- <view class="uni-column" style="height: 100%; background-color: #f5f5f5;position: fixed;left: 0;right: 0;">
- <view class="box-bg uni-row">
- <view class="input-view uni-row">
- <uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
- <input class="nav-bar-input" type="text" v-model="keywords" placeholder="请输入批次号/箱号" />
- </view>
- <view class="search" @click="handleSearch">
- 搜索
- </view>
- </view>
- <view class="list-title uni-row">
- <text class="label">是否正常批次</text>
- <text>{{ normalStatus ? '是' : '否' }}</text>
- <switch class="switch" :checked="normalStatus" @change="switchChange" color="rgba(103, 195, 55, 1.0)" />
- </view>
- <view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
- <text>暂无批次</text>
- </view>
- <view v-else class="scroll-container" style="margin-bottom:130px">
- <!-- 批次列表 -->
- <view v-for="(item, index) in listData" :key="index" class="list-item" @click="checkStatus(item)">
- <!-- @click="handleToreportingForWork(item)" -->
- <view class="title-container uni-row" style="justify-content: flex-start;">
- <view class="title uni-row">
- <text class="label">批次号:</text>
- <text class="label code">{{ item['lotCode'] }}</text>
- </view>
- <view class=" uni-row" style="margin-left: 16rpx;">
- <view v-if="item['status'] == 1" class="tag"><text class="label">进行中</text></view>
- <view v-else-if="item['status'] == 3" class="tag turnover "><text class="label">待领取</text>
- </view>
- <view v-else-if="item['status'] == 2" class="tag turnover "><text class="label">待周转</text>
- </view>
- <view v-else-if="item['status'] == 0" class="tag finished "><text class="label">未开始</text>
- </view>
- <view v-else-if="item['status'] == 4" type="default finished" class="tag finished"><text
- class="label">已完成</text></view>
- </view>
- </view>
- <view class="item-info uni-row">
- <text class="label">产品描述</text>
- <text class="label right">{{ curPlan['productDescription'] }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">材质</text>
- <text
- class="label right">{{ item['furnaceNoInfo'] ? item['furnaceNoInfo'].firstTechnicalRequirement + ";" + item['furnaceNoInfo'].secondTechnicalRequirement : '-' }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">原材料厂家</text>
- <text
- class="label right">{{ item['furnaceNoInfo'] ? (item['furnaceNoInfo'].factory === "" ? "-" : item['furnaceNoInfo'].factory) : "-" }}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">箱号</text>
- <text class="label right">{{ item['carrierName'] ? item['carrierName'] : '-' }}</text>
- </view>
- <!-- <view class="item-info uni-row">
- <text class="label">总工时</text>
- <text class="label right">{{ item['totalWorkingHours']}}</text>
- </view> -->
- <view class="item-info uni-row">
- <text class="label">投入数</text>
- <text
- class="label right">{{item.prevProcess == null ? item['productionQuantity'] : item['processQualifiedNum']}}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">已完成工序</text>
- <text class="label right">{{ item.prevProcess ? item['prevProcess'].processAlias : '-'}}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">待加工工序</text>
- <!-- <text
- class="label right">{{ item.currentProcess ? item.prevProcess && item['currentProcess'].processAlias == item['prevProcess'].processAlias ? '-' : item['currentProcess'].processAlias : '-'}}</text> -->
- <text class="label right">{{ item.currentProcess ?item['currentProcess'].processAlias : '-'}}</text>
- </view>
- <view class="item-info uni-row">
- <text class="label">下道工序</text>
- <view class="label right uni-row">{{ item.nextProcess ? item['nextProcess'].processAlias : '-' }}
- (<view style="color: #1684fc;" @click.stop="handleClickProcessList(item)"> 工艺列表
- </view>)
- </view>
- </view>
- <!-- <view class="item-info uni-row">
- <text class="label">设备</text>
- <text class="label right">{{ curPlan['equipmentName'] }}</text>
- </view> -->
- <view v-if="notPreProcess" class="item-info uni-row">
- <text class="label">所在区域</text>
- <text class="label right">{{ getPlaceText(item) }}</text>
- </view>
- <view class="status-btn uni-row">
- <view v-if="item.dayworkItemList[0].status < 3" class=" uni-row">
- <button class="reporting-tag" size="mini"
- @click.stop="handleToreportingForWork(item)">开始报工</button>
- <!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
- </view>
- <view v-if="item['status'] == 2" class=" uni-row">
- <button class="turnover-tag" size="mini"
- @click.stop="handleShowTurnoverApplication(item)">周转申请</button>
- <!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
- </view>
- <view v-else-if="item['status'] == 3" class=" uni-row">
- <button class="turnover-tag" size="mini" @click.stop="handleCancelTurnover(item)"
- style="background-color: rgba(255, 85, 85, 1);">取消周转</button>
- </view>
- </view>
- </view>
- </view>
- <!-- 抽屉 -->
- <uni-drawer ref="showRight" mode="right" :mask-click="true" style="height: 100%;">
- <view style="text-align: center; font-size: 48rpx; padding: 48rpx 0 24rpx 0;margin-top: 20px;">工艺列表</view>
- <view style="font-size: 24rpx;text-align: center;color: red; margin-bottom: 16rpx;">
- 仅显示当前工序后面工艺
- </view>
- <view><button v-if="!editStatus" class="start-batch-btn" style="margin-bottom: 16rpx;" type="primary"
- @click="handleOpenDrawing">查看本工序图纸</button></view>
- <scroll-view scroll-y="true" style="height: 70%;" @touchmove.stop>
- <view v-for="(item,index) in curProcessAfte" :key="index"
- style="padding: 8rpx 5% 8rpx 14%; border-top: 1px solid #cccccc">
- <text>{{ index + 1 }}.{{item.processAlias}}</text>
- </view>
- </scroll-view>
- <!-- <view><button v-if="!editStatus" class="view-end-btn" style="margin-top: 20rpx;" type="primary"
- @click="handleOpenDrawing">查看本工序图纸</button></view> -->
- </uni-drawer>
- <!-- <view v-if="bottomStatus" class="bottom uni-row">
- <button class="start-batch-btn" type="primary" @click="handleStartNewBatch">开始新批次</button>
- </view>
- <view v-if="!bottomStatus" class="bottom uni-row">
- <button class="start-batch-btn" type="primary" @click="handleScanCode">扫一扫开始新批次</button>
- </view> -->
- <view class="bottom uni-row">
- <button v-if="bottomStatus" class="start-batch-btn" style="margin-right: 10rpx;" type="primary"
- @click="handleStartNewBatch">开始新批次</button>
- <button class="start-batch-btn" style="margin-right: 10rpx;" type="primary"
- @click="handleScanCode">扫码开始批次</button>
- <button class="start-batch-btn" type="primary" @click="handleSearchCode">查箱号</button>
- </view>
- <dialog-lot ref="lotDialog" @submit="handleDoIt" />
- <dialog-turnoverApplication ref="turnoverApplicationDialog" @reflushDaywork="handleDoTurnoverAfter" />
- <dialog-selectProduction ref="selectProduction"></dialog-selectProduction>
- <dialog-selectEquipment ref='selectEquipment'
- @handleAddDayWorkItem='handleAddEquipment'></dialog-selectEquipment>
- <QrScanner v-if="showQrCodeReader" @decode="onDecodeHandler" @close="qrReaderClose" />
- </view>
- </template>
- <script setup>
- import {
- normalizeProps,
- reactive,
- onMounted,
- getCurrentInstance,
- ref
- } from 'vue'
- import {
- onLoad,
- onReady,
- onUnload,
- onShow,
- onPullDownRefresh
- } from '@dcloudio/uni-app'
- import QrScanner from '../vueQrCode/index.vue'
- import {
- getDayWorkList,
- showDaywork,
- // showDayworkSave,
- turnoverDelete
- } from '@/api/business/dayWork.js'
- import {
- getAbnormalityLot
- } from '@/api/business/lot.js'
- import {
- carrierFinishedCheck
- } from '@/api/business/carrier.js'
- import {
- addEquipmentInfo
- } from '@/api/business/dayWorkItem.js'
- import {
- isTakeStock
- } from '@/api/business/taksStackLot.js'
- import {
- store
- } from '@/store/index.js'
- import {
- toHHmmss
- } from '@/utils/common.js'
- import {
- getSortingDayworkItem,
- showDayworkSave
- } from '@/api/business/sortDaywork.js'
- const turnoverApplicationDialog = ref(null)
- const selectProduction = ref(null)
- const lotDialog = ref(null)
- const listData = ref([])
- const curPlan = ref(null)
- const bizDayworkObj = ref({})
- const bottomStatus = ref(false) // 底部按钮显示
- const paging = ref();
- const reqParam = ref(null);
- const normalStatus = ref(true)
- const isLoading = ref(false);
- const curDayworkItem = ref({}) // 当前报工记录,回显是否显示取消周转的状态
- const keywords = ref(null)
- const selectEquipment = ref(null) // 组件
- const tempList = ref([])
- const wasteRecyclingList = ref([]) //废品回用批次
- // 在数据中定义一个变量来控制遮罩层的显示
- const isMaskShow = ref(false);
- const currentDaywork = ref({})
- const notPreProcess = ref(true)
- const curProcessAfte = ref([])
- const showRight = ref(null) // 抽屉
- const editStatus = ref(false)
- const showQrCodeReader = ref(false);
- onLoad((options) => {
- curPlan.value = store.planDetails;
- normalStatus.value = true;
- console.log(store.planDetails)
- if (options != null) {
- console.log(options)
- console.log("999")
- keywords.value = options.param1
- if (store.planDetails.isAmend == 1 || store.planDetails.isWasteRecycling == 1) {
- normalStatus.value = false;
- }
- }
- console.log(curPlan.value)
- //废品回用的领料部门如果是当前工段,也要可以开始新批次
- //查找当前计划单下的批次废品回用是当前工段
- getAbnormalityLot({
- productionPlanDetailId: store.planDetails.id,
- requisitionDepartmentId: store.curDeptDetails.deptId
- }).then(res => {
- wasteRecyclingList.value = res.rows
- console.log(wasteRecyclingList.value.length)
- if (store.planDetails.requisitionDepartmentId == store.curDeptDetails.deptId) {
- bottomStatus.value = true;
- store.isPreProcess = true;
- } else {
- bottomStatus.value = false;
- store.isPreProcess = false;
- }
- })
- console.log(wasteRecyclingList.value.length)
- })
- function getPlaceText(item) {
- let place = item.dayworkItemList[0].place == "" ? item.dayworkItemList[0].turnoverArea == "" ?
- '-' : '默认周转区' : item.dayworkItemList[0].place
- let deptName = item.dayworkItemList[0].deptName
- return place == "-" ? deptName == "" ? "-" : deptName : deptName + "-" + place
- }
- /**
- * 监听下拉刷新
- */
- onPullDownRefresh(() => {
- uni.stopPullDownRefresh();
- reflush();
- // normalStatus.value = true;
- // let reqData = {
- // productionPlanDetailId: store.planDetails.id,
- // deptId: store.curDeptDetails.deptId,
- // keywords: keywords.value
- // };
- // getDayWorkList(reqData).then(res => {
- // if (res.code == 200) {
- // tempList.value = res.data
- // if (normalStatus.value) {
- // listData.value = res.data.filter(item => {
- // return item.isWasteRecycling == 0 && item.isAmend == 0;
- // });
- // } else {
- // listData.value = res.data.filter(item => {
- // return item.isWasteRecycling == 1 || item.isAmend == 1;
- // })
- // }
- // for (let i = 0; i < listData.value.length; i++) {
- // if (listData.value[i].prevProcess) {
- // let sum = 0;
- // for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
- // if (listData.value[i].dayworkItemList[j].processId == listData.value[i]
- // .prevProcess
- // .id && (listData.value[i].dayworkItemList[j].status == 2 || listData.value[
- // i]
- // .dayworkItemList[j].status == 3)) {
- // sum += listData.value[i].dayworkItemList[j].qualifiedNum;
- // }
- // }
- // listData.value[i].processQualifiedNum = sum;
- // }
- // }
- // }
- // uni.stopPullDownRefresh();
- // })
- })
- onShow(() => {
- reflush();
- })
- function handleOpenDrawing() {
- console.log(currentDaywork.value, "444")
- var filteredProcess = currentDaywork.value.processSequence.filter(item => item.processStepNumber == currentDaywork
- .value.currentProcess.processStepNumber);
- // 检查 filteredProcess 是否有元素,并选择第一个元素
- if (filteredProcess.length > 0) {
- var firstMatch = filteredProcess[0]; // 获取第一个匹配的对象
- // 对 technologicalProcessDetailId 进行URL编码
- var encodedId = encodeURIComponent(currentDaywork.value.productId);
- var enTechnologicalProcessId = encodeURIComponent(currentDaywork.value.technologicalProcessId);
- var enprocessCode = encodeURIComponent(firstMatch.processCode);
- var encodeCode = encodeURIComponent(currentDaywork.value.lotCode);
- var enProcessAlias = encodeURIComponent(firstMatch.processAlias);
- var enIsWasteRecycling = encodeURIComponent(currentDaywork.value.isWasteRecycling);
- var enIsAmend = encodeURIComponent(currentDaywork.value.isAmend);
- // 构建查询参数字符串
- var queryParam =
- `param1=${encodedId}¶m2=${encodeCode}¶m3=${enprocessCode}¶m4=${enTechnologicalProcessId}¶m5=${enProcessAlias}¶m6=${enIsWasteRecycling}¶m7=${enIsAmend}`;
- // 使用模板字符串构建完整的URL
- var navigateUrl = `/pages/drawingMenu/index?${queryParam}`;
- // 导航到指定页面
- uni.navigateTo({
- url: navigateUrl
- });
- } else {
- console.log('No process matched the current process step number.');
- }
- }
- function reflush() {
- // normalStatus.value = true;
- init(store.planDetails.id);
- }
- function handleShowTurnoverApplication(data) {
- isTakeStock().then(response => {
- if (response.data) {
- uni.showToast({
- icon: 'none',
- title: '正在盘点,不能申请周转',
- duration: 2000
- })
- } else {
- let _data = data ?? {}
- carrierFinishedCheck(data).then(res => {
- if (res.code === 200) {
- // 调用子组件中的方法
- turnoverApplicationDialog.value.open(_data)
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- })
- }
- })
- // .catch(err => {
- // uri.showToast({
- // icon: "fail",
- // title: "网络请求失败。"
- // })
- // })
- }
- function handleStartNewBatch() {
- store.normalStatus = normalStatus.value;
- // console.log(normalStatus.value)
- uni.navigateTo({
- url: "/pages/addNewBatch/index"
- })
- }
- function init(id) {
- uni.showLoading({
- title: '加载中'
- });
- let reqData = {
- productionPlanDetailId: id,
- deptId: store.curDeptDetails.deptId,
- keywords: keywords.value
- };
- // normalStatus.value = true;
- getDayWorkList(reqData).then(res => {
- if (res.code == 200) {
- console.log(res)
- tempList.value = res.data
- if (normalStatus.value) {
- listData.value = res.data.filter(item => {
- return item.isWasteRecycling == 0 && item.isAmend == 0;
- });
- } else {
- listData.value = res.data.filter(item => {
- return item.isWasteRecycling == 1 || item.isAmend == 1;
- })
- }
- // listData.value = res.data.filter(item => {
- // return item.isWasteRecycling == 0 && item.isAmend == 0;
- // });
- /* 0531 */
- // for (let i = 0; i < listData.value.length; i++) {
- // if (listData.value[i].prevProcess) {
- // let sum = 0;
- // for (let j = 0; j < listData.value[i].dayworkItemList.length; j++) {
- // if (listData.value[i].dayworkItemList[j].processId == listData.value[i].prevProcess
- // .id && (listData.value[i].dayworkItemList[j].status == 2 || listData.value[i]
- // .dayworkItemList[j].status == 3)) {
- // sum += listData.value[i].dayworkItemList[j].qualifiedNum;
- // }
- // }
- // listData.value[i].processQualifiedNum = sum;
- // }
- // }
- }
- uni.hideLoading();
- })
- }
- function handleSearch() {
- init(store.planDetails.id);
- }
- function checkStatus(item) {
- if (item.dayworkItemList[0].status < 3) {
- return
- } else {
- handleToreportingForWork(item)
- }
- }
- function handleToreportingForWork(item) {
- store.dayworkInfo = item
- console.log(store.dayworkInfo)
- // if (item.dayworkItemList[0].status == 0) {
- // return
- // }
- uni.$once("formBack", () => handleSearch())
- if (item.dayworkItemList[0].equipmentDetailId == 0) {
- selectEquipment.value.open(null);
- } else {
- uni.navigateTo({
- url: "/pages/sorting/form",
- success: function(res) {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('acceptDataFromOpenerPage', {
- data: item
- })
- }
- })
- }
- }
- //选择设备
- function handleAddEquipment(data) {
- let dayworkItem = store.dayworkInfo.dayworkItemList[0]
- store.dayworkInfo.dayworkItemList[0].equipmentDetailId = data.equipmentDetailId
- store.dayworkInfo.dayworkItemList[0].equipmentDetailCode = data.equipmentDetailCode
- dayworkItem.equipmentDetailId = data.equipmentDetailId
- dayworkItem.equipmentDetailCode = data.equipmentDetailCode
- //保存
- addEquipmentInfo(dayworkItem).then(res => {
- if (res.code == 200) {
- uni.navigateTo({
- url: "/pages/sorting/form",
- success: function(res) {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('acceptDataFromOpenerPage', {
- data: store.dayworkInfo
- })
- }
- })
- }
- })
- }
- function handleClickProcessList(item) {
- let curProcessAfterList = [];
- console.log(item)
- currentDaywork.value = item
- editStatus.value = false
- // if (item.isWasteRecycling == 1 || item.isAmend == 1) {
- // editStatus.value = true
- // } else {
- // editStatus.value = false
- // }
- let nextIndex = 0;
- for (let i = 0; i < item.processSequence.length; i++) {
- console.log(item.nextProcess, "next")
- if (item.nextProcess) {
- if (item.nextProcess.processStepNumber == item.processSequence[i].processStepNumber) {
- nextIndex = i;
- }
- } else {
- nextIndex = item.processSequence.length
- }
- }
- for (let i = 0; i < item.processSequence.length; i++) {
- if (i >= nextIndex) {
- curProcessAfterList.push(item.processSequence[i]);
- }
- }
- if (item.status == 3) {
- curProcessAfterList.splice(0, 1)
- }
- console.log(curProcessAfterList)
- curProcessAfte.value = curProcessAfterList;
- showRight.value.open();
- }
- function handleSearchCode() {
- selectProduction.value.open(normalStatus.value);
- }
- // function switchChange(event) {
- // //异常批
- // if (event.detail.value) {
- // listData.value = tempList.value.filter(item => {
- // return item.isWasteRecycling == 1 || item.isAmend == 1;
- // });
- // normalStatus.value = 1
- // } else {
- // listData.value = tempList.value.filter(item => {
- // return item.isWasteRecycling == 0 && item.isAmend == 0;
- // });
- // normalStatus.value = 0
- // }
- // }
- /*
- function handleScanCode() {
- // 引入原生插件
- const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
- // const mpaasScanModule = null
- if (mpaasScanModule) {
- // 调用插件的 mpaasScan 方法
- mpaasScanModule.mpaasScan({
- // 扫码识别类型,参数可多选,qrCode、barCode,
- // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
- scanType: ["qrCode", "barCode"],
- // 是否隐藏相册,默认false不隐藏
- hideAlbum: false,
- },
- (ret) => {
- console.log(ret);
- let vehicleObj = JSON.parse(ret.resp_result);
- if (!vehicleObj.carrierId || vehicleObj.carrierId == "") {
- uni.showToast({
- icon: "none",
- title: "请扫载具码",
- duration: 1000
- })
- return;
- }
- showDaywork({
- carrierId: vehicleObj.carrierId,
- status: 7
- }).then(response => {
- if (response.code == 200) {
- // console.log(response)
- // console.log(response.data[0].productionPlanDetailId)
- // console.log(store.planDetails.id)
- if (response.data[0].deptId !== store.curDeptDetails.deptId) {
- uni.showToast({
- icon: 'none',
- title: '该批次不在当前工段',
- duration: 2000
- })
- return
- }
- if (response.data[0].productionPlanDetailId == store.planDetails.id) {
- // console.log(response.data)
- lotDialog.value.open(response.data);
- } else {
- uni.showToast({
- icon: 'none',
- title: '该批次不在此计划单内',
- duration: 2000
- })
- }
- } else {
- uni.showToast({
- icon: 'none',
- title: response.msg,
- duration: 2000
- })
- }
- })
- }
- );
- } else {
- // 测试时用
- showDaywork({
- carrierId: '1770342949090017283',
- status: 7
- }).then(response => {
- if (response.code == 200) {
- if (response.data[0].deptId !== store.curDeptDetails.deptId) {
- uni.showToast({
- icon: 'none',
- title: '该批次不在当前工段',
- duration: 2000
- })
- return
- }
- if (response.data[0].productionPlanDetailId == store.planDetails.id) {
- console.log(response.data)
- lotDialog.value.open(response.data);
- } else {
- uni.showToast({
- icon: 'none',
- title: '该批次不在此计划单内',
- duration: 2000
- })
- }
- } else {
- console.log(response)
- uni.showToast({
- icon: 'none',
- title: response.msg,
- duration: 2000
- })
- }
- })
- }
- }
- */
- //H5扫码器回调
- function onDecodeHandler(data) {
- showQrCodeReader.value = false;
- let vehicleObj = {
- carrierCode: data
- };
- if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
- uni.showToast({
- icon: "none",
- title: "请扫载具码",
- duration: 1000
- })
- return;
- }
- showDaywork({
- carrierCode: vehicleObj.carrierCode,
- status: 7
- }).then(response => {
- if (response.code == 200) {
- // console.log(response)
- // console.log(response.data[0].productionPlanDetailId)
- // console.log(store.planDetails.id)
- if (response.data[0].deptId !== store.curDeptDetails.deptId) {
- uni.showToast({
- icon: 'none',
- title: '该批次不在当前工段',
- duration: 2000
- })
- return
- }
- if (response.data[0].productionPlanDetailId == store.planDetails.id) {
- // console.log(response.data)
- lotDialog.value.open(response.data);
- } else {
- uni.showToast({
- icon: 'none',
- title: '该批次不在此计划单内',
- duration: 2000
- })
- }
- } else {
- uni.showToast({
- icon: 'none',
- title: response.msg,
- duration: 2000
- })
- }
- })
- }
- //H5扫码器关闭
- function qrReaderClose() {
- showQrCodeReader.value = false;
- }
- function handleScanCode() {
- showQrCodeReader.value = true;
- // 引入原生插件
- // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
- // // const mpaasScanModule = null
- // if (mpaasScanModule) {
- // // 调用插件的 mpaasScan 方法
- // mpaasScanModule.mpaasScan({
- // // 扫码识别类型,参数可多选,qrCode、barCode,
- // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
- // scanType: ["qrCode", "barCode"],
- // // 是否隐藏相册,默认false不隐藏
- // hideAlbum: false,
- // },
- // (ret) => {
- // console.log(ret);
- // let vehicleObj = {
- // carrierCode: ret.resp_result
- // };
- // if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
- // uni.showToast({
- // icon: "none",
- // title: "请扫载具码",
- // duration: 1000
- // })
- // return;
- // }
- // showDaywork({
- // carrierCode: vehicleObj.carrierCode,
- // status: 7
- // }).then(response => {
- // if (response.code == 200) {
- // // console.log(response)
- // // console.log(response.data[0].productionPlanDetailId)
- // // console.log(store.planDetails.id)
- // if (response.data[0].deptId !== store.curDeptDetails.deptId) {
- // uni.showToast({
- // icon: 'none',
- // title: '该批次不在当前工段',
- // duration: 2000
- // })
- // return
- // }
- // if (response.data[0].productionPlanDetailId == store.planDetails.id) {
- // // console.log(response.data)
- // lotDialog.value.open(response.data);
- // } else {
- // uni.showToast({
- // icon: 'none',
- // title: '该批次不在此计划单内',
- // duration: 2000
- // })
- // }
- // } else {
- // uni.showToast({
- // icon: 'none',
- // title: response.msg,
- // duration: 2000
- // })
- // }
- // })
- // }
- // );
- // } else {
- // // 测试时用
- // showDaywork({
- // carrierCode: '000075',
- // status: 7
- // }).then(response => {
- // if (response.code == 200) {
- // if (response.data[0].deptId !== store.curDeptDetails.deptId) {
- // uni.showToast({
- // icon: 'none',
- // title: '该批次不在当前工段',
- // duration: 2000
- // })
- // return
- // }
- // if (response.data[0].productionPlanDetailId == store.planDetails.id) {
- // console.log(response.data)
- // lotDialog.value.open(response.data);
- // } else {
- // uni.showToast({
- // icon: 'none',
- // title: '该批次不在此计划单内',
- // duration: 2000
- // })
- // }
- // } else {
- // console.log(response)
- // uni.showToast({
- // icon: 'none',
- // title: response.msg,
- // duration: 2000
- // })
- // }
- // })
- // }
- }
- // function handleScanCode() {
- // uni.scanCode({
- // onlyFromCamera: true,
- // success: function (res) {
- // if (res.scanType !== 'QR_CODE') {
- // uni.showToast({
- // icon: 'none',
- // title: '二维码未识别成功',
- // duration: 2000
- // })
- // }
- // console.log('条码类型:' + res.scanType);
- // console.log('条码内容:' + res.result);
- // }
- // });
- // }
- function handleAddDaywork(data) {
- isLoading.value = true; // 显示遮罩层
- uni.showLoading({
- title: '加载中'
- })
- console.log(data)
- let reqParam = [];
- for (var i = 0; i < data.length; i++) {
- reqParam.push(data[i].daywork)
- }
- console.log(data)
- data.forEach(item => {
- item.isSort = 1
- item.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId
- })
- showDayworkSave(data).then(res => {
- isLoading.value = false;
- uni.hideLoading();
- if (res.code == 200) {
- console.log(res)
- init(store.planDetails.id);
- } else {
- uni.showToast({
- icon: "none",
- title: res.msg,
- duration: 2000
- })
- }
- })
- }
- function handleDoIt(data) {
- handleAddDaywork(data);
- }
- function handleDoTurnoverAfter() {
- reflush();
- }
- function switchChange(event) {
- console.log(event)
- //异常批
- if (normalStatus.value) {
- listData.value = tempList.value.filter(item => {
- return item.isWasteRecycling == 1 || item.isAmend == 1;
- });
- normalStatus.value = false
- } else {
- listData.value = tempList.value.filter(item => {
- return item.isWasteRecycling == 0 && item.isAmend == 0;
- });
- normalStatus.value = true
- }
- console.log(listData.value)
- }
- function startReport(data) {
- getSortingDayworkItem(data).then(res => {
- uni.showToast({
- icon: "success",
- title: "开始成功",
- duration: 2000
- })
- init(store.planDetails.id)
- })
- }
- function handleCancelTurnover(data) {
- isTakeStock().then(response => {
- if (response.data) {
- uni.showToast({
- icon: 'none',
- title: '正在盘点,不能取消周转',
- duration: 2000
- })
- } else {
- turnoverDelete(data).then(res => {
- if (res.code == 200) {
- uni.showToast({
- icon: "success",
- title: "取消成功",
- duration: 2000
- })
- setTimeout(() => {
- init(store.planDetails.id);
- }, 1500);
- } else {
- uni.showToast({
- icon: "none",
- title: "取消失败",
- duration: 2000
- })
- setTimeout(() => {
- init(store.planDetails.id);
- }, 1000);
- }
- })
- }
- })
- }
- </script>
- <style lang="scss">
- $nav-height: 60rpx;
- .box-bg {
- width: 94%;
- background-color: #F5F5F5;
- padding: 5rpx 16rpx;
- justify-content: space-around;
- align-items: center;
- margin: 24rpx auto 0;
- .input-view {
- width: 100%;
- flex: 4;
- background-color: #f8f8f8;
- height: $nav-height;
- border: 1rpx solid #999;
- border-radius: 15rpx;
- padding: 0 15rpx;
- flex-wrap: nowrap;
- margin: 0 10rpx 0;
- line-height: $nav-height;
- .input-uni-icon {
- line-height: $nav-height;
- }
- .nav-bar-input {
- width: 80%;
- height: $nav-height;
- line-height: $nav-height;
- padding: 0 5rpx;
- background-color: #f8f8f8;
- }
- }
- .search {
- width: 20%;
- text-align: center;
- color: #808080;
- }
- }
- .list-title {
- width: 100%;
- margin-top: 16rpx;
- height: 64rpx;
- line-height: 64rpx;
- align-items: center;
- margin-left: 32rpx;
- .label {
- font-size: 32rpx;
- margin-right: 24rpx;
- }
- .icon-gear {
- font-size: 56rpx;
- }
- }
- .switch {
- margin-top: -8rpx;
- transform: scale(0.7);
- }
- .scroll-container {
- width: 92%;
- margin: 24rpx auto 0 auto;
- height: calc(90% - 100rpx);
- overflow: auto;
- }
- .list-item {
- background-color: #fff;
- position: relative;
- padding: 16rpx;
- padding-bottom: 24rpx;
- margin-bottom: 24rpx;
- border-radius: 24rpx;
- .title-container {
- margin-top: 8rpx;
- margin-bottom: 16rpx;
- .title {
- height: 48rpx;
- align-items: center;
- .label {
- font-size: 32rpx;
- font-weight: bold;
- &.code {
- margin-left: 8rpx;
- }
- }
- }
- .tag {
- border: 1px solid #1CE5B0;
- background-color: #F6FFFD;
- padding: 8rpx;
- border-radius: 8rpx;
- .label {
- color: #1CE5B0;
- font-size: 24rpx;
- }
- &.finished {
- border: 1px solid #BBBBBB;
- background-color: #F5F5F5;
- .label {
- color: #BBBBBB;
- }
- }
- &.turnover {
- border: 1px solid #FF7901;
- background-color: #F6FFFD;
- .label {
- color: #FF7901;
- }
- }
- }
- }
- .item-info {
- margin-bottom: 8rpx;
- .label {
- font-size: 28rpx;
- width: 220rpx;
- color: #808080;
- &.right {
- flex: 1;
- color: #000000;
- }
- }
- }
- .status-btn {
- justify-content: flex-end;
- align-items: center;
- .turnover-tag {
- padding-right: 12rpx;
- padding-left: 12rpx;
- border-radius: 8rpx;
- border: 1rpx solid #FF7901;
- background-color: #FF7901;
- font-size: 28rpx;
- color: #FFFFFF;
- }
- .reporting-tag {
- padding-right: 12rpx;
- padding-left: 12rpx;
- border-radius: 8rpx;
- margin-left: 16rpx;
- border: 1rpx solid #1684fc;
- background-color: #1684fc;
- font-size: 28rpx;
- color: #FFFFFF;
- }
- }
- }
- .bottom {
- height: 10%;
- position: fixed;
- right: 0;
- bottom: 0;
- left: 0;
- height: 100rpx;
- border-top: 1px solid #999999;
- padding: 16rpx 32rpx;
- align-items: center;
- background-color: #fff;
- justify-content: space-evenly;
- .start-batch-btn {
- flex: 1;
- height: 80rpx;
- line-height: 80rpx;
- border-radius: 8rpx;
- color: #FFFFFF;
- font-size: 28rpx;
- }
- }
- </style>
|