add打印功能,修改表单出库

This commit is contained in:
2025-05-29 13:22:06 +08:00
parent 165154537b
commit 5cdacfa446
6 changed files with 140 additions and 9 deletions

View File

@@ -7,6 +7,10 @@
<view class="setup-label">服务器地址</view>
<input type="text" class="setup-input" placeholder="请输入服务器地址" v-model="addrip">
</view>
<view class="setup-item">
<view class="setup-label">打印地址</view>
<input type="text" class="setup-input" placeholder="请输入打印地址" v-model="printip">
</view>
<!-- <view class="setup-item">
<view class="setup-label">刷新时间(s)</view>
<input type="text" class="setup-input" placeholder="请输入刷新时间" v-model="setTime">
@@ -29,6 +33,7 @@
return {
addrip: this.$store.getters.baseUrl,
acsip: this.$store.getters.acsUrl,
printip: this.$store.getters.printUrl,
setTime: this.$store.getters.setTime / 1000
};
},
@@ -46,6 +51,13 @@
})
return
}
if (this.printip === '') {
uni.showToast({
title: '请填写打印地址',
icon: 'none'
})
return
}
// if (this.setTime === '') {
// uni.showToast({
// title: '请填写刷新时间',
@@ -54,7 +66,7 @@
// return
// }
// 存值
this.$store.dispatch('setConfig',{baseUrl: this.addrip, acsUrl: this.acsip, setTime: this.setTime * 1000})
this.$store.dispatch('setConfig',{baseUrl: this.addrip, acsUrl: this.acsip, printUrl: this.printip, setTime: this.setTime * 1000})
uni.redirectTo({
url: '/pages/login/login'
})

View File

@@ -22,7 +22,7 @@
<view class="zd-col-6"><span class="filter_label">单位</span></view>
<view class="zd-col-6"><span class="filter_input">{{currentData.unit_name}}</span></view>
</view> -->
<view class="zd-row">
<view class="zd-row border-bottom">
<view class="zd-col-6"><span class="filter_label">仓库</span></view>
<view class="zd-col-6 filter_select">
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
@@ -32,6 +32,15 @@
<uni-data-select v-model="currentData.product_area" :localdata="options2"></uni-data-select>
</view>
</view>
<view class="zd-row jcflexstart">
<view class="zd-col-6">
<span class="filter_label">加急单据</span>
</view>
<view class="relative zd-col-6">
<switch :checked="isChecked" color="#4e6ef2" style="transform:scale(0.8); transform-origin: left;"/>
<text @tap="setWStatus" style="position: absolute;display: inline-block;width: 52px; height: 32px;left: 0;"></text>
</view>
</view>
</view>
<view v-if="JSON.stringify(currentData) !== '{}'" class="grid-wraper">
<view class="slide_new">
@@ -100,7 +109,8 @@
index1: '',
options2: [{value: 'A1', text: 'A1车间'}, {value: 'A2', text: 'A2车间'}, {value: 'A3', text: 'A3车间'}],
allCheck: false,
formTypeName: ''
formTypeName: '',
isChecked: false
};
},
onLoad (options) {
@@ -120,6 +130,9 @@
}
},
methods: {
setWStatus () {
this.isChecked = !this.isChecked
},
// 出库单类型
async _outStorageOrder () {
let res = await outStorageOrder()
@@ -188,7 +201,8 @@
return
}
let arr = this.dataList.filter(el => el.checked === true)
let obj = Object.assign(this.currentData, {children: arr, stor_code: this.index1})
let urgent = this.isChecked ? '1' : '0'
let obj = Object.assign(this.currentData, {children: arr, stor_code: this.index1, urgent: urgent})
try {
let res = await outStorageConfirm(obj)
if (res.code === '200') {

View File

@@ -113,6 +113,7 @@
</template>
<script>
import {getCLodop} from "@/utils/CLodopfuncs.js"
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {queryPick, savePickTask} from '@/utils/getData2.js'
@@ -176,6 +177,8 @@
title: res.msg,
icon: 'none'
})
let data = Object.assign({}, this.data, {lxCode: this.val2})
setTimeout(this.toPrint(data), 800)
this.clearUp()
} else {
this.disabled = false
@@ -183,6 +186,72 @@
} catch (e) {
this.disabled = false
}
},
toPrint (data) {
let iparr = this.$store.getters.printUrl.split(":")
let printUrl = iparr[1].slice(2)
let LODOP = getCLodop();
if (!(LODOP.webskt && LODOP.webskt.readyState === 1)) {
uni.showToast({
title: '当前配置ip' + printUrl + '网络不通,请检查',
icon: 'none',
duration: 5000
})
return
}
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
LODOP.SET_LICENSES('浙江省烟草专卖局(公司)', 'C0C4A46A3A0D1F526D426018D9F11921', '', '')
// 更换为打印服务器ip 不需要加前缀
LODOP.PRINT_INIT(null, printUrl);
// 打印机序号 规则为打印服务器打印机列表倒数从0开始 -1为默认打印机
LODOP.SET_PRINTER_INDEX(-1);
LODOP.SET_PRINT_MODE("POS_BASEON_PAPER",true)
// 设置打印纸大小
// LODOP.SET_PRINT_PAGESIZE(1, '80mm', '60mm', '');
// LODOP.ADD_PRINT_RECT('1mm', '3mm', '74mm', '54mm', 0, 1);
// LODOP.SET_PRINT_STYLE('FontSize', 12);
// LODOP.SET_PRINT_STYLE('Bold', 1);
let tableHtml = `
<div id="div1">
<style>table{border:none} caption{height:20px;font-weight:bold;font-size: 20px;margin-bottom:20px;} td{border: 1px solid #000;height:28px;text-align: center}</style>
<table border=0 cellSpacing=0 cellPadding=0 width="100%" bordercolor="#000000" style="border-collapse:collapse">
<caption>物料信息卡</caption>
<tbody>
<tr>
<td width="40%">用料单号</td>
<td width="60%">${data.prd_ppbom_no}</td>
</tr>
<tr>
<td width="40%">物料编码</td>
<td width="60%">${data.material_code}</td>
</tr>
<tr>
<td width="40%">物料名称</td>
<td width="60%">${data.material_name}</td>
</tr>
<tr>
<td width="40%">物料规格</td>
<td width="60%">${data.material_spec}</td>
</tr>
<tr>
<td width="40%">物料数量</td>
<td width="60%">${data.assign_qty}</td>
</tr>
<tr>
<td width="40%">料箱号</td>
<td width="60%">${data.lxCode}</td>
</tr>
</tbody>
</table>
</div>`
LODOP.ADD_PRINT_TABLE("5%",20,"90%",220,tableHtml);
LODOP.PRINT();
// LODOP.PREVIEW()
uni.showToast({
title: '打印成功',
icon: 'none'
})
}
}
}

