| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409 |
- //
- // PromotionOrderSearchCell.m
- // IBOSS
- //
- // Created by 关宏厚 on 2020/9/7.
- // Copyright © 2020 elongtian. All rights reserved.
- //
- #import "PromotionOrderSearchCell.h"
- @implementation PromotionOrderSearchCell
- - (void)awakeFromNib {
- [super awakeFromNib];
-
- }
- /**
- 高度
-
- @return return value description
- */
- - (CGFloat)cellHeight {
- return 1119.0f;
- }
- /**
- cell
-
- @param indexPath <#indexPath description#>
- @return <#return value description#>
- */
- + (instancetype)createCellWithIndexPath:(NSIndexPath *)indexPath {
- PromotionOrderSearchCell *cell = [[NSBundle mainBundle]
- loadNibNamed:@"PromotionOrderSearchCell"
- owner:nil
- options:nil][0];
-
-
-
- cell.txtGoodsCode.delegate = cell;
- cell.txtOnlyCode.delegate=cell;
- cell.txtStrategyName.delegate=cell;
- cell.txtPromotionName.delegate=cell;
- cell.txtSpecification.delegate=cell;
- cell.txtColorNumber.delegate=cell;
- [cell configureKeyboard];
- return cell;
- }
- - (void)loadGradeData
- {
- _downManager = [[ASIDownManager alloc] init];
- _downManager.delegate = self;
- _downManager.onRequestSuccess = @selector(onLoadFinish:);
- _downManager.onRequestFail = @selector(onLoadFail:);
- NSString *urlStr = ServerURL;
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"GetGradeDataSource" forKey:@"Action"];
- [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- [_downManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
- }
- /**
- 数据加载成功回调
-
- @param sender <#sender description#>
- */
- - (void)onLoadFinish:(ASIDownManager *)sender
- {
-
- // 服务器返回数据
- RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
- // 服务器返回数据状态值
- int iStatus = resultModel.status;
- // 服务器返回数据消息
- NSString *message = resultModel.message;
- // 服务器返回数据状态值正确
- if (iStatus == 0)
- {
- NSArray *approvArr = (NSArray *)resultModel.result;
-
- if(approvArr!=nil&&approvArr.count>0)
- {
- _gradeList=[[NSMutableArray alloc]init];
- for(int i=0;i<approvArr.count;i++)
- {
- NSDictionary *approveDic=[approvArr objectAtIndex:i];
- NSString *gradeId= [approveDic objectForKey:@"GradeID"];
- NSString *gradeName=[approveDic objectForKey:@"GradeName"];
- GradeModel *model=[GradeModel new];
- [model parseDic:approveDic];
- GradeFrame *gradeFrame=[GradeFrame new];
- [gradeFrame setGradeFrame:model];
- [_gradeList addObject:gradeFrame];
- }
- }
- }
- }
- - (void)onLoadFail:(ASIDownManager *)sender
- {
-
- }
-
- /**
- 键盘配置
- */
- - (void)configureKeyboard {
- UIView *keyBoardAccessoryView = [self createKeyBoardAccessoryView];
- _txtGoodsCode.inputAccessoryView = keyBoardAccessoryView;
- _txtOnlyCode.inputAccessoryView = keyBoardAccessoryView;
- _txtStrategyName.inputAccessoryView = keyBoardAccessoryView;
- _txtPromotionName.inputAccessoryView = keyBoardAccessoryView;
- _txtSpecification.inputAccessoryView = keyBoardAccessoryView;
- _txtColorNumber.inputAccessoryView = keyBoardAccessoryView;
-
- }
- /**
- 文本编辑时候 弹出取消完成按钮
-
- @return <#return value description#>
- */
- - (UIView *)createKeyBoardAccessoryView {
- UIView *keyBoardAccessoryView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, Screen_Width, ACCESSORY_VIEW_HEIGHT)];
- [keyBoardAccessoryView setBackgroundColor:[UIColor hexColor:@"e1e1e1"]];
- UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(ACCESSORY_BUTTON_LEADING_TRAILING, 0, ACCESSORY_BUTTON_WIDTH, ACCESSORY_VIEW_HEIGHT)];
- [backButton setTitle:@"取消" forState:UIControlStateNormal];
- [backButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
- [backButton.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
- [backButton addTarget:self action:@selector(accessoryButtonBack) forControlEvents:UIControlEventTouchUpInside];
- UIButton *doneButton = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width - ACCESSORY_BUTTON_LEADING_TRAILING - ACCESSORY_BUTTON_WIDTH, 0, ACCESSORY_BUTTON_WIDTH, ACCESSORY_VIEW_HEIGHT)];
- [doneButton setTitle:@"完成" forState:UIControlStateNormal];
- [doneButton setTitleColor:[UIColor hexColor:FILTER_RED_STRING] forState:UIControlStateNormal];
- [doneButton.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
- [doneButton addTarget:self action:@selector(accessoryButtonDone) forControlEvents:UIControlEventTouchUpInside];
- [keyBoardAccessoryView addSubview:backButton];
- [keyBoardAccessoryView addSubview:doneButton];
- return keyBoardAccessoryView;
- }
- /**
- * 隐藏键盘
- */
- -(void)hideKey
- {
- [self.contentView endEditing:YES];
- }
- /**
- 取消文本
- */
- - (void)accessoryButtonBack {
- [self hideKey];}
- /**
- 确定文本
- */
- - (void)accessoryButtonDone {
- [_txtGoodsCode resignFirstResponder];
- [_txtOnlyCode resignFirstResponder];
- [_txtStrategyName resignFirstResponder];
- [_txtPromotionName resignFirstResponder];
- [_txtSpecification resignFirstResponder];
- [_txtColorNumber resignFirstResponder];
- [self hideKey];
- }
- -(void)showGradeInfo:(NSMutableArray*)gradeList
- {
- _gradeSelectedList=gradeList;
-
- NSString *gradeStr=@"";
- NSString *gradeIdStr=@"";
- for(GradeFrame *frame in _gradeSelectedList){
- GradeModel *model=frame.gModel;
- gradeStr= [NSString stringWithFormat:@"%@%@%@",gradeStr,model.gradeName,@","];
- gradeIdStr=[NSString stringWithFormat:@"%@%ld%@",gradeIdStr,model.gradeId,@"^"];
- }
-
- gradeStr=[gradeStr substringToIndex:gradeStr.length-1];
- _gradeIds=[gradeIdStr substringToIndex:gradeIdStr.length-1];
- [_btnGrade setTitle:gradeStr forState:UIControlStateNormal];
- [self updateModel];
- }
- /**
- Identifier
-
- @return <#return value description#>
- */
- + (NSString *)cellReuseIdentifier {
- return @"PromotionOrderSearchCell";
- }
- /**
- 长度
-
- @param textField <#textField description#>
- @param range <#range description#>
- @param string <#string description#>
- @return <#return value description#>
- */
- - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
-
- return YES;
- }
- /**
- 更新model
-
- @param model <#model description#>
- @param indexPath <#indexPath description#>
- */
- - (void)updateCellWithModel:(SideSlipModel *__autoreleasing *)model
- indexPath:(NSIndexPath *)indexPath{
- [self loadGradeData];
- self.regionModel = *model;
- }
- /**
- 文本编辑结束事件
-
- @param textField <#textField description#>
- */
- - (void)textFieldDidEndEditing:(UITextField *)textField {
- [self updateModel];
- }
- /**
- 库区,品牌回调函数
- @param model <#model description#>
- @param value <#value description#>
- */
- - (void)baseIDAndNameDoneDatas:(BaseIDAndNameModel *)m BaseIDAndName:(baseIdAndName)value{
- if (value == baseIdAndNameWare) {
- _warehouseId = m.id;
- [self.btnWarehouseArea setTitle:m.name forState:UIControlStateNormal];
- }
- if(value==baseIdAndNameBrand)
- {
- _brandId=m.id;
- [self.btnBrand setTitle:m.name forState:UIControlStateNormal];
- }
-
- if(value==baseIdAndNameSeries)
- {
- _seriesId=m.id;
- [self.btnSeries setTitle:m.name forState:UIControlStateNormal];
- }
-
- if(value==baseIdAndNameKind)
- {
- _kindCode=m.code;
- [self.btnKInd setTitle:m.name forState:UIControlStateNormal];
- }
-
- if(value==baseIdAndNameVariety)
- {
- _varietyId=m.id;
- [self.btnVariety setTitle:m.name forState:UIControlStateNormal];
- }
-
- if(value==BaseIDAndNamePromotionType)
- {
- _promotionTypeId=m.id;
- [self.btnPromotionType setTitle:m.name forState:UIControlStateNormal];
- }
-
- [self updateModel];
- }
- -(void)updateModel
- {
- SalesOrderListSearchModel *searchModel=[SalesOrderListSearchModel new];
-
- NSString *goodsCode=[_txtGoodsCode.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- searchModel.goodsCode=goodsCode;
-
- NSString *onlyCode=[_txtOnlyCode.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- searchModel.onlyCode=onlyCode;
-
- NSString *strategyName=[_txtStrategyName.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- searchModel.strategyName=strategyName;
-
- NSString *promotionName=[_txtPromotionName.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- searchModel.promotionName=promotionName;
-
- NSString *specification=[_txtSpecification.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- searchModel.specification=specification;
-
- NSString *colorNumber=[_txtColorNumber.text stringByReplacingOccurrencesOfString:@" " withString:@""];
- searchModel.colorNumber=colorNumber;
- searchModel.warehouseAreaId=_warehouseId;
- searchModel.brandId=_brandId;
- searchModel.seriesId=_seriesId;
- searchModel.kindCode=_kindCode;
- searchModel.varietyId=_varietyId;
- searchModel.gradeIds=_gradeIds;
- searchModel.promotionTypeId=_promotionTypeId;
- NSMutableDictionary *mutDict = [NSMutableDictionary dictionaryWithDictionary:_regionModel.customDict];
- [mutDict setValue:searchModel forKey:SALES_ORDER_LIST_SEARCH_RANGE_MODEL];
- _regionModel.customDict = [mutDict copy];
-
- }
- - (IBAction)clickVarietyAction:(id)sender {
-
- SalesOrderVarietyVC *tc = [[SalesOrderVarietyVC alloc ]init];
- tc.bDelegate = self;
- tc.isPresentViewFlag = YES;
- tc.showDialogViewTag = baseIdAndNameVariety;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
- }
- - (IBAction)clickPromotionTypeAction:(id)sender {
-
- PromotionTypeVC *tc = [[PromotionTypeVC alloc ]init];
- tc.bDelegate = self;
- tc.isPresentViewFlag = YES;
- tc.showDialogViewTag = BaseIDAndNamePromotionType;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
-
- }
- - (IBAction)clickGradeAction:(id)sender {
- if(_gradeList!=nil&&_gradeList.count>0)
- {
- SalesOrderGradeVC *tc = [[SalesOrderGradeVC alloc ]init];
- tc.gradeList=_gradeList;
- _gradeTempList= [[NSMutableArray alloc] initWithArray:_gradeList copyItems:YES];
- tc.isPresentViewFlag=YES;
- tc.gradeDelegate = self;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
- }
- }
- - (IBAction)clickWarehouseAreaAction:(id)sender {
- WarehouseAreaSearchVC *tc = [[WarehouseAreaSearchVC alloc ]init];
- tc.bDelegate = self;
- tc.isPresentViewFlg = YES;
- tc.showDialogViewTag = baseIdAndNameWare;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
- }
- - (IBAction)clickBrandAction:(id)sender {
- SalesOrderBrandSearchVC *tc = [[SalesOrderBrandSearchVC alloc ]init];
- tc.bDelegate = self;
- tc.isPresentViewFlag = YES;
- tc.showDialogViewTag = baseIdAndNameBrand;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- }
- - (IBAction)clickSeriesAction:(id)sender {
-
- SalesOrderSeriesVC *tc = [[SalesOrderSeriesVC alloc ]init];
- tc.bDelegate = self;
- tc.isPresentViewFlag = YES;
- tc.showDialogViewTag = baseIdAndNameSeries;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
- }
- - (IBAction)clickKindAction:(id)sender {
-
- SalesOrderKindVC *tc = [[SalesOrderKindVC alloc ]init];
- tc.bDelegate = self;
- tc.isPresentViewFlag = YES;
- tc.showDialogViewTag = baseIdAndNameKind;
- if ([self.delegate respondsToSelector:@selector(sideSlipTableViewCellNeedsDismissViewController:animated:)]) {
- [self.delegate sideSlipTableViewCellNeedsDismissViewController:tc animated:YES];
- }
- }
- -(void)recoveryData{
-
- if(_gradeTempList!=nil&&_gradeTempList.count>0){
- _gradeList= [[NSMutableArray alloc] initWithArray:_gradeTempList copyItems:YES];;
- }
- }
- @end
|