- (void)onSave {
    //    [db insertTable_DEFECT_CATEGORY:list isDel:YES];
    NSString *errMsg = [self checkValid];
    if (NO == [errMsg isEqualToString:@""]) {
        [GlobalVar alertMsgOKWithTitle:@"" message:errMsg];
        return;
    }
    
    DDTBT_SITE_TPPG_LOC *data = [mutableArray4Location objectAtIndex:[[mTableViewLoc indexPathForSelectedRow] row]];
    DDTBT_SITE_LOC_RGON *data1 = [mListRgon objectAtIndex:[[mTableViewRgon indexPathForSelectedRow] row]];
    DDTBT_RGON_DFCT_TYPE *data2 = [mListType objectAtIndex:[[mTableViewType indexPathForSelectedRow] row]];
    
    self.mDfct.cd_site = [GlobalVar loadFromUserDefaults:@"udglobalCDSite"];
    self.mDfct.cd_rcpt_phs = GlobalVar.globalVar.userSelectionSiteInformation.cd_rcpt_phs;
    self.mDfct.dt_rcpt = [GlobalVar currentDateTimeYYYYMMDD];
    self.mDfct.id_rcpt_prsn = GlobalVar.globalVar.userInfo.userId;
    
    self.mDfct.id_loc = data.id_loc;
    self.mDfct.id_rgon = data1.id_rgon;
    self.mDfct.id_dfct_type = data2.id_dfct_type;
    
    NSLog(@"insertDefectCategory_ id_loc : %d id_rgon : %d id_dfct_type %d", self.mDfct.id_loc, self.mDfct.id_rgon, self.mDfct.id_dfct_type);
    
    if (0 == mSeg.selectedSegmentIndex) {
        self.mDfct.id_dfct_cl = 5;
    }
    else if (1 == mSeg.selectedSegmentIndex) {
        self.mDfct.id_dfct_cl = 7;
    }
    else {
        self.mDfct.id_dfct_cl = 10;
    }
    
    self.mDfct.cd_hndl_stat = @"B";
    self.mDfct.dfct_cnts = [mTextDfctCnts.text stringByReplacingOccurrencesOfString:@"'" withString:@"''"];
    self.mDfct.id_rgst = GlobalVar.globalVar.userInfo.userId;
    self.mDfct.dnt_rgst = [GlobalVar currentDateTimeYYYYMMDD];
    self.mDfct.id_chg = GlobalVar.globalVar.userInfo.userId;
    self.mDfct.dnt_chg = [GlobalVar currentDateTimeYYYYMMDD];
    self.mDfct.yn_svr_trsm = @"N";
    
    NSString *atchId = [GlobalVar uniqueId];
    if (0 < [self.mDfct.atchListFmer count] && YES == [self.mDfct.id_wrk_fmer_pic_atch_file isEqualToString:@""]) {
        self.mDfct.id_wrk_fmer_pic_atch_file = atchId;
        NSLog(@"self.mDfct.id_wrk_fmer_pic_atch_file = atchId %@", atchId);
    }
    
    self.mDfct.yn_re_clsf_rqst = @"N";
    
    self.mDfct.cd_loc_clsf = GlobalVar.globalVar.globalCanYouSeeThisSword;
    
    SqlUtils *db = [[SqlUtils alloc] init];
    BOOL redbool = NO;
    if(mBilID !=0) {
        redbool = [db updateDefectCategory:self.mDfct];
    } else { //inserting not updating
        redbool = [db insertDefectCategory:self.mDfct];
    }
    if (redbool) {
        [GlobalVar alertMsgOKWithTitle:@"" message:@"저장되었습니다."];
        [self.delegate refresh];
    }
    else {
        [GlobalVar alertMsgOKWithTitle:@"" message:@"저장 오류-80386"];
    }
    
    [mTextDfctCnts resignFirstResponder];
    [self.navigationController popViewControllerAnimated:NO];
    
}

'Blog History' 카테고리의 다른 글

095  (0) 2020.02.26
094  (0) 2020.02.26
092  (0) 2020.02.26
091  (0) 2020.02.24
090  (0) 2020.02.24

+ Recent posts