This commit is contained in:
2022-12-10 10:49:38 +08:00
parent 2653259bf3
commit c8cb2bfabc
16 changed files with 256 additions and 226 deletions

View File

@@ -19,7 +19,6 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -150,28 +149,82 @@ public class LocalStorageServiceImpl implements LocalStorageService {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
List<Map<String, Object>> listMap = EasyExcel.read(path).sheet(0).doReadSync();
// listMap.remove(0);
for (int i = 2; i < 86; i++) {
//List<Map<String, Object>> listMap = EasyExcel.read(path).sheet(1).doReadSync();
List<Map<String, Object>> listMap = new ArrayList<>();
for (int i = 3; i < listMap.size(); i++) {
Map<String, Object> map = listMap.get(i);
String package_box_sn = String.valueOf(map.get(17));
String container_name = String.valueOf(map.get(9));
String sale_order = String.valueOf(map.get(15));
String no = String.valueOf(map.get(16));
String customer_name = String.valueOf(map.get(21));
String customer_description = String.valueOf(map.get(22));
/*//外库,计划内
String package_box_sn = String.valueOf(map.get(16));
String container_name = String.valueOf(map.get(8));
String sale_order = String.valueOf(map.get(14));
String no = String.valueOf(map.get(15));
String customer_name = String.valueOf(map.get(20));
String sap_pcsn = String.valueOf(map.get(9));
String customer_description = String.valueOf(map.get(21));
String product_name = String.valueOf(map.get(1));
String product_description = String.valueOf(map.get(2));
String date_of_FG_inbound = String.valueOf(map.get(11));
String width = String.valueOf(map.get(22));
String thickness = String.valueOf(map.get(23));
String net_weight = String.valueOf(map.get(3));
String length = String.valueOf(map.get(25));
String is_un_plan_production = "0";*/
/*//外库,计划外分切
String package_box_sn = String.valueOf(map.get(26));
String container_name = String.valueOf(map.get(33));
String sale_order = String.valueOf(map.get(29));
//String no = String.valueOf(map.get(15));
String customer_name = String.valueOf(map.get(30));
String sap_pcsn = String.valueOf(map.get(33));
String customer_description = String.valueOf(map.get(31));
String product_name = String.valueOf(map.get(2));
String product_description = String.valueOf(map.get(3));
String date_of_FG_inbound = String.valueOf(map.get(11));
String width = String.valueOf(map.get(23));
String thickness = String.valueOf(map.get(24));
String net_weight = String.valueOf(map.get(4));
String length = String.valueOf(map.get(26));
String is_un_plan_production = String.valueOf(map.get(27));
String date_of_FG_inbound = String.valueOf(map.get(25));
String width = String.valueOf(map.get(34));
String thickness = String.valueOf(map.get(35));
String net_weight = String.valueOf(map.get(37));
String length = String.valueOf(map.get(38));
String is_un_plan_production = "1";*/
if (StrUtil.isEmpty(package_box_sn)) {
//成品库,计划内
String package_box_sn = String.valueOf(map.get(18));
String container_name = String.valueOf(map.get(10));
String sale_order = String.valueOf(map.get(16));
String no = String.valueOf(map.get(17));
String customer_name = String.valueOf(map.get(22));
String sap_pcsn = String.valueOf(map.get(9));
String customer_description = String.valueOf(map.get(23));
String product_name = String.valueOf(map.get(2));
String product_description = String.valueOf(map.get(3));
String date_of_FG_inbound = String.valueOf(map.get(12));
String width = String.valueOf(map.get(24));
String thickness = String.valueOf(map.get(25));
String net_weight = String.valueOf(map.get(4));
String length = String.valueOf(map.get(27));
String is_un_plan_production = "0";
/*//成品库,计划外
String package_box_sn = String.valueOf(map.get(26));
String container_name = String.valueOf(map.get(34));
String sale_order = String.valueOf(map.get(29));
//String no = String.valueOf(map.get(17));
String customer_name = String.valueOf(map.get(30));
String sap_pcsn = String.valueOf(map.get(33));
String customer_description = String.valueOf(map.get(31));
String product_name = String.valueOf(map.get(2));
String product_description = String.valueOf(map.get(3));
String date_of_FG_inbound = String.valueOf(map.get(25));
String width = String.valueOf(map.get(36));
String thickness = String.valueOf(map.get(37));
String net_weight = String.valueOf(map.get(5));
String length = String.valueOf(map.get(40));
String is_un_plan_production = "1";*/
/*if (StrUtil.isEmpty(package_box_sn)) {
throw new BadRequestException("第" + (i + 2) + "行的木箱唯一码为空!");
}
}*/
if (StrUtil.isEmpty(sale_order)) {
throw new BadRequestException("" + (i + 2) + "行的销售订单及行号为空!");
}
@@ -203,17 +256,14 @@ public class LocalStorageServiceImpl implements LocalStorageService {
throw new BadRequestException("" + (i + 2) + "行的计划外分切的子卷为空!");
}
String material_code = String.valueOf(map.get(5));
if (StrUtil.isEmpty(material_code)) {
continue;
}
JSONObject jo = new JSONObject();
jo.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId());
jo.put("package_box_sn", package_box_sn);
jo.put("sap_pcsn", container_name);
jo.put("sap_pcsn", sap_pcsn);
// jo.put("box_weight", BoxWeight);
jo.put("quality_guaran_period", "90");
jo.put("sale_order_name", sale_order + "-" + no);
//jo.put("sale_order_name", sale_order);
jo.put("customer_name", customer_name);
jo.put("customer_description", customer_description);
jo.put("product_name", product_name);
@@ -221,6 +271,16 @@ public class LocalStorageServiceImpl implements LocalStorageService {
jo.put("date_of_FG_inbound", date_of_FG_inbound);
jo.put("container_name", container_name);
jo.put("width", width);
if (StrUtil.isEmpty(thickness) || thickness.equals("null")) {
//查询物料中的厚度
JSONObject mater = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + jo.getString("product_name") + "'").uniqueResult(0);
String code = mater.getString("material_name");
code = code.replace("|", ",");
String[] split = code.split(",");
String last = split[2];
String[] s = last.split("");
thickness = s[0];
}
jo.put("thickness", thickness);
jo.put("net_weight", net_weight);
jo.put("length", length);
@@ -238,41 +298,66 @@ public class LocalStorageServiceImpl implements LocalStorageService {
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
String package_box_sn = row.getString("package_box_sn");
if (StrUtil.isEmpty(package_box_sn) || package_box_sn.equals("null")) {
continue;
}
double total_weight = 0;
JSONArray box_rows = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '"+package_box_sn+"'").getResultJSONArray(0);
JSONArray box_rows = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + package_box_sn + "'").getResultJSONArray(0);
//判断该木箱是否已经存在库内
JSONObject str_jo = WQLObject.getWQLObject("st_ivt_structattr").query("storagevehicle_code = '" + row.get("package_box_sn") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(str_jo)) {
throw new BadRequestException("木箱:" + row.get("package_box_sn") + "已存在库内,请对数据进行核实!");
}
//判断是否属于外库
JSONObject goal_row = box_rows.getJSONObject(0);
JSONObject stor_jo = new JSONObject();
if (goal_row.getString("remark").contains("外库")){
stor_jo = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_virtualstore = '1'").uniqueResult(0);
}else {
stor_jo = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_productstore = '1'").uniqueResult(0);
}
//查询一个空的虚拟区货位
JSONObject struct = WQL.getWO("PDA_ST_01").addParam("flag", "3").process().uniqueResult(0);
JSONObject struct = WQL.getWO("PDA_ST_01").addParam("flag", "3").addParam("stor_id", stor_jo.getString("stor_id")).process().uniqueResult(0);
for (int j = 0; j < box_rows.size(); j++) {
JSONObject box_row = box_rows.getJSONObject(j);
JSONObject ivt_jo = new JSONObject();
//插入库存数据
ivt_jo.put("stockrecord_id",IdUtil.getSnowflake(1,1).nextId());
ivt_jo.put("struct_id",struct.getString("struct_id"));
ivt_jo.put("struct_code",struct.getString("struct_code"));
ivt_jo.put("struct_name",struct.getString("struct_name"));
ivt_jo.put("region_id","");
ivt_jo.put("quality_scode","01");
ivt_jo.put("pcsn",box_row.getString("container_name"));
ivt_jo.put("canuse_qty",box_row.getString("net_weight"));
ivt_jo.put("frozen_qty",0);
ivt_jo.put("ivt_qty",box_row.getString("net_weight"));
ivt_jo.put("instorage_time",DateUtil.now());
JSONObject mater = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '"+box_row.getString("product_name")+"'").uniqueResult(0);
ivt_jo.put("material_id",mater.getString("material_id"));
ivt_jo.put("qty_unit_id",mater.getString("base_unit_id"));
ivt_jo.put("stockrecord_id", IdUtil.getSnowflake(1, 1).nextId());
ivt_jo.put("struct_id", struct.getString("struct_id"));
ivt_jo.put("struct_code", struct.getString("struct_code"));
ivt_jo.put("struct_name", struct.getString("struct_name"));
ivt_jo.put("region_id", "");
ivt_jo.put("quality_scode", "01");
ivt_jo.put("pcsn", box_row.getString("container_name"));
ivt_jo.put("canuse_qty", box_row.getString("net_weight"));
ivt_jo.put("frozen_qty", 0);
ivt_jo.put("ivt_qty", box_row.getString("net_weight"));
ivt_jo.put("instorage_time", DateUtil.now());
JSONObject mater = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + box_row.getString("product_name") + "'").uniqueResult(0);
ivt_jo.put("material_id", mater.getString("material_id"));
ivt_jo.put("qty_unit_id", mater.getString("base_unit_id"));
WQLObject.getWQLObject("st_ivt_structivt").insert(ivt_jo);
total_weight += box_row.getDoubleValue("net_weight");
}
//更新总重量
HashMap<String,String> sub_map = new HashMap<>();
sub_map.put("box_weight",total_weight+"");
sub_map.put("status","2");
HashMap<String, String> sub_map = new HashMap<>();
//sub_map.put("box_weight", total_weight + "");
//sub_map.put("quanlity_in_box", box_rows.size() + "");
sub_map.put("status", "2");
WQLObject.getWQLObject("pdm_bi_subpackagerelation").update(sub_map,"package_box_sn = '"+package_box_sn+"'");
//更新仓位字段
struct.put("storagevehicle_code",package_box_sn);
struct.put("storagevehicle_code", package_box_sn);
WQLObject.getWQLObject("st_ivt_structattr").update(struct);
//更新点位字段
HashMap<String, String> point_map = new HashMap<>();
point_map.put("vehicle_code", package_box_sn);
WQLObject.getWQLObject("SCH_BASE_Point").update(point_map, "point_code = '" + struct.getString("struct_code") + "'");
}
}
}

