You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

140 lines
3.9 KiB

const db = require("../Config/db");
const sequelize = require("sequelize");
const modelCache = {};
function getInventoryMovementTable(tableName) {
console.log("MODEL CACHE ", modelCache);
if (!modelCache[tableName]) {
const model = db.define(
tableName,
{
SEQUENCE: {
type: sequelize.INTEGER
},
REC_TYPE: {
type: sequelize.STRING
},
MOV_PRD: {
type: sequelize.INTEGER
},
MOV_REF: {
primaryKey: true,
type: sequelize.STRING
},
MOV_LINE: {
primaryKey: true,
type: sequelize.STRING
},
LOCATION: {
type: sequelize.STRING
},
ITEM_CODE: {
type: sequelize.STRING
},
MOV_DATE: {
type: sequelize.STRING
},
STATUS: {
type: sequelize.STRING
},
IR_STAT: {
type: sequelize.STRING
},
BATCH_NO: {
type: sequelize.INTEGER
},
BATCH_LINE: {
type: sequelize.STRING
},
LINE_REF: {
type: sequelize.STRING
},
QUANTITY: {
type: sequelize.FLOAT
},
COST: {
type: sequelize.FLOAT
},
TOTAL: {
type: sequelize.FLOAT
},
MOV_UNITS: {
type: sequelize.STRING
},
MOV_TYPE: {
type: sequelize.STRING
},
UPDTE_PHYS: {
type: sequelize.STRING
},
UPDTE_ORDR: {
type: sequelize.STRING
},
ALLOC_REF: {
type: sequelize.STRING
},
ACCNT_CODE: {
type: sequelize.STRING
},
ASSET_CODE: {
type: sequelize.STRING
},
ANAL_M0: {
type: sequelize.STRING
},
ANAL_M1: {
type: sequelize.STRING
},
ANAL_M2: {
type: sequelize.STRING
},
ANAL_M3: {
type: sequelize.STRING
},
ANAL_M4: {
type: sequelize.STRING
},
ANAL_M5: {
type: sequelize.STRING
},
ANAL_M6: {
type: sequelize.STRING
},
ANAL_M7: {
type: sequelize.STRING
},
ANAL_M8: {
type: sequelize.STRING
},
ANAL_M9: {
type: sequelize.STRING
},
ORIG_LINE_NO: {
type: sequelize.STRING
},
PO_VALUE: {
type: sequelize.FLOAT
},
ID_ENTERED: {
type: sequelize.STRING
},
ID_ALLOC: {
type: sequelize.STRING
}
},
{
timestamps: false,
freezeTableName: true
}
);
model.removeAttribute('id');
modelCache[tableName] = model;
}
return modelCache[tableName];
}
module.exports = { getInventoryMovementTable };