base code resource

/*
 Base.js, version 1.1a
 Copyright 2006-2009, Dean Edwards
 License: http://www.opensource.org/licenses/mit-license.php
*/

var Base = function() {
 // dummy
};

Base.extend = function(_instance, _static) { // subclass
 var extend = Base.prototype.extend;
 
 // build the prototype
 Base._prototyping = true;
 var proto = new this;
 extend.call(proto, _instance);
  proto.base = function() {
    // call this method from any other method to invoke that method's ancestor
  };
 delete Base._prototyping;
 
 // create the wrapper for the constructor function
 //var constructor = proto.constructor.valueOf(); //-dean
 var constructor = proto.constructor;
 var klass = proto.constructor = function() {
  if (!Base._prototyping) {
   if (this._constructing || this.constructor == klass) { // instantiation
    this._constructing = true;
    constructor.apply(this, arguments);
    delete this._constructing;
   } else if (arguments[0] != null) { // casting
    return (arguments[0].extend || extend).call(arguments[0], proto);
   }
  }
 };
 
 // build the class interface
 klass.ancestor = this;
 klass.extend = this.extend;
 klass.forEach = this.forEach;
 klass.implement = this.implement;
 klass.prototype = proto;
 klass.toString = this.toString;
 klass.valueOf = function(type) {
  //return (type == "object") ? klass : constructor; //-dean
  return (type == "object") ? klass : constructor.valueOf();
 };
 extend.call(klass, _static);
 // class initialisation
 if (typeof klass.init == "function") klass.init();
 return klass;
};

Base.prototype = { 
 extend: function(source, value) {
  if (arguments.length > 1) { // extending with a name/value pair
   var ancestor = this[source];
   if (ancestor && (typeof value == "function") && // overriding a method?
    // the valueOf() comparison is to avoid circular references
    (!ancestor.valueOf || ancestor.valueOf() != value.valueOf()) &&
    //bbase/b/.test(value)) {
    // get the underlying method
    var method = value.valueOf();
    // override
    value = function() {
     var previous = this.base || Base.prototype.base;
     this.base = ancestor;
     var returnValue = method.apply(this, arguments);
     this.base = previous;
     return returnValue;
    };
    // point to the underlying method
    value.valueOf = function(type) {
     return (type == "object") ? value : method;
    };
    value.toString = Base.toString;
   }
   this[source] = value;
  } else if (source) { // extending with an object literal
   var extend = Base.prototype.extend;
   // if this object has a customised extend method then use it
   if (!Base._prototyping && typeof this != "function") {
    extend = this.extend || extend;
   }
   var proto = {toSource: null};
   // do the "toString" and other methods manually
   var hidden = ["constructor", "toString", "valueOf"];
   // if we are prototyping then include the constructor
   var i = Base._prototyping ? 0 : 1;
   while (key = hidden[i++]) {
    if (source[key] != proto[key]) {
     extend.call(this, key, source[key]);

    }
   }
   // copy each of the source object's properties to this object
   for (var key in source) {
    if (!proto[key]) extend.call(this, key, source[key]);
   }
  }
  return this;
 }
};

// initialise
Base = Base.extend({
 constructor: function() {
  this.extend(arguments[0]);
 }
}, {
 ancestor: Object,
 version: "1.1",
 
 forEach: function(object, block, context) {
  for (var key in object) {
   if (this.prototype[key] === undefined) {
    block.call(context, object[key], key, object);
   }
  }
 },
  
 implement: function() {
  for (var i = 0; i < arguments.length; i++) {
   if (typeof arguments[i] == "function") {
    // if it's a function, call it
    arguments[i](this.prototype);
   } else {
    // add the interface using the extend method
    this.prototype.extend(arguments[i]);
   }
  }
  return this;
 },
 
 toString: function() {
  return String(this.valueOf());
 }
});

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
优化sql:SELECT we.organization_id ,we.wip_entity_id ,case when wl.line_id is null then we.wip_entity_name else '' end wip_entity_name ,we.primary_item_id ,mtt.transaction_type_name ,mmt.transaction_date ,bd.department_code ,mmt.inventory_item_id ,mmt.subinventory_code ,mta.reference_account ,br.resource_code ,lu2.meaning as line_type_name ,mta.base_transaction_value ,mta.cost_element_id ,flv.meaning as cost_element ,wdj.class_code job_type_code ,ml.meaning job_type_name FROM (select * from gerp.mtl_material_transactions where substr(transaction_date,1,7) >= '2023-06' and transaction_source_type_id = 5) mmt inner join gerp.wip_entities we on mmt.organization_id = we.organization_id inner join gerp.mtl_transaction_accounts mta on mta.transaction_source_id = we.wip_entity_id and mta.transaction_id = mmt.transaction_id and mta.transaction_source_type_id = 5 inner join gerp.mtl_transaction_types mtt on mtt.transaction_type_id = mmt.transaction_type_id inner join mfg_lookups lu2 on lu2.lookup_code = mta.accounting_line_type and lu2.lookup_type = 'CST_ACCOUNTING_LINE_TYPE' inner join gerp.mtl_system_items_b msi on msi.inventory_item_id = mmt.inventory_item_id and msi.organization_id = mta.organization_id left join gerp.bom_departments bd on bd.department_id = mmt.department_id left join gerp.bom_resources br on br.resource_id = mta.resource_id left join gerp.wip_lines wl on wl.line_id = mmt.repetitive_line_id left join gerp.wip_discrete_jobs wdj on wdj.wip_entity_id = mta.transaction_source_id left join gerp.fnd_lookup_values_vl flv on cast(mta.cost_element_id as string) = flv.lookup_code and flv.lookup_type = 'CST_COST_CODE_TYPE' left join mfg_lookups ml on ml.lookup_code = wdj.job_type and ml.lookup_type = 'WIP_DISCRETE_JOB' 。其中mmt,we,mta,msi,wdj数据量很大
06-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值