1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-12 22:29:59 +08:00

Process the POS (#584)

* Process the POS

* fixe pos Process
This commit is contained in:
Elsio Sanchez 2021-02-16 14:06:06 -04:00 committed by GitHub
parent 737d85b0ba
commit 0b314fc8c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 139 additions and 139 deletions

View File

@ -32,6 +32,7 @@
placement="right" placement="right"
width="800" width="800"
trigger="click" trigger="click"
@show="seeOrderList"
> >
<orders-list <orders-list
:parent-metadata="metadata" :parent-metadata="metadata"
@ -126,18 +127,6 @@
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="size"> <el-col :span="size">
<el-card shadow="hover">
<p
:style="blockOption"
@click="copyLineOrder "
>
<i class="el-icon-document-copy" />
<br>
{{ $t('form.pos.optionsPoinSales.salesOrder.copyOrderLine') }}
</p>
</el-card>
</el-col>
<!-- <el-col :span="size">
<el-card shadow="hover"> <el-card shadow="hover">
<p <p
:style="blockOption" :style="blockOption"
@ -148,7 +137,7 @@
{{ $t('form.pos.optionsPoinSales.salesOrder.copyOrder') }} {{ $t('form.pos.optionsPoinSales.salesOrder.copyOrder') }}
</p> </p>
</el-card> </el-card>
</el-col> --> </el-col>
<el-col :span="size"> <el-col :span="size">
<el-card shadow="hover"> <el-card shadow="hover">
<p <p
@ -205,32 +194,6 @@
<el-collapse-item :title="$t('form.pos.optionsPoinSales.generalOptions.title')" name="generalOptions"> <el-collapse-item :title="$t('form.pos.optionsPoinSales.generalOptions.title')" name="generalOptions">
<el-row :gutter="12" style="padding-right: 10px;"> <el-row :gutter="12" style="padding-right: 10px;">
<!--
<el-col :span="size">
<el-card shadow="hover">
<el-popover
placement="right"
width="400"
trigger="click"
>
<el-form label-position="top" label-width="10px" @submit.native.prevent="notSubmitForm">
<field
:key="typeDocumentMetadata.columnName"
:metadata-field="typeDocumentMetadata"
:v-model="typeDocumentMetadata.value"
style="padding-left: 0px; padding-right: 0px;"
/>
</el-form>
<p slot="reference" :style="blockOption">
<i class="el-icon-document-copy" />
<br>
Cambiar Tipo de Documento
</p>
</el-popover>
</el-card>
</el-col>
-->
<el-col :span="size"> <el-col :span="size">
<el-card shadow="hover"> <el-card shadow="hover">
<el-dropdown trigger="click" style="padding-top: 8px; color: black;" @command="changePos"> <el-dropdown trigger="click" style="padding-top: 8px; color: black;" @command="changePos">
@ -298,7 +261,8 @@ import {
requestCreateWithdrawal, requestCreateWithdrawal,
requestCreateNewCustomerReturnOrder, requestCreateNewCustomerReturnOrder,
requestCashClosing, requestCashClosing,
requestDeleteOrder requestDeleteOrder,
requestCreateOrder
} from '@/api/ADempiere/form/point-of-sales.js' } from '@/api/ADempiere/form/point-of-sales.js'
import ModalDialog from '@/components/ADempiere/Dialog' import ModalDialog from '@/components/ADempiere/Dialog'
import posProcess from '@/utils/ADempiere/constants/posProcess' import posProcess from '@/utils/ADempiere/constants/posProcess'
@ -377,6 +341,9 @@ export default {
return 24 / size return 24 / size
} }
}, },
created() {
this.findProcess()
},
methods: { methods: {
notSubmitForm(event) { notSubmitForm(event) {
event.preventDefault() event.preventDefault()
@ -455,34 +422,31 @@ export default {
}) })
}, },
reverseSalesTransaction() { reverseSalesTransaction() {
const process = this.$store.getters.getProcess(posProcess[1].uuid) const process = this.$store.getters.getProcess(posProcess[0].uuid)
this.$store.dispatch('startProcess', { this.showModal(process)
action: process, const parametersList = [
isProcessTableSelection: false, {
containerUuid: process.containerUuid, columnName: 'C_Order_ID',
parametersList: [ value: this.$store.getters.getOrder.id
{ },
columnName: 'C_Order_ID', {
value: this.currentPOS.id columnName: 'Bill_BPartner_ID',
}, value: this.$store.getters.getOrder.businessPartner.id
{ },
columnName: 'Bill_BPartner_ID', {
value: this.currentPOS.businessPartner.id columnName: 'IsCancelled',
}, value: false
{ },
columnName: 'IsCancelled', {
value: false columnName: 'IsShipConfirm',
}, value: true
{ },
columnName: 'IsShipConfirm', {
value: true columnName: 'C_DocTypeRMA_ID',
}, value: 'VO'
{ }
columnName: 'C_DocTypeRMA_ID', ]
value: 'VO' this.$store.dispatch('addParametersProcessPos', parametersList)
}
]
})
}, },
createWithdrawal() { createWithdrawal() {
const { uuid: posUuid, id: posId } = this.getCurrentPOS const { uuid: posUuid, id: posId } = this.getCurrentPOS
@ -507,13 +471,50 @@ export default {
}) })
}, },
copyOrder() { copyOrder() {
this.processPos = posProcess[5].uuid this.processPos = posProcess[1].uuid
const process = this.$store.getters.getProcess(posProcess[5].uuid) const posUuid = this.currentPoint.uuid
this.showModal(process) const parametersList = [{
columnName: 'C_Order_ID',
value: this.$store.getters.getOrder.id
}]
this.$store.dispatch('addParametersProcessPos', parametersList)
requestCreateOrder({
posUuid,
customerUuid: this.currentPOS.businessPartner.uuid,
salesRepresentativeUuid: this.currentPOS.salesRepresentative.uuid
})
.then(order => {
this.$store.dispatch('currentOrder', order)
this.$router.push({
params: {
...this.$route.params
},
query: {
...this.$route.query,
action: order.uuid
}
}).then(() => {
}).catch(() => {})
this.$store.commit('setIsReloadListOrders')
})
.catch(error => {
console.error(error.message)
this.$message({
type: 'error',
message: error.message,
showClose: true
})
})
.finally(() => {
const process = this.$store.getters.getProcess(posProcess[1].uuid)
this.showModal(process)
})
}, },
copyLineOrder() { copyLineOrder() {
this.processPos = posProcess[5].uuid this.processPos = posProcess[1].uuid
const process = this.$store.getters.getProcess(posProcess[5].uuid) const process = this.$store.getters.getProcess(posProcess[1].uuid)
this.showModal(process) this.showModal(process)
}, },
cashClosing() { cashClosing() {
@ -524,6 +525,7 @@ export default {
}) })
}, },
deleteOrder() { deleteOrder() {
this.$store.dispatch('updateOrderPos', true)
requestDeleteOrder({ requestDeleteOrder({
orderUuid: this.$route.query.action orderUuid: this.$route.query.action
}) })
@ -536,10 +538,24 @@ export default {
}) })
this.$message({ this.$message({
type: 'success', type: 'success',
message: 'Orden Cancelada', message: this.$t('form.pos.optionsPoinSales.salesOrder.orderRemoved'),
showClose: true showClose: true
}) })
this.$store.dispatch('updateOrderPos', false)
}) })
},
seeOrderList() {
if (this.$store.getters.getListOrder.recordCount <= 0) {
this.$store.dispatch('listOrdersFromServer', {})
}
},
findProcess() {
const findServer = this.$store.getters.getProcess('a42ad0c6-fb40-11e8-a479-7a0060f0aa01')
if (this.isEmptyValue(findServer)) {
posProcess.forEach(item => {
this.$store.dispatch('getProcessFromServer', { containerUuid: item.uuid, processId: item.id })
})
}
} }
} }
} }

