123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110 |
- <template>
- <view class="page-container uni-column">
- <view class="lot-info uni-column">
- <view class="lot-code uni-row">
- <text>批次号</text>
- <text style="margin-left: 24rpx;">{{ dayworkItem.lotCode }}</text>
- </view>
- <view class="product-info">
- 产品描述: {{ dayworkItem.productDescription }}
- </view>
- <view class="product-info">
- 原材料厂家: {{ dayworkInfo.furnaceNoInfo.factory }}
- </view>
- <view class="product-info">
- 投产数量: {{ dayworkItem.prodNum }}
- </view>
- <view class="product-info">
- 设备: {{ dayworkItem.equipmentDetailCode }}
- </view>
- </view>
- <!-- 不合格信息 -->
- <view class="title unfit-title uni-row">
- <text>不合格信息</text>
- <view v-if="Number(dayworkItem.status) < 3" class="add-btn" @click="handleAddUnfit">添加</view>
- </view>
- <view class="unfit-container">
- <view class="unfit-item-container uni-column" v-for="(item, index) in unfitInfos" :key="index">
- <view class="title uni-row">
- <text>检查标准-{{ item.checkStandard }}</text>
- <uni-icons v-if="Number(dayworkItem.status) < 3" type="trash" size="24" color="#fc6565"
- @click="handleDelUnfit(index)" />
- </view>
- <!-- <view class="standard">检查标准:{{ item.checkStandard }}</view> -->
- <view class="result uni-row" style="display: flex;flex-direction: row;justify-content: space-between;">
- <!-- align-items: flex-start; -->
- <view class="label" style="padding-right: 16rpx;flex: 0 1 auto; min-width: 118rpx;">
- 检查结果</view>
- <input v-if="Number(dayworkItem.status) < 3" v-model="item.reason" placeholder="请输入检查结果" />
- <span v-else style="flex-grow: 1;">{{ item.reason }}</span>
- <view class="label"
- style="text-align: right; padding-right: 16rpx;flex: 0 1 auto; min-width: 68rpx;">数量</view>
- <input v-if="Number(dayworkItem.status) < 3" class="number" type="number" v-model="item.rejectNum"
- @blur="rejectNumberChange" />
- <span v-else>{{ item.rejectNum }}</span>
- </view>
- </view>
- </view>
- <!-- 咨询部分 -->
- <view class="title">咨询</view>
- <view class="consultation-container uni-column">
- <view class="consultation-item-container" v-for="(item, index) in consultations" :key="index">
- <view class="question uni-column">
- <view class="label uni-row">
- <text>问题描述</text>
- <text :style="{ color: showStatusColor(item.status) }">{{item.consultDepartment == 0?'技术':'品管'}}
- {{ selectText(item) }}</text>
- </view>
- <view class="content">{{ item.content }}</view>
- </view>
- <!-- <view v-if="item.answer !== ''" class="answer"
- style="margin-top: 24rpx; padding-top: 24rpx; border-top: 1px dotted #aaaaaa;">
- <view class="label">回复</view>
- <view class="content">{{ item.answer }}</view>
- </view> -->
- </view>
- </view>
- <!-- 零存库部分 -->
- <view class="title">零存库</view>
- <view class="consultation-container ">
- <view class="title unfit-title uni-row">
- <view class="title">零取</view>
- <view class="add-btn" v-if="Number(dayworkItem.status) < 3" style="background-color: #409eff;"
- @click="handleAddLot">添加</view>
- </view>
- <view>
- <zb-table v-if="Number(dayworkItem.status) < 3" :columns="column1" :stripe="true" :fit="true"
- @dele="dele" :data="retrievalInfo"></zb-table>
- <zb-table v-else :columns="column2" :stripe="true" :fit="true" @dele="dele"
- :data="retrievalInfo"></zb-table>
- <!-- <uni-table ref="table" :loading="loading" border stripe emptyText="暂无更多数据" >
- <uni-tr >
- <uni-th style="font-size: 25rpx;" width="atuo" align="center">批次号</uni-th>
- <uni-th style="font-size: 25rpx;" width="120" align="center">数量</uni-th>
- <uni-th v-if="Number(dayworkItem.status) < 3" style="font-size: 25rpx;" width="80" align="center">操作</uni-th>
- </uni-tr>
- <uni-tr v-for="(item, index) in retrievalInfo" :key="index">
- <uni-th style="font-size: 24rpx;" width="auto" align="center">{{ item.lotCode }}</uni-th>
- <uni-th style="font-size: 25rpx;" width="120" align="center">
- {{ item.storageNum }}
- </uni-th>
- <uni-th v-if="Number(dayworkItem.status) < 3 && item.status == 0" align="center" width="80">
- <uni-icons type="closeempty" size="22" @click="handleDelete(item)"></uni-icons>
- </uni-th>
- </uni-tr>
- </uni-table> -->
- </view>
- <view v-if="saveFlag" class='middle'>
- <view class='segment'></view>
- <view class='segment'></view>
- </view>
- <view v-if="saveFlag" class="title unfit-title uni-row">
- <view class="title">零存</view>
- </view>
- <view v-if="saveFlag" class="save uni-row">
- <text class="label">存入数量</text>
- <input class="number" type="number"
- v-if="!(storageInfo.status == 1 || Number(dayworkItem.status) >= 3 || storageInfo.id)"
- placeholder="请输入" v-model="storageNum" />
- <span style="margin-left: 56rpx;flex: 1;" v-else>{{ storageNum }}</span>
- </view>
- </view>
- <!-- 报工部分 -->
- <view class="daywork-container">
- <view class="result uni-row">
- <view class="label">合格量</view>
- <input v-if="Number(dayworkItem.status) < 3" type="number" placeholder="请输入合格量"
- v-model="dayworkItem.qualifiedNum" />
- <span v-else>{{ dayworkItem.qualifiedNum }}</span>
- <view class="label" style="text-align: right; padding-right: 24rpx">废品量</view>
- <input v-if="Number(dayworkItem.status) < 3" :disabled="true" type="number" placeholder="请输入废品量"
- v-model="dayworkItem.rejectNum" />
- <span v-else>{{ dayworkItem.rejectNum }}</span>
- </view>
- <view class="remark uni-row">
- <view class="label">备注</view>
- <textarea v-if="Number(dayworkItem.status) < 3" v-model="dayworkItem.remark" maxlength="999" />
- <span v-else>{{ dayworkItem.remark }}</span>
- </view>
- <view class="btns-container uni-row">
- <!-- 最后一步完成不能更换载具 -->
- <view v-if="dayworkItem.daywork != null && dayworkItem.daywork.status != 2" class="bottom-btn left-btn "
- @click="handleChangeCarrier">
- 更换载具</view>
- <view v-if="checkFinishable()&&Number(dayworkItem.status) < 3" class="finished-btn"
- @click.stop="handleFinishDaywork">结束报工</view>
- <view v-if="Number(dayworkItem.status) < 3" class="pause-btn" @click.stop="handleUpdateDaywork">暂停
- </view>
- <view v-if="Number(dayworkItem.status) < 3" class="question-btn uni-column"
- @click.stop="handleAddConsultation">
- <uni-icons type="headphones" size="24" />
- <text>咨询</text>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import {
- ref
- } from 'vue'
- import {
- onMounted,
- getCurrentInstance
- } from 'vue';
- import {
- getSortingDayworkItem,
- saveConsult,
- finishInner,
- update,
- selectInstructionList
- } from '@/api/business/sortDaywork.js'
- import {
- getTakeStockPeriod
- } from '@/api/business/taksStackLot.js'
- import {
- getDictInfoByType
- } from '@/api/dict/dict.js'
- import {
- onLoad,
- onReady,
- onUnload,
- onShow
- } from '@dcloudio/uni-app'
- import {
- store
- } from '@/store/index.js'
- import {
- timestampToTime,
- toHHmmss
- } from '@/utils/common.js'
- const isEventTriggered = ref(false); // 创建一个标志位
- const unfitInfos = ref([])
- const consultations = ref([])
- const dayworkInfo = ref({})
- const retrievalInfo = ref([])
- // 创建一个引用来存储最后一次请求的时间戳
- const lastRequestTimestamp = ref(0);
- const dayworkItem = ref({})
- const saveFlag = ref(false)
- const storageNum = ref(null)
- const storageInfo = ref(null)
- const qualifiedNumRatio = ref(0)
- const selectEquipment = ref(null) // 组件
- const isFinish = ref(false)
- const column1 = [{
- name: 'lotCode',
- label: '批次号',
- align: 'center'
- },
- {
- name: 'storageNum',
- label: '数量',
- align: 'center'
- },
- {
- name: 'operation',
- type: 'operation',
- label: '操作',
- align: 'center',
- renders: [{
- name: '删除',
- type: 'warn',
- func: "dele",
- class: "buttonOp"
- }, ]
- },
- ]
- const column2 = [{
- name: 'lotCode',
- label: '批次号',
- align: 'center'
- },
- {
- name: 'storageNum',
- label: '数量',
- align: 'center'
- },
- ]
- /***************************** 页面生命周期函数 *****************************/
- onLoad(() => {})
- onShow(() => {
- uni.$off('addInfoEvent');
- uni.$off('addUnfitInfoEvent')
- })
- onMounted(() => {
- const instance = getCurrentInstance().proxy
- const eventChannel = instance.getOpenerEventChannel();
- eventChannel.on('acceptDataFromOpenerPage', function(data) {
- if (data && data.data) {
- dayworkInfo.value = data.data
- console.log(dayworkInfo.value)
- init({
- id: data.data.id
- })
- } else {
- let reqParam = {
- id: dayworkInfo.value.id
- }
- init(reqParam);
- }
- })
- })
- /***************************** 定义了一些方法 *****************************/
- const init = (data) => {
- //获取当前跟选报工合格数最大值
- // getDictInfoByType("sort_report_limit").then(res => {
- // console.log(res.data && res.data.length >0)
- // if(res.data && res.data.length >0) {
- // qualifiedNumRatio.value =parseInt(res.data[0].dictValue)
- // }
- // }).catch(err => {
- // console.log(err)
- // console.log('369 err')
- // })
- console.log(data)
- console.log("dayworkInfo", dayworkInfo.value);
- // 获取当前报工信息
- getSortingDayworkItem(data).then(res => {
- console.log(res)
- if (res.code === 200) {
- dayworkItem.value = res.data
- //判断是否显示零存
- if (dayworkItem.value.processStepNumber == dayworkInfo.value.processSequence[dayworkInfo.value
- .processSequence.length - 1].processStepNumber) {
- saveFlag.value = true
- } else {
- saveFlag.value = false
- }
- console.log(dayworkItem.value)
- if (dayworkItem.value.status == 0 && dayworkItem.value.qualifiedNum === 0 && dayworkItem.value
- .rejectNum === 0) {
- dayworkItem.value.qualifiedNum = res.data.prodNum
- }
- retrievalInfo.value = res.data.retrievalInfo
- storageInfo.value = res.data.storageInfo
- console.log(Object.keys(storageInfo.value).length === 0)
- if (Object.keys(storageInfo.value).length !== 0) {
- storageNum.value = storageInfo.value.storageNum
- }
- consultations.value = res.data.consults
- unfitInfos.value = res.data.rejectList
- } else {
- uni.showToast({
- icon: 'none',
- title: res.message
- })
- }
- })
- }
- const addInfo = (data) => {
- data.forEach(item => {
- console.log(retrievalInfo.value)
- retrievalInfo.value.push(item)
- })
- console.log(data)
- uni.$off('addInfoEvent');
- }
- //添加零取批次
- function handleAddLot() {
- console.log('調用 handleAddLot')
- uni.$on('addInfoEvent', (data) => {
- addInfo(data.data)
- })
- console.log(dayworkItem.value)
- const info = {
- deptId: dayworkItem.value.deptId,
- productId: dayworkItem.value.daywork.productId,
- drawingNumber: dayworkItem.value.drawingNumber,
- technologyVersion: dayworkItem.value.technologyVersion,
- retrievalLotId: dayworkItem.value.lotId,
- hasAddedList: retrievalInfo.value
- }
- // 将 info 对象转换为 JSON 字符串
- const serializedData = JSON.stringify(info);
- // 对 JSON 字符串进行 URL 编码
- const encodedData = encodeURIComponent(serializedData);
- // 构建 URL,确保使用正确编码的数据
- uni.navigateTo({
- url: `/pages/sortingOutsource/storageRetrieval?data=${encodedData}`
- });
- }
- const addUnfitInfo = (data) => {
- console.log(data)
- if (data && data.length > 0) {
- for (var i = 0; i < data.length; i++) {
- const info = {
- inspectionInstructionId: data[i].id,
- title: data[i].title,
- standard: data[i].standard,
- checkStandard: data[i].standard,
- type: data[i].type,
- reason: ''
- }
- unfitInfos.value.push(info)
- }
- }
- }
- function dele(ite, index) {
- if (ite.status == 1) {
- uni.showToast({
- icon: 'none',
- title: '已被领取,不能删除'
- })
- } else {
- retrievalInfo.value.splice(index, 1);
- }
- }
- const addConsultation = (data) => {
- const info = {
- dayworkItemId: dayworkItem.value.id,
- content: data.content,
- userId: store.userInfo.userId,
- nickName: store.userInfo.nickName,
- dayworkId: dayworkItem.value.dayworkId,
- productionPlandetailId: dayworkItem.value.productionPlandetailId,
- productionPlanDetailSubDetailId: dayworkItem.value.productionPlanDetailSubDetailId,
- lotId: dayworkItem.value.lotId,
- lotCode: dayworkItem.value.lotCode,
- productId: dayworkItem.value.productId,
- productDescription: dayworkItem.value.productDescription,
- technologicalProcessId: dayworkItem.value.technologicalProcessId,
- technologicalProcessDetailId: dayworkItem.value.technologicalProcessDetailId,
- processId: dayworkItem.value.processId,
- processAlias: dayworkItem.value.process.processAlias,
- // technicianId: dayworkItem.value.technicianId,
- technicianId: data.technicianId,
- departments: data.departments,
- pictures: data.pictures
- }
- saveConsult(info).then(res => {
- if (res.code === 200) {
- consultations.value = res.data
- console.log(consultations.value)
- } else {
- uni.showToast({
- icon: 'none',
- title: res.message
- })
- }
- })
- isEventTriggered.value = true; // 更新标志位状态
- consultations.value.push(info)
- }
- /***************************** 定义了一些事件 *****************************/
- // 添加不合格信息
- async function handleAddUnfit() {
- // 监听事件
- uni.$once('addUnfitInfoEvent', (data) => {
- addUnfitInfo(data)
- })
- const hasInstruction = await getHasInstruction();
- console.log(hasInstruction); // 这将打印 true 或 false
- if (!hasInstruction) {
- uni.navigateTo({
- url: "/pages/sortingOutsource/specialOptions",
- success: (res) => {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('acceptDataFromOpenerPage', {
- data: dayworkItem.value,
- query: {
- productId: dayworkItem.value.daywork.productId,
- processId: dayworkItem.value.process.id,
- // technologyVersion: dayworkItem.value.technologicalProcessDetail.technologyVersion
- technologyVersion: dayworkItem.value.technologyVersion
- },
- index: unfitInfos.value.length
- })
- }
- })
- } else {
- console.log(dayworkItem.value)
- uni.navigateTo({
- url: "/pages/sorting/options",
- success: (res) => {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('acceptDataFromOpenerPage', {
- data: dayworkItem.value,
- query: {
- productId: dayworkItem.value.daywork.productId,
- processCode: dayworkItem.value.process.processCode,
- // technologyVersion: dayworkItem.value.technologicalProcessDetail.technologyVersion
- technologyVersion: dayworkItem.value.technologyVersion
- },
- index: unfitInfos.value.length
- })
- }
- })
- }
- }
- async function getHasInstruction() {
- console.log(dayworkItem.value)
- const res = await selectInstructionList({
- technologicalProcessId: dayworkItem.value.technologicalProcessId,
- processCode: dayworkItem.value.process.processCode,
- lotId: dayworkItem.value.lotId
- })
- return res.data
- // .then(res=> {
- // console.log(res.data)
- // return res.data
- // })
- }
- // 删除不合格信息
- const handleDelUnfit = (index) => {
- let tempInfo = unfitInfos.value[index]
- console.log(tempInfo)
- uni.showModal({
- title: '提示',
- content: '确定删除该项?',
- success: function(res) {
- if (res.confirm) {
- dayworkItem.value.rejectNum = dayworkItem.value.rejectNum - tempInfo.rejectNum
- dayworkItem.value.qualifiedNum = parseInt(dayworkItem.value.qualifiedNum) + parseInt(
- tempInfo.rejectNum)
- unfitInfos.value.splice(index, 1)
- } else if (res.cancel) {
- return
- }
- }
- })
- }
- /* 更换载具*/
- function handleChangeCarrier(item) {
- // uni.$once('refreshQuickReport', () => {
- // init()
- // })
- store.dayworkInfo = null
- uni.navigateTo({
- url: "/pages/changeBox/index",
- success: function(res) {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('sortingFromOpenerPage', {
- data: dayworkItem.value
- })
- }
- })
- }
- // 添加咨询信息
- const handleAddConsultation = () => {
- isEventTriggered.value = false; // 更新标志位状态
- // 监听事件
- uni.$once('addConsulttationEvent', (data) => {
- if (!isEventTriggered.value) {
- // 如果事件尚未触发,则执行事件触发逻辑
- addConsultation(data)
- }
- })
- uni.navigateTo({
- url: "/pages/sortingOutsource/consultation",
- success: (res) => {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('acceptDataFromOpenerPage', {
- data: dayworkItem.value
- })
- }
- })
- }
- const checkFinishable = () => {
- if (consultations.value.findIndex(v => v.status === 0) >= 0) {
- return false
- } else {
- return true
- }
- }
- const showStatus = (status) => {
- // console.log(status)
- switch (status) {
- case 0:
- return '未确认'
- case 1:
- return '不合格'
- case 2:
- return '合格'
- default:
- return ''
- }
- }
- function selectText(item) {
- // for (var i = 0; i < consul.length; i++) {
- // if (item.status == consul[i].value) {
- // return consul[i].text
- // }
- // }
- if (item.consultResultId == 0) {
- return '待确认'
- } else {
- return item.result
- }
- }
- const showStatusColor = (status) => {
- // console.log(status)
- switch (status) {
- case 0:
- return '#fcab53'
- case 1:
- return '#fc044f'
- case 2:
- return '#1deb19'
- default:
- return ''
- }
- }
- const rejectNumberChange = () => {
- let sumReject = 0
- unfitInfos.value.forEach(v => {
- sumReject += v.rejectNum == null ? 0 : Number(v.rejectNum)
- })
- dayworkItem.value.rejectNum = sumReject
- dayworkItem.value.qualifiedNum = dayworkItem.value.prodNum - sumReject
- console.log(dayworkItem.value)
- }
- const validHandle = () => {
- console.log(storageNum.value == "")
- if (storageNum.value != null && storageNum.value != "" && storageNum.value <= 0) {
- uni.showToast({
- icon: 'none',
- title: "存入数量应大于0",
- duration: 2000
- })
- return false;
- }
- for (let i = 0; i < unfitInfos.value.length; i++) {
- const e = unfitInfos.value[i]
- if (e.rejectNum == null || e.rejectNum == 0) {
- uni.showToast({
- icon: 'none',
- title: `第${i + 1}条不合格信息未输入不合格数量`
- })
- return false
- }
- }
- if (dayworkItem.value.qualifiedNum === null || dayworkItem.value.qualifiedNum === "") {
- uni.showToast({
- icon: 'none',
- title: "合格数不能为空",
- duration: 2000
- })
- return false;
- }
- if (isFinish.value && dayworkItem.value.qualifiedNum == 0) {
- uni.showToast({
- icon: 'none',
- title: "合格数不能为0",
- duration: 2000
- })
- return false;
- }
- if (dayworkItem.value.qualifiedNum > dayworkItem.value.prodNum) {
- uni.showToast({
- icon: 'none',
- title: "合格数不能超过投产数",
- duration: 2000
- })
- return false;
- }
- if (dayworkItem.value.qualifiedNum < 0) {
- uni.showToast({
- icon: 'none',
- title: "合格数不能为负数,请检查不合格信息后提交",
- duration: 2000
- })
- return false;
- }
- //只在结束报工的时候判断
- // if(isFinish.value &&dayworkItem.value.qualifiedNum > (dayworkItem.value.prodNum * (qualifiedNumRatio.value/100))){
- // uni.showToast({
- // icon: 'none',
- // title: "合格数不能超过投产量的"+qualifiedNumRatio.value+"%",
- // duration: 2000
- // })
- // return false;
- // }
- return true
- // unfitInfos.value.forEach((e, i) => {
- // if (e.name)
- // })
- }
- async function handleCheckStock() {
- let currentProcessStepNumber = dayworkInfo.value.currentProcess.processStepNumber;
- let lastProcess = dayworkInfo.value.processSequence[dayworkInfo.value.processSequence.length - 1];
- // 判断当前工序是否是最后一道序
- if (currentProcessStepNumber === lastProcess.processStepNumber) {
- // 等待 getTakeStockPeriod() 的 Promise 完成
- const res = await getTakeStockPeriod({
- dayworkId: dayworkInfo.value.id
- });
- console.log(res.data.length);
- if (res.data.length > 0) {
- uni.showToast({
- icon: 'none',
- title: "此次盘点未结束,不能结束报工",
- duration: 2000
- });
- return false; // 如果盘点未结束,返回 false
- }
- }
- // 如果不是最后一道工序或盘点已结束,返回 true
- return true;
- }
- async function handleFinishDaywork() {
- isFinish.value = true
- if (!validHandle()) {
- return
- }
- //判断当前批次是否在盘点,如果盘点未结束,则不能结束报工
- let checkStockResult = await handleCheckStock();
- console.log(checkStockResult)
- if (!checkStockResult) {
- return;
- }
- //零存数据
- if (storageNum.value != null && storageNum.value != "") {
- if (Object.keys(storageInfo.value).length === 0) {
- storageInfo.value = {
- productionPlanDetailId: dayworkItem.value.productionPlanDetailId,
- productDescription: dayworkItem.value.productDescription,
- drawingNumber: dayworkItem.value.drawingNumber,
- lotId: dayworkItem.value.lotId,
- lotCode: dayworkItem.value.lotCode,
- deptId: dayworkItem.value.deptId,
- productId: dayworkItem.value.daywork.productId,
- technologyVersion: dayworkItem.value.technologyVersion,
- storageNum: storageNum.value,
- storagerId: store.userInfo.userId,
- }
- } else {
- storageInfo.value.storageNum = storageNum.value
- }
- } else {
- storageInfo.value = null
- }
- //零取数据
- if (retrievalInfo.value.length > 0) {
- retrievalInfo.value.forEach(item => {
- item.retrievalLotId = dayworkItem.value.lotId,
- item.retrievalLotCode = dayworkItem.value.lotCode,
- item.retrievalerId = store.userInfo.userId,
- item.retrievalTime = timestampToTime(new Date())
- })
- }
- const saveData = {
- rejectList: unfitInfos.value,
- consult: consultations.value,
- id: dayworkItem.value.id,
- prodNum: dayworkItem.value.prodNum,
- rejectNum: dayworkItem.value.rejectNum,
- qualifiedNum: dayworkItem.value.qualifiedNum,
- equipmentDetailId: dayworkItem.value.equipmentDetailId,
- equipmentDetailCode: dayworkItem.value.equipmentDetailCode,
- remark: dayworkItem.value.remark,
- storageInfo: storageInfo.value,
- retrievalInfo: retrievalInfo.value
- }
- const currentTime = Date.now();
- // 检查是否已经过去了 2 秒
- if (currentTime - lastRequestTimestamp.value < 2000) {
- // 如果在 2 秒 内已经点击,那么不执行
- uni.showToast({
- icon: 'none',
- title: `请勿重复点击`,
- duration: 2000
- })
- return;
- }
- lastRequestTimestamp.value = currentTime;
- console.log(saveData)
- finishInner(saveData).then(res => {
- if (res.code === 200) {
- uni.navigateBack()
- } else {
- uni.showToast({
- icon: 'none',
- title: res.message
- })
- }
- })
- }
- const handleUpdateDaywork = () => {
- isFinish.value = false
- if (!validHandle()) {
- return
- }
- //零存数据
- if (storageNum.value != null && storageNum.value != "") {
- if (Object.keys(storageInfo.value).length === 0) {
- storageInfo.value = {
- productionPlanDetailId: dayworkItem.value.productionPlanDetailId,
- productDescription: dayworkItem.value.productDescription,
- drawingNumber: dayworkItem.value.drawingNumber,
- lotId: dayworkItem.value.lotId,
- lotCode: dayworkItem.value.lotCode,
- deptId: dayworkItem.value.deptId,
- productId: dayworkItem.value.daywork.productId,
- technologyVersion: dayworkItem.value.technologyVersion,
- storageNum: storageNum.value,
- storagerId: store.userInfo.userId,
- }
- } else {
- storageInfo.value.storageNum = storageNum.value
- }
- } else {
- storageInfo.value = null
- }
- //零取数据
- if (retrievalInfo.value.length > 0) {
- retrievalInfo.value.forEach(item => {
- item.retrievalLotId = dayworkItem.value.lotId,
- item.retrievalLotCode = dayworkItem.value.lotCode,
- item.retrievalerId = store.userInfo.userId,
- item.retrievalTime = timestampToTime(new Date())
- })
- }
- const saveData = {
- rejectList: unfitInfos.value,
- consult: consultations.value,
- id: dayworkItem.value.id,
- prodNum: dayworkItem.value.prodNum,
- rejectNum: dayworkItem.value.rejectNum,
- qualifiedNum: dayworkItem.value.qualifiedNum,
- equipmentDetailId: dayworkItem.value.equipmentDetailId,
- equipmentDetailCode: dayworkItem.value.equipmentDetailCode,
- remark: dayworkItem.value.remark,
- storageInfo: storageInfo.value,
- retrievalInfo: retrievalInfo.value
- }
- console.log(saveData)
- update(saveData).then(res => {
- if (res.code === 200) {
- uni.$emit("formBack")
- uni.navigateBack()
- } else {
- uni.showToast({
- icon: 'none',
- title: res.message
- })
- }
- })
- }
- </script>
- <style lang="scss">
- .buttonOp {
- margin-top: 5px;
- }
- .page-container {
- // height: 100%;
- background-color: #ececec;
- font-size: 28rpx;
- overflow: auto;
- >.title {
- font-weight: 700;
- margin: 24rpx 16rpx;
- }
- }
- .add-btn {
- padding: 12rpx 32rpx;
- background-color: #a4adb3;
- color: #ffffff;
- border-radius: 12rpx;
- font-size: 24rpx;
- }
- .lot-info {
- margin: 32rpx 16rpx 0 16rpx;
- padding: 24rpx;
- background-color: #ffffff;
- border-radius: 8rpx;
- .lot-code {
- font-size: 32rpx;
- font-weight: 700;
- margin-bottom: 16rpx;
- }
- .product-info {
- font-size: 28rpx;
- color: #9f9f9f;
- }
- }
- .middle {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center
- }
- .segment {
- width: 80%;
- background-color: rgba(213, 213, 213, 1);
- border: 1rpx solid rgba(213, 213, 213, 1);
- margin: 16px 0;
- }
- .unfit-title {
- margin-bottom: 24rpx;
- justify-content: space-between;
- align-items: center;
- text {
- font-size: 28rpx;
- font-weight: 700;
- }
- .add-btn {
- padding: 12rpx 32rpx;
- background-color: #a4adb3;
- color: #ffffff;
- border-radius: 12rpx;
- font-size: 24rpx;
- }
- }
- .save {
- align-items: center;
- padding-bottom: 32rpx;
- justify-content: space-between;
- input {
- height: 56rpx;
- border: 1px solid #9f9f9f;
- font-size: 28rpx;
- &.number {
- width: 60%;
- text-align: center;
- }
- }
- }
- .unfit-container {
- padding: 24rpx;
- margin: 0 16rpx;
- background-color: #ffffff;
- border-radius: 12rpx;
- .unfit-item-container {
- position: relative;
- >* {
- margin-bottom: 24rpx;
- }
- .title {
- font-weight: 700;
- justify-content: space-between;
- align-items: center;
- image {
- width: 40rpx;
- height: 40rpx;
- }
- }
- .standard {}
- .result {
- align-items: center;
- border-bottom: 1px solid #9f9f9f;
- padding-bottom: 32rpx;
- .label {
- flex: 1;
- }
- input {
- width: 280rpx;
- height: 56rpx;
- border: 1px solid #9f9f9f;
- font-size: 28rpx;
- &.number {
- width: 104rpx;
- text-align: center;
- }
- }
- }
- }
- .unfit-item-container:last-child {
- .result {
- border-bottom: none;
- padding-bottom: 0;
- }
- }
- }
- .consultation-container {
- margin: 0 16rpx;
- padding: 24rpx;
- background-color: #ffffff;
- border-radius: 8rpx;
- .consultation-item-container {
- margin-bottom: 24rpx;
- border-bottom: 2px solid #888888;
- padding-bottom: 24rpx;
- }
- .consultation-item-container:last-child {
- margin-bottom: 0;
- border-bottom: 0;
- padding-bottom: 0;
- }
- .question,
- .answer {
- .label {
- justify-content: space-between;
- margin-bottom: 16rpx;
- font-weight: 700;
- }
- .content {
- line-height: 40rpx;
- }
- }
- .answer {
- margin-top: 24rpx;
- }
- }
- .daywork-container {
- margin-top: 24rpx;
- padding: 24rpx;
- background-color: #ffffff;
- border: 1px solid #bcbcbc;
- .result {
- align-items: center;
- .label {
- width: 112rpx;
- }
- input {
- flex: 1;
- height: 56rpx;
- border: 1px solid #9f9f9f;
- font-size: 28rpx;
- text-align: center;
- }
- }
- .remark {
- margin-top: 24rpx;
- .label {
- width: 112rpx;
- }
- textarea {
- flex: 1;
- border: 1px solid #9f9f9f;
- height: 168rpx;
- }
- }
- .btns-container {
- margin-top: 24rpx;
- .bottom-btn {
- display: flex;
- flex: 1;
- height: 80rpx;
- background-color: #5555ff;
- color: #ffffff;
- text-align: center;
- justify-content: center;
- align-items: center;
- border-radius: 8rpx;
- margin-right: 10rpx;
- &.left-btn {
- background-color: rgba(85, 85, 255, 1.0);
- }
- &.right-btn {
- margin-left: 24rpx;
- }
- }
- .finished-btn {
- display: flex;
- flex: 1;
- height: 80rpx;
- background-color: #fc6565;
- color: #ffffff;
- text-align: center;
- justify-content: center;
- align-items: center;
- border-radius: 8rpx;
- }
- .pause-btn {
- display: flex;
- flex: 1;
- height: 80rpx;
- background-color: #55d90d;
- color: #ffffff;
- text-align: center;
- justify-content: center;
- align-items: center;
- border-radius: 8rpx;
- margin-left: 12rpx;
- }
- .question-btn {
- width: 80rpx;
- align-items: flex-end;
- image {
- width: 48rpx;
- height: 48rpx;
- }
- text {
- font-size: 24rpx;
- }
- }
- }
- }
- .zb-table .item-tr {
- flex-direction: row;
- }
- </style>
|