NewOtherInStorageVC.m 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. //
  2. // NewOtherInStorageVC.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2018/4/24.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "NewOtherInStorageVC.h"
  9. @interface NewOtherInStorageVC (){
  10. UIScrollView *_scrollView;
  11. UITextField *_selectedAchievementField;
  12. CGRect originalAchievementFrame;
  13. }
  14. @end
  15. @implementation NewOtherInStorageVC
  16. #pragma mark 公共函数
  17. /**
  18. 视图加载完成函数
  19. */
  20. - (void)viewDidLoad {
  21. [super viewDidLoad];
  22. [self initUI];
  23. [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
  24. [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
  25. [self loadDataSource];
  26. }
  27. /**
  28. 修改:2017-9-25
  29. 适配机型
  30. 安全区视图发生变化
  31. */
  32. -(void)viewSafeAreaInsetsDidChange{
  33. _scrollView.frame = CGRectMake(0, 10,Screen_Width, self.view.safeAreaLayoutGuide.layoutFrame.size.height-10);
  34. [super viewSafeAreaInsetsDidChange];
  35. }
  36. - (void)didReceiveMemoryWarning {
  37. [super didReceiveMemoryWarning];
  38. }
  39. #pragma mark 委托函数
  40. /**
  41. 客户编码回调
  42. @param searchModel <#searchModel description#>
  43. */
  44. -(void)getCustomerOrder:(CustomerCodeSearchModel*)searchModel{
  45. _customerId=[NSString stringWithFormat:@"%d",searchModel.customerId];
  46. _customerCode=searchModel.customerCode;
  47. _customerName=searchModel.customerName;
  48. _telephone=searchModel.telephone;
  49. _address=searchModel.address;
  50. _contacts=searchModel.contacts;
  51. _lblCustomerCode.text=_customerCode;
  52. }
  53. /**
  54. textfield委托函数
  55. @param textField <#textField description#>
  56. @return <#return value description#>
  57. */
  58. -(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
  59. {
  60. _selectedAchievementField = textField;
  61. return YES;
  62. }
  63. /**
  64. 渠道,区域,客户性质,级别等返回回调
  65. @param model <#model description#>
  66. @param cr <#cr description#>
  67. */
  68. - (void)customerReportTextDoneDatas:(CustomerReportTextInfoModel *)model CustomerReport:(CustomerReport)cr
  69. {
  70. if (model==nil) {
  71. return;
  72. }
  73. //渠道返回值
  74. if(cr==ReportDriver){
  75. _driverId=model.idCode;
  76. _driverName=model.name;
  77. _lblDriver.text=_driverName;
  78. }
  79. if(cr==ReportDocker){
  80. _dockerId=model.idCode;
  81. _dockerName=model.name;
  82. _lblDocker.text=_dockerName;
  83. }
  84. if(cr==ReportSupplier){
  85. _supplierId=model.idCode;
  86. _supplierName=model.name;
  87. _lblSupplier.text=_supplierName;
  88. }
  89. }
  90. /**
  91. 业务员 业务部门
  92. @param Amodel <#Amodel description#>
  93. @param cr <#cr description#>
  94. */
  95. -(void)achiementData:(AchiementDepartmentInfoModel *)Amodel CustomerReport:(CustomerReport)cr{
  96. //返回值
  97. if(cr== ReportAchiementDepartmt){
  98. _organizationName=Amodel.organizationName;
  99. _organizationId=Amodel.organizationId;
  100. _organizationCode=Amodel.organizationCode;
  101. _lblDepartment.text=_organizationName;
  102. }
  103. // 业务员
  104. if(cr==ReportAchiementmn){
  105. _staffId=Amodel.staffId;
  106. _staffName=Amodel.staffName;
  107. _lblStaff.text=_staffName;
  108. }
  109. }
  110. /**
  111. 数据源加载成功回调
  112. @param sender <#sender description#>
  113. */
  114. - (void)onDataSourceLoadFinish:(ASIDownManager *)sender {
  115. NSDictionary *dic = [sender.mWebStr JSONValue];
  116. [self stopLoading];
  117. // 服务器返回数据是否正确
  118. if (dic && [dic isKindOfClass:[NSDictionary class]]) {
  119. // 服务器返回数据状态值
  120. int iStatus = [[dic objectForKey:@"Status"] intValue];
  121. // 服务器返回数据消息
  122. NSString *message=[dic objectForKey:@"Message"];
  123. // 服务器返回数据状态值正确
  124. if (iStatus == 0) {
  125. NSDictionary * infoDic=[dic objectForKey:@"Result"];
  126. // 返回结果
  127. if(infoDic!=nil&& infoDic.count>0)
  128. {
  129. NSArray *departmentArray=[infoDic objectForKey:@"Table"];
  130. if(departmentArray!=nil&&departmentArray.count>0){
  131. _departmentList=departmentArray;
  132. }
  133. NSArray *staffArray=[infoDic objectForKey:@"Table1"];
  134. if(staffArray!=nil&&staffArray.count>0){
  135. _staffList=staffArray;
  136. }
  137. NSArray *driverArray=[infoDic objectForKey:@"Table2"];
  138. if(driverArray!=nil&&driverArray.count>0){
  139. _driverList=driverArray;
  140. _dockerList=driverArray;
  141. }
  142. NSArray *supplierArray=[infoDic objectForKey:@"Table3"];
  143. if(supplierArray!=nil&&supplierArray.count>0){
  144. _supplierList=supplierArray;
  145. }
  146. NSArray *warehouseArray=[infoDic objectForKey:@"Table5"];
  147. if(warehouseArray!=nil&&warehouseArray.count>0){
  148. _warehouseList=warehouseArray;
  149. }
  150. NSArray *positionNumberArray=[infoDic objectForKey:@"Table6"];
  151. if(positionNumberArray!=nil&&positionNumberArray.count>0){
  152. _positionNumberList=positionNumberArray;
  153. }
  154. }
  155. }
  156. // 服务器返回数据状态值异常
  157. else if(iStatus==ActionResultStatusAuthError
  158. ||iStatus==ActionResultStatusNoLogin
  159. ||iStatus==ActionResultStatusLogined ||iStatus == ActionResultStatusLoginedInvalid){
  160. [self showReLoginDialog:message];
  161. }
  162. else{
  163. [self showAlertViewText:message];
  164. }
  165. }
  166. }
  167. /**
  168. 数据源加载失败回调
  169. @param sender <#sender description#>
  170. */
  171. - (void)onDataSourceLoadFail:(ASIDownManager *)sender {
  172. [self stopLoading];
  173. [self showAlertViewText:@"加载失败"];
  174. }
  175. #pragma mark 私有函数
  176. /**
  177. 初始化UI
  178. */
  179. -(void)initUI{
  180. [self.view setBackgroundColor:[UIColor whiteColor]];
  181. UIView *topSeparatorView = [UIView new];
  182. topSeparatorView.frame=CGRectMake(0,3, Screen_Width, 10);
  183. topSeparatorView.backgroundColor = LineBackgroundColor;
  184. [self.view addSubview:topSeparatorView];
  185. CGFloat heightRow = 40;
  186. CGFloat lblx = 20;
  187. CGFloat lbly = 8;
  188. CGFloat lblwidth = 80;
  189. CGFloat lblheight = 25;
  190. _scrollView=[UIScrollView new];
  191. _scrollView.frame=CGRectMake(0,CGRectGetMaxY(topSeparatorView.frame), Screen_Width,self.view.frame.size.height-CGRectGetMaxY(topSeparatorView.frame));
  192. [self.view addSubview:_scrollView];
  193. UIView *vBody = [UIView new];
  194. [_scrollView addSubview:vBody];
  195. UITapGestureRecognizer* singleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideKey)];
  196. [self.view addGestureRecognizer:singleRecognizer];
  197. UIView *vDriver = [UIView new];
  198. vDriver.frame=CGRectMake(0,0, Screen_Width, heightRow);
  199. [vBody addSubview:vDriver];
  200. NSString *driverTitle=@"运输司机";
  201. UILabel *lblTitleDriver=[UILabel new];
  202. lblTitleDriver.frame=CGRectMake(lblx,lbly,lblwidth,lblheight);
  203. lblTitleDriver.textColor = [UIColor blackColor];
  204. lblTitleDriver.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  205. [vDriver addSubview:lblTitleDriver];
  206. lblTitleDriver.text=driverTitle;
  207. _lblDriver = [UILabel new];
  208. _lblDriver.frame=CGRectMake(CGRectGetMaxX(lblTitleDriver.frame), lbly,Screen_Width-CGRectGetMaxX(lblTitleDriver.frame)-55, lblheight);
  209. _lblDriver.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  210. _lblDriver.text=@"请选择运输司机";
  211. _lblDriver.userInteractionEnabled=YES;
  212. UITapGestureRecognizer *driverTapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(goDriver:)];
  213. [_lblDriver addGestureRecognizer:driverTapGesture];
  214. [vDriver addSubview:_lblDriver];
  215. UIButton *btnDriverRightArrow = [UIButton buttonWithType:UIButtonTypeCustom];
  216. btnDriverRightArrow.frame=CGRectMake(Screen_Width-50,lbly,32,30);
  217. UIImageView *rightArrowImg = [[UIImageView alloc]initWithFrame:CGRectMake(25,9,7, 12)];
  218. [rightArrowImg setImage:[UIImage imageNamed:@"rightarrow"]];
  219. [ btnDriverRightArrow addSubview:rightArrowImg];
  220. rightArrowImg.userInteractionEnabled=NO;
  221. [vDriver addSubview:btnDriverRightArrow];
  222. UIView *driverSeparator=[UIView new];
  223. driverSeparator.backgroundColor=LineBackgroundColor;
  224. driverSeparator.frame=CGRectMake(CGRectGetMaxX(lblTitleDriver.frame),heightRow,Screen_Width-CGRectGetMaxX(lblTitleDriver.frame),1);
  225. [vDriver addSubview:driverSeparator];
  226. UIView *vDocker = [UIView new];
  227. vDocker.frame=CGRectMake(0,CGRectGetMaxY(vDriver.frame), Screen_Width, heightRow);
  228. [vBody addSubview:vDocker];
  229. NSString *dockerTitle=@"装卸工人";
  230. UILabel *lblTitleDocker=[UILabel new];
  231. lblTitleDocker.frame=CGRectMake(lblx,lbly,lblwidth,lblheight);
  232. lblTitleDocker.textColor = [UIColor blackColor];
  233. lblTitleDocker.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  234. [vDocker addSubview:lblTitleDocker];
  235. lblTitleDocker.text=dockerTitle;
  236. _lblDocker = [UILabel new];
  237. _lblDocker.frame=CGRectMake(CGRectGetMaxX(lblTitleDocker.frame), lbly,Screen_Width-CGRectGetMaxX(lblTitleDocker.frame)-55, lblheight);
  238. _lblDocker.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  239. _lblDocker.text=@"请选择装卸工人";
  240. _lblDocker.userInteractionEnabled=YES;
  241. UITapGestureRecognizer *dockerTapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(goDocker:)];
  242. [_lblDocker addGestureRecognizer:dockerTapGesture];
  243. [vDocker addSubview:_lblDocker];
  244. UIButton *btnDockerRightArrow = [UIButton buttonWithType:UIButtonTypeCustom];
  245. btnDockerRightArrow.frame=CGRectMake(Screen_Width-50,lbly,32,30);
  246. UIImageView *rightArrowImg1 = [[UIImageView alloc]initWithFrame:CGRectMake(25,9,7, 12)];
  247. [rightArrowImg1 setImage:[UIImage imageNamed:@"rightarrow"]];
  248. [ btnDockerRightArrow addSubview:rightArrowImg1];
  249. rightArrowImg1.userInteractionEnabled=NO;
  250. [vDocker addSubview:btnDockerRightArrow];
  251. UIView *dockerSeparator=[UIView new];
  252. dockerSeparator.backgroundColor=LineBackgroundColor;
  253. dockerSeparator.frame=CGRectMake(CGRectGetMaxX(lblTitleDocker.frame),heightRow,Screen_Width-CGRectGetMaxX(lblTitleDocker.frame),1);
  254. [vDocker addSubview:dockerSeparator];
  255. UIView *vSupplier = [UIView new];
  256. vSupplier.frame=CGRectMake(0,CGRectGetMaxY(vDocker.frame), Screen_Width, heightRow);
  257. [vBody addSubview:vSupplier];
  258. NSString *supplierTitle=@"供 应 商";
  259. UILabel *lblTitleSupplier=[UILabel new];
  260. lblTitleSupplier.frame=CGRectMake(lblx,lbly,lblwidth,lblheight);
  261. lblTitleSupplier.textColor = [UIColor blackColor];
  262. lblTitleSupplier.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  263. [vSupplier addSubview:lblTitleSupplier];
  264. lblTitleSupplier.text=supplierTitle;
  265. _lblSupplier = [UILabel new];
  266. _lblSupplier.frame=CGRectMake(CGRectGetMaxX(lblTitleSupplier.frame), lbly,Screen_Width-CGRectGetMaxX(lblTitleSupplier.frame)-55, lblheight);
  267. _lblSupplier.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  268. _lblSupplier.text=@"请选择供应商";
  269. _lblSupplier.userInteractionEnabled=YES;
  270. UITapGestureRecognizer *supplierTapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(goSupplier:)];
  271. [_lblSupplier addGestureRecognizer:supplierTapGesture];
  272. [vSupplier addSubview:_lblSupplier];
  273. UIButton *btnSupplierRightArrow = [UIButton buttonWithType:UIButtonTypeCustom];
  274. btnSupplierRightArrow.frame=CGRectMake(Screen_Width-50,lbly,32,30);
  275. UIImageView *rightArrowImg2= [[UIImageView alloc]initWithFrame:CGRectMake(25,9,7, 12)];
  276. [rightArrowImg2 setImage:[UIImage imageNamed:@"rightarrow"]];
  277. [ btnSupplierRightArrow addSubview:rightArrowImg2];
  278. rightArrowImg2.userInteractionEnabled=NO;
  279. [vSupplier addSubview:btnSupplierRightArrow];
  280. UIView *supplierSeparator=[UIView new];
  281. supplierSeparator.backgroundColor=LineBackgroundColor;
  282. supplierSeparator.frame=CGRectMake(CGRectGetMaxX(lblTitleSupplier.frame),heightRow,Screen_Width-CGRectGetMaxX(lblTitleSupplier.frame),1);
  283. [vSupplier addSubview:supplierSeparator];
  284. UIView *vCustomerCode = [UIView new];
  285. vCustomerCode.frame=CGRectMake(0,CGRectGetMaxY(vSupplier.frame), Screen_Width, heightRow);
  286. [vBody addSubview:vCustomerCode];
  287. NSString *customerCodeTitle=@"客户编码";
  288. UILabel *lblTitleCustomerCode=[UILabel new];
  289. lblTitleCustomerCode.frame=CGRectMake(lblx,lbly,lblwidth,lblheight);
  290. lblTitleCustomerCode.textColor = [UIColor blackColor];
  291. lblTitleCustomerCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  292. [vCustomerCode addSubview:lblTitleCustomerCode];
  293. lblTitleCustomerCode.text=customerCodeTitle;
  294. _lblCustomerCode = [UILabel new];
  295. _lblCustomerCode.frame=CGRectMake(CGRectGetMaxX(lblTitleCustomerCode.frame), lbly,Screen_Width-CGRectGetMaxX(lblTitleCustomerCode.frame)-55, lblheight);
  296. _lblCustomerCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  297. _lblCustomerCode.text=@"请选择客户编码";
  298. _lblCustomerCode.tag=1301;
  299. _lblCustomerCode.userInteractionEnabled=YES;
  300. UITapGestureRecognizer *customerCodeTapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(searchCustomerCode)];
  301. [_lblCustomerCode addGestureRecognizer:customerCodeTapGesture];
  302. [vCustomerCode addSubview:_lblCustomerCode];
  303. UIButton *btnCustomerCodeRightArrow = [UIButton buttonWithType:UIButtonTypeCustom];
  304. btnCustomerCodeRightArrow.frame=CGRectMake(Screen_Width-50,lbly,32,30);
  305. UIImageView *rightArrowImg3= [[UIImageView alloc]initWithFrame:CGRectMake(25,9,7, 12)];
  306. [rightArrowImg3 setImage:[UIImage imageNamed:@"rightarrow"]];
  307. [ btnCustomerCodeRightArrow addSubview:rightArrowImg3];
  308. rightArrowImg3.userInteractionEnabled=NO;
  309. [vCustomerCode addSubview:btnCustomerCodeRightArrow];
  310. UIView *customerCodeSeparator=[UIView new];
  311. customerCodeSeparator.backgroundColor=LineBackgroundColor;
  312. customerCodeSeparator.frame=CGRectMake(CGRectGetMaxX(lblTitleCustomerCode.frame),heightRow,Screen_Width-CGRectGetMaxX(lblTitleCustomerCode.frame),1);
  313. [vCustomerCode addSubview:customerCodeSeparator];
  314. //业务员
  315. UIView *vStaff = [UIView new];
  316. vStaff.frame=CGRectMake(0,CGRectGetMaxY(vCustomerCode.frame), Screen_Width, heightRow);
  317. [vBody addSubview:vStaff];
  318. NSString *staffTitle=@"业 务 员";
  319. UILabel *lblTitleStaff=[UILabel new];
  320. lblTitleStaff.frame=CGRectMake(lblx,lbly,lblwidth,lblheight);
  321. lblTitleStaff.textColor = [UIColor blackColor];
  322. lblTitleStaff.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  323. [vStaff addSubview:lblTitleStaff];
  324. lblTitleStaff.text=staffTitle;
  325. _lblStaff = [UILabel new];
  326. _lblStaff.frame=CGRectMake(CGRectGetMaxX(lblTitleStaff.frame), lbly,Screen_Width-CGRectGetMaxX(lblTitleStaff.frame)-55, lblheight);
  327. _lblStaff.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  328. _lblStaff.text=@"请选择业务员";
  329. _lblStaff.userInteractionEnabled=YES;
  330. UITapGestureRecognizer *staffTapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(goStaff:)];
  331. [_lblStaff addGestureRecognizer:staffTapGesture];
  332. [vStaff addSubview:_lblStaff];
  333. UIButton *btnStaffRightArrow = [UIButton buttonWithType:UIButtonTypeCustom];
  334. btnStaffRightArrow.frame=CGRectMake(Screen_Width-50,lbly,32,30);
  335. UIImageView *rightArrowImg4= [[UIImageView alloc]initWithFrame:CGRectMake(25,9,7, 12)];
  336. [rightArrowImg4 setImage:[UIImage imageNamed:@"rightarrow"]];
  337. [ btnStaffRightArrow addSubview:rightArrowImg4];
  338. rightArrowImg4.userInteractionEnabled=NO;
  339. [vStaff addSubview:btnStaffRightArrow];
  340. UIView *staffSeparator=[UIView new];
  341. staffSeparator.backgroundColor=LineBackgroundColor;
  342. staffSeparator.frame=CGRectMake(CGRectGetMaxX(lblTitleStaff.frame),heightRow,Screen_Width-CGRectGetMaxX(lblTitleStaff.frame),1);
  343. [vStaff addSubview:staffSeparator];
  344. UIView *vDepartment = [UIView new];
  345. vDepartment.frame=CGRectMake(0,CGRectGetMaxY(vStaff.frame), Screen_Width, heightRow);
  346. [vBody addSubview:vDepartment];
  347. NSString *departmentTitle=@"业务部门";
  348. UILabel *lblTitleDepartment=[UILabel new];
  349. lblTitleDepartment.frame=CGRectMake(lblx,lbly,lblwidth,lblheight);
  350. lblTitleDepartment.textColor = [UIColor blackColor];
  351. lblTitleDepartment.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  352. [vDepartment addSubview:lblTitleDepartment];
  353. lblTitleDepartment.text=departmentTitle;
  354. _lblDepartment = [UILabel new];
  355. _lblDepartment.frame=CGRectMake(CGRectGetMaxX(lblTitleDepartment.frame), lbly,Screen_Width-CGRectGetMaxX(lblTitleDepartment.frame)-55, lblheight);
  356. _lblDepartment.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  357. _lblDepartment.text=@"请选择业务部门";
  358. _lblDepartment.userInteractionEnabled=YES;
  359. UITapGestureRecognizer *departmentTapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(goDepartment:)];
  360. [_lblDepartment addGestureRecognizer:departmentTapGesture];
  361. [vDepartment addSubview:_lblDepartment];
  362. UIButton *btnDepartmentRightArrow = [UIButton buttonWithType:UIButtonTypeCustom];
  363. btnDepartmentRightArrow.frame=CGRectMake(Screen_Width-50,lbly,32,30);
  364. UIImageView *rightArrowImg5= [[UIImageView alloc]initWithFrame:CGRectMake(25,9,7, 12)];
  365. [rightArrowImg5 setImage:[UIImage imageNamed:@"rightarrow"]];
  366. [ btnDepartmentRightArrow addSubview:rightArrowImg5];
  367. rightArrowImg5.userInteractionEnabled=NO;
  368. [vDepartment addSubview:btnDepartmentRightArrow];
  369. UIView *departmentSeparator=[UIView new];
  370. departmentSeparator.backgroundColor=LineBackgroundColor;
  371. departmentSeparator.frame=CGRectMake(CGRectGetMaxX(lblTitleDepartment.frame),heightRow,Screen_Width-CGRectGetMaxX(lblTitleDepartment.frame),1);
  372. [vDepartment addSubview:departmentSeparator];
  373. UIView *vRemarks = [UIView new];
  374. vRemarks.frame=CGRectMake(0,CGRectGetMaxY(vDepartment.frame), Screen_Width, heightRow);
  375. [vBody addSubview:vRemarks];
  376. NSString *remarksTitle=@"备 注";
  377. UILabel *lblRemarksTitle=[UILabel new];
  378. lblRemarksTitle.frame=CGRectMake(lblx,lbly,lblwidth,lblheight);
  379. lblRemarksTitle.textColor = [UIColor blackColor];
  380. lblRemarksTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  381. [vRemarks addSubview:lblRemarksTitle];
  382. lblRemarksTitle.text=remarksTitle;
  383. _txtRemarks = [UITextField new];
  384. _txtRemarks.frame=CGRectMake(CGRectGetMaxX(lblRemarksTitle.frame), lbly,Screen_Width-CGRectGetMaxX(lblRemarksTitle.frame)-10, lblheight);
  385. _txtRemarks.placeholder=@"请输入备注";
  386. _txtRemarks.delegate=self;
  387. _txtRemarks.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  388. [vRemarks addSubview:_txtRemarks];
  389. UIView *remarksSeparator=[UIView new];
  390. remarksSeparator.backgroundColor=LineBackgroundColor;
  391. remarksSeparator.frame=CGRectMake(CGRectGetMaxX(lblRemarksTitle.frame),heightRow,Screen_Width-CGRectGetMaxX(lblRemarksTitle.frame),1);
  392. [vRemarks addSubview:remarksSeparator];
  393. vBody.frame=CGRectMake(0,0, Screen_Width,CGRectGetMaxY(vRemarks.frame));
  394. _scrollView.contentSize = CGSizeMake(self.view.frame.size.width, CGRectGetMaxY(vBody.frame)+rectStatusHeight+rectNavHeight);
  395. originalAchievementFrame=_scrollView.frame;
  396. }
  397. /**
  398. 隐藏键盘
  399. */
  400. -(void)hideKey{
  401. [self.view endEditing:YES];
  402. }
  403. /**
  404. 出示键盘通知
  405. @param notification <#notification description#>
  406. */
  407. -(void)keyboardWillShow:(NSNotification*)notification
  408. {
  409. // 获得键盘尺寸
  410. NSDictionary *info = notification.userInfo;
  411. NSValue *aValue = [info objectForKeyedSubscript:UIKeyboardFrameEndUserInfoKey];
  412. CGSize keyboardSize = [aValue CGRectValue].size;
  413. if(!_keyboardShow){
  414. // //重新定义ScrollView的尺寸
  415. CGRect viewFrame = _scrollView.frame;
  416. viewFrame.size.height -=(keyboardSize.height); //原来的尺寸减去键盘的高度
  417. viewFrame.size.height-=130;
  418. _scrollView.frame = viewFrame;
  419. //获取当前文本框架大小
  420. CGRect textFieldRect = [_selectedAchievementField frame];
  421. //滚动到当前文本框
  422. [_scrollView scrollRectToVisible:textFieldRect animated:YES];
  423. }
  424. _keyboardShow=YES;
  425. }
  426. /**
  427. 隐藏键盘通知
  428. @param aNotification <#aNotification description#>
  429. */
  430. - (void)keyboardWillHide:(NSNotification *)aNotification
  431. {
  432. if(_keyboardShow){
  433. _scrollView.frame=originalAchievementFrame;
  434. }
  435. _keyboardShow=NO;
  436. }
  437. /**
  438. 跳转到司机页面
  439. @param gesture <#gesture description#>
  440. */
  441. - (void)goDriver:(UITapGestureRecognizer *)gesture {
  442. [self.view endEditing:YES];
  443. CustomerReportTextVC *tc=[[CustomerReportTextVC alloc] init];
  444. tc.delegate=self;
  445. tc.dataSourceCode=@"T_MST_Driver";
  446. tc.showDialogViewTag=ReportDriver;
  447. tc.jsonArr=_driverList;
  448. [self.listNavVc pushViewController:tc animated:YES];
  449. }
  450. /**
  451. 跳转到装卸工人页面
  452. @param gesture <#gesture description#>
  453. */
  454. - (void)goDocker:(UITapGestureRecognizer *)gesture {
  455. CustomerReportTextVC *tc=[[CustomerReportTextVC alloc] init];
  456. tc.delegate=self;
  457. [self.view endEditing:YES];
  458. tc.dataSourceCode=@"T_MST_Docker";
  459. tc.showDialogViewTag=ReportDocker;
  460. tc.jsonArr=_dockerList;
  461. [self.listNavVc pushViewController:tc animated:YES];
  462. }
  463. /**
  464. 跳转到供应商页面
  465. @param gesture <#gesture description#>
  466. */
  467. - (void)goSupplier:(UITapGestureRecognizer *)gesture {
  468. self.hidesBottomBarWhenPushed = YES;
  469. [self.view endEditing:YES];
  470. CustomerReportTextVC *tc=[[CustomerReportTextVC alloc] init];
  471. tc.delegate=self;
  472. tc.jsonArr=_supplierList;
  473. tc.showDialogViewTag=ReportSupplier;
  474. [self.listNavVc pushViewController:tc animated:YES];
  475. }
  476. /**
  477. 跳转到业务部门页面
  478. */
  479. - (void)goDepartment:(UITapGestureRecognizer *)gesture{
  480. [self.view endEditing:YES];
  481. CustomerAchievementTextVC *tc=[CustomerAchievementTextVC new];
  482. tc.cDelegate = self;
  483. tc.showDialogViewTag=ReportAchiementDepartmt;
  484. tc.jsonArr=_departmentList;
  485. [self.listNavVc pushViewController:tc animated:YES];
  486. }
  487. /**
  488. 跳转到客户编码查询
  489. */
  490. -(void)searchCustomerCode{
  491. [self.view endEditing:YES];
  492. CustomerCodeSearchVC *customerCodeVC=[[ CustomerCodeSearchVC alloc] init];
  493. UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:customerCodeVC];
  494. navigationController.modalPresentationStyle = UIModalPresentationFormSheet;
  495. navigationController.preferredContentSize = CGSizeMake(frameSize.x, frameSize.y);
  496. customerCodeVC.orderDelegate=self;
  497. customerCodeVC.flag=@"otherInStorage";
  498. [self.listNavVc pushViewController:customerCodeVC animated:YES];
  499. }
  500. /**
  501. 跳转到业务员页面
  502. */
  503. - (void)goStaff:(UITapGestureRecognizer *)gesture{
  504. [self.view endEditing:YES];
  505. CustomerAchievementTextVC *tc=[[CustomerAchievementTextVC alloc] init];
  506. tc.cDelegate=self;
  507. tc.showDialogViewTag=ReportAchiementmn;
  508. tc.jsonArr=_staffList;
  509. [self.listNavVc pushViewController:tc animated:YES];
  510. }
  511. /**
  512. 加载基本数据源
  513. */
  514. -(void)loadDataSource{
  515. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  516. [dict setObject:@"GetOtherEnterInitData" forKey:@"Action"];
  517. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  518. [dict setObject:kkUserCode forKey:@"UserCode"];
  519. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  520. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  521. [dict setObject:kkOrganizationId forKey:@"OrganizationID"];
  522. _downManager = [[ASIDownManager alloc] init];
  523. [self startLoading];
  524. _downManager.delegate = self;
  525. _downManager.OnImageDown = @selector(onDataSourceLoadFinish:);
  526. _downManager.OnImageFail = @selector(onDataSourceLoadFail:);
  527. [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
  528. }
  529. @end