View File

@ -45,8 +45,7 @@
:highlight-current-row="highlightRow" :highlight-current-row="highlightRow"
:height="heightTable" :height="heightTable"
@shortkey.native="keyAction" @shortkey.native="keyAction"
@current-change="orderPrpcess" @current-change="handleCurrentChange"
@row-dblclick="handleCurrentChange"
> >
<el-table-column <el-table-column
prop="documentNo" prop="documentNo"

View File

@ -10,7 +10,7 @@ import {
formatPrice, formatPrice,
formatQuantity formatQuantity
} from '@/utils/ADempiere/valueFormat.js' } from '@/utils/ADempiere/valueFormat.js'
import posProcess from '@/utils/ADempiere/constants/posProcess' // import posProcess from '@/utils/ADempiere/constants/posProcess'
export default { export default {
name: 'POSMixin', name: 'POSMixin',
@ -52,8 +52,7 @@ export default {
quantityAvailable: 0 quantityAvailable: 0
}, },
edit: false, edit: false,
displayType: '', displayType: ''
process: posProcess
} }
}, },
computed: { computed: {
@ -147,9 +146,8 @@ export default {
} }
}, },
updateOrderProcessPos(value) { updateOrderProcessPos(value) {
if (value) { if (!value && !this.isEmptyValue(this.$route.query)) {
this.reloadOrder(true) this.reloadOrder(true)
this.$store.dispatch('updateOrderPos', false)
} }
} }
}, },
@ -163,14 +161,14 @@ export default {
this.listOrderLines(this.currentOrder) this.listOrderLines(this.currentOrder)
} }
} }
this.findProcess(this.process)
this.unsubscribe = this.subscribeChanges() this.unsubscribe = this.subscribeChanges()
}, },
beforeDestroy() { beforeDestroy() {
this.unsubscribe() this.unsubscribe()
}, },
mounted() { mounted() {
if (this.isEmptyValue(this.currentOrder)) { // this.findProcess()
if (!this.isEmptyValue(this.$route.query)) {
this.reloadOrder(true, this.$route.query.action) this.reloadOrder(true, this.$route.query.action)
} }
}, },
@ -523,11 +521,6 @@ export default {
}) })
break break
} }
},
findProcess(processPos) {
processPos.forEach(item => {
this.$store.dispatch('getProcessFromServer', { containerUuid: item.uuid })
})
} }
} }
} }

