                 //シフト体制の分だけループを回し、各ループでスタッフ1人分のシフト出現場所を記録する
                 for(var i = 0; i < DBmethod().DBRecordCount(ShiftSystemDB); i++){
                     let shiftname = DBmethod().ShiftSystemNameGet(i)
-                    switch(shiftname.groupid){
-                    case 0:
-                        earlyshiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
-                        
-                    case 1:
-                        center1shiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
-                        
-                    case 2:
-                        center2shiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
-                        
-                    case 3:
-                        center3shiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
-                        
-                    case 4:
-                        lateshiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
-                        
-                    case 5:
-                        othershiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
-                        
-                    case 6:
-                        holidayshiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
-                        
-                    default:
-                        break
-                    }
+                    shiftlocationarray[shiftname.groupid] += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
+                    
+                    //                    switch(shiftname.groupid){
+                    //                    case 0:
+                    //                        earlyshiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
+                    //
+                    //                    case 1:
+                    //                        center1shiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
+                    //
+                    //                    case 2:
+                    //                        center2shiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
+                    //
+                    //                    case 3:
+                    //                        center3shiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
+                    //
+                    //                    case 4:
+                    //                        lateshiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
+                    //
+                    //                    case 5:
+                    //                        othershiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
+                    //
+                    //                    case 6:
+                    //                        holidayshiftlocationarray += self.GetShiftPositionArray(staffarraytmpnsstring, shiftname: shiftname.name)
+                    //
+                    //                    default:
+                    //                        break
+                    //                    }
                 }
             }
             
             //重複した要素を削除する
-            earlyshiftlocationarray = GetRemoveOverlapElementArray(earlyshiftlocationarray)
-            center1shiftlocationarray = GetRemoveOverlapElementArray(center1shiftlocationarray)
-            center2shiftlocationarray = GetRemoveOverlapElementArray(center2shiftlocationarray)
-            center3shiftlocationarray = GetRemoveOverlapElementArray(center3shiftlocationarray)
-            lateshiftlocationarray = GetRemoveOverlapElementArray(lateshiftlocationarray)
-            holidayshiftlocationarray = GetRemoveOverlapElementArray(holidayshiftlocationarray)
-            othershiftlocationarray = GetRemoveOverlapElementArray(othershiftlocationarray)
+            for(var i = 0; i < shiftlocationarray.count; i++){
+                shiftlocationarray[i] = self.GetRemoveOverlapElementArray(shiftlocationarray[i])
+            }
+            //            earlyshiftlocationarray = GetRemoveOverlapElementArray(earlyshiftlocationarray)
+            //            center1shiftlocationarray = GetRemoveOverlapElementArray(center1shiftlocationarray)
+            //            center2shiftlocationarray = GetRemoveOverlapElementArray(center2shiftlocationarray)
+            //            center3shiftlocationarray = GetRemoveOverlapElementArray(center3shiftlocationarray)
+            //            lateshiftlocationarray = GetRemoveOverlapElementArray(lateshiftlocationarray)
+            //            holidayshiftlocationarray = GetRemoveOverlapElementArray(holidayshiftlocationarray)
+            //            othershiftlocationarray = GetRemoveOverlapElementArray(othershiftlocationarray)
             
             
             //配列をまたがって重複している要素を削除する
-            let removeresultarray = self.GetRemoveOverlapElementAnotherArray(earlyshiftlocationarray, center1: center1shiftlocationarray, center2: center2shiftlocationarray, center3: center3shiftlocationarray, late: lateshiftlocationarray, other: othershiftlocationarray)
-            earlyshiftlocationarray = removeresultarray.removedearly
-            center1shiftlocationarray = removeresultarray.removedcenter1
-            center2shiftlocationarray = removeresultarray.removedcenter2
-            center3shiftlocationarray = removeresultarray.removedcenter3
-            lateshiftlocationarray = removeresultarray.removedlate
-            othershiftlocationarray = removeresultarray.removedother
+            for(var i = 0; i < shiftlocationarray.count; i++){
+                let AAA = self.GetRemoveOverlapElementAnotherArray(shiftlocationarray)
+                shiftlocationarray[i] = AAA[i]
+            }
+            
+            
+            
+            //            let removeresultarray = self.GetRemoveOverlapElementAnotherArray(earlyshiftlocationarray, center1: center1shiftlocationarray, center2: center2shiftlocationarray, center3: center3shiftlocationarray, late: lateshiftlocationarray, other: othershiftlocationarray)
+            //            earlyshiftlocationarray = removeresultarray.removedearly
+            //            center1shiftlocationarray = removeresultarray.removedcenter1
+            //            center2shiftlocationarray = removeresultarray.removedcenter2
+            //            center3shiftlocationarray = removeresultarray.removedcenter3
+            //            lateshiftlocationarray = removeresultarray.removedlate
+            //            othershiftlocationarray = removeresultarray.removedother
             
             
             //要素を昇順でソートする

            position += 1
            getcharacterstaffname = stafftext[stafftext.startIndex.advancedBy(position)]
        }

        return staffname
    }
    

        
        //スタッフ名の抽出(シフト体制に含まれる文字が出るまで)
        var getcharacterstaffname = stafftext[stafftext.startIndex.advancedBy(position)]
        
        while(DBmethod().SearchShiftSystem(String(getcharacterstaffname)) == nil){
            let ABC = stafftext.startIndex.advancedBy(position)
            
