This commit is contained in:
2022-08-05 08:59:42 +08:00
9 changed files with 109 additions and 12 deletions

View File

@@ -62,7 +62,7 @@ public class WmsToLkServiceImpl implements WmsToLkService {
JSONObject jsonUser = WQLObject.getWQLObject("sys_user").query("user_id = '" + currentUserId + "'").uniqueResult(0);
jsonParam.put("pallet_code", json.getString("pallet_code"));
jsonParam.put("inputtime", now);
jsonParam.put("iostorinv_uuid", json.getString("pallet_code") + "-" + now);
jsonParam.put("iostorinv_uuid", json.getString("pallet_code") + "-" + now.replaceAll("[[\\s-:punct:]]", ""));
jsonParam.put("create_ext_id", jsonUser.getString("ext_id"));
jsonParam.put("create_id", currentUserId);
jsonParam.put("create_name", SecurityUtils.getNickName());
@@ -150,6 +150,8 @@ public class WmsToLkServiceImpl implements WmsToLkService {
jsonParam.put("invtype", json.getString("invtype"));
jsonParam.put("agvaddr", json.getString("agvaddr"));// AGV站点
jsonParam.put("remark", json.getString("remark"));
jsonParam.put("iostorinv_uuid", json.getString("iostorinv_uuid"));
JSONArray dataArr = new JSONArray();
for (int i = 0; i < jsonArray.size(); i++) {

View File

@@ -2,6 +2,7 @@
package org.nl.wms.lk.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import lombok.RequiredArgsConstructor;
@@ -56,6 +57,7 @@ public class LibraryqueryServiceImpl implements LibraryqueryService {
@Override
@Transactional(rollbackFor = Exception.class)
public void outLk(JSONObject json) {
String now = DateUtil.now();
JSONObject data = json.getJSONObject("data");
String agvaddr = json.getString("agvaddr");
String pallet_code = data.getString("pallet_code");
@@ -64,6 +66,8 @@ public class LibraryqueryServiceImpl implements LibraryqueryService {
jsonParam.put("invtype", "2"); // 暂时没有
jsonParam.put("agvaddr", agvaddr);
jsonParam.put("remark", "");
jsonParam.put("iostorinv_uuid", pallet_code + "-" + now.replaceAll("[[\\s-:punct:]]", ""));
JSONArray jsonDataArr = new JSONArray();
JSONArray resultJSONArray = WQL.getWO("QLK01").addParam("flag", "2").addParam("pallet_code",pallet_code).setDbname("dataSource2").process().getResultJSONArray(0);
for (int i = 0; i < resultJSONArray.size(); i++) {

View File

@@ -62,7 +62,7 @@ public class DailyplanServiceImpl implements DailyplanService {
map.put("material_code", "%" + material_code + "%");
}
map.put("flag", "1");
JSONObject jret = WQL.getWO("QPDM_PRODUCTDAILYPLAN").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "pp.planstart_date");
JSONObject jret = WQL.getWO("QPDM_PRODUCTDAILYPLAN").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "pp.planstart_date,pp.plan_code");
JSONArray json = jret.getJSONArray("content");
JSONArray ja = new JSONArray();
for(int i=0;i<json.size();i++){

View File

@@ -337,6 +337,8 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
device_map.put(device_id,rows);
}
}
//已预排月计划
HashMap<String,JSONObject> have_map = new HashMap<String,JSONObject>();
//排序
HashMap<String,JSONArray> device_map2 = new HashMap<String,JSONArray>();
device_map.forEach((key,rows)->{
@@ -375,7 +377,34 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
}
});
rows = JSONArray.parseArray(JSON.toJSONString(list));
device_map2.put(key,rows);
JSONArray new_rows = new JSONArray();
for(int i=0;i<rows.size();i++){
JSONObject jo = rows.getJSONObject(i);
String before_date = jo.getString("plan_finish_date");
Date date = DateUtil.parse(before_date);
date = DateUtil.offsetDay(date,6);
long before_time = date.getTime();
if(i==0 || !have_map.containsKey(jo.getString("task_code"))){
have_map.put(jo.getString("task_code"),jo);
new_rows.add(jo);
for(int j=0;j<rows.size();j++){
JSONObject jo_j = rows.getJSONObject(j);
if(have_map.containsKey(jo_j.getString("task_code"))){
continue;
}else{
String material_id = jo_j.getString("material_id");
String plan_finish_date = jo_j.getString("plan_finish_date");
Date finish_date = DateUtil.parse(plan_finish_date);
long finish_time = finish_date.getTime();
if(jo.getString("material_id").equals(material_id) && finish_time<=before_time){
new_rows.add(jo_j);
have_map.put(jo_j.getString("task_code"),jo_j);
}
}
}
}
}
device_map2.put(key,new_rows);
});
String finalChecked = checked;
@@ -389,9 +418,9 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
}
//当天产能是否有剩余
double pcsn_num_day = 0;
JSONObject jo_before = null;
for(int i=0;i<rows.size();i++){
JSONObject jo = rows.getJSONObject(i);
double fact_weight = jo.getDouble("fact_weight");
double standard_weight = jo.getDouble("standard_weight");
@@ -405,6 +434,29 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
int totalproducecapacity_qty = series.getInteger("totalproducecapacity_qty");
//若初始日期不为空,取此初始日期
if(finalChecked.equals("true")){
JSONObject last = jo_before;
if(last!=null && jo.getString("old_mark").equals(last.getString("old_mark"))) {
JSONObject total_last = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "6")
.addParam("device_id", jo.getString("device_id"))
.addParam("planstart_date", last.getString("planstart_date"))
.process()
.uniqueResult(0);
pcsn_num_day = totalproducecapacity_qty - total_last.getInteger("total_product_num");
nowstart_date = last.getString("planstart_date");
date = DateUtil.parse(nowstart_date);
if (pcsn_num_day <= 0) {
date = DateUtil.offsetDay(date, 1);
}
}else{
if(last!=null){
nowstart_date = last.getString("planstart_date");
date = DateUtil.parse(nowstart_date);
date = DateUtil.offsetDay(date,1);
pcsn_num_day = 0;
}
}
while(pcsn_num > 0){
JSONObject ProcessRoute = WQL.getWO("QPDM_PRODUCTPLANPROC").addParam("flag","5")
.addParam("material_code",jo.getString("material_id")).process().uniqueResult(0);
@@ -485,6 +537,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
fact_weight = 0;
}
}
jo_before = jo;
}else{//若初始日期为空,获取日计划表设备标识=此分组设备的最后一个计划
//第一条查数据库
@@ -599,6 +652,33 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
}
}
}else{
JSONObject last = MPS_BD_ProductDailyPlan.query("device_id='"+jo.getString("device_id")+"'","planstart_date desc,create_time desc").uniqueResult(0);
if(last ==null ){
throw new BadRequestException("日计划表此分组设备的最后一个计划为空!");
}
JSONObject mater = MD_ME_ProducMaterialExt.query("material_id='"+last.getString("material_id")+"'").uniqueResult(0);
String old_mark = mater.getString("old_mark");
if(jo.getString("old_mark").equals(old_mark)) {
JSONObject total_last = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "6")
.addParam("device_id", jo.getString("device_id"))
.addParam("planstart_date", last.getString("planstart_date"))
.process()
.uniqueResult(0);
pcsn_num_day = totalproducecapacity_qty - total_last.getInteger("total_product_num");
nowstart_date = last.getString("planstart_date");
date = DateUtil.parse(nowstart_date);
if (pcsn_num_day <= 0) {
date = DateUtil.offsetDay(date, 1);
}
}else{
nowstart_date = last.getString("planstart_date");
date = DateUtil.parse(nowstart_date);
date = DateUtil.offsetDay(date,1);
pcsn_num_day = 0;
}
while(pcsn_num > 0){
JSONObject ProcessRoute = WQL.getWO("QPDM_PRODUCTPLANPROC").addParam("flag","5")
.addParam("material_code",jo.getString("material_id")).process().uniqueResult(0);

View File

@@ -140,7 +140,7 @@
OPTION 输入.device_id <> ""
pp.device_id = 输入.device_id
ENDOPTION
order by pp.planstart_date
order by pp.planstart_date,pp.plan_code
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -15,7 +15,7 @@
</el-col>
<el-col :span="4">
<span>
<!--左侧插槽-->
<!--左侧插槽-->
<slot name="left" />
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
<el-button slot="left" type="primary" @click="submit">保存</el-button>
@@ -26,6 +26,7 @@
<el-table
ref="dragTable"
:data="tableDtl"
row-key="dailyplan_id"
style="width: 100%;"
border
:highlight-current-row="true"
@@ -38,7 +39,7 @@
<el-table-column prop="planstart_date" label="计划开始日期" width="100" />
<el-table-column prop="plan_org_name" label="申报单位" width="100" />
<el-table-column prop="workorder_type" label="计划类型" :formatter="workorder_typeFormat" min-width="120" />
<el-table-column prop="material_code" label="物料编码" min-width="150"/>
<el-table-column prop="material_code" label="物料编码" min-width="150" />
<el-table-column prop="old_mark" label="牌号" />
<el-table-column :formatter="seriesFormat" min-width="80" prop="mater_product_series" label="产品系列" />
<el-table-column prop="product_weight" label="生产重量(kg)" :formatter="crud.formatNum3" min-width="120" />
@@ -46,10 +47,10 @@
<el-table-column prop="planend_date" label="计划结束日期" width="100" />
<el-table-column prop="plan_finish_date" label="交货日期" width="100" />
<el-table-column prop="day_num" label="提前天数" width="90" :formatter="crud.formatNum0" />
<el-table-column :formatter="stateFormat" min-width="80" prop="status" label="状态" />
<el-table-column :formatter="stateFormat" min-width="80" prop="status" label="状态" />
<el-table-column prop="task_code" label="生产任务号" width="120" />
<el-table-column prop="create_time" label="创建时间" width="140px" />
<el-table-column prop="create_name" label="创建人" width="100" />
<el-table-column prop="create_name" label="创建人" width="100" />
<el-table-column prop="remark" label="备注" />
</el-table>
</el-dialog>
@@ -81,7 +82,7 @@ export default {
tableDtl: [],
cxjList: [],
XLList: [],
queryrow: { device_id:'' },
queryrow: { device_id: '' },
sortable: null,
rows: []
}
@@ -159,7 +160,7 @@ export default {
this.crud.notify('无可提交的记录!')
return false
}
dailyplan.submit2({ query: this.queryrow, rows: this.rows}).then(res => {
dailyplan.submit2({ query: this.queryrow, rows: this.rows }).then(res => {
this.crud.notify('操作成功!')
this.tableDtl = []
this.$emit('update:dialogShow', false)

View File

@@ -327,9 +327,12 @@ export default {
this.crud.notify('请勾选需要操作的记录!')
return false
}
this.crud.loading = true
dailyplan.submit({ query: this.crud.query, rows: this.checkrows }).then(res => {
this.crud.notify('操作成功!')
this.querytable()
}).catch(() => {
this.crud.loading = false
})
},
querytable() {

View File

@@ -303,8 +303,9 @@ export default {
this.crud.notify('操作成功!')
this.crud.loading = false
this.querytable()
}).catch(() => {
this.crud.loading = false
})
this.crud.loading = false
},
querytable() {
this.crud.toQuery()

View File

@@ -363,9 +363,12 @@ export default {
this.crud.notify('无可操作的记录!')
return false
}
this.crud.loading = true
crudProducetask.submit({'status': '0', rows: this.checkrows}).then(res => {
this.crud.notify('操作成功!')
this.querytable()
}).catch(() => {
this.crud.loading = false
})
},
save() {
@@ -374,9 +377,12 @@ export default {
this.crud.notify('请勾选需要提交的记录!')
return false
}
this.crud.loading = true
crudProducetask.submit({'status': '1', rows: this.checkrows}).then(res => {
this.crud.notify('操作成功!')
this.querytable()
}).catch(() => {
this.crud.loading = false
})
},
querytable() {