This commit is contained in:
2023-08-21 15:24:24 +08:00
14 changed files with 261 additions and 222 deletions

View File

@@ -447,7 +447,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("device_code", this.device_code); param.put("device_code", this.device_code);
param.put("error", error); param.put("error", error);
param.put("error_msg", this.getError_message()); param.put("error_msg", error == 0 ? "" : this.getError_message());
param.put("device_name", this.getDevice().getDevice_name()); param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "4"); param.put("device_type", "4");
param.put("product_area", paramService.findByCode("productArea").getValue()); param.put("product_area", paramService.findByCode("productArea").getValue());

View File

@@ -690,7 +690,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("device_code", this.device_code); param.put("device_code", this.device_code);
param.put("error", error); param.put("error", error);
param.put("error_msg", this.getError_message()); param.put("error_msg", error == 0 ? "" : this.getError_message());
param.put("device_name", this.getDevice().getDevice_name()); param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "4"); param.put("device_type", "4");
param.put("product_area", ParamService.findByCode("productArea").getValue()); param.put("product_area", ParamService.findByCode("productArea").getValue());

View File

@@ -118,11 +118,11 @@ public class DeviceStatusDeviceDriver extends AbstractOpcDeviceDriver implements
} }
public void setIserror(Boolean iserror) { public void setIserror(Boolean iserror) {
this.iserror = iserror; this.iserror = iserror;
if (this.iserror != this.last_iserror && this.iserror && device_id.startsWith("RGV")) { if (this.iserror != this.last_iserror && device_id.startsWith("RGV")) {
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("device_code", this.device_id); param.put("device_code", this.device_id);
param.put("error", alarm); param.put("error", alarm);
param.put("error_msg", ErrorUtil.getDictDetail("ssx_error_type", alarm)); param.put("error_msg", iserror ? ErrorUtil.getDictDetail("ssx_error_type", alarm) : "");
param.put("device_name", this.getDevice().getDevice_name()); param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "3"); param.put("device_type", "3");
param.put("product_area", paramService.findByCode("productArea").getValue()); param.put("product_area", paramService.findByCode("productArea").getValue());

View File

@@ -222,16 +222,17 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
String errorInfo = ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(error)); String errorInfo = ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(error));
dto.setError_info(errorInfo); dto.setError_info(errorInfo);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "2");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
} }
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", error == 0 ? "" : ErrorUtil.getDictDetail("hxhj_error_type", String.valueOf(error)));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "2");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error); logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
} }

View File

@@ -272,18 +272,19 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)); String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
dto.setError_info(errorInfo); dto.setError_info(errorInfo);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
if ("true".equals(this.device.getExtraValue().get("sendDeviceStatus"))) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
} }
if ("true".equals(this.device.getExtraValue().get("sendDeviceStatus"))) {
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", error == 0 ? "" : ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
}
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error); logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
} }

View File

@@ -228,16 +228,17 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)); String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
dto.setError_info(errorInfo); dto.setError_info(errorInfo);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
} }
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", error == 0 ? "" : ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error); logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
} }

View File

@@ -206,16 +206,17 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)); String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
dto.setError_info(errorInfo); dto.setError_info(errorInfo);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
} }
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", error == 0 ? "" : ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog( logServer.deviceExecuteLog(
this.device_code, "", "", "信号error" + last_error + "->" + error); this.device_code, "", "", "信号error" + last_error + "->" + error);

View File

@@ -187,16 +187,16 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri
String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)); String errorInfo = ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error));
dto.setError_info(errorInfo); dto.setError_info(errorInfo);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
} }
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", error == 0 ? "" : ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "1");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
} }
} catch (Exception var17) { } catch (Exception var17) {
var17.printStackTrace(); var17.printStackTrace();

View File

@@ -266,16 +266,17 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
String errorInfo = ErrorUtil.getDictDetail("fqhj_error_type", String.valueOf(error)); String errorInfo = ErrorUtil.getDictDetail("fqhj_error_type", String.valueOf(error));
dto.setError_info(errorInfo); dto.setError_info(errorInfo);
deviceErrorLogService.create(dto); deviceErrorLogService.create(dto);
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", errorInfo);
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "2");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
} }
JSONObject param = new JSONObject();
param.put("device_code", this.device_code);
param.put("error", error);
param.put("error_msg", error == 0 ? "" : ErrorUtil.getDictDetail("fqhj_error_type", String.valueOf(error)));
param.put("device_name", this.getDevice().getDevice_name());
param.put("device_type", "2");
param.put("product_area", paramService.findByCode("productArea").getValue());
acsToWmsService.sendDeviceStatus(param);
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error); logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
} }

