Commit ea910f49 by wuwenlong

生产计划dev;

parent 6b8c6fb9
......@@ -10,7 +10,7 @@ import com.baosight.iplat4j.core.util.StringUtils;
/**
* Project: <br>
* Title:Hgsc005a.java <br>
* Title:HGSC005A.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
......@@ -23,6 +23,7 @@ public class HGSC005A extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_id = "id";
public static final String FIELD_mat_detail_id = "matDetailId"; /* 物料清单明细ID*/
public static final String FIELD_tech_flow_id = "techFlowId"; /* 工艺流程ID*/
public static final String FIELD_company_code = "companyCode"; /* 公司编码*/
public static final String FIELD_company_name = "companyName"; /* 公司名称*/
......@@ -48,6 +49,7 @@ public class HGSC005A extends DaoEPBase {
public static final String FIELD_updated_time = "updatedTime"; /* 更新时间*/
public static final String COL_id = "id";
public static final String COL_mat_detail_id = "mat_detail_id"; /* 物料清单明细ID*/
public static final String COL_tech_flow_id = "tech_flow_id"; /* 工艺流程ID*/
public static final String COL_company_code = "company_code"; /* 公司编码*/
public static final String COL_company_name = "company_name"; /* 公司名称*/
......@@ -77,8 +79,11 @@ public class HGSC005A extends DaoEPBase {
public static final String INSERT = "HGSC005A.insert";
public static final String UPDATE = "HGSC005A.update";
public static final String DELETE = "HGSC005A.delete";
public static final String DELETE_BY_MAT_DETAIL_ID = "HGSC005A.deleteByMatDetailId";
private Long id = new Long(0);
private Long matDetailId = new Long(0); /* 物料清单明细ID*/
private Long techFlowId = new Long(0); /* 工艺流程ID*/
private String companyCode = " "; /* 公司编码*/
private String companyName = " "; /* 公司名称*/
......@@ -114,6 +119,10 @@ public class HGSC005A extends DaoEPBase {
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_mat_detail_id);
eiColumn.setDescName("物料清单明细ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_tech_flow_id);
eiColumn.setDescName("工艺流程ID");
eiMetadata.addMeta(eiColumn);
......@@ -233,6 +242,22 @@ public class HGSC005A extends DaoEPBase {
this.id = id;
}
/**
* get the matDetailId - 物料清单明细ID.
* @return the matDetailId
*/
public Long getMatDetailId() {
return this.matDetailId;
}
/**
* set the matDetailId - 物料清单明细ID.
*
* @param matDetailId - 物料清单明细ID
*/
public void setMatDetailId(Long matDetailId) {
this.matDetailId = matDetailId;
}
/**
* get the techFlowId - 工艺流程ID.
* @return the techFlowId
*/
......@@ -609,6 +634,7 @@ public class HGSC005A extends DaoEPBase {
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_id)), id));
setMatDetailId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_mat_detail_id)), matDetailId));
setTechFlowId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_tech_flow_id)), techFlowId));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_company_code)), companyCode));
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_company_name)), companyName));
......@@ -642,6 +668,7 @@ public class HGSC005A extends DaoEPBase {
Map map = new HashMap();
map.put(FIELD_id, StringUtils.toString(id, eiMetadata.getMeta(FIELD_id)));
map.put(FIELD_mat_detail_id, StringUtils.toString(matDetailId, eiMetadata.getMeta(FIELD_mat_detail_id)));
map.put(FIELD_tech_flow_id, StringUtils.toString(techFlowId, eiMetadata.getMeta(FIELD_tech_flow_id)));
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)));
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-05-16 16:50:12
Generate time : 2024-05-16 19:32:42
Version : 1.0
schema : hggp
tableName : HGSC005A
id BIGINT NOT NULL primarykey,
mat_detail_id BIGINT NOT NULL,
tech_flow_id BIGINT,
company_code VARCHAR NOT NULL,
company_name VARCHAR NOT NULL,
......@@ -35,6 +36,9 @@
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matDetailId">
mat_detail_id = #matDetailId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowId">
tech_flow_id = #techFlowId#
</isNotEmpty>
......@@ -104,15 +108,13 @@
<isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planCodes">
plan_code IN <iterate close=")" open="(" conjunction="," property="planCodes">#planCodes[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC005A">
SELECT
id as "id",
mat_detail_id as "matDetailId", <!-- 物料清单明细ID -->
tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
......@@ -158,6 +160,9 @@
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matDetailId">
mat_detail_id = #matDetailId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="techFlowId">
tech_flow_id = #techFlowId#
</isNotEmpty>
......@@ -231,6 +236,7 @@
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSC005A (id,
mat_detail_id, <!-- 物料清单明细ID -->
tech_flow_id, <!-- 工艺流程ID -->
company_code, <!-- 公司编码 -->
company_name, <!-- 公司名称 -->
......@@ -255,7 +261,7 @@
updated_name, <!-- 修改人名称 -->
updated_time <!-- 更新时间 -->
)
VALUES (#id#, #techFlowId#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#, #projName#, #planCode#, #productCode#, #productName#, #finishDate#, #planStartDate#, #planEndDate#, #quantity#, #finishQuantity#, #unfinishQuantity#, #accountCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#)
VALUES (#id#, #matDetailId#, #techFlowId#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#, #projName#, #planCode#, #productCode#, #productName#, #finishDate#, #planStartDate#, #planEndDate#, #quantity#, #finishQuantity#, #unfinishQuantity#, #accountCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#)
</insert>
<delete id="delete">
......@@ -263,9 +269,15 @@
id = #id#
</delete>
<delete id="deleteByMatDetailId">
DELETE FROM ${hggpSchema}.HGSC005A WHERE
mat_detail_id = #matDetailId#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGSC005A
SET
mat_detail_id = #matDetailId#, <!-- 物料清单明细ID -->
tech_flow_id = #techFlowId#, <!-- 工艺流程ID -->
company_code = #companyCode#, <!-- 公司编码 -->
company_name = #companyName#, <!-- 公司名称 -->
......
......@@ -135,6 +135,7 @@ public class HGSCTools {
AssertUtils.isEmpty(hgsc005.getProjName(), "项目名称不能为空!");
AssertUtils.isEmpty(hgsc005.getHgsc005AList(), "计划明细不能为空");
hgsc005.getHgsc005AList().forEach(hgsc005A -> {
AssertUtils.isTrue(Objects.isNull(hgsc005A.getMatDetailId())||hgsc005A.getMatDetailId()<=0, "物料清单明细ID不能为空!");
AssertUtils.isEmpty(hgsc005A.getProductCode(), "产品编码不能为空!");
AssertUtils.isEmpty(hgsc005A.getProductName(), "产品名称不能为空!");
AssertUtils.isTrue(Objects.isNull(hgsc005A.getTechFlowId())||hgsc005A.getTechFlowId()<=0, "工序ID不能为空!");
......@@ -154,6 +155,36 @@ public class HGSCTools {
return CollectionUtils.isEmpty(results) ? null : results;
}
public static HGSC005A update(HGSC005A hgsc005a){
checkUpdateData(hgsc005a);
HGSC005A result = (HGSC005A) DaoBase.getInstance().get(HGSC001A.QUERY,HGSC005A.FIELD_mat_detail_id, hgsc005a.getMatDetailId());
result.setProductCode(hgsc005a.getProductCode());
result.setProductName(hgsc005a.getProductName());
result.setQuantity(hgsc005a.getQuantity());
result.setUnfinishQuantity(hgsc005a.getQuantity());
result.setFinishQuantity(0);
DaoUtils.update(HGSC005A.UPDATE,result);
return result;
}
public static void delete(Long matDetailId){
AssertUtils.isTrue(Objects.isNull(matDetailId)||matDetailId<=0, "物料清单明细ID不能为空!");
DaoUtils.update(HGSC005A.DELETE,matDetailId);
}
/**
* 校验修改的数据
*
* @param hgsc005a
*/
private static void checkUpdateData(HGSC005A hgsc005a) {
AssertUtils.isTrue(Objects.isNull(hgsc005a.getMatDetailId())||hgsc005a.getMatDetailId()<=0, "物料清单明细ID不能为空!");
AssertUtils.isEmpty(hgsc005a.getProductCode(), "产品编码不能为空!");
AssertUtils.isEmpty(hgsc005a.getProductName(), "产品名称不能为空!");
AssertUtils.isTrue(Objects.isNull(hgsc005a.getTechFlowId())||hgsc005a.getTechFlowId()<=0, "工序ID不能为空!");
AssertUtils.isTrue(Objects.isNull(hgsc005a.getQuantity())||hgsc005a.getQuantity()<=0, "数量不能为空!");
}
public static HGSC005A constructObj(HGSC005A hgsc005a, HGSC005 hgsc005){
hgsc005a.setPlanCode(hgsc005.getPlanCode());
hgsc005a.setCompanyCode(hgsc005.getCompanyCode());
......
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