|
|
@@ -969,41 +969,54 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 设置交期的信息
|
|
|
+ * 获取交期信息
|
|
|
+ * @param delivery
|
|
|
+ * @return
|
|
|
*/
|
|
|
- private void setDeliveryTime(ReleaseProductByBatch releaseProductByBatch, Object minDelivery, Object maxDelivery) {
|
|
|
- minDelivery = minDelivery == null ? maxDelivery : minDelivery;
|
|
|
- maxDelivery = maxDelivery == null ? minDelivery : maxDelivery;
|
|
|
+ private Short getDeliveryTime(Object delivery) {
|
|
|
+ if (delivery == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
Pattern intMinP = Pattern.compile(RegexConstant.Integer);
|
|
|
- Matcher intMinM = intMinP.matcher(minDelivery.toString());
|
|
|
- Short min = null, max = null;
|
|
|
+ Matcher intMinM = intMinP.matcher(delivery.toString());
|
|
|
+ Short result = null;
|
|
|
if (intMinM.find()) {
|
|
|
String g = intMinM.group();
|
|
|
- min = Short.valueOf(g);
|
|
|
- }
|
|
|
- Pattern intMaxP = Pattern.compile(RegexConstant.Integer);
|
|
|
- Matcher intMaxM = intMaxP.matcher(maxDelivery.toString());
|
|
|
- if (intMaxM.find()) {
|
|
|
- String g = intMaxM.group();
|
|
|
- max = Short.valueOf(g);
|
|
|
+ result = Short.valueOf(g);
|
|
|
}
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置交期的信息
|
|
|
+ */
|
|
|
+ private void setDeliveryTime(ReleaseProductByBatch releaseProductByBatch, Object minDelivery, Object maxDelivery) {
|
|
|
+ minDelivery = minDelivery == null ? maxDelivery : minDelivery;
|
|
|
+ maxDelivery = maxDelivery == null ? minDelivery : maxDelivery;
|
|
|
+ Short min = getDeliveryTime(minDelivery);
|
|
|
+ Short max = getDeliveryTime(maxDelivery);
|
|
|
if ((min != null) || (max != null)) {
|
|
|
min = min == null ? max : min;
|
|
|
max = max == null ? min : max;
|
|
|
- if (min > ShortConstant.maxDelivery || min < ShortConstant.minDelivery
|
|
|
- || max > ShortConstant.maxDelivery || max < ShortConstant.minDelivery) {
|
|
|
- releaseProductByBatch.addErrmsg(ErrorInfoConstant.DELIVERY_VALUE_INFO.getInfo());
|
|
|
- } else {
|
|
|
- if (min > max) {
|
|
|
- Short delivery = max;
|
|
|
- max = min;
|
|
|
- min = delivery;
|
|
|
- }
|
|
|
- releaseProductByBatch.setSelfMinDelivery(min);
|
|
|
- releaseProductByBatch.setSelfMaxDelivery(max);
|
|
|
+ if (min > ShortConstant.maxDelivery) {
|
|
|
+ min = ShortConstant.maxDelivery;
|
|
|
}
|
|
|
- } else {
|
|
|
- releaseProductByBatch.addErrmsg(ErrorInfoConstant.DELIVERY_VALUE_INFO.getInfo());
|
|
|
+ if (max > ShortConstant.maxDelivery) {
|
|
|
+ max = ShortConstant.maxDelivery;
|
|
|
+ }
|
|
|
+ if (min < ShortConstant.minDelivery) {
|
|
|
+ min = ShortConstant.minDelivery;
|
|
|
+ }
|
|
|
+ if (max < ShortConstant.minDelivery) {
|
|
|
+ max = ShortConstant.minDelivery;
|
|
|
+ }
|
|
|
+ if (min > max) {
|
|
|
+ Short delivery = max;
|
|
|
+ max = min;
|
|
|
+ min = delivery;
|
|
|
+ }
|
|
|
+ releaseProductByBatch.setSelfMinDelivery(min);
|
|
|
+ releaseProductByBatch.setSelfMaxDelivery(max);
|
|
|
}
|
|
|
}
|
|
|
|