View File

@ -347,7 +347,7 @@ export default {
createPos: 'Create Point of Sale Withdrawal', createPos: 'Create Point of Sale Withdrawal',
print: 'Print Document', print: 'Print Document',
cancelOrder: 'Cancel Order', cancelOrder: 'Cancel Order',
copyOrderLine: 'Copy Order Lines', orderRemoved: 'Order Deleted',
copyOrder: 'Copy Order' copyOrder: 'Copy Order'
}, },
cashManagement: { cashManagement: {

View File

@ -322,7 +322,7 @@ export default {
createPos: 'Crear Retiro de Punto de Venta', createPos: 'Crear Retiro de Punto de Venta',
print: 'Imprimir Documento', print: 'Imprimir Documento',
cancelOrder: 'Cancelar Orden', cancelOrder: 'Cancelar Orden',
copyOrderLine: 'Copiar Lineas de la Orden', orderRemoved: 'Orden Borrada',
copyOrder: 'Copiar Orden' copyOrder: 'Copiar Orden'
}, },
cashManagement: { cashManagement: {

View File

@ -1172,8 +1172,9 @@ export default {
type: 'info' type: 'info'
}) })
} }
dispatch('updateOrderPos', true)
const timeInitialized = (new Date()).getTime() const timeInitialized = (new Date()).getTime()
let processResult = { const processResult = {
// panel attributes from where it was executed // panel attributes from where it was executed
parentUuid, parentUuid,
containerUuid, containerUuid,
@ -1193,35 +1194,20 @@ export default {
output: '', output: '',
outputStream: '', outputStream: '',
reportType: '' reportType: ''
} },
} menuParentUuid,
if (!isEmptyValue(isActionDocument)) { processIdPath: isEmptyValue(routeToDelete) ? '' : routeToDelete.path,
processResult = { printFormatUuid: action.printFormatUuid,
...processResult, // process attributes
processUuid: action.uuid, action: processDefinition.name,
processId: action.id, name: processDefinition.name,
processName: 'Procesar Orden', description: processDefinition.description,
parameters: parametersList instanceUuid: '',
} processUuid: processDefinition.uuid,
} else { processId: processDefinition.id,
// Run process on server and wait for it for notify processName: processDefinition.processName,
// uuid of process parameters: parametersList,
processResult = { isReport: processDefinition.isReport
...processResult,
menuParentUuid,
processIdPath: isEmptyValue(routeToDelete) ? '' : routeToDelete.path,
printFormatUuid: action.printFormatUuid,
// process attributes
action: processDefinition.name,
name: processDefinition.name,
description: processDefinition.description,
instanceUuid: '',
processUuid: processDefinition.uuid,
processId: processDefinition.id,
processName: processDefinition.processName,
parameters: parametersList,
isReport: processDefinition.isReport
}
} }
commit('addInExecution', processResult) commit('addInExecution', processResult)
requestRunProcess({ requestRunProcess({
@ -1282,7 +1268,7 @@ export default {
dispatch('setProcessSelect', { dispatch('setProcessSelect', {
finish: true finish: true
}) })
dispatch('updateOrderPos', true) dispatch('updateOrderPos', false)
}) })
}) })
} }

