Commit f870efcd authored by k54990881's avatar k54990881

update

parent 6c09e045
No preview for this file type
from mysql_model import BaseModel
import os, json, base64, requests
from dbsql import MySQL
env = os.environ
host = env['MYSQL_HOST'] if 'MYSQL_HOST' in env else "192.168.6.194"
port = int(env['MYSQL_PORT']) if 'MYSQL_PORT' in env else 23306
usr = env['MYSQL_USR'] if 'MYSQL_USR' in env else "root"
pwd = env['MYSQL_PWD'] if 'MYSQL_PWD' in env else "123456"
db = env['MYSQL_DB'] if 'MYSQL_DB' in env else "ecom"
mysql = MySQL(host, port, usr, pwd, db)
# ========== 機器班別關係資料庫模型 ==========
class DeviceShiftRelationModel(BaseModel):
def __init__(self, ID=None):
super().__init__()
self.table = 'device_shift_relation'
if(ID != None):
self.data['no'] = ID if isinstance(ID, str) else str(ID)
self.data['device_id'] = None
self.data['shift_no'] = None
self.data['note'] = None
# ===== no ========================================
def GetNo(self):
return self.data['no'] if 'no' in self.data else None
# ===== device_id ========================================
def SetDeviceId(self, device_id):
return self.SetValue('device_id', device_id, str, False)
def GetDeviceId(self):
return self.data['device_id'] if 'device_id' in self.data else None
def GetOldDeviceId(self):
return self.change['device_id']
def HasChangeDeviceId(self):
return 'device_id' in self.change
# ===== shift_no ========================================
def SetShiftNo(self, shift_no):
return self.SetValue('shift_no', shift_no, str, False)
def GetShiftNo(self):
return self.data['shift_no'] if 'shift_no' in self.data else None
def GetOldShiftNo(self):
return self.change['shift_no']
def HasChangeShiftNo(self):
return 'shift_no' in self.change
# ===== note ========================================
def SetNote(self, note):
return self.SetValue('note', note, str, True)
def GetNote(self):
return self.data['note'] if 'note' in self.data else None
def GetOldNote(self):
return self.change['note']
def HasChangeNote(self):
return 'note' in self.change
# ===== operate database ========================================
def InsertToDB(self, log):
keys = self.data.keys()
values = [ self.data[x] for x in keys ]
mysql.SetLog(log)
script = mysql.Insert(self.table, keys, values)
return script.Fetch()
def UpdateToDB(self, log):
script = None
for k in self.data.keys():
mysql.SetLog(log)
script = mysql.Update(self.table, k, self.data[k]) if script is None else script.Add(k, self.data[k])
script = script.Where('no', '=', self.data['no'])
return script.FetchOne()
def DeleteFromDB(self, log):
script = mysql.Delete(self.table).Where('no', '=', self.data['no'])
mysql.SetLog(log)
return script.FetchOne()
def ToDict(self):
return {
'no': self.GetNo(),
'device_id': self.GetDeviceId(),
'shift_no': self.GetShiftNo(),
'note': self.GetNote(),
}
# ===== other ========================================
@staticmethod
def FromDB(ID, log):
model = DeviceShiftRelationModel(ID)
mysql.SetLog(log)
script = mysql.Select('device_shift_relation').Where('no', '=', ID).FetchOne()
if isinstance(script, tuple):
model.SetDeviceId(script[1])
model.SetShiftNo(script[2])
model.SetNote(script[3])
model.SetCreated(script[4])
model.SetUpdated(script[5])
model.SetDeleted(script[6])
model.isExist = True
return model
@staticmethod
def FromDBByDeviceIdShiftNo(DeviceId, ShiftNo, log):
model = DeviceShiftRelationModel()
mysql.SetLog(log)
script = mysql.Select('device_shift_relation').Where('device_id', '=', DeviceId).And('shift_no', '=', ShiftNo).FetchOne()
if isinstance(script, tuple):
model.SetDeviceId(script[1])
model.SetShiftNo(script[2])
model.SetNote(script[3])
model.SetCreated(script[4])
model.SetUpdated(script[5])
model.SetDeleted(script[6])
model.isExist = True
return model
@staticmethod
def AllFromDB(log):
models = []
mysql.SetLog(log)
script = mysql.Select('device_shift_relation').FetchAll()
for row in script:
model = DeviceShiftRelationModel(row[0])
model.SetDeviceId(row[1])
model.SetShiftNo(row[2])
model.SetNote(row[3])
model.SetCreated(row[4])
model.SetUpdated(row[5])
model.SetDeleted(row[6])
model.isExist = True
models.append(model)
return models
\ No newline at end of file
......@@ -141,6 +141,8 @@ class PunchInfluxModel(BaseItemInfluxModel):
return self.raw['fields']['name']
def GetType(self):
return self.raw['fields']['type']
def GetDevice(self):
return self.raw['tags']['device']
def GetLocation(self):
return self.raw['tags']['location']
def GetSimilarity(self):
......
from mysql_model import BaseModel
import os, json, base64, requests
from dbsql import MySQL
env = os.environ
host = env['MYSQL_HOST'] if 'MYSQL_HOST' in env else "192.168.6.194"
port = int(env['MYSQL_PORT']) if 'MYSQL_PORT' in env else 23306
usr = env['MYSQL_USR'] if 'MYSQL_USR' in env else "root"
pwd = env['MYSQL_PWD'] if 'MYSQL_PWD' in env else "123456"
db = env['MYSQL_DB'] if 'MYSQL_DB' in env else "ecom"
mysql = MySQL(host, port, usr, pwd, db)
# ========== 班別資料庫模型 ==========
class ShiftModel(BaseModel):
def __init__(self, ID=None):
super().__init__()
self.table = 'shift'
if(ID != None):
self.data['no'] = ID if isinstance(ID, str) else str(ID)
self.data['name'] = None
self.data['start'] = None
self.data['end'] = None
self.data['note'] = None
# ===== no ========================================
def GetNo(self):
return self.data['no'] if 'no' in self.data else None
# ===== name ========================================
def SetName(self, name):
return self.SetValue('name', name, str, False)
def GetName(self):
return self.data['name'] if 'name' in self.data else None
def GetOldName(self):
return self.change['name']
def HasChangeName(self):
return 'name' in self.change
# ===== start ========================================
def SetStart(self, start):
return self.SetValue('start', start, str, False)
def GetStart(self):
return self.data['start'] if 'start' in self.data else None
def GetOldStart(self):
return self.change['start']
def HasChangeStart(self):
return 'start' in self.change
# ===== end ========================================
def SetEnd(self, end):
return self.SetValue('end', end, str, False)
def GetEnd(self):
return self.data['end'] if 'end' in self.data else None
def GetOldEnd(self):
return self.change['end']
def HasChangeEnd(self):
return 'end' in self.change
# ===== note ========================================
def SetNote(self, note):
return self.SetValue('note', note, str, True)
def GetNote(self):
return self.data['note'] if 'note' in self.data else None
def GetOldNote(self):
return self.change['note']
def HasChangeNote(self):
return 'note' in self.change
# ===== operate database ========================================
def InsertToDB(self, log):
keys = self.data.keys()
values = [ self.data[x] for x in keys ]
mysql.SetLog(log)
script = mysql.Insert(self.table, keys, values)
return script.Fetch()
def UpdateToDB(self, log):
script = None
for k in self.data.keys():
mysql.SetLog(log)
script = mysql.Update(self.table, k, self.data[k]) if script is None else script.Add(k, self.data[k])
script = script.Where('no', '=', self.data['no'])
return script.FetchOne()
def DeleteFromDB(self, log):
script = mysql.Delete(self.table).Where('no', '=', self.data['no'])
mysql.SetLog(log)
return script.FetchOne()
def ToDict(self):
return {
'no': self.GetNo(),
'name': self.GetName(),
'start': self.GetStart(),
'end': self.GetEnd(),
'note': self.GetNote(),
}
# ===== other ========================================
@staticmethod
def FromDB(ID, log):
model = ShiftModel(ID)
mysql.SetLog(log)
script = mysql.Select('shift').Where('no', '=', ID).FetchOne()
if isinstance(script, tuple):
model.SetName(script[1])
model.SetStart(script[2])
model.SetEnd(script[3])
model.SetNote(script[4])
model.SetCreated(script[5])
model.SetUpdated(script[6])
model.SetDeleted(script[7])
model.isExist = True
return model
@staticmethod
def FromDBByName(Name, log):
model = ShiftModel()
mysql.SetLog(log)
script = mysql.Select('shift').Where('name', '=', Name).FetchOne()
if isinstance(script, tuple):
model.SetName(script[1])
model.SetStart(script[2])
model.SetEnd(script[3])
model.SetNote(script[4])
model.SetCreated(script[5])
model.SetUpdated(script[6])
model.SetDeleted(script[7])
model.isExist = True
return model
@staticmethod
def AllFromDB(log):
models = []
mysql.SetLog(log)
script = mysql.Select('shift').FetchAll()
for row in script:
model = ShiftModel(row[0])
model.SetName(row[1])
model.SetStart(row[2])
model.SetEnd(row[3])
model.SetNote(row[4])
model.SetCreated(row[5])
model.SetUpdated(row[6])
model.SetDeleted(row[7])
model.isExist = True
models.append(model)
return models
\ No newline at end of file
......@@ -44,3 +44,5 @@ class SendBaseResource(BaseResource):
return send_file(stream, attachment_filename="{0}.xlsx".format(name), as_attachment=True)
def GetWordResponse(self, name, stream):
return send_file(stream, attachment_filename="{0}.docx".format(name), as_attachment=True)
def GetTxtResponse(self, name, stream):
return send_file(stream, attachment_filename="{0}.txt".format(name), as_attachment=True)
\ No newline at end of file
from base_resource import BaseResource
from device_shift_relation_model import DeviceShiftRelationModel
# from werkzeug.datastructures import FileStorage
import os, werkzeug, base64, pandas as pd
# ========== 新增設備班別關係記錄 ==========
class DeviceShiftRelationInsert(BaseResource):
def __init__(self):
super().__init__("InsertDeviceShiftRelation")
self.parser.add_argument('device_id', required=True, help="設備編號,上限20字")
self.parser.add_argument('shift_no', required=True, help="班別編號,上限20字")
self.parser.add_argument('note', help="備註")
def post(self):
args = self.parser.parse_args()
model = DeviceShiftRelationModel.FromDBByDeviceIdShiftNo(args['device_id'],args['shift_no'], self.log.SetMessage)
if not model.isExist:
model.SetDeviceId(args['device_id'])
model.SetShiftNo(args['shift_no'])
model.SetNote(args['note'])
if model.InsertToDB(self.log.SetMessage):
self.message = "DeviceShiftRelation:{0}, {1} inserted".format(args['device_id'],args['shift_no'])
else:
self.message = "DeviceShiftRelation:{0}, {1} insert failed".format(args['device_id'],args['shift_no'])
else:
self.message = "DeviceShiftRelation:{0}, {1} is exist in database".format(args['device_id'],args['shift_no'])
return self.GetResponse()
# ========== 更新設備班別關係紀錄 ==========
class DeviceShiftRelationUpdate(BaseResource):
def __init__(self):
super().__init__("UpdateDeviceShiftRelation")
self.parser.add_argument('no', required=True, help="班別編號")
self.parser.add_argument('device_id', required=True, help="設備編號,上限20字")
self.parser.add_argument('shift_no', required=True, help="班別編號,上限20字")
self.parser.add_argument('note', help="備註")
def post(self):
args = self.parser.parse_args()
model = DeviceShiftRelationModel.FromDB(args['no'], self.log.SetMessage)
if model.isExist:
model.SetDeviceId(args['device_id'])
model.SetShiftNo(args['shift_no'])
model.SetNote(args['note'])
if model.UpdateToDB(self.log.SetMessage):
self.message = []
if model.HasChangeDeviceId():
self.message.append(
"DeviceId: {0} -> {1}".format(model.GetOldDeviceId(), model.GetDeviceId())
)
if model.HasChangeShiftNo():
self.message.append(
"ShiftNo: {0} -> {1}".format(model.GetOldShiftNo(), model.GetShiftNo())
)
if model.HasChangeNote():
self.message.append(
"Note: {0} -> {1}".format(model.GetOldNote(), model.GetNote())
)
self.message = ", ".join(self.message) if len(self.message) > 0 else ""
else:
self.message = "DeviceShiftRelation:{0}, {1} update failed".format(args['device_id'],args['shift_no'])
else:
self.message = "DeviceShiftRelation:{0}, {1} isn't exist in database".format(args['device_id'],args['shift_no'])
return self.GetResponse()
# ========== 刪除設備班別關係紀錄 ==========
class DeviceShiftRelationDelete(BaseResource):
def __init__(self):
super().__init__("DeleteDeviceShiftRelation")
self.parser.add_argument('no', required=True)
def post(self):
args = self.parser.parse_args()
model = DeviceShiftRelationModel.FromDB(args['no'], self.log.SetMessage)
if model.isExist:
if model.DeleteFromDB(self.log.SetMessage):
self.message = "DeviceShiftRelation:{0} deleted".format(args['no'], model.GetNow())
else:
self.message = "DeviceShiftRelation:{0} delete failed".format(args['no'])
else:
self.message = "DeviceShiftRelation:{0} isn't exist in database".format(args['no'])
return self.GetResponse()
# ========== 查詢所有設備班別關係紀錄 ==========
class DeviceShiftRelationSelectAll(BaseResource):
def __init__(self):
super().__init__("SelectDeviceShiftRelation")
def post(self, ID=None):
models = DeviceShiftRelationModel.AllFromDB(self.log.SetMessage)
if len(models) > 0:
self.data = []
for model in models:
self.data.append(model.ToDict())
self.message = "{0} selected".format(len(self.data))
else:
self.message = "no data in database"
return self.GetResponse()
\ No newline at end of file
......@@ -15,6 +15,8 @@ from leave_off_work_model import LeaveOffWorkModel
from overtime_model import OvertimeModel
from docx import Document
from docx.enum.style import WD_STYLE_TYPE
from device_shift_relation_model import DeviceShiftRelationModel
from shift_model import ShiftModel
env = os.environ
......@@ -206,6 +208,7 @@ class PunchCard1Upload(BaseResource):
print(uuid, host, location)
punch = PunchInfluxModel(uuid, host, location, time)
punch.SetID(ID)
punch.SetUID(ID)
punch.SetName(name)
punch.SetType(ptype)
punch.SetSimilarity(similarity)
......@@ -308,6 +311,7 @@ class PunchCard2Upload(BaseResource):
a12 = model.GetPosition()
punch = PunchInfluxModel(a1, a2, a9, a6)
punch.SetID(a3)
punch.SetUID(a3)
punch.SetName(a4)
punch.SetType(a10)
punch.SetSimilarity(a11)
......@@ -2773,3 +2777,87 @@ class PunchCardRecordToday(BaseResource):
}
dataList.append(record)
return dataList
# ========== 班別 ==========
class ExportShiftPunchCard(SendBaseResource):
def __init__(self):
super().__init__('txt')
self.parser.add_argument('start')
self.parser.add_argument('end')
def post(self):
args = self.parser.parse_args()
devices = DeviceModel.AllFromDB(self.log.SetMessage)
person = PersonModel.AllFromDB(self.log.SetMessage)
start = datetime.strptime(args['start'], '%Y-%m-%d %H:%M:%S')
end = datetime.strptime(args['end'], '%Y-%m-%d %H:%M:%S')
temperature = None
punch_card_data = PunchInfluxModel.AllFromRaw(start, end, temperature)
stream = ExportShiftPunchCard.GetFile(self,devices,person,punch_card_data,start)
return self.GetTxtResponse("{0}".format(start.strftime('%Y%m%d')), stream)
@staticmethod
def GetFile(self,devices,person,punch_card_data,start):
path = './static/File/{0}.txt'.format(start.strftime('%Y%m%d'))
file = open(path, 'w')
person_punch_card = {}
for p in person:
person_punch_card[p.GetID()] = {}
device_shift = {}
for d in devices:
device_shift[d.GetID()] = {}
#班別
shift_note = {}
shifts = ShiftModel.AllFromDB(self.log.SetMessage)
for s in shifts:
shift_note[s.GetNo()] = {}
shift_note[s.GetNo()]['name']=s.GetName()
shift_note[s.GetNo()]['start']=s.GetStart()
shift_note[s.GetNo()]['end']=s.GetEnd()
#設備班別關係
device_shift_relation = DeviceShiftRelationModel.AllFromDB(self.log.SetMessage)
for r in device_shift_relation:
device_shift[r.GetDeviceId()][r.GetShiftNo()] = {}
device_shift[r.GetDeviceId()][r.GetShiftNo()]['name'] = shift_note[r.GetShiftNo()]['name']
device_shift[r.GetDeviceId()][r.GetShiftNo()]['start'] = shift_note[r.GetShiftNo()]['start']
device_shift[r.GetDeviceId()][r.GetShiftNo()]['end'] = shift_note[r.GetShiftNo()]['end']
for data in punch_card_data:
ID = data.GetID()
if ID in person_punch_card:
time = data.GetTime()
date = time.strftime('%Y-%m-%d')
if date not in person_punch_card[ID]:
person_punch_card[ID][date] = {}
datetime = time.strftime('%Y%m%d%H%M')
only_time = time.strftime('%H:%M')
device_id = data.GetDevice()
shift_name = "ERROR"
if device_id in device_shift:
for device_shift_no in device_shift[device_id]:
shift_start = device_shift[device_id][device_shift_no]['start']
shift_end = device_shift[device_id][device_shift_no]['end']
if(shift_start<=only_time and only_time<=shift_end):
shift_name = device_shift[device_id][device_shift_no]['name']
if 'start' not in person_punch_card[ID][date]:
person_punch_card[ID][date]['start']='{0}{1}{2}\n'.format(ID,datetime,shift_name)
person_punch_card[ID][date]['start_shift']=shift_name
person_punch_card[ID][date]['end']='{0}{1}{2}\n'.format(ID,datetime,shift_name)
person_punch_card[ID][date]['end_shift']=shift_name
# file.write('{0}{1}{2}\n'.format(ID,datetime,shift_name))
write_list = []
for p in person_punch_card:
for d in person_punch_card[p]:
if person_punch_card[p][d]['start_shift'] != 'ERROR':
write_list.append(person_punch_card[p][d]['start'])
else:
write_list.insert(0,person_punch_card[p][d]['start'])
if person_punch_card[p][d]['start'] != person_punch_card[p][d]['end']:
if person_punch_card[p][d]['end_shift'] != 'ERROR':
write_list.append(person_punch_card[p][d]['end'])
else:
write_list.insert(0,person_punch_card[p][d]['end'])
# file.write(person_punch_card[p][d]['start'])
# file.write(person_punch_card[p][d]['end'])
file.writelines(write_list)
file.close()
s_file = open(path, 'rb')
return s_file
\ No newline at end of file
from base_resource import BaseResource
from shift_model import ShiftModel
# from werkzeug.datastructures import FileStorage
import os, werkzeug, base64, pandas as pd
# ========== 新增班別記錄 ==========
class ShiftInsert(BaseResource):
def __init__(self):
super().__init__("InsertShift")
self.parser.add_argument('name', required=True, help="班別,上限20字")
self.parser.add_argument('start', required=True, help="班別開始時間,上限20字")
self.parser.add_argument('end', required=True, help="班別結束時間,上限20字")
self.parser.add_argument('note', help="班別備註")
def post(self):
args = self.parser.parse_args()
model = ShiftModel.FromDBByName(args['name'], self.log.SetMessage)
if not model.isExist:
model.SetName(args['name'])
model.SetStart(args['start'])
model.SetEnd(args['end'])
model.SetNote(args['note'])
if model.InsertToDB(self.log.SetMessage):
self.message = "Shift:{0} inserted".format(args['name'])
else:
self.message = "Shift:{0} insert failed".format(args['name'])
else:
self.message = "Shift:{0} is exist in database".format(args['name'])
return self.GetResponse()
# ========== 更新班別紀錄 ==========
class ShiftUpdate(BaseResource):
def __init__(self):
super().__init__("UpdateShift")
self.parser.add_argument('no', required=True, help="班別編號")
self.parser.add_argument('name', required=True, help="班別,上限20字")
self.parser.add_argument('start', required=True, help="班別開始時間,上限20字")
self.parser.add_argument('end', required=True, help="班別結束時間,上限20字")
self.parser.add_argument('note', help="班別備註")
def post(self):
args = self.parser.parse_args()
model = ShiftModel.FromDB(args['no'], self.log.SetMessage)
if model.isExist:
model.SetName(args['name'])
model.SetStart(args['start'])
model.SetEnd(args['end'])
model.SetNote(args['note'])
if model.UpdateToDB(self.log.SetMessage):
self.message = []
if model.HasChangeName():
self.message.append(
"Name: {0} -> {1}".format(model.GetOldName(), model.GetName())
)
if model.HasChangeStart():
self.message.append(
"Start: {0} -> {1}".format(model.GetOldStart(), model.GetStart())
)
if model.HasChangeEnd():
self.message.append(
"End: {0} -> {1}".format(model.GetOldEnd(), model.GetEnd())
)
if model.HasChangeNote():
self.message.append(
"Note: {0} -> {1}".format(model.GetOldNote(), model.GetNote())
)
self.message = ", ".join(self.message) if len(self.message) > 0 else ""
else:
self.message = "Shift:{0} update failed".format(args['name'])
else:
self.message = "Shift:{0} isn't exist in database".format(args['name'])
return self.GetResponse()
# ========== 刪除班別紀錄 ==========
class ShiftDelete(BaseResource):
def __init__(self):
super().__init__("DeleteShift")
self.parser.add_argument('no', required=True)
def post(self):
args = self.parser.parse_args()
model = ShiftModel.FromDB(args['no'], self.log.SetMessage)
if model.isExist:
if model.DeleteFromDB(self.log.SetMessage):
self.message = "Shift:{0} deleted".format(args['no'], model.GetNow())
else:
self.message = "Shift:{0} delete failed".format(args['no'])
else:
self.message = "Shift:{0} isn't exist in database".format(args['no'])
return self.GetResponse()
# ========== 查詢所有班別紀錄 ==========
class ShiftSelectAll(BaseResource):
def __init__(self):
super().__init__("SelectShift")
def post(self, ID=None):
models = ShiftModel.AllFromDB(self.log.SetMessage)
if len(models) > 0:
self.data = []
for model in models:
self.data.append(model.ToDict())
self.message = "{0} selected".format(len(self.data))
else:
self.message = "no data in database"
return self.GetResponse()
\ No newline at end of file
......@@ -14,7 +14,7 @@ from person_group_relation_resource import PersonGroupRelationInsert,PersonGroup
from person_group_and_device_group_relation_resource import PersonGroupAndDeviceGroupRelationInsert,PersonGroupAndDeviceGroupRelationSelectAll,PersonGroupAndDeviceGroupRelationDelete
from grafana_access_json_resource import Grafana_Base,Grafana_Search,Grafana_Query,Grafana_Tag_Key,Grafana_Tag_Value
from punch_card_resource import PunchCardUpload, PunchCard1Upload, PunchCard2Upload,PunchCardRecord, PunchCardSend, PunchCardRecordDownload,PunchCardRecordAll, PunchCardInsert, PunchCardFirst,PunchCardRecordDownload2,PunchCardRecordDownloadGroup,PunchCardRecordDownload2Group, PunchCardRecordToday,PunchCardRecordVerson2,PunchCardRecordDownloadVerson2,PunchCardRecordDownloadGroupVerson2,PunchCardRecordDownload2Verson2,PunchCardRecordDownload2GroupVerson2
from punch_card_resource import PunchCardUpload, PunchCard1Upload, PunchCard2Upload,PunchCardRecord, PunchCardSend, PunchCardRecordDownload,PunchCardRecordAll, PunchCardInsert, PunchCardFirst,PunchCardRecordDownload2,PunchCardRecordDownloadGroup,PunchCardRecordDownload2Group, PunchCardRecordToday,PunchCardRecordVerson2,PunchCardRecordDownloadVerson2,PunchCardRecordDownloadGroupVerson2,PunchCardRecordDownload2Verson2,PunchCardRecordDownload2GroupVerson2,ExportShiftPunchCard
from CM26EWH_resource import CM26EWH_Personinfo,CM26EWH_subscription_aps
from version_resource import VersionSelect
#from socket_resource import Socket
......@@ -38,6 +38,10 @@ from features_resource import FeaturesInsert,FeaturesUpdate,FeaturesDelete,Featu
from features_role_relation_resource import FeaturesRoleRelationInsert,FeaturesRoleRelationUpdate,FeaturesRoleRelationDelete,FeaturesRoleRelationSelectAll
from features_user_relation_resource import FeaturesUserRelationInsert,FeaturesUserRelationUpdate,FeaturesUserRelationDelete,FeaturesUserRelationSelectAll
from test_resource import SetDateTime
from shift_resource import ShiftInsert,ShiftUpdate,ShiftDelete,ShiftSelectAll
from device_shift_relation_resource import DeviceShiftRelationInsert,DeviceShiftRelationUpdate,DeviceShiftRelationDelete,DeviceShiftRelationSelectAll
......@@ -208,6 +212,19 @@ api.add_resource(LeaveToExcelPersonalVerson2, '/leave/excel/personal/verson2')
api.add_resource(AnnualLeaveToExcelVerson2, '/annual/leave/excel/all/verson2')
# ===== 加班相關 =====
api.add_resource(OvertimeToWordVerson2, '/overtime/word/verson2')
# ========== 新版本-班別 ==========
# ========== 班別 ==========
api.add_resource(ShiftInsert, '/shift/insert')
api.add_resource(ShiftUpdate, '/shift/update')
api.add_resource(ShiftDelete, '/shift/delete')
api.add_resource(ShiftSelectAll, '/shift/all')
# ========== 設備班別關係 ==========
api.add_resource(DeviceShiftRelationInsert, '/device/shift/relation/insert')
api.add_resource(DeviceShiftRelationUpdate, '/device/shift/relation/update')
api.add_resource(DeviceShiftRelationDelete, '/device/shift/relation/delete')
api.add_resource(DeviceShiftRelationSelectAll, '/device/shift/relation/all')
# ========== 匯出TXT ==========
api.add_resource(ExportShiftPunchCard, '/device/shift/export')
# ----- Socket -----
# socketio = SocketIO(app)
# socketio.on_namespace(Socket('/test'))
......
B10902202109301721ERROR
B10903202109301612ERROR
B10903202109301454ERROR
B10902202109301721A4
B10902202110011204ERROR
B10903202110011142ERROR
B10903202110011408B2
B10902202110011409B2
File mode changed from 100644 to 100755
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -123,13 +123,13 @@
<div class="input-group-prepend">
<span class="input-group-text" id="inputGroup-sizing-default">設備host</span>
</div>
<input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" name="host" placeholder="Host" id="update_host">
<input readonly type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" name="host" placeholder="Host" id="update_host">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="inputGroup-sizing-default">設備port</span>
</div>
<input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" name="port" placeholder="Port" id="update_post">
<input readonly type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" name="port" placeholder="Port" id="update_post">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
<a href="{{ Route("comparison") }}" style="text-decoration:none;"><h2 class="text-dark" style="font-size: 20pt;text-align: center;background: white">人員管理</h2></a>
@elseif($this_page=="7" || $this_page=="8" || $this_page=="17" || $this_page=="9" || $this_page=="23" || $this_page=="22" || $this_page=="10" || $this_page=="11")
<a href="{{ Route("attendance") }}" style="text-decoration:none;"><h2 class="text-dark" style="font-size: 20pt;text-align: center;background: white">差勤管理</h2></a>
@elseif($this_page=="12" || $this_page=="13" || $this_page=="14" || $this_page=="15" || $this_page=="16")
@elseif($this_page=="12" || $this_page=="13" || $this_page=="14" || $this_page=="15" || $this_page=="16"|| $this_page=="26")
<a href="{{ Route("device_time") }}" style="text-decoration:none;"><h2 class="text-dark" style="font-size: 20pt;text-align: center;background: white">設備管理</h2></a>
@endif
<div style="height: 5vh"></div>
......@@ -30,11 +30,12 @@
{{-- <a id="11" class="nav-link" href="{{ Route("graph_attendance") }}" style="color: #ffffff;display: none">差勤圖表</a>--}}
</div>
</div>
<a id="title_device"class="nav-linggk" data-toggle="collapse" href="#collapseDevice" role="button" aria-expanded="false" aria-controls="collapseDevice" href="#" style="color: #ffffff;display: none">設備管理</a>
<a id="title_device" class="nav-link"data-toggle="collapse" href="#collapseDevice" role="button" aria-expanded="false" aria-controls="collapseDevice" href="#" style="color: #ffffff;display: none">設備管理</a>
<div class="collapse " id="collapseDevice">
<div class="card card-body" style="background: rgba(255,255,255,0);font-size:17px;">
{{-- <a id="12" class="nav-link" href="{{ Route("device") }}" style="color: #ffffff;display: none">設備管理</a>--}}
<a id="12" class="nav-link" href="{{ Route("device") }}" style="color: #ffffff;display: none">設備管理</a>
{{-- <a id="13" class="nav-link" href="{{ Route("type") }}" style="color: #ffffff;display: none">類型管理</a>--}}
<a id="26" class="nav-link" href="{{ Route("shift_index") }}" style="color: #ffffff;display: none">班別<a>
{{-- <a id="14" class="nav-link" href="{{ Route("group") }}" style="color: #ffffff;display: none">群組管理</a>--}}
{{-- <a id="15" class="nav-link" href="{{ Route("relation") }}" style="color: #ffffff;display: none">設備群組關係</a>--}}
<a id="16" class="nav-link" href="{{ Route("device_time") }}" style="color: #ffffff;display: none">設備時間</a>
......@@ -75,7 +76,7 @@
var attendance=document.getElementById("title_attendance");
attendance.style.display="";
}
if({{$auth["features_id"]}}=='12' || {{$auth["features_id"]}}=='13' || {{$auth["features_id"]}}=='14' || {{$auth["features_id"]}}=='15' || {{$auth["features_id"]}}=='16')
if({{$auth["features_id"]}}=='12' || {{$auth["features_id"]}}=='13' || {{$auth["features_id"]}}=='14' || {{$auth["features_id"]}}=='15' || {{$auth["features_id"]}}=='16'|| {{$auth["features_id"]}}=='26')
{
var device=document.getElementById("title_device");
device.style.display="";
......@@ -93,7 +94,7 @@
{
$('#collapseLeave').collapse('show');
}
if({{$this_page}}=='12' || {{$this_page}}=='13' || {{$this_page}}=='14' || {{$this_page}}=='15' || {{$this_page}}=='16')
if({{$this_page}}=='12' || {{$this_page}}=='13' || {{$this_page}}=='14' || {{$this_page}}=='15' || {{$this_page}}=='16'|| {{$this_page}}=='26')
{
$('#collapseDevice').collapse('show');
}
......
......@@ -37,6 +37,16 @@ Route::group(['prefix'=>'/Device','middleware'=>'auth'],function (){
Route::get('/time',"DeviceController@set_datetime_index")->name('device_time');
Route::post('/time',"DeviceController@set_datetime")->name('set_device_time');
});
//班別管理
Route::group(['prefix'=>'/Shift','middleware'=>'auth'],function (){
Route::get('/',"DeviceController@shift_index")->name('shift_index');
Route::post('/insert',"DeviceController@shift_insert")->name('shift_insert');
Route::post('/update',"DeviceController@shift_update")->name('shift_update');
Route::post('/delete',"DeviceController@shift_delete")->name('shift_delete');
Route::post('/device/relation/update',"DeviceController@device_shift_update")->name('device_shift_update');
Route::post('/device/export',"DeviceController@shift_punch_card_export")->name('shift_punch_card_export');
});
// 設備管理
//Route::group(['prefix'=>'/Camera','middleware'=>'auth'],function (){
// Route::get('/',"CameraController@index")->name('camera');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment