代码更新
This commit is contained in:
@@ -215,6 +215,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
|
||||
// 更新工单状态
|
||||
JSONObject jsonRaw = rawTab.query("container_name = '" + containerName + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonRaw)) throw new BadRequestException("工单不存在");
|
||||
jsonRaw.put("status", "04");
|
||||
rawTab.update(jsonRaw);
|
||||
}
|
||||
@@ -223,10 +224,11 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
} catch (Exception e) {
|
||||
result.put("RTYPE", "1");
|
||||
result.put("RTYPE", "E");
|
||||
result.put("RTMSG", "操作失败!" + e.getMessage());
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTOAL", 0);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
}
|
||||
log.info("momRollFoilComplete接口输出参数为:-------------------" + result.toString());
|
||||
return result;
|
||||
@@ -309,7 +311,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
} catch (Exception e) {
|
||||
result.put("RTYPE", "E");
|
||||
result.put("RTMSG", "操作失败!" + e.getMessage());
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTOAL", 0);
|
||||
result.put("RTDAT", null);
|
||||
}
|
||||
|
||||
@@ -497,6 +499,9 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
}
|
||||
|
||||
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + raw_jo.getString("product_name") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(mater_jo)) {
|
||||
throw new BadRequestException("未查询到物料:" + raw_jo.getString("product_name") + ",信息!");
|
||||
}
|
||||
|
||||
//创建任务,判断目的点是否存在空轴,存在创建4个点的任务,不存在则创建两个点任务
|
||||
String task_id = "";
|
||||
@@ -573,6 +578,9 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
mst_jo.put("bill_type", "1003");
|
||||
//查询成品库仓库
|
||||
JSONObject stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_delete = '0' AND is_used = '1' AND is_productstore = '1'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(stor)) {
|
||||
throw new BadRequestException("仓库不存在");
|
||||
}
|
||||
mst_jo.put("stor_id", stor.getString("stor_id"));
|
||||
mst_jo.put("total_qty", "0");
|
||||
mst_jo.put("bill_status", "10");
|
||||
@@ -581,10 +589,16 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
JSONObject dtl = new JSONObject();
|
||||
//查询该物料
|
||||
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + sub_jo.getString("product_name") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(mater_jo)) {
|
||||
throw new BadRequestException("未查询到物料:" + sub_jo.getString("product_name") + ",信息!");
|
||||
}
|
||||
dtl.put("material_id", mater_jo.getString("material_id"));
|
||||
dtl.put("pcsn", plan_jo.getString("restruct_container_name"));
|
||||
dtl.put("box_no", package_box_sn);
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + mater_jo.getString("base_unit_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(unit)) {
|
||||
throw new BadRequestException("未查询到物料计量单位:" + mater_jo.getString("base_unit_id") + ",信息!");
|
||||
}
|
||||
dtl.put("qty_unit_id", unit.getString("measure_unit_id"));
|
||||
dtl.put("qty_unit_name", unit.getString("unit_name"));
|
||||
dtl.put("plan_qty", sub_jo.getString("net_weight"));
|
||||
@@ -627,63 +641,80 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
@Override
|
||||
public JSONObject childRollCutStartComp(JSONArray param) {
|
||||
log.info("childRollCutStartComp接口输入参数为:-------------------" + param.toString());
|
||||
|
||||
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||
if (StrUtil.equals(is_mesTolms, "1")) {
|
||||
String Status = param.getJSONObject(0).getString("Status");
|
||||
|
||||
if (Status.equals("1")) {
|
||||
//更新分切计划表状态
|
||||
for (int i = 0; i < param.size(); i++) {
|
||||
JSONObject row = param.getJSONObject(i);
|
||||
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "'").uniqueResult(0);
|
||||
plan_jo.put("status", "05");
|
||||
WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo);
|
||||
}
|
||||
}
|
||||
|
||||
if (Status.equals("2")) {
|
||||
String ResourceName = param.getJSONObject(0).getString("ResourceName");
|
||||
JSONObject cut_jo = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("ext_code = '" + ResourceName + "'").uniqueResult(0);
|
||||
String up_point_code = cut_jo.getString("up_point_code");
|
||||
String down_point_code = cut_jo.getString("down_point_code");
|
||||
|
||||
JSONArray up_rows = new JSONArray();
|
||||
JSONArray down_rows = new JSONArray();
|
||||
for (int i = 0; i < param.size(); i++) {
|
||||
JSONObject row = param.getJSONObject(i);
|
||||
//查询对应的分切计划
|
||||
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "'").uniqueResult(0);
|
||||
if (row.getString("ContainerPosition").equals("1")) {
|
||||
up_rows.add(plan_jo);
|
||||
}
|
||||
if (row.getString("ContainerPosition").equals("2")) {
|
||||
down_rows.add(plan_jo);
|
||||
}
|
||||
}
|
||||
|
||||
if (up_rows.size() > 0) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("point_code", up_point_code);
|
||||
jo.put("cut_rows", up_rows);
|
||||
jo.put("is_last", "0");
|
||||
outService.confirm(jo);
|
||||
}
|
||||
if (down_rows.size() > 0) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("point_code", down_point_code);
|
||||
jo.put("cut_rows", down_rows);
|
||||
jo.put("is_last", "0");
|
||||
outService.confirm(jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
|
||||
try {
|
||||
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||
if (StrUtil.equals(is_mesTolms, "1")) {
|
||||
String Status = param.getJSONObject(0).getString("Status");
|
||||
|
||||
if (Status.equals("1")) {
|
||||
//更新分切计划表状态
|
||||
for (int i = 0; i < param.size(); i++) {
|
||||
JSONObject row = param.getJSONObject(i);
|
||||
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(plan_jo)) {
|
||||
throw new BadRequestException("未查询到分切计划:"+row.getString("ContainerGroup"));
|
||||
}
|
||||
plan_jo.put("status", "05");
|
||||
WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo);
|
||||
}
|
||||
}
|
||||
|
||||
if (Status.equals("2")) {
|
||||
String ResourceName = param.getJSONObject(0).getString("ResourceName");
|
||||
JSONObject cut_jo = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("ext_code = '" + ResourceName + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(cut_jo)) {
|
||||
throw new BadRequestException("分切点位库存不存在:"+ResourceName);
|
||||
}
|
||||
String up_point_code = cut_jo.getString("up_point_code");
|
||||
String down_point_code = cut_jo.getString("down_point_code");
|
||||
|
||||
JSONArray up_rows = new JSONArray();
|
||||
JSONArray down_rows = new JSONArray();
|
||||
for (int i = 0; i < param.size(); i++) {
|
||||
JSONObject row = param.getJSONObject(i);
|
||||
//查询对应的分切计划
|
||||
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '" + row.getString("ContainerGroup") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(plan_jo)) {
|
||||
throw new BadRequestException("未查询到分切计划:"+row.getString("ContainerGroup"));
|
||||
}
|
||||
if (row.getString("ContainerPosition").equals("1")) {
|
||||
up_rows.add(plan_jo);
|
||||
}
|
||||
if (row.getString("ContainerPosition").equals("2")) {
|
||||
down_rows.add(plan_jo);
|
||||
}
|
||||
}
|
||||
|
||||
if (up_rows.size() > 0) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("point_code", up_point_code);
|
||||
jo.put("cut_rows", up_rows);
|
||||
jo.put("is_last", "0");
|
||||
outService.confirm(jo);
|
||||
}
|
||||
if (down_rows.size() > 0) {
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("point_code", down_point_code);
|
||||
jo.put("cut_rows", down_rows);
|
||||
jo.put("is_last", "0");
|
||||
outService.confirm(jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
} catch (Exception e) {
|
||||
result.put("RTYPE", "E");
|
||||
result.put("RTMSG", "操作失败!" + e.getMessage());
|
||||
result.put("RTOAL", 0);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -697,8 +728,10 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
@Override
|
||||
public JSONObject childRollPackComplete(JSONObject param) {
|
||||
log.info("childRollPackComplete接口输入参数为:-------------------" + param.toString());
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
// String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||
try {
|
||||
// String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||
// if (StrUtil.equals(is_mesTolms, "1")) {
|
||||
String isUnPlanProductionBox = param.getString("isUnPlanProductionBox"); // 生产订单
|
||||
String QuanlityInBox = param.getString("QuanlityInBox"); // 产品编码
|
||||
@@ -714,6 +747,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
double BoxWeight = 0; // 木箱自身重量
|
||||
|
||||
JSONArray details = param.getJSONArray("details");
|
||||
if (ObjectUtil.isEmpty(details)) throw new BadRequestException("明细为空");
|
||||
for (int i = 0; i < details.size(); i++) {
|
||||
JSONObject detail = details.getJSONObject(i);
|
||||
BoxWeight = NumberUtil.add(BoxWeight, detail.getDoubleValue("NetWeight"));
|
||||
@@ -775,12 +809,18 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
tab.update(map,"package_box_sn = '"+PackageBoxSN+"'");
|
||||
}
|
||||
// }
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
} catch (Exception e) {
|
||||
result.put("RTYPE", "E");
|
||||
result.put("RTMSG", "操作失败!" + e.getMessage());
|
||||
result.put("RTOAL", 0);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -794,6 +834,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
@Override
|
||||
public JSONObject inventoryTransferInfoSync(JSONObject param) {
|
||||
log.info("inventoryTransferInfoSync接口输入参数为:-------------------" + param.toString());
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
// String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||
// if (StrUtil.equals(is_mesTolms, "1")) {
|
||||
try {
|
||||
@@ -822,6 +864,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
change_jo.put("changeinv_id", changeinv_id);
|
||||
change_jo.put("seq_no", detail_count + 1);
|
||||
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + container_row.getString("product_name") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(mater_jo)) throw new BadRequestException("物料不存在:"+container_row.getString("product_name"));
|
||||
change_jo.put("material_id", mater_jo.getString("material_id"));
|
||||
change_jo.put("pcsn", container_row.getString("container_name"));
|
||||
change_jo.put("package_box_sn", container_row.getString("package_box_sn"));
|
||||
@@ -830,11 +873,13 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
change_jo.put("customer_name", CustomerName);
|
||||
//查询对应的客户
|
||||
JSONObject customer_jo = WQLObject.getWQLObject("md_cs_customerbase").query("cust_code = '" + CustomerName + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(customer_jo)) throw new BadRequestException("客户不存在:"+CustomerName);
|
||||
change_jo.put("customer_description", customer_jo.getString("cust_name"));
|
||||
change_jo.put("isRePrintPackageBoxLabel", isRePrintPackageBoxLabel);
|
||||
change_jo.put("isUnPackBox", isUnPackBox);
|
||||
change_jo.put("UpdatedDateOfProduction", UpdatedDateOfProduction);
|
||||
JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + mater_jo.getString("base_unit_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(unit)) throw new BadRequestException("计量单位不存在:"+mater_jo.getString("base_unit_id"));
|
||||
change_jo.put("qty_unit_id", mater_jo.getString("base_unit_id"));
|
||||
change_jo.put("qty_unit_name", unit.getString("unit_name"));
|
||||
change_jo.put("qty", container_row.getString("net_weight"));
|
||||
@@ -854,6 +899,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
mst_jo.put("bill_type","2001");
|
||||
mst_jo.put("biz_date", DateUtil.today());
|
||||
JSONObject stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_delete = '0' AND is_used = '1' AND is_productstore = '1'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(stor)) throw new BadRequestException("仓库不存在!");
|
||||
mst_jo.put("stor_id", stor.getString("stor_id"));
|
||||
mst_jo.put("stor_code", stor.getString("stor_code"));
|
||||
mst_jo.put("stor_name", stor.getString("stor_name"));
|
||||
@@ -874,22 +920,20 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
mst_jo.put("syscompanyid", deptId + "");
|
||||
WQLObject.getWQLObject("ST_IVT_StructIvtChange").insert(mst_jo);
|
||||
|
||||
} catch (Exception e) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("RTYPE", "E");
|
||||
result.put("RTMSG", "操作失败!," + e.getMessage());
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
|
||||
} catch (Exception e) {
|
||||
result.put("RTYPE", "E");
|
||||
result.put("RTMSG", "操作失败!," + e.getMessage());
|
||||
result.put("RTOAL", 0);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
return result;
|
||||
}
|
||||
// }
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -903,10 +947,12 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
@Override
|
||||
public JSONObject childRollInfoUpdate(JSONObject param) {
|
||||
log.info("childRollInfoUpdate接口输入参数为:-------------------" + param.toString());
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
// String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||
try {
|
||||
// String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||
// if (StrUtil.equals(is_mesTolms, "1")) {
|
||||
|
||||
|
||||
String ContainerName = param.getString("ContainerName");
|
||||
String SaleOrderName = param.getString("SaleOrderName");
|
||||
String isUnPlanProduction = param.getString("isUnPlanProduction");
|
||||
@@ -916,6 +962,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("container_name = '"+ContainerName+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(sub_jo)) throw new BadRequestException("子卷包装不存在:"+ContainerName);
|
||||
/*sub_jo.put("change_type_scode","02");
|
||||
sub_jo.put("create_id",currentUserId);
|
||||
sub_jo.put("create_name",nickName);
|
||||
@@ -934,14 +981,19 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
new_sub.put("workorder_id",IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
WQLObject.getWQLObject("PDM_BI_SubPackageRelationChangeFlow").insert(new_sub);*/
|
||||
}
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
// }
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
} catch (Exception e) {
|
||||
result.put("RTYPE", "E");
|
||||
result.put("RTMSG", "操作失败!," + e.getMessage());
|
||||
result.put("RTOAL", 0);
|
||||
result.put("RTDAT", null);
|
||||
System.out.println(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
|
||||
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.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.ext.sap.service.LmsToSapService;
|
||||
@@ -62,15 +63,13 @@ public class LmsToSapServiceImpl implements LmsToSapService {
|
||||
log.info("returnDelivery接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
|
||||
String type = result.getString("TYPE");
|
||||
if (StrUtil.equals(type, "E")) {
|
||||
throw new BadRequestException(result.getString("MESSAGE"));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//ConnectException: Connection refused: connect
|
||||
//网络不通
|
||||
System.out.println(msg);
|
||||
result.put("status", HttpStatus.BAD_REQUEST);
|
||||
result.put("message", "网络不通,操作失败!");
|
||||
result.put("data", new JSONObject());
|
||||
log.info("网络不通,操作失败!");
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -128,16 +127,13 @@ public class LmsToSapServiceImpl implements LmsToSapService {
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
log.info("returnMoveDtl接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
String type = result.getString("TYPE");
|
||||
if (StrUtil.equals(type, "E")) {
|
||||
throw new BadRequestException(result.getString("MESSAGE"));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//ConnectException: Connection refused: connect
|
||||
//网络不通
|
||||
System.out.println(msg);
|
||||
result.put("status", HttpStatus.BAD_REQUEST);
|
||||
result.put("message", "网络不通,操作失败!");
|
||||
result.put("data", new JSONObject());
|
||||
log.info("网络不通,操作失败!");
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user