(function () { BemsWebApplication.FmsShortStockStatusViewViewModel = function (data) { this.SiteId = ko.observable(); this.BusinessFieldId = ko.observable(); this.MaterialId = ko.observable(); this.MaterialCode = ko.observable(); this.MaterialName = ko.observable(); this.Unit = ko.observable(); this.WarehouseId = ko.observable(); this.WarehouseName = ko.observable(); this.CurrentStoredCount = ko.observable(); this.CurrentReleaseCount = ko.observable(); this.CurrentCalcCount = ko.observable(); this.LackCount = ko.observable(); this.ReasonableStockCount = ko.observable(); this.CurrentStoredPrice = ko.observable(); this.CurrentReleasePrice = ko.observable(); this.CurrentCalcPrice = ko.observable(); if (data) this.fromJS(data); }; $.extend(BemsWebApplication.FmsShortStockStatusViewViewModel.prototype, { toJS: function () { return { SiteId: this.SiteId(), BusinessFieldId: this.BusinessFieldId(), MaterialId: this.MaterialId(), MaterialCode: this.MaterialCode(), MaterialName:this.MaterialName(), Unit: this.Unit(), WarehouseId: this.WarehouseId(), WarehouseName: this.WarehouseName(), CurrentStoredCount: this.CurrentStoredCount(), CurrentReleaseCount: this.CurrentReleaseCount(), CurrentCalcCount: this.CurrentCalcCount(), LackCount: this.LackCount(), ReasonableStockCount: this.ReasonableStockCount(), CurrentStoredPrice: this.CurrentStoredPrice(), CurrentReleasePrice: this.CurrentReleasePrice(), CurrentCalcPrice: this.CurrentCalcPrice() }; }, fromJS: function (data) { if (data) { this.SiteId(data.SiteId); this.BusinessFieldId(data.BusinessFieldId); this.MaterialId(data.MaterialId); this.MaterialCode(data.MaterialCode); this.MaterialName(data.MaterialName); this.Unit(data.Unit); this.WarehouseId(data.WarehouseId); this.WarehouseName(data.WarehouseName); this.CurrentStoredCount(data.CurrentStoredCount); this.CurrentReleaseCount(data.CurrentReleaseCount); this.CurrentCalcCount(data.CurrentCalcCount); this.LackCount(data.LackCount); this.ReasonableStockCount(data.ReasonableStockCount); this.CurrentStoredPrice(data.CurrentStoredPrice()); this.CurrentReleasePrice(data.CurrentReleasePrice()); this.CurrentCalcPrice(data.CurrentCalcPrice()); } } }); })();