View File

@@ -1,5 +1,7 @@
// 适配 Nginx 反向代理 // 适配 Nginx 反向代理
const baseUrl = process.env.VUE_APP_BASE_API === '/' ? '' : process.env.VUE_APP_BASE_API const baseUrl = window.g.prod.VUE_APP_BASE_API === '/' ? '' : window.g.prod.VUE_APP_BASE_API
// window.g.prod.VUE_APP_BASE_API
const baseImageUrl = window.g.prod.VUE_APP_BASE_API
const api = { const api = {
state: { state: {

View File

@@ -340,6 +340,19 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
b、没有则优先找空的巷道按空位置顺序分配 b、没有则优先找空的巷道按空位置顺序分配
3、任务下发判断巷道的任务类型只能为空盘入库或者无任务类型 3、任务下发判断巷道的任务类型只能为空盘入库或者无任务类型
* */ * */
// 查询此点位是否有正在进行的任务,如果有则不生成任务
JSONObject jsonTask = WQLObject.getWQLObject("sch_base_task")
.query("point_code2 = '" + device_code + "' and is_delete = '0' and task_status <> '07'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonTask)) {
result.put("status", HttpStatus.OK.value());
result.put("message", "此点位已生成任务,请等待任务结束!");
log.info("apply返回参数---------------------------------------------" + result.toString());
return result;
}
JSONArray empArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "22").process().getResultJSONArray(0); JSONArray empArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "22").process().getResultJSONArray(0);
JSONObject struct_jo = new JSONObject(); JSONObject struct_jo = new JSONObject();

View File

@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
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.common.utils.SecurityUtils; import org.nl.common.utils.SecurityUtils;
@@ -29,11 +30,14 @@ import org.nl.wms.sch.tasks.InTask;
import org.nl.wms.st.inbill.service.RawAssistIStorService; import org.nl.wms.st.inbill.service.RawAssistIStorService;
import org.nl.wms.st.inbill.service.StorPublicService; import org.nl.wms.st.inbill.service.StorPublicService;
import org.nl.wms.st.inbill.service.impl.InbillServiceImpl; import org.nl.wms.st.inbill.service.impl.InbillServiceImpl;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.TimeUnit;
/** /**
* @author zhouz * @author zhouz
@@ -53,6 +57,8 @@ public class ProductInstorServiceImpl implements ProductInstorService {
private final CutConveyorTask cutConveyorTask; private final CutConveyorTask cutConveyorTask;
private final RedissonClient redissonClient;
@Override @Override
public JSONObject boxQuery(JSONObject whereJson) { public JSONObject boxQuery(JSONObject whereJson) {
String box_no = whereJson.getString("box_no"); String box_no = whereJson.getString("box_no");
@@ -91,6 +97,7 @@ public class ProductInstorServiceImpl implements ProductInstorService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@SneakyThrows
public JSONObject confirm(JSONObject whereJson) { public JSONObject confirm(JSONObject whereJson) {
String box_no = whereJson.getString("box_no"); String box_no = whereJson.getString("box_no");
//1-报废入库2-生产入库3-退货入库4-拆分入库 //1-报废入库2-生产入库3-退货入库4-拆分入库
@@ -117,170 +124,182 @@ public class ProductInstorServiceImpl implements ProductInstorService {
JSONObject mst_jo = new JSONObject(); JSONObject mst_jo = new JSONObject();
mst_jo.put("tableData", box_rows); mst_jo.put("tableData", box_rows);
mst_jo.put("biz_date", DateUtil.now()); mst_jo.put("biz_date", DateUtil.now());
if (option.equals("1")) {
mst_jo.put("bill_type", "0003");
}
if (option.equals("2")) {
mst_jo.put("bill_type", "0001");
}
if (option.equals("3")) {
mst_jo.put("bill_type", "0002");
}
if (option.equals("4")) {
mst_jo.put("bill_type", "0005");
}
HashMap box_map = box_rows.get(0);
Object sub_type = box_map.get("sub_type");
if (ObjectUtil.isNotEmpty(sub_type)){
if (sub_type.equals("1")){
//如果为返检的包装关系则变为返检入库
mst_jo.put("bill_type", "0006");
}
}
//查询成品库仓库
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("stor_code", stor.getString("stor_code"));
mst_jo.put("stor_name", stor.getString("stor_name"));
mst_jo.put("detail_count", box_rows.size());
mst_jo.put("total_qty", "0");
mst_jo.put("bill_status", "10"); // 生成
String iostorinv_id = "";
//查询该木箱是否存在未完成的入库单 RLock lock = redissonClient.getLock("pda_ioIn:" + option);
JSONObject box_mst_jo = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "26").addParam("box_no", box_no).process().uniqueResult(0); boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
if (ObjectUtil.isNotEmpty(box_mst_jo)) { try {
iostorinv_id = box_mst_jo.getString("iostorinv_id"); if (tryLock) {
} else { if (option.equals("1")) {
iostorinv_id = rawAssistIStorService.insertDtl(mst_jo); mst_jo.put("bill_type", "0003");
}
//判断是否虚拟
if (!is_virtual.equals("1")) {
//判断是该包装计划是否存在长宽高
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_SN = '" + box_no + "'").uniqueResult(0);
Double box_length = sub_jo.getDoubleValue("box_length");
Double box_width = sub_jo.getDoubleValue("box_width");
Double box_high = sub_jo.getDoubleValue("box_high");
// 木箱长、宽、高不能为0
if (box_length <= 0 || box_width <= 0 || box_high <= 0) {
throw new BadRequestException("该木箱没有长宽高信息,无法入库,请到子卷包装关系中维护!");
}
// 木箱尺寸长度低于950的不入立体库长度大于1385的立体库无法入库
String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_up").getValue();
String length_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_down").getValue();
String with_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_with_up").getValue();
String high_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_high_up").getValue();
Double box_length_up = Double.valueOf(length_up); // 木箱长度上限
Double box_length_down = Double.valueOf(length_down); // 木箱长度下限
Double box_with_up = Double.valueOf(with_up); // 木箱宽度上限
Double box_high_up = Double.valueOf(high_up); // 木箱高度上限
if (!(box_length_down <= box_length && box_length <= box_length_up)) {
throw new BadRequestException("无法入立体库,木箱超长;当前木箱长度为:"+box_length);
}
if (!(box_width <= box_with_up)) {
throw new BadRequestException("无法入立体库,木箱超宽;当前木箱宽度为:"+box_width);
}
if (!(box_high <= box_high_up)) {
throw new BadRequestException("无法入立体库,木箱超高;当前木箱高度为:"+box_high);
}
JSONObject point_jo = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(point_jo)) {
throw new BadRequestException("未查询到对应的点位!");
} else {
if (point_jo.getString("is_used").equals("0")) {
throw new BadRequestException("该点位已经被禁用!");
} }
if (point_jo.getString("is_delete").equals("1")) { if (option.equals("2")) {
throw new BadRequestException("该点位已经被删除!"); mst_jo.put("bill_type", "0001");
} }
if (!point_jo.getString("region_code").equals("NBJ01")) { if (option.equals("3")) {
throw new BadRequestException("请扫描内包间入库点位!"); mst_jo.put("bill_type", "0002");
} }
} if (option.equals("4")) {
//创建二楼去一楼的任务 mst_jo.put("bill_type", "0005");
JSONObject form = new JSONObject(); }
form.put("point_code1", point_code); HashMap box_map = box_rows.get(0);
form.put("point_code2", "NTB01"); Object sub_type = box_map.get("sub_type");
form.put("vehicle_code", box_no); if (ObjectUtil.isNotEmpty(sub_type)){
form.put("task_type", "010507"); if (sub_type.equals("1")){
cutConveyorTask.createTask(form); //如果为返检的包装关系则变为返检入库
} else { mst_jo.put("bill_type", "0006");
JSONArray now_dis_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "18").addParam("box_no", map.get("box_no")).process().getResultJSONArray(0);
if (now_dis_rows.size() > 0) {
throw new BadRequestException("该木箱已经分配过货位,无法继续分配!");
}
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
//直接分配虚拟区货位,并确认
JSONObject struct = WQL.getWO("PDA_ST_01").addParam("flag", "3").addParam("stor_id", stor.getString("stor_id")).process().uniqueResult(0);
HashMap<String, String> dis_map = new HashMap();
dis_map.put("sect_id", struct.getString("sect_id"));
dis_map.put("sect_code", struct.getString("sect_code"));
dis_map.put("sect_name", struct.getString("sect_name"));
dis_map.put("struct_id", struct.getString("struct_id"));
dis_map.put("struct_code", struct.getString("struct_code"));
dis_map.put("struct_name", struct.getString("struct_name"));
dis_map.put("work_status", "01");
dis_map.put("task_id", task_id);
//更新该木箱明细对应的分配
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(dis_map, "iostorinv_id = '" + iostorinv_id + "' AND box_no = '" + box_no + "'");
//修改库存
//直接取出入库分配表的库存
mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
JSONArray dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "' AND box_no = '" + map.get("box_no") + "'").getResultJSONArray(0);
for (int i = 0; i < dis_rows.size(); i++) {
JSONObject dis_jo = dis_rows.getJSONObject(i);
JSONObject i_form = new JSONObject();
i_form.put("struct_id", dis_jo.getString("struct_id"));
i_form.put("material_id", dis_jo.getString("material_id"));
i_form.put("pcsn", dis_jo.getString("pcsn"));
i_form.put("change_qty", dis_jo.getString("plan_qty"));
i_form.put("bill_type_scode", mst_jo.getString("bill_type"));
i_form.put("quality_scode", "01");
i_form.put("inv_id", mst_jo.getString("iostorinv_id"));
i_form.put("bill_code", mst_jo.getString("bill_code"));
i_form.put("bill_table", "ST_IVT_IOStorInv");
i_form.put("qty_unit_id", dis_jo.getString("qty_unit_id"));
i_form.put("qty_unit_name", dis_jo.getString("qty_unit_name"));
storPublicService.IOStor(i_form, "31");
//更新明细表状态
JSONObject dtl_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "'").uniqueResult(0);
if (dtl_jo.getDoubleValue("unassign_qty") == 0) {
//判断该明细下是否还存在未分配货位的分配明细
JSONArray disdiv_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "' AND (struct_id = '' OR struct_id is null) AND (point_id = '' OR point_id is null)").getResultJSONArray(0);
if (disdiv_rows.size() == 0) {
dtl_jo.put("bill_status", "40");
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(dtl_jo);
//判断主表下的明细是否都为40
JSONArray dtl_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinv_id = '" + dis_jo.getString("iostorinv_id") + "' AND bill_status < '40'").getResultJSONArray(0);
if (dtl_rows.size() == 0) {
mst_jo.put("bill_status", "40");
mst_jo.put("dis_optid", currentUserId);
mst_jo.put("dis_optname", nickName);
mst_jo.put("dis_time", DateUtil.now());
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo);
}
} }
} }
//查询成品库仓库
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("stor_code", stor.getString("stor_code"));
mst_jo.put("stor_name", stor.getString("stor_name"));
mst_jo.put("detail_count", box_rows.size());
mst_jo.put("total_qty", "0");
mst_jo.put("bill_status", "10"); // 生成
String iostorinv_id = "";
//查询该木箱是否存在未完成的入库单
JSONObject box_mst_jo = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "26").addParam("box_no", box_no).process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(box_mst_jo)) {
iostorinv_id = box_mst_jo.getString("iostorinv_id");
} else {
iostorinv_id = rawAssistIStorService.insertDtl(mst_jo);
}
//判断是否虚拟
if (!is_virtual.equals("1")) {
//判断是该包装计划是否存在长宽高
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_SN = '" + box_no + "'").uniqueResult(0);
Double box_length = sub_jo.getDoubleValue("box_length");
Double box_width = sub_jo.getDoubleValue("box_width");
Double box_high = sub_jo.getDoubleValue("box_high");
// 木箱长、宽、高不能为0
if (box_length <= 0 || box_width <= 0 || box_high <= 0) {
throw new BadRequestException("该木箱没有长宽高信息,无法入库,请到子卷包装关系中维护!");
}
// 木箱尺寸长度低于950的不入立体库长度大于1385的立体库无法入库
String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_up").getValue();
String length_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_length_down").getValue();
String with_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_with_up").getValue();
String high_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("box_high_up").getValue();
Double box_length_up = Double.valueOf(length_up); // 木箱长度上限
Double box_length_down = Double.valueOf(length_down); // 木箱长度下限
Double box_with_up = Double.valueOf(with_up); // 木箱宽度上限
Double box_high_up = Double.valueOf(high_up); // 木箱高度上限
if (!(box_length_down <= box_length && box_length <= box_length_up)) {
throw new BadRequestException("无法入立体库,木箱超长;当前木箱长度为:"+box_length);
}
if (!(box_width <= box_with_up)) {
throw new BadRequestException("无法入立体库,木箱超宽;当前木箱宽度为:"+box_width);
}
if (!(box_high <= box_high_up)) {
throw new BadRequestException("无法入立体库,木箱超高;当前木箱高度为:"+box_high);
}
JSONObject point_jo = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(point_jo)) {
throw new BadRequestException("未查询到对应的点位!");
} else {
if (point_jo.getString("is_used").equals("0")) {
throw new BadRequestException("该点位已经被禁用!");
}
if (point_jo.getString("is_delete").equals("1")) {
throw new BadRequestException("该点位已经被删除!");
}
if (!point_jo.getString("region_code").equals("NBJ01")) {
throw new BadRequestException("请扫描内包间入库点位!");
}
}
//创建二楼去一楼的任务
JSONObject form = new JSONObject();
form.put("point_code1", point_code);
form.put("point_code2", "NTB01");
form.put("vehicle_code", box_no);
form.put("task_type", "010507");
cutConveyorTask.createTask(form);
} else {
JSONArray now_dis_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag", "18").addParam("box_no", map.get("box_no")).process().getResultJSONArray(0);
if (now_dis_rows.size() > 0) {
throw new BadRequestException("该木箱已经分配过货位,无法继续分配!");
}
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
//直接分配虚拟区货位,并确认
JSONObject struct = WQL.getWO("PDA_ST_01").addParam("flag", "3").addParam("stor_id", stor.getString("stor_id")).process().uniqueResult(0);
HashMap<String, String> dis_map = new HashMap();
dis_map.put("sect_id", struct.getString("sect_id"));
dis_map.put("sect_code", struct.getString("sect_code"));
dis_map.put("sect_name", struct.getString("sect_name"));
dis_map.put("struct_id", struct.getString("struct_id"));
dis_map.put("struct_code", struct.getString("struct_code"));
dis_map.put("struct_name", struct.getString("struct_name"));
dis_map.put("work_status", "01");
dis_map.put("task_id", task_id);
//更新该木箱明细对应的分配
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(dis_map, "iostorinv_id = '" + iostorinv_id + "' AND box_no = '" + box_no + "'");
//修改库存
//直接取出入库分配表的库存
mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
JSONArray dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + iostorinv_id + "' AND box_no = '" + map.get("box_no") + "'").getResultJSONArray(0);
for (int i = 0; i < dis_rows.size(); i++) {
JSONObject dis_jo = dis_rows.getJSONObject(i);
JSONObject i_form = new JSONObject();
i_form.put("struct_id", dis_jo.getString("struct_id"));
i_form.put("material_id", dis_jo.getString("material_id"));
i_form.put("pcsn", dis_jo.getString("pcsn"));
i_form.put("change_qty", dis_jo.getString("plan_qty"));
i_form.put("bill_type_scode", mst_jo.getString("bill_type"));
i_form.put("quality_scode", "01");
i_form.put("inv_id", mst_jo.getString("iostorinv_id"));
i_form.put("bill_code", mst_jo.getString("bill_code"));
i_form.put("bill_table", "ST_IVT_IOStorInv");
i_form.put("qty_unit_id", dis_jo.getString("qty_unit_id"));
i_form.put("qty_unit_name", dis_jo.getString("qty_unit_name"));
storPublicService.IOStor(i_form, "31");
//更新明细表状态
JSONObject dtl_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "'").uniqueResult(0);
if (dtl_jo.getDoubleValue("unassign_qty") == 0) {
//判断该明细下是否还存在未分配货位的分配明细
JSONArray disdiv_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "' AND (struct_id = '' OR struct_id is null) AND (point_id = '' OR point_id is null)").getResultJSONArray(0);
if (disdiv_rows.size() == 0) {
dtl_jo.put("bill_status", "40");
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(dtl_jo);
//判断主表下的明细是否都为40
JSONArray dtl_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinv_id = '" + dis_jo.getString("iostorinv_id") + "' AND bill_status < '40'").getResultJSONArray(0);
if (dtl_rows.size() == 0) {
mst_jo.put("bill_status", "40");
mst_jo.put("dis_optid", currentUserId);
mst_jo.put("dis_optname", nickName);
mst_jo.put("dis_time", DateUtil.now());
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo);
}
}
}
}
//调用入库分配确认方法
InbillServiceImpl inbillService = SpringContextHolder.getBean(InbillServiceImpl.class);
JSONObject dis_form = new JSONObject();
dis_form.put("task_id", task_id);
inbillService.confirmDis(dis_form);
}
} }
//调用入库分配确认方法 } finally {
InbillServiceImpl inbillService = SpringContextHolder.getBean(InbillServiceImpl.class); if (tryLock) {
JSONObject dis_form = new JSONObject(); lock.unlock();
dis_form.put("task_id", task_id); }
inbillService.confirmDis(dis_form);
} }
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
jo.put("message", "确认成功!"); jo.put("message", "确认成功!");

View File

@@ -243,7 +243,7 @@ public class InBillQueryServiceImpl implements InBillQueryService {
mp.put("班次", json.getString("classes")); mp.put("班次", json.getString("classes"));
mp.put("库区", json.getString("sect_name")); mp.put("库区", json.getString("sect_name"));
mp.put("客户编码", json.getString("customer_name")); mp.put("客户编码", json.getString("customer_name"));
mp.put("客户订单", json.getString("sale_order_name")); mp.put("销售订单及行", json.getString("sale_order_name"));
mp.put("生产日期", json.getString("date_of_production").replace("-","/")); mp.put("生产日期", json.getString("date_of_production").replace("-","/"));
mp.put("箱号", json.getString("box_no")); mp.put("箱号", json.getString("box_no"));
mp.put("生产批号", (json.getString("confirm_time").substring(0,10)).replace("-","").trim()); mp.put("生产批号", (json.getString("confirm_time").substring(0,10)).replace("-","").trim());

View File

@@ -87,7 +87,7 @@
@change="hand" @change="hand"
/> />
</el-form-item> </el-form-item>
<el-form-item label="入库日期"> <el-form-item label="业务日期">
<el-date-picker <el-date-picker
v-model="query.date_of_FG_inbound" v-model="query.date_of_FG_inbound"
type="date" type="date"
@@ -235,7 +235,7 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="入库日期"> <el-form-item label="业务日期">
<el-input v-model="form.date_of_fg_inbound" :disabled="crud.status.edit > 0 && form.status !== '0'" style="width: 300px;" /> <el-input v-model="form.date_of_fg_inbound" :disabled="crud.status.edit > 0 && form.status !== '0'" style="width: 300px;" />
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -473,8 +473,8 @@
/> />
<el-table-column <el-table-column
prop="date_of_fg_inbound" prop="date_of_fg_inbound"
label="入库日期" label="业务日期"
:min-width="flexWidth('date_of_fg_inbound',crud.data,'入库日期')" :min-width="flexWidth('date_of_fg_inbound',crud.data,'业务日期')"
/> />
<el-table-column prop="status" label="状态" :min-width="flexWidth('status',crud.data,'状态')"> <el-table-column prop="status" label="状态" :min-width="flexWidth('status',crud.data,'状态')">
<template slot-scope="scope"> <template slot-scope="scope">