Commit 02d6fd49 by liuyang

1.优化生成产品模板功能

parent 1417705e
......@@ -18,6 +18,14 @@ public class HgPzSqlConstant {
public static final String UPDATE_COMPOSING_COEFF = MODULE + "updateComposingCoeff";
}
public class HgPz015A {
// 模块名称
public static final String MODULE = "HGPZ015A.";
// 批量新增
public static final String BATCH_INSERT = MODULE + "batchInsert";
}
/**
*
* @author songx
......
......@@ -104,11 +104,11 @@ public class HGPZ015A extends DaoEPBase {
public static final String COL_PGSTATUS = "PGSTATUS"; /* 派工状态*/
public static final String COL_LV = "LV"; /* 树的层级*/
public static final String QUERY = "HPSC002.query";
public static final String COUNT = "HPSC002.count";
public static final String INSERT = "HPSC002.insert";
public static final String UPDATE = "HPSC002.update";
public static final String DELETE = "HPSC002.delete";
public static final String QUERY = "HGPZ015A.query";
public static final String COUNT = "HGPZ015A.count";
public static final String INSERT = "HGPZ015A.insert";
public static final String UPDATE = "HGPZ015A.update";
public static final String DELETE = "HGPZ015A.delete";
private Long id;
private String accountCode = " "; /* 企业编码 预留*/
......@@ -138,8 +138,8 @@ public class HGPZ015A extends DaoEPBase {
private String filePath3 = " "; /* 文件地址3*/
private String filePath4 = " "; /* 文件地址4*/
private String filePath5 = " "; /* 文件地址5*/
private Integer status; /* 状态 0-未审核,1-已审核*/
private Integer delStatus; /* 状态 1未删除,0已删除*/
private Integer status = 0; /* 状态 0-未审核,1-已审核*/
private Integer delStatus = 0; /* 状态 1未删除,0已删除*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
......
......@@ -4,6 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.pz.constant.HgPzSqlConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ015;
import com.baosight.hggp.hg.pz.domain.HGPZ015A;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
......@@ -11,6 +12,7 @@ import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -20,10 +22,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
*
......@@ -52,7 +51,7 @@ public class ServiceHGPZ015 extends ServiceBase {
@Override
public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/
EiInfo outInfo = super.query(inInfo, "HGPZ015.query", new HGPZ015());
EiInfo outInfo = super.query(inInfo, HGPZ015.QUERY, new HGPZ015());
return outInfo;
}
......@@ -64,7 +63,7 @@ public class ServiceHGPZ015 extends ServiceBase {
public EiInfo count(EiInfo inInfo) {
HashMap map = new HashMap();
map.put("projCode",inInfo.getString("projCode"));
List<HGPZ015> query = DaoBase.getInstance().query("HPPZ015.query", map);
List<HGPZ015> query = DaoBase.getInstance().query(HGPZ015.QUERY, map);
if (query.size() > 0) {
inInfo.setStatus(1);
inInfo.set("tempName",query.get(0).getTemplateName());
......@@ -83,7 +82,7 @@ public class ServiceHGPZ015 extends ServiceBase {
public EiInfo insert(EiInfo inInfo) {
HashMap map = new HashMap();
map.put("projCode",inInfo.getString("projCode"));
List<HGPZ015> query = DaoBase.getInstance().query("HGPZ015.query", map);
List<HGPZ015> query = DaoBase.getInstance().query(HGPZ015.QUERY, map);
List<HGSC004> hpsc004s = HGSCTools.Hgsc004.queryProjCode(inInfo.getString("projCode"));
if (query.size() > 0) {
dao.delete("HGPZ015.deleteByProjCode",map);
......@@ -98,24 +97,27 @@ public class ServiceHGPZ015 extends ServiceBase {
hgpz015.setRemark(inInfo.getString("materialId"));
hgpz015.setUpdatedBy(null);
hgpz015.setUpdatedTime(null);
DaoUtils.insert("HGPZ015.insert", hgpz015);
DaoUtils.insert(HGPZ015.INSERT, hgpz015);
//模板物料清单
List<HGSC004A> hpsc004aList = DaoBase.getInstance().query("HGSC004A.query", new HashMap<String, Object>(){{
List<HGSC004A> hpsc004aList = DaoBase.getInstance().query(HGSC004A.QUERY, new HashMap<String, Object>(){{
put("projCode", hpsc004s.get(0).getProjCode());
put("materialId", inInfo.getString("materialId"));
}});
if (hpsc004aList.size() > 0){
List<HGPZ015A> rows = new ArrayList<>();
hpsc004aList.forEach(hgsc004A ->{
HGPZ015A hgpz015A = new HGPZ015A();
hgpz015A.fromMap(hgsc004A.toMap());
//hgpz015A.fromMap(hgsc004A.toMap());
BeanUtils.copyProperties(hgsc004A,hgpz015A);
initHgpz015(hgpz015A,hgsc004A);
hgpz015A.setRemark(hgpz015.getId().toString());
if (hgsc004A.getLeaf().toString().equals(inInfo.getString("templateName"))){
hgpz015A.setParentPrdtName("");
}
hgpz015A.setId(null);
DaoUtils.insert("HGPZ015A.insert", hgpz015A);
rows.add(hgpz015A);
});
DaoUtils.batchInsert(HgPzSqlConstant.HgPz015A.BATCH_INSERT, rows);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("生成产品模板成功!");
......@@ -219,21 +221,21 @@ public class ServiceHGPZ015 extends ServiceBase {
}
public void initHgpz015(HGPZ015A hgpz015A,HGSC004A hgsc004A){
hgpz015A.setProjCode(hgsc004A.getProjCode());
hgpz015A.setProjName(hgsc004A.getProjName());
//hgpz015A.setProjCode(hgsc004A.getProjCode());
//hgpz015A.setProjName(hgsc004A.getProjName());
hgpz015A.setParentId(hgsc004A.getId().toString());
hgpz015A.setParentPrdtCode(hgsc004A.getParentProdCode());
hgpz015A.setParentPrdtName(hgsc004A.getParentProdName());
hgpz015A.setLeaf(hgsc004A.getLeaf().toString());
//hgpz015A.setParentPrdtCode(hgsc004A.getParentProdCode());
//hgpz015A.setParentPrdtName(hgsc004A.getParentProdName());
//hgpz015A.setLeaf(hgsc004A.getLeaf().toString());
hgpz015A.setPrdtType(Integer.valueOf(hgsc004A.getProductType()));
hgpz015A.setInventRecordId(hgsc004A.getProductId());
hgpz015A.setPrdtCode(hgsc004A.getProductCode());
hgpz015A.setPrdtName(hgsc004A.getProductName());
hgpz015A.setSpec(hgsc004A.getSpec());
hgpz015A.setLength(hgsc004A.getLength());
hgpz015A.setWidth(hgsc004A.getWidth());
hgpz015A.setThick(hgsc004A.getThick());
hgpz015A.setLv(hgsc004A.getLv());
//hgpz015A.setSpec(hgsc004A.getSpec());
//hgpz015A.setLength(hgsc004A.getLength());
//hgpz015A.setWidth(hgsc004A.getWidth());
//hgpz015A.setThick(hgsc004A.getThick());
//hgpz015A.setLv(hgsc004A.getLv());
hgpz015A.setNum(hgsc004A.getQuantity());
hgpz015A.setUnitWt(hgsc004A.getSingleWeight());
hgpz015A.setTotalWt(hgsc004A.getTotalWeight());
......
......@@ -220,6 +220,53 @@
#length#, #width#, #thick#)
</insert>
<insert id="batchInsert">
INSERT INTO ${hggpSchema}.hgpz015a (
ACCOUNT_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 -->
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
PARENT_ID, <!-- 父节点-部件编码 -->
PARENT_PRDT_CODE,
PARENT_PRDT_NAME, <!-- 父节点-部件名称 -->
TYPE, <!-- 类别 -->
LEAF, <!-- 是否有叶子节点 -->
SORT, <!-- 排序字段 -->
ICON, <!-- 图片地址 -->
PRDT_TYPE,
PRDT_CODE, <!-- 部件编码 -->
PRDT_NAME, <!-- 部件名称 -->
INVENT_RECORD_ID, <!-- 存货档案ID -->
NUM, <!-- 数量 -->
UNIT_WT, <!-- 单重 -->
TOTAL_WT, <!-- 总重 -->
FILE_PATH1, <!-- 文件地址1 -->
FILE_PATH2, <!-- 文件地址2 -->
FILE_PATH3, <!-- 文件地址3 -->
FILE_PATH4, <!-- 文件地址4 -->
FILE_PATH5, <!-- 文件地址5 -->
STATUS, <!-- 状态 0-未提交,1-已提交 -->
DEL_STATUS, <!-- 状态 1未删除,0已删除 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME,
CREATED_TIME, <!-- 创建时间 -->
REMARK, <!-- 备注 -->
LV,
SPEC,
LENGTH, <!-- 长 -->
WIDTH, <!-- 宽 -->
THICK <!-- 厚 -->
) VALUES
<iterate open="(" conjunction="), (" close=")" property="rows">
#rows[].accountCode#, #rows[].depCode#, #rows[].projCode#, #rows[].projName#, #rows[].parentId#,
#rows[].parentPrdtCode#, #rows[].parentPrdtName#, #rows[].type#, #rows[].leaf#, #rows[].sort#, #rows[].icon#,
#rows[].prdtType#, #rows[].prdtCode#, #rows[].prdtName#, #rows[].inventRecordId#, #rows[].num#, #rows[].unitWt#, #rows[].totalWt#,
#rows[].filePath1#, #rows[].filePath2#, #rows[].filePath3#, #rows[].filePath4#, #rows[].filePath5#,
#rows[].status#, #rows[].delStatus#, #rows[].createdBy#, #rows[].createdName#, #rows[].createdTime#,
#rows[].remark#, #rows[].lv#, #rows[].spec#, #rows[].length#, #rows[].width#, #rows[].thick#
</iterate>
</insert>
<insert id="insertMb" parameterClass="java.util.HashMap">
INSERT INTO ${hggpSchema}.hgpz015a(
ID,
......
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