优化
This commit is contained in:
@@ -342,7 +342,7 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
//当天产能是否有剩余
|
||||
double pcsn_num_day = 0;
|
||||
|
||||
JSONArray ja_day = new JSONArray();
|
||||
JSONArray ja_new2 = new JSONArray();
|
||||
for(int i=0;i<ja_new.size();i++){
|
||||
JSONObject jo = ja_new.getJSONObject(i);
|
||||
|
||||
@@ -400,7 +400,7 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = pcsn_num - pcsn_num_day;
|
||||
@@ -414,7 +414,7 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
pcsn_num_day = pcsn_num_day - pcsn_num;
|
||||
if(pcsn_num_day <= 0){
|
||||
@@ -436,8 +436,7 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
|
||||
ja_new2.add(this.createDay(jo));
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num =pcsn_num - totalproducecapacity_qty;
|
||||
fact_weight = fact_weight - totalproducecapacity_qty*standard_weight;
|
||||
@@ -450,8 +449,7 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
|
||||
ja_new2.add(this.createDay(jo));
|
||||
pcsn_num_day = totalproducecapacity_qty - pcsn_num;
|
||||
if(pcsn_num_day <= 0){
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
@@ -462,6 +460,64 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//根据工作日和结束日期相同的天数进行更新开始日期
|
||||
ja_new = new JSONArray();
|
||||
for (int i = 0; i < ja_new2.size(); i++) {
|
||||
JSONObject jo = ja_new2.getJSONObject(i);
|
||||
JSONObject jo_new = MPS_BD_ProductDailyPlan.query("dailyplan_id='"+jo.getString("dailyplan_id")+"' and status='01'").uniqueResult(0);
|
||||
if (jo_new!=null) {
|
||||
ja_new.add(jo);
|
||||
MPS_BD_ProductDailyPlan.delete(jo);
|
||||
}
|
||||
}
|
||||
HashMap<String,JSONObject> map = new HashMap<String,JSONObject>();
|
||||
for(int i=0;i<ja_new.size();i++){
|
||||
JSONObject jo = ja_new.getJSONObject(i);
|
||||
String planstart_date_old = jo.getString("planstart_date");
|
||||
String planstart_date = jo.getString("planstart_date");
|
||||
if(map.containsKey(planstart_date)){
|
||||
JSONObject other = map.get(planstart_date);
|
||||
jo.put("planstart_date",other.getString("planstart_date"));
|
||||
jo.put("planend_date",other.getString("planend_date"));
|
||||
MPS_BD_ProductDailyPlan.insert(jo);
|
||||
}else{
|
||||
boolean flag = true;
|
||||
while(flag){
|
||||
JSONObject last_day = WQL.getWO("QPDM_PRODUCTPLANPROC")
|
||||
.addParam("flag", "7")
|
||||
.addParam("planstart_date", planstart_date)
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
if(last_day ==null){
|
||||
throw new BadRequestException("未配置"+planstart_date+"后的工作日历!");
|
||||
}
|
||||
planstart_date = last_day.getString("factory_date");
|
||||
int days = this.getDays(jo.getString("material_id"));
|
||||
Date start_date = DateUtil.parse(planstart_date);
|
||||
Date planend_date = DateUtil.offsetDay(start_date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
JSONArray lasts = WQL.getWO("QPDM_PRODUCTPLANPROC")
|
||||
.addParam("flag", "8")
|
||||
.addParam("device_id", jo.getString("device_id"))
|
||||
.addParam("planend_date", jo.getString("planend_date"))
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
if(lasts.size()==0){
|
||||
jo.put("planstart_date",planstart_date);
|
||||
map.put(planstart_date_old,jo);
|
||||
MPS_BD_ProductDailyPlan.insert(jo);
|
||||
flag = false;
|
||||
}else{
|
||||
start_date = DateUtil.offsetDay(start_date,1);
|
||||
planstart_date = DateUtil.formatDate(start_date);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -478,7 +534,7 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createDay(JSONObject json) {
|
||||
public JSONObject createDay(JSONObject json) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
@@ -505,6 +561,7 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
|
||||
json.put("product_series", json.getString("product_series_id"));
|
||||
MPS_BD_ProductDailyPlan.insert(json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -420,6 +420,8 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
//当天产能是否有剩余
|
||||
double pcsn_num_day = 0;
|
||||
JSONObject jo_before = null;
|
||||
|
||||
JSONArray ja_new2 = new JSONArray();
|
||||
for(int i=0;i<rows.size();i++){
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
double fact_weight = jo.getDouble("fact_weight");
|
||||
@@ -470,7 +472,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = pcsn_num - pcsn_num_day;
|
||||
@@ -485,7 +487,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
pcsn_num_day = pcsn_num_day - pcsn_num;
|
||||
if(pcsn_num_day <= 0){
|
||||
@@ -507,7 +509,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = pcsn_num - totalproducecapacity_qty;
|
||||
@@ -522,7 +524,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
pcsn_num_day = totalproducecapacity_qty - pcsn_num;
|
||||
if(pcsn_num_day <= 0){
|
||||
@@ -577,7 +579,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = pcsn_num - pcsn_num_day;
|
||||
@@ -592,7 +594,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
pcsn_num_day = pcsn_num_day - pcsn_num;
|
||||
if(pcsn_num_day <= 0){
|
||||
@@ -615,7 +617,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num =pcsn_num - totalproducecapacity_qty;
|
||||
@@ -630,7 +632,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
pcsn_num_day = totalproducecapacity_qty - pcsn_num;
|
||||
if(pcsn_num_day <= 0){
|
||||
@@ -681,7 +683,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = pcsn_num - pcsn_num_day;
|
||||
@@ -696,7 +698,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
pcsn_num_day = pcsn_num_day - pcsn_num;
|
||||
if(pcsn_num_day <= 0){
|
||||
@@ -718,7 +720,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = pcsn_num - totalproducecapacity_qty;
|
||||
@@ -733,7 +735,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
this.createDay(jo);
|
||||
ja_new2.add(this.createDay(jo));
|
||||
|
||||
pcsn_num_day = totalproducecapacity_qty - pcsn_num;
|
||||
if(pcsn_num_day <= 0){
|
||||
@@ -746,6 +748,61 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONArray ja_new = new JSONArray();
|
||||
for (int i = 0; i < ja_new2.size(); i++) {
|
||||
JSONObject jo = ja_new2.getJSONObject(i);
|
||||
JSONObject jo_new = MPS_BD_ProductDailyPlan.query("dailyplan_id='"+jo.getString("dailyplan_id")+"' and status='01'").uniqueResult(0);
|
||||
if (jo_new!=null) {
|
||||
ja_new.add(jo);
|
||||
MPS_BD_ProductDailyPlan.delete(jo);
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<String,JSONObject> map = new HashMap<String,JSONObject>();
|
||||
for(int i=0;i<ja_new.size();i++){
|
||||
JSONObject jo = ja_new.getJSONObject(i);
|
||||
String planstart_date_old = jo.getString("planstart_date");
|
||||
String planstart_date = jo.getString("planstart_date");
|
||||
if(map.containsKey(planstart_date)){
|
||||
JSONObject other = map.get(planstart_date);
|
||||
jo.put("planstart_date",other.getString("planstart_date"));
|
||||
jo.put("planend_date",other.getString("planend_date"));
|
||||
MPS_BD_ProductDailyPlan.insert(jo);
|
||||
}else{
|
||||
boolean flag = true;
|
||||
while(flag){
|
||||
JSONObject last_day = WQL.getWO("QPDM_PRODUCTPLANPROC")
|
||||
.addParam("flag", "7")
|
||||
.addParam("planstart_date", planstart_date)
|
||||
.process()
|
||||
.uniqueResult(0);
|
||||
if(last_day ==null){
|
||||
throw new BadRequestException("未配置"+planstart_date+"后的工作日历!");
|
||||
}
|
||||
planstart_date = last_day.getString("factory_date");
|
||||
int days = this.getDays(jo.getString("material_id"));
|
||||
Date start_date = DateUtil.parse(planstart_date);
|
||||
Date planend_date = DateUtil.offsetDay(start_date,days-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planend_date));
|
||||
JSONArray lasts = WQL.getWO("QPDM_PRODUCTPLANPROC")
|
||||
.addParam("flag", "8")
|
||||
.addParam("device_id", jo.getString("device_id"))
|
||||
.addParam("planend_date", jo.getString("planend_date"))
|
||||
.process()
|
||||
.getResultJSONArray(0);
|
||||
if(lasts.size()==0){
|
||||
jo.put("planstart_date",planstart_date);
|
||||
map.put(planstart_date_old,jo);
|
||||
MPS_BD_ProductDailyPlan.insert(jo);
|
||||
flag = false;
|
||||
}else{
|
||||
start_date = DateUtil.offsetDay(start_date,1);
|
||||
planstart_date = DateUtil.formatDate(start_date);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
@@ -802,7 +859,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createDay(JSONObject json) {
|
||||
public JSONObject createDay(JSONObject json) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
@@ -830,5 +887,6 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
|
||||
json.put("product_series", json.getString("product_series_id"));
|
||||
MPS_BD_ProductDailyPlan.insert(json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
输入.device_id TYPEAS s_string
|
||||
输入.product_series TYPEAS s_string
|
||||
输入.planstart_date TYPEAS s_string
|
||||
输入.planend_date TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -228,4 +229,45 @@
|
||||
ENDIF
|
||||
|
||||
|
||||
IF 输入.flag = "7"
|
||||
QUERY
|
||||
SELECT
|
||||
FactoryCalendarDtl.factorycalendardtl_id,
|
||||
FactoryCalendarDtl.factory_date,
|
||||
FactoryCalendarDtl.work_type
|
||||
FROM
|
||||
PDM_BI_FactoryCalendarDtl FactoryCalendarDtl
|
||||
LEFT JOIN PDM_BI_FactoryCalendar FactoryCalendar ON FactoryCalendar.factorycalendar_id = FactoryCalendarDtl.factorycalendar_id
|
||||
WHERE
|
||||
1 = 1
|
||||
and FactoryCalendar.is_delete='0'
|
||||
and FactoryCalendar.is_active ='1'
|
||||
and FactoryCalendarDtl.work_type='00'
|
||||
OPTION 输入.planstart_date <> ""
|
||||
FactoryCalendarDtl.factory_date >= 输入.planstart_date
|
||||
ENDOPTION
|
||||
ORDER BY FactoryCalendarDtl.factory_date
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "8"
|
||||
QUERY
|
||||
SELECT
|
||||
ProductDailyPlan.planstart_date
|
||||
FROM
|
||||
MPS_BD_ProductDailyPlan ProductDailyPlan
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.device_id <> ""
|
||||
ProductDailyPlan.device_id = 输入.device_id
|
||||
ENDOPTION
|
||||
OPTION 输入.planend_date <> ""
|
||||
ProductDailyPlan.planend_date >= 输入.planend_date
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
append-to-body
|
||||
title="日计划重排"
|
||||
:visible.sync="dialogVisible"
|
||||
v-loading.fullscreen.lock="fullscreenLoading"
|
||||
destroy-on-close
|
||||
:show-close="false"
|
||||
fullscreen
|
||||
@@ -11,7 +12,22 @@
|
||||
>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="20" style="border: 1px solid white">
|
||||
<span />
|
||||
状态:<el-select
|
||||
v-model="queryrow.status"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="状态"
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
@change="MyQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.planstatus"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<span>
|
||||
@@ -82,7 +98,8 @@ export default {
|
||||
tableDtl: [],
|
||||
cxjList: [],
|
||||
XLList: [],
|
||||
queryrow: { device_id: '' },
|
||||
fullscreenLoading: false,
|
||||
queryrow: { device_id: '', status: '01' },
|
||||
sortable: null,
|
||||
rows: []
|
||||
}
|
||||
@@ -112,13 +129,18 @@ export default {
|
||||
*/
|
||||
getMsg(msg) {
|
||||
this.queryrow.device_id = msg
|
||||
this.queryrow.status = '01'
|
||||
},
|
||||
queryStruct() {
|
||||
this.fullscreenLoading = true
|
||||
dailyplan.query2(this.queryrow).then(res => {
|
||||
this.tableDtl = res
|
||||
this.$nextTick(() => {
|
||||
/*this.$nextTick(() => {
|
||||
this.setSort()
|
||||
})
|
||||
})*/
|
||||
this.fullscreenLoading = false
|
||||
}).catch(() => {
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
},
|
||||
setSort() {
|
||||
@@ -154,18 +176,31 @@ export default {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('StructIvtClosed', this.rows)
|
||||
},
|
||||
MyQuery(value) {
|
||||
this.queryrow.status = value
|
||||
this.fullscreenLoading = true
|
||||
dailyplan.query2(this.queryrow).then(res => {
|
||||
this.tableDtl = res
|
||||
/*this.$nextTick(() => {
|
||||
this.setSort()
|
||||
})*/
|
||||
this.fullscreenLoading = false
|
||||
}).catch(() => {
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
this.rows = this.$refs.dragTable.data
|
||||
if (this.rows.length === 0) {
|
||||
this.crud.notify('无可提交的记录!')
|
||||
/* if (this.rows.length === 0) {
|
||||
this.crud.notify('无可操作的记录!')
|
||||
return false
|
||||
}
|
||||
dailyplan.submit2({ query: this.queryrow, rows: this.rows }).then(res => {
|
||||
this.crud.notify('操作成功!')
|
||||
this.tableDtl = []
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('StructIvtClosed', this.rows)
|
||||
})
|
||||
})*/
|
||||
this.crud.notify('操作成功!')
|
||||
this.tableDtl = []
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('StructIvtClosed', this.rows)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user