You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udiwms-vue-frame/src/views/collect/IoCreateOrder.vue

2524 lines
78 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div>
<el-form
:model="orderFormData"
:rules="formRules"
ref="dataForm"
@submit.native.prevent
label-width="110px"
>
<el-card>
<el-row style="margin-bottom: 8px">
<div v-if="scanReCount > 0">
<span style="font-size: 18px;font-weight: bold;color: red" >扫码总数量:</span>
<span style="font-size: 18px;font-weight: bold;color: red">{{ scanReCount }}</span>
</div>
<span style="font-size: 18px;font-weight: bold;color: red"
v-if="redMesg && this.splitType == 'out'">请先扫取货槽编码</span>
<span style="font-size: 18px;font-weight: bold">{{ curQueueName }}</span>
<el-button-group
style="display: flex; margin-top: 5px; float: right"
>
<el-button size="mini" type="primary" @click.native="deleteCode" :loading="submitLoading"
v-if="splitType=='out' && labelName == 1" style="margin-right: 8px;border-radius: 5%;"
v-show="isLinkDisabled" :disabled="orderFormData.billNo == null"
>扫码剔除
</el-button>
<el-button size="mini" type="primary" @click.native="overdeleteCode" :loading="submitLoading"
v-if="splitType=='out' && labelName == 2" style="margin-right: 8px;border-radius: 5%;"
v-show="isLinkDisabled"
>结束剔除
</el-button>
<el-button size="mini" type="primary" @click.native="selectPrescribe()" :loading="submitLoading"
v-if="splitType=='out' && !redMesg" style="margin-right: 8px;border-radius: 5%;"
v-show="isLinkDisabled"
>选入已完成单据
</el-button>
<el-button size="mini" type="primary" @click.native="chooseDraftOrder()" :loading="submitLoading"
style="margin-right: 8px;border-radius: 5%;" v-show="isLinkDisabled"
>选入单据
</el-button>
<el-button size="mini" type="primary" @click.native="delOrder()" :loading="submitLoading"
style="margin-right: 8px;border-radius: 5%;" v-show="isLinkDisabled"
:disabled="orderFormData.billNo == null && curQueueName == '' "
>放弃
</el-button>
<el-button size="mini" type="primary" @click.native="draftOrder()" :loading="submitLoading"
v-show="isLinkDisabled" style="margin-right: 8px;border-radius: 5%;"
>保存
</el-button>
<el-button size="mini" type="primary" @click.native="submit()" :loading="submitLoading"
v-if="splitType=='out'" style="margin-right: 8px;border-radius: 5%;"
>上货完成
</el-button>
<!-- <el-button size="mini" type="primary" @click.native="" :loading="submitLoading" v-show="isLinkDisabled"
v-if="splitType=='return'" style="margin-right: 8px;border-radius: 5%;"
>保存
</el-button> -->
<el-button size="mini" type="primary" @click.native="submit()" :loading="submitLoading"
v-if="splitType=='return'" style="margin-right: 8px;border-radius: 5%;"
>退货完成
</el-button>
<!-- <el-button size="mini" type="primary" @click.native="printLabel()" :loading="submitLoading"-->
<!-- style="border-radius: 5%;"-->
<!-- >打印二维码-->
<!-- </el-button>-->
</el-button-group>
</el-row>
<el-row>
<el-col :span="6" v-if="!isLinkDisabled">
<el-form-item prop="workPlaceCode" class="query-form-item" label="当前工位:">
<el-select
v-model="orderFormData.workPlaceCode"
placeholder="当前工位"
style="width: 90%"
:disabled="corpOrderIdDisabled"
filterable
@change="changePlace"
>
<el-option
v-for="item in curWorkPlaces"
:key="item.code"
:label="item.label"
:value="item.code"
>
<span style="float: left">{{ item.label }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{
item.code
}}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<!--<el-col :span="6" v-if="!isLinkDisabled">-->
<!-- <el-form-item prop="busType" class="query-form-item" label="业务名称:">-->
<!-- <el-select-->
<!-- v-model="orderFormData.busType"-->
<!-- placeholder="业务名称"-->
<!-- style="width: 90%"-->
<!-- :disabled="corpOrderIdDisabled"-->
<!-- filterable-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="item in busTypeList"-->
<!-- :key="item.documentTypeCode"-->
<!-- :label="item.busName"-->
<!-- :value="item.documentTypeCode"-->
<!-- >-->
<!-- <span style="float: left">{{ item.busName }}</span>-->
<!-- <span style="float: right; color: #8492a6; font-size: 13px">{{-->
<!-- item.documentTypeCode-->
<!-- }}</span>-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!--</el-col>-->
<!--<el-col :span="6" v-if="splitType=='out'">-->
<!-- <el-form-item prop="fifoSplit" class="query-form-item" label="上货方式:">-->
<!-- <el-radio-group v-model="orderFormData.fifoSplit" :disabled="fifoSplitEnable" @change="splitChange">-->
<!-- <el-radio :label="1">拆零上货</el-radio>-->
<!-- <el-radio :label="2">整取上货</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!--</el-col>-->
</el-row>
<el-divider></el-divider>
<el-row>
<el-col :span="18">
<el-form-item prop="code" :label="labels[labelName]">
<el-input
id="inputer"
@focus="getInputFocus($event)"
@keypress.enter.native="enterKey($event)"
ref="inputRef"
style="ime-mode: disabled"
type="tel"
placeholder="请点击输入框进行扫码设置或者扫码录入"
v-model="scanCode"
></el-input>
<!-- :disabled="scanDisabled"-->
</el-form-item>
</el-col>
<el-col :span="6">
<el-button-group>
<el-button
type="primary"
size="mini"
@click.native.stop="enterKey($event)"
style="margin-left: 15px"
>添加
</el-button>
<!-- <el-button icon="el-icon-view" @click="hideSearch">/</el-button>-->
</el-button-group>
</el-col>
</el-row>
<el-alert
title="扫码结果:"
:type="scanResultType"
:closable="false"
:description="result"
v-if="successVisible"
>
</el-alert>
<el-alert
v-if="warnVisible"
title="警告信息:"
type="warning"
:closable="true"
:dangerouslyUseHTMLString="true"
:description="warnResult"
>
</el-alert>
<el-alert
v-if="errVisible"
title="错误信息:"
type="warning"
:closable="true"
:dangerouslyUseHTMLString="true"
:description="errResult"
>
</el-alert>
<el-row style="margin-top: 25px;margin-bottom: -15px">
<div v-if="showSearch && splitBusType!=null">
<el-divider>
<p style="font-weight: bold">扫码快捷设置</p>
</el-divider>
<el-row justify="center">
<el-col :span="4" style="text-align: center;">
<div>
<img src="@/assets/images/fifoSplit1.png" alt="二维码" style="width: 80px; height: 80px;">
<p style="margin-top: 5px;font-weight: bold">拆零上货</p>
</div>
</el-col>
<el-col :span="4" style="text-align: center;">
<div>
<img src="@/assets/images/fifoSplit2.png" alt="二维码" style="width: 80px; height: 80px;">
<p style="margin-top: 5px;font-weight: bold">整取上货</p>
</div>
</el-col>
<el-col :span="4" style="text-align: center;">
<div>
<img src="@/assets/images/splitOut.png" alt="二维码" style="width: 80px; height: 80px;">
<p style="margin-top: 5px;font-weight: bold">工位上货</p>
</div>
</el-col>
<el-col :span="4" style="text-align: center;">
<div>
<img src="@/assets/images/splitIn.png" alt="二维码" style="width: 80px; height: 80px;">
<p style="margin-top: 5px;font-weight: bold">工位退货</p>
</div>
</el-col>
</el-row>
</div>
</el-row>
<newCreateCodeDetail
ref="newCreateCodeDetail"
:idQuery="orderFormData"
:curAction="curAction"
:refreshPanel="refreshCodesPanel"
:viewType="viewType"
:status="orderStatus"
v-if="isCodeDetailAlive"
@clearBillNo="clearBillNo"
@getOrderData="getOrderData"
@getCount="getCount"
></newCreateCodeDetail>
</el-card>
</el-form>
<!--<el-tabs type="border-card" style="margin: 15px">-->
<!-- <el-tab-pane label="单据详情" v-if="viewCodeVisible">-->
<!-- <codeDetailPanel-->
<!-- :idQuery="orderFormData"-->
<!-- :curAction="curAction"-->
<!-- :refreshPanel="refreshCodesPanel"-->
<!-- :viewType="viewType"-->
<!-- :status="orderStatus"-->
<!-- v-if="isCodeDetailAlive"-->
<!-- @clearBillNo="clearBillNo"-->
<!-- @getOrderData="getOrderData"-->
<!-- @getCount="getCount"-->
<!-- ></codeDetailPanel>-->
<!-- </el-tab-pane>-->
<!-- <el-tab-pane label="扫码明细" v-if="viewCodeDetailVisible">-->
<!-- <codesPanel-->
<!-- @getCodeArray="handleCodeArray"-->
<!-- :idQuery="orderFormData"-->
<!-- :refreshPanel="refreshCodesPanel"-->
<!-- v-if="isCodeAlive"-->
<!-- :viewType="viewType"-->
<!-- :selectRlTitle="selectRlTitle"-->
<!-- :editTitle="editTitle"-->
<!-- :selectUnitTitle="selectUnitTitle"-->
<!-- ></codesPanel>-->
<!-- </el-tab-pane>-->
<!--</el-tabs>-->
<el-dialog
title="选入草稿单据"
:visible.sync="chooseDraftOrderVisible"
width="80%"
append-to-body
:close-on-click-modal="false"
:close-on-press-escape="false"
v-if="chooseDraftOrderVisible"
>
<chooseDraftOrderDialog
ref="chooseDraftOrder"
:rowData="rowData"
:closeChooseDialog="closeChooseDialog"
:handleChoose="handleChoose"
>
</chooseDraftOrderDialog>
</el-dialog>
<el-dialog
title="选入已完成单据"
:visible.sync="selectPrescriptionVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
v-if="selectPrescriptionVisible"
width="65%"
append-to-body
>
<SelectCollectOrderEndDialog
:RowType="1"
:workPlaceCode="null"
:busType="this.orderFormData.busType"
:fromCorp="this.orderFormData.fromCorp"
:confirmSelect="this.confirmSelect"
:closeDialog="this.closeDialog"
:viewType="viewType"
></SelectCollectOrderEndDialog>
</el-dialog>
</div>
</template>
<script>
import {
submitBiz,
addOrderWeb,
submitCodes,
submitOrderWeb,
saveOrderWeb,
deleteByOrderId,
enterCodeWeb,
submitAllocateBiz,
rollbackWaitcheck,
submitCodeResult,
submitCheckResult,
batchVailCode,
batchAddCode,
batchAddCodeByOrderFinish,
upProcessing
} from '@/api/inout/order'
import {filterSubAll, findByFrom, findInvByUser} from '@/api/system/invSubWarehouse'
import {parseTime} from '@/utils/coTools'
import {getBasicUnitMaintains} from '@/api/basic/basicUnitMaintain'
import editCodeDialog from '@/views/inout/DialogEditCode'
import DialogCreateOrderSelect from '@/views/inout/DialogCreateOrderSelect'
import {deleteCodesTempByCodes} from '@/api/inout/order'
import codesPanel from '@/views/collect/PanelCreateCodes'
import codeDetailPanel from '@/views/collect/PanelCreateCodeDetail'
import SelectCollectOrderEndDialog from '@/views/collect/SelectCollectOrderEndDialog'
import newCreateCodeDetail from "./newCreateCodeDetail"
import A from '../../plugins/KeyScaner'
import {findByInvUser, getBusTypeList} from '@/api/basic/busType'
import {getInvSpaceList} from '@/api/inventory/invSpace'
import DialogSelectUnit from '@/views/inout/DialogSelectUnit'
import selectRlDialog from '@/views/inout/DialogSelectRl'
import DialogSelectSpace from '@/views/inout/DialogSelectSpace'
import {isBlank} from '@/utils/strUtil'
import {filterNoPage, remoteFilter} from '@/api/basic/sicker/skPersonApi'
import dialogInvProduct from '@/views/inout/DialogSelectInvProduct'
import {printSplitLabel} from '@/api/collect/splitCreateOrder'
import chooseDraftOrderDialog from './chooseDraftOrderDialog'
import {getUserBindWork} from '@/api/basic/collectPoint/userWorkplace'
import {getWorkBindBusTypes} from '@/api/basic/workPlace/sysWorkplaceDocuments'
import {filterWorkOptimize} from '@/api/basic/workPlace/sysWorkplaceManage'
import {getByCode} from "@/api/basic/workPlace/SysWorkplaceQueue";
import { getCodeList } from '@/api/inout/splitInv'
// 常量定义
const SCAN_TIMEOUT = 1000
const ACTION_TYPES = {
BIZ: 'biz',
CODES: 'codes'
}
// 工具方法
const utils = {
isValidJson(str) {
try {
JSON.parse(str)
return true
} catch (e) {
return false
}
}
}
// 错误处理
const errorHandler = {
handle(error) {
console.error(error)
this.$message.error(error.message)
}
}
export default {
name: 'ioCreateOrder',
props: {
closeDialog: {
type: Function,
required: true
},
orderQuery: {
type: Object,
required: true,
default: {}
},
errView: {
type: Object,
required: true
},
sickerAdNum: {
type: Object,
required: true
},
sickerAdName: {
type: Object,
required: true
},
viewTypeKsck: {
type: Boolean,
required: false
},
viewType: {
//1、新增业务单据页面2.新增扫码单据页面3、正常单据处理页面,4.待配货页面,5:有三期验收,6:无三期验收7.待校验页面
type: Object,
required: true
},
dialogTitle: {//科室拆零单据类型
type: Object,
required: true
},
fromSplitType: {//splitType
type: Object,
required: true
},
resetKey: {
type: Function,
required: true
}
},
watch: {
resetKey(newVal, oldVal) {
this.$refs.inputRef.focus()
},
'orderFormData.billNo'(newValue) {
if (newValue == null) {
this.overdeleteCode()
this.scanDeleteType = true;
}
}
},
data() {
return {
queueStatus: null,
busTypeList: [],
splitBusType: null,
busQuery: {
busKey: '',
workplaceCode: null,
page: 1,
limit: 100
},
isLinkDisabled: false,
userInfo: {
inv: this.$store.getters.locInvName,
deptName: this.$store.getters.locDeptName,
userName: this.$store.getters.name,
userId: this.$store.getters.userId,
companyName: this.$store.getters.companyName
},
workplaceId: null,
//单据相关
orderFormData: {
billNo: null,
corpOrderId: null,
action: null,
invCode: null,
fromCorp: null,
fromCorpName: null,
fromName: null,
fromInvCode: null,
remark: null,
fromType: 2,
errMsg: null,
checkPreInOrders: null,
checkPreInInvCode: null,
checkPreInSpaceCode: null,
curSpaceCode: null,
preSpaceCode: null,
preCurSpaceCode: null, //单据
sickerAdNum: null,
workPlaceCode: null,
fifoSplit: 1,
splitBusType: null,
busType: null,
workPlaceQueueCode: null,
},
selectPrescriptionVisible: false,
detailList: [],
total: 0,
checkPreInArray: [],
errView: 0,
//选入相关
selectorder: false,
//扫码相关
codeFormData: {
code: '',
batchNo: null,
produceDate: null,
expireDate: null,
serialNo: null,
relId: null
},
curInvOptions: [],
busTypeOptions: [],
fromInvOptions: [],
curPreInInvOptions: [], //预验收仓库
curPreInSpaceOptions: [], //预验收货位
curPreSpaceOptions: [], //寄售货位
curSpaceOptions: [], //当前货位
curWorkPlaces: [],
allWorkPlaces: [],
curAction: {
corpType: 0,
genUnit: false,
checkWebNew: null,
mainAction: null
},
fromOptions: [],
fromSickOptions: [],
isCodeAlive: true,
bizShow: true,
isCheckResultAlive: true,
isBizDetailAlive: true,
isCodeDetailAlive: true,
isSickerAlive: true,
editCodeVisible: false,
actionEnable: false,
editOriginCodeVisible: false,
curId: null,
storageList: [],
formRules: {
corpOrderId: [
{required: true, message: '请输入单据号', trigger: 'blur'}
],
createTime: [
{required: true, message: '请选择创建时间', trigger: 'blur'}
],
invCode: [
{required: true, message: '请选择当前仓库', trigger: 'change'}
],
action: [
{required: true, message: '请选择单据类型', trigger: 'change'}
]
// acceptance: [
// {required: true, message: "请选入预验收单据", trigger: "blur"},
// ],
},
isScan: true,
scanText: '扫码录入:',
corpOrderIdDisabled: false,
isSupVesion: false,
loading: false,
index: null,
formLoading: false,
formVisible: false,
deleteLoading: false,
orderNo: null,
fromStorageOptions: [],
curRow: null,
dialogTableVisible: false,
selectRlVisible: false,
selectSpaceVisible: false,
sitcomScan: false,
selectRlTitle: '绑定产品',
selectUnitTitle: '绑定供应商',
sictomText: '',
originCode: '',
checkSuccess: false,
codeDetail: null,
editTitle: '编辑条码',
fromDeptOptions: [],
enableDept: false,
viewCheckVisible: false,
viewBizVisible: false,
viewCodeVisible: false,
viewCodeDetailVisible: false,
viewSickVisible: false, //是否显示处方使用耗材
documentShow: false, //控制预验收选入单据界面
curSpaceShow: false, //正常出入库选入出库界面
preInSpaceShow: false, //是否显示选择预验收界面
preSpaceShow: false, //寄售,预验收仓库界面
spaceCodeList: [],
checkTipDialogVisible: false,
checkTip: null,
enableSick: false,
saveLoading: false,
submitLoading: false,
checkLoading: false,
codeLoading: false,
retractLoading: false,
//库存选入
selectInvProductVisible: false,
chooseDraftOrderVisible: false,
invQueryData: {
invCode: null
},
showSearch: false,
scanCode: '',
isSuccess: false,
result: '',
scanResultType: 'success',
msgTip: '当前工位存量提醒:',
splitType: null,
rowData: {},
curWorkPlace: null,
fifoSplitEnable: false,
scanDisabled: false,//是否禁用扫码输入框
valiCodes: [],
warnResult: '',
errResult: '',
successVisible: true,
warnVisible: false,
errVisible: false,
labelName: 1,
scanDeleteType: true,
labels: {
1: '扫码录入',
2: '扫码剔除'
},
scanStatus: null, // 1:扫码剔除
codeArray: [],
curQueueName: "",
scanReCount: 0,
curQueue: null,
redMesg: false,
redMesgOld: false,
productName: null,
orderStatus: false,//是否调用子组件
workPlaceQueueCode:""
}
},
components: {
codesPanel,
codeDetailPanel,
editCodeDialog,
DialogCreateOrderSelect,
DialogSelectUnit,
DialogSelectSpace,
selectRlDialog,
dialogInvProduct,
chooseDraftOrderDialog,
SelectCollectOrderEndDialog,
newCreateCodeDetail
},
methods: {
changePlace(val) {
this.getWorkBindBusTypes(val)
this.$refs.inputRef.focus()
},
getWorkBindBusTypes(workplaceId) {
this.busQuery.workplaceCode = workplaceId
getWorkBindBusTypes(this.busQuery).then(res => {
if (res.code == 20000) {
this.busTypeList = res.data.list || []
if (this.busTypeList.length == 1) {
this.orderFormData.busType = this.busTypeList[0].documentTypeCode
} else {
this.orderFormData.busType = null
}
}
return
})
},
splitChange() {
this.$refs.inputRef.focus()
},
successCloseData() {
let tempData = JSON.parse(JSON.stringify(this.orderFormData))
this.orderFormData = {
billNo: null,
corpOrderId: null,
action: null,
invCode: null,
fromCorp: null,
fromCorpName: null,
fromName: null,
fromInvCode: null,
remark: null,
fromType: 2,
errMsg: null,
checkPreInOrders: null,
checkPreInInvCode: null,
checkPreInSpaceCode: null,
curSpaceCode: null,
preSpaceCode: null,
preCurSpaceCode: null, //单据
sickerAdNum: null,
workPlaceCode: null,
workPlaceQueueCode: null,
fifoSplit: 1
}
this.orderFormData.workPlaceCode = tempData.workPlaceCode
this.orderFormData.workPlaceQueueCode = tempData.workPlaceQueueCode
this.orderFormData.mainAction = tempData.mainAction
this.orderFormData.action = tempData.action
this.orderFormData.fromCorp = tempData.fromCorp
this.orderFormData.fromDeptCode = tempData.fromDeptCode
this.orderFormData.fromInvCode = tempData.fromInvCode
this.orderFormData.fromInvCode = tempData.fromInvCode
this.orderFormData.deptCode = tempData.deptCode
this.orderFormData.invCode = tempData.invCode
this.scanCode = ''
this.corpOrderIdDisabled = false
this.curQueueName = '';
this.redMesg = this.redMesgOld
this.orderStatus = false
this.scanReCount = 0
this.$refs.newCreateCodeDetail.codeCount = 0
this.refreshCodesPanel()
},
//获取用户仓库列表
findInvListByUser() {
this.curInvOptions = []
findInvByUser()
.then((response) => {
this.curInvOptions = response.data || []
if (
this.curInvOptions != null &&
this.curInvOptions.length > 0 &&
this.orderFormData.invWarehouseCode == null
) {
//this.orderFormData.invCode = this.curInvOptions[0].code;
this.getBusTypeByInv()
this.findCurSpaceList(this.orderFormData.invCode)
this.findCurWorkPlaces()
}
})
.catch(() => {
})
},
defaultSplitType() {
this.curWorkPlace = this.curWorkPlaces.find(item => item.workplaceId == this.orderFormData.workPlaceCode)
this.orderFormData.fifoSplit = this.curWorkPlace.workplaceType
if (this.curWorkPlace.workplaceType == 1 || this.curWorkPlace.workplaceType == 2) {
this.fifoSplitEnable = true
} else {
this.orderFormData.fifoSplit = 1
this.fifoSplitEnable = false
}
},
//仓库改变
changeInv(row) {
this.orderFormData.action = null
this.orderFormData.checkPreInOrders = null
this.checkPreInArray = []
if (this.documentShow) {
this.documentShow = false
}
this.curSpaceShow = false
this.preInSpaceShow = false
this.preSpaceShow = false
this.orderFormData.curSpaceCode = false
this.orderFormData.checkPreInSpaceCode = false
this.orderFormData.preCurSpaceCode = false
this.findCurSpaceList(row)
this.orderFormData.workPlaceCode = null
this.findCurWorkPlaces()
},
//关闭预选单弹框
closeDialogtwo() {
this.selectorder = false
},
initBusType() {
let query = {
action: this.orderFormData.action
}
getBusTypeList(query)
.then((response) => {
this.busTypeOptions = response.data.list || []
this.curAction = this.getActionItem(this.orderFormData.action)
if (isBlank(this.curAction)) {
this.curAction = {
corpType: 0,
genUnit: false,
checkWebNew: null
}
}
if (
(this.curAction.checkEnable &&
(this.curAction.checkWebNew ||
this.curAction.checkUdims ||
this.curAction.checkCopy ||
this.curAction.checkPdaEd ||
this.curAction.checkPdaUn ||
this.curAction.checkPc ||
this.curAction.checkWebNew ||
this.curAction.checkSp ||
this.curAction.checkChange ||
this.curAction.checkBalance)) ||
this.viewType == 1
) {
this.bizShow = true
} else {
this.bizShow = false
}
})
.catch(() => {
})
},
delorderData() {
//执行清空业务单据详情
let tQuery = Object.assign(
JSON.parse(JSON.stringify(this.orderFormData))
)
tQuery.orderId = this.orderFormData.billNo
delmitBiz(tQuery).then((response) => {
if (response.code === 20000) {
// this.$message.success("成功");
const codeDetailComponent = this.$refs.IoCreateOrderCodeDetail.getOrderDetails()
if (this.closeDialog != undefined) {
this.closeDialog()
}
this.clearOrder()
} else {
// this.$message.error(response.message);
const codeDetailComponent = this.$refs.IoCreateOrderCodeDetail.getOrderDetails()
}
})
const codeDetailComponent = this.$refs.IoCreateOrderCodeDetail.getOrderDetails()
console.log('66:' + codeDetailComponent)
},
//获取往来单位候选列表
findMethod(query) {
this.fromOptions = []
let cQuery = {
key: query,
corpType: null,
outType: null,
page: 1,
limit: 20
}
if (this.curAction.corpType == 3) {
//内部科室
cQuery.corpType = 3
} else if (this.curAction.corpType == 2) {
//供应商信息
cQuery.corpType = 2
} else if (this.curAction.corpType == 0) {
cQuery.corpType = 2
} else if (this.curAction.corpType == 1) {
cQuery.corpType = 1
cQuery.outType = 2
} else if (this.curAction.corpType == 4) {
//供应商信息
cQuery.corpType = 4
} else {
return
}
getBasicUnitMaintains(cQuery)
.then((response) => {
this.loading = false
this.fromOptions = response.data.list || []
})
.catch(() => {
this.loading = false
})
},
findSickMethod(key) {
let sickQuery = {
page: 1,
limit: 10,
key: key
}
filterNoPage(sickQuery).then(res => {
this.fromSickOptions = res.data.list || []
}).catch(() => {
})
},
remoteFindSickMethod(e) {
console.log(e.target.value)
let sickQuery = {
page: 1,
limit: 10,
adNum: e.target.value
}
remoteFilter(sickQuery).then(res => {
this.fromSickOptions = res.data.list || []
}).catch(() => {
})
},
//获取往来仓库列表
findFromInvList(val) {
let cQuery = {
locInvCode: this.orderFormData.invCode
}
findByFrom(cQuery)
.then((response) => {
this.fromInvOptions = response.data || []
if (val == 1) {
this.orderFormData.fromInvCode = this.fromInvOptions[0].code
}
})
.catch(() => {
})
},
//获取当前单据类型
getActionItem(action) {
for (let i = 0; i < this.busTypeOptions.length; i++) {
if (this.busTypeOptions[i].action == action) {
return this.busTypeOptions[i]
}
}
},
//切换预验收仓库
changePreInInv(row) {
this.orderFormData.checkPreInSpaceCode = null
this.findPreInSpaceList(row.code)
},
//获取预验收仓库
findPreInInvList(val) {
let query = {
advanceType: 2,
code: this.orderFormData.checkPreInInvCode
}
filterSubAll(query)
.then((response) => {
this.curPreInInvOptions = response.data || []
})
.catch(() => {
})
},
//获取预验收货位
findPreInSpaceList(val) {
let query = {
filterType: 'preIn',
status: 1,
code: this.orderFormData.checkPreInSpaceCode
}
getInvSpaceList(query).then((res) => {
this.curPreInSpaceOptions = res.data.list || []
})
},
//获取寄售
findPreSpaceList(val) {
let query = {
filterType: 'pre',
status: 1,
code: this.orderFormData.preSpaceCode
}
getInvSpaceList(query).then((res) => {
this.curPreSpaceOptions = res.data.list || []
})
},
//获取当前货位
findCurSpaceList(val) {
let query = {
invWarehouseCode: val,
status: 1,
code: this.orderFormData.curSpaceCode
}
getInvSpaceList(query).then((res) => {
this.curSpaceOptions = res.data.list || []
})
},
//获取当前工位
findAllWorkPlaces() {
let query = {
page: 1,
limit: 100,
}
getUserBindWork(query).then((res) => {
this.allWorkPlaces = res.data.list || [];
{
let item = this.allWorkPlaces.find(item => item.workplaceId == this.orderFormData.workPlaceCode)
this.queueStatus = item.queueStatus
if (this.queueStatus == 1) {
this.redMesg = true
this.redMesgOld = true
}
}
})
},
findCurWorkPlaces(val) {
let query = {
// chargeUser: _this.$store.getters.userId,
userIdFlag: true,
key: val,
page: 1,
limit: 10,
workPlaceClass: 2
}
filterWorkOptimize(query)
.then((response) => {
this.loading = false
this.curWorkPlaces = response.data || []
})
.catch(() => {
this.loading = false
this.curWorkPlaces = []
})
},
addInvProduct() {
this.invQueryData.invCode = this.orderFormData.invCode
this.selectInvProductVisible = true
},
closeDialogC2(rData) {
this.selectInvProductVisible = false
if (this.$isNotBlank(rData)) {
this.codeFormData.code = rData
this.addCode()
// this.codeFormData.code = null;
}
// this.refreshCodesPanel()
},
//添加条码
addCode() {
if (this.$isBlank(this.orderFormData.workPlaceCode)) {
this.$message.warning('请选择工位!')
return
}
this.originCode = ''
this.sictomText = ''
this.codeFormData.batchNo = ''
this.codeFormData.produceDate = ''
this.codeFormData.expireDate = ''
this.codeFormData.serialNo = ''
this.actionEnable = true
this.$refs.inputRef.select()
if (this.$isBlank(this.codeFormData.code)) {
this.codeFormData.code = this.scanCode.trim()
return
}
if (this.$isBlank(this.codeFormData.code) && this.$isBlank(this.scanCode)) {
return
}
if (this.$isBlank(this.orderFormData.action)) {
this.$message.warning('请选择单据类型!')
return
}
console.log(this.curAction)
console.log(this.splitBusType)
if (this.splitBusType != null) {
this.orderFormData.fromCorp = '72198012799726'
}
if (this.curAction.corpType === 0 || this.curAction.corpType === 2 || (this.curAction.corpType === 1 && !this.curAction.genUnit)) {
if (this.$isBlank(this.orderFormData.fromCorp) && this.$isBlank(this.orderFormData.sickerAdNum)) {
this.$message.warning('请选择往来单位!')
return
}
}
//todo 没有找到this.orderFormData在哪赋值
// if (this.curAction.corpType == 3) {
// if (this.$isBlank(this.orderFormData.fromInvCode)) {
// this.$message.warning('请选择往来仓库!')
// return
// }
// }
if (this.curAction.corpType === 1 && this.curAction.genUnit) {
if (this.$isBlank(this.orderFormData.fromCorp) && this.$isBlank(this.orderFormData.sickerAdNum)) {
this.$message.warning('请输入患者信息!')
return
}
}
if (this.curSpaceShow) {
if (this.$isBlank(this.orderFormData.curSpaceCode)) {
this.$message.warning('请选择当前取货槽!')
return
}
}
if (this.preInSpaceShow) {
if (this.$isBlank(this.orderFormData.checkPreInSpaceCode)) {
this.$message.warning('请选择预验收出库货位!')
return
}
}
if (this.preSpaceShow) {
if (this.$isBlank(this.orderFormData.preCurSpaceCode)) {
this.$message.warning('请选择寄售出库货位!')
return
}
}
if (this.checkPreInArray != null) {
this.orderFormData.checkPreInOrders = this.checkPreInArray.join(',')
}
if (this.$isBlank(this.orderFormData.corpOrderId)) {
let date = new Date()
this.orderFormData.corpOrderId =
parseTime(date, '{y}{m}{d}{h}{i}{s}') +
Math.ceil(Math.random() * 89 + 10)
}
// this.loading = true;
// this.warnResult = "";
// this.errResult = "";
// this.result = "";
this.warnVisible = false
this.errVisible = false
this.checkSuccess = true
if (this.getDMHotskeyValue(this.scanCode)) {
return
}
if (this.codeFormData.code.includes(';')) {
const codeArray = this.codeFormData.code.split(';')
let params = {
codeList: codeArray
}
this.batchVailCode(params)
return
}
let tQuery = Object.assign(
JSON.parse(JSON.stringify(this.orderFormData))
)
tQuery.code = this.codeFormData.code
tQuery.orderType = 2
tQuery.splitType = this.splitType
this.addCodeSubmit(tQuery)
this.$refs.inputRef.select()
},
repeatAddCode(editData) {
let tQuery = Object.assign(
JSON.parse(JSON.stringify(this.orderFormData))
)
tQuery.code = this.codeFormData.code
tQuery.orderType = this.viewType
tQuery.batchNo = editData.batchNo
tQuery.produceDate = editData.produceDate
tQuery.expireDate = editData.expireDate
tQuery.serialNo = editData.serialNo
this.closeCodeDialog()
this.addCodeSubmit(tQuery)
},
//添加条码后提交
addCodeSubmit(tQuery) {
addOrderWeb(tQuery).then((response) => {
if (response.code === 20000) {
this.orderFormData.billNo = response.data.orderId
if (response.data.errMsg != null) {
this.$alert(response.data.errMsg, '提示', {
confirmButtonText: '确定',
type: 'warning',
closeOnClickModal: true,
callback: (action) => {
}
})
}
this.corpOrderIdDisabled = true
this.refreshCodesPanel()
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
this.orderFormData.relId = null
} else {
if (response.code == 502) {
//该产品绑定多个产品ID处理
this.curRow = response.data
this.orderFormData.billNo = this.curRow.orderId
this.refreshCodesPanel()
this.$message.error(response.message)
this.selectRlTitle = response.message
//判断是出库需要选择供应商的时候把供应商值传过去
if (tQuery.selectSupId != null) {
this.codeFormData.selectSupId = tQuery.selectSupId
} else {
this.codeFormData.selectSupId = false
}
//DI绑定多个产品,请指定对应产品 时候传递关键字做过滤
this.codeFormData.key = 'key'
this.selectRlVisible = true
} else if (response.code == 503) {
//该产品绑定多个供应商处理
this.curRow = response.data
this.orderFormData.billNo = this.curRow.orderId
this.codeFormData.relId = this.curRow.relId
this.refreshCodesPanel()
this.selectUnitTitle = response.message
this.$message.error(response.message)
this.dialogTableVisible = true
} else if (response.code == 504) {
this.$confirm(response.message, '提示', {
confirmButtonText: '确定',
cancelButtonText: '忽略',
type: 'error'
})
.then(() => {
tQuery.ignoreExpire = true
this.addCodeSubmit(tQuery)
})
.catch(() => {
})
} else if (response.code == 505) {
this.$confirm(response.message, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
tQuery.ignoreRecentExpire = true
this.addCodeSubmit(tQuery)
})
.catch(() => {
})
} else if (response.code == 605) {
this.$confirm(response.message, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
})
.catch(() => {
})
return
} else if (response.code == 604) {
this.$confirm(response.message, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
})
.catch(() => {
})
return
} else if (response.code == 507) {
this.editOriginCodeVisible = true
this.editTitle = response.message
this.codeFormData.produceDate = response.data.produceDate
this.codeFormData.expireDate = response.data.expireDate
this.codeFormData.batchNo = response.data.batchNo
this.codeFormData.serialNo = response.data.serialNo
this.codeFormData.corpOrderId = this.orderFormData.corpOrderId
this.$message({
type: 'error',
message: '提交失败!' + this.editTitle,
customClass: 'messageIndex'
})
} else if (response.code == 511) {
//该UDI码绑定多个货位处理
this.spaceCodeList = response.data
this.selectSpaceVisible = true
} else {
this.$alert(response.message, '提示', {
confirmButtonText: '确定',
type: 'warning',
closeOnClickModal: true,
callback: (action) => {
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
}
})
}
}
// this.loading = false;
})
},
refreshCodesPanel() {
// this.warnResult = "";
// this.errResult = "";
// this.result = "";
this.warnVisible = false
this.errVisible = false
this.isCodeAlive = false
this.isBizDetailAlive = false
this.isCodeDetailAlive = false
this.isSickerAlive = false
this.$nextTick(() => {
//重新加载组件
this.scanDeleteType = false
this.isCodeAlive = true
this.isBizDetailAlive = true
this.isCodeDetailAlive = true
this.isSickerAlive = true
})
//选择性刷新
if (this.isCheckResultAlive) {
this.isCheckResultAlive = false
this.$nextTick(() => {
//重新加载组件
this.isCheckResultAlive = true
})
}
},
//判断详情是否为空 为空清除billNo
clearBillNo(data) {
if (data) {
this.orderFormData.billNo = null
this.orderStatus = false
}
},
getOrderData(orderDetail) {
this.productName = orderDetail.coName
this.curQueueName = "当前取货槽:" + this.productName + "(" + this.curQueue.code + ")"
this.orderStatus = true
},
getCount(count){
if (count == 0){
this.scanReCount = 0
}else{
this.scanReCount = count
}
},
refreshOrder(orderQuery) {
this.orderFormData = orderQuery
this.scanCode = ''
this.result = ''
this.refreshCodesPanel()
this.init()
},
//撤回单据
revokeBill() {
this.$confirm('是否确定撤回单据至草稿状态?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
let query = {billNo: this.orderFormData.billNo}
this.retractLoading = true
rollbackWaitcheck(query)
.then((response) => {
this.retractLoading = false
if (response.code == 20000) {
this.$message.success('撤回成功!')
if (this.closeDialog != undefined) {
this.closeDialog()
}
} else {
this.$message.error(response.message)
}
})
.catch(() => {
this.retractLoading = false
})
})
.catch(() => {
})
},
hideSearch() {
this.showSearch = !this.showSearch
},
submitCheckDialog() {
this.checkTipDialogVisible = true
},
//待校验以扫码结果为准
submitCodeResult(query) {
submitCodeResult(query).then((response) => {
this.codeLoading = false
if (response.code === 20000) {
this.$message.success('提交成功')
if (this.closeDialog != undefined) {
this.closeDialog()
}
} else {
this.$message.error(response.message)
}
})
},
//待校验以正确结果为准
submitCheckResult(query) {
submitCheckResult(query).then((response) => {
this.checkLoading = false
if (response.code === 20000) {
this.$message.success('提交成功')
if (this.closeDialog != undefined) {
this.closeDialog()
}
} else {
this.$message.error(response.message)
}
})
},
submit(val) {
if (this.$isBlank(this.orderFormData.action)) {
this.$message.warning('单据类型不能为空!')
return
}
if (this.curAction.corpType === 0 || this.curAction.corpType === 2 || (this.curAction.corpType === 1 && !this.curAction.genUnit)) {
if (this.$isBlank(this.orderFormData.fromCorp) && this.$isBlank(this.orderFormData.sickerAdNum)) {
this.$message.warning('请选择往来单位!')
return
}
}
//todo 没有找到 orderFormData 在哪里赋值
// if (this.curAction.corpType == 3) {
// if (this.$isBlank(this.orderFormData.fromInvCode)) {
// this.$message.warning('请选择往来单位!')
// return
// }
// }
if (this.curAction.corpType === 1 && this.curAction.genUnit) {
if (this.$isBlank(this.orderFormData.fromCorp) && this.$isBlank(this.orderFormData.sickerAdNum)) {
this.$message.warning('请选择往来单位!')
return
}
}
let tQuery = Object.assign(
JSON.parse(JSON.stringify(this.orderFormData))
)
tQuery.orderId = this.orderFormData.billNo
tQuery.productType = 1
if (val == 1) {
//校验btn
this.checkLoading = true
} else if (val == 2) {
//扫码btn
this.codeLoading = true
} else {
this.submitLoading = true
}
this.overdeleteCode()
this.orderStatus = false
if (this.viewType == 2) { //扫码单据立即提交
submitCodes(tQuery).then((response) => {
if (val == 1) {
//校验btn
this.checkLoading = false
} else if (val == 2) {
//扫码btn
this.codeLoading = false
} else {
this.submitLoading = false
}
if (response.code === 20000) {
this.$message.success('提交成功,等待处理,请刷新后查看!')
this.successCloseData()
console.log(this.closeDialog())
if (this.closeDialog != undefined) {
this.closeDialog()
}
} else {
this.$message.error(response.message)
}
})
} else if (this.viewType == 1) { //业务单据提交提交
if (val == 1 || this.curAction.checkWebNew == 2) {
tQuery.fromVailPi = 2
} else {
tQuery.fromVailPi = 1
}
submitBiz(tQuery).then((response) => {
if (val == 1) {
//校验btn
this.checkLoading = false
} else if (val == 2) {
//扫码btn
this.codeLoading = false
} else {
this.submitLoading = false
}
if (response.code === 20000) {
this.$message.success('提交成功')
this.successCloseData()
if (this.closeDialog != undefined) {
this.closeDialog()
}
} else {
this.$message.error(response.message)
}
})
} else if (this.viewType == 4) {
submitAllocateBiz(tQuery).then((response) => {
if (val == 1) {
//校验btn
this.checkLoading = false
} else if (val == 2) {
//扫码btn
this.codeLoading = false
} else {
this.submitLoading = false
}
if (response.code === 20000) {
this.$message.success('提交成功')
this.successCloseData()
if (this.closeDialog != undefined) {
this.closeDialog()
}
} else {
this.$message.error(response.message)
}
})
} else if (this.viewType == 7) { //待校验提交
if (val == 1) {
this.$confirm('此操作将以校验的正确结果重新生成业务单并提交,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.checkLoading = true
this.submitCheckResult(tQuery)
})
.catch(() => {
this.this.checkLoading = false
})
} else {
this.$confirm('此操作将以扫码结果重新生成业务单并提交,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.codeLoading = true
this.submitCodeResult(tQuery)
})
.catch(() => {
this.codeLoading = false
})
}
} else { //配货拣货后后提交
submitOrderWeb(tQuery).then((response) => {
this.submitLoading = false
if (response.code === 20000) {
this.$message.success('提交成功')
this.successCloseData()
this.result = ''
this.$refs.inputRef.focus()
if (this.closeDialog != undefined) {
this.closeDialog()
}
} else {
this.$message.error(response.message)
}
})
}
this.$refs.inputRef.focus()
},
//选择单据
selectPrescribe() {
if (this.$route.query.busType != null) {
this.orderFormData.busType = this.$route.query.busType
}
this.overdeleteCode()
this.selectPrescriptionVisible = true
},
deleteCode() {
if (this.orderFormData.billNo == null) {
this.$message.error('请先录入单据信息!')
return
}
this.labelName = 2
this.scanStatus = 1
this.scanCode = ''
},
overdeleteCode() {
if (this.orderFormData.billNo == null) {
this.scanDeleteType = true
}
this.labelName = 1
this.scanStatus = null
this.scanCode = ''
},
//选入草稿单据
chooseDraftOrder() {
if (this.$isBlank(this.orderFormData.workPlaceCode)) {
this.$message.warning('请选择工位!')
return
}
this.overdeleteCode()
this.rowData.workPlaceCode = this.orderFormData.workPlaceCode
this.rowData.fifoSplit = this.orderFormData.fifoSplit
this.$router.push({query: {...this.$route.query, splitType: this.splitType}, path: this.$route.path})
this.chooseDraftOrderVisible = true
},
closeChooseDialog() {
this.chooseDraftOrderVisible = false
},
handleChoose(currentRow) {
this.orderQuery = currentRow
this.chooseDraftOrderVisible = false
this.refreshOrder(this.orderQuery)
//选入单据 判断此订单是否正在处理中
// this.upOrderStatus()
},
upOrderStatus() {
let query = {
billNo: this.orderQuery.billNo
}
upProcessing(query).then(res => {
if (res.code == 20000) {
} else if (res.code == 501) {
this.$message.error('当前单据正在处理中,请重新选择单据')
this.$refs.chooseDraftOrder.getList()
this.chooseDraftOrderVisible = true
//当前订单正在处理中,刷新列表重新选择草稿订单
} else {
return this.$message.error('系统繁忙')
}
})
},
//获取选入的完成单
confirmSelect(row) {
this.selectPrescriptionVisible = false
this.formData = row
this.batchAddCodeByOrderFinish(row.billNo)
},
draftOrder() {
let tQuery = Object.assign(
JSON.parse(JSON.stringify(this.orderFormData))
)
tQuery.billNo = this.orderFormData.billNo
tQuery.orderType = 2
console.log('tQuery:')
console.log(tQuery)
if (this.orderFormData.billNo == null) {
this.$message.error('请先录入单据信息!')
return
}
this.saveLoading = true
if (this.splitType == 'return') {
tQuery.inoutType = 2
} else {
tQuery.inoutType = 1
}
this.overdeleteCode()
saveOrderWeb(tQuery).then((response) => {
this.saveLoading = false
if (response.code === 20000) {
this.$message.success('保存成功')
this.successCloseData()
this.result = ''
this.orderStatus = false
this.$refs.inputRef.focus()
} else {
this.$message.error(response.message)
}
this.loading = false
this.saveLoading = false
})
},
delOrder() {
let tQuery = Object.assign(
JSON.parse(JSON.stringify(this.orderFormData))
)
tQuery.billNo = this.orderFormData.billNo
tQuery.orderType = 2
if (this.orderFormData.billNo == null) {
this.$message.error('请先录入单据信息!')
return
}
this.saveLoading = true
if (this.orderFormData.billNo != null) {
deleteByOrderId(tQuery).then((response) => {
this.saveLoading = false
if (response.code === 20000) {
this.$message.success('放弃成功')
this.successCloseData()
this.result = ''
this.$refs.inputRef.focus()
} else {
this.$message.error(response.message)
}
this.loading = false
this.saveLoading = false
})
} else {
this.successCloseData()
this.result = ''
this.$refs.inputRef.focus()
}
},
// 刷新表单
resetForm() {
if (this.$refs['dataForm']) {
// 清空验证信息表单
this.$refs['dataForm'].clearValidate()
// 刷新表单
this.$refs['dataForm'].resetFields()
}
},
enterKey(event) {
this.warnResult = ''
this.errResult = ''
this.result = ''
this.warnVisible = false
this.errVisible = false
this.checkSuccess = true
// this.workPlaceQueueCode = this.scanCode
if (this.getDMHotskeyValue(this.scanCode)) {
if (this.scanCode.includes("DMOENTER")) {
this.submit()
this.scanCode = ''
return
}else if (this.scanCode.includes("DMOCANCEL")) {
this.delOrder()
this.scanCode = ''
return
}else if (this.scanCode.includes("DMODEL")) {
this.deleteCode()
this.scanCode = ''
return
}
//获取当前工位的所有码 然后批量扫入
if (this.splitType == 'return') {
getCodeList({workPlaceQueueCode:this.scanCode}).then((response) => {
if (response.code === 20000) {
let params = {
codeList: response.data
}
this.batchVailCode(params)
return
}
});
} else {
return
}
}
if (this.splitType == 'out') {
if (!this.scanCode.includes("DMQ")) {
if (this.queueStatus == "0" && this.orderFormData.workPlaceQueueCode) {
this.$message.warning('当前工位无需按取货槽上架')
return;
} else if (this.queueStatus == "1" && isBlank(this.orderFormData.workPlaceQueueCode)) {
this.scanCode = ''
this.$message.warning('当前工位需按取货槽上架')
return;
}
} else {
if (this.queueStatus == "0" && this.orderFormData.workPlaceQueueCode) {
this.$message.warning('当前工位无需按取货槽上架')
return;
} else if (this.queueStatus == "1" && !this.orderFormData.workPlaceQueueCode) {
this.$message.warning('当前工位需按取货槽上架')
return;
}
}
}
this.codeFormData.code = this.scanCode.trim()
if (this.codeFormData.code.includes(';')) {
const codeArray = this.codeFormData.code.split(';')
let params = {
codeList: codeArray
}
this.batchVailCode(params)
return
}
let tQuery = {
originCode: this.originCode,
code: this.codeFormData.code.trim()
}
if (this.scanStatus == 1) {
const codeArray = this.codeFormData.code.split(';')
let query = {
orderId: this.orderFormData.billNo,
codeList: codeArray
}
//剔除码
this.removeCodesTemp(query)
} else {
enterCodeWeb(tQuery).then((response) => {
if (response.code === 20000) {
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
this.isSuccess = true
this.printCodeResult(response.data)
this.codeFormData.code = response.data.code
this.scanCode = ''
this.addCode()
} else {
if (response.code == 502) {
this.checkSuccess = false
this.isSuccess = false
// this.scanCode = ''
this.printCodeResult(response.data)
this.codeFormData.code = response.data.code
this.originCode = this.codeFormData.code
// this.originCode = ""
} else if (response.code == 501) {
this.checkSuccess = false
this.scanCode = ''
this.originCode = ""
this.$message.error(response.message)
} else if (response.code == 503) {
this.checkSuccess = false
this.isSuccess = false
this.scanCode = ''
this.printCodeResult(response.data)
this.codeFormData.code = response.data.code
this.$confirm(response.message, '提示', {
type: 'warning'
})
.then(() => {
this.codeFormData.code = response.data.code
this.addCode()
})
.catch(() => {
this.codeFormData.code = response.data.code
})
} else if (response.code == 508) {
this.scanCode = ''
this.originCode = ''
this.codeFormData.code = '01' + response.data.nameCode
this.originCode = this.codeFormData.code
} else {
this.$alert(response.message, '提示', {
confirmButtonText: '确定',
type: 'warning',
closeOnClickModal: true,
callback: (action) => {
this.scanCode = ''
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
}
})
}
}
this.loading = false
})
}
},
removeCodesTemp(query) {
//todo 已经传过来 扫码明细 的数据 this.codeArray 根据id删除码明细的方法 deleteCodesTempById
deleteCodesTempByCodes(query).then(res => {
if (res.code == 20000) {
this.$message.success('剔除成功')
this.corpOrderIdDisabled = true
this.refreshCodesPanel()
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
} else {
this.$message.error(res.message)
}
this.scanCode = ''
}).catch(() => {
})
},
getInputFocus(event) {
event.currentTarget.select()
},
tableSelection() {
this.$refs.multipleTable.clearSelection()
this.$refs.multipleTable.toggleAllSelection()
},
intentBack() {
this.$router.go(-1)
},
selectSupUnit(row) {
this.dialogTableVisible = false
this.orderFormData.selectSupId = row.erpId
this.addCode()
},
selectBindRl(row) {
this.selectRlVisible = false
this.orderFormData.relId = row.id
this.addCode()
},
selectSpaceBind(val) {
if (this.curAction.scanPreIn) {
this.orderFormData.checkPreInSpaceCode = val
} else if (this.curAction.advancePreIn) {
this.orderFormData.preCurSpaceCode = val
} else {
this.orderFormData.curSpaceCode = val
}
this.addCode()
this.selectSpaceVisible = false
},
closeCodeDialog() {
this.editOriginCodeVisible = false
this.refreshCodesPanel()
},
//选入相关
OptionalDocument() {
this.selectorder = true
},
sickChange(value) {
this.orderFormData.sickerAdNum = value
},
getDMHotskeyValue(str) {
console.log(str)
if (str.includes('DMHotskey')) {
try {
const jsonObj = JSON.parse(str)
if (jsonObj.hasOwnProperty('DMHotskey')) {
const dmhotskey = jsonObj.DMHotskey
if (dmhotskey.hasOwnProperty('workPlace')) {
this.scanCode = ''
this.orderFormData.workPlaceCode = dmhotskey.workPlace
return true
} else if (dmhotskey.hasOwnProperty('fifoSplit')) {
this.scanCode = ''
this.orderFormData.fifoSplit = dmhotskey.fifoSplit
return true
}
}
} catch (error) {
console.log('字符串不是有效的 JSON 格式')
}
} else if (str.includes("DMQ")) {
if (!isBlank(this.curQueueName)) {
this.scanCode = ''
return this.$message.warning("上货未完成")
}
if (this.queueStatus == "0") {
this.scanCode = ''
return this.$message.warning('当前工位无需按取货槽上架')
}
// if (!isBlank(this.orderFormData.billNo)){
// this.scanCode = ''
// return this.$message.warning("请先扫描货位码")
// }
let query = {
code: this.scanCode
}
if (str != null) {
query.code = str
query.workPlaceIdFk = this.workplaceId
}
getByCode(query).then((response) => {
this.loading = false;
if (response.code == 20000) {
this.curQueue = response.data;
this.productName = this.curQueue.cpmctymc
if (isBlank(this.productName)) {
this.curQueueName = "当前取货槽:" + this.curQueue.code
} else {
this.curQueueName = "当前取货槽:" + this.productName + "(" + this.curQueue.code + ")"
}
this.redMesg = false
this.orderFormData.workPlaceQueueCode = this.curQueue.code
this.scanCode = '';
} else {
this.scanCode = ''
this.$message.error(response.message)
}
}).catch(() => {
})
return true
}else if (str.includes("DMOENTER")) {
return true
}else if (str.includes("DMOCANCEL")) {
return true
}else if (str.includes("DMODEL")) {
return true
}
return false
},
printCodeResult(data, isSuccess) {
this.successVisible = true
const resultParts = ['扫码解析结果:' + data.code]
if (data.udi) {
resultParts.push('层级标识: ' + data.udi)
}
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)
}
this.result = resultParts.join(' , ')
},
printLabel() {
let query = {
labelId: 7
}
printSplitLabel(query).then((response) => {
const binaryData = []
binaryData.push(response)
let url = window.URL.createObjectURL(
new Blob(binaryData, {type: 'application/pdf'})
)
window.open(url)
}).catch(() => {
this.loading = false
})
this.clearOrder()
},
/**
* 上货完成后,清空数据
*/
clearOrder() {
// this.$router.go(0)
this.orderFormData = {
billNo: null,
corpOrderId: null,
action: null,
invCode: null,
fromCorp: null,
fromCorpName: null,
fromName: null,
fromInvCode: null,
remark: null,
fromType: 2,
errMsg: null,
checkPreInOrders: null,
checkPreInInvCode: null,
checkPreInSpaceCode: null,
curSpaceCode: null,
preSpaceCode: null,
preCurSpaceCode: null, //单据
sickerAdNum: null,
workPlaceCode: null,
splitBusType: null,
fifoSplit: 1
}
this.scanCode = ''
this.result = ''
this.refreshCodesPanel()
this.init()
},
init() {
//页面初始化
this.findAllWorkPlaces()
this.codeFormData.code = ''
if (this.splitType == 'search') {
} else if (this.splitType == 'out') {
this.orderFormData.action = 'SC72197936495755'
this.getBusType();
} else if (this.splitType == 'return') {
this.orderFormData.action = 'SC72249388338364'
this.getBusType();
}
this.orderFormData.fromCorp = '72198012799726'
//页面类型
this.viewCodeVisible = true
this.viewCodeDetailVisible = true
this.orderFormData.orderType = this.viewType
if (this.$isNotBlank(this.orderQuery.billNo)) {
//编辑页面
this.corpOrderIdDisabled = true
this.orderFormData = this.orderQuery
this.actionEnable = true
this.findMethod(this.orderFormData.fromCorp)
this.curAction = {}
this.refreshCodesPanel()
this.findInvListByUser()
// this.initBusType()
this.findFromInvList()
// this.getWorkBindBusTypes(null);
} else {
//新增页面
this.corpOrderIdDisabled = false
let date = new Date()
this.orderFormData.createTime = parseTime(
date,
'{y}-{m}-{d} {h}:{i}:{s}'
)
this.orderFormData.corpOrderId =
parseTime(date, '{y}{m}{d}{h}{i}{s}') +
Math.ceil(Math.random() * 89 + 10)
this.orderFormData.deptCode = this.$store.getters.deptCode
this.orderFormData.invCode = this.$store.getters.locInvCode
this.findInvListByUser()
this.showSearch = true
}
},
//处理事件
handleRecCodesEvent(event) {
console.log('接收 recCodes event:', event.detail.recCodes)
let params = {
codeList: event.detail.recCodes
}
this.batchVailCode(params)
},
batchVailCode(params) {
if (this.$isBlank(this.orderFormData.corpOrderId)) {
let date = new Date()
this.orderFormData.corpOrderId =
parseTime(date, '{y}{m}{d}{h}{i}{s}') +
Math.ceil(Math.random() * 89 + 10)
}
if (this.scanStatus == 1) {
const codeArray = this.codeFormData.code.split(';')
let query = {
orderId: this.orderFormData.billNo,
codeList: codeArray
}
//剔除码
this.removeCodesTemp(query)
} else {
batchVailCode(params).then((response) => {
if (response.code === 20000) {
console.log('==滴码接收==', response.data)
this.valiCodes = []
let list = response.data
list.forEach(item => {
if (item.status === 1) {
this.valiCodes.push(item.code)
}
})
this.printMutiCodeResult(list)
this.$refs.inputRef.focus()
this.$refs.inputRef.select()
if (this.valiCodes != null && this.valiCodes.length > 0) {
this.orderFormData.codeList = this.valiCodes
if (this.splitType == 'out') {
this.orderFormData.inoutType = 1
} else {
this.orderFormData.inoutType = 2
}
// this.orderFormData.inoutType = this.splitType; orderType
this.orderFormData.orderType = 2
batchAddCode(this.orderFormData).then((res) => {
if (res.code === 20000) {
if (res.data.orderId != null) {
this.orderFormData.billNo = res.data.orderId
}
this.refreshCodesPanel(this)
this.printMutiCodeResult(res.data.vailCodeResultResponses)
} else {
this.$message.error(res.message)
}
})
}
}
// this.scanCode = this.valiCodes.join(";");
})
}
},
batchAddCodeByOrderFinish(orderFinishBillNo) {
this.orderFormData.orderFinishBillNo = orderFinishBillNo
batchAddCodeByOrderFinish(this.orderFormData).then((res) => {
if (res.code === 20000) {
this.$refs.inputRef.focus()
this.orderFormData.billNo = res.data.orderId
this.refreshCodesPanel(this)
this.printMutiCodeResult(res.data.vailCodeResultResponses)
} else {
this.$message.error(res.message)
}
})
},
async printMutiCodeResult(vailCodeResultResponses) {
this.warnResult = ''
this.errResult = ''
this.result = ''
this.warnVisible = false
this.errVisible = false
for (let i = 0; i < vailCodeResultResponses.length; i++) {
let data = vailCodeResultResponses[i]
if (data.status == 1) {
this.successVisible = true
this.result = this.result + ';' + vailCodeResultResponses[i].code
} else if (data.status == 2) {
if (this.result == '') {
this.successVisible = false
}
this.warnResult = this.warnResult + '\n' + vailCodeResultResponses[i].code + ':' + vailCodeResultResponses[i].errMsg
} else if (data.status == 3) {
this.result = this.result + '\n' + vailCodeResultResponses[i].code
// this.warnResult = this.warnResult + "\n" + vailCodeResultResponses[i].code + ":" + vailCodeResultResponses[i].errMsg;
await this.popupTip(data)
}
// else
// this.errResult = this.errResult + "\n" + vailCodeResultResponses[i].code + ":" + vailCodeResultResponses[i].errMsg;
}
if (!isBlank(this.warnResult)) {
this.warnVisible = true
}
if (!isBlank(this.errResult)) {
this.errVisible = true
}
},
getOrder() {
let query = {
workPlaceCode: this.workplaceId
}
getProcessingOrder(query).then(res => {
if (res.code == 20000) {
if (res.data != null) {
this.refreshOrder(res.data)
}
} else {
this.$message.error('获取错误')
}
})
},
getBusType() {
let query = {
action: this.orderFormData.action,
page: 1,
limit: 10
}
getBusTypeList(query)
.then((response) => {
this.busTypes = response.data.list || []
this.splitBusType = this.busTypes[0].busType
console.log('==busTypes==', this.busTypes)
})
.catch(() => {
})
},
handleScanComplete(fullScanData) {
if (this.queueStatus == "1" && !this.orderFormData.workPlaceQueueCode) {
if (fullScanData != null && fullScanData[0].includes("DMQ")) {
this.getDMHotskeyValue(fullScanData[0])
return;
}
} else if (this.queueStatus == "1" && this.orderFormData.workPlaceQueueCode != null) {
if (fullScanData != null && fullScanData[0].includes("DMQ")) {
this.$message.warning('当前上货已绑定取货槽,请勿重复绑定!');
return;
}
}
// if (!fullScanData.includes("DMQ")) {
// if (this.queueStatus == "0" && this.orderFormData.workPlaceQueueCode) {
// this.$message.warning('当前工位无需按货位上架')
// return;
// } else if (this.queueStatus == "1" && !this.orderFormData.workPlaceQueueCode) {
// this.$message.warning('当前工位需按货位上架')
// return;
// }
// } else if (this.queueStatus == "1") {
// this.getDMHotskeyValue(fullScanData[0]);
// }
if (this.scanStatus == 1) {
let query = {
orderId: this.orderFormData.billNo,
codeList: fullScanData
}
//剔除码
this.removeCodesTemp(query)
} else {
let params = {
codeList: fullScanData
}
this.batchVailCode(params)
}
},
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)
}
},
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成功')
}
}
},
handleCodeArray(codeArray) {
this.codeArray = codeArray;
}
},
filters: {},
mounted() {
document.body.ondrop = function (event) {
event.preventDefault()
event.stopPropagation()
}
var that = this
var inputer = document.getElementById('inputer')
window.sc = new A.KeyScaner(inputer) //传入要监听的DOM节点
sc.onInput = function (text) {
if (text.includes('delete')) {
that.codeFormData.code = ''
that.sictomText = ''
that.originCode = ''
return
}
if (that.sitcomScan) {
let tempTxt = text
let str = tempTxt.replace(/[\r]/g, '')
that.sictomText = that.sictomText + str
that.codeFormData.code = that.sictomText
} else {
that.codeFormData.code = text
}
}
inputer.focus()
this.$refs.inputRef.focus()
//环境判断
if (window.navigator.userAgent.indexOf('GLXP_PC') != -1) {
this.scanDisabled = true
window.removeEventListener('gwsh', this.handleRecCodesEvent)
window.addEventListener('gwsh', this.handleRecCodesEvent)
}
document.addEventListener('visibilitychange', this.handleVisibilityChange)
this.handleVisibilityChange()
},
beforeDestroy() {
window.removeEventListener('gwsh', this.handleRecCodesEvent)
this.ws.close()
this.ws.onclose = function (evt) {
console.log('工位上货Connection closed.')
}
document.removeEventListener('visibilitychange', this.handleVisibilityChange)
},
created() {
// this.splitType = this.$route.query.splitType;
// if (this.splitType == null)
this.splitType = this.fromSplitType
this.init()
if (this.$route.query.workplaceId != null) {
this.corpOrderIdDisabled = true
this.isLinkDisabled = true
this.workplaceId = this.$route.query.workplaceId
this.orderFormData.workPlaceCode = Number(this.$route.query.workplaceId)
this.orderFormData.splitBusType = 'YPCF002'
//查找当前用户工位是否有正在处理的单据
// this.getOrder()
} else {
if (this.orderQuery.workPlaceCode != null) {
this.orderFormData.workPlaceCode = String(this.orderQuery.workPlaceCode)
// if (this.orderQuery.splitBusType != null){
// this.orderFormData.busType = this.orderQuery.splitBusType;
// }
}
}
}
}
</script>
<style scoped>
.scroll-alert {
width: 100%; /* 或者你需要的宽度 */
overflow: hidden;
white-space: nowrap;
box-sizing: border-box;
/*border: 1px solid #f56c6c; !* 类似于 Element UI 警告框的边框 *!*/
background-color: rgba(255, 235, 59, 0.1); /* 类似于 Element UI 警告框的背景色 */
padding: 10px;
position: relative;
}
.scroll-text {
display: inline-block;
padding-left: 100%; /* 初始位置在容器右侧 */
animation: scroll 10s linear infinite; /* 滚动动画 */
}
@keyframes scroll {
from {
transform: translateX(0);
}
to {
transform: translateX(-100%);
}
}
.query-form-item {
margin-right: 5px;
margin-bottom: 6px;
}
#inputer {
width: 100%;
min-height: 30px;
background-color: white;
border: #d0d0d0;
border-style: solid;
border-width: 0.1px;
color: #4a4a4a;
}
#inputer:focus {
width: 100%;
min-height: 30px;
background-color: white;
border: #0080ff;
border-style: solid;
border-width: 0.1px;
color: #4a4a4a;
}
.ime-disabled {
ime-mode: disabled;
}
.result-display {
border: 2px solid #ccc; /* 默认外框颜色 */
border-radius: 10px;
margin-top: 5px;
margin-left: 15px;
margin-right: 25px;
padding-left: 25px;
/* 不设置背景颜色 */
}
.result-success {
border-color: #4CAF50; /* 成功时外框颜色 */
}
.result-failure {
border-color: #0080ff; /* 失败时外框颜色 */
}
.result-text {
height: 18px;
/* 你可以在这里设置默认的文本颜色或其他样式 */
}
.result-text-success {
color: #4CAF50; /* 成功时文本颜色 */
font-size: 14px;
}
.result-text-failure {
color: #0080ff; /* 失败时文本颜色 */
font-size: 14px;
}
</style>