OtherOutStorageInventoryDetailVC.m 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. //
  2. // SalesOutStorageInventoryDetailVC.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2018/4/28.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "OtherOutStorageInventoryDetailVC.h"
  9. @interface OtherOutStorageInventoryDetailVC (){
  10. UIScrollView *_scrollView;
  11. }
  12. @end
  13. @implementation OtherOutStorageInventoryDetailVC
  14. #pragma mark 公共函数
  15. /**
  16. 视图加载完成函数
  17. */
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. [self loadNavStyle];
  21. [self initUI];
  22. }
  23. /**
  24. 修改:2017-9-25
  25. 适配机型
  26. 安全区视图发生变化
  27. */
  28. -(void)viewSafeAreaInsetsDidChange{
  29. _scrollView.frame = CGRectMake(0, 0,Screen_Width, self.view.safeAreaLayoutGuide.layoutFrame.size.height);
  30. [super viewSafeAreaInsetsDidChange];
  31. }
  32. /**
  33. 内存警告函数
  34. */
  35. - (void)didReceiveMemoryWarning {
  36. [super didReceiveMemoryWarning];
  37. }
  38. #pragma mark 私有函数
  39. /**
  40. 导航按钮样式
  41. */
  42. -(void)loadNavStyle
  43. {
  44. self.navigationItem.title=@"商品明细信息";
  45. //返回
  46. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  47. [button setBackgroundImage:[UIImage imageNamed:@"icon_back"]
  48. forState:UIControlStateNormal];
  49. [button addTarget:self action:@selector(goBack)
  50. forControlEvents:UIControlEventTouchUpInside];
  51. button.frame = CGRectMake(0, 0, 15, 18);
  52. UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
  53. self.navigationItem.leftBarButtonItem = menuButton;
  54. }
  55. /**
  56. 返回函数
  57. */
  58. - (void)goBack
  59. {
  60. [self.navigationController popViewControllerAnimated:YES];
  61. }
  62. /**
  63. 初始化UI
  64. */
  65. -(void)initUI{
  66. [self.view setBackgroundColor:[UIColor whiteColor]];
  67. CGFloat heightRow = 40;
  68. CGFloat lblx = 10;
  69. CGFloat lbly = 8;
  70. CGFloat lblwidth = 80;
  71. CGFloat lblheight = 25;
  72. CGFloat valuey = 8;
  73. CGFloat valueheight = 25;
  74. _scrollView=[UIScrollView new];
  75. _scrollView.frame=self.view.bounds;
  76. [self.view addSubview:_scrollView];
  77. UIView *vBody = [UIView new];
  78. [_scrollView addSubview:vBody];
  79. UIView *topSeparatorView= [UIView new];
  80. topSeparatorView.frame = CGRectMake(0, 0, Screen_Width, 10);
  81. topSeparatorView.backgroundColor=LineBackgroundColor;
  82. [vBody addSubview:topSeparatorView];
  83. //唯一编码
  84. UIView *vOnlyCode = [UIView new];
  85. vOnlyCode.frame=CGRectMake(0,CGRectGetMaxY(topSeparatorView.frame), Screen_Width, heightRow);
  86. [vBody addSubview:vOnlyCode];
  87. NSString *onlyCodeTitle=@"唯一编码:";
  88. UILabel *lblTitleOnlyCode=[UILabel new];
  89. lblTitleOnlyCode.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  90. lblTitleOnlyCode.textColor = [UIColor blackColor];
  91. lblTitleOnlyCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  92. [vOnlyCode addSubview:lblTitleOnlyCode];
  93. lblTitleOnlyCode.text=onlyCodeTitle;
  94. NSString *onlyCode= _goodsDetailModel.onlyCode;
  95. UILabel *lblOnlyCode = [UILabel new];
  96. lblOnlyCode.frame=CGRectMake(CGRectGetMaxX(lblTitleOnlyCode.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleOnlyCode.frame)-10, valueheight);
  97. lblOnlyCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  98. lblOnlyCode.text =onlyCode;
  99. [vOnlyCode addSubview:lblOnlyCode];
  100. //商品编码
  101. UIView *vGoodsCode = [UIView new];
  102. vGoodsCode.frame=CGRectMake(0,CGRectGetMaxY(vOnlyCode.frame), Screen_Width, heightRow);
  103. [vBody addSubview:vGoodsCode];
  104. NSString *goodsCodeTitle=@"商品编码:";
  105. UILabel *lblTitleGoodsCode=[UILabel new];
  106. lblTitleGoodsCode.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  107. lblTitleGoodsCode.textColor = [UIColor blackColor];
  108. lblTitleGoodsCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  109. [vGoodsCode addSubview:lblTitleGoodsCode];
  110. lblTitleGoodsCode.text=goodsCodeTitle;
  111. NSString *goodsCode= _goodsDetailModel.code;
  112. UILabel *lblGoodsCode = [UILabel new];
  113. lblGoodsCode.frame=CGRectMake(CGRectGetMaxX(lblTitleGoodsCode.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleGoodsCode.frame)-10, valueheight);
  114. lblGoodsCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  115. lblGoodsCode.text =goodsCode;
  116. [vGoodsCode addSubview:lblGoodsCode];
  117. //商品品牌
  118. UIView *vBrand = [UIView new];
  119. vBrand.frame=CGRectMake(0,CGRectGetMaxY(vGoodsCode.frame), Screen_Width, heightRow);
  120. [vBody addSubview:vBrand];
  121. NSString *brandNameTitle=@"商品品牌:";
  122. UILabel *lblTitleBrand=[UILabel new];
  123. lblTitleBrand.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  124. lblTitleBrand.textColor = [UIColor blackColor];
  125. lblTitleBrand.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  126. [vBrand addSubview:lblTitleBrand];
  127. lblTitleBrand.text=brandNameTitle;
  128. NSString *brandName= _goodsDetailModel.brandName;
  129. UILabel *lblBrand = [UILabel new];
  130. lblBrand.frame=CGRectMake(CGRectGetMaxX(lblTitleBrand.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleBrand.frame)-10, valueheight);
  131. lblBrand.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  132. lblBrand.text =brandName;
  133. [vBrand addSubview:lblBrand];
  134. //商品种类
  135. UIView *vKind = [UIView new];
  136. vKind.frame=CGRectMake(0,CGRectGetMaxY(vBrand.frame), Screen_Width, heightRow);
  137. [vBody addSubview:vKind];
  138. NSString *kindNameTitle=@"商品种类:";
  139. UILabel *lblTitleKind=[UILabel new];
  140. lblTitleKind.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  141. lblTitleKind.textColor = [UIColor blackColor];
  142. lblTitleKind.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  143. [vKind addSubview:lblTitleKind];
  144. lblTitleKind.text=kindNameTitle;
  145. NSString *kindName= _goodsDetailModel.kindName;
  146. UILabel *lblKind = [UILabel new];
  147. lblKind.frame=CGRectMake(CGRectGetMaxX(lblTitleKind.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleKind.frame)-10, valueheight);
  148. lblKind.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  149. lblKind.text =kindName;
  150. [vKind addSubview:lblKind];
  151. //商品品种
  152. UIView *vVariety = [UIView new];
  153. vVariety.frame=CGRectMake(0,CGRectGetMaxY(vKind.frame), Screen_Width, heightRow);
  154. [vBody addSubview:vVariety];
  155. NSString *varietyNameTitle=@"商品品种:";
  156. UILabel *lblTitleVariety=[UILabel new];
  157. lblTitleVariety.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  158. lblTitleVariety.textColor = [UIColor blackColor];
  159. lblTitleVariety.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  160. [vVariety addSubview:lblTitleVariety];
  161. lblTitleVariety.text=varietyNameTitle;
  162. NSString *varietyName= _goodsDetailModel.varietyName;
  163. UILabel *lblVariety = [UILabel new];
  164. lblVariety.frame=CGRectMake(CGRectGetMaxX(lblTitleVariety.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleVariety.frame)-10, valueheight);
  165. lblVariety.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  166. lblVariety.text =varietyName;
  167. [vVariety addSubview:lblVariety];
  168. //商品系列
  169. UIView *vSeries = [UIView new];
  170. vSeries.frame=CGRectMake(0,CGRectGetMaxY(vVariety.frame), Screen_Width, heightRow);
  171. [vBody addSubview:vSeries];
  172. NSString *seriesNameTitle=@"商品系列:";
  173. UILabel *lblTitleSeries=[UILabel new];
  174. lblTitleSeries.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  175. lblTitleSeries.textColor = [UIColor blackColor];
  176. lblTitleSeries.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  177. [vSeries addSubview:lblTitleSeries];
  178. lblTitleSeries.text=seriesNameTitle;
  179. NSString *seriesName= _goodsDetailModel.seriesName;
  180. UILabel *lblSeries = [UILabel new];
  181. lblSeries.frame=CGRectMake(CGRectGetMaxX(lblTitleSeries.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleSeries.frame)-10, valueheight);
  182. lblSeries.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  183. lblSeries.text =seriesName;
  184. [vSeries addSubview:lblSeries];
  185. //计量单位
  186. UIView *vUnit = [UIView new];
  187. vUnit.frame=CGRectMake(0,CGRectGetMaxY(vSeries.frame), Screen_Width, heightRow);
  188. [vBody addSubview:vUnit];
  189. NSString *unitTitle=@"计量单位:";
  190. UILabel *lblTitleUnit=[UILabel new];
  191. lblTitleUnit.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  192. lblTitleUnit.textColor = [UIColor blackColor];
  193. lblTitleUnit.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  194. [vUnit addSubview:lblTitleUnit];
  195. lblTitleUnit.text=unitTitle;
  196. NSString *unitName= _goodsDetailModel.unitName;
  197. UILabel *lblUnit = [UILabel new];
  198. lblUnit.frame=CGRectMake(CGRectGetMaxX(lblTitleUnit.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleUnit.frame)-10, valueheight);
  199. lblUnit.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  200. lblUnit.text =unitName;
  201. [vUnit addSubview:lblUnit];
  202. //商品规格
  203. UIView *vSpecification = [UIView new];
  204. vSpecification.frame=CGRectMake(0,CGRectGetMaxY(vUnit.frame), Screen_Width, heightRow);
  205. [vBody addSubview:vSpecification];
  206. NSString *specificationTitle=@"商品规格:";
  207. UILabel *lblTitleSpecification=[UILabel new];
  208. lblTitleSpecification.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  209. lblTitleSpecification.textColor = [UIColor blackColor];
  210. lblTitleSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  211. [vSpecification addSubview:lblTitleSpecification];
  212. lblTitleSpecification.text=specificationTitle;
  213. NSString *specification= _goodsDetailModel.specification;
  214. UILabel *lblSpecification = [UILabel new];
  215. lblSpecification.frame=CGRectMake(CGRectGetMaxX(lblTitleSpecification.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleSpecification.frame)-10, valueheight);
  216. lblSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  217. lblSpecification.text =specification;
  218. [vSpecification addSubview:lblSpecification];
  219. //商品等级
  220. UIView *vGrade = [UIView new];
  221. vGrade.frame=CGRectMake(0,CGRectGetMaxY(vSpecification.frame), Screen_Width, heightRow);
  222. [vBody addSubview:vGrade];
  223. NSString *gradeTitle=@"商品等级:";
  224. UILabel *lblTitleGrade=[UILabel new];
  225. lblTitleGrade.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  226. lblTitleGrade.textColor = [UIColor blackColor];
  227. lblTitleGrade.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  228. [vGrade addSubview:lblTitleGrade];
  229. lblTitleGrade.text=gradeTitle;
  230. NSString *gradeName= _goodsDetailModel.gradeName;
  231. UILabel *lblGrade = [UILabel new];
  232. lblGrade.frame=CGRectMake(CGRectGetMaxX(lblTitleGrade.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleGrade.frame)-10, valueheight);
  233. lblGrade.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  234. lblGrade.text =gradeName;
  235. [vGrade addSubview:lblGrade];
  236. //色号
  237. UIView *vColorNumber = [UIView new];
  238. vColorNumber.frame=CGRectMake(0,CGRectGetMaxY(vGrade.frame), Screen_Width, heightRow);
  239. [vBody addSubview:vColorNumber];
  240. NSString *colorNumberTitle=@"色 号:";
  241. UILabel *lblTitleColorNumber=[UILabel new];
  242. lblTitleColorNumber.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  243. lblTitleColorNumber.textColor = [UIColor blackColor];
  244. lblTitleColorNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  245. [vColorNumber addSubview:lblTitleColorNumber];
  246. lblTitleColorNumber.text=colorNumberTitle;
  247. NSString *colorNumber= _goodsDetailModel.colorNumber;
  248. UILabel *lblColorNumber = [UILabel new];
  249. lblColorNumber.frame=CGRectMake(CGRectGetMaxX(lblTitleColorNumber.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleColorNumber.frame)-10, valueheight);
  250. lblColorNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  251. lblColorNumber.text =colorNumber;
  252. [vColorNumber addSubview:lblColorNumber];
  253. //单位重量
  254. UIView *vWeight = [UIView new];
  255. vWeight.frame=CGRectMake(0,CGRectGetMaxY(vColorNumber.frame), Screen_Width, heightRow);
  256. [vBody addSubview:vWeight];
  257. NSString *weightTitle=@"单位重量:";
  258. UILabel *lblTitleWeight=[UILabel new];
  259. lblTitleWeight.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  260. lblTitleWeight.textColor = [UIColor blackColor];
  261. lblTitleWeight.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  262. [vWeight addSubview:lblTitleWeight];
  263. lblTitleWeight.text=weightTitle;
  264. NSString *weight= _goodsDetailModel.weight;
  265. UILabel *lblWeight = [UILabel new];
  266. lblWeight.frame=CGRectMake(CGRectGetMaxX(lblTitleWeight.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleWeight.frame)-10, valueheight);
  267. lblWeight.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  268. lblWeight.text =weight;
  269. [vWeight addSubview:lblWeight];
  270. //库区名称
  271. UIView *vWarehouseName = [UIView new];
  272. vWarehouseName.frame=CGRectMake(0,CGRectGetMaxY(vWeight.frame), Screen_Width, heightRow);
  273. [vBody addSubview:vWarehouseName];
  274. NSString *warehouseNameTitle=@"库区名称:";
  275. UILabel *lblTitleWarehouseName=[UILabel new];
  276. lblTitleWarehouseName.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  277. lblTitleWarehouseName.textColor = [UIColor blackColor];
  278. lblTitleWarehouseName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  279. [vWarehouseName addSubview:lblTitleWarehouseName];
  280. lblTitleWarehouseName.text=warehouseNameTitle;
  281. NSString *warehouseName= _goodsDetailModel.wareHouseName;
  282. UILabel *lblWarehouseName = [UILabel new];
  283. lblWarehouseName.frame=CGRectMake(CGRectGetMaxX(lblTitleWarehouseName.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleWarehouseName.frame)-10, valueheight);
  284. lblWarehouseName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  285. lblWarehouseName.text =warehouseName;
  286. [vWarehouseName addSubview:lblWarehouseName];
  287. //仓位号
  288. UIView *vPositionNumber = [UIView new];
  289. vPositionNumber.frame=CGRectMake(0,CGRectGetMaxY(vWarehouseName.frame), Screen_Width, heightRow);
  290. [vBody addSubview:vPositionNumber];
  291. NSString *positionNumberTitle=@"仓 位 号:";
  292. UILabel *lblTitlePositionNumber=[UILabel new];
  293. lblTitlePositionNumber.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  294. lblTitlePositionNumber.textColor = [UIColor blackColor];
  295. lblTitlePositionNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  296. [vPositionNumber addSubview:lblTitlePositionNumber];
  297. lblTitlePositionNumber.text=positionNumberTitle;
  298. NSString *positionNumber= _goodsDetailModel.positionNumber;
  299. UILabel *lblPositionNumber = [UILabel new];
  300. lblPositionNumber.frame=CGRectMake(CGRectGetMaxX(lblTitlePositionNumber.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitlePositionNumber.frame)-10, valueheight);
  301. lblPositionNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  302. lblPositionNumber.text =positionNumber;
  303. [vPositionNumber addSubview:lblPositionNumber];
  304. //出库数量
  305. UIView *vOutQuantity= [UIView new];
  306. vOutQuantity.frame=CGRectMake(0,CGRectGetMaxY(vPositionNumber.frame), Screen_Width, heightRow);
  307. [vBody addSubview:vOutQuantity];
  308. NSString *outQuantityTitle=@"出库数量:";
  309. UILabel *lblTitleOutQuantity=[UILabel new];
  310. lblTitleOutQuantity.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  311. lblTitleOutQuantity.textColor = [UIColor blackColor];
  312. lblTitleOutQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  313. [vOutQuantity addSubview:lblTitleOutQuantity];
  314. lblTitleOutQuantity.text=outQuantityTitle;
  315. NSString *outQuantity= _goodsDetailModel.outQuantity;
  316. UILabel *lblOutQuantity = [UILabel new];
  317. lblOutQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleOutQuantity.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleOutQuantity.frame)-10, valueheight);
  318. lblOutQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  319. lblOutQuantity.text =outQuantity;
  320. [vOutQuantity addSubview:lblOutQuantity];
  321. UIView *vCanSalesQuantity= [UIView new];
  322. vCanSalesQuantity.frame=CGRectMake(0,CGRectGetMaxY(vOutQuantity.frame), Screen_Width, heightRow);
  323. [vBody addSubview:vCanSalesQuantity];
  324. NSString *canSalesQuantityTitle=@"可售数量:";
  325. UILabel *lblTitleCanSalesQuantity=[UILabel new];
  326. lblTitleCanSalesQuantity.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  327. lblTitleCanSalesQuantity.textColor = [UIColor blackColor];
  328. lblTitleCanSalesQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  329. [vCanSalesQuantity addSubview:lblTitleCanSalesQuantity];
  330. lblTitleCanSalesQuantity.text=canSalesQuantityTitle;
  331. NSString *canSalesQuantity= _goodsDetailModel.canSaleQuantity;
  332. UILabel *lblCanSalesQuantity= [UILabel new];
  333. lblCanSalesQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleCanSalesQuantity.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleCanSalesQuantity.frame)-10, valueheight);
  334. lblCanSalesQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  335. lblCanSalesQuantity.text =canSalesQuantity;
  336. [vCanSalesQuantity addSubview:lblCanSalesQuantity];
  337. if(_goodsDetailModel.circulateType==1){
  338. if([_goodsDetailModel.package integerValue]>0){
  339. if([_goodsDetailModel.outQuantity doubleValue]>=0){
  340. _goodsDetailModel.box = [NSString stringWithFormat:@"%ld",(long)floor([_goodsDetailModel.outQuantity doubleValue]/[_goodsDetailModel.package integerValue])];
  341. }
  342. else{
  343. _goodsDetailModel.box=[NSString stringWithFormat:@"%ld",(long)ceil([_goodsDetailModel.outQuantity doubleValue]/[_goodsDetailModel.package integerValue])];
  344. }
  345. _goodsDetailModel.piece = [NSString stringWithFormat:@"%ld",(int)[_goodsDetailModel.outQuantity doubleValue]%[_goodsDetailModel.package integerValue]];
  346. }
  347. }
  348. else if(_goodsDetailModel.circulateType==2){
  349. if([_goodsDetailModel.package integerValue]>0&&_goodsDetailModel.acreage >0){
  350. long pieces=0;
  351. if([_goodsDetailModel.outQuantity doubleValue]>=0){
  352. pieces=ceil([_goodsDetailModel.outQuantity doubleValue]/_goodsDetailModel.acreage);
  353. _goodsDetailModel.box=[NSString stringWithFormat:@"%ld",(long)floor(pieces/[_goodsDetailModel.package integerValue])];
  354. }
  355. else{
  356. pieces=floor([_goodsDetailModel.outQuantity doubleValue]/_goodsDetailModel.acreage);
  357. _goodsDetailModel.box=[NSString stringWithFormat:@"%ld",(long)ceil(pieces/[_goodsDetailModel.package integerValue])];
  358. }
  359. _goodsDetailModel.piece=[NSString stringWithFormat:@"%ld",(int)pieces%[_goodsDetailModel.package integerValue]];
  360. }
  361. }
  362. else{
  363. _goodsDetailModel.box=@"0";
  364. _goodsDetailModel.piece=@"1";
  365. }
  366. double M2Value;
  367. if(_goodsDetailModel.circulateType==1){
  368. M2Value=_goodsDetailModel.acreage*[_goodsDetailModel.outQuantity doubleValue];
  369. _goodsDetailModel.outStorageAcreage=[NSString stringWithFormat:@"%.6f",M2Value];
  370. }
  371. else{
  372. _goodsDetailModel.outStorageAcreage=_goodsDetailModel.outQuantity;
  373. }
  374. UIView *vBox= [UIView new];
  375. vBox.frame=CGRectMake(0,CGRectGetMaxY(vCanSalesQuantity.frame), Screen_Width, heightRow);
  376. [vBody addSubview:vBox];
  377. NSString *boxTitle=@"箱:";
  378. UILabel *lblTitleBox=[UILabel new];
  379. lblTitleBox.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  380. lblTitleBox.textColor = [UIColor blackColor];
  381. lblTitleBox.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  382. [vBox addSubview:lblTitleBox];
  383. lblTitleBox.text=boxTitle;
  384. NSString *box=_goodsDetailModel.box;
  385. UILabel *lblBox= [UILabel new];
  386. lblBox.frame=CGRectMake(CGRectGetMaxX(lblTitleBox.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleBox.frame)-10, valueheight);
  387. lblBox.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  388. lblBox.text =box;
  389. [vBox addSubview:lblBox];
  390. //片
  391. UIView *vPiece= [UIView new];
  392. vPiece.frame=CGRectMake(0,CGRectGetMaxY(vBox.frame), Screen_Width, heightRow);
  393. [vBody addSubview:vPiece];
  394. NSString *pieceTitle=@"片/个:";
  395. UILabel *lblTitlePiece=[UILabel new];
  396. lblTitlePiece.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  397. lblTitlePiece.textColor = [UIColor blackColor];
  398. lblTitlePiece.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  399. [vPiece addSubview:lblTitlePiece];
  400. lblTitlePiece.text=pieceTitle;
  401. NSString *piece=_goodsDetailModel.piece;
  402. UILabel *lblPiece= [UILabel new];
  403. lblPiece.frame=CGRectMake(CGRectGetMaxX(lblTitlePiece.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitlePiece.frame)-10, valueheight);
  404. lblPiece.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  405. lblPiece.text =piece;
  406. [vPiece addSubview:lblPiece];
  407. //包装
  408. UIView *vPackage= [UIView new];
  409. vPackage.frame=CGRectMake(0,CGRectGetMaxY(vPiece.frame), Screen_Width, heightRow);
  410. [vBody addSubview:vPackage];
  411. NSString *packageTitle=@"包 装:";
  412. UILabel *lblTitlePackage=[UILabel new];
  413. lblTitlePackage.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  414. lblTitlePackage.textColor = [UIColor blackColor];
  415. lblTitlePackage.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  416. [vPackage addSubview:lblTitlePackage];
  417. lblTitlePackage.text=packageTitle;
  418. NSString *package=_goodsDetailModel.package;
  419. UILabel *lblPackage= [UILabel new];
  420. lblPackage.frame=CGRectMake(CGRectGetMaxX(lblTitlePackage.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitlePackage.frame)-10, valueheight);
  421. lblPackage.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  422. lblPackage.text =package;
  423. [vPackage addSubview:lblPackage];
  424. //单位面积
  425. UIView *vAcreage= [UIView new];
  426. vAcreage.frame=CGRectMake(0,CGRectGetMaxY(vPackage.frame), Screen_Width, heightRow);
  427. [vBody addSubview:vAcreage];
  428. NSString *acreageTitle=@"单位面积:";
  429. UILabel *lblTitleAcreage=[UILabel new];
  430. lblTitleAcreage.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  431. lblTitleAcreage.textColor = [UIColor blackColor];
  432. lblTitleAcreage.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  433. [vAcreage addSubview:lblTitleAcreage];
  434. lblTitleAcreage.text=acreageTitle;
  435. NSString *acreage=[NSString stringWithFormat:@"%lf", _goodsDetailModel.acreage];
  436. UILabel *lblAcreage= [UILabel new];
  437. lblAcreage.frame=CGRectMake(CGRectGetMaxX(lblTitleAcreage.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleAcreage.frame)-10, valueheight);
  438. lblAcreage.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  439. lblAcreage.text =acreage;
  440. [vAcreage addSubview:lblAcreage];
  441. //出库面积
  442. UIView *vOutStorageAcreage= [UIView new];
  443. vOutStorageAcreage.frame=CGRectMake(0,CGRectGetMaxY(vAcreage.frame), Screen_Width, heightRow);
  444. [vBody addSubview:vOutStorageAcreage];
  445. NSString *outStorageAcreageTitle=@"出库面积:";
  446. UILabel *lblTitleOutStorageAcreage=[UILabel new];
  447. lblTitleOutStorageAcreage.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  448. lblTitleOutStorageAcreage.textColor = [UIColor blackColor];
  449. lblTitleOutStorageAcreage.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  450. [vOutStorageAcreage addSubview:lblTitleOutStorageAcreage];
  451. lblTitleOutStorageAcreage.text=outStorageAcreageTitle;
  452. UILabel *lblOutStorageAcreage= [UILabel new];
  453. lblOutStorageAcreage.frame=CGRectMake(CGRectGetMaxX(lblTitleOutStorageAcreage.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleOutStorageAcreage.frame)-10, valueheight);
  454. lblOutStorageAcreage.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  455. lblOutStorageAcreage.text =_goodsDetailModel.outStorageAcreage;
  456. [vOutStorageAcreage addSubview:lblOutStorageAcreage];
  457. //商品名称
  458. UIView *vGoodsName= [UIView new];
  459. vGoodsName.frame=CGRectMake(0,CGRectGetMaxY(vOutStorageAcreage.frame), Screen_Width, heightRow);
  460. [vBody addSubview:vGoodsName];
  461. NSString *goodsNameTitle=@"商品名称:";
  462. UILabel *lblTitleGoodsName=[UILabel new];
  463. lblTitleGoodsName.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  464. lblTitleGoodsName.textColor = [UIColor blackColor];
  465. lblTitleGoodsName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  466. [vGoodsName addSubview:lblTitleGoodsName];
  467. lblTitleGoodsName.text=goodsNameTitle;
  468. NSString *goodsName= _goodsDetailModel.goodsName;
  469. UILabel *lblGoodsName= [UILabel new];
  470. lblGoodsName.frame=CGRectMake(CGRectGetMaxX(lblTitleGoodsName.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleGoodsName.frame)-10, valueheight);
  471. lblGoodsName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  472. lblGoodsName.text =goodsName;
  473. [vGoodsName addSubview:lblGoodsName];
  474. //扩展属性
  475. UIView *vExpandAtrribute= [UIView new];
  476. vExpandAtrribute.frame=CGRectMake(0,CGRectGetMaxY(vGoodsName.frame), Screen_Width, heightRow);
  477. [vBody addSubview:vExpandAtrribute];
  478. NSString *expandAtrributeTitle=@"扩展属性:";
  479. UILabel *lblTitleExpandAttribute=[UILabel new];
  480. lblTitleExpandAttribute.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  481. lblTitleExpandAttribute.textColor = [UIColor blackColor];
  482. lblTitleExpandAttribute.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  483. [vExpandAtrribute addSubview:lblTitleExpandAttribute];
  484. lblTitleExpandAttribute.text=expandAtrributeTitle;
  485. NSString *expandAtrribute=_goodsDetailModel.expandAtrribute;
  486. UILabel *lblExpandAtrribute= [UILabel new];
  487. lblExpandAtrribute.frame=CGRectMake(CGRectGetMaxX(lblTitleExpandAttribute.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleExpandAttribute.frame)-10, valueheight);
  488. lblExpandAtrribute.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  489. lblExpandAtrribute.text =expandAtrribute;
  490. [vExpandAtrribute addSubview:lblExpandAtrribute];
  491. //扩展属性2
  492. UIView *vExpandAtrribute2= [UIView new];
  493. vExpandAtrribute2.frame=CGRectMake(0,CGRectGetMaxY(vExpandAtrribute.frame), Screen_Width, heightRow);
  494. [vBody addSubview:vExpandAtrribute2];
  495. NSString *expandAtrributeTitle2=@"扩展属性二:";
  496. UILabel *lblTitleExpandAttribute2=[UILabel new];
  497. lblTitleExpandAttribute2.frame=CGRectMake(lblx, lbly, lblwidth+10, lblheight);
  498. lblTitleExpandAttribute2.textColor = [UIColor blackColor];
  499. lblTitleExpandAttribute2.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  500. [vExpandAtrribute2 addSubview:lblTitleExpandAttribute2];
  501. lblTitleExpandAttribute2.text=expandAtrributeTitle2;
  502. NSString *expandAtrribute2=_goodsDetailModel.expandAtrribute2;
  503. UILabel *lblExpandAtrribute2= [UILabel new];
  504. lblExpandAtrribute2.frame=CGRectMake(CGRectGetMaxX(lblTitleExpandAttribute2.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleExpandAttribute2.frame)-10, valueheight);
  505. lblExpandAtrribute2.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  506. lblExpandAtrribute2.text =expandAtrribute2;
  507. [vExpandAtrribute2 addSubview:lblExpandAtrribute2];
  508. //商品备注
  509. UIView *vCodeRemarks= [UIView new];
  510. vCodeRemarks.frame=CGRectMake(0,CGRectGetMaxY(vExpandAtrribute2.frame), Screen_Width, heightRow);
  511. [vBody addSubview:vCodeRemarks];
  512. NSString *codeRemarksTitle=@"商品备注:";
  513. UILabel *lblTitleCodeRemarks=[UILabel new];
  514. lblTitleCodeRemarks.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  515. lblTitleCodeRemarks.textColor = [UIColor blackColor];
  516. lblTitleCodeRemarks.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  517. [vCodeRemarks addSubview:lblTitleCodeRemarks];
  518. lblTitleCodeRemarks.text=codeRemarksTitle;
  519. NSString *codeRemarks=_goodsDetailModel.goodsRemarks;
  520. UILabel *lblCodeRemarks= [UILabel new];
  521. lblCodeRemarks.frame=CGRectMake(CGRectGetMaxX(lblTitleCodeRemarks.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleCodeRemarks.frame)-10, valueheight);
  522. lblCodeRemarks.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  523. lblCodeRemarks.text =codeRemarks;
  524. [vCodeRemarks addSubview:lblCodeRemarks];
  525. //备注
  526. UIView *vRemark= [UIView new];
  527. vRemark.frame=CGRectMake(0,CGRectGetMaxY(vCodeRemarks.frame), Screen_Width, heightRow);
  528. [vBody addSubview:vRemark];
  529. NSString *remarksTitle=@"备 注:";
  530. UILabel *lblTitleRemarks=[UILabel new];
  531. lblTitleRemarks.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  532. lblTitleRemarks.text=remarksTitle;
  533. lblTitleRemarks.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  534. [vRemark addSubview:lblTitleRemarks];
  535. NSString *remarks=_goodsDetailModel.remarks;
  536. UILabel *lblRemarks= [UILabel new];
  537. lblRemarks.frame=CGRectMake(CGRectGetMaxX(lblTitleRemarks.frame),valuey,Screen_Width-CGRectGetMaxX(lblTitleRemarks.frame)-10, valueheight);
  538. lblRemarks.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  539. lblRemarks.text =remarks;
  540. [vRemark addSubview:lblRemarks];
  541. vBody.frame=CGRectMake(0,0, Screen_Width,CGRectGetMaxY(vRemark.frame));
  542. _scrollView.contentSize = CGSizeMake(self.view.frame.size.width, CGRectGetMaxY(vBody.frame)+rectStatusHeight+rectNavHeight);
  543. }
  544. @end