Commit fd57a2e8b902f328e7f568f89b9f212df8c94d6d

Authored by wdn127929
1 parent dce1c2ae

存酒出库不能输入0

@@ -117,12 +117,13 @@ class _ApplyOutStoreItemPageState extends State<ApplyOutStoreItemPage> { @@ -117,12 +117,13 @@ class _ApplyOutStoreItemPageState extends State<ApplyOutStoreItemPage> {
117 // print(value); 117 // print(value);
118 if (value != null && value.trim().length > 0) { 118 if (value != null && value.trim().length > 0) {
119 bool isNumber = 119 bool isNumber =
120 - Utils.isInteger(value); //判断输入的内容是否是数字 120 + Utils.isIntegerS(value); //判断输入的内容是否是数字
121 if (!isNumber) { 121 if (!isNumber) {
122 Utils.showToast('请输入整数'); 122 Utils.showToast('请输入整数');
123 controller.text = ''; 123 controller.text = '';
124 return; 124 return;
125 } 125 }
  126 +
126 if (double.parse(value) > 127 if (double.parse(value) >
127 double.parse( 128 double.parse(
128 widget.wineManageSunModel.wineAmount)) { 129 widget.wineManageSunModel.wineAmount)) {
@@ -132,6 +133,8 @@ class _ApplyOutStoreItemPageState extends State<ApplyOutStoreItemPage> { @@ -132,6 +133,8 @@ class _ApplyOutStoreItemPageState extends State<ApplyOutStoreItemPage> {
132 } 133 }
133 widget.wineManageSunModel.checkAmount = value; 134 widget.wineManageSunModel.checkAmount = value;
134 // controller.text = value; 135 // controller.text = value;
  136 + } else {
  137 + widget.wineManageSunModel.checkAmount = '0';
135 } 138 }
136 139
137 // if (value.trim().isEmpty || value.trim().length > 11) { 140 // if (value.trim().isEmpty || value.trim().length > 11) {
@@ -107,9 +107,9 @@ class _ApplyOutStorePageState extends State<ApplyOutStorePage> { @@ -107,9 +107,9 @@ class _ApplyOutStorePageState extends State<ApplyOutStorePage> {
107 // break outerloop; 107 // break outerloop;
108 // } 108 // }
109 109
110 - if (element.checkAmount != null && 110 + if (element.checkAmount != null && element.checkAmount != '0'&&
111 element.checkAmount != '' && 111 element.checkAmount != '' &&
112 - int.parse(element.checkAmount) > 0) { 112 + int.parse(element.checkAmount ) > 0) {
113 //有输入数量 113 //有输入数量
114 WineCheckModel sunMoveModel = WineCheckModel(); 114 WineCheckModel sunMoveModel = WineCheckModel();
115 sunMoveModel.wineName = element.wineName; 115 sunMoveModel.wineName = element.wineName;
@@ -314,6 +314,8 @@ class _ApplyOutStorePageState extends State<ApplyOutStorePage> { @@ -314,6 +314,8 @@ class _ApplyOutStorePageState extends State<ApplyOutStorePage> {
314 itemBuilder: (context, index) { 314 itemBuilder: (context, index) {
315 WineManageSunMoveModel wineManageModel = 315 WineManageSunMoveModel wineManageModel =
316 widget.wineManageDetail.wineDataMove[index]; 316 widget.wineManageDetail.wineDataMove[index];
  317 +
  318 +
317 return ApplyOutStoreItemPage( 319 return ApplyOutStoreItemPage(
318 wineManageSunModel: wineManageModel, 320 wineManageSunModel: wineManageModel,
319 controller: _controller, 321 controller: _controller,
@@ -369,7 +371,7 @@ class _ApplyOutStorePageState extends State<ApplyOutStorePage> { @@ -369,7 +371,7 @@ class _ApplyOutStorePageState extends State<ApplyOutStorePage> {
369 // } 371 // }
370 372
371 if (element.wineNumC.text != null && 373 if (element.wineNumC.text != null &&
372 - element.wineNumC.text.trim().length > 0) { 374 + element.wineNumC.text.trim().length > 0 &&element.wineNumC.text != '0') {
373 //有一个输入数量即可提交出库申请 375 //有一个输入数量即可提交出库申请
374 can = true; 376 can = true;
375 break outerloop; 377 break outerloop;
@@ -226,7 +226,7 @@ class _SmsCodeInputPageState extends State<SmsCodeInputPage> { @@ -226,7 +226,7 @@ class _SmsCodeInputPageState extends State<SmsCodeInputPage> {
226 // break outerloop; 226 // break outerloop;
227 // } 227 // }
228 228
229 - if (element.checkAmount != null && 229 + if (element.checkAmount != null && element.checkAmount != '0'&&
230 element.checkAmount != '' && 230 element.checkAmount != '' &&
231 double.parse(element.checkAmount) > 0) { 231 double.parse(element.checkAmount) > 0) {
232 //有输入数量 232 //有输入数量
@@ -167,6 +167,13 @@ class Utils { @@ -167,6 +167,13 @@ class Utils {
167 return reg.hasMatch(str); 167 return reg.hasMatch(str);
168 } 168 }
169 169
  170 + // 验证是否为数字
  171 + static bool isIntegerS(String str) {
  172 + final reg = RegExp(r'^[0-9]\d*$');
  173 + print('$str 是否数字:${reg.hasMatch(str)}');
  174 + return reg.hasMatch(str);
  175 + }
  176 +
170 //请求参数按key按ASCII排序key1=value1&key2=value2&...&keyN=valueN 177 //请求参数按key按ASCII排序key1=value1&key2=value2&...&keyN=valueN
171 static String keySort(Map<String, String> oldParamsMap) { 178 static String keySort(Map<String, String> oldParamsMap) {
172 List attrKeys = oldParamsMap.keys.toList(); 179 List attrKeys = oldParamsMap.keys.toList();