This commit is contained in:
zds
2022-07-19 18:54:24 +08:00
parent 45daab1a39
commit 4f30f55b66
6 changed files with 62 additions and 60 deletions

View File

@@ -67,6 +67,12 @@ public class EquipmentfileServiceImpl implements EquipmentfileService {
Long deptId = currentUser.getDeptId();
WQLObject mstTab = WQLObject.getWQLObject("EM_BI_EquipmentFile"); // 工艺路线主表
WQLObject EM_BI_DeviceLifeCycle = WQLObject.getWQLObject("EM_BI_DeviceLifeCycle"); // 工艺路线主表
String device_code = json.getString("device_code");
JSONObject old = mstTab.query("is_delete='0' and device_code='"+device_code+"'").uniqueResult(0);
if(old!=null){
throw new BadRequestException("已存在相同设备代码的档案!");
}
// 插入主表
String devicerecord_id = IdUtil.getSnowflake(1, 1).nextId()+"";
json.put("devicerecord_id", devicerecord_id);
@@ -100,8 +106,13 @@ public class EquipmentfileServiceImpl implements EquipmentfileService {
String now = DateUtil.now();
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
Long deptId = currentUser.getDeptId();
WQLObject mstTab = WQLObject.getWQLObject("EM_BI_EquipmentFile"); // 工艺路线主表
String device_code = whereJson.getString("device_code");
String devicerecord_id = whereJson.getString("devicerecord_id");
JSONObject old = mstTab.query("is_delete='0' and device_code='"+device_code+"' and devicerecord_id <>'"+devicerecord_id+"'").uniqueResult(0);
if(old!=null){
throw new BadRequestException("已存在相同设备代码的档案!");
}
WQLObject EM_BI_DeviceLifeCycle = WQLObject.getWQLObject("EM_BI_DeviceLifeCycle"); // 工艺路线主表
whereJson.put("update_optid", currentUserId);
whereJson.put("update_optname", nickName);
@@ -186,7 +197,7 @@ public class EquipmentfileServiceImpl implements EquipmentfileService {
jo2.put("create_id", currentUserId);
jo2.put("create_name", nickName);
jo2.put("create_time", now);
EM_BI_DeviceLifeCycle.insert(jo);
EM_BI_DeviceLifeCycle.insert(jo2);
} else if ("11".equals(status)) {//禁用
map.put("status", "11");
@@ -201,12 +212,12 @@ public class EquipmentfileServiceImpl implements EquipmentfileService {
jo2.put("create_id", currentUserId);
jo2.put("create_name", nickName);
jo2.put("create_time", now);
EM_BI_DeviceLifeCycle.insert(jo);
EM_BI_DeviceLifeCycle.insert(jo2);
}
map.put("update_optid", currentUserId + "");
map.put("update_optname", nickName);
map.put("update_time", now);
mstTab.update(map, "workorder_id ='" + jo.getString("workorder_id") + "'");
mstTab.update(map, "devicerecord_id ='" + jo.getString("devicerecord_id") + "'");
}
}
@@ -249,7 +260,8 @@ public class EquipmentfileServiceImpl implements EquipmentfileService {
@Override
public JSONArray queryBomList(Map whereJson) {
WQLObject EM_BI_DeviceBOM = WQLObject.getWQLObject("EM_BI_DeviceBOM"); // 工艺路线主表
JSONArray ja = EM_BI_DeviceBOM.query("is_delete='0' and is_used='1'").getResultJSONArray(0);
String material_type_id = (String) whereJson.get("material_type_id");
JSONArray ja = EM_BI_DeviceBOM.query("is_delete='0' and is_used='1' and material_type_id='"+material_type_id+"'").getResultJSONArray(0);
return ja;
}
}

View File

@@ -55,12 +55,14 @@
equipmentfile.*,
classstandard.class_name AS material_type_name,
dept1.name AS use_deptname,
dept2.name AS belong_deptname
dept2.name AS belong_deptname,
dept3.name AS use_groupname
FROM
em_bi_equipmentfile equipmentfile
LEFT JOIN md_pb_classstandard classstandard ON classstandard.class_id = equipmentfile.material_type_id
LEFT JOIN sys_dept dept1 ON dept1.dept_id = equipmentfile.use_deptid
LEFT JOIN sys_dept dept2 ON dept2.dept_id = equipmentfile.belong_deptid
LEFT JOIN sys_dept dept3 ON dept3.dept_id = equipmentfile.use_groupid
WHERE
equipmentfile.is_delete = '0'
OPTION 输入.is_produceuse <> ""