Browse Source

0505更新

master
ruanqi 4 years ago
parent
commit
14227268d9
  1. 2
      src/api/production/pallet.js
  2. 3
      src/main.js
  3. 4
      src/utils/LodopFuncs.js
  4. 44
      src/views/modules/pallet/pallet.vue
  5. 28
      src/views/modules/pallet/print_pallet_label.js
  6. 28
      src/views/modules/production/print_serialNo_label.js
  7. 52
      src/views/modules/production/search_schedule.vue

2
src/api/production/pallet.js

@ -15,3 +15,5 @@ export const getLocationData=data => createAPI(`/pallet/getLocationData`,'post'
export const saveLocationData=data => createAPI(`/pallet/saveLocationData`,'post',data) export const saveLocationData=data => createAPI(`/pallet/saveLocationData`,'post',data)
//删除位置数据 //删除位置数据
export const deleteLocationData=data => createAPI(`/pallet/deleteLocationData`,'post',data) export const deleteLocationData=data => createAPI(`/pallet/deleteLocationData`,'post',data)
export const getScheduleSerialNo=data => createAPI(`/pallet/getScheduleSerialNo`,'post',data)

3
src/main.js

@ -15,7 +15,7 @@ import JsonExcel from 'vue-json-excel'
import i18n from '@/i18n/i18n' import i18n from '@/i18n/i18n'
import './directives' import './directives'
import decimalUtil from '@/utils/decimalUtil.js' import decimalUtil from '@/utils/decimalUtil.js'
import getLodop from '@/utils/LodopFuncs.js'
Vue.component('downloadExcel', JsonExcel) Vue.component('downloadExcel', JsonExcel)
@ -33,6 +33,7 @@ Vue.prototype.$http = httpRequest // ajax请求方法
Vue.prototype.isAuth = isAuth // 权限方法 Vue.prototype.isAuth = isAuth // 权限方法
Vue.prototype.decimalUtil = decimalUtil // 计算 Vue.prototype.decimalUtil = decimalUtil // 计算
Vue.prototype.dayjs = dayjs //时间格式化插件 2021-11-02 Vue.prototype.dayjs = dayjs //时间格式化插件 2021-11-02
Vue.prototype.getLodop = getLodop // 打印
// 保存整站vuex本地储存初始状态 // 保存整站vuex本地储存初始状态
window.SITE_CONFIG['storeState'] = cloneDeep(store.state) window.SITE_CONFIG['storeState'] = cloneDeep(store.state)

4
src/utils/LodopFuncs.js

@ -14,7 +14,7 @@ head.insertBefore(oscript, head.firstChild)
// 下载loadLodop // 下载loadLodop
function loadLodop() { function loadLodop() {
window.open('../../static/Lodop/CLodop_Setup_for_Win32NT.exe')
window.open('http://www.lodop.net/')
} }
// ====获取LODOP对象的主过程:==== // ====获取LODOP对象的主过程:====
@ -32,7 +32,7 @@ function getLodop() {
title: '温馨提示', title: '温馨提示',
type: 'warning', type: 'warning',
showCancelButton: true, showCancelButton: true,
message: '您还未安装打印控件,点击确定下载打印控件,安装成功后刷新页面即可进行打印',
message: '您还未安装打印控件,请联系管理员或者去官网下载!',
callback: res => { callback: res => {
if (res === 'confirm') { if (res === 'confirm') {
loadLodop() loadLodop()

44
src/views/modules/pallet/pallet.vue

@ -30,12 +30,14 @@
</el-select> </el-select>
<el-button type="primary" @click="getPalletData()">查询</el-button> <el-button type="primary" @click="getPalletData()">查询</el-button>
<el-button type="primary" @click="newPallet()">新增</el-button> <el-button type="primary" @click="newPallet()">新增</el-button>
<el-button type="primary" @click="prints()">批量打印</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table
:height="height" :height="height"
:data="palletList" :data="palletList"
border border
@selection-change="selectionChangeHandle"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
prop="" prop=""
@ -48,6 +50,11 @@
<a type="text" size="small" @click="print(scope.row)">打印标签</a> <a type="text" size="small" @click="print(scope.row)">打印标签</a>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
type="selection"
align="center"
width="30">
</el-table-column>
<el-table-column <el-table-column
prop="palletNo" prop="palletNo"
header-align="center" header-align="center"
@ -146,7 +153,10 @@
savePalletAdds, savePalletAdds,
printPallet, printPallet,
} from '@/api/production/pallet.js' } from '@/api/production/pallet.js'
/*打印标签专用的js*/
import {
printMaterialLabel,
} from "@/views/modules/pallet/print_pallet_label.js"
export default { export default {
name: "pallet", name: "pallet",
data() { data() {
@ -158,6 +168,7 @@
date1:'', date1:'',
date2:'', date2:'',
}, },
dataListSelections:'',
addStatus:'', addStatus:'',
palletData:{ palletData:{
palletNo:'', palletNo:'',
@ -183,6 +194,9 @@
}) })
}, },
methods: { methods: {
selectionChangeHandle (val) {
this.dataListSelections = val
},
newPallet(){ newPallet(){
this.palletData.palletNo='系统自动生成'; this.palletData.palletNo='系统自动生成';
this.palletData.palletDesc=''; this.palletData.palletDesc='';
@ -303,24 +317,24 @@
}, },
print(row){ print(row){
let array=[]; let array=[];
let data={palletNo:row.palletNo,user:this.$store.state.user.name}
let data={palletNo:row.palletNo}
array.push(data); array.push(data);
printPallet(array).then(({data}) => {
if(data.code=="200"){
this.$message({
message: '打印成功',
type: 'success',
duration: 1500,
onClose: () => {
}
})
}else {
this.$alert(data.msg, '错误', {
printMaterialLabel(array);
},
prints(){
if(this.dataListSelections.length==0){
this.$alert('请勾选需要打印的栈板!','错误',{
confirmButtonText: '确定' confirmButtonText: '确定'
}) })
return false;
}
let array=[];
for (let i = 0; i <this.dataListSelections.length ; i++) {
let data={palletNo:this.dataListSelections[i].palletNo}
array.push(data);
}
printMaterialLabel(array);
} }
})
},
}, },
created() { created() {
this.getPalletData(); this.getPalletData();

28
src/views/modules/pallet/print_pallet_label.js

@ -0,0 +1,28 @@
/*调用js打印标签*/
import getLodop from '@/utils/LodopFuncs.js'
/*打印材料卷标签*/
export function printMaterialLabel(printList) {
const LODOP = getLodop()
if (LODOP) {
//LODOP.SET_LICENSES("", "13F0BE83846277CB60918577C6281375", "", "");
LODOP.SET_LICENSES("", "7B5624CC84E599D6B17F27DF40F4310C", "", "");
LODOP.SET_PRINTER_INDEXA("小标签打印机");
//循环调用打印机
for(let i = 0; i < printList.length; i++){
let printData = printList[i];
LODOP.NewPage();
LODOP.SET_PRINT_PAGESIZE(0,300,200,"");
LODOP.ADD_PRINT_TEXT(54,11,82,20,printData.palletNo);
LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
LODOP.ADD_PRINT_BARCODE(7,31,86,61,"QRCode",printData.palletNo);
}
// LODOP.PRINT_DESIGN();
//LODOP.PREVIEW();
LODOP.PRINT();
console.log("操作成功!")
}
}

28
src/views/modules/production/print_serialNo_label.js

@ -0,0 +1,28 @@
/*调用js打印标签*/
import getLodop from '@/utils/LodopFuncs.js'
/*打印材料卷标签*/
export function printMaterialLabel(printList) {
const LODOP = getLodop()
if (LODOP) {
//LODOP.SET_LICENSES("", "13F0BE83846277CB60918577C6281375", "", "");
LODOP.SET_LICENSES("", "7B5624CC84E599D6B17F27DF40F4310C", "", "");
LODOP.SET_PRINTER_INDEXA("小标签打印机");
//循环调用打印机
for(let i = 0; i < printList.length; i++){
let printData = printList[i];
LODOP.NewPage();
LODOP.SET_PRINT_PAGESIZE(0,300,200,"");
LODOP.ADD_PRINT_TEXT(54,11,82,20,printData.serialNo);
LODOP.SET_PRINT_STYLEA(0,"FontName","黑体");
LODOP.SET_PRINT_STYLEA(0,"FontSize",12);
LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
LODOP.ADD_PRINT_BARCODE(7,31,86,61,"QRCode",printData.serialNo);
}
// LODOP.PRINT_DESIGN();
//LODOP.PREVIEW();
LODOP.PRINT();
console.log("操作成功!")
}
}

52
src/views/modules/production/search_schedule.vue

@ -106,11 +106,15 @@
</template> </template>
<script> <script>
import {
printMaterialLabel,
} from "@/views/modules/production/print_serialNo_label.js"
import { import {
getProduceScheduleList getProduceScheduleList
} from '@/api/production/dailyPlan.js' } from '@/api/production/dailyPlan.js'
import { import {
printSerialNo
printSerialNo,
getScheduleSerialNo,
} from '@/api/production/pallet.js' } from '@/api/production/pallet.js'
export default { export default {
name: 'search_schedule', name: 'search_schedule',
@ -856,24 +860,49 @@
qty: this.printQty, qty: this.printQty,
user: this.$store.state.user.name user: this.$store.state.user.name
} }
array.push(data);
// array.push(data);
printSerialNo(array).then(({data}) => {
if(data.code=="200"){
this.$message({
message: '打印成功',
type: 'success',
duration: 1500,
onClose: () => {
}
// printSerialNo(array).then(({data}) => {
// if(data.code=="200"){
// this.$message({
// message: '',
// type: 'success',
// duration: 1500,
// onClose: () => {
// }
// })
// }else {
// this.$alert(data.msg, '', {
// confirmButtonText: ''
// })
// }
// })
// }
getScheduleSerialNo(data).then(({data}) => {
if (data.code == 0) {
if (data.total == 0) {
this.$alert("该日计划下不存在序列号请联系管理员!", '错误', {
confirmButtonText: '确定'
}) })
return false;
}else {
for (let i = 0; i <data.total ; i++) {
for(let x=0;x<this.printQty;x++){
let printData={serialNo:data.rows[i].serialNo}
array.push(printData);
}
}
printMaterialLabel(array);
this.printModalFlag = false;
}
} else { } else {
this.$alert(data.msg, '错误', { this.$alert(data.msg, '错误', {
confirmButtonText: '确定' confirmButtonText: '确定'
}) })
} }
}) })
}
}, },
routingRowClassName2 ({row, rowIndex}) { routingRowClassName2 ({row, rowIndex}) {
@ -882,6 +911,7 @@
return 'customer-row-2'; return 'customer-row-2';
} }
}, },
}
} }
</script> </script>

Loading…
Cancel
Save