Commit aa8d63dd by wuwenlong

生产计划排产

parent ce891bcb
...@@ -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;
}
} }
} }
...@@ -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 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);
HGSCTools.THGSC005A.schedule(planCode);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
// inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据排产成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "操作失败");
}
return inInfo;
}
private void checkScheduleData(HGSC005 hgsc005) {
AssertUtils.isTrue(hgsc005.getIsSchedule().compareTo(CommonConstant.YesNo.YES_1)==0,"当前计划已排产,请手动调整计划!");
}
} }
...@@ -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#, <!-- 部门编码 -->
......
...@@ -114,6 +114,9 @@ ...@@ -114,6 +114,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>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
......
...@@ -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);
}
}
}
...@@ -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) {
......
...@@ -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("HGSC005","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