Commit 3b65c185 by liuyang

2024-09-09

1.产品清单状态为审核或提交时,不能导入
2.产品清单需要满足同一项目可生成多个产品清单
parent d4b28a8a
......@@ -320,7 +320,7 @@ public enum DdynamicEnum {
* 用途:蓝图下拉框
* 编写:jhs
*/
BLUEPRINT_BOX_BLOCK_ID("blueprint_box_block_id", "blueprintCode", "blueprintName", "HGSC003.queryComboBox"),
BLUEPRINT_BOX_BLOCK_ID("blueprint_box_block_id", "blueprintCode", "blueprintName","projCode", "projName", "HGSC003.queryComboBox"),
ITEM_CODE_BOX_BLOCK_ID("item_code_box_block_id", "itemCode", "itemCname", "HGPZ005A.queryEdcm01"),
......
......@@ -27,6 +27,7 @@ import java.util.stream.Collectors;
*/
public class ServiceHGSC004 extends ServiceBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC004.QUERY, new HGSC004());
......@@ -43,6 +44,7 @@ public class ServiceHGSC004 extends ServiceBase {
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC004.QUERY, new HGSC004());
......@@ -134,7 +136,7 @@ public class ServiceHGSC004 extends ServiceBase {
AssertUtils.isTrue(hgsc003.getBlueprintStatus().compareTo(HGConstant.EnablingStatus.TY) == 0,"蓝图已停用不可修改!");
}
AssertUtils.isTrue(Objects.isNull(hgsc003),"未获取到蓝图信息!");
Map<String,Object> map = new HashMap<>();
/*Map<String,Object> map = new HashMap<>();
map.put("projCode",hgsc004.getProjCode());
List<HGSC004> hgsc004List = this.dao.query(HGSC004.QUERY,map);
for(HGSC004 o : hgsc004List){
......@@ -143,7 +145,7 @@ public class ServiceHGSC004 extends ServiceBase {
}else{
AssertUtils.isTrue(Objects.nonNull(o),"当前项目已存在!");
}
}
}*/
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
......
......@@ -34,6 +34,7 @@ import java.util.stream.Collectors;
*/
public class ServiceHGSC004A extends ServiceBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
// inInfo = super.query(inInfo, HGSC004A.QUERY, new HGSC004A());
......@@ -48,6 +49,7 @@ public class ServiceHGSC004A extends ServiceBase {
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC004A.QUERY, new HGSC004A());
......@@ -182,12 +184,14 @@ public class ServiceHGSC004A extends ServiceBase {
hgsc004a.setDepCode(hgsc004.getDepCode());
hgsc004a.setDepName(hgsc004.getDepName());
hgsc004a.setMaterialId(hgsc004.getId());
this.checkSaveData(hgsc004a,hgsc004);
//this.checkSaveData(hgsc004a,hgsc004);
if(Objects.nonNull(hgsc004a.getId())&&hgsc004a.getId()!=0){
this.checkSaveData(hgsc004a,hgsc004,"update");
//替换/修改
replaceEntity(hgsc004a,hgsc004);
}else {
//新增/增加
this.checkSaveData(hgsc004a,hgsc004,"insert");
addEntity(hgsc004a,hgsc004);
}
}
......@@ -352,19 +356,22 @@ public class ServiceHGSC004A extends ServiceBase {
*
* @param hgsc004a
*/
private void checkSaveData(HGSC004A hgsc004a,HGSC004 hgsc004) {
private void checkSaveData(HGSC004A hgsc004a,HGSC004 hgsc004,String type) {
if(Objects.nonNull(hgsc004a.getId())&&hgsc004a.getId()>0){
//蓝图信息,用于蓝图状态校验
HGSC003 hgsc003 = (HGSC003) super.dao.get(HGSC003.QUERY,HGSC003.FIELD_id,hgsc004.getBlueprintId());
AssertUtils.isTrue(hgsc003.getBlueprintStatus().compareTo(HGConstant.EnablingStatus.TY) == 0,"蓝图已停用不可修改!");
}
//为构件的需要验证是否已经存在了,不能重复添加
if(hgsc004a.getLv().intValue() == 3){
if(type.equals("insert") && hgsc004a.getLv().intValue() == 2 || type.equals("update") && hgsc004a.getLv().intValue() == 3){
Map<String,Object> mapA = new HashMap<>();
mapA.put("materialId",hgsc004a.getMaterialId());
//mapA.put("materialId",hgsc004a.getMaterialId());
mapA.put("projCode",hgsc004.getProjCode());
mapA.put("productId",hgsc004a.getProductId());
mapA.put("parentProdCode",hgsc004a.getParentProdCode());
mapA.put("notId",hgsc004a.getId());
if (hgsc004a.getId()>0){
mapA.put("notId",hgsc004a.getId());
}
List<HGSC004A> hgsc004AList = dao.query(HGSC004A.QUERY,mapA, 0, -999999);
AssertUtils.isTrue(!CollectionUtils.isEmpty(hgsc004AList), "已存在构建"+hgsc004a.getProductCode()+"-"+hgsc004a.getProductName());
}
......@@ -641,7 +648,7 @@ public class ServiceHGSC004A extends ServiceBase {
});
//int lv = Integer.parseInt((String) params.get("lv")) +1;
HGSCTools.THGSC004A.add(dataList, params.get("materialId").toString());
HGSCTools.THGSC004A.add(dataList, params.get("materialId").toString(),projCode);
//Map<String, Object> params = new HashMap<>(10);
//String fileName = inInfo.getString(ACConstants.FILE_NAME);
//String projCode = inInfo.getString(HGSC004A.FIELD_proj_code);
......
......@@ -176,7 +176,9 @@
resultClass="java.util.HashMap">
SELECT DISTINCT
BLUEPRINT_CODE as "blueprintCode", <!-- 蓝图编号 -->
BLUEPRINT_NAME as "blueprintName" <!-- 蓝图名称 -->
BLUEPRINT_NAME as "blueprintName", <!-- 蓝图名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName" <!-- 项目名称 -->
FROM ${hggpSchema}.HGSC003
WHERE 1=1
<include refid="HGXSDataAuth.authCondition"/>
......
......@@ -379,6 +379,14 @@ public class HGSCTools {
});
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
public static List<HGSC004> queryProjCode(String projCode) {
AssertUtils.isNull(projCode, "项目编码不能为空!");
List<HGSC004> results = DaoBase.getInstance().query(HGSC004.QUERY, new HashMap<String,Object>(){
{put("projCode",projCode);}
});
return results;
}
}
public static class THGSC004A{
......@@ -392,23 +400,24 @@ public class HGSCTools {
return DaoBase.getInstance().query(HGSC004A.QUERY, paramMap);
}
public static void add(List<HGSC004A> arrayList, String materialId) {
HGSC004 hgsc004 = Hgsc004.getId(materialId);
public static void add(List<HGSC004A> arrayList, String materialId,String projCode) {
List<HGSC004> hgsc004List = Hgsc004.queryProjCode(projCode);
List<HGSC004A> hgsc004aList = Optional.ofNullable(
list(new HashMap<String,Object>(){{put(HGSC004A.FIELD_material_id,materialId);}})).orElse(new ArrayList<>());
AssertUtils.isEmpty(Collections.singleton(hgsc004), "物料清单不存在,添加失败!");
AssertUtils.isTrue(hgsc004.getMaterialStatus()==2 || hgsc004.getApprovalStatus()==2, "物料清单已提交或已审核,无法添加!");
list(new HashMap<String,Object>(){{put(HGSC004A.FIELD_product_code,projCode);}})).orElse(new ArrayList<>());
List<HGSC004> hgsc004s = hgsc004List.stream().filter(hgsc004 -> hgsc004.getId().equals(Long.valueOf(materialId))).collect(Collectors.toList());
AssertUtils.isEmpty(hgsc004s, "物料清单不存在,添加失败!");
AssertUtils.isTrue(hgsc004s.get(0).getMaterialStatus()==2 || hgsc004s.get(0).getApprovalStatus()==2, "物料清单已提交或已审核,无法添加!");
for (HGSC004A hgsc004a : arrayList){
hgsc004a.setCompanyCode(hgsc004.getCompanyCode());
hgsc004a.setCompanyName(hgsc004.getCompanyName());
hgsc004a.setDepCode(hgsc004.getDepCode());
hgsc004a.setDepName(hgsc004.getDepName());
hgsc004a.setCompanyCode(hgsc004s.get(0).getCompanyCode());
hgsc004a.setCompanyName(hgsc004s.get(0).getCompanyName());
hgsc004a.setDepCode(hgsc004s.get(0).getDepCode());
hgsc004a.setDepName(hgsc004s.get(0).getDepName());
hgsc004a.setProductCode(hgsc004a.getProjCodePrefix().trim().concat(hgsc004a.getProductCode()));
hgsc004a.setProductName(hgsc004a.getProjNamePrefix().trim().concat(hgsc004a.getProductName()));
if (hgsc004a.getParentProdCode().trim().isEmpty()){
hgsc004a.setParentProdCode(hgsc004.getProjCode());
hgsc004a.setParentProdName(hgsc004.getProjName());
hgsc004a.setMaterialId(hgsc004.getId());
hgsc004a.setParentProdCode(hgsc004s.get(0).getProjCode());
hgsc004a.setParentProdName(hgsc004s.get(0).getProjName());
hgsc004a.setMaterialId(Long.valueOf(materialId));
hgsc004a.setLv(3);
}else{
/*Map<String,Object> paramMap = new HashMap<>();
......@@ -423,7 +432,7 @@ public class HGSCTools {
&& o.getCompanyCode().equals(hgsc004a.getCompanyCode())
).collect(Collectors.toList());*/
AssertUtils.isEmpty(hgsc004a.getParentProdCode(), String.format("父节点-产品编号[%s]数据不存在,导入失败!",hgsc004a.getProjCodePrefix().trim().concat(hgsc004a.getParentProdCode())));
hgsc004a.setMaterialId(hgsc004.getId());
hgsc004a.setMaterialId(Long.valueOf(materialId));
hgsc004a.setLv(4);
hgsc004a.setParentProdCode(hgsc004a.getProjCodePrefix().trim().concat(hgsc004a.getParentProdCode()));
hgsc004a.setParentProdName(hgsc004a.getProjNamePrefix().trim().concat(hgsc004a.getParentProdName()));
......@@ -527,8 +536,10 @@ public class HGSCTools {
//为构件的需要验证是否已经存在了,不能重复添加
if(hgsc004a.getLv() == 3){
Map<String,Object> mapA = new HashMap<>();
mapA.put(HGSC004A.FIELD_material_id,hgsc004a.getMaterialId());
//mapA.put(HGSC004A.FIELD_material_id,hgsc004a.getMaterialId());
//mapA.put(HGSC004A.FIELD_product_id,hgsc004a.getProductId());
mapA.put(HGSC004A.FIELD_company_code,hgsc004a.getCompanyCode());
mapA.put(HGSC004A.FIELD_proj_code,hgsc004a.getProjCode());
mapA.put(HGSC004A.FIELD_parent_prod_code,hgsc004a.getParentProdCode());
mapA.put(HGSC004A.FIELD_product_code,hgsc004a.getProductCode());
List<HGSC004A> hgsc004AList = list(mapA);
......
......@@ -94,18 +94,18 @@ $(function (){
}
}, {
field: "blueprintCode",
template: function (item) {
/*template: function (item) {
let template = "";
if(item.blueprintCode){
for(let i=0;i<blueprintCodes.length;i++){
if(item.blueprintCode === blueprintCodes[i]['valueField']){
item['blueprintName'] = blueprintCodes[i]['textField'];
template = blueprintCodes[i]['valueField'];
return blueprintCodes[i]['valueField'];
}
}
}
return item.blueprintCode;
},
},*/
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
......@@ -146,6 +146,7 @@ $(function (){
for (let i = 0; i < blueprintCodes.length; i++) {
if (e.items[0].blueprintCode === blueprintCodes[i]['valueField']) {
resultGrid.setCellValue(e.items[0],"blueprintName",blueprintCodes[i]['textField']);
break;
}
}
}
......@@ -155,12 +156,20 @@ $(function (){
for (let i = 0; i < projCodes.length; i++) {
if (e.items[0].projCode === projCodes[i]['valueField']) {
resultGrid.setCellValue(e.items[0],"projName",projCodes[i]['textField']);
resultGrid.setCellValue(e.items[0],"blueprintCode","");
resultGrid.setCellValue(e.items[0],"blueprintName","");
let blueprintList = blueprintCodes.filter(item=>item.param1Field === e.items[0].projCode);
let blueprintCode = blueprintList.length < 0?"":blueprintList[0]['valueField'];
let blueprintName = blueprintList.length < 0?"":blueprintList[0]['textField'];
resultGrid.setCellValue(e.items[0],"blueprintCode",blueprintCode);
resultGrid.setCellValue(e.items[0],"blueprintName",blueprintName);
if (isBlank(e.items[0].companyCode)){
resultGrid.setCellValue(e.items[0],"companyCode",projCodes[i]['param1Field']);
resultGrid.setCellValue(e.items[0],"companyName",projCodes[i]['param2Field']);
}
break;
}
}
}
loadChange(grid,e,"blueprintCode");
//loadChange(grid,e,"blueprintCode");
}
if (e.field == "companyCode") {
resultGrid.setCellValue(e.items[0],"projCode","");
......@@ -229,7 +238,7 @@ let save = function (btnNode) {
*/
function showDetail(id,companyCode,projCode,status) {
JSColorbox.open({
href: "HGSC004A?companyCode="+companyCode+"&projCode="+projCode+"&methodName=initLoad&inqu_status-0-materialId=" + id+"&inqu_status-0-status="+status,
href: "HGSC004A?inqu_status-0-companyCode="+companyCode+"&inqu_status-0-projCode="+projCode+"&methodName=initLoad&inqu_status-0-materialId=" + id+"&inqu_status-0-status="+status,
title: "<div style='text-align: center;'>物料清单详情</div>",
width: "80%",
height: "80%",
......
......@@ -38,7 +38,8 @@
<EF:EFColumn ename="projName" cname="项目名称" width="120" align="center" enable="false"/>
<EF:EFColumn ename="blueprintCode" cname="蓝图编码" enable="true" width="120" align="center" required="true"/>
<EF:EFColumn ename="blueprintName" cname="蓝图名称" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="materialStatus" cname="提交状态" width="80" align="center" enable="false" required="false" readonly="true">
<EF:EFComboColumn ename="materialStatus" cname="提交状态" width="80" align="center"
enable="false" required="false" readonly="true" defaultValue="0">
<EF:EFCodeOption codeName="hggp.sc.materialStatus" />
</EF:EFComboColumn>
</EF:EFGrid>
......
......@@ -818,7 +818,7 @@ function deteleDetail(id) {
inEiInfo.set("result-0-materialId", $("#inqu_status-0-materialId").val());
EiCommunicator.send('HGSC004A', 'delete', inEiInfo, {
onSuccess(response) {
if (response.status == 1){
if (response.status != -1){
NotificationUtil(response.msg);
query();
refreshTree();
......
......@@ -11,6 +11,8 @@
</style>
<EF:EFPage title="物料清单详情">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="inqu_status-0-companyCode" type="hidden"/>
<EF:EFInput ename="inqu_status-0-projCode" type="hidden"/>
<EF:EFInput ename="inqu_status-0-materialId" type="hidden"/>
<EF:EFInput ename="inqu_status-0-parentProdCode" type="hidden"/>
<EF:EFInput ename="inqu_status-0-status" type="hidden"/>
......
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