This commit is contained in:
zds
2022-09-21 16:02:05 +08:00
parent 1dd8ba896e
commit a222eb695d
3 changed files with 40 additions and 7 deletions

View File

@@ -215,6 +215,7 @@ public class DailyplanServiceImpl implements DailyplanService {
if(jret.size()>0){
JSONObject form = new JSONObject();
form.put("rows",jret);
form.put("query",whereJson);
this.submit2(form);
}
jret = WQL.getWO("QPDM_PRODUCTDAILYPLAN")
@@ -437,12 +438,16 @@ public class DailyplanServiceImpl implements DailyplanService {
}
String captemplate_id = captemplate.getString("id");
JSONArray ja = form.getJSONArray("rows");
JSONObject query = form.getJSONObject("query");
String checked = query.getString("checked");
if (StrUtil.isEmpty(checked)) {
checked = "false";
}
JSONObject last = MPS_BD_ProductDailyPlan.query("device_id='"+ja.getJSONObject(0).getString("device_id")+"' and status='01'","planstart_date").uniqueResult(0);
if(last ==null ){
throw new BadRequestException("日计划表此分组设备的最早一个日计划为空,没有可重排数据!");
}
JSONArray ja_new = new JSONArray();
for (int i = 0; i < ja.size(); i++) {
JSONObject jo = ja.getJSONObject(i);
@@ -452,8 +457,21 @@ public class DailyplanServiceImpl implements DailyplanService {
MPS_BD_ProductDailyPlan.delete(jo);
}
}
String nowstart_date = last.getString("planstart_date");
Date date = DateUtil.parse(nowstart_date);
if(checked.equals("true")){
if (StrUtil.isNotEmpty(query.getString("nowstart_date"))) {
String nowstart_date2 = query.getString("nowstart_date").substring(0,10);
Date date2 = DateUtil.parse(nowstart_date2);
//指定日期小于最晚的日计划日期
if(date2.getTime() >= date.getTime()){
nowstart_date = nowstart_date2;
date = date2;
}
}
}
//当天产能是否有剩余
double pcsn_num_day = 0;
@@ -474,7 +492,7 @@ public class DailyplanServiceImpl implements DailyplanService {
int totalproducecapacity_qty = series.getInteger("totalproducecapacity_qty");
//第一条查数据库
if(StrUtil.isNotEmpty(nowstart_date)){
JSONObject last2 = MPS_BD_ProductDailyPlan.query("device_id='"+jo.getString("device_id")+"'","planstart_date desc,create_time desc").uniqueResult(0);
JSONObject last2 = MPS_BD_ProductDailyPlan.query("device_id='"+jo.getString("device_id")+"' and planstart_date>='"+nowstart_date+"'","planstart_date desc,create_time desc").uniqueResult(0);
String standard_mark = jo.getString("standard_mark");
if(last2 != null ){
nowstart_date = last2.getString("planstart_date");