View File

@@ -136,7 +136,11 @@ public class LmsToMesServiceImpl implements LmsToMesService {
return result;
}
JSONArray list = new JSONArray();
String UserName = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
String Password = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
param.put("UserName",UserName);
param.put("Password",Password);
// String url = acsUrl + api;
String url = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_URL").getValue();

View File

@@ -42,7 +42,7 @@ public class BakingServiceImpl implements BakingService {
* 1.第二条任务出现异常后 如何再次触发
*/
@Override
@Transactional
@Transactional(rollbackFor = Exception.class)
public JSONObject ovenInAndOut(JSONObject whereJson) {
String option = whereJson.getString("option"); // 1-入箱 2-出箱
@@ -80,9 +80,9 @@ public class BakingServiceImpl implements BakingService {
// 1.查询烘箱对应的空位
JSONObject jsonMap = new JSONObject();
jsonMap.put("flag", "1");
jsonMap.put("product_area",jsonPointZc.getString("product_area"));
jsonMap.put("temperature",temperature);
jsonMap.put("point_location",jsonPointZc.getString("point_location"));
jsonMap.put("product_area", jsonPointZc.getString("product_area"));
jsonMap.put("temperature", temperature);
jsonMap.put("point_location", jsonPointZc.getString("point_location"));
JSONObject jsonHotIvt = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有对应空位");
// 2.创建暂存位 --> 烘烤区任务
@@ -103,6 +103,7 @@ public class BakingServiceImpl implements BakingService {
hotParam.put("workorder_id", jsonRaw.getString("workorder_id"));
hotParam.put("material_id", jsonMater.getString("material_id"));
hotParam.put("qty", jsonRaw.get("productin_qty"));
hotParam.put("io_type", "1");
hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id"));
hotParam.put("task_id", task_id);
hotParam.put("start_point_code", point_code1);
@@ -173,9 +174,9 @@ public class BakingServiceImpl implements BakingService {
JSONObject jsonMap = new JSONObject();
jsonMap.put("flag", "1");
jsonMap.put("product_area",product_area);
jsonMap.put("temperature",temperature);
jsonMap.put("point_location",map.getString("point_location"));
jsonMap.put("product_area", product_area);
jsonMap.put("temperature", temperature);
jsonMap.put("point_location", map.getString("point_location"));
JSONObject jsonHotIvt = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有对应空位");
@@ -202,8 +203,9 @@ public class BakingServiceImpl implements BakingService {
hotParam.put("qty", jsonRaw.get("productin_qty"));
hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id"));
hotParam.put("task_id", task_id);
hotParam.put("io_type", "0");
hotParam.put("start_point_code", point_code1);
hotParam.put("next_point_code", jsonHotIvt.getString("point_code"));
hotParam.put("end_point_code", jsonHotIvt.getString("point_code"));
hotParam.put("temperature", temperature);
hotParam.put("oven_time", hours);
this.createHotIoMst(hotParam);
@@ -292,18 +294,22 @@ public class BakingServiceImpl implements BakingService {
OutHotTask outHotTask = new OutHotTask();
String task_id = outHotTask.createTask(param);
// 4.插入烘箱区出入明细表
JSONObject jsonHotReMst = hosReMstTab.query("container_name = '" + jsonHotIvt.getString("container_name") + "' and bill_status <> '50' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotReMst)) throw new BadRequestException("烘箱区出入主表不存在");
//查询该母卷对应最近的一条入烘箱记录
JSONObject last_hot_mst = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst").query("container_name = '" + jsonHotIvt.getString("container_name") + "' AND io_type = '0' order by confirm_time desc").uniqueResult(0);
// 创建明细
JSONObject hotParam = new JSONObject();
hotParam.put("container_name", last_hot_mst.getString("container_name"));
hotParam.put("workorder_id", last_hot_mst.getString("workorder_id"));
hotParam.put("material_id", last_hot_mst.getString("material_id"));
hotParam.put("qty", last_hot_mst.get("qty"));
hotParam.put("io_type", "1");
hotParam.put("qty_unit_id", last_hot_mst.getString("qty_unit_id"));
hotParam.put("task_id", task_id);
hotParam.put("iostorinv_id", jsonHotReMst.getString("iostorinv_id"));
hotParam.put("start_point_code", point_code1);
hotParam.put("next_point_code", point_code2);
hotParam.put("temperature", jsonHotIvt.getString("temperature"));
this.createHotDtl(hotParam);
hotParam.put("end_point_code", point_code2);
hotParam.put("temperature", last_hot_mst.getString("temperature"));
hotParam.put("oven_time", last_hot_mst.getString("oven_time"));
this.createHotIoMst(hotParam);
}
JSONObject result = new JSONObject();
result.put("message", "操作成功!");
@@ -311,7 +317,7 @@ public class BakingServiceImpl implements BakingService {
}
@Override
@Transactional
@Transactional(rollbackFor = Exception.class)
public JSONObject inCoolIvt(JSONObject whereJson) {
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位点
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
@@ -356,7 +362,7 @@ public class BakingServiceImpl implements BakingService {
InCoolIvtTask inCoolIvtTask = new InCoolIvtTask();
String task_id = inCoolIvtTask.createTask(param);
// 4.插入明细
/* // 4.插入明细
JSONObject jsonHotMst = hotMstTab.query("container_name = '" + container_name + "' and is_delete = '0' and bill_status <> '50'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotMst)) throw new BadRequestException("烘烤区出入主表不存在");
JSONObject hotParam = new JSONObject();
@@ -364,7 +370,7 @@ public class BakingServiceImpl implements BakingService {
hotParam.put("iostorinv_id", jsonHotMst.getString("iostorinv_id"));
hotParam.put("start_point_code", point_code1);
hotParam.put("next_point_code", jsonCooIvt.getString("full_point_code"));
this.createHotDtl(hotParam);
this.createHotDtl(hotParam);*/
// 生成冷却区出入表
Long currentUserId = 2L;
@@ -416,6 +422,7 @@ public class BakingServiceImpl implements BakingService {
jsonHotMst.put("workorder_id", param.getString("workorder_id"));
jsonHotMst.put("material_id", param.get("material_id"));
jsonHotMst.put("qty", param.getString("qty"));
jsonHotMst.put("io_type", param.getString("io_type"));
jsonHotMst.put("bill_status", "50");
jsonHotMst.put("qty_unit_id", param.getString("qty_unit_id"));
jsonHotMst.put("start_point_code", param.getString("start_point_code"));

View File

@@ -9,9 +9,12 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.pda.mps.service.BakingService;
import org.nl.wms.pda.mps.service.HandleBakingService;
@@ -47,11 +50,8 @@ public class HandleBakingServiceImpl implements HandleBakingService {
String option = whereJson.getString("option"); // 1-入箱 2-出箱
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位表
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
WQLObject coolIvtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区点位库存表
WQLObject hosIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); // 烤箱区点位库存表
WQLObject hosReMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烤箱区出入主表
WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
@@ -63,6 +63,12 @@ public class HandleBakingServiceImpl implements HandleBakingService {
String point_code1 = whereJson.getString("point_code"); // 起点
String next_point_code = whereJson.getString("next_point_code"); // 终点
JSONObject cool_ivt = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code1 + "'").uniqueResult(0);
String on_container_name = cool_ivt.getString("container_name");
if (!on_container_name.equals(container_name)) {
throw new BadRequestException("点位上子卷不符!");
}
Long currentUserId = 2L;
String currentUsername = "默认用户";
@@ -127,13 +133,16 @@ public class HandleBakingServiceImpl implements HandleBakingService {
hotParam.put("qty", jsonRaw.get("productin_qty"));
hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id"));
hotParam.put("start_point_code", point_code1);
hotParam.put("next_point_code", next_point_code);
hotParam.put("end_point_code", next_point_code);
hotParam.put("temperature", temperature);
hotParam.put("oven_time", hours);
this.createHotIoMst(hotParam);
// 更新烘箱区库存状态
JSONObject jsonHotIvt = hosIvtTab.query("point_code = '" + next_point_code + "'").uniqueResult(0);
if (StrUtil.isNotEmpty(jsonHotIvt.getString("container_name"))){
throw new BadRequestException("目的点上存在母卷!");
}
jsonHotIvt.put("point_status", "02");
jsonHotIvt.put("container_name", container_name);
jsonHotIvt.put("workorder_id", jsonRaw.getString("workorder_id"));
@@ -198,6 +207,9 @@ public class HandleBakingServiceImpl implements HandleBakingService {
//更新冷却区库存
JSONObject jsonIvt = coolIvtTab.query("full_point_code ='" + next_point_code + "'").uniqueResult(0);
if (StrUtil.isNotEmpty(jsonIvt.getString("container_name"))){
throw new BadRequestException("目的点上存在母卷!");
}
jsonIvt.put("full_point_status", "02");
jsonIvt.put("cool_ivt_status", "03");
jsonIvt.put("instorage_time", DateUtil.now());
@@ -217,20 +229,33 @@ public class HandleBakingServiceImpl implements HandleBakingService {
String point_code = whereJson.getString("point_code");
String container_name = whereJson.getString("container_name");
if (StrUtil.isEmpty(point_code)){
if (StrUtil.isEmpty(point_code)) {
throw new BadRequestException("点位不能为空!");
}
if (StrUtil.isEmpty(container_name)){
if (StrUtil.isEmpty(container_name)) {
throw new BadRequestException("母卷不能为空!");
}
JSONObject cool_ivt = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '"+point_code+"'").uniqueResult(0);
String on_container_name = cool_ivt.getString("on_container_name");
if (!on_container_name.equals(container_name)){
JSONObject cool_ivt = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0);
String on_container_name = cool_ivt.getString("container_name");
if (!on_container_name.equals(container_name)) {
throw new BadRequestException("点位上子卷不符!");
}
cool_ivt.put("cool_ivt_status","04");
cool_ivt.put("cool_ivt_status", "04");
//调用回传MES的半成品入库接口
// 将入冷却信息发送给mes
JSONObject param = new JSONObject();
String userName = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_USERNAME").getValue();
String passWord = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_PASSWORD").getValue();
param.put("iContainerName", on_container_name);
param.put("iArrivalTime", DateUtil.now());
param.put("iWarehouse", 2);
param.put("UserName", userName);
param.put("PassWord", passWord);
new LmsToMesServiceImpl().momRollSemiFGInboundComplete(param);
JSONObject result = new JSONObject();
result.put("message", "操作成功!");
@@ -252,6 +277,7 @@ public class HandleBakingServiceImpl implements HandleBakingService {
jsonHotMst.put("material_id", param.get("material_id"));
jsonHotMst.put("qty", param.getString("qty"));
jsonHotMst.put("bill_status", "50");
jsonHotMst.put("io_type", param.get("io_type"));
jsonHotMst.put("qty_unit_id", param.getString("qty_unit_id"));
jsonHotMst.put("start_point_code", param.getString("start_point_code"));
jsonHotMst.put("end_point_code", param.getString("end_point_code"));

View File

@@ -145,7 +145,7 @@ public class OutServiceImpl implements OutService {
JSONObject jo = new JSONObject();
jo.put("point_code1", point_code);
jo.put("point_code2", delivery_point.getString("point_code"));
jo.put("point_code3", delivery_point.getString("point_code"));
jo.put("point_code3",delivery_point.getString("point_code"));
jo.put("point_code4", point_code);
jo.put("vehicle_code", delivery_point.getString("qzzno"));
jo.put("vehicle_code2", cut_qzzno);

View File

@@ -76,6 +76,7 @@
WHERE
is_used = '1'
AND full_point_status = '01'
AND empty_point_status = '01'
AND NOT EXISTS (
SELECT
@@ -95,7 +96,7 @@
OPTION 输入.point_location <> ""
point_location = 输入.point_location
ENDOPTION
ORDER BY sort_seq desc
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -62,11 +62,11 @@ public class CoolInServiceImpl implements CoolInService {
String is_bake = whereJson.getString("is_bake"); // 是否烘烤完成
// 查询终点在冷却区是否存在
JSONObject jsonCoolIvt = coolIvtTab.query("point_code = '" + point_code + "' and full_point_status = '01' and empty_point_status = '01' and is_used = '1'").uniqueResult(0);
JSONObject jsonCoolIvt = coolIvtTab.query("full_point_code = '" + point_code + "' and full_point_status = '01' and empty_point_status = '01' and is_used = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonCoolIvt)) throw new BadRequestException("此点位不存在或被占用"+point_code);
//查询该点位是否存在任务
JSONObject task_jo = WQLObject.getWQLObject("").query("(point_code1 like '%"+jsonCoolIvt.getString("point_code")+"%' OR point_code2 like '%"+jsonCoolIvt.getString("point_code")+"%') AND is_delete = '0' AND task_status < '07'").uniqueResult(0);
JSONObject task_jo = WQLObject.getWQLObject("sch_base_task").query("(point_code1 like '%"+jsonCoolIvt.getString("point_code")+"%' OR point_code2 like '%"+jsonCoolIvt.getString("point_code")+"%') AND is_delete = '0' AND task_status < '07'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(task_jo)){
throw new BadRequestException("该点位存在未完成的任务,不允许绑定!");
}

View File

@@ -20,6 +20,7 @@
输入.is_used TYPEAS s_string
输入.begin_time TYPEAS s_string
输入.end_time TYPEAS s_string
输入.container_name TYPEAS s_string
输入.bill_code TYPEAS s_string
输入.dtl_status TYPEAS s_string
输入.task_code TYPEAS s_string
@@ -83,34 +84,18 @@
SELECT
mst.bill_code,
mst.container_name,
dtl.start_point_code,
dtl.next_point_code,
dtl.temperature,
dtl.oven_time,
dtl.create_name,
dtl.create_time,
dtl.confirm_optname,
dtl.confirm_time,
(
CASE
dtl.dtl_status
WHEN '10' THEN '生成'
WHEN '40' THEN '执行中'
WHEN '50' THEN '确认'
END
) AS dtl_status,
(
CASE
dtl.task_type
WHEN '0' THEN 'AGV任务'
WHEN '1' THEN '桁架任务'
END
) AS task_type,
mst.start_point_code,
mst.end_point_code,
mst.temperature,
mst.oven_time,
mst.create_name,
mst.create_time,
mst.confirm_optname,
mst.confirm_time,
task.task_code
FROM
ST_IVT_HotRegionIODtl dtl
LEFT JOIN ST_IVT_HotRegionIOMst mst ON mst.iostorinv_id = dtl.iostorinv_id
LEFT JOIN sch_base_task task ON task.task_id = dtl.task_id
ST_IVT_HotRegionIOMst mst
LEFT JOIN sch_base_task task ON task.task_id = mst.task_id
WHERE
mst.is_delete = '0'
@@ -119,28 +104,28 @@
mst.bill_code = 输入.bill_code
ENDOPTION
OPTION 输入.dtl_status <> ""
dtl.dtl_status = 输入.dtl_status
ENDOPTION
OPTION 输入.task_code <> ""
task.task_code like 输入.task_code
ENDOPTION
OPTION 输入.start_point_code <> ""
dtl.start_point_code like 输入.start_point_code
mst.start_point_code like 输入.start_point_code
ENDOPTION
OPTION 输入.next_point_code <> ""
dtl.next_point_code like 输入.next_point_code
mst.end_point_code like 输入.next_point_code
ENDOPTION
OPTION 输入.begin_time <> ""
dtl.create_time >= 输入.begin_time
mst.create_time >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
dtl.create_time <= 输入.end_time
mst.create_time <= 输入.end_time
ENDOPTION
OPTION 输入.end_time <> ""
mst.container_name = 输入.container_name
ENDOPTION
ENDSELECT

View File

@@ -157,7 +157,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("终点未找到可用点位:" + point_code2);
// 更新工单状态为完成
jsonRaw.put("status", "09");
jsonRaw.put("status", "09");
rawTab.update(jsonRaw);
// 更新冷却库存状态
@@ -179,7 +179,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
JSONObject jsonRegion = new JSONObject();
jsonRegion.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
jsonRegion.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
jsonRegion.put("io_type", "1");
jsonRegion.put("io_type", "0");
jsonRegion.put("material_id", jsonMater.getString("material_id"));
jsonRegion.put("pcsn", jsonRaw.getString("container_name"));
jsonRegion.put("vehicle_code", "");
@@ -194,6 +194,12 @@ public class CallEmpReelTask extends AbstractAcsTask {
jsonRegion.put("create_id", currentUserId);
jsonRegion.put("create_name", currentUsername);
jsonRegion.put("create_time", DateUtil.now());
jsonRegion.put("update_optid", currentUserId);
jsonRegion.put("update_optname", currentUsername);
jsonRegion.put("update_time", DateUtil.now());
jsonRegion.put("confirm_optid", currentUserId);
jsonRegion.put("confirm_optname", currentUsername);
jsonRegion.put("confirm_time", DateUtil.now());
coolTab.insert(jsonRegion);
}
}

View File

@@ -66,8 +66,6 @@ public class InCoolIvtTask extends AbstractAcsTask {
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区库存表
WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工序工单表
WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烘箱出入主表
WQLObject hotDtlTab = WQLObject.getWQLObject("ST_IVT_HotRegionIODtl"); // 烘箱出入明细表
String task_id = taskObj.getString("task_id");
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
@@ -76,9 +74,6 @@ public class InCoolIvtTask extends AbstractAcsTask {
// 取消删除任务
taskTab.delete("task_id = '"+task_id+"'");
// 删除烘箱任务明细
hotDtlTab.delete("task_id = '"+task_id+"'");
// 删除冷却区出入表
coolTab.delete("task_id = '"+task_id+"'");
}
@@ -118,29 +113,16 @@ public class InCoolIvtTask extends AbstractAcsTask {
pointTab.update(jsonPoint);
// 更新冷却库存状态
JSONObject jsonHotMst = hotMstTab.query("container_name = '" + jsonTask.getString("material_code") + "'").uniqueResult(0);
JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + jsonTask.getString("material_code") + "'").uniqueResult(0);
jsonIvt.put("full_point_status", "02");
jsonIvt.put("cool_ivt_status", "03");
jsonIvt.put("cool_ivt_status", "04");
jsonIvt.put("instorage_time", DateUtil.now());
jsonIvt.put("container_name", jsonHotMst.getString("container_name"));
jsonIvt.put("workorder_id", jsonHotMst.getString("workorder_id"));
jsonIvt.put("ivt_qty", jsonHotMst.getString("qty"));
jsonIvt.put("container_name", raw_jo.getString("container_name"));
jsonIvt.put("workorder_id", raw_jo.getString("workorder_id"));
jsonIvt.put("ivt_qty", raw_jo.getString("qty"));
ivtTab.update(jsonIvt);
// 更新冷却出入主表状态
JSONObject jsonCool = coolTab.query("task_id = '" + task_id + "'").uniqueResult(0);
jsonCool.put("bill_status", "50");
coolTab.update(jsonCool);
// 更新烘烤出入主表为完成
jsonHotMst.put("bill_status", "50");
hotMstTab.update(jsonHotMst);
// 更新烘烤出入明细表为完成
JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0);
jsonHotDtl.put("dtl_status", "50");
hotDtlTab.update(jsonHotDtl);
// 将入冷却信息发送给mes
JSONObject param = new JSONObject();

View File

@@ -64,31 +64,14 @@ public class InHotTask extends AbstractAcsTask {
WQLObject coolIvtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区库存表
WQLObject hotIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); // 烘箱区库存表
WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烘箱区出入主表
WQLObject hotDtlTab = WQLObject.getWQLObject("ST_IVT_HotRegionIODtl"); // 烘箱区出入明细表
WQLObject coolIoTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表
String task_id = taskObj.getString("task_id");
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
if (StrUtil.equals(status, "0")) {
// 判断此条明细是否是冷却区 -> 烘箱,是则删除主表
if (ObjectUtil.isNotEmpty(jsonTask.getString("point_code3"))) {
// 删除烘箱主表
JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonHotDtl)) throw new BadRequestException("明细单据不存在");
hotMstTab.delete("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'");
// 删除冷却出入表
coolIoTab.delete("task_id = '" + task_id + "'");
}
// 取消删除任务
taskTab.delete("task_id = '" + task_id + "'");
// 删除烘箱明细
hotDtlTab.delete("task_id = '" + task_id + "'");
}
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
@@ -96,23 +79,6 @@ public class InHotTask extends AbstractAcsTask {
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
// 更新明细表状态
JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0);
jsonHotDtl.put("dtl_status", "40");
hotDtlTab.update(jsonHotDtl);
// 更新主表状态
JSONObject jsonHotMst = hotMstTab.query("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'").uniqueResult(0);
jsonHotMst.put("bill_status", "40");
hotMstTab.update(jsonHotMst);
// 如果是冷却区入烘箱则更新 冷却区出入表状态
if (ObjectUtil.isNotEmpty(jsonTask.getString("point_code3"))) {
JSONObject jsonCoolIo = coolIoTab.query("task_id = '" + task_id + "'").uniqueResult(0);
jsonCoolIo.put("bill_status", "40");
coolIoTab.update(jsonCoolIo);
}
}
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
@@ -126,16 +92,8 @@ public class InHotTask extends AbstractAcsTask {
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
// 更新明细表
JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0);
jsonHotDtl.put("dtl_status", "50");
jsonHotDtl.put("confirm_optid", currentUserId);
jsonHotDtl.put("confirm_optname", currentUsername);
jsonHotDtl.put("confirm_time", DateUtil.now());
hotDtlTab.update(jsonHotDtl);
// 更新主表: 什么时候更新主表
JSONObject jsonHotMst = hotMstTab.query("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'").uniqueResult(0);
JSONObject jsonHotMst = hotMstTab.query("task_id = '" + task_id + "'").uniqueResult(0);
String hot_point_code = "";
// 判断此任务是否有三个点位
@@ -210,8 +168,8 @@ public class InHotTask extends AbstractAcsTask {
param.put("iContainerName", jsonHotMst.getString("container_name"));
param.put("iResourceName", hot_point_code);
param.put("iMoveInDate", DateUtil.now());
param.put("iPlanBakingTemperature", jsonHotDtl.getDoubleValue("temperature"));
param.put("iPlanBakingTimer", jsonHotDtl.getDoubleValue("oven_time"));
param.put("iPlanBakingTemperature", jsonHotMst.getDoubleValue("temperature"));
param.put("iPlanBakingTimer", jsonHotMst.getDoubleValue("oven_time"));
param.put("UserName", userName);
param.put("PassWord", passWord);

View File

@@ -62,7 +62,6 @@ public class OutHotTask extends AbstractAcsTask {
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表
WQLObject hotIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); // 烘箱区库存表
WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烘箱区出入主表
WQLObject hotDtlTab = WQLObject.getWQLObject("ST_IVT_HotRegionIODtl"); // 烘箱区出入明细表
String task_id = taskObj.getString("task_id");
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
@@ -71,8 +70,7 @@ public class OutHotTask extends AbstractAcsTask {
// 取消删除任务
taskTab.delete("task_id = '" + task_id + "'");
// 删除出入烘箱任务明细
hotDtlTab.delete("task_id = '" + task_id + "'");
hotMstTab.delete("task_id = '" + task_id + "'");
}
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
@@ -81,11 +79,6 @@ public class OutHotTask extends AbstractAcsTask {
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
// 更新明细表状态
JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0);
jsonHotDtl.put("dtl_status", "40");
hotDtlTab.update(jsonHotDtl);
}
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
@@ -101,22 +94,8 @@ public class OutHotTask extends AbstractAcsTask {
JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0);
// 更新明细表
JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0);
Date date1 = DateUtil.parse(jsonHotIvt.getString("instorage_time"));
Date date2 = DateUtil.parse(DateUtil.now());
long betweenDay = DateUtil.between(date1, date2, DateUnit.MINUTE);
jsonHotDtl.put("dtl_status", "50");
jsonHotDtl.put("confirm_optid", currentUserId);
jsonHotDtl.put("confirm_optname", currentUsername);
jsonHotDtl.put("confirm_time", DateUtil.now());
jsonHotDtl.put("oven_time", Double.valueOf(betweenDay));
hotDtlTab.update(jsonHotDtl);
// 更新主表: 什么时候更新主表
JSONObject jsonHotMst = hotMstTab.query("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'").uniqueResult(0);
JSONObject jsonHotMst = hotMstTab.query("task_id = '" + task_id + "'").uniqueResult(0);
// 更新暂存区点位状态
JSONObject jsonPoint2 = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
@@ -140,10 +119,8 @@ public class OutHotTask extends AbstractAcsTask {
param.put("iContainerName", jsonHotMst.getString("container_name"));
param.put("iResourceName", jsonHotIvt.getString("point_code"));
param.put("iMoveOutDate", DateUtil.now());
param.put("iabxActualBakingTemperature", jsonHotDtl.getDoubleValue("temperature"));
param.put("iabxActualBakingTimer", jsonHotDtl.getDoubleValue("oven_time"));
param.put("UserName", "");
param.put("PassWord", "");
param.put("iabxActualBakingTemperature", jsonHotMst.getDoubleValue("temperature"));
param.put("iabxActualBakingTimer", jsonHotMst.getDoubleValue("oven_time"));
JSONObject result = new LmsToMesServiceImpl().momRollBakeOutBound(param);
}

View File

@@ -2088,11 +2088,13 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
from_start.put("storagevehicle_code", "");
storPublicService.updateStructAndPoint(from_start);
//查询对应明细
JSONObject dtl_jo = WQLObject.getWQLObject("st_ivt_iostorinvdtl").query("iostorinvdtl_id = '"+dis.getString("iostorinvdtl_id")+"'").uniqueResult(0);
// 更新子卷包装关系表 状态 - 3
JSONObject jsonSub = subTab.query("container_name = '" + dis.getString("pcsn") + "' and status = '2'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonSub)) throw new BadRequestException("此子卷不存在或不为入库状态:" + dis.getString("pcsn"));
// 如果是拆分入库则将包装关系改为生成状态
if (jo_mst.getString("bill_type").equals("1005")){
if (jo_mst.getString("bill_type").equals("1005") || (jo_mst.getString("bill_type").equals("1009") && StrUtil.isNotEmpty(dtl_jo.getString("source_bill_code")))){
jsonSub.put("status", "0");
} else {
jsonSub.put("status", "3");

View File

@@ -119,6 +119,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
jo_mst.put("upload_mes", "1");
jo_mst.put("upload_optid", SecurityUtils.getCurrentUserId());
jo_mst.put("upload_time", DateUtil.now());
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst);
}
}
@@ -213,6 +214,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
if (jo_mst.getString("upload_sap").equals("1")) {
jo_mst.put("is_upload", "1");
}
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst);
}
}
}
@@ -305,6 +307,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
jo_mst.put("upload_sap", "1");
jo_mst.put("is_upload", "1");
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst);
}
@@ -374,6 +377,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
if (jo_mst.getString("upload_mes").equals("1") || is_productstore.equals("0")) {
jo_mst.put("is_upload", "1");
}
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst);
}
// 改切出库
@@ -434,6 +438,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
if (jo_mst.getString("upload_mes").equals("1")) {
jo_mst.put("is_upload", "1");
}
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst);
}
}
}
@@ -499,6 +504,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
jo_mst.put("upload_mes", "1");
jo_mst.put("upload_optid", SecurityUtils.getCurrentUserId());
jo_mst.put("upload_time", DateUtil.now());
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst);
}
}