Commit ae489e58 by 江和松

物料清单删除时校验计划是否提交,如果提交了,不能删除

parent 7b7e5e66
......@@ -117,7 +117,7 @@ public class HGSC004A extends DaoEPBase {
private Long productId = new Long(0); /* 产品id*/
private String productCode = " "; /* 产品编号*/
private String productName = " "; /* 产品名称*/
private String productType = " "; /* 产品id*/
private String productType = " "; /* 产品类型*/
private String inventType = " "; /* 档案类型*/
private Integer productStatus = new Integer(0); /* 产品状态 0:未提交,1:已提交*/
private Integer changeType = new Integer(0); /* 变更类型:默认0,1:增加,2:替换,3:删除*/
......
......@@ -23,7 +23,7 @@ public class HGSC004B extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_id = "id"; /* 主键*/
public static final String FIELD_product_id = "productId"; /* 变更产品id*/
public static final String FIELD_material_detail_id = "materialDetailId"; /* 物料明细id*/
public static final String FIELD_company_code = "companyCode"; /* 公司编码(预留)*/
public static final String FIELD_company_name = "companyName"; /* 公司名称(预留)*/
public static final String FIELD_dep_code = "depCode"; /* 部门编号(预留)*/
......@@ -33,8 +33,11 @@ public class HGSC004B extends DaoEPBase {
public static final String FIELD_parent_prod_code = "parentProdCode"; /* 父节点-产品编码*/
public static final String FIELD_parent_prod_name = "parentProdName"; /* 父节点-产品名称*/
public static final String FIELD_material_id = "materialId"; /* 物料清单id*/
public static final String FIELD_product_id = "productId"; /* 产品id*/
public static final String FIELD_product_code = "productCode"; /* 产品编号*/
public static final String FIELD_product_name = "productName"; /* 产品名称*/
public static final String FIELD_product_type = "productType"; /* 产品type*/
public static final String FIELD_invent_type = "inventType"; /* 档案类型*/
public static final String FIELD_product_status = "productStatus"; /* 产品状态 0:未提交,1:已提交*/
public static final String FIELD_change_type = "changeType"; /* 变更类型:默认0,1:增加,2:替换,3:删除*/
public static final String FIELD_quantity = "quantity"; /* 数量*/
......@@ -50,7 +53,7 @@ public class HGSC004B extends DaoEPBase {
public static final String FIELD_updated_time = "updatedTime"; /* 更新时间*/
public static final String COL_id = "id"; /* 主键*/
public static final String COL_product_id = "product_id"; /* 变更产品id*/
public static final String COL_material_detail_id = "material_detail_id"; /* 物料明细id*/
public static final String COL_company_code = "company_code"; /* 公司编码(预留)*/
public static final String COL_company_name = "company_name"; /* 公司名称(预留)*/
public static final String COL_dep_code = "dep_code"; /* 部门编号(预留)*/
......@@ -60,8 +63,11 @@ public class HGSC004B extends DaoEPBase {
public static final String COL_parent_prod_code = "parent_prod_code"; /* 父节点-产品编码*/
public static final String COL_parent_prod_name = "parent_prod_name"; /* 父节点-产品名称*/
public static final String COL_material_id = "material_id"; /* 物料清单id*/
public static final String COL_product_id = "product_id"; /* 产品id*/
public static final String COL_product_code = "product_code"; /* 产品编号*/
public static final String COL_product_name = "product_name"; /* 产品名称*/
public static final String COL_product_type = "product_type"; /* 产品类型*/
public static final String COL_invent_type = "invent_type"; /* 档案类型*/
public static final String COL_product_status = "product_status"; /* 产品状态 0:未提交,1:已提交*/
public static final String COL_change_type = "change_type"; /* 变更类型:默认0,1:增加,2:替换,3:删除*/
public static final String COL_quantity = "quantity"; /* 数量*/
......@@ -83,7 +89,7 @@ public class HGSC004B extends DaoEPBase {
public static final String DELETE = "HGSC004B.delete";
private Long id = new Long(0); /* 主键*/
private Long productId = new Long(0); /* 变更产品id*/
private Long materialDetailId = new Long(0); /* 物料明细id*/
private String companyCode = " "; /* 公司编码(预留)*/
private String companyName = " "; /* 公司名称(预留)*/
private String depCode = " "; /* 部门编号(预留)*/
......@@ -93,8 +99,11 @@ public class HGSC004B extends DaoEPBase {
private String parentProdCode = " "; /* 父节点-产品编码*/
private String parentProdName = " "; /* 父节点-产品名称*/
private Long materialId = new Long(0); /* 物料清单id*/
private Long productId = new Long(0); /* 产品id*/
private String productCode = " "; /* 产品编号*/
private String productName = " "; /* 产品名称*/
private String productType = " "; /* 产品类型*/
private String inventType = " "; /* 档案类型*/
private Integer productStatus = new Integer(0); /* 产品状态 0:未提交,1:已提交*/
private Integer changeType = new Integer(0); /* 变更类型:默认0,1:增加,2:替换,3:删除*/
private Integer quantity = new Integer(0); /* 数量*/
......@@ -122,11 +131,18 @@ public class HGSC004B extends DaoEPBase {
eiColumn.setDescName("主键");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_material_detail_id);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(20);
eiColumn.setDescName("物料明细id");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_product_id);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
eiColumn.setFieldLength(20);
eiColumn.setDescName("变更产品id");
eiColumn.setDescName("产品id");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_company_code);
......@@ -186,6 +202,16 @@ public class HGSC004B extends DaoEPBase {
eiColumn.setDescName("产品名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_product_type);
eiColumn.setFieldLength(32);
eiColumn.setDescName("产品类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_invent_type);
eiColumn.setFieldLength(32);
eiColumn.setDescName("档案类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_product_status);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
......@@ -290,7 +316,7 @@ public class HGSC004B extends DaoEPBase {
this.id = id;
}
/**
* get the productId - 变更产品id.
* get the productId - 产品id.
* @return the productId
*/
public Long getProductId() {
......@@ -298,9 +324,9 @@ public class HGSC004B extends DaoEPBase {
}
/**
* set the productId - 变更产品id.
* set the productId - 产品id.
*
* @param productId - 变更产品id
* @param productId - 产品id
*/
public void setProductId(Long productId) {
this.productId = productId;
......@@ -689,6 +715,31 @@ public class HGSC004B extends DaoEPBase {
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
public Long getMaterialDetailId() {
return materialDetailId;
}
public void setMaterialDetailId(Long materialDetailId) {
this.materialDetailId = materialDetailId;
}
public String getProductType() {
return productType;
}
public void setProductType(String productType) {
this.productType = productType;
}
public String getInventType() {
return inventType;
}
public void setInventType(String inventType) {
this.inventType = inventType;
}
/**
* get the value from Map.
*
......@@ -698,6 +749,7 @@ public class HGSC004B extends DaoEPBase {
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_id)), id));
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_material_detail_id)), materialDetailId));
setProductId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_product_id)), productId));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_company_code)), companyCode));
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_company_name)), companyName));
......@@ -710,6 +762,8 @@ public class HGSC004B extends DaoEPBase {
setMaterialId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_material_id)), materialId));
setProductCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_product_code)), productCode));
setProductName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_product_name)), productName));
setProductType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_product_type)), productType));
setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_invent_type)), inventType));
setProductStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_product_status)), productStatus));
setChangeType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_change_type)), changeType));
setQuantity(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_quantity)), quantity));
......@@ -733,6 +787,7 @@ public class HGSC004B extends DaoEPBase {
Map map = new HashMap();
map.put(FIELD_id, StringUtils.toString(id, eiMetadata.getMeta(FIELD_id)));
map.put(FIELD_material_detail_id, StringUtils.toString(materialDetailId, eiMetadata.getMeta(FIELD_material_detail_id)));
map.put(FIELD_product_id, StringUtils.toString(productId, eiMetadata.getMeta(FIELD_product_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)));
......
......@@ -65,7 +65,6 @@ public class ServiceHGSC004A extends ServiceBase {
// 蓝图ids
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);
......
......@@ -81,12 +81,16 @@
<isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialDetailId">
material_detail_id = #materialDetailId#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC004B">
SELECT
id as "id", <!-- 主键 -->
material_detail_id as "materialDetailId", <!-- 物料明细id -->
product_id as "productId", <!-- 变更产品id -->
company_code as "companyCode", <!-- 公司编码(预留) -->
company_name as "companyName", <!-- 公司名称(预留) -->
......@@ -99,6 +103,8 @@
material_id as "materialId", <!-- 物料清单id -->
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
invent_type as "inventType", <!-- 档案类型 -->
product_type as "productType", <!-- 产品类别 -->
product_status as "productStatus", <!-- 产品状态 0:未提交,1:已提交 -->
change_type as "changeType", <!-- 变更类型:默认0,1:增加,2:替换,3:删除 -->
quantity as "quantity", <!-- 数量 -->
......@@ -127,89 +133,10 @@
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productId">
product_id = #productId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
company_name = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
proj_name = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentProdCode">
parent_prod_code = #parentProdCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentProdName">
parent_prod_name = #parentProdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialId">
material_id = #materialId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productCode">
product_code = #productCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productName">
product_name = #productName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productStatus">
product_status = #productStatus#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="changeType">
change_type = #changeType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="quantity">
quantity = #quantity#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="singleWeight">
single_weight = #singleWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="totalWeight">
total_weight = #totalWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="approvalStatus">
approval_status = #approvalStatus#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
created_by = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
created_name = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
created_time = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
updated_by = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
updated_name = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSC004B (id, <!-- 主键 -->
material_detail_id, <!-- 物料明细id -->
product_id, <!-- 变更产品id -->
company_code, <!-- 公司编码(预留) -->
company_name, <!-- 公司名称(预留) -->
......@@ -222,6 +149,8 @@
material_id, <!-- 物料清单id -->
product_code, <!-- 产品编号 -->
product_name, <!-- 产品名称 -->
product_type, <!-- 产品类别 -->
invent_type, <!-- 档案类型 -->
product_status, <!-- 产品状态 0:未提交,1:已提交 -->
change_type, <!-- 变更类型:默认0,1:增加,2:替换,3:删除 -->
quantity, <!-- 数量 -->
......@@ -236,7 +165,11 @@
updated_name, <!-- 修改人名称 -->
updated_time <!-- 更新时间 -->
)
VALUES (#id#, #productId#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#, #projName#, #parentProdCode#, #parentProdName#, #materialId#, #productCode#, #productName#, #productStatus#, #changeType#, #quantity#, #singleWeight#, #totalWeight#, #approvalStatus#, #accountCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#)
VALUES (#id#,#materialDetailId#, #productId#, #companyCode#, #companyName#, #depCode#, #depName#,
#projCode#, #projName#, #parentProdCode#, #parentProdName#, #materialId#,
#productCode#, #productName#,#productType#,#inventType#, #productStatus#, #changeType#, #quantity#, #singleWeight#,
#totalWeight#, #approvalStatus#, #accountCode#, #createdBy#, #createdName#, #createdTime#,
#updatedBy#, #updatedName#, #updatedTime#)
</insert>
<delete id="delete">
......@@ -247,6 +180,7 @@
UPDATE ${hggpSchema}.HGSC004B
SET
product_id = #productId#, <!-- 变更产品id -->
material_detail_id = #materialDetailId#, <!-- 物料明细id -->
company_code = #companyCode#, <!-- 公司编码(预留) -->
company_name = #companyName#, <!-- 公司名称(预留) -->
dep_code = #depCode#, <!-- 部门编号(预留) -->
......@@ -256,8 +190,10 @@
parent_prod_code = #parentProdCode#, <!-- 父节点-产品编码 -->
parent_prod_name = #parentProdName#, <!-- 父节点-产品名称 -->
material_id = #materialId#, <!-- 物料清单id -->
product_type = #productType#, <!-- 产品类别 -->
product_code = #productCode#, <!-- 产品编号 -->
product_name = #productName#, <!-- 产品名称 -->
invent_type = #inventType#, <!-- 档案类型 -->
product_status = #productStatus#, <!-- 产品状态 0:未提交,1:已提交 -->
change_type = #changeType#, <!-- 变更类型:默认0,1:增加,2:替换,3:删除 -->
quantity = #quantity#, <!-- 数量 -->
......
......@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.sc.tools;
import com.baosight.hggp.common.AssignStatusEnum;
import com.baosight.hggp.common.ComputeTypeEnum;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
......@@ -287,6 +288,7 @@ public class HGSCTools {
public static void delete(HGSC005A hgsc005a){
checkUpdateData(hgsc005a);
checkFatherSubmitStatus(hgsc005a);
Map<Long,Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005a);
oldObjMap.forEach((k,v)->{
HGSC005A oldObj = v.get();
......@@ -300,6 +302,11 @@ public class HGSCTools {
});
}
private static void checkFatherSubmitStatus(HGSC005A hgsc005a) {
HGSC005 hgsc005 = THGSC005.queryByMatId(hgsc005a.getMatId());
AssertUtils.isTrue(hgsc005.getCommitStatus().compareTo(CommonConstant.YesNo.NO_0)==1, "生产计划已提交,不能操作!");
}
/**
* 校验修改的数据
*
......
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