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