add:新增PC袋标签新增打印按钮
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
package org.nl.wms.basedata.master.rest;
|
package org.nl.wms.basedata.master.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.wms.basedata.master.service.BagrecordService;
|
import org.nl.wms.basedata.master.service.BagrecordService;
|
||||||
import org.nl.wms.basedata.master.service.dto.BagrecordDto;
|
import org.nl.wms.basedata.master.service.dto.BagrecordDto;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@@ -68,6 +69,13 @@ public class BagrecordController {
|
|||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log("PC组袋")
|
||||||
|
@ApiOperation("PC组袋")
|
||||||
|
@PostMapping("/groupBag")
|
||||||
|
public ResponseEntity<Object> groupBag(@RequestBody JSONObject json) {
|
||||||
|
return new ResponseEntity<>(bagrecordService.groupBag(json),HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("导出数据")
|
@ApiOperation("导出数据")
|
||||||
@GetMapping(value = "/download")
|
@GetMapping(value = "/download")
|
||||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
package org.nl.wms.basedata.master.service;
|
package org.nl.wms.basedata.master.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.wms.basedata.master.service.dto.BagrecordDto;
|
import org.nl.wms.basedata.master.service.dto.BagrecordDto;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
@@ -78,4 +79,9 @@ public interface BagrecordService {
|
|||||||
*/
|
*/
|
||||||
void download(Map whereJson, HttpServletResponse response) throws IOException;
|
void download(Map whereJson, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PC组袋
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
JSONObject groupBag(JSONObject json);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nl.exception.BadRequestException;
|
import org.nl.exception.BadRequestException;
|
||||||
|
import org.nl.pda.st.set.service.PdaBagService;
|
||||||
|
import org.nl.pda.st.set.service.impl.PdaBagServiceImpl;
|
||||||
import org.nl.utils.FileUtil;
|
import org.nl.utils.FileUtil;
|
||||||
|
import org.nl.utils.SpringContextHolder;
|
||||||
import org.nl.wms.basedata.master.service.BagrecordService;
|
import org.nl.wms.basedata.master.service.BagrecordService;
|
||||||
import org.nl.wms.basedata.master.service.dto.BagrecordDto;
|
import org.nl.wms.basedata.master.service.dto.BagrecordDto;
|
||||||
import org.nl.wql.WQL;
|
import org.nl.wql.WQL;
|
||||||
@@ -189,4 +192,38 @@ public class BagrecordServiceImpl implements BagrecordService {
|
|||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public JSONObject groupBag(JSONObject json) {
|
||||||
|
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
map.put("material_code", json.getString("material_code"));
|
||||||
|
map.put("pcsn", json.getString("pcsn"));
|
||||||
|
map.put("return_person", json.getString("return_person"));
|
||||||
|
map.put("storage_qty", json.getString("storage_qty"));
|
||||||
|
map.put("waste_type", json.getString("waste_type"));
|
||||||
|
map.put("bag_num", json.getString("bag_num"));
|
||||||
|
|
||||||
|
// 组织数据调用pda组盘接口
|
||||||
|
JSONObject jsonMater = materTab.query("material_code = '" + json.getString("material_code") + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("物料不存在!");
|
||||||
|
map.put("material_id",jsonMater.getString("material_id"));
|
||||||
|
|
||||||
|
PdaBagService pdaBagService = SpringContextHolder.getBean(PdaBagService.class);
|
||||||
|
Map<String, Object> result = pdaBagService.groupBag(map);
|
||||||
|
|
||||||
|
// 判断是否报错
|
||||||
|
if (!StrUtil.equals(result.get("code").toString(), "1")) {
|
||||||
|
throw new BadRequestException(result.get("desc").toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
String string = result.get("result").toString();
|
||||||
|
JSONArray.parseArray(string);
|
||||||
|
JSONObject resultParam = new JSONObject();
|
||||||
|
resultParam.put("data", JSONArray.parseArray(string));
|
||||||
|
|
||||||
|
return resultParam;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,4 +24,12 @@ export function edit(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del }
|
export function groupBag(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/bagrecord/groupBag',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del, groupBag }
|
||||||
|
|||||||
@@ -148,6 +148,16 @@
|
|||||||
>
|
>
|
||||||
导出Excel
|
导出Excel
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="success"
|
||||||
|
icon="el-icon-check"
|
||||||
|
size="mini"
|
||||||
|
@click="insertAndPrint"
|
||||||
|
>
|
||||||
|
新增打印
|
||||||
|
</el-button>
|
||||||
</crudOperation>
|
</crudOperation>
|
||||||
<!--表单组件-->
|
<!--表单组件-->
|
||||||
<!--表格渲染-->
|
<!--表格渲染-->
|
||||||
@@ -183,6 +193,7 @@
|
|||||||
<!--分页组件-->
|
<!--分页组件-->
|
||||||
<pagination />
|
<pagination />
|
||||||
</div>
|
</div>
|
||||||
|
<InsertAndPrint :dialog-show.sync="insertAndPrintDialog" :father-method="hand"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -197,13 +208,14 @@ import { download } from '@/api/data'
|
|||||||
import { downloadFile } from '@/utils'
|
import { downloadFile } from '@/utils'
|
||||||
import { getLodop } from '@/assets/js/lodop/LodopFuncs'
|
import { getLodop } from '@/assets/js/lodop/LodopFuncs'
|
||||||
import crudBucketrecord from "@/api/wms/basedata/master/bucketrecord";
|
import crudBucketrecord from "@/api/wms/basedata/master/bucketrecord";
|
||||||
|
import InsertAndPrint from '@/views/wms/basedata/master/bagrecord/insertAndPrintDialog'
|
||||||
import Date from '@/utils/datetime'
|
import Date from '@/utils/datetime'
|
||||||
|
|
||||||
const defaultForm = { bagrecord_id: null, bag_id: null, material_id: null, pcsn: null, qty_unit_id: null, qty_unit_name: null, storage_qty: null, seqno: null, remark: null, waste_type: null, return_person: null, print_times: null, status: null, input_optid: null, input_optname: null, input_time: null, bucketunique: null, makeup_optid: null, makeup_optname: null, makeup_time: null, print_type: null }
|
const defaultForm = { bagrecord_id: null, bag_id: null, material_id: null, pcsn: null, qty_unit_id: null, qty_unit_name: null, storage_qty: null, seqno: null, remark: null, waste_type: null, return_person: null, print_times: null, status: null, input_optid: null, input_optname: null, input_time: null, bucketunique: null, makeup_optid: null, makeup_optname: null, makeup_time: null, print_type: null }
|
||||||
export default {
|
export default {
|
||||||
name: 'Bagrecord',
|
name: 'Bagrecord',
|
||||||
dicts: ['MD_MATERIAL_WASTE_TYPE'],
|
dicts: ['MD_MATERIAL_WASTE_TYPE'],
|
||||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
components: { pagination, crudOperation, rrOperation, udOperation, InsertAndPrint },
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({
|
return CRUD({
|
||||||
@@ -232,6 +244,7 @@ export default {
|
|||||||
{ 'code': '02', 'name': '组桶' },
|
{ 'code': '02', 'name': '组桶' },
|
||||||
{ 'code': '03', 'name': '清洗' }
|
{ 'code': '03', 'name': '清洗' }
|
||||||
],
|
],
|
||||||
|
insertAndPrintDialog: false,
|
||||||
query_flag: true,
|
query_flag: true,
|
||||||
permission: {
|
permission: {
|
||||||
},
|
},
|
||||||
@@ -337,6 +350,9 @@ export default {
|
|||||||
this.crud.toQuery()
|
this.crud.toQuery()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
insertAndPrint() {
|
||||||
|
this.insertAndPrintDialog = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,196 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
title="新增打印"
|
||||||
|
append-to-body
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
width="450px"
|
||||||
|
:before-close="handleClose"
|
||||||
|
destroy-on-close
|
||||||
|
@close="close"
|
||||||
|
>
|
||||||
|
<el-form ref="form" :model="form1" :rules="rules" size="mini" label-width="110px">
|
||||||
|
<el-form-item label="压制单号:" prop="bill_code">
|
||||||
|
<el-input v-model="form1.bill_code" placeholder="请输入单号" style="width: 250px;" @blur="blurQueryMater(form1.bill_code)" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="粉料编码:" prop="material_code">
|
||||||
|
<el-select
|
||||||
|
v-model="form1.material_code"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
placeholder="全部"
|
||||||
|
class="filter-item"
|
||||||
|
style="width: 250px;"
|
||||||
|
@change="changePcsn"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in materialList"
|
||||||
|
:key="item.pcsn"
|
||||||
|
:label="item.material_code"
|
||||||
|
:value="item.material_code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="粉料批号:" prop="pcsn">
|
||||||
|
<el-input v-model="form1.pcsn" disabled style="width: 250px;" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="重量:" prop="storage_qty">
|
||||||
|
<el-input-number v-model="form1.storage_qty" :min="0" :precision="3" :controls="false" style="width: 250px;" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="还回人员编码:" prop="return_code">
|
||||||
|
<el-input v-model="form1.return_code" placeholder="请输入人员编码" style="width: 250px;" @blur="blurPerson(form1.return_code)" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="还回人员名称:" prop="return_person">
|
||||||
|
<el-input v-model="form1.return_person" disabled style="width: 250px;" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="软废类型:" prop="waste_type">
|
||||||
|
<el-select
|
||||||
|
v-model="form1.waste_type"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
placeholder="全部"
|
||||||
|
class="filter-item"
|
||||||
|
style="width: 250px;"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dict.MD_MATERIAL_WASTE_TYPE"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="袋数:" prop="bag_num">
|
||||||
|
<el-input-number v-model="form1.bag_num" :min="1" :precision="0" :controls="false" style="width: 250px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="groupBag">组 袋</el-button>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import CRUD, { header, presenter } from '@crud/crud'
|
||||||
|
import crudBagrecord from '@/api/wms/basedata/master/bagrecord'
|
||||||
|
import { getLodop } from '@/assets/js/lodop/LodopFuncs'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
dicts: ['MD_MATERIAL_WASTE_TYPE'],
|
||||||
|
name: 'ProcessDialog',
|
||||||
|
mixins: [presenter(), header()],
|
||||||
|
props: {
|
||||||
|
dialogShow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
openParam: {
|
||||||
|
type: String
|
||||||
|
},
|
||||||
|
fatherMethod: {
|
||||||
|
type: Function,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
dialogShow: {
|
||||||
|
handler(newValue, oldValue) {
|
||||||
|
this.dialogVisible = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
materialList: [],
|
||||||
|
dialogVisible: false,
|
||||||
|
form1: {
|
||||||
|
return_person: null,
|
||||||
|
bag_num: '1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClose(done) {
|
||||||
|
this.$confirm('确认关闭?')
|
||||||
|
.then(_ => {
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
.catch(_ => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$emit('update:dialogShow', false)
|
||||||
|
this.form1 = {}
|
||||||
|
},
|
||||||
|
blurQueryMater(val) {
|
||||||
|
// 根据单据号查询调用接口获取压制订单内信息
|
||||||
|
const res = [
|
||||||
|
{ 'pcsn': '111', 'material_code': 'XR13II-P-B-20' },
|
||||||
|
{ 'pcsn': '23423', 'material_code': '001' },
|
||||||
|
{ 'pcsn': '444', 'material_code': '002' },
|
||||||
|
{ 'pcsn': '1215552', 'material_code': '003' }
|
||||||
|
]
|
||||||
|
|
||||||
|
this.materialList = res
|
||||||
|
},
|
||||||
|
changePcsn(val) {
|
||||||
|
this.materialList.forEach(item => {
|
||||||
|
if (item.material_code === val) {
|
||||||
|
this.form1.pcsn = item.pcsn
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
blurPerson(val) {
|
||||||
|
// 调用接口查询对应的人员信息
|
||||||
|
|
||||||
|
this.form1.return_person = val
|
||||||
|
},
|
||||||
|
groupBag() {
|
||||||
|
crudBagrecord.groupBag(this.form1).then(res => {
|
||||||
|
this.crud.notify('操作成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
const LODOP = getLodop()
|
||||||
|
const data = res.data
|
||||||
|
data.forEach(item => {
|
||||||
|
debugger
|
||||||
|
|
||||||
|
var num = Number.parseFloat(item.storage_qty)
|
||||||
|
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
|
||||||
|
// 打印纸张大小设置https://www.it610.com/article/2094844.html
|
||||||
|
LODOP.PRINT_INIT('')
|
||||||
|
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)
|
||||||
|
|
||||||
|
LODOP.ADD_PRINT_BARCODE('2mm', '4mm', '33mm', '33mm', 'QRCode', item.bag_id + '##' + item.ext_id + '##' + item.pcsn + '##' + num + '##' + item.input_time)
|
||||||
|
LODOP.ADD_PRINT_TEXT('5mm', '35mm', '50mm', '15mm', '日期:' + item.input_time)
|
||||||
|
LODOP.ADD_PRINT_TEXT('15mm', '35mm', '50mm', '15mm', '批次:' + item.pcsn)
|
||||||
|
LODOP.ADD_PRINT_TEXT('25mm', '35mm', '50mm', '15mm', '重量:' + num + 'kg')
|
||||||
|
LODOP.ADD_PRINT_TEXT('34mm', '5mm', '80mm', '15mm', '袋号:' + item.bag_id)
|
||||||
|
LODOP.ADD_PRINT_TEXT('41mm', '5mm', '80mm', '15mm', '编码:' + item.material_code)
|
||||||
|
LODOP.ADD_PRINT_TEXT('48mm', '5mm', '80mm', '15mm', '还回人员:' + item.return_person)
|
||||||
|
// LODOP.PRINT_DESIGN() // 打印设置
|
||||||
|
// LODOP.PREVIEW()// 预览
|
||||||
|
LODOP.PRINT()// 打印
|
||||||
|
})
|
||||||
|
this.close()
|
||||||
|
this.fatherMethod()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user