Commit c06e494f by liuyang
parents 8c8f9000 5753d915
...@@ -52,7 +52,7 @@ public class HGCG001 extends DaoEPBase { ...@@ -52,7 +52,7 @@ public class HGCG001 extends DaoEPBase {
public static final String FIELD_PUR_QTY = "purQty"; /* 采购数量*/ public static final String FIELD_PUR_QTY = "purQty"; /* 采购数量*/
public static final String FIELD_PUR_UNIT_WEIGHT = "purUnitWeight"; /* 采购单重*/ public static final String FIELD_PUR_UNIT_WEIGHT = "purUnitWeight"; /* 采购单重*/
public static final String FIELD_PUR_WEIGHT = "purWeight"; /* 采购重量*/ public static final String FIELD_PUR_WEIGHT = "purWeight"; /* 采购重量*/
public static final String FIELD_STATUS = "status"; /* 状态:0-未审批,1-审核通过,2-审核未通过*/ public static final String FIELD_STATUS = "status"; /* 状态:0-待审核,1-审核中,2-审核通过,3-审核拒绝,4-生成合同,5-部分生成合同*/
public static final String FIELD_AUDIT_TIME = "auditTime"; /* 审核时间*/ public static final String FIELD_AUDIT_TIME = "auditTime"; /* 审核时间*/
public static final String FIELD_AUDIT_USER_ID = "auditUserId"; /* 审核人ID*/ public static final String FIELD_AUDIT_USER_ID = "auditUserId"; /* 审核人ID*/
public static final String FIELD_AUDIT_USER_NAME = "auditUserName"; /* 审核人名称*/ public static final String FIELD_AUDIT_USER_NAME = "auditUserName"; /* 审核人名称*/
...@@ -92,7 +92,7 @@ public class HGCG001 extends DaoEPBase { ...@@ -92,7 +92,7 @@ public class HGCG001 extends DaoEPBase {
public static final String COL_PUR_QTY = "PUR_QTY"; /* 采购数量*/ public static final String COL_PUR_QTY = "PUR_QTY"; /* 采购数量*/
public static final String COL_PUR_UNIT_WEIGHT = "PUR_UNIT_WEIGHT"; /* 采购单重*/ public static final String COL_PUR_UNIT_WEIGHT = "PUR_UNIT_WEIGHT"; /* 采购单重*/
public static final String COL_PUR_WEIGHT = "PUR_WEIGHT"; /* 采购重量*/ public static final String COL_PUR_WEIGHT = "PUR_WEIGHT"; /* 采购重量*/
public static final String COL_STATUS = "STATUS"; /* 状态:0-未审批,1-审核通过,2-审核未通过*/ public static final String COL_STATUS = "STATUS"; /* 状态:0-待审核,1-审核中,2-审核通过,3-审核拒绝,4-生成合同,5-部分生成合同*/
public static final String COL_AUDIT_TIME = "AUDIT_TIME"; /* 审核时间*/ public static final String COL_AUDIT_TIME = "AUDIT_TIME"; /* 审核时间*/
public static final String COL_AUDIT_USER_ID = "AUDIT_USER_ID"; /* 审核人ID*/ public static final String COL_AUDIT_USER_ID = "AUDIT_USER_ID"; /* 审核人ID*/
public static final String COL_AUDIT_USER_NAME = "AUDIT_USER_NAME"; /* 审核人名称*/ public static final String COL_AUDIT_USER_NAME = "AUDIT_USER_NAME"; /* 审核人名称*/
...@@ -136,7 +136,7 @@ public class HGCG001 extends DaoEPBase { ...@@ -136,7 +136,7 @@ public class HGCG001 extends DaoEPBase {
private BigDecimal purQty = new BigDecimal(0.000); /* 采购数量*/ private BigDecimal purQty = new BigDecimal(0.000); /* 采购数量*/
private BigDecimal purUnitWeight = new BigDecimal(0.000); /* 采购单重*/ private BigDecimal purUnitWeight = new BigDecimal(0.000); /* 采购单重*/
private BigDecimal purWeight = new BigDecimal(0.000); /* 采购重量*/ private BigDecimal purWeight = new BigDecimal(0.000); /* 采购重量*/
private Integer status; /* 状态:0-未审批,1-审核通过,2-审核未通过*/ private Integer status; /* 状态:0-待审核,1-审核中,2-审核通过,3-审核拒绝,4-生成合同,5-部分生成合同*/
private String auditTime = " "; /* 审核时间*/ private String auditTime = " "; /* 审核时间*/
private String auditUserId = " "; /* 审核人ID*/ private String auditUserId = " "; /* 审核人ID*/
private String auditUserName = " "; /* 审核人名称*/ private String auditUserName = " "; /* 审核人名称*/
...@@ -300,7 +300,7 @@ public class HGCG001 extends DaoEPBase { ...@@ -300,7 +300,7 @@ public class HGCG001 extends DaoEPBase {
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_STATUS); eiColumn = new EiColumn(FIELD_STATUS);
eiColumn.setDescName("状态:0-未审批,1-审核通过,2-审核未通过"); eiColumn.setDescName("状态:0-待审核,1-审核中,2-审核通过,3-审核拒绝,4-生成合同,5-部分生成合同");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AUDIT_TIME); eiColumn = new EiColumn(FIELD_AUDIT_TIME);
...@@ -820,7 +820,7 @@ public class HGCG001 extends DaoEPBase { ...@@ -820,7 +820,7 @@ public class HGCG001 extends DaoEPBase {
this.purWeight = purWeight; this.purWeight = purWeight;
} }
/** /**
* get the status - 状态:0-未审批,1-审核通过,2-审核未通过. * get the status - 状态:0-待审核,1-审核中,2-审核通过,3-审核拒绝,4-生成合同,5-部分生成合同.
* @return the status * @return the status
*/ */
public Integer getStatus() { public Integer getStatus() {
...@@ -828,9 +828,9 @@ public class HGCG001 extends DaoEPBase { ...@@ -828,9 +828,9 @@ public class HGCG001 extends DaoEPBase {
} }
/** /**
* set the status - 状态:0-未审批,1-审核通过,2-审核未通过. * set the status - 状态:0-待审核,1-审核中,2-审核通过,3-审核拒绝,4-生成合同,5-部分生成合同.
* *
* @param status - 状态:0-未审批,1-审核通过,2-审核未通过 * @param status - 状态:0-待审核,1-审核中,2-审核通过,3-审核拒绝,4-生成合同,5-部分生成合同
*/ */
public void setStatus(Integer status) { public void setStatus(Integer status) {
this.status = status; this.status = status;
......
...@@ -54,6 +54,15 @@ public class HGCG001A extends DaoEPBase { ...@@ -54,6 +54,15 @@ public class HGCG001A extends DaoEPBase {
public static final String FIELD_MATERIAL_PLAN_ID = "materialPlanId"; /* 材料计划id*/ public static final String FIELD_MATERIAL_PLAN_ID = "materialPlanId"; /* 材料计划id*/
public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /* 存货类型大类*/ public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /* 存货类型大类*/
public static final String FIELD_PRIMARY_ID = "primaryId"; /* 主表id*/ public static final String FIELD_PRIMARY_ID = "primaryId"; /* 主表id*/
public static final String FIELD_STATUS = "status"; /* 状态:0-待审核,1-审核中,2-审核通过,3-审核拒绝,4-生成合同,5-部分生成合同*/
//页面展示
public static final String FIELD_SOURCE = "source"; /* 数据来源 根据采购数据来源小代码 目前默认0材料计划,1手工录入*/
public static final String FIELD_PRICE = "price"; /* 单价*/
public static final String FIELD_AMOUNT = "amount"; /* 金额(不含税金额)*/
public static final String FIELD_TAX_INCLUDE_AMOUNT = "taxIncludeAmount"; /* 含税金额*/
public static final String FIELD_TAX_AMOUNT = "taxAmount"; /* 税额*/
public static final String FIELD_TAX_RATE = "taxRate"; /* 税率*/
public static final String COL_ID = "ID"; public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/ public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
...@@ -89,6 +98,7 @@ public class HGCG001A extends DaoEPBase { ...@@ -89,6 +98,7 @@ public class HGCG001A extends DaoEPBase {
public static final String COL_PRIMARY_ID = "PRIMARY_ID"; /* 主表id*/ public static final String COL_PRIMARY_ID = "PRIMARY_ID"; /* 主表id*/
public static final String QUERY = "HGCG001A.query"; public static final String QUERY = "HGCG001A.query";
public static final String QUERY_BY_CONTRACT = "HGCG001A.queryByContract";
public static final String COUNT = "HGCG001A.count"; public static final String COUNT = "HGCG001A.count";
public static final String INSERT = "HGCG001A.insert"; public static final String INSERT = "HGCG001A.insert";
public static final String UPDATE = "HGCG001A.update"; public static final String UPDATE = "HGCG001A.update";
...@@ -126,6 +136,15 @@ public class HGCG001A extends DaoEPBase { ...@@ -126,6 +136,15 @@ public class HGCG001A extends DaoEPBase {
private Long materialPlanId = new Long(0); /* 材料计划id*/ private Long materialPlanId = new Long(0); /* 材料计划id*/
private Integer inventTypeDetail; /* 存货类型大类*/ private Integer inventTypeDetail; /* 存货类型大类*/
private Long primaryId = new Long(0); /* 主表id*/ private Long primaryId = new Long(0); /* 主表id*/
private Integer status; /* 状态:0-待审核,1-审核中,2-审核通过,3-审核拒绝,4-生成合同,5-部分生成合同*/
//选择合同需要信息
private Integer source; /* 数据来源 根据采购数据来源小代码 目前默认0材料计划,1手工录入*/
private BigDecimal price = new BigDecimal("0"); /* 单价*/
private BigDecimal amount = new BigDecimal("0"); /* 金额(不含税金额)*/
private BigDecimal taxIncludeAmount = new BigDecimal("0"); /* 含税金额*/
private BigDecimal taxAmount = new BigDecimal("0"); /* 税额*/
private BigDecimal taxRate = new BigDecimal("0"); /* 税率*/
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -289,7 +308,48 @@ public class HGCG001A extends DaoEPBase { ...@@ -289,7 +308,48 @@ public class HGCG001A extends DaoEPBase {
eiColumn.setDescName("主表id"); eiColumn.setDescName("主表id");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_STATUS);
eiColumn.setDescName("状态:0-待审核,1-审核中,2-审核通过,3-审核拒绝,4-生成合同,5-部分生成合同");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SOURCE);
eiColumn.setDescName("数据来源");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PRICE);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("单价");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("金额(不含税金额)");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_TAX_INCLUDE_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("含税金额");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_TAX_AMOUNT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("税额");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_TAX_RATE);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(12);
eiColumn.setDescName("税率");
eiMetadata.addMeta(eiColumn);
} }
/** /**
...@@ -811,6 +871,63 @@ public class HGCG001A extends DaoEPBase { ...@@ -811,6 +871,63 @@ public class HGCG001A extends DaoEPBase {
public void setPrimaryId(Long primaryId) { public void setPrimaryId(Long primaryId) {
this.primaryId = primaryId; this.primaryId = primaryId;
} }
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getSource() {
return source;
}
public void setSource(Integer source) {
this.source = source;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public BigDecimal getTaxIncludeAmount() {
return taxIncludeAmount;
}
public void setTaxIncludeAmount(BigDecimal taxIncludeAmount) {
this.taxIncludeAmount = taxIncludeAmount;
}
public BigDecimal getTaxAmount() {
return taxAmount;
}
public void setTaxAmount(BigDecimal taxAmount) {
this.taxAmount = taxAmount;
}
public BigDecimal getTaxRate() {
return taxRate;
}
public void setTaxRate(BigDecimal taxRate) {
this.taxRate = taxRate;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -851,6 +968,14 @@ public class HGCG001A extends DaoEPBase { ...@@ -851,6 +968,14 @@ public class HGCG001A extends DaoEPBase {
setMaterialPlanId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_MATERIAL_PLAN_ID)), materialPlanId)); setMaterialPlanId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_MATERIAL_PLAN_ID)), materialPlanId));
setInventTypeDetail(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_INVENT_TYPE_DETAIL)), inventTypeDetail)); setInventTypeDetail(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_INVENT_TYPE_DETAIL)), inventTypeDetail));
setPrimaryId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PRIMARY_ID)), primaryId)); setPrimaryId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PRIMARY_ID)), primaryId));
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status));
setSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SOURCE)), source));
setPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRICE)), price));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setTaxIncludeAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_TAX_INCLUDE_AMOUNT)), taxIncludeAmount));
setTaxAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_TAX_AMOUNT)), taxAmount));
setTaxRate(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_TAX_RATE)), taxRate));
} }
/** /**
...@@ -892,7 +1017,14 @@ public class HGCG001A extends DaoEPBase { ...@@ -892,7 +1017,14 @@ public class HGCG001A extends DaoEPBase {
map.put(FIELD_MATERIAL_PLAN_ID, StringUtils.toString(materialPlanId, eiMetadata.getMeta(FIELD_MATERIAL_PLAN_ID))); map.put(FIELD_MATERIAL_PLAN_ID, StringUtils.toString(materialPlanId, eiMetadata.getMeta(FIELD_MATERIAL_PLAN_ID)));
map.put(FIELD_INVENT_TYPE_DETAIL, StringUtils.toString(inventTypeDetail, eiMetadata.getMeta(FIELD_INVENT_TYPE_DETAIL))); map.put(FIELD_INVENT_TYPE_DETAIL, StringUtils.toString(inventTypeDetail, eiMetadata.getMeta(FIELD_INVENT_TYPE_DETAIL)));
map.put(FIELD_PRIMARY_ID, StringUtils.toString(primaryId, eiMetadata.getMeta(FIELD_PRIMARY_ID))); map.put(FIELD_PRIMARY_ID, StringUtils.toString(primaryId, eiMetadata.getMeta(FIELD_PRIMARY_ID)));
map.put(FIELD_STATUS, StringUtils.toString(status, eiMetadata.getMeta(FIELD_STATUS)));
map.put(FIELD_SOURCE, StringUtils.toString(source, eiMetadata.getMeta(FIELD_SOURCE)));
map.put(FIELD_PRICE, StringUtils.toString(price, eiMetadata.getMeta(FIELD_PRICE)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_TAX_INCLUDE_AMOUNT, StringUtils.toString(taxIncludeAmount, eiMetadata.getMeta(FIELD_TAX_INCLUDE_AMOUNT)));
map.put(FIELD_TAX_AMOUNT, StringUtils.toString(taxAmount, eiMetadata.getMeta(FIELD_TAX_AMOUNT)));
map.put(FIELD_TAX_RATE, StringUtils.toString(taxRate, eiMetadata.getMeta(FIELD_TAX_RATE)));
return map; return map;
} }
} }
...@@ -55,6 +55,7 @@ public class HGCG002B extends DaoEPBase { ...@@ -55,6 +55,7 @@ public class HGCG002B extends DaoEPBase {
public static final String FIELD_TAX_RATE = "taxRate"; /* 税率*/ public static final String FIELD_TAX_RATE = "taxRate"; /* 税率*/
public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /* 存货类型大类*/ public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /* 存货类型大类*/
public static final String FIELD_PRIMARY_ID = "primaryId"; /* 主表id*/ public static final String FIELD_PRIMARY_ID = "primaryId"; /* 主表id*/
public static final String FIELD_PLAN_DETAIL_ID = "planDetailId"; /* 计划明细ID*/
//页面需要展示 //页面需要展示
public static final String FIELD_BC_RECEIVE_QTY = "bcReceiveQty"; /* 本次收货数量*/ public static final String FIELD_BC_RECEIVE_QTY = "bcReceiveQty"; /* 本次收货数量*/
public static final String FIELD_BC_MAX_RECEIVE_QTY = "bcMaxReceiveQty"; /* 本次最大收货数量*/ public static final String FIELD_BC_MAX_RECEIVE_QTY = "bcMaxReceiveQty"; /* 本次最大收货数量*/
...@@ -142,6 +143,7 @@ public class HGCG002B extends DaoEPBase { ...@@ -142,6 +143,7 @@ public class HGCG002B extends DaoEPBase {
private BigDecimal taxRate = new BigDecimal("0"); /* 税率*/ private BigDecimal taxRate = new BigDecimal("0"); /* 税率*/
private Integer inventTypeDetail; /* 存货类型大类*/ private Integer inventTypeDetail; /* 存货类型大类*/
private Long primaryId = new Long(0); /* 主表id*/ private Long primaryId = new Long(0); /* 主表id*/
private Long planDetailId = new Long(0); /* 合同明细id*/
//页面需要填写、展示字段 //页面需要填写、展示字段
private BigDecimal bcReceiveQty = new BigDecimal(0.000); /* 本次收货数量*/ private BigDecimal bcReceiveQty = new BigDecimal(0.000); /* 本次收货数量*/
...@@ -333,6 +335,10 @@ public class HGCG002B extends DaoEPBase { ...@@ -333,6 +335,10 @@ public class HGCG002B extends DaoEPBase {
eiColumn.setDescName("主表id"); eiColumn.setDescName("主表id");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PLAN_DETAIL_ID);
eiColumn.setDescName("合同明细id");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_BC_RECEIVE_QTY); eiColumn = new EiColumn(FIELD_BC_RECEIVE_QTY);
eiColumn.setType("N"); eiColumn.setType("N");
eiColumn.setScaleLength(3); eiColumn.setScaleLength(3);
...@@ -996,6 +1002,14 @@ public class HGCG002B extends DaoEPBase { ...@@ -996,6 +1002,14 @@ public class HGCG002B extends DaoEPBase {
this.status = status; this.status = status;
} }
public Long getPlanDetailId() {
return planDetailId;
}
public void setPlanDetailId(Long planDetailId) {
this.planDetailId = planDetailId;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -1037,6 +1051,7 @@ public class HGCG002B extends DaoEPBase { ...@@ -1037,6 +1051,7 @@ public class HGCG002B extends DaoEPBase {
setTaxRate(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_TAX_RATE)), taxRate)); setTaxRate(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_TAX_RATE)), taxRate));
setInventTypeDetail(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_INVENT_TYPE_DETAIL)), inventTypeDetail)); setInventTypeDetail(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_INVENT_TYPE_DETAIL)), inventTypeDetail));
setPrimaryId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PRIMARY_ID)), primaryId)); setPrimaryId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PRIMARY_ID)), primaryId));
setPlanDetailId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PLAN_DETAIL_ID)), planDetailId));
setBcReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_RECEIVE_QTY)), bcReceiveQty)); setBcReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_RECEIVE_QTY)), bcReceiveQty));
setBcMaxReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_MAX_RECEIVE_QTY)), bcMaxReceiveQty)); setBcMaxReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_MAX_RECEIVE_QTY)), bcMaxReceiveQty));
...@@ -1090,6 +1105,7 @@ public class HGCG002B extends DaoEPBase { ...@@ -1090,6 +1105,7 @@ public class HGCG002B extends DaoEPBase {
map.put(FIELD_TAX_RATE, StringUtils.toString(taxRate, eiMetadata.getMeta(FIELD_TAX_RATE))); map.put(FIELD_TAX_RATE, StringUtils.toString(taxRate, eiMetadata.getMeta(FIELD_TAX_RATE)));
map.put(FIELD_INVENT_TYPE_DETAIL, StringUtils.toString(inventTypeDetail, eiMetadata.getMeta(FIELD_INVENT_TYPE_DETAIL))); map.put(FIELD_INVENT_TYPE_DETAIL, StringUtils.toString(inventTypeDetail, eiMetadata.getMeta(FIELD_INVENT_TYPE_DETAIL)));
map.put(FIELD_PRIMARY_ID, StringUtils.toString(primaryId, eiMetadata.getMeta(FIELD_PRIMARY_ID))); map.put(FIELD_PRIMARY_ID, StringUtils.toString(primaryId, eiMetadata.getMeta(FIELD_PRIMARY_ID)));
map.put(FIELD_PLAN_DETAIL_ID, StringUtils.toString(planDetailId, eiMetadata.getMeta(FIELD_PLAN_DETAIL_ID)));
map.put(FIELD_BC_RECEIVE_QTY, StringUtils.toString(bcReceiveQty, eiMetadata.getMeta(FIELD_BC_RECEIVE_QTY))); map.put(FIELD_BC_RECEIVE_QTY, StringUtils.toString(bcReceiveQty, eiMetadata.getMeta(FIELD_BC_RECEIVE_QTY)));
map.put(FIELD_BC_MAX_RECEIVE_QTY, StringUtils.toString(bcMaxReceiveQty, eiMetadata.getMeta(FIELD_BC_MAX_RECEIVE_QTY))); map.put(FIELD_BC_MAX_RECEIVE_QTY, StringUtils.toString(bcMaxReceiveQty, eiMetadata.getMeta(FIELD_BC_MAX_RECEIVE_QTY)));
......
...@@ -244,6 +244,8 @@ public class ServiceHGCG001 extends ServiceBase { ...@@ -244,6 +244,8 @@ public class ServiceHGCG001 extends ServiceBase {
fCg001.setAuditUserName(UserSessionUtils.getLoginCName()); fCg001.setAuditUserName(UserSessionUtils.getLoginCName());
fCg001.setAuditReason(""); fCg001.setAuditReason("");
DaoUtils.update(HGSqlConstant.HgCg001.UPDATE_AUDIT, fCg001); DaoUtils.update(HGSqlConstant.HgCg001.UPDATE_AUDIT, fCg001);
//子表修改
DaoUtils.update(HGSqlConstant.HgCg001A.UPDATE_STATUS_BY_PLAN_NO, fCg001);
} }
} }
......
...@@ -5,14 +5,14 @@ import com.baosight.hggp.common.DdynamicEnum; ...@@ -5,14 +5,14 @@ import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum; import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.HGCG002; import com.baosight.hggp.hg.cg.domain.*;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.tools.HGCGTools; import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils; import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils; import com.baosight.hggp.util.DateUtils;
...@@ -28,6 +28,8 @@ import java.math.BigDecimal; ...@@ -28,6 +28,8 @@ import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/** /**
* @author:songx * @author:songx
...@@ -50,7 +52,7 @@ public class ServiceHGCG002 extends ServiceBase { ...@@ -50,7 +52,7 @@ public class ServiceHGCG002 extends ServiceBase {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class); EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
EiInfoUtils.addBlock(inInfo,"userByCompany", UserSessionUtils.getUserByCompany(UserSessionUtils.getAccountCode()), User.class); EiInfoUtils.addBlock(inInfo,"userByCompany", HGXSTools.XsUser.listAll(UserSessionUtils.getAccountCode()), User.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002().eiMetadata);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
...@@ -178,6 +180,10 @@ public class ServiceHGCG002 extends ServiceBase { ...@@ -178,6 +180,10 @@ public class ServiceHGCG002 extends ServiceBase {
* @param dbCg002AMap * @param dbCg002AMap
*/ */
private void removeData(List<HGCG002> fCg002s, Map<String, HGCG002A> dbCg002AMap) { private void removeData(List<HGCG002> fCg002s, Map<String, HGCG002A> dbCg002AMap) {
//需要改变状态的采购计划主表
List<String> planNos = fCg002s.stream().map(HGCG002::getPlanNo).collect(Collectors.toList());
List<HGCG001> hgcg001List = HGCGTools.HgCg001.list(planNos);
for (HGCG002 fCg002 : fCg002s) { for (HGCG002 fCg002 : fCg002s) {
String contractNo = fCg002.getContractNo(); String contractNo = fCg002.getContractNo();
HGCG002 dbCg002 = dbCg002AMap.get(contractNo); HGCG002 dbCg002 = dbCg002AMap.get(contractNo);
...@@ -185,7 +191,16 @@ public class ServiceHGCG002 extends ServiceBase { ...@@ -185,7 +191,16 @@ public class ServiceHGCG002 extends ServiceBase {
DaoUtils.update(HGCG002.DELETE, dbCg002); DaoUtils.update(HGCG002.DELETE, dbCg002);
// 更新计划状态 // 更新计划状态
HGCGTools.HgCg001.updateStatus(dbCg002.getPlanNo(), HGConstant.CgPlanStatus.S_2); HGCGTools.HgCg001.updateStatus(dbCg002.getPlanNo(), HGConstant.CgPlanStatus.S_2);
}
List<Long> primaryIds = fCg002s.stream().map(o->o.getId()).collect(Collectors.toList());
List<HGCG002B> queryHgcg002BList = HGCGTools.HgCg002B.listByPrimaryIds(primaryIds);
for(HGCG002B hgcg002B : queryHgcg002BList){
// 更新计划明细状态
HGCGTools.HgCg001A.updateStatus(hgcg002B.getPlanDetailId(), HGConstant.CgPlanStatus.S_2);
} }
} }
/** /**
......
...@@ -11,6 +11,7 @@ import com.baosight.hggp.hg.cg.utils.HGCGUtils; ...@@ -11,6 +11,7 @@ import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils; import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
...@@ -24,10 +25,12 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -24,10 +25,12 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author:songx * @author:songx
...@@ -49,9 +52,9 @@ public class ServiceHGCG002A extends ServiceBase { ...@@ -49,9 +52,9 @@ public class ServiceHGCG002A extends ServiceBase {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
EiInfoUtils.addBlock(inInfo,"userByCompany", UserSessionUtils.getUserByCompany(UserSessionUtils.getAccountCode()), User.class); EiInfoUtils.addBlock(inInfo,"userByCompany", HGXSTools.XsUser.listAll(UserSessionUtils.getAccountCode()), User.class);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class); EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG001().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG001A().eiMetadata);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
} }
...@@ -71,8 +74,8 @@ public class ServiceHGCG002A extends ServiceBase { ...@@ -71,8 +74,8 @@ public class ServiceHGCG002A extends ServiceBase {
Map queryRow = EiInfoUtils.getFirstRow(inInfo); Map queryRow = EiInfoUtils.getFirstRow(inInfo);
HGCGUtils.HgCg001.setCondition(queryRow); HGCGUtils.HgCg001.setCondition(queryRow);
// 仅审核通过 // 仅审核通过
queryRow.put(HGCG001.FIELD_STATUS, HGConstant.CgPlanStatus.S_2); queryRow.put(HGCG001A.FIELD_STATUS, HGConstant.CgPlanStatus.S_2);
inInfo = super.query(inInfo, HGCG001.QUERY, new HGCG001A()); inInfo = super.query(inInfo, HGCG001A.QUERY_BY_CONTRACT, new HGCG001A());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
...@@ -89,16 +92,20 @@ public class ServiceHGCG002A extends ServiceBase { ...@@ -89,16 +92,20 @@ public class ServiceHGCG002A extends ServiceBase {
public EiInfo confirm(EiInfo inInfo) { public EiInfo confirm(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<HGCG001> fCg001s = MapUtils.toDaoEPBase(inInfo, HGCG001.class); List<HGCG001A> fCg001As = MapUtils.toDaoEPBase(inInfo, HGCG001A.class);
// db数据 // db数据
Map<String, HGCG001> dbCg001Map = this.lockGetData(fCg001s); Map<Long, HGCG001A> dbCg001Map = this.lockGetData(fCg001As);
//计划主表信息
List<String> planNos = fCg001As.stream().map(HGCG001A::getPlanNo).collect(Collectors.toList());
Map<String, HGCG001> hgcg001Map = HGCGTools.HgCg001.map(planNos);
// 数据校验 // 数据校验
this.checkConfirmData(fCg001s, dbCg001Map); this.checkConfirmData(fCg001As, dbCg001Map,hgcg001Map);
// 保存数据 // 保存数据
this.confirmData(resultRows, dbCg001Map); this.confirmData(fCg001As, dbCg001Map,hgcg001Map);
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg001s.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + fCg001As.size() + "]条数据保存成功!");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败"); LogUtils.setDetailMsg(inInfo, e, "保存失败");
} }
...@@ -107,75 +114,79 @@ public class ServiceHGCG002A extends ServiceBase { ...@@ -107,75 +114,79 @@ public class ServiceHGCG002A extends ServiceBase {
/** /**
* 数据校验 * 数据校验
* * @param fCg001As
* @param fCg001s * @param dbCg001AMap
* @param dbCg001Map * @param hgcg001Map
*/ */
private void checkConfirmData(List<HGCG001> fCg001s, Map<String, HGCG001> dbCg001Map) { private void checkConfirmData(List<HGCG001A> fCg001As, Map<Long, HGCG001A> dbCg001AMap, Map<String, HGCG001> hgcg001Map) {
for (HGCG001 fCg001 : fCg001s) { for (HGCG001A fCg001A : fCg001As) {
String planNo = fCg001.getPlanNo(); Long id = fCg001A.getId();
HGCG001 dbCg001 = dbCg001Map.get(planNo); HGCG001A dbCg001A = dbCg001AMap.get(id);
AssertUtils.isNull(dbCg001, String.format("计划[%s]不存在", planNo)); AssertUtils.isNull(dbCg001A, String.format("计划明细[%s]不存在", id));
AssertUtils.isNotEquals(HGConstant.CgPlanStatus.S_2, dbCg001.getStatus(), AssertUtils.isTrue(fCg001A.getTaxRate().compareTo(BigDecimal.ZERO) <= 0, "税率不能小于等于");
String.format("计划[%s]状态不是\"审核通过\",不允许操作", planNo)); AssertUtils.isTrue(fCg001A.getPrice().compareTo(BigDecimal.ZERO) <= 0, "单价不能小于等于");
} }
} }
/** /**
* 数据保存 * 数据保存
*
* @param resultRows * @param resultRows
* @param dbCg001Map * @param dbCg001Map
* @param hgcg001Map
*/ */
private void confirmData(List<Map> resultRows, Map<String, HGCG001> dbCg001Map) { private void confirmData(List<HGCG001A> resultRows, Map<Long, HGCG001A> dbCg001Map, Map<String, HGCG001> hgcg001Map) {
for (Map resultRow : resultRows) { //取一条主表数据,用于拷贝合同主表信息
String planNo = MapUtils.getString(resultRow, HGCG001.FIELD_PLAN_NO); HGCG001A oneCg001A = resultRows.get(0);
HGCG001 dbCg001 = dbCg001Map.get(planNo); HGCG001 oneCG001 = hgcg001Map.get(oneCg001A.getPlanNo());
HGCG002 newCg002 = new HGCG002(); HGCG002 newCg002 = new HGCG002();
BeanUtils.copyProperties(dbCg001, newCg002,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime"); BeanUtils.copyProperties(oneCG001, newCg002,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
newCg002.setContractDate(DateUtils.shortDate()); newCg002.setContractDate(DateUtils.shortDate());
newCg002.setContractNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_CONTRACT_NO)); newCg002.setContractNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_CONTRACT_NO));
newCg002.setSupCode(MapUtils.getString(resultRow, HGCG002.FIELD_SUP_CODE)); newCg002.setStatus(HGConstant.CgContractStatus.S_0);
newCg002.setSupName(MapUtils.getString(resultRow, HGCG002.FIELD_SUP_NAME)); newCg002.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
newCg002.setPurUserName(MapUtils.getString(resultRow, HGCG002.FIELD_PUR_USER_NAME)); newCg002.setSource(HGConstant.CgSource.DEFAULT);
newCg002.setStatus(HGConstant.CgContractStatus.S_0); DaoUtils.insert(HGCG002.INSERT, newCg002);
newCg002.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); for (HGCG001A hgcg001A : resultRows) {
newCg002.setSource(HGConstant.CgSource.DEFAULT);
DaoUtils.insert(HGCG002.INSERT, newCg002);
//新增子表信息 //新增子表信息
insertDetails(dbCg001,newCg002); insertDetails(hgcg001A,newCg002);
HGCG001 cg001 = hgcg001Map.get(hgcg001A.getPlanNo());
// 更新计划状态
HGCGTools.HgCg001.updateStatus(cg001.getPlanNo(), HGConstant.CgPlanStatus.S_4);
// 更新计划状态 // 更新计划状态
HGCGTools.HgCg001.updateStatus(planNo, HGConstant.CgPlanStatus.S_4); HGCGTools.HgCg001A.updateStatus(hgcg001A.getId(), HGConstant.CgPlanStatus.S_4);
} }
//修改主表信息
HGCGTools.HgCg002.updateCg002Pur(newCg002);
} }
private void insertDetails(HGCG001 dbCg001, HGCG002 newCg002) { private void insertDetails(HGCG001A dbCg001A, HGCG002 newCg002) {
//获取采购计划明细 //获取采购计划明细
List<HGCG001A> hgcg001AList = HGCGTools.HgCg001A.listByPrimaryId(dbCg001.getId());
List<HGCG002B> cg002BList = new LinkedList<>(); List<HGCG002B> cg002BList = new LinkedList<>();
hgcg001AList.forEach(cg001A->{ HGCG002B cg002B = new HGCG002B();
HGCG002B cg002B = new HGCG002B(); //拷贝明细信息
//拷贝明细信息 BeanUtils.copyProperties(dbCg001A,cg002B,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
BeanUtils.copyProperties(cg001A,cg002B,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime"); cg002B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
cg002B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); cg002B.setPrimaryId(newCg002.getId());
cg002B.setPrimaryId(newCg002.getId()); cg002B.setPlanDetailId(dbCg001A.getId());
cg002BList.add(cg002B); cg002BList.add(cg002B);
});
DaoUtils.insertBatch(HGCG002B.INSERT,cg002BList); DaoUtils.insertBatch(HGCG002B.INSERT,cg002BList);
//修改主表信息
HGCGTools.HgCg002.updateCg002Pur(newCg002);
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
* @param fCg001s * @param fCg001As
* @return * @return
*/ */
private Map<String, HGCG001> lockGetData(List<HGCG001> fCg001s) { private Map<Long, HGCG001A> lockGetData(List<HGCG001A> fCg001As) {
// 计划号 // ids
List<String> planNos = ObjectUtils.listEpKey(fCg001s, HGCG001.FIELD_PLAN_NO); List<String> ids = ObjectUtils.listEpKey(fCg001As, HGCG001A.FIELD_ID);
// 锁 // 锁
HGCGTools.HgCg001.lock(planNos); HGCGTools.HgCg001A.lock(ids);
// db数据 // db数据
return HGCGTools.HgCg001.map(planNos); return HGCGTools.HgCg001A.map(ids);
} }
} }
...@@ -12,6 +12,7 @@ import com.baosight.hggp.hg.constant.HGConstant; ...@@ -12,6 +12,7 @@ import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
...@@ -42,7 +43,7 @@ public class ServiceHGCG002B extends ServiceBase { ...@@ -42,7 +43,7 @@ public class ServiceHGCG002B extends ServiceBase {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SUP_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
EiInfoUtils.addBlock(inInfo,"userByCompany", UserSessionUtils.getUserByCompany(UserSessionUtils.getAccountCode()), User.class); EiInfoUtils.addBlock(inInfo,"userByCompany", HGXSTools.XsUser.listAll(UserSessionUtils.getAccountCode()), User.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002B().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG002B().eiMetadata);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
...@@ -114,43 +115,16 @@ public class ServiceHGCG002B extends ServiceBase { ...@@ -114,43 +115,16 @@ public class ServiceHGCG002B extends ServiceBase {
* 数据保存 * 数据保存
* *
* @param fCg002Bs * @param fCg002Bs
* @param cg001 * @param cg002
*/ */
private void saveData(List<HGCG002B> fCg002Bs, HGCG002 cg001) { private void saveData(List<HGCG002B> fCg002Bs, HGCG002 cg002) {
for (HGCG002B fCg002B : fCg002Bs) { for (HGCG002B fCg002B : fCg002Bs) {
DaoUtils.update(HGCG002B.UPDATE, fCg002B); DaoUtils.update(HGCG002B.UPDATE, fCg002B);
} }
//修改主表信息 //修改主表信息
updateCg002Pur(cg001); HGCGTools.HgCg002.updateCg002Pur(cg002);
} }
private void updateCg002Pur(HGCG002 cg002) {
List<HGCG002B> hgcg002BList = HGCGTools.HgCg002B.listByPrimaryId(cg002.getId());
//修改主表信息
//采购数量
BigDecimal purQtySum = hgcg002BList.stream().map(HGCG002B::getPurQty).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setPurQty(purQtySum);
//采购重量
BigDecimal purWeightSum = hgcg002BList.stream().map(HGCG002B::getPurWeight).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setPurWeight(purWeightSum);
//收货数量
BigDecimal receiveQtySum = hgcg002BList.stream().map(HGCG002B::getReceiveQty).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setReceiveQty(receiveQtySum);
//收货重量
BigDecimal receiveWeightSum = hgcg002BList.stream().map(HGCG002B::getReceiveWeight).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setReceiveWeight(receiveWeightSum);
//金额(不含税金额)
BigDecimal amountSum = hgcg002BList.stream().map(HGCG002B::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setAmount(amountSum);
//税额
BigDecimal taxAmountSum = hgcg002BList.stream().map(HGCG002B::getTaxAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setTaxAmount(taxAmountSum);
//含税金额
BigDecimal taxIncludeAmountSum = hgcg002BList.stream().map(HGCG002B::getTaxIncludeAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setTaxIncludeAmount(taxIncludeAmountSum);
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_PUR, cg002);
}
/** /**
* 删除操作. * 删除操作.
...@@ -200,9 +174,9 @@ public class ServiceHGCG002B extends ServiceBase { ...@@ -200,9 +174,9 @@ public class ServiceHGCG002B extends ServiceBase {
* *
* @param fCg002Bs * @param fCg002Bs
* @param dbCg002BMap * @param dbCg002BMap
* @param cg001 * @param cg002
*/ */
private void removeData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap,HGCG002 cg001) { private void removeData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap,HGCG002 cg002) {
for (HGCG002B fCg002B : fCg002Bs) { for (HGCG002B fCg002B : fCg002Bs) {
Long id = fCg002B.getId(); Long id = fCg002B.getId();
HGCG002B dbCg002B = dbCg002BMap.get(id); HGCG002B dbCg002B = dbCg002BMap.get(id);
...@@ -210,7 +184,7 @@ public class ServiceHGCG002B extends ServiceBase { ...@@ -210,7 +184,7 @@ public class ServiceHGCG002B extends ServiceBase {
DaoUtils.update(HGCG002B.DELETE, dbCg002B); DaoUtils.update(HGCG002B.DELETE, dbCg002B);
} }
//修改主表信息 //修改主表信息
updateCg002Pur(cg001); HGCGTools.HgCg002.updateCg002Pur(cg002);
} }
} }
...@@ -15,6 +15,7 @@ import com.baosight.hggp.hg.sc.domain.HGSC009; ...@@ -15,6 +15,7 @@ import com.baosight.hggp.hg.sc.domain.HGSC009;
import com.baosight.hggp.hg.sj.domain.HGSJ002; import com.baosight.hggp.hg.sj.domain.HGSJ002;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -50,7 +51,7 @@ public class ServiceHGCG003 extends ServiceBase { ...@@ -50,7 +51,7 @@ public class ServiceHGCG003 extends ServiceBase {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID));
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class); EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
EiInfoUtils.addBlock(inInfo,"userByCompany", UserSessionUtils.getUserByCompany(UserSessionUtils.getAccountCode()), User.class); EiInfoUtils.addBlock(inInfo,"userByCompany", HGXSTools.XsUser.listAll(UserSessionUtils.getAccountCode()), User.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG003().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG003().eiMetadata);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......
...@@ -100,6 +100,9 @@ ...@@ -100,6 +100,9 @@
<isNotEmpty prepend=" AND " property="primaryId"> <isNotEmpty prepend=" AND " property="primaryId">
PRIMARY_ID = #primaryId# PRIMARY_ID = #primaryId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="primaryIds">
PRIMARY_ID IN <iterate open="(" close=")" conjunction="," property="primaryIds">#primaryIds[]#</iterate>
</isNotEmpty>
</sql> </sql>
<sql id="idCondition"> <sql id="idCondition">
...@@ -149,12 +152,6 @@ ...@@ -149,12 +152,6 @@
<isNotEmpty prepend=" AND " property="companyName"> <isNotEmpty prepend=" AND " property="companyName">
a.COMPANY_NAME = #companyName# a.COMPANY_NAME = #companyName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="planDate">
a.PLAN_DATE = #planDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planNo">
a.PLAN_NO = #planNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType"> <isNotEmpty prepend=" AND " property="inventType">
a.INVENT_TYPE = #inventType# a.INVENT_TYPE = #inventType#
</isNotEmpty> </isNotEmpty>
...@@ -215,6 +212,25 @@ ...@@ -215,6 +212,25 @@
<isNotEmpty prepend=" AND " property="ids"> <isNotEmpty prepend=" AND " property="ids">
a.ID IN <iterate open="(" close=")" conjunction="," property="ids">#ids[]#</iterate> a.ID IN <iterate open="(" close=")" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
a.STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="source">
b.SOURCE = #source#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planDate">
b.PLAN_DATE = #planDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planNo">
b.PLAN_NO = #planNo#
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#,
UPDATED_NAME = #updatedName#,
UPDATED_TIME = #updatedTime#
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
...@@ -251,9 +267,11 @@ ...@@ -251,9 +267,11 @@
PUR_WEIGHT as "purWeight", <!-- 采购重量 --> PUR_WEIGHT as "purWeight", <!-- 采购重量 -->
MATERIAL_PLAN_ID as "materialPlanId", <!-- 材料计划id --> MATERIAL_PLAN_ID as "materialPlanId", <!-- 材料计划id -->
INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 --> INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 -->
STATUS as "status", <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
PRIMARY_ID as "primaryId" <!-- 主表id --> PRIMARY_ID as "primaryId" <!-- 主表id -->
FROM ${hggpSchema}.HGCG001A WHERE 1=1 FROM ${hggpSchema}.HGCG001A WHERE 1=1
<include refid="condition" /> <include refid="condition" />
<include refid="idCondition"/>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -285,8 +303,6 @@ ...@@ -285,8 +303,6 @@
a.DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 --> a.DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
a.COMPANY_CODE as "companyCode", <!-- 公司编码 --> a.COMPANY_CODE as "companyCode", <!-- 公司编码 -->
a.COMPANY_NAME as "companyName", <!-- 公司名称 --> a.COMPANY_NAME as "companyName", <!-- 公司名称 -->
a.PLAN_DATE as "planDate", <!-- 计划日期 -->
a.PLAN_NO as "planNo", <!-- 计划单号 -->
a.INVENT_TYPE as "inventType", <!-- 存货类型 --> a.INVENT_TYPE as "inventType", <!-- 存货类型 -->
a.INVENT_CODE as "inventCode", <!-- 存货编码 --> a.INVENT_CODE as "inventCode", <!-- 存货编码 -->
a.INVENT_NAME as "inventName", <!-- 存货名称 --> a.INVENT_NAME as "inventName", <!-- 存货名称 -->
...@@ -304,15 +320,20 @@ ...@@ -304,15 +320,20 @@
a.PUR_WEIGHT as "purWeight", <!-- 采购重量 --> a.PUR_WEIGHT as "purWeight", <!-- 采购重量 -->
a.MATERIAL_PLAN_ID as "materialPlanId", <!-- 材料计划id --> a.MATERIAL_PLAN_ID as "materialPlanId", <!-- 材料计划id -->
a.INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 --> a.INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 -->
a.STATUS as "status", <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
b.SOURCE as "source", <!-- 数据来源 根据采购数据来源小代码 目前默认0材料计划,1手工录入 -->
b.PLAN_DATE as "planDate", <!-- 计划日期 -->
b.PLAN_NO as "planNo", <!-- 计划单号 -->
a.PRIMARY_ID as "primaryId" <!-- 主表id --> a.PRIMARY_ID as "primaryId" <!-- 主表id -->
FROM ${hggpSchema}.HGCG001A a WHERE 1=1 FROM ${hggpSchema}.HGCG001A a LEFT JOIN ${hggpSchema}.HGCG001 b ON a.PRIMARY_ID = b.ID
WHERE 1=1
<include refid="conditionByContract" /> <include refid="conditionByContract" />
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
ID desc a.ID desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
...@@ -350,9 +371,10 @@ ...@@ -350,9 +371,10 @@
PUR_WEIGHT, <!-- 采购重量 --> PUR_WEIGHT, <!-- 采购重量 -->
MATERIAL_PLAN_ID, <!-- 材料计划id --> MATERIAL_PLAN_ID, <!-- 材料计划id -->
INVENT_TYPE_DETAIL, <!-- 存货类型大类 --> INVENT_TYPE_DETAIL, <!-- 存货类型大类 -->
STATUS,
PRIMARY_ID <!-- 主表id --> PRIMARY_ID <!-- 主表id -->
) )
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #planDate#, #planNo#, #inventType#, #inventCode#, #inventName#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #planQty#, #planUnitWeight#, #planWeight#, #purQty#, #purUnitWeight#, #purWeight#, #materialPlanId#, #inventTypeDetail#, #primaryId#) VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #planDate#, #planNo#, #inventType#, #inventCode#, #inventName#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #planQty#, #planUnitWeight#, #planWeight#, #purQty#, #purUnitWeight#, #purWeight#, #materialPlanId#, #inventTypeDetail#,#status#, #primaryId#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
...@@ -393,6 +415,7 @@ ...@@ -393,6 +415,7 @@
PUR_WEIGHT = #purWeight#, <!-- 采购重量 --> PUR_WEIGHT = #purWeight#, <!-- 采购重量 -->
MATERIAL_PLAN_ID = #materialPlanId#, <!-- 材料计划id --> MATERIAL_PLAN_ID = #materialPlanId#, <!-- 材料计划id -->
INVENT_TYPE_DETAIL = #inventTypeDetail#, <!-- 存货类型大类 --> INVENT_TYPE_DETAIL = #inventTypeDetail#, <!-- 存货类型大类 -->
STATUS = #status#,
PRIMARY_ID = #primaryId# <!-- 主表id --> PRIMARY_ID = #primaryId# <!-- 主表id -->
WHERE WHERE
ID = #id# ID = #id#
...@@ -406,4 +429,20 @@ ...@@ -406,4 +429,20 @@
<include refid="idCondition"/> <include refid="idCondition"/>
</update> </update>
<!-- 修改状态信息 -->
<update id="updateStatusByPlanNo">
UPDATE ${hggpSchema}.HGCG001A
SET
STATUS = #status#, <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
<include refid="updateRevise"/>
WHERE PLAN_NO = #planNo#
</update>
<!-- 修改状态信息 -->
<update id="updateStatusById">
UPDATE ${hggpSchema}.HGCG001A
SET
STATUS = #status#, <!-- 状态:0-未审批,1-审核通过,2-审核未通过 -->
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
</sqlMap> </sqlMap>
...@@ -103,6 +103,9 @@ ...@@ -103,6 +103,9 @@
<isNotEmpty prepend=" AND " property="primaryId"> <isNotEmpty prepend=" AND " property="primaryId">
PRIMARY_ID = #primaryId# PRIMARY_ID = #primaryId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="planDetailId">
PLAN_DETAIL_ID = #planDetailId#
</isNotEmpty>
</sql> </sql>
<!-- 公共修改字段 --> <!-- 公共修改字段 -->
<sql id="updateRevise"> <sql id="updateRevise">
...@@ -158,7 +161,8 @@ ...@@ -158,7 +161,8 @@
TAX_AMOUNT as "taxAmount", <!-- 税额 --> TAX_AMOUNT as "taxAmount", <!-- 税额 -->
TAX_RATE as "taxRate", <!-- 税率 --> TAX_RATE as "taxRate", <!-- 税率 -->
INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 --> INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 -->
PRIMARY_ID as "primaryId" <!-- 主表id --> PRIMARY_ID as "primaryId", <!-- 主表id -->
PLAN_DETAIL_ID as "planDetailId" <!-- 计划明细id -->
FROM ${hggpSchema}.HGCG002A WHERE 1=1 FROM ${hggpSchema}.HGCG002A WHERE 1=1
<include refid="condition" /> <include refid="condition" />
<include refid="idCondition"/> <include refid="idCondition"/>
...@@ -210,9 +214,10 @@ ...@@ -210,9 +214,10 @@
TAX_AMOUNT, <!-- 税额 --> TAX_AMOUNT, <!-- 税额 -->
TAX_RATE, <!-- 税率 --> TAX_RATE, <!-- 税率 -->
INVENT_TYPE_DETAIL, <!-- 存货类型大类 --> INVENT_TYPE_DETAIL, <!-- 存货类型大类 -->
PRIMARY_ID <!-- 主表id --> PRIMARY_ID, <!-- 主表id -->
PLAN_DETAIL_ID
) )
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #inventType#, #inventCode#, #inventName#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #purQty#, #purUnitWeight#, #purWeight#, #receiveQty#, #receiveWeight#, #price#, #amount#, #taxIncludeAmount#, #taxAmount#, #taxRate#, #inventTypeDetail#, #primaryId#) VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #inventType#, #inventCode#, #inventName#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #purQty#, #purUnitWeight#, #purWeight#, #receiveQty#, #receiveWeight#, #price#, #amount#, #taxIncludeAmount#, #taxAmount#, #taxRate#, #inventTypeDetail#, #primaryId#, #planDetailId#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
...@@ -254,7 +259,8 @@ ...@@ -254,7 +259,8 @@
TAX_AMOUNT = #taxAmount#, <!-- 税额 --> TAX_AMOUNT = #taxAmount#, <!-- 税额 -->
TAX_RATE = #taxRate#, <!-- 税率 --> TAX_RATE = #taxRate#, <!-- 税率 -->
INVENT_TYPE_DETAIL = #inventTypeDetail#, <!-- 存货类型大类 --> INVENT_TYPE_DETAIL = #inventTypeDetail#, <!-- 存货类型大类 -->
PRIMARY_ID = #primaryId# <!-- 主表id --> PRIMARY_ID = #primaryId#, <!-- 主表id -->
PLAN_DETAIL_ID = #planDetailId# <!-- 计划明细id -->
WHERE WHERE
ID = #id# ID = #id#
</update> </update>
......
...@@ -178,7 +178,7 @@ public class HGCGTools { ...@@ -178,7 +178,7 @@ public class HGCGTools {
AssertUtils.isEmpty(ids, "计划明细id不能为空"); AssertUtils.isEmpty(ids, "计划明细id不能为空");
Map<String, Object> paramMap = new HashMap(); Map<String, Object> paramMap = new HashMap();
paramMap.put("ids", ids); paramMap.put("ids", ids);
return DaoBase.getInstance().query(HGCG001A.QUERY, paramMap); return DaoBase.getInstance().query(HGCG001A.QUERY_BY_CONTRACT, paramMap);
} }
/** /**
...@@ -193,6 +193,33 @@ public class HGCGTools { ...@@ -193,6 +193,33 @@ public class HGCGTools {
paramMap.put("primaryId", primaryId); paramMap.put("primaryId", primaryId);
return DaoBase.getInstance().query(HGCG001A.QUERY, paramMap); return DaoBase.getInstance().query(HGCG001A.QUERY, paramMap);
} }
/**
* 查询
*
* @param planNos
* @return
*/
public static List<HGCG001A> listByplanNos(List<String> planNos) {
AssertUtils.isNull(planNos, "计划编号不能为空");
Map<String, Object> paramMap = new HashMap();
paramMap.put("planNos", planNos);
return DaoBase.getInstance().query(HGCG001A.QUERY, paramMap);
}
/**
* 修改状态
*
* @param id
* @param status
*/
public static void updateStatus(Long id, Integer status) {
AssertUtils.isNull(id, "明细id不能为空!");
AssertUtils.isNull(status, "状态不能为空!");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("id", id);
paramMap.put("status", status);
DaoUtils.update(HGSqlConstant.HgCg001A.UPDATE_STATUS_BY_ID, paramMap);
}
} }
...@@ -334,6 +361,34 @@ public class HGCGTools { ...@@ -334,6 +361,34 @@ public class HGCGTools {
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_RECEIVE, paramMap); DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_RECEIVE, paramMap);
}); });
} }
public static void updateCg002Pur(HGCG002 cg002) {
List<HGCG002B> hgcg002BList = HGCGTools.HgCg002B.listByPrimaryId(cg002.getId());
//修改主表信息
//采购数量
BigDecimal purQtySum = hgcg002BList.stream().map(HGCG002B::getPurQty).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setPurQty(purQtySum);
//采购重量
BigDecimal purWeightSum = hgcg002BList.stream().map(HGCG002B::getPurWeight).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setPurWeight(purWeightSum);
//收货数量
BigDecimal receiveQtySum = hgcg002BList.stream().map(HGCG002B::getReceiveQty).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setReceiveQty(receiveQtySum);
//收货重量
BigDecimal receiveWeightSum = hgcg002BList.stream().map(HGCG002B::getReceiveWeight).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setReceiveWeight(receiveWeightSum);
//金额(不含税金额)
BigDecimal amountSum = hgcg002BList.stream().map(HGCG002B::getAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setAmount(amountSum);
//税额
BigDecimal taxAmountSum = hgcg002BList.stream().map(HGCG002B::getTaxAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setTaxAmount(taxAmountSum);
//含税金额
BigDecimal taxIncludeAmountSum = hgcg002BList.stream().map(HGCG002B::getTaxIncludeAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
cg002.setTaxIncludeAmount(taxIncludeAmountSum);
DaoUtils.update(HGSqlConstant.HgCg002.UPDATE_PUR, cg002);
}
} }
/** /**
......
...@@ -151,6 +151,8 @@ public class HGConstant { ...@@ -151,6 +151,8 @@ public class HGConstant {
public static final Integer S_3 = 3; public static final Integer S_3 = 3;
// 生成合同 // 生成合同
public static final Integer S_4 = 4; public static final Integer S_4 = 4;
// 生成合同
public static final Integer S_5 = 5;
} }
/** /**
......
...@@ -39,6 +39,10 @@ public class HGSqlConstant { ...@@ -39,6 +39,10 @@ public class HGSqlConstant {
private static final String MODULE_NAME = "HGCG001A."; private static final String MODULE_NAME = "HGCG001A.";
// 锁 // 锁
public static final String LOCK = MODULE_NAME + "lock"; public static final String LOCK = MODULE_NAME + "lock";
// 审核修改状态信息
public static final String UPDATE_STATUS_BY_PLAN_NO = MODULE_NAME + "updateStatusByPlanNo";
// 审核修改状态信息
public static final String UPDATE_STATUS_BY_ID = MODULE_NAME + "updateStatusById";
} }
/** /**
......
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.planStatus"/>
</EF:EFComboColumn>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/> <EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center" <EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/> editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<EF:EFColumn ename="contractDate" cname="合同日期" enable="false" width="100" align="center" editType="date" <EF:EFColumn ename="contractDate" cname="合同日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="center"/> <EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/> <%-- <EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/>--%>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center"> <EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.contractStatus" condition="ITEM_CODE IN ('0','2','4','5')"/> <EF:EFCodeOption codeName="hggp.hgcg.contractStatus" condition="ITEM_CODE IN ('0','2','4','5')"/>
</EF:EFComboColumn> </EF:EFComboColumn>
......
$(function () { $(function () {
var userByCompany = __eiInfo.getBlock("userByCompany").getMappedRows();
IPLATUI.EFGrid = { IPLATUI.EFGrid = {
"result": { "result": {
pageable:false, pageable:false,
columns: [ columns: [
{
field: "purUserName",
template: function (dataItem) {
for (let i = 0; i < userByCompany.length; i++) {
let purUserName = dataItem['purUserName'];
if(purUserName){
if (userByCompany[i]['userName'] === purUserName.userName) {
return userByCompany[i]['userName'];
}
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
inInfo.set("field", options.field);
EiCommunicator.send("HGSC001", "userByCompanyComboBox", inInfo, {
onSuccess: function (ei) {
userByCompany = ei.getBlock("userByCompany").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: userByCompany,
minLength: 0,
dataTextField: "userName",
dataValueField: "userName",
optionLabelTemplate: "[#:loginName#]#:userName#-#:depName#",
valueTemplate: "[#:loginName#]#:userName#-#:depName#",
template: "[#:loginName#]#:userName#-#:depName#",
filter: "contains"
});
}
}
], ],
loadComplete: function (grid) { loadComplete: function (grid) {
grid.dataSource.bind("change", function (e) { grid.dataSource.bind("change", function (e) {
supCodeChange(e); var item = e.items[0];
if (e.field == "price") {
calAmount(item);
}
if (e.field == "taxRate") {
calAmount(item);
}
}); });
} }
} }
...@@ -92,16 +57,16 @@ let confirm = function () { ...@@ -92,16 +57,16 @@ let confirm = function () {
return; return;
} }
for (let i = 0; i < rows.length; i++) { for (let i = 0; i < rows.length; i++) {
if (isBlank(rows[i]['supCode'])) { // if (isBlank(rows[i]['supCode'])) {
message("勾选的第" + (i + 1) + "行供应商名称不能为空"); // message("勾选的第" + (i + 1) + "行供应商名称不能为空");
return; // return;
} // }
if (isBlank(rows[i]['purUserName'])) { // if (isBlank(rows[i]['purUserName'])) {
message("勾选的第" + (i + 1) + "行采购员不能为空"); // message("勾选的第" + (i + 1) + "行采购员不能为空");
return; // return;
} // }
let purUserName = rows[i]['purUserName']; // let purUserName = rows[i]['purUserName'];
rows[i]['purUserName'] = purUserName.userName; // rows[i]['purUserName'] = purUserName.userName;
} }
JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据生成\"采购合同\"吗? ", { JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据生成\"采购合同\"吗? ", {
ok: function () { ok: function () {
...@@ -118,21 +83,43 @@ let confirm = function () { ...@@ -118,21 +83,43 @@ let confirm = function () {
} }
/** /**
* 供应商变更 * 计算金额
* @param item
* @param length
* @param width
* @param thick
* @param coefficient
*/ */
let supCodeChange = function (e) { let calAmount = function (item) {
if (e.field != "supCode") { //原材料
return; if(item.inventTypeDetail === '3'){
} if(item.purWeight && item.price && item.taxRate){
let item = e.items[0]; // 重量*单价金额
let supRecordRows = __eiInfo.blocks.sup_record_block_id.rows; let totalAmount = item.purWeight * item.price;
for (let k = 0; k < resultGrid.getCheckedRowsIndex() + 1; k++) { //不含税金额
for (let i = 0; i < supRecordRows.length; i++) { let amount = totalAmount / (1 + item.taxRate / 100);
if (supRecordRows[i][1] === item.supCode) { //税额
let supName = supRecordRows[i][0]; let taxAmount = totalAmount - amount;
resultGrid.setCellValue(item, 'supName', supName == null ? "" : supName); //含税金额
return; let taxIncludeAmount = totalAmount;
} resultGrid.setCellValue(item, 'taxAmount', taxAmount)
resultGrid.setCellValue(item, 'amount', amount)
resultGrid.setCellValue(item, 'taxIncludeAmount', taxIncludeAmount)
} }
}else{
if(item.purQty && item.price && item.taxRate){
// 数量*单价金额
let totalAmount = item.purQty * item.price;
//不含税金额
let amount = totalAmount / (1 + item.taxRate / 100);
//税额
let taxAmount = totalAmount - amount;
//含税金额
let taxIncludeAmount = totalAmount;
resultGrid.setCellValue(item, 'taxAmount', taxAmount)
resultGrid.setCellValue(item, 'amount', amount)
resultGrid.setCellValue(item, 'taxIncludeAmount', taxIncludeAmount)
}
} }
} }
...@@ -30,14 +30,24 @@ ...@@ -30,14 +30,24 @@
<EF:EFColumn ename="planDate" cname="计划日期" enable="false" width="100" align="center" editType="date" <EF:EFColumn ename="planDate" cname="计划日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/> <EF:EFColumn ename="planNo" cname="计划单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="supCode" cname="供应商名称" width="120" align="left" defaultValue="" <EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
filter="contains" required="true"> <EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/> <EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N0}" enable="false"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFComboColumn ename="taxRate" cname="税率(%)" enable="true" width="80" align="center" required="true">
<EF:EFCodeOption codeName="hggp.cw.taxPoints" />
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="100" align="center" hidden="true"/> <EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purUserName" cname="采购员" width="120" align="center" maxLength="100" required="true"/> <EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="120" align="right" format="{0:N0}"/> <EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purWeight" cname="采购重量" enable="false" width="120" align="right" format="{0:N3}"/> <EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/> <EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center" <EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/> editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
...@@ -42,11 +42,11 @@ $(function () { ...@@ -42,11 +42,11 @@ $(function () {
input.kendoDropDownList({ input.kendoDropDownList({
dataSource: dataSource, dataSource: dataSource,
minLength: 0, minLength: 0,
dataTextField: "valueField", dataTextField: "param4Field",
dataValueField: "valueField", dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#", optionLabelTemplate: "[#:valueField#]#:textField#[#:param4Field#]",
valueTemplate: "[#:valueField#]#:textField#", valueTemplate: "[#:valueField#]#:textField#[#:param4Field#]",
template: "[#:valueField#]#:textField#", template: "[#:valueField#]#:textField#[#:param4Field#]",
filter: "contains" filter: "contains"
}); });
} }
......
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