Commit 08d97908 by liuyang

2024-05-11 优化工序设置多公司无法重复添加并且可以多公司使用,

工序单价导入解析去空格
parent bb091811
...@@ -4,9 +4,9 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; ...@@ -4,9 +4,9 @@ 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.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sj.domain.HGSJ001; import com.baosight.hggp.hg.sj.domain.HGSJ001;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.ErrorCodeUtils; import com.baosight.hggp.util.ErrorCodeUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
...@@ -80,12 +80,13 @@ public class ServiceHGSJ001 extends ServiceEPBase { ...@@ -80,12 +80,13 @@ public class ServiceHGSJ001 extends ServiceEPBase {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据 // 写入数据
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HGSJ001 hpsc012 = new HGSJ001(); HGSJ001 hpsj001 = new HGSJ001();
hpsc012.fromMap(resultRows.get(i)); hpsj001.fromMap(resultRows.get(i));
if (hpsc012.getId() == null || hpsc012.getId() == 0) { queryDeviceCode(hpsj001);
this.add(hpsc012); if (hpsj001.getId() == null || hpsj001.getId() == 0) {
this.add(hpsj001);
} else { } else {
this.modify(hpsc012); this.modify(hpsj001);
} }
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
...@@ -134,4 +135,16 @@ public class ServiceHGSJ001 extends ServiceEPBase { ...@@ -134,4 +135,16 @@ public class ServiceHGSJ001 extends ServiceEPBase {
} }
return inInfo; return inInfo;
} }
/**
* 工序重复校验
* @param hgsj001 工序设置
*/
public void queryDeviceCode(HGSJ001 hgsj001){
Map<String,Object> map = new HashMap<>();
map.put("processName",hgsj001.getProcessName().trim());
map.put(HGSJ001.FIELD_DELETE_FLAG,hgsj001.getDeleteFlag());
List<HGSJ001> hgsj001s = this.dao.query(HGSJ001.QUERY,map);
AssertUtils.isNotEmpty(hgsj001s, String.format("工序名称[%s]已存在,添加失败!", hgsj001.getProcessName()));
}
} }
...@@ -38,7 +38,7 @@ public class ServiceHGSJ002A extends ServiceEPBase { ...@@ -38,7 +38,7 @@ public class ServiceHGSJ002A extends ServiceEPBase {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID),null); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_BOX_BLOCK_ID),null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROCESS_CODE_BLOCK_ID), CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROCESS_CODE_BLOCK_ID),
new HashMap<String,Object>(){{ new HashMap<String,Object>(){{
put(HGSJ002A.FIELD_FACTORY_CODE,factoryCode); //put(HGSJ002A.FIELD_FACTORY_CODE,factoryCode);
put(HGSJ002A.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);}} put(HGSJ002A.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);}}
); );
return inInfo; return inInfo;
......
...@@ -196,8 +196,9 @@ public class ServiceHGSJ003 extends ServiceEPBase { ...@@ -196,8 +196,9 @@ public class ServiceHGSJ003 extends ServiceEPBase {
Map map = HGSJTools.Hgsj003.getCompany(UserSession.getLoginName(),OrgTypeEnum.COMPANY.getCode()); Map map = HGSJTools.Hgsj003.getCompany(UserSession.getLoginName(),OrgTypeEnum.COMPANY.getCode());
param.put(HGSJ003.FIELD_FACTORY_CODE, map.get("orgEname")); param.put(HGSJ003.FIELD_FACTORY_CODE, map.get("orgEname"));
param.put(HGSJ003.FIELD_FACTORY_NAME, map.get("orgCname")); param.put(HGSJ003.FIELD_FACTORY_NAME, map.get("orgCname"));
param.put("orgType", OrgTypeEnum.COMPANY.getCode()); param.put(HGSJ003.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
param.put("loginName",UserSession.getLoginName()); //param.put("orgType", OrgTypeEnum.COMPANY.getCode());
//param.put("loginName",UserSession.getLoginName());
param.put(HGSJ003.FIELD_ACCOUNT_CODE,UserSessionUtils.getAccountCode()); param.put(HGSJ003.FIELD_ACCOUNT_CODE,UserSessionUtils.getAccountCode());
List list = new ArrayList<>(Arrays.asList(HGSJ003.FIELD_PROCESS_CODE,HGSJ003.FIELD_PROCESS_NAME,HGSJ003.FIELD_PROCESS_CLASS_NAME, List list = new ArrayList<>(Arrays.asList(HGSJ003.FIELD_PROCESS_CODE,HGSJ003.FIELD_PROCESS_NAME,HGSJ003.FIELD_PROCESS_CLASS_NAME,
......
...@@ -107,6 +107,9 @@ ...@@ -107,6 +107,9 @@
<isNotEmpty prepend=" AND " property="status"> <isNotEmpty prepend=" AND " property="status">
STATUS = #status# STATUS = #status#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="processNames">
PROCESS_NAME LIKE CONCAT('%', #processNames#, '%')
</isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
......
...@@ -364,13 +364,9 @@ ...@@ -364,13 +364,9 @@
'' as "thick" '' as "thick"
from hggp.hggy001 from hggp.hggy001
where ACCOUNT_CODE = #accountCode# where ACCOUNT_CODE = #accountCode#
AND FACTORY_CODE IN ( <isNotEmpty prepend=" AND " property="deleteFlag">
select distinct DELETE_FLAG = #deleteFlag#
ORG_ENAME </isNotEmpty>
from iplat_hggp.txsog01 A
inner join iplat_hggp.txsog02 B ON A.ORG_ID = B.ORG_ID
where A.ACCOUNT_CODE = #accountCode# and A.ORG_TYPE in (#orgType#) AND B.USER_ID = #loginName#
)
</select> </select>
<select id="queryCompanyCode" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryCompanyCode" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
......
...@@ -219,13 +219,13 @@ public class ExcelUtils { ...@@ -219,13 +219,13 @@ public class ExcelUtils {
break; break;
case "HGSJ003": case "HGSJ003":
HGSJ003 hgsj003 = new HGSJ003(); HGSJ003 hgsj003 = new HGSJ003();
Map<String, String> mapSmall = HGSJTools.Hgsj003.getSmallCode("hggp.hgsj.processClass"); Map mapSmall = HGSJTools.Hgsj003.getSmallCode("hggp.hgsj.processClass");
for (Map<?, ?> map : arrayList) { for (Map<?, ?> map : arrayList) {
String processClass = MapUtils.getString(mapSmall, map.get(HGSJ003.FIELD_PROCESS_CLASS_NAME)); String processClass = MapUtils.getString(mapSmall, StringUtils.trimToEmpty(map.get(HGSJ003.FIELD_PROCESS_CLASS_NAME).toString()));
AssertUtils.isEmpty(processClass, String.format("工序分类[%s]代码不存在,添加失败!", map.get(HGSJ003.FIELD_PROCESS_CLASS_NAME))); AssertUtils.isEmpty(processClass, String.format("工序分类[%s]代码不存在,添加失败!", map.get(HGSJ003.FIELD_PROCESS_CLASS_NAME)));
hgsj003.fromMap(map); hgsj003.fromMap(map);
// 设置规格 // 设置规格
if (org.apache.commons.lang3.StringUtils.isBlank(hgsj003.getSpec())) { if (StringUtils.isBlank(hgsj003.getSpec())) {
hgsj003.setSpec(HGSJTools.Hgsj003.jointSpec(hgsj003.getLength(), hgsj003.getWidth(), hgsj003.getThick())); hgsj003.setSpec(HGSJTools.Hgsj003.jointSpec(hgsj003.getLength(), hgsj003.getWidth(), hgsj003.getThick()));
} }
// 去除空格 // 去除空格
......
...@@ -178,10 +178,7 @@ let save = function (btnNode) { ...@@ -178,10 +178,7 @@ let save = function (btnNode) {
if(flag) { if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
JSUtils.submitGridsData("result", "HGSJ001", "save", true, JSUtils.submitGridsData("result", "HGSJ001", "save", true);
function (e) {
query();
});
btnNode.attr("disabled", false); btnNode.attr("disabled", 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