/var/www/greso.tech/server/nsm/services
NameSizeModeActions
auth.service.js9740644editdlrm
company.service.js15340644editdlrm
index.js9350644editdlrm
inventory.service.js21180644editdlrm
lead.service.js15180644editdlrm
mail.service.js99910644editdlrm
order.service.js53520644editdlrm
rateArea.service.js20220644editdlrm
system.service.js8720644editdlrm
webSocket.service.js46110644editdlrm
Edit: /var/www/greso.tech/server/nsm/services/inventory.service.js (2118B)
const logger = require('../logger')({ service: 'OrderService' }) const { Op } = require('sequelize') module.exports = class InventoryService { constructor({ db, config }) { this.db = db this.interval = null this.config = config logger.child({ service: 'InventoryService', method: 'Constructor' }).info('Success') } async Run() { logger.child({ service: 'InventoryService', method: 'Run' }).info('Success') } async Stop() { this.interval = null logger.child({ service: 'InventoryService', method: 'Stop' }).info('Success') } //////////////////////////////////////////////////////////////////////////////////////// async UpdateInventory(order) { const inventory = await db.orderInventory.findOne({ // include: [{ model: db.role }], where: { id: id } }) if (!inventory) { throw new NotFound({ lang: req.user?.languageCode }) } inventory.rate = order.rate inventory.items_weight = order.items_weight inventory.items_volume = order.items_volume inventory.items_count = items_count inventory.items_total = items_total inventory.bulky_count = bulky_count inventory.bulky_total = bulky_total inventory.extras_count = extras_count inventory.extras_total = extras_total inventory.packages_count = packages_count inventory.packages_total = packages_total inventory.fuel_percent = fuel_percent inventory.fuel_total = fuel_total inventory.discount_cash = discount_cash inventory.total = total inventory.paid = paid inventory.due = due await inventory.save() // // отправить клинету // await SERVICES.WebSocketService.SendToClient(order.userId, status, headerClients) // // отправить company // if(order.companyId != null && order.companyId != ''){ // await SERVICES.WebSocketService.SendToCrmByCompany( // order.companyId, // status, // headerOperators // ) // } // // отправить branch // if(order.branchId != null && order.branchId != ''){ // await SERVICES.WebSocketService.SendToCrmByBranch( // order.branchId, // status, // headerOperators // ) // } } }