1/8 单据校验页面1.0

20240912_adapter
wangwei 6 months ago
parent b1dedb00d3
commit bb6665ca8d

@ -126,7 +126,10 @@ export default {
}
this.closeDialog()
})
}
},
hideForm(){
this.closeDialog()
},
},
created() {
if (this.rowData != null){

@ -75,6 +75,10 @@
<!-- <i class="el-icon-s-order"></i>-->
<span slot="title">待处理单</span>
</el-menu-item>
<el-menu-item :index=11 @click="clickMenuItem(11)" v-if="workPlaceClass == 1">
<!-- <i class="el-icon-edit-outline"></i>-->
<span slot="title">单据校验</span>
</el-menu-item>
<el-menu-item :index=5 @click="clickMenuItem(5)" v-if="workPlaceClass == 1">
<!-- <i class="el-icon-s-claim"></i>-->
<span slot="title">已完成单</span>
@ -278,6 +282,7 @@ import CollectOrderUpload from '@/views/collect/CollectOrderUpload.vue'
import IoDestroyOrder from '@/views/collect/IoDestroyOrder.vue'
import IoSplitFifoRemind from '@/views/collect/IoSplitFifoRemind.vue'
import IocCollectOrderCheckCode from '@/views/collect/IocCollectOrderCheckCode.vue'
import IocCollectOrderVerify from "@/views/collect/IocCollectOrderVerify.vue"
import {listPage, switchWorkplaceStatus} from "@/api/basic/workPlace/sysWorkplaceManage";
import {
filterListByWorkplace,
@ -296,7 +301,8 @@ export default {
CollectOrderEnd,
CollectOrderUpload,
IoDestroyOrder,
IocCollectOrderCheckCode
IocCollectOrderCheckCode,
IocCollectOrderVerify
},
name: 'CollectOrderTabs',
data() {
@ -429,7 +435,16 @@ export default {
component: IocCollectOrderCheckCode,
//
componentProps: {}
}],
},
{
number: 11,
title: '单据校验',
name: 'IocCollectOrderVerify',
component: IocCollectOrderVerify,
//
componentProps: {}
}
],
editableTabs: [{
number: 0,
title: '处理单据',

@ -223,7 +223,7 @@ export default {
this.codeQuery.selectType = 1
this.getResultDetailList()
let codeList = res.data
let filterCodeList = codeList.filter(item => item.status === 5).map(item => item.code);;
let filterCodeList = codeList.filter(item => item.status === 5).map(item => item.code)
if (filterCodeList.length > 0){
query.codeList = filterCodeList
this.replaceCode(query,1)

@ -0,0 +1,754 @@
<template>
<div>
<el-form :model="filterQuery" class="order-el-form" ref="formData" label-width="120px" @submit.native.prevent>
<el-card>
<el-row :gutter="0" style="margin-top: 15px">
<el-col :span="24" align="right">
<el-button-group>
<el-button
type="primary"
:disabled="!orderData.billNo"
@click.native="confirmCheckOrder()"
>校验完成
</el-button>
</el-button-group>
</el-col>
</el-row>
<div style="border: 1px solid #ebeef5;border-radius: 2px;margin-top: 15px;padding: 15px"
v-loading="this.loading"
>
<el-row :gutter="0" style="margin-top: 5px">
<el-col :span="20">
<el-form-item prop="code" :label="scanTip" label-width="80px">
<el-input
id="inputer"
@focus="getInputFocus($event)"
@keypress.enter.native="enterKey($event)"
ref="inputRef"
style="ime-mode: disabled"
type="tel"
:placeholder="this.placeholder"
v-model="scanCode"
></el-input>
<!-- :disabled="scanDisabled"-->
</el-form-item>
</el-col>
<el-col :span="4">
<el-button-group style="display: flex;">
<el-button
type="primary"
size="mini"
icon="el-icon-search"
@click.native.stop="enterKey($event)"
style="margin-left: 15px"
>
</el-button>
<!-- :disabled="!formData.billNo || (this.formDataVisible != null && this.formDataVisible.scanType == 1)"-->
<el-button type="primary"
@click="addGs"
>ALT+29
</el-button>
<el-button
type="primary"
size="mini"
icon="el-icon-delete"
@click.native.stop="clear()"
>清空
</el-button>
</el-button-group>
</el-col>
</el-row>
<el-alert
v-if="successVisible "
:title="scanTitle"
:type="scanResultType"
:closable="false"
:dangerouslyUseHTMLString="true"
:description="result"
>
</el-alert>
<el-alert
v-if="errVisible "
title="错误信息:"
type="error"
:closable="false"
:dangerouslyUseHTMLString="true"
:description="errResult"
>
</el-alert>
</div>
<el-descriptions title="单据信息" :column="4" border style="margin-top: 15px">
<el-descriptions-item label="业务单号">{{ orderData.billNo }}</el-descriptions-item>
<el-descriptions-item label="发货方">{{ orderData.shipperName }}</el-descriptions-item>
<el-descriptions-item label="收货方">{{ orderData.fromCorpName }}</el-descriptions-item>
<el-descriptions-item label="单据类型">{{ orderData.busTypeName }}</el-descriptions-item>
<el-descriptions-item label="来源系统">{{ orderData.fromType }}</el-descriptions-item>
<el-descriptions-item label="单据时间">{{ orderData.billTime }}</el-descriptions-item>
<el-descriptions-item label="单据备注">{{ orderData.remark }}</el-descriptions-item>
</el-descriptions>
</el-card>
<el-tabs type="border-card" style="margin: 15px">
<!--单据业务详情-->
<el-tab-pane>
<span slot="label">单据 {{ orderData.billNo }}-追溯码详情</span>
<el-table :data="detailList" style="width: 100%;" highlight-current-row="true" border ref="multipleTable"
:row-style="rowStyle"
>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="追溯码" prop="code" width="160"></el-table-column> <el-table-column label="" prop="cpmctymc" width="110"></el-table-column>
<el-table-column label="包装规格" prop="ggxh" width="110"></el-table-column>
<el-table-column label="批次号" prop="batchNo"></el-table-column>
<el-table-column label="生产日期" prop="productDate"></el-table-column>
<el-table-column label="失效日期" prop="expireDate"></el-table-column>
<el-table-column label="序列号" prop="serialNo"></el-table-column>
<el-table-column label="药品编码" prop="nameCode"></el-table-column>
<!--<el-table-column label="扫码数量" prop="scanActCount"></el-table-column>-->
<el-table-column label="批准文号" prop="zczbhhzbapzbh"></el-table-column>
</el-table>
<el-row style="text-align: right;font-size: 12px;margin-top: 10px">
<el-col span="24">
<div style="float: right">
<!--<td>-->
<!-- <div style="background-color: #F56C6C;width: 10px;height: 10px;"></div>-->
<!--</td>-->
<!--<td><span style="color: #6d6d6d;"><pre>未赋码 </pre></span></td>-->
<td>
<div style="background-color: #E6A23C;width: 10px;height: 10px;"></div>
</td>
<td>
<span style="color: #6d6d6d;"><pre>替换码 </pre></span>
</td>
<td>
<div style="background-color: #67C23A;width: 10px;height: 10px;"></div>
</td>
<td>
<span style="color: #6d6d6d;"><pre>已校验</pre></span>
</td>
</div>
</el-col>
</el-row>
<pagination
v-show="resultTotal>0"
:total="resultTotal"
:limit.sync="codeQuery.limit"
:page.sync="codeQuery.page"
@pagination="getPage()"
></pagination>
<!-- 在表格下方添加说明 -->
</el-tab-pane>
<el-tab-pane label="整单详情">
<CollectFinishOrderBackupDetail
v-if="panelALive"
:prescribeData="curRow"
></CollectFinishOrderBackupDetail>
</el-tab-pane>
</el-tabs>
</el-form>
</div>
</template>
<script>
import { getCodeEndList } from '@/api/collect/IoCollectCodeSelect'
import { orderFinish } from '@/api/collect/collectOrder'
import selectPrescribeDialog from '@/views/collect/selectCollectOrderDialog'
import CollectFinishOrderBackupDetail from "./CollectFinishOrderBackupDetail"
import { commitCheckCodeOrder, scanCheckCodeOrder, scanCheckCodeReplace } from '@/api/collect/splitCreateOrder'
import { isBlank } from '@/utils/strUtil'
export default {
name: 'IocCollectOrderVerify',
props: {
resetKey: {
type: Function,
required: true
}
},
components: { selectPrescribeDialog,CollectFinishOrderBackupDetail },
data() {
return {
resultTotal: 0,
scanTip: '单据录入:',
placeholder: '请输入单据号进行扫码校验',
scanTitle: '扫码结果:',
scanResultType: 'success',
result: '\n',
errVisible: false,
loading: false,
successVisible: true,
errResult: '',
scanCode: '',
filterQuery: {
code: '',
billNo: null,
codeList: []
},
orderData: {},
curRow: null,
codeList: [],
//1/7
orderQuery: {
page: 1,
limit: 10,
billNo: null,
tagStatus: 3,
workPlaceCode: null,
busType: null
},
codeQuery: {
billNo: null,
code: null,
selectType: 2,
page: 1,
limit: 10
},
workplaceId: null,
busType: null,
detailList: [],
checkCodeList: [],
checkCodeEndList: [],
panelALive: false,
ws: null,
}
},
methods: {
enterKey() {
this.errResult = ''
if (this.orderData.billNo == null) {
this.enterBillNoKey()
return
}
this.check()
},
check() {
this.errResult = ''
this.filterQuery.code = this.scanCode.trim()
if (this.filterQuery.code.includes(';')) {
const codeArray = this.filterQuery.code.split(';')
this.filterQuery.codeList = codeArray
this.filterQuery.code = ''
this.filterQuery.billNo = this.orderData.billNo
//
this.batchVailCode(this.filterQuery)
return
}
if (this.filterQuery.code) {
if (!this.parseString(this.filterQuery.code)) {
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
this.$message.error('无效追溯码')
return
}
}
//
this.filterQuery.billNo = this.orderData.billNo
this.verifyCode(this.filterQuery)
// this.getInputFocus()
},
batchVailCode(params) {
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
this.verifyCode(params)
},
enterBillNoKey(billNo) {
if (isBlank(billNo)){
this.orderQuery.code = billNo
}else {
this.orderQuery.code = this.scanCode
}
this.orderQuery.workPlaceCode = this.workplaceId
this.orderQuery.busType = this.busType
orderFinish(this.orderQuery).then(res => {
if (res.code == 20000) {
this.placeholder = '已选入单据,请扫描追溯码进行校验'
this.scanTip = '扫码校验'
this.orderData = res.data.list[0]
this.curRow = res.data.list[0]
this.filterQuery.billNo = this.orderData.billNo
this.refreshCodesPanel()
this.initData()
this.getResultDetailList()
} else {
this.$message.error(res.message)
}
})
},
refreshCodesPanel() {
this.panelALive = false
this.$nextTick(() => {
this.panelALive = true
})
},
getPage(){
this.codeQuery.selectType = 1
this.getResultDetailList()
},
getResultDetailList() {
this.codeQuery.billNo = this.orderData.billNo
getCodeEndList(this.codeQuery).then((res) => {
if (res.code === 20000) {
this.detailList = res.data.list || []
this.checkCodeList = this.detailList.map(item => item.code)
this.resultTotal = res.data.total || 0
this.codeQuery.selectType = 2
} else {
this.$message.error(res.message)
this.detailList = []
this.resultTotal = 0
}
}).catch((error) => {
this.$message.error(error.message)
this.detailList = []
// this.resultTotal = 0;
})
},
getInputFocus(event) {
// event.currentTarget.select();
this.$nextTick(() => {
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
})
},
verifyCode(query) {
scanCheckCodeOrder(query).then(res => {
if (res.code == 20000) {
if (Array.isArray(res.data)) {
this.printCodeResultList(res.data)
this.codeQuery.selectType = 1
this.getResultDetailList()
let codeList = res.data
let filterCodeList = codeList.filter(item => item.status === 5).map(item => item.code)
if (filterCodeList.length > 0) {
query.codeList = filterCodeList
this.replaceCode(query, 1)
}
} else {
this.verifyFinish(1, res.data, res.message)
this.checkCodeEndList.push(query.code)
this.codeQuery.selectType = 1
this.getResultDetailList()
//
this.$message.success('校验成功')
}
} else if (res.code == 503) {
this.replaceCode(query, 2)
} else if (res.code == 504) {
//
this.$confirm('追溯码校验超出是否继续添加', '提示', {
confirmButtonText: '添加',
cancelButtonText: '取消',
type: 'warning',
center: true,
closeOnPressEscape: false,// ESC
closeOnClickModal: false,//
distinguishCancelAndClose: true//
}).then(() => {
scanCheckCodeReplace(query).then(res => {
if (res.code == 20000) {
this.scanCode = ''
this.orderData.checkCodeConfirm = res.data.checkCodeConfirm
this.codeQuery.selectType = 1
this.getResultDetailList()
this.getInputFocus()
this.$message.success('添加成功')
} else {
this.$message.error('添加失败')
}
})
})
} else {
if (Array.isArray(res.data)) {
} else {
this.scanCode = ''
this.getInputFocus()
// this.verifyFinish(2, res.data, res.message)
this.$message.error(res.message)
}
}
})
},
replaceCode(query, type) {
let title = ''
if (type == 1) {
const codeStr = query.codeList.join('\n')
title = `${codeStr}该追溯码不存在是否继续添加`
} else {
title = '该追溯码不存在是否继续添加'
}
//
this.$confirm(title, '提示', {
confirmButtonText: '添加',
cancelButtonText: '取消',
type: 'warning',
center: true,
closeOnPressEscape: false,// ESC
closeOnClickModal: false,//
distinguishCancelAndClose: true//
}).then(() => {
scanCheckCodeReplace(query).then(res => {
if (res.code == 20000) {
this.scanCode = ''
this.orderData.checkCodeConfirm = res.data.checkCodeConfirm
this.codeQuery.selectType = 1
this.getResultDetailList()
this.getInputFocus()
this.$message.success('添加成功')
} else {
this.$message.error('添加失败')
}
})
}).catch(() => {
this.scanCode = ''
this.getInputFocus()
})
},
verifyFinish(val, data, message) {
if (val == 1) {
this.errVisible = false
this.successVisible = true
this.printCodeResult(data, message)
} else {
this.errVisible = true
this.successVisible = false
this.errResult = data + '追溯码不存在'
}
this.scanCode = ''
this.getInputFocus()
},
printCodeResult(data, message) {
const resultParts = []
if (data.udi) {
resultParts.push('层级标识: ' + data.udi)
}
if (data.cpmctymc) {
resultParts.push(data.productType == 2 ? '药品通用名称' : '产品通用名称: ' + data.cpmctymc)
}
if (data.batchNo) {
resultParts.push('批次号: ' + data.batchNo)
}
if (data.produceDate) {
resultParts.push('生产日期: ' + data.produceDate)
}
if (data.expireDate) {
resultParts.push('失效日期: ' + data.expireDate)
}
if (data.serialNo) {
resultParts.push('序列号: ' + data.serialNo)
}
if (data.productType == 2) {
if (data.bzgg) {
resultParts.push('包装规格: ' + data.bzgg)
}
} else {
if (data.ggxh) {
resultParts.push('规格型号: ' + data.ggxh)
}
}
if (data.prepnSpec) {
resultParts.push('制剂规格: ' + data.prepnSpec)
}
if (data.prepnUnit) {
resultParts.push('剂型: ' + data.prepnUnit)
}
if (data.packUnit) {
resultParts.push('计量单位: ' + data.packUnit)
}
this.scanTitle = '扫码结果:' + data.code
this.result = resultParts.join(' , ')
if (message == 'success') {
this.scanResultType = 'success'
}
},
async printCodeResultList(vailCodeResultResponses) {
this.errResult = ''
this.result = ''
this.successVisible = false
this.errVisible = false
this.scanTitle = '扫码结果:'
for (let i = 0; i < vailCodeResultResponses.length; i++) {
let data = vailCodeResultResponses[i]
if (data.status == 1) {
this.scanResultType = 'success'
this.result = this.result + (isBlank(this.result) ? '' : ';') + vailCodeResultResponses[i].code + ':' + vailCodeResultResponses[i].sucMsg
} else if (data.status == 2) {
this.errResult = this.errResult + '\n' + vailCodeResultResponses[i].code + ':' + vailCodeResultResponses[i].errMsg
} else if (data.status == 5) {
this.scanResultType = 'warning'
this.result = this.result + (isBlank(this.result) ? '' : ';') + vailCodeResultResponses[i].code + ':' + vailCodeResultResponses[i].errMsg
}
}
if (!isBlank(this.result)) {
this.successVisible = true
}
if (!isBlank(this.errResult)) {
this.errVisible = true
}
},
parseString(str) {
// 1. "MA"
if (str.startsWith('MA')) {
return true
}
// 2. "01" 18
if (str.startsWith('01') && str.length >= 18) {
return true
}
// 3. "#" "#" 4
if (str.startsWith('#') && (str.match(/#/g) || []).length >= 4) {
return true
}
// 4. "8" 20
if (str.startsWith('8') && str.length === 20) {
return true
}
// 5. "11", "17", "21", "10"
const prefixes = ['11', '17', '21', '10']
if (prefixes.some(prefix => str.startsWith(prefix))) {
return true
}
// false
return false
},
confirmCheckOrder() {
if (this.orderData.checkCodeConfirm == 1) {
//
this.$confirm('当前单据存在可替换追溯码是否替换完成校验', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
center: true,
closeOnPressEscape: false,// ESC
closeOnClickModal: false,//
distinguishCancelAndClose: true//
}).then(() => {
this.commit()
}).catch(() => {
})
} else {
this.commit()
}
},
commit() {
commitCheckCodeOrder(this.filterQuery).then(res => {
if (res.code == 20000) {
this.init
this.$message.success('校验完成')
} else {
// if (this.orderData.checkCodeConfirm == 1) {
// this.init()
// }
this.$message.error(res.message)
}
}).catch(() => {
})
},
initData(){
this.scanCode = ''
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
},
init() {
this.scanCode = ''
this.orderData = {}
this.detailList = []
this.checkCodeList = []
this.checkCodeEndList = []
this.scanTip = '单据录入:'
this.placeholder = '请输入单据号进行扫码校验'
this.scanTitle = '扫码结果:'
this.curRow = null
this.orderQuery = {
page: 1,
limit: 10,
billNo: null,
tagStatus: 3,
workPlaceCode: null,
busType: null
}
this.codeQuery = {
billNo: null,
code: null,
selectType: 2,
page: 1,
limit: 10
}
this.filterQuery = {
code: '',
billNo: null,
codeList: []
}
if (this.$route.query.workplaceId != null) {
this.workplaceId = Number(this.$route.query.workplaceId)
}
if (this.$route.query.busType != null) {
this.busType = this.$route.query.busType
}
},
clear() {
this.init()
},
rowStyle({row, rowIndex}) {
let rowBackground = {}
if (row.scanCodeCheckStatus == 1) {
rowBackground.color = '#56a717'
}
if (row.scanCodeCheckStatus == 3) {
rowBackground.color = '#E6A23C';
}
rowBackground.height = "38px"
return rowBackground;
},
//WebSocket
//
handleRecCodesEvent(event) {
console.log('接收 recCodes event:', event.detail.recCodes);
if (this.orderData.billNo == null) {
this.$message.error("请先选入单据!");
return
}
this.filterQuery.codeList = event.detail.recCodes
this.filterQuery.code = ''
this.filterQuery.billNo = this.orderData.billNo
this.batchVailCode(this.filterQuery)
},
handleVisibilityChange() {
if (document.visibilityState === 'visible') {
console.log('用户切回到了单据校验页面');
if (this.ws == null || this.ws.readyState === WebSocket.CLOSED) {
this.ws = new WebSocket("ws://127.0.0.1:9988");
const self = this;
this.ws.onopen = function (evt) {
console.log("单据校验 WebSocket 连接中 ...");
self.socketListener()
};
}
} else {
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
this.ws.close();
console.log("关闭 单据校验 websocket成功")
}
}
},
socketListener() {
let lastScanTime = Date.now();
let scanBuffer = [];
let scanTimeout = null;
const SCAN_TIMEOUT = 1000; // 1
const self = this;
console.log("启用监听")
this.ws.onmessage = function (event) {
let scanData = event.data; //
let currentTime = Date.now();
console.log(scanData)
//
if (currentTime - lastScanTime > SCAN_TIMEOUT) {
//
if (scanBuffer.length > 0) {
self.handleScanComplete(scanBuffer);
}
//
scanBuffer = [];
}
//
lastScanTime = currentTime;
//
scanBuffer.push(scanData);
//
if (scanTimeout) {
clearTimeout(scanTimeout);
}
//
scanTimeout = setTimeout(() => {
//
self.handleScanComplete(scanBuffer);
scanBuffer = [];
}, SCAN_TIMEOUT);
};
},
handleScanComplete(fullScanData) {
console.log("Scan complete:", fullScanData.join(";"));
if (this.orderData.billNo == null ) {
this.enterBillNoKey(fullScanData[0])
return;
}
let params = {
codeList: fullScanData,
};
if (this.orderData.billNo == null) {
this.$message.error("请先选入单据!");
return
}
this.filterQuery.codeList = fullScanData
this.filterQuery.code = ''
this.filterQuery.billNo = this.orderData.billNo
this.batchVailCode(this.filterQuery)
},
},
watch: {
resetKey(newVal, oldVal) {
this.$refs.inputRef.focus()
}
},
created() {
if (this.$route.query.workplaceId != null) {
this.workplaceId = Number(this.$route.query.workplaceId)
}
if (this.$route.query.busType != null) {
this.busType = this.$route.query.busType
}
this.init()
},
mounted() {
this.getInputFocus()
if (window.navigator.userAgent.indexOf("GLXP_PC") != -1) {
window.removeEventListener('djjy', this.handleRecCodesEvent);
window.addEventListener('djjy', this.handleRecCodesEvent);
}
document.addEventListener('visibilitychange', this.handleVisibilityChange);
},
beforeDestroy() {
window.removeEventListener('djjy', this.handleRecCodesEvent);
document.removeEventListener('visibilitychange', this.handleVisibilityChange);
this.ws.close();
this.ws.onclose = function (evt) {
console.log("单据校验 Connection closed.");
};
},
}
</script>
<style scoped>
</style>

@ -278,7 +278,7 @@
:close-on-click-modal="false"
:close-on-press-escape="false"
v-if="codeCheckVisible"
width="60%"
width="80%"
append-to-body
@close="closeCodeCheckDialog"
>

@ -225,9 +225,6 @@ export default {
type: Object,
required: true,
},
orderQuery: {
productType: 1
},
type: { //1.2
type: Object,
required: true,
@ -269,7 +266,9 @@ export default {
productRemarkSet: {},
currentRow: null,
radioCheck: null,
orderQuery: {
productType: 1
},
tableHeader: [],
queryList: [],

Loading…
Cancel
Save