Merge branch 'master' of http://121.40.234.130:8899/root/wuHanXinRui
This commit is contained in:
@@ -24,6 +24,8 @@ public interface GenCodeService {
|
||||
|
||||
public String codeDemo(Map form);
|
||||
|
||||
public String codeDemo2(Map form);
|
||||
|
||||
public String queryIdByCode(String code);
|
||||
|
||||
}
|
||||
|
||||
@@ -167,6 +167,81 @@ public class GenCodeServiceImpl implements GenCodeService {
|
||||
return demo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String codeDemo2(Map form) {
|
||||
String code = (String) form.get("code");
|
||||
String id = this.queryIdByCode(code);
|
||||
//如果flag=1就执行更新数据库的操作
|
||||
String flag = (String) form.get("flag");
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_code_rule_detail");
|
||||
JSONArray ja = wo.query("code_rule_id = '" + id + "'", " sort_num,type FOR UPDATE").getResultJSONArray(0);
|
||||
String demo = "";
|
||||
boolean is_same = true;
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
String value = "";
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
//固定直接取值
|
||||
if (jo.getString("type").equals("01")) {
|
||||
value = jo.getString("init_value");
|
||||
}
|
||||
//日期判断数据库的值与当前值是否相同来决定顺序的值
|
||||
if (jo.getString("type").equals("02")) {
|
||||
String current_value = jo.getString("current_value");
|
||||
Date date = DateUtil.date();
|
||||
String format = jo.getString("format");
|
||||
String now_date = DateUtil.format(date, format);
|
||||
if (!now_date.equals(current_value)) {
|
||||
is_same = false;
|
||||
}
|
||||
if (flag.equals("1")) {
|
||||
jo.put("init_value", now_date);
|
||||
jo.put("current_value", now_date);
|
||||
}
|
||||
value = now_date;
|
||||
}
|
||||
//顺序的值:如果日期一样就+步长,等于最大值就归为初始值;日期不一样就归为初始值
|
||||
if (jo.getString("type").equals("03")) {
|
||||
String num_value = "";
|
||||
int step = jo.getInteger("step");
|
||||
Long max_value = jo.getLong("max_value");
|
||||
if (!is_same || (jo.getLongValue("current_value") + step > max_value)) {
|
||||
num_value = jo.getString("init_value");
|
||||
} else {
|
||||
num_value = (jo.getInteger("current_value") + step) + "";
|
||||
}
|
||||
int size = num_value.length();
|
||||
int length = jo.getInteger("length");
|
||||
String fillchar = jo.getString("fillchar");
|
||||
for (int m = 0; m < (length - size); m++) {
|
||||
value += fillchar;
|
||||
}
|
||||
value += num_value;
|
||||
if (flag.equals("1")) {
|
||||
if (!is_same) {
|
||||
int init_value = jo.getInteger("init_value");
|
||||
if (StrUtil.isEmpty((init_value + ""))) {
|
||||
throw new BadRequestException("请完善编码数值的初始值!");
|
||||
}
|
||||
jo.put("current_value", init_value + "");
|
||||
} else {
|
||||
int num_curr = jo.getInteger("current_value");
|
||||
if (num_curr >= max_value) {
|
||||
num_curr = jo.getInteger("init_value");
|
||||
jo.put("current_value", num_curr + "");
|
||||
}else{
|
||||
jo.put("current_value", (num_curr + step) + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
demo += value;
|
||||
if (flag.equals("1")) {
|
||||
wo.update(jo);
|
||||
}
|
||||
}
|
||||
return demo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryIdByCode(String code) {
|
||||
JSONObject jo = WQLObject.getWQLObject("sys_code_rule").query("code = '" + code + "'").uniqueResult(0);
|
||||
|
||||
@@ -16,4 +16,13 @@ public class CodeUtil {
|
||||
return service.codeDemo(map);
|
||||
}
|
||||
|
||||
public static synchronized String getNewCode2(String ruleCode){
|
||||
GenCodeService service=new GenCodeServiceImpl();
|
||||
String flag = "1";
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("flag",flag);
|
||||
map.put("code",ruleCode);
|
||||
return service.codeDemo2(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -91,7 +91,11 @@ public class BucketrecordServiceImpl implements BucketrecordService {
|
||||
String storagevehicle_code2 = jo.getString("storagevehicle_code");
|
||||
if(ObjectUtil.isNotEmpty(storagevehicle_code2)){
|
||||
JSONObject base_point = sch_base_point.query("vehicle_code='"+storagevehicle_code2+"'").uniqueResult(0);
|
||||
jo.put("point_code",base_point.getString("point_code"));
|
||||
if(base_point!=null){
|
||||
jo.put("point_code",base_point.getString("point_code"));
|
||||
}else{
|
||||
jo.put("point_code","");
|
||||
}
|
||||
}else{
|
||||
jo.put("point_code","");
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
|
||||
// 插入主表
|
||||
json.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("workordercard_id",json.getString("workorder_id"));
|
||||
String workorder_code = CodeUtil.getNewCode("GL_CODE");
|
||||
String workorder_code = CodeUtil.getNewCode2("GL_CODE");
|
||||
json.put("workorder_code", workorder_code);
|
||||
json.put("is_delete", "0");
|
||||
json.put("create_id", currentUserId);
|
||||
|
||||
@@ -307,7 +307,7 @@ public class InitformulaServiceImpl implements InitformulaService {
|
||||
JSONArray tableDtl = whereJson.getJSONArray("tableDtl");
|
||||
JSONObject Formula_01 = new JSONObject();
|
||||
long formula_id = IdUtil.getSnowflake(1, 1).nextId();
|
||||
String formula_code = CodeUtil.getNewCode("PF_CODE");
|
||||
String formula_code = CodeUtil.getNewCode2("PF_CODE");
|
||||
Formula_01.put("formula_id",formula_id);
|
||||
Formula_01.put("formula_code",formula_code);
|
||||
Formula_01.put("workorder_id",order.getString("workorder_id"));
|
||||
@@ -427,7 +427,7 @@ public class InitformulaServiceImpl implements InitformulaService {
|
||||
if("1".equals(whereJson.getString("is_again_put")) && tabledis.size()>0){
|
||||
JSONObject Formula_02 = new JSONObject();
|
||||
long formula_id2 = IdUtil.getSnowflake(1, 1).nextId();
|
||||
String formula_code2 = CodeUtil.getNewCode("PF_CODE");
|
||||
String formula_code2 = CodeUtil.getNewCode2("PF_CODE");
|
||||
Formula_02.put("formula_id",formula_id2);
|
||||
Formula_02.put("formula_code",formula_code2);
|
||||
Formula_02.put("workorder_id",order.getString("workorder_id"));
|
||||
@@ -609,7 +609,7 @@ public class InitformulaServiceImpl implements InitformulaService {
|
||||
JSONArray tableDtl = whereJson.getJSONArray("tableDtl");
|
||||
JSONObject Formula_01 = new JSONObject();
|
||||
long formula_id = IdUtil.getSnowflake(1, 1).nextId();
|
||||
String formula_code = CodeUtil.getNewCode("PF_CODE");
|
||||
String formula_code = CodeUtil.getNewCode2("PF_CODE");
|
||||
Formula_01.put("formula_id",formula_id);
|
||||
Formula_01.put("formula_code",formula_code);
|
||||
Formula_01.put("workorder_id",order.getString("workorder_id"));
|
||||
@@ -729,7 +729,7 @@ public class InitformulaServiceImpl implements InitformulaService {
|
||||
if("1".equals(whereJson.getString("is_again_put")) && tabledis.size()>0){
|
||||
JSONObject Formula_02 = new JSONObject();
|
||||
long formula_id2 = IdUtil.getSnowflake(1, 1).nextId();
|
||||
String formula_code2 = CodeUtil.getNewCode("PF_CODE");
|
||||
String formula_code2 = CodeUtil.getNewCode2("PF_CODE");
|
||||
Formula_02.put("formula_id",formula_id2);
|
||||
Formula_02.put("formula_code",formula_code2);
|
||||
Formula_02.put("workorder_id",order.getString("workorder_id"));
|
||||
|
||||
@@ -274,6 +274,7 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ
|
||||
JSONObject jsonMainMst = mainMstTab.query("maint_id = '" + whereJson.getString("maint_id") + "'").uniqueResult(0);
|
||||
jsonMainMst.put("invstatus", "03");
|
||||
jsonMainMst.put("update_optname",whereJson.getString("update_optname") );
|
||||
jsonMainMst.put("update_optname",whereJson.getString("update_optname") );
|
||||
jsonMainMst.put("real_start_date", DateUtil.now());
|
||||
mainMstTab.update(jsonMainMst);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user