代码更新

This commit is contained in:
2022-08-24 10:15:56 +08:00
parent df49d82d34
commit 98336e9c34
8 changed files with 18 additions and 45 deletions

View File

@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import lombok.RequiredArgsConstructor;
import org.nl.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
import org.nl.wms.basedata.em.service.DevicebomService;
import org.nl.wms.basedata.em.service.dto.DevicebomDto;
import org.nl.wms.basedata.master.service.ClassstandardService;
@@ -106,14 +107,10 @@ public class DevicebomServiceImpl implements DevicebomService {
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
String device_bom_code = whereJson.getString("device_bom_code");
JSONObject jsonObject = bomMstTab.query("device_bom_code = '" + device_bom_code + "' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonObject)) throw new BadRequestException("此编码已存在");
// 插入主表
JSONObject jsonMst = new JSONObject();
jsonMst.put("device_bom_id", IdUtil.getSnowflake(1,1).nextId());
jsonMst.put("device_bom_code",device_bom_code);
jsonMst.put("device_bom_code", CodeUtil.getNewCode("DEVICE_BOM_CODE"));
jsonMst.put("material_name",whereJson.getString("material_name"));
jsonMst.put("material_type_id",whereJson.get("material_type_id"));
jsonMst.put("detail_count",tableData.size());
@@ -152,7 +149,6 @@ public class DevicebomServiceImpl implements DevicebomService {
// 修改主表
JSONObject jsonMst = bomMstTab.query("device_bom_id ='" + device_bom_id + "'").uniqueResult(0);
jsonMst.put("device_bom_code",whereJson.getString("device_bom_code"));
jsonMst.put("material_name",whereJson.getString("material_name"));
jsonMst.put("material_type_id",whereJson.get("material_type_id"));
jsonMst.put("detail_count",tableData.size());
@@ -177,9 +173,6 @@ public class DevicebomServiceImpl implements DevicebomService {
bomDtlTab.insert(jsonDtl);
}
String device_bom_code = whereJson.getString("device_bom_code");
JSONArray jsonObject = bomMstTab.query("device_bom_code = '" + device_bom_code + "' and is_delete = '0'").getResultJSONArray(0);
if (jsonObject.size() > 1) throw new BadRequestException("此编码已存在");
}
@Override

View File

@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import lombok.RequiredArgsConstructor;
import org.nl.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
import org.nl.wms.basedata.em.service.DevicefaultclassService;
import org.nl.wms.basedata.em.service.dto.DevicefaultclassDto;
import org.nl.wms.basedata.master.service.ClassstandardService;
@@ -101,13 +102,9 @@ public class DevicefaultclassServiceImpl implements DevicefaultclassService {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicefaultclass");
String device_faultclass_code = whereJson.getString("device_faultclass_code");
JSONObject jsonObject = wo.query("device_faultclass_code = '" + device_faultclass_code + "' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonObject)) throw new BadRequestException("此编码已存在");
JSONObject json = new JSONObject();
json.put("device_faultclass_id",IdUtil.getSnowflake(1,1).nextId());
json.put("device_faultclass_code", whereJson.getString("device_faultclass_code"));
json.put("device_faultclass_code", CodeUtil.getNewCode("DEVICE_FACLASS_CODE"));
json.put("device_faultclass_name", whereJson.getString("device_faultclass_name"));
json.put("material_type_id", whereJson.getString("material_type_id"));
json.put("solutions", whereJson.getString("solutions"));
@@ -126,7 +123,6 @@ public class DevicefaultclassServiceImpl implements DevicefaultclassService {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicefaultclass");
JSONObject json = wo.query("device_faultclass_id = '" + whereJson.getString("device_faultclass_id") + "'").uniqueResult(0);
json.put("device_faultclass_code", whereJson.getString("device_faultclass_code"));
json.put("device_faultclass_name", whereJson.getString("device_faultclass_name"));
json.put("material_type_id", whereJson.getString("material_type_id"));
json.put("solutions", whereJson.getString("solutions"));
@@ -136,10 +132,6 @@ public class DevicefaultclassServiceImpl implements DevicefaultclassService {
json.put("update_time", DateUtil.now());
wo.update(json);
String device_faultclass_code = whereJson.getString("device_faultclass_code");
JSONArray jsonObject = wo.query("device_faultclass_code = '" + device_faultclass_code + "' and is_delete = '0'").getResultJSONArray(0);
if (jsonObject.size() > 1) throw new BadRequestException("此编码已存在");
}
@Override

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSON;
import lombok.RequiredArgsConstructor;
import org.nl.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
import org.nl.wms.basedata.em.service.DevicemaintenanceitemsService;
import org.nl.wms.basedata.em.service.dto.DevicemaintenanceitemsDto;
import org.nl.wql.WQL;
@@ -94,7 +95,7 @@ public class DevicemaintenanceitemsServiceImpl implements Devicemaintenanceitems
JSONObject json = new JSONObject();
json.put("maint_item_id", IdUtil.getSnowflake(1,1).nextId());
json.put("maint_item_code", whereJson.getString("maint_item_code"));
json.put("maint_item_code", CodeUtil.getNewCode("MAINT_ITEM_CODE"));
json.put("maint_item_name", whereJson.getString("maint_item_name"));
json.put("item_level", whereJson.getString("item_level"));
json.put("contents", whereJson.getString("contents"));
@@ -119,7 +120,6 @@ public class DevicemaintenanceitemsServiceImpl implements Devicemaintenanceitems
WQLObject wo = WQLObject.getWQLObject("em_bi_devicemaintenanceitems");
JSONObject json = wo.query("maint_item_id = '" + whereJson.getString("maint_item_id") + "'").uniqueResult(0);
json.put("maint_item_code", whereJson.getString("maint_item_code"));
json.put("maint_item_name", whereJson.getString("maint_item_name"));
json.put("item_level", whereJson.getString("item_level"));
json.put("contents", whereJson.getString("contents"));

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSON;
import lombok.RequiredArgsConstructor;
import org.nl.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
import org.nl.wms.basedata.em.service.DevicerepairitemsService;
import org.nl.wms.basedata.em.service.dto.DevicerepairitemsDto;
import org.nl.wql.WQL;
@@ -90,7 +91,7 @@ public class DevicerepairitemsServiceImpl implements DevicerepairitemsService {
JSONObject json = new JSONObject();
json.put("repair_item_id", IdUtil.getSnowflake(1,1).nextId());
json.put("repair_item_code", whereJson.getString("repair_item_code"));
json.put("repair_item_code", CodeUtil.getNewCode("REPAIR_ITEM_CODE"));
json.put("repair_item_name", whereJson.getString("repair_item_name"));
json.put("requirement", whereJson.getString("requirement"));
json.put("remark", whereJson.getString("remark"));
@@ -115,7 +116,6 @@ public class DevicerepairitemsServiceImpl implements DevicerepairitemsService {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicerepairitems");
JSONObject json = wo.query("repair_item_id = '" + whereJson.getString("repair_item_id") + "'").uniqueResult(0);
json.put("repair_item_code", whereJson.getString("repair_item_code"));
json.put("repair_item_name", whereJson.getString("repair_item_name"));
json.put("requirement", whereJson.getString("requirement"));
json.put("remark", whereJson.getString("remark"));