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>
......@@ -22,7 +22,8 @@ public class HGSC005A extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_id = "id";
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"; /* 公司名称*/
......@@ -47,7 +48,8 @@ public class HGSC005A extends DaoEPBase {
public static final String FIELD_updated_name = "updatedName"; /* 修改人名称*/
public static final String FIELD_updated_time = "updatedTime"; /* 更新时间*/
public static final String COL_id = "id";
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 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);
......@@ -227,12 +236,28 @@ public class HGSC005A extends DaoEPBase {
/**
* set the id .
*
* @param id
* @param id
*/
public void setId(Long id) {
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,
tech_flow_id BIGINT,
company_code VARCHAR NOT NULL,
company_name VARCHAR NOT NULL,
dep_code VARCHAR,
dep_name VARCHAR,
proj_code VARCHAR,
proj_name VARCHAR,
plan_code VARCHAR,
product_code VARCHAR,
product_name VARCHAR,
finish_date VARCHAR,
plan_start_date VARCHAR,
plan_end_date VARCHAR,
quantity TINYINT,
finish_quantity TINYINT,
unfinish_quantity TINYINT,
account_code VARCHAR NOT NULL,
created_by VARCHAR,
created_name VARCHAR,
created_time VARCHAR,
updated_by VARCHAR,
updated_name VARCHAR,
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,
dep_code VARCHAR,
dep_name VARCHAR,
proj_code VARCHAR,
proj_name VARCHAR,
plan_code VARCHAR,
product_code VARCHAR,
product_name VARCHAR,
finish_date VARCHAR,
plan_start_date VARCHAR,
plan_end_date VARCHAR,
quantity TINYINT,
finish_quantity TINYINT,
unfinish_quantity TINYINT,
account_code VARCHAR NOT NULL,
created_by VARCHAR,
created_name VARCHAR,
created_time VARCHAR,
updated_by VARCHAR,
updated_name VARCHAR,
updated_time VARCHAR
-->
<sqlMap namespace="HGSC005A">
......@@ -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,46 +108,44 @@
<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",
tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
plan_code as "planCode", <!-- 计划编码 -->
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
finish_date as "finishDate", <!-- 完工日期 -->
plan_start_date as "planStartDate", <!-- 计划开始日期 -->
plan_end_date as "planEndDate", <!-- 计划结束日期 -->
quantity as "quantity", <!-- 数量 -->
finish_quantity as "finishQuantity", <!-- 完工数量 -->
unfinish_quantity as "unfinishQuantity", <!-- 未完工数量 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
id as "id",
mat_detail_id as "matDetailId", <!-- 物料清单明细ID -->
tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
company_code as "companyCode", <!-- 公司编码 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
plan_code as "planCode", <!-- 计划编码 -->
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
finish_date as "finishDate", <!-- 完工日期 -->
plan_start_date as "planStartDate", <!-- 计划开始日期 -->
plan_end_date as "planEndDate", <!-- 计划结束日期 -->
quantity as "quantity", <!-- 数量 -->
finish_quantity as "finishQuantity", <!-- 完工数量 -->
unfinish_quantity as "unfinishQuantity", <!-- 未完工数量 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
FROM ${hggpSchema}.HGSC005A WHERE 1=1
<include refid="condition" />
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id asc
id asc
</isEmpty>
</dynamic>
......@@ -151,13 +153,16 @@
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC005A WHERE 1=1
<include refid="condition" />
<include refid="condition" />
</select>
<!--
<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,31 +236,32 @@
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSC005A (id,
tech_flow_id, <!-- 工艺流程ID -->
company_code, <!-- 公司编码 -->
company_name, <!-- 公司名称 -->
dep_code, <!-- 部门编码 -->
dep_name, <!-- 部门名称 -->
proj_code, <!-- 项目编码 -->
proj_name, <!-- 项目名称 -->
plan_code, <!-- 计划编码 -->
product_code, <!-- 产品编号 -->
product_name, <!-- 产品名称 -->
finish_date, <!-- 完工日期 -->
plan_start_date, <!-- 计划开始日期 -->
plan_end_date, <!-- 计划结束日期 -->
quantity, <!-- 数量 -->
finish_quantity, <!-- 完工数量 -->
unfinish_quantity, <!-- 未完工数量 -->
account_code, <!-- 帐套 -->
created_by, <!-- 创建人 -->
created_name, <!-- 创建人名称 -->
created_time, <!-- 创建时间 -->
updated_by, <!-- 更新人 -->
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#)
mat_detail_id, <!-- 物料清单明细ID -->
tech_flow_id, <!-- 工艺流程ID -->
company_code, <!-- 公司编码 -->
company_name, <!-- 公司名称 -->
dep_code, <!-- 部门编码 -->
dep_name, <!-- 部门名称 -->
proj_code, <!-- 项目编码 -->
proj_name, <!-- 项目名称 -->
plan_code, <!-- 计划编码 -->
product_code, <!-- 产品编号 -->
product_name, <!-- 产品名称 -->
finish_date, <!-- 完工日期 -->
plan_start_date, <!-- 计划开始日期 -->
plan_end_date, <!-- 计划结束日期 -->
quantity, <!-- 数量 -->
finish_quantity, <!-- 完工数量 -->
unfinish_quantity, <!-- 未完工数量 -->
account_code, <!-- 帐套 -->
created_by, <!-- 创建人 -->
created_name, <!-- 创建人名称 -->
created_time, <!-- 创建时间 -->
updated_by, <!-- 更新人 -->
updated_name, <!-- 修改人名称 -->
updated_time <!-- 更新时间 -->
)
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,34 +269,40 @@
id = #id#
</delete>
<delete id="deleteByMatDetailId">
DELETE FROM ${hggpSchema}.HGSC005A WHERE
mat_detail_id = #matDetailId#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGSC005A
SET
tech_flow_id = #techFlowId#, <!-- 工艺流程ID -->
company_code = #companyCode#, <!-- 公司编码 -->
company_name = #companyName#, <!-- 公司名称 -->
dep_code = #depCode#, <!-- 部门编码 -->
dep_name = #depName#, <!-- 部门名称 -->
proj_code = #projCode#, <!-- 项目编码 -->
proj_name = #projName#, <!-- 项目名称 -->
plan_code = #planCode#, <!-- 计划编码 -->
product_code = #productCode#, <!-- 产品编号 -->
product_name = #productName#, <!-- 产品名称 -->
finish_date = #finishDate#, <!-- 完工日期 -->
plan_start_date = #planStartDate#, <!-- 计划开始日期 -->
plan_end_date = #planEndDate#, <!-- 计划结束日期 -->
quantity = #quantity#, <!-- 数量 -->
finish_quantity = #finishQuantity#, <!-- 完工数量 -->
unfinish_quantity = #unfinishQuantity#, <!-- 未完工数量 -->
account_code = #accountCode#, <!-- 帐套 -->
created_by = #createdBy#, <!-- 创建人 -->
created_name = #createdName#, <!-- 创建人名称 -->
created_time = #createdTime#, <!-- 创建时间 -->
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime# <!-- 更新时间 -->
WHERE
id = #id#
mat_detail_id = #matDetailId#, <!-- 物料清单明细ID -->
tech_flow_id = #techFlowId#, <!-- 工艺流程ID -->
company_code = #companyCode#, <!-- 公司编码 -->
company_name = #companyName#, <!-- 公司名称 -->
dep_code = #depCode#, <!-- 部门编码 -->
dep_name = #depName#, <!-- 部门名称 -->
proj_code = #projCode#, <!-- 项目编码 -->
proj_name = #projName#, <!-- 项目名称 -->
plan_code = #planCode#, <!-- 计划编码 -->
product_code = #productCode#, <!-- 产品编号 -->
product_name = #productName#, <!-- 产品名称 -->
finish_date = #finishDate#, <!-- 完工日期 -->
plan_start_date = #planStartDate#, <!-- 计划开始日期 -->
plan_end_date = #planEndDate#, <!-- 计划结束日期 -->
quantity = #quantity#, <!-- 数量 -->
finish_quantity = #finishQuantity#, <!-- 完工数量 -->
unfinish_quantity = #unfinishQuantity#, <!-- 未完工数量 -->
account_code = #accountCode#, <!-- 帐套 -->
created_by = #createdBy#, <!-- 创建人 -->
created_name = #createdName#, <!-- 创建人名称 -->
created_time = #createdTime#, <!-- 创建时间 -->
updated_by = #updatedBy#, <!-- 更新人 -->
updated_name = #updatedName#, <!-- 修改人名称 -->
updated_time = #updatedTime# <!-- 更新时间 -->
WHERE
id = #id#
</update>
</sqlMap>
......@@ -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