diff --git a/app/Database/dbms_init_all.sql b/app/Database/dbms_init_all.sql index 0d95d00..8f5949e 100644 --- a/app/Database/dbms_init_all.sql +++ b/app/Database/dbms_init_all.sql @@ -568,6 +568,7 @@ CREATE TABLE `serviceinfo` ( `user_uid` int(11) NOT NULL COMMENT '관리자정보', `switchinfo_uid` int(11) NOT NULL COMMENT 'switch코드', `codeinfo_uid` int(11) NOT NULL COMMENT 'server코드', + `code` varchar(20) DEFAULT NULL, `location` varchar(20) DEFAULT NULL, `type` varchar(20) NOT NULL, `raid` varchar(20) NOT NULL, @@ -578,6 +579,7 @@ CREATE TABLE `serviceinfo` ( `created_at` timestamp NOT NULL DEFAULT current_timestamp(), `deleted_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`uid`), + UNIQUE KEY `UQ_code` (`code`), KEY `FK_clientinfo_TO_serviceinfo` (`clientinfo_uid`), KEY `FK_user_TO_serviceinfo` (`user_uid`), CONSTRAINT `FK_clientinfo_TO_serviceinfo` FOREIGN KEY (`clientinfo_uid`) REFERENCES `clientinfo` (`uid`), @@ -591,7 +593,7 @@ CREATE TABLE `serviceinfo` ( LOCK TABLES `serviceinfo` WRITE; /*!40000 ALTER TABLE `serviceinfo` DISABLE KEYS */; -INSERT INTO `serviceinfo` VALUES (1,1,1,1,9,8,'tokyo','defence','RAID1','2025-07-22','2025-06-02','default','2025-06-30 02:36:42','2025-06-02 03:37:30',NULL),(2,2,3,1,8,6,'default','default','default','2025-07-18','2025-06-04','default','2025-06-26 04:15:32','2025-06-09 08:23:13',NULL),(3,4,4,1,6,7,'default','dedicated','RAID5','2025-07-14','2025-06-04','default','2025-06-30 02:36:21','2025-06-11 08:20:37',NULL),(4,5,7,1,5,4,'default','alternative','RAID1','2025-06-21','2025-06-19','default','2025-06-26 04:15:09','2025-06-20 01:03:04',NULL),(5,6,6,1,1,3,'tokyo','test','RAID5','2025-06-25','2025-06-20','default','2025-06-26 04:07:07','2025-06-20 04:45:04',NULL),(6,8,8,1,2,1,'default','test','RAID1','2025-07-26','2025-06-25','default','2025-06-26 04:06:56','2025-06-25 09:46:24',NULL); +INSERT INTO `serviceinfo` VALUES (1,1,1,1,9,8,'Test001','tokyo','defence','RAID1','2025-07-22','2025-06-02','default','2025-06-30 02:36:42','2025-06-02 03:37:30',NULL),(2,2,3,1,8,6,'Test002','default','default','default','2025-07-18','2025-06-04','default','2025-06-26 04:15:32','2025-06-09 08:23:13',NULL),(3,4,4,1,6,7,'Test003','default','dedicated','RAID5','2025-07-14','2025-06-04','default','2025-06-30 02:36:21','2025-06-11 08:20:37',NULL),(4,5,7,1,5,4,'Test004','default','alternative','RAID1','2025-06-21','2025-06-19','default','2025-06-26 04:15:09','2025-06-20 01:03:04',NULL),(5,6,6,1,1,3,'Test005','tokyo','test','RAID5','2025-06-25','2025-06-20','default','2025-06-26 04:07:07','2025-06-20 04:45:04',NULL),(6,8,8,1,2,1,'Test006','default','test','RAID1','2025-07-26','2025-06-25','default','2025-06-26 04:06:56','2025-06-25 09:46:24',NULL); /*!40000 ALTER TABLE `serviceinfo` ENABLE KEYS */; UNLOCK TABLES; @@ -838,4 +840,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2025-07-08 12:55:47 +-- Dump completed on 2025-07-08 16:33:41 diff --git a/app/Database/erp2_2.vuerd.json b/app/Database/erp2_2.vuerd.json index 6722a2a..158d685 100644 --- a/app/Database/erp2_2.vuerd.json +++ b/app/Database/erp2_2.vuerd.json @@ -4,8 +4,8 @@ "settings": { "width": 3000, "height": 3000, - "scrollTop": -655.903, - "scrollLeft": -1430.7592, + "scrollTop": -1064.2363, + "scrollLeft": -958.7592, "zoomLevel": 0.76, "show": 511, "database": 4, @@ -820,7 +820,7 @@ "Vf3bNvvEPfu1zCs4rcHTU", "PLQrLZGFiiPQDZSYpU-Rc", "9DIj0WNLrGT8VCHZuRkCz", - "SGWWOOHjCF81V4O5tUiJu", + "1ZM86qoxmCcoKnqOpE2oj", "uuDbJDSDQLey7Km1W9hlJ", "Gb6fmS40Q3wvnvD1HMTqR", "FJtEzmrQUsMMbrWbzr8IR", @@ -850,6 +850,7 @@ "O7aGU_LJxCO1NeNVWbB-J", "PLQrLZGFiiPQDZSYpU-Rc", "9DIj0WNLrGT8VCHZuRkCz", + "1ZM86qoxmCcoKnqOpE2oj", "SGWWOOHjCF81V4O5tUiJu", "uuDbJDSDQLey7Km1W9hlJ", "Gb6fmS40Q3wvnvD1HMTqR", @@ -874,7 +875,7 @@ "color": "" }, "meta": { - "updateAt": 1750900805222, + "updateAt": 1751959972410, "createAt": 1748485662214 } }, @@ -7710,6 +7711,26 @@ "updateAt": 1751945842697, "createAt": 1751880475984 } + }, + "1ZM86qoxmCcoKnqOpE2oj": { + "id": "1ZM86qoxmCcoKnqOpE2oj", + "tableId": "B8haiEbPc1lRBWTv1g25G", + "name": "code", + "comment": "서비스코드", + "dataType": "VARCHAR(20)", + "default": "", + "options": 12, + "ui": { + "keys": 0, + "widthName": 60, + "widthComment": 62, + "widthDataType": 75, + "widthDefault": 60 + }, + "meta": { + "updateAt": 1751959588755, + "createAt": 1751959574914 + } } }, "relationshipEntities": { @@ -7900,7 +7921,7 @@ "columnIds": [ "NzxkmndrTbH7xb6fbnGV7" ], - "x": 1457.1138999999998, + "x": 1451.1138999999998, "y": 1057.9058, "direction": 2 }, @@ -7956,7 +7977,7 @@ "columnIds": [ "f1hR1JRFHBHwiJSSX34gw" ], - "x": 1457.1138999999998, + "x": 1451.1138999999998, "y": 1173.9058, "direction": 2 }, @@ -7975,7 +7996,7 @@ "columnIds": [ "N_yJVoCN4oUEDhYqdzApb" ], - "x": 1197.1138999999998, + "x": 1194.1138999999998, "y": 1463.9058, "direction": 8 }, @@ -8068,7 +8089,7 @@ "columnIds": [ "Vf3bNvvEPfu1zCs4rcHTU" ], - "x": 1197.1138999999998, + "x": 1194.1138999999998, "y": 999.9058, "direction": 4 }, @@ -8124,7 +8145,7 @@ "columnIds": [ "PLQrLZGFiiPQDZSYpU-Rc" ], - "x": 1457.1138999999998, + "x": 1451.1138999999998, "y": 1289.9058, "direction": 2 }, @@ -8152,7 +8173,7 @@ "columnIds": [ "9DIj0WNLrGT8VCHZuRkCz" ], - "x": 1457.1138999999998, + "x": 1451.1138999999998, "y": 1405.9058, "direction": 2 }, diff --git a/app/Entities/Customer/ServiceEntity.php b/app/Entities/Customer/ServiceEntity.php index d2db41d..0922d00 100644 --- a/app/Entities/Customer/ServiceEntity.php +++ b/app/Entities/Customer/ServiceEntity.php @@ -9,6 +9,10 @@ class ServiceEntity extends CustomerEntity { const PK = ServiceModel::PK; const TITLE = ServiceModel::TITLE; + public function getCode(): string + { + return $this->attributes['code'] ?? "null"; + } final public function getOwnerUID(): int { return intval($this->attributes['ownerinfo_uid']); @@ -25,10 +29,6 @@ class ServiceEntity extends CustomerEntity { return $this->attributes['codeinfo_uid']; } - public function getTitle(): string - { - return "S" . $this->getPK(); - } public function getType(): string { return $this->attributes['type']; diff --git a/app/Helpers/Customer/ServiceHelper.php b/app/Helpers/Customer/ServiceHelper.php index 448108d..9ea0939 100644 --- a/app/Helpers/Customer/ServiceHelper.php +++ b/app/Helpers/Customer/ServiceHelper.php @@ -157,6 +157,9 @@ class ServiceHelper extends CustomerHelper public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string { switch ($action) { + case 'modify': + $action = parent::getListButton($action, $viewDatas['entity']->getCode(), $viewDatas, $extras); + break; case 'history': $extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras]; $action = form_label( diff --git a/app/Language/en/Customer/Service.php b/app/Language/en/Customer/Service.php index 35f480f..31dccde 100644 --- a/app/Language/en/Customer/Service.php +++ b/app/Language/en/Customer/Service.php @@ -5,7 +5,7 @@ return [ 'clientinfo_uid' => "고객", 'ownerinfo_uid' => "관리자", 'user_uid' => "작업자", - 'title' => "서비스명", + 'code' => "서비스코드", 'type' => "서비스형식", 'location' => "위치", 'switchinfo_uid' => "스위치코드", diff --git a/app/Models/Customer/ServiceModel.php b/app/Models/Customer/ServiceModel.php index a6fa5b3..d7be43d 100644 --- a/app/Models/Customer/ServiceModel.php +++ b/app/Models/Customer/ServiceModel.php @@ -8,7 +8,7 @@ class ServiceModel extends CustomerModel { const TABLE = "serviceinfo"; const PK = "uid"; - const TITLE = "uid"; + const TITLE = "code"; protected $table = self::TABLE; protected $primaryKey = self::PK; protected $returnType = ServiceEntity::class; @@ -16,10 +16,11 @@ class ServiceModel extends CustomerModel "clientinfo_uid", "ownerinfo_uid", "user_uid", - "type", - "location", "switchinfo_uid", "codeinfo_uid", + "code", + "type", + "location", "raid", "billing_at", "start_at", @@ -43,6 +44,9 @@ class ServiceModel extends CustomerModel case "codeinfo_uid": $rule = "required|numeric"; break; + case "code": + $rule = "if_exist|trim|string"; + break; case "type": case "location": case "status": @@ -61,4 +65,12 @@ class ServiceModel extends CustomerModel } return $rule; } + //Create용 + protected function create_process(array $formDatas): ServiceEntity + { + $entity = parent::create_process($formDatas); + //고객코드 Code 자동 생성 후 수정 + $code = 'S' . str_pad($entity->getPK(), 8, '0', STR_PAD_LEFT); + return $this->modify($entity, ['code' => $code]); + } } diff --git a/app/Services/Customer/CustomerService.php b/app/Services/Customer/CustomerService.php index b650eba..dae9967 100644 --- a/app/Services/Customer/CustomerService.php +++ b/app/Services/Customer/CustomerService.php @@ -19,7 +19,6 @@ use App\Services\UserService; abstract class CustomerService extends CommonService { - private $_clientOptions = []; private ?UserService $_userService = null; private ?ClientService $_clientService = null; private $_equipmentService = []; @@ -105,13 +104,6 @@ abstract class CustomerService extends CommonService } return $this->_equipmentService[$key]; } - final public function getClientOptions(): array - { - if ($this->_clientOptions === null) { - $this->_clientOptions = $this->getClientService()->getEntities(); - } - return $this->_clientOptions; - } //기본기능 //FieldForm관련용 public function getFormFieldOption(string $field, array $options = []): array @@ -119,7 +111,7 @@ abstract class CustomerService extends CommonService switch ($field) { case 'clientinfo_uid': case 'ownerinfo_uid': - $options = $this->getClientOptions(); + $options = $this->getClientService()->getEntities(); break; case 'serviceinfo_uid': $options = $this->getServiceService()->getEntities();