代码更新
This commit is contained in:
@@ -10,8 +10,10 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.common.utils.SecurityUtils;
|
import org.nl.modules.common.utils.SecurityUtils;
|
||||||
|
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||||
import org.nl.modules.system.util.CodeUtil;
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
|
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
|
||||||
import org.nl.wms.ext.mes.service.MesToLmsService;
|
import org.nl.wms.ext.mes.service.MesToLmsService;
|
||||||
import org.nl.wms.log.LokiLog;
|
import org.nl.wms.log.LokiLog;
|
||||||
@@ -138,27 +140,29 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
|||||||
|
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
try {
|
try {
|
||||||
String ContainerName = param.getString("ContainerName");
|
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||||
String ResourceName = param.getString("ResourceName");
|
if (StrUtil.equals(is_mesTolms, "1")) {
|
||||||
//查询该母卷号、设备号对应的生箔工单
|
String ContainerName = param.getString("ContainerName");
|
||||||
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + ContainerName + "' AND resource_name = '" + ResourceName + "'").uniqueResult(0);
|
String ResourceName = param.getString("ResourceName");
|
||||||
|
//查询该母卷号、设备号对应的生箔工单
|
||||||
|
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + ContainerName + "' AND resource_name = '" + ResourceName + "'").uniqueResult(0);
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(raw_jo)) {
|
if (ObjectUtil.isEmpty(raw_jo)) {
|
||||||
throw new BadRequestException("未查询到对应的生箔工单!");
|
throw new BadRequestException("未查询到对应的生箔工单!");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONArray data = new JSONArray();
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("ContainerName", raw_jo.getString("container_name"));
|
||||||
|
json.put("ResourceName", raw_jo.getString("resource_name"));
|
||||||
|
json.put("Weight", String.format("%.2f", raw_jo.getDoubleValue("productin_qty")));
|
||||||
|
json.put("WeighDate", DateUtil.now());
|
||||||
|
data.add(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONArray data = new JSONArray();
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("ContainerName", raw_jo.getString("container_name"));
|
|
||||||
json.put("ResourceName", raw_jo.getString("resource_name"));
|
|
||||||
json.put("Weight", String.format("%.2f", raw_jo.getDoubleValue("productin_qty")));
|
|
||||||
json.put("WeighDate", DateUtil.now());
|
|
||||||
data.add(json);
|
|
||||||
|
|
||||||
result.put("RTYPE", "S");
|
result.put("RTYPE", "S");
|
||||||
result.put("RTMSG", "操作成功!");
|
result.put("RTMSG", "操作成功!");
|
||||||
result.put("RTOAL", 1);
|
result.put("RTOAL", 1);
|
||||||
result.put("RTDAT", data);
|
result.put("RTDAT", null);
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -187,31 +191,33 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
|||||||
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表
|
WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String containerName = param.getString("ContainerName");
|
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||||
String resourceName = param.getString("ResourceName");
|
if (StrUtil.equals(is_mesTolms, "1")) {
|
||||||
if (ObjectUtil.isEmpty(resourceName)) throw new BadRequestException("机台编码不能为空");
|
String containerName = param.getString("ContainerName");
|
||||||
if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空");
|
String resourceName = param.getString("ResourceName");
|
||||||
|
if (ObjectUtil.isEmpty(resourceName)) throw new BadRequestException("机台编码不能为空");
|
||||||
|
if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空");
|
||||||
|
|
||||||
JSONObject jsonSb = sbTab.query("ext_code = '" + resourceName + "' and is_used = '1'").uniqueResult(0);
|
JSONObject jsonSb = sbTab.query("ext_code = '" + resourceName + "' and is_used = '1'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("点位设备不存在");
|
if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("点位设备不存在");
|
||||||
|
|
||||||
// 下发ACS更改任务状态
|
// 下发ACS更改任务状态
|
||||||
JSONArray paramArr = new JSONArray();
|
JSONArray paramArr = new JSONArray();
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("device_code", jsonSb.getString("point_code"));
|
json.put("device_code", jsonSb.getString("point_code"));
|
||||||
json.put("option ", "2");
|
json.put("option ", "2");
|
||||||
paramArr.add(json);
|
paramArr.add(json);
|
||||||
|
|
||||||
JSONObject resultAcs = new WmsToAcsServiceImpl().updateTask(paramArr);
|
JSONObject resultAcs = new WmsToAcsServiceImpl().updateTask(paramArr);
|
||||||
if (!StrUtil.equals(resultAcs.getString("status"), "200")) {
|
if (!StrUtil.equals(resultAcs.getString("status"), "200")) {
|
||||||
throw new BadRequestException(resultAcs.getString("message "));
|
throw new BadRequestException(resultAcs.getString("message "));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新工单状态
|
||||||
|
JSONObject jsonRaw = rawTab.query("container_name = '" + containerName + "'").uniqueResult(0);
|
||||||
|
jsonRaw.put("status", "04");
|
||||||
|
rawTab.update(jsonRaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新工单状态
|
|
||||||
JSONObject jsonRaw = rawTab.query("container_name = '" + containerName + "'").uniqueResult(0);
|
|
||||||
jsonRaw.put("status", "04");
|
|
||||||
rawTab.update(jsonRaw);
|
|
||||||
|
|
||||||
result.put("RTYPE", "S");
|
result.put("RTYPE", "S");
|
||||||
result.put("RTMSG", "操作成功!");
|
result.put("RTMSG", "操作成功!");
|
||||||
result.put("RTOAL", 1);
|
result.put("RTOAL", 1);
|
||||||
@@ -243,66 +249,63 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
|||||||
|
|
||||||
JSONObject jsonParam = new JSONObject();
|
JSONObject jsonParam = new JSONObject();
|
||||||
try {
|
try {
|
||||||
String containerName = param.getString("ContainerName"); // 母卷号
|
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||||
String nextSpec = param.getString("NextSpec"); // 下工序:1-入烘箱,2-入冷却
|
if (StrUtil.equals(is_mesTolms, "1")) {
|
||||||
String bakingTemperature = param.getString("BakingTemperature"); // 温度
|
String containerName = param.getString("ContainerName"); // 母卷号
|
||||||
String bakingTimer = param.getString("BakingTimer"); // 烘烤时间
|
String nextSpec = param.getString("NextSpec"); // 下工序:1-入烘箱,2-入冷却
|
||||||
|
String bakingTemperature = param.getString("BakingTemperature"); // 温度
|
||||||
|
String bakingTimer = param.getString("BakingTimer"); // 烘烤时间
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空");
|
if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空");
|
||||||
if (ObjectUtil.isEmpty(nextSpec)) throw new BadRequestException("下工序不能为空");
|
if (ObjectUtil.isEmpty(nextSpec)) throw new BadRequestException("下工序不能为空");
|
||||||
|
|
||||||
if (StrUtil.equals(nextSpec, "1")) {
|
if (StrUtil.equals(nextSpec, "1")) {
|
||||||
/*
|
/*
|
||||||
* 入烘箱
|
* 入烘箱
|
||||||
*/
|
*/
|
||||||
if (ObjectUtil.isEmpty(bakingTemperature)) throw new BadRequestException("温度不能为空");
|
if (ObjectUtil.isEmpty(bakingTemperature)) throw new BadRequestException("温度不能为空");
|
||||||
if (ObjectUtil.isEmpty(bakingTimer)) throw new BadRequestException("烘烤时间不能为空");
|
if (ObjectUtil.isEmpty(bakingTimer)) throw new BadRequestException("烘烤时间不能为空");
|
||||||
|
|
||||||
String point_code = "";
|
String point_code = "";
|
||||||
JSONObject jsonCoolIvt = coolIvtTab.query("container_name = '" + containerName + "' and full_point_status = '02' and cool_ivt_status <> '03'").uniqueResult(0);
|
JSONObject jsonCoolIvt = coolIvtTab.query("container_name = '" + containerName + "' and full_point_status = '02' and cool_ivt_status <> '03'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(jsonCoolIvt)) {
|
if (ObjectUtil.isEmpty(jsonCoolIvt)) {
|
||||||
JSONObject jsonPoint = pointTab.query("material_code ='" + containerName + "'").uniqueResult(0);
|
JSONObject jsonPoint = pointTab.query("material_code ='" + containerName + "'").uniqueResult(0);
|
||||||
if (ObjectUtil.isNotEmpty(jsonPoint)) point_code = jsonPoint.getString("point_code");
|
if (ObjectUtil.isNotEmpty(jsonPoint)) point_code = jsonPoint.getString("point_code");
|
||||||
|
} else {
|
||||||
|
point_code = jsonCoolIvt.getString("full_point_code");
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(point_code)) throw new BadRequestException("母卷不存在或已烘烤完成");
|
||||||
|
|
||||||
|
// 调用接口输入参数
|
||||||
|
jsonParam.put("option", "1");
|
||||||
|
jsonParam.put("container_name", containerName);
|
||||||
|
jsonParam.put("temperature", bakingTemperature);
|
||||||
|
jsonParam.put("hours", bakingTimer);
|
||||||
|
jsonParam.put("point_code", point_code);
|
||||||
|
|
||||||
|
// 调用手持接口
|
||||||
|
BakingServiceImpl bakingService = new BakingServiceImpl();
|
||||||
|
bakingService.ovenInAndOut(jsonParam);
|
||||||
} else {
|
} else {
|
||||||
point_code = jsonCoolIvt.getString("full_point_code");
|
/*
|
||||||
|
* 入冷却区
|
||||||
|
*/
|
||||||
|
JSONObject jsonPoint = pointTab.query("material_code = '" + containerName + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(jsonPoint)) throw new BadRequestException("母卷不存在");
|
||||||
|
|
||||||
|
// 调用接口输入参数
|
||||||
|
jsonParam.put("point_code", jsonPoint.getString("point_code"));
|
||||||
|
jsonParam.put("container_name", containerName);
|
||||||
|
|
||||||
|
// 调用手持接口
|
||||||
|
BakingServiceImpl bakingService = new BakingServiceImpl();
|
||||||
|
bakingService.inCoolIvt(jsonParam);
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isEmpty(point_code)) throw new BadRequestException("母卷不存在或已烘烤完成");
|
|
||||||
|
|
||||||
// 调用接口输入参数
|
|
||||||
jsonParam.put("option", "1");
|
|
||||||
jsonParam.put("container_name", containerName);
|
|
||||||
jsonParam.put("temperature", bakingTemperature);
|
|
||||||
jsonParam.put("hours", bakingTimer);
|
|
||||||
jsonParam.put("point_code", point_code);
|
|
||||||
|
|
||||||
// 调用手持接口
|
|
||||||
BakingServiceImpl bakingService = new BakingServiceImpl();
|
|
||||||
bakingService.ovenInAndOut(jsonParam);
|
|
||||||
|
|
||||||
result.put("RTYPE", "S");
|
|
||||||
result.put("RTMSG", "操作成功!");
|
|
||||||
result.put("RTOAL", 1);
|
|
||||||
result.put("RTDAT", null);
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* 入冷却区
|
|
||||||
*/
|
|
||||||
JSONObject jsonPoint = pointTab.query("material_code = '" + containerName + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
|
|
||||||
if (ObjectUtil.isEmpty(jsonPoint)) throw new BadRequestException("母卷不存在");
|
|
||||||
|
|
||||||
// 调用接口输入参数
|
|
||||||
jsonParam.put("point_code", jsonPoint.getString("point_code"));
|
|
||||||
jsonParam.put("container_name", containerName);
|
|
||||||
|
|
||||||
// 调用手持接口
|
|
||||||
BakingServiceImpl bakingService = new BakingServiceImpl();
|
|
||||||
bakingService.inCoolIvt(jsonParam);
|
|
||||||
|
|
||||||
result.put("RTYPE", "S");
|
|
||||||
result.put("RTMSG", "操作成功!");
|
|
||||||
result.put("RTOAL", 1);
|
|
||||||
result.put("RTDAT", null);
|
|
||||||
}
|
}
|
||||||
|
result.put("RTYPE", "S");
|
||||||
|
result.put("RTMSG", "操作成功!");
|
||||||
|
result.put("RTOAL", 1);
|
||||||
|
result.put("RTDAT", null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
result.put("RTYPE", "1");
|
result.put("RTYPE", "1");
|
||||||
result.put("RTMSG", "操作失败!"+e.getMessage());
|
result.put("RTMSG", "操作失败!"+e.getMessage());
|
||||||
@@ -344,7 +347,6 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
|||||||
|
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// 基础校验
|
// 基础校验
|
||||||
if (ObjectUtil.isEmpty(orderType)) throw new BadRequestException("分切订单类型不能为空");
|
if (ObjectUtil.isEmpty(orderType)) throw new BadRequestException("分切订单类型不能为空");
|
||||||
if (ObjectUtil.isEmpty(ContainerName)) throw new BadRequestException("子卷号不能为空");
|
if (ObjectUtil.isEmpty(ContainerName)) throw new BadRequestException("子卷号不能为空");
|
||||||
@@ -452,141 +454,143 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
|||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String container_name = param.getString("ContainerName");
|
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||||
if (StrUtil.isEmpty(container_name)) {
|
if (StrUtil.equals(is_mesTolms, "1")) {
|
||||||
throw new BadRequestException("子卷号不能为空!");
|
String container_name = param.getString("ContainerName");
|
||||||
}
|
if (StrUtil.isEmpty(container_name)) {
|
||||||
|
throw new BadRequestException("子卷号不能为空!");
|
||||||
JSONObject plan_jo = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("container_name = '" + container_name + "' AND is_delete = '0'").uniqueResult(0);
|
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(plan_jo)) {
|
|
||||||
throw new BadRequestException("未查询到该子卷号对应的分切计划!");
|
|
||||||
}
|
|
||||||
|
|
||||||
//查询该分切机对应的点位
|
|
||||||
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("ext_code = '" + plan_jo.getString("resource_name") + "'").uniqueResult(0);
|
|
||||||
|
|
||||||
//创建搬运任务
|
|
||||||
if (plan_jo.getString("order_type").equals("1")) {
|
|
||||||
//生成一个半成品出库任务
|
|
||||||
String parent_container_name = plan_jo.getString("parent_container_name");
|
|
||||||
|
|
||||||
//查询该母卷号所在位置
|
|
||||||
JSONObject cool_ivt = WQLObject.getWQLObject("ST_IVT_CoolPointIvt").query("container_name = '" + parent_container_name + "'").uniqueResult(0);
|
|
||||||
if (ObjectUtil.isEmpty(cool_ivt)) {
|
|
||||||
throw new BadRequestException("未查询到该母卷的库存信息,!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询该母卷号对应的生箔信息
|
JSONObject plan_jo = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("container_name = '" + container_name + "' AND is_delete = '0'").uniqueResult(0);
|
||||||
JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + parent_container_name + "'").uniqueResult(0);
|
|
||||||
if (ObjectUtil.isEmpty(raw_jo)) {
|
if (ObjectUtil.isEmpty(plan_jo)) {
|
||||||
throw new BadRequestException("未查询到母卷:" + parent_container_name + ",对应的生箔信息!");
|
throw new BadRequestException("未查询到该子卷号对应的分切计划!");
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + raw_jo.getString("product_name") + "'").uniqueResult(0);
|
//查询该分切机对应的点位
|
||||||
|
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("ext_code = '" + plan_jo.getString("resource_name") + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
//创建搬运任务
|
||||||
|
if (plan_jo.getString("order_type").equals("1")) {
|
||||||
|
//生成一个半成品出库任务
|
||||||
|
String parent_container_name = plan_jo.getString("parent_container_name");
|
||||||
|
|
||||||
|
//查询该母卷号所在位置
|
||||||
|
JSONObject cool_ivt = WQLObject.getWQLObject("ST_IVT_CoolPointIvt").query("container_name = '" + parent_container_name + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(cool_ivt)) {
|
||||||
|
throw new BadRequestException("未查询到该母卷的库存信息,!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询该母卷号对应的生箔信息
|
||||||
|
JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + parent_container_name + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(raw_jo)) {
|
||||||
|
throw new BadRequestException("未查询到母卷:" + parent_container_name + ",对应的生箔信息!");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + raw_jo.getString("product_name") + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
//创建任务,判断目的点是否存在空轴,存在创建4个点的任务,不存在则创建两个点任务
|
||||||
|
String task_id = "";
|
||||||
|
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
if (StrUtil.isEmpty(cut_jo.getString("empty_vehicle_code"))) {
|
||||||
|
jo.put("point_code1", cool_ivt.getString("full_point_code"));
|
||||||
|
jo.put("point_code2", cut_jo.getString("full_point_code"));
|
||||||
|
jo.put("vehicle_code", parent_container_name);
|
||||||
|
jo.put("product_area", cool_ivt.getString("product_area"));
|
||||||
|
jo.put("task_type", "010302");
|
||||||
|
} else {
|
||||||
|
jo.put("point_code1", cool_ivt.getString("full_point_code"));
|
||||||
|
jo.put("point_code2", cut_jo.getString("full_point_code"));
|
||||||
|
jo.put("point_code3", cut_jo.getString("empty_point_code"));
|
||||||
|
jo.put("point_code4", cool_ivt.getString("empty_point_code"));
|
||||||
|
jo.put("vehicle_code", parent_container_name);
|
||||||
|
jo.put("vehicle_code2", cut_jo.getString("empty_vehicle_code"));
|
||||||
|
jo.put("product_area", cool_ivt.getString("product_area"));
|
||||||
|
jo.put("task_type", "010301");
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractAcsTask task = new CoolCutTask();
|
||||||
|
task_id = task.createTask(jo);
|
||||||
|
|
||||||
|
//生成半成品出库单据
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
|
||||||
|
JSONObject jsonCool = new JSONObject();
|
||||||
|
jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
|
||||||
|
jsonCool.put("io_type", "1");
|
||||||
|
jsonCool.put("material_id", mater_jo.getString("material_id"));
|
||||||
|
jsonCool.put("pcsn", parent_container_name);
|
||||||
|
jsonCool.put("bill_status", "10");
|
||||||
|
jsonCool.put("task_id", task_id);
|
||||||
|
jsonCool.put("qty_unit_id", "1");
|
||||||
|
jsonCool.put("start_point_code", cool_ivt.getString("full_point_code"));
|
||||||
|
jsonCool.put("end_point_code", cut_jo.getString("full_point_code"));
|
||||||
|
jsonCool.put("create_mode", "03");
|
||||||
|
jsonCool.put("create_id", "2");
|
||||||
|
jsonCool.put("create_name", "MES用户");
|
||||||
|
jsonCool.put("create_time", DateUtil.now());
|
||||||
|
jsonCool.put("update_optid", currentUserId);
|
||||||
|
jsonCool.put("update_optname", currentUsername);
|
||||||
|
jsonCool.put("update_time", DateUtil.now());
|
||||||
|
jsonCool.put("confirm_optid", currentUserId);
|
||||||
|
jsonCool.put("confirm_optname", currentUsername);
|
||||||
|
jsonCool.put("confirm_time", DateUtil.now());
|
||||||
|
WQLObject.getWQLObject("ST_IVT_CoolRegionIO").insert(jsonCool);
|
||||||
|
|
||||||
//创建任务,判断目的点是否存在空轴,存在创建4个点的任务,不存在则创建两个点任务
|
|
||||||
String task_id = "";
|
|
||||||
|
|
||||||
JSONObject jo = new JSONObject();
|
|
||||||
if (StrUtil.isEmpty(cut_jo.getString("empty_vehicle_code"))) {
|
|
||||||
jo.put("point_code1", cool_ivt.getString("full_point_code"));
|
|
||||||
jo.put("point_code2", cut_jo.getString("full_point_code"));
|
|
||||||
jo.put("vehicle_code", parent_container_name);
|
|
||||||
jo.put("product_area", cool_ivt.getString("product_area"));
|
|
||||||
jo.put("task_type", "010302");
|
|
||||||
} else {
|
} else {
|
||||||
jo.put("point_code1", cool_ivt.getString("full_point_code"));
|
//生成一个改切出库任务
|
||||||
jo.put("point_code2", cut_jo.getString("full_point_code"));
|
|
||||||
jo.put("point_code3", cut_jo.getString("empty_point_code"));
|
//查询该箱子所在仓位
|
||||||
jo.put("point_code4", cool_ivt.getString("empty_point_code"));
|
String package_box_sn = plan_jo.getString("package_box_sn");
|
||||||
jo.put("vehicle_code", parent_container_name);
|
String restruct_container_name = plan_jo.getString("restruct_container_name");
|
||||||
jo.put("vehicle_code2", cut_jo.getString("empty_vehicle_code"));
|
|
||||||
jo.put("product_area", cool_ivt.getString("product_area"));
|
//查询该包装关系
|
||||||
jo.put("task_type", "010301");
|
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("container_name = '"+restruct_container_name+"'").uniqueResult(0);
|
||||||
|
JSONObject struct = WQLObject.getWQLObject("st_ivt_structattr").query("storagevehicle_code = '" + package_box_sn + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(struct)) {
|
||||||
|
throw new BadRequestException("该箱子已出库,不在库内!");
|
||||||
|
}
|
||||||
|
if (!struct.getString("lock_type").equals("1")) {
|
||||||
|
throw new BadRequestException("该木箱正在出库中!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//插入主表、明细、分配
|
||||||
|
JSONObject mst_jo = new JSONObject();
|
||||||
|
mst_jo.put("biz_date", DateUtil.now());
|
||||||
|
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);
|
||||||
|
mst_jo.put("stor_id", stor.getString("stor_id"));
|
||||||
|
mst_jo.put("total_qty", "0");
|
||||||
|
mst_jo.put("bill_status", "10");
|
||||||
|
|
||||||
|
JSONArray rows = new JSONArray();
|
||||||
|
JSONObject dtl = new JSONObject();
|
||||||
|
//查询该物料
|
||||||
|
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + sub_jo.getString("product_name") + "'").uniqueResult(0);
|
||||||
|
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);
|
||||||
|
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"));
|
||||||
|
rows.add(dtl);
|
||||||
|
mst_jo.put("tableData",rows);
|
||||||
|
mst_jo.put("user","mes");
|
||||||
|
String iostorinv_id = checkOutBillService.insertDtl(mst_jo);
|
||||||
|
|
||||||
|
//调用自动分配
|
||||||
|
JSONObject out_jo = new JSONObject();
|
||||||
|
out_jo.put("iostorinv_id",iostorinv_id);
|
||||||
|
checkOutBillService.allDiv(out_jo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractAcsTask task = new CoolCutTask();
|
|
||||||
task_id = task.createTask(jo);
|
|
||||||
|
|
||||||
//生成半成品出库单据
|
|
||||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
|
||||||
|
|
||||||
JSONObject jsonCool = new JSONObject();
|
|
||||||
jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
|
|
||||||
jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
|
|
||||||
jsonCool.put("io_type", "1");
|
|
||||||
jsonCool.put("material_id", mater_jo.getString("material_id"));
|
|
||||||
jsonCool.put("pcsn", parent_container_name);
|
|
||||||
jsonCool.put("bill_status", "10");
|
|
||||||
jsonCool.put("task_id", task_id);
|
|
||||||
jsonCool.put("qty_unit_id", "1");
|
|
||||||
jsonCool.put("start_point_code", cool_ivt.getString("full_point_code"));
|
|
||||||
jsonCool.put("end_point_code", cut_jo.getString("full_point_code"));
|
|
||||||
jsonCool.put("create_mode", "03");
|
|
||||||
jsonCool.put("create_id", "2");
|
|
||||||
jsonCool.put("create_name", "MES用户");
|
|
||||||
jsonCool.put("create_time", DateUtil.now());
|
|
||||||
jsonCool.put("update_optid", currentUserId);
|
|
||||||
jsonCool.put("update_optname", currentUsername);
|
|
||||||
jsonCool.put("update_time", DateUtil.now());
|
|
||||||
jsonCool.put("confirm_optid", currentUserId);
|
|
||||||
jsonCool.put("confirm_optname", currentUsername);
|
|
||||||
jsonCool.put("confirm_time", DateUtil.now());
|
|
||||||
WQLObject.getWQLObject("ST_IVT_CoolRegionIO").insert(jsonCool);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//生成一个改切出库任务
|
|
||||||
|
|
||||||
//查询该箱子所在仓位
|
|
||||||
String package_box_sn = plan_jo.getString("package_box_sn");
|
|
||||||
String restruct_container_name = plan_jo.getString("restruct_container_name");
|
|
||||||
|
|
||||||
//查询该包装关系
|
|
||||||
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("container_name = '"+restruct_container_name+"'").uniqueResult(0);
|
|
||||||
JSONObject struct = WQLObject.getWQLObject("st_ivt_structattr").query("storagevehicle_code = '" + package_box_sn + "'").uniqueResult(0);
|
|
||||||
if (ObjectUtil.isEmpty(struct)) {
|
|
||||||
throw new BadRequestException("该箱子已出库,不在库内!");
|
|
||||||
}
|
|
||||||
if (!struct.getString("lock_type").equals("1")) {
|
|
||||||
throw new BadRequestException("该木箱正在出库中!");
|
|
||||||
}
|
|
||||||
|
|
||||||
//插入主表、明细、分配
|
|
||||||
JSONObject mst_jo = new JSONObject();
|
|
||||||
mst_jo.put("biz_date", DateUtil.now());
|
|
||||||
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);
|
|
||||||
mst_jo.put("stor_id", stor.getString("stor_id"));
|
|
||||||
mst_jo.put("total_qty", "0");
|
|
||||||
mst_jo.put("bill_status", "10");
|
|
||||||
|
|
||||||
JSONArray rows = new JSONArray();
|
|
||||||
JSONObject dtl = new JSONObject();
|
|
||||||
//查询该物料
|
|
||||||
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + sub_jo.getString("product_name") + "'").uniqueResult(0);
|
|
||||||
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);
|
|
||||||
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"));
|
|
||||||
rows.add(dtl);
|
|
||||||
mst_jo.put("tableData",rows);
|
|
||||||
mst_jo.put("user","mes");
|
|
||||||
String iostorinv_id = checkOutBillService.insertDtl(mst_jo);
|
|
||||||
|
|
||||||
//调用自动分配
|
|
||||||
JSONObject out_jo = new JSONObject();
|
|
||||||
out_jo.put("iostorinv_id",iostorinv_id);
|
|
||||||
checkOutBillService.allDiv(out_jo);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result.put("RTYPE", "S");
|
result.put("RTYPE", "S");
|
||||||
result.put("RTMSG", "操作成功!");
|
result.put("RTMSG", "操作成功!");
|
||||||
result.put("RTOAL", 1);
|
result.put("RTOAL", 1);
|
||||||
@@ -614,54 +618,56 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
|||||||
public JSONObject childRollCutStartComp(JSONArray param) {
|
public JSONObject childRollCutStartComp(JSONArray param) {
|
||||||
log.info("childRollCutStartComp接口输入参数为:-------------------" + param.toString());
|
log.info("childRollCutStartComp接口输入参数为:-------------------" + param.toString());
|
||||||
|
|
||||||
String Status = param.getJSONObject(0).getString("Status");
|
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")){
|
if (Status.equals("1")){
|
||||||
//更新分切计划表状态
|
//更新分切计划表状态
|
||||||
for (int i = 0; i < param.size(); i++) {
|
for (int i = 0; i < param.size(); i++) {
|
||||||
JSONObject row = param.getJSONObject(i);
|
JSONObject row = param.getJSONObject(i);
|
||||||
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '"+row.getString("ContainerGroup")+"'").uniqueResult(0);
|
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '"+row.getString("ContainerGroup")+"'").uniqueResult(0);
|
||||||
plan_jo.put("status","05");
|
plan_jo.put("status","05");
|
||||||
WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo);
|
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){
|
if (Status.equals("2")){
|
||||||
JSONObject jo = new JSONObject();
|
String ResourceName = param.getJSONObject(0).getString("ResourceName");
|
||||||
jo.put("point_code",up_point_code);
|
JSONObject cut_jo = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("ext_code = '"+ResourceName+"'").uniqueResult(0);
|
||||||
jo.put("cut_rows",up_rows);
|
String up_point_code = cut_jo.getString("up_point_code");
|
||||||
jo.put("is_last","0");
|
String down_point_code = cut_jo.getString("down_point_code");
|
||||||
outService.confirm(jo);
|
|
||||||
}
|
JSONArray up_rows = new JSONArray();
|
||||||
if (down_rows.size()>0){
|
JSONArray down_rows = new JSONArray();
|
||||||
JSONObject jo = new JSONObject();
|
for (int i = 0; i < param.size(); i++) {
|
||||||
jo.put("point_code",down_point_code);
|
JSONObject row = param.getJSONObject(i);
|
||||||
jo.put("cut_rows",down_rows);
|
//查询对应的分切计划
|
||||||
jo.put("is_last","0");
|
JSONObject plan_jo = WQLObject.getWQLObject("pdm_bi_slittingproductionplan").query("container_name = '"+row.getString("ContainerGroup")+"'").uniqueResult(0);
|
||||||
outService.confirm(jo);
|
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();
|
JSONObject result = new JSONObject();
|
||||||
result.put("RTYPE", "S");
|
result.put("RTYPE", "S");
|
||||||
result.put("RTMSG", "操作成功!");
|
result.put("RTMSG", "操作成功!");
|
||||||
@@ -682,70 +688,72 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
|||||||
public JSONObject childRollPackComplete(JSONObject param) {
|
public JSONObject childRollPackComplete(JSONObject param) {
|
||||||
log.info("childRollPackComplete接口输入参数为:-------------------" + param.toString());
|
log.info("childRollPackComplete接口输入参数为:-------------------" + param.toString());
|
||||||
|
|
||||||
String isUnPlanProductionBox = param.getString("isUnPlanProductionBox"); // 生产订单
|
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||||
String QuanlityInBox = param.getString("QuanlityInBox"); // 产品编码
|
if (StrUtil.equals(is_mesTolms, "1")) {
|
||||||
String BoxWeight = param.getString("BoxWeight"); // 产品名称
|
String isUnPlanProductionBox = param.getString("isUnPlanProductionBox"); // 生产订单
|
||||||
String QualityGuaranPeriod = param.getString("QualityGuaranPeriod"); // 分切机台编码
|
String QuanlityInBox = param.getString("QuanlityInBox"); // 产品编码
|
||||||
String ProductName = param.getString("ProductName"); // 来源卷位置
|
String BoxWeight = param.getString("BoxWeight"); // 产品名称
|
||||||
String Description = param.getString("Description"); // 来源卷位置
|
String QualityGuaranPeriod = param.getString("QualityGuaranPeriod"); // 分切机台编码
|
||||||
String DateOfFGInbound = param.getString("DateOfFGInbound"); // 来源卷位置
|
String ProductName = param.getString("ProductName"); // 来源卷位置
|
||||||
String box_type = param.getString("Attribute1"); // 木箱料号
|
String Description = param.getString("Description"); // 来源卷位置
|
||||||
|
String DateOfFGInbound = param.getString("DateOfFGInbound"); // 来源卷位置
|
||||||
|
String box_type = param.getString("Attribute1"); // 木箱料号
|
||||||
|
|
||||||
JSONArray details = param.getJSONArray("details");
|
JSONArray details = param.getJSONArray("details");
|
||||||
|
|
||||||
for (int i = 0; i < details.size(); i++) {
|
for (int i = 0; i < details.size(); i++) {
|
||||||
JSONObject detail = details.getJSONObject(i);
|
JSONObject detail = details.getJSONObject(i);
|
||||||
|
|
||||||
String PackageBoxSN = detail.getString("PackageBoxSN"); // 分切订单类型
|
String PackageBoxSN = detail.getString("PackageBoxSN"); // 分切订单类型
|
||||||
String ContainerName = detail.getString("ContainerName"); // 子卷号
|
String ContainerName = detail.getString("ContainerName"); // 子卷号
|
||||||
String SaleOrderName = detail.getString("SaleOrderName"); // 产品编码
|
String SaleOrderName = detail.getString("SaleOrderName"); // 产品编码
|
||||||
String CustomerName = detail.getString("CustomerName"); // 产品名称
|
String CustomerName = detail.getString("CustomerName"); // 产品名称
|
||||||
String CustomerDescription = detail.getString("CustomerDescription"); // 来源卷位置
|
String CustomerDescription = detail.getString("CustomerDescription"); // 来源卷位置
|
||||||
String Width = detail.getString("Width"); // 分切机台编码
|
String Width = detail.getString("Width"); // 分切机台编码
|
||||||
String Thickness = detail.getString("Thickness"); // 分切组
|
String Thickness = detail.getString("Thickness"); // 分切组
|
||||||
String MassPerUnitArea = detail.getString("MassPerUnitArea"); // 生产顺序
|
String MassPerUnitArea = detail.getString("MassPerUnitArea"); // 生产顺序
|
||||||
String NetWeight = detail.getString("NetWeight"); // 生产订单
|
String NetWeight = detail.getString("NetWeight"); // 生产订单
|
||||||
String Length = detail.getString("Length");
|
String Length = detail.getString("Length");
|
||||||
String DateOfProduction = detail.getString("DateOfProduction");
|
String DateOfProduction = detail.getString("DateOfProduction");
|
||||||
String isUnPlanProduction = detail.getString("isUnPlanProduction");
|
String isUnPlanProduction = detail.getString("isUnPlanProduction");
|
||||||
String UnPlanProductProperty1 = detail.getString("UnPlanProductProperty1");
|
String UnPlanProductProperty1 = detail.getString("UnPlanProductProperty1");
|
||||||
String UnPlanProductProperty2 = detail.getString("UnPlanProductProperty2");
|
String UnPlanProductProperty2 = detail.getString("UnPlanProductProperty2");
|
||||||
String UnPlanProductProperty3 = detail.getString("UnPlanProductProperty3");
|
String UnPlanProductProperty3 = detail.getString("UnPlanProductProperty3");
|
||||||
String sap_pcsn = detail.getString("Attribute1");//SAP批次
|
String sap_pcsn = detail.getString("Attribute1");//SAP批次
|
||||||
|
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId());
|
jo.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
jo.put("package_box_sn", PackageBoxSN);
|
jo.put("package_box_sn", PackageBoxSN);
|
||||||
jo.put("sap_pcsn", sap_pcsn);
|
jo.put("sap_pcsn", sap_pcsn);
|
||||||
jo.put("box_type", box_type);
|
jo.put("box_type", box_type);
|
||||||
jo.put("quanlity_in_box", QuanlityInBox);
|
jo.put("quanlity_in_box", QuanlityInBox);
|
||||||
jo.put("box_weight", BoxWeight);
|
jo.put("box_weight", BoxWeight);
|
||||||
jo.put("quality_guaran_period", QualityGuaranPeriod);
|
jo.put("quality_guaran_period", QualityGuaranPeriod);
|
||||||
jo.put("sale_order_name", SaleOrderName);
|
jo.put("sale_order_name", SaleOrderName);
|
||||||
jo.put("customer_name", CustomerName);
|
jo.put("customer_name", CustomerName);
|
||||||
jo.put("customer_description", CustomerDescription);
|
jo.put("customer_description", CustomerDescription);
|
||||||
jo.put("product_name", ProductName);
|
jo.put("product_name", ProductName);
|
||||||
jo.put("product_description", Description);
|
jo.put("product_description", Description);
|
||||||
jo.put("date_of_FG_inbound", DateOfFGInbound);
|
jo.put("date_of_FG_inbound", DateOfFGInbound);
|
||||||
jo.put("container_name", ContainerName);
|
jo.put("container_name", ContainerName);
|
||||||
jo.put("width", Width);
|
jo.put("width", Width);
|
||||||
jo.put("thickness", Thickness);
|
jo.put("thickness", Thickness);
|
||||||
jo.put("mass_per_unit_area", MassPerUnitArea);
|
jo.put("mass_per_unit_area", MassPerUnitArea);
|
||||||
jo.put("net_weight", NetWeight);
|
jo.put("net_weight", NetWeight);
|
||||||
jo.put("length", Length);
|
jo.put("length", Length);
|
||||||
jo.put("date_of_production", DateOfProduction);
|
jo.put("date_of_production", DateOfProduction);
|
||||||
jo.put("is_un_plan_production", isUnPlanProduction);
|
jo.put("is_un_plan_production", isUnPlanProduction);
|
||||||
jo.put("un_plan_product_property1", UnPlanProductProperty1);
|
jo.put("un_plan_product_property1", UnPlanProductProperty1);
|
||||||
jo.put("un_plan_product_property2", UnPlanProductProperty2);
|
jo.put("un_plan_product_property2", UnPlanProductProperty2);
|
||||||
jo.put("un_plan_product_property3", UnPlanProductProperty3);
|
jo.put("un_plan_product_property3", UnPlanProductProperty3);
|
||||||
jo.put("status", "0");
|
jo.put("status", "0");
|
||||||
jo.put("create_id", "1");
|
jo.put("create_id", "1");
|
||||||
jo.put("create_name", "管理员");
|
jo.put("create_name", "管理员");
|
||||||
jo.put("create_time", DateUtil.now());
|
jo.put("create_time", DateUtil.now());
|
||||||
WQLObject tab = WQLObject.getWQLObject("PDM_BI_SubPackageRelation");
|
WQLObject tab = WQLObject.getWQLObject("PDM_BI_SubPackageRelation");
|
||||||
tab.insert(jo);
|
tab.insert(jo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("RTYPE", "S");
|
result.put("RTYPE", "S");
|
||||||
result.put("RTMSG", "操作成功!");
|
result.put("RTMSG", "操作成功!");
|
||||||
@@ -765,6 +773,11 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
|||||||
@Override
|
@Override
|
||||||
public JSONObject inventoryTransferInfoSync(JSONObject param) {
|
public JSONObject inventoryTransferInfoSync(JSONObject param) {
|
||||||
log.info("inventoryTransferInfoSync接口输入参数为:-------------------" + param.toString());
|
log.info("inventoryTransferInfoSync接口输入参数为:-------------------" + param.toString());
|
||||||
|
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||||
|
if (StrUtil.equals(is_mesTolms, "1")) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("RTYPE", "S");
|
result.put("RTYPE", "S");
|
||||||
result.put("RTMSG", "操作成功!");
|
result.put("RTMSG", "操作成功!");
|
||||||
@@ -784,6 +797,12 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
|||||||
@Override
|
@Override
|
||||||
public JSONObject childRollInfoUpdate(JSONObject param) {
|
public JSONObject childRollInfoUpdate(JSONObject param) {
|
||||||
log.info("childRollInfoUpdate接口输入参数为:-------------------" + param.toString());
|
log.info("childRollInfoUpdate接口输入参数为:-------------------" + param.toString());
|
||||||
|
|
||||||
|
String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||||
|
if (StrUtil.equals(is_mesTolms, "1")) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("RTYPE", "S");
|
result.put("RTYPE", "S");
|
||||||
result.put("RTMSG", "操作成功!");
|
result.put("RTMSG", "操作成功!");
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.st.inbill.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.modules.logging.annotation.Log;
|
||||||
|
import org.nl.wms.st.inbill.service.InchargeService;
|
||||||
|
import org.nl.wms.st.vehiclebill.service.InEmptyvehiclerecordService;
|
||||||
|
import org.nl.wms.st.vehiclebill.service.dto.EmptyvehiclerecordDto;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @date 2022-08-12
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Api(tags = "入库冲销")
|
||||||
|
@RequestMapping("/api/incharge")
|
||||||
|
@Slf4j
|
||||||
|
public class InchargeController {
|
||||||
|
|
||||||
|
private final InchargeService inchargeService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("查询入库冲销")
|
||||||
|
@ApiOperation("查询入库冲销")
|
||||||
|
//@PreAuthorize("@el.check('emptyvehiclerecord:list')")
|
||||||
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||||
|
return new ResponseEntity<>(inchargeService.queryAll(whereJson, page), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增入库冲销")
|
||||||
|
@ApiOperation("新增入库冲销")
|
||||||
|
//@PreAuthorize("@el.check('emptyvehiclerecord:add')")
|
||||||
|
public ResponseEntity<Object> create(@Validated @RequestBody EmptyvehiclerecordDto dto) {
|
||||||
|
inchargeService.create(dto);
|
||||||
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Log("修改入库冲销")
|
||||||
|
@ApiOperation("修改入库冲销")
|
||||||
|
//@PreAuthorize("@el.check('emptyvehiclerecord:edit')")
|
||||||
|
public ResponseEntity<Object> update(@Validated @RequestBody EmptyvehiclerecordDto dto) {
|
||||||
|
inchargeService.update(dto);
|
||||||
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("删除入库冲销")
|
||||||
|
@ApiOperation("删除入库冲销")
|
||||||
|
//@PreAuthorize("@el.check('emptyvehiclerecord:del')")
|
||||||
|
@DeleteMapping
|
||||||
|
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||||
|
inchargeService.deleteAll(ids);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/charge")
|
||||||
|
@Log("冲销")
|
||||||
|
@ApiOperation("冲销")
|
||||||
|
public ResponseEntity<Object> charge(@RequestBody JSONObject whereJson) {
|
||||||
|
inchargeService.charge(whereJson);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.st.inbill.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.nl.wms.st.vehiclebill.service.dto.EmptyvehiclerecordDto;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @description 服务接口
|
||||||
|
* @date 2022-08-12
|
||||||
|
**/
|
||||||
|
public interface InchargeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据分页
|
||||||
|
*
|
||||||
|
* @param whereJson 条件
|
||||||
|
* @param page 分页参数
|
||||||
|
* @return Map<String, Object>
|
||||||
|
*/
|
||||||
|
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有数据不分页
|
||||||
|
*
|
||||||
|
* @param whereJson 条件参数
|
||||||
|
* @return List<EmptyvehiclerecordDto>
|
||||||
|
*/
|
||||||
|
List<EmptyvehiclerecordDto> queryAll(Map whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查询
|
||||||
|
*
|
||||||
|
* @param record_uuid ID
|
||||||
|
* @return Emptyvehiclerecord
|
||||||
|
*/
|
||||||
|
EmptyvehiclerecordDto findById(Long record_uuid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码查询
|
||||||
|
*
|
||||||
|
* @param code code
|
||||||
|
* @return Emptyvehiclerecord
|
||||||
|
*/
|
||||||
|
EmptyvehiclerecordDto findByCode(String code);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建
|
||||||
|
*
|
||||||
|
* @param dto /
|
||||||
|
*/
|
||||||
|
void create(EmptyvehiclerecordDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*
|
||||||
|
* @param dto /
|
||||||
|
*/
|
||||||
|
void update(EmptyvehiclerecordDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多选删除
|
||||||
|
*
|
||||||
|
* @param ids /
|
||||||
|
*/
|
||||||
|
void deleteAll(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 冲销
|
||||||
|
*
|
||||||
|
* @param whereJson /
|
||||||
|
*/
|
||||||
|
void charge(JSONObject whereJson);
|
||||||
|
}
|
||||||
@@ -0,0 +1,307 @@
|
|||||||
|
|
||||||
|
package org.nl.wms.st.inbill.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
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.common.utils.SecurityUtils;
|
||||||
|
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.modules.wql.util.WqlUtil;
|
||||||
|
import org.nl.wms.sch.service.PointService;
|
||||||
|
import org.nl.wms.st.inbill.service.InchargeService;
|
||||||
|
import org.nl.wms.st.inbill.service.StorPublicService;
|
||||||
|
import org.nl.wms.st.vehiclebill.service.InEmptyvehiclerecordService;
|
||||||
|
import org.nl.wms.st.vehiclebill.service.dto.EmptyvehiclerecordDto;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Liuxy
|
||||||
|
* @description 服务实现
|
||||||
|
* @date 2022-08-12
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class InchargeServiceImpl implements InchargeService {
|
||||||
|
|
||||||
|
private final StorPublicService storPublicService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||||
|
String bill_code = MapUtil.getStr(whereJson, "bill_code");
|
||||||
|
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
map.put("flag", "1");
|
||||||
|
map.put("stor_id", MapUtil.getStr(whereJson, "stor_id"));
|
||||||
|
map.put("begin_time", MapUtil.getStr(whereJson, "begin_time"));
|
||||||
|
map.put("end_time", MapUtil.getStr(whereJson, "end_time"));
|
||||||
|
map.put("create_mode", MapUtil.getStr(whereJson, "create_mode"));
|
||||||
|
map.put("bill_type", MapUtil.getStr(whereJson, "bill_type"));
|
||||||
|
if (ObjectUtil.isNotEmpty(bill_code)) map.put("bill_code","%"+bill_code + "%");
|
||||||
|
|
||||||
|
JSONObject json = WQL.getWO("QST_IVT_INCHARGE").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ios.input_time DESC");
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EmptyvehiclerecordDto> queryAll(Map whereJson) {
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||||
|
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(EmptyvehiclerecordDto.class);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmptyvehiclerecordDto findById(Long record_uuid) {
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||||
|
JSONObject json = wo.query("record_uuid = '" + record_uuid + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(json)) {
|
||||||
|
return json.toJavaObject(EmptyvehiclerecordDto.class);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EmptyvehiclerecordDto findByCode(String code) {
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||||
|
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(json)) {
|
||||||
|
return json.toJavaObject(EmptyvehiclerecordDto.class);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void create(EmptyvehiclerecordDto dto) {
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
|
String now = DateUtil.now();
|
||||||
|
|
||||||
|
String start_point_code = dto.getStart_point_code();
|
||||||
|
String next_point_code = dto.getNext_point_code();
|
||||||
|
// 判断起点是否为空! 入库起点不能为空
|
||||||
|
if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("起点不能为空");
|
||||||
|
// 根据点位编码找到对应的所属区域
|
||||||
|
Long start_region_id = pointTab.query("point_code = '" + start_point_code + "'").uniqueResult(0).getLongValue("region_id");
|
||||||
|
if (ObjectUtil.isNotEmpty(next_point_code)) {
|
||||||
|
Long end_region_id = pointTab.query("point_code = '" + next_point_code + "'").uniqueResult(0).getLongValue("region_id");
|
||||||
|
dto.setEnd_region_id(end_region_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
dto.setRecord_uuid(IdUtil.getSnowflake(1, 1).nextId());
|
||||||
|
dto.setCreate_id(currentUserId);
|
||||||
|
dto.setCreate_name(nickName);
|
||||||
|
dto.setUpdate_optid(currentUserId);
|
||||||
|
dto.setUpdate_optname(nickName);
|
||||||
|
dto.setUpdate_time(now);
|
||||||
|
dto.setCreate_time(now);
|
||||||
|
dto.setBill_code(CodeUtil.getNewCode("KZJ_BILL_CODE"));
|
||||||
|
dto.setIo_type("0");
|
||||||
|
dto.setBill_status("10");
|
||||||
|
dto.setStart_region_id(start_region_id);
|
||||||
|
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||||
|
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||||
|
wo.insert(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void update(EmptyvehiclerecordDto dto) {
|
||||||
|
EmptyvehiclerecordDto entity = this.findById(dto.getRecord_uuid());
|
||||||
|
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
|
|
||||||
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
|
||||||
|
String start_point_code = dto.getStart_point_code();
|
||||||
|
String next_point_code = dto.getNext_point_code();
|
||||||
|
// 判断起点是否为空! 入库起点不能为空
|
||||||
|
if (ObjectUtil.isEmpty(start_point_code)) throw new BadRequestException("起点不能为空");
|
||||||
|
// 根据点位编码找到对应的所属区域
|
||||||
|
Long start_region_id = pointTab.query("point_code = '" + start_point_code + "'").uniqueResult(0).getLongValue("region_id");
|
||||||
|
if (ObjectUtil.isNotEmpty(next_point_code)) {
|
||||||
|
Long end_region_id = pointTab.query("point_code = '" + next_point_code + "'").uniqueResult(0).getLongValue("region_id");
|
||||||
|
dto.setEnd_region_id(end_region_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
|
|
||||||
|
String now = DateUtil.now();
|
||||||
|
dto.setUpdate_time(now);
|
||||||
|
dto.setStart_region_id(start_region_id);
|
||||||
|
dto.setUpdate_optid(currentUserId);
|
||||||
|
dto.setUpdate_optname(nickName);
|
||||||
|
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||||
|
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||||
|
wo.update(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteAll(Long[] ids) {
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
|
String now = DateUtil.now();
|
||||||
|
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("st_ivt_emptyvehiclerecord");
|
||||||
|
for (Long record_uuid : ids) {
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("record_uuid", String.valueOf(record_uuid));
|
||||||
|
param.put("is_delete", "1");
|
||||||
|
param.put("update_optid", currentUserId);
|
||||||
|
param.put("update_optname", nickName);
|
||||||
|
param.put("update_time", now);
|
||||||
|
wo.update(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void charge(JSONObject whereJson) {
|
||||||
|
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库主表
|
||||||
|
WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl"); // 出入库明细表
|
||||||
|
WQLObject disTab = WQLObject.getWQLObject("ST_IVT_IOStorInvDis"); // 出入库分配表
|
||||||
|
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt"); // 仓位库存表
|
||||||
|
WQLObject attrTab = WQLObject.getWQLObject("ST_IVT_StructAttr"); // 仓位表
|
||||||
|
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
|
Long deptId = SecurityUtils.getDeptId();
|
||||||
|
|
||||||
|
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||||
|
|
||||||
|
// 根据入库单创建出库单
|
||||||
|
JSONObject jsonInMst = mstTab.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
JSONObject jsonOutMst = new JSONObject();
|
||||||
|
jsonOutMst.put("iostorinv_id", IdUtil.getSnowflake(1,1).nextId());
|
||||||
|
jsonOutMst.put("bill_code", CodeUtil.getNewCode("IO_CODE"));
|
||||||
|
jsonOutMst.put("io_type", "1");
|
||||||
|
jsonOutMst.put("buss_type", "1009");
|
||||||
|
jsonOutMst.put("bill_type", "1009");
|
||||||
|
jsonOutMst.put("biz_date", DateUtil.today());
|
||||||
|
jsonOutMst.put("stor_id", jsonInMst.getLongValue("stor_id"));
|
||||||
|
jsonOutMst.put("stor_code", jsonInMst.getString("stor_code"));
|
||||||
|
jsonOutMst.put("stor_name", jsonInMst.getString("stor_name"));
|
||||||
|
jsonOutMst.put("total_qty", jsonInMst.getDoubleValue("total_qty"));
|
||||||
|
jsonOutMst.put("total_weight", jsonInMst.getDoubleValue("total_weight"));
|
||||||
|
jsonOutMst.put("detail_count", jsonInMst.getIntValue("detail_count"));
|
||||||
|
jsonOutMst.put("bill_status", "40");
|
||||||
|
jsonOutMst.put("input_optid", currentUserId);
|
||||||
|
jsonOutMst.put("input_optname", nickName);
|
||||||
|
jsonOutMst.put("input_time", DateUtil.now());
|
||||||
|
jsonOutMst.put("update_optid", currentUserId);
|
||||||
|
jsonOutMst.put("update_optname", nickName);
|
||||||
|
jsonOutMst.put("update_time", DateUtil.now());
|
||||||
|
jsonOutMst.put("dis_optid", currentUserId);
|
||||||
|
jsonOutMst.put("dis_optname", nickName);
|
||||||
|
jsonOutMst.put("dis_time", DateUtil.now());
|
||||||
|
jsonOutMst.put("sysdeptid", deptId);
|
||||||
|
jsonOutMst.put("syscompanyid", deptId);
|
||||||
|
mstTab.insert(jsonOutMst);
|
||||||
|
|
||||||
|
// 根据入库明细生成出库明细
|
||||||
|
JSONArray inDtlArr = dtlTab.query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
|
||||||
|
for (int i = 0; i < inDtlArr.size(); i++) {
|
||||||
|
JSONObject json = inDtlArr.getJSONObject(i);
|
||||||
|
JSONObject jsonOutDtl = new JSONObject();
|
||||||
|
jsonOutDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1,1).nextId());
|
||||||
|
jsonOutDtl.put("iostorinv_id", jsonOutMst.getLongValue("iostorinv_id"));
|
||||||
|
jsonOutDtl.put("seq_no", json.getIntValue("seq_no"));
|
||||||
|
jsonOutDtl.put("material_id", json.getLongValue("material_id"));
|
||||||
|
jsonOutDtl.put("pcsn", json.getString("pcsn"));
|
||||||
|
jsonOutDtl.put("box_no", json.getString("box_no"));
|
||||||
|
jsonOutDtl.put("quality_scode", "01");
|
||||||
|
jsonOutDtl.put("bill_status", "40");
|
||||||
|
jsonOutDtl.put("qty_unit_id", json.getLongValue("qty_unit_id"));
|
||||||
|
jsonOutDtl.put("qty_unit_name", json.getString("qty_unit_name"));
|
||||||
|
jsonOutDtl.put("plan_qty", json.getDoubleValue("plan_qty"));
|
||||||
|
jsonOutDtl.put("source_billdtl_id", json.getLongValue("iostorinvdtl_id"));
|
||||||
|
// jsonOutDtl.put("source_bill_code", jsonInMst.getString("bill_code"));
|
||||||
|
jsonOutDtl.put("assign_qty", json.getDoubleValue("assign_qty"));
|
||||||
|
jsonOutDtl.put("unassign_qty", json.getDoubleValue("unassign_qty"));
|
||||||
|
jsonOutDtl.put("vbeln", json.getString("vbeln"));
|
||||||
|
jsonOutDtl.put("posnr", json.getString("posnr"));
|
||||||
|
dtlTab.insert(jsonOutDtl);
|
||||||
|
|
||||||
|
// 根据入库分配明细生成出库分配明细
|
||||||
|
JSONArray inDisArr = disTab.query("iostorinvdtl_id = '" + json.getString("iostorinvdtl_id") + "'").getResultJSONArray(0);
|
||||||
|
for (int j = 0; j < inDisArr.size(); j++) {
|
||||||
|
JSONObject json2 = inDisArr.getJSONObject(j);
|
||||||
|
JSONObject jsonOutDis = new JSONObject();
|
||||||
|
jsonOutDis.put("iostorinvdis_id", IdUtil.getSnowflake(1,1).nextId());
|
||||||
|
jsonOutDis.put("iostorinv_id", jsonOutMst.getLongValue("iostorinv_id"));
|
||||||
|
jsonOutDis.put("iostorinvdtl_id", jsonOutDtl.getLongValue("iostorinvdtl_id"));
|
||||||
|
jsonOutDis.put("seq_no", json2.getIntValue("seq_no"));
|
||||||
|
jsonOutDis.put("sect_id", json2.getLongValue("sect_id"));
|
||||||
|
jsonOutDis.put("sect_code", json2.getString("sect_code"));
|
||||||
|
jsonOutDis.put("sect_name", json2.getString("sect_name"));
|
||||||
|
jsonOutDis.put("struct_id", json2.getLongValue("struct_id"));
|
||||||
|
jsonOutDis.put("struct_code", json2.getString("struct_code"));
|
||||||
|
jsonOutDis.put("struct_name", json2.getString("struct_name"));
|
||||||
|
jsonOutDis.put("material_id", json2.getLongValue("material_id"));
|
||||||
|
jsonOutDis.put("pcsn", json2.getString("pcsn"));
|
||||||
|
jsonOutDis.put("box_no", json2.getString("box_no"));
|
||||||
|
jsonOutDis.put("quality_scode", "01");
|
||||||
|
// 如果是虚拟库区则将执行状态改为生成:01
|
||||||
|
if (StrUtil.equals(jsonOutDis.getString("sect_code"), "XN01")) {
|
||||||
|
jsonOutDis.put("work_status", "01");
|
||||||
|
} else {
|
||||||
|
jsonOutDis.put("work_status", "00");
|
||||||
|
}
|
||||||
|
jsonOutDis.put("qty_unit_id", json2.getLongValue("qty_unit_id"));
|
||||||
|
jsonOutDis.put("qty_unit_name", json2.getString("qty_unit_name"));
|
||||||
|
jsonOutDis.put("plan_qty", json2.getDoubleValue("plan_qty"));
|
||||||
|
jsonOutDis.put("real_qty", json2.getDoubleValue("real_qty"));
|
||||||
|
disTab.insert(jsonOutDis);
|
||||||
|
|
||||||
|
//更新库存
|
||||||
|
JSONObject jsonIvt = ivtTab.query("pcsn = '" + jsonOutDis.getString("pcsn") + "' and canuse_qty <> '0'").uniqueResult(0);
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("库存不存在");
|
||||||
|
|
||||||
|
jsonIvt.put("bill_type_scode", jsonOutMst.getString("bill_type"));
|
||||||
|
jsonIvt.put("inv_id", jsonOutMst.getString("iostorinv_id"));
|
||||||
|
jsonIvt.put("bill_code", jsonOutMst.getString("bill_code"));
|
||||||
|
jsonIvt.put("bill_table", "ST_IVT_IOStorInv");
|
||||||
|
jsonIvt.put("change_qty", json2.getDoubleValue("real_qty"));
|
||||||
|
storPublicService.IOStor(jsonIvt, "11");
|
||||||
|
|
||||||
|
// 锁定仓位
|
||||||
|
JSONObject jsonAttr = attrTab.query("struct_id = '" + jsonIvt.getString("struct_id") + "'").uniqueResult(0);
|
||||||
|
jsonAttr.put("lock_type", "3");
|
||||||
|
attrTab.update(jsonAttr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改入库单 是否冲销为 是
|
||||||
|
jsonInMst.put("is_writeoff", "1");
|
||||||
|
jsonInMst.put("writeoff_optid", currentUserId);
|
||||||
|
jsonInMst.put("writeoff_time", DateUtil.now());
|
||||||
|
mstTab.update(jsonInMst);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
[交易说明]
|
||||||
|
交易名: 入库冲销分页查询
|
||||||
|
所属模块:
|
||||||
|
功能简述:
|
||||||
|
版权所有:
|
||||||
|
表引用:
|
||||||
|
版本经历:
|
||||||
|
|
||||||
|
[数据库]
|
||||||
|
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||||
|
|
||||||
|
[IO定义]
|
||||||
|
#################################################
|
||||||
|
## 表字段对应输入参数
|
||||||
|
#################################################
|
||||||
|
输入.flag TYPEAS s_string
|
||||||
|
输入.begin_time TYPEAS s_string
|
||||||
|
输入.end_time TYPEAS s_string
|
||||||
|
输入.bill_code TYPEAS s_string
|
||||||
|
输入.stor_id TYPEAS s_string
|
||||||
|
输入.create_mode TYPEAS s_string
|
||||||
|
输入.bill_type TYPEAS s_string
|
||||||
|
|
||||||
|
|
||||||
|
[临时表]
|
||||||
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
|
|
||||||
|
[临时变量]
|
||||||
|
--所有中间过程变量均可在此处定义
|
||||||
|
|
||||||
|
[业务过程]
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 1、输入输出检查 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 2、主过程前处理 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# 3、业务主过程 #
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
IF 输入.flag = "1"
|
||||||
|
PAGEQUERY
|
||||||
|
SELECT
|
||||||
|
ios.*
|
||||||
|
FROM
|
||||||
|
ST_IVT_IOStorInv ios
|
||||||
|
WHERE
|
||||||
|
ios.is_delete = '0'
|
||||||
|
AND ios.io_type = '0'
|
||||||
|
AND ios.bill_status = '99'
|
||||||
|
AND ios.is_writeoff = '0'
|
||||||
|
AND ios.bill_type = '0002'
|
||||||
|
|
||||||
|
OPTION 输入.bill_code <> ""
|
||||||
|
ios.bill_code like 输入.bill_code
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.stor_id <> ""
|
||||||
|
ios.stor_id = 输入.stor_id
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.bill_type <> ""
|
||||||
|
ios.bill_type = 输入.bill_type
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.create_mode <> ""
|
||||||
|
ios.create_mode = 输入.create_mode
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.begin_time <> ""
|
||||||
|
ios.input_time >= 输入.begin_time
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
OPTION 输入.end_time <> ""
|
||||||
|
ios.input_time <= 输入.end_time
|
||||||
|
ENDOPTION
|
||||||
|
|
||||||
|
ENDSELECT
|
||||||
|
ENDPAGEQUERY
|
||||||
|
ENDIF
|
||||||
@@ -1732,6 +1732,72 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|||||||
// 调用接口回传
|
// 调用接口回传
|
||||||
new LmsToMesServiceImpl().childRollFGOutboundComplete(paramMesMst);
|
new LmsToMesServiceImpl().childRollFGOutboundComplete(paramMesMst);
|
||||||
}
|
}
|
||||||
|
// 手工出库
|
||||||
|
if (StrUtil.equals(bill_type, "1009")) {
|
||||||
|
// 1.回传sap
|
||||||
|
JSONArray paramSapMstArr = new JSONArray();
|
||||||
|
|
||||||
|
JSONObject paramSapMst = new JSONObject();
|
||||||
|
paramSapMst.put("ZACTION", "R");
|
||||||
|
paramSapMst.put("BUDAT", jo_mst.getString("biz_date"));
|
||||||
|
paramSapMst.put("ZZYGYF", jo_mst.getString("estimated_freight"));
|
||||||
|
paramSapMst.put("ZZYFGY", jo_mst.getString("trans_code"));
|
||||||
|
|
||||||
|
String vbeln = "";
|
||||||
|
|
||||||
|
JSONArray paramDtlArr = new JSONArray();
|
||||||
|
JSONArray dtlArr = wo_dtl.query("iostorinv_id = '" + jo_mst.getString("iostorinv_id") + "'").getResultJSONArray(0);
|
||||||
|
for (int i = 0; i < dtlArr.size(); i++) {
|
||||||
|
JSONArray paramDisArr = new JSONArray();
|
||||||
|
JSONObject json = dtlArr.getJSONObject(i);
|
||||||
|
JSONObject jsonMater = materTab.query("material_id = '" + json.getString("material_id") + "'").uniqueResult(0);
|
||||||
|
|
||||||
|
vbeln = json.getString("vbeln");
|
||||||
|
|
||||||
|
// 明细
|
||||||
|
JSONObject jsonDtl = new JSONObject();
|
||||||
|
jsonDtl.put("VBELN", json.getString("vbeln")); // 交货
|
||||||
|
paramSapMst.put("VBELN", json.getString("vbeln")); // 主表交货
|
||||||
|
jsonDtl.put("POSNR", json.getString("posnr")); // 项目
|
||||||
|
jsonDtl.put("MATNR", jsonMater.getString("material_code"));
|
||||||
|
|
||||||
|
// 分配明细
|
||||||
|
JSONArray disArr = wo_dis.query("iostorinvdtl_id = '" + json.getString("iostorinvdtl_id") + "'").getResultJSONArray(0);
|
||||||
|
for (int j = 0; j < disArr.size(); j++) {
|
||||||
|
JSONObject json2 = disArr.getJSONObject(j);
|
||||||
|
JSONObject jsonDis = new JSONObject();
|
||||||
|
|
||||||
|
JSONObject jsonSect = sectTab.query("sect_id = '" + json2.getString("sect_id") + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(jsonSect)) {
|
||||||
|
jsonDtl.put("LGORT", jsonSect.getString("ext_id")); // 明細储存地点
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject jsonSub = subTab.query("container_name = '" + json2.getString("pcsn") + "'").uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(jsonSub)) {
|
||||||
|
jsonDis.put("CHARG", jsonSub.getString("sap_pcsn")); // sap批次
|
||||||
|
}
|
||||||
|
jsonDis.put("VBELN", json.getString("vbeln")); // 交货
|
||||||
|
jsonDis.put("POSNR", json.getString("posnr")); // 项目
|
||||||
|
jsonDis.put("LFIMG", json2.getString("real_qty"));
|
||||||
|
jsonDis.put("VRKME", json.getString("qty_unit_name"));
|
||||||
|
jsonDis.put("PIKMG", json2.getString("real_qty"));
|
||||||
|
jsonDis.put("VRKMP", json2.getString("qty_unit_name"));
|
||||||
|
paramDisArr.add(jsonDis);
|
||||||
|
}
|
||||||
|
jsonDtl.put("CHARG_T", paramDisArr);
|
||||||
|
paramDtlArr.add(jsonDtl);
|
||||||
|
}
|
||||||
|
paramSapMst.put("ITEM", paramDtlArr);
|
||||||
|
paramSapMstArr.add(paramSapMst);
|
||||||
|
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("HEAD", paramSapMstArr);
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(vbeln)) {
|
||||||
|
// 调用接口回传
|
||||||
|
new LmsToSapServiceImpl().returnDelivery(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 改切出库
|
// 改切出库
|
||||||
if (StrUtil.equals(bill_type, "1003")) {
|
if (StrUtil.equals(bill_type, "1003")) {
|
||||||
|
|||||||
@@ -24,4 +24,12 @@ export function edit(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del }
|
export function charge(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/incharge/charge',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del, charge }
|
||||||
|
|||||||
@@ -67,24 +67,6 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="单据状态">
|
|
||||||
<el-select
|
|
||||||
v-model="query.bill_status"
|
|
||||||
clearable
|
|
||||||
size="mini"
|
|
||||||
placeholder="单据状态"
|
|
||||||
class="filter-item"
|
|
||||||
@change="crud.toQuery"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in dict.io_bill_status"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="业务类型">
|
<el-form-item label="业务类型">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="query.bill_type"
|
v-model="query.bill_type"
|
||||||
@@ -96,7 +78,7 @@
|
|||||||
@change="crud.toQuery"
|
@change="crud.toQuery"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dict.ST_INV_OUT_TYPE"
|
v-for="item in dict.ST_INV_IN_TYPE"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
@@ -111,13 +93,13 @@
|
|||||||
<el-button
|
<el-button
|
||||||
slot="right"
|
slot="right"
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
type="warning"
|
type="success"
|
||||||
:disabled="dis_flag"
|
:disabled="crud.selections.length !== 1"
|
||||||
icon="el-icon-check"
|
icon="el-icon-check"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="backConfirm"
|
@click="charge"
|
||||||
>
|
>
|
||||||
强制确认
|
冲销
|
||||||
</el-button>
|
</el-button>
|
||||||
</crudOperation>
|
</crudOperation>
|
||||||
<!--表格渲染-->
|
<!--表格渲染-->
|
||||||
@@ -130,8 +112,9 @@
|
|||||||
style="width: 100%;"
|
style="width: 100%;"
|
||||||
@selection-change="crud.selectionChangeHandler"
|
@selection-change="crud.selectionChangeHandler"
|
||||||
>
|
>
|
||||||
<el-table-column show-overflow-tooltip prop="bill_code" width="130" label="单据编码"/>
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column show-overflow-tooltip :formatter="stateFormat" width="100" prop="bill_status" label="单据状态" />
|
<el-table-column show-overflow-tooltip prop="bill_code" width="130" label="单据编码" />
|
||||||
|
<el-table-column show-overflow-tooltip :formatter="formatStatus" width="100" prop="bill_status" label="单据状态" />
|
||||||
<el-table-column prop="stor_name" label="仓库" width="100" />
|
<el-table-column prop="stor_name" label="仓库" width="100" />
|
||||||
<el-table-column show-overflow-tooltip prop="bill_type" :formatter="bill_typeFormat" label="业务类型" />
|
<el-table-column show-overflow-tooltip prop="bill_type" :formatter="bill_typeFormat" label="业务类型" />
|
||||||
<el-table-column show-overflow-tooltip width="135" prop="biz_date" label="业务日期" />
|
<el-table-column show-overflow-tooltip width="135" prop="biz_date" label="业务日期" />
|
||||||
@@ -175,9 +158,9 @@ export default {
|
|||||||
sort: 'id,desc',
|
sort: 'id,desc',
|
||||||
crudMethod: { ...crudInchargefrom },
|
crudMethod: { ...crudInchargefrom },
|
||||||
optShow: {
|
optShow: {
|
||||||
add: true,
|
add: false,
|
||||||
edit: true,
|
edit: false,
|
||||||
del: true,
|
del: false,
|
||||||
download: false,
|
download: false,
|
||||||
reset: false
|
reset: false
|
||||||
}
|
}
|
||||||
@@ -185,15 +168,12 @@ export default {
|
|||||||
},
|
},
|
||||||
mixins: [presenter(), header(), crud()],
|
mixins: [presenter(), header(), crud()],
|
||||||
// 数据字典
|
// 数据字典
|
||||||
dicts: ['ST_CREATE_MODE', 'ST_INV_OUT_TYPE'],
|
dicts: ['ST_CREATE_MODE', 'ST_INV_IN_TYPE', 'io_bill_status'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
permission: {
|
permission: {
|
||||||
},
|
},
|
||||||
billType: null,
|
storlist: []
|
||||||
storlist: [],
|
|
||||||
createtypelist: [],
|
|
||||||
statuslist: []
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -204,6 +184,22 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
[CRUD.HOOK.beforeRefresh]() {
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
return true
|
return true
|
||||||
|
},
|
||||||
|
charge() {
|
||||||
|
const _selectData = this.$refs.table.selection
|
||||||
|
crudInchargefrom.charge(_selectData[0]).then(res => {
|
||||||
|
this.crud.notify('操作完成!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
this.crud.toQuery()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
formatStatus(row) {
|
||||||
|
return this.dict.label.io_bill_status[row.bill_status]
|
||||||
|
},
|
||||||
|
bill_typeFormat(row) {
|
||||||
|
return this.dict.label.ST_INV_IN_TYPE[row.bill_type]
|
||||||
|
},
|
||||||
|
create_modeFormat(row) {
|
||||||
|
return this.dict.label.ST_CREATE_MODE[row.create_mode]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user