View File

@ -1,27 +1,33 @@
const posProcess = [ const posProcess = [
{ // {
name: 'C_POS Generate Immediate Invoice', // name: 'C_POS Generate Immediate Invoice',
uuid: 'a42cce58-fb40-11e8-a479-7a0060f0aa01' // uuid: 'a42cce58-fb40-11e8-a479-7a0060f0aa01',
}, // id: 53823
// },
{ {
name: 'C_POS ReverseTheSalesTransaction', name: 'C_POS ReverseTheSalesTransaction',
uuid: 'a42ccebc-fb40-11e8-a479-7a0060f0aa01' uuid: 'a42ccebc-fb40-11e8-a479-7a0060f0aa01',
}, id: 53824
{
name: 'C_POS CreateOrderBasedOnAnother',
uuid: 'a42ccc46-fb40-11e8-a479-7a0060f0aa01'
},
{
name: 'C_POS Withdrawal',
uuid: 'a42ce0a0-fb40-11e8-a479-7a0060f0aa01'
},
{
name: 'C_POS Bank Statement Close',
uuid: 'a42ce118-fb40-11e8-a479-7a0060f0aa01'
}, },
// {
// name: 'C_POS CreateOrderBasedOnAnother',
// uuid: 'a42ccc46-fb40-11e8-a479-7a0060f0aa01',
// id: 53822
// },
// {
// name: 'C_POS Withdrawal',
// uuid: 'a42ce0a0-fb40-11e8-a479-7a0060f0aa01',
// id: 53846
// },
// {
// name: 'C_POS Bank Statement Close',
// uuid: 'a42ce118-fb40-11e8-a479-7a0060f0aa01',
// id: 53847
// },
{ {
name: 'C_Order CopyFrom', name: 'C_Order CopyFrom',
uuid: 'a42ad0c6-fb40-11e8-a479-7a0060f0aa01' uuid: 'a42ad0c6-fb40-11e8-a479-7a0060f0aa01',
id: 211
} }
] ]
export default posProcess export default posProcess