Commit b388ccc0 by liuyang

2024-10-15 物料清单添加物料生成模板和模糊选择功能

parent 13919f0c
...@@ -29,6 +29,7 @@ public class HGPZ015A extends DaoEPBase { ...@@ -29,6 +29,7 @@ public class HGPZ015A extends DaoEPBase {
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/ public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/ public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_PARENT_ID = "parentId"; /* 父节点ID*/ public static final String FIELD_PARENT_ID = "parentId"; /* 父节点ID*/
public static final String FIELD_PARENT_PRDT_CODE = "parentProdCode"; /* 父节点-产品编码*/
public static final String FIELD_PARENT_PRDT_NAME = "parentPrdtName"; /* 父节点-产品名称*/ public static final String FIELD_PARENT_PRDT_NAME = "parentPrdtName"; /* 父节点-产品名称*/
public static final String FIELD_TYPE = "type"; /* 类别*/ public static final String FIELD_TYPE = "type"; /* 类别*/
public static final String FIELD_LEAF = "leaf"; /* 是否有叶子节点*/ public static final String FIELD_LEAF = "leaf"; /* 是否有叶子节点*/
...@@ -115,6 +116,7 @@ public class HGPZ015A extends DaoEPBase { ...@@ -115,6 +116,7 @@ public class HGPZ015A extends DaoEPBase {
private String projCode = " "; /* 项目编码*/ private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/ private String projName = " "; /* 项目名称*/
private String parentId = " "; /* 父节点ID*/ private String parentId = " "; /* 父节点ID*/
private String parentPrdtCode = " "; /* 父节点-产品编码*/
private String parentPrdtName = " "; /* 父节点-产品名称*/ private String parentPrdtName = " "; /* 父节点-产品名称*/
private String type = " "; /* 类别*/ private String type = " "; /* 类别*/
private String leaf = "1"; /* 是否有叶子节点*/ private String leaf = "1"; /* 是否有叶子节点*/
...@@ -180,6 +182,11 @@ public class HGPZ015A extends DaoEPBase { ...@@ -180,6 +182,11 @@ public class HGPZ015A extends DaoEPBase {
eiColumn.setDescName("父节点ID"); eiColumn.setDescName("父节点ID");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PARENT_PRDT_CODE);
eiColumn.setDescName("父节点-产品编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PARENT_PRDT_NAME); eiColumn = new EiColumn(FIELD_PARENT_PRDT_NAME);
eiColumn.setDescName("父节点-产品名称"); eiColumn.setDescName("父节点-产品名称");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -940,6 +947,14 @@ public class HGPZ015A extends DaoEPBase { ...@@ -940,6 +947,14 @@ public class HGPZ015A extends DaoEPBase {
this.pgStatus = pgStatus; this.pgStatus = pgStatus;
} }
public String getParentPrdtCode() {
return parentPrdtCode;
}
public void setParentPrdtCode(String parentPrdtCode) {
this.parentPrdtCode = parentPrdtCode;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -955,6 +970,7 @@ public class HGPZ015A extends DaoEPBase { ...@@ -955,6 +970,7 @@ public class HGPZ015A extends DaoEPBase {
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode)); setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName)); setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setParentId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_ID)), parentId)); setParentId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_ID)), parentId));
setParentPrdtCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_PRDT_CODE)), parentPrdtCode));
setParentPrdtName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_PRDT_NAME)), parentPrdtName)); setParentPrdtName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_PRDT_NAME)), parentPrdtName));
setType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_TYPE)), type)); setType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_TYPE)), type));
setLeaf(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LEAF)), leaf)); setLeaf(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LEAF)), leaf));
...@@ -1002,6 +1018,7 @@ public class HGPZ015A extends DaoEPBase { ...@@ -1002,6 +1018,7 @@ public class HGPZ015A extends DaoEPBase {
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE))); map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME))); map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_PARENT_ID, StringUtils.toString(parentId, eiMetadata.getMeta(FIELD_PARENT_ID))); map.put(FIELD_PARENT_ID, StringUtils.toString(parentId, eiMetadata.getMeta(FIELD_PARENT_ID)));
map.put(FIELD_PARENT_PRDT_CODE, StringUtils.toString(parentPrdtCode, eiMetadata.getMeta(FIELD_PARENT_PRDT_CODE)));
map.put(FIELD_PARENT_PRDT_NAME, StringUtils.toString(parentPrdtName, eiMetadata.getMeta(FIELD_PARENT_PRDT_NAME))); map.put(FIELD_PARENT_PRDT_NAME, StringUtils.toString(parentPrdtName, eiMetadata.getMeta(FIELD_PARENT_PRDT_NAME)));
map.put(FIELD_TYPE, StringUtils.toString(type, eiMetadata.getMeta(FIELD_TYPE))); map.put(FIELD_TYPE, StringUtils.toString(type, eiMetadata.getMeta(FIELD_TYPE)));
map.put(FIELD_LEAF, StringUtils.toString(leaf, eiMetadata.getMeta(FIELD_LEAF))); map.put(FIELD_LEAF, StringUtils.toString(leaf, eiMetadata.getMeta(FIELD_LEAF)));
......
...@@ -8,8 +8,12 @@ import com.baosight.hggp.hg.pz.domain.HGPZ015; ...@@ -8,8 +8,12 @@ import com.baosight.hggp.hg.pz.domain.HGPZ015;
import com.baosight.hggp.hg.pz.domain.HGPZ015A; import com.baosight.hggp.hg.pz.domain.HGPZ015A;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.HGSC001; import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC004A; import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
...@@ -61,7 +65,7 @@ public class ServiceHGPZ015 extends ServiceBase { ...@@ -61,7 +65,7 @@ public class ServiceHGPZ015 extends ServiceBase {
@OperationLogAnnotation(operModul = "产品模板",operType = "查询",operDesc = "查询") @OperationLogAnnotation(operModul = "产品模板",operType = "查询",operDesc = "查询")
public EiInfo count(EiInfo inInfo) { public EiInfo count(EiInfo inInfo) {
HashMap map = new HashMap(); HashMap map = new HashMap();
map.put("id",inInfo.getString("id")); map.put("projCode",inInfo.getString("projCode"));
List<HGPZ015> query = DaoBase.getInstance().query("HPPZ015.query", map); List<HGPZ015> query = DaoBase.getInstance().query("HPPZ015.query", map);
if (query.size() > 0) { if (query.size() > 0) {
inInfo.setStatus(1); inInfo.setStatus(1);
...@@ -80,9 +84,9 @@ public class ServiceHGPZ015 extends ServiceBase { ...@@ -80,9 +84,9 @@ public class ServiceHGPZ015 extends ServiceBase {
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
HashMap map = new HashMap(); HashMap map = new HashMap();
map.put("projCode",inInfo.getString("id")); map.put("projCode",inInfo.getString("projCode"));
List<HGPZ015> query = DaoBase.getInstance().query("HGPZ015.query", map); List<HGPZ015> query = DaoBase.getInstance().query("HGPZ015.query", map);
HGSC001 hpsc001 = HGSCTools.Hgsc001.getByCode(inInfo.getString("id")); List<HGSC004> hpsc004s = HGSCTools.Hgsc004.queryProjCode(inInfo.getString("projCode"));
if (query.size() > 0) { if (query.size() > 0) {
dao.delete("HGPZ015.deleteByProjCode",map); dao.delete("HGPZ015.deleteByProjCode",map);
dao.delete("HGPZ015A.delete",map); dao.delete("HGPZ015A.delete",map);
...@@ -90,22 +94,28 @@ public class ServiceHGPZ015 extends ServiceBase { ...@@ -90,22 +94,28 @@ public class ServiceHGPZ015 extends ServiceBase {
try { try {
HGPZ015 hgpz015 = new HGPZ015(); HGPZ015 hgpz015 = new HGPZ015();
// hgpz015.setId(Long.parseLong(inInfo.getString("id"))); // hgpz015.setId(Long.parseLong(inInfo.getString("id")));
hgpz015.setProjCode(hpsc001.getProjCode()); hgpz015.setProjCode(hpsc004s.get(0).getProjCode());
hgpz015.setTemplateName(inInfo.getString("templateName")); hgpz015.setTemplateName(inInfo.getString("templateName"));
hgpz015.setCreatedName(UserSessionUtils.getLoginCName());
hgpz015.setRemark(inInfo.getString("materialId"));
hgpz015.setUpdatedBy(null); hgpz015.setUpdatedBy(null);
hgpz015.setUpdatedTime(null); hgpz015.setUpdatedTime(null);
DaoUtils.insert("HGPZ015.insert", hgpz015.toMap()); DaoUtils.insert("HGPZ015.insert", hgpz015);
//模板物料清单 //模板物料清单
List<HGSC004A> hppz015AList = DaoBase.getInstance().query("HGSC004A.query", new HashMap<String, Object>(){{ List<HGSC004A> hpsc004aList = DaoBase.getInstance().query("HGSC004A.query", new HashMap<String, Object>(){{
put("projCode", hpsc001.getProjCode()); put("projCode", hpsc004s.get(0).getProjCode());
put("materialId", inInfo.getString("materialId"));
}}); }});
if (hppz015AList.size() > 0){ if (hpsc004aList.size() > 0){
hppz015AList.forEach(hgsc004A ->{ hpsc004aList.forEach(hgsc004A ->{
HGPZ015A hgpz015A = new HGPZ015A(); HGPZ015A hgpz015A = new HGPZ015A();
hgpz015A.fromMap(hgsc004A.toMap());
initHgpz015(hgpz015A,hgsc004A); initHgpz015(hgpz015A,hgsc004A);
hgpz015A.setRemark(hgpz015.getId().toString());
if (hgsc004A.getLeaf().toString().equals(inInfo.getString("templateName"))){ if (hgsc004A.getLeaf().toString().equals(inInfo.getString("templateName"))){
hgpz015A.setParentPrdtName(""); hgpz015A.setParentPrdtName("");
} }
hgpz015A.setId(null);
DaoUtils.insert("HGPZ015A.insert", hgpz015A); DaoUtils.insert("HGPZ015A.insert", hgpz015A);
}); });
} }
...@@ -127,23 +137,18 @@ public class ServiceHGPZ015 extends ServiceBase { ...@@ -127,23 +137,18 @@ public class ServiceHGPZ015 extends ServiceBase {
*/ */
@OperationLogAnnotation(operModul = "产品模板",operType = "新增",operDesc = "物料生成") @OperationLogAnnotation(operModul = "产品模板",operType = "新增",operDesc = "物料生成")
public EiInfo assign(EiInfo inInfo) { public EiInfo assign(EiInfo inInfo) {
HashMap map = new HashMap();
map.put("projCode",inInfo.getString("projCode"));
try { try {
Map qaramap = EiInfoUtils.getFirstRow(inInfo);
//模板清单 //模板清单
List<HGPZ015A> hppz015AList = DaoBase.getInstance().query("HGPZ015A.queryById",map); List<HGPZ015A> hppz015AList = DaoBase.getInstance().query("HGPZ015A.queryById",
if (hppz015AList.size()==0) { new HashMap<String, Object>(){{
inInfo.setStatus(EiConstant.STATUS_FAILURE); put(HGSC004A.FIELD_proj_code,qaramap.get("projCode"));
inInfo.setMsg("生成物料清单失败!该模板物料清单不存在!"); }});
return inInfo; AssertUtils.isEmpty(hppz015AList, "生成物料清单失败!该模板物料清单不存在!");
}
//生成清单 //生成清单
HGSC001 hpsc001New = HGSCTools.Hgsc001.getByCode(inInfo.getString("projCodeNew")); List<HGSC004> hgsc004s = HGSCTools.Hgsc004.queryProjCode(qaramap.get("projCodeNew").toString());
HashMap hashMap = new HashMap();
hashMap.put("leaf",0 ); HGPZTools.HgPz015A.chekParentId(hppz015AList,hgsc004s.get(0));
hashMap.put("projCode",hpsc001New.getProjCode());
DaoUtils.update("HGSC004A.updateTreeNodeLeaf2",hashMap);
HGPZTools.HgPz015A.chekParentId(hppz015AList,hpsc001New);
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("生成物料清单成功!"); inInfo.setMsg("生成物料清单成功!");
} catch (PlatException e) { } catch (PlatException e) {
...@@ -218,7 +223,8 @@ public class ServiceHGPZ015 extends ServiceBase { ...@@ -218,7 +223,8 @@ public class ServiceHGPZ015 extends ServiceBase {
public void initHgpz015(HGPZ015A hgpz015A,HGSC004A hgsc004A){ public void initHgpz015(HGPZ015A hgpz015A,HGSC004A hgsc004A){
hgpz015A.setProjCode(hgsc004A.getProjCode()); hgpz015A.setProjCode(hgsc004A.getProjCode());
hgpz015A.setProjName(hgsc004A.getProjName()); hgpz015A.setProjName(hgsc004A.getProjName());
hgpz015A.setParentId(hgsc004A.getParentProdCode()); hgpz015A.setParentId(hgsc004A.getId().toString());
hgpz015A.setParentPrdtCode(hgsc004A.getParentProdCode());
hgpz015A.setParentPrdtName(hgsc004A.getParentProdName()); hgpz015A.setParentPrdtName(hgsc004A.getParentProdName());
hgpz015A.setLeaf(hgsc004A.getLeaf().toString()); hgpz015A.setLeaf(hgsc004A.getLeaf().toString());
hgpz015A.setPrdtType(Integer.valueOf(hgsc004A.getProductType())); hgpz015A.setPrdtType(Integer.valueOf(hgsc004A.getProductType()));
...@@ -233,5 +239,6 @@ public class ServiceHGPZ015 extends ServiceBase { ...@@ -233,5 +239,6 @@ public class ServiceHGPZ015 extends ServiceBase {
hgpz015A.setNum(hgsc004A.getQuantity()); hgpz015A.setNum(hgsc004A.getQuantity());
hgpz015A.setUnitWt(hgsc004A.getSingleWeight()); hgpz015A.setUnitWt(hgsc004A.getSingleWeight());
hgpz015A.setTotalWt(hgsc004A.getTotalWeight()); hgpz015A.setTotalWt(hgsc004A.getTotalWeight());
hgpz015A.setCreatedName(UserSessionUtils.getLoginCName());
} }
} }
...@@ -176,6 +176,9 @@ ...@@ -176,6 +176,9 @@
UPDATED_NAME <!-- 修改时间 --> UPDATED_NAME <!-- 修改时间 -->
) )
VALUES (#id#, #accountCode#, #depCode#, #projCode#, #templateCode#, #templateName#, #remark#, #deleteFlag#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedTime#, #updatedName#) VALUES (#id#, #accountCode#, #depCode#, #projCode#, #templateCode#, #templateName#, #remark#, #deleteFlag#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedTime#, #updatedName#)
<selectKey resultClass="java.lang.Long" keyProperty="id">
SELECT MAX(ID) as "id" FROM ${hggpSchema}.HGPZ015
</selectKey>
</insert> </insert>
<delete id="delete"> <delete id="delete">
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
PROJ_CODE as "projCode", <!-- 项目编码 --> PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 --> PROJ_NAME as "projName", <!-- 项目名称 -->
PARENT_ID as "parentId", <!-- 父节点-部件编码 --> PARENT_ID as "parentId", <!-- 父节点-部件编码 -->
PARENT_PRDT_CODE as "parentPrdtCode",
PARENT_PRDT_NAME as "parentPrdtName", <!-- 父节点-部件名称 --> PARENT_PRDT_NAME as "parentPrdtName", <!-- 父节点-部件名称 -->
TYPE as "type", <!-- 类别 --> TYPE as "type", <!-- 类别 -->
LEAF as "leaf", <!-- 是否有叶子节点 --> LEAF as "leaf", <!-- 是否有叶子节点 -->
...@@ -47,6 +48,7 @@ ...@@ -47,6 +48,7 @@
A.PROJ_CODE as "projCode", <!-- 项目编码 --> A.PROJ_CODE as "projCode", <!-- 项目编码 -->
A.PROJ_NAME as "projName", <!-- 项目名称 --> A.PROJ_NAME as "projName", <!-- 项目名称 -->
A.PARENT_ID as "parentId", <!-- 父节点-部件编码 --> A.PARENT_ID as "parentId", <!-- 父节点-部件编码 -->
A.PARENT_PRDT_CODE as "parentPrdtCode",
A.PARENT_PRDT_NAME as "parentPrdtName", <!-- 父节点-部件名称 --> A.PARENT_PRDT_NAME as "parentPrdtName", <!-- 父节点-部件名称 -->
A.TYPE as "type", <!-- 类别 --> A.TYPE as "type", <!-- 类别 -->
A.LEAF as "leaf", <!-- 是否有叶子节点 --> A.LEAF as "leaf", <!-- 是否有叶子节点 -->
...@@ -79,20 +81,7 @@ ...@@ -79,20 +81,7 @@
B.STATUS as "pgStatus" <!-- 派工状态 --> B.STATUS as "pgStatus" <!-- 派工状态 -->
</sql> </sql>
<sql id="authCondition">
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition"> <sql id="condition">
<include refid="authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
ID = #id# ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -122,20 +111,7 @@ ...@@ -122,20 +111,7 @@
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<sql id="authCondition1">
<isNotEmpty prepend=" AND " property="accountCode">
A.ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
A.DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCodes">
A.DEP_CODE IN <iterate close=")" open="(" conjunction="," property="depCodes">#depCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition1"> <sql id="condition1">
<include refid="authCondition1"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
A.ID = #id# A.ID = #id#
</isNotEmpty> </isNotEmpty>
...@@ -205,6 +181,7 @@ ...@@ -205,6 +181,7 @@
PROJ_CODE, <!-- 项目编码 --> PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 --> PROJ_NAME, <!-- 项目名称 -->
PARENT_ID, <!-- 父节点-部件编码 --> PARENT_ID, <!-- 父节点-部件编码 -->
PARENT_PRDT_CODE,
PARENT_PRDT_NAME, <!-- 父节点-部件名称 --> PARENT_PRDT_NAME, <!-- 父节点-部件名称 -->
TYPE, <!-- 类别 --> TYPE, <!-- 类别 -->
LEAF, <!-- 是否有叶子节点 --> LEAF, <!-- 是否有叶子节点 -->
...@@ -225,6 +202,7 @@ ...@@ -225,6 +202,7 @@
STATUS, <!-- 状态 0-未提交,1-已提交 --> STATUS, <!-- 状态 0-未提交,1-已提交 -->
DEL_STATUS, <!-- 状态 1未删除,0已删除 --> DEL_STATUS, <!-- 状态 1未删除,0已删除 -->
CREATED_BY, <!-- 创建人 --> CREATED_BY, <!-- 创建人 -->
CREATED_NAME,
CREATED_TIME, <!-- 创建时间 --> CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 --> UPDATED_BY, <!-- 更新人 -->
UPDATED_TIME, <!-- 更新时间 --> UPDATED_TIME, <!-- 更新时间 -->
...@@ -235,10 +213,10 @@ ...@@ -235,10 +213,10 @@
WIDTH, <!-- 宽 --> WIDTH, <!-- 宽 -->
THICK <!-- 厚 --> THICK <!-- 厚 -->
) )
VALUES (#id#, #accountCode#, #depCode#, #projCode#, #projName#, #parentId#, #parentPrdtName#, VALUES (#id#, #accountCode#, #depCode#, #projCode#, #projName#, #parentId#, #parentPrdtCode#, #parentPrdtName#,
#type#, #leaf#, #sort#, #icon#, #prdtType#, #prdtCode#, #prdtName#, #inventRecordId#, #num#, #type#, #leaf#, #sort#, #icon#, #prdtType#, #prdtCode#, #prdtName#, #inventRecordId#, #num#,
#unitWt#, #totalWt#, #filePath1#, #filePath2#, #filePath3#, #filePath4#, #filePath5#, #status#, #unitWt#, #totalWt#, #filePath1#, #filePath2#, #filePath3#, #filePath4#, #filePath5#, #status#,
#delStatus#, #createdBy#, #createdTime#, #updatedBy#, #updatedTime#, #remark#, #lv#, #spec#, #delStatus#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedTime#, #remark#, #lv#, #spec#,
#length#, #width#, #thick#) #length#, #width#, #thick#)
</insert> </insert>
...@@ -314,6 +292,7 @@ ...@@ -314,6 +292,7 @@
PROJ_CODE = #projCode#, <!-- 项目编码 --> PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 --> PROJ_NAME = #projName#, <!-- 项目名称 -->
PARENT_ID = #parentId#, <!-- 父节点-部件编码 --> PARENT_ID = #parentId#, <!-- 父节点-部件编码 -->
PARENT_PRDT_CODE = #parentPrdtCode#,
PARENT_PRDT_NAME = #parentPrdtName#, <!-- 父节点-部件名称 --> PARENT_PRDT_NAME = #parentPrdtName#, <!-- 父节点-部件名称 -->
TYPE = #type#, <!-- 类别 --> TYPE = #type#, <!-- 类别 -->
LEAF = #leaf#, <!-- 是否有叶子节点 --> LEAF = #leaf#, <!-- 是否有叶子节点 -->
...@@ -357,6 +336,8 @@ ...@@ -357,6 +336,8 @@
PROJ_NAME as "projName",<!-- 项目名称 --> PROJ_NAME as "projName",<!-- 项目名称 -->
ID as "label", <!-- 名部件编码--> ID as "label", <!-- 名部件编码-->
PRDT_NAME as "text", <!-- 部件名称 --> PRDT_NAME as "text", <!-- 部件名称 -->
PARENT_PRDT_CODE as "parentPrdtCode",
PARENT_PRDT_NAME as "parentPrdtName",
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID --> INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
PARENT_ID as "pId", <!-- 父节点编码 --> PARENT_ID as "pId", <!-- 父节点编码 -->
TYPE as "type", <!-- 类别 --> TYPE as "type", <!-- 类别 -->
...@@ -483,6 +464,7 @@ ...@@ -483,6 +464,7 @@
PROJ_CODE as "projCode", <!-- 项目编码 --> PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 --> PROJ_NAME as "projName", <!-- 项目名称 -->
PARENT_ID as "parentId", <!-- 父节点-部件编码 --> PARENT_ID as "parentId", <!-- 父节点-部件编码 -->
PARENT_PRDT_CODE as "parentPrdtCode",
PARENT_PRDT_NAME as "parentPrdtName", <!-- 父节点-部件名称 --> PARENT_PRDT_NAME as "parentPrdtName", <!-- 父节点-部件名称 -->
TYPE as "type", <!-- 类别 --> TYPE as "type", <!-- 类别 -->
LEAF as "leaf", <!-- 是否有叶子节点 --> LEAF as "leaf", <!-- 是否有叶子节点 -->
......
package com.baosight.hggp.hg.pz.tools; package com.baosight.hggp.hg.pz.tools;
import com.baosight.hggp.common.InventTypeEnum; import com.baosight.hggp.common.InventTypeEnum;
import com.baosight.hggp.common.ProductTypeEnum;
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.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
...@@ -14,10 +15,7 @@ import com.baosight.hggp.hg.pz.domain.HGPZ005; ...@@ -14,10 +15,7 @@ import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ007; import com.baosight.hggp.hg.pz.domain.HGPZ007;
import com.baosight.hggp.hg.pz.domain.HGPZ009; import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.*;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
...@@ -949,56 +947,52 @@ public class HGPZTools { ...@@ -949,56 +947,52 @@ public class HGPZTools {
* @param hppz015AList * @param hppz015AList
* @return * @return
*/ */
public static void chekParentId(List<HGPZ015A> hppz015AList,HGSC001 hgsc001) { public static void chekParentId(List<HGPZ015A> hppz015AList,HGSC004 hgsc004) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
Long root = null;
Long prdtId = null;
Long prdtId_new = null;
HGSC004A hpsc002ById = HGSCTools.THGSC004A.getByTree3(hgsc001.getProjCode(),null);
root=hpsc002ById.getId();
List<HGPZ015A> hppz015s = hppz015AList.stream().filter(hgsc004A -> hgsc004A.getLv()==3).collect(Collectors.toList());
//处理部件 //处理部件
for (int i = 0; i<hppz015AList.size(); i++) { for (HGPZ015A hppz015A: hppz015s) {
if(hppz015AList.get(i).getLv()==2){ HGSC004A hgsc004A = new HGSC004A();
prdtId=hppz015AList.get(i).getId();//旧 hgsc004A.fromMap(hppz015A.toMap());
HGSC004A hgsc004A = new HGSC004A(); hgsc004A.setId(null);
hgsc004A.fromMap(hppz015AList.get(i).toMap()); hgsc004A.setMaterialId(hgsc004.getId());
hgsc004A.setId(null); hgsc004A.setCompanyCode(hgsc004.getCompanyCode());
hgsc004A.setParentProdCode(root.toString()); hgsc004A.setCompanyName(hgsc004.getCompanyName());
hgsc004A.setCreatedName(UserSession.getUserId()); hgsc004A.setProductType(hppz015A.getPrdtType().toString());
hgsc004A.setCreatedTime(sdf.format(new Date())); hgsc004A.setProductId(hppz015A.getInventRecordId());
hgsc004A.setProjCode(hgsc001.getProjCode()); hgsc004A.setProjCode(hgsc004.getProjCode());
hgsc004A.setProjName(hgsc001.getProjName()); hgsc004A.setProjName(hgsc004.getProjName());
hgsc004A.setParentProdName(hgsc001.getProjName()); hgsc004A.setParentProdCode(hgsc004.getProjCode());
hgsc004A.setApprovalStatus(CommonConstant.YesNo.NO_0); hgsc004A.setParentProdName(hgsc004.getProjName());
// hgsc004A.setDelStatus(CommonConstant.YesNo.NO_0); hgsc004A.setProductCode(hppz015A.getPrdtCode());
DaoBase.getInstance().insert("HGSC004A.insert", hgsc004A); hgsc004A.setProductName(hppz015A.getPrdtName());
HGSC004A byProjCode; hgsc004A.setQuantity(hppz015A.getNum());
if (prdtId_new!=null) hgsc004A.setSingleWeight(hppz015A.getUnitWt());
byProjCode = HGSCTools.THGSC004A.getByTree2(hgsc004A.getProjCode(), prdtId_new.toString()); hgsc004A.setTotalWeight(hppz015A.getTotalWt());
else byProjCode = HGSCTools.THGSC004A.getByTree2(hgsc004A.getProjCode(), null); HGSCTools.THGSC004A.addEntity(hgsc004A,hgsc004);
prdtId_new=byProjCode.getId(); //DaoUtils.insert(HGSC004A.INSERT, hgsc004A);
for (int j = 0; j<hppz015AList.size(); j++) { hppz015AList.stream().filter(hgpz015A -> hgpz015A.getParentPrdtCode().equals(hppz015A.getPrdtCode()))
if(hppz015AList.get(j).getLv()==3) { .forEach(hgpz015A -> {
if(Long.parseLong(hppz015AList.get(j).getParentId())==prdtId){ HGSC004A hpsc004Alv = new HGSC004A();
HGSC004A hpsc002_lv = new HGSC004A(); hpsc004Alv.fromMap(hgpz015A.toMap());
hpsc002_lv.fromMap(hppz015AList.get(j).toMap()); hpsc004Alv.setId(null);
hpsc002_lv.setId(null); hpsc004Alv.setCompanyCode(hgsc004.getCompanyCode());
hgsc004A.setParentProdCode(prdtId_new.toString()); hpsc004Alv.setCompanyName(hgsc004.getCompanyName());
hpsc002_lv.setCreatedName(UserSession.getUserId()); hpsc004Alv.setProductType(hgpz015A.getPrdtType().toString());
hpsc002_lv.setProjCode(hgsc001.getProjCode()); hpsc004Alv.setProductId(hgpz015A.getInventRecordId());
hpsc002_lv.setProjName(hgsc001.getProjName()); hpsc004Alv.setMaterialId(hgsc004A.getMaterialId());
hpsc002_lv.setCreatedTime(sdf.format(new Date())); hpsc004Alv.setProjCode(hgsc004.getProjCode());
hgsc004A.setApprovalStatus(CommonConstant.YesNo.NO_0); hpsc004Alv.setProjName(hgsc004.getProjName());
// hpsc002_lv.setDelStatus(CommonConstant.YesNo.NO_0); hpsc004Alv.setParentProdCode(hgsc004A.getProjCode());
DaoBase.getInstance().insert("HGSC004A.insert", hpsc002_lv); hpsc004Alv.setParentProdName(hgsc004A.getProjName());
} hpsc004Alv.setProductCode(hgpz015A.getPrdtCode());
} hpsc004Alv.setProductName(hgpz015A.getPrdtName());
} hpsc004Alv.setQuantity(hgpz015A.getNum());
hpsc004Alv.setSingleWeight(hgpz015A.getUnitWt());
hpsc004Alv.setTotalWeight(hgpz015A.getTotalWt());
} HGSCTools.THGSC004A.addEntity(hpsc004Alv,hgsc004);
//DaoUtils.insert(HGSC004A.INSERT, hpsc002_lv);
});
} }
} }
} }
......
...@@ -7,6 +7,7 @@ import com.baosight.hggp.util.LogUtils; ...@@ -7,6 +7,7 @@ import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Map; import java.util.Map;
...@@ -14,7 +15,7 @@ import java.util.Map; ...@@ -14,7 +15,7 @@ import java.util.Map;
* @author:songx * @author:songx
* @date:2024/2/6,10:39 * @date:2024/2/6,10:39
*/ */
public class ServiceHGSC004F extends ServiceBase { public class ServiceHGSC004F extends ServiceEPBase {
/** /**
* 画面初始化 * 画面初始化
...@@ -22,7 +23,7 @@ public class ServiceHGSC004F extends ServiceBase { ...@@ -22,7 +23,7 @@ public class ServiceHGSC004F extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
@OperationLogAnnotation(operModul = "产品模板",operType = "查询",operDesc = "物料清单选择-产品模板-初始化") @Override
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGPZ015().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGPZ015().eiMetadata);
...@@ -38,7 +39,6 @@ public class ServiceHGSC004F extends ServiceBase { ...@@ -38,7 +39,6 @@ public class ServiceHGSC004F extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
@OperationLogAnnotation(operModul = "产品模板",operType = "查询",operDesc = "物料清单选择-产品模板-查询")
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
......
...@@ -580,6 +580,32 @@ public class HGSCTools { ...@@ -580,6 +580,32 @@ public class HGSCTools {
AssertUtils.isEmpty(results, String.format("项目编码[%s]信息不存在", projCode)); AssertUtils.isEmpty(results, String.format("项目编码[%s]信息不存在", projCode));
return results.get(0); return results.get(0);
} }
/**
* 添加物料清单
* @param hgsc004a 物料清单
* @param hgsc004 父物料清单
*/
public static void addEntity(HGSC004A hgsc004a, HGSC004 hgsc004) {
//不为4级都有叶子节点,父节点需要+1
if(hgsc004a.getLv().intValue() < 4){
hgsc004a.setLv(hgsc004a.getLv() + 1);
}
if(hgsc004a.getLv().intValue() == 3){
hgsc004a.setLeaf(2);
}else{
hgsc004a.setLeaf(1);
}
hgsc004a.setProductStatus(HGConstant.ProductStatus.WTJ);
if(hgsc004a.getLv().intValue() == 3){
hgsc004a.setProductType(ProductTypeEnum.STRUCT.getCode().toString());
}else{
hgsc004a.setProductType(ProductTypeEnum.PART.getCode().toString());
}
//主表全部提交时需要有改变状态
DaoUtils.insert(HGSC004A.INSERT, hgsc004a);
}
} }
public static class THGSC004B{ public static class THGSC004B{
public static void save(HGSC004A oldHGSC004A,HGSC004A newHGSC004A) { public static void save(HGSC004A oldHGSC004A,HGSC004A newHGSC004A) {
......
...@@ -22,7 +22,7 @@ $(function () { ...@@ -22,7 +22,7 @@ $(function () {
$("#GENERATE").on("click", function () { $("#GENERATE").on("click", function () {
var projCode = $("#inqu_status-0-projCode").val(); var projCode = $("#inqu_status-0-projCode").val();
var info = new EiInfo() var info = new EiInfo()
info.set("id", projCode); info.set("projCode", projCode);
EiCommunicator.send("HGPZ015", "count", info, { EiCommunicator.send("HGPZ015", "count", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
if (ei["status"] == 1) { if (ei["status"] == 1) {
...@@ -91,9 +91,9 @@ $(function () { ...@@ -91,9 +91,9 @@ $(function () {
height: "70%", height: "70%",
callbackName: function (row) { callbackName: function (row) {
var info = new EiInfo() var info = new EiInfo()
info.set("id", row.id); info.set("inqu_status-0-id", row.id);
info.set("projCode", row.projCode); info.set("inqu_status-0-projCode", row.projCode);
info.set("projCodeNew", projCodeNew); info.set("inqu_status-0-projCodeNew", projCodeNew);
EiCommunicator.send("HGPZ015", "assign", info, { EiCommunicator.send("HGPZ015", "assign", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
if (ei["status"] == -1) { if (ei["status"] == -1) {
...@@ -130,7 +130,8 @@ $(function () { ...@@ -130,7 +130,8 @@ $(function () {
function generateMode(projCode,generateName) { function generateMode(projCode,generateName) {
const inEiInfo = new EiInfo(); const inEiInfo = new EiInfo();
inEiInfo.set("id", projCode); inEiInfo.set("projCode", projCode);
inEiInfo.set("materialId", $("#inqu_status-0-materialId").val());
inEiInfo.set("templateName", generateName); inEiInfo.set("templateName", generateName);
EiCommunicator.send('HGPZ015', 'insert', inEiInfo, { EiCommunicator.send('HGPZ015', 'insert', inEiInfo, {
onSuccess(response) { onSuccess(response) {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" hidden="true"/> <EF:EFColumn ename="projCode" cname="项目编码" hidden="true"/>
<EF:EFColumn ename="templateName" cname="模板名称" enable="false" width="120" align="center"/> <EF:EFColumn ename="templateName" cname="模板名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="createdBy" enable="false" cname="创建人"/> <EF:EFColumn ename="createdName" enable="false" cname="创建人"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</EF:EFPage> </EF:EFPage>
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