b6069a048015a7771c8cf8bcc495c42056330c27.svn-base 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. (function () {
  2. BemsWebApplication.FmsShortStockStatusViewViewModel = function (data) {
  3. this.SiteId = ko.observable();
  4. this.BusinessFieldId = ko.observable();
  5. this.MaterialId = ko.observable();
  6. this.MaterialCode = ko.observable();
  7. this.MaterialName = ko.observable();
  8. this.Unit = ko.observable();
  9. this.WarehouseId = ko.observable();
  10. this.WarehouseName = ko.observable();
  11. this.CurrentStoredCount = ko.observable();
  12. this.CurrentReleaseCount = ko.observable();
  13. this.CurrentCalcCount = ko.observable();
  14. this.LackCount = ko.observable();
  15. this.ReasonableStockCount = ko.observable();
  16. this.CurrentStoredPrice = ko.observable();
  17. this.CurrentReleasePrice = ko.observable();
  18. this.CurrentCalcPrice = ko.observable();
  19. if (data)
  20. this.fromJS(data);
  21. };
  22. $.extend(BemsWebApplication.FmsShortStockStatusViewViewModel.prototype, {
  23. toJS: function () {
  24. return {
  25. SiteId: this.SiteId(),
  26. BusinessFieldId: this.BusinessFieldId(),
  27. MaterialId: this.MaterialId(),
  28. MaterialCode: this.MaterialCode(),
  29. MaterialName:this.MaterialName(),
  30. Unit: this.Unit(),
  31. WarehouseId: this.WarehouseId(),
  32. WarehouseName: this.WarehouseName(),
  33. CurrentStoredCount: this.CurrentStoredCount(),
  34. CurrentReleaseCount: this.CurrentReleaseCount(),
  35. CurrentCalcCount: this.CurrentCalcCount(),
  36. LackCount: this.LackCount(),
  37. ReasonableStockCount: this.ReasonableStockCount(),
  38. CurrentStoredPrice: this.CurrentStoredPrice(),
  39. CurrentReleasePrice: this.CurrentReleasePrice(),
  40. CurrentCalcPrice: this.CurrentCalcPrice()
  41. };
  42. },
  43. fromJS: function (data) {
  44. if (data) {
  45. this.SiteId(data.SiteId);
  46. this.BusinessFieldId(data.BusinessFieldId);
  47. this.MaterialId(data.MaterialId);
  48. this.MaterialCode(data.MaterialCode);
  49. this.MaterialName(data.MaterialName);
  50. this.Unit(data.Unit);
  51. this.WarehouseId(data.WarehouseId);
  52. this.WarehouseName(data.WarehouseName);
  53. this.CurrentStoredCount(data.CurrentStoredCount);
  54. this.CurrentReleaseCount(data.CurrentReleaseCount);
  55. this.CurrentCalcCount(data.CurrentCalcCount);
  56. this.LackCount(data.LackCount);
  57. this.ReasonableStockCount(data.ReasonableStockCount);
  58. this.CurrentStoredPrice(data.CurrentStoredPrice());
  59. this.CurrentReleasePrice(data.CurrentReleasePrice());
  60. this.CurrentCalcPrice(data.CurrentCalcPrice());
  61. }
  62. }
  63. });
  64. })();