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)));
......
......@@ -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