| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239 |
- <template>
- <gui-page :custom-header="true" :header-class="['gui-theme-background-color']">
- <template #gHeader>
- <view style="height:44px;" class="gui-flex gui-nowrap gui-rows gui-align-items-center">
- <!-- 使用组件实现返回按钮及返回首页按钮 -->
- <text style="font-size:44rpx;" class="gui-header-leader-btns gui-color-white font-icons"
- @tap="goBack"></text>
- <!-- 导航文本此处也可以是其他自定义内容 -->
- <text
- class="gui-h4 gui-blod gui-flex1 gui-text-center gui-ellipsis gui-color-white gui-primary-text">工单执行</text>
- <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
- <!-- 实际宽度请根据自己情况设置 -->
- <view style="width:40px;" />
- <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
- </view>
- </template>
- <template #gBody>
- <view class="oqc-checkout">
- <view class="scan">
- <view class="scan-title">
- <span>{{ params.erpWorkOrderNo }}</span>
- <span>{{ params.processName }}</span>
- </view>
- </view>
- <view class="scan">
- <view class="scan-title">
- <span>检验状态</span>
- <span>{{ computedIPQCState(btnState) }}</span>
- </view>
- </view>
- <view class="scan">
- <view class="scan-card">
- <span>执行人</span>
- <uni-easyinput ref="userInput" v-model="params.userName" :input-border="false" type="text"
- placeholder="请扫描工号" @confirm="confirmUser" @focus="handleInputFocus('userInput')"
- @clear="handleClear('userInput')" />
- <text class="font-icons" @click="handleScanUser"></text>
- </view>
- </view>
- <view v-if="params.equipmentInspection * 1 === 1" class="scan">
- <view v-if="params.equipmentInspection * 1 === 0 && !params.userName" class="scan-card">
- <span>设备</span>
- <uni-easyinput v-model="params.equipmentName" :input-border="false" disabled type="text"
- placeholder="请扫描设备码" />
- </view>
- <view v-if="params.equipmentInspection * 1 === 1 || params.userName" class="scan-card">
- <span>设备</span>
- <uni-easyinput ref="equipmentInput" v-model="params.equipmentName" :input-border="false"
- type="text" placeholder="请扫描设备码" @confirm="confirmEquipmentName"
- @focus="handleInputFocus('equipmentInput')" @clear="handleClear('equipmentInput')" />
- <text class="font-icons" @click="handleScanDevice"></text>
- </view>
- </view>
- <view v-if="params.verifyMoldFixture * 1 === 1" class="scan">
- <view v-if="params.verifyMoldFixture * 1 === 0 && !params.equipmentName" class="scan-card">
- <span>模具</span>
- <uni-easyinput v-model="params.toolingName" :input-border="false" disabled type="text"
- placeholder="请扫描模具码" />
- </view>
- <view v-if="params.verifyMoldFixture * 1 === 1 || params.equipmentName" class="scan-card">
- <span>模具</span>
- <uni-easyinput ref="toolingInput" v-model="params.toolingName" :input-border="false" type="text"
- placeholder="请扫描模具码" @confirm="confirmToolingName" @focus="handleInputFocus('toolingInput')"
- @clear="handleClear('toolingInput')" />
- <text class="font-icons" @click="handleScanTooling"></text>
- </view>
- </view>
- <!-- <view class="scan" v-if="params.verifyMoldFixture === '0'">
- <view class="scan-card">
- <span>物料清单</span>
- <uni-easyinput :inputBorder="false" disabled type="text"
- v-model="params.scanMaterialNumber" placeholder="请扫描物料条码/轴号"></uni-easyinput>
- </view>
- </view> -->
- <view class="scan">
- <!-- toolState: 当前是否已绑定模具 -->
- <!-- verifyMoldFixture: 是否需要绑定摸具 -->
- <view v-if="params.toolState * 1 === 0" class="scan-card">
- <span>物料清单</span>
- <uni-easyinput v-model="params.scanMaterialNumber" :input-border="false" disabled type="text"
- placeholder="请扫描物料条码/轴号" />
- </view>
- <view v-if="params.toolState * 1 === 1" class="scan-card">
- <span>物料清单</span>
- <uni-easyinput ref="materialInput" v-model="params.scanMaterialNumber" :input-border="false"
- type="text" placeholder="请扫描物料条码/轴号" @confirm="confirmMaterial"
- @focus="handleInputFocus('materialInput')" @clear="handleClear('materialInput')" />
- <text class="font-icons" @click="handleScanMaterialOrAxisNumber"></text>
- </view>
- </view>
- <uni-collapse accordion style="margin-bottom: 100px;">
- <uni-collapse-item v-for="(item, key) in params.materialList" :key="key">
- <template #title>
- <view class="collapse">
- <text
- v-if="params.materialList[key].complete && computedResidualArea(params.materialList[key].batchNumberDetails) > 0"
- class="font-icons" style="color: rgba(109, 205, 50, 1);"></text>
- <text v-else class="font-icons" style="color: orange;"></text>
- <view class="collapse-title">
- <view class="title-text-layout">{{ computedCollapseTitle(item) }}</view>
- <view v-if="params.materialList[key].complete"
- style="display: grid;grid-template-columns: 2fr 5fr 3fr;">
- <view class="title-text-layout">
- 轴({{ computedRollNo(params.materialList[key].rollNo) }})</view>
- <view class="title-text-layout">
- 规格({{ params.materialList[key].materialModels }})</view>
- <view class="title-text-layout"
- style="text-align: right;color: orange;font-weight: bold;">
- {{ computedResidualArea(params.materialList[key].batchNumberDetails) }}
- </view>
- </view>
- </view>
- </view>
- </template>
- <view class="content">
- <view v-for="(Citem, Ckey) in params.materialList[key].batchNumberDetails" :key="Ckey"
- class="body-card" @click="handleChangeRow(Citem)">
- <view class="body-card-row">
- <span>批号</span>
- <span>{{ Citem.batchNum }}</span>
- </view>
- <view class="body-card-row">
- <span>余量</span>
- <span>{{ Citem.residueNumber }}㎡</span>
- </view>
- </view>
- </view>
- </uni-collapse-item>
- </uni-collapse>
- <view class="operationBtn">
- <button v-if="(btnState * 1 === 1) && (params.finishedProcess * 1 === 1)" type="primary"
- style="width: calc(100% - 8px);margin: 0 4px;" :disabled="params.printLabel * 1 === 0" @click="handleShowDayModal">打印</button>
- <button v-else-if="(btnState * 1 === 1) && (params.finishedProcess * 1 !== 1)" type="primary"
- style="width: calc(100% - 8px);margin: 0 4px;" :disabled="params.printLabel * 1 === 0" @click="handleValidataPrint('')">打印</button>
- <button v-else-if="btnState === -1" type="primary" style="width: calc(100% - 8px);margin: 0 4px;"
- @click="handleSubmission">送检</button>
- <button type="primary" style="width: calc(100% - 8px);margin: 0 4px;background-color: #07c160;"
- @click="handleNavigate">生产结束</button>
- </view>
- </view>
- <!-- 选择班别 -->
- <uni-popup ref="dayModal" background-color="#fff">
- <view class="popup-process-content">
- <view class="list-title" style="margin-bottom: 8px;">
- <span class="font-icons"
- style="font-size: 20px;color: #00a0e9;width: 40px;text-align: center;"></span>
- <span>班别列表</span>
- </view>
- <view class="grid-box">
- <view v-for="(item, key) in dictDataList" :key="key" class="box" @click="handleClickDay(item)">
- <text>{{ item.label }}</text>
- </view>
- </view>
- </view>
- </uni-popup>
- <!-- 打印前,用户需要输入生产数量 -->
- <uni-popup ref="inputDialog" type="dialog">
- <uni-popup-dialog ref="inputClose" mode="input" title="标签生产数量" :value="qty" placeholder="请输入内容"
- @confirm="handleSetNum" />
- </uni-popup>
- <!-- 提示窗示例 -->
- <uni-popup ref="popup" type="dialog">
- <uni-popup-dialog type="warn" cancel-text="取消" confirm-text="确认" title="提示"
- @confirm="handleReportingWork" @close="popup.close()">
- <!-- eslint-disable-next-line -->
- <template #default="custom">
- <view class="form" style="width: 100%;margin: 0;">
- <view class="form-item">
- <div class="title">物料批次</div>
- <div class="content">
- <uni-easyinput v-model="rowEvent.materialCode" disabled type="digit"
- placeholder="请输入" />
- </div>
- </view>
- <view class="form-item">
- <div class="title">轴号</div>
- <div class="content">
- <uni-easyinput v-model="rowEvent.rollNo" disabled type="text" />
- </div>
- </view>
- <view class="form-item">
- <div class="title">剩余长度</div>
- <div class="content">
- <uni-easyinput v-model="rowEvent.residueLength" placeholder="请输入长度" type="digit" />
- </div>
- </view>
- <view class="form-item">
- <div class="title">核准数量(㎡)</div>
- <div class="content" style="margin: 0;">
- <input v-model="rowEvent.calculate" disabled>
- </div>
- </view>
- <view style="margin: 0 0 12px 0;display: flex;align-items: center;">
- <checkbox-group @change="handlePrintLabelChecked">
- <checkbox value="printLabel" :checked="isPrintLabel" color="#007aff"
- style="transform:scale(0.7)" />
- 打标签
- </checkbox-group>
- </view>
- </view>
- </template>
- </uni-popup-dialog>
- </uni-popup>
- <uni-popup ref="errorTip" type="dialog">
- <uni-popup-dialog type="error" cancel-text="关闭" confirm-text="确认" title="提示" :content="errorTipMessage"
- @confirm="handleCloseErrorTipsModal" @close="handleCloseErrorTipsModal" />
- </uni-popup>
- </template>
- </gui-page>
- </template>
- <script>
- import {
- add
- } from '@/unit/Math.js'
- import {
- computed,
- defineComponent,
- ref,
- onMounted,
- onBeforeMount,
- watch
- } from 'vue'
- import tsc from '@/unit/CHITEN_SDK_APP/tsc.js'
- export default defineComponent({
- onLoad() {
- // // #ifdef APP-PLUS
- // plus.screen.lockOrientation('default');
- // // #endif
- },
- onUnload() {
- // // #ifdef APP-PLUS
- // plus.screen.lockOrientation('portrait-primary');
- // // #endif
- },
- onResize() {
- if ([90, -90].includes(plus.navigator.getOrientation())) {
- this.isLandscapeScreen = true
- } else {
- this.isLandscapeScreen = false
- }
- },
- setup(options) {
- const popup = ref()
- const btnState = ref(0)
- const modalForm = ref()
- const dayModal = ref()
- const dictDataList = ref([])
- const isLandscapeScreen = ref(false)
- // 是否打标签
- const isPrintLabel = ref(false)
- const parentRow = uni.getStorageSync('HotPressInfo') ?? {}
- // 绑定的检查人信息
- const params = ref({
- userState: '0', // 执行人
- deviceState: '0', // 设备
- toolState: '0', // 模具
- processName: '',
- routingListId: '',
- materialCount: 0,
- finishedProcess: '', // 打印是否需要选择班别, 为1则表示需要选择班别
- userName: '', // 执行人
- equipmentName: '', // 设备
- toolingName: '', // 模具
- materialNo: '', // 物料编码
- scanMaterialNumber: '', // 物料/轴号
- upperMaterialId: '', // 物料主表Id
- materialList: [], // 用料清单
- equipmentInspection: '',
- verifyMoldFixture: '',
- // 是否打印标签:为0不打印,打印按钮置灰
- printLabel: 0
- })
- const rowEvent = ref({
- width: 0, // 宽度
- residueLength: 0, //剩余长度
- materialCode: '',
- batchNum: '',
- rollNo: '',
- calculate: '',
- labelMasterId: ''
- })
- // 0:物料,1:轴号
- const nextScanState = ref('batchNum')
- // 生产数量
- const qty = ref(0)
- const inputDialog = ref()
- // 班别列表选择的班别
- const className = ref()
- // 当前执行物料清单索引
- const nextCodeIndex = ref(0)
- const bluetooth = ref()
- const blueConfig = ref({
- loopBuffer: 0,
- currentTime: 1,
- lastData: 0,
- onBufferSize: 20,
- printerNum: 1,
- currentPrint: 1,
- isLabelSend: false
- })
- const userInput = ref()
- const equipmentInput = ref()
- const toolingInput = ref()
- const materialInput = ref()
- const emptyDocument = ref()
- const errorState = ref(0)
- const errorTip = ref('')
- const errorTipMessage = ref('')
- // 手风琴表头
- const computedCollapseTitle = computed(() => {
- return item => {
- if (![NaN, null, undefined, ''].includes(item.materialCode)) {
- return item?.materialCode + '(' + item?.materialName + ')'
- }
- return ''
- }
- })
- const computedResidualArea = computed(() => {
- return item => {
- if (item?.length > 0) {
- let num = 0
- for (let i = 0; i < item.length; i++) {
- num = add(item[i].residueNumber, num)
- }
- return num
- } else {
- return 0
- }
- }
- })
- // rollNo
- const computedRollNo = computed(() => {
- return item => {
- if (![NaN, null, undefined, ''].includes(item)) {
- return item.trim()?.slice(0, 3)
- }
- return ''
- }
- })
- const computedIPQCState = computed(() => {
- return item => {
- if (![NaN, null, undefined, ''].includes(item)) {
- switch (item) {
- case -1:
- return '待送检'
- case 0:
- return '工单冻结不可送检'
- case 1:
- return '可下料打标签'
- case 2:
- return '已送检未审核'
- }
- }
- return ''
- }
- })
- // 根据剩余长度计算剩余数量
- watch([() => rowEvent.value.residueLength], (oldVal, newVal) => {
- rowEvent.value.calculate = Math.ceil((oldVal[0] * 1) * (rowEvent.value.width * 0.001)).toFixed(5);
- })
- const search = async function() {
- await uni.$reqGet('getProcessParam', {
- id: params.value?.id
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- Object.assign(params.value, data)
- } else {
- uni.showToast({
- title: msg,
- icon: 'none',
- duration: 2000
- })
- }
- })
- await uni.$reqGet('getUpperMaterialFlatKnife', {
- hotPressId: params.value?.id
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- data?.materialList.forEach(item => {
- item.complete = true
- })
- nextCodeIndex.value = data?.materialList?.length
- if (params.value.verifyMoldFixture * 1 === 0 || data?.toolingName) {
- params
- .value.toolState = '1'
- }
- Object.assign(params.value, data)
- if (params.value.materialCount > 0) {
- const forCount = params.value.materialCount - data
- .materialList?.length
- for (let i = 0; i < forCount; i++) {
- params.value.materialList.push({
- batchNum: '',
- materialName: '',
- rollNo: '',
- complete: false
- })
- }
- }
- } else {
- uni.showToast({
- title: msg,
- icon: 'none',
- duration: 2000
- })
- }
- })
- }
- // 校验显示打印按钮还是送检按钮
- const initChecked = async function() {
- const month = new Date().getMonth() + 1
- const day = new Date().getDate()
- await uni.$reqPost('getCheckedIPQCPass', {
- ipqcDate: new Date().getFullYear() + '' + (
- month < 10 ? ('0' +
- month) :
- month) + '' + (day < 10 ? ('0' + day) : day),
- mesHotPressId: params.value?.id,
- productionCode: '1605796881528524802'
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- btnState.value = data
- } else {
- uni.showToast({
- title: msg,
- icon: 'none',
- duration: 2000
- })
- }
- })
- }
- onBeforeMount(() => {
- Object.assign(params.value, JSON.parse(parentRow))
- // #ifdef APP-PLUS
- const bluetoothConfig = uni.getStorageSync('bluetoothConfig')
- if ([null, '', undefined].includes(bluetoothConfig)) {
- bluetooth.value = {
- 'isOpenBle': false,
- 'deviceId': '',
- 'serviceId': '',
- 'writeId': '',
- 'notifyId': ''
- }
- setTimeout(() => {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = '蓝牙打印机未连接'
- errorState.value = -1
- errorTip.value.open()
- }, 800)
- } else {
- bluetooth.value = JSON.parse(bluetoothConfig)
- }
- // #endif
- // 获取班别字典数据
- uni.$reqGet('getDictDataPage', {
- dictType: 'class_flag',
- pageNo: 1,
- pageSize: 100
- })
- .then(({
- code,
- data,
- msg
- }) => {
- dictDataList.value = data?.list ?? []
- })
- })
- onMounted(async () => {
- await search()
- await initChecked()
- if (params.value.userName && params.value.equipmentName && params.value.toolingName) {
- materialInput.value.onBlur()
- materialInput.value.onFocus()
- } else if (params.value.userName && params.value.equipmentName) {
- toolingInput.value.onBlur()
- toolingInput.value.onFocus()
- } else if (params.value.userName) {
- equipmentInput.value.onBlur()
- equipmentInput.value.onFocus()
- } else {
- userInput.value.onBlur()
- userInput.value.onFocus()
- }
- })
- const goBack = function() {
- uni.$goBack('/pages/workbranch/production/processExecution/processDetails')
- }
- const handleScanUser = function() {
- // #ifdef APP-PLUS
- const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
- mpaasScanModule.mpaasScan({
- // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
- 'scanType': ['qrCode', 'barCode'],
- // 是否隐藏相册,默认false不隐藏
- 'hideAlbum': false
- },
- (ret) => {
- if (ret.resp_code === 1000) {
- // 执行人
- uni.$reqPost('scanUser', {
- hotPressId: params.value?.id,
- qrCode: ret.resp_result
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- if (data?.result * 1 === 0) {
- params.value.userName = ''
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = data.message
- errorTip.value.open()
- errorState.value = 0
- return
- }
- params.value.userName = data?.echoData
- params.value.userState = data?.result
- equipmentInput.value.onBlur()
- equipmentInput.value.onFocus()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = 0
- }
- })
- }
- })
- // #endif
- }
- // 绑定执行人
- const confirmUser = function(e) {
- // 执行人
- uni.$reqPost('scanUser', {
- hotPressId: params.value?.id,
- qrCode: e
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- if (data?.result * 1 === 0) {
- params.value.userName = ''
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = data.message
- errorTip.value.open()
- errorState.value = 0
- return
- }
- params.value.userName = data?.echoData
- params.value.userState = data?.result
- equipmentInput.value.onBlur()
- equipmentInput.value.onFocus()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = 0
- }
- })
- }
- const handleScanDevice = function() {
- // #ifdef APP-PLUS
- const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
- mpaasScanModule.mpaasScan({
- // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
- 'scanType': ['qrCode', 'barCode'],
- // 是否隐藏相册,默认false不隐藏
- 'hideAlbum': false
- },
- (ret) => {
- if (ret.resp_code === 1000) {
- // 扫描设备
- uni.$reqPost('scanDevice', {
- hotPressId: params.value?.id,
- qrCode: ret.resp_result
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- if (data?.result * 1 === 0) {
- params.value.equipmentName = ''
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = data.message
- errorTip.value.open()
- errorState.value = 1
- return
- }
- params.value.equipmentName = data?.echoData
- params.value.deviceState = data?.result
- toolingInput.value.onBlur()
- toolingInput.value.onFocus()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = 1
- }
- })
- }
- })
- // #endif
- }
- const confirmEquipmentName = function(e) {
- // 扫描设备
- uni.$reqPost('scanDevice', {
- hotPressId: params.value?.id,
- qrCode: e
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- if (data?.result * 1 === 0) {
- params.value.equipmentName = ''
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = data.message
- errorTip.value.open()
- errorState.value = 1
- return
- }
- params.value.equipmentName = data?.echoData
- params.value.deviceState = data?.result
- toolingInput.value.onBlur()
- toolingInput.value.onFocus()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = 1
- }
- })
- }
- const handleScanTooling = function() {
- // #ifdef APP-PLUS
- const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
- mpaasScanModule.mpaasScan({
- // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
- 'scanType': ['qrCode', 'barCode'],
- // 是否隐藏相册,默认false不隐藏
- 'hideAlbum': false
- },
- (ret) => {
- if (ret.resp_code === 1000) {
- // 扫描模具
- uni.$reqPost('scanTooling', {
- hotPressId: params.value?.id,
- qrCode: ret.resp_result
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- if (data?.result * 1 === 0) {
- params.value.toolingName = ''
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = data.message
- errorTip.value.open()
- errorState.value = 2
- return
- }
- params.value.toolingName = data?.echoData
- params.value.toolState = data?.result
- materialInput.value.onBlur()
- materialInput.value.onFocus()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = 2
- }
- })
- }
- })
- // #endif
- }
- const confirmToolingName = function(e) {
- // 扫描模具
- uni.$reqPost('scanTooling', {
- hotPressId: params.value?.id,
- qrCode: e
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- if (data?.result * 1 === 0) {
- params.value.toolingName = ''
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = data.message
- errorTip.value.open()
- errorState.value = 2
- return
- }
- params.value.toolingName = data?.echoData
- params.value.toolState = data?.result
- materialInput.value.onBlur()
- materialInput.value.onFocus()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = 2
- }
- })
- }
- const handleScanMaterialOrAxisNumber = function() {
- // #ifdef APP-PLUS
- const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
- mpaasScanModule.mpaasScan({
- // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
- 'scanType': ['qrCode', 'barCode'],
- // 是否隐藏相册,默认false不隐藏
- 'hideAlbum': false
- },
- (ret) => {
- if (ret.resp_code === 1000) {
- if (nextScanState.value !== 'roll') {
- // 扫描物料
- uni.$reqPost('scanMaterialInfo', {
- hotPressId: params.value?.id,
- qrCode: ret.resp_result
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- // errorTipMessage.value = data?.message;
- // errorTip.value.open();
- if (data?.result * 1 === 1) {
- params.value.scanMaterialNumber = ret.resp_result
- params.value.materialNo = ret.resp_result
- // 存在两种情况,1:物料与轴号对应,2:只需扫物料
- // next等于2表示需要扫轴
- if (data?.next * 1 === 2) {
- nextScanState.value = 'roll'
- } else {
- nextScanState.value = 'batchNum'
- search()
- }
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = data.message
- errorTip.value.open()
- errorState.value = 3
- }
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = 3
- }
- })
- } else {
- // 扫描轴号
- uni.$reqPost('scaRoll', {
- hotPressId: params.value?.id,
- materialQrCode: params.value.materialNo,
- rollQrCode: ret.resp_result
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- // errorTipMessage.value = data?.message;
- // errorTip.value.open();
- if (data?.result * 1 === 1) {
- if (data?.next * 1 === 1) {
- nextScanState.value = 'batchNum'
- }
- search()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = data.message
- errorTip.value.open()
- errorState.value = 3
- }
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = 3
- }
- })
- }
- }
- })
- // #endif
- }
- // 绑定物料/轴号
- const confirmMaterial = function(e) {
- if (nextScanState.value !== 'roll') {
- // 扫描物料
- uni.$reqPost('scanMaterialInfo', {
- hotPressId: params.value?.id,
- qrCode: e
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- // errorTipMessage.value = data?.message;
- // errorTip.value.open();
- if (data?.result * 1 === 1) {
- params.value.materialNo = e
- errorState.value = 3
- setInputFocus()
- // 存在两种情况,1:物料与轴号对应,2:只需扫物料
- // next等于2表示需要扫轴
- if (data?.next * 1 === 2) {
- nextScanState.value = 'roll'
- } else {
- nextScanState.value = 'batchNum'
- search()
- }
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = data.message
- errorTip.value.open()
- errorState.value = 3
- }
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = 3
- }
- })
- } else {
- // 扫描轴号
- uni.$reqPost('scaRoll', {
- hotPressId: params.value?.id,
- materialQrCode: params.value.materialNo,
- rollQrCode: e
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- // errorTipMessage.value = data?.message;
- // errorTip.value.open();
- if (data?.result * 1 === 1) {
- errorState.value = 3
- setInputFocus()
- if (data?.next * 1 === 1) {
- nextScanState.value = 'batchNum'
- }
- search()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = data.message
- errorTip.value.open()
- errorState.value = 3
- }
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = 3
- }
- })
- }
- }
- // 送检
- const handleSubmission = function() {
- const month = new Date().getMonth() + 1
- const day = new Date().getDate()
- uni.$reqPost('createIPQCFormHotPress', {
- ipqcDate: new Date().getFullYear() + '' + (
- month < 10 ? ('0' +
- month) :
- month) + '' + (day < 10 ? ('0' + day) : day),
- mesHotPressId: params.value?.id,
- productionCode: '1605796881528524802'
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- uni.showToast({
- title: '送检成功',
- icon: 'none',
- duration: 2000
- })
- initChecked()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = -1
- }
- })
- }
- const handleChangeRow = function(row) {
- Object.assign(rowEvent.value, {
- materialCode: row.materialCode,
- batchNum: row.batchNum,
- rollNo: row.rollNo,
- labelMasterId: row.labelMasterId ?? '',
- width: row.width ?? 0,
- residueLength: Math.ceil(((row.residueNumber * 1) / ((row.width * 1) * 0.001))).toFixed(5) ?? 0,
- // calculate: row.residueNumber ?? ''
- })
- popup.value.open()
- }
- const handleReportingWork = function() {
- let list = []
- // 卸料
- uni.$reqPost('ReportingWorkDischarge', {
- hotPressId: params.value?.id,
- batchNum: rowEvent.value.batchNum,
- materialCode: rowEvent.value.materialCode,
- calculate: Number(rowEvent.value.calculate)
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- // // #ifdef APP-PLUS
- // const Activity = plus.android.runtimeMainActivity();
- // const Intent = plus.android.importClass("android.content.Intent");
- // const Uri = plus.android.importClass("android.net.Uri");
- // const browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
- // `${uni.$baseUrl}/jmreport/view/821903765761437696?id=${data}`
- // ))
- // Activity.startActivity(browserIntent);
- // // #endif
- // // #ifdef H5
- // const dom = document.createElement('a');
- // dom.setAttribute("href",
- // `${uni.$baseUrl}/jmreport/view/821903765761437696?id=${data}`
- // );
- // dom.setAttribute("target", "_blank");
- // dom.click();
- // // #endif
- search()
- if (!isPrintLabel.value) {
- uni.showToast({
- title: '卸料成功',
- duration: 2000,
- icon: 'none'
- })
- return
- }
- uni.request({
- url: uni.$baseUrl + '/report/print/slittingPrintData',
- data: {
- id: rowEvent.value.labelMasterId
- }
- }).then(async ({
- data
- }) => {
- if (data.data?.length > 0) {
- uni.showToast({
- title: '标签打印中,请勿进行操作',
- duration: 10000,
- icon: 'none'
- })
- list = data.data
- if (list.length > 0) {
- blueConfig.value.currentPrint = 1
- blueConfig.value.printNum = list.length
- const timer = setInterval(async () => {
- const currentPrint = blueConfig.value
- .currentPrint - 1
- if (blueConfig.value.isLabelSend ===
- false &&
- currentPrint <
- blueConfig.value.printNum) {
- const paramsObj = {
- materialName: list[
- currentPrint]
- .materialName ?? '',
- materialNo: list[
- currentPrint]
- .materialNo ??
- '',
- supplierName: list[
- currentPrint]
- .supplierName ??
- '',
- size: list[currentPrint]
- .size ??
- '',
- createTime: list[
- currentPrint]
- .createTime ??
- '',
- materialLots: list[
- currentPrint]
- .materialLots ??
- '',
- wmsStockLocationName: list[
- currentPrint]
- .wmsStockLocationName ??
- '',
- validityDate: list[
- currentPrint]
- .validityDate ??
- '',
- inspectTime: list[
- currentPrint]
- .inspectTime ??
- '',
- storageEnvironment: list[
- currentPrint]
- .storageEnvironment ??
- '',
- slittingOrderNo: list[
- currentPrint]
- .slittingOrderNo ??
- '',
- produceDate: list[
- currentPrint]
- .produceDate ??
- '',
- batchNumber: list[
- currentPrint]
- .batchNumber ??
- '',
- qty: list[currentPrint]
- .qty ??
- ''
- }
- await cuttingLabelTest(paramsObj)
- }
- if (currentPrint === blueConfig.value
- .printNum) {
- await clearInterval(timer)
- }
- }, 3000)
- }
- } else {
- uni.showToast({
- title: '打印数据错误',
- icon: 'none',
- duration: 2000
- })
- }
- })
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = -1
- }
- })
- }
- const handleNavigate = function() {
- uni.navigateTo({
- url: '/pages/workbranch/production/processExecution/takePhoto'
- })
- }
- const handleShowDayModal = function() {
- if (dayModal.value?.showPopup === false) {
- dayModal.value.open('bottom')
- }
- }
- // 班别列表选择事件
- const handleClickDay = function(ret) {
- className.value = ret.value
- handleValidataPrint()
- dayModal.value.close()
- }
- // 分切打印测试
- const cuttingLabelTest = async function(ret) {
- var command = tsc.dlabelPrinter.createNew()
- command.setBackFeed(6)
- // (640 * 320)dots
- command.setSize(80, 40)
- command.setCls()
- command.setGap(8)
- command.setBox(0, 0, 635, 315, 1)
- command.setBar(0, 40, 640, 2)
- command.setBar(0, 80, 640, 2)
- command.setBar(0, 120, 640, 2)
- command.setBar(0, 160, 640, 2)
- command.setBar(0, 200, 366, 2)
- command.setBar(0, 240, 366, 2)
- command.setBar(0, 280, 640, 2)
- // 1
- command.setBar(115, 0, 2, 40)
- command.setBar(115, 40, 2, 40)
- command.setBar(115, 80, 2, 40)
- command.setBar(115, 120, 2, 40)
- command.setBar(115, 160, 2, 40)
- command.setBar(115, 200, 2, 40)
- command.setBar(115, 240, 2, 40)
- command.setBar(115, 280, 2, 40)
- // 2
- command.setBar(360, 40, 2, 40)
- command.setBar(360, 80, 2, 40)
- command.setBar(360, 120, 2, 40)
- command.setBar(360, 160, 2, 40)
- command.setBar(360, 200, 2, 40)
- command.setBar(360, 240, 2, 40)
- command.setBar(360, 280, 2, 40)
- // 3
- command.setBar(475, 40, 2, 40)
- command.setBar(475, 80, 2, 40)
- command.setBar(475, 120, 2, 40)
- command.setBar(475, 280, 2, 40)
- command.setText(10, 6, 'TSS24.BF2', 0, 1, 1, '物料名称')
- command.setText(126, 6, 'TSS24.BF2', 0, 1, 1, ret.materialName)
- // row2
- command.setText(10, 46, 'TSS24.BF2', 0, 1, 1, '物料编码')
- command.setText(126, 46, 'TSS24.BF2', 0, 1, 1, ret.materialNo)
- command.setText(366, 46, 'TSS24.BF2', 0, 1, 1, '供应商')
- command.setText(481, 46, 'TSS24.BF2', 0, 1, 1, ret.supplierName)
- // row3
- command.setText(10, 86, 'TSS24.BF2', 0, 1, 1, '物料规格')
- command.setText(126, 86, 'TSS24.BF2', 0, 1, 1, ret.size)
- command.setText(366, 86, 'TSS24.BF2', 0, 1, 1, '分切日期')
- command.setText(481, 86, 'TSS24.BF2', 0, 1, 1, ret.createTime)
- // row4
- command.setText(10, 126, 'TSS24.BF2', 0, 1, 1, 'Lot no.')
- command.setText(126, 126, '1', 0, 1, 1, ret.materialLots)
- command.setText(366, 126, 'TSS24.BF2', 0, 1, 1, '储位')
- command.setText(481, 126, 'TSS24.BF2', 0, 1, 1, ret.wmsStockLocationName)
- // row5
- command.setText(10, 166, 'TSS24.BF2', 0, 1, 1, '有效期')
- command.setText(126, 166, 'TSS24.BF2', 0, 1, 1, ret.validityDate)
- // row6
- command.setText(10, 206, 'TSS24.BF2', 0, 1, 1, '检测日期')
- command.setText(126, 206, 'TSS24.BF2', 0, 1, 1, ret.inspectTime)
- // row7
- command.setText(10, 246, 'TSS24.BF2', 0, 1, 1, '存储条件')
- const strList = ret.storageEnvironment?.split(' ')
- const strText = strList[0] + ' ' + strList[1]
- command.setText(126, 246, 'TSS24.BF2', 0, 1, 1, strText)
- // row8
- command.setText(10, 286, 'TSS24.BF2', 0, 1, 1, '分切单号')
- command.setText(126, 286, 'TSS24.BF2', 0, 1, 1, ret.slittingOrderNo)
- command.setText(366, 286, 'TSS24.BF2', 0, 1, 1, '生产日期')
- command.setText(481, 286, 'TSS24.BF2', 0, 1, 1, ret.produceDate)
- command.setText(480, 216, '2', 0, 1, 1, ret.qty)
- command.setQrcode(366, 166, 'L', 4, 'A', ret.batchNumber)
- command.setPagePrint()
- prepareSend(command.getData())
- }
- const Send = function(buff) {
- var currentTime = blueConfig.value.currentTime
- var loopBuffer = blueConfig.value.loopBuffer
- var lastData = blueConfig.value.lastData
- var onBufferSize = blueConfig.value.onBufferSize
- var printNum = blueConfig.value.printerNum
- var currentPrint = blueConfig.value.currentPrint
- var buf
- var dataView
- if (currentTime < loopBuffer) {
- buf = new ArrayBuffer(onBufferSize)
- dataView = new DataView(buf)
- for (let i = 0; i < onBufferSize; ++i) {
- dataView.setUint8(i, buff[(currentTime - 1) * onBufferSize + i])
- }
- } else {
- buf = new ArrayBuffer(lastData)
- dataView = new DataView(buf)
- for (let i = 0; i < lastData; ++i) {
- dataView.setUint8(i, buff[(currentTime - 1) * onBufferSize + i])
- }
- }
- plus.bluetooth.writeBLECharacteristicValue({
- deviceId: bluetooth.value.deviceId,
- serviceId: bluetooth.value.serviceId,
- characteristicId: bluetooth.value.writeId,
- value: buf,
- success: function(res) {
- if (currentPrint <= printNum) {
- wx.showToast({
- title: '数据打印中',
- icon: 'loading'
- })
- }
- // 将complete中处理数据的代码挪过来,增加30ms延迟, 解决蓝牙打印数据传输10007问题
- setTimeout(() => {
- currentTime += 1
- if (currentTime <= loopBuffer) {
- blueConfig.value.isLabelSend = true
- blueConfig.value.currentTime = currentTime
- Send(buff)
- }
- // end
- if (currentTime === loopBuffer) {
- blueConfig.value.currentPrint += 1
- blueConfig.value.isLabelSend = false
- }
- }, 10)
- },
- fail: function(e) {
- wx.showToast({
- title: '打印第' + currentPrint + '张失败' + 'error: code ' + e
- ?.code + ', message ' + e?.message,
- icon: 'none',
- duration: 4000
- })
- },
- complete: function() {}
- })
- }
- const prepareSend = function(buff) {
- var time = blueConfig.value.onBufferSize
- var loopBuffer = parseInt(buff.length / time)
- var lastData = parseInt(buff.length % time)
- blueConfig.value.loopBuffer = loopBuffer + 1
- blueConfig.value.lastData = lastData
- blueConfig.value.currentTime = 1
- Send(buff)
- }
- const labelTest = function(ret) {
- var command = tsc.dlabelPrinter.createNew()
- command.setBackFeed(6)
- // (480 * 200)dots
- command.setSize(60, 25)
- command.setCls()
- command.setGap(6)
- command.setBox(0, 0, 475, 200, 1)
- // 1
- command.setBar(108, 0, 2, 40)
- command.setBar(108, 40, 2, 40)
- command.setBar(108, 80, 2, 40)
- command.setBar(108, 120, 2, 40)
- command.setBar(108, 160, 2, 40)
- command.setBar(108, 200, 2, 40)
- // 竖
- command.setBar(210, 80, 2, 40)
- command.setBar(210, 120, 2, 40)
- command.setBar(210, 160, 2, 40)
- command.setBar(210, 200, 2, 40)
- // 横
- command.setBar(0, 40, 480, 2)
- command.setBar(0, 80, 320, 2)
- command.setBar(0, 120, 210, 2)
- command.setBar(0, 160, 210, 2)
- // 横
- command.setBar(320, 80, 480, 2)
- command.setBar(320, 120, 480, 2)
- command.setBar(320, 160, 480, 2)
- // 竖
- command.setBar(322, 40, 2, 40)
- command.setBar(322, 80, 2, 40)
- command.setBar(322, 120, 2, 40)
- command.setBar(322, 160, 2, 40)
- // 竖
- command.setBar(378, 40, 2, 40)
- command.setBar(378, 80, 2, 40)
- command.setBar(378, 120, 2, 40)
- command.setBar(378, 160, 2, 40)
- // row1
- command.setText(4, 8, 'TSS24.BF2', 0, 1, 1, '料号')
- command.setText(112, 10, '2', 0, 1, 1, ret.materialName)
- // row2
- command.setText(4, 48, 'TSS24.BF2', 0, 1, 1, '工令单')
- command.setText(112, 50, '2', 0, 1, 1, ret.wordOrderNo)
- command.setText(328, 48, 'TSS24.BF2', 0, 1, 1, '数量')
- command.setText(384, 50, '2', 0, 1, 1, ret.qty)
- // row3
- command.setText(4, 88, 'TSS24.BF2', 0, 1, 1, '生产日期')
- command.setText(110, 90, '1', 0, 1, 1, ret.dateOfManufacture)
- command.setText(328, 88, 'TSS24.BF2', 0, 1, 1, '库位')
- command.setText(384, 90, '1', 0, 1, 1, ret.storageLocation)
- // row4
- command.setText(4, 128, 'TSS24.BF2', 0, 1, 1, '供应商')
- command.setText(112, 130, '3', 0, 1, 1, ret.vendor)
- command.setText(328, 128, 'TSS24.BF2', 0, 1, 1, '后制')
- command.setText(384, 130, '1', 0, 1, 1, ret.postProduction)
- // row5
- command.setText(4, 168, 'TSS24.BF2', 0, 1, 1, '包装')
- command.setText(112, 170, '1', 0, 1, 1, ret.packaging)
- command.setText(328, 168, 'TSS24.BF2', 0, 1, 1, 'QC')
- command.setText(384, 170, '1', 0, 1, 1, ret.qc)
- command.setQrcode(214, 88, 'L', 5, 'A', ret.qrCode)
- command.setPagePrint()
- prepareSend(command.getData())
- }
- const handleLabelPrint = function() {
- let list = []
- const submitParams = {
- hotPressId: params.value?.id
- }
- if (![null, NaN, undefined, ''].includes(className.value)) {
- submitParams.classFlag = className.value
- }
- if (![null, NaN, undefined, ''].includes(qty.value)) {
- submitParams.qty = qty.value
- }
- // 打印确认
- uni.$reqPost('printConfirm', submitParams)
- .then(async ({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- uni.showToast({
- title: data?.message,
- icon: 'none',
- duration: 2000
- })
- if (data?.result * 1 === 1) {
- uni.request({
- method: 'GET',
- url: uni.$baseUrl + '/report/print/getPrintDataFeol',
- data: {
- hotPressId: params.value?.id
- }
- }).then(async ({
- data: {
- code,
- data,
- msg
- }
- }) => {
- if (code === 0) {
- uni.showToast({
- title: '标签打印中,请勿操作',
- duration: 10000,
- icon: 'none'
- })
- list = data
- if (list.length > 0) {
- blueConfig.value.currentPrint = 1
- blueConfig.value.printNum = list.length
- const timer = setInterval(async () => {
- const currentPrint = blueConfig
- .value.currentPrint - 1
- if (blueConfig.value
- .isLabelSend === false &&
- currentPrint <
- blueConfig.value.printNum
- ) {
- const paramsObj = {
- pn: list[
- currentPrint
- ]
- .pn ?? '',
- wordOrderNo: list[
- currentPrint
- ]
- .wordOrderNo ??
- '',
- qty: list[
- currentPrint
- ]
- .qty ??
- '',
- dateOfManufacture: list[
- currentPrint
- ]
- .dateOfManufacture ??
- '',
- storageLocation: list[
- currentPrint
- ]
- .storageLocation ??
- '',
- postProduction: list[
- currentPrint
- ]
- .postProduction ??
- '',
- vendor: list[
- currentPrint
- ]
- .vendor ??
- '',
- packaging: list[
- currentPrint
- ]
- .packaging ??
- '',
- qc: list[
- currentPrint
- ]
- .qc ??
- '',
- qrCode: list[
- currentPrint
- ]
- .qrCode ??
- ''
- }
- await labelTest(paramsObj)
- }
- if (currentPrint === blueConfig
- .value.printNum) {
- await clearInterval(timer)
- }
- }, 3000)
- }
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = -1
- }
- })
- }
- await search()
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = msg
- errorTip.value.open()
- errorState.value = -1
- }
- })
- }
- const handleValidataPrint = function(dictValue) {
- console.log(dictValue)
- uni.$reqGet('getHotProcessProductionNum', {
- id: params.value?.id
- })
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- qty.value = data?.numberOfPieces ?? 0
- inputDialog.value.open()
- }
- })
- }
- const setInputFocus = function() {
- if (errorState.value === 0) {
- params.value.userName = ''
- userInput.value.onBlur()
- userInput.value.onFocus()
- } else if (errorState.value === 1) {
- params.value.equipmentName = ''
- equipmentInput.value.onBlur()
- equipmentInput.value.onFocus()
- } else if (errorState.value === 2) {
- params.value.toolingName = ''
- toolingInput.value.onBlur()
- toolingInput.value.onFocus()
- } else if (errorState.value === 3) {
- params.value.scanMaterialNumber = ''
- materialInput.value.onBlur()
- materialInput.value.onFocus()
- }
- }
- // 关闭错误信息弹窗
- const handleCloseErrorTipsModal = async function() {
- errorTip.value.close()
- await setInputFocus()
- }
- const handleInputFocus = function(text) {
- setTimeout(() => {
- uni.hideKeyboard()
- }, 100)
- emptyDocument.value ? emptyDocument.value.$el.className = 'uni-easyinput' : false
- if (text === 'userInput') {
- userInput.value.$el.className = 'uni-easyinput light-focus'
- emptyDocument.value = userInput.value
- }
- if (text === 'equipmentInput') {
- equipmentInput.value.$el.className = 'uni-easyinput light-focus'
- emptyDocument.value = equipmentInput.value
- }
- if (text === 'toolingInput') {
- toolingInput.value.$el.className = 'uni-easyinput light-focus'
- emptyDocument.value = toolingInput.value
- }
- if (text === 'materialInput') {
- materialInput.value.$el.className = 'uni-easyinput light-focus'
- emptyDocument.value = materialInput.value
- }
- }
- const handleClear = function(text) {
- if (text === 'userInput') {
- userInput.value.onBlur()
- userInput.value.onFocus()
- }
- if (text === 'equipmentInput') {
- equipmentInput.value.onBlur()
- equipmentInput.value.onFocus()
- }
- if (text === 'toolingInput') {
- toolingInput.value.onBlur()
- toolingInput.value.onFocus()
- }
- if (text === 'materialInput') {
- materialInput.value.onBlur()
- materialInput.value.onFocus()
- }
- }
- // 设置标签生产数量
- const handleSetNum = function(ret) {
- if (![NaN, undefined, null, ''].includes(Number(ret))) {
- qty.value = ret
- } else {
- // #ifdef APP-PLUS
- plus.device.beep(2)
- // #endif
- errorTipMessage.value = '数量不正确!'
- errorTip.value.open()
- errorState.value = 3
- return
- }
- handleLabelPrint()
- }
- // 是否打标签单选框触发事件
- const handlePrintLabelChecked = function(e) {
- const checked = e.detail.value
- if (checked?.length > 0) {
- isPrintLabel.value = true
- } else {
- isPrintLabel.value = false
- }
- }
- return {
- popup,
- goBack,
- dayModal,
- modalForm,
- errorState,
- errorTip,
- errorTipMessage,
- userInput,
- equipmentInput,
- toolingInput,
- materialInput,
- isPrintLabel,
- qty,
- rowEvent,
- btnState,
- isLandscapeScreen,
- params,
- inputDialog,
- dictDataList,
- handleInputFocus,
- handleClear,
- computedResidualArea,
- computedRollNo,
- computedIPQCState,
- computedCollapseTitle,
- handleSubmission,
- handleShowDayModal,
- handleValidataPrint,
- handleScanUser,
- handleScanDevice,
- handleScanTooling,
- handleReportingWork,
- handleSetNum,
- confirmUser,
- confirmEquipmentName,
- confirmToolingName,
- confirmMaterial,
- handleScanMaterialOrAxisNumber,
- handleCloseErrorTipsModal,
- handleChangeRow,
- handleNavigate,
- handleClickDay,
- handlePrintLabelChecked
- }
- }
- })
- </script>
- <style lang="scss" scoped>
- .gui-header-leader-btns {
- color: black;
- font-size: 24px !important;
- margin-left: 24rpx;
- }
- .gui-sbody {
- background-color: rgba(234, 239, 242, 1);
- }
- .gui-relative {
- overflow: visible;
- height: 100vh;
- .oqc-checkout {
- width: 100vw;
- height: calc(100vh - 75px);
- position: absolute;
- top: 95px;
- overflow-y: scroll;
- }
- }
- .popup-content {
- width: 100vw;
- height: 55vh;
- overflow-y: scroll;
- }
- .card-list-flexbox-popup {
- width: 100vw;
- display: flex;
- flex-direction: row;
- align-items: center;
- flex-wrap: wrap;
- .card-list-item,
- .card-list-item-input {
- width: 100vw;
- height: 100%;
- min-height: 40px;
- display: flex;
- flex-direction: row;
- align-items: center;
- background-color: #fff;
- uni-text {
- font-size: 14px;
- height: 50rpx;
- text-align: left;
- padding: 0 12px;
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- uni-image {
- width: calc(100vw / 2 - 4px);
- height: calc(100vw / 3.2 - 2px);
- pointer-events: none;
- }
- uni-image::after {
- content: "×";
- width: 22px;
- height: 22px;
- position: absolute;
- top: 5px;
- right: 5px;
- display: flex;
- justify-content: center;
- align-items: center;
- color: rgba(255, 255, 255, 0.9);
- background-color: rgba(0, 0, 0, 0.5);
- border-radius: 50%;
- font-size: 24px;
- /*给伪元素开启鼠标事件,将事件冒泡到父元素的点击事件中*/
- pointer-events: auto;
- }
- .text-1 {
- flex: 1;
- height: 40px;
- justify-content: flex-start;
- }
- .text-2 {
- flex: 3;
- height: 40px;
- justify-content: flex-end;
- margin-right: 4px;
- padding: 2px 6px;
- }
- .text-3 {
- width: calc(100% - 15%);
- min-height: 35px;
- justify-content: flex-end;
- padding: 2px 6px;
- }
- .text-3::before {}
- .btn-mg {
- margin: 0 5px;
- }
- }
- .card-list-item {
- justify-content: center;
- }
- .card-list-item-input {
- margin: 10px 0 10px 2%;
- display: flex;
- flex-direction: column;
- uni-view {
- width: 100%;
- height: 100%;
- display: flex;
- uni-textarea {
- flex: 8;
- }
- uni-view {
- flex: 1;
- }
- .operation-icon,
- .operation-icon-2 {
- height: auto;
- uni-text {
- width: 22px;
- height: 100%;
- padding: 0 !important;
- text-align: center;
- display: flex;
- justify-content: center;
- align-items: center;
- border-top-right-radius: 4px;
- border-bottom-right-radius: 4px;
- color: white;
- background-color: #80b7ff;
- }
- }
- .operation-icon-2 {
- uni-text {
- background-color: #ff5962;
- }
- }
- }
- }
- .grid-image {
- /* 设置容器布局为grid布局 */
- display: grid;
- /* 指定每一行的宽度 每个宽度中间用空格隔开 */
- grid-template-rows: repeat(auto-fill, 1fr);
- /* 指定每一列的宽度 每个宽度中间用空格隔开 */
- grid-template-columns: repeat(2, 1fr);
- padding: 0 4px;
- }
- .card-list-item:nth-of-type(1) {
- .text-1 {
- flex: 9;
- font-weight: bold;
- color: black !important;
- }
- .text-1::before {
- content: "";
- width: 4px;
- height: 20px;
- border-radius: 4px;
- margin-right: 4px;
- background-color: skyblue;
- }
- .text-2 {
- flex: 4;
- display: flex;
- flex-direction: row;
- justify-content: flex-end;
- align-items: center;
- color: limegreen !important;
- }
- }
- }
- .table-title {
- height: 40px;
- line-height: 40px;
- margin: 0 0 -3px 0;
- padding: 0 12px;
- font-size: 16px;
- font-weight: bold;
- background-color: white;
- }
- .uni-list-cell {
- width: 100vw;
- height: 35px;
- margin: 4px 0;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- border-bottom: 2px solid #eaeff2;
- background-color: #fff;
- view {
- font-size: 14px;
- height: 50rpx;
- text-align: left;
- padding: 0 8px;
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- .uni-list-cell-left {
- flex: 1;
- height: 35px;
- justify-content: flex-start;
- }
- .uni-list-cell-db {
- flex: 3;
- height: 35px;
- justify-content: flex-end;
- margin-right: 4px;
- padding: 2px 6px;
- uni-picker {
- width: 100%;
- display: flex;
- flex-direction: row;
- justify-content: center;
- }
- }
- }
- .modal-btns {
- height: 100rpx;
- line-height: 100rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .line {
- margin-top: 10rpx;
- height: 80rpx;
- width: 1rpx;
- background-color: #dcdcdc;
- }
- .card-list {
- display: grid;
- grid-template-rows: 1fr;
- grid-template-columns: 1fr 1fr;
- background-color: white;
- .card {
- display: grid;
- grid-template-rows: 1fr;
- grid-template-columns: 2fr 5fr;
- height: 45px;
- span {
- font-size: 14px;
- font-weight: bold;
- text-align: center;
- line-height: 45px;
- }
- uni-input {
- height: 45px;
- display: flex;
- align-items: center;
- }
- }
- }
- .font-icons {
- width: 30px;
- font-size: 20px;
- text-align: right;
- }
- .scan {
- height: 45px;
- width: calc(100% - 48px);
- margin: 0 12px 12px 12px;
- padding: 0 12px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-radius: 6px;
- background-color: white;
- .scan-title {
- width: 100%;
- display: grid;
- grid-template-rows: 1fr;
- grid-template-columns: 1fr 1fr;
- align-items: center;
- span {
- font-size: 14px;
- font-weight: bold;
- }
- span:nth-of-type(2) {
- text-align: right;
- }
- }
- .scan-card {
- width: 100%;
- display: grid;
- grid-template-rows: 1fr;
- grid-template-columns: 2fr 6fr 1fr;
- align-items: center;
- span {
- font-size: 14px;
- font-weight: bold;
- }
- input {
- height: 35px;
- line-height: 35px;
- }
- text {
- width: 100%;
- text-align: right;
- }
- }
- }
- .body-card {
- width: calc(100% - 48px);
- margin: 0 12px 12px 12px;
- padding: 0 12px;
- display: grid;
- grid-template-columns: 1fr;
- grid-template-rows: 1fr 1fr;
- border-radius: 6px;
- background-color: white;
- .body-card-row {
- height: 35px;
- line-height: 35px;
- display: flex;
- justify-content: space-between;
- }
- }
- .collapse {
- width: 100%;
- display: flex;
- align-items: center;
- .collapse-title {
- height: 90px;
- width: 80%;
- padding: 0 12px;
- display: grid;
- grid-template-columns: 1fr;
- grid-template-rows: 1fr 1fr;
- uni-text {
- display: inline-block;
- height: 45px;
- line-height: 45px;
- font-size: 14px;
- }
- }
- }
- .example-body {
- flex-direction: column;
- flex: 1;
- }
- .form {
- font-size: 14px;
- margin: 0 12px 80px 12px;
- padding: 4px 8px;
- border-radius: 4px;
- background-color: white;
- .form-title {
- height: 32px;
- line-height: 32px;
- text-align: center;
- font-size: 16px;
- font-weight: bold;
- border-bottom: 2px dashed #edeeee;
- }
- .form-item {
- .title {
- height: 32px;
- line-height: 32px;
- text-align: left;
- font-weight: bold;
- color: #333;
- }
- .content {
- height: 42px;
- line-height: 42px;
- margin: 0 0 6px 0;
- }
- }
- }
- .title-text-layout {
- height: 45px;
- line-height: 45px;
- font-size: 14px;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- -o-text-overflow: ellipsis;
- }
- .popup-process-content {
- width: 100vw;
- height: 85vh;
- overflow-y: scroll;
- .list-title {
- // position: fixed;
- // top: 0;
- // left: 0;
- // z-index: 99999;
- display: flex;
- align-items: center;
- height: 45px;
- line-height: 45px;
- font-size: 16px;
- font-weight: bold;
- border-top-left-radius: 16px;
- border-top-right-radius: 16px;
- border-bottom: 2px solid #d4d4d4;
- .block {
- width: 6px;
- height: 60%;
- margin: 0 4px;
- background-color: rgb(0, 160, 233);
- }
- }
- .grid-box {
- display: grid;
- grid-template-columns: 1fr 1fr 1fr 1fr;
-
- .box {
- position: relative;
- height: 40px;
- padding: 10px 6px;
- border: 1px solid rgb(250, 250, 251);
- box-sizing: border-box;
- margin: 12px;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 14px;
- font-weight: bold;
- border-radius: 4px;
- color: white;
- box-shadow: 0 3px 6px 0 rgba(121, 118, 118, 0.34);
- background-color: rgb(0, 160, 233);
- }
-
- .box::before {
- content: '';
- position: absolute;
- top: 20px;
- left: 0;
- bottom: 0;
- transform: translate(-50%, -50%);
- width: 12px;
- height: 12px;
- border-radius: 50%;
- z-index: 1;
- background-color: #ffffff;
- }
- }
- }
- .light-focus {
- border: 1px solid #008aff;
- border-radius: 6px !important;
- ::v-deep .uni-easyinput__content {
- border-radius: 6px !important;
- }
- }
- .light-focus::before {
- position: absolute;
- left: -10px;
- top: -10px;
- content: "✏️";
- width: 20px;
- height: 20px;
- color: red;
- font-weight: bold;
- font-size: 18px;
- }
- .operationBtn {
- position: fixed;
- display: grid;
- grid-template-rows: 1fr;
- grid-template-columns: 1fr 1fr;
- width: 100%;
- bottom: 0;
- padding: 12px 0;
- }
- </style>
|