<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: '', // 产出类别:value
|
outputCategoryLabel: '', // 产出类别:label
|
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'],
|
},
|
// 正则判断只能为数字
|
{
|
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'],
|
},
|
// 正则判断只能为数字
|
{
|
validator: (rule, value, callback) => {
|
return this.$u.test.number(value);
|
},
|
message: '只能为数值',
|
trigger: ['blur'],
|
},
|
],
|
length: [ // 长度,
|
{
|
required: true,
|
message: '请填写长度',
|
trigger: ['blur'],
|
},
|
// 正则判断只能为数字
|
{
|
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'],
|
},
|
// 正则判断只能为数字
|
{
|
validator: (rule, value, callback) => {
|
return this.$u.test.number(value);
|
},
|
message: '只能为数值',
|
trigger: ['blur'],
|
},
|
],
|
clampOtherWeight: [ // 夹件及其他重量
|
{
|
required: true,
|
message: '请填写夹件及其他重量',
|
trigger: ['blur'],
|
},
|
// 正则判断只能为数字
|
{
|
validator: (rule, value, callback) => {
|
return this.$u.test.number(value);
|
},
|
message: '只能为数值',
|
trigger: ['blur'],
|
},
|
],
|
prodWeight: [ // 成品重量
|
{
|
required: true,
|
message: '请填写成品重量',
|
trigger: ['blur'],
|
},
|
// 正则判断只能为数字
|
{
|
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, '片宽(mm):', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
|
this.getDrawLabelText(5, 29, 20, 20, '厚度(mm):', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
|
this.getDrawLabelText(5, 35, 20, 20, '重量(KG):', 3.6, 0, LineModeType.AutoHeight, 0, 0, 0, 1)
|
this.getDrawLabelText(5, 41, 20, 20, '长度(m):', 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()
|
// 钣金车间
|
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"
|
}
|
// 外壳车间-非最后一道工序
|
if (this.isShowWorkCenter('WK-01') && this.workOrder.operationId !== this.workOrder
|
.lastOperationId) {
|
obj.productReportWaikePrev = {
|
labelNo: '',
|
qty: this.form.finishQty
|
},
|
obj.reportType = "WAIKE_PRODUCT_REPORT_PREV"
|
}
|
// 外壳车间-最后一道工序
|
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,YB-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')
|
}
|
// 外壳车间-最后一道工序
|
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() {
|
// 成套 -> 本体:SELF_BODY
|
if (this.isShowWorkCenter('ZZ-03')&& this.isWorkStationName('ZZ-03','箱体组装')) {
|
return 'SELF_BODY'
|
}
|
// 套装 -> 铁芯:IRON_CORE
|
if (this.isNotOperationName('ZZ-01,ZZ-02', '组装,二装,注油')) {
|
return 'IRON_CORE'
|
}
|
// 总装 -> 器身:MAIN_BODY
|
if (this.isOperationName('ZZ-01,ZZ-02', '组装,二装,注油')) {
|
return 'MAIN_BODY'
|
}
|
// 成品总装 -> 本体:SELF_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) {
|
// 初始化SDK
|
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>
|