38cc28159e40c210a0827298170641fb8e1b54a4.svn-base 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. $(function () {
  2. 'use strict';
  3. BemsWebApplication.Factory.Equipment = {
  4. getBasicDataSourceRef: function (options) {
  5. var dbModeIId = options.dbModeIId,
  6. primaryKeyDataField = options.primaryKeyDataField,
  7. moreSelectFields = options.moreSelectFields,
  8. expand = [
  9. 'FmsEquipment',
  10. 'FmsEquipmentRentInfo',
  11. 'FmsEquipmentRentInfo/CmUser1',
  12. 'FmsEquipmentCodeStateType',
  13. 'FmsEquipment/FmsEquipmentCodeType',
  14. //hcLee 2016 01 13
  15. 'FmsEquipment/FmsMaterialWarehouse',
  16. //'FmsEquipment/FmsMaterialWarehouse',
  17. ]
  18. ;
  19. var select = [
  20. 'SiteId',
  21. primaryKeyDataField,
  22. 'EquipmentId',
  23. 'TotalStockCount',
  24. 'CurrentStockCount',
  25. 'RentCount',
  26. 'CurrentRentCount',
  27. 'ReturnCount',
  28. 'LossCount',
  29. 'StoredCount',
  30. 'EquipmentRentId',
  31. 'EquipmentStateTypeId',
  32. 'AddDate',
  33. 'UpdateDate',
  34. 'FmsEquipment/FmsEquipmentCodeType/Name',
  35. 'FmsEquipment/WarehouseId',
  36. 'FmsEquipment/Unit',
  37. 'FmsEquipment/Standard',
  38. 'FmsEquipment/Name',
  39. 'FmsEquipmentCodeStateType/Name',
  40. 'FmsEquipment/Standard',
  41. 'FmsEquipmentRentInfo/Title',
  42. 'FmsEquipmentRentInfo/CmUser1/Name', // 대여자
  43. 'FmsEquipmentRentInfo/RentDate',
  44. 'FmsEquipmentRentInfo/ReturnDueDate',
  45. 'FmsEquipmentRentInfo/ReturnFixDate',
  46. //hcLee 2016 01 13
  47. //'FmsEquipmentRentInfo/FmsMaterialWarehouse/Name',
  48. 'FmsEquipment/FmsMaterialWarehouse/Name',
  49. ];
  50. if (_.isArray(moreSelectFields)) {
  51. select = select.concat(moreSelectFields);
  52. }
  53. if (_.isArray(options.expand)) {
  54. expand = expand.concat(options.expand);
  55. }
  56. return BWA.DataUtil.createDataSource({
  57. dataSourceOptions: {
  58. paginate: false, // 전체를 모두 가져옴
  59. select: select,
  60. expand: expand,
  61. extendOptions: {
  62. forceOriginalField: true,
  63. alterNames: {
  64. 'FmsEquipment/Name': 'Name'
  65. }
  66. },
  67. sort: { field: "EquipmentHistoryId", desc: true },
  68. }
  69. }, dbModeIId);
  70. },
  71. getDataSourceWithRelation: function (store, options) {
  72. return BWA.Factory.getBaseDataSourceWithRelation(
  73. store,
  74. options,
  75. BWA.Factory.Equipment.getDataSourceForRefDataGrid(),
  76. 'FmsEquipment');
  77. },
  78. getDataSourceForDataGrid: function () {
  79. return {
  80. select: [
  81. 'SiteId',
  82. //'BusinessFieldId',
  83. 'EquipmentId',
  84. 'Name',
  85. 'EquipmentTypeId',
  86. 'WarehouseId',
  87. 'Unit',
  88. 'Standard',
  89. 'AddDate',
  90. 'UpdateDate',
  91. 'RegisterUserId',
  92. 'SupplierName',
  93. 'SupplierPhoneNo'
  94. // ,
  95. //'FmsMaterialCodeType/Name',
  96. //'FmsMaterialWarehouse/Name',
  97. //'FmsMaterialTradeCompany/Name'
  98. ],
  99. //expand: ['CmBusinessField', 'FmsMaterialCodeLocation', 'FmsMaterialCodeType', 'FmsMaterialWarehouse', 'FmsMaterialTradeCompany'],
  100. //filter: [
  101. // ['SiteId', '=', BWA.UserInfo.SiteId()],
  102. // 'and',
  103. // [
  104. // ['BusinessFieldId', '=', BWA.UserInfo.BusinessFieldId()],
  105. // 'or',
  106. // ['BusinessFieldId', '=', 1],
  107. // ]
  108. //],
  109. //extendOptions: {
  110. // multipleItems: [
  111. // {
  112. // id: 'MaterialClassId',
  113. // entries: ['FmsMaterialCodeClass', 'FmsMaterialCodeClass1', 'FmsMaterialCodeClass2'],
  114. // fields: ['FirstClassId', 'SecondClassId', 'ThirdClassId'],
  115. // }
  116. // ],
  117. // forceOriginalField: true,
  118. // alterNames: {
  119. // 'FmsMaterialCodeClass/FirstClassId/Name': 'FirstClassName',
  120. // 'FmsMaterialCodeClass/SecondClassId/Name': 'SecondClassName',
  121. // 'FmsMaterialCodeClass/ThirdClassId/Name': 'ThirdClassName',
  122. // }
  123. //},
  124. sort: { field: "EquipmentId", desc: true }
  125. };
  126. },
  127. //getDataSourceForRefDataGrid: function () {
  128. // return {
  129. // select: [
  130. // 'SiteId', 'BusinessFieldId', 'MaterialId', 'MaterialCode', 'Name', 'Unit', 'MaterialCode', 'Standard',
  131. // 'FinalPrice', 'DurableYears', 'CmBusinessField/Name'
  132. // ],
  133. // expand: ['CmBusinessField'],
  134. // filter: [
  135. // ['SiteId', '=', BWA.UserInfo.SiteId()]
  136. // ],
  137. // extendOptions: {
  138. // forceOriginalField: true
  139. // }
  140. // };
  141. //},
  142. defaultColumns: [
  143. { dataField: 'Number', caption: $G('number'), width: '10%', alignment: 'center', allowFiltering: false },
  144. { dataField: 'Name', caption: $G('name'), width: '15%', alignment: 'center' },
  145. //{ dataField: 'Unit', caption: $G('materialUnit'), width: '10%', alignment: 'center' },
  146. //{ dataField: 'Standard', caption: $G('materialStandard'), width: '10%', alignment: 'center' },
  147. ],
  148. };
  149. $.extend(BWA.Factory.Equipment, BWA.DataUtil.pickFunctions(BWA.Equipment));
  150. });