Commit d842a6d1 by 宋祥

Merge remote-tracking branch 'origin/dev' into dev

parents 21b0ee32 d2f87c38
......@@ -61,6 +61,8 @@ public class HGCG003B extends DaoEPBase {
public static final String FIELD_CONTRACT_DETAIL_ID = "contractDetailId"; /* 合同明细id*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_CALCULATION_METHOD = "calculationMethod"; /* 计算方式 0-数量乘单价 1-重量乘单价*/
//页面要展示主表信息
public static final String FIELD_SUP_CODE = "supCode"; /* 供应商编码*/
......@@ -164,6 +166,7 @@ public class HGCG003B extends DaoEPBase {
private Integer isInvoicing = 0; /*是否开票 0-否 1-是*/
private Integer source; /* 数据来源 根据采购数据来源小代码 目前0默认采购合同,1手动录入*/
private Integer calculationMethod; /* 状态:0-未审批,1-审核通过,2-审核未通过*/
/**
* initialize the metadata.
*/
......@@ -380,6 +383,10 @@ public class HGCG003B extends DaoEPBase {
eiColumn = new EiColumn(FIELD_PROJ_NAME);
eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CALCULATION_METHOD);
eiColumn.setDescName("计算方式 0-数量乘单价 1-重量乘单价");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -1039,6 +1046,14 @@ public class HGCG003B extends DaoEPBase {
this.projName = projName;
}
public Integer getCalculationMethod() {
return calculationMethod;
}
public void setCalculationMethod(Integer calculationMethod) {
this.calculationMethod = calculationMethod;
}
/**
* get the value from Map.
*
......@@ -1092,6 +1107,7 @@ public class HGCG003B extends DaoEPBase {
setSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SOURCE)), source));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setCalculationMethod(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_CALCULATION_METHOD)), calculationMethod));
}
/**
......@@ -1146,6 +1162,7 @@ public class HGCG003B extends DaoEPBase {
map.put(FIELD_SOURCE, StringUtils.toString(source, eiMetadata.getMeta(FIELD_SOURCE)));
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_CALCULATION_METHOD, StringUtils.toString(calculationMethod, eiMetadata.getMeta(FIELD_CALCULATION_METHOD)));
return map;
}
......
......@@ -196,22 +196,25 @@ public class ServiceHGCG002 extends ServiceBase {
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) {
String contractNo = fCg002.getContractNo();
HGCG002 dbCg002 = dbCg002AMap.get(contractNo);
dbCg002.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG002.DELETE, dbCg002);
// 更新计划状态
HGCGTools.HgCg001.updateStatus(dbCg002.getPlanNo(), HGConstant.CgContractStatus.S_2);
if(StringUtils.isNotBlank(dbCg002.getPlanNo())){
// 更新计划状态
HGCGTools.HgCg001.updateStatus(dbCg002.getPlanNo(), HGConstant.CgContractStatus.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);
if(hgcg002B.getPlanDetailId() != null && hgcg002B.getPlanDetailId().intValue() != 0){
HGCGTools.HgCg001A.updateStatus(hgcg002B.getPlanDetailId(), HGConstant.CgPlanStatus.S_2);
}
}
......
......@@ -119,6 +119,9 @@
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME LIKE CONCAT('%', #projName# ,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="calculationMethod">
CALCULATION_METHOD = #calculationMethod#
</isNotEmpty>
</sql>
<sql id="idCondition">
......@@ -180,6 +183,7 @@
PRIMARY_ID as "primaryId", <!-- 主表id -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
CONTRACT_DETAIL_ID as "contractDetailId", <!-- 合同明细id -->
IS_INVOICING as "isInvoicing"
FROM ${hggpSchema}.HGCG003A WHERE 1=1
......@@ -240,13 +244,14 @@
CONTRACT_DETAIL_ID, <!-- 合同明细id -->
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
CALCULATION_METHOD,
IS_INVOICING
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #receiveDate#, #receiveNo#, #planNo#, #contractNo#,
#inventType#, #inventCode#, #inventName#, #specId#, #spec#, #material#, #unit#, #length#, #width#, #thick#,
#receiveQty#, #deliverQty#, #depositQty#, #receiveUnitWeight#, #receiveWeight#, #status#, #price#, #amount#,
#inventTypeDetail#, #primaryId#, #contractDetailId#,#projCode#,#projName#,#isInvoicing#)
#inventTypeDetail#, #primaryId#, #contractDetailId#,#projCode#,#projName#,#calculationMethod#,#isInvoicing#)
</insert>
<delete id="delete">
......@@ -295,6 +300,7 @@
CONTRACT_DETAIL_ID = #contractDetailId#, <!-- 合同明细id -->
PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 -->
CALCULATION_METHOD = #calculationMethod#,
IS_INVOICING = #isInvoicing#
WHERE
ID = #id#
......@@ -390,6 +396,7 @@
a.CONTRACT_DETAIL_ID as "contractDetailId", <!-- 合同明细id -->
a.PROJ_CODE as "projCode", <!-- 项目编码 -->
a.PROJ_NAME as "projName", <!-- 项目名称 -->
a.CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
b.STATUS as "status", <!-- 状态 -->
b.SUP_CODE as "supCode", <!-- 供应商编码 -->
b.SUP_NAME as "supName", <!-- 供应商名称 -->
......@@ -439,6 +446,9 @@
<isNotEmpty prepend=" AND " property="receiveDate">
a.RECEIVE_DATE = replace(#receiveDate#,'-','')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="calculationMethod">
a.CALCULATION_METHOD = #calculationMethod#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supCode">
b.SUP_CODE = #supCode#
</isNotEmpty>
......
......@@ -35,6 +35,11 @@
</EF:EFComboColumn>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" required="true"/>
<EF:EFColumn ename="material" cname="材质" width="80" align="center" required="true"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="width" cname="宽(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="thick" cname="厚(MM)" width="80" align="right" format="{0:N3}" required="true"/>
<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="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
......
......@@ -82,22 +82,19 @@ $(function () {
loadComplete: function (grid) {
// 此grid对象
grid.dataSource.bind("change", function (e) {
var item = e.items[0];
//数量发生变化进行计算
if(e.field === "receiveQty"){
if(e.items[0].receiveUnitWeight != null){
let receiveWeight = e.items[0].receiveQty * e.items[0].receiveUnitWeight;
resultGrid.setCellValue(e.items[0], 'receiveWeight', receiveWeight);
}
if(e.items[0].price != null){
let amount = e.items[0].receiveQty * e.items[0].price;
resultGrid.setCellValue(e.items[0], 'amount', amount);
}
calAmount(item)
}
if(e.field === "price"){
if(e.items[0].receiveQty != null){
let amount = e.items[0].receiveQty * e.items[0].price;
resultGrid.setCellValue(e.items[0], 'amount', amount);
}
calAmount(item)
}
if(e.field === "receiveWeight"){
calAmount(item)
}
if(e.field === "calculationMethod"){
calAmount(item)
}
if (e.field === "inventCode") {
for (let i = 0; i < inventRecordBoxBlockId.length; i++) {
......@@ -165,6 +162,34 @@ $(window).load(function () {
});
/**
* 计算金额
* @param item
* @param length
* @param width
* @param thick
* @param coefficient
*/
let calAmount = function (item) {
//计算方式为重量乘单价
if(item.calculationMethod == 1){
if(item.receiveWeight && item.price){
// 重量*单价金额
let totalAmount = item.receiveWeight * item.price;
resultGrid.setCellValue(item, 'amount', totalAmount)
}
}else{
if(item.receiveQty && item.price){
if(item.receiveQty && item.price){
// 重量*单价金额
let totalAmount = item.receiveQty * item.price;
resultGrid.setCellValue(item, 'amount', totalAmount)
}
}
}
}
/**
* 查询
*/
let query = function () {
......
......@@ -35,18 +35,21 @@
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="specId" cname="规格ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<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="receiveQty" cname="收货数量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="receiveWeight" cname="收货重量" width="120" align="right" format="{0:N3}" required="true"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="receiveWeight" cname="收货重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="receiveUnitWeight" cname="收货单重" enable="false" width="120" align="right" format="{0:N3}" hidden="true"/>
<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="amount" cname="金额" enable="false" width="80" 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:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/>
</EF:EFComboColumn>
......
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