<commit_before>//
//  XLSXmethod.swift
//  masamon
//
//  Created by 岩見建汰 on 2015/12/06.
//  Copyright © 2015年 Kenta. All rights reserved.
//

import UIKit
import RealmSwift

class XLSXmethod: UIViewController {
    
    //cellの列(日付が記載されている範囲)
    let cellrow = ["G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","AA","AB","AC","AD","AE","AF","AG","AH","AI","AJ","AK"]
    let holiday = DBmethod().ShiftSystemNameArrayGetByGroudid(6)      //休暇のシフト体制を取得
    let mark = "F"
    var number = 6
    
    var flag = true
    
    var documentPath: String = ""
    var spreadsheet = BRAOfficeDocumentPackage()
    var worksheet = BRAWorksheet()
    var P1String: String = ""
    let appDelegate:AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate //AppDelegateのインスタンスを取得

    //XLSXファイルのインスタンスをセットするメソッド
    func SetXLSX() -> (sheet: BRAWorksheet, P1:String){
        
        if flag {
            documentPath = DBmethod().FilePathTmpGet() as String
            spreadsheet = BRAOfficeDocumentPackage.open(documentPath)
            worksheet = spreadsheet.workbook.worksheets[0] as! BRAWorksheet
            P1String = worksheet.cellForCellReference("P1").stringValue()
            flag = false
            return (worksheet,P1String)
        }else{
            return (worksheet,P1String)
        }
    
    }
    
    //ワンクール分のシフトをShiftDetailDBとShiftDBへ記録する
    func ShiftDBOneCoursRegist(importname: String, importpath: String, update: Bool){
        let worksheet = self.SetXLSX()
        let shiftyearandmonth = CommonMethod().JudgeYearAndMonth(worksheet.P1)
        
        let monthrange = CommonMethod().GetShiftCoursMonthRange(shiftyearandmonth.startcoursmonthyear, shiftstartmonth: shiftyearandmonth.startcoursmonth)
        
        var date = 11
        let staffcellposition = self.StaffCellPositionGet()     //スタッフの名前が記載されているセル場所 ex.)F8,F9
        var shiftdetailarray = List<ShiftDetailDB>()
        var shiftdetailrecordcount = DBmethod().DBRecordCount(ShiftDetailDB)<commit_msg>P1Stringを半角処理した<commit_after>//
//  XLSXmethod.swift
//  masamon
//
//  Created by 岩見建汰 on 2015/12/06.
//  Copyright © 2015年 Kenta. All rights reserved.
//

import UIKit
import RealmSwift

class XLSXmethod: UIViewController {
    
    //cellの列(日付が記載されている範囲)
    let cellrow = ["G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","AA","AB","AC","AD","AE","AF","AG","AH","AI","AJ","AK"]
    let holiday = DBmethod().ShiftSystemNameArrayGetByGroudid(6)      //休暇のシフト体制を取得
    let mark = "F"
    var number = 6
    
    var flag = true
    
    var documentPath: String = ""
    var spreadsheet = BRAOfficeDocumentPackage()
    var worksheet = BRAWorksheet()
    var P1String: String = ""
    let appDelegate:AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate //AppDelegateのインスタンスを取得

    //XLSXファイルのインスタンスをセットするメソッド
    func SetXLSX() -> (sheet: BRAWorksheet, P1:String){
        
        if flag {
            documentPath = DBmethod().FilePathTmpGet() as String
            spreadsheet = BRAOfficeDocumentPackage.open(documentPath)
            worksheet = spreadsheet.workbook.worksheets[0] as! BRAWorksheet
            P1String = worksheet.cellForCellReference("P1").stringValue()
            P1String = P1String.hankakuOnly
            
            flag = false
            return (worksheet,P1String)
        }else{
            return (worksheet,P1String)
        }
    
    }
    
    //ワンクール分のシフトをShiftDetailDBとShiftDBへ記録する
    func ShiftDBOneCoursRegist(importname: String, importpath: String, update: Bool){
        let worksheet = self.SetXLSX()
        let shiftyearandmonth = CommonMethod().JudgeYearAndMonth(worksheet.P1)
        
        let monthrange = CommonMethod().GetShiftCoursMonthRange(shiftyearandmonth.startcoursmonthyear, shiftstartmonth: shiftyearandmonth.startcoursmonth)
        
        var date = 11
        let staffcellposition = self.StaffCellPositionGet()     //スタッフの名前が記載されているセル場所 ex.)F8,F9
        var shiftdetailarray = List<ShiftDetailDB>()
        var shiftdetailrecordcount = DBmethod().DBRecordCount(ShiftDetailDB)
{'fraction_non_alphanumeric': 0.12689987937273825, 'fraction_numerical': 0.013268998793727383, 'mean_word_length': 3.0409356725146197, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5302812', 'n_tokens_mistral': 1466, 'n_tokens_neox': 1410, 'n_words': 235}