Commit 8460c00a by liuyang

2024-06-18 优化存货档案去掉自动添加编码,改为手动编码,导入添加存货编码

parent 1a15e08b
...@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.pz.service; ...@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.pz.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
...@@ -132,7 +133,11 @@ public class ServiceHGPZ005 extends ServiceBase { ...@@ -132,7 +133,11 @@ public class ServiceHGPZ005 extends ServiceBase {
* @throws Exception * @throws Exception
*/ */
private void add(HGPZ005 hgpz005) throws Exception { private void add(HGPZ005 hgpz005) throws Exception {
hgpz005.setInventCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.INVENT_CODE)); //hgpz005.setInventCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.INVENT_CODE));
Map<String, Object> params = new HashMap<>();
params.put(HGPZ005.FIELD_INVENT_CODE, hgpz005.getInventCode());
List list = DaoBase.getInstance().query(HGPZ005.QUERY, params);
AssertUtils.isNotEmpty(list, String.format("存货编码[%s]已存在", hgpz005.getInventCode()));
DaoUtils.insert(HGPZ005.INSERT, hgpz005); DaoUtils.insert(HGPZ005.INSERT, hgpz005);
} }
......
...@@ -590,7 +590,7 @@ public class HGPZTools { ...@@ -590,7 +590,7 @@ public class HGPZTools {
*/ */
public static void add(List<Map> list){ public static void add(List<Map> list){
List<HGPZ004> hgpz004s = DaoBase.getInstance().query(HGPZ004.QUERY, new HashMap<>()); List<HGPZ004> hgpz004s = DaoBase.getInstance().query(HGPZ004.QUERY, new HashMap<>());
Map parmap = hgpz004s.stream().collect(Collectors.toMap(HGPZ004::getInventTypeName, HGPZ004::getInventType)); Map parmap = hgpz004s.stream().collect(Collectors.toMap(HGPZ004::getInventTypeName, HGPZ004::getInventType,(v1, v2) -> v1));
for (Map map:list) { for (Map map:list) {
String inventType = MapUtils.getString(parmap, StringUtils.trimToEmpty(map.get(HGPZ005.FIELD_INVENT_TYPE).toString())); String inventType = MapUtils.getString(parmap, StringUtils.trimToEmpty(map.get(HGPZ005.FIELD_INVENT_TYPE).toString()));
AssertUtils.isEmpty(inventType, String.format("存货类型[%s]代码不存在,添加失败!", inventType)); AssertUtils.isEmpty(inventType, String.format("存货类型[%s]代码不存在,添加失败!", inventType));
...@@ -598,7 +598,11 @@ public class HGPZTools { ...@@ -598,7 +598,11 @@ public class HGPZTools {
hgpz005.fromMap(map); hgpz005.fromMap(map);
hgpz005.setInventType(inventType); hgpz005.setInventType(inventType);
hgpz005.setStatus(1); //默认启用 hgpz005.setStatus(1); //默认启用
hgpz005.setInventCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.INVENT_CODE)); Map<String, Object> params = new HashMap<>();
params.put(HGPZ005.FIELD_INVENT_CODE, hgpz005.getInventCode());
List hgpz005s = DaoBase.getInstance().query(HGPZ005.QUERY, params);
AssertUtils.isNotEmpty(hgpz005s, String.format("存货编码[%s]已存在", hgpz005.getInventCode()));
//hgpz005.setInventCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.INVENT_CODE));
// 设置规格 // 设置规格
if (StringUtils.isBlank(hgpz005.getSpec())) { if (StringUtils.isBlank(hgpz005.getSpec())) {
hgpz005.setSpec(HGPZTools.HgPz005.jointSpec(hgpz005.getLength(), hgpz005.getWidth(), hgpz005.getThick())); hgpz005.setSpec(HGPZTools.HgPz005.jointSpec(hgpz005.getLength(), hgpz005.getWidth(), hgpz005.getThick()));
......
...@@ -164,6 +164,7 @@ let save = function () { ...@@ -164,6 +164,7 @@ let save = function () {
let flag = true; let flag = true;
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let inventType= item.get("inventType"); let inventType= item.get("inventType");
let inventCode= item.get("inventCode");
let inventName= item.get("inventName"); let inventName= item.get("inventName");
let length= item.get("length"); let length= item.get("length");
let width= item.get("width"); let width= item.get("width");
...@@ -174,6 +175,11 @@ let save = function () { ...@@ -174,6 +175,11 @@ let save = function () {
flag = false; flag = false;
return false; return false;
} }
if(isBlank(inventCode)){
message("选中的第"+(index+1)+"行\"存货编码\",不能为空!");
flag = false;
return false;
}
if(isBlank(inventName)){ if(isBlank(inventName)){
message("选中的第"+(index+1)+"行\"存货名称\",不能为空!"); message("选中的第"+(index+1)+"行\"存货名称\",不能为空!");
flag = false; flag = false;
...@@ -184,7 +190,6 @@ let save = function () { ...@@ -184,7 +190,6 @@ let save = function () {
flag = false; flag = false;
return false; return false;
} }
if(!isBlank(length) && !isNumber(length)){ if(!isBlank(length) && !isNumber(length)){
message("选中的第" + (i + 1) + "行\"\",必须是数值!"); message("选中的第" + (i + 1) + "行\"\",必须是数值!");
flag = false; flag = false;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="160" align="center"/> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="160" align="center"/>
<EF:EFColumn cname="存货编码" ename="inventCode" width="140" align="center" enable="false"/> <EF:EFColumn cname="存货编码" ename="inventCode" width="140" align="center" enable="true" readonly="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="true" <EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="true"
blockName="invent_type_box_block_id" textField="textField" valueField="valueField" blockName="invent_type_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false" columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment