commit 7783e965fd285811da1b36c888a7945188fba2ed Author: yi <100551693+yi1108@users.noreply.github.com> Date: Wed Jun 10 14:01:56 2026 +0800 chore: re-initialize git repository for deployment diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d057e21 --- /dev/null +++ b/.gitignore @@ -0,0 +1,93 @@ +# --- Python --- +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +*.egg +*.egg-info/ +.eggs/ +dist/ +build/ +pip-log.txt +pip-delete-this-directory.txt + +# Virtual environments +.venv/ +venv/ +ENV/ +env/ +.python-version + +# --- Django --- +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Collected static (if STATIC_ROOT differs from source) +staticfiles/ +collected_static/ + +# Compiled translations (generate via compilemessages) +*.mo + +# --- Environment & secrets --- +.env +.env.* +!.env.example +*.pem +*.key + +# --- IDE / Editor --- +.idea/ +.vscode/ +*.sublime-project +*.sublime-workspace +*.swp +*.swo +*~ + +# --- OS --- +.DS_Store +.DS_Store? +Thumbs.db +ehthumbs.db +desktop.ini + +# --- Cursor / local workflow --- +.cursor/ +.work/ + +# --- Test & coverage --- +.coverage +.coverage.* +htmlcov/ +.tox/ +.nox/ +.pytest_cache/ +.mypy_cache/ +.dmypy.json +dmypy.json + +# --- Docker (local overrides & volumes) --- +docker-compose.override.yml +docker-compose.local.yml +*.volume/ + +# --- User uploads (MEDIA_ROOT) --- +# Keep template docs under upload/doc/ +upload/data/* +!upload/data/.gitkeep +upload/inventory/* +!upload/inventory/.gitkeep +upload/project/* +!upload/project/.gitkeep +upload/offer sheet/* +!upload/offer sheet/.gitkeep + +# --- Misc --- +*.bak +*.tmp +*.orig +.work/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cff5448 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM python:2.7-slim + +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# Set work directory +WORKDIR /app + +# Install Python dependencies +# Using PyMySQL which is pure python, so we might not need gcc/mysql-client-dev +COPY Install/requirements.txt /app/Install/requirements.txt +RUN pip install --no-cache-dir -r Install/requirements.txt + +# Copy project +COPY . /app/ + +# Expose port +EXPOSE 8000 + +# Run server +CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] diff --git a/Install/SQL/mis.sql b/Install/SQL/mis.sql new file mode 100644 index 0000000..0bdae69 --- /dev/null +++ b/Install/SQL/mis.sql @@ -0,0 +1,2413 @@ +/* +SQLyog 企业版 - MySQL GUI v8.14 +MySQL - 5.1.55-community : Database - mis +********************************************************************* +*/ + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/`mis` /*!40100 DEFAULT CHARACTER SET utf8 */; + +USE `mis`; + +/*Table structure for table `auth_group` */ + +DROP TABLE IF EXISTS `auth_group`; + +CREATE TABLE `auth_group` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(80) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; + +/*Data for the table `auth_group` */ + +insert into `auth_group`(`id`,`name`) values (2,'人事'),(3,'库存'),(5,'经理'),(1,'职员'),(6,'财务'),(4,'采购'); + +/*Table structure for table `auth_group_permissions` */ + +DROP TABLE IF EXISTS `auth_group_permissions`; + +CREATE TABLE `auth_group_permissions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `group_id` int(11) NOT NULL, + `permission_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `group_id` (`group_id`,`permission_id`), + KEY `auth_group_permissi_permission_id_23962d04_fk_auth_permission_id` (`permission_id`), + CONSTRAINT `auth_group_permissions_group_id_58c48ba9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), + CONSTRAINT `auth_group_permissi_permission_id_23962d04_fk_auth_permission_id` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=823 DEFAULT CHARSET=utf8; + +/*Data for the table `auth_group_permissions` */ + +insert into `auth_group_permissions`(`id`,`group_id`,`permission_id`) values (770,1,11),(776,1,37),(777,1,38),(778,1,39),(779,1,41),(780,1,43),(781,1,44),(782,1,45),(784,1,47),(786,1,50),(787,1,53),(788,1,55),(789,1,56),(790,1,57),(791,1,61),(792,1,62),(793,1,76),(794,1,77),(795,1,78),(796,1,80),(797,1,85),(798,1,86),(799,1,89),(800,1,91),(801,1,92),(802,1,93),(803,1,94),(804,1,95),(805,1,96),(806,1,97),(807,1,98),(808,1,99),(811,1,113),(812,1,114),(813,1,117),(814,1,119),(815,1,120),(816,1,121),(817,1,122),(818,1,123),(819,1,124),(820,1,125),(821,1,126),(822,1,127),(761,1,128),(762,1,129),(763,1,130),(764,1,131),(765,1,132),(766,1,133),(767,1,134),(768,1,135),(769,1,136),(771,1,154),(773,1,162),(774,1,163),(775,1,164),(783,1,174),(772,1,175),(785,1,176),(809,1,234),(810,1,235),(45,2,115),(355,3,58),(356,3,59),(357,3,60),(358,3,61),(359,3,62),(360,3,63),(361,3,79),(362,3,80),(363,3,81),(364,3,82),(365,3,83),(366,3,84),(335,3,156),(336,3,157),(337,3,158),(338,3,159),(339,3,160),(340,3,161),(341,3,162),(342,3,163),(343,3,164),(344,3,168),(345,3,169),(346,3,170),(347,3,171),(348,3,172),(349,3,173),(350,3,174),(351,3,175),(352,3,176),(353,3,178),(354,3,181),(525,4,40),(526,4,41),(527,4,177),(528,4,178),(529,4,179),(530,4,180),(531,4,181),(532,4,182),(533,4,186); + +/*Table structure for table `auth_permission` */ + +DROP TABLE IF EXISTS `auth_permission`; + +CREATE TABLE `auth_permission` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) DEFAULT NULL, + `content_type_id` int(11) NOT NULL, + `codename` varchar(100) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `content_type_id` (`content_type_id`,`codename`), + CONSTRAINT `auth_permissi_content_type_id_51277a81_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=237 DEFAULT CHARSET=utf8; + +/*Data for the table `auth_permission` */ + +insert into `auth_permission`(`id`,`name`,`content_type_id`,`codename`) values (1,'Can add log entry',1,'add_logentry'),(2,'Can change log entry',1,'change_logentry'),(3,'Can delete log entry',1,'delete_logentry'),(4,'Can add permission',2,'add_permission'),(5,'Can change permission',2,'change_permission'),(6,'Can delete permission',2,'delete_permission'),(7,'Can add group',3,'add_group'),(8,'Can change group',3,'change_group'),(9,'Can delete group',3,'delete_group'),(10,'Can add user',4,'add_user'),(11,'Can change user',4,'change_user'),(12,'Can delete user',4,'delete_user'),(13,'Can add content type',5,'add_contenttype'),(14,'Can change content type',5,'change_contenttype'),(15,'Can delete content type',5,'delete_contenttype'),(16,'Can add session',6,'add_session'),(17,'Can change session',6,'change_session'),(18,'Can delete session',6,'delete_session'),(19,'Can add Site',7,'add_site'),(20,'Can change Site',7,'change_site'),(21,'Can delete Site',7,'delete_site'),(22,'Can add module',8,'add_module'),(23,'Can change module',8,'change_module'),(24,'Can delete module',8,'delete_module'),(25,'Can add menu',9,'add_menu'),(26,'Can change menu',9,'change_menu'),(27,'Can delete menu',9,'delete_menu'),(28,'Can add role',10,'add_role'),(29,'Can change role',10,'change_role'),(30,'Can delete role',10,'delete_role'),(31,'Can add value list',11,'add_valuelist'),(32,'Can change value list',11,'change_valuelist'),(33,'Can delete value list',11,'delete_valuelist'),(34,'Can add list item',12,'add_valuelistitem'),(35,'Can change list item',12,'change_valuelistitem'),(36,'Can delete list item',12,'delete_valuelistitem'),(37,'Can add address',13,'add_address'),(38,'Can change address',13,'change_address'),(39,'Can delete address',13,'delete_address'),(40,'Can add partner',14,'add_partner'),(41,'Can change partner',14,'change_partner'),(42,'Can delete partner',14,'delete_partner'),(43,'Can add bank account',15,'add_bankaccount'),(44,'Can change bank account',15,'change_bankaccount'),(45,'Can delete bank account',15,'delete_bankaccount'),(46,'Can add organization',16,'add_organization'),(47,'Can change organization',16,'change_organization'),(48,'Can delete organization',16,'delete_organization'),(49,'Can add org unit',17,'add_orgunit'),(50,'Can change org unit',17,'change_orgunit'),(51,'Can delete org unit',17,'delete_orgunit'),(52,'Can add position',18,'add_position'),(53,'Can change position',18,'change_position'),(54,'Can delete position',18,'delete_position'),(55,'Can add project',19,'add_project'),(56,'Can change project',19,'change_project'),(57,'Can delete project',19,'delete_project'),(58,'Can add warehouse',20,'add_warehouse'),(59,'Can change warehouse',20,'change_warehouse'),(60,'Can delete warehouse',20,'delete_warehouse'),(61,'Can add measure',21,'add_measure'),(62,'Can change measure',21,'change_measure'),(63,'Can delete measure',21,'delete_measure'),(64,'Can add trade',22,'add_trade'),(65,'Can change trade',22,'change_trade'),(66,'Can delete trade',22,'delete_trade'),(67,'Can add brand',23,'add_brand'),(68,'Can change brand',23,'change_brand'),(69,'Can delete brand',23,'delete_brand'),(70,'Can add category',24,'add_category'),(71,'Can change category',24,'change_category'),(72,'Can delete category',24,'delete_category'),(73,'Can add technical parameter',25,'add_technicalparametername'),(74,'Can change technical parameter',25,'change_technicalparametername'),(75,'Can delete technical parameter',25,'delete_technicalparametername'),(76,'Can add technical value',26,'add_technicalparametervalue'),(77,'Can change technical value',26,'change_technicalparametervalue'),(78,'Can delete technical value',26,'delete_technicalparametervalue'),(79,'Can add material',27,'add_material'),(80,'Can change material',27,'change_material'),(81,'Can delete material',27,'delete_material'),(82,'Can add material parameter',28,'add_materialparam'),(83,'Can change material parameter',28,'change_materialparam'),(84,'Can delete material parameter',28,'delete_materialparam'),(85,'Can add expenses account',29,'add_expenseaccount'),(86,'Can change expenses account',29,'change_expenseaccount'),(87,'Can delete expenses account',29,'delete_expenseaccount'),(88,'Can add employee',30,'add_employee'),(89,'Can change employee',30,'change_employee'),(90,'Can delete employee',30,'delete_employee'),(91,'Can add family member',31,'add_family'),(92,'Can change family member',31,'change_family'),(93,'Can delete family member',31,'delete_family'),(94,'Can add education experience',32,'add_education'),(95,'Can change education experience',32,'change_education'),(96,'Can delete education experience',32,'delete_education'),(97,'Can add work experience',33,'add_workexperience'),(98,'Can change work experience',33,'change_workexperience'),(99,'Can delete work experience',33,'delete_workexperience'),(100,'Can add workflow model',34,'add_modal'),(101,'Can change workflow model',34,'change_modal'),(102,'Can delete workflow model',34,'delete_modal'),(103,'Can add workflow node',35,'add_node'),(104,'Can change workflow node',35,'change_node'),(105,'Can delete workflow node',35,'delete_node'),(106,'Can add workflow instance',36,'add_instance'),(107,'Can change workflow instance',36,'change_instance'),(108,'Can delete workflow instance',36,'delete_instance'),(109,'Can add workflow history',37,'add_history'),(110,'Can change workflow history',37,'change_history'),(111,'Can delete workflow history',37,'delete_history'),(112,'Can add workflow todo',38,'add_todolist'),(113,'Can change workflow todo',38,'change_todolist'),(114,'Can delete workflow todo',38,'delete_todolist'),(115,'view all employee',30,'view_all_employee'),(116,'Can add extra param',39,'add_extraparam'),(117,'Can change extra param',39,'change_extraparam'),(118,'Can delete extra param',39,'delete_extraparam'),(119,'Can add work order',40,'add_workorder'),(120,'Can change work order',40,'change_workorder'),(121,'Can delete work order',40,'delete_workorder'),(122,'Can add wo extra value',41,'add_woextravalue'),(123,'Can change wo extra value',41,'change_woextravalue'),(124,'Can delete wo extra value',41,'delete_woextravalue'),(125,'Can add wo item',42,'add_woitem'),(126,'Can change wo item',42,'change_woitem'),(127,'Can delete wo item',42,'delete_woitem'),(128,'Can add loan',43,'add_loan'),(129,'Can change loan',43,'change_loan'),(130,'Can delete loan',43,'delete_loan'),(131,'Can add reimbursement',44,'add_reimbursement'),(132,'Can change reimbursement',44,'change_reimbursement'),(133,'Can delete reimbursement',44,'delete_reimbursement'),(134,'Can add fee item ',45,'add_reimbursementitem'),(135,'Can change fee item ',45,'change_reimbursementitem'),(136,'Can delete fee item ',45,'delete_reimbursementitem'),(137,'Can add salary item',46,'add_salaryitem'),(138,'Can change salary item',46,'change_salaryitem'),(139,'Can delete salary item',46,'delete_salaryitem'),(140,'Can add employee entry',47,'add_entry'),(141,'Can change employee entry',47,'change_entry'),(142,'Can delete employee entry',47,'delete_entry'),(143,'Can add salary item',48,'add_employeesalaryitem'),(144,'Can change salary item',48,'change_employeesalaryitem'),(145,'Can delete salary item',48,'delete_employeesalaryitem'),(146,'Can add employee transfer',49,'add_transfer'),(147,'Can change employee transfer',49,'change_transfer'),(148,'Can delete employee transfer',49,'delete_transfer'),(149,'Can add employee departure',50,'add_departure'),(150,'Can change employee departure',50,'change_departure'),(151,'Can delete employee departure',50,'delete_departure'),(152,'modify salary item',47,'modify_salary_item'),(153,'Can add Inventory',51,'add_inventory'),(154,'Can change Inventory',51,'change_inventory'),(155,'Can delete Inventory',51,'delete_inventory'),(156,'Can add Initial Inventory',52,'add_initialinventory'),(157,'Can change Initial Inventory',52,'change_initialinventory'),(158,'Can delete Initial Inventory',52,'delete_initialinventory'),(159,'Can add StockIn',53,'add_stockin'),(160,'Can change StockIn',53,'change_stockin'),(161,'Can delete StockIn',53,'delete_stockin'),(162,'Can add StockOut',54,'add_stockout'),(163,'Can change StockOut',54,'change_stockout'),(164,'Can delete StockOut',54,'delete_stockout'),(165,'Can add in out detail',55,'add_inoutdetail'),(166,'Can change in out detail',55,'change_inoutdetail'),(167,'Can delete in out detail',55,'delete_inoutdetail'),(168,'Can add init item',56,'add_inititem'),(169,'Can change init item',56,'change_inititem'),(170,'Can delete init item',56,'delete_inititem'),(171,'Can add in item',57,'add_initem'),(172,'Can change in item',57,'change_initem'),(173,'Can delete in item',57,'delete_initem'),(174,'Can add out item',58,'add_outitem'),(175,'Can change out item',58,'change_outitem'),(176,'Can delete out item',58,'delete_outitem'),(177,'Can add purchase order',59,'add_purchaseorder'),(178,'Can change purchase order',59,'change_purchaseorder'),(179,'Can delete purchase order',59,'delete_purchaseorder'),(180,'Can add po item',60,'add_poitem'),(181,'Can change po item',60,'change_poitem'),(182,'Can delete po item',60,'delete_poitem'),(183,'view all customer',15,'view_all_customer'),(184,'view all supplier',15,'view_all_supplier'),(185,'view all customer',14,'view_all_customer'),(186,'view all supplier',14,'view_all_supplier'),(187,'Can add Invoice',61,'add_invoice'),(188,'Can change Invoice',61,'change_invoice'),(189,'Can delete Invoice',61,'delete_invoice'),(190,'Can add Payment',62,'add_payment'),(191,'Can change Payment',62,'change_payment'),(192,'Can delete Payment',62,'delete_payment'),(193,'Can add activity',63,'add_activity'),(194,'Can change activity',63,'change_activity'),(195,'Can delete activity',63,'delete_activity'),(196,'Can add feedback',64,'add_feedback'),(197,'Can change feedback',64,'change_feedback'),(198,'Can delete feedback',64,'delete_feedback'),(199,'Can add enroll',65,'add_enroll'),(200,'Can change enroll',65,'change_enroll'),(201,'Can delete enroll',65,'delete_enroll'),(202,'Can add sale order',66,'add_saleorder'),(203,'Can change sale order',66,'change_saleorder'),(204,'Can delete sale order',66,'delete_saleorder'),(205,'Can add order detail',67,'add_saleitem'),(206,'Can change order detail',67,'change_saleitem'),(207,'Can delete order detail',67,'delete_saleitem'),(208,'Can add Payment Collection',68,'add_paymentcollection'),(209,'Can change Payment Collection',68,'change_paymentcollection'),(210,'Can delete Payment Collection',68,'delete_paymentcollection'),(211,'Can add offer sheet',69,'add_offersheet'),(212,'Can change offer sheet',69,'change_offersheet'),(213,'Can delete offer sheet',69,'delete_offersheet'),(214,'Can add offer detail',70,'add_offeritem'),(215,'Can change offer detail',70,'change_offeritem'),(216,'Can delete offer detail',70,'delete_offeritem'),(217,'Can add ware return',71,'add_warereturn'),(218,'Can change ware return',71,'change_warereturn'),(219,'Can delete ware return',71,'delete_warereturn'),(220,'Can add return item',72,'add_returnitem'),(221,'Can change return item',72,'change_returnitem'),(222,'Can delete return item',72,'delete_returnitem'),(223,'Can add ware adjust',73,'add_wareadjust'),(224,'Can change ware adjust',73,'change_wareadjust'),(225,'Can delete ware adjust',73,'delete_wareadjust'),(226,'Can add adjust item',74,'add_adjustitem'),(227,'Can change adjust item',74,'change_adjustitem'),(228,'Can delete adjust item',74,'delete_adjustitem'),(229,'Can add data import',75,'add_dataimport'),(230,'Can change data import',75,'change_dataimport'),(231,'Can delete data import',75,'delete_dataimport'),(232,'financial pay',43,'financial_pay'),(233,'financial pay',44,'financial_pay'),(234,'Can add document',76,'add_document'),(235,'Can change document',76,'change_document'),(236,'Can delete document',76,'delete_document'); + +/*Table structure for table `auth_user` */ + +DROP TABLE IF EXISTS `auth_user`; + +CREATE TABLE `auth_user` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `password` varchar(128) NOT NULL, + `last_login` datetime DEFAULT NULL, + `is_superuser` tinyint(1) NOT NULL, + `username` varchar(30) NOT NULL, + `first_name` varchar(30) NOT NULL, + `last_name` varchar(30) NOT NULL, + `email` varchar(254) DEFAULT NULL, + `is_staff` tinyint(1) NOT NULL, + `is_active` tinyint(1) NOT NULL, + `date_joined` datetime NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `username` (`username`) +) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8; + +/*Data for the table `auth_user` */ + +insert into `auth_user`(`id`,`password`,`last_login`,`is_superuser`,`username`,`first_name`,`last_name`,`email`,`is_staff`,`is_active`,`date_joined`) values (11,'pbkdf2_sha256$20000$65muyWSOyY0I$AJfRNDE6kHRx5nC+mpIokzi8SbBxOgkHvhUSV9aEsPs=','2015-07-30 21:20:26',1,'chengcai','才','成','chengcai@abc.com',1,1,'2015-06-28 06:07:28'),(12,'pbkdf2_sha256$20000$Aa8BLynbsEpp$pI4WoKbMcC6aMUWt0CMCsG+n4pCd1hU3en6rLrHhh8s=','2015-06-28 06:21:54',0,'admin','管理员','系统','admin@abc.com',1,1,'2015-06-28 06:21:16'),(13,'pbkdf2_sha256$20000$PEAP6nZQMRCd$tZYq/lxTE8D4AfxuTvDp6SwhXzhjlti1Md21z0sM+CQ=','2015-07-30 21:24:15',0,'zhangsan','张三','','',1,1,'2015-07-02 05:16:00'),(14,'pbkdf2_sha256$20000$JHBOGao9PQ8B$fkSipKaxiKPc1wSDF+goL3CTq9Vn8FChVwECsedyGAw=','2015-07-30 21:23:39',0,'lisi','李四','','',1,1,'2015-07-02 05:17:00'),(15,'pbkdf2_sha256$20000$y5ll1rcvxVCD$aVtFs/PauFR3SkhQER87nD8fYMTI79ix1mTzt5qYMpU=',NULL,0,'wangwu','王五','','',1,1,'2015-07-02 05:17:00'),(16,'pbkdf2_sha256$20000$8x5VhF4ohGFd$YEBmAxWAb8xkIBcbzsLLAgCNCoMt7hMQlO4K2v80isM=','2015-07-30 21:22:33',0,'dongyong','董永','','',1,1,'2015-07-02 05:17:00'),(17,'pbkdf2_sha256$20000$NR4ED19mIltP$nBnvpsnPPDdQniXIq/H2TRZny9KDo4w/LdM9yRRrJmk=','2015-07-15 12:06:07',0,'9001','曹菊芳','','caojf@163.com',1,1,'2015-07-15 12:04:17'); + +/*Table structure for table `auth_user_groups` */ + +DROP TABLE IF EXISTS `auth_user_groups`; + +CREATE TABLE `auth_user_groups` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `group_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`,`group_id`), + KEY `auth_user_groups_group_id_30a071c9_fk_auth_group_id` (`group_id`), + CONSTRAINT `auth_user_groups_group_id_30a071c9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), + CONSTRAINT `auth_user_groups_user_id_24702650_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; + +/*Data for the table `auth_user_groups` */ + +insert into `auth_user_groups`(`id`,`user_id`,`group_id`) values (15,12,1),(23,13,1),(21,14,1),(22,15,1),(20,16,1),(24,17,1); + +/*Table structure for table `auth_user_user_permissions` */ + +DROP TABLE IF EXISTS `auth_user_user_permissions`; + +CREATE TABLE `auth_user_user_permissions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `permission_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `user_id` (`user_id`,`permission_id`), + KEY `auth_user_user_perm_permission_id_3d7071f0_fk_auth_permission_id` (`permission_id`), + CONSTRAINT `auth_user_user_permissions_user_id_7cd7acb6_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `auth_user_user_perm_permission_id_3d7071f0_fk_auth_permission_id` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `auth_user_user_permissions` */ + +/*Table structure for table `basedata_address` */ + +DROP TABLE IF EXISTS `basedata_address`; + +CREATE TABLE `basedata_address` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `zipcode` varchar(8) DEFAULT NULL, + `address` varchar(120) DEFAULT NULL, + `phone` varchar(20) DEFAULT NULL, + `contacts` varchar(40) DEFAULT NULL, + `address_type` varchar(2), + `content_type_id` int(11), + `object_id` int(10) unsigned, + PRIMARY KEY (`id`), + KEY `basedata_address_417f1b1c` (`content_type_id`), + CONSTRAINT `basedata_addr_content_type_id_17983026_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_address` */ + +/*Table structure for table `basedata_bankaccount` */ + +DROP TABLE IF EXISTS `basedata_bankaccount`; + +CREATE TABLE `basedata_bankaccount` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `account` varchar(40) NOT NULL, + `title` varchar(40) NOT NULL, + `memo` varchar(20) DEFAULT NULL, + `partner_id` int(11) DEFAULT NULL, + `org_id` int(11), + PRIMARY KEY (`id`), + KEY `basedata_bankaccount_partner_id_561018ee_fk_basedata_partner_id` (`partner_id`), + KEY `basedata_bankaccount_9cf869aa` (`org_id`), + CONSTRAINT `basedata_bankaccount_org_id_6017321e_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `basedata_bankaccount_partner_id_561018ee_fk_basedata_partner_id` FOREIGN KEY (`partner_id`) REFERENCES `basedata_partner` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_bankaccount` */ + +insert into `basedata_bankaccount`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`account`,`title`,`memo`,`partner_id`,`org_id`) values (2,NULL,NULL,NULL,NULL,'2015-06-14 18:08:21','2015-06-14 18:08:21','2335635412398092','杭州银行','',NULL,1); + +/*Table structure for table `basedata_brand` */ + +DROP TABLE IF EXISTS `basedata_brand`; + +CREATE TABLE `basedata_brand` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(120) NOT NULL, + `pinyin` varchar(120) DEFAULT NULL, + `trade_id` int(11), + `weight` int(11), + PRIMARY KEY (`id`), + KEY `basedata_brand_09249466` (`trade_id`), + CONSTRAINT `basedata_brand_trade_id_bdcfb86_fk_basedata_trade_id` FOREIGN KEY (`trade_id`) REFERENCES `basedata_trade` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_brand` */ + +insert into `basedata_brand`(`id`,`name`,`pinyin`,`trade_id`,`weight`) values (1,'LENOVO-联想','',NULL,99),(2,'DELL','',3,99); + +/*Table structure for table `basedata_category` */ + +DROP TABLE IF EXISTS `basedata_category`; + +CREATE TABLE `basedata_category` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(6) DEFAULT NULL, + `name` varchar(120) NOT NULL, + `path` varchar(200) DEFAULT NULL, + `parent_id` int(11) DEFAULT NULL, + `trade_id` int(11), + PRIMARY KEY (`id`), + KEY `basedata_category_parent_id_43280ad5_fk_basedata_category_id` (`parent_id`), + KEY `basedata_category_09249466` (`trade_id`), + CONSTRAINT `basedata_category_parent_id_43280ad5_fk_basedata_category_id` FOREIGN KEY (`parent_id`) REFERENCES `basedata_category` (`id`), + CONSTRAINT `basedata_category_trade_id_7d069922_fk_basedata_trade_id` FOREIGN KEY (`trade_id`) REFERENCES `basedata_trade` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_category` */ + +insert into `basedata_category`(`id`,`code`,`name`,`path`,`parent_id`,`trade_id`) values (1,'F01','内部服务','',NULL,NULL),(2,'F02','办公设备','',NULL,NULL),(3,'F03','笔记本电脑','办公设备',2,NULL); + +/*Table structure for table `basedata_dataimport` */ + +DROP TABLE IF EXISTS `basedata_dataimport`; + +CREATE TABLE `basedata_dataimport` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `imp_date` date DEFAULT NULL, + `title` varchar(40) NOT NULL, + `description` longtext, + `attach` varchar(100) DEFAULT NULL, + `is_clear` tinyint(1) NOT NULL, + `handler` varchar(80) DEFAULT NULL, + `status` varchar(2) NOT NULL, + `content_type_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `basedata_data_content_type_id_2051ca2a_fk_django_content_type_id` (`content_type_id`), + CONSTRAINT `basedata_data_content_type_id_2051ca2a_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_dataimport` */ + +insert into `basedata_dataimport`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`imp_date`,`title`,`description`,`attach`,`is_clear`,`handler`,`status`,`content_type_id`) values (20,'2015-06-28','9999-12-31','chengcai','chengcai','2015-06-28 09:03:59','2015-07-15 12:10:58','2015-06-28','【上线准备】-【部门|岗位|员工】第一步','====操作步骤====\r\n1)请从【文档】中下载模板文档【FD0001】;\r\n2)在您的电脑上用excel编辑文档,按照要求录入部门信息、岗位信息、员工信息;\r\n3)在您整理好的文档后,点击【选择文件】按钮,上传您的文档;\r\n4)点击【保存】按钮先保存您的文档到服务器;\r\n5)点击【导入】按钮将您的数据导入至系统中;\r\n====提示信息====\r\n1)请勿修改【处理类】中的【OPS】内容,本类数据的【处理类】为指定值;\r\n2)在组织机构重组时,您可批量导入重组后的数据,原先的旧组织机构将被设置为过期,仍然保留在系统中;','',0,'OPS','0',18),(21,'2015-06-28','9999-12-31','chengcai','chengcai','2015-06-28 09:09:24','2015-06-28 09:16:37','2015-06-28','【上线准备】-【用户信息】第二步','====操作步骤====\r\n1)请从【文档】中下载模板文档【FD0005】;\r\n2)在您的电脑上用excel编辑文档,按照要求录入用户信息;\r\n3)在您整理好的文档后,点击【选择文件】按钮,上传您的文档;\r\n4)点击【保存】按钮先保存您的文档到服务器;\r\n5)点击【导入】按钮将您的数据导入至系统中;\r\n====提示信息====\r\n1)请勿修改【处理类】中的【admin.user】内容,本类数据的【处理类】为指定值;','',0,'admin.user','0',4),(22,'2015-06-28','9999-12-31','chengcai','chengcai','2015-06-28 09:13:34','2015-06-28 09:20:20','2015-06-28','【上线准备】-【合作伙伴信息】第三步','====操作步骤====\r\n1)请从【文档】中下载模板文档【FD0003】;\r\n2)在您的电脑上用excel编辑文档,按照要求录入合作伙伴(客户|供应商)信息;\r\n3)在您整理好的文档后,点击【选择文件】按钮,上传您的文档;\r\n4)点击【保存】按钮先保存您的文档到服务器;\r\n5)点击【导入】按钮将您的数据导入至系统中;\r\n====提示信息====\r\n1)模板中的”C“代表客户,”S“代表供应商;','',0,'','0',14),(23,'2015-06-28','9999-12-31','chengcai','chengcai','2015-06-28 09:18:59','2015-06-28 09:20:48','2015-06-28','【上线准备】-【项目信息】第四步(可选)','====操作步骤====\r\n1)请从【文档】中下载模板文档【FD0004】;\r\n2)在您的电脑上用excel编辑文档,按照要求录入项目信息;\r\n3)在您整理好的文档后,点击【选择文件】按钮,上传您的文档;\r\n4)点击【保存】按钮先保存您的文档到服务器;\r\n5)点击【导入】按钮将您的数据导入至系统中;\r\n====提示信息====\r\n1)本项工作可选,非必需项;','',0,'','0',19); + +/*Table structure for table `basedata_document` */ + +DROP TABLE IF EXISTS `basedata_document`; + +CREATE TABLE `basedata_document` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `title` varchar(120) NOT NULL, + `keywords` varchar(120) DEFAULT NULL, + `description` longtext, + `tp` varchar(2) NOT NULL, + `business_domain` varchar(4) NOT NULL, + `status` varchar(2) NOT NULL, + `pub_date` datetime DEFAULT NULL, + `size` varchar(20) DEFAULT NULL, + `attach` varchar(100) DEFAULT NULL, + `user_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `basedata_document_user_id_105428c7_fk_auth_user_id` (`user_id`), + CONSTRAINT `basedata_document_user_id_105428c7_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_document` */ + +insert into `basedata_document`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`title`,`keywords`,`description`,`tp`,`business_domain`,`status`,`pub_date`,`size`,`attach`,`user_id`) values (1,'2015-06-28','9999-12-31','chengcai','chengcai','2015-06-28 07:27:18','2015-06-28 08:54:09','FD0001','【模板文档】-【基础数据】-1001部门岗位员工导入模板','导入模板 部门 岗位 员工','1)在系统上线的时候,用于大批量的导入部门、岗位、员工信息;\r\n2)操作路径为:【基础数据】>【导入】;\r\n3)在列表页面选择“增加 导入”按钮,打开表单页面;\r\n4)在表单页面,填写“处理类”字段的值为:OPS,选择本地文档上传;\r\n5)注意:先保存,后执行“导入”;\r\n6)提示:在组织机构重组时,可使用本模板进行大批量更改;','00','OT','1','2015-07-06 20:47:19',NULL,'doc/1001部门岗位员工导入模板.xls',11),(2,'2015-06-28','9999-12-31','chengcai','chengcai','2015-06-28 08:23:01','2015-06-28 08:32:43','FD0002','【模板文档】-【基础数据】-1002期初库存导入模板','导入模板 期初库存','1)在系统上线的时候,用于批量的导入期初库存信息;\r\n2)操作路径为:【库存管理】>【期初库存】;\r\n3)在列表页面,选择“增加 期初库存”按钮,进入表单页面;\r\n4)输入相关信息,从本地上传修改后的CSV文档;\r\n5)先保存,后执行“入库”操作;\r\n6)注意:本文档为csv格式,请使用excel编辑;\r\n','00','OT','1','2015-07-06 20:47:19',NULL,'doc/1002期初库存导入模板.csv',11),(3,'2015-06-28','9999-12-31','chengcai','chengcai','2015-06-28 08:30:17','2015-06-28 08:32:33','FD0003','【模板文档】-【基础数据】-1003合作伙伴导入模板','导入模板 合作伙伴','1)在系统上线的时候,用于大批量的导入合作伙伴(客户、供应商)信息;\r\n2)操作路径为:【基础数据】>【导入】;\r\n3)在列表页面选择“增加 导入”按钮,打开表单页面;\r\n4)在表单页面,选择本地文档上传;\r\n5)注意:先保存,后执行“导入”;','00','OT','1','2015-07-06 20:47:19',NULL,'doc/1003合作伙伴导入模板.xls',11),(4,'2015-06-28','9999-12-31','chengcai',NULL,'2015-06-28 08:32:25','2015-06-28 08:32:25','FD0004','【模板文档】-【基础数据】-1004项目信息导入模板','导入模板 项目信息','','00','OT','1','2015-07-06 20:47:19',NULL,'doc/1004项目导入模板.xls',11),(5,'2015-06-28','9999-12-31','chengcai','chengcai','2015-06-28 08:35:37','2015-06-28 08:35:59','FD0005','【模板文档】-【基础数据】-1005用户信息导入模板','导入模板 用户','1)在系统上线的时候,用于大批量的导入用户信息;\r\n2)操作路径为:【基础数据】>【导入】;\r\n3)在列表页面选择“增加 导入”按钮,打开表单页面;\r\n4)在表单页面,填写“处理类”字段的值为:admin.user,选择本地文档上传;\r\n5)注意:先保存,后执行“导入”;','00','OT','1','2015-07-06 20:47:19',NULL,'',11),(6,'2015-06-28','9999-12-31','chengcai','chengcai','2015-06-28 08:39:50','2015-06-28 08:45:56','FD0006','【模板文档】-【明细数据】-2001报价单明细导入模板','导入模板 报价单明细 ','1)在创建报价单的时候,若物料明细太多,可选择从excel批量导入;\r\n2)在保存报价单的时候,系统依据上传的文档自动加载物料;\r\n3)导入的物料遵循“没有即创建”原则,若系统中没有此物料则直接创建,检查的依据为【物料编号】,请慎重填写【物料编号】,避免造成重复导入;\r\n4)本模板有开关功能,当【B1】单元格为【0演示数据】时,不导入,为【1正式报价】时导入','00','BU','1','2015-07-06 20:47:19',NULL,'doc/2001报价单明细样例.xls',11),(7,'2015-06-28','9999-12-31','chengcai','chengcai','2015-06-28 08:47:41','2015-06-28 08:48:09','FD0007','【模板文档】-【明细数据】-2002需求单明细导入模板','导入模板 需求单明细 工单服务 ','1)在创建【工单服务】的时候,若需求物料明细太多,可选择从excel批量导入;\r\n2)在保存【工单服务】的时候,系统依据上传的文档自动加载物料;\r\n3)导入的物料遵循“没有即创建”原则,若系统中没有此物料则直接创建,检查的依据为【物料编号】,请慎重填写【物料编号】,避免造成重复导入;\r\n4)本模板有开关功能,当【B1】单元格为【0演示数据】时,不导入,为【1正式报价】时导入','00','OT','1','2015-07-06 20:47:19',NULL,'doc/2002需求计划明细样例.xls',11),(8,'2015-06-28','9999-12-31','chengcai',NULL,'2015-06-28 08:50:09','2015-06-28 08:50:09','FD0008','【模板文档】-【明细数据】-2003采购单明细导入模板','导入模板 采购单明细 ','1)在创建【采购单】的时候,若物料明细太多,可选择从excel批量导入;\r\n2)在保存【采购单】的时候,系统依据上传的文档自动加载物料;\r\n3)导入的物料遵循“没有即创建”原则,若系统中没有此物料则直接创建,检查的依据为【物料编号】,请慎重填写【物料编号】,避免造成重复导入;\r\n4)本模板有开关功能,当【B1】单元格为【0演示数据】时,不导入,为【1正式报价】时导入','00','PO','1','2015-07-06 20:47:19',NULL,'doc/2003采购单明细样例.xls',11),(9,'2015-07-03','9999-12-31','chengcai',NULL,'2015-07-03 21:28:30','2015-07-03 21:28:30','FD0009','【使用手册】-功能概述','maximus 功能概述','','00','OT','0',NULL,NULL,'',11),(10,'2015-07-03','9999-12-31','chengcai',NULL,'2015-07-03 21:28:58','2015-07-03 21:28:58','FD0010','【使用手册】-基本操作','maximus 基本操作','','00','OT','0',NULL,NULL,'',11),(11,'2015-07-03','9999-12-31','chengcai',NULL,'2015-07-03 21:29:29','2015-07-03 21:29:29','FD0011','【使用手册】-个人自助','maximus 个人自助','','00','OT','0',NULL,NULL,'',11),(12,'2015-07-03','9999-12-31','chengcai',NULL,'2015-07-03 21:29:58','2015-07-03 21:29:58','FD0012','【使用手册】-销售管理','maximus 销售管理','','00','OT','0',NULL,NULL,'',11),(13,'2015-07-03','9999-12-31','chengcai',NULL,'2015-07-03 21:30:39','2015-07-03 21:30:39','FD0013','【使用手册】-采购管理','maximus 采购管理','','00','OT','0',NULL,NULL,'',11),(14,'2015-07-03','9999-12-31','chengcai',NULL,'2015-07-03 21:31:19','2015-07-03 21:31:19','FD0014','【使用手册】-库存管理','maximus 库存管理','','00','OT','0',NULL,NULL,'',11),(15,'2015-07-03','9999-12-31','chengcai',NULL,'2015-07-03 21:31:41','2015-07-03 21:31:41','FD0015','【使用手册】-组织机构','maximus 组织机构','','00','OT','0',NULL,NULL,'',11),(16,'2015-07-03','9999-12-31','chengcai',NULL,'2015-07-03 21:32:03','2015-07-03 21:32:03','FD0016','【使用手册】-基础数据','maximus 基础数据','','00','OT','0',NULL,NULL,'',11),(17,'2015-07-03','9999-12-31','chengcai',NULL,'2015-07-03 21:32:26','2015-07-03 21:32:26','FD0017','【使用手册】-工作流管理','maximus 工作流','','00','OT','0',NULL,NULL,'',11); + +/*Table structure for table `basedata_education` */ + +DROP TABLE IF EXISTS `basedata_education`; + +CREATE TABLE `basedata_education` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `edu_type` varchar(2) NOT NULL, + `school` varchar(120) NOT NULL, + `major` varchar(120) DEFAULT NULL, + `degree` varchar(2) DEFAULT NULL, + `employee_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `basedata_education_employee_id_54096a10_fk_basedata_employee_id` (`employee_id`), + CONSTRAINT `basedata_education_employee_id_54096a10_fk_basedata_employee_id` FOREIGN KEY (`employee_id`) REFERENCES `basedata_employee` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_education` */ + +/*Table structure for table `basedata_employee` */ + +DROP TABLE IF EXISTS `basedata_employee`; + +CREATE TABLE `basedata_employee` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `name` varchar(120) NOT NULL, + `pinyin` varchar(120) DEFAULT NULL, + `birthday` date DEFAULT NULL, + `gender` varchar(2) NOT NULL, + `idcard` varchar(20) NOT NULL, + `country` varchar(2) DEFAULT NULL, + `hometown` varchar(40) DEFAULT NULL, + `address` varchar(120) DEFAULT NULL, + `banknum` varchar(40) DEFAULT NULL, + `bankname` varchar(80) DEFAULT NULL, + `emergency` varchar(40) DEFAULT NULL, + `rank` varchar(2) NOT NULL, + `workday` date DEFAULT NULL, + `startday` date DEFAULT NULL, + `religion` varchar(2) DEFAULT NULL, + `marital` varchar(2), + `party` varchar(2), + `nation` varchar(2), + `ygxs` varchar(2), + `status` varchar(2), + `category` varchar(2), + `literacy` varchar(2) DEFAULT NULL, + `major` varchar(2), + `degree` varchar(2), + `tag1` varchar(2), + `tag2` varchar(2), + `tag3` varchar(2), + `tag4` varchar(2), + `organization_id` int(11) DEFAULT NULL, + `position_id` int(11) NOT NULL, + `user_id` int(11) DEFAULT NULL, + `email` varchar(20), + `office` varchar(20), + `phone` varchar(20), + `health` varchar(2), + `spjob` varchar(2), + PRIMARY KEY (`id`), + KEY `basedata_emplo_organization_id_3b46dfdc_fk_organ_organization_id` (`organization_id`), + KEY `basedata_employee_position_id_3d7368b4_fk_organ_position_id` (`position_id`), + KEY `basedata_employee_user_id_6883fc78_fk_auth_user_id` (`user_id`), + CONSTRAINT `basedata_employee_position_id_3d7368b4_fk_organ_position_id` FOREIGN KEY (`position_id`) REFERENCES `organ_position` (`id`), + CONSTRAINT `basedata_employee_user_id_6883fc78_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `basedata_emplo_organization_id_3b46dfdc_fk_organ_organization_id` FOREIGN KEY (`organization_id`) REFERENCES `organ_organization` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_employee` */ + +insert into `basedata_employee`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`name`,`pinyin`,`birthday`,`gender`,`idcard`,`country`,`hometown`,`address`,`banknum`,`bankname`,`emergency`,`rank`,`workday`,`startday`,`religion`,`marital`,`party`,`nation`,`ygxs`,`status`,`category`,`literacy`,`major`,`degree`,`tag1`,`tag2`,`tag3`,`tag4`,`organization_id`,`position_id`,`user_id`,`email`,`office`,`phone`,`health`,`spjob`) values (1,NULL,NULL,NULL,'chengcai','2015-06-27 13:08:28','2015-07-02 05:24:41','1001','李四','lisi','1956-11-21','1','110112195611212118','CN','','','','','','10','1983-09-01','2001-10-21','00','10','13','01','2','10','21','10','99','4','99','9','00','0',NULL,99,14,'','','','1','00'),(2,'2015-07-02','9999-12-31','chengcai','chengcai','2015-07-02 05:22:26','2015-07-02 05:25:23','1002','张三','zhangsan','1988-12-02','1','321027198812021234','CN','','','','','','12','2008-07-02','2012-07-02','00','10','13','01','2','10','21','10','99','4','99','9','00','0',NULL,92,13,'','','','1','00'),(3,'2015-07-02','9999-12-31','chengcai',NULL,'2015-07-02 05:27:10','2015-07-02 05:27:10','1003','王五','wangwu','1973-12-03','1','310202197312038921','CN','','','','','','12','2015-07-02','2015-07-02','00','10','13','01','2','10','21','10','99','4','99','9','00','0',NULL,91,11,'','','','1','00'),(4,'2015-07-02','9999-12-31','chengcai','chengcai','2015-07-02 05:28:44','2015-07-02 06:07:37','1004','董永','dongyong','1981-02-13','1','1011123119810213892x','CN','','','','','','10','2015-07-02','2015-07-02','00','10','13','01','2','10','21','10','99','4','99','9','00','0',NULL,87,16,'','','','1','00'),(5,NULL,NULL,NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','9001','曹菊芳','caojufang','1972-09-12','2','31011019720912574x','CN',NULL,NULL,NULL,NULL,NULL,'00','1985-09-01','2000-10-01','00','10','13','01','2','10','21','10','99','4','99','9','00','0',NULL,96,17,NULL,NULL,NULL,'1','00'); + +/*Table structure for table `basedata_expenseaccount` */ + +DROP TABLE IF EXISTS `basedata_expenseaccount`; + +CREATE TABLE `basedata_expenseaccount` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `name` varchar(120) NOT NULL, + `category` varchar(4) NOT NULL, + `description` longtext, + `status` tinyint(1) NOT NULL, + `parent_id` int(11) DEFAULT NULL, + `org_id` int(11), + PRIMARY KEY (`id`), + KEY `basedata_expens_parent_id_61334aac_fk_basedata_expenseaccount_id` (`parent_id`), + KEY `basedata_expenseaccount_9cf869aa` (`org_id`), + CONSTRAINT `basedata_expenseaccount_org_id_5661eb95_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `basedata_expens_parent_id_61334aac_fk_basedata_expenseaccount_id` FOREIGN KEY (`parent_id`) REFERENCES `basedata_expenseaccount` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_expenseaccount` */ + +insert into `basedata_expenseaccount`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`name`,`category`,`description`,`status`,`parent_id`,`org_id`) values (1,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:03:23','2015-05-02 21:03:23','FC0001','差旅补助','PU','',1,NULL,NULL),(2,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:03:28','2015-05-02 21:03:28','FC0002','住宿费','PU','',1,NULL,NULL),(3,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:03:45','2015-05-02 21:03:45','FC0003','市内交通费','PU','',1,NULL,NULL),(4,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:04:00','2015-05-02 21:04:00','FC0004','长途交通(大巴)费','PU','',1,NULL,NULL),(5,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:04:11','2015-05-02 21:04:11','FC0005','长途交通(火车)费','PU','',1,NULL,NULL),(6,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:04:22','2015-05-02 21:04:22','FC0006','机票费','PU','',1,NULL,NULL),(7,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:04:31','2015-05-02 21:04:31','FC0007','业务咨询费','PU','',1,NULL,NULL),(8,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:05:09','2015-05-02 21:05:09','FC0008','赞助费','PU','',1,NULL,NULL),(9,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:05:32','2015-05-02 21:05:32','FC0009','教育培训费','HR','',1,NULL,NULL),(10,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:05:55','2015-05-02 21:05:55','FC0010','集体活动费','HR','',1,NULL,NULL),(11,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:06:16','2015-05-02 21:06:16','FC0011','劳务外包费','HR','',1,NULL,NULL),(12,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:06:33','2015-05-02 21:06:33','FC0012','结婚礼金','HR','',1,NULL,NULL),(13,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:06:43','2015-05-02 21:06:43','FC0013','生育礼金','HR','',1,NULL,NULL),(14,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:06:54','2015-05-02 21:06:54','FC0014','丧葬抚恤','HR','',1,NULL,NULL),(15,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:07:08','2015-05-02 21:07:08','FC0015','独生子女费','HR','',1,NULL,NULL),(16,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:09:31','2015-05-02 21:09:31','FC0016','IT设备及服务费用','OF','',1,NULL,NULL),(17,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:09:48','2015-05-02 21:09:48','FC0017','通信及网络费用','OF','',1,NULL,NULL),(18,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:10:06','2015-05-02 21:10:06','FC0018','印刷品费用','OF','',1,NULL,NULL),(19,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:10:30','2015-05-02 21:10:30','FC0019','劳保用品费用','OF','',1,NULL,NULL),(20,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:10:58','2015-05-02 21:10:58','FC0020','办公用品费用','OF','',1,NULL,NULL),(21,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:11:32','2015-05-02 21:11:32','FC0021','车辆维修营运保养费','OF','',1,NULL,NULL),(22,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:12:00','2015-05-02 21:12:00','FC0022','固定资产购置修缮费','OF','',1,NULL,NULL),(23,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:13:39','2015-05-02 21:13:39','FC0023','运输费','MU','',1,NULL,NULL),(24,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:13:49','2015-05-02 21:13:49','FC0024','包装费','MU','',1,NULL,NULL),(25,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:14:08','2015-05-02 21:14:08','FC0025','设备维修费','MU','',1,NULL,NULL),(26,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:14:33','2015-05-02 21:14:33','FC0026','技术咨询费','MU','',1,NULL,NULL),(27,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:14:58','2015-05-02 21:14:58','FC0027','礼品费','BU','',1,NULL,NULL),(28,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:15:10','2015-05-02 21:15:10','FC0028','业务招待费','BU','',1,NULL,NULL),(29,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:15:25','2015-05-02 21:15:25','FC0029','广告费','BU','',1,NULL,NULL),(30,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:19:28','2015-05-02 21:19:28','FC0030','土地房屋设备租赁费','OF','',1,NULL,NULL),(31,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:20:46','2015-05-02 21:20:46','FC0031','诉讼费','PU','',1,NULL,NULL),(32,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:21:07','2015-05-02 21:21:07','FC0032','审计费','PU','',1,NULL,NULL),(33,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:22:52','2015-05-02 21:22:52','FC0033','商业保险费','PU','',1,NULL,NULL),(34,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:23:31','2015-05-02 21:23:31','FC0034','代理服务费','PU','',1,NULL,NULL),(35,'2015-05-02','9999-12-31','zhugl',NULL,'2015-05-02 21:26:27','2015-05-02 21:26:27','FC0035','其他不便归类的费用','OT','',1,NULL,NULL),(36,'2015-06-27','9999-12-31','zhangliangjun',NULL,'2015-06-27 08:15:17','2015-06-27 08:15:17','FC0036','食堂粮油','OF','',1,NULL,NULL); + +/*Table structure for table `basedata_extraparam` */ + +DROP TABLE IF EXISTS `basedata_extraparam`; + +CREATE TABLE `basedata_extraparam` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(40) NOT NULL, + `data_type` varchar(6) NOT NULL, + `data_source` varchar(40) DEFAULT NULL, + `material_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `basedata_extraparam_material_id_615a14c3_fk_basedata_material_id` (`material_id`), + CONSTRAINT `basedata_extraparam_material_id_615a14c3_fk_basedata_material_id` FOREIGN KEY (`material_id`) REFERENCES `basedata_material` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_extraparam` */ + +insert into `basedata_extraparam`(`id`,`name`,`data_type`,`data_source`,`material_id`) values (1,'出发日期','DATE','',1),(2,'预计返回日期','DATE','',1),(3,'目的地','CHAR','S043',1),(4,'起始里程','NUM','',3),(5,'结束里程','NUM','',3),(6,'所用里程','NUM','',3),(7,'目的地','CHAR','',3),(8,'加班时长(小时)','NUM','',57),(9,'调休时长(小时)','NUM','',58),(10,'休假时长(小时)','NUM','',59),(11,'工卡/饭卡/门禁卡','CHAR','',60),(12,'计算机编号/IP地址','CHAR','',60),(13,'员工手册/保密培训','CHAR','',60),(14,'办公用品','CHAR','',60),(15,'工位安排','CHAR','',60),(16,'宿舍安排','CHAR','',60),(17,'ERP系统/帐号','CHAR','',60),(18,'邮箱开通/邮箱地址','CHAR','',60),(19,'贷款银行抬头','CHAR','',62),(20,'薪水截止日期','CHAR','',63),(21,'社保及公积金办理','CHAR','',63),(22,'工卡/门禁卡/饭卡回收','CHAR','',63),(23,'ERP系统/帐号停用','CHAR','',63),(24,'邮箱帐号停用','CHAR','',63),(25,'计算机/IP地址注销','CHAR','',63),(26,'工作内容交接','CHAR','',63),(27,'离职证明开具','CHAR','',63),(28,'培训课程','CHAR','',64),(29,'培训机构','CHAR','',64),(30,'培训天数','NUM','',64); + +/*Table structure for table `basedata_family` */ + +DROP TABLE IF EXISTS `basedata_family`; + +CREATE TABLE `basedata_family` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `relation` varchar(2) DEFAULT NULL, + `status` varchar(2) DEFAULT NULL, + `name` varchar(60) NOT NULL, + `birthday` date DEFAULT NULL, + `organization` varchar(120) DEFAULT NULL, + `phone` varchar(120) DEFAULT NULL, + `emergency` tinyint(1) NOT NULL, + `employee_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `basedata_family_employee_id_2c56437d_fk_basedata_employee_id` (`employee_id`), + CONSTRAINT `basedata_family_employee_id_2c56437d_fk_basedata_employee_id` FOREIGN KEY (`employee_id`) REFERENCES `basedata_employee` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_family` */ + +/*Table structure for table `basedata_material` */ + +DROP TABLE IF EXISTS `basedata_material`; + +CREATE TABLE `basedata_material` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `barcode` varchar(40) DEFAULT NULL, + `name` varchar(120) NOT NULL, + `spec` varchar(120) DEFAULT NULL, + `pinyin` varchar(120) DEFAULT NULL, + `status` tinyint(1) NOT NULL, + `is_equip` tinyint(1) NOT NULL, + `can_sale` tinyint(1) NOT NULL, + `is_virtual` tinyint(1) NOT NULL, + `stock_price` decimal(14,4) DEFAULT NULL, + `purchase_price` decimal(14,4) DEFAULT NULL, + `sale_price` decimal(14,4) DEFAULT NULL, + `brand_id` int(11) DEFAULT NULL, + `category_id` int(11) DEFAULT NULL, + `warehouse_id` int(11), + `org_id` int(11), + `tp` varchar(2), + PRIMARY KEY (`id`), + KEY `basedata_material_brand_id_70cca220_fk_basedata_brand_id` (`brand_id`), + KEY `basedata_material_category_id_7ca5506e_fk_basedata_category_id` (`category_id`), + KEY `basedata_material_9744817e` (`warehouse_id`), + KEY `basedata_material_9cf869aa` (`org_id`), + CONSTRAINT `basedata_material_brand_id_70cca220_fk_basedata_brand_id` FOREIGN KEY (`brand_id`) REFERENCES `basedata_brand` (`id`), + CONSTRAINT `basedata_material_category_id_7ca5506e_fk_basedata_category_id` FOREIGN KEY (`category_id`) REFERENCES `basedata_category` (`id`), + CONSTRAINT `basedata_material_org_id_1ac5ffff_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `basedata_material_warehouse_id_1e7533f6_fk_basedata_warehouse_id` FOREIGN KEY (`warehouse_id`) REFERENCES `basedata_warehouse` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_material` */ + +insert into `basedata_material`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`barcode`,`name`,`spec`,`pinyin`,`status`,`is_equip`,`can_sale`,`is_virtual`,`stock_price`,`purchase_price`,`sale_price`,`brand_id`,`category_id`,`warehouse_id`,`org_id`,`tp`) values (1,'2015-05-22','9999-12-31','zhugl','chengcai','2015-05-22 22:03:36','2015-06-29 21:18:44','IT00001','','出差申请','差旅【费用报销】需有出差申请',NULL,1,0,0,1,NULL,NULL,NULL,NULL,1,2,NULL,'80'),(2,'2015-05-23','9999-12-31','zhugl',NULL,'2015-05-23 07:47:02','2015-06-14 13:33:05','IT00002','','戴尔(DELL)Inspiron 3455-R1248 灵越23.8英寸一体电脑 ','E2-7110 4G 500G WIFI 蓝牙 WIN8.1 3年上门',NULL,1,1,0,0,'4512.8205','5280.0000',NULL,2,3,3,NULL,'10'),(3,'2015-05-24','9999-12-31','zhugl','chengcai','2015-05-24 15:13:47','2015-06-29 21:23:43','IT00003','','用车申请','请提前24小时申请',NULL,1,0,0,1,NULL,NULL,NULL,NULL,1,NULL,NULL,'80'),(4,'2015-06-03','9999-12-31','zhugl','caojufang','2015-06-03 21:23:43','2015-07-17 12:29:02','IT00004','','福光杯子','500ml 真空保温',NULL,1,0,0,0,'27.3504','32.0000',NULL,NULL,NULL,NULL,NULL,'10'),(5,'2015-06-03','9999-12-31','zhugl',NULL,'2015-06-03 21:43:33','2015-06-03 21:43:33','IT00005','','手套','',NULL,1,0,1,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'10'),(6,'2015-06-11','9999-12-31','zhugl','chengcai','2015-06-11 22:36:17','2015-06-29 21:40:04','IT00006','','2号楼3楼大会议室','投影、话筒、视频会议、白板',NULL,1,1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'20'),(40,NULL,NULL,NULL,NULL,'2015-06-14 13:22:36','2015-06-14 13:22:54','IT9001',NULL,'陕西红富士苹果','#80',NULL,1,0,1,0,'5.6000',NULL,NULL,NULL,NULL,11,NULL,'10'),(41,NULL,NULL,NULL,NULL,'2015-06-14 13:22:36','2015-06-14 13:22:54','IT9002',NULL,'丰水梨','#75',NULL,1,0,1,0,'8.2000',NULL,NULL,NULL,NULL,11,NULL,'10'),(42,NULL,NULL,NULL,NULL,'2015-06-14 13:22:36','2015-06-14 13:22:54','IT9003',NULL,'冰糖心富士','#80',NULL,1,0,1,0,'9.5000',NULL,NULL,NULL,NULL,11,NULL,'10'),(43,NULL,NULL,NULL,NULL,'2015-06-14 13:22:36','2015-06-14 13:22:54','IT9004',NULL,'常香玉','',NULL,1,0,1,0,'6.5000',NULL,NULL,NULL,NULL,11,NULL,'10'),(44,NULL,NULL,NULL,NULL,'2015-06-14 13:22:36','2015-06-14 13:22:54','IT9005',NULL,'砀山梨','',NULL,1,0,1,0,'7.8000',NULL,NULL,NULL,NULL,11,NULL,'10'),(45,NULL,NULL,NULL,NULL,'2015-06-14 13:22:36','2015-06-14 13:22:54','IT9006',NULL,'赣南橙','',NULL,1,0,1,0,'6.9000',NULL,NULL,NULL,NULL,11,NULL,'10'),(46,NULL,NULL,NULL,NULL,'2015-06-14 13:22:36','2015-06-14 13:22:54','IT9007',NULL,'红毛丹','',NULL,1,0,1,0,'12.6000',NULL,NULL,NULL,NULL,11,NULL,'10'),(47,NULL,NULL,NULL,NULL,'2015-06-14 13:22:36','2015-06-14 13:22:54','IT9008',NULL,'红心火龙果','',NULL,1,0,1,0,'8.2000',NULL,NULL,NULL,NULL,11,NULL,'10'),(48,NULL,NULL,NULL,NULL,'2015-06-14 13:22:36','2015-06-14 13:22:54','IT9009',NULL,'黄圣女果','',NULL,1,0,1,0,'8.9000',NULL,NULL,NULL,NULL,11,NULL,'10'),(49,NULL,NULL,NULL,NULL,'2015-06-14 13:22:36','2015-06-14 13:22:54','IT9010',NULL,'国产柠檬','',NULL,1,0,1,0,'14.6000',NULL,NULL,NULL,NULL,11,NULL,'10'),(52,NULL,NULL,NULL,NULL,'2015-06-17 21:29:52','2015-06-17 21:29:52','IT9981',NULL,'PZ-30配电箱','',NULL,1,0,1,0,NULL,'210.4500','320.0000',NULL,NULL,NULL,NULL,'10'),(53,NULL,NULL,NULL,NULL,'2015-06-27 19:19:52','2015-06-27 19:19:52','IT5001',NULL,'联想T440笔记本电脑','14寸双核4G内存1T硬盘',NULL,1,0,1,0,NULL,'6219.0000','7150.0000',NULL,NULL,NULL,NULL,'10'),(54,NULL,NULL,NULL,NULL,'2015-06-27 19:21:33','2015-06-27 19:21:33','IT5002',NULL,'戴尔M-10塔式服务器','9核16G内存500G硬盘',NULL,1,0,1,0,NULL,'8125.0000','9999.0000',NULL,NULL,NULL,NULL,'10'),(55,NULL,NULL,NULL,NULL,'2015-06-27 20:06:15','2015-07-17 12:29:02','IT5003',NULL,'格力电风扇','遥控功能,1.2m高',NULL,1,0,1,0,'255.5556','299.0000',NULL,NULL,NULL,NULL,NULL,'10'),(56,NULL,NULL,NULL,NULL,'2015-06-27 20:58:04','2015-06-27 20:58:04','IT5004',NULL,'进口红蛇果','#85',NULL,1,0,1,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'10'),(57,'2015-06-29','9999-12-31','chengcai','chengcai','2015-06-29 21:02:51','2015-06-29 21:16:37','IT00057','','加班申请','加班时长可调休',NULL,1,0,0,1,NULL,NULL,NULL,NULL,NULL,2,NULL,'80'),(58,'2015-06-29','9999-12-31','chengcai','chengcai','2015-06-29 21:03:37','2015-06-29 21:16:46','IT00058','','调休申请','调休申请需要有加班单据,请在【参考工单】中选择加班单据',NULL,1,0,0,1,NULL,NULL,NULL,NULL,NULL,2,NULL,'80'),(59,'2015-06-29','9999-12-31','chengcai','chengcai','2015-06-29 21:06:13','2015-06-29 21:16:56','IT00059','','休假申请','请注明休假类别:年假、病假、事假、婚假、丧假、探亲假',NULL,1,0,0,1,NULL,NULL,NULL,NULL,NULL,2,NULL,'80'),(60,'2015-06-29','9999-12-31','chengcai','chengcai','2015-06-29 21:13:47','2015-06-29 21:27:04','IT00060','','入职办理','员工入职办理手续',NULL,1,0,0,1,NULL,NULL,NULL,NULL,NULL,2,NULL,'80'),(61,'2015-06-29','9999-12-31','chengcai','chengcai','2015-06-29 21:22:36','2015-06-29 22:02:04','IT00061','','用印申请','公章、法人章、人事章、财务章、合同章、投标章、采购章',NULL,1,0,0,1,NULL,NULL,NULL,NULL,NULL,2,NULL,'80'),(62,'2015-06-29','9999-12-31','chengcai','chengcai','2015-06-29 21:33:14','2015-06-29 21:42:26','IT00062','','收入证明','收入证明有效期为2个月',NULL,1,0,0,1,NULL,NULL,NULL,NULL,1,2,NULL,'80'),(63,'2015-06-29','9999-12-31','chengcai','chengcai','2015-06-29 21:38:11','2015-06-30 20:07:48','IT00063','','离职办理','请提前30天提出申请',NULL,1,0,0,1,NULL,NULL,NULL,NULL,NULL,2,NULL,'80'),(64,'2015-06-30','9999-12-31','chengcai',NULL,'2015-06-30 20:09:12','2015-06-30 20:09:12','IT00064','','培训申请','外部培训3000元以上需签订服务期协议',NULL,1,0,0,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'80'); + +/*Table structure for table `basedata_material_measure` */ + +DROP TABLE IF EXISTS `basedata_material_measure`; + +CREATE TABLE `basedata_material_measure` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `material_id` int(11) NOT NULL, + `measure_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `material_id` (`material_id`,`measure_id`), + KEY `basedata_material_mea_measure_id_5c0d90fc_fk_basedata_measure_id` (`measure_id`), + CONSTRAINT `basedata_material_mea_measure_id_5c0d90fc_fk_basedata_measure_id` FOREIGN KEY (`measure_id`) REFERENCES `basedata_measure` (`id`), + CONSTRAINT `basedata_material_me_material_id_572f4c8_fk_basedata_material_id` FOREIGN KEY (`material_id`) REFERENCES `basedata_material` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_material_measure` */ + +insert into `basedata_material_measure`(`id`,`material_id`,`measure_id`) values (49,1,8),(5,2,9),(51,3,8),(10,4,1),(9,5,1),(56,6,1),(23,40,3),(24,41,3),(25,42,3),(26,43,3),(27,44,3),(28,45,3),(29,46,3),(30,47,3),(31,48,3),(32,49,3),(45,57,8),(46,58,8),(47,59,8),(52,60,8),(59,61,8),(58,62,8),(60,63,8),(61,64,8); + +/*Table structure for table `basedata_materialparam` */ + +DROP TABLE IF EXISTS `basedata_materialparam`; + +CREATE TABLE `basedata_materialparam` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `creation` date NOT NULL, + `material_id` int(11) NOT NULL, + `param_name_id` int(11), + `param_value_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `basedata_materialpa_material_id_666e08d1_fk_basedata_material_id` (`material_id`), + KEY `basedata_materialparam_996e5113` (`param_name_id`), + KEY `basedata_materialparam_2f9b9c2f` (`param_value_id`), + CONSTRAINT `basedata_materialpa_material_id_666e08d1_fk_basedata_material_id` FOREIGN KEY (`material_id`) REFERENCES `basedata_material` (`id`), + CONSTRAINT `bas_param_name_id_3c50302d_fk_basedata_technicalparametername_id` FOREIGN KEY (`param_name_id`) REFERENCES `basedata_technicalparametername` (`id`), + CONSTRAINT `b_param_value_id_18882fba_fk_basedata_technicalparametervalue_id` FOREIGN KEY (`param_value_id`) REFERENCES `basedata_technicalparametervalue` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_materialparam` */ + +/*Table structure for table `basedata_measure` */ + +DROP TABLE IF EXISTS `basedata_measure`; + +CREATE TABLE `basedata_measure` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(6) DEFAULT NULL, + `name` varchar(20) NOT NULL, + `status` tinyint(1) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_measure` */ + +insert into `basedata_measure`(`id`,`code`,`name`,`status`) values (1,'ge','个',1),(2,'zhi','只',1),(3,'kg','千克',1),(4,'t','吨',1),(5,'g','克',1),(6,'gen','根',1),(7,'xi','箱',1),(8,'CI','次',1),(9,'TAI','台',1); + +/*Table structure for table `basedata_partner` */ + +DROP TABLE IF EXISTS `basedata_partner`; + +CREATE TABLE `basedata_partner` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `name` varchar(120) NOT NULL, + `short` varchar(20) DEFAULT NULL, + `pinyin` varchar(120) DEFAULT NULL, + `partner_type` varchar(2) NOT NULL, + `level` varchar(2) NOT NULL, + `tax_num` varchar(40) DEFAULT NULL, + `tax_address` varchar(40) DEFAULT NULL, + `tax_account` varchar(80) DEFAULT NULL, + `contacts` varchar(40), + `memo` longtext, + `phone` varchar(40), + `org_id` int(11), + PRIMARY KEY (`id`), + KEY `basedata_partner_9cf869aa` (`org_id`), + CONSTRAINT `basedata_partner_org_id_29c57159_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_partner` */ + +insert into `basedata_partner`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`name`,`short`,`pinyin`,`partner_type`,`level`,`tax_num`,`tax_address`,`tax_account`,`contacts`,`memo`,`phone`,`org_id`) values (17,NULL,NULL,NULL,'chengcai','2015-06-27 22:27:23','2015-06-29 22:01:03','C1001','中国船舶重工业集团','中船集团','cdt','C','A','10111293847','北京市海淀区10号','北京银行海淀支行 330291837','周强','','13813898213',NULL),(18,'2015-06-30','9999-12-31','chengcai',NULL,'2015-06-30 20:22:27','2015-06-30 20:22:27','90018','京东商城','','','S','A','','','','','','',NULL); + +/*Table structure for table `basedata_project` */ + +DROP TABLE IF EXISTS `basedata_project`; + +CREATE TABLE `basedata_project` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `name` varchar(120) NOT NULL, + `short` varchar(20) DEFAULT NULL, + `pinyin` varchar(120) DEFAULT NULL, + `status` varchar(2) DEFAULT NULL, + `prj_type` varchar(2), + `description` longtext, + `budget` decimal(10,2) DEFAULT NULL, + `income` decimal(10,2) DEFAULT NULL, + `expand` decimal(10,2) DEFAULT NULL, + `blueprint` varchar(100) DEFAULT NULL, + `offer` varchar(100) DEFAULT NULL, + `business` varchar(100) DEFAULT NULL, + `partner_id` int(11) DEFAULT NULL, + `org_id` int(11), + PRIMARY KEY (`id`), + KEY `basedata_project_partner_id_36721156_fk_basedata_partner_id` (`partner_id`), + KEY `basedata_project_9cf869aa` (`org_id`), + CONSTRAINT `basedata_project_org_id_5726486_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `basedata_project_partner_id_36721156_fk_basedata_partner_id` FOREIGN KEY (`partner_id`) REFERENCES `basedata_partner` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_project` */ + +insert into `basedata_project`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`name`,`short`,`pinyin`,`status`,`prj_type`,`description`,`budget`,`income`,`expand`,`blueprint`,`offer`,`business`,`partner_id`,`org_id`) values (7,NULL,NULL,NULL,'chengcai','2015-06-27 22:39:27','2015-07-30 21:24:06','PJ-C-1001','内部运营项目','','','02','00','','50000.00',NULL,NULL,'','','',NULL,NULL),(8,NULL,NULL,NULL,NULL,'2015-06-27 22:39:27','2015-07-03 05:50:38','PJ-C-1002','办公用品分摊项目','','','03','00',NULL,NULL,NULL,NULL,'','','',NULL,NULL),(9,'2015-07-04','9999-12-31','zhangsan',NULL,'2015-07-04 11:05:59','2015-07-12 01:26:21','PJ0009','中海洋船舶工业集团张江工业园配电柜项目','','','03','00','',NULL,NULL,NULL,'','','',NULL,NULL); + +/*Table structure for table `basedata_project_users` */ + +DROP TABLE IF EXISTS `basedata_project_users`; + +CREATE TABLE `basedata_project_users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `project_id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `project_id` (`project_id`,`user_id`), + KEY `basedata_project_users_user_id_2b10e1a1_fk_auth_user_id` (`user_id`), + CONSTRAINT `basedata_project_users_project_id_1560ad8_fk_basedata_project_id` FOREIGN KEY (`project_id`) REFERENCES `basedata_project` (`id`), + CONSTRAINT `basedata_project_users_user_id_2b10e1a1_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_project_users` */ + +/*Table structure for table `basedata_technicalparametername` */ + +DROP TABLE IF EXISTS `basedata_technicalparametername`; + +CREATE TABLE `basedata_technicalparametername` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(40) NOT NULL, + `status` tinyint(1) NOT NULL, + `category_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `basedata_technicalpa_category_id_8e419b4_fk_basedata_category_id` (`category_id`), + CONSTRAINT `basedata_technicalpa_category_id_8e419b4_fk_basedata_category_id` FOREIGN KEY (`category_id`) REFERENCES `basedata_category` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_technicalparametername` */ + +/*Table structure for table `basedata_technicalparametervalue` */ + +DROP TABLE IF EXISTS `basedata_technicalparametervalue`; + +CREATE TABLE `basedata_technicalparametervalue` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `value` varchar(80) NOT NULL, + `description` varchar(80) DEFAULT NULL, + `tech_name_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `base_tech_name_id_401b4baa_fk_basedata_technicalparametername_id` (`tech_name_id`), + CONSTRAINT `base_tech_name_id_401b4baa_fk_basedata_technicalparametername_id` FOREIGN KEY (`tech_name_id`) REFERENCES `basedata_technicalparametername` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_technicalparametervalue` */ + +/*Table structure for table `basedata_trade` */ + +DROP TABLE IF EXISTS `basedata_trade`; + +CREATE TABLE `basedata_trade` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(6) NOT NULL, + `name` varchar(120) NOT NULL, + `memo` varchar(120) DEFAULT NULL, + `parent_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `basedata_trade_parent_id_40eb4a8a_fk_basedata_trade_id` (`parent_id`), + CONSTRAINT `basedata_trade_parent_id_40eb4a8a_fk_basedata_trade_id` FOREIGN KEY (`parent_id`) REFERENCES `basedata_trade` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_trade` */ + +insert into `basedata_trade`(`id`,`code`,`name`,`memo`,`parent_id`) values (1,'A','农、林、牧、渔业','',NULL),(2,'B','采矿业','',NULL),(3,'C','制造业','',NULL),(4,'D','电力、燃气及水的生产和供应业','',NULL),(5,'E','建筑业','',NULL),(6,'F','交通运输、仓储和邮政业','',NULL),(7,'G','信息传输、计算机服务和软件业','',NULL),(8,'H','批发和零售业','',NULL),(9,'I','住宿和餐饮业','',NULL),(10,'J','金融业','',NULL),(11,'K','房地产业','',NULL),(12,'L','租赁和商务服务业','',NULL),(13,'M','科学研究、技术服务和地质勘查业','',NULL),(14,'N','水利、环境和公共设施管理业','',NULL),(15,'O','居民服务和其他服务业','',NULL),(16,'P','教育','',NULL),(17,'Q','卫生、社会保障和社会福利业','',NULL),(18,'R','文化、体育和娱乐业','',NULL),(19,'S','公共管理和社会组织','',NULL),(20,'T','国际组织','',NULL); + +/*Table structure for table `basedata_valuelist` */ + +DROP TABLE IF EXISTS `basedata_valuelist`; + +CREATE TABLE `basedata_valuelist` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(6) DEFAULT NULL, + `name` varchar(40) NOT NULL, + `status` tinyint(1) NOT NULL, + `init` tinyint(1) NOT NULL, + `locked` tinyint(1) NOT NULL, + `lock_time` datetime DEFAULT NULL, + `locked_by_id` int(11) DEFAULT NULL, + `module_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `basedata_valuelist_module_id_249f4ef9_fk_syscfg_module_id` (`module_id`), + KEY `basedata_valuelist_locked_by_id_3ddaefa_fk_auth_user_id` (`locked_by_id`), + CONSTRAINT `basedata_valuelist_locked_by_id_3ddaefa_fk_auth_user_id` FOREIGN KEY (`locked_by_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `basedata_valuelist_module_id_249f4ef9_fk_syscfg_module_id` FOREIGN KEY (`module_id`) REFERENCES `syscfg_module` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_valuelist` */ + +insert into `basedata_valuelist`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`name`,`status`,`init`,`locked`,`lock_time`,`locked_by_id`,`module_id`) values (10,'2015-05-01','9999-12-31','zhugl','zhugl','2015-05-01 09:58:32','2015-05-03 08:16:48','gender','性别',1,0,0,NULL,NULL,2),(11,'2015-05-01','9999-12-31','zhugl','zhugl','2015-05-01 10:31:10','2015-05-03 07:08:51','S011','地址类型',1,0,0,NULL,NULL,2),(12,'2015-05-02','9999-12-31','zhugl','zhugl','2015-05-02 10:00:30','2015-05-03 07:08:44','S012','项目状态',1,0,0,NULL,NULL,2),(13,'2015-05-02','9999-12-31','zhugl','zhugl','2015-05-02 10:03:27','2015-05-03 07:08:28','S013','项目类别',1,0,0,NULL,NULL,2),(14,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 06:49:41','2015-05-03 06:49:41','S014','岗位序列',1,0,0,NULL,NULL,2),(15,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 06:56:08','2015-05-09 15:41:55','S015','岗位级别',1,0,0,NULL,NULL,2),(16,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 07:13:31','2015-05-03 07:13:31','S016','人员状态',1,0,0,NULL,NULL,2),(17,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 07:19:43','2015-05-03 07:19:50','S017','职员级别',1,0,0,NULL,NULL,2),(18,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 07:22:10','2015-05-03 07:22:10','S018','人员类别',1,0,0,NULL,NULL,2),(19,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 07:24:00','2015-05-03 15:12:54','S019','用工形式',1,0,0,NULL,NULL,2),(20,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 07:33:41','2015-05-03 07:33:41','S020','宗教信仰',1,0,0,NULL,NULL,2),(21,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 07:42:12','2015-05-03 08:32:32','S021','民族',1,0,0,NULL,NULL,2),(22,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 07:54:20','2015-05-03 07:54:20','S022','国家',1,0,0,NULL,NULL,2),(23,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 08:00:47','2015-05-03 08:33:02','S023','婚姻状况',1,0,0,NULL,NULL,2),(24,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 08:11:20','2015-05-03 08:32:51','S024','文化程度',1,0,0,NULL,NULL,2),(25,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 08:26:49','2015-05-03 08:32:42','S025','家庭关系',1,0,0,NULL,NULL,2),(26,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 08:39:02','2015-05-03 08:43:11','S026','政治面貌',1,0,0,NULL,NULL,2),(27,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 08:41:44','2015-05-03 08:41:44','S027','兵役状况',1,0,0,NULL,NULL,2),(28,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 08:44:29','2015-05-03 08:44:29','S028','血型',1,0,0,NULL,NULL,2),(29,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 08:51:03','2015-05-03 08:51:03','S029','人员身份',1,0,0,NULL,NULL,2),(30,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 08:52:49','2015-05-03 08:52:49','S030','合同类型',1,0,0,NULL,NULL,2),(31,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 08:54:11','2015-05-03 08:54:19','S031','合同期限类型',1,0,0,NULL,NULL,2),(32,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 08:55:13','2015-05-03 08:56:32','S032','合同密级',1,0,0,NULL,NULL,2),(33,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 08:56:17','2015-05-03 08:56:17','S033','合同变动类型',1,0,0,NULL,NULL,2),(34,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 08:58:32','2015-05-03 08:58:32','S034','工时制度',1,0,0,NULL,NULL,2),(35,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 09:56:24','2015-05-03 09:56:24','S035','教育类型',1,0,0,NULL,NULL,2),(36,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 10:02:20','2015-05-03 10:02:38','S036','从学单位类别',1,0,0,NULL,NULL,2),(37,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 10:13:32','2015-05-03 10:16:48','S037','学位',1,0,0,NULL,NULL,2),(38,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 10:16:17','2015-05-03 10:17:06','S038','专业类别',1,0,0,NULL,NULL,2),(39,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 13:41:51','2015-05-03 13:41:51','S039','复转军人标识',1,0,0,NULL,NULL,2),(40,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 14:04:26','2015-05-03 14:07:50','S040','党委负责人标识',1,0,0,NULL,NULL,2),(41,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 14:07:37','2015-05-03 14:08:16','S041','董事监事标识',1,0,0,NULL,NULL,2),(42,'2015-05-03','9999-12-31','zhugl','zhugl','2015-05-03 14:14:35','2015-05-03 14:18:08','S042','特殊工种',1,0,0,NULL,NULL,2),(43,'2015-05-03','9999-12-31','zhugl',NULL,'2015-05-03 14:21:31','2015-05-03 14:21:31','S043','身体状况',1,0,0,NULL,NULL,2),(44,'2015-05-22','9999-12-31','zhugl','zhugl','2015-05-22 22:38:58','2015-05-25 20:58:34','S044','工单类型',1,0,0,NULL,NULL,2),(45,'2015-05-22','9999-12-31','zhugl','zhugl','2015-05-22 22:41:19','2015-05-25 20:26:41','S045','业务域',1,0,0,NULL,NULL,4),(46,'2015-05-22','9999-12-31','zhugl','zhugl','2015-05-22 22:44:49','2015-05-24 20:07:18','S046','工单状态',1,0,0,NULL,NULL,4),(47,'2015-05-24','9999-12-31','zhugl','zhugl','2015-05-24 20:04:37','2015-05-24 20:06:09','S047','试用期',1,1,1,NULL,NULL,3),(48,'2015-05-24','9999-12-31','zhugl',NULL,'2015-05-24 20:11:06','2015-05-24 20:11:06','S048','工资项类别',1,0,0,NULL,NULL,3),(49,'2015-05-24','9999-12-31','zhugl','zhugl','2015-05-24 20:13:08','2015-05-24 20:13:15','S049','增减属性',1,0,0,NULL,NULL,3),(50,'2015-05-24','9999-12-31','zhugl','zhugl','2015-05-24 20:20:10','2015-05-24 20:37:22','S050','计算方式',1,0,0,NULL,NULL,3),(51,'2015-05-24','9999-12-31','zhugl','zhugl','2015-05-24 21:32:21','2015-05-24 21:32:31','S051','离职类别',1,0,0,NULL,NULL,3),(52,'2015-06-03','9999-12-31','zhugl',NULL,'2015-06-03 20:01:03','2015-06-03 20:01:03','S052','税率',1,0,0,NULL,NULL,5),(53,'2015-06-14','9999-12-31','zhugl','zhugl','2015-06-14 11:09:43','2015-06-14 12:43:38','S053','发票类别 ',1,0,0,NULL,NULL,6),(54,'2015-06-20','9999-12-31','zhugl','zhugl','2015-06-20 21:33:08','2015-06-21 11:30:19','S054','物料性质',1,0,0,NULL,NULL,2); + +/*Table structure for table `basedata_valuelistitem` */ + +DROP TABLE IF EXISTS `basedata_valuelistitem`; + +CREATE TABLE `basedata_valuelistitem` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `group_code` varchar(6) DEFAULT NULL, + `code` varchar(6) DEFAULT NULL, + `name` varchar(40) NOT NULL, + `status` tinyint(1) NOT NULL, + `weight` int(11) DEFAULT NULL, + `group_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `basedata_valuelistitem_group_id_13b9f5f2_idx` (`group_id`,`group_code`), + CONSTRAINT `basedata_valuelistite_group_id_435c66f8_fk_basedata_valuelist_id` FOREIGN KEY (`group_id`) REFERENCES `basedata_valuelist` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=416 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_valuelistitem` */ + +insert into `basedata_valuelistitem`(`id`,`group_code`,`code`,`name`,`status`,`weight`,`group_id`) values (13,'S011','01','送货地址',1,9,11),(14,'S011','02','发票地址',1,9,11),(15,'S011','03','临时地址',1,9,11),(16,'S011','04','家庭地址',0,9,11),(17,'S012','00','跟踪/新建',1,1,12),(18,'S012','01','投标/报价',1,2,12),(19,'S012','02','签订合同',1,3,12),(20,'S012','03','生产/交付',1,4,12),(21,'S012','04','验收/回款',1,5,12),(22,'S012','99','关闭',1,6,12),(23,'S013','00','产品/服务交付类',1,9,13),(24,'S013','10','技术/设备改造类',1,9,13),(25,'S013','20','内部运营类',1,9,13),(26,'S013','40','其他临时项目',1,9,13),(27,'S014','A','管理/行政类',1,9,14),(28,'S014','S','营销/市场类',1,9,14),(29,'S014','T','技术/研发类',1,9,14),(30,'S014','P','生产/操作类',1,9,14),(31,'S015','01','员级',1,9,15),(32,'S015','02','初级',1,9,15),(33,'S015','03','中级',1,9,15),(34,'S015','04','高级',1,9,15),(35,'S015','05','专家',1,9,15),(36,'S016','10','在岗工作',1,9,16),(37,'S016','11','见习期(试用)',1,9,16),(38,'S016','12','待岗',1,9,16),(39,'S016','20','离职',1,9,16),(40,'S016','21','退休',1,9,16),(41,'S016','22','终止劳动合同',1,9,16),(42,'S016','23','协商解除劳动合同',1,9,16),(43,'S016','24','劳动者主张解除劳动合同',1,9,16),(44,'S016','25','用人单位主张解除劳动合同',1,9,16),(45,'S016','30','死亡',1,9,16),(46,'S017','10','领导班子',1,9,17),(47,'S017','11','副总师(助理)',1,9,17),(48,'S017','12','部门负责人(正职)',1,9,17),(49,'S017','13','部门负责人(副职)',1,9,17),(50,'S017','14','部门内设机构负责人(正职)',1,9,17),(51,'S017','15','部门内设机构负责人(副职)',1,9,17),(52,'S017','20','一级职员',1,9,17),(53,'S017','21','二级职员',1,9,17),(54,'S017','22','三级职员',1,9,17),(55,'S017','23','四级职员',1,9,17),(56,'S017','24','五级职员',1,9,17),(57,'S017','25','六级职员',1,9,17),(58,'S017','26','七级职员',1,9,17),(59,'S017','27','八级职员',1,9,17),(60,'S018','10','经营者',1,9,18),(61,'S018','20','中层管理人员',1,9,18),(62,'S018','21','一般管理人员',1,9,18),(63,'S018','30','专业技术人员',1,9,18),(64,'S018','40','技能人员',1,9,18),(65,'S018','50','服务人员',1,9,18),(66,'S018','90','其他人员',1,9,18),(67,'S019','1','劳动合同制(长期)',1,9,19),(68,'S019','2','劳动合同制(短期)',1,9,19),(69,'S019','3','人事代理制',1,9,19),(70,'S019','4','劳务派遣制',1,9,19),(71,'S019','5','非全日制',1,9,19),(72,'S019','6','业务外包',1,9,19),(73,'S019','9','其他',1,9,19),(74,'S020','00','无宗教信仰',1,9,20),(75,'S020','10','佛教',1,9,20),(76,'S020','20','喇嘛教',1,9,20),(77,'S020','30','道教',1,9,20),(78,'S020','40','天主教',1,9,20),(79,'S020','50','基督教',1,9,20),(80,'S020','70','东正教',1,9,20),(81,'S020','80','伊斯兰教',1,9,20),(82,'S020','99','其他',1,9,20),(83,'S021','01','汉族',1,9,21),(84,'S021','02','蒙古族',1,9,21),(85,'S021','03','回族',1,9,21),(86,'S021','04','藏族',1,9,21),(87,'S021','05','维吾尔族',1,9,21),(88,'S021','06','苗族',1,9,21),(89,'S021','07','彝族',1,9,21),(90,'S021','08','壮族',1,9,21),(91,'S021','09','布依族',1,9,21),(92,'S021','10','朝鲜族',1,9,21),(93,'S021','11','满族',1,9,21),(94,'S022','CN','中国',1,9,22),(95,'S022','EG','埃及',1,9,22),(96,'S022','AT','奥地利',1,9,22),(97,'S022','AU','澳大利亚',1,9,22),(98,'S022','PK','巴基斯坦',1,9,22),(99,'S022','BR','巴西',1,9,22),(100,'S022','KP','北朝鲜',1,9,22),(101,'S022','BE','比利时',1,9,22),(102,'S022','IS','冰岛',1,9,22),(103,'S022','PL','波兰',1,9,22),(104,'S022','DK','丹麦',1,9,22),(105,'S022','DE','德国',1,9,22),(106,'S022','FR','法国',1,9,22),(107,'S022','KR','韩国',1,9,22),(108,'S022','NL','荷兰',1,9,22),(109,'S022','CA','加拿大',1,9,22),(110,'S022','US','美国',1,9,22),(111,'S022','JP','日本',1,9,22),(112,'S022','TW','中国台湾',1,9,22),(113,'S022','HK','中国香港',1,9,22),(114,'S022','ES','西班牙',1,9,22),(115,'S022','GR','希腊',1,9,22),(116,'S022','SG','新加坡',1,9,22),(117,'S022','NZ','新西兰',1,9,22),(118,'S022','IT','意大利',1,9,22),(119,'S022','GB','英国',1,9,22),(120,'S022','MO','中国澳门',1,9,22),(121,'S022','IL','以色列',1,9,22),(122,'S023','10','未婚',1,9,23),(123,'S023','20','初婚',1,9,23),(124,'S023','21','再婚',1,9,23),(125,'S023','22','复婚',1,9,23),(126,'S023','30','丧偶',1,9,23),(127,'S023','40','离婚',1,9,23),(128,'S023','90','其他',1,9,23),(129,'S024','0','研究生',1,9,24),(132,'S024','10','大学本科',1,9,24),(136,'S024','20','大学专科和专科学校',1,9,24),(144,'S024','40','技工学校',1,9,24),(146,'S024','50','高中',1,9,24),(147,'S024','60','初中',1,9,24),(148,'S024','70','小学',1,9,24),(149,'S024','80','文盲或半文盲',1,9,24),(150,'gender','0','未知的性别',1,9,10),(151,'gender','1','男性',1,9,10),(152,'gender','2','女性',1,9,10),(153,'gender','9','未说明的性别',1,9,10),(154,'S025','11','丈夫',1,9,25),(155,'S025','12','妻子',1,9,25),(156,'S025','21','独生子',1,9,25),(157,'S025','22','长子',1,9,25),(158,'S025','23','次子',1,9,25),(159,'S025','24','三子',1,9,25),(160,'S025','25','四子',1,9,25),(161,'S025','26','五子',1,9,25),(162,'S025','27','养子或继子',1,9,25),(163,'S025','28','女婿',1,9,25),(164,'S025','31','独生女',1,9,25),(165,'S025','32','长女',1,9,25),(166,'S025','33','次女',1,9,25),(167,'S025','34','三女',1,9,25),(168,'S025','35','四女',1,9,25),(169,'S025','36','五女',1,9,25),(170,'S025','37','养女或继女',1,9,25),(171,'S025','51','父亲',1,9,25),(172,'S025','52','母亲',1,9,25),(173,'S025','53','公公',1,9,25),(174,'S025','54','婆婆',1,9,25),(175,'S025','55','岳父',1,9,25),(176,'S025','56','岳母',1,9,25),(177,'S025','57','继父或养父',1,9,25),(178,'S025','58','继母或养母',1,9,25),(179,'S025','71','兄',1,9,25),(180,'S025','72','嫂',1,9,25),(181,'S025','73','弟',1,9,25),(182,'S025','74','弟媳',1,9,25),(183,'S025','75','姐姐',1,9,25),(184,'S025','76','姐夫',1,9,25),(185,'S025','77','妹妹',1,9,25),(186,'S025','78','妹夫',1,9,25),(187,'S026','01','中国共产党党员',1,9,26),(188,'S026','02','中国共产党预备党员',1,9,26),(189,'S026','03','中国共产主义青年团团员',1,9,26),(190,'S026','04','中国国民党革命委员会会员',1,9,26),(191,'S026','05','中国民主同盟盟员',1,9,26),(192,'S026','06','中国民主建国会会员',1,9,26),(193,'S026','07','中国民主促进会会员',1,9,26),(194,'S026','08','中国农工民主党党员',1,9,26),(195,'S026','09','中国致公党党员',1,9,26),(196,'S026','10','九三学社社员',1,9,26),(197,'S026','11','台湾民主自治同盟盟员',1,9,26),(198,'S026','12','无党派民主人士',1,9,26),(199,'S026','13','群众',1,9,26),(200,'S027','0','未服兵役',1,9,27),(201,'S027','1','退出现役',1,9,27),(202,'S027','2','士兵预备役',1,9,27),(203,'S027','3','军官预备役',1,9,27),(204,'S027','4','服现役',1,9,27),(205,'S027','9','其他',1,9,27),(206,'S028','0','不明',1,9,28),(207,'S028','1','A型',1,9,28),(208,'S028','2','B型',1,9,28),(209,'S028','3','O型',1,9,28),(210,'S028','4','AB型',1,9,28),(211,'S028','9','其他',1,9,28),(212,'S029','11','国家公务员',1,9,29),(213,'S029','13','专业技术人员',1,9,29),(214,'S029','17','职员',1,9,29),(215,'S029','21','企业管理人员',1,9,29),(216,'S029','24','工人',1,9,29),(217,'S029','27','农民',1,9,29),(218,'S029','31','学生',1,9,29),(219,'S029','37','现役军人',1,9,29),(220,'S029','51','自由职业者',1,9,29),(221,'S029','54','个人经营者',1,9,29),(222,'S029','70','无业人员',1,9,29),(223,'S029','80','退(离)休人员',1,9,29),(224,'S029','90','其他',1,9,29),(225,'S030','1','劳动合同',1,9,30),(226,'S030','2','岗位聘用合同',1,9,30),(227,'S030','3','聘任合同',1,9,30),(228,'S030','9','其他',1,9,30),(229,'S031','1','有固定期限',1,9,31),(230,'S031','2','无固定期限',1,9,31),(231,'S031','3','以任务为限',1,9,31),(232,'S031','9','其他',1,9,31),(233,'S032','1','严格保密',1,9,32),(234,'S032','2','需要保密',1,9,32),(235,'S032','3','无需保密',1,9,32),(236,'S033','01','初定',1,9,33),(237,'S033','02','续订',1,9,33),(238,'S033','03','变更',1,9,33),(239,'S033','04','终止',1,9,33),(240,'S033','05','解除',1,9,33),(241,'S034','1','定时',1,9,34),(242,'S034','2','不定时',1,9,34),(243,'S034','3','综合计算工时',1,9,34),(244,'S035','10','研究生教育',1,9,35),(245,'S035','20','大学本科教育',1,9,35),(246,'S035','30','大学专科教育',1,9,35),(247,'S035','40','中等职业教育',1,9,35),(248,'S035','60','普通高级中学教育',1,9,35),(249,'S035','70','初级中学教育',1,9,35),(250,'S035','80','小学教育',1,9,35),(251,'S035','90','其他',1,9,35),(252,'S035','99','非学历教育',1,9,35),(254,'S036','11','全日制小学',1,9,36),(255,'S036','12','全日制中学',1,9,36),(256,'S036','13','全日制中专',1,9,36),(257,'S036','14','全日制高等学校',1,9,36),(259,'S036','41','国家行政学院',1,9,36),(260,'S036','42','省行政学院',1,9,36),(261,'S036','49','其他行政学院(校)',1,9,36),(262,'S036','71','中央党校',1,9,36),(263,'S036','72','省委党校',1,9,36),(264,'S036','73','地、市委党校',1,9,36),(265,'S036','81','军队(武警)高等院校',1,9,36),(266,'S036','82','军队(武警)中等专科学校',1,9,36),(267,'S036','83','军队(武警)党校',1,9,36),(268,'S036','84','军队(武警)科研机构',1,9,36),(269,'S036','85','军队(武警)医院',1,9,36),(270,'S037','1','名誉博士 ',1,9,37),(271,'S037','2','博士',1,9,37),(272,'S037','3','硕士',1,9,37),(273,'S037','4','学士',1,9,37),(274,'S037','5','双学士',1,9,37),(275,'S038','01','哲学',1,9,38),(276,'S038','02','经济学',1,9,38),(277,'S038','03','法学',1,9,38),(278,'S038','04','教育学',1,9,38),(279,'S038','05','文学',1,9,38),(280,'S038','06','历史学',1,9,38),(281,'S038','07','理学',1,9,38),(282,'S038','08','工学',1,9,38),(283,'S038','09','农学',1,9,38),(284,'S038','10','医学',1,9,38),(285,'S038','11','军事学',1,9,38),(286,'S038','12','管理学',1,9,38),(287,'S038','14','建筑学',1,9,38),(288,'S037','9','其他',1,9,37),(289,'S038','99','其他',1,9,38),(290,'S039','15','复员干部',1,9,39),(291,'S039','10','军转干部',1,9,39),(292,'S039','20','转业士官',1,9,39),(293,'S039','30','复员士官',1,9,39),(294,'S039','40','退役士兵',1,9,39),(295,'S039','99','非复转军人',1,9,39),(296,'S040','1','党委(党组)书记',1,9,40),(297,'S040','2','党委(党组)副书记',1,9,40),(298,'S040','3','党委常委(党组成员)',1,9,40),(299,'S040','4','纪委书记(纪检组组长)',1,9,40),(300,'S040','6','工会主席',1,9,40),(301,'S040','8','其他党委(党组)负责人',1,9,40),(302,'S040','9','非党委负责人',1,9,40),(303,'S041','010101','董事长',1,9,41),(304,'S041','010102','副董事长',1,9,41),(305,'S041','010103','董事',1,9,41),(306,'S041','010104','职工董事',1,9,41),(307,'S041','0201','监事会主席',1,9,41),(308,'S041','0202','监事会副主席',1,9,41),(309,'S041','0203','监事',1,9,41),(310,'S041','0204','国资委派出监事',1,9,41),(311,'S041','0205','职工监事',1,9,41),(312,'S041','00','非董事监事',1,9,41),(313,'S042','00','非特殊工种',1,9,42),(314,'S042','11','汽机运行值班工',1,9,42),(315,'S042','12','锅炉运行值班工',1,9,42),(316,'S042','13','燃料运行值班工',1,9,42),(317,'S042','14','锅炉本体检修工',1,9,42),(318,'S042','15','保温工',1,9,42),(319,'S042','16','钢球磨煤机及制粉系统检修工',1,9,42),(320,'S042','17','水轮机检修工',1,9,42),(321,'S042','6','其他(由地方社会保障部门认可的特殊工种)',1,9,42),(322,'S042','21','锅炉本体安装工',1,9,42),(323,'S042','22','管道安装工',1,9,42),(324,'S042','23','筑炉瓦工',1,9,42),(325,'S042','24','装模工',1,9,42),(326,'S042','31','水轮机安装工',1,9,42),(327,'S042','32','采石工',1,9,42),(328,'S042','33','爆破',1,9,42),(329,'S042','34','石料粉碎工',1,9,42),(330,'S042','35','潜水员',1,9,42),(331,'S042','35','轮机工',1,9,42),(332,'S042','37','水手',1,9,42),(333,'S042','41','翻砂铸造工',1,9,42),(334,'S042','42','喷砂工',1,9,42),(335,'S042','43','镀锌工',1,9,42),(336,'S042','44','电镀工',1,9,42),(337,'S042','45','印刷线路制板工',1,9,42),(338,'S042','46','浸漆工',1,9,42),(339,'S042','47','电焊条制作工',1,9,42),(340,'S042','48','注塑工',1,9,42),(341,'S042','49','铆工',1,9,42),(342,'S042','51','混凝土工',1,9,42),(343,'S042','52','钢筋工',1,9,42),(344,'S042','53','架子工',1,9,42),(345,'S042','54','推土机司机',1,9,42),(346,'S042','55','挖土机司机',1,9,42),(347,'S042','56','重型载重汽车司机',1,9,42),(348,'S042','57','野外勘测工',1,9,42),(349,'S042','58','沥青工',1,9,42),(350,'S042','59','环氧树脂工',1,9,42),(351,'S043','1','健康或良好',1,9,43),(352,'S043','2','一般或较弱',1,9,43),(353,'S043','3','有慢性病(一)',1,9,43),(354,'S043','4','有慢性病(二)',1,9,43),(355,'S043','6','残疾',1,9,43),(356,'S043','7','军残',1,9,43),(357,'S044','S','内部服务',1,9,44),(358,'S044','R','设备维修',1,9,44),(359,'S044','Q','问题咨询',1,9,44),(360,'S045','HR','人事',1,1,45),(361,'S045','FI','财务',1,2,45),(362,'S045','AD','行政',1,4,45),(363,'S045','MA','市场',1,4,45),(364,'S045','BU','商务',1,5,45),(365,'S045','CS','客服',1,6,45),(366,'S045','OT','其他',1,7,45),(367,'S046','NEW','新建',1,9,46),(368,'S046','SCHE','调度',1,9,46),(369,'S046','PROC','处理',1,9,46),(370,'S046','CLOSE','关闭',1,9,46),(371,'S044','D','采购申请',1,9,44),(372,'S047','0','无试用期',1,1,47),(373,'S047','1','1个月',1,2,47),(374,'S047','2','2个月',1,2,47),(375,'S047','3','3个月',1,3,47),(376,'S047','4','4个月',1,4,47),(377,'S047','5','5个月',1,5,47),(378,'S047','6','6个月',1,6,47),(379,'S047','12','1年',1,12,47),(380,'S048','10','工资',1,9,48),(381,'S048','20','社保',1,9,48),(382,'S048','30','奖金',1,9,48),(383,'S048','40','福利',1,9,48),(384,'S048','99','其他',1,9,48),(385,'S049','+','增加',1,9,49),(386,'S049','-','扣款',1,9,49),(387,'S050','10','固定值',1,9,50),(388,'S050','20','比例值',1,9,50),(390,'S050','30','计算值',1,9,50),(391,'S051','10','个人辞职',1,9,51),(392,'S051','20','合同到期',1,9,51),(393,'S051','30','公司辞退',1,9,51),(394,'S051','40','人员死亡',1,9,51),(395,'S051','50','法定退休',1,9,51),(396,'S051','60','其他',1,9,51),(397,'S045','PO','采购',1,3,45),(398,'S052','0.00','0%',1,9,52),(399,'S052','0.03','3%',1,9,52),(400,'S052','0.05','5%',1,9,52),(401,'S052','0.07','7%',1,9,52),(402,'S052','0.10','10%',1,9,52),(403,'S052','0.17','17%',1,9,52),(404,'S053','10','普通发票',1,9,53),(405,'S053','20','增值税专用发票',1,9,53),(406,'S053','30','专业发票',1,9,53),(407,'S054','10','生产物料',1,9,54),(408,'S054','20','建筑物/培训室',1,9,54),(409,'S054','30','员工宿舍',1,9,54),(410,'S054','40','工卡/饭卡',1,9,54),(411,'S054','50','车辆',1,9,54),(412,'S054','60','图书',1,9,54),(413,'S054','70','工位',1,9,54),(414,'S054','80','工单服务',1,9,54),(415,'S054','11','办公用品',1,9,54); + +/*Table structure for table `basedata_warehouse` */ + +DROP TABLE IF EXISTS `basedata_warehouse`; + +CREATE TABLE `basedata_warehouse` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(6) DEFAULT NULL, + `name` varchar(40) NOT NULL, + `status` tinyint(1) NOT NULL, + `location` varchar(120) DEFAULT NULL, + `org_id` int(11), + PRIMARY KEY (`id`), + KEY `basedata_warehouse_9cf869aa` (`org_id`), + CONSTRAINT `basedata_warehouse_org_id_1160a0d2_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_warehouse` */ + +insert into `basedata_warehouse`(`id`,`code`,`name`,`status`,`location`,`org_id`) values (1,'A01','电力信息一号库',1,'',NULL),(2,'A02','内部运营服务',1,'',NULL),(3,'A03','办公用品仓库',1,'',NULL),(11,'FR','水果库',1,NULL,NULL); + +/*Table structure for table `basedata_warehouse_users` */ + +DROP TABLE IF EXISTS `basedata_warehouse_users`; + +CREATE TABLE `basedata_warehouse_users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `warehouse_id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `warehouse_id` (`warehouse_id`,`user_id`), + KEY `basedata_warehouse_users_user_id_c95aacd_fk_auth_user_id` (`user_id`), + CONSTRAINT `basedata_warehouse_users_user_id_c95aacd_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `basedata_warehous_warehouse_id_2b476168_fk_basedata_warehouse_id` FOREIGN KEY (`warehouse_id`) REFERENCES `basedata_warehouse` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_warehouse_users` */ + +/*Table structure for table `basedata_workexperience` */ + +DROP TABLE IF EXISTS `basedata_workexperience`; + +CREATE TABLE `basedata_workexperience` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `organization` varchar(120) NOT NULL, + `position` varchar(120) NOT NULL, + `employee_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `basedata_workexperi_employee_id_1ccfb6d0_fk_basedata_employee_id` (`employee_id`), + CONSTRAINT `basedata_workexperi_employee_id_1ccfb6d0_fk_basedata_employee_id` FOREIGN KEY (`employee_id`) REFERENCES `basedata_employee` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `basedata_workexperience` */ + +/*Table structure for table `django_admin_log` */ + +DROP TABLE IF EXISTS `django_admin_log`; + +CREATE TABLE `django_admin_log` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `action_time` datetime NOT NULL, + `object_id` longtext, + `object_repr` varchar(200) NOT NULL, + `action_flag` smallint(5) unsigned NOT NULL, + `change_message` longtext NOT NULL, + `content_type_id` int(11) DEFAULT NULL, + `user_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `django_admin__content_type_id_5151027a_fk_django_content_type_id` (`content_type_id`), + KEY `django_admin_log_user_id_1c5f563_fk_auth_user_id` (`user_id`), + CONSTRAINT `django_admin_log_user_id_1c5f563_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `django_admin__content_type_id_5151027a_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1148 DEFAULT CHARSET=utf8; + +/*Data for the table `django_admin_log` */ + +insert into `django_admin_log`(`id`,`action_time`,`object_id`,`object_repr`,`action_flag`,`change_message`,`content_type_id`,`user_id`) values (986,'2015-06-28 06:19:13','18','用户信息',3,'',75,11),(987,'2015-06-28 06:19:51','19','用户信息导入',1,'',75,11),(988,'2015-06-28 06:21:08','19','用户信息导入',2,'已修改 attach 。',75,11),(989,'2015-06-28 07:27:18','1','规章制度-考勤手册',1,'',76,11),(990,'2015-06-28 07:40:49','1','职员',2,'已修改 permissions 。',3,11),(991,'2015-06-28 08:16:44','1','【模板文档】-【基础数据】-1001部门岗位员工导入模板',2,'已修改 title,keywords,description,tp 和 attach 。',76,11),(992,'2015-06-28 08:18:34','1','【模板文档】-【基础数据】-1001部门岗位员工导入模板',2,'已修改 description 。',76,11),(993,'2015-06-28 08:20:33','1','【模板文档】-【基础数据】-1001部门岗位员工导入模板',2,'已修改 description 。',76,11),(994,'2015-06-28 08:21:18','1','【模板文档】-【基础数据】-1001部门岗位员工导入模板',2,'已修改 description 。',76,11),(995,'2015-06-28 08:23:01','2','【模板文档】-【基础数据】-1002期初库存导入模板',1,'',76,11),(996,'2015-06-28 08:23:55','2','【模板文档】-【基础数据】-1002期初库存导入模板',2,'已修改 description 。',76,11),(997,'2015-06-28 08:26:09','2','【模板文档】-【基础数据】-1002期初库存导入模板',2,'已修改 description 。',76,11),(998,'2015-06-28 08:27:02','2','【模板文档】-【基础数据】-1002期初库存导入模板',2,'已修改 description 。',76,11),(999,'2015-06-28 08:30:17','3','【模板文档】-【基础数据】-1003合作伙伴导入模板',1,'',76,11),(1000,'2015-06-28 08:31:03','3','【模板文档】-【基础数据】-1003合作伙伴导入模板',2,'已修改 description 。',76,11),(1001,'2015-06-28 08:32:25','4','【模板文档】-【基础数据】-1004项目信息导入模板',1,'',76,11),(1002,'2015-06-28 08:32:33','3','【模板文档】-【基础数据】-1003合作伙伴导入模板',2,'已修改 tp 。',76,11),(1003,'2015-06-28 08:32:43','2','【模板文档】-【基础数据】-1002期初库存导入模板',2,'已修改 tp 。',76,11),(1004,'2015-06-28 08:35:37','5','【模板文档】-【基础数据】-1005用户信息导入模板',1,'',76,11),(1005,'2015-06-28 08:35:59','5','【模板文档】-【基础数据】-1005用户信息导入模板',2,'已修改 tp 。',76,11),(1006,'2015-06-28 08:39:50','6','【模板文档】-【明细数据】-2001报价单明细导入模板',1,'',76,11),(1007,'2015-06-28 08:44:03','6','【模板文档】-【明细数据】-2001报价单明细导入模板',2,'已修改 description 。',76,11),(1008,'2015-06-28 08:45:56','6','【模板文档】-【明细数据】-2001报价单明细导入模板',2,'已修改 description 。',76,11),(1009,'2015-06-28 08:47:41','7','【模板文档】-【明细数据】-2002需求单明细导入模板',1,'',76,11),(1010,'2015-06-28 08:48:09','7','【模板文档】-【明细数据】-2002需求单明细导入模板',2,'已修改 description 。',76,11),(1011,'2015-06-28 08:50:09','8','【模板文档】-【明细数据】-2003采购单明细导入模板',1,'',76,11),(1012,'2015-06-28 08:54:09','1','【模板文档】-【基础数据】-1001部门岗位员工导入模板',2,'已修改 description 。',76,11),(1013,'2015-06-28 08:58:43','19','用户信息导入',3,'',75,11),(1014,'2015-06-28 08:58:43','16','项目导入',3,'',75,11),(1015,'2015-06-28 08:58:43','15','合作伙伴',3,'',75,11),(1016,'2015-06-28 09:03:59','20','【上线准备】-【部门|岗位|员工】数据导入',1,'',75,11),(1017,'2015-06-28 09:06:51','20','【上线准备】-【部门|岗位|员工】数据导入',2,'已修改 description 。',75,11),(1018,'2015-06-28 09:07:25','20','【上线准备】-【部门|岗位|员工】数据导入',2,'已修改 description 。',75,11),(1019,'2015-06-28 09:07:45','20','【上线准备】-【部门|岗位|员工】数据导入',2,'已修改 description 。',75,11),(1020,'2015-06-28 09:08:36','20','【上线准备】-【部门|岗位|员工】数据导入',2,'已修改 description 。',75,11),(1021,'2015-06-28 09:09:24','21','【上线准备】-【用户信息】数据导入',1,'',75,11),(1022,'2015-06-28 09:10:16','21','【上线准备】-【用户信息】数据导入',2,'已修改 description 。',75,11),(1023,'2015-06-28 09:10:30','21','【上线准备】-【用户信息】数据导入',2,'已修改 description 。',75,11),(1024,'2015-06-28 09:11:53','21','【上线准备】-【用户信息】数据导入',2,'已修改 description 。',75,11),(1025,'2015-06-28 09:12:02','20','【上线准备】-【部门|岗位|员工】数据导入',2,'已修改 description 。',75,11),(1026,'2015-06-28 09:12:46','21','【上线准备】-【用户信息】数据导入',2,'已修改 is_clear 。',75,11),(1027,'2015-06-28 09:13:34','22','【上线准备】-【合作伙伴信息】数据导入',1,'',75,11),(1028,'2015-06-28 09:14:29','22','【上线准备】-【合作伙伴信息】数据导入',2,'已修改 description 。',75,11),(1029,'2015-06-28 09:14:45','22','【上线准备】-【合作伙伴信息】数据导入',2,'已修改 description 。',75,11),(1030,'2015-06-28 09:16:24','20','【上线准备】-【部门|岗位|员工】第一步',2,'已修改 title 。',75,11),(1031,'2015-06-28 09:16:37','21','【上线准备】-【用户信息】第二步',2,'已修改 title 。',75,11),(1032,'2015-06-28 09:16:49','22','【上线准备】-【合作伙伴信息】第三步',2,'已修改 title 。',75,11),(1033,'2015-06-28 09:18:59','23','【上线准备】-【项目信息】数据导入',1,'',75,11),(1034,'2015-06-28 09:19:11','23','【上线准备】-【项目信息】第四步',2,'已修改 title 。',75,11),(1035,'2015-06-28 09:19:28','23','【上线准备】-【项目信息】第四步(可选)',2,'已修改 title 。',75,11),(1036,'2015-06-28 09:20:20','22','【上线准备】-【合作伙伴信息】第三步',2,'已修改 description 。',75,11),(1037,'2015-06-28 09:20:48','23','【上线准备】-【项目信息】第四步(可选)',2,'已修改 description 。',75,11),(1038,'2015-06-29 21:02:51','57',' 加班申请',1,'',27,11),(1039,'2015-06-29 21:03:37','58',' 调休申请',1,'',27,11),(1040,'2015-06-29 21:03:55','58','IT00058 调休申请',2,'已修改 tp 。',27,11),(1041,'2015-06-29 21:06:13','59',' 休假申请',1,'',27,11),(1042,'2015-06-29 21:07:24','58','IT00058 调休申请',2,'已修改 spec 和 warehouse 。',27,11),(1043,'2015-06-29 21:09:02','57','IT00057 加班申请',2,'已修改 spec 。',27,11),(1044,'2015-06-29 21:13:47','60',' 入职办理',1,'',27,11),(1045,'2015-06-29 21:15:17','3','IT00003 用车申请',2,'已变更 name 和 data_type for 扩展参数 \"起始里程\". 已变更 name 和 data_type for 扩展参数 \"结束里程\". 已变更 name for 扩展参数 \"所用里程\". 已变更 name for 扩展参数 \"目的地\".',27,11),(1046,'2015-06-29 21:16:00','3','IT00003 用车申请',2,'已修改 spec 。',27,11),(1047,'2015-06-29 21:16:37','57','IT00057 加班申请',2,'已修改 is_virtual 。',27,11),(1048,'2015-06-29 21:16:46','58','IT00058 调休申请',2,'已修改 can_sale 和 is_virtual 。',27,11),(1049,'2015-06-29 21:16:56','59','IT00059 休假申请',2,'已修改 can_sale 和 is_virtual 。',27,11),(1050,'2015-06-29 21:17:15','60','IT00060 入职办理',2,'已修改 is_virtual 。',27,11),(1051,'2015-06-29 21:18:44','1','IT00001 出差申请',2,'已修改 spec 。',27,11),(1052,'2015-06-29 21:22:36','61',' 用印申请',1,'',27,11),(1053,'2015-06-29 21:23:43','3','IT00003 用车申请',2,'已修改 spec 。',27,11),(1054,'2015-06-29 21:27:04','60','IT00060 入职办理',2,'已添加 扩展参数 \"ERP系统/帐号\". 已添加 扩展参数 \"邮箱开通/邮箱地址\". 已变更 name for 扩展参数 \"员工手册/保密培训\".',27,11),(1055,'2015-06-29 21:33:14','62',' 收入证明开具',1,'',27,11),(1056,'2015-06-29 21:38:11','63',' 员工离职',1,'',27,11),(1057,'2015-06-29 21:39:13','6','IT00006 F2-H03 罗浮厅',2,'已修改 spec 。',27,11),(1058,'2015-06-29 21:40:04','6','IT00006 2号楼3楼大会议室',2,'已修改 name 。',27,11),(1059,'2015-06-29 21:42:10','62','IT00062 收入证明',2,'已修改 name 。',27,11),(1060,'2015-06-29 21:42:26','62','IT00062 收入证明',2,'已修改 spec 。',27,11),(1061,'2015-06-29 22:00:18','18',' ',3,'',14,11),(1062,'2015-06-29 22:01:03','17','中国船舶重工业集团',2,'已修改 name 和 short 。',14,11),(1063,'2015-06-29 22:02:04','61','IT00061 用印申请',2,'已修改 spec 。',27,11),(1064,'2015-06-30 20:07:48','63','IT00063 离职办理',2,'已修改 name 。',27,11),(1065,'2015-06-30 20:09:12','64',' 培训申请',1,'',27,11),(1066,'2015-06-30 20:22:27','18','京东商城',1,'',14,11),(1067,'2015-06-30 20:23:07','1',' 采购物品',1,'',59,11),(1068,'2015-06-30 20:23:36','1','CG00001 采购物品',2,'已变更 price 和 tax for 采购明细 \"POItem object\". 已变更 measure,price 和 tax for 采购明细 \"POItem object\".',59,11),(1069,'2015-07-01 05:58:07','None','1',1,'',63,11),(1070,'2015-07-01 06:17:53','2','2',1,'',63,11),(1071,'2015-07-01 06:18:24','2','2',2,'没有字段被修改。',63,11),(1072,'2015-07-01 06:29:17','2','2',2,'已修改 description 。',63,11),(1073,'2015-07-01 06:32:18','2','2',2,'已修改 description 。',63,11),(1074,'2015-07-01 06:34:14','2','2',2,'已修改 description 。',63,11),(1075,'2015-07-01 06:35:11','2','2',2,'已修改 description 。',63,11),(1076,'2015-07-01 06:35:55','2','2',2,'已修改 description 。',63,11),(1077,'2015-07-01 06:37:00','2','2',2,'已修改 description 。',63,11),(1078,'2015-07-01 06:37:21','3','123',1,'',63,11),(1079,'2015-07-01 06:46:22','2','项目审批流程',1,'',34,11),(1080,'2015-07-02 05:04:19','1','张三',2,'已修改 code,gender 和 rank 。',30,11),(1081,'2015-07-02 05:16:59','13','zhangsan',1,'',4,11),(1082,'2015-07-02 05:17:08','14','lisi',1,'',4,11),(1083,'2015-07-02 05:17:21','15','wangwu',1,'',4,11),(1084,'2015-07-02 05:17:32','16','dongyong',1,'',4,11),(1085,'2015-07-02 05:18:01','16','dongyong',2,'已修改 first_name 和 groups 。',4,11),(1086,'2015-07-02 05:18:14','14','lisi',2,'已修改 first_name 和 groups 。',4,11),(1087,'2015-07-02 05:18:32','15','wangwu',2,'已修改 first_name 和 groups 。',4,11),(1088,'2015-07-02 05:18:47','13','zhangsan',2,'已修改 first_name 和 groups 。',4,11),(1089,'2015-07-02 05:19:41','16','dongyong',2,'已修改 is_staff 。',4,11),(1090,'2015-07-02 05:19:48','14','lisi',2,'已修改 is_staff 。',4,11),(1091,'2015-07-02 05:19:54','15','wangwu',2,'已修改 is_staff 。',4,11),(1092,'2015-07-02 05:20:01','13','zhangsan',2,'已修改 is_staff 。',4,11),(1093,'2015-07-02 05:22:26','2','张三',1,'',30,11),(1094,'2015-07-02 05:23:53','2','张三',2,'已修改 birthday 和 user 。',30,11),(1095,'2015-07-02 05:24:41','1','李四',2,'已修改 name,pinyin,gender 和 user 。',30,11),(1096,'2015-07-02 05:25:23','2','张三',2,'已修改 workday 和 startday 。',30,11),(1097,'2015-07-02 05:27:10','3','王五',1,'',30,11),(1098,'2015-07-02 05:28:44','4','董永',1,'',30,11),(1099,'2015-07-02 05:44:31','5','N01-商务主管审批',2,'已修改 next_user_handler 。',35,11),(1100,'2015-07-02 06:07:37','4','1004 董永',2,'已修改 user 。',30,11),(1101,'2015-07-02 06:18:45','5','N01-商务主管审批',2,'已修改 status_field 和 status_value 。',35,11),(1102,'2015-07-02 06:19:06','6','N02-财务经理审批',2,'已修改 next_user_handler,status_field 和 status_value 。',35,11),(1103,'2015-07-02 06:19:27','7','N03-总经理审批',2,'已修改 handler_type 和 positions 。',35,11),(1104,'2015-07-02 20:50:47','5','N01-商务主管审批',2,'已修改 next 。',35,11),(1105,'2015-07-02 20:58:30','5','N01-商务主管审批',2,'已修改 next 。',35,11),(1106,'2015-07-02 21:43:08','5','N01-商务主管审批',2,'已修改 can_edit 。',35,11),(1107,'2015-07-02 21:50:00','5','N01-商务主管审批',2,'已修改 can_edit 。',35,11),(1108,'2015-07-02 21:51:23','5','N01-商务主管审批',2,'已修改 can_edit 。',35,11),(1109,'2015-07-03 05:46:47','6','N02-财务经理审批',2,'已修改 action 。',35,11),(1110,'2015-07-03 06:19:36','7','内部运营项目',2,'已修改 budget 。',19,11),(1111,'2015-07-03 06:24:43','5','N01-商务主管审批',2,'已修改 next_node_handler 。',35,11),(1112,'2015-07-03 21:28:30','9','【使用手册】-功能概述',1,'',76,11),(1113,'2015-07-03 21:28:58','10','【使用手册】-基本操作',1,'',76,11),(1114,'2015-07-03 21:29:29','11','【使用手册】-个人自助',1,'',76,11),(1115,'2015-07-03 21:29:58','12','【使用手册】-销售管理',1,'',76,11),(1116,'2015-07-03 21:30:39','13','【使用手册】-采购管理',1,'',76,11),(1117,'2015-07-03 21:31:19','14','【使用手册】-库存管理',1,'',76,11),(1118,'2015-07-03 21:31:41','15','【使用手册】-组织机构',1,'',76,11),(1119,'2015-07-03 21:32:03','16','【使用手册】-基础数据',1,'',76,11),(1120,'2015-07-03 21:32:26','17','【使用手册】-工作流管理',1,'',76,11),(1121,'2015-07-04 10:56:34','1','-申请采购办公用品一批',1,'',40,13),(1122,'2015-07-04 11:06:00','9','中海洋船舶工业集团张江工业园配电柜项目',1,'',19,13),(1123,'2015-07-04 11:58:58','2','-出差申请(重庆)',1,'',40,13),(1124,'2015-07-04 12:15:27','3','-用车申请(张江)',1,'',40,13),(1125,'2015-07-04 12:18:14','4','-用车申请(张江)',1,'',40,13),(1126,'2015-07-04 12:20:21','3','WO00003-用车申请(张江)',2,'已修改 classification 。',40,13),(1127,'2015-07-04 13:36:53','1',' 张三 2015年3月份行政部备用金 J:3000.00 Y:3000.00',1,'',43,13),(1128,'2015-07-04 13:38:14','1','15年3月份行政部费用报销',1,'',44,13),(1129,'2015-07-04 13:39:34','1','15年3月份行政部费用报销',2,'已添加 费用明细 \"ReimbursementItem object\". 已添加 费用明细 \"ReimbursementItem object\".',44,13),(1130,'2015-07-04 13:39:59','1','15年3月份行政部费用报销',2,'已修改 description 。',44,13),(1131,'2015-07-04 15:18:13','3','WO00003-用车申请(张江)',2,'已修改 classification 。',40,13),(1132,'2015-07-04 15:19:05','3','WO00003-2号楼3楼男厕所小便池堵塞',2,'已修改 title 和 description 。',40,13),(1133,'2015-07-04 18:15:02','1','WO00001-申请采购办公用品一批',2,'已修改 description 。',40,13),(1134,'2015-07-04 18:21:01','1','WO00001-申请采购办公用品一批',2,'已修改 service 。',40,13),(1135,'2015-07-07 21:09:47','1','123',1,'',69,11),(1136,'2015-07-07 21:10:14','1','123',2,'已变更 measure 和 sale_price for 报价明细 \"OfferItem object\". 已变更 measure for 报价明细 \"OfferItem object\". 已变更 measure for 报价明细 \"OfferItem object\".',69,11),(1137,'2015-07-15 12:04:06','20','【上线准备】-【部门|岗位|员工】第一步',2,'已修改 attach 。',75,11),(1138,'2015-07-15 12:10:58','20','【上线准备】-【部门|岗位|员工】第一步',2,'已修改 attach 。',75,11),(1139,'2015-07-15 12:36:18','1','11',1,'',54,11),(1140,'2015-07-15 12:36:39','1','11',2,'已变更 inventory for 出库明细 \"OutItem object\".',54,11),(1141,'2015-07-15 12:39:11','1','会议接待领用水果',2,'已修改 title 。 已变更 cnt for 出库明细 \"OutItem object\".',54,11),(1142,'2015-07-17 12:07:05','1','一批物资入库',1,'',53,11),(1143,'2015-07-17 12:07:23','1','一批办公物资入库',2,'已修改 title 。',53,11),(1144,'2015-07-17 12:09:39','2','调整一批物资库存',1,'',73,11),(1145,'2015-07-17 12:12:39','1','归还物资',1,'',71,11),(1146,'2015-07-17 12:14:55','1','归还物资',2,'已变更 cnt for 返库明细 \"ReturnItem object\".',71,11),(1147,'2015-07-17 12:16:36','1','上海某集团有限公司',2,'已修改 name 。',16,11); + +/*Table structure for table `django_content_type` */ + +DROP TABLE IF EXISTS `django_content_type`; + +CREATE TABLE `django_content_type` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `app_label` varchar(100) NOT NULL, + `model` varchar(100) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `django_content_type_app_label_3ec8c61c_uniq` (`app_label`,`model`) +) ENGINE=InnoDB AUTO_INCREMENT=77 DEFAULT CHARSET=utf8; + +/*Data for the table `django_content_type` */ + +insert into `django_content_type`(`id`,`app_label`,`model`) values (1,'admin','logentry'),(3,'auth','group'),(2,'auth','permission'),(4,'auth','user'),(13,'basedata','address'),(15,'basedata','bankaccount'),(23,'basedata','brand'),(24,'basedata','category'),(75,'basedata','dataimport'),(76,'basedata','document'),(32,'basedata','education'),(30,'basedata','employee'),(29,'basedata','expenseaccount'),(39,'basedata','extraparam'),(31,'basedata','family'),(27,'basedata','material'),(28,'basedata','materialparam'),(21,'basedata','measure'),(14,'basedata','partner'),(19,'basedata','project'),(25,'basedata','technicalparametername'),(26,'basedata','technicalparametervalue'),(22,'basedata','trade'),(11,'basedata','valuelist'),(12,'basedata','valuelistitem'),(20,'basedata','warehouse'),(33,'basedata','workexperience'),(5,'contenttypes','contenttype'),(50,'hr','departure'),(48,'hr','employeesalaryitem'),(47,'hr','entry'),(46,'hr','salaryitem'),(49,'hr','transfer'),(74,'invent','adjustitem'),(57,'invent','initem'),(52,'invent','initialinventory'),(56,'invent','inititem'),(55,'invent','inoutdetail'),(51,'invent','inventory'),(58,'invent','outitem'),(72,'invent','returnitem'),(53,'invent','stockin'),(54,'invent','stockout'),(73,'invent','wareadjust'),(71,'invent','warereturn'),(16,'organ','organization'),(17,'organ','orgunit'),(18,'organ','position'),(61,'purchase','invoice'),(62,'purchase','payment'),(60,'purchase','poitem'),(59,'purchase','purchaseorder'),(70,'sale','offeritem'),(69,'sale','offersheet'),(68,'sale','paymentcollection'),(67,'sale','saleitem'),(66,'sale','saleorder'),(63,'selfhelp','activity'),(65,'selfhelp','enroll'),(64,'selfhelp','feedback'),(43,'selfhelp','loan'),(44,'selfhelp','reimbursement'),(45,'selfhelp','reimbursementitem'),(41,'selfhelp','woextravalue'),(42,'selfhelp','woitem'),(40,'selfhelp','workorder'),(6,'sessions','session'),(9,'syscfg','menu'),(8,'syscfg','module'),(10,'syscfg','role'),(7,'syscfg','site'),(37,'workflow','history'),(36,'workflow','instance'),(34,'workflow','modal'),(35,'workflow','node'),(38,'workflow','todolist'); + +/*Table structure for table `django_migrations` */ + +DROP TABLE IF EXISTS `django_migrations`; + +CREATE TABLE `django_migrations` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `app` varchar(255) NOT NULL, + `name` varchar(255) NOT NULL, + `applied` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=122 DEFAULT CHARSET=utf8; + +/*Data for the table `django_migrations` */ + +insert into `django_migrations`(`id`,`app`,`name`,`applied`) values (1,'contenttypes','0001_initial','2015-05-01 07:28:26'),(2,'auth','0001_initial','2015-05-01 07:28:26'),(3,'admin','0001_initial','2015-05-01 07:28:26'),(4,'contenttypes','0002_remove_content_type_name','2015-05-01 07:28:26'),(5,'auth','0002_alter_permission_name_max_length','2015-05-01 07:28:26'),(6,'auth','0003_alter_user_email_max_length','2015-05-01 07:28:26'),(7,'auth','0004_alter_user_username_opts','2015-05-01 07:28:26'),(8,'auth','0005_alter_user_last_login_null','2015-05-01 07:28:26'),(9,'auth','0006_require_contenttypes_0002','2015-05-01 07:28:26'),(10,'sessions','0001_initial','2015-05-01 07:28:26'),(11,'syscfg','0001_initial','2015-05-01 07:28:27'),(12,'basedata','0001_initial','2015-05-01 09:25:30'),(13,'basedata','0002_auto_20150501_0929','2015-05-01 09:30:01'),(14,'basedata','0003_auto_20150501_0931','2015-05-01 09:31:07'),(15,'basedata','0004_address','2015-05-01 10:52:00'),(16,'basedata','0005_auto_20150501_1121','2015-05-01 11:21:30'),(17,'basedata','0006_partner','2015-05-01 12:02:16'),(18,'basedata','0007_bankaccount','2015-05-01 15:35:20'),(19,'basedata','0008_auto_20150501_1547','2015-05-01 15:48:03'),(20,'organ','0001_initial','2015-05-01 19:14:41'),(21,'organ','0002_auto_20150501_2036','2015-05-01 20:36:43'),(22,'organ','0003_auto_20150501_2045','2015-05-01 20:46:03'),(23,'basedata','0009_auto_20150502_0817','2015-05-02 08:17:55'),(24,'basedata','0010_auto_20150502_0851','2015-05-02 08:51:53'),(25,'basedata','0011_auto_20150502_0934','2015-05-02 09:34:17'),(26,'basedata','0012_auto_20150502_0946','2015-05-02 09:46:24'),(27,'basedata','0013_auto_20150502_1311','2015-05-02 13:11:33'),(28,'basedata','0014_auto_20150502_1314','2015-05-02 13:14:16'),(29,'basedata','0015_brand_weight','2015-05-02 13:21:10'),(30,'basedata','0016_auto_20150502_1402','2015-05-02 14:04:33'),(31,'basedata','0017_auto_20150502_1731','2015-05-02 17:31:10'),(32,'basedata','0018_auto_20150502_2100','2015-05-02 21:00:06'),(33,'organ','0004_auto_20150503_1445','2015-05-03 14:46:12'),(34,'basedata','0019_auto_20150503_1445','2015-05-03 14:46:12'),(35,'basedata','0020_auto_20150503_1501','2015-05-03 15:01:41'),(36,'basedata','0021_auto_20150503_1518','2015-05-03 15:18:14'),(37,'basedata','0022_auto_20150503_1538','2015-05-03 15:38:24'),(38,'basedata','0023_auto_20150504_2120','2015-05-04 21:20:32'),(39,'basedata','0024_education_family_workexperience','2015-05-04 21:59:53'),(44,'organ','0005_auto_20150510_1141','2015-05-10 11:41:46'),(49,'workflow','0001_initial','2015-05-10 12:18:40'),(50,'workflow','0002_auto_20150513_2124','2015-05-13 21:24:50'),(51,'basedata','0025_auto_20150516_1829','2015-05-16 18:30:12'),(52,'basedata','0026_extraparam','2015-05-22 22:01:36'),(53,'selfhelp','0001_initial','2015-05-22 23:06:19'),(54,'selfhelp','0002_auto_20150522_2330','2015-05-22 23:30:14'),(55,'selfhelp','0003_auto_20150523_0621','2015-05-23 06:21:46'),(56,'basedata','0027_auto_20150523_2007','2015-05-23 20:07:34'),(57,'selfhelp','0004_auto_20150523_2007','2015-05-23 20:07:35'),(58,'selfhelp','0005_auto_20150523_2031','2015-05-23 20:31:54'),(59,'selfhelp','0006_auto_20150523_2050','2015-05-23 20:50:08'),(60,'selfhelp','0007_auto_20150523_2052','2015-05-23 20:52:17'),(61,'selfhelp','0008_auto_20150523_2133','2015-05-23 21:33:23'),(62,'selfhelp','0009_auto_20150523_2146','2015-05-23 21:46:15'),(65,'workflow','0003_auto_20150524_2208','2015-05-24 22:23:11'),(67,'hr','0001_initial','2015-05-25 22:12:43'),(68,'selfhelp','0010_auto_20150525_2255','2015-05-25 22:55:20'),(69,'selfhelp','0011_auto_20150603_1344','2015-06-03 13:44:59'),(70,'basedata','0028_auto_20150603_1444','2015-06-03 14:44:39'),(71,'invent','0001_initial','2015-06-03 15:56:04'),(72,'purchase','0001_initial','2015-06-03 20:27:01'),(73,'purchase','0002_auto_20150603_2117','2015-06-03 21:17:30'),(74,'purchase','0003_auto_20150603_2202','2015-06-03 22:02:53'),(75,'basedata','0029_auto_20150606_0944','2015-06-06 09:44:41'),(76,'basedata','0030_auto_20150606_0949','2015-06-06 09:49:22'),(77,'purchase','0004_auto_20150606_1050','2015-06-06 10:50:56'),(78,'invent','0002_auto_20150606_1050','2015-06-06 10:50:57'),(79,'invent','0003_auto_20150606_1147','2015-06-06 11:48:06'),(80,'purchase','0005_poitem_measure','2015-06-06 11:48:07'),(81,'invent','0004_initem_po_item','2015-06-06 11:54:49'),(82,'invent','0005_auto_20150606_1205','2015-06-06 12:06:09'),(83,'invent','0006_stockin_batch','2015-06-06 12:08:31'),(84,'invent','0007_auto_20150606_2008','2015-06-06 20:08:50'),(85,'invent','0008_inoutdetail_status','2015-06-06 20:30:43'),(86,'invent','0009_auto_20150607_1132','2015-06-07 11:33:09'),(87,'invent','0010_auto_20150607_1202','2015-06-07 12:03:02'),(88,'purchase','0006_auto_20150607_1202','2015-06-07 12:03:04'),(89,'purchase','0007_auto_20150607_1353','2015-06-07 13:53:55'),(90,'invent','0011_outitem_inventory','2015-06-08 21:07:50'),(91,'basedata','0031_auto_20150608_2143','2015-06-08 21:44:17'),(92,'invent','0012_auto_20150608_2143','2015-06-08 21:44:18'),(93,'invent','0013_auto_20150609_0623','2015-06-09 06:23:21'),(94,'purchase','0008_invoice','2015-06-10 20:51:34'),(95,'purchase','0009_auto_20150610_2133','2015-06-10 21:33:08'),(96,'selfhelp','0012_activity_enroll_feedback','2015-06-11 21:37:16'),(97,'selfhelp','0013_activity_code','2015-06-11 21:41:50'),(98,'invent','0014_auto_20150613_1747','2015-06-13 17:48:07'),(99,'sale','0001_initial','2015-06-14 12:07:39'),(100,'sale','0002_auto_20150614_1748','2015-06-14 17:48:34'),(101,'sale','0003_paymentcollection_org','2015-06-14 17:51:18'),(102,'purchase','0010_auto_20150614_1822','2015-06-14 18:22:22'),(103,'sale','0004_auto_20150614_2026','2015-06-14 20:26:59'),(104,'sale','0005_offeritem_discount_price','2015-06-14 20:31:16'),(105,'sale','0006_auto_20150617_2108','2015-06-17 21:08:38'),(106,'sale','0007_saleitem_discount_price','2015-06-20 21:16:32'),(107,'basedata','0032_material_tp','2015-06-20 21:35:33'),(108,'invent','0015_auto_20150621_0836','2015-06-21 08:36:19'),(109,'invent','0016_auto_20150621_1425','2015-06-21 14:25:45'),(110,'basedata','0033_auto_20150622_1009','2015-06-22 10:09:50'),(111,'selfhelp','0014_auto_20150627_0534','2015-06-27 05:34:44'),(112,'selfhelp','0015_loan_is_clear','2015-06-27 06:45:06'),(113,'purchase','0011_purchaseorder_attach','2015-06-27 19:58:41'),(114,'selfhelp','0016_auto_20150627_2039','2015-06-27 20:40:10'),(115,'basedata','0034_auto_20150627_2055','2015-06-27 20:56:46'),(116,'selfhelp','0017_woitem_measure','2015-06-27 20:56:47'),(117,'basedata','0035_document','2015-06-28 07:13:21'),(118,'workflow','0004_auto_20150630_2042','2015-06-30 20:43:08'),(119,'workflow','0005_auto_20150630_2138','2015-06-30 21:38:29'),(120,'workflow','0006_node_action','2015-06-30 22:10:27'),(121,'workflow','0007_node_can_edit','2015-07-02 21:12:10'); + +/*Table structure for table `django_session` */ + +DROP TABLE IF EXISTS `django_session`; + +CREATE TABLE `django_session` ( + `session_key` varchar(40) NOT NULL, + `session_data` longtext NOT NULL, + `expire_date` datetime NOT NULL, + PRIMARY KEY (`session_key`), + KEY `django_session_de54fa62` (`expire_date`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `django_session` */ + +insert into `django_session`(`session_key`,`session_data`,`expire_date`) values ('2rdw4agh630yjfqhy14jie3dgzhi8v8i','OGEyMjM1MDM3YmU1ZmE4NjYxNmIzOWE5MTY3NjYzZjhhNDUyMWQxMDp7Il9hdXRoX3VzZXJfaGFzaCI6IjUzODFkNDg2MjM0YTlmMTQ0YjBkM2Y4ZWY4NWNmMDZlMmRkYjE1MWMiLCJfYXV0aF91c2VyX2JhY2tlbmQiOiJkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZCIsIl9hdXRoX3VzZXJfaWQiOiIxIn0=','2015-05-16 08:18:20'),('9yr00u8rvtplvssvra5nkw29ykbs9cxo','OGEyMjM1MDM3YmU1ZmE4NjYxNmIzOWE5MTY3NjYzZjhhNDUyMWQxMDp7Il9hdXRoX3VzZXJfaGFzaCI6IjUzODFkNDg2MjM0YTlmMTQ0YjBkM2Y4ZWY4NWNmMDZlMmRkYjE1MWMiLCJfYXV0aF91c2VyX2JhY2tlbmQiOiJkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZCIsIl9hdXRoX3VzZXJfaWQiOiIxIn0=','2015-06-24 20:54:54'),('bffad131mfdzd3ti0eat4ixwbaedqqfn','OGEyMjM1MDM3YmU1ZmE4NjYxNmIzOWE5MTY3NjYzZjhhNDUyMWQxMDp7Il9hdXRoX3VzZXJfaGFzaCI6IjUzODFkNDg2MjM0YTlmMTQ0YjBkM2Y4ZWY4NWNmMDZlMmRkYjE1MWMiLCJfYXV0aF91c2VyX2JhY2tlbmQiOiJkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZCIsIl9hdXRoX3VzZXJfaWQiOiIxIn0=','2015-05-15 07:39:11'); + +/*Table structure for table `hr_departure` */ + +DROP TABLE IF EXISTS `hr_departure`; + +CREATE TABLE `hr_departure` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `employee_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `hr_departure_employee_id_cd15087_fk_basedata_employee_id` (`employee_id`), + CONSTRAINT `hr_departure_employee_id_cd15087_fk_basedata_employee_id` FOREIGN KEY (`employee_id`) REFERENCES `basedata_employee` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `hr_departure` */ + +/*Table structure for table `hr_employeesalaryitem` */ + +DROP TABLE IF EXISTS `hr_employeesalaryitem`; + +CREATE TABLE `hr_employeesalaryitem` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `calculate_way` varchar(2) NOT NULL, + `fixed_value` decimal(10,2) DEFAULT NULL, + `base_value` decimal(10,2) DEFAULT NULL, + `org_percent` decimal(4,2) DEFAULT NULL, + `employee_percent` decimal(4,2) DEFAULT NULL, + `employee_id` int(11) DEFAULT NULL, + `entry_id` int(11) NOT NULL, + `salary_item_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `hr_employeesalaryitem_entry_id_3a7aa921_uniq` (`entry_id`,`salary_item_id`), + KEY `hr_employeesalaryit_employee_id_3ca63cb3_fk_basedata_employee_id` (`employee_id`), + KEY `hr_employeesalaryitem_b64a62ea` (`entry_id`), + KEY `hr_employeesalaryitem_dc6d0554` (`salary_item_id`), + CONSTRAINT `hr_employeesalaryitem_entry_id_24d5804c_fk_hr_entry_id` FOREIGN KEY (`entry_id`) REFERENCES `hr_entry` (`id`), + CONSTRAINT `hr_employeesalaryite_salary_item_id_308f4922_fk_hr_salaryitem_id` FOREIGN KEY (`salary_item_id`) REFERENCES `hr_salaryitem` (`id`), + CONSTRAINT `hr_employeesalaryit_employee_id_3ca63cb3_fk_basedata_employee_id` FOREIGN KEY (`employee_id`) REFERENCES `basedata_employee` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `hr_employeesalaryitem` */ + +/*Table structure for table `hr_entry` */ + +DROP TABLE IF EXISTS `hr_entry`; + +CREATE TABLE `hr_entry` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `name` varchar(120) NOT NULL, + `pinyin` varchar(120) DEFAULT NULL, + `birthday` date DEFAULT NULL, + `gender` varchar(2) NOT NULL, + `idcard` varchar(20) NOT NULL, + `address` varchar(120) DEFAULT NULL, + `zipcode` varchar(8) NOT NULL, + `phone` varchar(20) DEFAULT NULL, + `rank` varchar(2) NOT NULL, + `ygxs` varchar(2) DEFAULT NULL, + `category` varchar(2) DEFAULT NULL, + `probation_months` varchar(2) NOT NULL, + `probation_begin` date NOT NULL, + `probation_end` date DEFAULT NULL, + `memo` longtext, + `profile` varchar(100) DEFAULT NULL, + `guider_id` int(11) NOT NULL, + `position_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `hr_entry_guider_id_677409a1_fk_basedata_employee_id` (`guider_id`), + KEY `hr_entry_position_id_70f8683c_fk_organ_position_id` (`position_id`), + CONSTRAINT `hr_entry_guider_id_677409a1_fk_basedata_employee_id` FOREIGN KEY (`guider_id`) REFERENCES `basedata_employee` (`id`), + CONSTRAINT `hr_entry_position_id_70f8683c_fk_organ_position_id` FOREIGN KEY (`position_id`) REFERENCES `organ_position` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `hr_entry` */ + +/*Table structure for table `hr_salaryitem` */ + +DROP TABLE IF EXISTS `hr_salaryitem`; + +CREATE TABLE `hr_salaryitem` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(10) DEFAULT NULL, + `name` varchar(120) NOT NULL, + `classification` varchar(2) NOT NULL, + `plus_or_minus` varchar(2) NOT NULL, + `required` tinyint(1) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; + +/*Data for the table `hr_salaryitem` */ + +insert into `hr_salaryitem`(`id`,`code`,`name`,`classification`,`plus_or_minus`,`required`) values (1,'1001','基本工资','10','+',1),(2,'1002','岗位工资','10','+',1),(3,'1003','技能工资','10','+',1),(4,'1004','学历工资','10','+',1),(5,'1006','职务工资','10','+',1),(6,'2001','养老保险','20','-',1),(7,'2002','医疗保险','20','-',1),(8,'2003','生育保险','20','-',1),(9,'2004','失业保险','20','-',1),(10,'2005','工伤保险','20','-',1),(11,'2006','住房公积金','20','-',1),(12,'3001','销售佣金','30','+',0),(13,'3002','伯乐奖','30','+',0),(14,'4001','高温费','40','+',0),(15,'4002','取暖费','40','+',0),(16,'4003','独生子女费','40','+',0),(17,'4004','交通费','40','+',0),(18,'4005','住房补贴','40','+',0); + +/*Table structure for table `hr_transfer` */ + +DROP TABLE IF EXISTS `hr_transfer`; + +CREATE TABLE `hr_transfer` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `employee_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `hr_transfer_employee_id_58f1c915_fk_basedata_employee_id` (`employee_id`), + CONSTRAINT `hr_transfer_employee_id_58f1c915_fk_basedata_employee_id` FOREIGN KEY (`employee_id`) REFERENCES `basedata_employee` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `hr_transfer` */ + +/*Table structure for table `invent_adjustitem` */ + +DROP TABLE IF EXISTS `invent_adjustitem`; + +CREATE TABLE `invent_adjustitem` ( + `inoutdetail_ptr_id` int(11) NOT NULL, + `inventory_id` int(11) DEFAULT NULL, + `master_id` int(11) NOT NULL, + PRIMARY KEY (`inoutdetail_ptr_id`), + KEY `invent_adjustitem_inventory_id_26479e75_fk_invent_inventory_id` (`inventory_id`), + KEY `invent_adjustitem_90349b61` (`master_id`), + CONSTRAINT `invent_adjustitem_inventory_id_26479e75_fk_invent_inventory_id` FOREIGN KEY (`inventory_id`) REFERENCES `invent_inventory` (`id`), + CONSTRAINT `invent_adjustitem_master_id_4e55f6a0_fk_invent_wareadjust_id` FOREIGN KEY (`master_id`) REFERENCES `invent_wareadjust` (`id`), + CONSTRAINT `invent_adju_inoutdetail_ptr_id_56d701c4_fk_invent_inoutdetail_id` FOREIGN KEY (`inoutdetail_ptr_id`) REFERENCES `invent_inoutdetail` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `invent_adjustitem` */ + +insert into `invent_adjustitem`(`inoutdetail_ptr_id`,`inventory_id`,`master_id`) values (102,49,1),(103,48,1),(104,47,1),(108,51,2),(109,49,2),(110,45,2); + +/*Table structure for table `invent_initem` */ + +DROP TABLE IF EXISTS `invent_initem`; + +CREATE TABLE `invent_initem` ( + `inoutdetail_ptr_id` int(11) NOT NULL, + `master_id` int(11) NOT NULL, + `po_item_id` int(11), + PRIMARY KEY (`inoutdetail_ptr_id`), + KEY `invent_initem_master_id_777093cc_fk_invent_stockin_id` (`master_id`), + KEY `invent_initem_2a7dcb03` (`po_item_id`), + CONSTRAINT `invent_initem_master_id_777093cc_fk_invent_stockin_id` FOREIGN KEY (`master_id`) REFERENCES `invent_stockin` (`id`), + CONSTRAINT `invent_initem_po_item_id_10308e1c_fk_purchase_poitem_id` FOREIGN KEY (`po_item_id`) REFERENCES `purchase_poitem` (`id`), + CONSTRAINT `invent_init_inoutdetail_ptr_id_62cb8948_fk_invent_inoutdetail_id` FOREIGN KEY (`inoutdetail_ptr_id`) REFERENCES `invent_inoutdetail` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `invent_initem` */ + +insert into `invent_initem`(`inoutdetail_ptr_id`,`master_id`,`po_item_id`) values (106,1,1),(107,1,2); + +/*Table structure for table `invent_initialinventory` */ + +DROP TABLE IF EXISTS `invent_initialinventory`; + +CREATE TABLE `invent_initialinventory` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `title` varchar(40) NOT NULL, + `status` varchar(2) NOT NULL, + `execute_time` datetime DEFAULT NULL, + `org_id` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT NULL, + `amount` decimal(14,4), + `attach` varchar(100), + PRIMARY KEY (`id`), + KEY `invent_initialinventory_org_id_5505a597_fk_organ_organization_id` (`org_id`), + KEY `invent_initialinventory_user_id_52fe41ef_fk_auth_user_id` (`user_id`), + CONSTRAINT `invent_initialinventory_org_id_5505a597_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `invent_initialinventory_user_id_52fe41ef_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; + +/*Data for the table `invent_initialinventory` */ + +insert into `invent_initialinventory`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`title`,`status`,`execute_time`,`org_id`,`user_id`,`amount`,`attach`) values (15,'2015-06-14','9999-12-31','zhugl',NULL,'2015-06-14 13:22:36','2015-06-14 13:22:54','QC015','期初库存x12','9','2015-06-14 13:22:54',1,NULL,'19438.0000','inventory/INVENTORY_PPfDioe.csv'); + +/*Table structure for table `invent_inititem` */ + +DROP TABLE IF EXISTS `invent_inititem`; + +CREATE TABLE `invent_inititem` ( + `inoutdetail_ptr_id` int(11) NOT NULL, + `master_id` int(11) NOT NULL, + PRIMARY KEY (`inoutdetail_ptr_id`), + KEY `invent_inititem_master_id_2e3b4e8d_fk_invent_initialinventory_id` (`master_id`), + CONSTRAINT `invent_inititem_master_id_2e3b4e8d_fk_invent_initialinventory_id` FOREIGN KEY (`master_id`) REFERENCES `invent_initialinventory` (`id`), + CONSTRAINT `invent_init_inoutdetail_ptr_id_4be99311_fk_invent_inoutdetail_id` FOREIGN KEY (`inoutdetail_ptr_id`) REFERENCES `invent_inoutdetail` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `invent_inititem` */ + +insert into `invent_inititem`(`inoutdetail_ptr_id`,`master_id`) values (76,15),(77,15),(78,15),(79,15),(80,15),(81,15),(82,15),(83,15),(84,15),(85,15); + +/*Table structure for table `invent_inoutdetail` */ + +DROP TABLE IF EXISTS `invent_inoutdetail`; + +CREATE TABLE `invent_inoutdetail` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `create_time` datetime NOT NULL, + `event_time` datetime DEFAULT NULL, + `batch` varchar(20) DEFAULT NULL, + `price` decimal(14,4) DEFAULT NULL, + `prop` varchar(2) NOT NULL, + `source` varchar(20) DEFAULT NULL, + `material_id` int(11) DEFAULT NULL, + `measure_id` int(11) DEFAULT NULL, + `warehouse_id` int(11) DEFAULT NULL, + `cnt` decimal(14,4) DEFAULT NULL, + `status` tinyint(1) NOT NULL, + PRIMARY KEY (`id`), + KEY `invent_inoutdetail_eb4b9aaa` (`material_id`), + KEY `invent_inoutdetail_80c371ce` (`measure_id`), + KEY `invent_inoutdetail_9744817e` (`warehouse_id`), + CONSTRAINT `invent_inoutdetail_material_id_61f641de_fk_basedata_material_id` FOREIGN KEY (`material_id`) REFERENCES `basedata_material` (`id`), + CONSTRAINT `invent_inoutdetail_measure_id_24903062_fk_basedata_measure_id` FOREIGN KEY (`measure_id`) REFERENCES `basedata_measure` (`id`), + CONSTRAINT `invent_inoutdetail_warehouse_id_b6de15f_fk_basedata_warehouse_id` FOREIGN KEY (`warehouse_id`) REFERENCES `basedata_warehouse` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=utf8; + +/*Data for the table `invent_inoutdetail` */ + +insert into `invent_inoutdetail`(`id`,`create_time`,`event_time`,`batch`,`price`,`prop`,`source`,`material_id`,`measure_id`,`warehouse_id`,`cnt`,`status`) values (76,'2015-06-14 13:22:36','2015-06-14 13:22:54',NULL,'5.6000','+','QC015',40,3,11,'120.0000',1),(77,'2015-06-14 13:22:36','2015-06-14 13:22:54',NULL,'8.2000','+','QC015',41,3,11,'105.0000',1),(78,'2015-06-14 13:22:36','2015-06-14 13:22:54',NULL,'9.5000','+','QC015',42,3,11,'569.0000',1),(79,'2015-06-14 13:22:36','2015-06-14 13:22:54',NULL,'6.5000','+','QC015',43,3,11,'159.0000',1),(80,'2015-06-14 13:22:36','2015-06-14 13:22:54',NULL,'7.8000','+','QC015',44,3,11,'276.0000',1),(81,'2015-06-14 13:22:36','2015-06-14 13:22:54',NULL,'6.9000','+','QC015',45,3,11,'309.0000',1),(82,'2015-06-14 13:22:36','2015-06-14 13:22:54',NULL,'12.6000','+','QC015',46,3,11,'38.0000',1),(83,'2015-06-14 13:22:36','2015-06-14 13:22:54',NULL,'8.2000','+','QC015',47,3,11,'98.0000',1),(84,'2015-06-14 13:22:36','2015-06-14 13:22:54',NULL,'8.9000','+','QC015',48,3,11,'315.0000',1),(85,'2015-06-14 13:22:36','2015-06-14 13:22:54',NULL,'14.6000','+','QC015',49,3,11,'212.0000',1),(102,'2015-06-21 14:34:47','2015-06-21 14:42:33',NULL,NULL,'+','TZ001',47,3,11,'1.0000',1),(103,'2015-06-21 14:34:47','2015-06-21 14:42:33',NULL,NULL,'+','TZ001',46,3,11,'1.0000',1),(104,'2015-06-21 14:34:47','2015-06-21 14:42:33',NULL,NULL,'+','TZ001',45,3,11,'1.0000',1),(105,'2015-07-15 12:36:18','2015-07-15 12:43:35',NULL,'5.6000','-','CK00001',40,3,11,'5.0000',1),(106,'2015-07-17 12:07:05','2015-07-17 12:29:02','','27.3504','+','RK00001',4,1,3,'5.0000',1),(107,'2015-07-17 12:07:05','2015-07-17 12:29:02','','255.5556','+','RK00001',55,1,3,'5.0000',1),(108,'2015-07-17 12:09:39','2015-07-17 12:37:12',NULL,NULL,'+','TZ002',49,3,11,'1.0000',1),(109,'2015-07-17 12:09:39','2015-07-17 12:37:12',NULL,NULL,'-','TZ002',47,3,11,'2.0000',1),(110,'2015-07-17 12:09:39','2015-07-17 12:37:12',NULL,NULL,'+','TZ002',43,3,11,'1.0000',1),(111,'2015-07-17 12:12:39','2015-07-17 12:56:25',NULL,'5.6000','+','FK0001',40,3,11,'2.0000',1); + +/*Table structure for table `invent_inventory` */ + +DROP TABLE IF EXISTS `invent_inventory`; + +CREATE TABLE `invent_inventory` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `batch` varchar(20) DEFAULT NULL, + `price` decimal(14,4) NOT NULL, + `material_id` int(11) NOT NULL, + `measure_id` int(11) NOT NULL, + `org_id` int(11) DEFAULT NULL, + `warehouse_id` int(11) NOT NULL, + `cnt` decimal(14,4) NOT NULL, + PRIMARY KEY (`id`), + KEY `invent_inventory_material_id_7b04cfa0_fk_basedata_material_id` (`material_id`), + KEY `invent_inventory_measure_id_66c34c34_fk_basedata_measure_id` (`measure_id`), + KEY `invent_inventory_org_id_3e72901a_fk_organ_organization_id` (`org_id`), + KEY `invent_inventory_warehouse_id_7b12f523_fk_basedata_warehouse_id` (`warehouse_id`), + CONSTRAINT `invent_inventory_material_id_7b04cfa0_fk_basedata_material_id` FOREIGN KEY (`material_id`) REFERENCES `basedata_material` (`id`), + CONSTRAINT `invent_inventory_measure_id_66c34c34_fk_basedata_measure_id` FOREIGN KEY (`measure_id`) REFERENCES `basedata_measure` (`id`), + CONSTRAINT `invent_inventory_org_id_3e72901a_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `invent_inventory_warehouse_id_7b12f523_fk_basedata_warehouse_id` FOREIGN KEY (`warehouse_id`) REFERENCES `basedata_warehouse` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8; + +/*Data for the table `invent_inventory` */ + +insert into `invent_inventory`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`batch`,`price`,`material_id`,`measure_id`,`org_id`,`warehouse_id`,`cnt`) values (42,NULL,NULL,NULL,NULL,'2015-06-14 13:22:54','2015-07-17 12:56:25',NULL,'5.6000',40,3,NULL,11,'114.0000'),(43,NULL,NULL,NULL,NULL,'2015-06-14 13:22:54','2015-06-14 13:22:54',NULL,'8.2000',41,3,NULL,11,'105.0000'),(44,NULL,NULL,NULL,NULL,'2015-06-14 13:22:54','2015-06-14 13:22:54',NULL,'9.5000',42,3,NULL,11,'569.0000'),(45,NULL,NULL,NULL,NULL,'2015-06-14 13:22:54','2015-07-17 12:37:12',NULL,'6.5000',43,3,NULL,11,'160.0000'),(46,NULL,NULL,NULL,NULL,'2015-06-14 13:22:54','2015-06-14 13:22:54',NULL,'7.8000',44,3,NULL,11,'276.0000'),(47,NULL,NULL,NULL,NULL,'2015-06-14 13:22:54','2015-06-21 14:42:33',NULL,'6.9000',45,3,NULL,11,'310.0000'),(48,NULL,NULL,NULL,NULL,'2015-06-14 13:22:54','2015-06-21 14:42:33',NULL,'12.6000',46,3,NULL,11,'39.0000'),(49,NULL,NULL,NULL,NULL,'2015-06-14 13:22:54','2015-07-17 12:37:12',NULL,'8.2000',47,3,NULL,11,'97.0000'),(50,NULL,NULL,NULL,NULL,'2015-06-14 13:22:54','2015-06-14 13:22:54',NULL,'8.9000',48,3,NULL,11,'315.0000'),(51,NULL,NULL,NULL,NULL,'2015-06-14 13:22:54','2015-07-17 12:37:12',NULL,'14.6000',49,3,NULL,11,'208.0000'),(52,NULL,NULL,NULL,NULL,'2015-06-14 13:33:05','2015-06-21 10:23:35',NULL,'4512.8205',2,9,NULL,3,'2.0000'),(53,NULL,NULL,NULL,NULL,'2015-07-17 12:29:02','2015-07-17 12:29:02',NULL,'27.3504',4,1,NULL,3,'5.0000'),(54,NULL,NULL,NULL,NULL,'2015-07-17 12:29:02','2015-07-17 12:29:02',NULL,'255.5556',55,1,NULL,3,'5.0000'); + +/*Table structure for table `invent_outitem` */ + +DROP TABLE IF EXISTS `invent_outitem`; + +CREATE TABLE `invent_outitem` ( + `inoutdetail_ptr_id` int(11) NOT NULL, + `master_id` int(11) NOT NULL, + `inventory_id` int(11), + PRIMARY KEY (`inoutdetail_ptr_id`), + KEY `invent_outitem_master_id_5d572ab8_fk_invent_stockout_id` (`master_id`), + KEY `invent_outitem_98fac743` (`inventory_id`), + CONSTRAINT `invent_outitem_inventory_id_1a5f5da3_fk_invent_inventory_id` FOREIGN KEY (`inventory_id`) REFERENCES `invent_inventory` (`id`), + CONSTRAINT `invent_outitem_master_id_5d572ab8_fk_invent_stockout_id` FOREIGN KEY (`master_id`) REFERENCES `invent_stockout` (`id`), + CONSTRAINT `invent_outi_inoutdetail_ptr_id_60f3e3dc_fk_invent_inoutdetail_id` FOREIGN KEY (`inoutdetail_ptr_id`) REFERENCES `invent_inoutdetail` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `invent_outitem` */ + +insert into `invent_outitem`(`inoutdetail_ptr_id`,`master_id`,`inventory_id`) values (105,1,42); + +/*Table structure for table `invent_returnitem` */ + +DROP TABLE IF EXISTS `invent_returnitem`; + +CREATE TABLE `invent_returnitem` ( + `inoutdetail_ptr_id` int(11) NOT NULL, + `out_cnt` decimal(14,4) NOT NULL, + `master_id` int(11) NOT NULL, + `out_item_id` int(11), + PRIMARY KEY (`inoutdetail_ptr_id`), + KEY `invent_returnitem_90349b61` (`master_id`), + KEY `invent_returnitem_99ef2a78` (`out_item_id`), + CONSTRAINT `invent_out_item_id_735b9d2f_fk_invent_outitem_inoutdetail_ptr_id` FOREIGN KEY (`out_item_id`) REFERENCES `invent_outitem` (`inoutdetail_ptr_id`), + CONSTRAINT `invent_returnitem_master_id_11698bd3_fk_invent_warereturn_id` FOREIGN KEY (`master_id`) REFERENCES `invent_warereturn` (`id`), + CONSTRAINT `invent_retu_inoutdetail_ptr_id_616dfca9_fk_invent_inoutdetail_id` FOREIGN KEY (`inoutdetail_ptr_id`) REFERENCES `invent_inoutdetail` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `invent_returnitem` */ + +insert into `invent_returnitem`(`inoutdetail_ptr_id`,`out_cnt`,`master_id`,`out_item_id`) values (111,'5.0000',1,105); + +/*Table structure for table `invent_stockin` */ + +DROP TABLE IF EXISTS `invent_stockin`; + +CREATE TABLE `invent_stockin` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `title` varchar(40) NOT NULL, + `status` varchar(2) NOT NULL, + `execute_time` datetime DEFAULT NULL, + `org_id` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT NULL, + `warehouse_id` int(11) NOT NULL, + `po_id` int(11), + `batch` varchar(20), + `amount` decimal(14,4), + PRIMARY KEY (`id`), + KEY `invent_stockin_org_id_138faa53_fk_organ_organization_id` (`org_id`), + KEY `invent_stockin_user_id_7ca6d2b_fk_auth_user_id` (`user_id`), + KEY `invent_stockin_warehouse_id_77701ff6_fk_basedata_warehouse_id` (`warehouse_id`), + KEY `invent_stockin_c73ffa0a` (`po_id`), + CONSTRAINT `invent_stockin_org_id_138faa53_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `invent_stockin_po_id_54608973_fk_purchase_purchaseorder_id` FOREIGN KEY (`po_id`) REFERENCES `purchase_purchaseorder` (`id`), + CONSTRAINT `invent_stockin_user_id_7ca6d2b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `invent_stockin_warehouse_id_77701ff6_fk_basedata_warehouse_id` FOREIGN KEY (`warehouse_id`) REFERENCES `basedata_warehouse` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/*Data for the table `invent_stockin` */ + +insert into `invent_stockin`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`title`,`status`,`execute_time`,`org_id`,`user_id`,`warehouse_id`,`po_id`,`batch`,`amount`) values (1,'2015-07-17','9999-12-31','chengcai','chengcai','2015-07-17 12:07:05','2015-07-17 12:29:02','RK00001','一批办公物资入库','9','2015-07-17 12:29:02',NULL,11,3,1,'','1414.5300'); + +/*Table structure for table `invent_stockout` */ + +DROP TABLE IF EXISTS `invent_stockout`; + +CREATE TABLE `invent_stockout` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `title` varchar(40) NOT NULL, + `description` longtext, + `status` varchar(2) NOT NULL, + `execute_time` datetime DEFAULT NULL, + `org_id` int(11) DEFAULT NULL, + `project_id` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT NULL, + `wo_id` int(11) DEFAULT NULL, + `amount` decimal(14,4), + PRIMARY KEY (`id`), + KEY `invent_stockout_org_id_71a748a3_fk_organ_organization_id` (`org_id`), + KEY `invent_stockout_project_id_4e2d4cbc_fk_basedata_project_id` (`project_id`), + KEY `invent_stockout_wo_id_3c16dd70_fk_selfhelp_workorder_id` (`wo_id`), + KEY `invent_stockout_user_id_537784b_fk_auth_user_id` (`user_id`), + CONSTRAINT `invent_stockout_org_id_71a748a3_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `invent_stockout_project_id_4e2d4cbc_fk_basedata_project_id` FOREIGN KEY (`project_id`) REFERENCES `basedata_project` (`id`), + CONSTRAINT `invent_stockout_user_id_537784b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `invent_stockout_wo_id_3c16dd70_fk_selfhelp_workorder_id` FOREIGN KEY (`wo_id`) REFERENCES `selfhelp_workorder` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/*Data for the table `invent_stockout` */ + +insert into `invent_stockout`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`title`,`description`,`status`,`execute_time`,`org_id`,`project_id`,`user_id`,`wo_id`,`amount`) values (1,'2015-07-15','9999-12-31','chengcai','chengcai','2015-07-15 12:36:18','2015-07-15 12:43:35','CK00001','会议接待领用水果','','9','2015-07-15 12:43:35',NULL,8,11,1,'28.0000'); + +/*Table structure for table `invent_wareadjust` */ + +DROP TABLE IF EXISTS `invent_wareadjust`; + +CREATE TABLE `invent_wareadjust` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `title` varchar(40) NOT NULL, + `description` longtext, + `status` varchar(2) NOT NULL, + `execute_time` datetime DEFAULT NULL, + `org_id` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `invent_wareadjust_org_id_4dd80263_fk_organ_organization_id` (`org_id`), + KEY `invent_wareadjust_user_id_5f3e6fc5_fk_auth_user_id` (`user_id`), + CONSTRAINT `invent_wareadjust_org_id_4dd80263_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `invent_wareadjust_user_id_5f3e6fc5_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; + +/*Data for the table `invent_wareadjust` */ + +insert into `invent_wareadjust`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`title`,`description`,`status`,`execute_time`,`org_id`,`user_id`) values (1,'2015-06-21','9999-12-31','zhugl',NULL,'2015-06-21 14:34:47','2015-06-21 14:42:33','TZ001','水果库存调整','','9','2015-06-21 14:42:33',NULL,NULL),(2,'2015-07-17','9999-12-31','chengcai',NULL,'2015-07-17 12:09:39','2015-07-17 12:37:12','TZ002','调整一批物资库存','因前期盘点有误,调整库存数量','9','2015-07-17 12:37:12',NULL,11); + +/*Table structure for table `invent_warereturn` */ + +DROP TABLE IF EXISTS `invent_warereturn`; + +CREATE TABLE `invent_warereturn` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `title` varchar(40) NOT NULL, + `amount` decimal(14,4) DEFAULT NULL, + `status` varchar(2) NOT NULL, + `execute_time` datetime DEFAULT NULL, + `org_id` int(11) DEFAULT NULL, + `out_id` int(11) NOT NULL, + `user_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `invent_warereturn_org_id_c9a93c_fk_organ_organization_id` (`org_id`), + KEY `invent_warereturn_out_id_3a81433a_fk_invent_stockout_id` (`out_id`), + KEY `invent_warereturn_user_id_5a6b8d9c_fk_auth_user_id` (`user_id`), + CONSTRAINT `invent_warereturn_org_id_c9a93c_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `invent_warereturn_out_id_3a81433a_fk_invent_stockout_id` FOREIGN KEY (`out_id`) REFERENCES `invent_stockout` (`id`), + CONSTRAINT `invent_warereturn_user_id_5a6b8d9c_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/*Data for the table `invent_warereturn` */ + +insert into `invent_warereturn`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`title`,`amount`,`status`,`execute_time`,`org_id`,`out_id`,`user_id`) values (1,'2015-07-17','9999-12-31','chengcai','chengcai','2015-07-17 12:12:39','2015-07-17 12:56:25','FK0001','归还物资','11.2000','9','2015-07-17 12:56:25',NULL,1,11); + +/*Table structure for table `organ_organization` */ + +DROP TABLE IF EXISTS `organ_organization`; + +CREATE TABLE `organ_organization` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `name` varchar(120) NOT NULL, + `short` varchar(20) DEFAULT NULL, + `pinyin` varchar(120) DEFAULT NULL, + `status` tinyint(1) NOT NULL, + `tax_num` varchar(40) DEFAULT NULL, + `tax_address` varchar(40) DEFAULT NULL, + `tax_account` varchar(80) DEFAULT NULL, + `represent` varchar(40) DEFAULT NULL, + `address` varchar(120) DEFAULT NULL, + `zipcode` varchar(8) DEFAULT NULL, + `fax` varchar(20) DEFAULT NULL, + `contacts` varchar(40) DEFAULT NULL, + `phone` varchar(40) DEFAULT NULL, + `website` varchar(40) DEFAULT NULL, + `email` varchar(40) DEFAULT NULL, + `lic_code` varchar(40) DEFAULT NULL, + `cer_code` varchar(40) DEFAULT NULL, + `license` varchar(100) DEFAULT NULL, + `certificate` varchar(100) DEFAULT NULL, + `weight` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/*Data for the table `organ_organization` */ + +insert into `organ_organization`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`name`,`short`,`pinyin`,`status`,`tax_num`,`tax_address`,`tax_account`,`represent`,`address`,`zipcode`,`fax`,`contacts`,`phone`,`website`,`email`,`lic_code`,`cer_code`,`license`,`certificate`,`weight`) values (1,'2015-05-01','9999-12-31','zhugl','chengcai','2015-05-01 20:26:05','2015-07-17 12:16:36','O01','上海某集团有限公司','上海机场','Shanghai Airport',1,'310120000001357','上海市浦东机场启航路900号','交通银行上海分行浦东支行','李德润','上海市肇嘉浜路301号','200032','021-58698201','王勇','021-58698202','www.shairport.com','webadmin@sgs.gov.cn','310120000001357','20120620102952945','','',9); + +/*Table structure for table `organ_orgunit` */ + +DROP TABLE IF EXISTS `organ_orgunit`; + +CREATE TABLE `organ_orgunit` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(8) DEFAULT NULL, + `name` varchar(120) NOT NULL, + `short` varchar(20) DEFAULT NULL, + `pinyin` varchar(120) DEFAULT NULL, + `unit_type` int(11) NOT NULL, + `status` tinyint(1) NOT NULL, + `virtual` tinyint(1) NOT NULL, + `fax` varchar(20) DEFAULT NULL, + `phone` varchar(40) DEFAULT NULL, + `contacts` varchar(40) DEFAULT NULL, + `email` varchar(40) DEFAULT NULL, + `weight` int(11) NOT NULL, + `organization_id` int(11) DEFAULT NULL, + `parent_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `organ_orgunit_organization_id_56741454_fk_organ_organization_id` (`organization_id`), + KEY `organ_orgunit_parent_id_20b497af_fk_organ_orgunit_id` (`parent_id`), + CONSTRAINT `organ_orgunit_organization_id_56741454_fk_organ_organization_id` FOREIGN KEY (`organization_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `organ_orgunit_parent_id_20b497af_fk_organ_orgunit_id` FOREIGN KEY (`parent_id`) REFERENCES `organ_orgunit` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=84 DEFAULT CHARSET=utf8; + +/*Data for the table `organ_orgunit` */ + +insert into `organ_orgunit`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`name`,`short`,`pinyin`,`unit_type`,`status`,`virtual`,`fax`,`phone`,`contacts`,`email`,`weight`,`organization_id`,`parent_id`) values (70,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','B1001','董事会','董事会','board',2,1,0,NULL,NULL,NULL,NULL,99,NULL,NULL),(71,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','B1002','总经理办公室','总办','president office',2,1,0,NULL,NULL,NULL,NULL,99,NULL,NULL),(72,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','B1003','人事行政部','人事部','hr',2,1,0,NULL,NULL,NULL,NULL,99,NULL,NULL),(73,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','B1004','财务部','财务部','finace',2,1,0,NULL,NULL,NULL,NULL,99,NULL,NULL),(74,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','B1005','采购部','采购部','purchase',2,1,0,NULL,NULL,NULL,NULL,99,NULL,NULL),(75,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','B1006','生产中心','生产中心','produce center',2,1,0,NULL,NULL,NULL,NULL,99,NULL,NULL),(76,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','B1007','质检中心','质检中心','qulification center',2,1,0,NULL,NULL,NULL,NULL,99,NULL,NULL),(77,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','B1001','董事会','董事会','board',2,1,0,NULL,NULL,NULL,NULL,1,NULL,NULL),(78,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','B1002','总经理办公室','总办','president office',2,1,0,NULL,NULL,NULL,NULL,2,NULL,NULL),(79,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','B1003','人事行政部','人事部','hr',2,1,0,NULL,NULL,NULL,NULL,3,NULL,NULL),(80,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','B1004','财务部','财务部','finace',2,1,0,NULL,NULL,NULL,NULL,4,NULL,NULL),(81,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','B1005','采购部','采购部','purchase',2,1,0,NULL,NULL,NULL,NULL,5,NULL,NULL),(82,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','B1006','生产中心','生产中心','produce center',2,1,0,NULL,NULL,NULL,NULL,6,NULL,NULL),(83,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','B1007','质检中心','质检中心','qulification center',2,1,0,NULL,NULL,NULL,NULL,7,NULL,NULL); + +/*Table structure for table `organ_position` */ + +DROP TABLE IF EXISTS `organ_position`; + +CREATE TABLE `organ_position` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(8) DEFAULT NULL, + `name` varchar(120) NOT NULL, + `short` varchar(20) DEFAULT NULL, + `pinyin` varchar(120) DEFAULT NULL, + `series` varchar(1) NOT NULL, + `grade` varchar(2) DEFAULT NULL, + `virtual` tinyint(1) NOT NULL, + `description` longtext, + `qualification` longtext, + `document` varchar(100) DEFAULT NULL, + `weight` int(11) NOT NULL, + `parent_id` int(11) DEFAULT NULL, + `unit_id` int(11) NOT NULL, + `organization_id` int(11), + `status` tinyint(1) NOT NULL, + PRIMARY KEY (`id`), + KEY `organ_position_parent_id_1d9e732d_fk_organ_position_id` (`parent_id`), + KEY `organ_position_unit_id_411e3ee9_fk_organ_orgunit_id` (`unit_id`), + KEY `organ_position_26b2345e` (`organization_id`), + CONSTRAINT `organ_position_organization_id_3435c72a_fk_organ_organization_id` FOREIGN KEY (`organization_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `organ_position_parent_id_1d9e732d_fk_organ_position_id` FOREIGN KEY (`parent_id`) REFERENCES `organ_position` (`id`), + CONSTRAINT `organ_position_unit_id_411e3ee9_fk_organ_orgunit_id` FOREIGN KEY (`unit_id`) REFERENCES `organ_orgunit` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=utf8; + +/*Data for the table `organ_position` */ + +insert into `organ_position`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`name`,`short`,`pinyin`,`series`,`grade`,`virtual`,`description`,`qualification`,`document`,`weight`,`parent_id`,`unit_id`,`organization_id`,`status`) values (86,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1001','董事长',NULL,NULL,'A','01',0,NULL,NULL,'',99,NULL,70,NULL,1),(87,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1002','总经理',NULL,NULL,'A','01',0,NULL,NULL,'',99,86,70,NULL,1),(88,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1003','副总经理',NULL,NULL,'A','01',0,NULL,NULL,'',99,87,71,NULL,1),(89,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1004','总工程师',NULL,NULL,'A','01',0,NULL,NULL,'',99,87,71,NULL,1),(90,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1005','总经济师',NULL,NULL,'A','01',0,NULL,NULL,'',99,87,71,NULL,1),(91,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1006','人事经理',NULL,NULL,'A','01',0,NULL,NULL,'',99,87,72,NULL,1),(92,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1007','行政经理',NULL,NULL,'A','01',0,NULL,NULL,'',99,87,72,NULL,1),(93,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1008','财务经理',NULL,NULL,'A','01',0,NULL,NULL,'',99,87,73,NULL,1),(94,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1009','生产总监',NULL,NULL,'A','01',0,NULL,NULL,'',99,87,75,NULL,1),(95,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1010','采购经理',NULL,NULL,'A','01',0,NULL,NULL,'',99,87,74,NULL,1),(96,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1011','会计',NULL,NULL,'A','01',0,NULL,NULL,'',99,93,73,NULL,1),(97,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1012','出纳',NULL,NULL,'A','01',0,NULL,NULL,'',99,93,73,NULL,1),(98,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1013','人事专员',NULL,NULL,'A','01',0,NULL,NULL,'',99,91,72,NULL,1),(99,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1014','司机',NULL,NULL,'A','01',0,NULL,NULL,'',99,92,72,NULL,1),(100,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1015','行政专员',NULL,NULL,'A','01',0,NULL,NULL,'',99,92,72,NULL,1),(101,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1016','报价员',NULL,NULL,'A','01',0,NULL,NULL,'',99,94,75,NULL,1),(102,'2015-06-27','9999-12-31',NULL,NULL,'2015-06-27 13:08:27','2015-06-27 13:08:27','P1017','技术工程师',NULL,NULL,'A','01',0,NULL,NULL,'',99,94,75,NULL,1),(103,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1001','董事长',NULL,NULL,'A','01',0,NULL,NULL,'',1,NULL,70,NULL,1),(104,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1002','总经理',NULL,NULL,'A','01',0,NULL,NULL,'',2,86,70,NULL,1),(105,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1003','副总经理',NULL,NULL,'A','01',0,NULL,NULL,'',3,87,71,NULL,1),(106,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1004','总工程师',NULL,NULL,'A','01',0,NULL,NULL,'',4,87,71,NULL,1),(107,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1005','总经济师',NULL,NULL,'A','01',0,NULL,NULL,'',5,87,71,NULL,1),(108,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1006','人事经理',NULL,NULL,'A','01',0,NULL,NULL,'',6,87,72,NULL,1),(109,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1007','行政经理',NULL,NULL,'A','01',0,NULL,NULL,'',7,87,72,NULL,1),(110,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1008','财务经理',NULL,NULL,'A','01',0,NULL,NULL,'',8,87,73,NULL,1),(111,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1009','生产总监',NULL,NULL,'A','01',0,NULL,NULL,'',9,87,75,NULL,1),(112,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1010','采购经理',NULL,NULL,'A','01',0,NULL,NULL,'',10,87,74,NULL,1),(113,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1011','会计',NULL,NULL,'A','01',0,NULL,NULL,'',11,93,73,NULL,1),(114,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1012','出纳',NULL,NULL,'A','01',0,NULL,NULL,'',12,93,73,NULL,1),(115,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1013','人事专员',NULL,NULL,'A','01',0,NULL,NULL,'',13,91,72,NULL,1),(116,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1014','司机',NULL,NULL,'A','01',0,NULL,NULL,'',14,92,72,NULL,1),(117,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1015','行政专员',NULL,NULL,'A','01',0,NULL,NULL,'',15,92,72,NULL,1),(118,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1016','报价员',NULL,NULL,'A','01',0,NULL,NULL,'',16,94,75,NULL,1),(119,'2015-07-15','9999-12-31',NULL,NULL,'2015-07-15 12:04:17','2015-07-15 12:04:17','P1017','技术工程师',NULL,NULL,'A','01',0,NULL,NULL,'',17,94,75,NULL,1); + +/*Table structure for table `purchase_invoice` */ + +DROP TABLE IF EXISTS `purchase_invoice`; + +CREATE TABLE `purchase_invoice` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `vo_date` date, + `code` varchar(20) NOT NULL, + `number` varchar(20) NOT NULL, + `po_amount` decimal(14,4) DEFAULT NULL, + `vo_amount` decimal(14,4) NOT NULL, + `file` varchar(100) DEFAULT NULL, + `partner_id` int(11) DEFAULT NULL, + `po_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `purchase_invoice_partner_id_7ee3f712_fk_basedata_partner_id` (`partner_id`), + KEY `purchase_invoice_po_id_3777f562_fk_purchase_purchaseorder_id` (`po_id`), + CONSTRAINT `purchase_invoice_partner_id_7ee3f712_fk_basedata_partner_id` FOREIGN KEY (`partner_id`) REFERENCES `basedata_partner` (`id`), + CONSTRAINT `purchase_invoice_po_id_3777f562_fk_purchase_purchaseorder_id` FOREIGN KEY (`po_id`) REFERENCES `purchase_purchaseorder` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `purchase_invoice` */ + +/*Table structure for table `purchase_payment` */ + +DROP TABLE IF EXISTS `purchase_payment`; + +CREATE TABLE `purchase_payment` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `py_date` date DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `po_amount` decimal(14,4) DEFAULT NULL, + `py_amount` decimal(14,4) NOT NULL, + `response_code` varchar(80) DEFAULT NULL, + `memo` longtext, + `bank_id` int(11) DEFAULT NULL, + `partner_id` int(11) DEFAULT NULL, + `po_id` int(11) NOT NULL, + `org_id` int(11), + PRIMARY KEY (`id`), + KEY `purchase_payment_partner_id_102965e7_fk_basedata_partner_id` (`partner_id`), + KEY `purchase_payment_po_id_3291acc9_fk_purchase_purchaseorder_id` (`po_id`), + KEY `purchase_payment_bank_id_66ac7b06_fk_basedata_bankaccount_id` (`bank_id`), + KEY `purchase_payment_9cf869aa` (`org_id`), + CONSTRAINT `purchase_payment_bank_id_66ac7b06_fk_basedata_bankaccount_id` FOREIGN KEY (`bank_id`) REFERENCES `basedata_bankaccount` (`id`), + CONSTRAINT `purchase_payment_org_id_33cf80e9_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `purchase_payment_partner_id_102965e7_fk_basedata_partner_id` FOREIGN KEY (`partner_id`) REFERENCES `basedata_partner` (`id`), + CONSTRAINT `purchase_payment_po_id_3291acc9_fk_purchase_purchaseorder_id` FOREIGN KEY (`po_id`) REFERENCES `purchase_purchaseorder` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `purchase_payment` */ + +/*Table structure for table `purchase_poitem` */ + +DROP TABLE IF EXISTS `purchase_poitem`; + +CREATE TABLE `purchase_poitem` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `price` decimal(12,4) DEFAULT NULL, + `cnt` decimal(12,4) DEFAULT NULL, + `discount_price` decimal(12,4) DEFAULT NULL, + `amount` decimal(12,2) DEFAULT NULL, + `discount_amount` decimal(12,2) DEFAULT NULL, + `tax` varchar(6) NOT NULL, + `material_id` int(11) NOT NULL, + `po_id` int(11) NOT NULL, + `woitem_id` int(11), + `in_stock_time` datetime, + `is_in_stock` tinyint(1) NOT NULL, + `measure_id` int(11), + `entry_cnt` decimal(12,4), + `left_cnt` decimal(12,4), + PRIMARY KEY (`id`), + KEY `purchase_poitem_material_id_10910564_fk_basedata_material_id` (`material_id`), + KEY `purchase_poitem_c73ffa0a` (`po_id`), + KEY `purchase_poitem_1f526118` (`woitem_id`), + KEY `purchase_poitem_80c371ce` (`measure_id`), + CONSTRAINT `purchase_poitem_material_id_10910564_fk_basedata_material_id` FOREIGN KEY (`material_id`) REFERENCES `basedata_material` (`id`), + CONSTRAINT `purchase_poitem_measure_id_115682d0_fk_basedata_measure_id` FOREIGN KEY (`measure_id`) REFERENCES `basedata_measure` (`id`), + CONSTRAINT `purchase_poitem_po_id_698de2ca_fk_purchase_purchaseorder_id` FOREIGN KEY (`po_id`) REFERENCES `purchase_purchaseorder` (`id`), + CONSTRAINT `purchase_poitem_woitem_id_7ee62f3a_fk_selfhelp_woitem_id` FOREIGN KEY (`woitem_id`) REFERENCES `selfhelp_woitem` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; + +/*Data for the table `purchase_poitem` */ + +insert into `purchase_poitem`(`id`,`price`,`cnt`,`discount_price`,`amount`,`discount_amount`,`tax`,`material_id`,`po_id`,`woitem_id`,`in_stock_time`,`is_in_stock`,`measure_id`,`entry_cnt`,`left_cnt`) values (1,'32.0000','5.0000',NULL,'160.00',NULL,'0.17',4,1,NULL,'2015-07-17 12:29:02',1,1,'5.0000','0.0000'),(2,'299.0000','5.0000',NULL,'1495.00',NULL,'0.17',55,1,NULL,'2015-07-17 12:29:02',1,1,'5.0000','0.0000'); + +/*Table structure for table `purchase_purchaseorder` */ + +DROP TABLE IF EXISTS `purchase_purchaseorder`; + +CREATE TABLE `purchase_purchaseorder` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `order_date` date NOT NULL, + `arrive_date` date NOT NULL, + `title` varchar(40) NOT NULL, + `description` longtext, + `status` varchar(2) NOT NULL, + `amount` decimal(12,2), + `discount_amount` decimal(12,2), + `org_id` int(11) DEFAULT NULL, + `partner_id` int(11) NOT NULL, + `user_id` int(11) DEFAULT NULL, + `entry_status` tinyint(1) NOT NULL, + `entry_time` datetime, + `attach` varchar(100), + PRIMARY KEY (`id`), + KEY `purchase_purchaseorder_org_id_5454e9a_fk_organ_organization_id` (`org_id`), + KEY `purchase_purchaseorder_partner_id_4f47a8a_fk_basedata_partner_id` (`partner_id`), + KEY `purchase_purchaseorder_user_id_6da1490e_fk_auth_user_id` (`user_id`), + CONSTRAINT `purchase_purchaseorder_org_id_5454e9a_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `purchase_purchaseorder_partner_id_4f47a8a_fk_basedata_partner_id` FOREIGN KEY (`partner_id`) REFERENCES `basedata_partner` (`id`), + CONSTRAINT `purchase_purchaseorder_user_id_6da1490e_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/*Data for the table `purchase_purchaseorder` */ + +insert into `purchase_purchaseorder`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`order_date`,`arrive_date`,`title`,`description`,`status`,`amount`,`discount_amount`,`org_id`,`partner_id`,`user_id`,`entry_status`,`entry_time`,`attach`) values (1,'2015-06-30','9999-12-31','chengcai','chengcai','2015-06-30 20:23:07','2015-07-17 12:29:02','CG00001','2015-06-30','2015-07-30','采购物品','','99','1655.00','0.00',NULL,18,11,1,'2015-07-17 12:29:02',''); + +/*Table structure for table `sale_offeritem` */ + +DROP TABLE IF EXISTS `sale_offeritem`; + +CREATE TABLE `sale_offeritem` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `cnt` decimal(14,4) NOT NULL, + `stock_price` decimal(14,4) DEFAULT NULL, + `sale_price` decimal(14,4) DEFAULT NULL, + `tax` varchar(6) NOT NULL, + `create_time` datetime NOT NULL, + `status` tinyint(1) NOT NULL, + `event_time` datetime DEFAULT NULL, + `master_id` int(11) NOT NULL, + `material_id` int(11), + `measure_id` int(11), + `discount_price` decimal(14,4), + `brand` varchar(20), + `cost_price` decimal(14,4), + PRIMARY KEY (`id`), + KEY `sale_offeritem_90349b61` (`master_id`), + KEY `sale_offeritem_eb4b9aaa` (`material_id`), + KEY `sale_offeritem_80c371ce` (`measure_id`), + CONSTRAINT `sale_offeritem_master_id_759ed829_fk_sale_offersheet_id` FOREIGN KEY (`master_id`) REFERENCES `sale_offersheet` (`id`), + CONSTRAINT `sale_offeritem_material_id_1984f90_fk_basedata_material_id` FOREIGN KEY (`material_id`) REFERENCES `basedata_material` (`id`), + CONSTRAINT `sale_offeritem_measure_id_3e74b43c_fk_basedata_measure_id` FOREIGN KEY (`measure_id`) REFERENCES `basedata_measure` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; + +/*Data for the table `sale_offeritem` */ + +insert into `sale_offeritem`(`id`,`cnt`,`stock_price`,`sale_price`,`tax`,`create_time`,`status`,`event_time`,`master_id`,`material_id`,`measure_id`,`discount_price`,`brand`,`cost_price`) values (1,'2.0000',NULL,'550.0000','0.00','2015-07-07 21:09:47',0,NULL,1,55,2,NULL,NULL,NULL),(2,'2.0000',NULL,'9999.0000','0.00','2015-07-07 21:09:47',0,NULL,1,54,2,NULL,NULL,NULL),(3,'2.0000',NULL,'320.0000','0.00','2015-07-07 21:09:47',0,NULL,1,52,2,NULL,NULL,NULL); + +/*Table structure for table `sale_offersheet` */ + +DROP TABLE IF EXISTS `sale_offersheet`; + +CREATE TABLE `sale_offersheet` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `offer_date` date NOT NULL, + `deliver_date` date NOT NULL, + `title` varchar(40) NOT NULL, + `description` longtext, + `amount` decimal(12,2) DEFAULT NULL, + `discount_amount` decimal(12,2) DEFAULT NULL, + `attach` varchar(100) DEFAULT NULL, + `status` tinyint(1) NOT NULL, + `event_time` datetime DEFAULT NULL, + `org_id` int(11) DEFAULT NULL, + `partner_id` int(11) NOT NULL, + `user_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `sale_offersheet_org_id_4224cc19_fk_organ_organization_id` (`org_id`), + KEY `sale_offersheet_partner_id_180d0c89_fk_basedata_partner_id` (`partner_id`), + KEY `sale_offersheet_user_id_34ea58c1_fk_auth_user_id` (`user_id`), + CONSTRAINT `sale_offersheet_org_id_4224cc19_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `sale_offersheet_partner_id_180d0c89_fk_basedata_partner_id` FOREIGN KEY (`partner_id`) REFERENCES `basedata_partner` (`id`), + CONSTRAINT `sale_offersheet_user_id_34ea58c1_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/*Data for the table `sale_offersheet` */ + +insert into `sale_offersheet`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`offer_date`,`deliver_date`,`title`,`description`,`amount`,`discount_amount`,`attach`,`status`,`event_time`,`org_id`,`partner_id`,`user_id`) values (1,'2015-07-07','9999-12-31','chengcai','chengcai','2015-07-07 21:09:46','2015-07-07 21:10:14','BJ00001','2015-07-07','2015-08-06','123','','21738.00','0.00','',0,NULL,NULL,17,11); + +/*Table structure for table `sale_paymentcollection` */ + +DROP TABLE IF EXISTS `sale_paymentcollection`; + +CREATE TABLE `sale_paymentcollection` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `collection_date` date DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `order_amount` decimal(14,4) DEFAULT NULL, + `collection_amount` decimal(14,4) NOT NULL, + `memo` longtext, + `bank_id` int(11) DEFAULT NULL, + `partner_id` int(11) DEFAULT NULL, + `so_id` int(11) NOT NULL, + `org_id` int(11), + PRIMARY KEY (`id`), + KEY `sale_paymentcollecti_bank_id_5db2135c_fk_basedata_bankaccount_id` (`bank_id`), + KEY `sale_paymentcollectio_partner_id_545062b1_fk_basedata_partner_id` (`partner_id`), + KEY `sale_paymentcollection_5a20014e` (`so_id`), + KEY `sale_paymentcollection_9cf869aa` (`org_id`), + CONSTRAINT `sale_paymentcollection_org_id_3858f3f_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `sale_paymentcollection_so_id_1640456e_fk_sale_saleorder_id` FOREIGN KEY (`so_id`) REFERENCES `sale_saleorder` (`id`), + CONSTRAINT `sale_paymentcollectio_partner_id_545062b1_fk_basedata_partner_id` FOREIGN KEY (`partner_id`) REFERENCES `basedata_partner` (`id`), + CONSTRAINT `sale_paymentcollecti_bank_id_5db2135c_fk_basedata_bankaccount_id` FOREIGN KEY (`bank_id`) REFERENCES `basedata_bankaccount` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `sale_paymentcollection` */ + +/*Table structure for table `sale_saleitem` */ + +DROP TABLE IF EXISTS `sale_saleitem`; + +CREATE TABLE `sale_saleitem` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `cnt` decimal(14,4) NOT NULL, + `stock_price` decimal(14,4) DEFAULT NULL, + `sale_price` decimal(14,4) DEFAULT NULL, + `tax` varchar(6) NOT NULL, + `create_time` datetime NOT NULL, + `status` tinyint(1) NOT NULL, + `event_time` datetime DEFAULT NULL, + `master_id` int(11) NOT NULL, + `material_id` int(11), + `measure_id` int(11), + `discount_price` decimal(14,4), + PRIMARY KEY (`id`), + KEY `sale_saleitem_90349b61` (`master_id`), + KEY `sale_saleitem_eb4b9aaa` (`material_id`), + KEY `sale_saleitem_80c371ce` (`measure_id`), + CONSTRAINT `sale_saleitem_master_id_7aa6dde1_fk_sale_saleorder_id` FOREIGN KEY (`master_id`) REFERENCES `sale_saleorder` (`id`), + CONSTRAINT `sale_saleitem_material_id_4cb3eb8_fk_basedata_material_id` FOREIGN KEY (`material_id`) REFERENCES `basedata_material` (`id`), + CONSTRAINT `sale_saleitem_measure_id_317dc10c_fk_basedata_measure_id` FOREIGN KEY (`measure_id`) REFERENCES `basedata_measure` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `sale_saleitem` */ + +/*Table structure for table `sale_saleorder` */ + +DROP TABLE IF EXISTS `sale_saleorder`; + +CREATE TABLE `sale_saleorder` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(20) DEFAULT NULL, + `order_date` date NOT NULL, + `deliver_date` date NOT NULL, + `title` varchar(40) NOT NULL, + `description` longtext, + `contact` varchar(20) DEFAULT NULL, + `phone` varchar(20) DEFAULT NULL, + `fax` varchar(20) DEFAULT NULL, + `deliver_address` varchar(120) DEFAULT NULL, + `invoice_type` varchar(6) NOT NULL, + `amount` decimal(12,2) DEFAULT NULL, + `discount_amount` decimal(12,2) DEFAULT NULL, + `status` varchar(2) NOT NULL, + `org_id` int(11) DEFAULT NULL, + `partner_id` int(11) NOT NULL, + `user_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `sale_saleorder_org_id_1d0df2d2_fk_organ_organization_id` (`org_id`), + KEY `sale_saleorder_partner_id_31af6b7e_fk_basedata_partner_id` (`partner_id`), + KEY `sale_saleorder_user_id_1b41e486_fk_auth_user_id` (`user_id`), + CONSTRAINT `sale_saleorder_org_id_1d0df2d2_fk_organ_organization_id` FOREIGN KEY (`org_id`) REFERENCES `organ_organization` (`id`), + CONSTRAINT `sale_saleorder_partner_id_31af6b7e_fk_basedata_partner_id` FOREIGN KEY (`partner_id`) REFERENCES `basedata_partner` (`id`), + CONSTRAINT `sale_saleorder_user_id_1b41e486_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `sale_saleorder` */ + +/*Table structure for table `selfhelp_activity` */ + +DROP TABLE IF EXISTS `selfhelp_activity`; + +CREATE TABLE `selfhelp_activity` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `begin_time` datetime NOT NULL, + `end_time` datetime NOT NULL, + `enroll_deadline` datetime DEFAULT NULL, + `title` varchar(120) NOT NULL, + `description` longtext, + `host` varchar(80) DEFAULT NULL, + `speaker` varchar(80) DEFAULT NULL, + `accept_enroll` tinyint(1) NOT NULL, + `location` varchar(80) DEFAULT NULL, + `classification` varchar(2), + `mail_list` longtext, + `mail_notice` tinyint(1) NOT NULL, + `short_message_notice` tinyint(1) NOT NULL, + `weixin_notice` tinyint(1) NOT NULL, + `status` tinyint(1) NOT NULL, + `publish_time` datetime DEFAULT NULL, + `attach` varchar(100) DEFAULT NULL, + `parent_id` int(11) DEFAULT NULL, + `room_id` int(11) DEFAULT NULL, + `code` varchar(20), + PRIMARY KEY (`id`), + KEY `selfhelp_activity_parent_id_1638e788_fk_selfhelp_activity_id` (`parent_id`), + KEY `selfhelp_activity_room_id_76f73121_fk_basedata_material_id` (`room_id`), + CONSTRAINT `selfhelp_activity_parent_id_1638e788_fk_selfhelp_activity_id` FOREIGN KEY (`parent_id`) REFERENCES `selfhelp_activity` (`id`), + CONSTRAINT `selfhelp_activity_room_id_76f73121_fk_basedata_material_id` FOREIGN KEY (`room_id`) REFERENCES `basedata_material` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; + +/*Data for the table `selfhelp_activity` */ + +insert into `selfhelp_activity`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`begin_time`,`end_time`,`enroll_deadline`,`title`,`description`,`host`,`speaker`,`accept_enroll`,`location`,`classification`,`mail_list`,`mail_notice`,`short_message_notice`,`weixin_notice`,`status`,`publish_time`,`attach`,`parent_id`,`room_id`,`code`) values (1,'2015-06-11','9999-12-31','zhugl',NULL,'2015-06-11 22:36:57','2015-06-11 22:36:57','2015-06-12 10:34:00','2015-06-12 16:34:00',NULL,'hadoop大数据应用Qcon分享','关于hadoop大数据技术分享','张三','李四',1,'','T','nsg@abc.com;cuc@abc.com;',1,1,1,0,NULL,'',NULL,6,'AC00001'),(2,'2015-07-01','9999-12-31','chengcai','chengcai','2015-07-01 06:17:53','2015-07-01 06:37:00','2015-07-01 18:17:00','2015-07-02 00:17:00',NULL,'2','1234567','','',1,'','M','',1,1,1,0,NULL,'',NULL,6,'AC00002'),(3,'2015-07-01','9999-12-31','chengcai',NULL,'2015-07-01 06:37:21','2015-07-01 06:37:21','2015-07-01 18:37:00','2015-07-02 00:37:00',NULL,'123','123','','',1,'','M','',1,1,1,0,NULL,'',NULL,6,'AC00003'); + +/*Table structure for table `selfhelp_enroll` */ + +DROP TABLE IF EXISTS `selfhelp_enroll`; + +CREATE TABLE `selfhelp_enroll` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `enroll_time` datetime NOT NULL, + `activity_id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `selfhelp_enroll_activity_id_5615acbc_fk_selfhelp_activity_id` (`activity_id`), + KEY `selfhelp_enroll_user_id_a71585e_fk_auth_user_id` (`user_id`), + CONSTRAINT `selfhelp_enroll_activity_id_5615acbc_fk_selfhelp_activity_id` FOREIGN KEY (`activity_id`) REFERENCES `selfhelp_activity` (`id`), + CONSTRAINT `selfhelp_enroll_user_id_a71585e_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `selfhelp_enroll` */ + +/*Table structure for table `selfhelp_feedback` */ + +DROP TABLE IF EXISTS `selfhelp_feedback`; + +CREATE TABLE `selfhelp_feedback` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `feed_time` datetime NOT NULL, + `rank` varchar(2) DEFAULT NULL, + `comment` varchar(80) DEFAULT NULL, + `activity_id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `selfhelp_feedback_activity_id_1591e8eb_fk_selfhelp_activity_id` (`activity_id`), + KEY `selfhelp_feedback_user_id_10b5739_fk_auth_user_id` (`user_id`), + CONSTRAINT `selfhelp_feedback_activity_id_1591e8eb_fk_selfhelp_activity_id` FOREIGN KEY (`activity_id`) REFERENCES `selfhelp_activity` (`id`), + CONSTRAINT `selfhelp_feedback_user_id_10b5739_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `selfhelp_feedback` */ + +/*Table structure for table `selfhelp_loan` */ + +DROP TABLE IF EXISTS `selfhelp_loan`; + +CREATE TABLE `selfhelp_loan` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(10) DEFAULT NULL, + `title` varchar(120) NOT NULL, + `status` varchar(2) DEFAULT NULL, + `logout_time` datetime DEFAULT NULL, + `loan_amount` decimal(10,2) DEFAULT NULL, + `logout_amount` decimal(10,2) DEFAULT NULL, + `project_id` int(11) NOT NULL, + `user_id` int(11) DEFAULT NULL, + `description` longtext, + `pay_time` datetime, + `pay_user` varchar(40), + `is_clear` tinyint(1) NOT NULL, + PRIMARY KEY (`id`), + KEY `selfhelp_loan_project_id_7b541607_fk_basedata_project_id` (`project_id`), + KEY `selfhelp_loan_user_id_1d36464e_fk_auth_user_id` (`user_id`), + CONSTRAINT `selfhelp_loan_project_id_7b541607_fk_basedata_project_id` FOREIGN KEY (`project_id`) REFERENCES `basedata_project` (`id`), + CONSTRAINT `selfhelp_loan_user_id_1d36464e_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/*Data for the table `selfhelp_loan` */ + +insert into `selfhelp_loan`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`title`,`status`,`logout_time`,`loan_amount`,`logout_amount`,`project_id`,`user_id`,`description`,`pay_time`,`pay_user`,`is_clear`) values (1,'2015-07-04','9999-12-31','zhangsan',NULL,'2015-07-04 13:36:53','2015-07-04 13:36:53','JK00001','2015年3月份行政部备用金','N',NULL,'3000.00',NULL,7,13,'行政部零星采购使用',NULL,NULL,0); + +/*Table structure for table `selfhelp_reimbursement` */ + +DROP TABLE IF EXISTS `selfhelp_reimbursement`; + +CREATE TABLE `selfhelp_reimbursement` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(10) DEFAULT NULL, + `title` varchar(120) NOT NULL, + `bank_account` varchar(120) DEFAULT NULL, + `status` varchar(2) DEFAULT NULL, + `amount` decimal(10,2) DEFAULT NULL, + `loan_amount` decimal(10,2) DEFAULT NULL, + `logout_amount` decimal(10,2) DEFAULT NULL, + `pay_amount` decimal(10,2) DEFAULT NULL, + `pay_time` datetime DEFAULT NULL, + `loan_id` int(11) DEFAULT NULL, + `org_id` int(11) DEFAULT NULL, + `project_id` int(11) NOT NULL, + `user_id` int(11) DEFAULT NULL, + `wo_id` int(11) DEFAULT NULL, + `description` longtext, + `pay_user` varchar(40), + PRIMARY KEY (`id`), + KEY `selfhelp_reimbursement_org_id_1e6a35f_fk_organ_orgunit_id` (`org_id`), + KEY `selfhelp_reimbursement_project_id_ed3db4e_fk_basedata_project_id` (`project_id`), + KEY `selfhelp_reimbursement_user_id_5d122f07_fk_auth_user_id` (`user_id`), + KEY `selfhelp_reimbursement_wo_id_ac8ed7a_fk_selfhelp_workorder_id` (`wo_id`), + KEY `selfhelp_reimbursement_loan_id_44fd1f10_fk_selfhelp_loan_id` (`loan_id`), + CONSTRAINT `selfhelp_reimbursement_loan_id_44fd1f10_fk_selfhelp_loan_id` FOREIGN KEY (`loan_id`) REFERENCES `selfhelp_loan` (`id`), + CONSTRAINT `selfhelp_reimbursement_org_id_1e6a35f_fk_organ_orgunit_id` FOREIGN KEY (`org_id`) REFERENCES `organ_orgunit` (`id`), + CONSTRAINT `selfhelp_reimbursement_project_id_ed3db4e_fk_basedata_project_id` FOREIGN KEY (`project_id`) REFERENCES `basedata_project` (`id`), + CONSTRAINT `selfhelp_reimbursement_user_id_5d122f07_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`), + CONSTRAINT `selfhelp_reimbursement_wo_id_ac8ed7a_fk_selfhelp_workorder_id` FOREIGN KEY (`wo_id`) REFERENCES `selfhelp_workorder` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/*Data for the table `selfhelp_reimbursement` */ + +insert into `selfhelp_reimbursement`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`title`,`bank_account`,`status`,`amount`,`loan_amount`,`logout_amount`,`pay_amount`,`pay_time`,`loan_id`,`org_id`,`project_id`,`user_id`,`wo_id`,`description`,`pay_user`) values (1,'2015-07-04','9999-12-31','zhangsan','zhangsan','2015-07-04 13:38:14','2015-07-04 13:39:59','BX00001','15年3月份行政部费用报销',NULL,'N','1348.00',NULL,'1348.00','0.00',NULL,1,72,7,13,NULL,'印刷宣传册及维修费',NULL); + +/*Table structure for table `selfhelp_reimbursementitem` */ + +DROP TABLE IF EXISTS `selfhelp_reimbursementitem`; + +CREATE TABLE `selfhelp_reimbursementitem` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date NOT NULL, + `amount` decimal(10,2) NOT NULL, + `memo` varchar(40) DEFAULT NULL, + `expense_account_id` int(11) NOT NULL, + `reimbursement_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `selfhelp__reimbursement_id_37efbf0e_fk_selfhelp_reimbursement_id` (`reimbursement_id`), + KEY `selfhe_expense_account_id_65c44030_fk_basedata_expenseaccount_id` (`expense_account_id`), + CONSTRAINT `selfhelp__reimbursement_id_37efbf0e_fk_selfhelp_reimbursement_id` FOREIGN KEY (`reimbursement_id`) REFERENCES `selfhelp_reimbursement` (`id`), + CONSTRAINT `selfhe_expense_account_id_65c44030_fk_basedata_expenseaccount_id` FOREIGN KEY (`expense_account_id`) REFERENCES `basedata_expenseaccount` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; + +/*Data for the table `selfhelp_reimbursementitem` */ + +insert into `selfhelp_reimbursementitem`(`id`,`begin`,`amount`,`memo`,`expense_account_id`,`reimbursement_id`) values (1,'2015-07-04','1258.00','印刷企业宣传册',18,1),(2,'2015-07-04','90.00','维修公司打印机',25,1); + +/*Table structure for table `selfhelp_woextravalue` */ + +DROP TABLE IF EXISTS `selfhelp_woextravalue`; + +CREATE TABLE `selfhelp_woextravalue` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `param_value` varchar(40) DEFAULT NULL, + `param_name_id` int(11) NOT NULL, + `workorder_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `selfhelp_woextr_param_name_id_34779449_fk_basedata_extraparam_id` (`param_name_id`), + KEY `selfhelp_woextravalue_be2c0a1b` (`workorder_id`), + CONSTRAINT `selfhelp_woextrav_workorder_id_781e29d2_fk_selfhelp_workorder_id` FOREIGN KEY (`workorder_id`) REFERENCES `selfhelp_workorder` (`id`), + CONSTRAINT `selfhelp_woextr_param_name_id_34779449_fk_basedata_extraparam_id` FOREIGN KEY (`param_name_id`) REFERENCES `basedata_extraparam` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; + +/*Data for the table `selfhelp_woextravalue` */ + +insert into `selfhelp_woextravalue`(`id`,`param_value`,`param_name_id`,`workorder_id`) values (1,NULL,1,2),(2,NULL,2,2),(3,NULL,3,2),(4,NULL,4,4),(5,NULL,5,4),(6,NULL,6,4),(7,NULL,7,4),(8,NULL,19,1); + +/*Table structure for table `selfhelp_woitem` */ + +DROP TABLE IF EXISTS `selfhelp_woitem`; + +CREATE TABLE `selfhelp_woitem` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `amount` decimal(10,4) DEFAULT NULL, + `price` decimal(10,4) DEFAULT NULL, + `material_id` int(11) DEFAULT NULL, + `workorder_id` int(11) NOT NULL, + `measure_id` int(11), + PRIMARY KEY (`id`), + KEY `selfhelp_woitem_material_id_34e897bf_fk_basedata_material_id` (`material_id`), + KEY `selfhelp_woitem_be2c0a1b` (`workorder_id`), + KEY `selfhelp_woitem_80c371ce` (`measure_id`), + CONSTRAINT `selfhelp_woitem_material_id_34e897bf_fk_basedata_material_id` FOREIGN KEY (`material_id`) REFERENCES `basedata_material` (`id`), + CONSTRAINT `selfhelp_woitem_measure_id_2352ebad_fk_basedata_measure_id` FOREIGN KEY (`measure_id`) REFERENCES `basedata_measure` (`id`), + CONSTRAINT `selfhelp_woitem_workorder_id_6a435420_fk_selfhelp_workorder_id` FOREIGN KEY (`workorder_id`) REFERENCES `selfhelp_workorder` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `selfhelp_woitem` */ + +/*Table structure for table `selfhelp_workorder` */ + +DROP TABLE IF EXISTS `selfhelp_workorder`; + +CREATE TABLE `selfhelp_workorder` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `title` varchar(120) NOT NULL, + `description` longtext, + `business_domain` varchar(4) NOT NULL, + `classification` varchar(4) NOT NULL, + `status` varchar(6) DEFAULT NULL, + `answer` longtext, + `service_id` int(11) DEFAULT NULL, + `user_id` int(11) DEFAULT NULL, + `project_id` int(11), + `code` varchar(10), + `refer_id` int(11), + `attach` varchar(100), + `detail` varchar(100), + PRIMARY KEY (`id`), + KEY `selfhelp_workorder_service_id_17a66979_fk_basedata_material_id` (`service_id`), + KEY `selfhelp_workorder_user_id_72d939fa_fk_auth_user_id` (`user_id`), + KEY `selfhelp_workorder_b098ad43` (`project_id`), + KEY `selfhelp_workorder_12b2c0fd` (`refer_id`), + CONSTRAINT `selfhelp_workorder_project_id_66ab927f_fk_basedata_project_id` FOREIGN KEY (`project_id`) REFERENCES `basedata_project` (`id`), + CONSTRAINT `selfhelp_workorder_refer_id_212bc854_fk_selfhelp_workorder_id` FOREIGN KEY (`refer_id`) REFERENCES `selfhelp_workorder` (`id`), + CONSTRAINT `selfhelp_workorder_service_id_17a66979_fk_basedata_material_id` FOREIGN KEY (`service_id`) REFERENCES `basedata_material` (`id`), + CONSTRAINT `selfhelp_workorder_user_id_72d939fa_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; + +/*Data for the table `selfhelp_workorder` */ + +insert into `selfhelp_workorder`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`title`,`description`,`business_domain`,`classification`,`status`,`answer`,`service_id`,`user_id`,`project_id`,`code`,`refer_id`,`attach`,`detail`) values (1,'2015-07-04','9999-12-31','zhangsan','zhangsan','2015-07-04 10:56:34','2015-07-04 18:21:01','申请采购办公用品一批','2015年3月份办公用品采购,详细查看明细,2','OT','D','NEW',NULL,62,13,8,'WO00001',NULL,'',''),(2,'2015-07-04','9999-12-31','zhangsan',NULL,'2015-07-04 11:58:58','2015-07-04 11:58:58','出差申请(重庆)','因项目需要,前往重庆出差。','OT','S','NEW',NULL,1,13,NULL,'WO00002',NULL,'',''),(3,'2015-07-04','9999-12-31','zhangsan','zhangsan','2015-07-04 12:15:27','2015-07-04 15:19:05','2号楼3楼男厕所小便池堵塞','内有烟头,请安排人员清理','OT','R','NEW',NULL,NULL,13,NULL,'WO00003',NULL,'',''),(4,'2015-07-04','9999-12-31','zhangsan',NULL,'2015-07-04 12:18:14','2015-07-04 12:18:14','用车申请(张江)','','OT','S','NEW',NULL,3,13,NULL,'WO00004',NULL,'',''); + +/*Table structure for table `syscfg_menu` */ + +DROP TABLE IF EXISTS `syscfg_menu`; + +CREATE TABLE `syscfg_menu` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(6) DEFAULT NULL, + `name` varchar(40) NOT NULL, + `url` varchar(80) DEFAULT NULL, + `weight` int(11) DEFAULT NULL, + `icon` varchar(40) DEFAULT NULL, + `status` tinyint(1) NOT NULL, + `module_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `syscfg_menu_c9799665` (`module_id`), + CONSTRAINT `syscfg_menu_module_id_14fa2e70_fk_syscfg_module_id` FOREIGN KEY (`module_id`) REFERENCES `syscfg_module` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; + +/*Data for the table `syscfg_menu` */ + +insert into `syscfg_menu`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`name`,`url`,`weight`,`icon`,`status`,`module_id`) values (1,'2015-05-01','9999-12-31','zhugl',NULL,'2015-05-01 07:30:19','2015-05-01 07:30:19','M001','模块管理','',99,'',1,1),(2,'2015-05-01','9999-12-31','zhugl',NULL,'2015-05-01 07:30:32','2015-05-01 07:30:32','M002','菜单管理','',99,'',1,1),(3,'2015-05-01','9999-12-31','zhugl',NULL,'2015-05-01 07:52:20','2015-05-01 07:52:20','M003','角色管理','',99,'',1,1); + +/*Table structure for table `syscfg_module` */ + +DROP TABLE IF EXISTS `syscfg_module`; + +CREATE TABLE `syscfg_module` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(6) DEFAULT NULL, + `name` varchar(40) NOT NULL, + `url` varchar(80) DEFAULT NULL, + `weight` int(11) DEFAULT NULL, + `icon` varchar(40) DEFAULT NULL, + `status` tinyint(1) NOT NULL, + `parent_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `syscfg_module_parent_id_350dc54d_fk_syscfg_module_id` (`parent_id`), + CONSTRAINT `syscfg_module_parent_id_350dc54d_fk_syscfg_module_id` FOREIGN KEY (`parent_id`) REFERENCES `syscfg_module` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; + +/*Data for the table `syscfg_module` */ + +insert into `syscfg_module`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`name`,`url`,`weight`,`icon`,`status`,`parent_id`) values (1,'2015-05-01','9999-12-31','zhugl',NULL,'2015-05-01 07:30:01','2015-05-01 07:30:01','U001','系统管理','',99,'',1,NULL),(2,'2015-05-01','9999-12-31','zhugl',NULL,'2015-05-01 07:51:45','2015-05-01 07:51:45','U002','基础数据','',99,'',1,NULL),(3,'2015-05-24','9999-12-31','zhugl',NULL,'2015-05-24 20:02:43','2015-05-24 20:02:43','HR','人力资源','',99,'',1,NULL),(4,'2015-05-24','9999-12-31','zhugl',NULL,'2015-05-24 20:07:15','2015-05-24 20:07:15','U004','个人自助','',99,'',1,NULL),(5,'2015-06-03','9999-12-31','zhugl',NULL,'2015-06-03 20:00:04','2015-06-03 20:00:04','U005','采购管理','',99,'',1,NULL),(6,'2015-06-14','9999-12-31','zhugl',NULL,'2015-06-14 11:08:29','2015-06-14 11:08:29','SA','销售管理','',99,'',1,NULL); + +/*Table structure for table `syscfg_role` */ + +DROP TABLE IF EXISTS `syscfg_role`; + +CREATE TABLE `syscfg_role` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `creator` varchar(20) DEFAULT NULL, + `modifier` varchar(20) DEFAULT NULL, + `creation` datetime DEFAULT NULL, + `modification` datetime DEFAULT NULL, + `code` varchar(6) DEFAULT NULL, + `name` varchar(40) NOT NULL, + `description` varchar(80) DEFAULT NULL, + `status` tinyint(1) NOT NULL, + `parent_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `syscfg_role_parent_id_161850bd_fk_syscfg_role_id` (`parent_id`), + CONSTRAINT `syscfg_role_parent_id_161850bd_fk_syscfg_role_id` FOREIGN KEY (`parent_id`) REFERENCES `syscfg_role` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8; + +/*Data for the table `syscfg_role` */ + +insert into `syscfg_role`(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`name`,`description`,`status`,`parent_id`) values (1,'2015-05-01','9999-12-31','zhugl','zhugl','2015-05-01 07:31:46','2015-05-10 16:53:23','R001','职员','',1,NULL),(2,'2015-06-23','9999-12-31','zhugl',NULL,'2015-06-23 20:41:11','2015-06-23 20:41:11','R002','部门经理','',1,NULL),(3,'2015-06-23','9999-12-31','zhugl',NULL,'2015-06-23 20:41:23','2015-06-23 20:41:23','R003','副总经理','',1,NULL),(4,'2015-06-23','9999-12-31','zhugl',NULL,'2015-06-23 20:41:47','2015-06-23 20:41:47','R004','人事经理','',1,NULL),(5,'2015-06-23','9999-12-31','zhugl',NULL,'2015-06-23 20:41:55','2015-06-23 20:41:55','R005','财务经理','',1,NULL),(6,'2015-06-23','9999-12-31','zhugl',NULL,'2015-06-23 20:42:12','2015-06-23 20:42:12','R006','人事专员','',1,NULL),(7,'2015-06-23','9999-12-31','zhugl',NULL,'2015-06-23 20:42:18','2015-06-23 20:42:18','R007','财务会计','',1,NULL),(9,'2015-06-23','9999-12-31','zhugl',NULL,'2015-06-23 20:42:37','2015-06-23 20:42:37','R009','财务出纳','',1,NULL),(10,'2015-06-23','9999-12-31','zhugl',NULL,'2015-06-23 20:43:02','2015-06-23 20:43:02','R010','行政专员','',1,NULL),(11,'2015-06-23','9999-12-31','zhugl',NULL,'2015-06-23 20:43:12','2015-06-23 20:43:12','R011','市场销售','',1,NULL),(12,'2015-06-23','9999-12-31','zhugl',NULL,'2015-06-23 20:43:24','2015-06-23 20:43:24','R012','库存专员','',1,NULL),(13,'2015-06-23','9999-12-31','zhugl',NULL,'2015-06-23 20:43:32','2015-06-23 20:43:32','R013','总经理','',1,NULL); + +/*Table structure for table `syscfg_role_menus` */ + +DROP TABLE IF EXISTS `syscfg_role_menus`; + +CREATE TABLE `syscfg_role_menus` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `role_id` int(11) NOT NULL, + `menu_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `role_id` (`role_id`,`menu_id`), + KEY `syscfg_role_menus_menu_id_4fb81053_fk_syscfg_menu_id` (`menu_id`), + CONSTRAINT `syscfg_role_menus_menu_id_4fb81053_fk_syscfg_menu_id` FOREIGN KEY (`menu_id`) REFERENCES `syscfg_menu` (`id`), + CONSTRAINT `syscfg_role_menus_role_id_2c83ed04_fk_syscfg_role_id` FOREIGN KEY (`role_id`) REFERENCES `syscfg_role` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `syscfg_role_menus` */ + +/*Table structure for table `syscfg_role_users` */ + +DROP TABLE IF EXISTS `syscfg_role_users`; + +CREATE TABLE `syscfg_role_users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `role_id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `role_id` (`role_id`,`user_id`), + KEY `syscfg_role_users_user_id_3ede60c3_fk_auth_user_id` (`user_id`), + CONSTRAINT `syscfg_role_users_role_id_50b58548_fk_syscfg_role_id` FOREIGN KEY (`role_id`) REFERENCES `syscfg_role` (`id`), + CONSTRAINT `syscfg_role_users_user_id_3ede60c3_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `syscfg_role_users` */ + +/*Table structure for table `syscfg_site` */ + +DROP TABLE IF EXISTS `syscfg_site`; + +CREATE TABLE `syscfg_site` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `name` varchar(40) NOT NULL, + `description` longtext, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/*Data for the table `syscfg_site` */ + +insert into `syscfg_site`(`id`,`begin`,`end`,`name`,`description`) values (1,'2015-05-01','9999-05-01','启腾控股集团',''); + +/*Table structure for table `syscfg_site_user` */ + +DROP TABLE IF EXISTS `syscfg_site_user`; + +CREATE TABLE `syscfg_site_user` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `site_id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `site_id` (`site_id`,`user_id`), + KEY `syscfg_site_user_user_id_31f8aecc_fk_auth_user_id` (`user_id`), + CONSTRAINT `syscfg_site_user_site_id_e6ec06c_fk_syscfg_site_id` FOREIGN KEY (`site_id`) REFERENCES `syscfg_site` (`id`), + CONSTRAINT `syscfg_site_user_user_id_31f8aecc_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `syscfg_site_user` */ + +/*Table structure for table `workflow_history` */ + +DROP TABLE IF EXISTS `workflow_history`; + +CREATE TABLE `workflow_history` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `pro_time` datetime NOT NULL, + `pro_type` int(11) NOT NULL, + `memo` varchar(40) DEFAULT NULL, + `inst_id` int(11) NOT NULL, + `node_id` int(11), + `user_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `workflow_history_d2b1b1e1` (`inst_id`), + KEY `workflow_history_c693ebc8` (`node_id`), + KEY `workflow_history_e8701ad4` (`user_id`), + CONSTRAINT `workflow_history_inst_id_2237d3b0_fk_workflow_instance_id` FOREIGN KEY (`inst_id`) REFERENCES `workflow_instance` (`id`), + CONSTRAINT `workflow_history_node_id_54527354_fk_workflow_node_id` FOREIGN KEY (`node_id`) REFERENCES `workflow_node` (`id`), + CONSTRAINT `workflow_history_user_id_4dee98c5_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; + +/*Data for the table `workflow_history` */ + +insert into `workflow_history`(`id`,`pro_time`,`pro_type`,`memo`,`inst_id`,`node_id`,`user_id`) values (1,'2015-07-02 06:19:52',0,NULL,1,NULL,14),(2,'2015-07-03 05:48:11',1,'同意',1,5,13),(3,'2015-07-03 05:50:38',1,'好',1,6,16),(4,'2015-07-03 05:51:08',1,'',1,7,16),(7,'2015-07-05 09:44:25',0,NULL,3,NULL,14),(14,'2015-07-09 21:25:38',1,'123',3,5,13),(15,'2015-07-12 01:26:21',1,'12',3,6,16),(16,'2015-07-12 01:26:40',1,'123',3,7,16),(20,'2015-07-30 21:24:06',0,NULL,8,NULL,14); + +/*Table structure for table `workflow_instance` */ + +DROP TABLE IF EXISTS `workflow_instance`; + +CREATE TABLE `workflow_instance` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(10) DEFAULT NULL, + `object_id` int(10) unsigned NOT NULL, + `start_time` datetime NOT NULL, + `approved_time` datetime DEFAULT NULL, + `status` int(11) NOT NULL, + `modal_id` int(11) NOT NULL, + `starter_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `workflow_instance_9b2b8663` (`modal_id`), + KEY `workflow_instance_11d91f21` (`starter_id`), + CONSTRAINT `workflow_instance_modal_id_3eb1d1ea_fk_workflow_modal_id` FOREIGN KEY (`modal_id`) REFERENCES `workflow_modal` (`id`), + CONSTRAINT `workflow_instance_starter_id_3e0b14b6_fk_auth_user_id` FOREIGN KEY (`starter_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; + +/*Data for the table `workflow_instance` */ + +insert into `workflow_instance`(`id`,`code`,`object_id`,`start_time`,`approved_time`,`status`,`modal_id`,`starter_id`) values (1,'S00001',8,'2015-07-02 06:19:52','2015-07-03 05:51:08',99,2,14),(3,'S00003',9,'2015-07-05 09:44:25','2015-07-12 01:26:40',99,2,14),(8,'S00008',7,'2015-07-30 21:24:06',NULL,1,2,14); + +/*Table structure for table `workflow_instance_current_nodes` */ + +DROP TABLE IF EXISTS `workflow_instance_current_nodes`; + +CREATE TABLE `workflow_instance_current_nodes` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `instance_id` int(11) NOT NULL, + `node_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `instance_id` (`instance_id`,`node_id`), + KEY `workflow_instance_current_n_node_id_54bc8d3a_fk_workflow_node_id` (`node_id`), + CONSTRAINT `workflow_instance_current_n_node_id_54bc8d3a_fk_workflow_node_id` FOREIGN KEY (`node_id`) REFERENCES `workflow_node` (`id`), + CONSTRAINT `workflow_instance_cu_instance_id_556870f_fk_workflow_instance_id` FOREIGN KEY (`instance_id`) REFERENCES `workflow_instance` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; + +/*Data for the table `workflow_instance_current_nodes` */ + +insert into `workflow_instance_current_nodes`(`id`,`instance_id`,`node_id`) values (3,8,5); + +/*Table structure for table `workflow_modal` */ + +DROP TABLE IF EXISTS `workflow_modal`; + +CREATE TABLE `workflow_modal` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(6) DEFAULT NULL, + `name` varchar(40) NOT NULL, + `description` longtext, + `app_name` varchar(60) DEFAULT NULL, + `model_name` varchar(60) DEFAULT NULL, + `begin` date DEFAULT NULL, + `end` date DEFAULT NULL, + `content_type_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `workflow_moda_content_type_id_7646d9af_fk_django_content_type_id` (`content_type_id`), + CONSTRAINT `workflow_moda_content_type_id_7646d9af_fk_django_content_type_id` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; + +/*Data for the table `workflow_modal` */ + +insert into `workflow_modal`(`id`,`code`,`name`,`description`,`app_name`,`model_name`,`begin`,`end`,`content_type_id`) values (1,'WF001','新员工入职流程','','basedata','employee','2015-05-10','9999-12-31',30),(2,'WF002','项目审批流程','','basedata','project','2015-07-01','9999-12-31',19); + +/*Table structure for table `workflow_node` */ + +DROP TABLE IF EXISTS `workflow_node`; + +CREATE TABLE `workflow_node` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(4) DEFAULT NULL, + `name` varchar(80) NOT NULL, + `tooltip` varchar(120) DEFAULT NULL, + `start` tinyint(1) NOT NULL, + `stop` tinyint(1) NOT NULL, + `can_terminate` tinyint(1) NOT NULL, + `can_deny` tinyint(1) NOT NULL, + `email_notice` tinyint(1) NOT NULL, + `short_message_notice` tinyint(1) NOT NULL, + `approve_node` tinyint(1) NOT NULL, + `handler` longtext, + `handler_type` int(11) NOT NULL, + `modal_id` int(11) NOT NULL, + `next_node_handler` varchar(40), + `next_user_handler` varchar(40), + `status_field` varchar(40), + `status_value` varchar(40), + `action` varchar(40), + `can_edit` tinyint(1) NOT NULL, + PRIMARY KEY (`id`), + KEY `workflow_node_modal_id_3aa9d381_fk_workflow_modal_id` (`modal_id`), + CONSTRAINT `workflow_node_modal_id_3aa9d381_fk_workflow_modal_id` FOREIGN KEY (`modal_id`) REFERENCES `workflow_modal` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; + +/*Data for the table `workflow_node` */ + +insert into `workflow_node`(`id`,`code`,`name`,`tooltip`,`start`,`stop`,`can_terminate`,`can_deny`,`email_notice`,`short_message_notice`,`approve_node`,`handler`,`handler_type`,`modal_id`,`next_node_handler`,`next_user_handler`,`status_field`,`status_value`,`action`,`can_edit`) values (3,'N01','薪酬专员审批','',0,0,0,1,1,0,0,'',1,1,NULL,NULL,NULL,NULL,NULL,0),(4,'N02','合同专员审批','',0,0,0,1,1,0,0,'',1,1,NULL,NULL,NULL,NULL,NULL,0),(5,'N01','商务主管审批',NULL,0,0,0,1,1,0,0,'',1,2,'project.budge.gt.10000','up.position.user','status','02','',1),(6,'N02','财务经理审批',NULL,0,0,0,1,1,0,0,'',1,2,'','up.position.user','status','03','action.test',0),(7,'N03','总经理审批',NULL,0,0,0,1,1,0,0,'',2,2,'','','','','',0); + +/*Table structure for table `workflow_node_departments` */ + +DROP TABLE IF EXISTS `workflow_node_departments`; + +CREATE TABLE `workflow_node_departments` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `node_id` int(11) NOT NULL, + `orgunit_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `node_id` (`node_id`,`orgunit_id`), + KEY `workflow_node_department_orgunit_id_276f2bb6_fk_organ_orgunit_id` (`orgunit_id`), + CONSTRAINT `workflow_node_departments_node_id_379e5725_fk_workflow_node_id` FOREIGN KEY (`node_id`) REFERENCES `workflow_node` (`id`), + CONSTRAINT `workflow_node_department_orgunit_id_276f2bb6_fk_organ_orgunit_id` FOREIGN KEY (`orgunit_id`) REFERENCES `organ_orgunit` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `workflow_node_departments` */ + +/*Table structure for table `workflow_node_next` */ + +DROP TABLE IF EXISTS `workflow_node_next`; + +CREATE TABLE `workflow_node_next` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `from_node_id` int(11) NOT NULL, + `to_node_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `from_node_id` (`from_node_id`,`to_node_id`), + KEY `workflow_node_next_to_node_id_71e709f3_fk_workflow_node_id` (`to_node_id`), + CONSTRAINT `workflow_node_next_from_node_id_78e6ce74_fk_workflow_node_id` FOREIGN KEY (`from_node_id`) REFERENCES `workflow_node` (`id`), + CONSTRAINT `workflow_node_next_to_node_id_71e709f3_fk_workflow_node_id` FOREIGN KEY (`to_node_id`) REFERENCES `workflow_node` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; + +/*Data for the table `workflow_node_next` */ + +insert into `workflow_node_next`(`id`,`from_node_id`,`to_node_id`) values (3,3,4); + +/*Table structure for table `workflow_node_positions` */ + +DROP TABLE IF EXISTS `workflow_node_positions`; + +CREATE TABLE `workflow_node_positions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `node_id` int(11) NOT NULL, + `position_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `node_id` (`node_id`,`position_id`), + KEY `workflow_node_position_position_id_187bce75_fk_organ_position_id` (`position_id`), + CONSTRAINT `workflow_node_positions_node_id_64f898c6_fk_workflow_node_id` FOREIGN KEY (`node_id`) REFERENCES `workflow_node` (`id`), + CONSTRAINT `workflow_node_position_position_id_187bce75_fk_organ_position_id` FOREIGN KEY (`position_id`) REFERENCES `organ_position` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/*Data for the table `workflow_node_positions` */ + +insert into `workflow_node_positions`(`id`,`node_id`,`position_id`) values (1,7,87); + +/*Table structure for table `workflow_node_roles` */ + +DROP TABLE IF EXISTS `workflow_node_roles`; + +CREATE TABLE `workflow_node_roles` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `node_id` int(11) NOT NULL, + `role_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `node_id` (`node_id`,`role_id`), + KEY `workflow_node_roles_role_id_1b05e9ff_fk_syscfg_role_id` (`role_id`), + CONSTRAINT `workflow_node_roles_node_id_c6ea3f5_fk_workflow_node_id` FOREIGN KEY (`node_id`) REFERENCES `workflow_node` (`id`), + CONSTRAINT `workflow_node_roles_role_id_1b05e9ff_fk_syscfg_role_id` FOREIGN KEY (`role_id`) REFERENCES `syscfg_role` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `workflow_node_roles` */ + +/*Table structure for table `workflow_node_users` */ + +DROP TABLE IF EXISTS `workflow_node_users`; + +CREATE TABLE `workflow_node_users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `node_id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `node_id` (`node_id`,`user_id`), + KEY `workflow_node_users_user_id_36b0d3c5_fk_auth_user_id` (`user_id`), + CONSTRAINT `workflow_node_users_node_id_4b2940ca_fk_workflow_node_id` FOREIGN KEY (`node_id`) REFERENCES `workflow_node` (`id`), + CONSTRAINT `workflow_node_users_user_id_36b0d3c5_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +/*Data for the table `workflow_node_users` */ + +/*Table structure for table `workflow_todolist` */ + +DROP TABLE IF EXISTS `workflow_todolist`; + +CREATE TABLE `workflow_todolist` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `app_name` varchar(60) DEFAULT NULL, + `model_name` varchar(60) DEFAULT NULL, + `arrived_time` datetime NOT NULL, + `is_read` tinyint(1) NOT NULL, + `read_time` datetime DEFAULT NULL, + `inst_id` int(11) NOT NULL, + `node_id` int(11) DEFAULT NULL, + `user_id` int(11) NOT NULL, + `code` varchar(10), + `status` tinyint(1) NOT NULL, + PRIMARY KEY (`id`), + KEY `workflow_todolist_inst_id_5f7d95_fk_workflow_instance_id` (`inst_id`), + KEY `workflow_todolist_user_id_5209b40_fk_auth_user_id` (`user_id`), + KEY `workflow_todolist_node_id_6be79401_fk_workflow_node_id` (`node_id`), + CONSTRAINT `workflow_todolist_inst_id_5f7d95_fk_workflow_instance_id` FOREIGN KEY (`inst_id`) REFERENCES `workflow_instance` (`id`), + CONSTRAINT `workflow_todolist_node_id_6be79401_fk_workflow_node_id` FOREIGN KEY (`node_id`) REFERENCES `workflow_node` (`id`), + CONSTRAINT `workflow_todolist_user_id_5209b40_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; + +/*Data for the table `workflow_todolist` */ + +insert into `workflow_todolist`(`id`,`app_name`,`model_name`,`arrived_time`,`is_read`,`read_time`,`inst_id`,`node_id`,`user_id`,`code`,`status`) values (1,'basedata','project','2015-07-02 06:19:52',1,'2015-07-02 06:20:23',1,5,13,'TD00001',1),(2,'basedata','project','2015-07-03 05:48:11',1,'2015-07-03 05:50:21',1,6,16,'TD00002',1),(3,'basedata','project','2015-07-03 05:50:38',1,'2015-07-03 05:50:39',1,7,16,'TD00003',1),(5,'basedata','project','2015-07-05 09:44:25',1,'2015-07-05 09:49:38',3,5,13,'TD00005',1),(12,'basedata','project','2015-07-09 21:25:38',1,'2015-07-12 01:26:17',3,6,16,'TD00012',1),(13,'basedata','project','2015-07-12 01:26:21',1,'2015-07-12 01:26:21',3,7,16,'TD00013',1),(17,'basedata','project','2015-07-30 21:24:06',1,'2015-07-30 21:24:17',8,5,13,'TD00017',0),(18,'basedata','project','2015-07-30 21:24:06',1,'2015-07-30 21:24:06',8,NULL,14,'TD00018',1); + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; diff --git a/Install/SQL/sale_order_sample.sql b/Install/SQL/sale_order_sample.sql new file mode 100644 index 0000000..10c9472 --- /dev/null +++ b/Install/SQL/sale_order_sample.sql @@ -0,0 +1,45 @@ +-- 销售订单示例数据(依赖 basedata_partner / basedata_material 等基础数据) +-- 导入: mysql -uroot -proot mis < Install/SQL/sale_order_sample.sql + +SET NAMES utf8mb4; + +INSERT INTO `sale_saleorder` +(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`order_date`,`deliver_date`,`title`,`description`,`contact`,`phone`,`fax`,`deliver_address`,`invoice_type`,`amount`,`discount_amount`,`status`,`org_id`,`partner_id`,`user_id`) +SELECT 1,'2025-05-20','9999-12-31','chengcai','chengcai',NOW(),NOW(),'SO00001','2025-05-10','2025-05-25','办公设备采购订单','含笔记本电脑及服务器,需上门安装调试。','张经理','13800138001',NULL,'上海市浦东新区张江高科技园区科苑路88号','10',24299.00,0.00,'9',1,17,11 +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sale_saleorder WHERE code='SO00001'); + +INSERT INTO `sale_saleorder` +(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`order_date`,`deliver_date`,`title`,`description`,`contact`,`phone`,`fax`,`deliver_address`,`invoice_type`,`amount`,`discount_amount`,`status`,`org_id`,`partner_id`,`user_id`) +SELECT 2,'2025-05-20','9999-12-31','chengcai','chengcai',NOW(),NOW(),'SO00002','2025-05-15','2025-06-01','配电设备批量采购','项目现场配电改造用材。','李工','13900139002',NULL,'江苏省南京市江宁区将军大道29号','10',6400.00,200.00,'1',1,17,11 +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sale_saleorder WHERE code='SO00002'); + +INSERT INTO `sale_saleorder` +(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`order_date`,`deliver_date`,`title`,`description`,`contact`,`phone`,`fax`,`deliver_address`,`invoice_type`,`amount`,`discount_amount`,`status`,`org_id`,`partner_id`,`user_id`) +SELECT 3,'2025-05-20','9999-12-31','chengcai','chengcai',NOW(),NOW(),'SO00003','2025-05-18','2025-05-22','水果批发季节订单','当季鲜果直采,分批配送。','王采购','13700137003',NULL,'浙江省杭州市余杭区良渚街道物流园A区','10',13962.00,0.00,'0',1,17,11 +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sale_saleorder WHERE code='SO00003'); + +INSERT INTO `sale_saleorder` +(`id`,`begin`,`end`,`creator`,`modifier`,`creation`,`modification`,`code`,`order_date`,`deliver_date`,`title`,`description`,`contact`,`phone`,`fax`,`deliver_address`,`invoice_type`,`amount`,`discount_amount`,`status`,`org_id`,`partner_id`,`user_id`) +SELECT 4,'2025-05-20','9999-12-31','chengcai','chengcai',NOW(),NOW(),'SO00004','2025-05-20','2025-05-28','劳保用品集中采购','车间一线员工劳保手套补充采购。','赵主任','13600136004',NULL,'安徽省合肥市蜀山区望江西路666号','10',5500.00,0.00,'9',1,17,11 +FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sale_saleorder WHERE code='SO00004'); + +INSERT INTO `sale_saleitem` (`id`,`cnt`,`stock_price`,`sale_price`,`tax`,`create_time`,`status`,`event_time`,`master_id`,`material_id`,`measure_id`,`discount_price`) +SELECT 1,2.0000,NULL,7150.0000,'0.00',NOW(),0,NULL,1,53,1,NULL FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sale_saleitem WHERE id=1); + +INSERT INTO `sale_saleitem` (`id`,`cnt`,`stock_price`,`sale_price`,`tax`,`create_time`,`status`,`event_time`,`master_id`,`material_id`,`measure_id`,`discount_price`) +SELECT 2,1.0000,NULL,9999.0000,'0.00',NOW(),0,NULL,1,54,1,NULL FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sale_saleitem WHERE id=2); + +INSERT INTO `sale_saleitem` (`id`,`cnt`,`stock_price`,`sale_price`,`tax`,`create_time`,`status`,`event_time`,`master_id`,`material_id`,`measure_id`,`discount_price`) +SELECT 3,20.0000,NULL,320.0000,'0.00',NOW(),0,NULL,2,52,1,NULL FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sale_saleitem WHERE id=3); + +INSERT INTO `sale_saleitem` (`id`,`cnt`,`stock_price`,`sale_price`,`tax`,`create_time`,`status`,`event_time`,`master_id`,`material_id`,`measure_id`,`discount_price`) +SELECT 4,500.0000,NULL,10.9200,'0.00',NOW(),0,NULL,3,40,3,NULL FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sale_saleitem WHERE id=4); + +INSERT INTO `sale_saleitem` (`id`,`cnt`,`stock_price`,`sale_price`,`tax`,`create_time`,`status`,`event_time`,`master_id`,`material_id`,`measure_id`,`discount_price`) +SELECT 5,300.0000,NULL,15.9900,'0.00',NOW(),0,NULL,3,41,3,NULL FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sale_saleitem WHERE id=5); + +INSERT INTO `sale_saleitem` (`id`,`cnt`,`stock_price`,`sale_price`,`tax`,`create_time`,`status`,`event_time`,`master_id`,`material_id`,`measure_id`,`discount_price`) +SELECT 6,200.0000,NULL,18.5250,'0.00',NOW(),0,NULL,3,42,3,NULL FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sale_saleitem WHERE id=6); + +INSERT INTO `sale_saleitem` (`id`,`cnt`,`stock_price`,`sale_price`,`tax`,`create_time`,`status`,`event_time`,`master_id`,`material_id`,`measure_id`,`discount_price`) +SELECT 7,1000.0000,NULL,5.5000,'0.00',NOW(),0,NULL,4,5,1,NULL FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sale_saleitem WHERE id=7); diff --git a/Install/load_sale_sample.py b/Install/load_sale_sample.py new file mode 100644 index 0000000..60713fa --- /dev/null +++ b/Install/load_sale_sample.py @@ -0,0 +1,170 @@ +# -*- coding: utf-8 -*- +"""导入销售订单示例数据。用法: python Install/load_sale_sample.py""" +import os +import sys +import datetime + +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +if BASE_DIR not in sys.path: + sys.path.insert(0, BASE_DIR) + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mis.settings') + +import django +django.setup() + +from decimal import Decimal +from django.contrib.auth.models import User +from django.db import transaction +from basedata.models import Partner, Material, Organization +from sale.models import SaleOrder, SaleItem + + +def recalc_order_amount(order): + total = Decimal('0') + for item in SaleItem.objects.filter(master=order): + price = item.sale_price or Decimal('0') + total += price * item.cnt + SaleOrder.objects.filter(pk=order.pk).update(amount=total) + order.amount = total + return total + + +SAMPLE_ORDERS = [ + { + 'code': 'SO00001', + 'title': u'办公设备采购订单', + 'order_date': datetime.date(2025, 5, 10), + 'deliver_date': datetime.date(2025, 5, 25), + 'contact': u'张经理', + 'phone': '13800138001', + 'deliver_address': u'上海市浦东新区张江高科技园区科苑路88号', + 'description': u'含笔记本电脑及服务器,需上门安装调试。', + 'status': '9', + 'discount_amount': 0, + 'items': [ + {'material_code': 'IT5001', 'cnt': 2, 'sale_price': 7150.00}, + {'material_code': 'IT5002', 'cnt': 1, 'sale_price': 9999.00}, + ], + }, + { + 'code': 'SO00002', + 'title': u'配电设备批量采购', + 'order_date': datetime.date(2025, 5, 15), + 'deliver_date': datetime.date(2025, 6, 1), + 'contact': u'李工', + 'phone': '13900139002', + 'deliver_address': u'江苏省南京市江宁区将军大道29号', + 'description': u'项目现场配电改造用材。', + 'status': '1', + 'discount_amount': 200.00, + 'items': [ + {'material_code': 'IT9981', 'cnt': 20, 'sale_price': 320.00}, + ], + }, + { + 'code': 'SO00003', + 'title': u'水果批发季节订单', + 'order_date': datetime.date(2025, 5, 18), + 'deliver_date': datetime.date(2025, 5, 22), + 'contact': u'王采购', + 'phone': '13700137003', + 'deliver_address': u'浙江省杭州市余杭区良渚街道物流园A区', + 'description': u'当季鲜果直采,分批配送。', + 'status': '0', + 'discount_amount': 0, + 'items': [ + {'material_code': 'IT9001', 'cnt': 500, 'sale_price': 11.00}, + {'material_code': 'IT9002', 'cnt': 300, 'sale_price': 16.00}, + {'material_code': 'IT9003', 'cnt': 200, 'sale_price': 19.00}, + ], + }, + { + 'code': 'SO00004', + 'title': u'劳保用品集中采购', + 'order_date': datetime.date(2025, 5, 20), + 'deliver_date': datetime.date(2025, 5, 28), + 'contact': u'赵主任', + 'phone': '13600136004', + 'deliver_address': u'安徽省合肥市蜀山区望江西路666号', + 'description': u'车间一线员工劳保手套补充采购。', + 'status': '9', + 'discount_amount': 0, + 'items': [ + {'material_code': 'IT00005', 'cnt': 1000, 'sale_price': 5.50}, + ], + }, +] + + +def load_samples(): + partner = Partner.objects.filter(partner_type='C').first() + if not partner: + print(u'错误: 未找到客户类型合作伙伴,请先维护基础数据。') + return + + user = User.objects.filter(username='chengcai').first() or User.objects.first() + org = Organization.objects.first() + creator = user.username if user else 'system' + today = datetime.date.today() + + created = 0 + skipped = 0 + + with transaction.atomic(): + for data in SAMPLE_ORDERS: + if SaleOrder.objects.filter(code=data['code']).exists(): + print(u'跳过已存在订单: %s' % data['code']) + skipped += 1 + continue + + order = SaleOrder( + code=data['code'], + title=data['title'], + order_date=data['order_date'], + deliver_date=data['deliver_date'], + partner=partner, + org=org, + user=user, + contact=data['contact'], + phone=data['phone'], + deliver_address=data['deliver_address'], + description=data['description'], + invoice_type='10', + status=data['status'], + discount_amount=data['discount_amount'], + amount=0, + begin=today, + end=datetime.date(9999, 12, 31), + creator=creator, + modifier=creator, + ) + order.save() + + for item_data in data['items']: + material = Material.objects.filter(code=item_data['material_code']).first() + if not material: + print(u'警告: 物料 %s 不存在,已跳过' % item_data['material_code']) + continue + item = SaleItem( + master=order, + material=material, + cnt=item_data['cnt'], + sale_price=item_data['sale_price'], + tax='0.00', + ) + item.save() + + if data['discount_amount'] > 0: + order.save() + total = recalc_order_amount(order) + print(u'已创建: %s %s 金额=%s 状态=%s' % ( + order.code, order.title, total, order.get_status_display() + )) + created += 1 + + print(u'\n完成: 新增 %d 条,跳过 %d 条。' % (created, skipped)) + + +if __name__ == '__main__': + load_samples() diff --git a/Install/requirements.txt b/Install/requirements.txt new file mode 100644 index 0000000..5730d58 --- /dev/null +++ b/Install/requirements.txt @@ -0,0 +1,4 @@ +Django==1.10.6 +PyMySQL==0.7.9 +xlwt==1.0.0 +xlrd==1.2.0 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..46c84fa --- /dev/null +++ b/README.md @@ -0,0 +1,127 @@ +# 智捷ERP (SmartJet ERP) 操作手册 + +智捷ERP 是一款基于 Django 1.10.6 深度定制的企业资源计划 (ERP) 管理软件。系统经过现代 UI 重构与 Docker 化部署优化,提供销售管理、采购管理、库存管理、组织架构、人力资源及自动化工作流审批等核心功能。 + +![image-20260610135601841](images/image-20260610135601841.png) + +--- + +## 1. 快速开始 + +### 1.1 环境要求 +- Docker +- Docker Compose + +### 1.2 一键部署 +在项目根目录下执行以下命令,即可启动 Web 服务与 MySQL 数据库: + +```bash +docker compose -f docker-compose.full.yml up -d --build +``` + +### 1.3 访问地址 +- **后台管理**: [http://localhost:6010/admin/](http://localhost:6010/admin/) +- **数据库服务**: `localhost:6011` (容器内 3306) + +### 1.4 默认账号 +系统预置了管理员账号用于演示: + +| 角色 | 用户名 | 密码 | 说明 | +|------|--------|------|------| +| 超级管理员 | xinmi_admin | admin123456 | 全新创建的超级用户,建议首选使用 | + +--- + +## 2. 核心功能模块 + +智捷ERP 采用现代化的“侧边栏 + 高密度工作台”布局,确保业务数据直观可见。 + +![image-20260610135614258](images/image-20260610135614258.png) + +### 2.1 仪表盘 (Dashboard) +**路径**: `/admin/` +**功能概述**: 实时展现企业核心经营指标。 +- **数据看板**: 销售总额、待办审批、库存预警、系统在线率。 +- **趋势分析**: 关键指标下方的 Sparkline 动态折线图。 +- **快捷操作**: 一键新建销售单、采购入库、员工入职。 + +### 2.2 核心业务 +- **销售管理**: `/admin/sale/saleorder/` —— 涵盖报价单、销售订单、收款计划跟踪。 +- **采购管理**: `/admin/purchase/purchaseorder/` —— 支持采购申请、订单审批、入库确认。 +- **库存管理**: `/admin/invent/inventory/` —— 实时盘点、低水位报警、批次溯源。 + +![image-20260610135625703](images/image-20260610135625703.png) + +![image-20260610135636514](images/image-20260610135636514.png) + +![image-20260610135644978](images/image-20260610135644978.png) + +![image-20260610135653450](images/image-20260610135653450.png) + +![image-20260610135704180](images/image-20260610135704180.png) + + + +![image-20260610135711248](images/image-20260610135711248.png) + + + +### 2.3 组织与人力 +- **组织架构**: `/admin/organ/organization/` —— 维护企业多级部门与岗位树。 +- **员工档案**: `/admin/basedata/employee/` —— 员工全生命周期管理、五险一金基础配置。 + +![image-20260610135719363](images/image-20260610135719363.png) + +![image-20260610135727597](images/image-20260610135727597.png) + +![image-20260610135737510](images/image-20260610135737510.png) + +### 2.4 流程协同 +- **审批中心**: `/admin/workflow/instance/` —— 流程实例监控。 + +- **待办任务**: `/admin/workflow/todolist/` —— 个人审批任务列表,支持紧急程度分级。 + + ![image-20260610135747819](images/image-20260610135747819.png) + + ![image-20260610135757306](images/image-20260610135757306.png) + + + + + +--- + +## 3. 视觉与体验优化 (Next-Gen UI 4.0) + +本项目已完成 1:1 高保真 UI 复刻,具有以下设计特征: +- **高级配色**: 采用 Indigo & Slate 商务配色。 +- **极致紧凑**: Ultra-Compact 模式,单屏展示数据量提升 40% 以上。 +- **响应式布局**: 侧边栏固定,超宽表格自动开启内部横向滚动保护。 + +--- + +## 4. 技术维护 + +### 4.1 数据库初始化 +数据库初始化 SQL 位于 `Install/SQL/mis.sql`,Docker 启动时会自动挂载并执行。 + +### 4.2 静态资源更新 +若修改了 CSS 或 JS,请在容器内执行: +```bash +docker compose exec web python manage.py collectstatic --noinput +``` + +--- + +## 5. 常见问题 (FAQ) + +**Q: 登录时提示“请输入正确的用户名和密码”?** +A: 可能是由于默认加密算法版本差异,请通过控制台重置: +`docker compose exec web python manage.py changepassword admin` + +**Q: 列表页面字段太多,显示超宽?** +A: 系统已开启横向滚动条保护,您可以在表格区域内左右滑动查看完整数据。 + +--- + +© 2026 智捷ERP (SmartJet ERP) · 让企业管理更智能 diff --git a/basedata/__init__.py b/basedata/__init__.py new file mode 100644 index 0000000..03d7ed8 --- /dev/null +++ b/basedata/__init__.py @@ -0,0 +1,2 @@ + +default_app_config = 'basedata.apps.BaseDataConfig' \ No newline at end of file diff --git a/basedata/admin.py b/basedata/admin.py new file mode 100644 index 0000000..7a0cd81 --- /dev/null +++ b/basedata/admin.py @@ -0,0 +1,339 @@ +# coding=utf-8 +from django.contrib import admin +from django.forms import models +from django.forms import fields,TextInput,Textarea +from django.contrib import messages +from django.utils.translation import ugettext_lazy as _ +from django.contrib.contenttypes.admin import GenericTabularInline +from common import generic +from basedata.models import ValueList,ValueListItem,Address,Partner,BankAccount,Project,Measure,Material,Brand,\ + Category,Warehouse,TechnicalParameterName,TechnicalParameterValue,Trade,ExpenseAccount,Employee,Family,Education,\ + WorkExperience,ExtraParam,DataImport,Document + + +class ValueListItemInline(admin.TabularInline): + model = ValueListItem + exclude = ['group_code'] + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 3 + + +class ValueListAdmin(generic.BOAdmin): + CODE_NUMBER_WIDTH = 3 + CODE_PREFIX = 'S' + list_display = ['code', 'name', 'module', 'status'] + fields = (('code',),('name',),('module',),('status','init','locked',),('locked_by','lock_time',)) + raw_id_fields = ['module'] + readonly_fields = ['locked_by','lock_time'] + inlines = [ValueListItemInline] + search_fields = ['code','name'] + + def save_model(self, request, obj, form, change): + super(ValueListAdmin,self).save_model(request,obj,form,change) + obj.valuelistitem_set.update(group_code=obj.code) + + +class AddressAdmin(generic.BOAdmin): + list_display = ['address','phone','contacts'] + exclude = ['content_type','object_id','creator','modifier','creation','modification','begin','end'] + + +class AddressInline(GenericTabularInline): + model = Address + exclude = ['content_type','object_id','creator','modifier','creation','modification','begin','end'] + extra = 1 + + +class BankAccountInline(admin.TabularInline): + model = BankAccount + fields = ['account','title','memo'] + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 1 + + +class PartnerForm(models.ModelForm): + tax_address = fields.CharField(widget=TextInput(attrs={'size': 119,}),required=False,label=_("tax address")) + memo = fields.CharField(widget=Textarea(attrs={'rows':3,'cols':85}),required=False,label=_("memo")) + + class Meta: + model = Partner + fields = '__all__' + + +class PartnerAdmin(generic.BOAdmin): + list_display = ['code','name','partner_type','level'] + list_display_links = ['code','name'] + + fields = (('code','name',),('short','pinyin',),('partner_type','level'),('tax_num','tax_account',), + ('tax_address',),('contacts','phone',),('memo',),) + search_fields = ['code','name','pinyin'] + form = PartnerForm + save_on_top = True + inlines = [AddressInline,BankAccountInline] + + def get_queryset(self, request): + if request.user.is_superuser or (request.user.has_perm('basedate.view_all_customer') and request.user.has_perm('basedate.view_all_supplier')): + return super(PartnerAdmin,self).get_queryset(request) + elif request.user.has_perm('basedata.view_all_customer'): + return super(PartnerAdmin,self).get_queryset(request).filter(partner_type='C') + else: + return super(PartnerAdmin,self).get_queryset(request).filter(partner_type='S') + + +class ProjectForm(models.ModelForm): + income = fields.DecimalField(required=False,widget=TextInput(attrs={'readonly':'true'})) + expand = fields.DecimalField(required=False,widget=TextInput(attrs={'readonly':'true'})) + + class Meta: + model = Project + fields = '__all__' + + +class ProjectAdmin(generic.BOAdmin): + CODE_PREFIX = 'PJ' + list_display = ['code','name','status','income','expand'] + list_display_links = ['code','name'] + fields = ( + ('code','name',),('short','pinyin',), + ('partner',),('status','prj_type',), + ('description',), + ('budget','income','expand',),('blueprint',),('offer',),('business',),('users',), + ) + search_fields = ['code','name'] + readonly_fields = ['status'] + raw_id_fields = ['partner'] + filter_horizontal = ['users'] + form = ProjectForm + + +class WarehouseAdmin(admin.ModelAdmin): + list_display = ['code','name','location'] + filter_horizontal = ['users'] + + def save_model(self, request, obj, form, change): + super(WarehouseAdmin,self).save_model(request,obj,form,change) + try: + code = getattr(obj,'code') + if not code: + obj.code = '%s%02d' % ('A',obj.id) + obj.save() + except Exception,e: + self.message_user(request,'ERROR:%s' % e,level=messages.ERROR) + + +class BrandAdmin(admin.ModelAdmin): + list_display = ['name','pinyin'] + + +class MeasureAdmin(admin.ModelAdmin): + list_display = ['code','name','status'] + + +class CategoryAdmin(admin.ModelAdmin): + list_display = ['code','name','path'] + + def save_model(self, request, obj, form, change): + super(CategoryAdmin,self).save_model(request,obj,form,change) + try: + code = getattr(obj,'code') + if not code: + obj.code = '%s%02d' % ('F',obj.id) + obj.save() + if obj.parent: + if obj.parent.path: + obj.path = obj.parent.path + '/'+obj.parent.name + else: + obj.path = obj.parent.name + obj.save() + except Exception,e: + self.message_user(request,'ERROR:%s' % e,level=messages.ERROR) + + +class MaterialForm(models.ModelForm): + name = fields.CharField(widget=TextInput(attrs={"size":"119"}),label=_("material name")) + spec = fields.CharField(widget=TextInput(attrs={"size":"119"}),required=False,label=_("specifications")) + + class Mata: + model = Material + fields = '__all__' + + +class ExtraParamInline(admin.TabularInline): + model = ExtraParam + fields = ['name','data_type','data_source'] + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 1 + + +class MaterialAdmin(generic.BOAdmin): + CODE_PREFIX = 'IT' + CODE_NUMBER_WIDTH = 5 + list_display = ['code','name','spec','tp'] + list_display_links = ['code','name'] + list_filter = ['brand','tp'] + search_fields = ['code','name'] + fields = ( + ('code','barcode'),('name',),('spec',), + ('brand',),('category',),('status','is_equip','can_sale','is_virtual',), + ('warehouse',),('tp',),('measure',),('stock_price','purchase_price','sale_price',), + ) + filter_horizontal = ['measure'] + inlines = [ExtraParamInline] + form = MaterialForm + + +class TechParamValueInline(admin.TabularInline): + model = TechnicalParameterValue + + +class TechParamNameAdmin(admin.ModelAdmin): + list_display = ['name','category'] + inlines = [TechParamValueInline] + + +class TradeAdmin(admin.ModelAdmin): + list_display = ['code','name','parent'] + + +class ExpenseAdmin(generic.BOAdmin): + CODE_PREFIX = 'FC' + list_display = ['code','name','category'] + list_display_links = ['code','name'] + list_filter = ['category'] + search_fields = ['name'] + + +class FamilyForm(models.ModelForm): + name = fields.CharField(widget=TextInput(attrs={"size":"25"}),label=_("name")) + phone = fields.CharField(widget=TextInput(attrs={"size":"25"}),label=_("phone")) + + class Meta: + model = Family + fields = '__all__' + + +class FamilyInline(admin.TabularInline): + model = Family + exclude = ['creator','modifier','creation','modification','begin','end'] + form = FamilyForm + extra = 1 + + +class EducationInline(admin.TabularInline): + model = Education + exclude = ['creator','modifier','creation','modification'] + extra = 0 + + +class WorkExperienceInline(admin.TabularInline): + model = WorkExperience + exclude = ['creator','modifier','creation','modification'] + extra = 1 + + +class EmployeeAdmin(generic.BOAdmin): + CODE_PREFIX = '1' + list_display = ['code','name','position','gender','idcard','age','work_age','literacy','phone','email'] + search_fields = ['code','name','idcard','pinyin'] + fieldsets = [ + (None,{'fields':[('code','phone',),('name','pinyin',),('gender','birthday',),('idcard','country',), + ('position',),('rank','category'),('status','ygxs',),('workday','startday',)]}), + (_('other info'),{'fields':[('hometown','address',),('banknum','bankname',),('email','office',), + ('emergency','literacy',),('religion','marital',),('party','nation',),('spjob','health',), + ('major','degree',),('tag1','tag2',),('tag3','tag4',),('user',),],'classes':['collapse']}), + ] + readonly_fields = ['status','ygxs','rank','category'] + inlines = [FamilyInline,EducationInline,WorkExperienceInline] + raw_id_fields = ['user'] + + def get_queryset(self, request): + if request.user.is_superuser or request.user.has_perm('basedata.view_all_employee'): + return super(EmployeeAdmin,self).get_queryset(request) + else: + return super(EmployeeAdmin,self).get_queryset(request).filter(user=request.user) + + def get_readonly_fields(self, request, obj=None): + if request.user.is_superuser: + return [] + else: + return ['status','ygxs','rank','category','position','user'] + + +class DataImportAdmin(generic.BOAdmin): + list_display = ['imp_date','title','status'] + list_display_links = ['imp_date','title'] + raw_id_fields = ['content_type'] + readonly_fields = ['status'] + extra_buttons = [{'href':'action','title':_('import')}] + + def changeform_view(self, request, object_id=None, form_url='', extra_context=None): + if object_id: + obj = DataImport.objects.get(id=object_id) + if obj.status == '1': + extra_context = extra_context or {} + extra_context.update(dict(readonly=True)) + return super(DataImportAdmin,self).changeform_view(request,object_id,form_url,extra_context) + + +class DocumentForm(models.ModelForm): + title = fields.CharField(widget=TextInput(attrs={"size":"119"}),label=_("title")) + keywords = fields.CharField(widget=TextInput(attrs={"size":"119"}),label=_("keywords")) + + class Meta: + model = Document + fields = '__all__' + + +class DocumentAdmin(generic.BOAdmin): + CODE_PREFIX = 'FD' + CODE_NUMBER_WIDTH = 4 + list_display = ['code','title','keywords','tp','business_domain','status','creation'] + list_display_links = ['code','title'] + fields = (('code','status',),('title',),('keywords',),('description',),('business_domain','tp',),('attach',)) + readonly_fields = ['status'] + list_filter = ['tp','business_domain'] + search_fields = ['title','keywords','code'] + form = DocumentForm + actions = ['publish'] + date_hierarchy = 'begin' + + def get_readonly_fields(self, request, obj=None): + if obj and obj.status=='1': + return ['code','status','title','keywords','description','business_domain','tp','attach',] + else: + return ['status'] + + def publish(self,request,queryset): + import datetime + cnt = queryset.filter(status='0').update(status='1',pub_date=datetime.datetime.now()) + self.message_user(request,u'%s 个文档发布成功'%cnt) + + publish.short_description = _('publish selected %(verbose_name_plural)s') + +# admin.site.register(Address,AddressAdmin) +admin.site.register(ValueList,ValueListAdmin) +admin.site.register(Partner,PartnerAdmin) +admin.site.register(Project,ProjectAdmin) +admin.site.register(Material,MaterialAdmin) +admin.site.register(Warehouse,WarehouseAdmin) +admin.site.register(Brand,BrandAdmin) +admin.site.register(Measure,MeasureAdmin) +admin.site.register(Category,CategoryAdmin) +admin.site.register(TechnicalParameterName,TechParamNameAdmin) +admin.site.register(Trade,TradeAdmin) +admin.site.register(ExpenseAccount,ExpenseAdmin) +admin.site.register(Employee,EmployeeAdmin) +admin.site.register(DataImport,DataImportAdmin) +admin.site.register(Document,DocumentAdmin) \ No newline at end of file diff --git a/basedata/apps.py b/basedata/apps.py new file mode 100644 index 0000000..cbd8dc6 --- /dev/null +++ b/basedata/apps.py @@ -0,0 +1,9 @@ +__author__ = 'zhugl' +# created at 15-4-22 +from django.apps.config import AppConfig +from django.utils.translation import ugettext_lazy as _ + + +class BaseDataConfig(AppConfig): + name = 'basedata' + verbose_name = _('BaseData') \ No newline at end of file diff --git a/basedata/models.py b/basedata/models.py new file mode 100644 index 0000000..68f77f6 --- /dev/null +++ b/basedata/models.py @@ -0,0 +1,657 @@ +# coding=utf-8 +from django.db import models +from django.contrib.auth.models import User +from django.contrib.contenttypes.models import ContentType +from django.contrib.contenttypes.fields import GenericForeignKey +from django.utils.translation import ugettext_lazy as _ +from django.utils.text import force_text +from common import const +from common import generic +from syscfg.models import Module,Site +from organ.models import Organization,Position +import datetime +from plugin.xls import ExcelManager + + +class ValueList(generic.BO): + """ + 值列表 + """ + index_weight = 9 + code = models.CharField(_("list code"),max_length=const.DB_CHAR_CODE_6,blank=True,null=True) + name = models.CharField(_("list name"),max_length=const.DB_CHAR_NAME_40) + module = models.ForeignKey(Module,verbose_name=_("module"),blank=True,null=True) + status = models.BooleanField(_("in use"),default=True) + init = models.BooleanField(_("is init"),default=False) + locked = models.BooleanField(_("is locked"),default=False) + locked_by = models.ForeignKey(User,verbose_name=_("locked by"),blank=True,null=True) + lock_time = models.DateTimeField(_("locked time"),null=True,blank=True) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + super(ValueList,self).save(force_insert,force_update,using,update_fields) + sql = 'update basedata_valuelistitem set group_code = %s where groud_id=%s' + params = [self.code,self.id] + generic.update(sql,params) + + class Meta: + verbose_name = _('value list') + verbose_name_plural = _('value list') + + +class ValueListItem(models.Model): + """ + 值列表项 + """ + group = models.ForeignKey(ValueList,verbose_name=_("list group")) + group_code = models.CharField(max_length=const.DB_CHAR_CODE_6,blank=True,null=True) + code = models.CharField(_("item code"),max_length=const.DB_CHAR_CODE_6,blank=True,null=True) + name = models.CharField(_("item name"),max_length=const.DB_CHAR_NAME_40) + status = models.BooleanField(_("in use"),default=True) + weight = models.IntegerField(_("weight"),null=True,default=9) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + if not self.code: + cnt = self.group.valuelistitem_set.count()+1 + self.code = "%02d" % cnt + self.group_code = self.group.code + super(ValueListItem,self).save(force_insert,force_update,using,update_fields) + + def __unicode__(self): + return "%s-%s" % (self.code,self.name) + + class Meta: + verbose_name = _('list item') + verbose_name_plural = _('list item') + ordering = ['weight','code'] + index_together = ['group','group_code'] + + +def get_value_list(group): + """ + + :param group: + :return: + """ + if group: + return tuple([(item.code, item.name) for item in ValueListItem.objects.filter(group_code__exact=group,status=1)]) + else: + return None + + +class Address(generic.BO): + """ + 地址 + """ + ADDRESS_TYPE = get_value_list('S011') + address_type = models.CharField(_("address type"),max_length=const.DB_CHAR_CODE_2,choices=ADDRESS_TYPE,default='01') + address = models.CharField(_("address"),max_length=const.DB_CHAR_NAME_120) + zipcode = models.CharField(_("zipcode"),max_length=const.DB_CHAR_CODE_8,blank=True,null=True) + phone = models.CharField(_("phone"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + contacts = models.CharField(_("contacts"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + + content_type = models.ForeignKey(ContentType,blank=True,null=True) + object_id = models.PositiveIntegerField(blank=True,null=True) + content_object = GenericForeignKey('content_type', 'object_id') + + class Meta: + verbose_name = _('address') + verbose_name_plural = _('address') + + +class Partner(generic.BO): + """ + 合作伙伴 + """ + index_weight = 3 + PARTNER_TYPE = ( + ('C', _('Customer')), + ('S', _('Supplier')), + ) + + LEVEL = ( + ('A','A'), + ('B','B'), + ('C','C'), + ('D','D'), + ) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + code = models.CharField(_("partner code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + name = models.CharField(_("partner name"),max_length=const.DB_CHAR_NAME_120) + short = models.CharField(_("short name"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + pinyin = models.CharField(_("pinyin"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + partner_type = models.CharField(_("type"),max_length=const.DB_CHAR_CODE_2,choices=PARTNER_TYPE,default='C') + level = models.CharField(_("level"),max_length=const.DB_CHAR_CODE_2,choices=LEVEL,default='C') + + tax_num = models.CharField(_("tax num"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + tax_address = models.CharField(_("tax address"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + tax_account = models.CharField(_("tax account"),max_length=const.DB_CHAR_NAME_80,blank=True,null=True) + + contacts = models.CharField(_("contacts"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + phone = models.CharField(_("phone"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + memo = models.TextField(_("memo"),blank=True,null=True) + + class Meta: + verbose_name = _('partner') + verbose_name_plural = _('partner') + permissions = ( + ('view_all_customer',_("view all customer")), + ('view_all_supplier',_("view all supplier")), + ) + + +class BankAccount(generic.BO): + """ + 银行账户 organization + """ + account = models.CharField(_("account num"),max_length=const.DB_CHAR_NAME_40) + title = models.CharField(_("bank name"),max_length=const.DB_CHAR_NAME_40) + memo = models.CharField(_("memo"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + partner = models.ForeignKey(Partner,verbose_name=_("partner"),blank=True,null=True) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + + def __unicode__(self): + name = '' + if self.org: + name = self.org.name + elif self.partner: + name = self.partner.name + return u"%s %s %s" % (name,self.account,self.title) + + class Meta: + verbose_name = _('bank account') + verbose_name_plural = _('bank account') + + +class Project(generic.BO): + """ + 工程项目 + """ + STATUS = get_value_list('S012') + TYPES = get_value_list('S013') + index_weight = 1 + + code = models.CharField(_("project code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + name = models.CharField(_("project name"),max_length=const.DB_CHAR_NAME_120) + short = models.CharField(_("short name"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + pinyin = models.CharField(_("pinyin"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + + partner = models.ForeignKey(Partner,blank=True,null=True,verbose_name=_("partner"),limit_choices_to={"partner_type":"C"}) + status = models.CharField(_("status"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,default='00',choices=STATUS) + prj_type = models.CharField(_("project type"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=TYPES,default='00') + + description = models.TextField(_("description"),blank=True,null=True) + + budget = models.DecimalField(_("budget"),max_digits=10,decimal_places=2,blank=True,null=True) + income = models.DecimalField(_("income"),max_digits=10,decimal_places=2,blank=True,null=True) + expand = models.DecimalField(_("expand"),max_digits=10,decimal_places=2,blank=True,null=True) + + blueprint = models.FileField(_("blueprint"),upload_to='project',blank=True,null=True) + offer = models.FileField(_("offer sheet"),upload_to='offer sheet',blank=True,null=True) + business = models.FileField(_("business document"),upload_to='project',blank=True,null=True) + + users = models.ManyToManyField(User,verbose_name=_("related users"),blank=True) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + + class Meta: + verbose_name = _('project') + verbose_name_plural = _('project') + + +class Warehouse(models.Model): + """ + 仓库 + """ + index_weight = 6 + code = models.CharField(_("code"),max_length=const.DB_CHAR_CODE_6,blank=True,null=True) + name = models.CharField(_("name"),max_length=const.DB_CHAR_NAME_40) + status = models.BooleanField(_("in use"),default=True) + location = models.CharField(_("location"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + users = models.ManyToManyField(User,verbose_name=_("related users"),blank=True) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + + def __unicode__(self): + return '%s' % self.name + + class Meta: + verbose_name = _('warehouse') + verbose_name_plural = _('warehouse') + + +class Measure(models.Model): + """ + 计量单位 + """ + index_weight = 5 + code = models.CharField(_("code"),max_length=const.DB_CHAR_CODE_6,blank=True,null=True) + name = models.CharField(_("name"),max_length=const.DB_CHAR_NAME_20) + status = models.BooleanField(_("in use"),default=True) + + def __unicode__(self): + return '%s' % self.name + + class Meta: + verbose_name = _('measure') + verbose_name_plural = _('measure') + + +class Trade(models.Model): + """ + 国民经济行业分类 + """ + index_weight = 102 + code = models.CharField(_("code"),max_length=const.DB_CHAR_CODE_6) + name = models.CharField(_("name"),max_length=const.DB_CHAR_NAME_120) + memo = models.CharField(_("memo"),max_length=const.DB_CHAR_NAME_120,null=True,blank=True) + parent = models.ForeignKey('self',verbose_name=_("parent"),null=True,blank=True) + + def __unicode__(self): + return '%s' % self.name + + class Meta: + verbose_name = _('trade') + verbose_name_plural = _('trade') + ordering = ['code'] + + +class Brand(models.Model): + """ + 品牌 + """ + index_weight = 101 + trade = models.ForeignKey(Trade,verbose_name=_("trade"),null=True,blank=True) + name = models.CharField(_("name"),max_length=const.DB_CHAR_NAME_120) + pinyin = models.CharField(_("pinyin"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + weight = models.IntegerField(_("weight"),blank=True,null=True,default=99) + + def __unicode__(self): + return '%s' % self.name + + class Meta: + verbose_name = _('brand') + verbose_name_plural = _('brand') + + +class Category(models.Model): + """ + 分类 + """ + index_weight = 100 + trade = models.ForeignKey(Trade,verbose_name=_("trade"),null=True,blank=True) + parent = models.ForeignKey('self',verbose_name=_("parent"),null=True,blank=True) + code = models.CharField(_("code"),max_length=const.DB_CHAR_CODE_6,null=True,blank=True) + name = models.CharField(_("name"),max_length=const.DB_CHAR_NAME_120) + path = models.CharField(_("path"),max_length=const.DB_CHAR_NAME_200,null=True,blank=True) + + def __unicode__(self): + return '%s' % self.name + + class Meta: + verbose_name = _('category') + verbose_name_plural = _('category') + + +class TechnicalParameterName(models.Model): + """ + 技术参数-名称,将技术参数绑定于物料分类上,在此分类下的物料自动继承全部技术参数 + """ + index_weight = 7 + category = models.ForeignKey(Category,verbose_name=_("material category")) + name = models.CharField(_("name"),max_length=const.DB_CHAR_NAME_40) + status = models.BooleanField(_("in use"),default=True) + + def __unicode__(self): + return '%s' % self.name + + class Meta: + verbose_name = _('technical parameter') + verbose_name_plural = _('technical parameter') + + +class TechnicalParameterValue(models.Model): + """ + 技术参数-值,将技术参数绑定于物料分类上,在此分类下的物料自动继承全部技术参数 + """ + tech_name = models.ForeignKey(TechnicalParameterName,verbose_name=_("technical name")) + value = models.CharField(_("value"),max_length=const.DB_CHAR_NAME_80) + description = models.CharField(_("description"),max_length=const.DB_CHAR_NAME_80,null=True,blank=True) + + def __unicode__(self): + return '%s' % self.value + + class Meta: + verbose_name = _('technical value') + verbose_name_plural = _('technical value') + + +class Material(generic.BO): + """ + 物料 + """ + index_weight = 4 + code = models.CharField(_("material code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + barcode = models.CharField(_("bar code"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + name = models.CharField(_("material name"),max_length=const.DB_CHAR_NAME_120) + spec = models.CharField(_("specifications"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + pinyin = models.CharField(_("pinyin"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + brand = models.ForeignKey(Brand,blank=True,null=True,verbose_name=_("brand")) + category = models.ForeignKey(Category,blank=True,null=True,verbose_name=_("category")) + tp = models.CharField(_('mt type'),blank=True,null=True,max_length=const.DB_CHAR_CODE_2,choices=const.get_value_list('S054'),default='10') + status = models.BooleanField(_("in use"),default=True) + is_equip = models.BooleanField(_("is equipment"),default=False) + can_sale = models.BooleanField(_("can sale"),default=True) + is_virtual = models.BooleanField(_("is virtual"),default=False) + + warehouse = models.ForeignKey(Warehouse,blank=True,null=True,verbose_name=_("warehouse")) + measure = models.ManyToManyField(Measure,verbose_name=_("measure")) + + params = models.ManyToManyField(TechnicalParameterValue,verbose_name=_("technical parameter"),through='MaterialParam') + + stock_price = models.DecimalField(_("stock price"),max_digits=14,decimal_places=4,blank=True,null=True) + purchase_price = models.DecimalField(_("purchase price"),max_digits=14,decimal_places=4,blank=True,null=True) + sale_price = models.DecimalField(_("sale price"),max_digits=14,decimal_places=4,blank=True,null=True) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + + def __unicode__(self): + + return "%s %s" % (self.code,self.name) + + class Meta: + verbose_name = _('material') + verbose_name_plural = _('material') + ordering = ['tp','code'] + + +class MaterialParam(models.Model): + """ + + """ + material = models.ForeignKey(Material) + param_value = models.ForeignKey(TechnicalParameterValue) + param_name = models.ForeignKey(TechnicalParameterName,blank=Trade,null=True) + creation = models.DateField(auto_now_add=True) + + def __unicode__(self): + return '%s' % self.param_value + + class Meta: + verbose_name = _('material parameter') + verbose_name_plural = _('material parameter') + + +class ExtraParam(models.Model): + """ + + """ + DATA_TYPE = ( + ('CHAR',_('CHAR')), + ('NUM',_('NUMBER')), + ('DATE',_('DATE')), + ) + material = models.ForeignKey(Material,verbose_name=_("material")) + name = models.CharField(_("name"),max_length=const.DB_CHAR_NAME_40) + data_type = models.CharField(_("data type"),default='CHAR',choices=DATA_TYPE,max_length=const.DB_CHAR_CODE_6) + data_source = models.CharField(_("data source"),blank=True,null=True,max_length=const.DB_CHAR_NAME_40) + + def __unicode__(self): + return "%s" % self.name + + class Meta: + verbose_name = _("extra param") + verbose_name_plural = _("extra params") + + +class ExpenseAccount(generic.BO): + """ + 费用科目 + """ + CATEGORY = ( + ('HR',_('HR-DOMAIN')), + ('OF',_('OFFICE-DOMAIN')), + ('PU',_('PUBLIS-DOMAIN')), + ('MU',_('MUNADOMAIN')), + ('BU',_('BUSINESS')), + ('OT',_('OTHER')), + ) + index_weight = 10 + code = models.CharField(_("code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + name = models.CharField(_("name"),max_length=const.DB_CHAR_NAME_120) + category = models.CharField(_("category"),max_length=const.DB_CHAR_CODE_4,choices=CATEGORY,default='PU') + description = models.TextField(_("description"),blank=True,null=True) + parent = models.ForeignKey('self',verbose_name=_("parent"),null=True,blank=True) + status = models.BooleanField(_("in use"),default=True) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + + class Meta: + verbose_name = _('expenses account') + verbose_name_plural = _('expenses account') + ordering = ['category','code'] + + +class Employee(generic.BO): + """ + 职员信息 + """ + index_weight = 2 + code = models.CharField(_("employee number"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + phone = models.CharField(_("phone"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + organization = models.ForeignKey(Organization,verbose_name = _('organization'),null=True,blank=True) + name = models.CharField(_("employee name"),max_length=const.DB_CHAR_NAME_120) + pinyin = models.CharField(_("pinyin"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + birthday = models.DateField(_("birthday"),blank=True,null=True) + + gender = models.CharField(_("gender"),max_length=const.DB_CHAR_CODE_2,choices=const.get_value_list('gender'),default='1') + idcard = models.CharField(_("id card"),max_length=const.DB_CHAR_NAME_20) + + country = models.CharField(_("nationality"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,default='CN',choices=const.get_value_list('S022')) + hometown = models.CharField(_("hometown"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + address = models.CharField(_("home address"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + banknum = models.CharField(_("bank account"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + bankname = models.CharField(_("bank name"),max_length=const.DB_CHAR_NAME_80,blank=True,null=True) + emergency = models.CharField(_("emergency contacts"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + email = models.CharField(_("email"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + office = models.CharField(_("office phone"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + + position = models.ForeignKey(Position,verbose_name = _('position')) + rank = models.CharField(_("employee rank"),max_length=const.DB_CHAR_CODE_2,default='00',choices=const.get_value_list('S017')) + + workday = models.DateField(_("workday"),blank=True,null=True) + startday = models.DateField(_("start date"),blank=True,null=True) + + religion = models.CharField(_("religion"),max_length=const.DB_CHAR_CODE_2,default='00',choices=const.get_value_list('S020'),blank=True,null=True,) + marital = models.CharField(_("marital status"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S023'),default='10') + + party = models.CharField(_("political party"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S026'),default='13') + nation = models.CharField(_("nation"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S021'),default='01') + + ygxs = models.CharField(_("employ ygxs"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S019'),default='2') + status = models.CharField(_("employ status"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S016'),default='10') + category = models.CharField(_("employ category"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S018'),default='21') + + literacy = models.CharField(_("literacy"),max_length=const.DB_CHAR_CODE_2,default='10',choices=const.get_value_list('S024'),blank=True,null=True) + major = models.CharField(_("major type"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S038'),default='99') + degree = models.CharField(_("major degree"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S037'),default='4') + + spjob = models.CharField(_("special job"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S042'),default='00') + health = models.CharField(_("health"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S043'),default='1') + + tag1 = models.CharField(_("tag1 fzjr"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S039'),default='99') + tag2 = models.CharField(_("tag2 dwld"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S040'),default='9') + tag3 = models.CharField(_("tag3 dsjs"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S041'),default='00') + tag4 = models.CharField(_("tag4 byzk"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S027'),default='0') + + user = models.ForeignKey(User,verbose_name=_("user"),blank=True,null=True) + + def age(self): + import datetime + if self.birthday: + cnt = datetime.date.today().year-self.birthday.year + return cnt + + def work_age(self): + import datetime + if self.birthday and self.workday: + cnt = datetime.date.today().year-self.workday.year + return cnt + + def __unicode__(self): + return u'%s %s'%(self.code,self.name) + + age.short_description = u'年龄' + work_age.short_description = u'工龄' + + class Meta: + verbose_name = _("employee") + verbose_name_plural = _("employee") + permissions = ( + ('view_all_employee',_("view all employee")), + ) + + +class Family(generic.BO): + """ + 家庭成员 + """ + relation = models.CharField(_("family title"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S025')) + status = models.CharField(_("social status"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S029'),default='17') + name = models.CharField(_("name"),max_length=const.DB_CHAR_NAME_60) + birthday = models.DateField(_("birthday"),blank=True,null=True) + organization = models.CharField(_("organization"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + phone = models.CharField(_("phone"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + emergency = models.BooleanField(_("emergency"),default=False) + employee = models.ForeignKey(Employee,verbose_name=_("employee")) + + class Meta: + verbose_name = _("family member") + verbose_name_plural = _("family member") + + +class Education(generic.BO): + """ + 教育履历 + """ + edu_type = models.CharField(_("edu type"),max_length=const.DB_CHAR_CODE_2,choices=const.get_value_list('S035'),default='1') + school = models.CharField(_("school"),max_length=const.DB_CHAR_NAME_120) + major = models.CharField(_("major"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + degree = models.CharField(_("major degree"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S037'),default='4') + employee = models.ForeignKey(Employee,verbose_name=_("employee")) + + class Meta: + verbose_name = _("education experience") + verbose_name_plural = _("education experience") + + +class WorkExperience(generic.BO): + """ + 工作履历 + """ + organization = models.CharField(_("organization"),max_length=const.DB_CHAR_NAME_120) + position = models.CharField(_("position"),max_length=const.DB_CHAR_NAME_120) + employee = models.ForeignKey(Employee,verbose_name=_("employee")) + + class Meta: + verbose_name = _("work experience") + verbose_name_plural = _("work experience") + + +class DataImport(generic.BO): + + """ + Data import + """ + actions = {} + + STATUS = ( + ('0',_('NEW')), + ('1',_('EXECUTED')), + ) + imp_date = models.DateField(_('date'),blank=True,null=True,default=datetime.datetime.today) + title = models.CharField(_('title'),max_length=const.DB_CHAR_NAME_40) + description = models.TextField(_('description'),blank=True,null=True) + content_type = models.ForeignKey(ContentType,verbose_name=_("content type"),limit_choices_to={"app_label__in":['basedata','organ','auth']}) + attach = models.FileField(_('attach'),blank=True,null=True,upload_to='data') + is_clear = models.BooleanField(_('clear old data?'),default=0) + handler = models.CharField(_('handler class'),max_length=const.DB_CHAR_NAME_80,blank=True,null=True) + status = models.CharField(_('status'),max_length=const.DB_CHAR_CODE_2,default='0',choices=STATUS) + + def action_import(self,request): + from django.db import transaction + if self.attach: + if self.handler: + klass = ExcelManager().handlers.get(self.handler) + with transaction.atomic(): + klass.handle(self,self.attach) + self.status = 1 + self.save() + else: + import xlrd + import os + from mis import settings + path = os.path.join(settings.MEDIA_ROOT,self.attach.name) + workbook = xlrd.open_workbook(path) + sheet = workbook.sheet_by_index(0) + row_count = sheet.nrows + col_count = sheet.ncols + cols = [] + with transaction.atomic(): + for row_index in range(row_count): + line = sheet.row_values(row_index) + if row_index == 0: + cols = line + continue + elif row_index == 1: + continue + else: + klass = self.content_type.model_class() + values = line + params = {} + for name in cols: + index = cols.index(name) + v = values[index] + if type(v) == str: + v = force_text(v.decode('gbk')) + params[name]=v + # print 'name is %s value is %s'%(name,v) + try: + params.pop('') + except Exception,e: + pass + # print params + klass.objects.create(**params) + self.status = '1' + self.save() + + class Meta: + verbose_name = _("data import") + verbose_name_plural = _("data import") + + +class Document(generic.BO): + """ + 文档管理 + """ + TP = ( + ('00',_('SYSTEM MANUAL')), + ('10',_('BUSINESS DOC')), + ) + STATUS = ( + ('0',_('draft')), + ('1',_('published')) + ) + index_weight = 8 + code = models.CharField(_('code'),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + title = models.CharField(_('title'),max_length=const.DB_CHAR_NAME_120) + keywords = models.CharField(_('keywords'),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + description = models.TextField(_('description'),blank=True,null=True) + tp = models.CharField(_('type'),max_length=const.DB_CHAR_CODE_2,default='10',choices=TP) + business_domain = models.CharField(_("business domain"),max_length=const.DB_CHAR_CODE_4,choices=const.get_value_list('S045'),default='OT') + user = models.ForeignKey(User,verbose_name=_('user'),blank=True,null=True) + status = models.CharField(_('status'),max_length=const.DB_CHAR_CODE_2,default='0',choices=STATUS) + pub_date = models.DateTimeField(_('publish date'),blank=True,null=True) + size = models.CharField(_('size'),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + attach = models.FileField(_('attach'),blank=True,null=True,upload_to='doc') + + class Meta: + verbose_name = _("document") + verbose_name_plural = _("documents") diff --git a/basedata/tests.py b/basedata/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/basedata/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/basedata/urls.py b/basedata/urls.py new file mode 100644 index 0000000..5a59f9f --- /dev/null +++ b/basedata/urls.py @@ -0,0 +1,6 @@ +from django.conf.urls import include, url,static +import basedata.views + +urlpatterns = [ + url(r"dataimport/(?P\d+)/action", basedata.views.action_import), +] diff --git a/basedata/views.py b/basedata/views.py new file mode 100644 index 0000000..744b316 --- /dev/null +++ b/basedata/views.py @@ -0,0 +1,42 @@ +# coding=utf-8 +from django.contrib.admin import site +from django.http.response import HttpResponseRedirect +from django.utils.encoding import force_text +from django.template.response import TemplateResponse +from django.contrib import messages +from basedata.models import DataImport +from django.utils.translation import ugettext_lazy as _ + + +def action_import(request,object_id): + """ + 数据导入操作 + :param request: + :param object_id: + :return: + """ + title = _("Are you sure?") + obj = DataImport.objects.get(id=int(object_id)) + opts = obj._meta + objects_name = force_text(opts.verbose_name) + + if request.POST.get("post"): + obj.action_import(request) + try: + + messages.success(request,_('data import successfully')) + except Exception,e: + messages.error(request,e) + + return HttpResponseRedirect("/admin/basedata/dataimport/%s"%(object_id)) + + context = dict( + site.each_context(request), + title=title, + opts=opts, + objects_name=objects_name, + object=obj, + ) + request.current_app = site.name + + return TemplateResponse(request,'admin/invent/stockin/in_confirmation.html', context) diff --git a/common/__init__.py b/common/__init__.py new file mode 100644 index 0000000..db0afd1 --- /dev/null +++ b/common/__init__.py @@ -0,0 +1 @@ +__author__ = 'Administrator' diff --git a/common/const.py b/common/const.py new file mode 100644 index 0000000..cb30663 --- /dev/null +++ b/common/const.py @@ -0,0 +1,39 @@ +# coding=utf-8 +from django.db import connection +from django.utils.translation import ugettext_lazy as _ +__author__ = 'zhugl' + +DB_CHAR_CODE_2 = 2 +DB_CHAR_CODE_4 = 4 +DB_CHAR_CODE_6 = 6 +DB_CHAR_CODE_8 = 8 +DB_CHAR_CODE_10 = 10 + +DB_CHAR_NAME_20 = 20 +DB_CHAR_NAME_40 = 40 +DB_CHAR_NAME_60 = 60 +DB_CHAR_NAME_80 = 80 +DB_CHAR_NAME_120 = 120 +DB_CHAR_NAME_200 = 200 + + +STATUS_ON_OFF = ( + (0,_('OFF')), + (0,_('ON')), +) + + +def get_value_list(group): + """ + 获取值列表信息 + """ + if group: + try: + cursor = connection.cursor() + cursor.execute('SELECT code,name FROM basedata_valuelistitem WHERE group_code=%s AND status=1',[group]) + rows = cursor.fetchall() + return tuple([(code,name) for code,name in rows]) + except Exception,e: + return None + else: + return None diff --git a/common/generic.py b/common/generic.py new file mode 100644 index 0000000..50a4e03 --- /dev/null +++ b/common/generic.py @@ -0,0 +1,312 @@ +# coding=utf-8 +__author__ = 'zhugl' +# created at 15-4-21 +import datetime +import xlwt +import re +from django.db import models +from django.db import connection,transaction +from django.db.models import fields +from django.db.models.fields import related +from django.contrib import admin +from django.http import HttpRequest,HttpResponseRedirect,HttpResponse +from django.contrib.contenttypes.models import ContentType +from django.utils.text import force_text +from django.utils.encoding import smart_str +from django.utils.http import urlquote +from django.utils.translation import ugettext_lazy as _ +from common import const +from midware import cuser + + +def update(sql, params=None): + """ + :param sql: + :param params: + :return: + """ + cursor = connection.cursor() + with transaction.atomic(): + try: + if params: + cursor.execute(sql,params) + else: + cursor.execute(sql) + except Exception,e: + print e + +def get_app_model_info_from_request(request): + """ + + """ + if request and isinstance(request,HttpRequest): + import re + pattern = re.compile(r"/(admin)/(\w+)/(\w+)/(\d+)") + match = pattern.match(request.path) + + if match and match.group(): + app = match.group(2) + model = match.group(3) + oid = match.group(4) + ct = ContentType.objects.get(app_label=app,model=model) + obj = ct.get_object_for_this_type(id=oid) + return {'app':app,'model':model,'id':oid,'obj':obj} + return None + + +class MineBOManager(models.Manager): + """ + get the objects created by current login user + """ + def get_query_set(self): + return super(MineBOManager,self).get_query_set().filter(creator=cuser.getuser()) + + +class BOManager(models.Manager): + """ + """ + def get_query_set(self): + return super(BOManager,self).get_query_set() + + +class BO(models.Model): + """ + All business object derive from this class + """ + begin = models.DateField(_('begin date'),blank=True,null=True) + end = models.DateField(_('end date'),blank=True,null=True) + creator = models.CharField(_("creator"),blank=True,null=True,max_length=const.DB_CHAR_NAME_20) + modifier = models.CharField(_("modifier"),blank=True,null=True,max_length=const.DB_CHAR_NAME_20) + creation = models.DateTimeField(_('creation'),auto_now_add=True,blank=True,null=True) + modification = models.DateTimeField(_('modification'),auto_now=True,blank=True,null=True) + # mine = MineBOManager() + objects = models.Manager() + + def __unicode__(self): + display = getattr(self,'name',None) or getattr(self,'title',None) or getattr(self,'description',None) + if not display: + display = ' ' + return u'%s' % display + + class Meta: + abstract = True + + +class BOAdmin(admin.ModelAdmin): + """ + All business object admin derive from this class + """ + CODE_NUMBER_WIDTH = 4 + CODE_PREFIX = '9' + extra_buttons = [] + + exclude = ['creator','modifier','creation','modification','begin','end'] + list_per_page = 18 + actions = ['export_selected_data'] + + def changeform_view(self, request, object_id=None, form_url='', extra_context=None): + """ + + :param request: + :param object_id: + :param form_url: + :param extra_context: + :return: + """ + app_info = get_app_model_info_from_request(request) + workflow_modal = None + workflow_instance = None + has_workflow_modal = False + has_workflow_instance = False + show_workflow_line = False + show_submit_button = False + can_restart = False + can_edit = False + # print app_info + if app_info: + try: + modal = ContentType.objects.get(app_label='workflow',model='modal') + workflow_modal = modal.get_object_for_this_type(app_name=app_info['app'],model_name=app_info['model']) + has_workflow_modal = True + # print workflow_modal.code + instance = ContentType.objects.get(app_label='workflow',model='instance') + workflow_instance = instance.get_object_for_this_type(modal=workflow_modal,object_id=app_info['id']) + has_workflow_instance = True + todo = ContentType.objects.get(app_label='workflow',model='todolist') + todo_list = todo.model_class().objects.filter(inst=workflow_instance,status=0,user=request.user) + x = todo_list.all() + + if x and len(x)>0: + can_edit = x[0].node.can_edit + if todo_list.count() > 0: + # print 'we fount it' + unread = todo_list.filter(is_read=0) + show_workflow_line = True + if unread.count() > 0: + unread.update(is_read=1,read_time=datetime.datetime.now()) + if workflow_instance.status == 3 and request.user == workflow_instance.starter: + can_restart = True + show_workflow_line = True + + except Exception,e: + print Exception,e + + if workflow_modal and not workflow_instance: + show_submit_button = True + extra_context = extra_context or {} + ctx = dict( + has_workflow_instance = has_workflow_instance, + has_workflow_modal = has_workflow_modal, + workflow_modal = workflow_modal, + workflow_instance = workflow_instance, + show_workflow_line = show_workflow_line, + can_restart = can_restart, + can_edit = can_edit, + show_submit_button = show_submit_button, + ) + if len(self.extra_buttons) > 0: + buttons = dict( + extra_buttons = self.extra_buttons + ) + ctx.update(buttons) + extra_context.update(ctx) + # print extra_context + return super(BOAdmin,self).changeform_view(request,object_id,form_url,extra_context) + + def history_view(self, request, object_id, extra_context=None): + """ + + :param request: + :param object_id: + :param extra_context: + :return: + """ + app_info = get_app_model_info_from_request(request) + # print app_info + if app_info: + try: + modal = ContentType.objects.get(app_label='workflow',model='modal') + workflow_modal = modal.get_object_for_this_type(app_name=app_info['app'],model_name=app_info['model']) + has_workflow_modal = True + instance = ContentType.objects.get(app_label='workflow',model='instance') + workflow_instance = instance.get_object_for_this_type(modal=workflow_modal,object_id=app_info['id']) + has_workflow_instance = True + history = ContentType.objects.get(app_label='workflow',model='history') + history_list = history.model_class().objects.filter(inst=workflow_instance) + has_history = True + todo = ContentType.objects.get(app_label='workflow',model='todolist') + todo_list = todo.model_class().objects.filter(inst=workflow_instance,status=0).exclude(node=None) + + extra_context = extra_context or {} + ctx = dict( + has_workflow_instance = has_workflow_instance, + has_workflow_modal = has_workflow_modal, + workflow_modal = workflow_modal, + workflow_instance = workflow_instance, + history_list = history_list, + has_history = has_history, + todo_list = todo_list, + ) + # print history_list + extra_context.update(ctx) + except Exception,e: + print Exception,e + pass + return super(BOAdmin,self).history_view(request,object_id,extra_context) + + def get_changeform_initial_data(self, request): + import datetime + return {'begin':datetime.date.today,'end':datetime.date(9999,12,31)} + + def save_model(self, request, obj, form, change): + + if change: + setattr(obj,'modifier',request.user.username) + else: + setattr(obj,'creator',request.user.username) + setattr(obj,'begin',datetime.date.today()) + setattr(obj,'end',datetime.date(9999,12,31)) + try: + setattr(obj,'user',request.user) + except Exception,e: + pass + + super(BOAdmin,self).save_model(request,obj,form,change) + # print '=========it is here=========' + try: + code = getattr(obj,'code') + # print code + if code is None or len(code) == 0: + fmt = '%s%0'+str(self.CODE_NUMBER_WIDTH)+'d' + code = fmt % (self.CODE_PREFIX,obj.id) + table = obj._meta.db_table + sql = 'update %s set code = \'%s\' where id=%s' % (table,code,obj.id) + print sql + update(sql) + except Exception,e: + print e + + # def response_change(self, request, obj): + # return HttpResponseRedirect('') + + def export_selected_data(self,request,queryset): + ops = self.model._meta + workbook = xlwt.Workbook(encoding='utf-8') + dd = datetime.date.today().strftime('%Y%m%d') + file_name = force_text(ops.verbose_name+dd) + sheet = workbook.add_sheet(force_text(ops.verbose_name)) + obj_fields = getattr(self,'export_fields',None) or self.list_display or self.fields + + head_col_index = 0 + for field in obj_fields: + col_name = field + try: + f = ops.get_field(field) + col_name = f.verbose_name + except Exception,e: + f = getattr(self.model,field) + if hasattr(f,'short_description'): + col_name = f.short_description + sheet.write(0,head_col_index,force_text(col_name)) + head_col_index+=1 + row_index = 1 + for obj in queryset: + col_index = 0 + for field in obj_fields: + f = field + try: + f = ops.get_field(field) + except Exception,e: + pass + v = getattr(obj,field,'') + if hasattr(v,'__call__') or callable(v): + v = v() + elif type(f) == fields.DateField: + v = v.strftime('%Y-%m-%d') + elif type(f) == fields.DateTimeField: + v = v.strftime('%Y-%m-%d %H:%M') + elif type(f) == fields.CharField and f.choices: + fc = 'get_'+field+'_display' + v = getattr(obj,fc)() + elif type(f) == related.ForeignKey: + v = str(v) + sheet.write(row_index,col_index,v) + col_index += 1 + row_index += 1 + response = HttpResponse(content_type='application/vnd.ms-excel') + agent = request.META.get('HTTP_USER_AGENT') + nn = smart_str(file_name) + if agent and re.search('MSIE',agent): + nn = urlquote(file_name) + response['Content-Disposition'] = 'attachment; filename=%s.xls'%nn + workbook.save(response) + return response + #self.message_user(request,'SUCCESS') + export_selected_data.short_description = _("export selected %(verbose_name_plural)s") + + class Meta: + ordering = ['-creation'] + + class Media: + css = {'all':('css/maximus.css',)} + js = ('js/maximus.js',) diff --git a/docker-compose.full.yml b/docker-compose.full.yml new file mode 100644 index 0000000..fd2665a --- /dev/null +++ b/docker-compose.full.yml @@ -0,0 +1,30 @@ +version: '3' + +services: + web: + build: . + volumes: + - .:/app + ports: + - "6010:8000" + depends_on: + - db + environment: + - DATABASE_HOST=db + - DATABASE_NAME=mis + - DATABASE_USER=root + - DATABASE_PASSWORD=root + + db: + image: mysql:5.7 + command: --default-authentication-plugin=mysql_native_password + volumes: + - mysql_data:/var/lib/mysql + - ./Install/SQL:/docker-entrypoint-initdb.d + environment: + - MYSQL_DATABASE=mis + - MYSQL_ROOT_PASSWORD=root + - MYSQL_PASSWORD=root + +volumes: + mysql_data: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4378f71 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +version: '3' + +services: + web: + build: . + volumes: + - .:/app + ports: + - "6010:8000" + depends_on: + - db + environment: + - DATABASE_HOST=db + - DATABASE_NAME=mis + - DATABASE_USER=root + - DATABASE_PASSWORD=root + + db: + image: mysql:5.7 + command: --default-authentication-plugin=mysql_native_password + volumes: + - mysql_data:/var/lib/mysql + - ./Install/SQL:/docker-entrypoint-initdb.d + environment: + - MYSQL_DATABASE=mis + - MYSQL_ROOT_PASSWORD=root + - MYSQL_PASSWORD=root + ports: + - "6011:3306" + +volumes: + mysql_data: diff --git a/hr/__init__.py b/hr/__init__.py new file mode 100644 index 0000000..9d3c63a --- /dev/null +++ b/hr/__init__.py @@ -0,0 +1 @@ +default_app_config = 'hr.apps.MyAppConfig' \ No newline at end of file diff --git a/hr/admin.py b/hr/admin.py new file mode 100644 index 0000000..af662e2 --- /dev/null +++ b/hr/admin.py @@ -0,0 +1,47 @@ +# coding = utf-8 +from django.contrib import admin +from django.utils.translation import ugettext_lazy as _ +from common import generic +from common import const +from hr.models import Entry,SalaryItem,EmployeeSalaryItem + + +class SalaryItemAdmin(admin.ModelAdmin): + list_display = ['code','classification','name','plus_or_minus','required'] + list_display_links = ['code','name'] + list_per_page = 20 + + +class EmployeeSalaryItemInline(admin.TabularInline): + model = EmployeeSalaryItem + exclude = ['employee'] + + def formfield_for_foreignkey(self, db_field, request=None, **kwargs): + if db_field.name == 'salary_item': + kwargs['queryset'] = SalaryItem.objects.filter(required=1) + + return super(EmployeeSalaryItemInline,self).formfield_for_foreignkey(db_field,request,**kwargs) + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 3 + + +class EntryAdmin(generic.BOAdmin): + list_display = ['code','name','gender','position','rank','probation_months','probation_end'] + inlines = [EmployeeSalaryItemInline] + fieldsets = [ + (None,{'fields':[('code','position',),('name','pinyin',),('address','zipcode',),('idcard','phone',),('memo',),('profile',)]}), + (_('org distribute'),{'fields':[('guider',),('rank','ygxs',),('category','probation_months',),('probation_begin','probation_end',)],'classes': ['collapse']}) + ] + raw_id_fields = ['position','guider'] + def get_changeform_initial_data(self, request): + import datetime + end = datetime.date.today()+datetime.timedelta(90) + return {'probation_end':end} + + +admin.site.register(SalaryItem,SalaryItemAdmin) +admin.site.register(Entry,EntryAdmin) \ No newline at end of file diff --git a/hr/apps.py b/hr/apps.py new file mode 100644 index 0000000..5325f71 --- /dev/null +++ b/hr/apps.py @@ -0,0 +1,11 @@ +# created at 15-5-23 +# coding=utf-8 +__author__ = 'zhugl' + +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + + +class MyAppConfig(AppConfig): + name = 'hr' + verbose_name = _("human resource") diff --git a/hr/models.py b/hr/models.py new file mode 100644 index 0000000..3582a05 --- /dev/null +++ b/hr/models.py @@ -0,0 +1,125 @@ +# coding=utf-8 +from django.db import models +from django.contrib.auth.models import User +from django.utils.translation import ugettext_lazy as _ +from common import generic +from common import const +from basedata.models import Position,Employee +from organ.models import OrgUnit +import datetime + + +class SalaryItemHandler: + code = None + + def __init__(self,employee): + self.employee = employee + + def value(self): + return 0 + + +class SalaryItem(models.Model): + """ + 工资项 + """ + formulas = {} + + @classmethod + def add_formula(cls, code, handler): + SalaryItem.formulas[code] = handler + + @classmethod + def get_formula(cls): + return SalaryItem.formulas.get(cls.code,None) + + code = models.CharField(_("code"),max_length=const.DB_CHAR_CODE_10,null=True) + name = models.CharField(_("name"),max_length=const.DB_CHAR_NAME_120) + classification = models.CharField(_("classification"),max_length=const.DB_CHAR_CODE_2,choices=const.get_value_list('S048'),default='10') + plus_or_minus = models.CharField(_("plus or minus"),max_length=const.DB_CHAR_CODE_2,choices=const.get_value_list('S049'),default='+') + required = models.BooleanField(_("is required"),default=0) + + def __unicode__(self): + return "%s %s" % (self.code,self.name) + + class Meta: + verbose_name = _('salary item') + verbose_name_plural = _('salary items') + ordering = ('code',) + + +class Entry(generic.BO): + """ + 人员入职 + """ + code = models.CharField(_("employee number"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + name = models.CharField(_("employee name"),max_length=const.DB_CHAR_NAME_120) + pinyin = models.CharField(_("pinyin"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + birthday = models.DateField(_("birthday"),blank=True,null=True) + gender = models.CharField(_("gender"),max_length=const.DB_CHAR_CODE_2,choices=const.get_value_list('gender'),default='1') + idcard = models.CharField(_("id card"),max_length=const.DB_CHAR_NAME_20) + address = models.CharField(_("mail address"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + zipcode = models.CharField(_("zipcode"),max_length=const.DB_CHAR_CODE_8) + phone = models.CharField(_("phone"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + + guider = models.ForeignKey(Employee,verbose_name=_("guider")) + position = models.ForeignKey(Position,verbose_name = _('designate position')) + rank = models.CharField(_("employee rank"),max_length=const.DB_CHAR_CODE_2,default='00',choices=const.get_value_list('S017')) + ygxs = models.CharField(_("employ ygxs"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S019'),default='2') + category = models.CharField(_("employ category"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=const.get_value_list('S018'),default='21') + + probation_months = models.CharField(_("probation months"),max_length=2,default='3',choices=const.get_value_list('S047')) + probation_begin = models.DateField(_("probation begin"),default=datetime.date.today) + probation_end = models.DateField(_("probation end"),blank=True,null=True) + + memo = models.TextField(_("memo"),blank=True,null=True) + profile = models.FileField(_("profile"),blank=True,null=True,upload_to='hr profile') + + class Meta: + verbose_name = _("employee entry") + verbose_name_plural = _("employee entries") + permissions = ( + ('modify_salary_item',_("modify salary item")), + ) + + +class EmployeeSalaryItem(models.Model): + """ + + """ + entry = models.ForeignKey(Entry,verbose_name=_("employee entry")) + employee = models.ForeignKey(Employee,verbose_name=_("employee"),blank=True,null=True) + salary_item = models.ForeignKey(SalaryItem,verbose_name=_("salary item")) + calculate_way = models.CharField(_("calculate way"),max_length=const.DB_CHAR_CODE_2,choices=const.get_value_list('S050'),default='10') + fixed_value = models.DecimalField(_("fixed value"),blank=True,null=True,max_digits=10,decimal_places=2) + base_value = models.DecimalField(_("base value"),blank=True,null=True,max_digits=10,decimal_places=2) + org_percent = models.DecimalField(_("org percent"),blank=True,null=True,max_digits=4,decimal_places=2) + employee_percent = models.DecimalField(_("employee percent"),blank=True,null=True,max_digits=4,decimal_places=2) + + class Meta: + verbose_name = _("salary item") + verbose_name_plural = _("salary item") + unique_together = (('entry', 'salary_item'),) + + +class Transfer(generic.BO): + """ + 人员调动 + """ + employee = models.ForeignKey(Employee,verbose_name=_("employee")) + + class Meta: + verbose_name = _("employee transfer") + verbose_name_plural = _("employee transfers") + + +class Departure(generic.BO): + """ + 人员离职 + """ + employee = models.ForeignKey(Employee,verbose_name=_("employee")) + + class Meta: + verbose_name = _("employee departure") + verbose_name_plural = _("employee departures") + diff --git a/hr/tests.py b/hr/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/hr/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/hr/views.py b/hr/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/hr/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/images/image-20260610135601841.png b/images/image-20260610135601841.png new file mode 100644 index 0000000..9edba36 Binary files /dev/null and b/images/image-20260610135601841.png differ diff --git a/images/image-20260610135614258.png b/images/image-20260610135614258.png new file mode 100644 index 0000000..158d424 Binary files /dev/null and b/images/image-20260610135614258.png differ diff --git a/images/image-20260610135625703.png b/images/image-20260610135625703.png new file mode 100644 index 0000000..dc16348 Binary files /dev/null and b/images/image-20260610135625703.png differ diff --git a/images/image-20260610135636514.png b/images/image-20260610135636514.png new file mode 100644 index 0000000..3932b91 Binary files /dev/null and b/images/image-20260610135636514.png differ diff --git a/images/image-20260610135644978.png b/images/image-20260610135644978.png new file mode 100644 index 0000000..f6f2a85 Binary files /dev/null and b/images/image-20260610135644978.png differ diff --git a/images/image-20260610135653450.png b/images/image-20260610135653450.png new file mode 100644 index 0000000..56bef12 Binary files /dev/null and b/images/image-20260610135653450.png differ diff --git a/images/image-20260610135704180.png b/images/image-20260610135704180.png new file mode 100644 index 0000000..638db80 Binary files /dev/null and b/images/image-20260610135704180.png differ diff --git a/images/image-20260610135711248.png b/images/image-20260610135711248.png new file mode 100644 index 0000000..8dd1c95 Binary files /dev/null and b/images/image-20260610135711248.png differ diff --git a/images/image-20260610135719363.png b/images/image-20260610135719363.png new file mode 100644 index 0000000..2c3773e Binary files /dev/null and b/images/image-20260610135719363.png differ diff --git a/images/image-20260610135727597.png b/images/image-20260610135727597.png new file mode 100644 index 0000000..5e6df13 Binary files /dev/null and b/images/image-20260610135727597.png differ diff --git a/images/image-20260610135737510.png b/images/image-20260610135737510.png new file mode 100644 index 0000000..2a0dd4a Binary files /dev/null and b/images/image-20260610135737510.png differ diff --git a/images/image-20260610135746092.png b/images/image-20260610135746092.png new file mode 100644 index 0000000..5190d5e Binary files /dev/null and b/images/image-20260610135746092.png differ diff --git a/images/image-20260610135747819.png b/images/image-20260610135747819.png new file mode 100644 index 0000000..5190d5e Binary files /dev/null and b/images/image-20260610135747819.png differ diff --git a/images/image-20260610135757306.png b/images/image-20260610135757306.png new file mode 100644 index 0000000..e656bff Binary files /dev/null and b/images/image-20260610135757306.png differ diff --git a/invent/__init__.py b/invent/__init__.py new file mode 100644 index 0000000..79f626d --- /dev/null +++ b/invent/__init__.py @@ -0,0 +1 @@ +default_app_config = "invent.apps.MyAppConfig" \ No newline at end of file diff --git a/invent/admin.py b/invent/admin.py new file mode 100644 index 0000000..5bfbd32 --- /dev/null +++ b/invent/admin.py @@ -0,0 +1,248 @@ +from django.contrib import admin +from django.utils.translation import ugettext_lazy as _ +from common import generic +from basedata.models import Material +from invent.models import StockIn,StockOut,InitialInventory,InItem,OutItem,InitItem,Inventory,InItemForm,InOutDetail,\ + WareReturn,ReturnItem,WareAdjust,AdjustItem + + +class InItemInline(admin.TabularInline): + model = InItem + form = InItemForm + fields = ('material', 'measure', 'cnt', 'price') + raw_id_fields = ['material'] + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 1 + + def get_readonly_fields(self, request, obj=None): + if obj and obj.status == 1: + return ['material', 'measure', 'cnt', 'price'] + else: + return [] + + def formfield_for_foreignkey(self, db_field, request=None, **kwargs): + if db_field.name == 'material': + kwargs['queryset'] = Material.objects.filter(is_virtual=0) + return super(InItemInline,self).formfield_for_foreignkey(db_field,request,**kwargs) + + +class OutItemInline(admin.TabularInline): + model = OutItem + fields = ('inventory', 'measure', 'cnt', 'price','warehouse',) + raw_id_fields = ['inventory'] + readonly_fields = ['measure', 'price', 'warehouse'] + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 3 + + +class InitItemInline(admin.TabularInline): + model = InitItem + fields = ('material', 'measure', 'cnt', 'warehouse', 'price',) + raw_id_fields = ['material'] + + def get_readonly_fields(self, request, obj=None): + if obj and obj.execute_time: + return ['material', 'measure', 'cnt', 'warehouse', 'price'] + else: + return [] + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 3 + + def formfield_for_foreignkey(self, db_field, request=None, **kwargs): + if db_field.name == 'material': + kwargs['queryset'] = Material.objects.filter(is_virtual=0) + return super(InitItemInline,self).formfield_for_foreignkey(db_field,request,**kwargs) + + +class StockInAdmin(generic.BOAdmin): + CODE_PREFIX = 'RK' + CODE_NUMBER_WIDTH = 5 + list_display = ['code','title','money_of_amount','status','entry_time'] + inlines = [InItemInline] + raw_id_fields = ['po'] + fields = ( + ('code',),('title',),('po',),('warehouse',),('batch',),('status','amount',) + ) + date_hierarchy = 'begin' + extra_buttons = [{'href':'cin','title':_('Action Stock In')}] + + def save_model(self, request, obj, form, change): + import decimal + super(StockInAdmin,self).save_model(request,obj,form,change) + if obj and obj.po: + po_items = obj.po.poitem_set.filter(left_cnt__gt=0).all() + for item in po_items: + try: + InItem.objects.get(po_item=item,master=obj) + continue + except Exception,e: + pp = item.discount_price or item.price + if decimal.Decimal(item.tax) > decimal.Decimal(0): + pp = pp /(decimal.Decimal(1)+decimal.Decimal(item.tax)) + InItem.objects.create(warehouse=obj.warehouse,material=item.material,measure=item.measure,prop='+', + po_item=item,master=obj,cnt=item.left_cnt,price=pp,batch=obj.batch,source=obj.code) + + def get_readonly_fields(self, request, obj=None): + print obj + if obj and obj.status == 9: + return ['code','title','po','warehouse','batch','status'] + else: + return ['status','amount'] + + def changeform_view(self, request, object_id=None, form_url='', extra_context=None): + extra_context = extra_context or {} + if object_id: + obj = StockIn.objects.get(id=object_id) + if obj and obj.execute_time: + extra_context.update(dict(readonly=True)) + return super(StockInAdmin,self).changeform_view(request,object_id,form_url,extra_context) + + +class StockOutAdmin(generic.BOAdmin): + CODE_PREFIX = 'CK' + CODE_NUMBER_WIDTH = 5 + list_display = ['code','title','project','status','out_time','out_amount'] + list_display_links = ['code','title'] + date_hierarchy = 'begin' + inlines = [OutItemInline] + raw_id_fields = ['project','wo','user'] + fields = ( + ('code', 'status',),('project', ),('wo','user'), + ('title','amount',),('description',), + ) + readonly_fields = ['status'] + extra_buttons = [{'href':'out','title':_('Action Stock Out')}] + search_fields = ['code','title','user__username'] + + def changeform_view(self, request, object_id=None, form_url='', extra_context=None): + extra_context = extra_context or {} + if object_id: + obj = StockOut.objects.get(id=object_id) + if obj and obj.execute_time: + extra_context.update(dict(readonly=True)) + return super(StockOutAdmin,self).changeform_view(request,object_id,form_url,extra_context) + + def save_model(self, request, obj, form, change): + if obj and obj.user is None: + obj.user = request.user + super(StockOutAdmin,self).save_model(request,obj,form,change) + + +class InitialInventoryAdmin(generic.BOAdmin): + CODE_PREFIX = 'QC' + CODE_NUMBER_WIDTH = 3 + list_display = ['code','title','status'] + inlines = [InitItemInline] + fields = ('code','title','org','status','amount','attach') + readonly_fields = ['status','amount'] + extra_buttons = [{'href':'cin','title':_('Action Stock In')}] + + def changeform_view(self, request, object_id=None, form_url='', extra_context=None): + extra_context = extra_context or {} + if object_id: + obj = InitialInventory.objects.get(id=object_id) + if obj and obj.execute_time: + extra_context.update(dict(readonly=True)) + return super(InitialInventoryAdmin,self).changeform_view(request,object_id,form_url,extra_context) + + +class InventoryAdmin(generic.BOAdmin): + list_display = ['material','measure','warehouse','cnt','price'] + search_fields = ['material__name','material__code'] + + def changeform_view(self, request, object_id=None, form_url='', extra_context=None): + extra_context = extra_context or {} + extra_context.update(dict(readonly=True)) + if object_id: + inventory = Inventory.objects.get(id=object_id) + material = inventory.material + warehouse = inventory.warehouse + detail = InOutDetail.objects.filter(material=material,warehouse=warehouse) + extra_context.update(dict(detail=detail)) + + return super(InventoryAdmin,self).changeform_view(request,object_id,form_url,extra_context) + + +class ReturnItemInline(admin.TabularInline): + model = ReturnItem + fields = ['material','measure','warehouse','out_cnt','cnt'] + readonly_fields = ['material','measure','warehouse','out_cnt'] + extra = 0 + + +class WareReturnAdmin(generic.BOAdmin): + """ + + """ + CODE_PREFIX = 'FK' + CODE_NUMBER_WIDTH = 4 + list_display = ['code','title','out'] + fields = ( + ('code',),('title',),('out',),('amount',),('status',) + ) + readonly_fields = ['status'] + raw_id_fields = ['out'] + inlines = [ReturnItemInline] + extra_buttons = [{'href':'cin','title':_('Action Ware Return')}] + + def changeform_view(self, request, object_id=None, form_url='', extra_context=None): + if object_id : + obj = WareReturn.objects.get(id=object_id) + if obj.status == '9': + extra_context = extra_context or {} + extra_context.update(dict(readonly=True)) + return super(WareReturnAdmin,self).changeform_view(request,object_id,form_url,extra_context) + + +class AdjustItemInline(admin.TabularInline): + model = AdjustItem + fields = ['inventory','measure','warehouse','prop','cnt'] + readonly_fields = ['measure','warehouse'] + raw_id_fields = ['inventory'] + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 1 + + +class WareAdjustAdmin(generic.BOAdmin): + CODE_PREFIX = 'TZ' + CODE_NUMBER_WIDTH = 3 + list_display = ['code','title','status'] + fields = ( + ('code',),('title',),('description',),('status',) + ) + readonly_fields = ['status'] + inlines = [AdjustItemInline] + extra_buttons = [{'href':'adjust','title':_('Action Ware Adjust')}] + date_hierarchy = 'begin' + + def changeform_view(self, request, object_id=None, form_url='', extra_context=None): + if object_id: + obj = WareAdjust.objects.get(id=object_id) + if obj and obj.status == '9': + extra_context = extra_context or {} + extra_context.update(dict(readonly=True)) + return super(WareAdjustAdmin,self).changeform_view(request,object_id,form_url,extra_context) + + +admin.site.register(StockIn,StockInAdmin) +admin.site.register(StockOut,StockOutAdmin) +admin.site.register(InitialInventory,InitialInventoryAdmin) +admin.site.register(Inventory,InventoryAdmin) +admin.site.register(WareReturn,WareReturnAdmin) +admin.site.register(WareAdjust,WareAdjustAdmin) diff --git a/invent/apps.py b/invent/apps.py new file mode 100644 index 0000000..25d842a --- /dev/null +++ b/invent/apps.py @@ -0,0 +1,11 @@ +# created at 15-5-23 +# coding=utf-8 +__author__ = 'zhugl' + +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + + +class MyAppConfig(AppConfig): + name = 'invent' + verbose_name = _("inventory manage") diff --git a/invent/models.py b/invent/models.py new file mode 100644 index 0000000..b863956 --- /dev/null +++ b/invent/models.py @@ -0,0 +1,493 @@ +# coding=utf-8 +import csv +import os +import datetime +import decimal +from django.db import transaction +from django.db import models +from django import forms +from mis import settings +from django.utils.text import force_text +from django.db import transaction +from django.contrib.auth.models import User +from django.utils.translation import ugettext_lazy as _ +from common import generic +from common import const +from basedata.models import Material,Warehouse,Measure,Organization,Project +from selfhelp.models import WorkOrder +from purchase.models import PurchaseOrder,POItem + + +class Inventory(generic.BO): + """ + 库存信息 + """ + index_weight = 1 + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + warehouse = models.ForeignKey(Warehouse,verbose_name=_("warehouse")) + material = models.ForeignKey(Material,verbose_name=_("material")) + measure = models.ForeignKey(Measure,verbose_name=_("measure")) + cnt = models.DecimalField(_("count"),max_digits=14,decimal_places=4) + batch = models.CharField(_("batch"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + price = models.DecimalField(_("price"),max_digits=14,decimal_places=4) + + def __unicode__(self): + des = self.material.spec or '' + return u'%s %s %s' % (self.material.code,self.material.name,des) + + class Meta: + verbose_name = _("Inventory") + verbose_name_plural = _("Inventory") + ordering = ['material'] + + +class InitialInventory(generic.BO): + """ + 期初库存 + """ + STATUS = ( + ('0', _("NEW")), + ('9', _("EXECUTED")) + ) + index_weight = 9 + code = models.CharField(_("code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + title = models.CharField(_("title"),max_length=const.DB_CHAR_NAME_40) + user = models.ForeignKey(User,verbose_name=_("user"),blank=True,null=True) + status = models.CharField(_("status"),max_length=const.DB_CHAR_CODE_2,default='0',choices=STATUS) + execute_time = models.DateTimeField(_("execute time"),blank=True,null=True) + attach = models.FileField(_('attach'),blank=True,null=True,upload_to='inventory',help_text=u'参考FD0002模板文档') + amount = models.DecimalField(_('money of amount'),max_digits=14,decimal_places=4,blank=True,null=True) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + + super(InitialInventory,self).save(force_insert,force_update,using,update_fields) + count = InitItem.objects.filter(master=self).count() + if self.attach and count == 0: + path = os.path.join(settings.MEDIA_ROOT,self.attach.name) + reader = csv.reader(open(path,'r')) + index = 0 + with transaction.atomic(): + for code,name,description,unit_code,unit_name,warehouse_code,warehouse_name,price,cnt in reader: + index+=1 + if index == 1: + continue + + material = None + measure = None + house = None + + try: + measure = Measure.objects.get(code=unit_code) + except Exception,e: + measure = Measure.objects.create(code=unit_code,name=force_text(unit_name.decode('gbk'))) + + try: + house = Warehouse.objects.get(code=warehouse_code) + except Exception,e: + house = Warehouse.objects.create(code=warehouse_code,name=force_text(warehouse_name.decode('gbk'))) + + try: + material = Material.objects.get(code=code) + except Exception,e: + material = Material(code=code,name=force_text(name.decode('gbk')),spec=force_text(description.decode('gbk')),warehouse=house) + material.stock_price = price + material.save() + InitItem.objects.create(master=self,material=material,price=price,cnt=cnt,warehouse=house,measure=measure,source=self.code) + + def init_entry(self,request=None): + """ + 执行期初入库 + """ + count = InitItem.objects.filter(master=self).count() + if count > 0: + with transaction.atomic(): + total_amount = 0 + for item in InitItem.objects.filter(master=self).all(): + Inventory.objects.create(material=item.material,price=item.price,cnt=item.cnt,warehouse=item.warehouse,measure=item.measure) + item.status = 1 + item.event_time = datetime.datetime.now() + item.source = self.code + item.save() + item.material.stock_price = item.price + if item.material.measure.count() == 0: + item.material.measure.add(item.measure) + item.material.save() + total_amount += item.price*item.cnt + self.amount = total_amount + self.status = '9' + self.execute_time = datetime.datetime.now() + self.save() + else: + raise Exception(_("none material was found")) + + class Meta: + verbose_name = _("Initial Inventory") + verbose_name_plural = _("Initial Inventory") + + +class StockIn(generic.BO): + """ + 入库单 + """ + STATUS = ( + ('0', _("NEW")), + ('1', _("QUALITY TESTING")), + ('9', _("EXECUTED")) + ) + index_weight = 3 + code = models.CharField(_("code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + warehouse = models.ForeignKey(Warehouse,verbose_name=_("warehouse")) + title = models.CharField(_("title"),max_length=const.DB_CHAR_NAME_40) + user = models.ForeignKey(User,verbose_name=_("user"),blank=True,null=True) + status = models.CharField(_("status"),max_length=const.DB_CHAR_CODE_2,default='0',choices=STATUS) + execute_time = models.DateTimeField(_("execute time"),blank=True,null=True) + po = models.ForeignKey(PurchaseOrder,verbose_name=_("purchase order"),null=True,limit_choices_to={"entry_status":"0"},blank=True) + amount = models.DecimalField(_("stock in money of amount"),max_digits=14,decimal_places=4,blank=True,null=True) + batch = models.CharField(_("batch"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + + def money_of_amount(self): + if self.amount: + return self.amount + else: + return 0.00 + + def entry_time(self): + if self.execute_time: + return self.execute_time + else: + return '' + + money_of_amount.short_description = _("stock in money of amount") + entry_time.short_description = _("entry time") + + def action_entry(self,request): + """ + 执行入库操作 + """ + if self.initem_set.count() > 0: + with transaction.atomic(): + total_amount = decimal.Decimal(0) + for item in self.initem_set.filter(status=0).all(): + try: + inventory = Inventory.objects.get(warehouse=self.warehouse,material=item.material,measure=item.measure) + if inventory.price != item.price: + at = decimal.Decimal(inventory.price*inventory.cnt+item.price*item.cnt) + ac = decimal.Decimal(inventory.cnt+item.cnt) + average = at/ac + inventory.price = average + item.material.stock_price = average + item.material.save() + inventory.cnt += item.cnt + inventory.save() + total_amount += item.price*item.cnt + except Exception,e: + Inventory.objects.create(warehouse=self.warehouse,material=item.material,measure=item.measure, + cnt=item.cnt,price=item.price,org=self.org) + item.material.stock_price = item.price + item.material.save() + + item.status=1 + item.event_time = datetime.datetime.now() + item.source = self.code + item.save() + total_amount += item.price*item.cnt + # saving the purchase item + item.po_item.is_in_stock = 1 + item.po_item.in_stock_time = datetime.datetime.now() + item.po_item.entry_cnt = item.cnt + + item.po_item.save() + none_zero_left = POItem.objects.filter(po=item.po_item.po,left_cnt__gt=0).count() + if none_zero_left == 0: + item.po_item.po.status = '99' + item.po_item.po.entry_status = 1 + item.po_item.po.entry_time = datetime.datetime.now() + item.po_item.po.save() + # saving stock in item status + item.status = 1 + item.event_time = datetime.datetime.now() + # updating master's record + self.status = 9 + self.execute_time = datetime.datetime.now() + self.amount = total_amount + self.save() + + class Meta: + verbose_name = _("StockIn") + verbose_name_plural = _("StockIn") + + +class StockOut(generic.BO): + """ + 领料单 + """ + STATUS = ( + ('0', _("NEW")), + ('1', _("IN PROGRESS")), + ('9', _("EXECUTED")) + ) + index_weight = 2 + code = models.CharField(_("code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + title = models.CharField(_("title"),max_length=const.DB_CHAR_NAME_40) + project = models.ForeignKey(Project,verbose_name=_("project"),blank=True,null=True) + wo = models.ForeignKey(WorkOrder,verbose_name=_("work order"),blank=True,null=True) + description = models.TextField(_("description"),blank=True,null=True) + amount = models.DecimalField(_("money of amount"),max_digits=14,decimal_places=4,blank=True,null=True) + user = models.ForeignKey(User,verbose_name=_("out user"),blank=True,null=True) + status = models.CharField(_("status"),max_length=const.DB_CHAR_CODE_2,default='0',choices=STATUS) + execute_time = models.DateTimeField(_("execute time"),blank=True,null=True) + + def out_amount(self): + return self.amount or '' + + def out_time(self): + return self.execute_time or '' + + out_time.short_description = _('stock out time') + out_amount.short_description = _('stock out amount') + + def action_out(self,request=None): + """ + 执行出库操作 + """ + if self.outitem_set.count() > 0: + with transaction.atomic(): + total = decimal.Decimal(0) + for item in OutItem.objects.filter(master=self).all(): + if item.inventory.cnt < item.cnt: + raise Exception('%s does not meets required' % item.material) + if item.cnt: + total += item.cnt * item.inventory.price + item.inventory.cnt -= item.cnt + item.status = 1 + item.price = item.inventory.price + item.event_time = datetime.datetime.now() + item.inventory.save() + item.source=self.code + item.save() + if total > 0: + self.amount = total + self.status = '9' + self.execute_time = datetime.datetime.now() + self.save() + + class Meta: + verbose_name = _("StockOut") + verbose_name_plural = _("StockOut") + + +class WareReturn(generic.BO): + """ + 返库单 + """ + STATUS = ( + ('0', _("NEW")), + ('1', _("IN PROGRESS")), + ('9', _("EXECUTED")) + ) + index_weight = 5 + code = models.CharField(_("code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + title = models.CharField(_("title"),max_length=const.DB_CHAR_NAME_40) + out = models.ForeignKey(StockOut,verbose_name=_('StockOut')) + amount = models.DecimalField(_("money of amount"),max_digits=14,decimal_places=4,blank=True,null=True) + user = models.ForeignKey(User,verbose_name=_("out user"),blank=True,null=True) + status = models.CharField(_("status"),max_length=const.DB_CHAR_CODE_2,default='0',choices=STATUS) + execute_time = models.DateTimeField(_("execute time"),blank=True,null=True) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + super(WareReturn,self).save(force_insert,force_update,using,update_fields) + item_count = ReturnItem.objects.filter(master=self).count() + if self.out and item_count == 0: + for out_item in OutItem.objects.filter(master=self.out): + ReturnItem.objects.create(master=self,out_item=out_item,material=out_item.material,price=out_item.price, + measure=out_item.measure,warehouse=out_item.warehouse,out_cnt=out_item.cnt,cnt=out_item.cnt) + + def action_return(self,request): + with transaction.atomic(): + total_amount = decimal.Decimal(0) + for item in ReturnItem.objects.filter(master=self): + if item.cnt > item.out_item.cnt or item.cnt < 0: + raise Exception('%s cnt is invalid,out is %s,return is %s' % (item.material,item.out_cnt,item.cnt)) + item.event_time = datetime.datetime.now() + item.source = self.code + item.status = 1 + item.out_item.inventory.cnt += item.cnt + item.out_item.inventory.save() + item.save() + total_amount += item.price * item.cnt + self.amount = total_amount + self.status = '9' + self.execute_time = datetime.datetime.now() + self.save() + + class Meta: + verbose_name = _("ware return") + verbose_name_plural = _("ware return") + + +class WareAdjust(generic.BO): + """ + 库存调整 + """ + STATUS = ( + ('0', _("NEW")), + ('1', _("IN PROGRESS")), + ('9', _("EXECUTED")) + ) + index_weight = 4 + code = models.CharField(_("code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + title = models.CharField(_("title"),max_length=const.DB_CHAR_NAME_40) + description = models.TextField(_("description"),blank=True,null=True) + user = models.ForeignKey(User,verbose_name=_("out user"),blank=True,null=True) + status = models.CharField(_("status"),max_length=const.DB_CHAR_CODE_2,default='0',choices=STATUS) + execute_time = models.DateTimeField(_("execute time"),blank=True,null=True) + + def action_adjust(self,request): + with transaction.atomic(): + for item in AdjustItem.objects.filter(master=self,status=0): + inventory = item.inventory + if item.prop == '+': + inventory.cnt += item.cnt + else: + inventory.cnt -= item.cnt + inventory.save() + item.status = 1 + item.event_time = datetime.datetime.now() + item.source = self.code + item.save() + self.status = '9' + self.execute_time = datetime.datetime.now() + self.save() + + class Meta: + verbose_name = _("ware adjust") + verbose_name_plural = _("ware adjust") + + +class InOutDetail(models.Model): + """ + in out detail + """ + + PROP = ( + ('+', _("PLUS")), + ('-', _("MINUS")) + ) + + create_time = models.DateTimeField(_("create time"),auto_now_add=True) + status = models.BooleanField(_("executed"),default=0) + event_time = models.DateTimeField(_("event time"),blank=True,null=True) + warehouse = models.ForeignKey(Warehouse,verbose_name=_("warehouse"),blank=True,null=True) + material = models.ForeignKey(Material,verbose_name=_("material"),limit_choices_to={"is_virtual":"0"},blank=True,null=True) + measure = models.ForeignKey(Measure,verbose_name=_("measure"),blank=True,null=True) + cnt = models.DecimalField(_("count"),max_digits=14,decimal_places=4,blank=True,null=True) + batch = models.CharField(_("batch"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + price = models.DecimalField(_("price"),max_digits=14,decimal_places=4,blank=True,null=True) + prop = models.CharField(_("plus or minus property"),max_length=const.DB_CHAR_CODE_2,choices=PROP,default='+') + source = models.CharField(_("source"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + + +class InitItem(InOutDetail): + """ + 期初入库明细 + """ + master = models.ForeignKey(InitialInventory) + + class Meta: + verbose_name = _("init item") + verbose_name_plural = _("init item") + + +class InItem(InOutDetail): + """ + 入库单明细 + """ + master = models.ForeignKey(StockIn) + po_item = models.ForeignKey(POItem,verbose_name=_("po item"),blank=True,null=True) + + def get_new_price(self): + if self.po_item and self.master.warehouse: + try: + inventory = Inventory.objects.get(warehouse=self.master.warehouse,material=self.material,measure=self.measure) + if inventory and self.price != inventory.price: + total_amount = self.price*self.cnt+inventory.price*inventory.cnt + total_count = self.cnt+inventory.cnt + return total_amount/total_count + except Exception,e: + pass + return self.price or '' + + class Meta: + verbose_name = _("in item") + verbose_name_plural = _("in item") + + +class InItemForm(forms.ModelForm): + + new_price = forms.CharField(label=_('new price'),required=False) + + class Meta: + model = InItem + fields = ('material', 'measure', 'cnt', 'price') + + +class OutItem(InOutDetail): + """ + 出库单明细 + """ + master = models.ForeignKey(StockOut) + inventory = models.ForeignKey(Inventory,blank=True,null=True,verbose_name=_("inventory material")) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + self.prop = '-' + if self.inventory: + self.material = self.inventory.material + self.measure = self.inventory.measure + self.warehouse = self.inventory.warehouse + + super(OutItem,self).save(force_insert,force_update,using,update_fields) + + class Meta: + verbose_name = _("out item") + verbose_name_plural = _("out item") + + +class ReturnItem(InOutDetail): + """ + 返库单明细 + """ + master = models.ForeignKey(WareReturn) + out_item = models.ForeignKey(OutItem,blank=True,null=True,verbose_name=_('out item')) + out_cnt = models.DecimalField(_("out count"),max_digits=14,decimal_places=4) + + class Meta: + verbose_name = _("return item") + verbose_name_plural = _("return item") + + +class AdjustItem(InOutDetail): + """ + 库存调整明细 + """ + master = models.ForeignKey(WareAdjust) + inventory = models.ForeignKey(Inventory,blank=True,null=True,verbose_name=_("inventory material")) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + if self.inventory: + self.material = self.inventory.material + self.measure = self.inventory.measure + self.warehouse = self.inventory.warehouse + super(AdjustItem,self).save(force_insert,force_update,using,update_fields) + + class Meta: + verbose_name = _("adjust item") + verbose_name_plural = _("adjust item") \ No newline at end of file diff --git a/invent/tests.py b/invent/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/invent/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/invent/urls.py b/invent/urls.py new file mode 100644 index 0000000..b2e1020 --- /dev/null +++ b/invent/urls.py @@ -0,0 +1,10 @@ +from django.conf.urls import include, url,static +import invent.views + +urlpatterns = [ + url(r"stockin/(?P\d+)/cin", invent.views.action_in), + url(r"initialinventory/(?P\d+)/cin", invent.views.action_init), + url(r"stockout/(?P\d+)/out", invent.views.action_out), + url(r"warereturn/(?P\d+)/cin", invent.views.action_return), + url(r"wareadjust/(?P\d+)/adjust", invent.views.action_adjust), +] diff --git a/invent/views.py b/invent/views.py new file mode 100644 index 0000000..d747b63 --- /dev/null +++ b/invent/views.py @@ -0,0 +1,175 @@ +# coding=utf-8 +from django.contrib.admin import site +from django.contrib.contenttypes.models import ContentType +from django.db import connection +from django.http.response import HttpResponseRedirect +from django.utils.encoding import force_text +from django.template.response import TemplateResponse +from django.contrib import messages +from django.contrib.auth.models import User +from invent.models import StockIn,StockOut,InitialInventory,WareReturn,WareAdjust +from django.utils.translation import ugettext_lazy as _ + + +def action_in(request,object_id): + """ + 入库操作 + :param request: + :param object_id: + :return: + """ + title = _("Are you sure?") + obj = StockIn.objects.get(id=int(object_id)) + opts = obj._meta + objects_name = force_text(opts.verbose_name) + + if request.POST.get("post"): + try: + obj.action_entry(request) + messages.success(request,_('check in successfully')) + except Exception,e: + messages.error(request,e) + + return HttpResponseRedirect("/admin/invent/stockin/%s"%(object_id)) + + context = dict( + site.each_context(request), + title=title, + opts=opts, + objects_name=objects_name, + object=obj, + ) + request.current_app = site.name + + return TemplateResponse(request,'admin/invent/stockin/in_confirmation.html', context) + + +def action_out(request,object_id): + """ + 出库操作 + :param request: + :param object_id: + :return: + """ + title = _("Are you sure?") + obj = StockOut.objects.get(id=int(object_id)) + opts = obj._meta + objects_name = force_text(opts.verbose_name) + + if request.POST.get("post"): + try: + obj.action_out(request) + messages.success(request,_('check out successfully')) + except Exception,e: + messages.error(request,e) + return HttpResponseRedirect("/admin/invent/stockout/%s"%(object_id)) + + context = dict( + site.each_context(request), + title=title, + opts=opts, + objects_name=objects_name, + object=obj, + ) + request.current_app = site.name + + return TemplateResponse(request,'admin/invent/stockout/out_confirmation.html', context) + + +def action_init(request,object_id): + """ + 期初入库操作 + :param request: + :param object_id: + :return: + """ + title = _("Are you sure?") + obj = InitialInventory.objects.get(id=int(object_id)) + opts = obj._meta + objects_name = force_text(opts.verbose_name) + + if request.POST.get("post"): + try: + obj.init_entry(request) + messages.success(request,_('check in successfully')) + except Exception,e: + messages.error(request,e) + + return HttpResponseRedirect("/admin/invent/initialinventory/%s"%(object_id)) + + context = dict( + site.each_context(request), + title=title, + opts=opts, + objects_name=objects_name, + object=obj, + ) + request.current_app = site.name + + return TemplateResponse(request,'admin/invent/stockin/in_confirmation.html', context) + + +def action_return(request,object_id): + """ + 返库操作 + :param request: + :param object_id: + :return: + """ + title = _("Are you sure?") + obj = WareReturn.objects.get(id=int(object_id)) + opts = obj._meta + objects_name = force_text(opts.verbose_name) + + if request.POST.get("post"): + try: + obj.action_return(request) + messages.success(request,_('check in successfully')) + except Exception,e: + messages.error(request,e) + + return HttpResponseRedirect("/admin/invent/warereturn/%s"%(object_id)) + + context = dict( + site.each_context(request), + title=title, + opts=opts, + objects_name=objects_name, + object=obj, + ) + request.current_app = site.name + + return TemplateResponse(request,'admin/invent/stockin/in_confirmation.html', context) + + +def action_adjust(request,object_id): + """ + 调整操作 + :param request: + :param object_id: + :return: + """ + title = _("Are you sure?") + obj = WareAdjust.objects.get(id=int(object_id)) + opts = obj._meta + objects_name = force_text(opts.verbose_name) + + if request.POST.get("post"): + try: + obj.action_adjust(request) + messages.success(request,_('check in successfully')) + except Exception,e: + messages.error(request,e) + + return HttpResponseRedirect("/admin/invent/wareadjust/%s"%(object_id)) + + context = dict( + site.each_context(request), + title=title, + opts=opts, + objects_name=objects_name, + object=obj, + ) + request.current_app = site.name + + return TemplateResponse(request,'admin/invent/stockin/in_confirmation.html', context) \ No newline at end of file diff --git a/locale/zh_CN/LC_MESSAGES/django.po b/locale/zh_CN/LC_MESSAGES/django.po new file mode 100644 index 0000000..e3a7092 --- /dev/null +++ b/locale/zh_CN/LC_MESSAGES/django.po @@ -0,0 +1,1453 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-05-01 19:18+0800\n" +"PO-Revision-Date: 2026-06-10 12:00+0800\n" +"Last-Translator: \n" +"Language-Team: zh_Hans\n" +"Language: zh_Hans\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: .\basedata\apps.py:9 +msgid "BaseData" +msgstr "基础数据" + +#: .\basedata\models.py:16 +msgid "list code" +msgstr "编号" + +#: .\basedata\models.py:17 +msgid "list name" +msgstr "名称" + +#: .\basedata\models.py:18 .\syscfg\models.py:40 .\syscfg\models.py:41 +#: .\syscfg\models.py:48 +msgid "module" +msgstr "模块" + +#: .\basedata\models.py:19 .\basedata\models.py:38 .\organ\models.py:16 +#: .\organ\models.py:60 .\syscfg\models.py:37 .\syscfg\models.py:54 +#: .\syscfg\models.py:68 +msgid "in use" +msgstr "在用?" + +#: .\basedata\models.py:20 +msgid "is init" +msgstr "初始数据?" + +#: .\basedata\models.py:21 +msgid "is locked" +msgstr "锁定?" + +#: .\basedata\models.py:22 +msgid "locked by" +msgstr "锁定用户" + +#: .\basedata\models.py:23 +msgid "locked time" +msgstr "锁定时间" + +#: .\basedata\models.py:26 .\basedata\models.py:27 +msgid "value list" +msgstr "值列表" + +#: .\basedata\models.py:34 +msgid "list group" +msgstr "值列表组" + +#: .\basedata\models.py:36 +msgid "item code" +msgstr "项编号" + +#: .\basedata\models.py:37 +msgid "item name" +msgstr "项名称" + +#: .\basedata\models.py:39 .\organ\models.py:34 .\organ\models.py:66 +#: .\organ\models.py:104 .\syscfg\models.py:34 .\syscfg\models.py:52 +msgid "weight" +msgstr "排序权重" + +#: .\basedata\models.py:53 .\basedata\models.py:54 +msgid "list item" +msgstr "列表项" + +#: .\basedata\models.py:63 .\basedata\models.py:73 .\basedata\models.py:74 +#: .\organ\models.py:23 +msgid "address" +msgstr "地址" + +#: .\basedata\models.py:64 .\organ\models.py:24 +msgid "zipcode" +msgstr "邮编" + +#: .\basedata\models.py:65 .\basedata\models.py:105 .\organ\models.py:27 +#: .\organ\models.py:63 +msgid "phone" +msgstr "联系电话" + +#: .\basedata\models.py:66 .\basedata\models.py:104 .\organ\models.py:26 +#: .\organ\models.py:64 +msgid "contacts" +msgstr "联系人" + +#: .\basedata\models.py:82 +msgid "Customer" +msgstr "客户" + +#: .\basedata\models.py:83 +msgid "Supplier" +msgstr "供应商" + +#: .\basedata\models.py:93 +msgid "partner code" +msgstr "合作伙伴编号" + +#: .\basedata\models.py:94 +msgid "partner name" +msgstr "名称" + +#: .\basedata\models.py:95 .\organ\models.py:14 .\organ\models.py:57 +#: .\organ\models.py:96 +msgid "short name" +msgstr "简称" + +#: .\basedata\models.py:96 .\organ\models.py:15 .\organ\models.py:58 +#: .\organ\models.py:97 +msgid "pinyin" +msgstr "拼音/英语" + +#: .\basedata\models.py:97 .\organ\models.py:59 +msgid "type" +msgstr "类别" + +#: .\basedata\models.py:98 +msgid "level" +msgstr "等级" + +#: .\basedata\models.py:100 .\organ\models.py:18 +msgid "tax num" +msgstr "纳税识别号" + +#: .\basedata\models.py:101 .\organ\models.py:19 +msgid "tax address" +msgstr "开票地址/电话" + +#: .\basedata\models.py:102 .\organ\models.py:20 +msgid "tax account" +msgstr "发票开户行" + +#: .\basedata\models.py:106 .\basedata\models.py:119 +msgid "memo" +msgstr "备注" + +#: .\basedata\models.py:109 .\basedata\models.py:110 .\basedata\models.py:120 +msgid "partner" +msgstr "合作伙伴" + +#: .\basedata\models.py:117 +msgid "account num" +msgstr "银行帐号" + +#: .\basedata\models.py:118 +msgid "bank name" +msgstr "开户行" + +#: .\basedata\models.py:123 .\basedata\models.py:124 +msgid "bank account" +msgstr "银行账户" + +#: .\common\const.py:20 +msgid "OFF" +msgstr "关闭" + +#: .\common\const.py:21 +msgid "ON" +msgstr "开启" + +#: .\common\generic.py:31 .\syscfg\models.py:13 +msgid "begin date" +msgstr "开始日期" + +#: .\common\generic.py:32 .\syscfg\models.py:14 +msgid "end date" +msgstr "结束日期" + +#: .\common\generic.py:33 +msgid "creator" +msgstr "创建用户" + +#: .\common\generic.py:34 +msgid "modifier" +msgstr "修改用户" + +#: .\common\generic.py:35 +msgid "creation" +msgstr "创建时间" + +#: .\common\generic.py:36 +msgid "modification" +msgstr "修改时间" + +#: .\organ\apps.py:9 .\organ\models.py:37 .\organ\models.py:38 +#: .\organ\models.py:54 +msgid "organization" +msgstr "组织机构" + +#: .\organ\models.py:12 .\organ\models.py:55 +msgid "organ code" +msgstr "机构编号" + +#: .\organ\models.py:13 .\organ\models.py:56 +msgid "organ name" +msgstr "机构名称" + +#: .\organ\models.py:22 +msgid "representative " +msgstr "法人代表" + +#: .\organ\models.py:25 .\organ\models.py:62 +msgid "fax" +msgstr "传真" + +#: .\organ\models.py:28 +msgid "website" +msgstr "网址" + +#: .\organ\models.py:29 .\organ\models.py:65 +msgid "email" +msgstr "邮箱" + +#: .\organ\models.py:30 +msgid "license code" +msgstr "营业执照代码" + +#: .\organ\models.py:31 +msgid "certificate code" +msgstr "组织机构代码" + +#: .\organ\models.py:32 +msgid "business license" +msgstr "营业执照" + +#: .\organ\models.py:33 +msgid "organization code certificate" +msgstr "组织机构证书" + +#: .\organ\models.py:46 +msgid "BRANCH" +msgstr "分公司/事业部" + +#: .\organ\models.py:47 +msgid "DEPARTMENT" +msgstr "一级部门" + +#: .\organ\models.py:48 +msgid "OFFICE" +msgstr "二级部门/处室/科室" + +#: .\organ\models.py:49 +msgid "TEAM" +msgstr "组/班" + +#: .\organ\models.py:50 +msgid "COMMITTEE" +msgstr "委员会" + +#: .\organ\models.py:53 .\organ\models.py:93 .\syscfg\models.py:36 +#: .\syscfg\models.py:69 +msgid "parent" +msgstr "父级" + +#: .\organ\models.py:61 .\organ\models.py:100 +msgid "is virtual" +msgstr "虚拟?" + +#: .\organ\models.py:69 .\organ\models.py:70 .\organ\models.py:92 +msgid "org unit" +msgstr "组织单元" + +#: .\organ\models.py:78 +msgid "Admin Position" +msgstr "管理类" + +#: .\organ\models.py:79 +msgid "Sale Position" +msgstr "营销类" + +#: .\organ\models.py:80 +msgid "Technology Position" +msgstr "技术类" + +#: .\organ\models.py:81 +msgid "Produce Position" +msgstr "生产/操作类" + +#: .\organ\models.py:85 +msgid "BASIC" +msgstr "基础" + +#: .\organ\models.py:86 +msgid "MEDIUM" +msgstr "中等" + +#: .\organ\models.py:87 +msgid "SENIOR" +msgstr "高级" + +#: .\organ\models.py:88 +msgid "PROFESSOR" +msgstr "教授" + +#: .\organ\models.py:89 +msgid "EXPERT" +msgstr "专家" + +#: .\organ\models.py:94 +msgid "position code" +msgstr "岗位编号" + +#: .\organ\models.py:95 +msgid "position name" +msgstr "岗位名称" + +#: .\organ\models.py:98 +msgid "position series" +msgstr "岗位序列" + +#: .\organ\models.py:99 +msgid "position grade" +msgstr "岗位级别" + +#: .\organ\models.py:101 +msgid "position description" +msgstr "岗位说明" + +#: .\organ\models.py:102 +msgid "qualification" +msgstr "任职资格" + +#: .\organ\models.py:103 +msgid "reference" +msgstr "参考资料" + +#: .\organ\models.py:107 .\organ\models.py:108 +msgid "position" +msgstr "岗位" + +#: .\syscfg\apps.py:9 +msgid "SysConfig" +msgstr "系统配置" + +#: .\syscfg\models.py:15 +msgid "site name" +msgstr "站点名称" + +#: .\syscfg\models.py:16 +msgid "site description" +msgstr "描述信息" + +#: .\syscfg\models.py:17 +msgid "administrator" +msgstr "管理员" + +#: .\syscfg\models.py:23 .\syscfg\models.py:24 +msgid "Site" +msgstr "站点" + +#: .\syscfg\models.py:31 +msgid "module code" +msgstr "模块编号" + +#: .\syscfg\models.py:32 +msgid "module name" +msgstr "模块名称" + +#: .\syscfg\models.py:33 +msgid "module url" +msgstr "URL" + +#: .\syscfg\models.py:35 .\syscfg\models.py:53 +msgid "style class" +msgstr "样式类" + +#: .\syscfg\models.py:49 +msgid "menu code" +msgstr "菜单编号" + +#: .\syscfg\models.py:50 +msgid "menu name" +msgstr "菜单名称" + +#: .\syscfg\models.py:51 +msgid "menu url" +msgstr "URL" + +#: .\syscfg\models.py:57 .\syscfg\models.py:58 +msgid "menu" +msgstr "菜单" + +#: .\syscfg\models.py:65 +msgid "role code" +msgstr "角色编号" + +#: .\syscfg\models.py:66 +msgid "role name" +msgstr "角色名称" + +#: .\syscfg\models.py:67 +msgid "description" +msgstr "描述信息" + +#: .\syscfg\models.py:70 +msgid "role users" +msgstr "分配用户" + +#: .\syscfg\models.py:71 +msgid "role menus" +msgstr "分配菜单" + +#: .\syscfg\models.py:74 .\syscfg\models.py:75 +msgid "role" +msgstr "角色" + +msgid "code" +msgstr "编号" + +msgid "address type" +msgstr "地址类型" + +msgid "project" +msgstr "项目" + +msgid "project code" +msgstr "项目编号" + +msgid "project name" +msgstr "项目名称" + +msgid "status" +msgstr "状态" + +msgid "project type" +msgstr "性质" + +msgid "budget" +msgstr "预算金额" + +msgid "income" +msgstr "收入金额" + +msgid "expand" +msgstr "支出金额" + +msgid "blueprint" +msgstr "技术/图纸" + +msgid "offer sheet" +msgstr "报价单" + +msgid "business document" +msgstr "商务/标书" + +msgid "related users" +msgstr "关系人" + +msgid "trade" +msgstr "经济行业" + +msgid "brand" +msgstr "品牌" + +msgid "category" +msgstr "分类" + +msgid "path" +msgstr "路径" + +msgid "material" +msgstr "物料" + +msgid "material code" +msgstr "物料编号" + +msgid "material name" +msgstr "物料名称" + +msgid "bar code" +msgstr "条形码" + +msgid "specifications" +msgstr "规格型号" + +msgid "is equipment" +msgstr "设备?" + +msgid "can sale" +msgstr "可销售" + +msgid "warehouse" +msgstr "仓库" + +msgid "measure" +msgstr "计量单位" + +msgid "stock price" +msgstr "库存单价" + +msgid "purchase price" +msgstr "采购单价" + +msgid "sale price" +msgstr "销售单价" + +msgid "technical parameter" +msgstr "技术参数" + +msgid "technical value" +msgstr "参数值" + +msgid "value" +msgstr "值" + +msgid "location" +msgstr "位置" + +msgid "material category" +msgstr "物料分类" + +msgid "expenses account" +msgstr "费用科目" + +msgid "HR-DOMAIN" +msgstr "人事费用" + +msgid "OFFICE-DOMAIN" +msgstr "行政办公" + +msgid "PUBLIS-DOMAIN" +msgstr "运营公共" + +msgid "MUNADOMAIN" +msgstr "生产制造" + +msgid "BUSINESS" +msgstr "市场商务" + +msgid "OTHER" +msgstr "其他" + +msgid "employee number" +msgstr "工号" + +msgid "employee name" +msgstr "职员姓名" + +msgid "birthday" +msgstr "出生日期" + +msgid "gender" +msgstr "性别" + +msgid "id card" +msgstr "身份证号码" + +msgid "nationality" +msgstr "国籍" + +msgid "hometown" +msgstr "籍贯" + +msgid "home address" +msgstr "家庭住址" + +msgid "emergency contacts" +msgstr "紧急联系人/方式" + +msgid "office phone" +msgstr "办公电话" + +msgid "employee rank" +msgstr "职员职级" + +msgid "workday" +msgstr "参加工作日期" + +msgid "start date" +msgstr "入司日期" + +msgid "religion" +msgstr "宗教信仰" + +msgid "marital status" +msgstr "婚姻状况" + +msgid "political party" +msgstr "政治面貌" + +msgid "nation" +msgstr "民族" + +msgid "employ ygxs" +msgstr "用工形式" + +msgid "employ status" +msgstr "人员状态" + +msgid "employ category" +msgstr "人员类别" + +msgid "literacy" +msgstr "文化程度" + +msgid "major type" +msgstr "专业类别" + +msgid "major degree" +msgstr "学位" + +msgid "tag1 fzjr" +msgstr "复转军人?" + +msgid "tag2 dwld" +msgstr "党委负责人?" + +msgid "tag3 dsjs" +msgstr "董事监事?" + +msgid "tag4 byzk" +msgstr "兵役状况" + +msgid "employee" +msgstr "职员" + +msgid "special job" +msgstr "特殊工种?" + +msgid "family member" +msgstr "家庭成员" + +msgid "education experience" +msgstr "教育履历" + +msgid "work experience" +msgstr "工作履历" + +msgid "social status" +msgstr "人员身份" + +msgid "emergency" +msgstr "紧急联系人?" + +msgid "edu type" +msgstr "教育类型" + +msgid "school" +msgstr "毕业学校" + +msgid "major" +msgstr "专业" + +msgid "family title" +msgstr "成员称谓" + +msgid "health" +msgstr "健康状况" + +msgid "Content Types" +msgstr "内容类型" + +msgid "workflow model" +msgstr "工作流模型" + +msgid "workflow code" +msgstr "编号" + +msgid "workflow name" +msgstr "工作流名称" + +msgid "app name" +msgstr "应用名称" + +msgid "model name" +msgstr "模型名称" + +msgid "node code" +msgstr "节点编号" + +msgid "node name" +msgstr "节点名称" + +msgid "tooltip words" +msgstr "提示语" + +msgid "start node" +msgstr "起始节点?" + +msgid "stop node" +msgstr "结束节点?" + +msgid "can terminate" +msgstr "允许终止?" + +msgid "can deny" +msgstr "允许拒绝?" + +msgid "email notice" +msgstr "邮件通知?" + +msgid "short message notice" +msgstr "短信通知?" + +msgid "approve node" +msgstr "批准节点" + +msgid "handler" +msgstr "处理人" + +msgid "workflow node" +msgstr "工作流节点" + +msgid "NEW" +msgstr "新建" + +msgid "IN PROGRESS" +msgstr "处理中" + +msgid "DENY" +msgstr "拒绝" + +msgid "TERMINATED" +msgstr "已终止审批" + +msgid "APPROVED" +msgstr "已批准" + +msgid "start user" +msgstr "提交人" + +msgid "start time" +msgstr "提交时间" + +msgid "approved time" +msgstr "批准时间" + +msgid "current node" +msgstr "当前节点" + +msgid "SUBMIT" +msgstr "提交" + +msgid "AGREE" +msgstr "同意" + +msgid "object id" +msgstr "对象 ID" + +msgid "workflow instance" +msgstr "工作流实例" + +msgid "submitter" +msgstr "提交人" + +msgid "process time" +msgstr "处理时间" + +msgid "process type" +msgstr "处理类型" + +msgid "workflow history" +msgstr "审批记录" + +msgid "arrived time" +msgstr "到达时间" + +msgid "is read" +msgstr "已阅?" + +msgid "read time" +msgstr "阅读时间" + +msgid "workflow todo" +msgstr "待办任务" + +msgid "workflow" +msgstr "工作流" + +msgid "No, take me back" +msgstr "不,返回" + +msgid "submit" +msgstr "提交" + +msgid "Are you sure you want to submit the %(object_name)s \"%(escaped_object)s\"? " +msgstr "您确定要提交\"%(escaped_object)s\"进行审批吗?" + +msgid "next node" +msgstr "下一节点" + +msgid "designated department" +msgstr "部门范围" + +msgid "designated user" +msgstr "指定用户" + +msgid "designated role" +msgstr "指定角色" + +msgid "designated position" +msgstr "指定岗位" + +msgid "handler type" +msgstr "处理人类型" + +msgid "Please handle the request %(verbose)s:%(object)s" +msgstr "请审批单据:" + +msgid "node" +msgstr "节点" + +msgid "Workflow Memo" +msgstr "审批意见" + +msgid "Workflow History" +msgstr "审批历史" + +msgid "already read" +msgstr "已阅" + +msgid "unread" +msgstr "未阅" + +msgid "workflow started successfully" +msgstr "工作流提交成功" + +msgid "the object is already in workflow" +msgstr "对象已提交审批,请勿重复提交" + +msgid "agree" +msgstr "同意" + +msgid "deny" +msgstr "拒绝" + +msgid "terminate" +msgstr "终止" + +msgid "workflow approve" +msgstr "工作流审批" + +msgid "No workflow model was found" +msgstr "未配置工作流模型" + +msgid "you needs to config a workflow model for this content type" +msgstr "请在 工作流/工作流模型 中配置本业务的流程模型" + +msgid "Hold down \"Control\", or \"Command\" on a Mac, to select more than one." +msgstr "按住\"Ctrl\"键或者Mac上的\"Command\"键进行多选" + +msgid "No user was configured to handle this node" +msgstr "本节点未配置处理人,请联系管理员配置处理人" + +msgid "current node is stop node,click the submit button to complete it" +msgstr "当前为流程最后一个环节,点击\"确定\"完成流程" + +msgid "workflow approved successfully" +msgstr "工作流审批成功" + +msgid "COMPLETED" +msgstr "完成" + +msgid "Summary" +msgstr "摘要" + +msgid "Objects" +msgstr "对象清单" + +msgid "your apply has been denied,you can restart a new apply" +msgstr "您的申请未获得批准,您可重新启动申请" + +msgid "restart workflow" +msgstr "重新启动" + +msgid "work order" +msgstr "工单" + +msgid "work orders" +msgstr "工单" + +msgid "classification" +msgstr "分类" + +msgid "business domain" +msgstr "业务域" + +msgid "workorder apply" +msgstr "工单服务" + +msgid "workorder code" +msgstr "工单编号" + +msgid "title" +msgstr "标题" + +msgid "amount" +msgstr "数量" + +msgid "price" +msgstr "单价" + +msgid "service name" +msgstr "服务名称" + +msgid "refer wo" +msgstr "参考工单" + +msgid "self help" +msgstr "个人自助" + +msgid "extra values" +msgstr "扩展信息" + +msgid "workorder items" +msgstr "工单明细" + +msgid "extra param" +msgstr "扩展参数" + +msgid "extra params" +msgstr "扩展参数" + +msgid "param value" +msgstr "值" + +msgid "data type" +msgstr "数据类别" + +msgid "data source" +msgstr "数据源" + +msgid "DATE" +msgstr "日期" + +msgid "NUMBER" +msgstr "数字" + +msgid "loans" +msgstr "借款申请" + +msgid "loan" +msgstr "借款申请" + +msgid "reimbursement" +msgstr "费用报销" + +msgid "reimbursements" +msgstr "费用报销" + +msgid "fee item" +msgstr "费用明细" + +msgid "fee items" +msgstr "费用明细" + +msgid "fee code" +msgstr "单据编号" + +msgid "loan code" +msgstr "单据编号" + +msgid "loan amount" +msgstr "借款金额" + +msgid "logout time" +msgstr "核销时间" + +msgid "logout amount" +msgstr "核销金额" + +msgid "amount of money" +msgstr "金额" + +msgid "cost center" +msgstr "成本中心" + +msgid "loan record" +msgstr "借款单据" + +msgid "pay amount" +msgstr "支付金额" + +msgid "occur date" +msgstr "发生日期" + +msgid "fico" +msgstr "财务信息" + +msgid "Authentication and Authorization" +msgstr "认证授权" + +msgid "human resource" +msgstr "人力资源" + +msgid "salary items" +msgstr "工资项" + +msgid "salary item" +msgstr "工资项" + +msgid "plus or minus" +msgstr "增减属性" + +msgid "employee entries" +msgstr "人员入职" + +msgid "employee entry" +msgstr "人员入职" + +msgid "designate position" +msgstr "拟任岗位" + +msgid "mail address" +msgstr "邮寄地址" + +msgid "profile" +msgstr "简历信息" + +msgid "org distribute" +msgstr "组织分配" + +msgid "guider" +msgstr "指导老师" + +msgid "calculate way" +msgstr "计算方式" + +msgid "fixed value" +msgstr "固定值" + +msgid "base value" +msgstr "基数值" + +msgid "org percent" +msgstr "公司比例" + +msgid "employee percent" +msgstr "员工比例" + +msgid "probation months" +msgstr "试聘期" + +msgid "probation begin" +msgstr "试聘开始" + +msgid "probation end" +msgstr "试聘结束" + +msgid "is required" +msgstr "必需?" + +msgid "extra value" +msgstr "扩展信息" + +msgid "workorder item" +msgstr "工单明细" + +msgid "inventory manage" +msgstr "库存管理" + +msgid "Initial Inventory" +msgstr "期初库存" + +msgid "StockIn" +msgstr "入库单" + +msgid "StockOut" +msgstr "领料单" + +msgid "execute time" +msgstr "执行时间" + +msgid "in items" +msgstr "入库明细" + +msgid "in item" +msgstr "入库明细" + +msgid "out items" +msgstr "出库明细" + +msgid "out item" +msgstr "出库明细" + +msgid "init item" +msgstr "期初明细" + +msgid "PLUS" +msgstr "增加" + +msgid "MINUS" +msgstr "减少" + +msgid "EXECUTED" +msgstr "已执行" + +msgid "QUALITY TESTING" +msgstr "质检" + +msgid "purchase manage" +msgstr "采购管理" + +msgid "purchase orders" +msgstr "采购单" + +msgid "purchase order" +msgstr "采购单" + +msgid "order date" +msgstr "订单日期" + +msgid "arrive date" +msgstr "交货日期" + +msgid "count" +msgstr "数量" + +msgid "money amount" +msgstr "金额" + +msgid "discount amount" +msgstr "折扣金额" + +msgid "tax rate" +msgstr "税率" + +msgid "po item" +msgstr "采购明细" + +msgid "discount price" +msgstr "折后单价" + +msgid "batch" +msgstr "批次号" + +msgid "Action Stock In" +msgstr "入库" + +msgid "Action Stock Out" +msgstr "出库" + +msgid "money of amount" +msgstr "金额" + +msgid "stock in money of amount" +msgstr "入库金额" + +msgid "entry time" +msgstr "入库时间" + +msgid "ALREADY STOCK IN" +msgstr "已入库" + +msgid "Inventory" +msgstr "实时库存" + +msgid "CHAR" +msgstr "字符" + +msgid "inventory material" +msgstr "库存物资" + +msgid "stock out time" +msgstr "出库时间" + +msgid "stock out amount" +msgstr "出库金额" + +msgid "Invoice" +msgstr "发票" + +msgid "invoice date" +msgstr "发票日期" + +msgid "invoice code" +msgstr "发票代码" + +msgid "invoice number" +msgstr "发票编号" + +msgid "po amount" +msgstr "采购金额" + +msgid "invoice amount" +msgstr "发票金额" + +msgid "invoice file" +msgstr "发票文件" + +msgid "pay date" +msgstr "付款日期" + +msgid "pay code" +msgstr "付款编号" + +msgid "response code" +msgstr "银行回执" + +msgid "Payment" +msgstr "采购付款" + +msgid "activity" +msgstr "活动" + +msgid "activities" +msgstr "活动" + +msgid "begin time" +msgstr "开始时间" + +msgid "end time" +msgstr "结束时间" + +msgid "host" +msgstr "主持人" + +msgid "speaker" +msgstr "主讲人" + +msgid "room" +msgstr "房间/会议室" + +msgid "mail list" +msgstr "邮件组" + +msgid "mail notice" +msgstr "邮件通知" + +msgid "weixin notice" +msgstr "微信通知" + +msgid "attach" +msgstr "附件" + +msgid "Meeting" +msgstr "会议" + +msgid "Train" +msgstr "培训" + +msgid "Community" +msgstr "集体活动" + +msgid "out user" +msgstr "领料人" + +msgid "other info" +msgstr "其他信息" + +msgid "InOut History" +msgstr "出入库历史" + +msgid "source" +msgstr "原始单据" + +msgid "plus or minus prop" +msgstr "增减属性" + +msgid "deliver address" +msgstr "交付地址" + +msgid "deliver date" +msgstr "交付日期" + +msgid "sales man" +msgstr "销售员" + +msgid "invoice type" +msgstr "发票类型" + +msgid "sale management" +msgstr "销售管理" + +msgid "sale order" +msgstr "销售订单" + +msgid "order detail" +msgstr "订单明细" + +msgid "Payment Collection" +msgstr "销售回款" + +msgid "collection date" +msgstr "回款日期" + +msgid "collection code" +msgstr "回款单号" + +msgid "order amount" +msgstr "合同金额" + +msgid "collection amount" +msgstr "到账金额" + +msgid "offer detail" +msgstr "报价明细" + +msgid "offer date" +msgstr "报价日期" + +msgid "offer man" +msgstr "报价员" + +msgid "offer sheet file" +msgstr "报价表" + +msgid "cost price" +msgstr "成本单价" + +msgid "mt type" +msgstr "物料性质" + +msgid "ware return" +msgstr "返库单" + +msgid "return item" +msgstr "返库明细" + +msgid "out count" +msgstr "领料数量" + +msgid "Action Ware Return" +msgstr "执行返库" + +msgid "ware adjust" +msgstr "库存调整" + +msgid "adjust item" +msgstr "调整明细" + +msgid "plus or minus property" +msgstr "增减属性" + +msgid "Action Ware Adjust" +msgstr "执行调整" + +msgid "data import" +msgstr "导入" + +msgid "date" +msgstr "日期" + +msgid "clear old data?" +msgstr "清除旧数据?" + +msgid "handler class" +msgstr "处理类" + +msgid "import" +msgstr "导入" + +msgid "action" +msgstr "执行" + +msgid "data import successfully" +msgstr "数据导入成功" + +msgid "applier" +msgstr "申请人" + +msgid "pay" +msgstr "支付" + +msgid "PAYED" +msgstr "已支付" + +msgid "action successfully" +msgstr "执行成功" + +msgid "Are your sure to execute the operations?" +msgstr "您确认要执行本操作吗?" + +msgid "to be imported detail" +msgstr "待导入明细" + +msgid "draft" +msgstr "草稿" + +msgid "published" +msgstr "已发布" + +msgid "keywords" +msgstr "关键词" + +msgid "BUSINESS DOC" +msgstr "业务文档" + +msgid "SYSTEM MANUAL" +msgstr "系统手册" + +msgid "document" +msgstr "文档" + +msgid "documents" +msgstr "文档" + +msgid "%(app)s administration" +msgstr "%(app)s 模块" + +msgid "next user handler" +msgstr "next用户处理类" + +msgid "next node handler" +msgstr "next节点处理类" + +msgid "status field" +msgstr "状态字段" + +msgid "status value" +msgstr "状态值" + +msgid "execute action" +msgstr "执行动作" + +msgid "can edit" +msgstr "可编辑?" + +msgid "attention" +msgstr "注意" + +msgid "is done" +msgstr "已办?" + +msgid "Are you sure to deny the request?" +msgstr "您确定要拒绝申请吗?" + +msgid "Are you sure to terminate the request?" +msgstr "您确定要终止申请吗?" + +msgid "workflow restarted success" +msgstr "工作流重启成功" + +msgid "export selected %(verbose_name_plural)s" +msgstr "导出所选的 %(verbose_name_plural)s" + +msgid "publish selected %(verbose_name_plural)s" +msgstr "发布所选的 %(verbose_name_plural)s" + +msgid "Are your sure to execute the check out operations?" +msgstr "您确定要执行出库操作吗?" + +msgid "check out successfully" +msgstr "已成功出库" + +msgid "check in successfully" +msgstr "已成功入库" \ No newline at end of file diff --git a/locale/zh_Hans/LC_MESSAGES/django.po b/locale/zh_Hans/LC_MESSAGES/django.po new file mode 100644 index 0000000..e3a7092 --- /dev/null +++ b/locale/zh_Hans/LC_MESSAGES/django.po @@ -0,0 +1,1453 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-05-01 19:18+0800\n" +"PO-Revision-Date: 2026-06-10 12:00+0800\n" +"Last-Translator: \n" +"Language-Team: zh_Hans\n" +"Language: zh_Hans\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: .\basedata\apps.py:9 +msgid "BaseData" +msgstr "基础数据" + +#: .\basedata\models.py:16 +msgid "list code" +msgstr "编号" + +#: .\basedata\models.py:17 +msgid "list name" +msgstr "名称" + +#: .\basedata\models.py:18 .\syscfg\models.py:40 .\syscfg\models.py:41 +#: .\syscfg\models.py:48 +msgid "module" +msgstr "模块" + +#: .\basedata\models.py:19 .\basedata\models.py:38 .\organ\models.py:16 +#: .\organ\models.py:60 .\syscfg\models.py:37 .\syscfg\models.py:54 +#: .\syscfg\models.py:68 +msgid "in use" +msgstr "在用?" + +#: .\basedata\models.py:20 +msgid "is init" +msgstr "初始数据?" + +#: .\basedata\models.py:21 +msgid "is locked" +msgstr "锁定?" + +#: .\basedata\models.py:22 +msgid "locked by" +msgstr "锁定用户" + +#: .\basedata\models.py:23 +msgid "locked time" +msgstr "锁定时间" + +#: .\basedata\models.py:26 .\basedata\models.py:27 +msgid "value list" +msgstr "值列表" + +#: .\basedata\models.py:34 +msgid "list group" +msgstr "值列表组" + +#: .\basedata\models.py:36 +msgid "item code" +msgstr "项编号" + +#: .\basedata\models.py:37 +msgid "item name" +msgstr "项名称" + +#: .\basedata\models.py:39 .\organ\models.py:34 .\organ\models.py:66 +#: .\organ\models.py:104 .\syscfg\models.py:34 .\syscfg\models.py:52 +msgid "weight" +msgstr "排序权重" + +#: .\basedata\models.py:53 .\basedata\models.py:54 +msgid "list item" +msgstr "列表项" + +#: .\basedata\models.py:63 .\basedata\models.py:73 .\basedata\models.py:74 +#: .\organ\models.py:23 +msgid "address" +msgstr "地址" + +#: .\basedata\models.py:64 .\organ\models.py:24 +msgid "zipcode" +msgstr "邮编" + +#: .\basedata\models.py:65 .\basedata\models.py:105 .\organ\models.py:27 +#: .\organ\models.py:63 +msgid "phone" +msgstr "联系电话" + +#: .\basedata\models.py:66 .\basedata\models.py:104 .\organ\models.py:26 +#: .\organ\models.py:64 +msgid "contacts" +msgstr "联系人" + +#: .\basedata\models.py:82 +msgid "Customer" +msgstr "客户" + +#: .\basedata\models.py:83 +msgid "Supplier" +msgstr "供应商" + +#: .\basedata\models.py:93 +msgid "partner code" +msgstr "合作伙伴编号" + +#: .\basedata\models.py:94 +msgid "partner name" +msgstr "名称" + +#: .\basedata\models.py:95 .\organ\models.py:14 .\organ\models.py:57 +#: .\organ\models.py:96 +msgid "short name" +msgstr "简称" + +#: .\basedata\models.py:96 .\organ\models.py:15 .\organ\models.py:58 +#: .\organ\models.py:97 +msgid "pinyin" +msgstr "拼音/英语" + +#: .\basedata\models.py:97 .\organ\models.py:59 +msgid "type" +msgstr "类别" + +#: .\basedata\models.py:98 +msgid "level" +msgstr "等级" + +#: .\basedata\models.py:100 .\organ\models.py:18 +msgid "tax num" +msgstr "纳税识别号" + +#: .\basedata\models.py:101 .\organ\models.py:19 +msgid "tax address" +msgstr "开票地址/电话" + +#: .\basedata\models.py:102 .\organ\models.py:20 +msgid "tax account" +msgstr "发票开户行" + +#: .\basedata\models.py:106 .\basedata\models.py:119 +msgid "memo" +msgstr "备注" + +#: .\basedata\models.py:109 .\basedata\models.py:110 .\basedata\models.py:120 +msgid "partner" +msgstr "合作伙伴" + +#: .\basedata\models.py:117 +msgid "account num" +msgstr "银行帐号" + +#: .\basedata\models.py:118 +msgid "bank name" +msgstr "开户行" + +#: .\basedata\models.py:123 .\basedata\models.py:124 +msgid "bank account" +msgstr "银行账户" + +#: .\common\const.py:20 +msgid "OFF" +msgstr "关闭" + +#: .\common\const.py:21 +msgid "ON" +msgstr "开启" + +#: .\common\generic.py:31 .\syscfg\models.py:13 +msgid "begin date" +msgstr "开始日期" + +#: .\common\generic.py:32 .\syscfg\models.py:14 +msgid "end date" +msgstr "结束日期" + +#: .\common\generic.py:33 +msgid "creator" +msgstr "创建用户" + +#: .\common\generic.py:34 +msgid "modifier" +msgstr "修改用户" + +#: .\common\generic.py:35 +msgid "creation" +msgstr "创建时间" + +#: .\common\generic.py:36 +msgid "modification" +msgstr "修改时间" + +#: .\organ\apps.py:9 .\organ\models.py:37 .\organ\models.py:38 +#: .\organ\models.py:54 +msgid "organization" +msgstr "组织机构" + +#: .\organ\models.py:12 .\organ\models.py:55 +msgid "organ code" +msgstr "机构编号" + +#: .\organ\models.py:13 .\organ\models.py:56 +msgid "organ name" +msgstr "机构名称" + +#: .\organ\models.py:22 +msgid "representative " +msgstr "法人代表" + +#: .\organ\models.py:25 .\organ\models.py:62 +msgid "fax" +msgstr "传真" + +#: .\organ\models.py:28 +msgid "website" +msgstr "网址" + +#: .\organ\models.py:29 .\organ\models.py:65 +msgid "email" +msgstr "邮箱" + +#: .\organ\models.py:30 +msgid "license code" +msgstr "营业执照代码" + +#: .\organ\models.py:31 +msgid "certificate code" +msgstr "组织机构代码" + +#: .\organ\models.py:32 +msgid "business license" +msgstr "营业执照" + +#: .\organ\models.py:33 +msgid "organization code certificate" +msgstr "组织机构证书" + +#: .\organ\models.py:46 +msgid "BRANCH" +msgstr "分公司/事业部" + +#: .\organ\models.py:47 +msgid "DEPARTMENT" +msgstr "一级部门" + +#: .\organ\models.py:48 +msgid "OFFICE" +msgstr "二级部门/处室/科室" + +#: .\organ\models.py:49 +msgid "TEAM" +msgstr "组/班" + +#: .\organ\models.py:50 +msgid "COMMITTEE" +msgstr "委员会" + +#: .\organ\models.py:53 .\organ\models.py:93 .\syscfg\models.py:36 +#: .\syscfg\models.py:69 +msgid "parent" +msgstr "父级" + +#: .\organ\models.py:61 .\organ\models.py:100 +msgid "is virtual" +msgstr "虚拟?" + +#: .\organ\models.py:69 .\organ\models.py:70 .\organ\models.py:92 +msgid "org unit" +msgstr "组织单元" + +#: .\organ\models.py:78 +msgid "Admin Position" +msgstr "管理类" + +#: .\organ\models.py:79 +msgid "Sale Position" +msgstr "营销类" + +#: .\organ\models.py:80 +msgid "Technology Position" +msgstr "技术类" + +#: .\organ\models.py:81 +msgid "Produce Position" +msgstr "生产/操作类" + +#: .\organ\models.py:85 +msgid "BASIC" +msgstr "基础" + +#: .\organ\models.py:86 +msgid "MEDIUM" +msgstr "中等" + +#: .\organ\models.py:87 +msgid "SENIOR" +msgstr "高级" + +#: .\organ\models.py:88 +msgid "PROFESSOR" +msgstr "教授" + +#: .\organ\models.py:89 +msgid "EXPERT" +msgstr "专家" + +#: .\organ\models.py:94 +msgid "position code" +msgstr "岗位编号" + +#: .\organ\models.py:95 +msgid "position name" +msgstr "岗位名称" + +#: .\organ\models.py:98 +msgid "position series" +msgstr "岗位序列" + +#: .\organ\models.py:99 +msgid "position grade" +msgstr "岗位级别" + +#: .\organ\models.py:101 +msgid "position description" +msgstr "岗位说明" + +#: .\organ\models.py:102 +msgid "qualification" +msgstr "任职资格" + +#: .\organ\models.py:103 +msgid "reference" +msgstr "参考资料" + +#: .\organ\models.py:107 .\organ\models.py:108 +msgid "position" +msgstr "岗位" + +#: .\syscfg\apps.py:9 +msgid "SysConfig" +msgstr "系统配置" + +#: .\syscfg\models.py:15 +msgid "site name" +msgstr "站点名称" + +#: .\syscfg\models.py:16 +msgid "site description" +msgstr "描述信息" + +#: .\syscfg\models.py:17 +msgid "administrator" +msgstr "管理员" + +#: .\syscfg\models.py:23 .\syscfg\models.py:24 +msgid "Site" +msgstr "站点" + +#: .\syscfg\models.py:31 +msgid "module code" +msgstr "模块编号" + +#: .\syscfg\models.py:32 +msgid "module name" +msgstr "模块名称" + +#: .\syscfg\models.py:33 +msgid "module url" +msgstr "URL" + +#: .\syscfg\models.py:35 .\syscfg\models.py:53 +msgid "style class" +msgstr "样式类" + +#: .\syscfg\models.py:49 +msgid "menu code" +msgstr "菜单编号" + +#: .\syscfg\models.py:50 +msgid "menu name" +msgstr "菜单名称" + +#: .\syscfg\models.py:51 +msgid "menu url" +msgstr "URL" + +#: .\syscfg\models.py:57 .\syscfg\models.py:58 +msgid "menu" +msgstr "菜单" + +#: .\syscfg\models.py:65 +msgid "role code" +msgstr "角色编号" + +#: .\syscfg\models.py:66 +msgid "role name" +msgstr "角色名称" + +#: .\syscfg\models.py:67 +msgid "description" +msgstr "描述信息" + +#: .\syscfg\models.py:70 +msgid "role users" +msgstr "分配用户" + +#: .\syscfg\models.py:71 +msgid "role menus" +msgstr "分配菜单" + +#: .\syscfg\models.py:74 .\syscfg\models.py:75 +msgid "role" +msgstr "角色" + +msgid "code" +msgstr "编号" + +msgid "address type" +msgstr "地址类型" + +msgid "project" +msgstr "项目" + +msgid "project code" +msgstr "项目编号" + +msgid "project name" +msgstr "项目名称" + +msgid "status" +msgstr "状态" + +msgid "project type" +msgstr "性质" + +msgid "budget" +msgstr "预算金额" + +msgid "income" +msgstr "收入金额" + +msgid "expand" +msgstr "支出金额" + +msgid "blueprint" +msgstr "技术/图纸" + +msgid "offer sheet" +msgstr "报价单" + +msgid "business document" +msgstr "商务/标书" + +msgid "related users" +msgstr "关系人" + +msgid "trade" +msgstr "经济行业" + +msgid "brand" +msgstr "品牌" + +msgid "category" +msgstr "分类" + +msgid "path" +msgstr "路径" + +msgid "material" +msgstr "物料" + +msgid "material code" +msgstr "物料编号" + +msgid "material name" +msgstr "物料名称" + +msgid "bar code" +msgstr "条形码" + +msgid "specifications" +msgstr "规格型号" + +msgid "is equipment" +msgstr "设备?" + +msgid "can sale" +msgstr "可销售" + +msgid "warehouse" +msgstr "仓库" + +msgid "measure" +msgstr "计量单位" + +msgid "stock price" +msgstr "库存单价" + +msgid "purchase price" +msgstr "采购单价" + +msgid "sale price" +msgstr "销售单价" + +msgid "technical parameter" +msgstr "技术参数" + +msgid "technical value" +msgstr "参数值" + +msgid "value" +msgstr "值" + +msgid "location" +msgstr "位置" + +msgid "material category" +msgstr "物料分类" + +msgid "expenses account" +msgstr "费用科目" + +msgid "HR-DOMAIN" +msgstr "人事费用" + +msgid "OFFICE-DOMAIN" +msgstr "行政办公" + +msgid "PUBLIS-DOMAIN" +msgstr "运营公共" + +msgid "MUNADOMAIN" +msgstr "生产制造" + +msgid "BUSINESS" +msgstr "市场商务" + +msgid "OTHER" +msgstr "其他" + +msgid "employee number" +msgstr "工号" + +msgid "employee name" +msgstr "职员姓名" + +msgid "birthday" +msgstr "出生日期" + +msgid "gender" +msgstr "性别" + +msgid "id card" +msgstr "身份证号码" + +msgid "nationality" +msgstr "国籍" + +msgid "hometown" +msgstr "籍贯" + +msgid "home address" +msgstr "家庭住址" + +msgid "emergency contacts" +msgstr "紧急联系人/方式" + +msgid "office phone" +msgstr "办公电话" + +msgid "employee rank" +msgstr "职员职级" + +msgid "workday" +msgstr "参加工作日期" + +msgid "start date" +msgstr "入司日期" + +msgid "religion" +msgstr "宗教信仰" + +msgid "marital status" +msgstr "婚姻状况" + +msgid "political party" +msgstr "政治面貌" + +msgid "nation" +msgstr "民族" + +msgid "employ ygxs" +msgstr "用工形式" + +msgid "employ status" +msgstr "人员状态" + +msgid "employ category" +msgstr "人员类别" + +msgid "literacy" +msgstr "文化程度" + +msgid "major type" +msgstr "专业类别" + +msgid "major degree" +msgstr "学位" + +msgid "tag1 fzjr" +msgstr "复转军人?" + +msgid "tag2 dwld" +msgstr "党委负责人?" + +msgid "tag3 dsjs" +msgstr "董事监事?" + +msgid "tag4 byzk" +msgstr "兵役状况" + +msgid "employee" +msgstr "职员" + +msgid "special job" +msgstr "特殊工种?" + +msgid "family member" +msgstr "家庭成员" + +msgid "education experience" +msgstr "教育履历" + +msgid "work experience" +msgstr "工作履历" + +msgid "social status" +msgstr "人员身份" + +msgid "emergency" +msgstr "紧急联系人?" + +msgid "edu type" +msgstr "教育类型" + +msgid "school" +msgstr "毕业学校" + +msgid "major" +msgstr "专业" + +msgid "family title" +msgstr "成员称谓" + +msgid "health" +msgstr "健康状况" + +msgid "Content Types" +msgstr "内容类型" + +msgid "workflow model" +msgstr "工作流模型" + +msgid "workflow code" +msgstr "编号" + +msgid "workflow name" +msgstr "工作流名称" + +msgid "app name" +msgstr "应用名称" + +msgid "model name" +msgstr "模型名称" + +msgid "node code" +msgstr "节点编号" + +msgid "node name" +msgstr "节点名称" + +msgid "tooltip words" +msgstr "提示语" + +msgid "start node" +msgstr "起始节点?" + +msgid "stop node" +msgstr "结束节点?" + +msgid "can terminate" +msgstr "允许终止?" + +msgid "can deny" +msgstr "允许拒绝?" + +msgid "email notice" +msgstr "邮件通知?" + +msgid "short message notice" +msgstr "短信通知?" + +msgid "approve node" +msgstr "批准节点" + +msgid "handler" +msgstr "处理人" + +msgid "workflow node" +msgstr "工作流节点" + +msgid "NEW" +msgstr "新建" + +msgid "IN PROGRESS" +msgstr "处理中" + +msgid "DENY" +msgstr "拒绝" + +msgid "TERMINATED" +msgstr "已终止审批" + +msgid "APPROVED" +msgstr "已批准" + +msgid "start user" +msgstr "提交人" + +msgid "start time" +msgstr "提交时间" + +msgid "approved time" +msgstr "批准时间" + +msgid "current node" +msgstr "当前节点" + +msgid "SUBMIT" +msgstr "提交" + +msgid "AGREE" +msgstr "同意" + +msgid "object id" +msgstr "对象 ID" + +msgid "workflow instance" +msgstr "工作流实例" + +msgid "submitter" +msgstr "提交人" + +msgid "process time" +msgstr "处理时间" + +msgid "process type" +msgstr "处理类型" + +msgid "workflow history" +msgstr "审批记录" + +msgid "arrived time" +msgstr "到达时间" + +msgid "is read" +msgstr "已阅?" + +msgid "read time" +msgstr "阅读时间" + +msgid "workflow todo" +msgstr "待办任务" + +msgid "workflow" +msgstr "工作流" + +msgid "No, take me back" +msgstr "不,返回" + +msgid "submit" +msgstr "提交" + +msgid "Are you sure you want to submit the %(object_name)s \"%(escaped_object)s\"? " +msgstr "您确定要提交\"%(escaped_object)s\"进行审批吗?" + +msgid "next node" +msgstr "下一节点" + +msgid "designated department" +msgstr "部门范围" + +msgid "designated user" +msgstr "指定用户" + +msgid "designated role" +msgstr "指定角色" + +msgid "designated position" +msgstr "指定岗位" + +msgid "handler type" +msgstr "处理人类型" + +msgid "Please handle the request %(verbose)s:%(object)s" +msgstr "请审批单据:" + +msgid "node" +msgstr "节点" + +msgid "Workflow Memo" +msgstr "审批意见" + +msgid "Workflow History" +msgstr "审批历史" + +msgid "already read" +msgstr "已阅" + +msgid "unread" +msgstr "未阅" + +msgid "workflow started successfully" +msgstr "工作流提交成功" + +msgid "the object is already in workflow" +msgstr "对象已提交审批,请勿重复提交" + +msgid "agree" +msgstr "同意" + +msgid "deny" +msgstr "拒绝" + +msgid "terminate" +msgstr "终止" + +msgid "workflow approve" +msgstr "工作流审批" + +msgid "No workflow model was found" +msgstr "未配置工作流模型" + +msgid "you needs to config a workflow model for this content type" +msgstr "请在 工作流/工作流模型 中配置本业务的流程模型" + +msgid "Hold down \"Control\", or \"Command\" on a Mac, to select more than one." +msgstr "按住\"Ctrl\"键或者Mac上的\"Command\"键进行多选" + +msgid "No user was configured to handle this node" +msgstr "本节点未配置处理人,请联系管理员配置处理人" + +msgid "current node is stop node,click the submit button to complete it" +msgstr "当前为流程最后一个环节,点击\"确定\"完成流程" + +msgid "workflow approved successfully" +msgstr "工作流审批成功" + +msgid "COMPLETED" +msgstr "完成" + +msgid "Summary" +msgstr "摘要" + +msgid "Objects" +msgstr "对象清单" + +msgid "your apply has been denied,you can restart a new apply" +msgstr "您的申请未获得批准,您可重新启动申请" + +msgid "restart workflow" +msgstr "重新启动" + +msgid "work order" +msgstr "工单" + +msgid "work orders" +msgstr "工单" + +msgid "classification" +msgstr "分类" + +msgid "business domain" +msgstr "业务域" + +msgid "workorder apply" +msgstr "工单服务" + +msgid "workorder code" +msgstr "工单编号" + +msgid "title" +msgstr "标题" + +msgid "amount" +msgstr "数量" + +msgid "price" +msgstr "单价" + +msgid "service name" +msgstr "服务名称" + +msgid "refer wo" +msgstr "参考工单" + +msgid "self help" +msgstr "个人自助" + +msgid "extra values" +msgstr "扩展信息" + +msgid "workorder items" +msgstr "工单明细" + +msgid "extra param" +msgstr "扩展参数" + +msgid "extra params" +msgstr "扩展参数" + +msgid "param value" +msgstr "值" + +msgid "data type" +msgstr "数据类别" + +msgid "data source" +msgstr "数据源" + +msgid "DATE" +msgstr "日期" + +msgid "NUMBER" +msgstr "数字" + +msgid "loans" +msgstr "借款申请" + +msgid "loan" +msgstr "借款申请" + +msgid "reimbursement" +msgstr "费用报销" + +msgid "reimbursements" +msgstr "费用报销" + +msgid "fee item" +msgstr "费用明细" + +msgid "fee items" +msgstr "费用明细" + +msgid "fee code" +msgstr "单据编号" + +msgid "loan code" +msgstr "单据编号" + +msgid "loan amount" +msgstr "借款金额" + +msgid "logout time" +msgstr "核销时间" + +msgid "logout amount" +msgstr "核销金额" + +msgid "amount of money" +msgstr "金额" + +msgid "cost center" +msgstr "成本中心" + +msgid "loan record" +msgstr "借款单据" + +msgid "pay amount" +msgstr "支付金额" + +msgid "occur date" +msgstr "发生日期" + +msgid "fico" +msgstr "财务信息" + +msgid "Authentication and Authorization" +msgstr "认证授权" + +msgid "human resource" +msgstr "人力资源" + +msgid "salary items" +msgstr "工资项" + +msgid "salary item" +msgstr "工资项" + +msgid "plus or minus" +msgstr "增减属性" + +msgid "employee entries" +msgstr "人员入职" + +msgid "employee entry" +msgstr "人员入职" + +msgid "designate position" +msgstr "拟任岗位" + +msgid "mail address" +msgstr "邮寄地址" + +msgid "profile" +msgstr "简历信息" + +msgid "org distribute" +msgstr "组织分配" + +msgid "guider" +msgstr "指导老师" + +msgid "calculate way" +msgstr "计算方式" + +msgid "fixed value" +msgstr "固定值" + +msgid "base value" +msgstr "基数值" + +msgid "org percent" +msgstr "公司比例" + +msgid "employee percent" +msgstr "员工比例" + +msgid "probation months" +msgstr "试聘期" + +msgid "probation begin" +msgstr "试聘开始" + +msgid "probation end" +msgstr "试聘结束" + +msgid "is required" +msgstr "必需?" + +msgid "extra value" +msgstr "扩展信息" + +msgid "workorder item" +msgstr "工单明细" + +msgid "inventory manage" +msgstr "库存管理" + +msgid "Initial Inventory" +msgstr "期初库存" + +msgid "StockIn" +msgstr "入库单" + +msgid "StockOut" +msgstr "领料单" + +msgid "execute time" +msgstr "执行时间" + +msgid "in items" +msgstr "入库明细" + +msgid "in item" +msgstr "入库明细" + +msgid "out items" +msgstr "出库明细" + +msgid "out item" +msgstr "出库明细" + +msgid "init item" +msgstr "期初明细" + +msgid "PLUS" +msgstr "增加" + +msgid "MINUS" +msgstr "减少" + +msgid "EXECUTED" +msgstr "已执行" + +msgid "QUALITY TESTING" +msgstr "质检" + +msgid "purchase manage" +msgstr "采购管理" + +msgid "purchase orders" +msgstr "采购单" + +msgid "purchase order" +msgstr "采购单" + +msgid "order date" +msgstr "订单日期" + +msgid "arrive date" +msgstr "交货日期" + +msgid "count" +msgstr "数量" + +msgid "money amount" +msgstr "金额" + +msgid "discount amount" +msgstr "折扣金额" + +msgid "tax rate" +msgstr "税率" + +msgid "po item" +msgstr "采购明细" + +msgid "discount price" +msgstr "折后单价" + +msgid "batch" +msgstr "批次号" + +msgid "Action Stock In" +msgstr "入库" + +msgid "Action Stock Out" +msgstr "出库" + +msgid "money of amount" +msgstr "金额" + +msgid "stock in money of amount" +msgstr "入库金额" + +msgid "entry time" +msgstr "入库时间" + +msgid "ALREADY STOCK IN" +msgstr "已入库" + +msgid "Inventory" +msgstr "实时库存" + +msgid "CHAR" +msgstr "字符" + +msgid "inventory material" +msgstr "库存物资" + +msgid "stock out time" +msgstr "出库时间" + +msgid "stock out amount" +msgstr "出库金额" + +msgid "Invoice" +msgstr "发票" + +msgid "invoice date" +msgstr "发票日期" + +msgid "invoice code" +msgstr "发票代码" + +msgid "invoice number" +msgstr "发票编号" + +msgid "po amount" +msgstr "采购金额" + +msgid "invoice amount" +msgstr "发票金额" + +msgid "invoice file" +msgstr "发票文件" + +msgid "pay date" +msgstr "付款日期" + +msgid "pay code" +msgstr "付款编号" + +msgid "response code" +msgstr "银行回执" + +msgid "Payment" +msgstr "采购付款" + +msgid "activity" +msgstr "活动" + +msgid "activities" +msgstr "活动" + +msgid "begin time" +msgstr "开始时间" + +msgid "end time" +msgstr "结束时间" + +msgid "host" +msgstr "主持人" + +msgid "speaker" +msgstr "主讲人" + +msgid "room" +msgstr "房间/会议室" + +msgid "mail list" +msgstr "邮件组" + +msgid "mail notice" +msgstr "邮件通知" + +msgid "weixin notice" +msgstr "微信通知" + +msgid "attach" +msgstr "附件" + +msgid "Meeting" +msgstr "会议" + +msgid "Train" +msgstr "培训" + +msgid "Community" +msgstr "集体活动" + +msgid "out user" +msgstr "领料人" + +msgid "other info" +msgstr "其他信息" + +msgid "InOut History" +msgstr "出入库历史" + +msgid "source" +msgstr "原始单据" + +msgid "plus or minus prop" +msgstr "增减属性" + +msgid "deliver address" +msgstr "交付地址" + +msgid "deliver date" +msgstr "交付日期" + +msgid "sales man" +msgstr "销售员" + +msgid "invoice type" +msgstr "发票类型" + +msgid "sale management" +msgstr "销售管理" + +msgid "sale order" +msgstr "销售订单" + +msgid "order detail" +msgstr "订单明细" + +msgid "Payment Collection" +msgstr "销售回款" + +msgid "collection date" +msgstr "回款日期" + +msgid "collection code" +msgstr "回款单号" + +msgid "order amount" +msgstr "合同金额" + +msgid "collection amount" +msgstr "到账金额" + +msgid "offer detail" +msgstr "报价明细" + +msgid "offer date" +msgstr "报价日期" + +msgid "offer man" +msgstr "报价员" + +msgid "offer sheet file" +msgstr "报价表" + +msgid "cost price" +msgstr "成本单价" + +msgid "mt type" +msgstr "物料性质" + +msgid "ware return" +msgstr "返库单" + +msgid "return item" +msgstr "返库明细" + +msgid "out count" +msgstr "领料数量" + +msgid "Action Ware Return" +msgstr "执行返库" + +msgid "ware adjust" +msgstr "库存调整" + +msgid "adjust item" +msgstr "调整明细" + +msgid "plus or minus property" +msgstr "增减属性" + +msgid "Action Ware Adjust" +msgstr "执行调整" + +msgid "data import" +msgstr "导入" + +msgid "date" +msgstr "日期" + +msgid "clear old data?" +msgstr "清除旧数据?" + +msgid "handler class" +msgstr "处理类" + +msgid "import" +msgstr "导入" + +msgid "action" +msgstr "执行" + +msgid "data import successfully" +msgstr "数据导入成功" + +msgid "applier" +msgstr "申请人" + +msgid "pay" +msgstr "支付" + +msgid "PAYED" +msgstr "已支付" + +msgid "action successfully" +msgstr "执行成功" + +msgid "Are your sure to execute the operations?" +msgstr "您确认要执行本操作吗?" + +msgid "to be imported detail" +msgstr "待导入明细" + +msgid "draft" +msgstr "草稿" + +msgid "published" +msgstr "已发布" + +msgid "keywords" +msgstr "关键词" + +msgid "BUSINESS DOC" +msgstr "业务文档" + +msgid "SYSTEM MANUAL" +msgstr "系统手册" + +msgid "document" +msgstr "文档" + +msgid "documents" +msgstr "文档" + +msgid "%(app)s administration" +msgstr "%(app)s 模块" + +msgid "next user handler" +msgstr "next用户处理类" + +msgid "next node handler" +msgstr "next节点处理类" + +msgid "status field" +msgstr "状态字段" + +msgid "status value" +msgstr "状态值" + +msgid "execute action" +msgstr "执行动作" + +msgid "can edit" +msgstr "可编辑?" + +msgid "attention" +msgstr "注意" + +msgid "is done" +msgstr "已办?" + +msgid "Are you sure to deny the request?" +msgstr "您确定要拒绝申请吗?" + +msgid "Are you sure to terminate the request?" +msgstr "您确定要终止申请吗?" + +msgid "workflow restarted success" +msgstr "工作流重启成功" + +msgid "export selected %(verbose_name_plural)s" +msgstr "导出所选的 %(verbose_name_plural)s" + +msgid "publish selected %(verbose_name_plural)s" +msgstr "发布所选的 %(verbose_name_plural)s" + +msgid "Are your sure to execute the check out operations?" +msgstr "您确定要执行出库操作吗?" + +msgid "check out successfully" +msgstr "已成功出库" + +msgid "check in successfully" +msgstr "已成功入库" \ No newline at end of file diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..1620c50 --- /dev/null +++ b/manage.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mis.settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/midware/__init__.py b/midware/__init__.py new file mode 100644 index 0000000..db0afd1 --- /dev/null +++ b/midware/__init__.py @@ -0,0 +1 @@ +__author__ = 'Administrator' diff --git a/midware/cuser.py b/midware/cuser.py new file mode 100644 index 0000000..d8989e9 --- /dev/null +++ b/midware/cuser.py @@ -0,0 +1,176 @@ +__author__ = 'zhugl' +# created at 15-4-21 +#python import +from threading import local +from django.contrib import admin +from django.apps import apps +from django.conf import settings +from django.contrib.admin import ModelAdmin, actions +from django.contrib.auth import REDIRECT_FIELD_NAME +from django.core.exceptions import ImproperlyConfigured, PermissionDenied +from django.core.urlresolvers import NoReverseMatch, reverse +from django.db.models.base import ModelBase +from django.http import Http404, HttpResponseRedirect +from django.template.engine import Engine +from django.template.response import TemplateResponse +from django.utils import six +from django.utils.text import capfirst +from django.utils.translation import ugettext as _, ugettext_lazy +from django.views.decorators.cache import never_cache +from django.views.decorators.csrf import csrf_protect + +_thread_local = local() + + +def getuser(): + return getattr(_thread_local,'user',None) + + +class RequestUser(object): + + def process_request(self,request): + django_user = getattr(request,'user',None) + + if django_user is not None: + _thread_local.user = django_user + + def process_view(self, request, view_func, view_args, view_kwargs): + app_weight = {'selfhelp':1,'purchase':3,'sale':2,'invent':4,'organ':5,'basedata':6,'syscfg':7,'workflow':8} + if view_func.__name__ == 'index': + app_dict = {} + for model, model_admin in admin.site._registry.items(): + app_label = model._meta.app_label + has_module_perms = model_admin.has_module_permission(request) + + if has_module_perms: + perms = model_admin.get_model_perms(request) + if True in perms.values(): + info = (app_label, model._meta.model_name) + model_dict = { + 'name': capfirst(model._meta.verbose_name_plural), + 'object_name': model._meta.object_name, + 'perms': perms, + 'weight':getattr(model,'index_weight',99) + } + if perms.get('change', False): + try: + model_dict['admin_url'] = reverse('admin:%s_%s_changelist' % info, current_app=admin.site.name) + except NoReverseMatch: + pass + if perms.get('add', False): + try: + model_dict['add_url'] = reverse('admin:%s_%s_add' % info, current_app=admin.site.name) + except NoReverseMatch: + pass + if app_label in app_dict: + app_dict[app_label]['models'].append(model_dict) + else: + app_dict[app_label] = { + 'name': apps.get_app_config(app_label).verbose_name, + 'app_label': app_label, + 'app_url': reverse( + 'admin:app_list', + kwargs={'app_label': app_label}, + current_app=admin.site.name, + ), + 'has_module_perms': has_module_perms, + 'models': [model_dict], + 'weight':app_weight.get(app_label,99) + } + + app_list = list(six.itervalues(app_dict)) + app_list.sort(key=lambda x: x['weight']) + + for app in app_list: + app['models'].sort(key=lambda x: x['weight']) + + context = dict( + maxi_app_list=app_list, + ) + try: + todolist = self.get_my_task(request) + context.update(dict(todolist = todolist)) + except Exception,e: + pass + # print context + view_kwargs['extra_context'] = context + + if view_func.__name__ == 'app_index': + app_label = view_kwargs['app_label'] + app_name = apps.get_app_config(app_label).verbose_name + app_dict = {} + lib_dict = {} + for model, model_admin in admin.site._registry.items(): + if model_admin.has_module_permission(request): + label = model._meta.app_label + is_current = False + if label == app_label: + is_current = True + lib_dict[label] = { + 'name': apps.get_app_config(label).verbose_name, + 'app_label': label, + 'app_url': reverse( + 'admin:app_list', + kwargs={'app_label': label}, + current_app=admin.site.name, + ), + 'weight':app_weight.get(label,99), + 'is_current':is_current, + } + if app_label == model._meta.app_label: + has_module_perms = model_admin.has_module_permission(request) + if not has_module_perms: + raise PermissionDenied + + perms = model_admin.get_model_perms(request) + + if True in perms.values(): + info = (app_label, model._meta.model_name) + model_dict = { + 'name': capfirst(model._meta.verbose_name_plural), + 'object_name': model._meta.object_name, + 'perms': perms, + 'weight':getattr(model,'index_weight',99) + } + if perms.get('change'): + try: + model_dict['admin_url'] = reverse('admin:%s_%s_changelist' % info, current_app=admin.site.name) + except NoReverseMatch: + pass + if perms.get('add'): + try: + model_dict['add_url'] = reverse('admin:%s_%s_add' % info, current_app=admin.site.name) + except NoReverseMatch: + pass + if app_dict: + app_dict['models'].append(model_dict), + else: + app_dict = { + 'name': app_name, + 'app_label': app_label, + 'app_url': '', + 'has_module_perms': has_module_perms, + 'models': [model_dict], + } + if not app_dict: + raise Http404('The requested admin page does not exist.') + # Sort the models alphabetically within each app. + app_dict['models'].sort(key=lambda x: x['weight']) + + app_lib = list(six.itervalues(lib_dict)) + app_lib.sort(key=lambda x: x['weight']) + + context = dict( + maxi_app_list=[app_dict], + app_lib=app_lib, + ) + view_kwargs['extra_context'] = context + + def get_my_task(self,request): + from workflow.models import TodoList + if request and request.user: + query = TodoList.objects.filter(user=request.user,status=0) + if query.count() == 0: + return None + else: + return query.all()[:10] diff --git a/mis/__init__.py b/mis/__init__.py new file mode 100644 index 0000000..fa400f3 --- /dev/null +++ b/mis/__init__.py @@ -0,0 +1,9 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +import pymysql +pymysql.install_as_MySQLdb() +#解决mysql-python的历史遗留问题(Yuri_2017-04-29) +from django.contrib import admin + +admin.site.site_header = '智捷ERP' +admin.site.site_title = '智捷ERP' \ No newline at end of file diff --git a/mis/production.py b/mis/production.py new file mode 100644 index 0000000..f277194 --- /dev/null +++ b/mis/production.py @@ -0,0 +1,127 @@ +""" +Django settings for mis project. + +Generated by 'django-admin startproject' using Django 1.8. + +For more information on this file, see +https://docs.djangoproject.com/en/1.8/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.8/ref/settings/ +""" + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os + +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '_5%1a5zxdjsb-je@85!l34g--ve7!skhc%^c2n)3vqyhq)yq@c' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = False + +ALLOWED_HOSTS = ['127.0.0.1', 'localhost'] + + +# Application definition + +INSTALLED_APPS = ( + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'syscfg', + 'basedata', + 'organ', + 'workflow', + 'selfhelp', + 'hr', + 'invent', + 'purchase', + 'sale', +) + +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.security.SecurityMiddleware', + 'midware.cuser.RequestUser', +) + +ROOT_URLCONF = 'mis.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates')], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +TEMPLATE_THEME = 'default' + +WSGI_APPLICATION = 'mis.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.8/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'HOST': '172.31.16.165', + 'NAME': 'erp', + 'USER': 'maximus', + 'PASSWORD': 'maximus1234', + } +} + + +# Internationalization +# https://docs.djangoproject.com/en/1.8/topics/i18n/ + +LANGUAGE_CODE = 'zh-CN' + +LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')] + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = False + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.8/howto/static-files/ + +STATIC_URL = '/static/' +STATIC_ROOT = os.path.join(BASE_DIR,'static') +STATICFILES_DIRS = ( + ('css',os.path.join(STATIC_ROOT,'css')), + ('js',os.path.join(STATIC_ROOT,'js')), + ('img',os.path.join(STATIC_ROOT,'img')), +) + +MEDIA_ROOT = os.path.join(BASE_DIR,'upload') +MEDIA_URL = '/upload/' \ No newline at end of file diff --git a/mis/settings.py b/mis/settings.py new file mode 100644 index 0000000..a83da1c --- /dev/null +++ b/mis/settings.py @@ -0,0 +1,129 @@ +""" +Django settings for mis project. + +Generated by 'django-admin startproject' using Django 1.8. + +For more information on this file, see +https://docs.djangoproject.com/en/1.8/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.8/ref/settings/ +""" + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os + +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '_5%1a5zxdjsb-je@85!l34g--ve7!skhc%^c2n)3vqyhq)yq@c' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = ['127.0.0.1', 'localhost'] + + +# Application definition + +INSTALLED_APPS = ( + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'syscfg', + 'basedata', + 'organ', + 'workflow', + 'selfhelp', + 'hr', + 'invent', + 'purchase', + 'sale', +) + +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.locale.LocaleMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.security.SecurityMiddleware', + 'midware.cuser.RequestUser', +) + +ROOT_URLCONF = 'mis.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates')], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +TEMPLATE_THEME = 'default' + +WSGI_APPLICATION = 'mis.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.8/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'HOST': os.environ.get('DATABASE_HOST', 'localhost'), + 'PORT': os.environ.get('DATABASE_PORT', '3306'), + 'NAME': os.environ.get('DATABASE_NAME', 'mis'), + 'USER': os.environ.get('DATABASE_USER', 'root'), + 'PASSWORD': os.environ.get('DATABASE_PASSWORD', 'root'), + } +} + + +# Internationalization +# https://docs.djangoproject.com/en/1.8/topics/i18n/ + +LANGUAGE_CODE = 'zh-hans' + +LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')] + +TIME_ZONE = 'Asia/Shanghai' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = False + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.8/howto/static-files/ + +STATIC_URL = '/static/' +STATIC_ROOT = os.path.join(BASE_DIR,'static') +STATICFILES_DIRS = ( + ('css',os.path.join(STATIC_ROOT,'css')), + ('js',os.path.join(STATIC_ROOT,'js')), + ('img',os.path.join(STATIC_ROOT,'img')), +) + +MEDIA_ROOT = os.path.join(BASE_DIR,'upload') +MEDIA_URL = '/upload/' \ No newline at end of file diff --git a/mis/urls.py b/mis/urls.py new file mode 100644 index 0000000..6250797 --- /dev/null +++ b/mis/urls.py @@ -0,0 +1,21 @@ +from django.conf.urls import include, url, static +from django.contrib import admin +from mis import settings +import workflow.views +import invent.urls +import basedata.urls +import selfhelp.urls +import mis.views + +urlpatterns = [ + url(r'^$', mis.views.home), + url(r"^admin/(?P\w+)/(?P\w+)/(?P\d+)/start", workflow.views.start), + url(r"^admin/(?P\w+)/(?P\w+)/(?P\d+)/approve/(?P\d+)", workflow.views.approve), + url(r"^admin/(?P\w+)/(?P\w+)/(?P\d+)/restart/(?P\d+)", workflow.views.restart), + url(r'^admin/', include(admin.site.urls)), + url(r'^admin/invent/', include(invent.urls)), + url(r'^admin/basedata/', include(basedata.urls)), + url(r'^admin/selfhelp/', include(selfhelp.urls)), +] +urlpatterns += static.static(settings.STATIC_URL,document_root=settings.STATIC_ROOT) +urlpatterns += static.static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT) diff --git a/mis/views.py b/mis/views.py new file mode 100644 index 0000000..a88c4fc --- /dev/null +++ b/mis/views.py @@ -0,0 +1,5 @@ +from django.http.response import HttpResponseRedirect + + +def home(request): + return HttpResponseRedirect("/admin") \ No newline at end of file diff --git a/mis/wsgi.py b/mis/wsgi.py new file mode 100644 index 0000000..31990a7 --- /dev/null +++ b/mis/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for mis project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mis.settings") + +application = get_wsgi_application() diff --git a/organ/__init__.py b/organ/__init__.py new file mode 100644 index 0000000..ea52637 --- /dev/null +++ b/organ/__init__.py @@ -0,0 +1 @@ +default_app_config = 'organ.apps.OrganConfig' \ No newline at end of file diff --git a/organ/admin.py b/organ/admin.py new file mode 100644 index 0000000..bf142f4 --- /dev/null +++ b/organ/admin.py @@ -0,0 +1,68 @@ +# coding=utf-8 +from django.contrib import admin +from common import generic +from organ.models import Organization,OrgUnit,Position +from basedata.models import BankAccount +from basedata.admin import BankAccountInline +import datetime + + +class OrgAdmin(generic.BOAdmin): + CODE_PREFIX = 'O' + CODE_NUMBER_WIDTH = 2 + list_display = ['code','name','represent','lic_code','cer_code'] + + fields = ( + ('name','code',),('short','pinyin',), + ('tax_num','tax_account',),('tax_address',),('represent','email',), + ('address','zipcode',),('contacts','phone',),('fax','website',), + ('lic_code','cer_code',),('license','certificate',),('status','weight',), + ) + + inlines = [BankAccountInline] + + +class OrgUnitAdmin(generic.BOAdmin): + CODE_PREFIX = 'S' + CODE_NUMBER_WIDTH = 3 + list_display = ['code','name','unit_type','parent'] + list_display_links = ['code','name'] + fields = ( + ('organization',),('parent',),('name','code',),('short','pinyin',), + ('unit_type',),('status','virtual',),('phone','fax',), + ('contacts','email',),('weight',), + ) + + def get_queryset(self, request): + return super(OrgUnitAdmin,self).get_queryset(request).filter(end__gt=datetime.date.today()) + + def save_model(self, request, obj, form, change): + if obj.parent and obj.parent.organization: + obj.organization = obj.parent.organization + obj.save() + super(OrgUnitAdmin,self).save_model(request,obj,form,change) + + +class PositionAdmin(generic.BOAdmin): + CODE_PREFIX = 'P' + CODE_NUMBER_WIDTH = 4 + list_display = ['code','name','unit','series','grade','parent'] + list_display_links = ['code','name'] + fields = ( + ('unit',),('organization',),('parent',),('name','code',),('short','pinyin',),('series','grade',), + ('virtual','status'),('description',),('qualification',),('document',),('weight',), + ) + readonly_fields = ['organization'] + + def get_queryset(self, request): + return super(PositionAdmin,self).get_queryset(request).filter(end__gt=datetime.date.today()) + + def save_model(self, request, obj, form, change): + if obj.unit: + obj.organization = obj.unit.organization + obj.save() + super(PositionAdmin,self).save_model(request,obj,form,change) + +admin.site.register(Position,PositionAdmin) +admin.site.register(OrgUnit,OrgUnitAdmin) +admin.site.register(Organization,OrgAdmin) \ No newline at end of file diff --git a/organ/apps.py b/organ/apps.py new file mode 100644 index 0000000..d3aceac --- /dev/null +++ b/organ/apps.py @@ -0,0 +1,9 @@ +__author__ = 'zhugl' +# created at 15-4-22 +from django.apps.config import AppConfig +from django.utils.translation import ugettext_lazy as _ + + +class OrganConfig(AppConfig): + name = 'organ' + verbose_name = _('organization') \ No newline at end of file diff --git a/organ/models.py b/organ/models.py new file mode 100644 index 0000000..95e3347 --- /dev/null +++ b/organ/models.py @@ -0,0 +1,115 @@ +# coding=utf-8 +from django.db import models +from django.db import connection +from django.utils.translation import ugettext_lazy as _ +from common import const +from common import generic + + +class Organization(generic.BO): + """ + 组织单位 + """ + index_weight = 1 + code = models.CharField(_("organ code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + name = models.CharField(_("organ name"),max_length=const.DB_CHAR_NAME_120) + short = models.CharField(_("short name"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + pinyin = models.CharField(_("pinyin"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + status = models.BooleanField(_("in use"),default=True) + + tax_num = models.CharField(_("tax num"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + tax_address = models.CharField(_("tax address"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + tax_account = models.CharField(_("tax account"),max_length=const.DB_CHAR_NAME_80,blank=True,null=True) + + represent = models.CharField(_("representative "),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + address = models.CharField(_("address"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + zipcode = models.CharField(_("zipcode"),max_length=const.DB_CHAR_CODE_8,blank=True,null=True) + fax = models.CharField(_("fax"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + contacts = models.CharField(_("contacts"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + phone = models.CharField(_("phone"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + website = models.CharField(_("website"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + email = models.CharField(_("email"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + lic_code = models.CharField(_("license code"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + cer_code = models.CharField(_("certificate code"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + license = models.FileField(_("business license"),blank=True,null=True,upload_to='organ') + certificate = models.FileField(_("organization code certificate"),blank=True,null=True,upload_to='organ') + weight = models.IntegerField(_("weight"),default=9) + + class Meta: + verbose_name = _('organization') + verbose_name_plural = _('organization') + + +class OrgUnit(generic.BO): + """ + 组织单元 + """ + UNIT_LEVEL = ( + (1,_('BRANCH')), + (2,_('DEPARTMENT')), + (3,_('OFFICE')), + (4,_('TEAM')), + (5,_('COMMITTEE')) + ) + index_weight = 2 + parent = models.ForeignKey('self',verbose_name=_("parent"),null=True,blank=True) + organization = models.ForeignKey(Organization,verbose_name = _('organization'),null=True,blank=True) + code = models.CharField(_("code"),max_length=const.DB_CHAR_CODE_8,blank=True,null=True) + name = models.CharField(_("name"),max_length=const.DB_CHAR_NAME_120) + short = models.CharField(_("short name"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + pinyin = models.CharField(_("pinyin"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + unit_type = models.IntegerField(_("type"),choices=UNIT_LEVEL,default=2) + status = models.BooleanField(_("in use"),default=True) + virtual = models.BooleanField(_("is virtual"),default=False) + fax = models.CharField(_("fax"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + phone = models.CharField(_("phone"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + contacts = models.CharField(_("contacts"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + email = models.CharField(_("email"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + weight = models.IntegerField(_("weight"),default=99) + + class Meta: + verbose_name = _('org unit') + verbose_name_plural = _('org unit') + + +class Position(generic.BO): + """ + 岗位 + """ + SERIES = ( + ('A',_("Admin Position")), + ('S',_("Sale Position")), + ('T',_("Technology Position")), + ('P',_("Produce Position")), + ) + + GRADE = ( + ('01', _("BASIC")), + ('02', _("MEDIUM")), + ('03', _("SENIOR")), + ('04', _("PROFESSOR")), + ('05', _("EXPERT")), + ) + index_weight = 3 + unit = models.ForeignKey(OrgUnit,verbose_name=_('org unit')) + organization = models.ForeignKey(Organization,verbose_name=_('organization'),null=True,blank=True) + parent = models.ForeignKey('self',verbose_name=_("parent"),null=True,blank=True) + code = models.CharField(_("position code"),max_length=const.DB_CHAR_CODE_8,blank=True,null=True) + name = models.CharField(_("position name"),max_length=const.DB_CHAR_NAME_120) + short = models.CharField(_("short name"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + pinyin = models.CharField(_("pinyin"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + series = models.CharField(_("position series"),max_length=1,default='A',choices=const.get_value_list('S014')) + grade = models.CharField(_("position grade"),max_length=const.DB_CHAR_CODE_2,default='01',choices=const.get_value_list('S015')) + virtual = models.BooleanField(_("is virtual"),default=False) + status = models.BooleanField(_("in use"),default=True) + description = models.TextField(_("position description"),blank=True,null=True) + qualification = models.TextField(_("qualification"),blank=True,null=True) + document = models.FileField(_("reference"),blank=True,null=True) + weight = models.IntegerField(_("weight"),default=99) + + def __unicode__(self): + return u'%s %s' % (self.code,self.name) + + class Meta: + verbose_name = _('position') + verbose_name_plural = _('position') diff --git a/organ/tests.py b/organ/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/organ/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/organ/views.py b/organ/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/organ/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/plugin/__init__.py b/plugin/__init__.py new file mode 100644 index 0000000..ce3bd2f --- /dev/null +++ b/plugin/__init__.py @@ -0,0 +1,3 @@ +# created at 15-6-27 +# coding=utf-8 +__author__ = 'zhugl' diff --git a/plugin/wfactions.py b/plugin/wfactions.py new file mode 100644 index 0000000..803fc2e --- /dev/null +++ b/plugin/wfactions.py @@ -0,0 +1,54 @@ +# created at 15-6-30 +# coding=utf-8 +__author__ = 'zhugl' + + +class Operation(object): + APPROVE = 1 + DENY = 3 + TERMINATE = 4 + + +class WorkflowAction(object): + + name = '' + description = '' + + def action(self,request,obj,node_config,operation=Operation.APPROVE): + """ + + :param request: + :param obj: + :param node_config: + :return: + """ + + +class TestAction(WorkflowAction): + name = 'action.test' + + def action(self,request,obj,node_config,operation=Operation.APPROVE): + print 'this is a workflow test action' + print 'request user is %s,current node is %s'%(request.user,node_config) + + +class WorkflowActionManager(object): + """ + + """ + actions = {} + registed = False + + def __init__(self): + if WorkflowActionManager.registed: + pass + else: + WorkflowActionManager.register(TestAction) + WorkflowActionManager.registed = True + + @classmethod + def register(cls,action): + if cls.actions.get(action.name): + raise Exception('%s already exists,register failed'%action.name) + if issubclass(action,WorkflowAction): + WorkflowActionManager.actions[action.name] = action() \ No newline at end of file diff --git a/plugin/wfnodes.py b/plugin/wfnodes.py new file mode 100644 index 0000000..ec6bca2 --- /dev/null +++ b/plugin/wfnodes.py @@ -0,0 +1,54 @@ +# created at 15-6-30 +# coding=utf-8 +__author__ = 'zhugl' +from workflow.models import Node + + +class NextNodeHandler(object): + """ + + """ + name = '' + description = '' + + def handle(self,request,obj,node_config): + """ + + :param request: + :param obj: + :param node_config: + :return:workflow.models.Node + """ + return None + + +class TestHandler(NextNodeHandler): + name = 'project.budge.gt.10000' + description = '预算金额大于10000,由总经理审批' + + def handle(self,request,obj,node_config): + budget = getattr(obj,'budget',None) + if budget and budget > 10000: + return Node.objects.filter(id=7).all() + + +class NextNodeManager(object): + """ + + """ + handlers = {} + registed = False + + def __init__(self): + if NextNodeManager.registed: + pass + else: + NextNodeManager.register(TestHandler) + NextNodeManager.registed = True + + @classmethod + def register(cls,handler): + if cls.handlers.get(handler.name): + raise Exception('%s already exists,register failed'%handler.name) + if issubclass(handler,NextNodeHandler): + NextNodeManager.handlers[handler.name] = handler() diff --git a/plugin/wfusers.py b/plugin/wfusers.py new file mode 100644 index 0000000..4dc6b45 --- /dev/null +++ b/plugin/wfusers.py @@ -0,0 +1,67 @@ +# created at 15-6-30 +# coding=utf-8 +__author__ = 'zhugl' + + +class NextUserHandler(object): + """ + + """ + name = '' + description = '' + + def handle(self,request,obj,node_config): + """ + + :param request: + :param obj: + :param node_config: + :return:django.contrib.auth.models.User[] + """ + + return None + + +class UpPosition(NextUserHandler): + """ + + """ + name = 'up.position.user' + + def handle(self,request,obj,node_config): + from basedata.models import Employee,Position + emp_query = Employee.objects.filter(user=request.user) + if emp_query.count()>0: + emp = emp_query.all() + parent = [] + for e in emp: + if e.position and e.position.parent: + parent.append(e.position.parent) + # print emp + # print parent + query2 = Employee.objects.filter(position__in=parent).exclude(user=None) + return [x.user for x in query2.all()] + else: + return None + + +class NextUserManager(object): + """ + + """ + handlers = {} + registed = False + + def __init__(self): + if NextUserManager.registed: + pass + else: + NextUserManager.register(UpPosition) + NextUserManager.registed = True + + @classmethod + def register(cls,handler): + if cls.handlers.get(handler.name): + raise Exception('%s already exists,register failed'%handler.name) + if issubclass(handler,NextUserHandler): + NextUserManager.handlers[handler.name] = handler() \ No newline at end of file diff --git a/plugin/xls.py b/plugin/xls.py new file mode 100644 index 0000000..7f07e6f --- /dev/null +++ b/plugin/xls.py @@ -0,0 +1,183 @@ +# created at 15-6-27 +# coding=utf-8 +__author__ = 'zhugl' +import xlrd +import os +import datetime +from mis import settings + + +class Handler(object): + name = '' + + def handle(self,obj,f): + pass + + +class OPSHandler(Handler): + """ + 导入基础信息:部门,岗位,职员 + """ + name = 'OPS' + + def handle(self,obj,f): + if f and f.name.endswith('.xls'): + path = os.path.join(settings.MEDIA_ROOT,f.name) + workbook = xlrd.open_workbook(path) + for sheet in workbook.sheets(): + if sheet.name == u'部门' or sheet.name == 'department': + self.department(obj,sheet) + elif sheet.name == u'岗位' or sheet.name == 'position': + self.position(obj,sheet) + elif sheet.name == u'职员' or sheet.name == 'employee': + self.stuff(obj,sheet) + + def department(self,obj,sheet): + from organ.models import OrgUnit + row_count = sheet.nrows + if obj.is_clear: + OrgUnit.objects.update(end=datetime.date.today()) + for row_index in range(1,row_count): + row = sheet.row_values(row_index) + weight = 99 + if row[6]: + weight = row[6] + OrgUnit.objects.create(code=row[0],name=row[1],short=row[2],pinyin=row[3],begin=datetime.date.today(), + end=datetime.date(9999,12,31),weight=weight) + for row_index in range(1,row_count): + row = sheet.row_values(row_index) + if len(row[4]) > 0: + try: + parent = OrgUnit.objects.get(code=row[4]) + OrgUnit.objects.filter(code=row[0]).update(parent=parent) + except Exception,e: + pass + + def position(self,obj,sheet): + from organ.models import Position,OrgUnit + row_count = sheet.nrows + if obj.is_clear: + Position.objects.update(end=datetime.date.today()) + for row_index in range(1,row_count): + row = sheet.row_values(row_index) + depart = None + if len(row[4]) > 0: + try: + depart = OrgUnit.objects.filter(code=row[4],end__gt=datetime.date.today()).all()[0] + except Exception,e: + pass + weight = 99 + if row[6]: + weight = row[6] + Position.objects.create(code=row[0],name=row[1],unit=depart,begin=datetime.date.today(), + end=datetime.date(9999,12,31),weight=weight) + for row_index in range(1,row_count): + row = sheet.row_values(row_index) + if len(row[2]) > 0: + try: + parent = Position.objects.filter(code=row[2],end__gt=datetime.date.today()).all()[0] + Position.objects.filter(code=row[0]).update(parent=parent) + except Exception,e: + pass + + def stuff(self,obj,sheet): + from organ.models import Position + from basedata.models import Employee + from django.contrib.auth.models import User,Group + row_count = sheet.nrows + try: + group = Group.objects.get_by_natural_key(u'职员') + except Exception,e: + pass + for row_index in range(1,row_count): + row = sheet.row_values(row_index) + position = Position.objects.filter(code=row[8],end__gt=datetime.date.today()).all()[0] + username = row[10] + email = row[11] + password = row[4][-6:] + if position is None: + raise Exception(u'职员%s-%s未分配岗位,或者您选择的岗位已失效,不可被引用'%(row[0],row[1])) + try: + employee = Employee.objects.get(code=row[0]) + if employee.position.code == row[8]: + continue + else: + employee.position = position + employee.save() + except Exception,e: + employee = Employee.objects.create(code=row[0],name=row[1],pinyin=row[2],gender=row[3],idcard=row[4], + birthday=row[5],workday=row[6],startday=row[7],position=position) + if username: + try: + user = User.objects.get_by_natural_key(username) + except Exception,e: + user = User.objects.create_user(username=username,password=password) + user.is_staff = True + user.is_active = True + user.first_name = row[1] + if email: + user.email = email + if group: + user.groups.add(group) + user.save() + employee.user = user + employee.save() + + +class UserHandler(Handler): + """ + 基础数据导入:用户 + """ + name = 'admin.user' + + def handle(self,obj,f): + from django.contrib.auth.models import User,Group + if f and f.name.endswith('.xls'): + path = os.path.join(settings.MEDIA_ROOT,f.name) + workbook = xlrd.open_workbook(path) + sheet = workbook.sheet_by_index(0) + row_count = sheet.nrows + try: + group = Group.objects.get_by_natural_key(u'职员') + except Exception,e: + pass + + for row_index in range(2,row_count): + row = sheet.row_values(row_index) + username = row[0] + password = row[1] + last_name = row[2] + first_name = row[3] + email = row[4] + if username == '': + continue + try: + user = User.objects.get_by_natural_key(username) + except Exception,e: + user = User.objects.create_user(username=username,password=password,email=email) + user.is_staff = True + user.is_active = True + user.last_name = last_name + user.first_name = first_name + if group: + user.groups.add(group) + user.save() + + +class ExcelManager(object): + """ + + """ + handlers = {} + + def __init__(self): + ExcelManager.register(OPSHandler) + ExcelManager.register(UserHandler) + + @classmethod + def register(cls,handler): + if cls.handlers.get(handler.name): + raise Exception('%s already exists,register failed'%handler.name) + if issubclass(handler,Handler): + ExcelManager.handlers[handler.name] = handler() + diff --git a/purchase/__init__.py b/purchase/__init__.py new file mode 100644 index 0000000..8ef3b57 --- /dev/null +++ b/purchase/__init__.py @@ -0,0 +1 @@ +default_app_config = "purchase.apps.MyAppConfig" \ No newline at end of file diff --git a/purchase/admin.py b/purchase/admin.py new file mode 100644 index 0000000..946dcbf --- /dev/null +++ b/purchase/admin.py @@ -0,0 +1,90 @@ +from django.contrib import admin +from common import generic +from purchase.models import PurchaseOrder,POItem,Invoice,Payment +from basedata.models import Partner,BankAccount + + +class POItemInline(admin.TabularInline): + model = POItem + fields = ('material', 'measure','price', 'cnt', 'tax', 'discount_price') + raw_id_fields = ['material'] + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 3 + + +class PurchaseOrderAdmin(generic.BOAdmin): + """ + + """ + CODE_PREFIX = 'CG' + CODE_NUMBER_WIDTH = 5 + list_display = ['code','title','order_date','partner','amount','discount_amount','payed_amount','invoice_amount','status'] + list_display_links = ['code','title'] + raw_id_fields = ['partner'] + fields = ( + ('code','partner'),('order_date','arrive_date'), + ('title','status',),('description',),('amount','discount_amount'),('attach',), + ) + readonly_fields = ['status','amount'] + inlines = [POItemInline] + date_hierarchy = 'begin' + + def changeform_view(self, request, object_id=None, form_url='', extra_context=None): + if object_id: + extra_context = extra_context or {} + obj = PurchaseOrder.objects.get(id=object_id) + if obj.status == '99': + extra_context.update(dict(readonly=True)) + return super(PurchaseOrderAdmin,self).changeform_view(request,object_id,form_url,extra_context) + + def get_changeform_initial_data(self, request): + import datetime + begin = datetime.date.today() + end = begin + datetime.timedelta(30) + return {'order_date':begin,'arrive_date':end} + + +class PurchaseItemAdmin(generic.BOAdmin): + list_display = ['po','vender','material','cnt','price','tax'] + readonly_fields = ['po','material','cnt','price','tax'] + + def get_queryset(self, request): + return POItem.objects.filter(left_cnt__gt=0) + + +class InvoiceAdmin(generic.BOAdmin): + list_display = ['code','number','vo_date','po','partner','po_amount','vo_amount'] + readonly_fields = ['partner','po_amount'] + raw_id_fields = ['po'] + search_fields = ['po__code','partner__name'] + date_hierarchy = 'begin' + fields = ( + ('vo_date',),('po',),('po_amount','partner',),('code',),('number',),('vo_amount',),('file',) + ) + + +class PaymentAdmin(generic.BOAdmin): + CODE_PREFIX = 'PY' + CODE_NUMBER_WIDTH = 4 + list_display = ['code','py_date','po','partner','po_amount','py_amount'] + readonly_fields = ['partner','po_amount'] + raw_id_fields = ['po'] + search_fields = ['po__code','partner__name'] + fields = ( + ('py_date','code',),('po',),('partner','po_amount',),('py_amount',),('bank',),('response_code'),('memo',) + ) + date_hierarchy = 'begin' + + def formfield_for_foreignkey(self, db_field, request=None, **kwargs): + if db_field.name == 'bank': + kwargs['queryset'] = BankAccount.objects.exclude(org__exact=None) + return super(PaymentAdmin,self).formfield_for_foreignkey(db_field,request,**kwargs) + +admin.site.register(PurchaseOrder,PurchaseOrderAdmin) +admin.site.register(POItem,PurchaseItemAdmin) +admin.site.register(Invoice,InvoiceAdmin) +admin.site.register(Payment,PaymentAdmin) diff --git a/purchase/apps.py b/purchase/apps.py new file mode 100644 index 0000000..e6efba6 --- /dev/null +++ b/purchase/apps.py @@ -0,0 +1,11 @@ +# created at 15-5-23 +# coding=utf-8 +__author__ = 'zhugl' + +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + + +class MyAppConfig(AppConfig): + name = 'purchase' + verbose_name = _("purchase manage") diff --git a/purchase/models.py b/purchase/models.py new file mode 100644 index 0000000..52cdf8e --- /dev/null +++ b/purchase/models.py @@ -0,0 +1,221 @@ +# coding=utf-8 +import datetime +import os +import xlrd +import decimal +from django.db import transaction +from django.db import models +from django.db.models.aggregates import Sum +from django.contrib.auth.models import User +from django.utils.translation import ugettext_lazy as _ +from django.utils.text import force_text +from mis import settings +from common import generic +from common import const +from selfhelp.models import WOItem +from basedata.models import Material,Organization,Partner,Measure,BankAccount + + +class PurchaseOrder(generic.BO): + """ + + """ + STATUS = ( + ('0', _("NEW")), + ('1', _("IN PROGRESS")), + ('4', _("DROP")), + ('9', _("APPROVED")), + ('99', _("ALREADY STOCK IN")), + ) + index_weight = 1 + code = models.CharField(_("code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + partner = models.ForeignKey(Partner,verbose_name=_("partner"),limit_choices_to={"partner_type":"S"}) + order_date = models.DateField(_("order date")) + arrive_date = models.DateField(_("arrive date")) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + title = models.CharField(_("title"),max_length=const.DB_CHAR_NAME_40) + description = models.TextField(_("description"),blank=True,null=True) + user = models.ForeignKey(User,verbose_name=_("user"),blank=True,null=True) + status = models.CharField(_("status"),max_length=const.DB_CHAR_CODE_2,default='0',choices=STATUS) + amount = models.DecimalField(_("money amount"),max_digits=12,decimal_places=2,blank=True,null=True,default=0.00) + discount_amount = models.DecimalField(_("discount amount"),max_digits=12,decimal_places=2,blank=True,null=True,default=0.00) + entry_status = models.BooleanField(_("entry status"),default=0) + entry_time = models.DateTimeField(_("entry time"),blank=True,null=True) + attach = models.FileField(_('attach'),blank=True,null=True,help_text=u'您可导入采购明细,模板请参考文档FD0008') + + def __unicode__(self): + return u'%s %s' % (self.code,self.title) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + super(PurchaseOrder,self).save(force_insert,force_update,using,update_fields) + if self.discount_amount > 0: + sql = 'UPDATE purchase_poitem a SET a.discount_price = ' \ + 'a.price-((SELECT discount_amount/amount FROM purchase_purchaseorder WHERE id=%s)*a.amount/a.cnt) WHERE a.po_id = %s' + params = [self.id,self.id] + generic.update(sql,params) + + item_count = POItem.objects.filter(po=self).count() + if self.attach and item_count == 0: + path = os.path.join(settings.MEDIA_ROOT,self.attach.name) + workbook = xlrd.open_workbook(path) + sheet = workbook.sheet_by_index(0) + row_count = sheet.nrows + with transaction.atomic(): + total_amount = decimal.Decimal(0) + for row_index in range(row_count): + row = sheet.row_values(row_index) + if row_index == 0: + doc_type = row[1] + if doc_type.startswith('0'): + break + else: + continue + elif row_index < 3: + continue + + material = None + measure = None + + try: + measure = Measure.objects.get(code=row[4]) + except Exception,e: + measure = Measure.objects.create(code=row[4],name=force_text(row[5])) + + try: + material = Material.objects.get(code=row[0]) + except Exception,e: + material = Material(code=row[0],name=force_text(row[1]),spec=force_text(row[2])) + material.purchase_price = row[6] + material.save() + amount = decimal.Decimal(row[6])*decimal.Decimal(row[7]) + POItem.objects.create(po=self,material=material,measure=measure,cnt=row[7],price=row[6],amount=amount) + total_amount += amount + sql = 'update purchase_purchaseorder set amount = %s where id=%s' + params = [total_amount,self.id] + generic.update(sql,params) + + def invoice_amount(self): + total = Invoice.objects.filter(po=self).aggregate(Sum('vo_amount')).get('vo_amount__sum') or 0.00 + return total + + def payed_amount(self): + return Payment.objects.filter(po=self).aggregate(Sum('py_amount')).get('py_amount__sum') or 0.00 + + invoice_amount.short_description = _('invoice amount') + payed_amount.short_description = _('pay amount') + + class Meta: + verbose_name = _("purchase order") + verbose_name_plural = _("purchase orders") + + +class POItem(models.Model): + """ + + """ + index_weight = 2 + po = models.ForeignKey(PurchaseOrder,verbose_name=_("purchase order")) + material = models.ForeignKey(Material,verbose_name=_("material"),limit_choices_to={"is_virtual":"0"}) + measure = models.ForeignKey(Measure,verbose_name=_("measure"),blank=True,null=True) + price = models.DecimalField(_("price"),max_digits=12,decimal_places=4,blank=True,null=True) + cnt = models.DecimalField(_("count"),max_digits=12,decimal_places=4,blank=True,null=True) + discount_price = models.DecimalField(_("discount price"),max_digits=12,decimal_places=4,blank=True,null=True) + amount = models.DecimalField(_("money of amount"),max_digits=12,decimal_places=2,blank=True,null=True) + discount_amount = models.DecimalField(_("discount amount"),max_digits=12,decimal_places=2,blank=True,null=True) + tax = models.CharField(_("tax rate"),max_length=const.DB_CHAR_CODE_6,choices=const.get_value_list('S052'),default='0.00') + woitem = models.ForeignKey(WOItem,verbose_name=_("wo item"),blank=True,null=True) + is_in_stock = models.BooleanField(_("is in stock"),default=0) + in_stock_time = models.DateTimeField(_("execute time"),blank=True,null=True) + entry_cnt = models.DecimalField(_("entry count"),max_digits=12,decimal_places=4,blank=True,null=True) + left_cnt = models.DecimalField(_("left count"),max_digits=12,decimal_places=4,blank=True,null=True) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + if self.price and self.cnt: + money = self.price * self.cnt + self.amount = money + + if self.measure is None and self.material and self.material.measure.count() > 0: + self.measure = self.material.measure.all()[0] + + if self.is_in_stock: + self.left_cnt -= self.entry_cnt + else: + self.left_cnt = self.cnt + super(POItem,self).save(force_insert,force_update,using,update_fields) + self.material.purchase_price = self.price + self.material.save() + sql = 'UPDATE purchase_purchaseorder SET amount = (SELECT SUM(a.price*a.cnt) AS amount FROM ' \ + 'purchase_poitem a WHERE a.po_id = %s) WHERE id = %s' + params = [self.po.id,self.po.id] + generic.update(sql,params) + + def vender(self): + return u'%s' % (self.po.partner) + + vender.short_description = _("partner") + + class Meta: + verbose_name = _("po item") + verbose_name_plural = _("po item") + + +class Invoice(generic.BO): + """ + 采购发票 + """ + index_weight = 4 + vo_date = models.DateField(_("invoice date"),blank=True,null=True,default=datetime.date.today) + code = models.CharField(_("invoice code"),max_length=const.DB_CHAR_NAME_20) + number = models.CharField(_("invoice number"),max_length=const.DB_CHAR_NAME_20) + po = models.ForeignKey(PurchaseOrder,verbose_name=_("purchase order")) + partner = models.ForeignKey(Partner,verbose_name=_("partner"),blank=True,null=True) + po_amount = models.DecimalField(_("po amount"),max_digits=14,decimal_places=4,blank=True,null=True) + vo_amount = models.DecimalField(_("invoice amount"),max_digits=14,decimal_places=4) + file = models.FileField(_("invoice file"),upload_to='invoice',blank=True,null=True) + + def __unicode__(self): + return u"%s %s" % (self.code,self.partner) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + if self.po: + self.partner = self.po.partner + self.po_amount = self.po.amount + super(Invoice,self).save(force_insert,force_update,using,update_fields) + + class Meta: + verbose_name = _("Invoice") + verbose_name_plural = _("Invoice") + + +class Payment(generic.BO): + """ + 采购付款 + """ + index_weight = 3 + py_date = models.DateField(_("pay date"),blank=True,null=True,default=datetime.date.today) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + code = models.CharField(_("pay code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + po = models.ForeignKey(PurchaseOrder,verbose_name=_("purchase order")) + partner = models.ForeignKey(Partner,verbose_name=_("partner"),blank=True,null=True) + po_amount = models.DecimalField(_("po amount"),max_digits=14,decimal_places=4,blank=True,null=True) + py_amount = models.DecimalField(_("pay amount"),max_digits=14,decimal_places=4) + bank = models.ForeignKey(BankAccount,verbose_name=_("bank account"),blank=True,null=True) + response_code = models.CharField(_("response code"),max_length=const.DB_CHAR_NAME_80,blank=True,null=True) + memo = models.TextField(_("memo"),blank=True,null=True) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + if self.po: + self.partner = self.po.partner + self.po_amount = self.po.amount + super(Payment,self).save(force_insert,force_update,using,update_fields) + + def __unicode__(self): + return u"%s %s" % (self.code,self.partner) + + class Meta: + verbose_name = _("Payment") + verbose_name_plural = _("Payment") \ No newline at end of file diff --git a/purchase/tests.py b/purchase/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/purchase/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/purchase/views.py b/purchase/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/purchase/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/sale/__init__.py b/sale/__init__.py new file mode 100644 index 0000000..69606b4 --- /dev/null +++ b/sale/__init__.py @@ -0,0 +1 @@ +default_app_config = "sale.apps.MyAppConfig" \ No newline at end of file diff --git a/sale/admin.py b/sale/admin.py new file mode 100644 index 0000000..86264ee --- /dev/null +++ b/sale/admin.py @@ -0,0 +1,104 @@ +from django.contrib import admin +from common import generic +from sale.models import SaleOrder,SaleItem,PaymentCollection,OfferSheet,OfferItem +from basedata.models import Measure,BankAccount +from common import generic +import datetime + + +class SaleItemInline(admin.TabularInline): + model = SaleItem + fields = ('material','measure','sale_price','discount_price','cnt','tax') + raw_id_fields = ['material'] + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 3 + + +class OfferItemInline(admin.TabularInline): + model = OfferItem + fields = ('material','brand','measure','cost_price','sale_price','discount_price','cnt','tax') + raw_id_fields = ['material'] + readonly_fields = ['brand'] + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 3 + + +class SaleOrderAdmin(generic.BOAdmin): + CODE_NUMBER_WIDTH = 5 + CODE_PREFIX = 'SO' + inlines = [SaleItemInline] + list_display = ['code','title','order_date','partner','amount','collection_amount'] + list_display_links = ['code','title'] + raw_id_fields = ['partner','user','org'] + fields = ( + ('code','org',),('title','invoice_type',),('partner','user',),('order_date','deliver_date',), + ('contact','phone',),('deliver_address','fax',),('description',),('amount','discount_amount','status') + ) + readonly_fields = ['amount','status'] + date_hierarchy = 'begin' + + def save_model(self, request, obj, form, change): + if obj: + obj.user = request.user + super(SaleOrderAdmin,self).save_model(request,obj,form,change) + + def get_changeform_initial_data(self, request): + today = datetime.datetime.today() + deadline = today+datetime.timedelta(days=30) + return {'order_date':today,'deliver_date':deadline} + + +class OfferSheetAdmin(generic.BOAdmin): + CODE_NUMBER_WIDTH = 5 + CODE_PREFIX = 'BJ' + inlines = [OfferItemInline] + list_display = ['code','title','offer_date','partner','amount'] + list_display_links = ['code','title'] + raw_id_fields = ['partner','user','org'] + fields = ( + ('code','org',),('partner','user',),('offer_date','deliver_date',),('title',), + ('description',),('amount','discount_amount',),('attach'), + ) + readonly_fields = ['amount'] + date_hierarchy = 'begin' + + def save_model(self, request, obj, form, change): + if obj: + obj.user = request.user + super(OfferSheetAdmin,self).save_model(request,obj,form,change) + + def get_changeform_initial_data(self, request): + today = datetime.datetime.today() + deadline = today+datetime.timedelta(days=30) + return {'offer_date':today,'deliver_date':deadline} + + +class PaymentCollectionAdmin(generic.BOAdmin): + CODE_NUMBER_WIDTH = 4 + CODE_PREFIX = 'CP' + list_display = ['code','so','partner','order_amount','collection_date','collection_amount'] + fields = ( + ('code',),('collection_date',),('so',),('partner',),('order_amount','collection_amount',),('bank',), + ('memo',) + ) + raw_id_fields = ['so','partner'] + readonly_fields = ['order_amount'] + list_display_links = ['code','so'] + date_hierarchy = 'begin' + + def formfield_for_foreignkey(self, db_field, request=None, **kwargs): + if db_field.name=='bank': + kwargs['queryset'] = BankAccount.objects.exclude(org__exact=None) + return super(PaymentCollectionAdmin,self).formfield_for_foreignkey(db_field,request,**kwargs) + +admin.site.register(SaleOrder,SaleOrderAdmin) +admin.site.register(PaymentCollection,PaymentCollectionAdmin) +admin.site.register(OfferSheet,OfferSheetAdmin) diff --git a/sale/apps.py b/sale/apps.py new file mode 100644 index 0000000..052b88f --- /dev/null +++ b/sale/apps.py @@ -0,0 +1,11 @@ +# created at 15-5-23 +# coding=utf-8 +__author__ = 'zhugl' + +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + + +class MyAppConfig(AppConfig): + name = 'sale' + verbose_name = _("sale management") diff --git a/sale/models.py b/sale/models.py new file mode 100644 index 0000000..d71d114 --- /dev/null +++ b/sale/models.py @@ -0,0 +1,252 @@ +# coding=utf-8 +import decimal +import datetime +import csv +import os +import xlrd +from mis import settings +from django.db import models +from django.db import transaction +from django.db.models.aggregates import Sum +from django.contrib.auth.models import User +from django.utils.text import force_text +from django.utils.translation import ugettext_lazy as _ +from common import generic +from common import const +from basedata.models import Material,Project,Partner,Organization,Measure,BankAccount + + +class SaleOrder(generic.BO): + """ + 销售订单 + """ + STATUS = ( + ('0', _("NEW")), + ('1', _("IN PROGRESS")), + ('4', _("DROP")), + ('9', _("APPROVED")), + ('99', _("ALREADY STOCK OUT")), + ) + index_weight = 2 + code = models.CharField(_("code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + partner = models.ForeignKey(Partner,verbose_name=_("partner"),limit_choices_to={"partner_type":"C"}) + order_date = models.DateField(_("order date")) + deliver_date = models.DateField(_("deliver date")) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + title = models.CharField(_("title"),max_length=const.DB_CHAR_NAME_40) + description = models.TextField(_("memo"),blank=True,null=True) + contact = models.CharField(_("contacts"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + phone = models.CharField(_("phone"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + fax = models.CharField(_("fax"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + deliver_address = models.CharField(_("deliver address"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + invoice_type = models.CharField(_("invoice type"),max_length=const.DB_CHAR_CODE_6,choices=const.get_value_list('S053'),default='10') + + amount = models.DecimalField(_("money amount"),max_digits=12,decimal_places=2,blank=True,null=True,default=0.00) + discount_amount = models.DecimalField(_("discount amount"),max_digits=12,decimal_places=2,blank=True,null=True,default=0.00) + user = models.ForeignKey(User,verbose_name=_("sales man"),blank=True,null=True) + status = models.CharField(_("status"),max_length=const.DB_CHAR_CODE_2,default='0',choices=STATUS) + + def __unicode__(self): + return u'%s %s' % (self.code,self.title) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + super(SaleOrder,self).save(force_insert,force_update,using,update_fields) + if self.discount_amount > 0: + sql = 'UPDATE sale_saleitem a SET a.discount_price = a.sale_price - ' \ + '((SELECT discount_amount/amount FROM sale_saleorder WHERE id = %s) * (a.sale_price*a.cnt)/a.cnt) WHERE a.master_id = %s' + params = [self.id,self.id] + generic.update(sql,params) + + def collection_amount(self): + return PaymentCollection.objects.filter(so=self).aggregate(Sum('collection_amount')).get('collection_amount__sum') or 0.00 + + collection_amount.short_description = _('collection amount') + + class Meta: + verbose_name = _('sale order') + verbose_name_plural = _('sale order') + + +class SaleItem(models.Model): + """ + 订单明细 + """ + master = models.ForeignKey(SaleOrder) + material = models.ForeignKey(Material,verbose_name=_("material"),limit_choices_to={"is_virtual":"0",'can_sale':'1'},blank=True,null=True) + measure = models.ForeignKey(Measure,verbose_name=_("measure"),blank=True,null=True) + cnt = models.DecimalField(_("count"),max_digits=14,decimal_places=4) + stock_price = models.DecimalField(_("stock price"),max_digits=14,decimal_places=4,blank=True,null=True) + sale_price = models.DecimalField(_("sale price"),max_digits=14,decimal_places=4,blank=True,null=True) + discount_price = models.DecimalField(_("discount price"),max_digits=14,decimal_places=4,blank=True,null=True) + tax = models.CharField(_("tax rate"),max_length=const.DB_CHAR_CODE_6,choices=const.get_value_list('S052'),default='0.00') + create_time = models.DateTimeField(_("create time"),auto_now_add=True) + status = models.BooleanField(_("executed"),default=0) + event_time = models.DateTimeField(_("event time"),blank=True,null=True) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + if self.material and self.material.measure.count() > 0: + self.measure = self.material.measure.all()[0] + if self.material.sale_price or self.material.stock_price: + self.sale_price = self.material.sale_price or self.material.stock_price*decimal.Decimal(1.17)/decimal.Decimal(0.6) + super(SaleItem,self).save(force_insert,force_update,using,update_fields) + sql = 'update sale_saleorder set amount = (select sum(sale_price*cnt) from sale_saleitem where master_id=%s) where id=%s' + params = [self.master.id,self.master.id] + # print sql % (self.master.id,self.master.id) + generic.update(sql,params) + + class Meta: + verbose_name = _('order detail') + verbose_name_plural = _('order detail') + + +class PaymentCollection(generic.BO): + """ + 销售回款 + """ + index_weight = 3 + collection_date = models.DateField(_("collection date"),blank=True,null=True,default=datetime.date.today) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + code = models.CharField(_("collection code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + so = models.ForeignKey(SaleOrder,verbose_name=_("sale order")) + partner = models.ForeignKey(Partner,verbose_name=_("partner"),blank=True,null=True) + order_amount = models.DecimalField(_("order amount"),max_digits=14,decimal_places=4,blank=True,null=True) + collection_amount = models.DecimalField(_("collection amount"),max_digits=14,decimal_places=4) + bank = models.ForeignKey(BankAccount,verbose_name=_("bank account"),blank=True,null=True) + memo = models.TextField(_("memo"),blank=True,null=True) + + def __unicode__(self): + return u'%s %s'%(self.code,self.so) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + if self.so: + self.partner = self.so.partner + self.order_amount = self.so.amount + if self.so.discount_amount > 0: + self.order_amount -= self.so.discount_amount + super(PaymentCollection,self).save(force_insert,force_update,using,update_fields) + + class Meta: + verbose_name = _('Payment Collection') + verbose_name_plural = _('Payment Collection') + + +class OfferSheet(generic.BO): + """ + 报价单 + """ + index_weight = 1 + STATUS = ( + ('0', _("NEW")), + ('1', _("IN PROGRESS")), + ('4', _("DROP")), + ('9', _("APPROVED")), + ) + code = models.CharField(_("code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + partner = models.ForeignKey(Partner,verbose_name=_("partner"),limit_choices_to={"partner_type":"C"}) + offer_date = models.DateField(_("offer date")) + deliver_date = models.DateField(_("deliver date")) + org = models.ForeignKey(Organization,verbose_name=_("organization"),blank=True,null=True) + title = models.CharField(_("title"),max_length=const.DB_CHAR_NAME_40) + description = models.TextField(_("memo"),blank=True,null=True) + + amount = models.DecimalField(_("money amount"),max_digits=12,decimal_places=2,blank=True,null=True,default=0.00) + discount_amount = models.DecimalField(_("discount amount"),max_digits=12,decimal_places=2,blank=True,null=True,default=0.00) + user = models.ForeignKey(User,verbose_name=_("offer man"),blank=True,null=True) + + attach = models.FileField(_('offer sheet file'),blank=True,null=True,upload_to='offer sheet',help_text=u'您可导入报价明细,模板请参考文档FD0006') + status = models.BooleanField(_("executed"),default=0) + event_time = models.DateTimeField(_("event time"),blank=True,null=True) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + import decimal + super(OfferSheet,self).save(force_insert,force_update,using,update_fields) + if self.discount_amount > 0: + sql = 'UPDATE sale_offeritem a SET a.discount_price = a.sale_price - ' \ + '((SELECT discount_amount/amount FROM sale_offersheet WHERE id = %s) * (a.sale_price*a.cnt)/a.cnt) WHERE a.master_id = %s' + params = [self.id,self.id] + # print sql % (self.id,self.id) + generic.update(sql,params) + + item_count = OfferItem.objects.filter(master=self).count() + if self.attach and item_count == 0: + path = os.path.join(settings.MEDIA_ROOT,self.attach.name) + workbook = xlrd.open_workbook(path) + sheet = workbook.sheet_by_index(0) + row_count = sheet.nrows + with transaction.atomic(): + total_amount = decimal.Decimal(0) + for row_index in range(row_count): + row = sheet.row_values(row_index) + if row_index == 0: + doc_type = row[1] + if doc_type.startswith('0'): + break + else: + continue + elif row_index < 3: + continue + + material = None + measure = None + + try: + measure = Measure.objects.get(code=row[4]) + except Exception,e: + measure = Measure.objects.create(code=row[4],name=force_text(row[5])) + + try: + material = Material.objects.get(code=row[0]) + except Exception,e: + material = Material(code=row[0],name=force_text(row[1]),spec=force_text(row[2])) + material.sale_price = row[6] + material.purchase_price = row[7] + material.save() + OfferItem.objects.create(master=self,material=material,measure=measure,cnt=row[8],brand=force_text(row[3]), + cost_price=row[7],sale_price=row[6]) + total_amount += decimal.Decimal(row[6])*decimal.Decimal(row[8]) + sql = 'update sale_offersheet set amount = %s where id=%s' + params = [total_amount,self.id] + generic.update(sql,params) + + class Meta: + verbose_name = _('offer sheet') + verbose_name_plural = _('offer sheet') + + +class OfferItem(models.Model): + """ + 订单明细 + """ + master = models.ForeignKey(OfferSheet) + material = models.ForeignKey(Material,verbose_name=_("material"),limit_choices_to={"is_virtual":"0",'can_sale':'1'},blank=True,null=True) + measure = models.ForeignKey(Measure,verbose_name=_("measure"),blank=True,null=True) + cnt = models.DecimalField(_("count"),max_digits=14,decimal_places=4) + brand = models.CharField(_('brand'),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + cost_price = models.DecimalField(_("cost price"),max_digits=14,decimal_places=4,blank=True,null=True) + stock_price = models.DecimalField(_("stock price"),max_digits=14,decimal_places=4,blank=True,null=True) + sale_price = models.DecimalField(_("sale price"),max_digits=14,decimal_places=4,blank=True,null=True) + discount_price = models.DecimalField(_("discount price"),max_digits=14,decimal_places=4,blank=True,null=True) + tax = models.CharField(_("tax rate"),max_length=const.DB_CHAR_CODE_6,choices=const.get_value_list('S052'),default='0.00') + create_time = models.DateTimeField(_("create time"),auto_now_add=True) + status = models.BooleanField(_("executed"),default=0) + event_time = models.DateTimeField(_("event time"),blank=True,null=True) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + if self.material and self.material.measure.count() > 0: + self.measure = self.material.measure.all()[0] + if self.material.sale_price or self.material.stock_price: + self.sale_price = self.material.sale_price or self.material.stock_price*decimal.Decimal(1.17)/decimal.Decimal(0.6) + super(OfferItem,self).save(force_insert,force_update,using,update_fields) + sql = 'update sale_offersheet set amount = (select sum(sale_price*cnt) from sale_offeritem where master_id=%s) where id=%s' + params = [self.master.id,self.master.id] + # print sql % (self.master.id,self.master.id) + generic.update(sql,params) + + class Meta: + verbose_name = _('offer detail') + verbose_name_plural = _('offer detail') \ No newline at end of file diff --git a/sale/tests.py b/sale/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/sale/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/sale/views.py b/sale/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/sale/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/selfhelp/__init__.py b/selfhelp/__init__.py new file mode 100644 index 0000000..e5b99fa --- /dev/null +++ b/selfhelp/__init__.py @@ -0,0 +1 @@ +default_app_config = "selfhelp.apps.MyAppConfig" \ No newline at end of file diff --git a/selfhelp/admin.py b/selfhelp/admin.py new file mode 100644 index 0000000..0a52495 --- /dev/null +++ b/selfhelp/admin.py @@ -0,0 +1,219 @@ +# coding=utf-8 +# coding = utf-8 +import datetime +from django.contrib import admin +from django.contrib import messages +from django.http import HttpResponseRedirect +from django.db.models.aggregates import Sum +from django.utils.translation import ugettext_lazy as _ +from common import generic +from common import const +from basedata.models import Material,ExtraParam,Employee,Position +from selfhelp.models import WorkOrder,WOExtraValue,WOItem,Reimbursement,ReimbursementItem,Loan,Enroll,Feedback,Activity + + +class ParamValueInline(admin.TabularInline): + model = WOExtraValue + fields = ('param_name','param_value') + readonly_fields = ['param_name'] + + def formfield_for_foreignkey(self, db_field, request=None, **kwargs): + + if db_field.name == 'param_name': + app_info = generic.get_app_model_info_from_request(request) + instance = app_info['obj'] + if instance: + kwargs['queryset'] = ExtraParam.objects.filter(material=instance.service) + + return super(ParamValueInline,self).formfield_for_foreignkey(db_field,request,**kwargs) + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 1 + + +class ItemInline(admin.TabularInline): + model = WOItem + raw_id_fields = ['material'] + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 1 + + +class WorkOrderAdmin(generic.BOAdmin): + """ + + """ + CODE_PREFIX = 'WO' + CODE_NUMBER_WIDTH = 5 + list_display = ['code','begin','title','classification','business_domain','status'] + list_display_links = ['code','title'] + exclude = ['creator','modifier','creation','modification'] + search_fields = ['code','title'] + list_filter = ['classification','service','status'] + fields = ( + ('begin','end',), + ('code','refer',),('classification','business_domain',), + ('service','project',), + ('title','status',),('description',),('attach',),('detail',) + ) + readonly_fields = ['status'] + raw_id_fields = ['service','project','refer'] + inlines = [ItemInline,ParamValueInline] + date_hierarchy = 'begin' + + def save_model(self, request, obj, form, change): + if obj.user is None: + obj.user = request.user + super(WorkOrderAdmin,self).save_model(request,obj,form,change) + + def get_changeform_initial_data(self, request): + import datetime + td = datetime.date.today() + end = td + datetime.timedelta(30) + return {'begin':datetime.date.today, 'end':end} + + def formfield_for_foreignkey(self, db_field, request=None, **kwargs): + if db_field.name == 'refer': + app_info = generic.get_app_model_info_from_request(request) + if app_info and app_info['obj']: + kwargs['queryset'] = WorkOrder.objects.exclude(id=app_info['id']) + + return super(WorkOrderAdmin,self).formfield_for_foreignkey(db_field,request,**kwargs) + + +class LoanAdmin(generic.BOAdmin): + CODE_PREFIX = 'JK' + CODE_NUMBER_WIDTH = 5 + list_display = ['code','title','project','loan_amount','applier','status'] + list_display_links = ['code','title'] + readonly_fields = ['status','logout_time','logout_amount'] + raw_id_fields = ['project','user'] + fields = ( + ('code',),('title','loan_amount',),('description',),('project'),('user','status'),('logout_time','logout_amount',), + ) + extra_buttons = [{'href':'pay','title':_('pay')}] + search_fields = ['code','title','user__username'] + date_hierarchy = 'begin' + + def changeform_view(self, request, object_id=None, form_url='', extra_context=None): + if object_id: + try: + obj = Loan.objects.get(id=object_id) + if obj and obj.status == 'P': + extra_context = extra_context or {} + extra_context.update(dict(readonly=True)) + except Exception,e: + pass + return super(LoanAdmin,self).changeform_view(request,object_id,form_url,extra_context) + + def save_model(self, request, obj, form, change): + if obj and obj.user is None: + obj.user = request.user + super(LoanAdmin,self).save_model(request,obj,form,change) + + +class ReimbursementItemInline(admin.TabularInline): + model = ReimbursementItem + raw_id_fields = ['expense_account'] + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 1 + + +class ReimbursementAdmin(generic.BOAdmin): + CODE_PREFIX = 'BX' + CODE_NUMBER_WIDTH = 5 + list_display = ['code','title','project','amount','applier','status'] + list_display_links = ['code','title'] + inlines = [ReimbursementItemInline] + raw_id_fields = ['project','wo','user','org'] + readonly_fields = ['loan_amount','pay_time','status','amount'] + fieldsets = [ + (None,{'fields':[('code','user'),('title','amount','status',),('description',),('project','wo',)]}), + (_('fico'),{'fields':[('org',),('loan',),('logout_amount','pay_amount',)],'classes': ['collapse']}) + ] + extra_buttons = [{'href':'pay','title':_('pay')}] + search_fields = ['code','title','project__code','project__name','user__username'] + date_hierarchy = 'begin' + + def get_changeform_initial_data(self, request): + apps = generic.get_app_model_info_from_request(request) + obj = getattr(apps,'obj',None) + current = request.user + if obj: + current = obj.user + sm = Loan.objects.filter(user=current).aggregate(Sum('loan_amount')).get('loan_amount__sum') or 0.00 + return {'loan_amount':sm} + + def save_model(self, request, obj, form, change): + if obj and obj.user is None: + obj.user = request.user + + super(ReimbursementAdmin,self).save_model(request,obj,form,change) + + def formfield_for_foreignkey(self, db_field, request=None, **kwargs): + if db_field.name == 'loan': + apps = generic.get_app_model_info_from_request(request) + current = request.user + if apps: + obj = apps.get('obj') + current = obj.user + if obj.status == 'P': + kwargs['queryset']=Loan.objects.filter(id=obj.loan.id) + else: + kwargs['queryset']=Loan.objects.filter(user=current,is_clear=0) + else: + kwargs['queryset']=Loan.objects.filter(user=current,is_clear=0) + return super(ReimbursementAdmin,self).formfield_for_foreignkey(db_field,request,**kwargs) + + def changeform_view(self, request, object_id=None, form_url='', extra_context=None): + if object_id: + try: + obj = Reimbursement.objects.get(id=object_id) + if obj and obj.status == 'P': + extra_context = extra_context or {} + extra_context.update(dict(readonly=True)) + except Exception,e: + pass + return super(ReimbursementAdmin,self).changeform_view(request,object_id,form_url,extra_context) + + +class EnrollInline(admin.TabularInline): + model = Enroll + + +class FeedbackInline(admin.TabularInline): + model = Feedback + + +class ActivityAdmin(generic.BOAdmin): + CODE_PREFIX = 'AC' + CODE_NUMBER_WIDTH = 5 + list_display = ['code','begin_time','end_time','title','classification','room'] + list_display_links = ['code','title'] + raw_id_fields = ['room','parent'] + fieldsets = [ + (None,{'fields':[('begin_time','end_time',),('title','classification',),('description',), + ('host','speaker',),('room','location',),('attach',)]}), + (_('other info'),{'fields':[('mail_list',),('parent',),('mail_notice','short_message_notice','weixin_notice',)],'classes': ['collapse']}) + ] + + def get_changeform_initial_data(self, request): + now = datetime.datetime.now() + begin = now + datetime.timedelta(hours=12) + end = begin + datetime.timedelta(hours=6) + return {'begin_time':begin,'end_time':end} + +admin.site.register(WorkOrder,WorkOrderAdmin) +admin.site.register(Loan,LoanAdmin) +admin.site.register(Reimbursement,ReimbursementAdmin) +admin.site.register(Activity,ActivityAdmin) diff --git a/selfhelp/apps.py b/selfhelp/apps.py new file mode 100644 index 0000000..583e36d --- /dev/null +++ b/selfhelp/apps.py @@ -0,0 +1,11 @@ +# created at 15-5-23 +# coding=utf-8 +__author__ = 'zhugl' + +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + + +class MyAppConfig(AppConfig): + name = 'selfhelp' + verbose_name = _("self help") diff --git a/selfhelp/models.py b/selfhelp/models.py new file mode 100644 index 0000000..5fc023d --- /dev/null +++ b/selfhelp/models.py @@ -0,0 +1,330 @@ +# coding=utf-8 +import datetime +import os +import xlrd +import decimal +from django.db import transaction +from django.db import models +from django.contrib.auth.models import User +from django.utils.text import force_text +from django.utils.translation import ugettext_lazy as _ +from common import generic +from common import const +from mis import settings +from basedata.models import Material,ExtraParam,Project,ExpenseAccount,Measure +from organ.models import OrgUnit + + +class WorkOrder(generic.BO): + """ + + """ + index_weight = 1 + code = models.CharField(_("workorder code"),blank=True,null=True,max_length=const.DB_CHAR_CODE_10) + refer = models.ForeignKey("self",verbose_name=_("refer wo"),blank=True,null=True) + title = models.CharField(_("title"),max_length=const.DB_CHAR_NAME_120) + description = models.TextField(_("description"),blank=True,null=True) + business_domain = models.CharField(_("business domain"),max_length=const.DB_CHAR_CODE_4,choices=const.get_value_list('S045'),default='OT') + classification = models.CharField(_("classification"),max_length=const.DB_CHAR_CODE_4,choices=const.get_value_list('S044'),default='D') + service = models.ForeignKey(Material,verbose_name=_("service name"),null=True,blank=True,limit_choices_to={"is_virtual":"1"}) + project = models.ForeignKey(Project,verbose_name=_("project"),null=True,blank=True) + status = models.CharField(_("status"),blank=True,null=True,default='NEW',max_length=const.DB_CHAR_CODE_6,choices=const.get_value_list('S046')) + answer = models.TextField(_("answer"),blank=True,null=True) + user = models.ForeignKey(User,verbose_name=_("user"),blank=True,null=True) + attach = models.FileField(_('attach'),blank=True,null=True,help_text=u'工单附件,不导入明细。') + detail = models.FileField(_('to be imported detail'),blank=True,null=True,help_text=u'您可导入需求明细,模板请参考文档FD0007') + + def __unicode__(self): + return u"%s-%s" % (self.code,self.title) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + super(WorkOrder,self).save(force_insert,force_update,using,update_fields) + if self.service: + material = self.service + if self.woextravalue_set.count() < 1 and material.extraparam_set and material.extraparam_set.count() > 0: + for param in material.extraparam_set.all(): + extra_param = WOExtraValue.objects.create(workorder=self,param_name=param) + self.woextravalue_set.add(extra_param) + item_count = WOItem.objects.filter(workorder=self).count() + if self.detail and item_count == 0: + path = os.path.join(settings.MEDIA_ROOT,self.detail.name) + workbook = xlrd.open_workbook(path) + sheet = workbook.sheet_by_index(0) + row_count = sheet.nrows + with transaction.atomic(): + for row_index in range(row_count): + row = sheet.row_values(row_index) + if row_index == 0: + doc_type = row[1] + if doc_type.startswith('0'): + break + else: + continue + elif row_index < 3: + continue + material = None + measure = None + try: + measure = Measure.objects.get(code=row[4]) + except Exception,e: + measure = Measure.objects.create(code=row[4],name=force_text(row[5])) + try: + material = Material.objects.get(code=row[0]) + except Exception,e: + material = Material(code=row[0],name=force_text(row[1]),spec=force_text(row[2])) + material.save() + WOItem.objects.create(workorder=self,material=material,measure=measure,amount=row[6]) + + class Meta: + verbose_name = _("workorder apply") + verbose_name_plural = _("workorder apply") + + class Media: + js = ('js/workorder.js',) + + +class WOExtraValue(models.Model): + """ + + """ + workorder = models.ForeignKey(WorkOrder,verbose_name=_("workorder")) + param_name = models.ForeignKey(ExtraParam,verbose_name=_("extra param")) + param_value = models.CharField(_("param value"),blank=True,null=True,max_length=const.DB_CHAR_NAME_40) + + class Meta: + verbose_name = _("extra value") + verbose_name_plural = _("extra values") + + +class WOItem(models.Model): + """ + + """ + workorder = models.ForeignKey(WorkOrder,verbose_name=_("workorder")) + material = models.ForeignKey(Material,verbose_name=_("material"),null=True,blank=True,limit_choices_to={"is_virtual":"0"}) + amount = models.DecimalField(_("amount"),max_digits=10,decimal_places=4,blank=True,null=True) + measure = models.ForeignKey(Measure,verbose_name=_('measure'),blank=True,null=True) + price = models.DecimalField(_("price"),max_digits=10,decimal_places=4,blank=True,null=True) + + class Meta: + verbose_name = _("workorder item") + verbose_name_plural = _("workorder items") + + +class Loan(generic.BO): + """ + + """ + LOAD_STATUS = ( + ('N',_("NEW")), + ('I',_("IN PROGRESS")), + ('A',_("APPROVED")), + ('P',_("PAYED")) + ) + index_weight = 3 + code = models.CharField(_("loan code"),max_length=const.DB_CHAR_CODE_10,blank=True,null=True) + title = models.CharField(_("title"),max_length=const.DB_CHAR_NAME_120) + description = models.TextField(_("description"),blank=True,null=True) + project = models.ForeignKey(Project,verbose_name=_("project")) + user = models.ForeignKey(User,verbose_name=_("user"),blank=True,null=True) + status = models.CharField(_("status"),blank=True,null=True,default='N',max_length=const.DB_CHAR_CODE_2,choices=LOAD_STATUS) + logout_time = models.DateTimeField(_("logout time"),blank=True,null=True) + loan_amount = models.DecimalField(_("loan amount"),max_digits=10,decimal_places=2,blank=True,null=True) + logout_amount = models.DecimalField(_("logout amount"),max_digits=10,decimal_places=2,blank=True,null=True) + pay_user = models.CharField(_('pay user'),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + pay_time = models.DateTimeField(_('pay time'),blank=True,null=True) + is_clear = models.BooleanField(_('is clear'),default=False) + + def __unicode__(self): + import decimal + left = self.loan_amount + left -= self.logout_amount or decimal.Decimal(0.00) + name = '%s%s'%(self.user.last_name,self.user.first_name) + return '%s %s %s J:%.2f Y:%.2f' % (self.code,name,self.title,self.loan_amount,left) + + def applier(self): + return u'%s%s'%(self.user.last_name,self.user.first_name) + + applier.short_description = _('applier') + + def action_pay(self,request): + self.pay_time = datetime.datetime.now() + self.pay_user = request.user.username + self.status = 'P' + self.save() + + class Meta: + verbose_name = _("loan") + verbose_name_plural = _("loans") + permissions = ( + ('financial_pay',_("financial pay")), + ) + + +class Reimbursement(generic.BO): + """ + + """ + REIM_STATUS = ( + ('N',_("NEW")), + ('I',_("IN PROGRESS")), + ('A',_("APPROVED")), + ('P',_("PAYED")) + ) + index_weight = 2 + code = models.CharField(_("fee code"),max_length=const.DB_CHAR_CODE_10,blank=True,null=True) + title = models.CharField(_("title"),max_length=const.DB_CHAR_NAME_120) + description = models.TextField(_("description"),blank=True,null=True) + project = models.ForeignKey(Project,verbose_name=_("project")) + wo = models.ForeignKey(WorkOrder,verbose_name=_("work order"),null=True,blank=True) + user = models.ForeignKey(User,verbose_name=_("user"),blank=True,null=True) + org = models.ForeignKey(OrgUnit,verbose_name=_("cost center"),blank=True,null=True) + bank_account = models.CharField(_("bank account"),max_length=const.DB_CHAR_NAME_120,blank=True,null=True) + status = models.CharField(_("status"),blank=True,null=True,default='N',max_length=const.DB_CHAR_CODE_2,choices=REIM_STATUS) + amount = models.DecimalField(_("amount of money"),max_digits=10,decimal_places=2,blank=True,null=True) + loan = models.ForeignKey(Loan,verbose_name=_("loan record"),blank=True,null=True) + loan_amount = models.DecimalField(_("loan amount"),max_digits=10,decimal_places=2,blank=True,null=True) + logout_amount = models.DecimalField(_("logout amount"),max_digits=10,decimal_places=2,blank=True,null=True) + pay_amount = models.DecimalField(_("pay amount"),max_digits=10,decimal_places=2,blank=True,null=True) + pay_time = models.DateTimeField(_("pay time"),blank=True,null=True) + pay_user = models.CharField(_('pay user'),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + + def applier(self): + return u'%s%s'%(self.user.last_name,self.user.first_name) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + import decimal + if self.loan: + left = self.loan.loan_amount + left -= self.loan.logout_amount or decimal.Decimal(0.00) + if self.logout_amount is None or self.logout_amount == '': + if self.amount < left: + self.logout_amount = self.amount + else: + self.logout_amount = left + self.pay_amount = self.amount + if self.logout_amount: + self.pay_amount -= self.logout_amount + super(Reimbursement,self).save(force_insert,force_update,using,update_fields) + + def action_pay(self,request): + if self.loan: + if self.logout_amount is None or self.logout_amount == '': + self.logout_amount = self.amount + if self.logout_amount < 0: + raise Exception(u'核销金额小于0') + + if self.loan.logout_amount is None: + self.loan.logout_amount = self.logout_amount + else: + self.loan.logout_amount += self.logout_amount + + if self.loan.loan_amount == self.loan.logout_amount: + self.loan.is_clear=True + + self.loan.logout_time = datetime.datetime.now() + self.loan.save() + + if self.amount > self.logout_amount: + self.pay_amount = self.amount - self.logout_amount + + self.pay_time = datetime.datetime.now() + self.pay_user = request.user.username + self.status = 'P' + self.save() + + applier.short_description = _('applier') + + class Meta: + verbose_name = _("reimbursement") + verbose_name_plural = _("reimbursements") + permissions = ( + ('financial_pay',_("financial pay")), + ) + + +class ReimbursementItem(models.Model): + """ + + """ + import datetime + reimbursement = models.ForeignKey(Reimbursement,verbose_name=_("reimbursement")) + expense_account = models.ForeignKey(ExpenseAccount,verbose_name=_("expenses account")) + begin = models.DateField(_("occur date"),default=datetime.date.today) + amount = models.DecimalField(_("amount of money"),max_digits=10,decimal_places=2) + memo = models.CharField(_("memo"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + super(ReimbursementItem,self).save(force_insert,force_update,using,update_fields) + sql = 'UPDATE selfhelp_reimbursement SET amount = (SELECT SUM(amount) FROM selfhelp_reimbursementitem WHERE reimbursement_id = %s) WHERE id = %s' + params = [self.reimbursement.id,self.reimbursement.id] + generic.update(sql,params) + + class Meta: + verbose_name = _("fee item") + verbose_name_plural = _("fee items") + + +class Activity(generic.BO): + """ + + """ + CLASSIFICATION = ( + ('T',_("Train")), + ('M',_("Meeting")), + ('G',_("Community")), + ) + index_index_weight = 4 + begin_time = models.DateTimeField(_('begin time')) + end_time = models.DateTimeField(_('end time')) + enroll_deadline = models.DateTimeField(_('enroll deadline'),blank=True,null=True) + code = models.CharField(_("code"),max_length=const.DB_CHAR_NAME_20,blank=True,null=True) + title = models.CharField(_("title"),max_length=const.DB_CHAR_NAME_120) + parent = models.ForeignKey('self',verbose_name=_("parent"),blank=True,null=True) + description = models.TextField(_("description"),blank=True,null=True) + host = models.CharField(_("host"),max_length=const.DB_CHAR_NAME_80,blank=True,null=True) + speaker = models.CharField(_("speaker"),max_length=const.DB_CHAR_NAME_80,blank=True,null=True) + accept_enroll = models.BooleanField(_("accept enroll"),default=1) + room = models.ForeignKey(Material,verbose_name=_("room"),blank=True,null=True,limit_choices_to={'tp':20}) + location = models.CharField(_("location"),max_length=const.DB_CHAR_NAME_80,blank=True,null=True) + classification = models.CharField(_("classification"),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=CLASSIFICATION,default='M') + mail_list = models.TextField(_("mail list"),blank=True,null=True) + mail_notice = models.BooleanField(_("mail notice"),default=1) + short_message_notice = models.BooleanField(_("short message notice"),default=1) + weixin_notice = models.BooleanField(_("weixin notice"),default=1) + status = models.BooleanField(_("published"),default=0) + publish_time = models.DateTimeField(_("publish time"),blank=True,null=True) + attach = models.FileField(_("attach"),blank=True,null=True,upload_to='activity') + + class Meta: + verbose_name = _("activity") + verbose_name_plural = _("activities") + + +class Feedback(models.Model): + """ + + """ + RANK = ( + ('A','A'), + ('B','B'), + ('C','C'), + ('D','D'), + ) + activity = models.ForeignKey(Activity) + user = models.ForeignKey(User) + feed_time = models.DateTimeField(_("feedback time"),auto_now_add=True) + rank = models.CharField(_('rank'),max_length=const.DB_CHAR_CODE_2,blank=True,null=True,choices=RANK,default='B') + comment = models.CharField(_("suggest"),blank=True,null=True,max_length=const.DB_CHAR_NAME_80) + + +class Enroll(models.Model): + """ + + """ + activity = models.ForeignKey(Activity) + user = models.ForeignKey(User) + enroll_time = models.DateTimeField(_("enroll time"),auto_now_add=True) diff --git a/selfhelp/tests.py b/selfhelp/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/selfhelp/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/selfhelp/urls.py b/selfhelp/urls.py new file mode 100644 index 0000000..dd0b214 --- /dev/null +++ b/selfhelp/urls.py @@ -0,0 +1,6 @@ +from django.conf.urls import include, url,static +import selfhelp.views + +urlpatterns = [ + url(r"(?P\w+)/(?P\d+)/pay", selfhelp.views.pay_action), +] diff --git a/selfhelp/views.py b/selfhelp/views.py new file mode 100644 index 0000000..261d5a3 --- /dev/null +++ b/selfhelp/views.py @@ -0,0 +1,46 @@ +# coding=utf-8 +from django.contrib.admin import site +from django.contrib.contenttypes.models import ContentType +from django.db import connection +from django.http.response import HttpResponseRedirect +from django.utils.encoding import force_text +from django.template.response import TemplateResponse +from django.contrib import messages +from django.utils.translation import ugettext_lazy as _ +from django.contrib.contenttypes.models import ContentType + + +def pay_action(request,model,object_id): + title = _("Are you sure?") + ct = ContentType.objects.get(app_label='selfhelp',model=model) + obj = ct.get_object_for_this_type(id=int(object_id)) + opts = obj._meta + objects_name = force_text(opts.verbose_name) + + if model == 'reimbursement': + loan = obj.loan + amount = obj.logout_amount + if loan and (amount is None or amount< 0): + messages.error(request,u'您选择了借款单据,但是未正确填写核销金额,请在\'财务信息\'栏目中更正') + return HttpResponseRedirect("/admin/selfhelp/%s/%s"%(model,object_id)) + + if request.POST.get("post"): + try: + obj.action_pay(request) + messages.success(request,_('action successfully')) + except Exception,e: + messages.error(request,e) + + return HttpResponseRedirect("/admin/selfhelp/%s/%s"%(model,object_id)) + + context = dict( + site.each_context(request), + title=title, + opts=opts, + objects_name=objects_name, + object=obj, + action_name=_('pay') + ) + request.current_app = site.name + + return TemplateResponse(request,'admin/invent/stockin/in_confirmation.html', context) diff --git a/static/css/maximus.css b/static/css/maximus.css new file mode 100644 index 0000000..f41a24e --- /dev/null +++ b/static/css/maximus.css @@ -0,0 +1,38 @@ + +table#workflow-history{ + width:100% +} +table#workflow-history tbody th,table#workflow-history tbody td.col { + width: 16em; +} + +.submitlink { + padding-left: 12px; + background: url(../img/icon-yes.gif) 0 .25em no-repeat; +} + +a.submitlink:link, a.submitlink:visited { + color: #CC3434; +} + +a.submitlink:hover { + color: #993333; +} + +label.control{ + width:4em; +} + +p.next-node{ + font-weight:bold; +} +ul.node-users{ + list-style:none; +} +p.tooltip{ + color:#999; +} +li.done-link{ + padding-left: 12px; + background: url(../img/icon_yes.gif) 0 .2em no-repeat; +} \ No newline at end of file diff --git a/static/css/modern_ui.css b/static/css/modern_ui.css new file mode 100644 index 0000000..4379d3e --- /dev/null +++ b/static/css/modern_ui.css @@ -0,0 +1,984 @@ +/* 智捷ERP SmartJet ERP - 1:1 High-Fidelity UI System v4.0 */ +@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap'); + +:root { + --primary: #6366f1; + --primary-light: #818cf8; + --primary-bg: #f5f3ff; + + --slate-50: #f8fafc; + --slate-100: #f1f5f9; + --slate-200: #e2e8f0; + --slate-300: #cbd5e1; + --slate-400: #94a3b8; + --slate-500: #64748b; + --slate-600: #475569; + --slate-700: #334155; + --slate-800: #1e293b; + --slate-900: #0f172a; + + --success: #10b981; + --warning: #f59e0b; + --danger: #ef4444; + --info: #3b82f6; + + --sidebar-width: 240px; + --sidebar-collapsed-width: 0px; + --topbar-height: 64px; + --radius-lg: 16px; + --radius-md: 10px; + --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02); +} + +*, *::before, *::after { + box-sizing: border-box; +} + +body { + background-color: #f1f5f9 !important; + color: var(--slate-800) !important; + font-family: 'Plus Jakarta Sans', -apple-system, sans-serif !important; + margin: 0 !important; + padding: 0 !important; + overflow-x: hidden; +} + +#container { + display: flex !important; + min-height: 100vh; + min-width: 0 !important; + max-width: 100vw; + width: 100%; + overflow-x: hidden; +} + +/* --- SIDEBAR --- */ +#header { + width: var(--sidebar-width) !important; + height: 100vh !important; + position: fixed !important; + left: 0; top: 0; + background: #ffffff !important; + border-right: 1px solid var(--slate-200) !important; + padding: 0 !important; + display: flex !important; + flex-direction: column !important; + z-index: 1000 !important; + color: var(--slate-800) !important; + line-height: normal !important; + overflow: visible !important; +} + +/* 覆盖 Django admin 默认深色顶栏链接样式(白字导致侧栏文字不可见) */ +#header a:link, +#header a:visited { + color: inherit !important; + text-decoration: none !important; +} + +#header a:focus, +#header a:hover { + text-decoration: none !important; +} + +.brand-section { + padding: 24px; + display: flex; + align-items: center; +} + +.brand-logo { + width: 32px; + height: 32px; + background: linear-gradient(135deg, #6366f1, #a855f7); + border-radius: 8px; + margin-right: 12px; + display: flex; + align-items: center; + justify-content: center; + color: white; + font-weight: 800; +} + +.brand-text h1 { + font-size: 18px !important; + font-weight: 800 !important; + color: #1e293b !important; + margin: 0 !important; + line-height: 1 !important; +} + +.brand-text span { + font-size: 11px; + color: var(--slate-400); + text-transform: uppercase; + letter-spacing: 0.05em; +} + +.sidebar-nav { + flex: 1; + padding: 0 16px; + overflow-y: auto; +} + +.nav-group-label { + padding: 20px 12px 10px 12px; + color: var(--slate-400); + font-size: 11px; + font-weight: 700; + text-transform: uppercase; +} + +.nav-item { + display: flex; + align-items: center; + padding: 12px 16px; + border-radius: 12px; + color: var(--slate-600) !important; + text-decoration: none !important; + font-weight: 600; + font-size: 14px; + margin-bottom: 4px; + transition: all 0.2s; +} + +.nav-item:hover, +.nav-item:focus { + background: var(--slate-50); + color: var(--primary) !important; +} + +.nav-item.active, +.nav-item.active:link, +.nav-item.active:visited { + background: var(--primary-bg) !important; + color: var(--primary) !important; +} + +.nav-item i { margin-right: 12px; font-size: 18px; width: 20px; text-align: center; } +.nav-item .arrow { margin-left: auto; font-size: 10px; color: var(--slate-300); } + +.sidebar-footer { + padding: 16px; + border-top: 1px solid var(--slate-100); + position: relative; + z-index: 1002; + flex-shrink: 0; + background: #ffffff; +} + +.nav-item-btn { + width: 100%; + border: none; + background: transparent; + cursor: pointer; + font-family: inherit; + text-align: left; +} + +button.nav-item-btn:hover, +button.nav-item-btn:focus { + background: var(--slate-50); + color: var(--primary) !important; + outline: none; +} + +/* 侧栏收起 */ +#header { + transition: transform 0.25s ease; +} + +body.sidebar-collapsed #header { + transform: translateX(-100%); + pointer-events: none; +} + +body.sidebar-collapsed #main { + margin-left: 0 !important; + max-width: 100vw !important; +} + +/* --- TOPBAR --- */ +#main { + flex: 1 1 auto !important; + margin-left: var(--sidebar-width) !important; + width: auto !important; + min-width: 0 !important; + max-width: calc(100vw - var(--sidebar-width)) !important; + overflow-x: hidden; + position: relative; + z-index: 1; +} + +.topbar { + height: var(--topbar-height); + background: #ffffff !important; + opacity: 1 !important; + display: flex; + align-items: center; + padding: 0 32px; + position: sticky; + top: 0; + z-index: 900; + box-shadow: 0 1px 2px rgba(0,0,0,0.02); +} + +.topbar-left { display: flex; align-items: center; flex: 1; } +.topbar-right { + display: flex; + align-items: center; + gap: 20px; + background: #ffffff !important; + opacity: 1 !important; + position: relative; + z-index: 901; + pointer-events: auto; +} + +.breadcrumb-new { + display: flex; + align-items: center; + gap: 8px; + font-size: 13px; + color: var(--slate-400); + margin-left: 20px; +} + +.breadcrumb-new span { color: var(--slate-800); font-weight: 600; } + +.search-btn, .icon-btn { + width: 36px; + height: 36px; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + color: var(--slate-500); + cursor: pointer; + transition: background 0.2s; + border: none; + background: transparent; + padding: 0; + font-size: 16px; + line-height: 1; + pointer-events: auto; + position: relative; + z-index: 1; +} + +.search-btn:hover, .icon-btn:hover, +.search-btn:focus, .icon-btn:focus { + background: var(--slate-100); + outline: none; +} + +.user-menu-wrap { + position: relative; + padding-left: 20px; + border-left: 1px solid var(--slate-200); +} + +.user-profile { + display: flex; + align-items: center; + gap: 12px; + padding: 4px 8px; + border: none; + border-radius: 10px; + background: #ffffff !important; + opacity: 1 !important; + cursor: pointer; + font-family: inherit; + pointer-events: auto; +} + +.user-profile:hover, +.user-profile:focus { + background: var(--slate-50) !important; + outline: none; +} + +.user-caret { + font-size: 10px; + color: var(--slate-400); + margin-left: 4px; +} + +.user-dropdown { + display: none; + position: absolute; + top: calc(100% + 8px); + right: 0; + min-width: 140px; + background: #ffffff; + border: 1px solid var(--slate-200); + border-radius: 10px; + box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); + padding: 6px; + z-index: 1100; +} + +.user-dropdown.open { + display: block; +} + +.user-dropdown a { + display: block; + padding: 10px 14px; + border-radius: 8px; + color: var(--slate-700) !important; + text-decoration: none !important; + font-size: 13px; + font-weight: 600; +} + +.user-dropdown a:hover { + background: var(--slate-50); + color: var(--primary) !important; +} + +.avatar { + width: 36px; + height: 36px; + border-radius: 10px; + background: var(--slate-200); + flex-shrink: 0; + opacity: 1 !important; +} + +.user-info { display: flex; flex-direction: column; background: transparent; } +.user-name { font-weight: 700; font-size: 13px; color: var(--slate-800) !important; opacity: 1 !important; } +.user-role { font-size: 11px; color: var(--slate-500) !important; opacity: 1 !important; } + +/* --- CONTENT --- */ +#content { + padding: 32px !important; + width: 100% !important; + max-width: 100% !important; + min-width: 0 !important; + position: relative; + z-index: 1; +} + +.dashboard #content { + width: 100% !important; + max-width: 100% !important; +} + +#content-main { + float: none !important; + width: 100% !important; + max-width: 100% !important; + min-width: 0 !important; +} + +.dashboard #content > h1 { + display: none; +} + +#content > h1 { + font-size: 22px; + font-weight: 700; + color: var(--slate-900); + margin: 0 0 24px; + padding-right: 120px; +} + +.colM, .colMS { + max-width: 100%; + min-width: 0; +} + +#changelist, #changelist-form, .results { + max-width: 100%; + overflow-x: auto; +} + +/* --- STATS CARDS --- */ +.stats-grid { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + gap: 24px; + margin-bottom: 32px; + width: 100%; + max-width: 100%; +} + +.stat-card { + background: #ffffff; + padding: 24px; + border-radius: var(--radius-lg); + box-shadow: var(--shadow-card); + position: relative; + min-width: 0; +} + +.stat-header { display: flex; justify-content: space-between; margin-bottom: 12px; } +.stat-icon-bg { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: white; font-size: 18px; } +.stat-info-icon { color: var(--slate-300); font-size: 14px; cursor: help; } + +.stat-value { font-size: 24px; font-weight: 800; color: var(--slate-900); margin-bottom: 8px; } +.stat-label { font-size: 14px; color: var(--slate-500); font-weight: 500; } + +.stat-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; border-top: 1px solid var(--slate-50); padding-top: 16px; } +.stat-trend { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 4px; } +.trend-up { color: var(--success); } +.trend-down { color: var(--danger); } + +.sparkline { width: 60px; height: 30px; } + +/* --- DATA MODULES --- */ +.dashboard-main-grid { + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); + gap: 24px; + width: 100%; + max-width: 100%; +} + +.module-card { + background: white; + border-radius: var(--radius-lg); + box-shadow: var(--shadow-card); + overflow: hidden; + display: flex; + flex-direction: column; + min-width: 0; +} + +.card-title { + padding: 24px 32px; + font-size: 16px; + font-weight: 700; + color: var(--slate-900); + display: flex; + justify-content: space-between; + align-items: center; +} + +/* --- TABLE STYLES --- */ +.table-container { overflow-x: auto; max-width: 100%; padding: 0 12px 12px 12px; } +table { width: 100%; max-width: 100%; border-collapse: collapse; } +th { text-align: left; padding: 12px 20px; font-size: 12px; color: var(--slate-400); font-weight: 600; border-bottom: 1px solid var(--slate-100); } +td { padding: 16px 20px; font-size: 13px; color: var(--slate-700); border-bottom: 1px solid var(--slate-50); } +tr:last-child td { border: none; } + +.badge { + padding: 4px 10px; + border-radius: 6px; + font-size: 11px; + font-weight: 700; +} +.badge-new { background: #eef2ff; color: #6366f1; } +.badge-audit { background: #ecfdf5; color: #10b981; } +.badge-update { background: #eff6ff; color: #3b82f6; } +.badge-submit { background: #fff7ed; color: #f97316; } + +/* --- TASK LIST --- */ +.task-list { padding: 0 24px 24px 24px; } +.task-item { + display: flex; + align-items: flex-start; + gap: 16px; + padding: 16px; + border-radius: 12px; + margin-bottom: 12px; + background: #ffffff; + border: 1px solid var(--slate-50); + transition: all 0.2s; +} +.task-item:hover { border-color: var(--slate-200); background: var(--slate-50); } + +.task-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; color: white; } +.task-content { flex: 1; } +.task-name { font-size: 13px; font-weight: 700; color: var(--slate-800); } +.task-info { font-size: 11px; color: var(--slate-400); margin-top: 2px; } +.task-time { font-size: 11px; color: var(--slate-400); } + +.priority-tag { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; margin-top: 8px; display: inline-block; } +.p-urgent { background: #fef2f2; color: #ef4444; } +.p-high { background: #fff7ed; color: #f97316; } +.p-medium { background: #fffbeb; color: #f59e0b; } +.p-low { background: #f0fdf4; color: #10b981; } + +.view-all { text-align: center; padding: 20px; border-top: 1px solid var(--slate-50); } +.view-all a { color: var(--primary); text-decoration: none; font-size: 13px; font-weight: 700; } + +/* --- ADMIN FORM ACTIONS --- */ +#content-main { + position: relative; + padding-bottom: 24px; +} + +.object-tools { + float: none !important; + position: absolute !important; + top: 32px; + right: 32px; + margin: 0 !important; + padding: 0 !important; + font-size: 12px !important; + font-weight: 600 !important; + opacity: 1 !important; + z-index: 5; + pointer-events: auto; +} + +.object-tools li { + height: auto !important; + margin-left: 0 !important; +} + +.object-tools a:link, +.object-tools a:visited, +.object-tools a.historylink { + display: inline-flex !important; + align-items: center; + float: none !important; + padding: 8px 16px !important; + background: var(--slate-600) !important; + color: #ffffff !important; + opacity: 1 !important; + border-radius: 8px !important; + font-size: 12px !important; + font-weight: 600 !important; + text-transform: none !important; + letter-spacing: 0 !important; + text-decoration: none !important; +} + +.object-tools a:hover, +.object-tools a:focus { + background: var(--slate-700) !important; + color: #ffffff !important; + opacity: 1 !important; +} + +.submit-row { + display: flex !important; + flex-wrap: wrap; + align-items: center; + justify-content: flex-end; + gap: 10px; + overflow: visible !important; + padding: 16px 20px !important; + margin: 24px 0 0 !important; + background: #ffffff !important; + border: 1px solid var(--slate-200) !important; + border-radius: var(--radius-md) !important; + box-shadow: var(--shadow-card); +} + +.submit-row p { + margin: 0 !important; +} + +.submit-row p.deletelink-box { + float: none !important; + margin-right: auto !important; +} + +.submit-row a.deletelink { + display: inline-flex !important; + align-items: center; + justify-content: center; + height: auto !important; + min-height: 38px; + line-height: 1.4 !important; + padding: 10px 20px !important; + border-radius: 8px !important; + color: #ffffff !important; + background: var(--danger) !important; + text-decoration: none !important; + font-weight: 600; + font-size: 13px; +} + +.submit-row a.deletelink:hover, +.submit-row a.deletelink:focus { + background: #dc2626 !important; +} + +.submit-row input, +.submit-row a.button, +.submit-row .button { + height: auto !important; + min-height: 38px; + line-height: 1.4 !important; + padding: 10px 20px !important; + margin: 0 !important; + border-radius: 8px !important; + font-size: 13px !important; + font-weight: 600 !important; + text-transform: none !important; + cursor: pointer; +} + +.submit-row input.default { + background: var(--primary) !important; + border-color: var(--primary) !important; + color: #ffffff !important; +} + +.submit-row input[name="_addanother"], +.submit-row input[name="_continue"], +.submit-row input[name="_saveasnew"] { + background: #ffffff !important; + color: var(--slate-700) !important; + border: 1px solid var(--slate-300) !important; +} + +/* 双栏选择器 */ +.selector { + max-width: 100%; +} + +.selector .selector-available h2, +.selector .selector-chosen h2 { + font-size: 13px; + font-weight: 600; + color: var(--slate-700); +} + +.selector select { + max-width: 100%; +} + +.selector .selector-filter label { + font-size: 12px; + color: var(--slate-500); +} + +/* 表单模块 */ +.module h2, fieldset.module h2 { + font-size: 14px; + font-weight: 700; + color: var(--slate-800); + background: var(--slate-50) !important; + border-bottom: 1px solid var(--slate-200); +} + +.form-row label { + color: var(--slate-700) !important; + font-weight: 600; +} + +/* Hide messy native elements */ +#footer, .breadcrumbs, #content-related { display: none !important; } + +@media (max-width: 1280px) { + .stats-grid { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + + .dashboard-main-grid { + grid-template-columns: 1fr; + } +} + +@media (max-width: 768px) { + .stats-grid { + grid-template-columns: 1fr; + } + + #content { + padding: 20px !important; + } + + .topbar { + padding: 0 16px; + } +} + +/* --- LOGIN PAGE --- */ +body.login-page { + margin: 0; + padding: 0; + min-height: 100vh; + background: var(--slate-100); + overflow-x: hidden; +} + +.login-shell { + display: flex; + min-height: 100vh; + width: 100%; +} + +.login-brand { + flex: 1; + display: flex; + align-items: center; + justify-content: center; + padding: 48px; + background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%); + color: #ffffff; + position: relative; + overflow: hidden; +} + +.login-brand::before { + content: ''; + position: absolute; + inset: 0; + background: radial-gradient(circle at 20% 80%, rgba(255,255,255,0.12) 0%, transparent 50%), + radial-gradient(circle at 80% 20%, rgba(255,255,255,0.08) 0%, transparent 40%); + pointer-events: none; +} + +.login-brand-inner { + position: relative; + max-width: 420px; + z-index: 1; +} + +.login-brand-logo { + width: 56px; + height: 56px; + background: rgba(255, 255, 255, 0.2); + border-radius: 14px; + display: flex; + align-items: center; + justify-content: center; + font-size: 28px; + margin-bottom: 24px; + backdrop-filter: blur(4px); +} + +.login-brand h1 { + font-size: 36px; + font-weight: 800; + margin: 0 0 8px; + letter-spacing: -0.02em; +} + +.login-brand-tagline { + font-size: 13px; + text-transform: uppercase; + letter-spacing: 0.1em; + opacity: 0.8; + margin: 0 0 20px; +} + +.login-brand-desc { + font-size: 16px; + opacity: 0.9; + margin: 0 0 32px; + line-height: 1.6; +} + +.login-brand-features { + list-style: none; + padding: 0; + margin: 0; +} + +.login-brand-features li { + padding: 10px 0; + padding-left: 24px; + position: relative; + font-size: 14px; + opacity: 0.9; +} + +.login-brand-features li::before { + content: '✓'; + position: absolute; + left: 0; + font-weight: 700; +} + +.login-panel { + flex: 0 0 480px; + display: flex; + align-items: center; + justify-content: center; + padding: 32px; + background: var(--slate-50); +} + +.login-card { + width: 100%; + max-width: 400px; + background: #ffffff; + border-radius: var(--radius-lg); + box-shadow: var(--shadow-card); + padding: 40px 36px; + border: 1px solid var(--slate-200); +} + +.login-card-header { + margin-bottom: 28px; +} + +.login-card-header h2 { + font-size: 24px; + font-weight: 800; + color: var(--slate-900); + margin: 0 0 8px; +} + +.login-card-header p { + font-size: 14px; + color: var(--slate-500); + margin: 0; +} + +.login-error { + background: #fef2f2; + color: #dc2626; + padding: 12px 14px; + border-radius: 8px; + font-size: 13px; + margin-bottom: 20px; + border: 1px solid #fecaca; +} + +.login-form { + margin-bottom: 24px; +} + +.login-field { + margin-bottom: 20px; +} + +.login-field label { + display: block; + font-size: 13px; + font-weight: 600; + color: var(--slate-700); + margin-bottom: 8px; +} + +.login-field input[type="text"], +.login-field input[type="password"] { + width: 100%; + padding: 12px 14px; + font-size: 14px; + font-family: inherit; + border: 1px solid var(--slate-300); + border-radius: var(--radius-md); + background: #ffffff; + color: var(--slate-800); + box-sizing: border-box; + transition: border-color 0.2s, box-shadow 0.2s; +} + +.login-field input[type="text"]:focus, +.login-field input[type="password"]:focus { + outline: none; + border-color: var(--primary); + box-shadow: 0 0 0 3px var(--primary-bg); +} + +.login-submit { + width: 100%; + padding: 14px; + margin-top: 8px; + font-size: 15px; + font-weight: 700; + font-family: inherit; + color: #ffffff; + background: linear-gradient(135deg, var(--primary), #7c3aed); + border: none; + border-radius: var(--radius-md); + cursor: pointer; + transition: opacity 0.2s, transform 0.15s; +} + +.login-submit:hover { + opacity: 0.92; + transform: translateY(-1px); +} + +.login-submit:active { + transform: translateY(0); +} + +.login-demo { + background: var(--primary-bg); + border: 1px solid #e0e7ff; + border-radius: var(--radius-md); + padding: 16px; + margin-bottom: 20px; +} + +.login-demo-title { + font-size: 12px; + font-weight: 700; + color: var(--primary); + margin-bottom: 8px; +} + +.login-demo-row { + display: flex; + align-items: center; + gap: 12px; + font-size: 13px; + color: var(--slate-600); + margin-bottom: 4px; +} + +.login-demo-row span { + min-width: 48px; + color: var(--slate-500); +} + +.login-demo-row code { + font-family: 'Consolas', monospace; + background: rgba(255, 255, 255, 0.8); + padding: 2px 8px; + border-radius: 4px; + font-size: 12px; + color: var(--slate-800); +} + +.login-demo-divider { + height: 1px; + background: #e0e7ff; + margin: 12px 0; +} + +.login-footer-link { + text-align: center; +} + +.login-footer-link a { + font-size: 12px; + color: var(--slate-400); + text-decoration: none; +} + +.login-footer-link a:hover { + color: var(--primary); +} + +@media (max-width: 900px) { + .login-shell { + flex-direction: column; + } + + .login-brand { + flex: none; + padding: 32px 24px; + } + + .login-brand-inner { + max-width: 100%; + text-align: center; + } + + .login-brand-logo { + margin-left: auto; + margin-right: auto; + } + + .login-brand-features { + display: none; + } + + .login-panel { + flex: 1; + padding: 24px 16px 32px; + } +} diff --git a/static/img/icon-submitlink.gif b/static/img/icon-submitlink.gif new file mode 100644 index 0000000..6525289 Binary files /dev/null and b/static/img/icon-submitlink.gif differ diff --git a/static/img/icon-submitlink.png b/static/img/icon-submitlink.png new file mode 100644 index 0000000..5c012ad Binary files /dev/null and b/static/img/icon-submitlink.png differ diff --git a/static/img/icon-yes.gif b/static/img/icon-yes.gif new file mode 100644 index 0000000..7399282 Binary files /dev/null and b/static/img/icon-yes.gif differ diff --git a/static/js/maximus.js b/static/js/maximus.js new file mode 100644 index 0000000..b1d3f9e --- /dev/null +++ b/static/js/maximus.js @@ -0,0 +1,22 @@ +/** +author:zhugl +date:2015-05-15 +*/ +(function($) { + $(document).ready(function() { + /** + set operation type + */ + $("fieldset.workflow input[type='radio']").on('click',function(){ + operation = $(this).val(); + next = "approve/"+operation; + $("#workflow_approve").attr("href",next); + }); + try{ + $("div.inline-group table tbody tr.form-row").removeClass('has_original'); + $("div.inline-group table tbody tr.form-row td:first-child").find('p').hide(); + }catch(e){ + + } + }); +})(django.jQuery); \ No newline at end of file diff --git a/static/js/modern_ui.js b/static/js/modern_ui.js new file mode 100644 index 0000000..e80a2cf --- /dev/null +++ b/static/js/modern_ui.js @@ -0,0 +1,86 @@ +(function () { + 'use strict'; + + function ready(fn) { + if (document.readyState !== 'loading') { + fn(); + } else { + document.addEventListener('DOMContentLoaded', fn); + } + } + + function toggleSidebar() { + var collapsed = document.body.classList.toggle('sidebar-collapsed'); + try { + localStorage.setItem('erp-sidebar-collapsed', collapsed ? '1' : '0'); + } catch (e) {} + updateCollapseLabel(); + } + + function updateCollapseLabel() { + var btn = document.getElementById('sidebarCollapseBtn'); + if (!btn) { + return; + } + var collapsed = document.body.classList.contains('sidebar-collapsed'); + btn.innerHTML = collapsed + ? ' 展开菜单' + : ' 收起菜单'; + } + + function restoreSidebarState() { + try { + if (localStorage.getItem('erp-sidebar-collapsed') === '1') { + document.body.classList.add('sidebar-collapsed'); + } + } catch (e) {} + updateCollapseLabel(); + } + + function toggleUserMenu() { + var menu = document.getElementById('userDropdown'); + if (!menu) { + return; + } + var open = menu.classList.toggle('open'); + if (open) { + document.addEventListener('click', closeUserMenuOutside); + } else { + document.removeEventListener('click', closeUserMenuOutside); + } + } + + function closeUserMenuOutside(e) { + var menu = document.getElementById('userDropdown'); + var profile = document.getElementById('userProfileToggle'); + if (!menu || !profile) { + return; + } + if (!menu.contains(e.target) && !profile.contains(e.target)) { + menu.classList.remove('open'); + document.removeEventListener('click', closeUserMenuOutside); + } + } + + function bindClick(id, handler) { + var el = document.getElementById(id); + if (el) { + el.addEventListener('click', function (e) { + e.preventDefault(); + e.stopPropagation(); + handler(e); + }); + } + } + + ready(function () { + restoreSidebarState(); + + bindClick('topbarMenuBtn', toggleSidebar); + bindClick('sidebarCollapseBtn', toggleSidebar); + bindClick('topbarNotifyBtn', function () { + window.location.href = '/admin/workflow/todolist/'; + }); + bindClick('userProfileToggle', toggleUserMenu); + }); +})(); diff --git a/static/js/workorder.js b/static/js/workorder.js new file mode 100644 index 0000000..3ec5748 --- /dev/null +++ b/static/js/workorder.js @@ -0,0 +1,11 @@ +/** + * Created by Administrator on 15-5-23. + */ +(function($) { + $(document).ready(function() { + /** + set operation type + */ + $("#woextravalue_set-group select").attr('readonly','true') + }); +})(django.jQuery); diff --git a/syscfg/__init__.py b/syscfg/__init__.py new file mode 100644 index 0000000..557efda --- /dev/null +++ b/syscfg/__init__.py @@ -0,0 +1,2 @@ + +default_app_config = 'syscfg.apps.SysConfig' \ No newline at end of file diff --git a/syscfg/admin.py b/syscfg/admin.py new file mode 100644 index 0000000..cf8f765 --- /dev/null +++ b/syscfg/admin.py @@ -0,0 +1,53 @@ +# coding=utf-8 +from django.contrib import admin +from django.forms import ModelForm,DateField +from syscfg.models import * +from common import generic + + +class SiteForm(ModelForm): + """ + + """ + class Meta: + model = Site + fields = '__all__' + + +class SiteAdmin(admin.ModelAdmin): + list_per_page = 10 + list_display = ['name', 'begin', 'end'] + fields = (('begin', 'end'), 'name', 'description', 'user') + filter_horizontal = ['user'] + form = SiteForm + + +class ModuleAdmin(generic.BOAdmin): + CODE_NUMBER_WIDTH = 3 + CODE_PREFIX = 'U' + list_display = ['code','name','parent','status'] + ordering = ['weight'] + raw_id_fields = ['parent'] + + +class MenuAdmin(generic.BOAdmin): + CODE_NUMBER_WIDTH = 3 + CODE_PREFIX = 'M' + + list_display = ['code','name','module','status'] + list_filter = ['module'] + ordering = ['weight'] + raw_id_fields = ['module'] + + +class RoleAdmin(generic.BOAdmin): + CODE_NUMBER_WIDTH = 3 + CODE_PREFIX = 'R' + list_display = ['code','name','status'] + filter_horizontal = ['users','menus'] + + +admin.site.register(Site, SiteAdmin) +admin.site.register(Module,ModuleAdmin) +admin.site.register(Menu,MenuAdmin) +admin.site.register(Role,RoleAdmin) diff --git a/syscfg/apps.py b/syscfg/apps.py new file mode 100644 index 0000000..eb97ebd --- /dev/null +++ b/syscfg/apps.py @@ -0,0 +1,9 @@ +__author__ = 'zhugl' +# created at 15-4-22 +from django.apps.config import AppConfig +from django.utils.translation import ugettext_lazy as _ + + +class SysConfig(AppConfig): + name = 'syscfg' + verbose_name = _('SysConfig') \ No newline at end of file diff --git a/syscfg/models.py b/syscfg/models.py new file mode 100644 index 0000000..b84eebd --- /dev/null +++ b/syscfg/models.py @@ -0,0 +1,79 @@ +# coding=utf-8 +from django.db import models +from django.contrib.auth.models import User +from django.utils.translation import ugettext_lazy as _ +from common import const +from common import generic + + +class Site(models.Model): + """ + 站点,一个站点下可有多个公司,处于同一个站点下的用户逻辑上位于同一个组织 + """ + index_weight = 1 + begin = models.DateField(_('begin date'), blank=True,null=True) + end = models.DateField(_('end date'), blank=True,null=True) + name = models.CharField(_('site name'), max_length=const.DB_CHAR_NAME_40) + description = models.TextField(_('site description'),blank=True,null=True) + user = models.ManyToManyField(User,verbose_name=_('administrator')) + + def __unicode__(self): + return u'%s'%self.name + + class Meta: + verbose_name = _('Site') + verbose_name_plural = _('Site') + + +class Module(generic.BO): + """ + 模块管理 + """ + index_weight = 2 + code = models.CharField(_("module code"),max_length=const.DB_CHAR_CODE_6,blank=True,null=True) + name = models.CharField(_("module name"),max_length=const.DB_CHAR_NAME_40) + url = models.URLField(_("module url"),blank=True,null=True,max_length=const.DB_CHAR_NAME_80) + weight = models.IntegerField(_("weight"),blank=True,null=True,default=99) + icon = models.CharField(_("style class"),blank=True,null=True,max_length=const.DB_CHAR_NAME_40) + parent = models.ForeignKey('self',blank=True,null=True,verbose_name=_("parent")) + status = models.BooleanField(_("in use"),default=True) + + class Meta: + verbose_name = _("module") + verbose_name_plural = _("module") + + +class Menu(generic.BO): + """ + 菜单管理 + """ + index_weight = 3 + module = models.ForeignKey(Module,verbose_name=_("module")) + code = models.CharField(_("menu code"),max_length=const.DB_CHAR_CODE_6,blank=True,null=True) + name = models.CharField(_("menu name"),max_length=const.DB_CHAR_NAME_40) + url = models.URLField(_("menu url"),blank=True,null=True,max_length=const.DB_CHAR_NAME_80) + weight = models.IntegerField(_("weight"),blank=True,null=True,default=99) + icon = models.CharField(_("style class"),blank=True,null=True,max_length=const.DB_CHAR_NAME_40) + status = models.BooleanField(_("in use"),default=True) + + class Meta: + verbose_name = _("menu") + verbose_name_plural = _("menu") + + +class Role(generic.BO): + """ + 角色管理,分配用户所拥有的菜单 + """ + index_weight = 4 + code = models.CharField(_("role code"),max_length=const.DB_CHAR_CODE_6,blank=True,null=True) + name = models.CharField(_("role name"),max_length=const.DB_CHAR_NAME_40) + description = models.CharField(_("description"),max_length=const.DB_CHAR_NAME_80,blank=True,null=True) + status = models.BooleanField(_("in use"),default=True) + parent = models.ForeignKey('self',blank=True,null=True,verbose_name=_("parent")) + users = models.ManyToManyField(User,verbose_name=_("role users"),blank=True) + menus = models.ManyToManyField(Menu,verbose_name=_("role menus"),blank=True) + + class Meta: + verbose_name = _("role") + verbose_name_plural = _("role") diff --git a/syscfg/tests.py b/syscfg/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/syscfg/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/syscfg/views.py b/syscfg/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/syscfg/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/templates/admin/app_index.html b/templates/admin/app_index.html new file mode 100644 index 0000000..874ee81 --- /dev/null +++ b/templates/admin/app_index.html @@ -0,0 +1,17 @@ +{% extends "admin/index.html" %} +{% load i18n %} + +{% block bodyclass %}{{ block.super }} app-{{ app_label }}{% endblock %} + +{% if not is_popup %} +{% block breadcrumbs %} + +{% endblock %} +{% endif %} + +{% block sidebar %}{% endblock %} diff --git a/templates/admin/base.html b/templates/admin/base.html new file mode 100644 index 0000000..5ff6f58 --- /dev/null +++ b/templates/admin/base.html @@ -0,0 +1,122 @@ +{% load i18n admin_static %} +{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %} + + +{% block title %}{% endblock %} + + +{% block extrastyle %}{% endblock %} + +{% if LANGUAGE_BIDI %}{% endif %} + + +{% block extrahead %}{% endblock %} +{% block blockbots %}{% endblock %} + +{% load i18n %} + + + + +
+ + {% if not is_popup %} + + + {% endif %} + +
+ {% if not is_popup %} +
+
+ + +
+
+ +
+ + +
+
+
+ {% endif %} + + {% block messages %} + {% if messages %} +
    {% for message in messages %} + {{ message|capfirst }} + {% endfor %}
+ {% endif %} + {% endblock messages %} + + +
+ {% block pretitle %}{% endblock %} + {% block content_title %}{% if title %}

{{ title }}

{% endif %}{% endblock %} + {% block content %} + {% block object-tools %}{% endblock %} + {{ content }} + {% endblock %} + {% block sidebar %}{% endblock %} +
+
+ + + {% if not is_popup %} + {% block footer %} + + {% endblock %} + {% endif %} +
+
+ + + + + diff --git a/templates/admin/change_form.html b/templates/admin/change_form.html new file mode 100644 index 0000000..93045f1 --- /dev/null +++ b/templates/admin/change_form.html @@ -0,0 +1,148 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_urls admin_static admin_modify %} + +{% block extrahead %}{{ block.super }} + +{{ media }} +{% endblock %} + +{% block extrastyle %}{{ block.super }}{% endblock %} + +{% block coltype %}colM{% endblock %} + +{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %} + +{% if not is_popup %} +{% block breadcrumbs %} + +{% endblock %} +{% endif %} + +{% block content %}
+{% block object-tools %} +{% if change %}{% if not is_popup %} + +{% endif %}{% endif %} +{% endblock %} +
{% csrf_token %}{% block form_top %}{% endblock %} +
+{% if is_popup %}{% endif %} +{% if to_field %}{% endif %} +{% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %} +{% if show_workflow_line%} +
+

{% trans "workflow approve" %}

+
+ {% if can_restart %} + {% trans "restart workflow" %} +

{% trans "your apply has been denied,you can restart a new apply" %}

+ {% else %} + + + + {% trans "submit" %} + {% endif %} +
+
+{% endif %} +{% if errors %} +

+ {% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} +

+ {{ adminform.form.non_field_errors }} +{% endif %} + +{% block field_sets %} +{% for fieldset in adminform %} + {% include "admin/includes/fieldset.html" %} +{% endfor %} +{% endblock %} + +{% block after_field_sets %}{% endblock %} + +{% block inline_field_sets %} +{% for inline_admin_formset in inline_admin_formsets %} + {% include inline_admin_formset.opts.template %} +{% endfor %} +{% endblock %} + +{% block after_related_objects %}{% endblock %} + +{% block submit_buttons_bottom %}{% submit_row %}{% endblock %} + +{% block admin_change_form_document_ready %} + +{% endblock %} + +{# JavaScript for prepopulated fields #} +{% prepopulated_fields_js %} + +
+
+{% endblock %} diff --git a/templates/admin/index.html b/templates/admin/index.html new file mode 100644 index 0000000..34edb90 --- /dev/null +++ b/templates/admin/index.html @@ -0,0 +1,162 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_static %} + +{% block content %} +
+ +
+
+
+
+ +
+
销售总额
+
¥ 8,231,078
+ +
+
+
+
📋
+ +
+
待办审批
+
32
+ +
+
+
+
📦
+ +
+
库存预警
+
18
+ +
+
+
+
🖥️
+ +
+
系统在线
+
98.6%
+ +
+
+ + +
+ +
+
最近操作日志
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
时间操作人模块操作类型操作内容IP地址
2025-05-22 10:24:31张伟销售管理新增新增销售订单 SO-20250522-001192.168.1.100
2025-05-22 10:18:44李娜采购管理审核审核采购订单 PO-20250522-045192.168.1.101
2025-05-22 09:56:12王强库存管理更新更新库存调拔单 TB-20250522-009192.168.1.102
2025-05-22 09:41:07张伟审批中心提交提交费用报销单 FB-20250522-008192.168.1.100
+
+
+ 共 120 条记录 +
+ 1 + 2 + 3 +
+
+
+ + +
+
+ 待办任务 + 更多 > +
+
+
+
📄
+
+
费用报销单审批
+
报销人:张伟
+ 紧急 +
+
10分钟前
+
+
+
🛒
+
+
采购订单审批
+
单号:PO-20250522-047
+ +
+
30分钟前
+
+
+
💰
+
+
销售订单审批
+
单号:SO-20250522-004
+ +
+
1小时前
+
+
+ +
+
+
+{% endblock %} diff --git a/templates/admin/invent/inventory/change_form.html b/templates/admin/invent/inventory/change_form.html new file mode 100644 index 0000000..a6e147e --- /dev/null +++ b/templates/admin/invent/inventory/change_form.html @@ -0,0 +1,167 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_urls admin_static admin_modify %} + +{% block extrahead %}{{ block.super }} + +{{ media }} +{% endblock %} + +{% block extrastyle %}{{ block.super }}{% endblock %} + +{% block coltype %}colM{% endblock %} + +{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %} + +{% if not is_popup %} +{% block breadcrumbs %} + +{% endblock %} +{% endif %} + +{% block content %}
+{% block object-tools %} +{% if change %}{% if not is_popup %} + +{% endif %}{% endif %} +{% endblock %} +
{% csrf_token %}{% block form_top %}{% endblock %} +
+{% if is_popup %}{% endif %} +{% if to_field %}{% endif %} +{% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %} +{% if show_workflow_line%} +
+

{% trans "workflow approve" %}

+
+ {% if can_restart %} + {% trans "restart workflow" %} +

{% trans "your apply has been denied,you can restart a new apply" %}

+ {% else %} + + + + {% trans "submit" %} + {% endif %} +
+
+{% endif %} +{% if errors %} +

+ {% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} +

+ {{ adminform.form.non_field_errors }} +{% endif %} + +{% block field_sets %} +{% for fieldset in adminform %} + {% include "admin/includes/fieldset.html" %} +{% endfor %} +{% endblock %} + +{% block after_field_sets %}{% endblock %} + +{% block inline_field_sets %} +{% for inline_admin_formset in inline_admin_formsets %} + {% include inline_admin_formset.opts.template %} +{% endfor %} +{% endblock %} + +{% block after_related_objects %}{% endblock %} + +{% block submit_buttons_bottom %}{% submit_row %}{% endblock %} + +{% block admin_change_form_document_ready %} + +{% endblock %} + +{# JavaScript for prepopulated fields #} +{% prepopulated_fields_js %} + +
+
+{% if detail %} +

{% trans "InOut History" %}

+
+ + + + + + + + + + + + + + {% for item in detail %} + + + + + + + + + + {% endfor %} + + +
{% trans 'execute time' %}{% trans 'plus or minus prop' %}{% trans 'price' %}{% trans 'count' %}{% trans 'measure' %}{% trans 'status' %}{% trans 'source' %}
{{ item.event_time|date:"DATETIME_FORMAT" }}{{ item.prop }}{{ item.price }}{{ item.cnt }}{{ item.measure }}{% if item.status %} {% trans 'EXECUTED'%} {% endif %}{{ item.source }}
+
+{% endif %} +{% endblock %} diff --git a/templates/admin/invent/stockin/change_form.html b/templates/admin/invent/stockin/change_form.html new file mode 100644 index 0000000..453b691 --- /dev/null +++ b/templates/admin/invent/stockin/change_form.html @@ -0,0 +1,136 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_urls admin_static admin_modify %} + +{% block extrahead %}{{ block.super }} + +{{ media }} +{% endblock %} + +{% block extrastyle %}{{ block.super }}{% endblock %} + +{% block coltype %}colM{% endblock %} + +{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %} + +{% if not is_popup %} +{% block breadcrumbs %} + +{% endblock %} +{% endif %} + +{% block content %}
+{% block object-tools %} +{% if change %}{% if not is_popup %} + +{% endif %}{% endif %} +{% endblock %} +
{% csrf_token %}{% block form_top %}{% endblock %} +
+{% if is_popup %}{% endif %} +{% if to_field %}{% endif %} +{% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %} +{% if show_workflow_line%} +
+

{% trans "workflow approve" %}

+
+ {% if can_restart %} + {% trans "restart workflow" %} +

{% trans "your apply has been denied,you can restart a new apply" %}

+ {% else %} + + + + {% trans "submit" %} + {% endif %} +
+
+{% endif %} +{% if errors %} +

+ {% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} +

+ {{ adminform.form.non_field_errors }} +{% endif %} + +{% block field_sets %} +{% for fieldset in adminform %} + {% include "admin/includes/fieldset.html" %} +{% endfor %} +{% endblock %} + +{% block after_field_sets %}{% endblock %} + +{% block inline_field_sets %} +{% for inline_admin_formset in inline_admin_formsets %} + {% include inline_admin_formset.opts.template %} +{% endfor %} +{% endblock %} + +{% block after_related_objects %}{% endblock %} + +{% block submit_buttons_bottom %}{% submit_row %}{% endblock %} + +{% block admin_change_form_document_ready %} + +{% endblock %} + +{# JavaScript for prepopulated fields #} +{% prepopulated_fields_js %} + +
+
+{% endblock %} diff --git a/templates/admin/invent/stockin/in_confirmation.html b/templates/admin/invent/stockin/in_confirmation.html new file mode 100644 index 0000000..07ff43c --- /dev/null +++ b/templates/admin/invent/stockin/in_confirmation.html @@ -0,0 +1,27 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_urls %} + +{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation{% endblock %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block content %} +

{% trans 'Are your sure to execute the operations?' %}

+
{% csrf_token %} +
+ + {% if is_popup %}{% endif %} + {% if to_field %}{% endif %} + + {% trans "No, take me back" %} +
+
+{% endblock %} diff --git a/templates/admin/invent/stockout/change_form.html b/templates/admin/invent/stockout/change_form.html new file mode 100644 index 0000000..3e8227e --- /dev/null +++ b/templates/admin/invent/stockout/change_form.html @@ -0,0 +1,137 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_urls admin_static admin_modify %} + +{% block extrahead %}{{ block.super }} + +{{ media }} +{% endblock %} + +{% block extrastyle %}{{ block.super }}{% endblock %} + +{% block coltype %}colM{% endblock %} + +{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %} + +{% if not is_popup %} +{% block breadcrumbs %} + +{% endblock %} +{% endif %} + +{% block content %}
+{% block object-tools %} +{% if change %}{% if not is_popup %} + +{% endif %}{% endif %} +{% endblock %} +
{% csrf_token %}{% block form_top %}{% endblock %} +
+{% if is_popup %}{% endif %} +{% if to_field %}{% endif %} +{% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %} +{% if show_workflow_line%} +
+

{% trans "workflow approve" %}

+
+ {% if can_restart %} + {% trans "restart workflow" %} +

{% trans "your apply has been denied,you can restart a new apply" %}

+ {% else %} + + + + {% trans "submit" %} + {% endif %} +
+
+{% endif %} +{% if errors %} +

+ {% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} +

+ {{ adminform.form.non_field_errors }} +{% endif %} + +{% block field_sets %} +{% for fieldset in adminform %} + {% include "admin/includes/fieldset.html" %} +{% endfor %} +{% endblock %} + +{% block after_field_sets %}{% endblock %} + +{% block inline_field_sets %} +{% for inline_admin_formset in inline_admin_formsets %} + {% include inline_admin_formset.opts.template %} +{% endfor %} +{% endblock %} + +{% block after_related_objects %}{% endblock %} + +{% block submit_buttons_bottom %}{% submit_row %}{% endblock %} + +{% block admin_change_form_document_ready %} + +{% endblock %} + +{# JavaScript for prepopulated fields #} +{% prepopulated_fields_js %} + +
+
+{% endblock %} diff --git a/templates/admin/invent/stockout/out_confirmation.html b/templates/admin/invent/stockout/out_confirmation.html new file mode 100644 index 0000000..590a703 --- /dev/null +++ b/templates/admin/invent/stockout/out_confirmation.html @@ -0,0 +1,27 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_urls %} + +{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation{% endblock %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block content %} +

{% trans 'Are your sure to execute the check out operations?' %}

+
{% csrf_token %} +
+ + {% if is_popup %}{% endif %} + {% if to_field %}{% endif %} + + {% trans "No, take me back" %} +
+
+{% endblock %} diff --git a/templates/admin/login.html b/templates/admin/login.html new file mode 100644 index 0000000..51ed30c --- /dev/null +++ b/templates/admin/login.html @@ -0,0 +1,75 @@ +{% extends "admin/login_base.html" %} +{% load i18n admin_static %} + +{% block content %} + +{% endblock %} diff --git a/templates/admin/login_base.html b/templates/admin/login_base.html new file mode 100644 index 0000000..2f39342 --- /dev/null +++ b/templates/admin/login_base.html @@ -0,0 +1,13 @@ +{% load i18n admin_static %} + + + + + {% block title %}登录 | 智捷ERP{% endblock %} + + {% block extrastyle %}{% endblock %} + + + {% block content %}{% endblock %} + + diff --git a/templates/admin/object_history.html b/templates/admin/object_history.html new file mode 100644 index 0000000..42ca717 --- /dev/null +++ b/templates/admin/object_history.html @@ -0,0 +1,82 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_urls %} +{% block extrastyle %} + +{% endblock %} +{% block breadcrumbs %} + +{% endblock %} + +{% block content %} +
+
+ +{% if action_list %} + + + + + + + + + + {% for action in action_list %} + + + + + + {% endfor %} + +
{% trans 'Date/time' %}{% trans 'User' %}{% trans 'Action' %}
{{ action.action_time|date:"DATETIME_FORMAT" }}{{ action.user.get_username }}{% if action.user.get_full_name %} ({{ action.user.get_full_name }}){% endif %}{{ action.change_message }}
+{% else %} +

{% trans "This object doesn't have a change history. It probably wasn't added via this admin site." %}

+{% endif %} +
+{% if history_list %} +

{% trans "Workflow History" %}

+
+ + + + + + + + + + + + {% for history in history_list %} + + + + + + + + {% endfor %} + {% if todo_list %} + {% for todo in todo_list %} + + + + + + + + {% endfor %} + {% endif %} + +
{% trans 'Date/time' %}{% trans 'User' %}{% trans 'node' %}{% trans 'Action' %}{% trans 'Workflow Memo' %}
{{ history.pro_time|date:"DATETIME_FORMAT" }}{{ history.user.get_username }}{% if history.user.get_full_name %} ({{ history.user.get_full_name }}){% endif %}{{ history.get_node_desc }}{{ history.get_action_desc }}{{ history.get_memo_desc }}
{% if todo.is_read %}{{ todo.read_time|date:"DATETIME_FORMAT" }}{% endif %}{{ todo.user.get_username }}{% if todo.user.get_full_name %} ({{ todo.user.get_full_name }}){% endif %}{{ todo.node.name }}{% if todo.is_read %} {% trans 'already read' %} {% else %} {% trans 'unread' %} {% endif %}
+
+{% endif %} +
+{% endblock %} diff --git a/templates/admin/selfhelp/workorder/change_form.html b/templates/admin/selfhelp/workorder/change_form.html new file mode 100644 index 0000000..02f9efc --- /dev/null +++ b/templates/admin/selfhelp/workorder/change_form.html @@ -0,0 +1,173 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_urls admin_static admin_modify %} + +{% block extrahead %}{{ block.super }} + +{{ media }} +{% endblock %} + +{% block extrastyle %}{{ block.super }}{% endblock %} + +{% block coltype %}colM{% endblock %} + +{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %} + +{% if not is_popup %} +{% block breadcrumbs %} + +{% endblock %} +{% endif %} + +{% block content %}
+{% block object-tools %} +{% if change %}{% if not is_popup %} + +{% endif %}{% endif %} +{% endblock %} +
{% csrf_token %}{% block form_top %}{% endblock %} +
+{% if is_popup %}{% endif %} +{% if to_field %}{% endif %} +{% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %} +{% if show_workflow_line%} +
+

{% trans "workflow approve" %}

+
+ {% if can_restart %} + {% trans "restart workflow" %} +

{% trans "your apply has been denied,you can restart a new apply" %}

+ {% else %} + + + + {% trans "submit" %} + {% endif %} +
+
+{% endif %} +{% if errors %} +

+ {% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} +

+ {{ adminform.form.non_field_errors }} +{% endif %} + +{% block field_sets %} +{% for fieldset in adminform %} + {% include "admin/includes/fieldset.html" %} +{% endfor %} +{% endblock %} + +{% block after_field_sets %}{% endblock %} + +{% block inline_field_sets %} +{% for inline_admin_formset in inline_admin_formsets %} + {% include inline_admin_formset.opts.template %} +{% endfor %} +{% endblock %} + +{% block after_related_objects %}{% endblock %} + +{% block submit_buttons_bottom %}{% submit_row %}{% endblock %} + +{% block admin_change_form_document_ready %} + +{% endblock %} + +{# JavaScript for prepopulated fields #} +{% prepopulated_fields_js %} + +
+
+{% endblock %} diff --git a/templates/admin/submit_line.html b/templates/admin/submit_line.html new file mode 100644 index 0000000..9ae7940 --- /dev/null +++ b/templates/admin/submit_line.html @@ -0,0 +1,18 @@ +{% load i18n admin_urls %} +
+ +{% if show_save %}{% endif %} +{% trans "submit" %} + {% for button in extra_buttons %} +{{button.title}} + {% endfor %} + {{extra_buttons}} +{% if show_delete_link %} + {% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %} + +{% endif %} +{% if show_save_as_new %}{% endif %} +{% if show_save_and_add_another %}{% endif %} +{% if show_save_and_continue %}{% endif %} +
diff --git a/templates/admin/workflow/node/change_form.html b/templates/admin/workflow/node/change_form.html new file mode 100644 index 0000000..4358e4d --- /dev/null +++ b/templates/admin/workflow/node/change_form.html @@ -0,0 +1,164 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_urls admin_static admin_modify %} + +{% block extrahead %}{{ block.super }} + +{{ media }} +{% endblock %} + +{% block extrastyle %}{{ block.super }}{% endblock %} + +{% block coltype %}colM{% endblock %} + +{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %} + +{% if not is_popup %} +{% block breadcrumbs %} + +{% endblock %} +{% endif %} + +{% block content %}
+{% block object-tools %} +{% if change %}{% if not is_popup %} + +{% endif %}{% endif %} +{% endblock %} +
{% csrf_token %}{% block form_top %}{% endblock %} +
+{% if is_popup %}{% endif %} +{% if to_field %}{% endif %} +{% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %} +{% if show_workflow_line%} +
+

{% trans "workflow approve" %}

+
+ {% if can_restart %} + {% trans "restart workflow" %} +

{% trans "your apply has been denied,you can restart a new apply" %}

+ {% else %} + + + + {% trans "submit" %} + {% endif %} +
+
+{% endif %} +{% if errors %} +

+ {% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} +

+ {{ adminform.form.non_field_errors }} +{% endif %} + +{% block field_sets %} +{% for fieldset in adminform %} + {% include "admin/includes/fieldset.html" %} +{% endfor %} +{% endblock %} + +{% block after_field_sets %}{% endblock %} + +{% block inline_field_sets %} +{% for inline_admin_formset in inline_admin_formsets %} + {% include inline_admin_formset.opts.template %} +{% endfor %} +{% endblock %} + +{% block after_related_objects %}{% endblock %} + +{% block submit_buttons_bottom %}{% submit_row %}{% endblock %} + +{% block admin_change_form_document_ready %} + +{% endblock %} + +{# JavaScript for prepopulated fields #} +{% prepopulated_fields_js %} + +
+
+{% endblock %} diff --git a/templates/default/workflow/workflow_approve_confirmation.html b/templates/default/workflow/workflow_approve_confirmation.html new file mode 100644 index 0000000..87588ea --- /dev/null +++ b/templates/default/workflow/workflow_approve_confirmation.html @@ -0,0 +1,67 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_urls %} +{% block extrastyle %}{{ block.super }}{% endblock %} +{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation{% endblock %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block content %} +{% if operation == '4' %} +

{% trans "Are you sure to terminate the request?" %}

+{% elif operation == '3' %} +

{% trans "Are you sure to deny the request?" %}

+{% else %} +

{% blocktrans with escaped_object=object %}Are you sure you want to submit the {{ object_name }} "{{ escaped_object }}"? {% endblocktrans %}

+{% endif%} +

{{ workflow_modal.code }} {{ workflow_modal.name }}

+ +
{% csrf_token %} + {% if is_stop_node %} +

{% trans "current node is stop node,click the submit button to complete it" %}

+ {% else %} + {% for node_user in node_users %} + {% if node_user.node == 'start'%} +

{% trans "back to start node" %}

+ {%else%} +

{% trans "next node" %}:{{ node_user.node.name }}

+ {% endif%} + {% if next_node_description %} +

{% trans "attention" %}:{{next_node_description}}

+ {% endif %} + {% if node_has_users %} +
    + {% for user in node_user.users %} +
  • {{user.last_name}}{{user.first_name}}
  • + {% endfor %} +
+ {% else %} +

{% trans "No user was configured to handle this node"%}

+ {% endif %} + {% endfor%} + {% endif%} + {% if is_stop_node or node_has_users%} + + +
+ + + {% if is_popup %}{% endif %} + {% if to_field %}{% endif %} + + {% trans "No, take me back" %} +
+ {% else %} + {% if is_popup %}{% endif %} + {% if to_field %}{% endif %} + {% trans "No, take me back" %} + {% endif %} +
+{% endblock %} diff --git a/templates/default/workflow/workflow_start_confirmation.html b/templates/default/workflow/workflow_start_confirmation.html new file mode 100644 index 0000000..c498ceb --- /dev/null +++ b/templates/default/workflow/workflow_start_confirmation.html @@ -0,0 +1,46 @@ +{% extends "admin/base_site.html" %} +{% load i18n admin_urls %} + +{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation{% endblock %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block content %} +{% if has_workflow %} +

{% blocktrans with escaped_object=object %}Are you sure you want to submit the {{ object_name }} "{{ escaped_object }}"? {% endblocktrans %}

+

{{ workflow_modal.code }} {{ workflow_modal.name }}

+ +
{% csrf_token %} + {% if next_node %} +

{% trans "next node" %}:{{ next_node.name }}

+ {% if has_next_user %} +
    + {% for user in next_users %} +
  • {{user.last_name}}{{user.first_name}}
  • + {% endfor %} +
+ {% else %} +

{% trans "No user was configured to handle this node"%}

+ {% endif %} + {% endif %} +
+ + {% if is_popup %}{% endif %} + {% if to_field %}{% endif %} + + {% trans "No, take me back" %} +
+
+{% else %} +

{% trans "you needs to config a workflow model for this content type" %}

+ {% trans "OK" %} +{% endif %} +{% endblock %} diff --git a/upload/doc/1001部门岗位员工导入模板.xls b/upload/doc/1001部门岗位员工导入模板.xls new file mode 100644 index 0000000..770b396 Binary files /dev/null and b/upload/doc/1001部门岗位员工导入模板.xls differ diff --git a/upload/doc/1002期初库存导入模板.csv b/upload/doc/1002期初库存导入模板.csv new file mode 100644 index 0000000..beffe50 --- /dev/null +++ b/upload/doc/1002期初库存导入模板.csv @@ -0,0 +1,11 @@ +ϱ,,ͺ,,λ,ֿ,ֿ,, +IT9001,츻ʿƻ,#80,KG,ǧˣ,FR,ˮ,5.6,120 +IT9002,ˮ,#75,KG,ǧˣ,FR,ˮ,8.2,105 +IT9003,ĸʿ,#80,KG,ǧˣ,FR,ˮ,9.5,569 +IT9004,,,KG,ǧˣ,FR,ˮ,6.5,159 +IT9005,ɽ,,KG,ǧˣ,FR,ˮ,7.8,276 +IT9006,ϳ,,KG,ǧˣ,FR,ˮ,6.9,309 +IT9007,ë,,KG,ǧˣ,FR,ˮ,12.6,38 +IT9008,Ļ,,KG,ǧˣ,FR,ˮ,8.2,98 +IT9009,ʥŮ,,KG,ǧˣ,FR,ˮ,8.9,315 +IT9010,,,KG,ǧˣ,FR,ˮ,14.6,212 diff --git a/upload/doc/1003合作伙伴导入模板.xls b/upload/doc/1003合作伙伴导入模板.xls new file mode 100644 index 0000000..d5aeea1 Binary files /dev/null and b/upload/doc/1003合作伙伴导入模板.xls differ diff --git a/upload/doc/1004项目导入模板.xls b/upload/doc/1004项目导入模板.xls new file mode 100644 index 0000000..20032e0 Binary files /dev/null and b/upload/doc/1004项目导入模板.xls differ diff --git a/upload/doc/2001报价单明细样例.xls b/upload/doc/2001报价单明细样例.xls new file mode 100644 index 0000000..1d2bf17 Binary files /dev/null and b/upload/doc/2001报价单明细样例.xls differ diff --git a/upload/doc/2002需求计划明细样例.xls b/upload/doc/2002需求计划明细样例.xls new file mode 100644 index 0000000..a8bdd29 Binary files /dev/null and b/upload/doc/2002需求计划明细样例.xls differ diff --git a/upload/doc/2003采购单明细样例.xls b/upload/doc/2003采购单明细样例.xls new file mode 100644 index 0000000..071e9f8 Binary files /dev/null and b/upload/doc/2003采购单明细样例.xls differ diff --git a/workflow/__init__.py b/workflow/__init__.py new file mode 100644 index 0000000..7257d56 --- /dev/null +++ b/workflow/__init__.py @@ -0,0 +1 @@ +default_app_config = 'workflow.apps.WorkflowConfig' \ No newline at end of file diff --git a/workflow/admin.py b/workflow/admin.py new file mode 100644 index 0000000..39fe49d --- /dev/null +++ b/workflow/admin.py @@ -0,0 +1,118 @@ +from django.contrib import admin +from django.contrib.contenttypes.models import ContentType +from common import generic +from workflow.models import Modal,Node,TodoList,Instance,History + + +class NodeInline(admin.TabularInline): + model = Node + fields = ['code','name','next_user_handler','can_deny','can_terminate'] + + def get_extra(self, request, obj=None, **kwargs): + if obj: + return 0 + else: + return 1 + + +class WorkflowModelAdmin(admin.ModelAdmin): + list_display = ['code','name','begin','end'] + inlines = [NodeInline] + readonly_fields = ['app_name','model_name'] + raw_id_fields = ['content_type'] + fields = ( + ('begin','end',),('code','name',),('description',),('content_type',),('app_name','model_name',), + ) + + def get_form(self, request, obj=None, **kwargs): + print kwargs + return super(WorkflowModelAdmin,self).get_form(request,obj,**kwargs) + + def save_model(self, request, obj, form, change): + import datetime + super(WorkflowModelAdmin,self).save_model(request,obj,form,change) + + if not obj.code: + code = 'WF%03d' % obj.id + obj.code = code + obj.save() + if not obj.begin: + obj.begin = datetime.date.today() + obj.end = datetime.date(9999,12,31) + app_name = obj.content_type.app_label + model_name = obj.content_type.model + obj.app_name = app_name + obj.model_name = model_name + obj.save() + + +class WorkflowNodeAdmin(admin.ModelAdmin): + fields = ( + ('modal',), + ('name','code',), + ('start','stop','can_terminate','can_deny','can_edit',), + ('email_notice','short_message_notice','approve_node',),('next',), + ('handler_type',), + ('handler',), + ('next_user_handler','next_node_handler',), + ('status_field','status_value',),('action',), + ('users',),('positions',),('roles',), + ) + list_display = ['code','name','modal','can_deny','can_terminate'] + list_display_links = ['code','name'] + list_filter = ['modal'] + readonly_fields = ['modal','code'] + filter_horizontal = ['next','users','positions','roles','departments',] + radio_fields = {'handler_type':admin.HORIZONTAL} + search_fields = ['modal__code','modal__name','code','name'] + + def get_readonly_fields(self, request, obj=None): + if obj and obj.stop: + return ['modal','code','next'] + return super(WorkflowNodeAdmin,self).get_readonly_fields(request,obj) + + def formfield_for_manytomany(self, db_field, request=None, **kwargs): + if db_field.name == 'next': + apps = generic.get_app_model_info_from_request(request) + # print apps + if apps and apps.get('obj'): + # print 'it is here' + obj = apps.get('obj') + # print obj.modal + kwargs['queryset'] = Node.objects.filter(modal=obj.modal).exclude(id=obj.id) + else: + kwargs['queryset'] = Node.objects.filter(id=-1) + + return super(WorkflowNodeAdmin,self).formfield_for_manytomany(db_field,request,**kwargs) + + +class InstanceAdmin(admin.ModelAdmin): + list_display = ['code','modal','starter','start_time','status'] + readonly_fields = ['code','modal','starter','start_time','status','object_id','approved_time','current_nodes'] + + +class TodoAdmin(admin.ModelAdmin): + list_display = ['code_link','modal_dsc','href','node_dsc','is_read','status','submitter','arrived_time'] + list_filter = ['status'] + + def get_queryset(self, request): + return super(TodoAdmin,self).get_queryset(request).filter(user=request.user) + + +class HistoryAdmin(admin.ModelAdmin): + list_display = ['inst','node','user','pro_time','memo'] + + +class ContentTypeAdmin(admin.ModelAdmin): + list_display = ['app_label','model'] + search_fields = ['app_label','model'] + list_per_page = 20 + list_filter = ['app_label'] + + +admin.site.register(Modal, WorkflowModelAdmin) +admin.site.register(Node, WorkflowNodeAdmin) +admin.site.register(Instance, InstanceAdmin) +admin.site.register(TodoList, TodoAdmin) +admin.site.register(History, HistoryAdmin) +admin.site.register(ContentType,ContentTypeAdmin) diff --git a/workflow/apps.py b/workflow/apps.py new file mode 100644 index 0000000..d440522 --- /dev/null +++ b/workflow/apps.py @@ -0,0 +1,9 @@ +__author__ = 'zhugl' +# created at 15-4-22 +from django.apps.config import AppConfig +from django.utils.translation import ugettext_lazy as _ + + +class WorkflowConfig(AppConfig): + name = 'workflow' + verbose_name = _('workflow') \ No newline at end of file diff --git a/workflow/models.py b/workflow/models.py new file mode 100644 index 0000000..0427e88 --- /dev/null +++ b/workflow/models.py @@ -0,0 +1,272 @@ +# coding=utf-8 +from django.db import models +from django.contrib.contenttypes.models import ContentType +from django.contrib.auth.models import User +from django.utils.html import format_html +from django.utils.translation import ugettext_lazy as _ +from common import const +from syscfg.models import Role +from organ.models import Position,OrgUnit + + +class Modal(models.Model): + """ + + """ + import datetime + index_weight = 1 + code = models.CharField(_("workflow code"),max_length=const.DB_CHAR_CODE_6,blank=True,null=True) + name = models.CharField(_("workflow name"),max_length=const.DB_CHAR_NAME_40) + description = models.TextField(_("description"),blank=True,null=True) + content_type = models.ForeignKey(ContentType,verbose_name=_("content type"),limit_choices_to={"app_label__in":['basedata','organ']}) + app_name = models.CharField(_("app name"),max_length=const.DB_CHAR_NAME_60,blank=True,null=True) + model_name = models.CharField(_("model name"),max_length=const.DB_CHAR_NAME_60,blank=True,null=True) + # added by zhugl 2015-05-10 + begin = models.DateField(_("begin date"),blank=True,null=True,default=datetime.date.today) + end = models.DateField(_("end date"),blank=True,null=True,default=datetime.date(9999,12,31)) + + def __unicode__(self): + return "%s" % self.name + + class Meta: + verbose_name = _("workflow model") + verbose_name_plural = _("workflow model") + + +class Node(models.Model): + """ + submitter() + upper() + user() + role() + position() + sql() + etc:upper('zhangsan','lisi') + """ + HANDLER_TYPE = ( + (1, _("designated user")), + (2, _("designated position")), + (3, _("designated role")), + (4, _("submitter")), + ) + index_weight = 2 + modal = models.ForeignKey(Modal,verbose_name=_("workflow model")) + code = models.CharField(_("node code"),max_length=const.DB_CHAR_CODE_4,blank=True,null=True) + name = models.CharField(_("node name"),max_length=const.DB_CHAR_NAME_80) + tooltip = models.CharField(_('tooltip words'),blank=True,null=True,max_length=const.DB_CHAR_NAME_120) + + start = models.BooleanField(_("start node"),default=False) + stop = models.BooleanField(_("stop node"),default=False) + can_terminate = models.BooleanField(_("can terminate"),default=False) + can_deny = models.BooleanField(_("can deny"),default=True) + can_edit = models.BooleanField(_("can edit"),default=False) + + email_notice = models.BooleanField(_("email notice"),default=True) + short_message_notice = models.BooleanField(_("short message notice"),default=False) + approve_node = models.BooleanField(_("approve node"),default=False) + handler = models.TextField(_("handler"),blank=True,null=True,help_text=u'自定义SQL语句,优先高于指定用户、岗位、角色') + # added by zhugl 2015-05-10 + handler_type = models.IntegerField(_("handler type"),choices=HANDLER_TYPE,default=1) + positions = models.ManyToManyField(Position,verbose_name=_("designated position"),blank=True) + roles = models.ManyToManyField(Role,verbose_name=_("designated role"),blank=True) + users = models.ManyToManyField(User,verbose_name=_("designated user"),blank=True) + departments = models.ManyToManyField(OrgUnit,verbose_name=_("designated department"),blank=True) + next = models.ManyToManyField('self',blank=True,verbose_name=_("next node"),symmetrical=False) + # added by zhugl 2015-06-30 + next_user_handler = models.CharField(_('next user handler'),blank=True,null=True,max_length=const.DB_CHAR_NAME_40) + next_node_handler = models.CharField(_('next node handler'),blank=True,null=True,max_length=const.DB_CHAR_NAME_40) + status_field = models.CharField(_('status field'),blank=True,null=True,max_length=const.DB_CHAR_NAME_40) + status_value = models.CharField(_('status value'),blank=True,null=True,max_length=const.DB_CHAR_NAME_40) + action = models.CharField(_('execute action'),blank=True,null=True,max_length=const.DB_CHAR_NAME_40) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + if not self.code: + fmt = 'N%02d' + self.code = fmt % (self.modal.node_set.count()+1) + super(Node,self).save(force_insert,force_update,using,update_fields) + + def __unicode__(self): + return "%s-%s" % (self.code, self.name) + + class Meta: + verbose_name = _("workflow node") + verbose_name_plural = _("workflow node") + + +class Instance(models.Model): + """ + + """ + STATUS = ( + (1, _("NEW")), + (2, _("IN PROGRESS")), + (3, _("DENY")), + (4, _("TERMINATED")), + (9, _("APPROVED")), + (99, _("COMPLETED")) + ) + index_weight = 3 + code = models.CharField(_("code"),blank=True,null=True,max_length=const.DB_CHAR_CODE_10) + modal = models.ForeignKey(Modal,verbose_name=_("workflow model")) + object_id = models.PositiveIntegerField(_("object id")) + starter = models.ForeignKey(User,verbose_name=_("start user"),related_name="starter") + start_time = models.DateTimeField(_("start time"),auto_now_add=True) + approved_time = models.DateTimeField(_("approved time"),blank=True,null=True) + status = models.IntegerField(_("status"),default=1,choices=STATUS) + current_nodes = models.ManyToManyField(Node,verbose_name=_("current node"),blank=True) + + def __unicode__(self): + return '%s' % self.code + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + super(Instance,self).save(force_insert,force_update,using,update_fields) + if not self.code: + self.code = 'S%05d'%self.id + self.save() + + class Meta: + verbose_name = _("workflow instance") + verbose_name_plural = _("workflow instance") + + +class History(models.Model): + """ + workflow history + """ + PROCESS_TYPE = ( + (0, _("SUBMIT")), + (1, _("AGREE")), + (3, _("DENY")), + (4, _("TERMINATE")), + ) + index_weight = 5 + inst = models.ForeignKey(Instance,verbose_name=_("workflow instance")) + node = models.ForeignKey(Node,verbose_name=_("workflow node"),blank=True,null=True) + user = models.ForeignKey(User,verbose_name=_("submitter")) + pro_time = models.DateTimeField(_("process time"),auto_now_add=True) + pro_type = models.IntegerField(_("process type"),choices=PROCESS_TYPE,default=0) + memo = models.CharField(_("memo"),max_length=const.DB_CHAR_NAME_40,blank=True,null=True) + + def get_node_desc(self): + if self.node: + return self.node.name + else: + return u'启动' + + def get_action_desc(self): + action_mapping = {0:u'提交',1:u'同意',3:u'拒绝',4:u'终止',} + # print action_mapping + if self.pro_type: + return action_mapping[self.pro_type] + else: + return u'提交' + + def get_memo_desc(self): + if self.memo: + return self.memo + else: + return '' + + class Meta: + verbose_name = _("workflow history") + verbose_name_plural = _("workflow history") + ordering = ['inst','pro_time'] + + +class TodoList(models.Model): + """ + + """ + index_weight = 4 + code = models.CharField(_("code"),max_length=const.DB_CHAR_CODE_10,blank=True,null=True) + inst = models.ForeignKey(Instance,verbose_name=_("workflow instance")) + node = models.ForeignKey(Node,verbose_name=_("current node"),blank=True,null=True) + app_name = models.CharField(_("app name"),max_length=const.DB_CHAR_NAME_60,blank=True,null=True) + model_name = models.CharField(_("model name"),max_length=const.DB_CHAR_NAME_60,blank=True,null=True) + user = models.ForeignKey(User,verbose_name=_("handler")) + arrived_time = models.DateTimeField(_("arrived time"),auto_now_add=True) + is_read = models.BooleanField(_("is read"),default=False) + read_time = models.DateTimeField(_("read time"),blank=True,null=True) + status = models.BooleanField(_("is done"),default=False) + + def save(self, force_insert=False, force_update=False, using=None, + update_fields=None): + super(TodoList,self).save(force_update,force_update,using,update_fields) + if not self.code: + self.code = 'TD%05d' % self.id + self.save() + + def node_dsc(self): + if self.node: + return u'%s'%self.node.name + else: + return u'启动' + + def code_link(self): + return format_html("{}", + self.app_name,self.model_name,self.inst.object_id,self.code) + code_link.allow_tags = True + code_link.short_description = _("code") + + def href(self): + import sys + reload(sys) + sys.setdefaultencoding("utf-8") + ct = ContentType.objects.get(app_label=self.app_name,model=self.model_name) + obj = ct.get_object_for_this_type(id=self.inst.object_id) + title = u"%s" % (obj) + return format_html("{}", + self.app_name,self.model_name,self.inst.object_id,title) + def modal_dsc(self): + return u'%s'%(self.inst.modal.name) + modal_dsc.short_description = u'业务流程' + + def start_time(self): + return self.inst.start_time.strftime('%Y-%m-%d %H:%M') + + href.allow_tags = True + href.short_description = _("description") + node_dsc.short_description = _('current node') + + def submitter(self): + if self.inst.starter.last_name or self.inst.starter.first_name: + return u"%s%s"%(self.inst.starter.last_name,self.inst.starter.first_name) + return u"%s"%(self.inst.starter.username) + submitter.short_description = _("submitter") + + class Meta: + verbose_name = _("workflow todo") + verbose_name_plural = _("workflow todo") + ordering = ['user','-arrived_time'] + + +def get_modal(app_label,model_name): + """ + + :param app_label: + :param model_name: + :return: + """ + try: + return Modal.objects.get(app_name=app_label,model_name=model_name) + except Exception,e: + return None + + +def get_instance(obj): + """ + + :param obj: + :return: + """ + if obj and obj._meta: + modal = get_modal(obj._meta.app_label,obj._meta.model_name) + if modal: + try: + return Instance.objects.get(modal=modal,object_id=obj.id) + except Exception,e: + return None + else: + return None diff --git a/workflow/tests.py b/workflow/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/workflow/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/workflow/views.py b/workflow/views.py new file mode 100644 index 0000000..df40cb9 --- /dev/null +++ b/workflow/views.py @@ -0,0 +1,314 @@ +# coding=utf-8 +from django.contrib.admin import site +from django.contrib.contenttypes.models import ContentType +from django.db import connection +from django.http.response import HttpResponseRedirect +from django.utils.encoding import force_text +from django.template.response import TemplateResponse +from django.contrib import messages +from django.contrib.auth.models import User +from django.utils.translation import ugettext_lazy as _ +from workflow.models import Modal,Instance,TodoList,History,Node +from plugin.wfnodes import NextNodeManager,NextNodeHandler +from plugin.wfusers import NextUserManager,NextUserHandler +from plugin.wfactions import WorkflowActionManager,WorkflowAction + + +SELECTED_CHECKBOX_NAME = 'NEXT_NODE_USER' + + +def compile_node_handler(request,obj,next_node): + """ + :param request: + :param obj: + :param handler: + :return: + """ + + handler = next_node.handler + next_user_handler = next_node.next_user_handler + # next_user_handler 具有最高优先级 + if next_user_handler: + # print 'it is here' + klass = NextUserManager().handlers.get(next_user_handler) + if klass and isinstance(klass,NextUserHandler): + return klass.handle(request,obj,next_node) + + if handler and handler != '': + handler = handler.replace("submitter()", request.user.username) + handler = handler.replace("suber()", request.user.username) + fields = obj._meta.fields + for field in fields: + name = field.name + temp = "{{%s}}" % name + val = getattr(obj,name,None) + if val: + if type(val)!=str: + val = str(val) + handler = handler.replace(temp,val) + cursor = connection.cursor() + cursor.execute(handler) + rows = [row for row in cursor.fetchall()] + return rows + else: + tp = next_node.handler_type + if tp == 1 and next_node.users: + # user + users = [user for user in next_node.users.all()] + return users + elif tp == 2 and next_node.positions: + # position + users = [] + for position in next_node.positions.all(): + for employee in position.employee_set.all(): + users.append(employee.user) + return users + elif tp == 3 and next_node.roles: + # role + users = [] + for role in next_node.roles.all(): + for user in role.users.all(): + users.append(user) + return users + elif tp == 4: + # submitter + return request.user + else: + return None + + +def start(request,app,model,object_id): + """ + + :param request: + :return: + """ + import datetime + content_type = ContentType.objects.get(app_label=app,model=model) + obj = content_type.get_object_for_this_type(id=int(object_id)) + title = _("Are you sure?") + opts = obj._meta + objects_name = force_text(opts.verbose_name) + has_workflow = False + queryset = Modal.objects.filter(content_type=content_type,end__gt=datetime.date.today()).order_by('-end') + cnt = queryset.count() + workflow_modal = None + next_node = None + next_users = [] + has_next_user = False + if cnt > 0: + has_workflow = True + workflow_modal = queryset[0] + query_start_node = workflow_modal.node_set.filter(start=1) + query_first_node = workflow_modal.node_set.order_by('id') + if query_start_node.count() > 0: + next_node = query_start_node[0] + elif query_first_node.count()>0: + next_node = query_first_node[0] + if next_node: + next_users = compile_node_handler(request,obj,next_node) + if len(next_users) > 0: + has_next_user = True + else: + title = _("No workflow model was found") + + try: + tmp = Instance.objects.get(modal = workflow_modal,object_id=object_id) + messages.warning(request,_("the object is already in workflow")) + return HttpResponseRedirect("/admin/%s/%s/%s"%(app,model,object_id)) + except Exception: + pass + + if request.POST.get("post"): + val = request.POST.getlist(SELECTED_CHECKBOX_NAME) + workflow_inst = Instance.objects.create(modal=workflow_modal,object_id=object_id,starter=request.user) + workflow_inst.current_nodes.add(next_node) + workflow_inst.save() + workflow_history = History.objects.create(inst=workflow_inst,user=request.user) + for user in User.objects.filter(id__in=val): + todo = TodoList.objects.create(inst=workflow_inst,node=next_node,user=user,app_name=app,model_name=model) + TodoList.objects.create(inst=workflow_inst,user=request.user,app_name=app,model_name=model,is_read=True, + read_time=datetime.datetime.now(),status=True) + if next_node.status_field and next_node.status_value: + try: + setattr(obj,next_node.status_field,next_node.status_value) + obj.save() + except Exception,e: + pass + messages.success(request,_('workflow started successfully')) + return HttpResponseRedirect("/admin/%s/%s/%s"%(app,model,object_id)) + + context = dict( + site.each_context(request), + title=title, + opts=opts, + objects_name=objects_name, + object=obj, + has_workflow = has_workflow, + workflow_modal = workflow_modal, + next_node = next_node, + has_next_user = has_next_user, + next_users = next_users, + checkbox_name = SELECTED_CHECKBOX_NAME, + ) + request.current_app = site.name + + return TemplateResponse(request,'default/workflow/workflow_start_confirmation.html', context) + + +def approve(request,app,model,object_id,operation): + """ + + :param request: + :param operation: + :return: + """ + if operation not in ('1','3','4'): + messages.warning(request,_("unkown workflow operation")) + return HttpResponseRedirect("/admin/%s/%s/%s"%(app,model,object_id)) + + import datetime + import copy + content_type = ContentType.objects.get(app_label=app,model=model) + obj = content_type.get_object_for_this_type(id=int(object_id)) + title = _("Are you sure?") + opts = obj._meta + objects_name = force_text(opts.verbose_name) + + has_workflow = False + queryset = Modal.objects.filter(content_type=content_type,end__gt=datetime.date.today()).order_by('-end') + cnt = queryset.count() + workflow_modal = None + if cnt > 0: + workflow_modal = queryset[0] + else: + messages.warning(request,_("No workflow model was found")) + return HttpResponseRedirect("/admin/%s/%s/%s"%(app,model,object_id)) + workflow_instance = None + try: + workflow_instance = Instance.objects.get(modal = workflow_modal,object_id=object_id) + except Exception: + messages.warning(request,_("please start the workflow first")) + return HttpResponseRedirect("/admin/%s/%s/%s"%(app,model,object_id)) + + next_nodes = [] + node_users = [] + is_stop_node = False + node_has_users = False + delete_instance = False + deny_to_first = False + next_node_description = None + all_nodes =[x for x in Node.objects.filter(modal=workflow_modal).order_by('-id')] + current = workflow_instance.current_nodes.all() + current_tmp = copy.deepcopy(current[0]) + if operation == '4' or operation == '3': + next_nodes = ['stop'] + is_stop_node = True + else: + if current.count() > 1: + pass + else: + tmp_node = current[0] + if tmp_node.stop or tmp_node == all_nodes[0]: + next_nodes = ['stop'] + is_stop_node = True + else: + if tmp_node.next_node_handler and len(tmp_node.next_node_handler) > 0: + hd = tmp_node.next_node_handler + klass = NextNodeManager().handlers.get(hd) + if klass and isinstance(klass,NextNodeHandler): + next_nodes = klass.handle(request,obj,tmp_node) + next_node_description = klass.description + if next_nodes and len(next_nodes) > 0: + pass + elif tmp_node.next and tmp_node.next.count()>0: + next_nodes = [nd for nd in tmp_node.next.all()] + else: + position = all_nodes.index(tmp_node) + next_nodes = [all_nodes[position-1]] + + if request.POST.get("post"): + from django.db import transaction + val = request.POST.getlist(SELECTED_CHECKBOX_NAME) + memo = request.POST['memo'] + with transaction.atomic(): + try: + if delete_instance: + workflow_instance.delete() + else: + if is_stop_node: + workflow_instance.status = 99 + if operation in ('3', '4'): + workflow_instance.status = int(operation) + if not workflow_instance.approved_time and operation == '1': + workflow_instance.approved_time = datetime.datetime.now() + workflow_instance.current_nodes.clear() + workflow_instance.save() + else: + workflow_instance.current_nodes.clear() + workflow_instance.current_nodes.add(next_nodes[0]) + for user in User.objects.filter(id__in=val): + todo = TodoList.objects.create(inst=workflow_instance,node=next_nodes[0],user=user,app_name=app,model_name=model) + if current_tmp.status_field and current_tmp.status_value: + try: + setattr(obj,current_tmp.status_field,current_tmp.status_value) + obj.save() + except Exception,e: + pass + History.objects.create(inst=workflow_instance,user=request.user,pro_type=int(operation),memo=memo,node=current_tmp) + TodoList.objects.filter(inst=workflow_instance,node=current_tmp,status=0).update(status=1) + messages.success(request,_('workflow approved successfully')) + except Exception,e: + messages.error(request,e) + pass + if current_tmp.action and len(current_tmp.action) > 0: + action = WorkflowActionManager().actions.get(current_tmp.action) + if action and isinstance(action,WorkflowAction): + action.action(request,obj,current_tmp,operation) + + return HttpResponseRedirect("/admin/%s/%s/%s"%(app,model,object_id)) + + if len(next_nodes) > 0 and not is_stop_node and operation == '1': + for node in next_nodes: + users = compile_node_handler(request,obj,node) + if len(users) > 0: + node_has_users = True + node_users.append({'node':node,'users':users}) + + context = dict( + site.each_context(request), + title=title, + opts=opts, + objects_name=objects_name, + object=obj, + operation = operation, + is_stop_node = is_stop_node, + delete_instance = delete_instance, + node_users = node_users, + node_has_users = node_has_users, + checkbox_name = SELECTED_CHECKBOX_NAME, + ) + if next_node_description: + context.update(dict(next_node_description=next_node_description)) + return TemplateResponse(request,"default/workflow/workflow_approve_confirmation.html",context) + + +def restart(request,app,model,object_id,instance): + """ + + :param request: + :param app: + :param model: + :param object_id: + :return: + """ + try: + inst = Instance.objects.get(id=int(instance)) + if request.user == inst.starter: + inst.delete() + messages.success(request,_("workflow restarted success")) + else: + messages.warning(request,_("you do not have the permission to restart,only the starter can restart")) + except Exception,e: + messages.error(request,e) + return HttpResponseRedirect("/admin/%s/%s/%s"%(app,model,object_id)) \ No newline at end of file