Commit 6c6b8f18 by liulei

产品模板优化

parent f0d80ef0
......@@ -11,6 +11,7 @@ import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import lombok.extern.slf4j.Slf4j;
/**
* OSS凭证
*
......
......@@ -5,6 +5,7 @@ import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
......@@ -48,12 +49,15 @@ public class ServiceHPKC002B extends ServiceEPBase {
try {
Map queryMap = new HashMap();
queryMap.put("inventTypes", DEFAULT_INVENT_CODE);
Map queryMap2 = new HashMap();
queryMap2.put("companyCode", UserSessionUtils.getCompanyCode());
queryMap2.put("status", 1);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID), null, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID), queryMap2, false);
String hpsc006Id = inInfo.getString("inqu_status-0-hpsc006Id");
if (StringUtils.isNotBlank(hpsc006Id)) {
inInfo.set("inqu_result-0-hpsc006Id", hpsc006Id);
......
......@@ -5,6 +5,7 @@ import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
......@@ -25,7 +26,7 @@ import java.util.List;
import java.util.Map;
/**
* 生产领料挑选库存
* 耗材挑选库存
*
* @author:songx
* @date:2022/7/11,11:08
......@@ -48,12 +49,15 @@ public class ServiceHPKC004B extends ServiceEPBase {
try {
Map queryMap = new HashMap();
queryMap.put("inventTypes", DEFAULT_INVENT_CODE);
Map queryMap2 = new HashMap();
queryMap2.put("companyCode", UserSessionUtils.getCompanyCode());
queryMap2.put("status", 1);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID), null, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJ_RECORD_BLOCK_ID), queryMap2, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC010().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......
......@@ -126,7 +126,7 @@
$order$
</isNotEmpty>
<isEmpty property="order">
ID asc
ID desc
</isEmpty>
</dynamic>
</sql>
......
......@@ -58,36 +58,54 @@ public class ServiceHPPZ015 extends ServiceBase {
}
/**
* 查询操作.
*/
@OperationLogAnnotation(operModul = "产品模板",operType = "查询",operDesc = "查询")
public EiInfo count(EiInfo inInfo) {
HashMap map = new HashMap();
map.put("id",inInfo.getString("id"));
List<HPPZ015> query = this.dao.query("HPPZ015.query", map);
if (query.size() > 0) {
inInfo.setStatus(1);
inInfo.set("tempName",query.get(0).getTemplateName());
}else{
inInfo.setStatus(0);
}
return inInfo;
}
/**
* 新增操作.
*/
@OperationLogAnnotation(operModul = "产品模板",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
HashMap map = new HashMap();
map.put("projCode",inInfo.getString("projCode"));
map.put("id",inInfo.getString("id"));
List<HPPZ015> query = this.dao.query("HPPZ015.query", map);
HPSC001 hpsc001 = HPSCTools.HpSc001.getId(inInfo.getString("id"));
if (query.size() > 0) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("该产品模板已存在,生成失败!");
logError("生成产品模板失败","该产品模板已存在");
return inInfo;
dao.delete("HPPZ015.delete",map);
dao.delete("HPPZ015A.delete",hpsc001.toMap());
}
HPSC001 hpsc001 = HPSCTools.HpSc001.get(inInfo.getString("projCode"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
HPPZ015 HPPZ015 = new HPPZ015();
HPPZ015.setId(hpsc001.getId());
HPPZ015.setProjCode(inInfo.getString("projCode"));
HPPZ015.setId(Long.parseLong(inInfo.getString("id")));
HPPZ015.setProjCode(hpsc001.getProjCode());
HPPZ015.setTemplateName(inInfo.getString("templateName"));
HPPZ015.setCreatedBy(UserSession.getUserId());
HPPZ015.setCompanyCode(UserSession.getUserId());
HPPZ015.setCreatedName(UserSession.getLoginName());
HPPZ015.setCreatedName(UserSession.getUserId()+"-"+UserSession.getLoginCName());
HPPZ015.setCreatedTime(sdf.format(new Date()));
HPPZ015.setUpdatedBy(null);
HPPZ015.setUpdatedTime(null);
this.dao.insert("HPPZ015.insert", HPPZ015.toMap());
//模板物料清单
map.put("companyCode", UserSessionUtils.getCompanyCode());
map.put("templateName", inInfo.getString("templateName"));
map.put("projCode", hpsc001.getProjCode());
this.dao.insert("HPPZ015A.insertMb", map);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("生成产品模板成功!");
......@@ -119,7 +137,12 @@ public class ServiceHPPZ015 extends ServiceBase {
return inInfo;
}
//生成清单
HPPZTools.HpPz015A.chekParentId(hppz015AList);
HPSC001 hpsc001New = HPSCTools.HpSc001.get(inInfo.getString("projCodeNew"));
HashMap hashMap = new HashMap();
hashMap.put("leaf",0 );
hashMap.put("projCode",hpsc001New.getProjCode());
this.dao.update("HPSC002.updateTreeNodeLeaf2",hashMap);
HPPZTools.HpPz015A.chekParentId(hppz015AList,hpsc001New);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("生成物料清单成功!");
} catch (PlatException e) {
......
......@@ -8,6 +8,7 @@ import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.ds.domain.HPDS002;
import com.baosight.hpjx.hp.pz.domain.HPPZ015;
import com.baosight.hpjx.hp.pz.domain.HPPZ015A;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.*;
......@@ -19,12 +20,14 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
......@@ -127,6 +130,12 @@ public class ServiceHPPZ015A extends ServiceBase {
if (!HPPZ015A.getParentId().equals("root")) {
this.checkTreeNodeLeaf(HPPZ015A.getParentId());
}
HPPZ015 byPrdt = HPPZTools.HpPz015.getByPrdt(HPPZ015A.getProjCode());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
byPrdt.setUpdatedBy(UserSession.getUserId());
byPrdt.setUpdatedName(UserSession.getUserId()+"-"+UserSession.getLoginCName());
byPrdt.setUpdatedTime(sdf.format(new Date()));
this.dao.update("HPPZ015.update", byPrdt.toMap());
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("新增成功!");
} catch (PlatException e) {
......@@ -148,6 +157,12 @@ public class ServiceHPPZ015A extends ServiceBase {
EiInfo inInfo = new EiInfo();
try {
this.updateHPPZ015A(HPPZ015A);
HPPZ015 byPrdt = HPPZTools.HpPz015.getByPrdt(HPPZ015A.getProjCode());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
byPrdt.setUpdatedBy(UserSession.getUserId());
byPrdt.setUpdatedName(UserSession.getUserId()+"-"+UserSession.getLoginCName());
byPrdt.setUpdatedTime(sdf.format(new Date()));
this.dao.update("HPPZ015.update", byPrdt.toMap());
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!");
} catch (PlatException e) {
......@@ -194,6 +209,12 @@ public class ServiceHPPZ015A extends ServiceBase {
//处理项目管理中物料状态
HPSCTools.updateProjStatus(hppz002.getProjCode());
}
HPPZ015 byPrdt = HPPZTools.HpPz015.getByPrdt(hppz002.getProjCode());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
byPrdt.setUpdatedBy(UserSession.getUserId());
byPrdt.setUpdatedName(UserSession.getUserId()+"-"+UserSession.getLoginCName());
byPrdt.setUpdatedTime(sdf.format(new Date()));
this.dao.update("HPPZ015.update", byPrdt.toMap());
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("新增成功!");
......@@ -221,7 +242,13 @@ public class ServiceHPPZ015A extends ServiceBase {
hppz002.fromMap(map);
this.updateHPPZ015A(hppz002);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
HPPZ015 byPrdt = HPPZTools.HpPz015.getByPrdt(hppz002.getProjCode());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
byPrdt.setUpdatedBy(UserSession.getUserId());
byPrdt.setUpdatedName(UserSession.getUserId()+"-"+UserSession.getLoginCName());
byPrdt.setUpdatedTime(sdf.format(new Date()));
this.dao.update("HPPZ015.update", byPrdt.toMap());
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!");
} catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
......@@ -259,6 +286,7 @@ public class ServiceHPPZ015A extends ServiceBase {
AssertUtils.isNotEmpty(dbSc002s, String.format("部件[%s]已存在子节点不能删除", fSc002.getPrdtName()));
}
// 删除数据
String projCode=null;
for (Map resultRow : resultRows) {
HPPZ015A fSc002 = new HPPZ015A();
fSc002.fromMap(resultRow);
......@@ -270,8 +298,14 @@ public class ServiceHPPZ015A extends ServiceBase {
this.checkTreeNodeLeaf(fSc002.getParentId());
// 修改节点状态是叶子节点或非叶子节点
this.checkTreeNodeLeaf(fSc002.getId().toString());
projCode=fSc002.getProjCode();
}
HPPZ015 byPrdt = HPPZTools.HpPz015.getByPrdt(projCode);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
byPrdt.setUpdatedBy(UserSession.getUserId());
byPrdt.setUpdatedName(UserSession.getUserId()+"-"+UserSession.getLoginCName());
byPrdt.setUpdatedTime(sdf.format(new Date()));
this.dao.update("HPPZ015.update", byPrdt.toMap());
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
......@@ -333,9 +367,9 @@ public class ServiceHPPZ015A extends ServiceBase {
if (projId != null) {
Map map = new HashMap();
map.put("id", projId);
List list = dao.query("HPSC001.queryDomainById", map);
List list = dao.query("HPPZ015.queryDomainById", map);
if (list.size() > 0) {
String projCode = ((HPSC001)list.get(0)).getProjCode();
String projCode = ((HPPZ015)list.get(0)).getProjCode();
queryMap.put("projCode", projCode);
}
}
......
......@@ -190,4 +190,28 @@
ID = #id#
</update>
<select id="queryDomainById" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ015">
SELECT
ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
TEMPLATE_CODE as "templateCode", <!-- 产品代码 -->
TEMPLATE_NAME as "templateName", <!-- 产品名称 -->
REMARK as "remark", <!-- 备注 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除0:否1.是 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 修改人 -->
UPDATED_TIME as "updatedTime", <!-- 修改人名称 -->
UPDATED_NAME as "updatedName" <!-- 修改时间 -->
FROM ${hpjxSchema}.T_HPPZ015 WHERE 1=1
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
</select>
</sqlMap>
......@@ -217,14 +217,76 @@
</insert>
<insert id="insertMb" parameterClass="java.util.HashMap">
INSERT INTO hpjx.t_hppz015a (
SELECT * FROM hpjx.t_hpsc002 WHERE PROJ_CODE=#projCode# AND COMPANY_CODE=#companyCode#
INSERT INTO hpjx.t_hppz015a(
ID,
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 -->
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
PARENT_ID, <!-- 父节点-部件编码 -->
PARENT_PRDT_NAME, <!-- 父节点-部件名称 -->
TYPE, <!-- 类别 -->
LEAF, <!-- 是否有叶子节点 -->
SORT, <!-- 排序字段 -->
ICON, <!-- 图片地址 -->
PRDT_TYPE,
PRDT_CODE, <!-- 部件编码 -->
PRDT_NAME, <!-- 部件名称 -->
INVENT_RECORD_ID, <!-- 存货档案ID -->
NUM, <!-- 数量 -->
UNIT_WT, <!-- 单重 -->
TOTAL_WT, <!-- 总重 -->
STATUS, <!-- 状态 0-未提交,1-已提交 -->
DEL_STATUS, <!-- 状态 1未删除,0已删除 -->
CREATED_BY, <!-- 创建人 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_TIME, <!-- 更新时间 -->
REMARK, <!-- 备注 -->
LV,
SPEC,
LENGTH, <!-- 长 -->
WIDTH, <!-- 宽 -->
THICK <!-- 厚 -->
)(
SELECT
ID,
COMPANY_CODE, <!-- 企业编码 预留 -->
DEP_CODE, <!-- 部门编码 预留 -->
PROJ_CODE, <!-- 项目编码 -->
#templateName# as PROJ_NAME, <!-- 项目名称 -->
PARENT_ID, <!-- 父节点-部件编码 -->
CASE WHEN LEAF='0' THEN #templateName# ELSE PARENT_PRDT_NAME END as PARENT_PRDT_NAME, <!-- 父节点-部件名称 -->
TYPE, <!-- 类别 -->
LEAF, <!-- 是否有叶子节点 -->
SORT, <!-- 排序字段 -->
ICON, <!-- 图片地址 -->
PRDT_TYPE,
PRDT_CODE, <!-- 部件编码 -->
CASE WHEN PRDT_CODE=PROJ_CODE THEN #templateName# ELSE PRDT_NAME END as PRDT_NAME, <!-- 部件名称 -->
INVENT_RECORD_ID, <!-- 存货档案ID -->
NUM, <!-- 数量 -->
UNIT_WT, <!-- 单重 -->
TOTAL_WT, <!-- 总重 -->
STATUS, <!-- 状态 0-未提交,1-已提交 -->
DEL_STATUS, <!-- 状态 1未删除,0已删除 -->
CREATED_BY, <!-- 创建人 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_TIME, <!-- 更新时间 -->
REMARK, <!-- 备注 -->
LV,
SPEC,
LENGTH, <!-- 长 -->
WIDTH, <!-- 宽 -->
THICK <!-- 厚 -->
FROM hpjx.t_hpsc002 WHERE PROJ_CODE=#projCode# AND COMPANY_CODE=#companyCode#
)
</insert>
<!-- 删除 -->
<delete id="delete">
DELETE FROM hpjx.t_hppz015a WHERE ID = #id#
DELETE FROM hpjx.t_hppz015a WHERE PROJ_CODE = #projCode#
</delete>
<update id="update">
......@@ -390,6 +452,7 @@
<select id="queryById" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ015A">
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
DEP_CODE as "depCode", <!-- 部门编码 预留 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
......@@ -409,7 +472,7 @@
WIDTH as "width", <!-- 宽 -->
THICK as "thick" <!-- 厚 -->
FROM hpjx.t_hppz015a
WHERE 1=1 AND PROJ_CODE=#projCode#
WHERE 1=1 AND PROJ_CODE=#projCode# AND PARENT_ID NOT IN('root')
</select>
</sqlMap>
......@@ -7,6 +7,7 @@ import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.*;
import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.pz.domain.*;
......@@ -575,6 +576,24 @@ public class HPPZTools {
}
}
public static class HpPz015 {
/**
* 查询
*
* @param prdtCode
* @return
*/
public static HPPZ015 getByPrdt(String prdtCode) {
AssertUtils.isEmpty(prdtCode, "部件编码不能为空");
Map queryMap = new HashMap();
queryMap.put("prdtCode", prdtCode);
List<HPPZ015> results = DaoBase.getInstance().query("HPPZ015.query", queryMap);
AssertUtils.isNull(results, String.format("部件编码[%s]信息不存在", prdtCode));
return results.get(0);
}
}
/**
* HPSC002公共DAO定义
*
......@@ -639,48 +658,47 @@ public class HPPZTools {
* @param hppz015AList
* @return
*/
public static void chekParentId(List<HPPZ015A> hppz015AList) {
public static void chekParentId(List<HPPZ015A> hppz015AList,HPSC001 hpsc001) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
Long root = null;
Long prdtId = null;
Long prdtId_new = null;
//处理root
for (int i = 0; i<hppz015AList.size(); i++) {
if(hppz015AList.get(i).getLv().equals("1")){
HPSC002 hpsc002 = new HPSC002();
hpsc002.fromMap(hppz015AList.get(i).toMap());
hpsc002.setCreatedName(UserSession.getUserId());
hpsc002.setUpdatedTime(sdf.format(new Date()));
hpsc002.setStatus(CommonConstant.YesNo.NO_0);
hpsc002.setDelStatus(CommonConstant.YesNo.NO_0);
DaoBase.getInstance().insert("HPSC002.insert", hpsc002);
HPSC002 byProjCode = HPSCTools.HpSc002.getByProjCode(hpsc002.getProjCode());
root=byProjCode.getId();
break;
}
}
HPSC002 hpsc002ById = HPSCTools.HpSc002.getByTree3(hpsc001.getProjCode(),null);
root=hpsc002ById.getId();
//处理部件
for (int i = 0; i<hppz015AList.size(); i++) {
if(hppz015AList.get(i).getLv().equals("2")){
if(hppz015AList.get(i).getLv()==2){
prdtId=hppz015AList.get(i).getId();//旧
HPSC002 hpsc002 = new HPSC002();
hpsc002.setParentId(root.toString());
hpsc002.fromMap(hppz015AList.get(i).toMap());
hpsc002.setId(null);
hpsc002.setParentId(root.toString());
hpsc002.setCreatedName(UserSession.getUserId());
hpsc002.setUpdatedTime(sdf.format(new Date()));
hpsc002.setCreatedTime(sdf.format(new Date()));
hpsc002.setProjCode(hpsc001.getProjCode());
hpsc002.setProjName(hpsc001.getProjName());
hpsc002.setParentPrdtName(hpsc001.getProjName());
hpsc002.setStatus(CommonConstant.YesNo.NO_0);
hpsc002.setDelStatus(CommonConstant.YesNo.NO_0);
DaoBase.getInstance().insert("HPSC002.insert", hpsc002);
HPSC002 byProjCode = HPSCTools.HpSc002.getByProjCode(hpsc002.getProjCode());
HPSC002 byProjCode;
if (prdtId_new!=null)
byProjCode = HPSCTools.HpSc002.getByTree2(hpsc002.getProjCode(), prdtId_new.toString());
else byProjCode = HPSCTools.HpSc002.getByTree2(hpsc002.getProjCode(), null);
prdtId_new=byProjCode.getId();
for (int j = 0; j<hppz015AList.size(); j++) {
if(hppz015AList.get(i).getLv().equals("3")) {
if(hppz015AList.get(j).getParentId().equals(prdtId)){
if(hppz015AList.get(j).getLv()==3) {
if(Long.parseLong(hppz015AList.get(j).getParentId())==prdtId){
HPSC002 hpsc002_lv = new HPSC002();
hpsc002_lv.fromMap(hppz015AList.get(j).toMap());
hpsc002_lv.setId(null);
hpsc002_lv.setParentId(prdtId_new.toString());
hpsc002_lv.fromMap(hppz015AList.get(i).toMap());
hpsc002_lv.setCreatedName(UserSession.getUserId());
hpsc002_lv.setUpdatedTime(sdf.format(new Date()));
hpsc002_lv.setProjCode(hpsc001.getProjCode());
hpsc002_lv.setProjName(hpsc001.getProjName());
hpsc002_lv.setCreatedTime(sdf.format(new Date()));
hpsc002_lv.setStatus(CommonConstant.YesNo.NO_0);
hpsc002_lv.setDelStatus(CommonConstant.YesNo.NO_0);
DaoBase.getInstance().insert("HPSC002.insert", hpsc002_lv);
......
......@@ -3,11 +3,13 @@ package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.ds.domain.HPDS002;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ015;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.*;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
......@@ -75,6 +77,28 @@ public class ServiceHPSC002 extends ServiceBase {
}
/**
* 查询操作物料清单选择校验.
*/
@OperationLogAnnotation(operModul = "物料清单",operType = "查询",operDesc = "查询")
public EiInfo count(EiInfo inInfo) {
try {
HashMap map = new HashMap();
HPSC001 hpsc001 = HPSCTools.HpSc001.getId(inInfo.getString("id"));
map.put("projCode",hpsc001.getProjCode());
List<HPSC002> results = this.dao.query("HPSC002.queryTree", map);
if (results.size()>1){
inInfo.setStatus(0);
}else{
inInfo.setStatus(1);
inInfo.set("projCode",hpsc001.getProjCode());
}
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
......
......@@ -197,13 +197,27 @@
<select id="queryProjCode" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC001">
SELECT
PROJ_CODE as "projCode"
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 预留 -->
PROJ_TYPE as "projType", <!-- 项目类型 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PRINC1 as "princ1", <!-- 本公司项目负责人 -->
PRINC2 as "princ2", <!-- 客户项目负责人 -->
STATUS as "status", <!-- 状态 0-未提交,1-已提交 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
REMARK as "remark", <!-- 备注 -->
MATERIAL_STATUS as "materialStatus"
FROM hpjx.t_hpsc001 WHERE 1=1
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME = #projName#
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
</select>
......
......@@ -137,6 +137,12 @@
<isNotEmpty prepend=" AND " property="lv">
A.LV = #lv#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
A.PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
</sql>
<sql id="order">
......@@ -218,6 +224,12 @@
DELETE FROM hpjx.t_hpsc002 WHERE ID = #id#
</delete>
<!-- 删除 -->
<delete id="deleteByPro">
DELETE FROM hpjx.t_hpsc002 WHERE PROJ_CODE = #projCode#
</delete>
<update id="update">
UPDATE hpjx.t_hpsc002
SET
......@@ -290,6 +302,73 @@
ORDER BY CREATED_TIME DESC
</select>
<select id="queryTree2" resultClass="com.baosight.hpjx.hp.sc.domain.HPSC002" >
SELECT
ID as "id",
PRDT_TYPE as "prdtType",
PRDT_CODE as "prdtCode", <!-- 项目编码 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PRDT_name as "prdtName", <!-- 项目编码 -->
PROJ_NAME as "projName",<!-- 项目名称 -->
ID as "label", <!-- 名部件编码-->
PRDT_NAME as "text", <!-- 部件名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
PARENT_ID as "pId", <!-- 父节点编码 -->
TYPE as "type", <!-- 类别 -->
LEAF as "leaf", <!-- 是否有叶子节点 -->
SORT as "sort", <!-- 排序字段 -->
ICON as "icon", <!-- 图片地址 -->
LV as "lv",
SPEC as "spec"
FROM
hpjx.t_hpsc002
WHERE
1=1 AND PARENT_ID NOT IN ('root') AND LV != 3
<isNotEmpty prepend=" AND " property="pEname">
PARENT_ID = #pEname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="id">
ID != #id#
</isNotEmpty>
ORDER BY CREATED_TIME DESC
</select>
<select id="queryTree3" resultClass="com.baosight.hpjx.hp.sc.domain.HPSC002" >
SELECT
ID as "id",
PRDT_TYPE as "prdtType",
PRDT_CODE as "prdtCode", <!-- 项目编码 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PRDT_name as "prdtName", <!-- 项目编码 -->
PROJ_NAME as "projName",<!-- 项目名称 -->
ID as "label", <!-- 名部件编码-->
PRDT_NAME as "text", <!-- 部件名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
PARENT_ID as "pId", <!-- 父节点编码 -->
TYPE as "type", <!-- 类别 -->
LEAF as "leaf", <!-- 是否有叶子节点 -->
SORT as "sort", <!-- 排序字段 -->
ICON as "icon", <!-- 图片地址 -->
LV as "lv",
SPEC as "spec"
FROM
hpjx.t_hpsc002
WHERE
1=1
<isNotEmpty prepend=" AND " property="pEname">
PARENT_ID = #pEname#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
ORDER BY CREATED_TIME DESC
</select>
<!-- 根据父级ID查询 -->
<select id="queryTreeNodeByParentPrtdCode" resultClass="java.util.HashMap">
SELECT
......@@ -322,6 +401,10 @@
UPDATE hpjx.t_hpsc002 SET LEAF = #leaf# WHERE ID = #id#
</update>
<update id="updateTreeNodeLeaf2">
UPDATE hpjx.t_hpsc002 SET LEAF = #leaf# WHERE PROJ_CODE = #projCode#
</update>
<update id="check">
UPDATE hpjx.t_hpsc002 SET status = #status# WHERE ID = #id#
</update>
......
......@@ -262,6 +262,54 @@ public class HPSCTools {
AssertUtils.isNull(results, String.format("项目编码[%s]信息不存在", projCode));
return results.get(0);
}
/**
* 查询
*
* @param projCode
* @return
*/
public static HPSC002 getByTree(String projCode) {
AssertUtils.isEmpty(projCode, "项目编码不能为空");
Map queryMap = new HashMap();
queryMap.put("projCode", projCode);
List<HPSC002> results = DaoBase.getInstance().query("HPSC002.queryTree", queryMap);
AssertUtils.isNull(results, String.format("项目编码[%s]信息不存在", projCode));
return results.get(0);
}
/**
* 查询
*
* @param projCode
* @return
*/
public static HPSC002 getByTree2(String projCode,String id) {
AssertUtils.isEmpty(projCode, "项目编码不能为空");
Map queryMap = new HashMap();
queryMap.put("projCode", projCode);
queryMap.put("id", id);
List<HPSC002> results = DaoBase.getInstance().query("HPSC002.queryTree2", queryMap);
AssertUtils.isNull(results, String.format("项目编码[%s]信息不存在", projCode));
return results.get(0);
}
/**
* 查询
*
* @param projCode
* @return
*/
public static HPSC002 getByTree3(String projCode,String id) {
AssertUtils.isEmpty(projCode, "项目编码不能为空");
Map queryMap = new HashMap();
queryMap.put("projCode", projCode);
queryMap.put("id", id);
List<HPSC002> results = DaoBase.getInstance().query("HPSC002.queryTree3", queryMap);
AssertUtils.isNull(results, String.format("项目编码[%s]信息不存在", projCode));
return results.get(0);
}
/**
* 查询节点
......
......@@ -42,7 +42,7 @@
blockName="invent_name_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventRecordId" cname="规格(MM)" enable="false" width="100" align="center"
<EF:EFComboColumn ename="inventRecordId" cname="规格(MM)" enable="false" width="150" align="center"
blockName="invent_spec_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
......@@ -53,7 +53,7 @@
<EF:EFColumn ename="unitWeight" cname="单量(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="库存重量(KG)" enable="false" width="120" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150" type="hidden"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -26,7 +26,7 @@
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" autoFit="true" checkMode="row">
<EF:EFColumn ename="id" cname="库存ID" enable="false" width="60" align="center" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="100" align="center">
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="60" align="center">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('2')"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="false" width="120" align="center"
......@@ -41,18 +41,18 @@
blockName="invent_spec_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="projCode" cname="项目名称" width="300" align="center" defaultValue="" required="true"
<EF:EFComboColumn ename="projCode" cname="项目名称" width="350" align="center" defaultValue="" required="true"
filter="contains" >
<EF:EFOptions blockId="proj_record_block_id" valueField="valueField" textField="textField" />
</EF:EFComboColumn>
<EF:EFColumn ename="applyAmount" cname="申请数量" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="applyRemark" cname="申请说明" width="150" editType="textarea" copy="true"/>
<EF:EFColumn ename="applyRemark" cname="申请说明" width="200" editType="textarea" copy="true"/>
<EF:EFColumn ename="amount" cname="库存数量" enable="false" width="120" align="right" format="{0:N0}"
sumType="all"/>
<EF:EFColumn ename="unitWeight" cname="单量(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="库存重量(KG)" enable="false" width="120" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -22,10 +22,10 @@
<EF:EFColumn ename="projCode" cname="项目编码" hidden="true"/>
<EF:EFColumn ename="operator" 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="createdTime" dateFormat="yyyy-MM-dd HH:mm:ss" enable="false" cname="创建时间"/>
<EF:EFColumn ename="updatedBy" enable="false" cname="修改人"/>
<EF:EFColumn ename="updatedTime" dateFormat="yyyy-MM-dd HH:mm:ss" enable="false" cname="修改时间"/>
<EF:EFColumn ename="createdName" enable="false" align="center" cname="创建人"/>
<EF:EFColumn ename="createdTime" dateFormat="yyyy-MM-dd HH:mm:ss" enable="false" align="center" cname="创建时间"/>
<EF:EFColumn ename="updatedName" enable="false" cname="修改人"/>
<EF:EFColumn ename="updatedTime" dateFormat="yyyy-MM-dd HH:mm:ss" enable="false" align="center" cname="修改时间"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......
......@@ -14,7 +14,7 @@ if (url.indexOf("?") != -1) { //判断是否有参数
$(function () {
IPLATUI.EFTree = {
"materialTree": {
ROOT: "root:项目列表",
ROOT: "root:产品列表",
/**
* 树加载完成后的回调函数
* @param options: 树的配置项
......@@ -135,15 +135,26 @@ $(function () {
* e.preventDefault 阻止事件发生
*/
beforeAdd: function (e) {
var lv = IPLATUI.EFTree.materialTree.selectTreeNode.lv;
var logic = IPLATUI.EFTree.materialTree.selectTreeNode.nodeId ? false : true;
if (logic) { // 通过业务逻辑判断, 控制是否进行新增
if (lv === '3') {
IPLAT.alert({
message: '<b>请选择项目列表</b>',
message: '<b>不能在零件下进行新增</b>',
okFn: function (e) {
},
title: '提示'
});
e.preventDefault();
} else {
if (logic) { // 通过业务逻辑判断, 控制是否进行新增
IPLAT.alert({
message: '<b>请选择项目列表</b>',
okFn: function (e) {
},
title: '提示'
});
e.preventDefault();
}
}
},
/**
......
......@@ -436,33 +436,56 @@ $(function () {
*/
$("#GENERATE").on("click", function () {
var projCode = IPLATUI.EFTree.materialTree.selectTreeNode.projCode;
if (projCode === undefined) {
IPLAT.alert({
message: '<b>请选择项目列表</b>',
okFn: function (e) {
},
title: '提示'
});
}else {
IPLAT.confirm({
message: '<b>模板名称:<red>*<red></b> <input id="generateName" name="generateName" ' +
'class="k-textbox" with="30px" required="true" />',
okFn: function (e) {
var generateName = $("#generateName").val();
if (generateName === "") {
message("模板名称不能为空!");
} else {
generateMode(projCode, generateName);
}
},
cancelFn: function (e) {
IPLAT.NotificationUtil('取消该操作');
},
title: '生成物料清单模板确认',
minWidth: 300
});
}
var projCode=strs[1];
var info = new EiInfo()
info.set("id", projCode);
EiCommunicator.send("HPPZ015", "count", info, {
onSuccess: function (ei) {
if (ei["status"] == 1) {
//处理存在产品模板
var generateName= ei["extAttr"]["tempName"];
IPLAT.confirm({
message: '<b>模板名称:<red>*<red></b> <input id="generateName" type="text" name="generateName" ' +
'class="k-textbox" with="30px" required="true" value=" '+generateName+'"/>',
okFn: function (e) {
var generateName = $("#generateName").val();
if (generateName === "") {
message("模板名称不能为空!");
} else {
generateMode(projCode, generateName);
}
},
cancelFn: function (e) {
IPLAT.NotificationUtil('取消该操作');
},
title: '该产品模板已经存在,是否覆盖',
minWidth: 300
});
} else {
IPLAT.confirm({
message: '<b>模板名称:<red>*<red></b> <input id="generateName" name="generateName" ' +
'class="k-textbox" with="30px" required="true" />',
okFn: function (e) {
var generateName = $("#generateName").val();
if (generateName === "") {
message("模板名称不能为空!");
} else {
generateMode(projCode, generateName);
}
},
cancelFn: function (e) {
IPLAT.NotificationUtil('取消该操作');
},
title: '生成物料清单模板确认',
minWidth: 300
});
}
}, onFail: function (ei) {
}
}, {async: false});
});
// 模板选择
......@@ -472,16 +495,14 @@ $(function () {
* 物料生成
*/
function assign() {
var projCode = IPLATUI.EFTree.materialTree.selectTreeNode.projCode;
if (projCode === undefined) {
IPLAT.alert({
message: '<b>请选择项目列表</b>',
okFn: function (e) {
},
title: '提示'
});
}else {
JSColorbox.open({
var projCode=strs[1];
var info = new EiInfo()
info.set("id", projCode);
EiCommunicator.send("HPSC002", "count", info, {
onSuccess: function (ei) {
if (ei["status"] == 1) {
var projCodeNew=ei["extAttr"]["projCode"];
JSColorbox.open({
href: "HPSC002C?methodName=initLoad",
title: "<div style='text-align: center;'>选择产品模板</div>",
width: "70%",
......@@ -490,7 +511,8 @@ $(function () {
var info = new EiInfo()
info.set("id", row.id);
info.set("projCode", row.projCode);
/* EiCommunicator.send("HPPZ015", "assign", info, {
info.set("projCodeNew", projCodeNew);
EiCommunicator.send("HPPZ015", "assign", info, {
onSuccess: function (ei) {
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
......@@ -498,6 +520,9 @@ $(function () {
NotificationUtil({
msg: ei.msg
});
//刷新树
var tree = $("#materialTree").data("kendoTreeView");
tree.reload("root");//更新树
// 刷新列表
resultGrid.dataSource.page(1);
// 关闭弹窗
......@@ -505,15 +530,25 @@ $(function () {
}
}, onFail: function (ei) {
}
}, {async: false});*/
}, {async: false});
}
});
}
}else {
IPLAT.alert({
message: '<b>该项目下已有物料清单!</b>',
okFn: function (e) {
},
title: '提示'
});
}
}, onFail: function (ei) {
}
}, {async: false});
}
function generateMode(projCode,generateName) {
const inEiInfo = new EiInfo();
inEiInfo.set("projCode", projCode);
inEiInfo.set("id", projCode);
inEiInfo.set("templateName", generateName);
EiCommunicator.send('HPPZ015', 'insert', inEiInfo, {
onSuccess(response) {
......
......@@ -26,7 +26,7 @@ $(function () {
parent.JSColorbox.setValueCallback(row);
return;
};
JSUtils.confirm("确定选择模板吗? ", {
JSUtils.confirm("确定选择模板吗? ", {
ok: function () {
parent.JSColorbox.setValueCallback(row);
}
......
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