Skip to content

Commit

Permalink
support to service process shipment (#1289)
Browse files Browse the repository at this point in the history
* support to service process shipment

* Supporte reverse order

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
  • Loading branch information
elsiosanchez and elsiosanchez committed Oct 20, 2021
1 parent 3fc05bc commit 93605a2
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 54 deletions.
53 changes: 48 additions & 5 deletions src/api/ADempiere/form/point-of-sales.js
Original file line number Diff line number Diff line change
Expand Up @@ -1058,15 +1058,58 @@ export function shipments({
})
}

// Confirm Shipment
export function confirmShipment({
shipmentUuid
/**
* POST Process Shipment
*
* req.query.token - user token
* Body:
* req.body.shipment_uuid - POS UUID shipment uuid
* req.body.description - POS UUID description
* req.body.document_action - Sales Representative UUID reference
* Details:
*/

export function processShipment({
shipmentUuid,
description
}) {
return request({
url: `${config.pointOfSales.endpoint}/confirm-shipment`,
url: `${config.pointOfSales.endpoint}/process-shipment`,
method: 'post',
data: {
shipment_uuid: shipmentUuid
shipment_uuid: shipmentUuid,
description,
document_action: 'CO'
}
})
.then(response => {
return response
})
}

/**
* POST Reverse Sales
*
* req.query.token - user token
* Body:
* req.body.order_uuid - Order UUID
* req.body.pos_uuid - POS UUID
* req.body.description - POS UUID description
* Details:
*/

export function reverseSales({
posUuid,
orderUuid,
description
}) {
return request({
url: `${config.pointOfSales.endpoint}/reverse-sales`,
method: 'post',
data: {
pos_uuid: posUuid,
order_uuid: orderUuid,
description
}
})
.then(response => {
Expand Down
21 changes: 10 additions & 11 deletions src/components/ADempiere/Form/VPOS/ConfirmDelivery/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@
@click="close"
/>
<el-button
v-if="allowsConfirmShipment"
type="primary"
class="custom-button-create-bp"
icon="el-icon-check"
Expand All @@ -186,7 +185,7 @@ import {
createShipment,
deleteShipment,
shipments,
confirmShipment
processShipment
} from '@/api/ADempiere/form/point-of-sales.js'
import ImageProduct from '@/components/ADempiere/Form/VPOS/Order/ImageProduct/index'
Expand Down Expand Up @@ -347,18 +346,12 @@ export default {
})
},
searchProduct(value) {
const posUuid = this.currentPointOfSales.uuid
const orderUuid = this.currentOrder.uuid
const salesRepresentativeUuid = this.currentPointOfSales.salesRepresentative.uuid
if (this.isEmptyValue(this.shipment)) {
this.createDelivery({ posUuid, orderUuid, salesRepresentativeUuid })
}
clearTimeout(this.timeOut)
this.timeOut = setTimeout(() => {
this.isSearchProduct = true
const product = this.findProductFromOrder(value)
if (product) {
this.addLineShipment({ shipmentUuid: this.shipment.uuid, orderLineUuid: product.uuid })
this.addLineShipment({ shipmentUuid: this.currentShipment.uuid, orderLineUuid: product.uuid })
} else {
this.$message({
type: 'error',
Expand Down Expand Up @@ -414,7 +407,7 @@ export default {
})
})
.finally(() => {
this.listShipments({ shipmentUuid: this.shipment.uuid })
this.listShipments({ shipmentUuid: this.currentShipment.uuid })
})
},
/**
Expand Down Expand Up @@ -457,10 +450,16 @@ export default {
if (this.isEmptyValue(this.currentShipment)) {
return
}
confirmShipment({
processShipment({
shipmentUuid: this.currentShipment.uuid
})
.then(response => {
this.$message({
type: 'success',
message: 'OK',
duration: 1500,
showClose: true
})
return response
})
.catch(error => {
Expand Down
135 changes: 97 additions & 38 deletions src/components/ADempiere/Form/VPOS/Options/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
>
<el-button
type="text"
style="min-height: 50px;width: -webkit-fill-available;white-space: normal;"
@click="openListOrdes()"
>
<svg-icon icon-class="list" />
Expand Down Expand Up @@ -101,14 +102,52 @@

<el-col v-if="allowsReturnOrder" :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
<el-card shadow="hover" style="height: 100px">
<p
:style="blockOption"
@click="adviserPin ? validateOption($t('form.pos.optionsPoinSales.salesOrder.cancelSaleTransaction')) : reverseSalesTransaction()"
<el-popover
v-model="visibleReverse"
placement="top"
width="450"
:disabled="!isProcessed"
>
<i class="el-icon-error" />
<br>
{{ $t('form.pos.optionsPoinSales.salesOrder.cancelSaleTransaction') }}
</p>
<el-row :gutter="24" class="container-reverse">
<el-col :span="24" class="container-reverse">
<p class="container-popover">
<b class="container-popover">
{{ $t('data.addDescription') }}
</b>
</p>
</el-col>
<el-col :span="24">
<el-input
v-model="messageReverseSales"
type="textarea"
:rows="2"
:placeholder="$t('data.addDescription')"
style=""
/>
</el-col>
<el-col :span="24">
<samp class="spam-button">
<el-button
type="danger"
icon="el-icon-close"
style="background: #ff6d6d;border-color: #ff6d6d;background-color: #ff6d6d;"
@click="messageReverseSales = false"
/>
<el-button
type="primary"
style="background: #46a6ff;border-color: #46a6ff;background-color: #46a6ff;"
icon="el-icon-check"
@click="adviserPin ? validateOption($t('form.pos.optionsPoinSales.salesOrder.cancelSaleTransaction')) : reverseSalesTransaction()"
/>
</samp>
</el-col>
</el-row>
<el-button slot="reference" type="text" style="min-height: 50px;width: -webkit-fill-available;white-space: normal;">
<i class="el-icon-error" />
<br>
{{ $t('form.pos.optionsPoinSales.salesOrder.cancelSaleTransaction') }}
</el-button>
</el-popover>
</el-card>
</el-col>

Expand Down Expand Up @@ -375,6 +414,7 @@ import {
cashClosing,
deleteOrder,
createOrder,
reverseSales,
processOrder
} from '@/api/ADempiere/form/point-of-sales.js'
import { createShipment, shipments } from '@/api/ADempiere/form/point-of-sales.js'
Expand Down Expand Up @@ -408,7 +448,9 @@ export default {
attributePin: {},
validatePin: true,
visible: false,
visibleReverse: false,
showFieldListOrder: false,
messageReverseSales: '',
showConfirmDelivery: false,
posProcess
}
Expand Down Expand Up @@ -525,7 +567,10 @@ export default {
}
},
isProcessed() {
return this.currentPointOfSales.currentOrder.isProcessed
if (!this.isEmptyValue(this.currentOrder.documentStatus.value) && this.currentOrder.documentStatus.value === 'CO') {
return true
}
return false
}
},
watch: {
Expand All @@ -545,6 +590,9 @@ export default {
},
methods: {
openDelivery() {
if (!this.isProcessed) {
return
}
createShipment({
posUuid: this.currentPointOfSales.uuid,
orderUuid: this.currentOrder.uuid,
Expand Down Expand Up @@ -726,36 +774,27 @@ export default {
})
},
reverseSalesTransaction() {
if (this.isEmptyValue(this.currentOrder.uuid)) {
return ''
}
const process = this.$store.getters.getProcess(posProcess[0].uuid)
this.showModal(process)
const parametersList = [
{
columnName: 'C_Order_ID',
value: this.currentOrder.id
},
{
columnName: 'Bill_BPartner_ID',
value: this.currentOrder.businessPartner.id
},
{
columnName: 'IsCancelled',
value: true
},
{
columnName: 'IsShipConfirm',
value: true
},
{
columnName: 'C_DocTypeRMA_ID',
value: this.currentPointOfSales.returnDocumentType.id
}
]
this.$store.dispatch('addParametersProcessPos', parametersList)
// close panel lef
this.$store.commit('setShowPOSOptions', false)
reverseSales({
posUuid: this.currentPointOfSales.uuid,
orderUuid: this.currentOrder.uuid,
description: this.messageReverseSales
})
.then(response => {
const orderUuid = this.currentOrder.uuid
this.$store.dispatch('reloadOrder', { orderUuid })
})
.catch(error => {
console.error(error.message)
this.$message({
type: 'error',
message: error.message,
showClose: true
})
})
.finally(() => {
this.visibleReverse = false
this.messageReverseSales = ''
})
},
withdrawal() {
const { uuid: posUuid, id: posId } = this.currentPointOfSales
Expand Down Expand Up @@ -1003,4 +1042,24 @@ export default {
cursor: pointer;
text-align: center !important;
}
.spam-button {
float: right;
padding-top: 5px;
background-color:white;
background:white;
}
.container-reverse {
background-color:white;
background:white;
}
.container-popover {
padding-right: 10px;
background-color:white;
background:white;
}
</style>
<style>
.el-textarea__inner:hover {
background-color: #FFFFFF!important;
}
</style>
1 change: 1 addition & 0 deletions src/lang/ADempiere/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ export default {
exportRecord: 'Export Record',
lockRecord: 'Lock Record',
noDescription: 'No Description',
addDescription: 'Add Description',
recordAccess: {
modeMobile: {
accessRoles: 'Access Roles',
Expand Down
1 change: 1 addition & 0 deletions src/lang/ADempiere/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ export default {
exportRecord: 'Exportar Registro',
lockRecord: 'Registro Bloqueado',
noDescription: 'Sin Descripción',
addDescription: 'Agregue una Descripción',
recordAccess: {
modeMobile: {
accessRoles: 'Roles con Acceso',
Expand Down

0 comments on commit 93605a2

Please sign in to comment.