|
@@ -506,10 +506,16 @@ public class BizOutsourcedOrderController extends BaseController {
|
|
|
}
|
|
|
} else {
|
|
|
codeValue = previous;
|
|
|
- int lastFourDigits = Integer.parseInt(codeValue.substring(5, 10));
|
|
|
- lastFourDigits += 1; // 加1
|
|
|
- codeValue = codeValue.substring(0, 5) + String.format("%05d", lastFourDigits);
|
|
|
- previous = codeValue;
|
|
|
+ String codeYear=codeValue.substring(4, 5);//取出当前外协单号年份
|
|
|
+ //如果年份一致表示是当前年的发出单,如果不一致则表示已经进入了新的一年则重置发出单号
|
|
|
+ if(codeYear.equals(formattedDate)){
|
|
|
+ int lastFourDigits = Integer.parseInt(codeValue.substring(5, 10));
|
|
|
+ lastFourDigits += 1; // 加1
|
|
|
+ codeValue = codeValue.substring(0, 5) + String.format("%05d", lastFourDigits);
|
|
|
+ previous = codeValue;
|
|
|
+ }else{
|
|
|
+ previous = ("WFD" + formattedDate + "00001");
|
|
|
+ }
|
|
|
}
|
|
|
//存到redis中
|
|
|
redisCache.setCacheObject(codeType, previous);
|
|
@@ -582,10 +588,16 @@ public class BizOutsourcedOrderController extends BaseController {
|
|
|
}
|
|
|
} else {
|
|
|
codeValue = previous;
|
|
|
- int lastFourDigits = Integer.parseInt(codeValue.substring(5, 10));
|
|
|
- lastFourDigits += 1; // 加1
|
|
|
- codeValue = codeValue.substring(0, 5) + String.format("%05d", lastFourDigits);
|
|
|
- previous = codeValue;
|
|
|
+ String codeYear=codeValue.substring(4, 5);//取出当前外协单号年份
|
|
|
+ //如果年份一致表示是当前年的发出单,如果不一致则表示已经进入了新的一年则重置发出单号
|
|
|
+ if(codeYear.equals(formattedDate)){
|
|
|
+ int lastFourDigits = Integer.parseInt(codeValue.substring(5, 10));
|
|
|
+ lastFourDigits += 1; // 加1
|
|
|
+ codeValue = codeValue.substring(0, 5) + String.format("%05d", lastFourDigits);
|
|
|
+ previous = codeValue;
|
|
|
+ }else{
|
|
|
+ previous = ("WFD" + formattedDate + "00001");
|
|
|
+ }
|
|
|
}
|
|
|
//存到redis中
|
|
|
redisCache.setCacheObject(codeType, previous);
|
|
@@ -1096,10 +1108,16 @@ public class BizOutsourcedOrderController extends BaseController {
|
|
|
}
|
|
|
} else {
|
|
|
codeValue = previous;
|
|
|
- int lastFourDigits = Integer.parseInt(codeValue.substring(5, 10));
|
|
|
- lastFourDigits += 1; // 加1
|
|
|
- codeValue = codeValue.substring(0, 5) + String.format("%05d", lastFourDigits);
|
|
|
- previous = codeValue;
|
|
|
+ String codeYear=codeValue.substring(4, 5);//取出当前外协单号年份
|
|
|
+ //如果年份一致表示是当前年的发出单,如果不一致则表示已经进入了新的一年则重置发出单号
|
|
|
+ if(codeYear.equals(formattedDate)){
|
|
|
+ int lastFourDigits = Integer.parseInt(codeValue.substring(5, 10));
|
|
|
+ lastFourDigits += 1; // 加1
|
|
|
+ codeValue = codeValue.substring(0, 5) + String.format("%05d", lastFourDigits);
|
|
|
+ previous = codeValue;
|
|
|
+ }else{
|
|
|
+ previous = ("WFD" + formattedDate + "00001");
|
|
|
+ }
|
|
|
}
|
|
|
//存到redis中
|
|
|
redisCache.setCacheObject(codeType, previous);
|
|
@@ -1392,10 +1410,16 @@ public class BizOutsourcedOrderController extends BaseController {
|
|
|
}
|
|
|
} else {
|
|
|
codeValue = previous;
|
|
|
- int lastFourDigits = Integer.parseInt(codeValue.substring(5, 10));
|
|
|
- lastFourDigits += 1; // 加1
|
|
|
- codeValue = codeValue.substring(0, 5) + String.format("%05d", lastFourDigits);
|
|
|
- previous = codeValue;
|
|
|
+ String codeYear=codeValue.substring(4, 5);//取出当前外协单号年份
|
|
|
+ //如果年份一致表示是当前年的发出单,如果不一致则表示已经进入了新的一年则重置发出单号
|
|
|
+ if(codeYear.equals(formattedDate)){
|
|
|
+ int lastFourDigits = Integer.parseInt(codeValue.substring(5, 10));
|
|
|
+ lastFourDigits += 1; // 加1
|
|
|
+ codeValue = codeValue.substring(0, 5) + String.format("%05d", lastFourDigits);
|
|
|
+ previous = codeValue;
|
|
|
+ }else{
|
|
|
+ previous = ("WFD" + formattedDate + "00001");
|
|
|
+ }
|
|
|
}
|
|
|
//存到redis中
|
|
|
redisCache.setCacheObject(codeType, previous);
|