123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- $(function () {
- 'use strict';
- BemsWebApplication.Factory.Equipment = {
- getBasicDataSourceRef: function (options) {
- var dbModeIId = options.dbModeIId,
- primaryKeyDataField = options.primaryKeyDataField,
- moreSelectFields = options.moreSelectFields,
- expand = [
- 'FmsEquipment',
- 'FmsEquipmentRentInfo',
- 'FmsEquipmentRentInfo/CmUser1',
- 'FmsEquipmentCodeStateType',
- 'FmsEquipment/FmsEquipmentCodeType',
- //hcLee 2016 01 13
- 'FmsEquipment/FmsMaterialWarehouse',
- //'FmsEquipment/FmsMaterialWarehouse',
- ]
- ;
- var select = [
- 'SiteId',
- primaryKeyDataField,
- 'EquipmentId',
- 'TotalStockCount',
- 'CurrentStockCount',
- 'RentCount',
- 'CurrentRentCount',
- 'ReturnCount',
- 'LossCount',
- 'StoredCount',
- 'EquipmentRentId',
- 'EquipmentStateTypeId',
- 'AddDate',
- 'UpdateDate',
- 'FmsEquipment/FmsEquipmentCodeType/Name',
- 'FmsEquipment/WarehouseId',
- 'FmsEquipment/Unit',
- 'FmsEquipment/Standard',
- 'FmsEquipment/Name',
- 'FmsEquipmentCodeStateType/Name',
- 'FmsEquipment/Standard',
- 'FmsEquipmentRentInfo/Title',
- 'FmsEquipmentRentInfo/CmUser1/Name', // 대여자
- 'FmsEquipmentRentInfo/RentDate',
- 'FmsEquipmentRentInfo/ReturnDueDate',
- 'FmsEquipmentRentInfo/ReturnFixDate',
- //hcLee 2016 01 13
- //'FmsEquipmentRentInfo/FmsMaterialWarehouse/Name',
- 'FmsEquipment/FmsMaterialWarehouse/Name',
- ];
- if (_.isArray(moreSelectFields)) {
- select = select.concat(moreSelectFields);
- }
- if (_.isArray(options.expand)) {
- expand = expand.concat(options.expand);
- }
- return BWA.DataUtil.createDataSource({
- dataSourceOptions: {
- paginate: false, // 전체를 모두 가져옴
- select: select,
- expand: expand,
- extendOptions: {
- forceOriginalField: true,
- alterNames: {
- 'FmsEquipment/Name': 'Name'
- }
- },
- sort: { field: "EquipmentHistoryId", desc: true },
- }
- }, dbModeIId);
- },
- getDataSourceWithRelation: function (store, options) {
- return BWA.Factory.getBaseDataSourceWithRelation(
- store,
- options,
- BWA.Factory.Equipment.getDataSourceForRefDataGrid(),
- 'FmsEquipment');
- },
- getDataSourceForDataGrid: function () {
- return {
- select: [
- 'SiteId',
- //'BusinessFieldId',
- 'EquipmentId',
- 'Name',
- 'EquipmentTypeId',
- 'WarehouseId',
- 'Unit',
- 'Standard',
- 'AddDate',
- 'UpdateDate',
- 'RegisterUserId',
- 'SupplierName',
- 'SupplierPhoneNo'
- // ,
- //'FmsMaterialCodeType/Name',
- //'FmsMaterialWarehouse/Name',
- //'FmsMaterialTradeCompany/Name'
- ],
- //expand: ['CmBusinessField', 'FmsMaterialCodeLocation', 'FmsMaterialCodeType', 'FmsMaterialWarehouse', 'FmsMaterialTradeCompany'],
- //filter: [
- // ['SiteId', '=', BWA.UserInfo.SiteId()],
- // 'and',
- // [
- // ['BusinessFieldId', '=', BWA.UserInfo.BusinessFieldId()],
- // 'or',
- // ['BusinessFieldId', '=', 1],
- // ]
- //],
- //extendOptions: {
- // multipleItems: [
- // {
- // id: 'MaterialClassId',
- // entries: ['FmsMaterialCodeClass', 'FmsMaterialCodeClass1', 'FmsMaterialCodeClass2'],
- // fields: ['FirstClassId', 'SecondClassId', 'ThirdClassId'],
- // }
- // ],
- // forceOriginalField: true,
- // alterNames: {
- // 'FmsMaterialCodeClass/FirstClassId/Name': 'FirstClassName',
- // 'FmsMaterialCodeClass/SecondClassId/Name': 'SecondClassName',
- // 'FmsMaterialCodeClass/ThirdClassId/Name': 'ThirdClassName',
- // }
- //},
- sort: { field: "EquipmentId", desc: true }
- };
- },
- //getDataSourceForRefDataGrid: function () {
- // return {
- // select: [
- // 'SiteId', 'BusinessFieldId', 'MaterialId', 'MaterialCode', 'Name', 'Unit', 'MaterialCode', 'Standard',
- // 'FinalPrice', 'DurableYears', 'CmBusinessField/Name'
- // ],
- // expand: ['CmBusinessField'],
- // filter: [
- // ['SiteId', '=', BWA.UserInfo.SiteId()]
- // ],
- // extendOptions: {
- // forceOriginalField: true
- // }
- // };
- //},
- defaultColumns: [
- { dataField: 'Number', caption: $G('number'), width: '10%', alignment: 'center', allowFiltering: false },
- { dataField: 'Name', caption: $G('name'), width: '15%', alignment: 'center' },
- //{ dataField: 'Unit', caption: $G('materialUnit'), width: '10%', alignment: 'center' },
- //{ dataField: 'Standard', caption: $G('materialStandard'), width: '10%', alignment: 'center' },
- ],
- };
- $.extend(BWA.Factory.Equipment, BWA.DataUtil.pickFunctions(BWA.Equipment));
- });
|