代码合并
This commit is contained in:
@@ -142,4 +142,7 @@ public class StructattrDto implements Serializable {
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 放置类型 */
|
||||
private String placement_type;
|
||||
}
|
||||
|
||||
@@ -168,17 +168,6 @@ public class StructattrServiceImpl implements StructattrService {
|
||||
dto.setStor_code(storattrDto.getStor_code());
|
||||
dto.setStor_name(storattrDto.getStor_name());
|
||||
|
||||
String storagevehicle_code = dto.getStoragevehicle_code();
|
||||
if (ObjectUtil.isNotEmpty(storagevehicle_code)) {
|
||||
WQLObject vehicleTab = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
|
||||
JSONObject obj = vehicleTab.query("storagevehicle_code = '" + storagevehicle_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(obj)) throw new BadRequestException("未发现载具号为【" + storagevehicle_code + "】的载具信息");
|
||||
|
||||
dto.setStoragevehicle_id(obj.getLong
|
||||
("storagevehicle_id"));
|
||||
dto.setStoragevehicle_type(obj.getString("storagevehicle_type"));
|
||||
}
|
||||
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
|
||||
Binary file not shown.
@@ -40,14 +40,6 @@ public class MesToLmsController {
|
||||
return new ResponseEntity<>(mesToLmsService.momRollFoilWeighing(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("test")
|
||||
@Log("MES获取AGV称重信息")
|
||||
@ApiOperation("MES获取AGV称重信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> test(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(mesToLmsService.test(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/momRollFoilComplete")
|
||||
@Log("MES执行下卷动作告诉LMS")
|
||||
@ApiOperation("MES执行下卷动作告诉LMS")
|
||||
|
||||
@@ -14,8 +14,6 @@ public interface MesToLmsService {
|
||||
*/
|
||||
JSONObject momRollFoilWeighing(JSONObject param);
|
||||
|
||||
JSONObject test(JSONObject param);
|
||||
|
||||
/**
|
||||
* MES执行下卷动作告诉LMS
|
||||
*/
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package org.nl.wms.ext.mes.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
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.mes.service.LmsToMesService;
|
||||
@@ -22,6 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
@Slf4j
|
||||
public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
|
||||
/**
|
||||
* LMS的PDA操作AGV下卷,AGV称重完成后AGV称重信息发送MES
|
||||
*
|
||||
@@ -218,6 +221,11 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
public JSONObject airSwellWithPaperTubeAssComplete(JSONObject param) {
|
||||
log.info("airSwellWithPaperTubeAssComplete接口输入参数为:-------------------"+param.toString());
|
||||
|
||||
String container_name = param.getString("container_name");
|
||||
if (StrUtil.isEmpty(container_name)){
|
||||
throw new BadRequestException("子卷号不能为空!");
|
||||
}
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
String isConnect = "1";
|
||||
if (StrUtil.equals("0", isConnect)) {
|
||||
@@ -227,7 +235,9 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
return result;
|
||||
}
|
||||
|
||||
JSONArray list = new JSONArray();
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("iContainerName",container_name);
|
||||
jo.put("iisAirSwellAssComplete",1);
|
||||
|
||||
// String url = acsUrl + api;
|
||||
String url = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_URL").getValue();
|
||||
@@ -235,7 +245,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
url = url+api;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(param))
|
||||
.body(String.valueOf(jo))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
log.info("airSwellWithPaperTubeAssComplete接口输出参数为:-------------------"+result.toString());
|
||||
@@ -310,6 +320,11 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
public JSONObject airSwellWithPaperTubeAssArrival(JSONObject param) {
|
||||
log.info("airSwellWithPaperTubeAssArrival接口输入参数为:-------------------"+param.toString());
|
||||
|
||||
String container_name = param.getString("container_name");
|
||||
if (StrUtil.isEmpty(container_name)){
|
||||
throw new BadRequestException("子卷号不能为空!");
|
||||
}
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
String isConnect = "1";
|
||||
if (StrUtil.equals("0", isConnect)) {
|
||||
@@ -319,7 +334,9 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
return result;
|
||||
}
|
||||
|
||||
JSONArray list = new JSONArray();
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("iContainerName",container_name);
|
||||
jo.put("iisAirSwellDeliveryComplete",1);
|
||||
|
||||
// String url = acsUrl + api;
|
||||
String url = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_URL").getValue();
|
||||
@@ -327,7 +344,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
url = url+api;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(param))
|
||||
.body(String.valueOf(jo))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
log.info("airSwellWithPaperTubeAssArrival接口输出参数为:-------------------"+result.toString());
|
||||
@@ -356,6 +373,8 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
public JSONObject childRollFGInboundComplete(JSONObject param) {
|
||||
log.info("childRollFGInboundComplete接口输入参数为:-------------------"+param.toString());
|
||||
|
||||
String PackageBoxSN = param.getString("PackageBoxSN");
|
||||
String User = param.getString("User");
|
||||
JSONObject result = new JSONObject();
|
||||
String isConnect = "1";
|
||||
if (StrUtil.equals("0", isConnect)) {
|
||||
@@ -365,7 +384,12 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
return result;
|
||||
}
|
||||
|
||||
JSONArray list = new JSONArray();
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("iPackageBoxSN",PackageBoxSN);
|
||||
jo.put("iSpec","FGPRODUCT");
|
||||
jo.put("iWarehouse","3");
|
||||
jo.put("iArrivalDate", DateUtil.now());
|
||||
jo.put("iUser", User);
|
||||
|
||||
// String url = acsUrl + api;
|
||||
String url = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_URL").getValue();
|
||||
@@ -402,6 +426,7 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
public JSONObject childRollFGOutboundComplete(JSONObject param) {
|
||||
log.info("childRollFGOutboundComplete接口输入参数为:-------------------"+param.toString());
|
||||
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
String isConnect = "1";
|
||||
if (StrUtil.equals("0", isConnect)) {
|
||||
|
||||
@@ -9,20 +9,32 @@ 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.core.bean.WQLObject;
|
||||
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
|
||||
import org.nl.wms.ext.mes.service.MesToLmsService;
|
||||
import org.nl.wms.log.LokiLog;
|
||||
import org.nl.wms.log.LokiLogType;
|
||||
import org.nl.wms.pda.mps.service.OutService;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.tasks.CoolCutTask;
|
||||
import org.nl.wms.st.inbill.service.CheckOutBillService;
|
||||
import org.nl.wms.pda.mps.service.impl.BakingServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import sun.security.krb5.internal.crypto.Des;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
|
||||
private final CheckOutBillService checkOutBillService;
|
||||
|
||||
private final OutService outService;
|
||||
|
||||
/**
|
||||
* 生箔烘箱:
|
||||
* 母卷批次创建信息发送智能物流(MES生箔工序Move In)
|
||||
@@ -159,49 +171,6 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.MES_TO_LMS)
|
||||
@Override
|
||||
public JSONObject test(JSONObject param) {
|
||||
log.info("momRollFoilStart接口输入参数为:-------------------" + param.toString());
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
try {
|
||||
String ContainerName = param.getString("ContainerName");
|
||||
String ResourceName = param.getString("ResourceName");
|
||||
String weight = param.getString("weight");
|
||||
//查询该母卷号、设备号对应的生箔工单
|
||||
JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + ContainerName + "' AND resource_name = '" + ResourceName + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(raw_jo)) {
|
||||
throw new BadRequestException("未查询到对应的生箔工单!");
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(weight)) {
|
||||
throw new BadRequestException("未输入重量!");
|
||||
}
|
||||
|
||||
raw_jo.put("productin_qty",weight);
|
||||
|
||||
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(raw_jo);
|
||||
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
result.put("RTOAL", 1);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* MES执行下卷动作告诉LMS
|
||||
*
|
||||
@@ -472,12 +441,155 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
@Override
|
||||
public JSONObject callNextAssAndMomRoll(JSONObject param) {
|
||||
log.info("callNextAssAndMomRoll接口输入参数为:-------------------" + param.toString());
|
||||
|
||||
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 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 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("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("full_point_code"));
|
||||
jo.put("point_code4", cool_ivt.getString("full_point_code"));
|
||||
jo.put("vehicle_code", parent_container_name);
|
||||
jo.put("vehicle_code2", cut_jo.getString("empty_vehicle_code"));
|
||||
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", currentUserId);
|
||||
jsonCool.put("create_name", currentUsername);
|
||||
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("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);
|
||||
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("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;
|
||||
}
|
||||
|
||||
@@ -492,6 +604,52 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
public JSONObject childRollCutStartComp(JSONArray param) {
|
||||
log.info("childRollCutStartComp接口输入参数为:-------------------" + param.toString());
|
||||
|
||||
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(row);
|
||||
}
|
||||
if (row.getString("ContainerPosition").equals("2")){
|
||||
down_rows.add(row);
|
||||
}
|
||||
}
|
||||
|
||||
if (up_rows.size()>0){
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("point_code",up_point_code);
|
||||
jo.put("cut_rows",up_rows);
|
||||
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);
|
||||
outService.confirm(jo);
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
@@ -543,7 +701,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jo.put("package_box_SN", PackageBoxSN);
|
||||
jo.put("package_box_sn", PackageBoxSN);
|
||||
jo.put("quanlity_in_box", QuanlityInBox);
|
||||
jo.put("box_weight", BoxWeight);
|
||||
jo.put("quality_guaran_period", QualityGuaranPeriod);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ShippingController {
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("套轴确认")
|
||||
@ApiOperation("套轴确认")
|
||||
@ApiOperation("配送确认")
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(shippingService.confirm(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -123,9 +123,8 @@ public class CasingServiceImpl implements CasingService {
|
||||
|
||||
//调用MES接口,通知MES已经套轴完成
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("ContainerName",row.getString("container_name"));
|
||||
jo.put("isAirSwellAssComplete",1);
|
||||
//lmsToMesService.airSwellWithPaperTubeAssComplete(jo);
|
||||
jo.put("container_name",row.getString("container_name"));
|
||||
lmsToMesService.airSwellWithPaperTubeAssComplete(jo);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class SubpackagerelationDto implements Serializable {
|
||||
private Long workorder_id;
|
||||
|
||||
/** 木箱唯一码 */
|
||||
private String package_box_SN;
|
||||
private String package_box_sn;
|
||||
|
||||
/** 箱内子卷数量 */
|
||||
private BigDecimal quanlity_in_box;
|
||||
|
||||
@@ -7,26 +7,29 @@ import lombok.Data;
|
||||
@Builder
|
||||
public class AcsTaskDto {
|
||||
//任务标识
|
||||
private String task_id;
|
||||
private String ext_task_id;
|
||||
//任务编码
|
||||
private String task_code;
|
||||
//任务类型
|
||||
private String task_type;
|
||||
//起点
|
||||
//取货点1
|
||||
private String start_device_code;
|
||||
//下一点
|
||||
//放货点1
|
||||
private String next_device_code;
|
||||
//载具号
|
||||
private String vehicle_code;
|
||||
//载具类型
|
||||
private String vehicle_type;
|
||||
//取货点2
|
||||
private String start_device_code2;
|
||||
//放货点2
|
||||
private String next_device_code2;
|
||||
//烘箱放货点
|
||||
private String put_device_code;
|
||||
//优先级
|
||||
private String priority;
|
||||
//载具号
|
||||
private String vehicle_code;
|
||||
//任务类型
|
||||
private String task_type;
|
||||
//Agv系统类型
|
||||
private String agv_system_type;
|
||||
//备注
|
||||
private String remark;
|
||||
//扩展参数
|
||||
private String params;
|
||||
//路由类型
|
||||
private String route_plan_code;
|
||||
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class AutoCreateTask {
|
||||
if ("200".equals(status)) {
|
||||
taskList.forEach(item -> {
|
||||
JSONObject taskObj = new JSONObject();
|
||||
taskObj.put("task_id", item.getTask_id());
|
||||
taskObj.put("task_id", item.getExt_task_id());
|
||||
taskObj.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
taskObj.put("remark", "下发成功");
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
@@ -96,7 +96,7 @@ public class AutoCreateTask {
|
||||
} else {//下发失败
|
||||
taskList.forEach(item -> {
|
||||
JSONObject taskObj = new JSONObject();
|
||||
taskObj.put("task_id", item.getTask_id());
|
||||
taskObj.put("task_id", item.getExt_task_id());
|
||||
taskObj.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
taskObj.put("remark", "下发失败:" + message);
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
|
||||
@@ -43,13 +43,12 @@ public class BookTwoConfirmTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.task_id(json.getString("task_id"))
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.vehicle_type(json.getString("vehicle_type"))
|
||||
.priority(json.getString("priority"))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
|
||||
@@ -41,13 +41,12 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.task_id(json.getString("task_id"))
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.vehicle_type(json.getString("vehicle_type"))
|
||||
.priority(json.getString("priority"))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
|
||||
@@ -0,0 +1,292 @@
|
||||
package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.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.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.ext.mes.service.LmsToMesService;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CoolCutTask extends AbstractAcsTask {
|
||||
|
||||
private final String THIS_CLASS = CoolCutTask.class.getName();
|
||||
|
||||
|
||||
@Override
|
||||
public List<AcsTaskDto> addTask() {
|
||||
/*
|
||||
* 下发给ACS时需要特殊处理
|
||||
*/
|
||||
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + THIS_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
|
||||
|
||||
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.priority(json.getString("priority"))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
resultList.add(dto);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO");
|
||||
|
||||
String task_id = taskObj.getString("task_id");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
if (StrUtil.equals(status, "0")) {
|
||||
// 取消删除任务
|
||||
taskTab.delete("task_id = '" + task_id + "'");
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
// 更新主表状态
|
||||
JSONObject coolMst = ivtTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
coolMst.put("bill_status", "40");
|
||||
ivtTab.update(coolMst);
|
||||
|
||||
}
|
||||
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
// 更改任务状态为完成
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
jsonTask.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
String point_code1 = jsonTask.getString("point_code1");
|
||||
String point_code2 = jsonTask.getString("point_code2");
|
||||
String point_code3 = jsonTask.getString("point_code3");
|
||||
String point_code4 = jsonTask.getString("point_code4");
|
||||
|
||||
if (jsonTask.getString("task_type").equals("010301")) {
|
||||
// 更新主表状态
|
||||
JSONObject coolMst = ivtTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
coolMst.put("bill_status", "50");
|
||||
ivtTab.update(coolMst);
|
||||
|
||||
//更新冷却区母卷库存
|
||||
JSONObject jsonCoolIvt = ivtTab.query("full_point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
String container_name = jsonCoolIvt.getString("container_name"); // 母卷号
|
||||
|
||||
jsonCoolIvt.put("full_point_status", "01");
|
||||
jsonCoolIvt.put("container_name", "");
|
||||
jsonCoolIvt.put("workorder_id", "");
|
||||
jsonCoolIvt.put("ivt_qty", "0");
|
||||
jsonCoolIvt.put("cool_ivt_status", "01");
|
||||
jsonCoolIvt.put("instorage_time", "");
|
||||
jsonCoolIvt.put("update_optid", currentUserId);
|
||||
jsonCoolIvt.put("update_optname", currentUsername);
|
||||
jsonCoolIvt.put("update_time", DateUtil.now());
|
||||
ivtTab.update(jsonCoolIvt);
|
||||
|
||||
//更新分切区母卷库存
|
||||
JSONObject cut_jo = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("full_point_code = '" + point_code2 + "'").uniqueResult(0);
|
||||
cut_jo.put("full_point_status", "02");
|
||||
cut_jo.put("container_name", container_name);
|
||||
cut_jo.put("update_optid", currentUserId);
|
||||
cut_jo.put("update_optname", currentUsername);
|
||||
cut_jo.put("update_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("ST_IVT_CutPointIvt").update(cut_jo);
|
||||
|
||||
//更新分切区空轴库存
|
||||
JSONObject cut_jo2 = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("empty_point_code = '" + point_code3 + "'").uniqueResult(0);
|
||||
cut_jo2.put("empty_point_status", "01");
|
||||
cut_jo2.put("empty_vehicle_code", "");
|
||||
cut_jo2.put("update_optid", currentUserId);
|
||||
cut_jo2.put("update_optname", currentUsername);
|
||||
cut_jo2.put("update_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("ST_IVT_CutPointIvt").update(cut_jo2);
|
||||
|
||||
//更新冷却区空轴库存
|
||||
JSONObject jsonCoolIvt2 = ivtTab.query("full_point_code = '" + point_code4 + "'").uniqueResult(0);
|
||||
jsonCoolIvt2.put("empty_point_status", "02");
|
||||
jsonCoolIvt2.put("empty_vehicle_code", jsonTask.getString("vehicle_code2"));
|
||||
jsonCoolIvt2.put("cool_ivt_status", "01");
|
||||
jsonCoolIvt2.put("instorage_time", "");
|
||||
jsonCoolIvt2.put("update_optid", currentUserId);
|
||||
jsonCoolIvt2.put("update_optname", currentUsername);
|
||||
jsonCoolIvt2.put("update_time", DateUtil.now());
|
||||
ivtTab.update(jsonCoolIvt2);
|
||||
}
|
||||
|
||||
if (jsonTask.getString("task_type").equals("010302")) {
|
||||
// 更新主表状态
|
||||
JSONObject coolMst = ivtTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
coolMst.put("bill_status", "50");
|
||||
ivtTab.update(coolMst);
|
||||
|
||||
//更新冷却区母卷库存
|
||||
JSONObject jsonCoolIvt = ivtTab.query("full_point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
String container_name = jsonCoolIvt.getString("container_name"); // 母卷号
|
||||
|
||||
jsonCoolIvt.put("full_point_status", "01");
|
||||
jsonCoolIvt.put("container_name", "");
|
||||
jsonCoolIvt.put("workorder_id", "");
|
||||
jsonCoolIvt.put("ivt_qty", "0");
|
||||
jsonCoolIvt.put("cool_ivt_status", "01");
|
||||
jsonCoolIvt.put("instorage_time", "");
|
||||
jsonCoolIvt.put("update_optid", currentUserId);
|
||||
jsonCoolIvt.put("update_optname", currentUsername);
|
||||
jsonCoolIvt.put("update_time", DateUtil.now());
|
||||
ivtTab.update(jsonCoolIvt);
|
||||
|
||||
//更新分切区母卷库存
|
||||
JSONObject cut_jo = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("full_point_code = '" + point_code2 + "'").uniqueResult(0);
|
||||
cut_jo.put("full_point_status", "02");
|
||||
cut_jo.put("container_name", container_name);
|
||||
cut_jo.put("update_optid", currentUserId);
|
||||
cut_jo.put("update_optname", currentUsername);
|
||||
cut_jo.put("update_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("ST_IVT_CutPointIvt").update(cut_jo);
|
||||
}
|
||||
|
||||
if (jsonTask.getString("task_type").equals("010303")) {
|
||||
//更新分切区空轴库存
|
||||
JSONObject cut_jo2 = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("empty_point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
cut_jo2.put("empty_point_status", "01");
|
||||
cut_jo2.put("empty_vehicle_code", "");
|
||||
cut_jo2.put("update_optid", currentUserId);
|
||||
cut_jo2.put("update_optname", currentUsername);
|
||||
cut_jo2.put("update_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("ST_IVT_CutPointIvt").update(cut_jo2);
|
||||
|
||||
//更新冷却区空轴库存
|
||||
JSONObject jsonCoolIvt2 = ivtTab.query("full_point_code = '" + point_code2 + "'").uniqueResult(0);
|
||||
jsonCoolIvt2.put("empty_point_status", "02");
|
||||
jsonCoolIvt2.put("empty_vehicle_code", jsonTask.getString("vehicle_code"));
|
||||
jsonCoolIvt2.put("cool_ivt_status", "01");
|
||||
jsonCoolIvt2.put("instorage_time", "");
|
||||
jsonCoolIvt2.put("update_optid", currentUserId);
|
||||
jsonCoolIvt2.put("update_optname", currentUsername);
|
||||
jsonCoolIvt2.put("update_time", DateUtil.now());
|
||||
ivtTab.update(jsonCoolIvt2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String createTask(JSONObject form) {
|
||||
WQLObject tab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
String point_code1 = form.getString("point_code1");
|
||||
String point_code2 = form.getString("point_code2");
|
||||
String point_code3 = form.getString("point_code3");
|
||||
String point_code4 = form.getString("point_code4");
|
||||
if (isSingleTask(point_code1)) {
|
||||
throw new BadRequestException("点位:" + point_code1 + "存在未完成的任务!");
|
||||
}
|
||||
if (isSingleTask(point_code2)) {
|
||||
throw new BadRequestException("点位:" + point_code2 + "存在未完成的任务!");
|
||||
}
|
||||
if (isSingleTask(point_code3)) {
|
||||
throw new BadRequestException("点位:" + point_code3 + "存在未完成的任务!");
|
||||
}
|
||||
if (isSingleTask(point_code4)) {
|
||||
throw new BadRequestException("点位:" + point_code4 + "存在未完成的任务!");
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_type", form.getString("task_type"));
|
||||
json.put("task_status", "01");
|
||||
json.put("point_code1", point_code1);
|
||||
json.put("point_code2", point_code2);
|
||||
json.put("point_code3", point_code3);
|
||||
json.put("point_code4", point_code4);
|
||||
json.put("vehicle_code", form.getString("vehicle_code"));
|
||||
json.put("handle_class", THIS_CLASS);
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("create_name", currentUsername);
|
||||
json.put("create_time", DateUtil.now());
|
||||
json.put("priority", "1");
|
||||
json.put("acs_task_type", "5");
|
||||
tab.insert(json);
|
||||
|
||||
return json.getString("task_id");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
//判断该点位是否存在未完成的任务
|
||||
public boolean isSingleTask(String point_code) {
|
||||
JSONObject task1 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code1 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
JSONObject task2 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code2 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
JSONObject task3 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code3 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
JSONObject task4 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code4 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(task1) || ObjectUtil.isNotEmpty(task2) || ObjectUtil.isNotEmpty(task3) || ObjectUtil.isNotEmpty(task4)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,8 @@ 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.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.ext.mes.service.LmsToMesService;
|
||||
import org.nl.wms.sch.AcsTaskDto;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
@@ -26,6 +28,7 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CutConveyorTask extends AbstractAcsTask {
|
||||
|
||||
private final String THIS_CLASS = CutConveyorTask.class.getName();
|
||||
|
||||
@Override
|
||||
@@ -40,13 +43,12 @@ public class CutConveyorTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.task_id(json.getString("task_id"))
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.vehicle_type(json.getString("vehicle_type"))
|
||||
.priority(json.getString("priority"))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
@@ -64,9 +66,9 @@ public class CutConveyorTask extends AbstractAcsTask {
|
||||
String task_id = taskObj.getString("task_id");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
if (StrUtil.equals(status,"0")) {
|
||||
if (StrUtil.equals(status, "0")) {
|
||||
// 取消删除任务
|
||||
taskTab.delete("task_id = '"+task_id+"'");
|
||||
taskTab.delete("task_id = '" + task_id + "'");
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
@@ -76,9 +78,9 @@ public class CutConveyorTask extends AbstractAcsTask {
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
|
||||
if(StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
// 更改任务状态为完成
|
||||
jsonTask.put("task_status",TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
jsonTask.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
@@ -87,7 +89,7 @@ public class CutConveyorTask extends AbstractAcsTask {
|
||||
String point_code1 = jsonTask.getString("point_code1");
|
||||
String point_code2 = jsonTask.getString("point_code2");
|
||||
|
||||
if (jsonTask.getString("task_type").equals("010401")){
|
||||
if (jsonTask.getString("task_type").equals("010401")) {
|
||||
// 校验终点是否存在
|
||||
JSONObject jsonIvt = ivtTab.query("point_code ='" + point_code1 + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonIvt)) {
|
||||
@@ -98,7 +100,7 @@ public class CutConveyorTask extends AbstractAcsTask {
|
||||
jsonIvt.put("point_status", "01");
|
||||
ivtTab.update(jsonIvt);
|
||||
}
|
||||
if (jsonTask.getString("task_type").equals("010402")){
|
||||
if (jsonTask.getString("task_type").equals("010402")) {
|
||||
// 校验终点是否存在
|
||||
JSONObject jsonIvt = ivtTab.query("point_code ='" + point_code2 + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonIvt)) {
|
||||
@@ -112,9 +114,21 @@ public class CutConveyorTask extends AbstractAcsTask {
|
||||
|
||||
//更新对应气涨轴的分切计划表为配送完成
|
||||
HashMap map = new HashMap();
|
||||
map.put("is_child_ps_ok","1");
|
||||
map.put("status","03");
|
||||
WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").update(map,"qzzno = '"+jsonTask.getString("vehicle_code")+"' AND is_child_tz_ok = '1' AND is_child_ps_ok = '0' AND is_delete ='0' AND status = '02'");
|
||||
map.put("is_child_ps_ok", "1");
|
||||
map.put("status", "03");
|
||||
WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").update(map, "qzzno = '" + jsonTask.getString("vehicle_code") + "' AND is_child_tz_ok = '1' AND is_child_ps_ok = '0' AND is_delete ='0' AND status = '02'");
|
||||
|
||||
LmsToMesService lmsToMesService = SpringContextHolder.getBean(LmsToMesService.class);
|
||||
//调用MES配送完成接口
|
||||
JSONArray rows = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("qzzno = '" + jsonTask.getString("vehicle_code") + "' AND is_child_tz_ok = '1' AND is_child_ps_ok = '0' AND is_delete ='0' AND status = '02'").getResultJSONArray(0);
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
String ContainerName = row.getString("container_name");
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("ContainerName", ContainerName);
|
||||
lmsToMesService.airSwellWithPaperTubeAssArrival(row);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,14 +152,14 @@ public class CutConveyorTask extends AbstractAcsTask {
|
||||
|
||||
String point_code1 = form.getString("point_code1");
|
||||
String point_code2 = form.getString("point_code2");
|
||||
if (isSingleTask(point_code1)){
|
||||
throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!");
|
||||
if (isSingleTask(point_code1)) {
|
||||
throw new BadRequestException("点位:" + point_code1 + "存在未完成的任务!");
|
||||
}
|
||||
if (isSingleTask(point_code2)){
|
||||
throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!");
|
||||
if (isSingleTask(point_code2)) {
|
||||
throw new BadRequestException("点位:" + point_code2 + "存在未完成的任务!");
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_type", form.getString("task_type"));
|
||||
json.put("task_status", "01");
|
||||
@@ -156,8 +170,8 @@ public class CutConveyorTask extends AbstractAcsTask {
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("create_name", currentUsername);
|
||||
json.put("create_time", DateUtil.now());
|
||||
json.put("priority","1" );
|
||||
json.put("acs_task_type","5" );
|
||||
json.put("priority", "1");
|
||||
json.put("acs_task_type", "5");
|
||||
tab.insert(json);
|
||||
|
||||
return json.getString("task_id");
|
||||
@@ -171,22 +185,21 @@ public class CutConveyorTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
//判断该点位是否存在未完成的任务
|
||||
public boolean isSingleTask(String point_code){
|
||||
JSONObject task1 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code1 = '"+point_code+"' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
JSONObject task2 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code2 = '"+point_code+"' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
JSONObject task3 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code3 = '"+point_code+"' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
JSONObject task4 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code4 = '"+point_code+"' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
public boolean isSingleTask(String point_code) {
|
||||
JSONObject task1 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code1 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
JSONObject task2 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code2 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
JSONObject task3 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code3 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
JSONObject task4 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code4 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(task1) || ObjectUtil.isNotEmpty(task2) || ObjectUtil.isNotEmpty(task3) || ObjectUtil.isNotEmpty(task4)){
|
||||
if (ObjectUtil.isNotEmpty(task1) || ObjectUtil.isNotEmpty(task2) || ObjectUtil.isNotEmpty(task3) || ObjectUtil.isNotEmpty(task4)) {
|
||||
return true;
|
||||
}else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,13 +39,12 @@ public class CutTrussTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.task_id(json.getString("task_id"))
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.vehicle_type(json.getString("vehicle_type"))
|
||||
.priority(json.getString("priority"))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
|
||||
@@ -43,13 +43,12 @@ public class InCoolIvtTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.task_id(json.getString("task_id"))
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.vehicle_type(json.getString("vehicle_type"))
|
||||
.priority(json.getString("priority"))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
|
||||
@@ -40,13 +40,12 @@ public class InHotTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.task_id(json.getString("task_id"))
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.vehicle_type(json.getString("vehicle_type"))
|
||||
.priority(json.getString("priority"))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
|
||||
@@ -41,13 +41,12 @@ public class InTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.task_id(json.getString("task_id"))
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.vehicle_type(json.getString("vehicle_type"))
|
||||
.priority(json.getString("priority"))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
|
||||
@@ -41,13 +41,12 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.task_id(json.getString("task_id"))
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.vehicle_type(json.getString("vehicle_type"))
|
||||
.priority(json.getString("priority"))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
@@ -68,12 +67,12 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
String task_id = taskObj.getString("task_id");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
if (StrUtil.equals(status,"0")) {
|
||||
if (StrUtil.equals(status, "0")) {
|
||||
// 取消删除任务
|
||||
taskTab.delete("task_id = '"+task_id+"'");
|
||||
taskTab.delete("task_id = '" + task_id + "'");
|
||||
|
||||
// 删除出入烘箱任务明细
|
||||
hotDtlTab.delete("task_id = '"+task_id+"'");
|
||||
hotDtlTab.delete("task_id = '" + task_id + "'");
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
@@ -89,12 +88,12 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
|
||||
}
|
||||
|
||||
if(StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
// 更改任务状态为完成
|
||||
jsonTask.put("task_status",TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("update_optid", currentUserId);
|
||||
jsonTask.put("update_optname", currentUsername);
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
@@ -127,10 +126,10 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
|
||||
// 更新烘箱区库存状态
|
||||
jsonHotIvt.put("point_status", "01");
|
||||
jsonHotIvt.put("container_name","" );
|
||||
jsonHotIvt.put("workorder_id","" );
|
||||
jsonHotIvt.put("ivt_qty",0 );
|
||||
jsonHotIvt.put("instorage_time","");
|
||||
jsonHotIvt.put("container_name", "");
|
||||
jsonHotIvt.put("workorder_id", "");
|
||||
jsonHotIvt.put("ivt_qty", 0);
|
||||
jsonHotIvt.put("instorage_time", "");
|
||||
jsonHotIvt.put("update_optid", currentUserId);
|
||||
jsonHotIvt.put("update_optname", currentUsername);
|
||||
jsonHotIvt.put("update_time", DateUtil.now());
|
||||
@@ -140,7 +139,7 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("iContainerName", jsonHotMst.getString("container_name"));
|
||||
param.put("iResourceName", jsonHotIvt.getString("point_code"));
|
||||
param.put("iMoveOutDate", DateUtil. now());
|
||||
param.put("iMoveOutDate", DateUtil.now());
|
||||
param.put("iabxActualBakingTemperature", jsonHotDtl.getDoubleValue("temperature"));
|
||||
param.put("iabxActualBakingTimer", jsonHotDtl.getDoubleValue("oven_time"));
|
||||
param.put("UserName", "");
|
||||
@@ -171,15 +170,15 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
|
||||
String point_code1 = form.getString("point_code1");
|
||||
String point_code2 = form.getString("point_code2");
|
||||
if (cutConveyorTask.isSingleTask(point_code1)){
|
||||
throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!");
|
||||
if (cutConveyorTask.isSingleTask(point_code1)) {
|
||||
throw new BadRequestException("点位:" + point_code1 + "存在未完成的任务!");
|
||||
}
|
||||
if (cutConveyorTask.isSingleTask(point_code2)){
|
||||
throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!");
|
||||
if (cutConveyorTask.isSingleTask(point_code2)) {
|
||||
throw new BadRequestException("点位:" + point_code2 + "存在未完成的任务!");
|
||||
}
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id",IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
json.put("task_type", "010202");
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
@@ -191,10 +190,10 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("create_name", currentUsername);
|
||||
json.put("create_time", DateUtil.now());
|
||||
json.put("priority","1" );
|
||||
json.put("acs_task_type","1" );
|
||||
json.put("priority", "1");
|
||||
json.put("acs_task_type", "1");
|
||||
tab.insert(json);
|
||||
|
||||
immediateNotifyAcs();
|
||||
return json.getString("task_id");
|
||||
}
|
||||
|
||||
@@ -206,7 +205,6 @@ public class OutHotTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
|
||||
|
||||
@@ -40,13 +40,12 @@ public class OutTask extends AbstractAcsTask {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
.task_id(json.getString("task_id"))
|
||||
.ext_task_id(json.getString("task_id"))
|
||||
.task_code(json.getString("task_code"))
|
||||
.task_type(json.getString("acs_task_type"))
|
||||
.start_device_code(json.getString("point_code1"))
|
||||
.next_device_code(json.getString("point_code2"))
|
||||
.vehicle_code(json.getString("vehicle_code"))
|
||||
.vehicle_type(json.getString("vehicle_type"))
|
||||
.priority(json.getString("priority"))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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;
|
||||
@@ -213,4 +214,13 @@ public class RawAssistIStorController {
|
||||
rawAssistIStorService.backConfirm(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/autoDis")
|
||||
@Log("自动分配")
|
||||
@ApiOperation("自动分配")
|
||||
//@PreAuthorize("@el.check('materialtype:list')")
|
||||
public ResponseEntity<Object> autoDis(@RequestBody JSONObject whereJson) {
|
||||
rawAssistIStorService.autoDis(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public interface CheckOutBillService {
|
||||
* {bill_code=, stor_id=1473161852946092032, stor_code=01, stor_name=原材料库, bill_status=10, total_qty=2, detail_count=1, bill_type=010201, remark=, biz_date=2022-01-08, create_mode=, tableData=[{material_id=1309, material_code=090301010001, bill_status=10, material_name=碳化钨粉 02, pcsn=, quality_scode=02, ivt_level=01, is_active=1, plan_qty=2, qty_unit_name=千克\公斤, qty_unit_id=1, remark=, edit=true}]}
|
||||
* /
|
||||
*/
|
||||
void insertDtl (JSONObject whereJson);
|
||||
String insertDtl (JSONObject whereJson);
|
||||
/**
|
||||
* 新增出库单
|
||||
* @param whereJson
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.st.inbill.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -58,4 +59,6 @@ public interface RawAssistIStorService {
|
||||
|
||||
JSONArray bucketDtl(Map whereJson);
|
||||
|
||||
JSONObject autoDis(JSONObject whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.st.inbill.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.math.MathUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -515,9 +516,9 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
//判断起点是否不为空
|
||||
JSONObject ios_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + map.get("iostorinv_id") + "' AND box_no = '" + map.get("box_no") + "'").uniqueResult(0);
|
||||
|
||||
JSONObject sect_jo = WQLObject.getWQLObject("st_ivt_sectattr").query("sect_id ='"+sect_id+"'").uniqueResult(0);
|
||||
JSONObject sect_jo = WQLObject.getWQLObject("st_ivt_sectattr").query("sect_id ='" + sect_id + "'").uniqueResult(0);
|
||||
boolean is_virtual = false;
|
||||
if (sect_jo.getString("sect_type_attr").equals("09")){
|
||||
if (sect_jo.getString("sect_type_attr").equals("09")) {
|
||||
is_virtual = true;
|
||||
dis_map.put("task_id", map.get("iostorinv_id"));
|
||||
dis_map.put("work_status", "01");
|
||||
@@ -620,7 +621,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
}
|
||||
}
|
||||
//如果是虚拟区,直接更新完成分配任务
|
||||
if (is_virtual){
|
||||
if (is_virtual) {
|
||||
JSONObject dis_form = new JSONObject();
|
||||
dis_form.put("task_id", map.get("iostorinv_id"));
|
||||
inbillService.confirmDis(dis_form);
|
||||
@@ -790,6 +791,98 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject autoDis(JSONObject whereJson) {
|
||||
/*
|
||||
* 分配逻辑:
|
||||
* 1、先查找该木箱内属于什么物料、订单,定位到具体的块、排,查看是否存在空位
|
||||
* a、存在的话,优先放在这一块这一排中
|
||||
* b、不存在则根据该订单物料大概数量、选择数量相近的一个空巷道
|
||||
* 1)存在空巷道
|
||||
* 2)不存在,则找一个双通有空位置、数量相近的巷道
|
||||
* */
|
||||
|
||||
JSONObject struct_jo = new JSONObject();
|
||||
|
||||
String box_no = whereJson.getString("box_no");
|
||||
|
||||
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query(" = '" + box_no + "' AND status < 2").uniqueResult(0);
|
||||
|
||||
String material_code = sub_jo.getString("product_name");
|
||||
|
||||
String sale_order_name = sub_jo.getString("sale_order_name");
|
||||
|
||||
HashMap<String, String> row_map = new HashMap<>();
|
||||
row_map.put("material_code", material_code);
|
||||
row_map.put("sale_order_name", sale_order_name);
|
||||
row_map.put("flag", "11");
|
||||
//查询到当前可用的巷道
|
||||
JSONObject row_jo = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(row_jo)) {
|
||||
String block_num = row_jo.getString("block_num");
|
||||
String row_num = row_jo.getString("row_num");
|
||||
String placement_type = row_jo.getString("placement_type");
|
||||
|
||||
if (placement_type.equals("01") || placement_type.equals("03")) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_empty_seq").uniqueResult(0);
|
||||
} else {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_empty_seq desc").uniqueResult(0);
|
||||
}
|
||||
} else {
|
||||
//如果不存在相同订单物料的巷道
|
||||
|
||||
|
||||
/*//查询是否存在未完成的相同订单物流的入库单,如果存在则查询该排是否存在可用的仓位
|
||||
HashMap<String,String> io_map = new HashMap<>();
|
||||
io_map.put("flag","12");
|
||||
io_map.put("material_code",material_code);
|
||||
io_map.put("sale_order_name",sale_order_name);
|
||||
JSONArray io_rows = WQL.getWO("").addParamMap(io_map).process().getResultJSONArray(0);*/
|
||||
|
||||
//根据分切计划查询该订单物料大概还有多少未入
|
||||
row_map.put("flag", "12");
|
||||
JSONObject plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().uniqueResult(0);
|
||||
int box_num = (int) Math.ceil(plan_rows.size() / 3);
|
||||
|
||||
//查询数量与订单物料箱子数量相近的一排
|
||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "13").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num").process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
||||
String block_num = empty_row.getString("block_num");
|
||||
String row_num = empty_row.getString("row_num");
|
||||
String placement_type = empty_row.getString("placement_type");
|
||||
|
||||
if (placement_type.equals("01") || placement_type.equals("03")) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_empty_seq").uniqueResult(0);
|
||||
} else {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_empty_seq desc").uniqueResult(0);
|
||||
}
|
||||
} else {
|
||||
//如果查询不到空的一排,则查询有空位双通的一排
|
||||
JSONObject have_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num").process().uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(have_row)) {
|
||||
String block_num = have_row.getString("block_num");
|
||||
String row_num = have_row.getString("row_num");
|
||||
|
||||
//判断该排是左边为空,还是右边为空
|
||||
JSONObject right_str = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' order by out_empty_seq").uniqueResult(0);
|
||||
JSONObject left_str = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' order by out_empty_seq desc").uniqueResult(0);
|
||||
if (StrUtil.isNotEmpty(right_str.getString("storagevehicle_code")) || !right_str.getString("lock_type").equals("1")){
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_empty_seq").uniqueResult(0);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(left_str.getString("storagevehicle_code")) || !left_str.getString("lock_type").equals("1")){
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_empty_seq desc").uniqueResult(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(struct_jo)){
|
||||
throw new BadRequestException("未查询到可用的仓位!");
|
||||
}
|
||||
return struct_jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTask(Map whereJson) {
|
||||
@@ -914,7 +1007,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
task_map.put("update_optname", nickName);
|
||||
task_map.put("update_time", now);
|
||||
//修改分配表起点,任务表起点
|
||||
/* task_wql.update(task_map, "task_id = '" + task_id + "'");*/
|
||||
/* task_wql.update(task_map, "task_id = '" + task_id + "'");*/
|
||||
|
||||
//解锁原货位点位
|
||||
HashMap unlock_map = new HashMap();
|
||||
@@ -1018,9 +1111,9 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void confirmTask(Map whereJson) {
|
||||
//判断指令状态,只能下发生成、执行中状态的任务
|
||||
//判断指令状态,只能下发生成、执行中状态的任务
|
||||
String task_code = (String) whereJson.get("task_code");
|
||||
JSONObject task_jo = WQLObject.getWQLObject("sch_base_task").query("task_code = '"+task_code+"'").uniqueResult(0);
|
||||
JSONObject task_jo = WQLObject.getWQLObject("sch_base_task").query("task_code = '" + task_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(task_jo)) {
|
||||
throw new BadRequestException("请输入正确的任务号!");
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
输入.package_box_sn TYPEAS s_string
|
||||
输入.iostorinv_id TYPEAS s_string
|
||||
输入.iostorinvdtl_id TYPEAS s_string
|
||||
输入.sale_order_name TYPEAS s_string
|
||||
输入.material_code TYPEAS s_string
|
||||
输入.sql_str TYPEAS f_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -390,6 +393,103 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "11"
|
||||
QUERY
|
||||
SELECT
|
||||
count(sa2.struct_code) AS num,
|
||||
sa2.block_num,
|
||||
sa2.row_num,
|
||||
sa2.placement_type
|
||||
FROM
|
||||
st_ivt_structivt ivt
|
||||
INNER JOIN pdm_bi_subpackagerelation sub ON sub.container_name = ivt.pcsn
|
||||
LEFT JOIN st_ivt_structattr sa ON sa.struct_code = ivt.struct_code
|
||||
LEFT JOIN st_ivt_structattr sa2 ON sa2.row_num = sa.row_num AND sa2.block_num = sa.block_num
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = ivt.material_id
|
||||
WHERE
|
||||
IFNULL(sa2.storagevehicle_code,'') = ''
|
||||
AND
|
||||
sa2.lock_type = '1'
|
||||
OPTION 输入.material_code <> ""
|
||||
mb.material_code = 输入.material_code
|
||||
ENDOPTION
|
||||
OPTION 输入.material_code <> ""
|
||||
sub.sale_order_name = 输入.sale_order_name
|
||||
ENDOPTION
|
||||
GROUP BY
|
||||
sa2.block_num,sa2.row_num
|
||||
ORDER BY
|
||||
sa.placement_type desc,num
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "12"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
pdm_bi_slittingproductionplan plan
|
||||
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = plan.container_name
|
||||
WHERE
|
||||
IFNULL( sub.container_name, '' ) = ''
|
||||
AND
|
||||
plan.is_delete = '0'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "13"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
sa.block_num,
|
||||
sa.row_num,
|
||||
sa.placement_type,
|
||||
COUNT( sa.struct_code ) AS struct_num
|
||||
FROM
|
||||
st_ivt_structattr sa
|
||||
WHERE
|
||||
sa.is_delete = '0'
|
||||
AND is_used = '1'
|
||||
AND sa.sect_id = '1582991348217286656'
|
||||
GROUP BY
|
||||
sa.block_num,
|
||||
sa.row_num,
|
||||
sa.placement_type
|
||||
) a
|
||||
WHERE
|
||||
NOT EXISTS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
block_num,
|
||||
row_num,
|
||||
placement_type
|
||||
FROM
|
||||
st_ivt_structattr sa2
|
||||
WHERE
|
||||
sa2.lock_type <> '1'
|
||||
OR IFNULL( sa2.storagevehicle_code, '' ) <> ''
|
||||
GROUP BY
|
||||
sa2.block_num,
|
||||
sa2.row_num,
|
||||
sa2.placement_type
|
||||
) b
|
||||
WHERE
|
||||
b.block_num = a.block_num
|
||||
AND
|
||||
b.row_num = a.row_num
|
||||
AND
|
||||
b.placement_type = a.placement_type
|
||||
)
|
||||
输入.sql_str
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -178,10 +178,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void insertDtl(JSONObject map) {
|
||||
|
||||
public String insertDtl(JSONObject map) {
|
||||
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt");
|
||||
|
||||
//明细另一种写法
|
||||
//JSONArray jsonArr = JSONArray.fromObject(whereJson.get("tableData"));
|
||||
JSONArray rows = map.getJSONArray("tableData");
|
||||
@@ -279,6 +277,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
map.put("total_qty", qty);
|
||||
map.put("detail_count", num);
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInv").insert(map);
|
||||
|
||||
return iostorinv_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user