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

4
src/utils/LodopFuncs.js

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

48
src/views/modules/pallet/pallet.vue

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

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

@ -106,11 +106,15 @@
</template>
<script>
import {
printMaterialLabel,
} from "@/views/modules/production/print_serialNo_label.js"
import {
getProduceScheduleList
} from '@/api/production/dailyPlan.js'
import {
printSerialNo
printSerialNo,
getScheduleSerialNo,
} from '@/api/production/pallet.js'
export default {
name: 'search_schedule',
@ -795,19 +799,19 @@
},
methods: {
//excel
createExportData() {
createExportData () {
return this.dataList;
},
startDownload() {
startDownload () {
// this.exportData = this.dataList
},
finishDownload() {
finishDownload () {
},
fields() {
fields () {
let json = "{"
this.columnArray.forEach((item, index) => {
if (index == this.columnArray.length - 1) {
@ -822,66 +826,92 @@
return s
},
// end
refreshTables(){
refreshTables () {
getProduceScheduleList(this.searchData).then(({data}) => {
//
this.dataList = data.rows;
})
},
printAction(row){
this.rowData=row;
this.printQty=1;
this.printModalFlag=true;
printAction (row) {
this.rowData = row;
this.printQty = 1;
this.printModalFlag = true;
},
doPrint(){
if(this.printQty==""||this.printQty==0||this.printQty==null){
doPrint () {
if (this.printQty == "" || this.printQty == 0 || this.printQty == null) {
this.$alert('请输入大于0的打印份数!', '错误', {
confirmButtonText: '确定'
})
return false;
}
if(this.printQty>20){
if (this.printQty > 20) {
this.$alert('打印份数过大请重新设置!', '错误', {
confirmButtonText: '确定'
})
return false;
}
let array=[];
let data={
site:this.rowData.site,
orderNo:this.rowData.orderNo,
itemNo:this.rowData.itemNo,
scheduleDate:this.rowData.scheduledDate,
shiftNo:this.rowData.shiftNo,
qty:this.printQty,
user:this.$store.state.user.name
let data = {
site: this.rowData.site,
orderNo: this.rowData.orderNo,
itemNo: this.rowData.itemNo,
scheduleDate: this.rowData.scheduledDate,
shiftNo: this.rowData.shiftNo,
qty: this.printQty,
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: () => {
// }
// })
// }else {
// this.$alert(data.msg, '', {
// confirmButtonText: ''
// })
// }
// })
// }
printSerialNo(array).then(({data}) => {
if(data.code=="200"){
this.$message({
message: '打印成功',
type: 'success',
duration: 1500,
onClose: () => {
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);
}
}
})
}else {
printMaterialLabel(array);
this.printModalFlag = false;
}
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}
},
routingRowClassName2({row, rowIndex}){
routingRowClassName2 ({row, rowIndex}) {
//
if(row.printFlag=="Y"){
if (row.printFlag == "Y") {
return 'customer-row-2';
}
},
}
}
</script>

Loading…
Cancel
Save