From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 28 五月 2025 16:48:52 +0800 Subject: [PATCH] 初始化项目 --- pages/daily/common/work-reporting.vue | 1644 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 1,644 insertions(+), 0 deletions(-) diff --git a/pages/daily/common/work-reporting.vue b/pages/daily/common/work-reporting.vue new file mode 100644 index 0000000..7db9c3f --- /dev/null +++ b/pages/daily/common/work-reporting.vue @@ -0,0 +1,1644 @@ +<template> + <view class="work-reporting"> + <u-navbar title="鎶ュ伐" :border-bottom="false" :background="background" :title-size="40" :title-bold="true" + title-color="#FFFFFF" back-icon-color="#fff"> + <view v-if=" + (isShowWorkCenter('WK-01') && workOrder.operationId === workOrder.lastOperationId) || + isOperationName('TX-01', '绾靛壀') || + isOperationName('TX-02', '鍙犺') || + isShowWorkCenter('ZZ-03') || + isNotOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补') + " class="navbar-right" slot="right" @click="goTagList"> + 鏍囩璁板綍 + </view> + <view v-if="isSubmit" class="navbar-right" slot="right" @click="searchDevice"> + 鎼滅储璁惧 + </view> + </u-navbar> + <scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y"> + <view class="form"> + <h3 class="form-title">鎶ュ伐淇℃伅</h3> + <u-icon class="icon_report" size="170rpx" /> + <u-form :model="form" ref="uForm"> + <!--绫诲瀷--> + <u-form-item v-if="isShowWorkCenter('BJ-01')" label="绫诲瀷" prop="typeLabel" required + :label-width="180"> + <u-input v-model="form.typeLabel" placeholder="璇烽�夋嫨" /> + <u-icon name="arrow-right" color="#687792" size="28" @click="workTypeSelect = true"></u-icon> + </u-form-item> + <!--鍙版暟--> + <u-form-item v-if=" + isShowWorkCenter('BJ-01') || + isOperationName('TX-01', '妯壀')" label="鍙版暟" prop="qty" required :label-width="180"> + <u-input v-model="form.qty" placeholder="璇疯緭鍏�" /> + </u-form-item> + <!--鏉$爜缂栧彿--> + <u-form-item v-if=" + isShowWorkCenter('TM-01,JG-01,ZZ-03,BZ-01,YB-04') || + isFirstOperationId('DY-01,GY-01,YB-01,YB-02,ZM-01') || + (workOrder.operationId === workOrder.lastOperationId && isShowWorkCenter('WK-01')) || + isOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补') || + isOperationName('TX-02', '鍙犺') || + (isShowWorkCenter('TX-02') && workOrder.operationName !== '鍙犺') || + isNotOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补')" label="鏉$爜缂栧彿" prop="labelNo" required :label-width="180"> + <u-input v-if ="isShowWorkCenter('TM-01,JG-01,YB-04') || isFirstOperationId( + 'DY-01,GY-01,YB-01,YB-02,ZM-01')|| + (isShowWorkCenter('TX-02') && workOrder.operationName !== '鍙犺')" v-model="form.labelNo" placeholder="璇锋壂鐮�" disabled /> + <u-input v-else v-model="form.labelNo" placeholder="璇疯緭鍏�" @blur="identifyingQrCodesBlur"/> + <u-icon name="scan" color="#2c4ce4" size="40" @click="identifyingQrCodes"></u-icon> + </u-form-item> + <!--宸ュ簭绫诲瀷--> + <u-form-item v-if=" + isShowWorkCenter('ZZ-03') || + (isOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补') && isOilChange)" label="宸ュ簭绫诲瀷" prop="operationTypeLabel" required + :label-width="180" @click="operationTypeSelect = true"> + <u-input v-model="form.operationTypeLabel" placeholder="璇烽�夋嫨" /> + <u-icon name="arrow-right" color="#687792" size="28" + @click="operationTypeSelect = true"></u-icon> + </u-form-item> + <!--瀹屾垚鏁伴噺--> + <u-form-item v-if=" + isShowWorkCenter('WK-01,ZZ-03,BZ-01') || + isOperationName('TX-02', '鍙犺') || + (isOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补') && isFanAssembly) || + isNotOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补')" label="瀹屾垚鏁伴噺" prop="finishQty" required :label-width="180"> + <u-input v-model="form.finishQty" placeholder="璇疯緭鍏�" /> + </u-form-item> + <!--闀垮害--> + <u-form-item v-if="isShowWorkCenter('') || isOperationName('TX-01', '绾靛壀')" label="闀垮害" prop="length" + required :label-width="180"> + <u-input v-model="form.length" placeholder="璇疯緭鍏�" @blur="calculateWeight" /> + </u-form-item> + <!--閲嶉噺--> + <u-form-item v-if="isShowWorkCenter('') || isOperationName('TX-01', '绾靛壀')" label="閲嶉噺" prop="weight" + required :label-width="180"> + <u-input v-model="form.weight" placeholder="鍙嶆樉" disabled /> + </u-form-item> + <!--浜у嚭绫诲埆--> + <u-form-item v-if=" + isShowWorkCenter('') || + isOperationName('TX-01', '妯壀')" label="浜у嚭绫诲埆" prop="outputCategoryLabel" required :label-width="180"> + <u-input v-model="form.outputCategoryLabel" placeholder="璇烽�夋嫨" /> + <u-icon name="arrow-right" color="#687792" size="28" + @click="showOutputCategory = true"></u-icon> + <u-select v-model="showOutputCategory" :list="outputCategoryList" + @confirm="outputCategoryFirm"></u-select> + </u-form-item> + <!--鐗囧--> + <u-form-item v-if=" + isShowWorkCenter('') || + (isOperationName('TX-01', '妯壀') && form.outputCategoryLabel !== '涓煴')" label="鐗囧" prop="sliceWidth" required + :label-width="180"> + <u-input v-model="form.sliceWidth" placeholder="璇烽�夋嫨" /> + </u-form-item> + <!--鐗囨枡鏁伴噺--> + <u-form-item v-if=" + isShowWorkCenter('') || + isOperationName('TX-01', '妯壀')" label="鐗囨枡鏁伴噺" prop="sliceQty" required :label-width="180"> + <u-input v-model="form.sliceQty" placeholder="璇疯緭鍏�" /> + </u-form-item> + <!--绾垮湀绫诲瀷--> + <u-form-item v-if=" + isShowWorkCenter('TM-01,JG-01,YB-04') || + isFirstOperationId('DY-01,GY-01,YB-01,YB-02,ZM-01')" label="绾垮湀绫诲瀷" prop="weight" required :label-width="180"> + <u-input v-model="form.weightTwo" placeholder="鍙嶆樉" disabled /> + </u-form-item> + <!--鍥惧彿--> + <u-form-item v-if=" + isShowWorkCenter('TM-01,JG-01,YB-04') || + isFirstOperationId('DY-01,GY-01,YB-01,YB-02,ZM-01') || + (isShowWorkCenter('TX-02') && workOrder.operationName !== '鍙犺')" label="鍥惧彿" prop="drawNo" required + :label-width="180"> + <u-input v-model="form.drawNo" placeholder="鍙嶆樉" disabled /> + </u-form-item> + <!--瑙勬牸鍨嬪彿--> + <u-form-item v-if=" + isShowWorkCenter('TM-01,JG-01,YB-04') || + isFirstOperationId('DY-01,GY-01,YB-01,YB-02,ZM-01') || + (isShowWorkCenter('TX-02') && workOrder.operationName !== '鍙犺')" label="瑙勬牸鍨嬪彿" prop="weight" required + :label-width="180"> + <u-input v-model="form.weight" placeholder="鍙嶆樉" disabled /> + </u-form-item> + <!--澶逛欢鍙婂叾浠栭噸閲�--> + <u-form-item v-if="isOperationName('TX-02', '鍙犺')" label="澶逛欢鍙婂叾浠栭噸閲�" prop="clampOtherWeight" required + :label-width="180"> + <u-input v-model="form.clampOtherWeight" placeholder="璇疯緭鍏�" /> + </u-form-item> + <!--鎴愬搧閲嶉噺--> + <u-form-item v-if="isOperationName('TX-02', '鍙犺')" label="鎴愬搧閲嶉噺" prop="prodWeight" required + :label-width="180"> + <u-input v-model="form.prodWeight" placeholder="璇疯緭鍏�" /> + </u-form-item> + </u-form> + </view> + <view class="scan-code-feeding" v-if=" + isShowWorkCenter('BZ-01') || + isOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补') || + isOperationName('TX-01', '绾靛壀') || + isOperationName('TX-01', '妯壀') || + isOperationName('TX-02', '鍙犺') || + isNotOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补')"> + <h3 class="form-title">鎵爜鎶曟枡</h3> + <u-icon class="icon_camera" size="82rpx" @click="qrCode" /> + <u-input v-model="partID" placeholder="璇疯緭鍏ョ墿鏂�" @blur="getPart"/> + <view class="infoform" v-for="(item,index) in infoFormList" :key="'item'+index"> + <p> + <u-icon class="icon_zl" size="24rpx" /> + <span style="margin-right: 18rpx">鍓╀綑閲嶉噺:</span> + <u-input :border="true" v-model="item.qtyRequired" label="鍓╀綑閲嶉噺" + style="width: 450rpx;height: 56rpx;display: inline-flex;background: #F6FAFF;border-radius: 8rpx;border: 1px solid #214DED;align-items: center;"></u-input> + </p> + <p> + <u-icon class="icon_7" size="24rpx" /> + <span>鎵规鍙�:{{item.lotBatchNo}}</span> + </p> + <p> + <u-icon class="icon_6" size="24rpx" /> + <span>闆朵欢鍚嶇О锛歿{item.partName}}</span> + </p> + <u-divider :use-slot="false" half-width="640"></u-divider> + <view class="buttonFlex"> + <button class="delete-button" type="warn" @click="deleteInfo(index)"> + <u-icon class="icon_del" size="32rpx" /> + 鍒犻櫎 + </button> + <button class="primary-button" v-if="isOperationName('TX-01', '妯壀') && isSubmit" type="primary" + plain="true" @click="printQrCode(item)"> + <u-icon class="icon_dy" size="32rpx" /> + 鏍囩鎵撳嵃 + </button> + </view> + </view> + </view> + <view class="scan-code-feeding" v-if=" + isShowWorkCenter('ZZ-03')&& isWorkStationName('ZZ-03','绠变綋缁勮')"> + <h3 class="form-title">鎵爜鎶曟枡</h3> + <u-icon class="icon_camera" size="82rpx" @click="qrCode" /> + <u-input v-model="partID" placeholder="璇疯緭鍏ョ墿鏂�" @blur="getPart"/> + <view class="infoform" v-for="(item,index) in infoFormList" :key="'item'+index"> + <p> + <u-icon class="icon_zl" size="24rpx" /> + <span style="margin-right: 18rpx">鍓╀綑閲嶉噺:</span> + <u-input :border="true" v-model="item.qtyRequired" label="鍓╀綑閲嶉噺" + style="width: 450rpx;height: 56rpx;display: inline-flex;background: #F6FAFF;border-radius: 8rpx;border: 1px solid #214DED;align-items: center;"></u-input> + </p> + <p> + <u-icon class="icon_7" size="24rpx" /> + <span>鎵规鍙�:{{item.lotBatchNo}}</span> + </p> + <p> + <u-icon class="icon_6" size="24rpx" /> + <span>闆朵欢鍚嶇О锛歿{item.partName}}</span> + </p> + <u-divider :use-slot="false" half-width="640"></u-divider> + <view class="buttonFlex"> + <button class="delete-button" type="warn" @click="deleteInfo(index)"> + <u-icon class="icon_del" size="32rpx" /> + 鍒犻櫎 + </button> + <button class="primary-button" v-if="isOperationName('TX-01', '妯壀') && isSubmit" type="primary" + plain="true" @click="printQrCode(item)"> + <u-icon class="icon_dy" size="32rpx" /> + 鏍囩鎵撳嵃 + </button> + </view> + </view> + + <h3 class="form-title">楂樺帇鏌滅粦瀹�</h3> + <view class="infoform" v-for="(item,index) in hvCoilFormList" :key="'item'+index"> + <!-- <p> --> + <!-- <u-icon class="icon_zl" size="24rpx" /> --> + <!-- <span style="margin-right: 18rpx">鍓╀綑閲嶉噺:</span> --> + <!-- <u-input :border="true" v-model="item.qtyRequired" label="鍓╀綑閲嶉噺" --> + <!-- style="width: 450rpx;height: 56rpx;display: inline-flex;background: #F6FAFF;border-radius: 8rpx;border: 1px solid #214DED;align-items: center;"></u-input> --> + <!-- </p> --> + <p> + <u-icon class="icon_7" size="24rpx" /> + <span>渚跨缂栫爜:{{item}}</span> + </p> + <!-- <p> + <u-icon class="icon_7" size="24rpx" /> + <span>鎵规鍙�:{{item.lotBatchNo}}</span> + </p> + <p> + <u-icon class="icon_6" size="24rpx" /> + <span>闆朵欢鍚嶇О锛歿{item.partName}}</span> + </p> --> + <u-divider :use-slot="false" half-width="640"></u-divider> + <view class="buttonFlex"> + <button class="delete-button" type="warn" @click="deleteInfoGy(index)"> + <u-icon class="icon_del" size="32rpx" /> + 鍒犻櫎 + </button> + <!-- <button class="primary-button" + v-if="isOperationName('TX-02', '鍙犺')||isOperationName('TX-01', '妯壀') && isSubmit" + type="primary" plain="true" @click="printQrCode(item)"> + <u-icon class="icon_dy" size="32rpx" /> + 鏍囩鎵撳嵃 + </button> --> + </view> + </view> + + <h3 class="form-title">浣庡帇鏌滅粦瀹�</h3> + <view class="infoform" v-for="(item,index) in lvCoilFormList" :key="'item'+index"> + <!-- <p> + <u-icon class="icon_zl" size="24rpx" /> + <span style="margin-right: 18rpx">鍓╀綑閲嶉噺:</span> + <u-input :border="true" v-model="item.qtyRequired" label="鍓╀綑閲嶉噺" + style="width: 450rpx;height: 56rpx;display: inline-flex;background: #F6FAFF;border-radius: 8rpx;border: 1px solid #214DED;align-items: center;"></u-input> + </p> --> + <p> + <u-icon class="icon_7" size="24rpx" /> + <span>渚跨缂栫爜:{{item}}</span> + </p> + <!-- <p> + <u-icon class="icon_7" size="24rpx" /> + <span>鎵规鍙�:{{item.lotBatchNo}}</span> + </p> + <p> + <u-icon class="icon_6" size="24rpx" /> + <span>闆朵欢鍚嶇О锛歿{item.partName}}</span> + </p> --> + <u-divider :use-slot="false" half-width="640"></u-divider> + <view class="buttonFlex"> + <button class="delete-button" type="warn" @click="deleteInfoDy(index)"> + <u-icon class="icon_del" size="32rpx" /> + 鍒犻櫎 + </button> + <!-- <button class="primary-button" v-if="isOperationName('TX-01', '妯壀') && isSubmit" type="primary" + plain="true" @click="printQrCode(item)"> + <u-icon class="icon_dy" size="32rpx" /> + 鏍囩鎵撳嵃 + </button> --> + </view> + </view> + + </view> + </scroll-view> + <view class="bottom" v-if=" + !(isShowWorkCenter('TM-01,JG-01,YB-04') || + isFirstOperationId('DY-01,GY-01,YB-01,YB-02,ZM-01') || + (isShowWorkCenter('TX-02') && workOrder.operationName !== '鍙犺'))"> + <u-button class="u-button" type="primary" @click="submit">鎻愪氦</u-button> + </view> + <u-toast ref="uToast" /> + <u-modal v-model="show" @confirm="confirm" content="鏄惁纭鍒犻櫎" show-cancel-button></u-modal> + <!-- 涓嬫媺妗� --> + <!-- 绫诲瀷 --> + <u-select v-model="workTypeSelect" :list="workTypeList" @confirm="workTypeTypeFirm"></u-select> + <!-- 宸ュ簭绫诲瀷 --> + <u-select v-model="operationTypeSelect" :list="operationTypeList" @confirm="operationTypeFirm"></u-select> + <view v-if="maskShow" class="uni-mask" @touchmove.stop.prevent="moveHandle" @click="maskclose"> + <scroll-view class="uni-scroll_box" scroll-y @touchmove.stop.prevent="moveHandle" @click.stop="moveHandle"> + <view class="uni-list-box" v-for="(item, index) in listDevice" :key="index" @click="tapQuery(item)"> + <view> + <view class="uni-list_name">鍚嶇О锛歿{ item.name }}</view> + <view class="uni-list_item">UUID:{{ item.address }}</view> + </view> + </view> + </scroll-view> + </view> + </view> +</template> + +<script> + import UIcon from "../../../uview-ui/components/u-icon/u-icon.vue"; + import { + dateFormat + } from "../../../utils/date" + + const jcapi = uni.requireNativePlugin("JCSDK-JCApiModule"); + + // 浜岀淮鐮佺被鍨� + const QrCodeType = { + QrCode: 31, + PDF417: 32, + DataMatrix: 33, + AZTEC: 34 + } + // 绾挎潯绫诲瀷 + const LineType = { + Solid: 1, // 瀹炵嚎 + Dotted: 2, // 铏氱嚎锛堥粯璁よ櫄瀹�1:1鐩搁棿锛� + } + // 鎹㈣鏂瑰紡 + const LineModeType = { + Justified: 1, // 瀹介珮鍥哄畾锛屽唴瀹硅嚜閫傚簲锛堝瓧鍙�/瀛楅棿璺�/琛岄棿璺濇寜姣斾緥缂╂斁锛� + AutoHeight: 2, // 瀹藉害鍥哄畾锛岄珮搴﹁嚜閫傚簲 + Fixed: 4, // 瀹介珮鍥哄畾锛岃秴鍑洪儴鍒嗚鍓� + Adapt: 6, // 瀹介珮鍥哄畾锛屽唴瀹硅秴杩囨椂棰勮瀹介珮鑷姩缂╁皬 + } + + export default { + name: "work-reporting", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: { + UIcon + }, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + partID:'',//鐗╂枡ID + background: { + backgroundColor: '#214DED', + }, + scrollTop: 0, + form: { + clazzType: '', // 鐝 + dutyNo: '', // 鐝缂栧彿 + locationId: '', // 搴撲綅id + operationTaskId: '', // 宸ュ崟id + reportTime: '', // 鎻愪氦鏃堕棿 + labelNo: '', // 鏉$爜缂栧彿 + qty: '', // 鍙版暟 + drawNo: '', // 鍥惧彿 + finishQty: '', // 瀹屾垚鏁伴噺 + identifyingQr: '', // 绾垮湀杞﹂棿-杩囪处-鎵爜缁撴灉 + type: '', // 绫诲瀷閫夋嫨鍣細value + typeLabel: '', // 绫诲瀷閫夋嫨鍣細label + operationType: '', // 宸ュ簭绫诲瀷閫夋嫨鍣細value + operationTypeLabel: '', // 宸ュ簭绫诲瀷閫夋嫨鍣細label + outputCategory: '', // 浜у嚭绫诲埆锛歷alue + outputCategoryLabel: '', // 浜у嚭绫诲埆锛歭abel + length: '', // 闀垮害, + siliconSteelCode: '', // 鎵爜鑾峰彇鍘傚淇℃伅鏉ユ枡妫�淇℃伅 + sliceWidth: '', // 鐗囧 + sliceQty: '', // 鐗囨枡鏁伴噺 + clampOtherWeight: '', // 澶逛欢鍙婂叾浠栭噸閲� + weightTwo: '' + }, + num: '', + rules: { + labelNo: [{ + required: true, + message: '璇烽�夋嫨鎵爜鎴栬緭鍏ョ紪鍙�', + trigger: ['blur'], + }], + typeLabel: [ // 绫诲瀷 + { + required: true, + message: '璇烽�夋嫨绫诲瀷', + trigger: ['change'], + } + ], + qty: [ // 鍙版暟 + { + required: true, + message: '璇峰~鍐欏彴鏁�', + trigger: ['blur'], + }, + // 姝e垯鍒ゆ柇鍙兘涓烘暟瀛� + { + validator: (rule, value, callback) => { + return this.$u.test.number(value); + }, + message: '鍙兘涓烘暟鍊�', + trigger: ['blur'], + }, + ], + operationTypeLabel: [ // 宸ュ簭绫诲瀷 + { + required: true, + message: '璇烽�夋嫨宸ュ簭绫诲瀷', + trigger: ['change'], + } + ], + finishQty: [ // 瀹屾垚鏁伴噺 + { + required: true, + message: '璇峰~鍐欏畬鎴愭暟閲�', + trigger: ['blur'], + }, + // 姝e垯鍒ゆ柇鍙兘涓烘暟瀛� + { + validator: (rule, value, callback) => { + return this.$u.test.number(value); + }, + message: '鍙兘涓烘暟鍊�', + trigger: ['blur'], + }, + ], + length: [ // 闀垮害, + { + required: true, + message: '璇峰~鍐欓暱搴�', + trigger: ['blur'], + }, + // 姝e垯鍒ゆ柇鍙兘涓烘暟瀛� + { + validator: (rule, value, callback) => { + return this.$u.test.number(value); + }, + message: '鍙兘涓烘暟鍊�', + trigger: ['blur'], + }, + ], + outputCategoryLabel: [ // 鐗囧 + { + required: true, + message: '璇峰~鍐欑墖瀹�', + trigger: ['change'], + } + ], + sliceQty: [ // 鐗囨枡鏁伴噺 + { + required: true, + message: '璇峰~鍐欑墖鏂欐暟閲�', + trigger: ['blur'], + }, + // 姝e垯鍒ゆ柇鍙兘涓烘暟瀛� + { + validator: (rule, value, callback) => { + return this.$u.test.number(value); + }, + message: '鍙兘涓烘暟鍊�', + trigger: ['blur'], + }, + ], + clampOtherWeight: [ // 澶逛欢鍙婂叾浠栭噸閲� + { + required: true, + message: '璇峰~鍐欏す浠跺強鍏朵粬閲嶉噺', + trigger: ['blur'], + }, + // 姝e垯鍒ゆ柇鍙兘涓烘暟瀛� + { + validator: (rule, value, callback) => { + return this.$u.test.number(value); + }, + message: '鍙兘涓烘暟鍊�', + trigger: ['blur'], + }, + ], + prodWeight: [ // 鎴愬搧閲嶉噺 + { + required: true, + message: '璇峰~鍐欐垚鍝侀噸閲�', + trigger: ['blur'], + }, + // 姝e垯鍒ゆ柇鍙兘涓烘暟瀛� + { + validator: (rule, value, callback) => { + return this.$u.test.number(value); + }, + message: '鍙兘涓烘暟鍊�', + trigger: ['blur'], + }, + ] + }, + showTypeSelect: false, + workTypeSelect: false, + operationTypeSelect: false, + showOutputCategory: false, + infoFormList: [], + hvCoilFormList: [], //绠变綋楂樺帇 + lvCoilFormList: [], //绠变綋浣庡帇 + workOrder: '', + id: '', + isSubmit: false, + show: false, + deleteIndex: '', + workTypeList: [], // 绫诲瀷list + operationTypeList: [], // 宸ュ簭绫诲瀷list + outputCategoryList: [], // 浜у嚭绫诲埆 + maskShow: false, + listDevice: [], //钃濈墮璁惧鏁版嵁 + isFanAssembly: false, // 鏄惁涓洪鏈鸿閰� + isOilChange: false, // 闆朵欢鍚嶇О鍖呭惈娌瑰彉 + } + }, + // 鏂规硶闆嗗悎 + methods: { + moveHandle() { + + }, + maskclose() { + + }, + //鎵撳嵃浜岀淮鐮� + async printQrCode(item) { + const params = { + rwMatlBindId: item.id + } + let res = await this.$u.api.dailyPaper.zongjianLabelInfo(params) + if (!res.data) { + this.$refs.uToast.show({ + title: '鏈煡璇㈠埌璇ユ爣绛句俊鎭紒', + type: 'warning ' + }) + return + } + // 鍒濆鍖栫敾鏉� + jcapi.initDrawingBoard({ + width: 50, + height: 100, + rotate: 0 + }); + let printData = res.data.ParamList[0] + // // 缁樺埗浜岀淮鐮� + jcapi.drawLabelQrCode({ + x: 14.5, + y: 74, + width: 20, + height: 20, + value: jsonString, + rotate: 0, + codeType: QrCodeType.QrCode, + }); + // 缁樺埗妯嚎 瀹炵嚎8鏉� + let sum = 4; + for (let i = 1; i < 13; i++) { + this.getDrawLabelLine(4, sum, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎 + sum = (i * 6) + 4 + } + // 浜岀淮鐮佸ぇ妗� + this.getDrawLabelLine(4, 97, 46, 0.5, 0, LineType.Solid) // 瀹炵嚎9 + + //缁樺埗绔栫嚎 + this.getDrawLabelLine(4, 4, 0.5, 97, 0, LineType.Solid) // 绔栫嚎1 + this.getDrawLabelLine(20, 4, 0.5, 66, 0, LineType.Solid) // 绔栫嚎2 + this.getDrawLabelLine(44.5, 4, 0.5, 97, 0, LineType.Solid) // 绔栫嚎2 + + // 濉啿鏂囧瓧鏍囬 + this.getDrawLabelText(5, 5, 20, 20, '缂� 鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 11, 20, 20, '宸ュ崟鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 17, 20, 20, '鐗� 鍙�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 23, 20, 20, '鐗囧锛坢m锛�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 29, 20, 20, '鍘氬害锛坢m锛�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 35, 20, 20, '閲嶉噺锛圞G锛�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 41, 20, 20, '闀垮害锛坢锛�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 47, 20, 20, '鐢熶骇浜�:', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 53, 20, 20, '鐢熶骇鏃堕棿:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 59, 20, 20, '鍘傚:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + this.getDrawLabelText(5, 65, 20, 20, '閾佹崯:', 3.4, 0, LineModeType.AutoHeight, 0, 0, 0, 1) + + let labelNo = JSON.stringify(printData.labelNo).replace(/"/g, "") + let optaskNo = JSON.stringify(printData.optaskNo).replace(/"/g, "") + let sliceWidth = JSON.stringify(printData.sliceWidth ? printData.sliceWidth : '').replace(/"/g, "") + let thickness = JSON.stringify(printData.thickness ? printData.thickness : '').replace(/"/g, "") + let wweight = JSON.stringify(printData.wweight ? printData.wweight : '').replace(/"/g, "") + let llength = JSON.stringify(printData.llength ? printData.llength : '').replace(/"/g, "") + let reportTime = JSON.stringify(item.reportTime).replace(/"/g, "") + let reportName = JSON.stringify(item.reportName).replace(/"/g, "") + let grade = JSON.stringify(printData.grade ? printData.grade : '').replace(/"/g, "") + let ironLoss = JSON.stringify(printData.ironLoss ? printData.ironLoss : '').replace(/"/g, "") + let supplierVenderName = JSON.stringify(printData.supplierVenderName ? printData.supplierVenderName : + '').replace(/"/g, "") + + // // 濉啿鍙傛暟鍊� + this.getDrawLabelText(22, 5, 35, 12, labelNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 11, 35, 12, optaskNo, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 17, 35, 12, grade, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 23, 35, 12, sliceWidth, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 29, 35, 12, thickness, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 35, 35, 12, wweight, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 41, 35, 12, llength, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 47, 35, 12, reportName, 2, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 53, 35, 12, reportTime, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 59, 35, 12, supplierVenderName, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + this.getDrawLabelText(22, 65, 35, 12, ironLoss, 3, 0, LineModeType.AutoHeight, 0, 0, 0, 0) + + // 鐢熸垚鎵撳嵃鏁版嵁 + let imageJsonObj = jcapi.generateLabelJson() + // 璁剧疆鎵撳嵃浠诲姟 + jcapi.startJob({ + totalCount: 1, + density: this.printDensity, + labelType: this.labelType, + printMode: this.printMode, + }, function(r) { + if (r.code == 0) { + // 鎵撳嵃鏁版嵁 + jcapi.printData(imageJsonObj, { + "printQuantity": 1, + }, function(r) { + if (r.code == 0) { + console.log("鎵撳嵃鎴愬姛") + } else { + console.log("鎵撳嵃澶辫触") + } + }) + } else { + console.log("璁剧疆鎵撳嵃浠诲姟澶辫触") + } + }) + }, + tapQuery(item) { + this.maskShow = false + // 杩炴帴鎵撳嵃鏈� + let _this = this; + console.log(item) + jcapi.openPrinterByDevice({ + address: item.address, + name: item.name, + deviceType: item.deviceType // 璁惧绫诲瀷锛�0-钃濈墮锛�1-缃戠粶 + }, function(r) { + uni.showToast({ + title: (r.code == 0) ? "杩炴帴鎴愬姛" : "杩炴帴澶辫触", + duration: 2 * 1000 + }) + if (r.code == 0) { + _this.connectedDevice = item + } + }) + }, + //鎵撳嵃鐩稿叧 + searchDevice() { + let _this = this + uni.openBluetoothAdapter({ // 纭钃濈墮鏄惁鎵撳紑 + success(r) { + uni.showLoading({ + title: "鎼滅储涓�..." + }) + // 鏈巿浜堣摑鐗欑浉鍏虫潈闄愬拰鏈墦寮�鎵嬫満瀹氫綅浼氭悳绱笉鍒拌澶� + jcapi.getBluetoothDevices(function(r) { + console.log("device:" + JSON.stringify(r)) + // 鎼滅储鍒拌澶囧洖璋� + uni.hideLoading() + _this.listDevice = r; + _this.maskShow = true + }) + }, + fail(e) { + uni.showModal({ + confirmText: "鎵撳紑钃濈墮澶辫触" + }) + console.log("寮�鍚摑鐗欒澶囧け璐�" + e) + } + }) + }, + // 鍒ゆ柇宸ュ崟鏄惁绛変簬 + isShowWorkCenter(workCenter) { + if (workCenter.includes(this.workOrder.workCenter)) { + return true + } else { + return false + } + }, + // 鍒ゆ柇宸ュ崟鏄惁绛変簬,鍚屾椂鍒ゆ柇鏄惁涓虹涓�閬撳伐搴� + isFirstOperationId(workCenter) { + if (workCenter.includes(this.workOrder.workCenter)) { + // 鍒ゆ柇鏄惁涓嶄负绗竴閬撳伐搴� + if (this.workOrder.operationId !== this.workOrder.firstOperationId) { + return true + } else { + return false + } + } else { + return false + } + }, + isOperationName(workCenter, operationName) { + // 鍒ゆ柇鏄惁涓鸿宸ヤ綔绔� + if (workCenter.includes(this.workOrder.workCenter)) { + // 鍒ゆ柇鏄惁鍖呭惈宸ュ簭鍚嶇О + if (operationName.includes(this.workOrder.operationName)) { + return true + } else { + return false + } + } else { + return false + } + }, + isNotOperationName(workCenter, operationName) { + // 鍒ゆ柇鏄惁涓鸿宸ヤ綔绔� + if (workCenter.includes(this.workOrder.workCenter)) { + // 鍒ゆ柇鏄惁鍖呭惈宸ュ簭鍚嶇О + if (!operationName.includes(this.workOrder.operationName)) { + return true + } else { + return false + } + } else { + return false + } + }, + isWorkStationName(workCenter,workStationName){ + // 鍒ゆ柇鏄惁涓鸿宸ヤ綔绔� + if (workCenter.includes(this.workOrder.workCenter)) { + // 鍒ゆ柇杞﹂棿鍚嶇О + if (workStationName.includes(this.workOrder.workstationName.split(')')[1])) { + return true + } else { + return false + } + } else { + return false + } + }, + goTagList() { + uni.navigateTo({ + url: '/pages/daily/tag-list/index?info=' + encodeURIComponent(JSON.stringify(this.workOrder)) + }) + }, + submit() { + this.$refs.uForm.validate(async valid => { + if (valid) { + // 鎶ュ伐鍏叡鏁版嵁 + let obj = this.getProductReportData() + // 閽i噾杞﹂棿 + if (this.isShowWorkCenter('BJ-01')) { + obj.productReport = { + qty: this.form.qty, + type: this.form.type + }, + obj.reportType = "BANJIN_PRODUCT_REPORT" + } + // 绾垮湀杞﹂棿-杩囧笎 + if (this.isShowWorkCenter('TM-01,JG-01,YB-04') || this.isFirstOperationId( + 'DY-01,GY-01,YB-01,YB-02,ZM-01')) { + let op = { + labelNo: this.form.labelNo + } + obj.operationId = this.workOrder.operationId + obj.productReportXianquanNonFirst = op + obj.reportType = "XIANQUAN_NON_FIRST_PRODUCT_REPORT" + } + // 澶栧3杞﹂棿-闈炴渶鍚庝竴閬撳伐搴� + if (this.isShowWorkCenter('WK-01') && this.workOrder.operationId !== this.workOrder + .lastOperationId) { + obj.productReportWaikePrev = { + labelNo: '', + qty: this.form.finishQty + }, + obj.reportType = "WAIKE_PRODUCT_REPORT_PREV" + } + // 澶栧3杞﹂棿-鏈�鍚庝竴閬撳伐搴� + if (this.isShowWorkCenter('WK-01') && this.workOrder.operationId === this.workOrder + .lastOperationId) { + obj.productReportWaike = { + labelNo: this.form.labelNo, + qty: this.form.finishQty + }, + obj.reportType = "WAIKE_PRODUCT_REPORT" + } + // 绠卞彉杞﹂棿(鎴愬杞﹂棿) + if (this.isShowWorkCenter('ZZ-03')) { + obj.productReportChengtao = { + id: null, + labelNo: this.form.labelNo, + operationType: this.form.operationType, + qty: this.form.finishQty, + rwMatlBindDTOList: this.infoFormList, + gyLabelNoList:this.hvCoilFormList, + dyLabelNoList:this.lvCoilFormList + + } + obj.reportType = "CHENGTAO_PRODUCT_REPORT" + } + // 鎬昏杞﹂棿 + if (this.isOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补')) { + obj.productReportZongzhuang = { + id: null, + labelNo: this.form.labelNo, + operationType: this.form.operationType, + qty: this.form.finishQty, + workstationId: this.workOrder.workstationId, + rwMatlBindDTOList: this.infoFormList, + } + obj.reportType = "ZONGZHUANG_PRODUCT_REPORT" + } + // 閾佽姱杞﹂棿-绾靛壀 + if (this.isOperationName('TX-01', '绾靛壀')) { + obj.productReportZongjian = { + finishQty: '1', + labelNo: this.form.labelNo, + llength: this.form.length, + qty: '1', + rwMatlBindDTOList: this.infoFormList, + sliceWidth: this.form.siliconSteelCode.width, + workstationId: this.workOrder.workstationId, + wweight: this.form.weight + } + obj.reportType = "ZONGJIAN_PRODUCT_REPORT" + } + // 閾佽姱杞﹂棿-妯壀 + if (this.isOperationName('TX-01', '妯壀')) { + obj.productReportHengjian = { + finishQty: '1', + qty: '1', + rwMatlBindDTOList: this.infoFormList, + sliceQty: this.form.sliceQty, + workstationId: this.workOrder.workstationId, + wweight: '', + prodClass: this.form.outputCategory + } + // 娣诲姞鐗囧 + if (this.isOperationName('TX-01', '妯壀') && this.form.outputCategoryLabel !== + '涓煴') { + obj.productReportHengjian.sliceWidth = this.form.sliceWidth + } + obj.reportType = "HENGJIAN_PRODUCT_REPORT" + } + // 閾佽姱杞﹂棿-鍙犺 + if (this.isOperationName('TX-02', '鍙犺')) { + obj.productReportDiezhuang = { + clampOtherWeight: this.form.clampOtherWeight, + finishQty: this.form.finishQty, + labelNo: this.form.labelNo, + llength: '', + prodWeight: this.form.prodWeight, + qty: "1", + rwMatlBindDTOList: this.infoFormList, + workstationId: this.workOrder.workstationId, + wweight: '0.00' + } + obj.reportType = "DIEZHUANG_PRODUCT_REPORT" + } + // 閾佽姱杞﹂棿-鍏朵粬宸ュ簭 + if ((this.isShowWorkCenter('TX-02') && this.workOrder.operationName !== '鍙犺')) { + obj.operationId = this.workOrder.operationId + obj.productReportOtherOperation = { + labelNo: this.form.labelNo, + workstationId: this.workOrder.workstationId + } + obj.reportType = "OTHER_OPERATION_PRODUCT_REPORT" + } + // 鎴愬搧鎬昏(鍏朵粬杞﹂棿) + if (this.isShowWorkCenter('BZ-01')) { + obj.productReportFprodZongzhuang = { + id: null, + labelNo: this.form.labelNo, + operationType: null, + qty: this.form.finishQty, + rwMatlBindDTOList: this.infoFormList, + workstationId: this.workOrder.workstationId, + } + obj.reportType = "F_PROD_ZONGZHUANG_PRODUCT_REPORT" + } + // 濂楄杞﹂棿 + if (this.isNotOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补')) { + obj.productReportOther = { + finishQty: this.form.finishQty, + labelNo: this.form.labelNo, + llength: '', + qty: this.form.finishQty, + rwMatlBindDTOList: this.infoFormList, + workstationId: this.workOrder.workstationId, + wweight: '' + } + obj.reportType = "OTHER_PRODUCT_REPORT" + } + // 鎶ュ伐鎻愪氦 + console.log("鎶ュ伐鎻愪氦", obj) + let productReportRes = await this.$u.api.dailyPaper.productReport(obj) + console.log("鎶ュ伐鎻愪氦", productReportRes) + if (productReportRes.code === 0) { + this.$refs.uToast.show({ + title: '鎶ュ伐鎴愬姛', + type: 'success ' + }) + // 閾佽姱杞﹂棿-妯壀 鏄剧ず鏍囩鎵撳嵃 + if (this.isOperationName('TX-01', '妯壀')) { + this.isSubmit = true + } + //澹伴煶鍜屾尟鍔� + uni.playVoice({ + filePath: '/static/y1253.mp3', // 鎻愮ず闊虫枃浠惰矾寰� + complete: () => { + console.log('鎻愮ず闊虫挱鏀惧畬鎴�'); + } + }); + uni.vibrateShort(); // 鐭殏鎸姩 + } + console.log('楠岃瘉閫氳繃'); + } else { + console.log('楠岃瘉澶辫触'); + } + }); + }, + // 鏁寸悊鎶ュ伐鍏叡鏁版嵁 + getProductReportData() { + console.log("鎶ュ伐鎻愪氦", this.workOrder, this.form) + this.form.clazzType = this.workOrder.clazzType + this.form.dutyNo = this.workOrder.dutyNo + // this.form.operationTaskId = this.workOrder.id + this.form.reportTime = dateFormat(new Date(), 'yyyy-MM-dd') + ' 00:00:00' + this.form.reportUserList = this.workOrder.userStaffNo + this.form.workstationName = this.workOrder.workstationName + let obj + if ((this.isShowWorkCenter('TX-02') && this.workOrder.operationName !== '鍙犺') || this.isFirstOperationId( + 'DY-01,GY-01,YB-01,YB-02') || this.isShowWorkCenter('TM-01,JG-01锛孻B-04') ||this.isNotOperationName('ZZ-02', '浜岃,娉ㄦ补')) { + obj = Object.assign({ + clazzType: this.workOrder.clazzType, + dutyNo: this.workOrder.dutyNo, + operationTaskId: 12, //闅忎究濉� + locationId: this.form.locationId, + reportTime: dateFormat(new Date(), 'yyyy-MM-dd') + ' 00:00:00', + reportUserList: this.workOrder.userStaffNo, + workstationName: this.workOrder.workstationName, + }) + } else { + obj = Object.assign({ + clazzType: this.workOrder.clazzType, + dutyNo: this.workOrder.dutyNo, + operationTaskId: this.workOrder.id, + locationId: this.form.locationId, + reportTime: dateFormat(new Date(), 'yyyy-MM-dd') + ' 00:00:00', + reportUserList: this.workOrder.userStaffNo.split(','), + workstationName: this.workOrder.workstationName, + }) + } + return obj + }, + identifyingQrCodes() { + uni.scanCode({ + success: (res) => { + this.identifyingQrCodesBlur(res.result) + }, + fail: (err) => {} + }) + }, + async identifyingQrCodesBlur(result) { + let labelNo = "" + let json ={} + if(this.isJSON(result)){ + json = JSON.parse(result) + labelNo = json.ID + }else{ + labelNo = result + } + console.log(labelNo) + // 濡傛灉涓虹嚎鍦堣溅闂�-杩囧笎闇�瑕佹煡璇� + if (this.isShowWorkCenter('TM-01,JG-01,YB-04') || this.isFirstOperationId( + 'DY-01,GY-01,YB-01,YB-02,ZM-01')) { + this.form.labelNo = labelNo + let params = { + partNo: json.part_no + } + await this.$u.api.dailyPaper.findByNo(params).then(r => { + console.log(r) + this.form.drawNo = r.data.drawNo + this.form.weight = r.data.specificationModel + this.form.weightTwo = r.data.partName + this.submit() + }) + // await this.scanCodeData(json.ID, 'listReportOtherOperation') + this.$set(this.form, 'finishQty', this.form.identifyingQr.finishQty) + // this.scanCodeData(result, 'listReportXianQuanNonFirst') + } + // 澶栧3杞﹂棿-鏈�鍚庝竴閬撳伐搴� + if (this.isShowWorkCenter('WK-01') && this.workOrder.operationId === this.workOrder.lastOperationId) { + this.scanCodeData(labelNo, 'listReportWaike') + } + // 绠卞彉杞﹂棿(鎴愬杞﹂棿) + if (this.isShowWorkCenter('ZZ-03')) { + console.log(this.workOrder.workCenter) + this.scanCodeData(labelNo, 'listReportChengtao') + } + // 鎬昏杞﹂棿 + if (this.isOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补')) { + this.scanCodeData(labelNo, 'listReportZongzhuang') + } + // 閾佽姱杞﹂棿-绾靛壀 + if (this.isOperationName('TX-01', '绾靛壀')) { + // 鏉$爜缂栧彿鎵弿鍚庣殑鏁版嵁澶勭悊 + this.scanCodeData(labelNo, 'listReportZongjian') + } + // 閾佽姱杞﹂棿-鍙犺 + if (this.isOperationName('TX-02', '鍙犺')) { + // 榛樿涓� + this.$set(this.form, 'finishQty', 1) + await this.scanCodeData(labelNo, 'listReportDieZhuang') + } + // 閾佽姱杞﹂棿-鍏朵粬宸ュ簭 + if ((this.isShowWorkCenter('TX-02') && this.workOrder.operationName !== '鍙犺')) { + this.form.labelNo = labelNo + let params = { + partNo: json.part_no + } + console.log(params) + await this.$u.api.dailyPaper.findByNo(params).then(r => { + console.log(r) + this.form.drawNo = r.data.drawNo + this.form.weight = r.data.specificationModel + this.submit() + }) + // await this.scanCodeData(result, 'listReportOtherOperation') + this.$set(this.form, 'finishQty', this.form.identifyingQr.finishQty) + } + // 鎴愬搧鎬昏(鍏朵粬杞﹂棿) + if (this.isShowWorkCenter('BZ-01')) { + this.form.labelNo = labelNo + // await this.scanCodeData(result, 'listReportFprodZongzhuang') + } + // 濂楄杞﹂棿 + if (this.isNotOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补')) { + await this.scanCodeData(labelNo, 'listReportOther') + this.$set(this.form, 'finishQty', 1) + + //澧炲姞鍒版姇鍏ョ墿鏂� + // // 鑾峰彇鍗婃垚鍝佸簱瀛樼被鍨� + const obj = { + lotBatchNo: labelNo, + optaskId: this.workOrder.id, + locationId: this.form.locationId + } + // 鏍规嵁鎵规鍙锋潯浠舵煡璇� + let feeding = await this.$u.api.dailyPaper.getFeeding(obj) + let isExist = false + this.infoFormList.forEach(i => { + if (i.lotBatchNo === feeding.data.lotBatchNo) { + isExist = true + } + }) + // 娣诲姞缁欓〉闈� + if (!isExist) { + this.infoFormList.push(feeding.data) + } else { + this.$refs.uToast.show({ + title: '璇峰嬁閲嶅鎶曟枡锛�', + type: 'warning ' + }) + } + } + }, + // 杞﹂棿鎶ュ伐鎵爜鎶曟枡浣跨敤鐨勫崐鎴愬搧搴撳瓨绫诲瀷 + judgmentWorkshop() { + // 鎴愬 -> 鏈綋锛歋ELF_BODY + if (this.isShowWorkCenter('ZZ-03')&& this.isWorkStationName('ZZ-03','绠变綋缁勮')) { + return 'SELF_BODY' + } + // 濂楄 -> 閾佽姱锛欼RON_CORE + if (this.isNotOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补')) { + return 'IRON_CORE' + } + // 鎬昏 -> 鍣ㄨ韩锛歁AIN_BODY + if (this.isOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补')) { + return 'MAIN_BODY' + } + // 鎴愬搧鎬昏 -> 鏈綋锛歋ELF_BODY + if (this.isShowWorkCenter('BZ-01')) { + return 'SELF_BODY' + } + }, + qrCode() { + uni.scanCode({ + success: async (res) => { + let json = JSON.parse(res.result) + console.log(json) + if (this.isShowWorkCenter('ZZ-03')&& this.isWorkStationName('ZZ-03','绠变綋缁勮') && (json.ID.startsWith("GY") || json.ID.startsWith( + "DY"))) { + if (json.ID.startsWith("GY")) { + if (this.hvCoilFormList.includes(json.ID)) { + this.$refs.uToast.show({ + title: '璇峰嬁閲嶅鎵爜锛�', + type: 'warning ' + }) + return + } + this.hvCoilFormList.push(json.ID) + } else { + if (this.lvCoilFormList.includes(json.ID)) { + this.$refs.uToast.show({ + title: '璇峰嬁閲嶅鎵爜锛�', + type: 'warning ' + }) + return + } + this.lvCoilFormList.push(json.ID) + } + } else { + // // 鑾峰彇鍗婃垚鍝佸簱瀛樼被鍨� + let sfpInvType = await this.judgmentWorkshop() + const obj = { + lotBatchNo: json.lot_batch_no, + optaskId: this.workOrder.id, + locationId: this.form.locationId + } + if (sfpInvType) { + obj.sfpInvType = sfpInvType + } + // 鏍规嵁鎵规鍙锋潯浠舵煡璇� + let feeding = await this.$u.api.dailyPaper.getFeeding(obj) + // 閾佽姱杞﹂棿-鍓垏 + if (this.isOperationName('TX-01', '绾靛壀')) { + if (this.infoFormList.length >= 1) { + this.$refs.uToast.show({ + title: '鍙兘娣诲姞涓�鏉℃暟鎹繘琛屾姤宸�', + type: 'warning ' + }) + return + } + // 鏌ヨ鏉ユ枡妫�娴嬶紝鏌ヨ閲嶉噺淇℃伅 + await this.getSiliconSteelCode(json.lot_batch_no) + // 璁$畻閲嶉噺 + await this.calculateWeight() + } + let isExist = false + this.infoFormList.forEach(i => { + if (i.lotBatchNo === feeding.data.lotBatchNo) { + isExist = true + } + }) + // 娣诲姞缁欓〉闈� + if (!isExist) { + this.infoFormList.push(feeding.data) + // } + } else { + this.$refs.uToast.show({ + title: '璇峰嬁閲嶅鎶曟枡锛�', + type: 'warning ' + }) + } + } + }, + fail: (err) => {} + }) + }, + // 寮瑰嚭鏄惁鍒犻櫎鎶曟枡妗嗘 + deleteInfo(index) { + this.show = true + this.deleteIndex = index + }, + deleteInfoDy(index) { + this.lvCoilFormList.splice(index, 1) + }, + deleteInfoGy(index) { + this.hvCoilFormList.splice(index, 1) + }, + // 鍒犻櫎鎶曟枡 + confirm() { + this.infoFormList.splice(this.deleteIndex, 1) + }, + // 绫诲瀷select纭畾 + workTypeTypeFirm(e) { + this.form.type = e[0].value + this.form.typeLabel = e[0].label + }, + // 宸ュ簭绫诲瀷select纭畾 + operationTypeFirm(e) { + this.form.operationType = e[0].value + this.form.operationTypeLabel = e[0].label + if (this.isOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补')) { + if (e[0].label === '椋庢満瑁呴厤') { + this.$set(this.form, 'finishQty', '') + this.isFanAssembly = true + } else { + this.$set(this.form, 'finishQty', 1) + } + } + }, + // 浜у嚭绫诲埆 select閫夋嫨 + outputCategoryFirm(e) { + this.form.outputCategory = e[0].value + this.form.outputCategoryLabel = e[0].label + }, + // 鏉$爜缂栧彿鎵弿鍚庣殑鏁版嵁澶勭悊 + async scanCodeData(result, apiName) { + console.log(result) + if (!result) { + return + } + const params = { + id: this.workOrder.id + } + await this.$u.api.dailyPaper[apiName](params).then(r => { + console.log(r) + r.data.forEach(i => { + if (i.labelNo === result) { + i.reportTime = null + this.form.labelNo = i.labelNo + this.form.identifyingQr = i + this.$refs.uToast.show({ + title: '鎵爜鎴愬姛锛�', + type: 'success ' + }) + } + }) + if (!this.form.identifyingQr.labelNo) { + this.$refs.uToast.show({ + title: '鏈煡璇㈠埌璇ョ紪鍙凤紒', + type: 'warning ' + }) + } + }) + }, + // 鏌ヨ鏉ユ枡妫�淇℃伅 + async getSiliconSteelCode(lotBatchNo) { + const params = { + siliconSteelCode: lotBatchNo + } + await this.$u.api.dailyPaper.siliconSteelCode(params).then(res => { + this.form.siliconSteelCode = res.data + }) + }, + // 璁$畻閲嶉噺 + calculateWeight() { + if (this.form.siliconSteelCode) { + let sum = this.form.siliconSteelCode.width * this.form.siliconSteelCode.thickness * 7.65 + if (this.form.length) { + sum = sum * this.form.length / 1000 + let result = Number(sum).toFixed(2) + this.$set(this.form, 'weight', result) + } + } + }, + isJSON(str) { + try { + const result = JSON.parse(str); + return typeof result === 'object' && result !== null; + } catch (e) { + return false; + } + }, + //杈撳叆鑾峰彇鎶曟枡淇℃伅 + async getPart(){ + console.log(this.partID) + if (this.isShowWorkCenter('ZZ-03')&& this.isWorkStationName('ZZ-03','绠变綋缁勮') && (this.partID.startsWith("GY") || this.partID.startsWith( + "DY"))) { + if (this.partID.startsWith("GY")) { + if (this.hvCoilFormList.includes(this.partID)) { + this.$refs.uToast.show({ + title: '璇峰嬁閲嶅鎵爜锛�', + type: 'warning ' + }) + return + } + this.hvCoilFormList.push(this.partID) + } else { + if (this.lvCoilFormList.includes(this.partID)) { + this.$refs.uToast.show({ + title: '璇峰嬁閲嶅鎵爜锛�', + type: 'warning ' + }) + return + } + this.lvCoilFormList.push(this.partID) + } + } else { + // // 鑾峰彇鍗婃垚鍝佸簱瀛樼被鍨� + let sfpInvType = await this.judgmentWorkshop() + const obj = { + lotBatchNo: "*", + optaskId: this.workOrder.id, + locationId: this.form.locationId + } + if (sfpInvType) { + obj.sfpInvType = sfpInvType + } + // 鏍规嵁鎵规鍙锋潯浠舵煡璇� + let feeding = await this.$u.api.dailyPaper.getFeeding(obj) + // 閾佽姱杞﹂棿-鍓垏 + if (this.isOperationName('TX-01', '绾靛壀')) { + if (this.infoFormList.length >= 1) { + this.$refs.uToast.show({ + title: '鍙兘娣诲姞涓�鏉℃暟鎹繘琛屾姤宸�', + type: 'warning ' + }) + return + } + // 鏌ヨ鏉ユ枡妫�娴嬶紝鏌ヨ閲嶉噺淇℃伅 + await this.getSiliconSteelCode('*') + // 璁$畻閲嶉噺 + await this.calculateWeight() + } + let isExist = false + this.infoFormList.forEach(i => { + if (i.lotBatchNo === feeding.data.lotBatchNo) { + isExist = true + } + }) + // 娣诲姞缁欓〉闈� + if (!isExist) { + this.infoFormList.push(feeding.data) + // } + } else { + this.$refs.uToast.show({ + title: '璇峰嬁閲嶅鎶曟枡锛�', + type: 'warning ' + }) + } + } + }, + onLoad(options) { + // 鍒濆鍖朣DK + jcapi.initSDK() + // 鐩戝惉椤电爜鍥炶皟 + jcapi.didReadPrintCountInfo(function(r) { + console.log(r) + }) + + // 鐩戝惉閿欒鍥炶皟 + jcapi.didReadPrintErrorInfo(function(r) { + console.log(r) + if (r.code == 23) { + // 鎵撳嵃鏈烘柇寮�杩炴帴 + _this.connectedDevice = null + } + uni.showToast({ + icon: 'none', + title: JSON.stringify(r), + duration: 2 * 1000 + }) + }) + this.workOrder = JSON.parse(decodeURIComponent(options.info)) + console.log(this.workOrder) + this.form.drawNo = this.workOrder.drawNo + this.id = this.workOrder.id + // 濡傛灉涓洪挘閲戣溅闂存煡璇㈢被鍨� + if (this.isShowWorkCenter('BJ-01')) { + this.$u.api.dictData({ + dictType: 'work_type' + }).then((res) => { + if (res.code === 0 && res.data.length > 0) { + this.workTypeList = res.data + } + }) + } + // 濡傛灉涓虹鍙樿溅闂�(鎴愬杞﹂棿) 鏌ヨ宸ュ簭绫诲瀷 + if (this.isShowWorkCenter('ZZ-03')) { + this.$u.api.dictData({ + dictType: 'suit_process_type' + }).then((res) => { + if (res.code === 0 && res.data.length > 0) { + this.operationTypeList = res.data + } + }) + } + // 鎬昏杞﹂棿 + if (this.isOperationName('ZZ-01,ZZ-02', '缁勮,浜岃,娉ㄦ补')) { + if (this.workOrder.partName.includes('娌瑰彉')) { + this.isOilChange = true + } + this.$u.api.dictData({ + dictType: 'assembly_process_type' + }).then((res) => { + if (res.code === 0 && res.data.length > 0) { + this.operationTypeList = res.data + } + }) + } + // 閾佽姱杞﹂棿-妯壀 + if (this.isOperationName('TX-01', '妯壀')) { + this.$u.api.dictData({ + dictType: 'hj_prod_class' + }).then((res) => { + if (res.code === 0 && res.data.length > 0) { + this.outputCategoryList = res.data + } + }) + } + const params = { + workstationId: this.workOrder.workstationId + } + // 鑾峰彇locationId搴撲綅id + this.$u.api.dailyPaper.getLocationId(params).then(res => { + this.form.locationId = res.data.qualifiedLocationIds[0] + }) + }, + onReady() { + this.$refs.uForm.setRules(this.rules); + } + } + } +</script> + +<style scoped lang="scss"> + .uni-list_name { + font-size: 30rpx; + color: #333; + } + + .uni-list_item { + font-size: 24rpx; + color: #555; + line-height: 1.5; + } + + .uni-list-box { + margin: 0 20rpx; + padding: 15rpx 0; + border-bottom: 1px #f5f5f5 solid; + box-sizing: border-box; + } + + .uni-scroll_box { + height: 70%; + background: #fff; + border-radius: 20rpx; + } + + .uni-mask { + position: fixed; + top: 0; + left: 0; + bottom: 0; + display: flex; + align-items: center; + width: 100%; + background: rgba(0, 0, 0, 0.6); + padding: 0 30rpx; + box-sizing: border-box; + } + + .work-reporting { + background-color: #e6f0ff; + width: 100%; + height: 100vh; + box-sizing: border-box; + + ::v-deep.navbar-right { + font-weight: 500; + font-size: 28rpx; + color: #FFFFFF; + line-height: 36rpx; + margin-right: 32rpx; + } + + .scroll-Y { + width: 100%; + height: calc(100vh - 270rpx); + + .form { + background: linear-gradient(180deg, #D8E8FF 0%, #FFFFFF 100%); + border-radius: 10rpx; + margin: 68rpx 30rpx 0; + padding: 36rpx 26rpx 0; + position: relative; + + .form-title { + font-weight: 800; + font-size: 34rpx; + color: #1D2541; + margin-bottom: 30rpx; + } + + .icon_report { + background-image: url('~@/static/custom/daily/icon_report.png'); + background-repeat: no-repeat; + background-size: cover; + height: 170rpx; + width: 170rpx; + position: absolute; + top: -64rpx; + right: -30rpx; + } + } + + .scan-code-feeding { + background: linear-gradient(180deg, #D8E8FF 0%, #F3F8FF 100%); + border-radius: 10rpx; + margin: 20rpx 30rpx 68rpx; + padding: 36rpx 16rpx 58rpx; + position: relative; + + .form-title { + font-weight: 800; + font-size: 34rpx; + color: #1D2541; + padding-left: 10rpx; + margin-bottom: 30rpx; + } + + .icon_camera { + background-image: url('~@/static/custom/daily/icon_camera.png'); + background-repeat: no-repeat; + background-size: cover; + height: 82rpx; + width: 82rpx; + position: absolute; + top: 18rpx; + right: 28rpx; + } + + .infoform { + background: #FFFFFF; + border-radius: 10rpx; + border: 1px solid #EAF2FF; + box-sizing: border-box; + padding: 30rpx 24rpx; + margin-top: 20rpx; + + p { + font-weight: 500; + font-size: 26rpx; + color: #333333; + margin-bottom: 24rpx; + + .icon_zl { + background-image: url('~@/static/custom/daily/icon_zl.png'); + background-repeat: no-repeat; + background-size: cover; + height: 24rpx; + width: 24rpx; + margin-right: 6rpx; + margin-bottom: 6rpx; + vertical-align: middle; + position: relative; + } + + .icon_7 { + background-image: url('~@/static/custom/daily/icon_7.png'); + background-repeat: no-repeat; + background-size: cover; + height: 24rpx; + width: 24rpx; + margin-right: 6rpx; + margin-bottom: 6rpx; + vertical-align: middle; + position: relative; + } + + .icon_6 { + background-image: url('~@/static/custom/daily/icon_6.png'); + background-repeat: no-repeat; + background-size: cover; + height: 24rpx; + width: 24rpx; + margin-right: 6rpx; + margin-bottom: 6rpx; + vertical-align: middle; + position: relative; + } + } + + .buttonFlex { + display: flex; + justify-content: flex-end; + flex-direction: row; + + .delete-button { + height: 66rpx; + background: #FFFFFF; + border-radius: 8rpx; + border: 1px solid #D6655C; + font-weight: 500; + font-size: 28rpx; + color: #D6655C; + margin: 24rpx 24rpx 0 206rpx; + line-height: 66rpx; + + .icon_del { + background-image: url('~@/static/custom/daily/icon_del.png'); + background-repeat: no-repeat; + background-size: cover; + height: 32rpx; + width: 32rpx; + margin-right: 8rpx; + margin-bottom: 8rpx; + vertical-align: middle; + position: relative; + } + } + + .primary-button { + height: 66rpx; + background: #FFFFFF; + border-radius: 8rpx; + border: 1px solid #214DED; + font-weight: 500; + font-size: 28rpx; + color: #214DED; + line-height: 66rpx; + margin: 24rpx 0 0 0; + + .icon_dy { + background-image: url('~@/static/custom/daily/icon_dy.png'); + background-repeat: no-repeat; + background-size: cover; + height: 32rpx; + width: 32rpx; + margin-right: 8rpx; + margin-bottom: 8rpx; + vertical-align: middle; + position: relative; + } + } + } + } + } + } + + .bottom { + width: 100vw; + position: fixed; + bottom: 60rpx; + + .u-button { + width: 690rpx; + height: 80rpx; + background: #214DED; + border-radius: 8rpx; + font-weight: 500; + font-size: 34rpx; + color: #FFFFFF; + z-index: 99; + } + } + } + + ::v-deep.u-form-item--left__content__label { + padding-left: 26rpx; + font-weight: 500; + font-size: 30rpx; + color: #4F4F4F; + line-height: 80rpx; + } + + ::v-deep.u-form-item--left__content--required { + left: 8rpx; + top: 0; + } +</style> \ No newline at end of file -- Gitblit v1.9.3