Commit 9805cadd by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

 Conflicts:
	src/main/java/com/baosight/hggp/hg/sj/sql/HGSJ001.xml
parents 366ef3cd 7f3438bb
...@@ -241,6 +241,12 @@ public enum DdynamicEnum { ...@@ -241,6 +241,12 @@ public enum DdynamicEnum {
*/ */
PLAN_PROCESS_BLOCK_ID("plan_process_block_id", "processName", "processName", "HGSC005A.queryProcessComboBox"), PLAN_PROCESS_BLOCK_ID("plan_process_block_id", "processName", "processName", "HGSC005A.queryProcessComboBox"),
/**
* 合同
*/
CONTRACT_BLOCK_ID("contract_block_id", "contractNumber", "contractName", "HGCW002.queryComboBox"),
/** /**
* *
*/ */
......
...@@ -241,4 +241,21 @@ public class HGConstant { ...@@ -241,4 +241,21 @@ public class HGConstant {
public static final Integer YTJ = 1; public static final Integer YTJ = 1;
} }
/**
*
* 物料变动状态
* @author:songx
* @date:2024/5/15,15:18
*/
public static class ChangeType {
// 默认保存
public static final Integer BC = 0;
// 增加
public static final Integer ZJ = 1;
// 替换
public static final Integer TH = 2;
// 删除
public static final Integer SC = 3;
}
} }
...@@ -5,6 +5,8 @@ import com.baosight.hggp.common.DdynamicEnum; ...@@ -5,6 +5,8 @@ import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.cw.domain.HGCW002; import com.baosight.hggp.hg.cw.domain.HGCW002;
import com.baosight.hggp.hg.cw.domain.HGCW003;
import com.baosight.hggp.hg.cw.domain.HGCW999;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO; import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
...@@ -14,10 +16,14 @@ import com.baosight.iplat4j.core.ei.EiConstant; ...@@ -14,10 +16,14 @@ 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.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.util.StringUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -99,6 +105,21 @@ public class ServiceHGCW002 extends ServiceBase { ...@@ -99,6 +105,21 @@ public class ServiceHGCW002 extends ServiceBase {
HGCW002.setPlanStartDate(DateUtils.formatShort(HGCW002.getPlanStartDate())); HGCW002.setPlanStartDate(DateUtils.formatShort(HGCW002.getPlanStartDate()));
HGCW002.setPlanEndDate(DateUtils.formatShort(HGCW002.getPlanEndDate())); HGCW002.setPlanEndDate(DateUtils.formatShort(HGCW002.getPlanEndDate()));
HGCW002.setSigningDate(DateUtils.formatShort(HGCW002.getSigningDate())); HGCW002.setSigningDate(DateUtils.formatShort(HGCW002.getSigningDate()));
BigDecimal totalContractPriceExcluding = new BigDecimal(0);
BigDecimal totalContractPriceIncluding = new BigDecimal(0);
BigDecimal valueAddedTax = new BigDecimal(0);
//计算合同清单金额
for (int i = 0; i < detail1Rows.size(); i++) {
HGCW003 hgcw003 = new HGCW003();
hgcw003.fromMap(detail1Rows.get(i));
totalContractPriceExcluding = totalContractPriceExcluding.add(hgcw003.getTotalPriceExcluding());
totalContractPriceIncluding = totalContractPriceIncluding.add(hgcw003.getTotalPriceIncluding());
}
valueAddedTax = totalContractPriceIncluding.subtract(totalContractPriceExcluding);
DecimalFormat decimalFormat = new DecimalFormat("#.000");
HGCW002.setTotalContractPriceExcluding(new BigDecimal(decimalFormat.format(totalContractPriceExcluding)));
HGCW002.setTotalContractPriceIncluding(new BigDecimal(decimalFormat.format(totalContractPriceIncluding)));
HGCW002.setValueAddedTax(new BigDecimal(decimalFormat.format(valueAddedTax)));
this.modify(HGCW002); this.modify(HGCW002);
} }
} }
...@@ -203,5 +224,40 @@ public class ServiceHGCW002 extends ServiceBase { ...@@ -203,5 +224,40 @@ public class ServiceHGCW002 extends ServiceBase {
return inInfo; return inInfo;
} }
/**
* 提交操作
* @param inInfo
* @return
*/
public EiInfo submit(EiInfo inInfo){
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HGCW002 HGCW002 = new HGCW002();
HGCW002.fromMap(resultRows.get(i));
HGCW002.setReviewStatus(3);
DaoUtils.update("HGCW002.submit", HGCW002);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据提交成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
public EiInfo contractComboBox(EiInfo inInfo){
Map<String, Object> map = new HashMap<>();
if (StringUtils.isNotEmpty(inInfo.getString("reviewStatus"))) {
map.put("reviewStatus", inInfo.getString("reviewStatus"));
}
if (StringUtils.isNotEmpty(inInfo.getString("contractType"))) {
map.put("contractType", inInfo.getString("contractType"));
}
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CONTRACT_BLOCK_ID), map, false);
return inInfo;
}
} }
package com.baosight.hggp.hg.cw.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.hg.cw.domain.HGCW002;
import com.baosight.hggp.hg.cw.domain.HGCW003;
import com.baosight.hggp.hg.cw.domain.HGCW999;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.Arrays;
import java.util.List;
/**
* @author yukang
* @date 2024年05月06日 18:22
*/
public class ServiceHGCW002C extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "合同详情",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
// CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PROJECT_CODE_BOX_BLOCK_ID), null, false);
String id = inInfo.getString("id");
HGCW002 HGCW002 = HGCWTools.HgCw002.getId(id);
inInfo.addBlock(EiConstant.resultBlock).addRow(HGCW002);
//获取清单
List<HGCW003> hgcw003List = HGCWTools.HgCw003.queryByContractNumber(HGCW002.getContractNumber());
inInfo.addBlock("detail1").addRows(hgcw003List);
List<HGCW999> hgcw999List = HGCWTools.HgCw999.queryByBiz(HGCW002.getId(),"HT");
inInfo.addBlock("detail2").addRows(hgcw999List);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
}
...@@ -66,13 +66,13 @@ ...@@ -66,13 +66,13 @@
PROJ_CODE = #projCode# PROJ_CODE = #projCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="projName"> <isNotEmpty prepend=" AND " property="projName">
PROJ_NAME = #projName# PROJ_NAME like ('%$projName$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="contractNumber"> <isNotEmpty prepend=" AND " property="contractNumber">
CONTRACT_NUMBER = #contractNumber# CONTRACT_NUMBER like ('%$contractNumber$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="contractName"> <isNotEmpty prepend=" AND " property="contractName">
CONTRACT_NAME = #contractName# CONTRACT_NAME like ('%$contractName$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="contractType"> <isNotEmpty prepend=" AND " property="contractType">
CONTRACT_TYPE = #contractType# CONTRACT_TYPE = #contractType#
...@@ -81,10 +81,10 @@ ...@@ -81,10 +81,10 @@
CONTRACT_CATEGORY = #contractCategory# CONTRACT_CATEGORY = #contractCategory#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="partyA"> <isNotEmpty prepend=" AND " property="partyA">
PARTY_A = #partyA# PARTY_A like ('%$partyA$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="partyB"> <isNotEmpty prepend=" AND " property="partyB">
PARTY_B = #partyB# PARTY_B like ('%$partyB$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="partyC"> <isNotEmpty prepend=" AND " property="partyC">
PARTY_C = #partyC# PARTY_C = #partyC#
...@@ -113,11 +113,14 @@ ...@@ -113,11 +113,14 @@
<isNotEmpty prepend=" AND " property="engineeringAddress"> <isNotEmpty prepend=" AND " property="engineeringAddress">
ENGINEERING_ADDRESS = #engineeringAddress# ENGINEERING_ADDRESS = #engineeringAddress#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="signingDate"> <isNotEmpty prepend=" AND " property="signingDateFrom">
SIGNING_DATE = #signingDate# SIGNING_DATE &gt;= REPLACE(#signingDateFrom#, '-', '')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="signingDateTo">
SIGNING_DATE &lt;= REPLACE(#signingDateTo#, '-', '')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="mainContractNumber"> <isNotEmpty prepend=" AND " property="mainContractNumber">
MAIN_CONTRACT_NUMBER = #mainContractNumber# MAIN_CONTRACT_NUMBER like ('%$mainContractNumber$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="contractContent"> <isNotEmpty prepend=" AND " property="contractContent">
CONTRACT_CONTENT = #contractContent# CONTRACT_CONTENT = #contractContent#
...@@ -153,7 +156,7 @@ ...@@ -153,7 +156,7 @@
CREATED_BY = #createdBy# CREATED_BY = #createdBy#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName"> <isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName# CREATED_NAME like ('%$createdName$%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime"> <isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime# CREATED_TIME = #createdTime#
...@@ -412,7 +415,7 @@ ...@@ -412,7 +415,7 @@
<update id="update"> <update id="update">
UPDATE ${hggpSchema}.HGCW002 UPDATE ${hggpSchema}.HGCW002
SET SET
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 --> <!-- ACCOUNT_CODE = #accountCode#, 企业编码 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 --> COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 --> COMPANY_NAME = #companyName#, <!-- 公司名称 -->
PROJ_CODE = #projCode#, <!-- 项目编码 --> PROJ_CODE = #projCode#, <!-- 项目编码 -->
...@@ -442,15 +445,53 @@ ...@@ -442,15 +445,53 @@
TOTAL_CONTRACT_PRICE_EXCLUDING = #totalContractPriceExcluding#, <!-- 合同总价(不含税) --> TOTAL_CONTRACT_PRICE_EXCLUDING = #totalContractPriceExcluding#, <!-- 合同总价(不含税) -->
VALUE_ADDED_TAX = #valueAddedTax#, <!-- 税点 --> VALUE_ADDED_TAX = #valueAddedTax#, <!-- 税点 -->
TOTAL_CONTRACT_PRICE_INCLUDING = #totalContractPriceIncluding#, <!-- 合同总价(含税) --> TOTAL_CONTRACT_PRICE_INCLUDING = #totalContractPriceIncluding#, <!-- 合同总价(含税) -->
<!-- REVIEW_STATUS = #reviewStatus#, 审核状态 -->
<!-- BALANCE_STATUS = #balanceStatus#, 结算状态;1未结算2部分结算3最终结算 -->
<!-- CREATED_BY = #createdBy#, 记录创建者 -->
<!-- CREATED_NAME = #createdName#, 记录创建名称 -->
<!-- CREATED_TIME = #createdTime#, 记录创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime# <!-- 记录修改时间 -->
<!-- DEP_CODE = #depCode# 部门编码 -->
WHERE
ID = #id#
</update>
<select id="queryComboBox" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT DISTINCT
CONTRACT_NUMBER as contractNumber, <!-- 合同号 -->
CONTRACT_NAME as contractName <!-- 合同名称 -->
FROM ${hggpSchema}.HGCW002
WHERE 1=1
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCodes">
COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="reviewStatus">
REVIEW_STATUS = #reviewStatus#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractType">
CONTRACT_TYPE = #contractType#
</isNotEmpty>
ORDER BY CONTRACT_NUMBER
</select>
<update id="submit">
UPDATE ${hggpSchema}.HGCW002
SET
REVIEW_STATUS = #reviewStatus#, <!-- 审核状态 --> REVIEW_STATUS = #reviewStatus#, <!-- 审核状态 -->
BALANCE_STATUS = #balanceStatus#, <!-- 结算状态;1未结算2部分结算3最终结算 -->
CREATED_BY = #createdBy#, <!-- 记录创建者 -->
CREATED_NAME = #createdName#, <!-- 记录创建名称 -->
CREATED_TIME = #createdTime#, <!-- 记录创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 --> UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 --> UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 --> UPDATED_TIME = #updatedTime# <!-- 记录修改时间 -->
DEP_CODE = #depCode# <!-- 部门编码 -->
WHERE WHERE
ID = #id# ID = #id#
</update> </update>
......
...@@ -95,6 +95,9 @@ ...@@ -95,6 +95,9 @@
<isNotEmpty prepend=" AND " property="flowId"> <isNotEmpty prepend=" AND " property="flowId">
FLOW_ID = #flowId# FLOW_ID = #flowId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty property="inventCodes">
INVENT_CODE IN <iterate close=")" open="(" conjunction="," property="inventCodes">#inventCodes[]#</iterate>
</isNotEmpty>
</sql> </sql>
<sql id="authCondition"> <sql id="authCondition">
......
...@@ -81,6 +81,9 @@ ...@@ -81,6 +81,9 @@
<isNotEmpty prepend=" AND " property="parentId"> <isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId# PARENT_ID = #parentId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
......
...@@ -204,6 +204,20 @@ public class HGPZTools { ...@@ -204,6 +204,20 @@ public class HGPZTools {
/** /**
* 查询 * 查询
* *
* @param inventCodes
* @return
*/
public static List<HGPZ005> listByInventCodes(List<String> inventCodes) {
AssertUtils.isEmpty(inventCodes, "存货档案编码不能为空!");
Map queryMap = new HashMap();
queryMap.put("inventCodes", inventCodes);
return DaoBase.getInstance().query(HGPZ005.QUERY, queryMap);
}
/**
* 查询
*
* @param ids * @param ids
* @return * @return
*/ */
...@@ -450,6 +464,20 @@ public class HGPZTools { ...@@ -450,6 +464,20 @@ public class HGPZTools {
List<HGPZ005A> results = DaoBase.getInstance().query(HGPZ005A.QUERY, paramMap); List<HGPZ005A> results = DaoBase.getInstance().query(HGPZ005A.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results; return CollectionUtils.isEmpty(results) ? null : results;
} }
/**
* 通过存货编码查询存货工序*
*
* @param ids
* @return
*/
public static List<HGPZ005A> queryByIds(List<Long> ids) {
AssertUtils.isEmpty(ids, "ID不能为空!");
Map paramMap = new HashMap();
paramMap.put("ids", ids);
List<HGPZ005A> results = DaoBase.getInstance().query(HGPZ005A.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
} }
} }
...@@ -64,6 +64,7 @@ public class HGSC004 extends DaoEPBase { ...@@ -64,6 +64,7 @@ public class HGSC004 extends DaoEPBase {
public static final String COL_del_status = "del_status"; /* 数据状态 0:保存,1:删除*/ public static final String COL_del_status = "del_status"; /* 数据状态 0:保存,1:删除*/
public static final String QUERY = "HGSC004.query"; public static final String QUERY = "HGSC004.query";
public static final String QUERY_BY_ID = "HGSC004.queryById";
public static final String COUNT = "HGSC004.count"; public static final String COUNT = "HGSC004.count";
public static final String INSERT = "HGSC004.insert"; public static final String INSERT = "HGSC004.insert";
public static final String UPDATE = "HGSC004.update"; public static final String UPDATE = "HGSC004.update";
...@@ -93,6 +94,10 @@ public class HGSC004 extends DaoEPBase { ...@@ -93,6 +94,10 @@ public class HGSC004 extends DaoEPBase {
private String updatedTime = " "; /* 更新时间*/ private String updatedTime = " "; /* 更新时间*/
private Integer delStatus = new Integer(0); /* 数据状态 0:保存,1:删除*/ private Integer delStatus = new Integer(0); /* 数据状态 0:保存,1:删除*/
private String finishDate = " "; /* 完工日期*/
/** /**
* initialize the metadata. * initialize the metadata.
*/ */
...@@ -527,6 +532,14 @@ public class HGSC004 extends DaoEPBase { ...@@ -527,6 +532,14 @@ public class HGSC004 extends DaoEPBase {
this.delStatus = delStatus; this.delStatus = delStatus;
} }
public String getFinishDate() {
return finishDate;
}
public void setFinishDate(String finishDate) {
this.finishDate = finishDate;
}
/** /**
* get the value from Map. * get the value from Map.
* *
......
...@@ -85,11 +85,13 @@ public class HGSC004A extends DaoEPBase { ...@@ -85,11 +85,13 @@ public class HGSC004A extends DaoEPBase {
public static final String COL_updated_time = "updated_time"; /* 更新时间*/ public static final String COL_updated_time = "updated_time"; /* 更新时间*/
public static final String QUERY = "HGSC004A.query"; public static final String QUERY = "HGSC004A.query";
public static final String QUERY_BY_MATERIAL_ID = "HGSC004A.queryByMaterialId";
public static final String COUNT = "HGSC004A.count"; public static final String COUNT = "HGSC004A.count";
public static final String INSERT = "HGSC004A.insert"; public static final String INSERT = "HGSC004A.insert";
public static final String UPDATE = "HGSC004A.update"; public static final String UPDATE = "HGSC004A.update";
public static final String DELETE = "HGSC004A.delete"; public static final String DELETE = "HGSC004A.delete";
public static final String BATCH_DELETE = "HGSC004A.batchDelete"; public static final String BATCH_DELETE = "HGSC004A.batchDelete";
public static final String BATCH_CHANGE_TYPE = "HGSC004A.changeType";
public static final String QUERY_ALL = "HGSC004A.queryAll"; public static final String QUERY_ALL = "HGSC004A.queryAll";
public static final String UPDATE_PRODUCT_STATUS = "HGSC004A.updateProductStatus"; public static final String UPDATE_PRODUCT_STATUS = "HGSC004A.updateProductStatus";
...@@ -126,6 +128,9 @@ public class HGSC004A extends DaoEPBase { ...@@ -126,6 +128,9 @@ public class HGSC004A extends DaoEPBase {
private String updatedName = " "; /* 修改人名称*/ private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 更新时间*/ private String updatedTime = " "; /* 更新时间*/
private Long techFlowId = new Long(0); /* 工艺流程id*/
private String finishDate = " "; /* 完工日期*/
/** /**
* initialize the metadata. * initialize the metadata.
*/ */
...@@ -747,6 +752,22 @@ public class HGSC004A extends DaoEPBase { ...@@ -747,6 +752,22 @@ public class HGSC004A extends DaoEPBase {
this.productType = productType; this.productType = productType;
} }
public Long getTechFlowId() {
return techFlowId;
}
public void setTechFlowId(Long techFlowId) {
this.techFlowId = techFlowId;
}
public String getFinishDate() {
return finishDate;
}
public void setFinishDate(String finishDate) {
this.finishDate = finishDate;
}
/** /**
* get the value from Map. * get the value from Map.
* *
......
...@@ -70,6 +70,7 @@ public class HGSC005 extends DaoEPBase { ...@@ -70,6 +70,7 @@ public class HGSC005 extends DaoEPBase {
public static final String INSERT = "HGSC005.insert"; public static final String INSERT = "HGSC005.insert";
public static final String UPDATE = "HGSC005.update"; public static final String UPDATE = "HGSC005.update";
public static final String DELETE = "HGSC005.delete"; public static final String DELETE = "HGSC005.delete";
public static final String BATCH_COMMIT = "HGSC005.batch_commit";
private Long id = new Long(0); private Long id = new Long(0);
private Long matId = new Long(0); /* 物料清单ID*/ private Long matId = new Long(0); /* 物料清单ID*/
......
...@@ -27,7 +27,9 @@ public class HGSC005A extends DaoEPBase { ...@@ -27,7 +27,9 @@ public class HGSC005A extends DaoEPBase {
public static final String FIELD_tech_flow_id = "techFlowId"; /* 工艺流程ID*/ public static final String FIELD_tech_flow_id = "techFlowId"; /* 工艺流程ID*/
public static final String FIELD_tech_flow_name = "techFlowName"; /* 工艺流程名称*/ public static final String FIELD_tech_flow_name = "techFlowName"; /* 工艺流程名称*/
public static final String FIELD_invent_process_id = "inventProcessId"; /* 存货工序ID,对应HGPZ005A.id*/ public static final String FIELD_invent_process_id = "inventProcessId"; /* 存货工序ID,对应HGPZ005A.id*/
public static final String FIELD_process_code = "processCode"; /* 工序名称*/
public static final String FIELD_process_name = "processName"; /* 工序名称*/ public static final String FIELD_process_name = "processName"; /* 工序名称*/
public static final String FIELD_process_order = "processOrder"; /* 加工顺序*/
public static final String FIELD_company_code = "companyCode"; /* 公司编码*/ public static final String FIELD_company_code = "companyCode"; /* 公司编码*/
public static final String FIELD_company_name = "companyName"; /* 公司名称*/ public static final String FIELD_company_name = "companyName"; /* 公司名称*/
public static final String FIELD_dep_code = "depCode"; /* 部门编码*/ public static final String FIELD_dep_code = "depCode"; /* 部门编码*/
...@@ -58,7 +60,9 @@ public class HGSC005A extends DaoEPBase { ...@@ -58,7 +60,9 @@ public class HGSC005A extends DaoEPBase {
public static final String COL_tech_flow_id = "tech_flow_id"; /* 工艺流程ID*/ public static final String COL_tech_flow_id = "tech_flow_id"; /* 工艺流程ID*/
public static final String COL_tech_flow_name = "tech_flow_name"; /* 工艺流程名称*/ public static final String COL_tech_flow_name = "tech_flow_name"; /* 工艺流程名称*/
public static final String COL_invent_process_id = "invent_process_id"; /* 存货工序ID,对应HGPZ005A.id*/ public static final String COL_invent_process_id = "invent_process_id"; /* 存货工序ID,对应HGPZ005A.id*/
public static final String COL_process_code = "process_code"; /* 工序名称*/
public static final String COL_process_name = "process_name"; /* 工序名称*/ public static final String COL_process_name = "process_name"; /* 工序名称*/
public static final String COL_process_order = "processOrder"; /* 加工顺序*/
public static final String COL_company_code = "company_code"; /* 公司编码*/ public static final String COL_company_code = "company_code"; /* 公司编码*/
public static final String COL_company_name = "company_name"; /* 公司名称*/ public static final String COL_company_name = "company_name"; /* 公司名称*/
public static final String COL_dep_code = "dep_code"; /* 部门编码*/ public static final String COL_dep_code = "dep_code"; /* 部门编码*/
...@@ -96,7 +100,9 @@ public class HGSC005A extends DaoEPBase { ...@@ -96,7 +100,9 @@ public class HGSC005A extends DaoEPBase {
private Long techFlowId = new Long(0); /* 工艺流程ID*/ private Long techFlowId = new Long(0); /* 工艺流程ID*/
private Long techFlowName = new Long(0); /* 工艺流程名称*/ private Long techFlowName = new Long(0); /* 工艺流程名称*/
private Long inventProcessId = new Long(0); /* 存货工序ID,对应HGPZ005A.id*/ private Long inventProcessId = new Long(0); /* 存货工序ID,对应HGPZ005A.id*/
private String processCode = " "; /* 工序名称*/
private String processName = " "; /* 工序名称*/ private String processName = " "; /* 工序名称*/
private Long processOrder = new Long(0);
private String companyCode = " "; /* 公司编码*/ private String companyCode = " "; /* 公司编码*/
private String companyName = " "; /* 公司名称*/ private String companyName = " "; /* 公司名称*/
private String depCode = " "; /* 部门编码*/ private String depCode = " "; /* 部门编码*/
...@@ -152,10 +158,18 @@ public class HGSC005A extends DaoEPBase { ...@@ -152,10 +158,18 @@ public class HGSC005A extends DaoEPBase {
eiColumn.setDescName("存货工序ID,对应HGPZ005A.id"); eiColumn.setDescName("存货工序ID,对应HGPZ005A.id");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_process_code);
eiColumn.setDescName("工序编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_process_name); eiColumn = new EiColumn(FIELD_process_name);
eiColumn.setDescName("工序名称"); eiColumn.setDescName("工序名称");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_process_order);
eiColumn.setDescName("加工顺序");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_company_code); eiColumn = new EiColumn(FIELD_company_code);
eiColumn.setDescName("公司编码"); eiColumn.setDescName("公司编码");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -354,6 +368,15 @@ public class HGSC005A extends DaoEPBase { ...@@ -354,6 +368,15 @@ public class HGSC005A extends DaoEPBase {
public void setInventProcessId(Long inventProcessId) { public void setInventProcessId(Long inventProcessId) {
this.inventProcessId = inventProcessId; this.inventProcessId = inventProcessId;
} }
public String getProcessCode() {
return processCode;
}
public void setProcessCode(String processCode) {
this.processCode = processCode;
}
/** /**
* get the processName - 工序名称. * get the processName - 工序名称.
* @return the processName * @return the processName
...@@ -370,6 +393,15 @@ public class HGSC005A extends DaoEPBase { ...@@ -370,6 +393,15 @@ public class HGSC005A extends DaoEPBase {
public void setProcessName(String processName) { public void setProcessName(String processName) {
this.processName = processName; this.processName = processName;
} }
public Long getProcessOrder() {
return processOrder;
}
public void setProcessOrder(Long processOrder) {
this.processOrder = processOrder;
}
/** /**
* get the companyCode - 公司编码. * get the companyCode - 公司编码.
* @return the companyCode * @return the companyCode
...@@ -752,7 +784,9 @@ public class HGSC005A extends DaoEPBase { ...@@ -752,7 +784,9 @@ public class HGSC005A extends DaoEPBase {
setTechFlowId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_tech_flow_id)), techFlowId)); setTechFlowId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_tech_flow_id)), techFlowId));
setTechFlowName(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_tech_flow_name)), techFlowName)); setTechFlowName(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_tech_flow_name)), techFlowName));
setInventProcessId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_invent_process_id)), inventProcessId)); setInventProcessId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_invent_process_id)), inventProcessId));
setProcessCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_process_code)), processCode));
setProcessName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_process_name)), processName)); setProcessName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_process_name)), processName));
setProcessOrder(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_process_order)), processOrder));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_company_code)), companyCode)); setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_company_code)), companyCode));
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_company_name)), companyName)); setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_company_name)), companyName));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_dep_code)), depCode)); setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_dep_code)), depCode));
...@@ -791,7 +825,9 @@ public class HGSC005A extends DaoEPBase { ...@@ -791,7 +825,9 @@ public class HGSC005A extends DaoEPBase {
map.put(FIELD_tech_flow_id, StringUtils.toString(techFlowId, eiMetadata.getMeta(FIELD_tech_flow_id))); map.put(FIELD_tech_flow_id, StringUtils.toString(techFlowId, eiMetadata.getMeta(FIELD_tech_flow_id)));
map.put(FIELD_tech_flow_name, StringUtils.toString(techFlowName, eiMetadata.getMeta(FIELD_tech_flow_name))); map.put(FIELD_tech_flow_name, StringUtils.toString(techFlowName, eiMetadata.getMeta(FIELD_tech_flow_name)));
map.put(FIELD_invent_process_id, StringUtils.toString(inventProcessId, eiMetadata.getMeta(FIELD_invent_process_id))); map.put(FIELD_invent_process_id, StringUtils.toString(inventProcessId, eiMetadata.getMeta(FIELD_invent_process_id)));
map.put(FIELD_process_code, StringUtils.toString(processCode, eiMetadata.getMeta(FIELD_process_code)));
map.put(FIELD_process_name, StringUtils.toString(processName, eiMetadata.getMeta(FIELD_process_name))); map.put(FIELD_process_name, StringUtils.toString(processName, eiMetadata.getMeta(FIELD_process_name)));
map.put(FIELD_process_order, StringUtils.toString(id, eiMetadata.getMeta(FIELD_process_order)));
map.put(FIELD_company_code, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_company_code))); map.put(FIELD_company_code, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_company_code)));
map.put(FIELD_company_name, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_company_name))); map.put(FIELD_company_name, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_company_name)));
map.put(FIELD_dep_code, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_dep_code))); map.put(FIELD_dep_code, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_dep_code)));
......
...@@ -96,7 +96,6 @@ public class ServiceHGSC001 extends ServiceBase { ...@@ -96,7 +96,6 @@ public class ServiceHGSC001 extends ServiceBase {
public EiInfo commit(EiInfo inInfo) { public EiInfo commit(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 销售单号
List<Long> ids = ObjectUtils.listKey(resultRows, HGSC001.FIELD_id); List<Long> ids = ObjectUtils.listKey(resultRows, HGSC001.FIELD_id);
DaoUtils.update(HGSC001.BATCH_COMMIT, new HashMap<String,Object>(){{put("ids",ids);}}); DaoUtils.update(HGSC001.BATCH_COMMIT, new HashMap<String,Object>(){{put("ids",ids);}});
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
......
package com.baosight.hggp.hg.sc.service; package com.baosight.hggp.hg.sc.service;
import cn.hutool.core.bean.BeanUtil;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ005A; import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.sc.domain.HGSC001; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.sc.domain.HGSC003;
import com.baosight.hggp.hg.sc.domain.HGSC004;
import com.baosight.hggp.hg.sc.domain.HGSC004A;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants; import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
...@@ -32,7 +31,7 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -32,7 +31,7 @@ public class ServiceHGSC004A extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
inInfo = super.query(inInfo, HGSC004A.QUERY, new HGSC004A()); // inInfo = super.query(inInfo, HGSC004A.QUERY, new HGSC004A());
Map map = new HashMap(); Map map = new HashMap();
map.put(HGSC004A.FIELD_account_code, UserSessionUtils.getAccountCode()); map.put(HGSC004A.FIELD_account_code, UserSessionUtils.getAccountCode());
CommonMethod.initBlock(inInfo, CommonMethod.initBlock(inInfo,
...@@ -65,7 +64,33 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -65,7 +64,33 @@ public class ServiceHGSC004A extends ServiceBase {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 蓝图ids // 蓝图ids
List<Long> ids = ObjectUtils.listKey(resultRows, HGSC004A.FIELD_id); List<Long> ids = ObjectUtils.listKey(resultRows, HGSC004A.FIELD_id);
HGSC004A hgsc004a = (HGSC004A) super.dao.get(HGSC004A.QUERY,HGSC004A.FIELD_id,ids.get(0));
Map<String,Object> mapA = new HashMap<>();
mapA.put("ids",ids);
List<HGSC004A> hgsc004AList = dao.query(HGSC004A.QUERY_BY_MATERIAL_ID,mapA, 0, -999999);
HGSC004 hgsc004 = (HGSC004) super.dao.get(HGSC004.QUERY,HGSC004A.FIELD_id,hgsc004AList.get(0).getMaterialId());
if(Objects.nonNull(hgsc004)){
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
DaoUtils.update(HGSC004A.BATCH_CHANGE_TYPE, new HashMap<String,Object>(){{put("ids",ids);put("changeType",HGConstant.ChangeType.SC);}});
for(HGSC004A hgsc004A : hgsc004AList){
//子表
HGSC005A hgsc005a = new HGSC005A();
BeanUtil.copyProperties(hgsc004A,hgsc005a,"id","productType");
hgsc005a.setMatDetailId(hgsc004A.getId());
hgsc005a.setMatId(hgsc004.getId());
if(hgsc004A.getLv().intValue() == 3){
hgsc005a.setProductType(ProductTypeEnum.STRUCT.getCode());
}else{
hgsc005a.setProductType(ProductTypeEnum.PART.getCode());
}
HGSCTools.THGSC005A.delete(hgsc005a);
}
}else{
DaoUtils.update(HGSC004A.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}}); DaoUtils.update(HGSC004A.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
}
}
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
...@@ -104,13 +129,41 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -104,13 +129,41 @@ public class ServiceHGSC004A extends ServiceBase {
}else{ }else{
hgsc004a.setLeaf(1); hgsc004a.setLeaf(1);
} }
}
this.checkSaveData(hgsc004a,hgsc003); this.checkSaveData(hgsc004a,hgsc003);
if(Objects.nonNull(hgsc004a.getId())&&hgsc004a.getId()!=0){ if(Objects.nonNull(hgsc004a.getId())&&hgsc004a.getId()!=0){
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
hgsc004a.setChangeType(HGConstant.ChangeType.TH);
}
DaoUtils.update(HGSC004A.UPDATE, hgsc004a); DaoUtils.update(HGSC004A.UPDATE, hgsc004a);
//子表
HGSC005A hgsc005a = new HGSC005A();
BeanUtil.copyProperties(hgsc004a,hgsc005a,"id","productType");
hgsc005a.setMatDetailId(hgsc004a.getId());
hgsc005a.setMatId(hgsc004.getId());
if(hgsc004a.getLv().intValue() == 3){
hgsc005a.setProductType(ProductTypeEnum.STRUCT.getCode());
}else{
hgsc005a.setProductType(ProductTypeEnum.PART.getCode());
}
HGSCTools.THGSC005A.update(hgsc005a);
}else { }else {
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
hgsc004a.setChangeType(HGConstant.ChangeType.ZJ);
}
hgsc004a.setProductStatus(HGConstant.ProductStatus.WTJ); hgsc004a.setProductStatus(HGConstant.ProductStatus.WTJ);
DaoUtils.insert(HGSC004A.INSERT, hgsc004a); DaoUtils.insert(HGSC004A.INSERT, hgsc004a);
//子表
HGSC005A hgsc005a = new HGSC005A();
BeanUtil.copyProperties(hgsc004a,hgsc005a,"id","productType");
hgsc005a.setMatDetailId(hgsc004a.getId());
hgsc005a.setMatId(hgsc004.getId());
if(hgsc004a.getLv().intValue() == 3){
hgsc005a.setProductType(ProductTypeEnum.STRUCT.getCode());
}else{
hgsc005a.setProductType(ProductTypeEnum.PART.getCode());
}
HGSCTools.THGSC005A.save(hgsc005a);
}
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!"); inInfo.setMsg("保存成功!");
...@@ -193,23 +246,23 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -193,23 +246,23 @@ public class ServiceHGSC004A extends ServiceBase {
hgsc004a.fromMap(map); hgsc004a.fromMap(map);
DaoUtils.update(HGSC004A.UPDATE_PRODUCT_STATUS, hgsc004a); DaoUtils.update(HGSC004A.UPDATE_PRODUCT_STATUS, hgsc004a);
} }
HGSC004 hgsc004 = (HGSC004) super.dao.get(HGSC004.QUERY,HGSC001.FIELD_id,hgsc004a.getMaterialId()); HGSC004 hgsc004 = (HGSC004) super.dao.get(HGSC004.QUERY_BY_ID,HGSC001.FIELD_id,hgsc004a.getMaterialId());
if(Objects.nonNull(hgsc004)){ if(Objects.nonNull(hgsc004)){
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.WTJ.intValue()){
//如果是未提交则修改为部分提交
hgsc004.setMaterialStatus(HGConstant.MaterialStatus.BFTJ);
DaoUtils.update(HGSC004.UPDATE_MATERIAL_STATUS, hgsc004);
}else if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.BFTJ.intValue()){
//如果不存在未提交的,就标记主表为全部提交
Map<String,Object> mapA = new HashMap<>(); Map<String,Object> mapA = new HashMap<>();
mapA.put("materialId",hgsc004a.getMaterialId()); mapA.put("materialId",hgsc004a.getMaterialId());
mapA.put("productStatus",HGConstant.ProductStatus.WTJ); mapA.put("productStatus",HGConstant.ProductStatus.WTJ);
mapA.put("notId",hgsc004a.getId()); mapA.put("notId",hgsc004a.getId());
List<HGSC004A> hgsc004AList = dao.query(HGSC004A.QUERY_ALL,mapA, 0, -999999); List<HGSC004A> hgsc004AList = dao.query(HGSC004A.QUERY_ALL,mapA, 0, -999999);
if(!CollectionUtils.isEmpty(hgsc004AList)){ if(!CollectionUtils.isEmpty(hgsc004AList)){
//如果存在就是部分提交
hgsc004.setMaterialStatus(HGConstant.MaterialStatus.BFTJ);
DaoUtils.update(HGSC004.UPDATE_MATERIAL_STATUS, hgsc004);
}else{
hgsc004.setMaterialStatus(HGConstant.MaterialStatus.QBTJ); hgsc004.setMaterialStatus(HGConstant.MaterialStatus.QBTJ);
DaoUtils.update(HGSC004.UPDATE_MATERIAL_STATUS, hgsc004); DaoUtils.update(HGSC004.UPDATE_MATERIAL_STATUS, hgsc004);
} //保存生产计划
saveTHGSC005(hgsc004,hgsc004a);
} }
} }
...@@ -225,5 +278,31 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -225,5 +278,31 @@ public class ServiceHGSC004A extends ServiceBase {
return inInfo; return inInfo;
} }
private void saveTHGSC005(HGSC004 hgsc004,HGSC004A hgsc004a) {
//主表
HGSC005 hgsc005 = new HGSC005();
BeanUtil.copyProperties(hgsc004,hgsc005,"id");
hgsc005.setMatId(hgsc004.getId());
HGSCTools.THGSC005.save(hgsc005);
// 全部提交后,发送计划
Map<String,Object> mapA = new HashMap<>();
mapA.put("materialId",hgsc004a.getMaterialId());
List<HGSC004A> hgsc004AList = dao.query(HGSC004A.QUERY_BY_MATERIAL_ID,mapA, 0, -999999);
for(HGSC004A hgsc004A : hgsc004AList){
//子表
HGSC005A hgsc005a = new HGSC005A();
BeanUtil.copyProperties(hgsc004A,hgsc005a,"id","productType");
hgsc005a.setMatDetailId(hgsc004A.getId());
hgsc005a.setMatId(hgsc004.getId());
if(hgsc004A.getLv().intValue() == 3){
hgsc005a.setProductType(ProductTypeEnum.STRUCT.getCode());
}else{
hgsc005a.setProductType(ProductTypeEnum.PART.getCode());
}
HGSCTools.THGSC005A.save(hgsc005a);
}
}
} }
package com.baosight.hggp.hg.sc.service; package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.domain.HGSC005; import com.baosight.hggp.hg.sc.domain.HGSC005;
import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -50,7 +53,34 @@ public class ServiceHGSC005 extends ServiceBase { ...@@ -50,7 +53,34 @@ public class ServiceHGSC005 extends ServiceBase {
return inInfo; return inInfo;
} }
@OperationLogAnnotation(operModul = "生产计划", operType = "提交", operDesc = "提交")
public EiInfo commit(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<String> planCodes = ObjectUtils.listKey(resultRows, HGSC005.FIELD_plan_code);
List<HGSC005A> hgsc005AList = HGSCTools.THGSC005A.queryByPlanCodes(planCodes);
this.checkCommitDate(hgsc005AList);
List<Long> ids = ObjectUtils.listKey(resultRows, HGSC005.FIELD_id);
DaoUtils.update(HGSC005.BATCH_COMMIT, new HashMap<String,Object>(){{put("ids",ids);}});
//TODO 生成生产计划
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据提交成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
private void checkCommitDate(List<HGSC005A> hgsc005AList){
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
hgsc005AList.forEach(o -> {
AssertUtils.isEmpty(o.getPlanStartDate(), String.format("项目[%s]%s,计划详情有未排产的数据,无法提交!",o.getProjCode(),o.getProjName()));
AssertUtils.isEmpty(o.getPlanEndDate(), String.format("项目[%s]%s,计划详情有未排产的数据,无法提交!",o.getProjCode(),o.getProjName()));
});
}
} }
......
...@@ -4,13 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; ...@@ -4,13 +4,7 @@ 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.hg.cg.domain.HGCG002; import com.baosight.hggp.hg.sc.domain.HGSC005;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC001A;
import com.baosight.hggp.hg.sc.domain.HGSC005A; import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.*;
...@@ -82,6 +76,24 @@ public class ServiceHGSC005A extends ServiceBase { ...@@ -82,6 +76,24 @@ public class ServiceHGSC005A extends ServiceBase {
} }
} }
@OperationLogAnnotation(operModul = "生产计划详情", operType = "排产", operDesc = "排产")
public EiInfo schedule(EiInfo inInfo) {
try {
String planCode = inInfo.getString(HGSC005.FIELD_plan_code);
HGSC005 hgsc005 = HGSCTools.THGSC005.queryByPlanCode(planCode);
this.checkScheduleData(hgsc005);
int count = HGSCTools.THGSC005A.schedule(planCode);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + count + "]条数据排产成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
private void checkScheduleData(HGSC005 hgsc005) {
AssertUtils.isTrue(hgsc005.getIsSchedule().compareTo(CommonConstant.YesNo.YES_1)==0,"当前计划已排产,请手动调整计划!");
}
} }
...@@ -91,7 +91,8 @@ ...@@ -91,7 +91,8 @@
updated_by as "updatedBy", <!-- 更新人 --> updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 --> updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 --> updated_time as "updatedTime" <!-- 更新时间 -->
FROM ${hggpSchema}.HGSC004 WHERE 1=1 FROM ${hggpSchema}.HGSC004
WHERE 1=1
<include refid="condition" /> <include refid="condition" />
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
...@@ -101,6 +102,42 @@ ...@@ -101,6 +102,42 @@
</select> </select>
<select id="queryById" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC004">
SELECT
a.id as "id", <!-- 主键 -->
a.blueprint_id as "blueprintId", <!-- 蓝图id -->
a.company_code as "companyCode", <!-- 公司编码 -->
a.company_name as "companyName", <!-- 公司名称 -->
a.dep_code as "depCode", <!-- 部门编号 -->
a.dep_name as "depName", <!-- 部门名称 -->
a.blueprint_code as "blueprintCode", <!-- 蓝图编号 -->
a.blueprint_name as "blueprintName", <!-- 蓝图名称 -->
a.proj_code as "projCode", <!-- 项目编码 -->
a.proj_name as "projName", <!-- 项目名称 -->
a.material_status as "materialStatus", <!-- 物料状态 0:未提交,1:部分提交,2:全部提交 -->
a.approval_status as "approvalStatus", <!-- 审批状态 0:待审;1:审核中;2:已审 -->
a.del_status as "delStatus", <!-- 数据状态 0:保存,1:删除 -->
a.account_code as "accountCode", <!-- 帐套 -->
a.created_by as "createdBy", <!-- 创建人 -->
a.created_name as "createdName", <!-- 创建人名称 -->
a.created_time as "createdTime", <!-- 创建时间 -->
a.updated_by as "updatedBy", <!-- 更新人 -->
a.updated_name as "updatedName", <!-- 修改人名称 -->
a.updated_time as "updatedTime", <!-- 更新时间 -->
b.end_date as "finishDate"
FROM ${hggpSchema}.HGSC004 a
left join ${hggpSchema}.hgsc001 b on a.proj_code = b.proj_code and b.approval_status = 2
WHERE 1=1
and a.id = #id#
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
</dynamic>
</select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC004 WHERE 1=1 SELECT COUNT(*) FROM ${hggpSchema}.HGSC004 WHERE 1=1
<include refid="condition" /> <include refid="condition" />
......
...@@ -122,6 +122,9 @@ ...@@ -122,6 +122,9 @@
<isNotEmpty prepend=" AND " property="notId"> <isNotEmpty prepend=" AND " property="notId">
id != #notId# id != #notId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
...@@ -136,7 +139,6 @@ ...@@ -136,7 +139,6 @@
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
</dynamic> </dynamic>
</select> </select>
<select id="queryAll" parameterClass="java.util.HashMap" <select id="queryAll" parameterClass="java.util.HashMap"
...@@ -153,6 +155,61 @@ ...@@ -153,6 +155,61 @@
</select> </select>
<select id="queryByMaterialId" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC004A">
SELECT
a.id as "id", <!-- 主键 -->
a.company_code as "companyCode", <!-- 公司编码(预留) -->
a.company_name as "companyName", <!-- 公司名称(预留) -->
a.dep_code as "depCode", <!-- 部门编号(预留) -->
a.dep_name as "depName", <!-- 部门名称(预留) -->
a.proj_code as "projCode", <!-- 项目编码(预留) -->
a.proj_name as "projName", <!-- 项目名称(预留) -->
a.parent_prod_code as "parentProdCode", <!-- 父节点-产品编码 -->
a.parent_prod_name as "parentProdName", <!-- 父节点-产品名称 -->
a.material_id as "materialId", <!-- 物料清单id -->
a.product_id as "productId", <!-- 产品id -->
a.product_type as "productType", <!-- 产品类别 -->
a.product_code as "productCode", <!-- 产品编号 -->
a.product_name as "productName", <!-- 产品名称 -->
a.product_status as "productStatus", <!-- 产品状态 0:未提交,1:已提交 -->
a.change_type as "changeType", <!-- 变更类型:默认0,1:增加,2:替换,3:删除 -->
a.quantity as "quantity", <!-- 数量 -->
a.single_weight as "singleWeight", <!-- 单重 -->
a.total_weight as "totalWeight", <!-- 总重 -->
a.approval_status as "approvalStatus", <!-- 审批状态 0:待审;1:审核中;2:已审 -->
a.leaf as "leaf", <!-- 是否有叶子节点 -->
a.sort as "sort", <!-- 排序字段 -->
a.lv as "lv", <!-- 层级 -->
a.account_code as "accountCode", <!-- 帐套 -->
a.created_by as "createdBy", <!-- 创建人 -->
a.created_name as "createdName", <!-- 创建人名称 -->
a.created_time as "createdTime", <!-- 创建时间 -->
a.updated_by as "updatedBy", <!-- 更新人 -->
a.updated_name as "updatedName", <!-- 修改人名称 -->
a.updated_time as "updatedTime", <!-- 更新时间 -->
b.flow_id as "techFlowId",
c.end_date as "finishDate"
FROM ${hggpSchema}.HGSC004A a
left join ${hggpSchema}.hgpz005 b on a.product_id = b.id
left join ${hggpSchema}.hgsc001 c on a.proj_code = c.proj_code and c.approval_status = 2
WHERE 1=1
<isNotEmpty prepend=" AND " property="materialId">
a.material_id = #materialId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="ids">
a.id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
</dynamic>
</select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC004A WHERE 1=1 SELECT COUNT(*) FROM ${hggpSchema}.HGSC004A WHERE 1=1
<include refid="condition" /> <include refid="condition" />
...@@ -294,6 +351,17 @@ ...@@ -294,6 +351,17 @@
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate> id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</delete> </delete>
<update id="changeType">
UPDATE ${hggpSchema}.HGSC004A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
CHANGE_TYPE = #changeType# <!-- 变更类型:默认0,1:增加,2:替换,3:删除 -->
WHERE
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</update>
<update id="updateProductStatus"> <update id="updateProductStatus">
UPDATE ${hggpSchema}.HGSC004A UPDATE ${hggpSchema}.HGSC004A
SET SET
......
...@@ -238,4 +238,17 @@ ...@@ -238,4 +238,17 @@
id = #id# id = #id#
</update> </update>
<update id="batch_commit">
UPDATE ${hggpSchema}.HGSC005
SET
commit_status = 2, <!-- 审批状态 0:待审;1:审核中;2:已审 -->
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime# <!-- 更新时间 -->
WHERE
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</update>
</sqlMap> </sqlMap>
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
<sqlMap namespace="HGSC005A"> <sqlMap namespace="HGSC005A">
<sql id="condition"> <sql id="condition">
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
id = #id# id = #id#
</isNotEmpty> </isNotEmpty>
...@@ -59,6 +61,12 @@ ...@@ -59,6 +61,12 @@
<isNotEmpty prepend=" AND " property="processName"> <isNotEmpty prepend=" AND " property="processName">
process_name = #processName# process_name = #processName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="processCode">
process_code = #processCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="processOrder">
process_order = #processOrder#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
company_code = #companyCode# company_code = #companyCode#
</isNotEmpty> </isNotEmpty>
...@@ -128,6 +136,9 @@ ...@@ -128,6 +136,9 @@
<isNotEmpty prepend=" AND " property="updatedTime"> <isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime# updated_time = #updatedTime#
</isNotEmpty> </isNotEmpty>
<isNotEmpty property="planCodes">
plan_code IN <iterate close=")" open="(" conjunction="," property="planCodes">#planCodes[]#</iterate>
</isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
...@@ -139,7 +150,9 @@ ...@@ -139,7 +150,9 @@
tech_flow_id as "techFlowId", <!-- 工艺流程ID --> tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
tech_flow_name as "techFlowName", <!-- 工艺流程名称 --> tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id --> invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
process_code as "processCode", <!-- 工序编码 -->
process_name as "processName", <!-- 工序名称 --> process_name as "processName", <!-- 工序名称 -->
process_order as "processOrder", <!-- 加工顺序 -->
company_code as "companyCode", <!-- 公司编码 --> company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 --> company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 --> dep_code as "depCode", <!-- 部门编码 -->
...@@ -281,7 +294,9 @@ ...@@ -281,7 +294,9 @@
tech_flow_id, <!-- 工艺流程ID --> tech_flow_id, <!-- 工艺流程ID -->
tech_flow_name, <!-- 工艺流程名称 --> tech_flow_name, <!-- 工艺流程名称 -->
invent_process_id, <!-- 存货工序ID,对应HGPZ005A.id --> invent_process_id, <!-- 存货工序ID,对应HGPZ005A.id -->
process_code, <!-- 工序名称 -->
process_name, <!-- 工序名称 --> process_name, <!-- 工序名称 -->
process_order, <!-- 工序名称 -->
company_code, <!-- 公司编码 --> company_code, <!-- 公司编码 -->
company_name, <!-- 公司名称 --> company_name, <!-- 公司名称 -->
dep_code, <!-- 部门编码 --> dep_code, <!-- 部门编码 -->
...@@ -306,7 +321,7 @@ ...@@ -306,7 +321,7 @@
updated_name, <!-- 修改人名称 --> updated_name, <!-- 修改人名称 -->
updated_time <!-- 更新时间 --> updated_time <!-- 更新时间 -->
) )
VALUES (#id#, #matId#, #matDetailId#, #techFlowId#, #techFlowName#, #inventProcessId#, #processName#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#, #projName#, #planCode#, #productType#, #productCode#, #productName#, #finishDate#, #planStartDate#, #planEndDate#, #quantity#, #finishQuantity#, #unfinishQuantity#, #accountCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#) VALUES (#id#, #matId#, #matDetailId#, #techFlowId#, #techFlowName#, #inventProcessId#, #processCode#, #processName#, #processOrder#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#, #projName#, #planCode#, #productType#, #productCode#, #productName#, #finishDate#, #planStartDate#, #planEndDate#, #quantity#, #finishQuantity#, #unfinishQuantity#, #accountCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
...@@ -322,7 +337,9 @@ ...@@ -322,7 +337,9 @@
tech_flow_id = #techFlowId#, <!-- 工艺流程ID --> tech_flow_id = #techFlowId#, <!-- 工艺流程ID -->
tech_flow_name = #techFlowName#, <!-- 工艺流程名称 --> tech_flow_name = #techFlowName#, <!-- 工艺流程名称 -->
invent_process_id = #inventProcessId#, <!-- 存货工序ID,对应HGPZ005A.id --> invent_process_id = #inventProcessId#, <!-- 存货工序ID,对应HGPZ005A.id -->
process_code = #processCode#, <!-- 工序名称 -->
process_name = #processName#, <!-- 工序名称 --> process_name = #processName#, <!-- 工序名称 -->
process_order = #processOrder#, <!-- 工序名称 -->
company_code = #companyCode#, <!-- 公司编码 --> company_code = #companyCode#, <!-- 公司编码 -->
company_name = #companyName#, <!-- 公司名称 --> company_name = #companyName#, <!-- 公司名称 -->
dep_code = #depCode#, <!-- 部门编码 --> dep_code = #depCode#, <!-- 部门编码 -->
......
...@@ -115,6 +115,9 @@ ...@@ -115,6 +115,9 @@
<isNotEmpty prepend=" AND " property="processNames"> <isNotEmpty prepend=" AND " property="processNames">
PROCESS_NAME LIKE CONCAT('%', #processNames#, '%') PROCESS_NAME LIKE CONCAT('%', #processNames#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty property="processCodes">
PROCESS_CODE IN <iterate close=")" open="(" conjunction="," property="processCodes">#processCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="computeType"> <isNotEmpty prepend=" AND " property="computeType">
COMPUTE_TYPE = #computeType# COMPUTE_TYPE = #computeType#
</isNotEmpty> </isNotEmpty>
......
...@@ -2,7 +2,7 @@ package com.baosight.hggp.hg.sj.tools; ...@@ -2,7 +2,7 @@ package com.baosight.hggp.hg.sj.tools;
import com.baosight.hggp.core.dao.DaoBase; import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sb.domain.HGSB002A; import com.baosight.hggp.hg.sj.domain.HGSJ001;
import com.baosight.hggp.hg.sj.domain.HGSJ002A; import com.baosight.hggp.hg.sj.domain.HGSJ002A;
import com.baosight.hggp.hg.sj.domain.HGSJ003; import com.baosight.hggp.hg.sj.domain.HGSJ003;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
...@@ -22,6 +22,17 @@ import java.util.stream.Collectors; ...@@ -22,6 +22,17 @@ import java.util.stream.Collectors;
*/ */
public class HGSJTools { public class HGSJTools {
public static class Hgsj001 {
public static List<HGSJ001> queryByProcessCodes(List<String> processCodes){
AssertUtils.isEmpty(processCodes, "工序编码不能为空!");
Map paramMap = new HashMap();
paramMap.put("processCodes", processCodes);
List<HGSJ001> results = DaoBase.getInstance().query(HGSJ001.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
}
/** /**
* Hgsj002a公共DAO方法定义 * Hgsj002a公共DAO方法定义
*/ */
......
package com.baosight.hggp.util;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
/**
* @Author wwl
* @Date 2024/5/20 17:02
*/
public class DateUtil {
protected static Logger logger = LogManager.getLogger(DateUtil.class);
public static final String DEFAULT_DATE_PATTERN = "yyyy-MM-dd";
public static final String DEFAULT_DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
public static final String DEFAULT_DATEDETAIL_PATTERN = "yyyy-MM-dd HH:mm:ss SSS";
public static final String DATE8_PATTERN = "yyyyMMdd";
public static final String DATE10_PATTERN = "yyyy-MM-dd";
public static final String DATE11_PATTERN = "M月d日";
public static final String TIME6_PATTERN = "HHmmss";
public static final String TIME8_PATTERN = "HH:mm:ss";
public static final String DATETIME14_PATTERN = "yyyyMMddHHmmss";
public static final String DATETIME19_PATTERN = "yyyy-MM-dd HH:mm:ss";
public static final String DATEMSEL17_PATTERN = "yyyyMMddHHmmssSSS";
public static final String DATEMSEL18_PATTERN = "yyyyMMddHHmmssSSSS";
/**
* 返回 指定日期时间的
* @param dateStr 日期
* @param day 天数
* @return 返回 dateStr+day后的日期
*/
public static String dateSubStr(String dateStr, int day) {
//将时间格式化成yyyyMMdd的格式
SimpleDateFormat format = new SimpleDateFormat(DATE8_PATTERN);
try {
//获取当前日期
Date date = format.parse(dateStr);
//创建Calendar实例
Calendar cal = Calendar.getInstance();
//设置当前时间
cal.setTime(date);
//同理增加一天的方法:
cal.add(Calendar.DATE, day);
return format.format(cal.getTime());
} catch (ParseException e) {
e.printStackTrace();
}
return "";
}
/**、
* 返回月份天数
* @param dateStr 日期
* @return 天数
*/
public static int getDaysOfMonth(String dateStr) {
SimpleDateFormat format = new SimpleDateFormat(DATE8_PATTERN);
try {
Date date = format.parse(dateStr);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
} catch (ParseException e) {
e.printStackTrace();
}
return 0;
}
/**
* 返回当前日期的上月日期时间
* @param date
* @return
*/
public static String getMonthOfDays(String date){
Calendar calendar = Calendar.getInstance();//日历对象
calendar.setTime(Objects.requireNonNull(DateUtil.toDate(date, DATE10_PATTERN)));//设置当前日期
calendar.add(Calendar.MONTH, -1);//月份减一
return DateUtil.toDateStr(calendar.getTime(),DATE8_PATTERN);//输出上个月的日期
}
private static SimpleDateFormat getDateParser(String pattern) {
return new SimpleDateFormat(pattern);
}
public static Date toDate(String dateString, String pattern) {
Date date = null;
try {
date = getDateParser(pattern).parse(dateString);
return date;
} catch (Exception var4) {
logger.warn("解析date字符串时出错,返回null. dateString:" + dateString + "ex:" + var4);
return null;
}
}
public static String toDateStr(Date date, String pattern) {
if (date == null) {
if (logger.isInfoEnabled()) {
logger.info("传入的date对象为空,返回空字符串");
}
return "";
} else {
return getDateParser(pattern).format(date);
}
}
}
...@@ -16,9 +16,9 @@ $(function() { ...@@ -16,9 +16,9 @@ $(function() {
field: "operator", field: "operator",
template: function (item) { template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + contractDetailFunc(item.id) + '" target="_blank">合同详情</a>'; + 'onclick="contractDetailFunc(' + item.id + ')">合同详情</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + fileDetailFunc(item.id) + '" target="_blank">附件详情</a>'; + 'onclick="fileDetailFunc(' + item.id + ')">附件详情</a>';
return template; return template;
} }
} }
...@@ -26,11 +26,8 @@ $(function() { ...@@ -26,11 +26,8 @@ $(function() {
loadComplete: function (e) { loadComplete: function (e) {
$("#BTN_INSERT").on("click",addFunc); $("#BTN_INSERT").on("click",addFunc);
$("#BTN_UPDATE").on("click",updateFunc); $("#BTN_UPDATE").on("click",updateFunc);
}, $("#BTN_SUBMIT").on("click",submitFunc);
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
deleteFunc();
}, },
onSuccess: function (e) { onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') { if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
...@@ -92,32 +89,7 @@ function updateFunc() { ...@@ -92,32 +89,7 @@ function updateFunc() {
callbackName: windowCallback callbackName: windowCallback
}); });
} }
/**
* 删除
*/
function deleteFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let accountPeriodStatus= item.get("accountPeriodStatus");
if(accountPeriodStatus === "1"){
message("选中的第"+(index+1)+"行记录为开账状态,不能删除!");
flag = false;
return false;
}
});
if(flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGCW001", "delete", true);
}
});
}
}
function windowCallback() { function windowCallback() {
// 刷新列表 // 刷新列表
...@@ -127,10 +99,69 @@ function windowCallback() { ...@@ -127,10 +99,69 @@ function windowCallback() {
} }
function contractDetailFunc(id) { function contractDetailFunc(id) {
return ""; JSColorbox.open({
href: "HGCW002C?methodName=initLoad&id=" + id + "&efParentFormEname=HGCW002",
title: "<div style='text-align: center;'>合同详情</div>",
width: "90%",
height: "90%",
callbackName: windowCallback
});
} }
function fileDetailFunc(id) { function fileDetailFunc(id) {
return ""; JSColorbox.open({
href: "HGCW999?methodName=initLoad&inqu_status-0-bizType=HT&inqu_status-0-matId=" + id + "&efParentFormEname=HGCW002",
title: "<div style='text-align: center;'>附件清单</div>",
width: "80%",
height: "80%",
});
} }
function submitFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length != 1) {
message("请选择一条数据");
return;
}
var flag = true;
rows.forEach(function (row) {
if (row.reviewStatus == "3") {
message("勾选的数据中有已经提交的合同!");
flag = false;
}
})
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"提交\"操作? ", {
ok: function () {
var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HGCW002", "submit", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
query();
} catch (e) {
// TODO: handle exception
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
}
});
}
}
...@@ -113,8 +113,11 @@ $(function() { ...@@ -113,8 +113,11 @@ $(function() {
//清除甲乙方 //清除甲乙方
IPLAT.EFPopupInput.clear(("#popupInputPartyA"), true) IPLAT.EFPopupInput.clear(("#popupInputPartyA"), true)
IPLAT.EFPopupInput.clear(("#popupInputPartyB"), true) IPLAT.EFPopupInput.clear(("#popupInputPartyB"), true)
IPLAT.EFPopupInput.clear(("#popupInputMainContractNumber"), true)
$("#result-0-partyA").val(""); $("#result-0-partyA").val("");
$("#result-0-partyB").val(""); $("#result-0-partyB").val("");
$("#result-0-mainContractNumber").val("");
} }
} }
} }
...@@ -199,6 +202,50 @@ $(function() { ...@@ -199,6 +202,50 @@ $(function() {
IPLAT.EFPopupInput.text( $("#popupInputPartyB") , partyB) IPLAT.EFPopupInput.text( $("#popupInputPartyB") , partyB)
e.preventDefault(); // 不使用默认的回填逻辑 e.preventDefault(); // 不使用默认的回填逻辑
} }
},
"popupInputMainContractNumber": {
/**
* EFGrid 查询时触发的事件,通常在此处,设置查询条件
* 注意: 必须返回一个EiInfo,作为初始查询条件
* 配置了query时,默认每次打开窗口都会进行一次查询
*/
query: function (e) {
console.log("Step" + (++i) + ": ----query----");
// 将自定义div中的字段构造成查询条件 EiInfo
// var queryInfo = EiInfo.build("#result-0-contractCategory");
var contractType = $("#result-0-contractType").val();
if (!contractType) {
message("请先选择合同类型!");
// 阻止弹窗
e.preventDefault();
} else if (contractType != "3") {
message("只有合同类型为补充协议时,才需要填写主合同号!");
e.preventDefault();
}
var info = new EiInfo();
info.set("contractType","1")
return info;
},
/**
* grid中的数据回填时触发的事件
* @param e 回填数据事件
* e.sender 弹出窗口对象
* e.grid 弹出的grid对象
* e.model 选中的数据行model
*/
backFill: function (e) {
console.log("Step" + (++i) + ": ----backFill----");
// 回填数据
var model = e.model;
// var data = model.toJSON();
console.log(model);
var contractNumber = model.contractNumber;
var contractName = model.contractName;
$("#result-0-mainContractNumber").val(contractNumber);
IPLAT.EFPopupInput.text( $("#popupInputMainContractNumber") , contractName)
e.preventDefault(); // 不使用默认的回填逻辑
}
} }
}; };
...@@ -277,6 +324,7 @@ function cancelFunc() { ...@@ -277,6 +324,7 @@ function cancelFunc() {
} }
function btnSaveFunc() { function btnSaveFunc() {
fieldValidation();
JSUtils.confirm("确定对数据做\"保存\"操作? ", { JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () { ok: function () {
JSUtils.submitGrid("detail1,detail2", "HGCW002", "save", {isAlldata:true,onSuccessCallback:parent.windowCallback}); JSUtils.submitGrid("detail1,detail2", "HGCW002", "save", {isAlldata:true,onSuccessCallback:parent.windowCallback});
...@@ -313,7 +361,16 @@ let refreshRowNo = function () { ...@@ -313,7 +361,16 @@ let refreshRowNo = function () {
detail1Grid.refresh(); detail1Grid.refresh();
} }
} }
function fieldValidation() {
var contractType = $("#result-0-contractType").val();
if (contractType == "3") {
var mainContractNumber = $("#result-0-mainContractNumber").val();
if (!mainContractNumber) {
message("请填写主合同号!");
return;
}
}
}
$(window).load(function () { $(window).load(function () {
refreshRowNo(); refreshRowNo();
}); });
......
...@@ -79,7 +79,17 @@ ...@@ -79,7 +79,17 @@
<div class="row"> <div class="row">
<EF:EFDatePicker cname="签约日期" ename="result-0-signingDate" colWidth="4" <EF:EFDatePicker cname="签约日期" ename="result-0-signingDate" colWidth="4"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/> format="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFInput ename="result-0-mainContractNumber" cname="主合同号" colWidth="8" ratio="2:10"/> <EF:EFInput ename="result-0-mainContractNumber" cname="主合同号" type="hidden"/>
<EF:EFPopupInput ename="popupInputMainContractNumber" cname="主合同号" colWidth="8" ratio="2:10"
serviceName="HGCW002" methodName="contractComboBox"
resultId="contract_block_id"
save="false" popupType="ServiceGrid"
valueField="result-0-mainContractNumber" textField="popupInputMainContractNumber"
columnEnames="valueField,textField"
columnCnames="合同号,合同名称"
readonly="true"
resizable="true" popupTitle="主合同号" popupWidth="800">
</EF:EFPopupInput>
</div> </div>
<div class="row"> <div class="row">
<EF:EFInput type="textarea" ename="result-0-contractContent" cname="合同内容" colWidth="8" ratio="2:10" required="true"/> <EF:EFInput type="textarea" ename="result-0-contractContent" cname="合同内容" colWidth="8" ratio="2:10" required="true"/>
......
...@@ -202,6 +202,51 @@ $(function() { ...@@ -202,6 +202,51 @@ $(function() {
IPLAT.EFPopupInput.text( $("#popupInputPartyB") , partyB) IPLAT.EFPopupInput.text( $("#popupInputPartyB") , partyB)
e.preventDefault(); // 不使用默认的回填逻辑 e.preventDefault(); // 不使用默认的回填逻辑
} }
},
"popupInputMainContractNumber": {
/**
* EFGrid 查询时触发的事件,通常在此处,设置查询条件
* 注意: 必须返回一个EiInfo,作为初始查询条件
* 配置了query时,默认每次打开窗口都会进行一次查询
*/
query: function (e) {
debugger;
console.log("Step" + (++i) + ": ----query----");
// 将自定义div中的字段构造成查询条件 EiInfo
// var queryInfo = EiInfo.build("#result-0-contractCategory");
var contractType = $("#result-0-contractType").val();
if (!contractType) {
message("请先选择合同类型!");
// 阻止弹窗
e.preventDefault();
} else if (contractType != "3") {
message("只有合同类型为补充协议时,才需要填写主合同号!");
e.preventDefault();
}
var info = new EiInfo();
info.set("contractType","1")
return info;
},
/**
* grid中的数据回填时触发的事件
* @param e 回填数据事件
* e.sender 弹出窗口对象
* e.grid 弹出的grid对象
* e.model 选中的数据行model
*/
backFill: function (e) {
console.log("Step" + (++i) + ": ----backFill----");
// 回填数据
var model = e.model;
// var data = model.toJSON();
console.log(model);
var contractNumber = model.contractNumber;
var contractName = model.contractName;
$("#result-0-mainContractNumber").val(contractNumber);
IPLAT.EFPopupInput.text( $("#popupInputMainContractNumber") , contractName)
e.preventDefault(); // 不使用默认的回填逻辑
}
} }
}; };
...@@ -228,8 +273,12 @@ function initDate() { ...@@ -228,8 +273,12 @@ function initDate() {
} }
var partyA = $("#result-0-partyA").val(); var partyA = $("#result-0-partyA").val();
var partyB = $("#result-0-partyB").val(); var partyB = $("#result-0-partyB").val();
var mainContractNumber = $("#result-0-mainContractNumber").val();
IPLAT.EFPopupInput.text( $("#popupInputPartyA") , partyA) IPLAT.EFPopupInput.text( $("#popupInputPartyA") , partyA)
IPLAT.EFPopupInput.text( $("#popupInputPartyB") , partyB) IPLAT.EFPopupInput.text( $("#popupInputPartyB") , partyB)
IPLAT.EFPopupInput.text( $("#popupInputMainContractNumber") , mainContractNumber)
} }
...@@ -332,9 +381,10 @@ function cancelFunc() { ...@@ -332,9 +381,10 @@ function cancelFunc() {
} }
function btnSaveFunc() { function btnSaveFunc() {
fieldValidation();
JSUtils.confirm("确定对数据做\"保存\"操作? ", { JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () { ok: function () {
JSUtils.submitGrid("result", "HGCW002", "save", {isAlldata:true,onSuccessCallback:parent.windowCallback}); JSUtils.submitGrid("detail1,detail2", "HGCW002", "save", {isAlldata:true,onSuccessCallback:parent.windowCallback});
} }
}); });
} }
...@@ -437,3 +487,14 @@ function calculateAmount() { ...@@ -437,3 +487,14 @@ function calculateAmount() {
$("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3)) $("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3))
} }
function fieldValidation() {
var contractType = $("#result-0-contractType").val();
if (contractType == "3") {
var mainContractNumber = $("#result-0-mainContractNumber").val();
if (!mainContractNumber) {
message("请填写主合同号!");
return;
}
}
}
...@@ -81,7 +81,17 @@ ...@@ -81,7 +81,17 @@
<div class="row"> <div class="row">
<EF:EFDatePicker cname="签约日期" ename="result-0-signingDate" colWidth="4" <EF:EFDatePicker cname="签约日期" ename="result-0-signingDate" colWidth="4"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/> format="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFInput ename="result-0-mainContractNumber" cname="主合同号" colWidth="8" ratio="2:10"/> <EF:EFInput ename="result-0-mainContractNumber" cname="主合同号" type="hidden"/>
<EF:EFPopupInput ename="popupInputMainContractNumber" cname="主合同号" colWidth="8" ratio="2:10"
serviceName="HGCW002" methodName="contractComboBox"
resultId="contract_block_id"
save="false" popupType="ServiceGrid"
valueField="result-0-mainContractNumber" textField="popupInputMainContractNumber"
columnEnames="valueField,textField"
columnCnames="合同号,合同名称"
readonly="true"
resizable="true" popupTitle="主合同号" popupWidth="800">
</EF:EFPopupInput>
</div> </div>
<div class="row"> <div class="row">
<EF:EFInput type="textarea" ename="result-0-contractContent" cname="合同内容" colWidth="8" ratio="2:10" required="true"/> <EF:EFInput type="textarea" ename="result-0-contractContent" cname="合同内容" colWidth="8" ratio="2:10" required="true"/>
......
$(function() {
IPLATUI.EFGrid.detail1 = {
pageable: {
pageSize: 20,
pageSizes: [10,20,30,50,100,200],
},
columns: [
]
}
IPLATUI.EFGrid.detail2 = {
pageable: {
pageSize: 20,
pageSizes: [10,20,30,50,100,200],
},
columns: [
]
}
});
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<head>
</head>
<EF:EFPage title="合同详情">
<EF:EFRegion id="inqu1" title="基本信息">
<div class="row">
<EF:EFInput ename="result-0-id" cname="id" type="hidden"/>
<EF:EFInput ename="result-0-projCode" cname="项目编号" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-projName" cname="项目简称" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-contractNumber" cname="合同号" colWidth="4" readonly="true" />
</div>
<div class="row">
<EF:EFInput ename="result-0-contractName" cname="合同名称" colWidth="4" readonly="true"/>
<EF:EFSelect cname="合同类型" ename="result-0-contractType" colWidth="4" filter="contains" readonly="true" enable="false">
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.contractType"/>
</EF:EFSelect>
<EF:EFSelect cname="合同类别" ename="result-0-contractCategory" colWidth="4" filter="contains" readonly="true" enable="false">
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.contractCategory"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFInput ename="result-0-partyA" cname="甲方名称" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-partyB" cname="乙方名称" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-partyC" cname="丙方" colWidth="4" readonly="true"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-planStartDate" cname="计划开工日期" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-planEndDate" cname="计划竣工日期" colWidth="4" readonly="true"/>
<EF:EFSelect cname="合同状态" ename="result-0-contractStatus" colWidth="4" filter="contains" readonly="true" enable="false">
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.contractStatus"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFInput ename="result-0-partyAName" cname="甲方联系人姓名" colWidth="4" readonly="true" enable="false"/>
<EF:EFInput ename="result-0-partyAPhoneNumber" cname="甲方联系人电话" colWidth="4" readonly="true" enable="false"/>
<EF:EFInput ename="result-0-alreadyName" cname="已方联系人姓名" colWidth="4" readonly="true" enable="false"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-alreadyPhoneNumber" cname="已方联系人电话" colWidth="4" readonly="true" enable="false"/>
<EF:EFInput ename="result-0-engineeringAddress" cname="工程地址" colWidth="8" ratio="2:10" readonly="true" enable="false"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-signingDate" cname="签约日期" colWidth="4" readonly="true"/>
<EF:EFInput ename="result-0-mainContractNumber" cname="主合同号" readonly="true" enable="false"/>
</div>
<div class="row">
<EF:EFInput type="textarea" ename="result-0-contractContent" cname="合同内容" colWidth="8" ratio="2:10" readonly="true" enable="false"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="inqu2" title="承包方式及合同价款">
<div class="row">
<EF:EFInput ename="result-0-contractingMethod" cname="承包方式" colWidth="4" readonly="true" enable="false"/>
<EF:EFSelect cname="付款方式" ename="result-0-paymentMethod" colWidth="4" filter="contains" readonly="true" enable="false">
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.paymentMethod"/>
</EF:EFSelect>
<EF:EFSelect cname="计价方式" ename="result-0-pricingMethod" colWidth="4" filter="contains" readonly="true" enable="false">
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.pricingMethod"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect cname="税点" ename="result-0-taxPoints" colWidth="4" filter="contains" readonly="true" enable="false">
<EF:EFOption label="-- 请选择 --" value=""/>
<EF:EFCodeOption codeName="hggp.cw.taxPoints"/>
</EF:EFSelect>
<EF:EFInput ename="result-0-totalContractPriceExcluding" cname="合同总价(不含税)" colWidth="4" readonly="true" enable="false"/>
<EF:EFInput ename="result-0-valueAddedTax" cname="增值税" colWidth="4" readonly="true" enable="false"/>
</div>
<div class="row">
<EF:EFInput ename="result-0-totalContractPriceIncluding" cname="合同总价(含税)" colWidth="4" readonly="true" enable="false"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="detail1" title="合同清单">
<EF:EFGrid blockId="detail1" autoDraw="override" checkMode="row" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="contractNumber" cname="合同号" hidden="true"/>
<EF:EFColumn ename="inventory" cname="清单" align="center" enable="false"/>
<EF:EFColumn ename="unit" cname="单位" align="center" enable="false"/>
<EF:EFColumn ename="provisionalQuantity" cname="暂定工程量" format="{0:N3}" align="center" enable="false"/>
<EF:EFColumn ename="measurementMethod" cname="计量方式" align="center" enable="false"/>
<EF:EFColumn ename="supplyMethod" cname="材料供应方式" align="center" enable="false"/>
<EF:EFColumn ename="unitPriceExcludingTax" cname="除税单价/元" format="{0:N3}" align="center" enable="false"/>
<EF:EFColumn ename="totalPriceExcluding" cname="不含税总价" enable="false" format="{0:N3}" align="center" />
<EF:EFColumn ename="totalPriceIncluding" cname="含税总价" enable="false" format="{0:N3}" align="center" />
<EF:EFColumn ename="laborCosts" cname="其中人工费、元" format="{0:N3}" align="center" enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
<EF:EFRegion id="detail2" title="附件信息">
<EF:EFGrid blockId="detail2" autoDraw="override" checkMode="row" isFloat="true">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="matId" cname="matId" hidden="true"/>
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="150"/>
<EF:EFColumn ename="docName" cname="文件名称" enable="false" width="150"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
parseFormats="['yyyyMMddHHmmss']" editType="datetime" dateFormat="yyyy-MM-dd HH:mm:ss"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<script>
var ctx = "${ctx}";
</script>
<script src="${ctx}/HG/CW/HGCW002C.js"></script>
\ No newline at end of file
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + downloadHref(item.docId) + '" target="_blank">附件下载</a>';
return template;
}
}],
dataBound: function () {
}
}
};
$("#ef_form_head").hide();
// 查询
$("#QUERY").on("click", query);
// 附件上传
$("#UPLOAD_FILE").on("click", uploadFile);
// 查询
$("#BTN_DELETE").on("click", deleteFunc);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 初始化查询
query();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
}
/**
* 文件上传
*
* @param id
*/
function uploadFile(id) {
JSColorbox.open({
href: "HGCW099?methodName=initLoad&inqu_status-0-bizType="+$("#inqu_status-0-bizType").val()+"&inqu_status-0-matId="+$("#inqu_status-0-matId").val(),
title: "<div style='text-align: center;'>附件上传</div>",
width: "60%",
height: "50%",
callbackName: uploadFileCallback
});
}
/**
* 附件上传回调
*
* @param docId
*/
function uploadFileCallback(data) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-matId", data.matId);
inEiInfo.set("result-0-docId", data.docId);
inEiInfo.set("result-0-bizType", data.bizType);
EiCommunicator.send('HGCW999', 'insert', inEiInfo, {
onSuccess(response) {
resultGrid.dataSource.page(1);
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
});
}
/**
* 删除
*/
function deleteFunc() {
var rows = resultGrid.getCheckedRows();
if (rows.length == 0) {
message("请先勾选数据!");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作?", {
ok: function () {
JSUtils.submitGridsData("result", "HGCW999", "delete", true);
}
})
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="附件清单">
<EF:EFRegion id="inqu" title="查询区域" type="query">
<EF:EFInput cname="物料ID" ename="matId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFInput cname="文件名称" ename="docName" blockId="inqu_status" row="0" colWidth="3" />
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="150"/>
<EF:EFColumn ename="docName" cname="文件名称" enable="false" width="150"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
parseFormats="['yyyyMMddHHmmss']" editType="datetime" dateFormat="yyyy-MM-dd HH:mm:ss"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="200" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
...@@ -50,9 +50,9 @@ $(function () { ...@@ -50,9 +50,9 @@ $(function () {
$("#BNT_MODIFY").on("click", update); $("#BNT_MODIFY").on("click", update);
//删除 //删除
$("#BNT_REMOVE").on("click", remove); $("#BNT_REMOVE").on("click", remove);
//删除 //完工
$("#BNT_COMPLETE").on("click", complete); $("#BNT_COMPLETE").on("click", complete);
//删除 //提交
$("#BNT_COMMIT").on("click", commit); $("#BNT_COMMIT").on("click", commit);
}, },
onAdd: function(e) { onAdd: function(e) {
......
...@@ -279,7 +279,7 @@ $(function () { ...@@ -279,7 +279,7 @@ $(function () {
var inInfo = new EiInfo(); var inInfo = new EiInfo();
EiCommunicator.send("HGSC004A", "queryTreeNode", inInfo, {//传入参数 EiCommunicator.send("HGSC004A", "queryTreeNode", inInfo, {//传入参数
onSuccess: function (inInfo) { onSuccess: function (inInfo) {
tree.reload("root");//更新树 refreshTree();
} }
}); });
}, },
...@@ -295,10 +295,10 @@ $(function () { ...@@ -295,10 +295,10 @@ $(function () {
var inInfo = new EiInfo(); var inInfo = new EiInfo();
EiCommunicator.send("HGSC004A", "queryTreeNode", inInfo, {//传入参数 EiCommunicator.send("HGSC004A", "queryTreeNode", inInfo, {//传入参数
onSuccess: function (inInfo) { onSuccess: function (inInfo) {
tree.reload("root");//更新树 refreshTree();
} }
}); });
refreshTree();
}, },
toolbarConfig: { toolbarConfig: {
hidden: false, // true时,不显示功能按钮,但保留setting导出按钮 hidden: false, // true时,不显示功能按钮,但保留setting导出按钮
......
...@@ -23,8 +23,8 @@ $(function () { ...@@ -23,8 +23,8 @@ $(function () {
} }
], ],
loadComplete: function(grid) { loadComplete: function(grid) {
// 此 grid 对象 //提交
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化 $("#BNT_COMMIT").on("click", commit);
}, },
onSuccess: function (e) { onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'commit'||e.eiInfo.extAttr.methodName == 'delete' ){ if(e.eiInfo.extAttr.methodName == 'commit'||e.eiInfo.extAttr.methodName == 'delete' ){
...@@ -57,3 +57,35 @@ function showUploadFile(id) { ...@@ -57,3 +57,35 @@ function showUploadFile(id) {
height: "80%", height: "80%",
}); });
} }
function commit() {
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message2("提交","没有选中的行");
return;
}
IPLAT.confirm({
title:'提交',
message:'确认提交此数据么?',
okFn:function () {
var post = new EiInfo();
post.addBlock(resultGrid.getCheckedBlockData());
post.set("recursion", true);
EiCommunicator.send("HGSC005","commit",post,{
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
NotificationUtil(ei);
resultGrid.dataSource.query();
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
}
})
}
...@@ -13,8 +13,8 @@ $(function () { ...@@ -13,8 +13,8 @@ $(function () {
columns: [ columns: [
], ],
loadComplete: function(grid) { loadComplete: function(grid) {
// 此 grid 对象 //排产
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化 $("#BNT_SCHEDULE").on("click", schedule);
}, },
onSuccess: function (e) { onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'||e.eiInfo.extAttr.methodName == 'delete' ){ if(e.eiInfo.extAttr.methodName == 'save'||e.eiInfo.extAttr.methodName == 'delete' ){
...@@ -24,3 +24,32 @@ $(function () { ...@@ -24,3 +24,32 @@ $(function () {
} }
}); });
function schedule() {
var planCode = $("#inqu_status-0-planCode").val();
var inInfo=new EiInfo();
inInfo.set("inqu_status-0-planCode",planCode);
IPLAT.confirm({
title:'提交',
message:'自动排产将覆盖原排产数据,且只能执行一次,请谨慎操作,确认对当前数据进行排产?',
okFn:function () {
var inInfo=new EiInfo();
inInfo.set("inqu_status-0-planCode",planCode);
EiCommunicator.send("HGSC005A","schedule",inInfo,{
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
NotificationUtil(ei);
resultGrid.dataSource.query();
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
}
})
}
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<EF:EFPage title="生产计划详情"> <EF:EFPage title="生产计划详情">
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<div class="row"> <div class="row">
<EF:EFInput ename="inqu_status-0-planCode" cname="计划编码" type="hidden"/>
<EF:EFInput ename="inqu_status-0-productName" cname="产品名称" colWidth="3"/> <EF:EFInput ename="inqu_status-0-productName" cname="产品名称" colWidth="3"/>
<EF:EFSelect cname="工序" ename="result-0-processName" colWidth="3" required="true" filter="contains"> <EF:EFSelect cname="工序" ename="result-0-processName" colWidth="3" required="true" filter="contains">
<EF:EFOptions blockId="plan_process_block_id" valueField="valueField" textField="textField"/> <EF:EFOptions blockId="plan_process_block_id" valueField="valueField" textField="textField"/>
......
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