Commit ae1df708 by 江和松

采购合同增加计算方式,根据计算方式来计算重量乘单价还是数量乘单价

parent 054afc56
...@@ -58,6 +58,8 @@ public class HGCG002B extends DaoEPBase { ...@@ -58,6 +58,8 @@ public class HGCG002B extends DaoEPBase {
public static final String FIELD_PLAN_DETAIL_ID = "planDetailId"; /* 计划明细ID*/ public static final String FIELD_PLAN_DETAIL_ID = "planDetailId"; /* 计划明细ID*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/ public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/ public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_CALCULATION_METHOD = "calculationMethod"; /* 计算方式 0-数量乘单价 1-重量乘单价*/
//页面需要展示 //页面需要展示
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"; /* 本次最大收货数量*/
...@@ -148,6 +150,7 @@ public class HGCG002B extends DaoEPBase { ...@@ -148,6 +150,7 @@ public class HGCG002B extends DaoEPBase {
private Long planDetailId = new Long(0); /* 合同明细id*/ private Long planDetailId = new Long(0); /* 合同明细id*/
private String projCode = " "; /* 项目编码*/ private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/ private String projName = " "; /* 项目名称*/
private Integer calculationMethod; /* 状态:0-未审批,1-审核通过,2-审核未通过*/
//页面需要填写、展示字段 //页面需要填写、展示字段
private BigDecimal bcReceiveQty = new BigDecimal(0.000); /* 本次收货数量*/ private BigDecimal bcReceiveQty = new BigDecimal(0.000); /* 本次收货数量*/
...@@ -396,6 +399,10 @@ public class HGCG002B extends DaoEPBase { ...@@ -396,6 +399,10 @@ public class HGCG002B extends DaoEPBase {
eiColumn = new EiColumn(FIELD_PROJ_NAME); eiColumn = new EiColumn(FIELD_PROJ_NAME);
eiColumn.setDescName("项目名称"); eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CALCULATION_METHOD);
eiColumn.setDescName("计算方式 0-数量乘单价 1-重量乘单价");
eiMetadata.addMeta(eiColumn);
} }
/** /**
...@@ -1038,6 +1045,14 @@ public class HGCG002B extends DaoEPBase { ...@@ -1038,6 +1045,14 @@ public class HGCG002B extends DaoEPBase {
this.projName = projName; this.projName = projName;
} }
public Integer getCalculationMethod() {
return calculationMethod;
}
public void setCalculationMethod(Integer calculationMethod) {
this.calculationMethod = calculationMethod;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -1082,6 +1097,7 @@ public class HGCG002B extends DaoEPBase { ...@@ -1082,6 +1097,7 @@ public class HGCG002B extends DaoEPBase {
setPlanDetailId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PLAN_DETAIL_ID)), planDetailId)); setPlanDetailId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PLAN_DETAIL_ID)), planDetailId));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode)); setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName)); setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setCalculationMethod(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_CALCULATION_METHOD)), calculationMethod));
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));
...@@ -1138,6 +1154,7 @@ public class HGCG002B extends DaoEPBase { ...@@ -1138,6 +1154,7 @@ public class HGCG002B extends DaoEPBase {
map.put(FIELD_PLAN_DETAIL_ID, StringUtils.toString(planDetailId, eiMetadata.getMeta(FIELD_PLAN_DETAIL_ID))); map.put(FIELD_PLAN_DETAIL_ID, StringUtils.toString(planDetailId, eiMetadata.getMeta(FIELD_PLAN_DETAIL_ID)));
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE))); map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME))); map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_CALCULATION_METHOD, StringUtils.toString(calculationMethod, eiMetadata.getMeta(FIELD_CALCULATION_METHOD)));
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)));
......
...@@ -112,6 +112,9 @@ ...@@ -112,6 +112,9 @@
<isNotEmpty prepend=" AND " property="projName"> <isNotEmpty prepend=" AND " property="projName">
PROJ_NAME LIKE CONCAT('%', #projName# ,'%') PROJ_NAME LIKE CONCAT('%', #projName# ,'%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="calculationMethod">
CALCULATION_METHOD = #calculationMethod#
</isNotEmpty>
</sql> </sql>
<!-- 公共修改字段 --> <!-- 公共修改字段 -->
<sql id="updateRevise"> <sql id="updateRevise">
...@@ -170,6 +173,7 @@ ...@@ -170,6 +173,7 @@
PRIMARY_ID as "primaryId", <!-- 主表id --> PRIMARY_ID as "primaryId", <!-- 主表id -->
PROJ_CODE as "projCode", <!-- 项目编码 --> PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 --> PROJ_NAME as "projName", <!-- 项目名称 -->
CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
PLAN_DETAIL_ID as "planDetailId" <!-- 计划明细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" />
...@@ -225,9 +229,10 @@ ...@@ -225,9 +229,10 @@
PRIMARY_ID, <!-- 主表id --> PRIMARY_ID, <!-- 主表id -->
PROJ_CODE, <!-- 项目编码 --> PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 --> PROJ_NAME, <!-- 项目名称 -->
CALCULATION_METHOD,
PLAN_DETAIL_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#,#projCode#,#projName#, #planDetailId#) 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#,#projCode#,#projName#,#calculationMethod#, #planDetailId#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
...@@ -272,6 +277,7 @@ ...@@ -272,6 +277,7 @@
PRIMARY_ID = #primaryId#, <!-- 主表id --> PRIMARY_ID = #primaryId#, <!-- 主表id -->
PROJ_CODE = #projCode#, <!-- 项目编码 --> PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 --> PROJ_NAME = #projName#, <!-- 项目名称 -->
CALCULATION_METHOD = #calculationMethod#,
PLAN_DETAIL_ID = #planDetailId# <!-- 计划明细id --> PLAN_DETAIL_ID = #planDetailId# <!-- 计划明细id -->
WHERE WHERE
ID = #id# ID = #id#
...@@ -325,6 +331,7 @@ ...@@ -325,6 +331,7 @@
(a.PUR_QTY - a.RECEIVE_QTY) as "bcMaxReceiveQty", (a.PUR_QTY - a.RECEIVE_QTY) as "bcMaxReceiveQty",
a.PROJ_CODE as "projCode", <!-- 项目编码 --> a.PROJ_CODE as "projCode", <!-- 项目编码 -->
a.PROJ_NAME as "projName", <!-- 项目名称 --> a.PROJ_NAME as "projName", <!-- 项目名称 -->
a.CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
b.STATUS as "status", <!-- 状态 --> b.STATUS as "status", <!-- 状态 -->
b.CONTRACT_DATE as "contractDate", <!-- 合同日期 --> b.CONTRACT_DATE as "contractDate", <!-- 合同日期 -->
b.CONTRACT_NO as "contractNo", <!-- 合同号 --> b.CONTRACT_NO as "contractNo", <!-- 合同号 -->
...@@ -371,6 +378,9 @@ ...@@ -371,6 +378,9 @@
<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="calculationMethod">
a.CALCULATION_METHOD = #calculationMethod#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractDate"> <isNotEmpty prepend=" AND " property="contractDate">
b.CONTRACT_DATE = #contractDate# b.CONTRACT_DATE = #contractDate#
</isNotEmpty> </isNotEmpty>
......
...@@ -147,12 +147,21 @@ $(function () { ...@@ -147,12 +147,21 @@ $(function () {
// change事件 // change事件
grid.dataSource.bind("change", function (e) { grid.dataSource.bind("change", function (e) {
var item = e.items[0]; var item = e.items[0];
if (e.field == "purQty") {
calAmount(item);
}
if (e.field == "purWeight") {
calAmount(item);
}
if (e.field == "price") { if (e.field == "price") {
calAmount(item); calAmount(item);
} }
if (e.field == "taxRate") { if (e.field == "taxRate") {
calAmount(item); calAmount(item);
} }
if (e.field == "calculationMethod") {
calAmount(item);
}
if (e.field === "inventCode") { if (e.field === "inventCode") {
for (let i = 0; i < inventRecordBoxBlockId.length; i++) { for (let i = 0; i < inventRecordBoxBlockId.length; i++) {
if (inventRecordBoxBlockId[i]['valueField'] === e.items[0].inventCode) { if (inventRecordBoxBlockId[i]['valueField'] === e.items[0].inventCode) {
...@@ -197,8 +206,8 @@ $(function () { ...@@ -197,8 +206,8 @@ $(function () {
* @param coefficient * @param coefficient
*/ */
let calAmount = function (item) { let calAmount = function (item) {
//原材料 //计算方式为重量乘单价
if(item.inventTypeDetail === '3'){ if(item.calculationMethod == 1){
if(item.purWeight && item.price && item.taxRate){ if(item.purWeight && item.price && item.taxRate){
// 重量*单价金额 // 重量*单价金额
let totalAmount = item.purWeight * item.price; let totalAmount = item.purWeight * item.price;
......
...@@ -38,11 +38,14 @@ ...@@ -38,11 +38,14 @@
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" required="true" defaultValue="0"/> <EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" required="true" defaultValue="0"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" required="true" defaultValue="0"/> <EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" required="true" defaultValue="0"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/> <EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFComboColumn ename="calculationMethod" cname="计算方式" enable="true" width="100" align="center" required="true">
<EF:EFCodeOption codeName="hggp.cg.calculationMethod" />
</EF:EFComboColumn>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/> <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:EFComboColumn ename="taxRate" cname="税率(%)" enable="true" width="80" align="center" required="true">
<EF:EFCodeOption codeName="hggp.cw.taxPoints" /> <EF:EFCodeOption codeName="hggp.cw.taxPoints" />
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" width="80" align="center" required="true"/> <EF:EFColumn ename="material" cname="材质" width="80" align="center" required="true"/>
......
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