View File

@@ -1,4 +1,5 @@
/* eslint-disable */
import store from '@/vuex/store'
// #ifdef APP-PLUS
window = {
@@ -8,13 +9,20 @@ window = {
};
// #endif
(function(win) {
const iparr = store.getters.printUrl;
const urlRegex = /http:\/\/(\d+\.\d+\.\d+\.\d+)(:\d+)?/;
const match = iparr.match(urlRegex);
let printIp = match[1]; // IP 地址
let printPort = match[1] + (match[2] || ''); // IP 地址加端口
let printListDev = [];
let printListOnline = [];
var CLODOP = {
strWebPageID:"JL68836",
strTaskID: "",
strHostURI: "http://192.168.81.198:8000",
wsHostURI: "ws://192.168.81.198:8000/c_webskt/",
// strHostURI: "http://192.168.81.187:8000",
// wsHostURI: "ws://192.168.81.187:8000/c_webskt/",
strHostURI: "http://" + printPort,
wsHostURI: "ws://" + printPort + "/c_webskt/",
VERSION:"6.2.2.0",
IVERSION:"6220",
CVERSION:"3.0.2.5",
@@ -123,7 +131,8 @@ window = {
console.log(this.webskt)
console.log(CLODOP.wsHostURI)
console.log(rest)
let ip = uni.getStorageSync('fl_ip') || '192.168.81.198';
// let ip = uni.getStorageSync('fl_ip') || '192.168.81.187';
let ip = printIp;
let wsHostURI = `ws://${ip}:8000/c_webskt/`
this.SocketEnable = true;
try {

View File

@@ -315,3 +315,25 @@ export const inStorageConfirm = () => {
let res = {code: '200'}
return res
}
export const queryPick = () => {
let res = {
'code': 'a00001',
'product_area': 'A2',
'stor_code': 'FStockId',
"point_code": "001",
"material_code": "100001",
"material_name": "垃圾了付定金",
"material_spec": "垃圾了付定金",
"prd_ppbom_no": "20202020",
"assign_qty": 6,
'qty': 35
}
return res
}
export const savePickTask = (data) => {
let res = {
code: '200',
msg: 'ok'
}
return res
}

View File

@@ -2,9 +2,11 @@ import * as types from '../types'
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.10.49:8099' : 'http://192.168.10.49:8099'
const acsUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.18.250:8012' : 'http://192.168.18.250:8012'
const printUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.162:8010' : 'http://192.168.81.162:8010'
const state = {
baseUrl: uni.getStorageSync('baseUrl') || baseUrl,
acsUrl: uni.getStorageSync('acsUrl') || acsUrl,
printUrl: uni.getStorageSync('printUrl') || printUrl,
setTime: uni.getStorageSync('setTime') || 5000,
setPrintName: uni.getStorageSync('setPrintName') || '',
loginName: uni.getStorageSync('loginName') ? uni.getStorageSync('loginName') : '',
@@ -14,6 +16,7 @@ const state = {
const getters = {
baseUrl: state => state.baseUrl,
acsUrl: state => state.acsUrl,
printUrl: state => state.printUrl,
setTime: state => state.setTime,
setPrintName: state => state.setPrintName,
loginName: state => state.loginName,
@@ -24,6 +27,7 @@ const actions = {
setConfig ({commit}, res) {
uni.setStorageSync('baseUrl', res.baseUrl)
uni.setStorageSync('acsUrl', res.acsUrl)
uni.setStorageSync('printUrl', res.printUrl)
uni.setStorageSync('setTime', res.setTime)
uni.setStorageSync('setPrintName', res.setPrintName)
commit(types.COM_CONFIG, res)
@@ -54,6 +58,7 @@ const mutations = {
[types.COM_CONFIG] (state, res) {
state.baseUrl = res.baseUrl
state.acsUrl = res.acsUrl
state.printUrl = res.printUrl
state.setTime = res.setTime
state.setPrintName = res.setPrintName
},