Commit 363c3378 by 江和松

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

parents ccdab298 30327607
...@@ -97,6 +97,8 @@ public class HGCB005 extends DaoEPBase { ...@@ -97,6 +97,8 @@ public class HGCB005 extends DaoEPBase {
public static final String INSERT = "HGCB005.insert"; public static final String INSERT = "HGCB005.insert";
public static final String UPDATE = "HGCB005.update"; public static final String UPDATE = "HGCB005.update";
public static final String DELETE = "HGCB005.delete"; public static final String DELETE = "HGCB005.delete";
public static final String DELETE_BY_CONDITION = "HGCB005.delete_by_condition";
private Long id = new Long(0); private Long id = new Long(0);
private String accountCode = " "; /* 企业编码*/ private String accountCode = " "; /* 企业编码*/
...@@ -133,6 +135,25 @@ public class HGCB005 extends DaoEPBase { ...@@ -133,6 +135,25 @@ public class HGCB005 extends DaoEPBase {
private String processName = " "; /* 工序名称*/ private String processName = " "; /* 工序名称*/
private Long processOrder = new Long(0); /* 加工顺序*/ private Long processOrder = new Long(0); /* 加工顺序*/
private BigDecimal costWeight = new BigDecimal(0);
private BigDecimal costWeightValue = new BigDecimal(0);
public BigDecimal getCostWeight() {
return costWeight;
}
public void setCostWeight(BigDecimal costWeight) {
this.costWeight = costWeight;
}
public BigDecimal getCostWeightValue() {
return costWeightValue;
}
public void setCostWeightValue(BigDecimal costWeightValue) {
this.costWeightValue = costWeightValue;
}
/** /**
* initialize the metadata. * initialize the metadata.
*/ */
......
...@@ -350,6 +350,13 @@ ...@@ -350,6 +350,13 @@
id = #id# id = #id#
</delete> </delete>
<delete id="delete_by_condition">
DELETE FROM ${hggpSchema}.HGCB005 WHERE
company_code = #companyCode#, <!-- 公司编码 -->
account_year = #accountYear#, <!-- 会计期(年) -->
account_month = #accountMonth# <!-- 会计期(月) -->
</delete>
<update id="update"> <update id="update">
UPDATE ${hggpSchema}.HGCB005 UPDATE ${hggpSchema}.HGCB005
SET SET
......
...@@ -15,14 +15,12 @@ import com.baosight.hggp.hg.cb.domain.HGCB005; ...@@ -15,14 +15,12 @@ import com.baosight.hggp.hg.cb.domain.HGCB005;
import com.baosight.hggp.hg.cg.domain.HGCG003; import com.baosight.hggp.hg.cg.domain.HGCG003;
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.cw.domain.HGCW001; import com.baosight.hggp.hg.cw.domain.*;
import com.baosight.hggp.hg.cw.domain.HGCW012;
import com.baosight.hggp.hg.cw.domain.HGCW012A;
import com.baosight.hggp.hg.cw.domain.HGCW013;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.kc.domain.*; import com.baosight.hggp.hg.kc.domain.*;
import com.baosight.hggp.hg.kc.tools.HGKCTools; import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ005A;
import com.baosight.hggp.hg.pz.domain.HGPZ007; import com.baosight.hggp.hg.pz.domain.HGPZ007;
import com.baosight.hggp.hg.pz.tools.HGPZTools; import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.HGSC005A; import com.baosight.hggp.hg.sc.domain.HGSC005A;
...@@ -620,6 +618,10 @@ public class HGCBTools { ...@@ -620,6 +618,10 @@ public class HGCBTools {
} }
public static class THGCB005 { public static class THGCB005 {
public static void deleteByCondition(Map params){
DaoBase.getInstance().delete(HGCB005.DELETE_BY_CONDITION, params);
}
/** /**
* 同步数据 * 同步数据
* *
...@@ -639,22 +641,73 @@ public class HGCBTools { ...@@ -639,22 +641,73 @@ public class HGCBTools {
//入库单按项目编码、产品编码、存货工序ID、规格、单重分组,分别取正向入库单数量、重量和退回数量 //入库单按项目编码、产品编码、存货工序ID、规格、单重分组,分别取正向入库单数量、重量和退回数量
//生成制造成本基础数据 //生成制造成本基础数据
List<HGCB005> hgcb005List = constractHGCB005(hgcw001,hgkc003List); List<HGCB005> hgcb005List = constractHGCB005(hgcw001,hgkc003List);
//通过存货工序ID查询工序权重 //设置权重
List<Long> processIds = Optional.ofNullable(hgcb005List).orElse(new ArrayList<>()).stream().map(HGCB005::getInventProcessId).collect(Collectors.toList()); setingCostWeight(hgcb005List);
if(CollectionUtils.isNotEmpty(processIds)){ //计算项目总成本
List<HGPZ005> hgpz005List = HGPZTools.HgPz005.getIds(processIds); Map<String,BigDecimal> totalAmoutMap = calculateProjAmout(hgcw001);
Map<Long,HGPZ005> hgpz005Map = Optional.ofNullable(hgpz005List).orElse(new ArrayList<>()).stream().collect(Collectors.toMap( //计算产副品成本:权重值*项目总费用=产副品制造总成本;总成本/数量=单位成本
HGPZ005::getId, Optional.ofNullable(hgcb005List).orElse(new ArrayList<>()).stream().forEach( o -> {
o->o, BigDecimal totalAmout = totalAmoutMap.get(o.getProjCode());
(o1,o2)->o1 o.setTotalCost(totalAmout.multiply(o.getCostWeightValue()).setScale(6,RoundingMode.HALF_UP));
)); o.setUnitCost(o.getTotalCost().divide(o.getQuantity(),6,RoundingMode.HALF_UP));
});
//按公司删除当前会计起的成本核算数据
Map cb005DeleteParam = new HashMap();
cb005DeleteParam.put(HGCB005.FIELD_company_code,hgcw001.getCompanyCode());
cb005DeleteParam.put(HGCB005.FIELD_account_year,hgcw001.getAccountYear());
cb005DeleteParam.put(HGCB005.FIELD_account_month,hgcw001.getAccountPeriod().substring(4));
deleteByCondition(cb005DeleteParam);
//保存新的成本核算数据
if(CollectionUtils.isNotEmpty(hgcb005List)){
DaoBase.getInstance().insertBatch(HGCB005.INSERT, hgcb005List);
} }
//通过业务账期信息查询类型为分摊的费用归集数据,按项目分组金额求和
//计算成本:入库重量*工序权重=产副品权重,SUM(产副品权重)=项目权重,产副品权重/项目权重*总费用=产副品制造总成本
} }
} }
private static Map<String,BigDecimal> calculateProjAmout(HGCW001 hgcw001){
//通过业务账期信息查询类型为分摊的费用归集数据,按项目分组金额求和
Map cw052ParamMap = new HashMap();
cw052ParamMap.put(HGCW052.FIELD_COMPANY_CODE,hgcw001.getCompanyCode());
cw052ParamMap.put(HGCW052.FIELD_YEAR,hgcw001.getAccountYear());
cw052ParamMap.put(HGCW052.FIELD_MONTH,hgcw001.getAccountPeriod().substring(4));
cw052ParamMap.put(HGCW052.FIELD_IS_SHARE, CommonConstant.YesNo.YES_1);
List<HGCW052> hgcw052List = HGCWTools.HgCw052.listByCondition(cw052ParamMap);
Map<String,BigDecimal> totalAmoutMap = Optional.ofNullable(hgcw052List).orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(
o->o.getItemCode(),
Collectors.reducing(
BigDecimal.ZERO,HGCW052::getAmount,BigDecimal::add))
);
return totalAmoutMap;
}
private static void setingCostWeight(List<HGCB005> hgcb005List){
//通过存货工序ID查询工序权重
List<Long> processIds = Optional.ofNullable(hgcb005List).orElse(new ArrayList<>()).stream().map(HGCB005::getInventProcessId).collect(Collectors.toList());
List<HGPZ005A> hgpz005aList = HGPZTools.HgPz005A.queryByIds(processIds);
Map<Long,HGPZ005A> hgpz005aMap = Optional.ofNullable(hgpz005aList).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(
HGPZ005A::getId,
o->o,
(o1,o2)->o1
));
//设置权重,入库重量*工序权重=产副品权重
Optional.ofNullable(hgcb005List).orElse(new ArrayList<>()).stream().forEach(o -> {
HGPZ005A hgpz005a = hgpz005aMap.get(o.getInventProcessId());
AssertUtils.isNull(hgpz005a,String.format("产品[%s]%s工艺工序配置缺失",o.getProductCode(),o.getProductName()));
o.setCostWeight(o.getTotalWeight().multiply(hgpz005a.getCostWeight()).setScale(6,RoundingMode.HALF_UP));
});
//按项目分组求总权重,SUM(产副品权重)=项目权重
Map<String,BigDecimal> totalCostWeightMap = Optional.ofNullable(hgcb005List).orElse(new ArrayList<>()).stream().collect(
Collectors.groupingBy(HGCB005::getProjCode,Collectors.reducing(
BigDecimal.ZERO,HGCB005::getCostWeight,BigDecimal::add)));
//设置权重值 = 产副品权重/项目权重
Optional.ofNullable(hgcb005List).orElse(new ArrayList<>()).stream().forEach(o -> {
BigDecimal projCostWeight = totalCostWeightMap.get(o.getProjCode());
AssertUtils.isTrue(Objects.isNull(projCostWeight)||BigDecimal.ZERO.compareTo(projCostWeight)>=0
,String.format("项目[%s]%s总权重等于或小于0",o.getProjCode(),o.getProjName()));
o.setCostWeightValue(o.getCostWeight().divide(projCostWeight,6,RoundingMode.HALF_UP));
});
}
private static List<HGCB005> constractHGCB005(HGCW001 hgcw001, List<HGKC003> hgkc003List){ private static List<HGCB005> constractHGCB005(HGCW001 hgcw001, List<HGKC003> hgkc003List){
List<HGCB005> hgcb005List = Optional.ofNullable(hgkc003List).orElse(new ArrayList<>()).stream().collect(Collectors.toMap( List<HGCB005> hgcb005List = Optional.ofNullable(hgkc003List).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(
o->o.getProjCode()+"-"+o.getPrdtCode()+"-"+o.getInventProcessId()+"-"+o.getPrdtSpec()+"-"+o.getInvUnitWeight(), o->o.getProjCode()+"-"+o.getPrdtCode()+"-"+o.getInventProcessId()+"-"+o.getPrdtSpec()+"-"+o.getInvUnitWeight(),
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
SUP_CODE = #supCode# SUP_CODE = #supCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="supName"> <isNotEmpty prepend=" AND " property="supName">
SUP_NAME = #supName# SUP_NAME like concat('%',#supName#,'%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="purUserId"> <isNotEmpty prepend=" AND " property="purUserId">
PUR_USER_ID = #purUserId# PUR_USER_ID = #purUserId#
...@@ -109,6 +109,12 @@ ...@@ -109,6 +109,12 @@
<isNotEmpty prepend=" AND " property="inventTypeDetails"> <isNotEmpty prepend=" AND " property="inventTypeDetails">
INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate> INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="signingDateFrom">
RECEIVE_DATE >= #signingDateFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="signingDateTo">
RECEIVE_DATE &lt;= #signingDateTo#
</isNotEmpty>
</sql> </sql>
<sql id="idCondition"> <sql id="idCondition">
......
...@@ -148,7 +148,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -148,7 +148,7 @@ public class ServiceHGCW012 extends ServiceBase {
return inInfo; return inInfo;
} }
@OperationLogAnnotation(operModul = "采购收票",operType = "插入",operDesc = "生成采购收票") @OperationLogAnnotation(operModul = "采购收票",operType = "插入",operDesc = "生成采购收票劳务合同")
public EiInfo select(EiInfo inInfo) { public EiInfo select(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock("resultA").getRows(); List<Map> resultRows = inInfo.getBlock("resultA").getRows();
...@@ -169,7 +169,8 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -169,7 +169,8 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setCompanyName(userVO.getUsername()); hgcw012.setCompanyName(userVO.getUsername());
hgcw012.setReviewStatus(0); hgcw012.setReviewStatus(0);
hgcw012.setBillState(1); hgcw012.setBillState(1);
hgcw012.setSigningDate(DateUtils.shortDate()); //hgcw012.setSigningDate(DateUtils.shortDate());
hgcw012.setReceiveDate(DateUtils.shortDate());
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO; BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer settlementNumber = new StringBuffer(); StringBuffer settlementNumber = new StringBuffer();
Map<String, BigDecimal> rowMap = new HashMap<>(); Map<String, BigDecimal> rowMap = new HashMap<>();
...@@ -244,7 +245,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -244,7 +245,7 @@ public class ServiceHGCW012 extends ServiceBase {
} }
return inInfo; return inInfo;
} }
@OperationLogAnnotation(operModul = "采购收票",operType = "插入",operDesc = "生成采购收票")
public EiInfo selecta(EiInfo inInfo) { public EiInfo selecta(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock("result").getRows(); List<Map> resultRows = inInfo.getBlock("result").getRows();
...@@ -265,7 +266,9 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -265,7 +266,9 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setCompanyName(userVO.getUsername()); hgcw012.setCompanyName(userVO.getUsername());
hgcw012.setReviewStatus(0); hgcw012.setReviewStatus(0);
hgcw012.setBillState(1); hgcw012.setBillState(1);
hgcw012.setSigningDate(DateUtils.shortDate()); hgcw012.setBillTybe(1);
//hgcw012.setSigningDate(DateUtils.shortDate());
hgcw012.setReceiveDate(DateUtils.shortDate());
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO; BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer settlementNumber = new StringBuffer(); StringBuffer settlementNumber = new StringBuffer();
Map<String, BigDecimal> rowMap = new HashMap<>(); Map<String, BigDecimal> rowMap = new HashMap<>();
...@@ -332,6 +335,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -332,6 +335,7 @@ public class ServiceHGCW012 extends ServiceBase {
} }
return inInfo; return inInfo;
} }
@OperationLogAnnotation(operModul = "采购收票",operType = "插入",operDesc = "生成租赁合同")
public EiInfo selectb(EiInfo inInfo) { public EiInfo selectb(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock("resultB").getRows(); List<Map> resultRows = inInfo.getBlock("resultB").getRows();
...@@ -352,7 +356,9 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -352,7 +356,9 @@ public class ServiceHGCW012 extends ServiceBase {
hgcw012.setCompanyName(userVO.getUsername()); hgcw012.setCompanyName(userVO.getUsername());
hgcw012.setReviewStatus(0); hgcw012.setReviewStatus(0);
hgcw012.setBillState(1); hgcw012.setBillState(1);
hgcw012.setSigningDate(DateUtils.shortDate()); hgcw012.setBillTybe(1);
//hgcw012.setSigningDate(DateUtils.shortDate());
hgcw012.setReceiveDate(DateUtils.shortDate());
BigDecimal totalContractPriceIncluding = BigDecimal.ZERO; BigDecimal totalContractPriceIncluding = BigDecimal.ZERO;
StringBuffer settlementNumber = new StringBuffer(); StringBuffer settlementNumber = new StringBuffer();
Map<String, BigDecimal> rowMap = new HashMap<>(); Map<String, BigDecimal> rowMap = new HashMap<>();
...@@ -378,7 +384,9 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -378,7 +384,9 @@ public class ServiceHGCW012 extends ServiceBase {
//生成明细表 //生成明细表
for (HGCW013 hgcw013 : hgcw013List) { for (HGCW013 hgcw013 : hgcw013List) {
hgcw013.setMainId(hgcw012.getId()); hgcw013.setMainId(hgcw012.getId());
HGCWTools.HgCw006.deductionAmount(hgcw013.getSettlementNumber(),rowMap.get(hgcw013.getSettlementNumber()));
hgcw013.setId(null); hgcw013.setId(null);
this.addHGCW013(hgcw013);
} }
} else { } else {
HGCW012 hgcw012 = HGCWTools.HgCw012.getId(mainId); HGCW012 hgcw012 = HGCWTools.HgCw012.getId(mainId);
...@@ -393,7 +401,7 @@ public class ServiceHGCW012 extends ServiceBase { ...@@ -393,7 +401,7 @@ public class ServiceHGCW012 extends ServiceBase {
for (HGCW013 hgcw013 : hgcw013List) { for (HGCW013 hgcw013 : hgcw013List) {
hgcw013.setMainId(hgcw012.getId()); hgcw013.setMainId(hgcw012.getId());
// 反写金额 // 反写金额
HGCWTools.HgCw008.deductionAmount(hgcw013.getSettlementNumber(),rowMap.get(hgcw013.getSettlementNumber())); HGCWTools.HgCw006.deductionAmount(hgcw013.getSettlementNumber(),rowMap.get(hgcw013.getSettlementNumber()));
this.addHGCW013(hgcw013); this.addHGCW013(hgcw013);
} }
List<HGCW013> hgcw013s = HGCWTools.HgCw013.getMainId(hgcw012.getId()); List<HGCW013> hgcw013s = HGCWTools.HgCw013.getMainId(hgcw012.getId());
......
package com.baosight.hggp.hg.cw.service; package com.baosight.hggp.hg.cw.service;
import com.baosight.bpm.util.StringUtil;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.hg.cg.domain.HGCG003; import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cw.domain.*; import com.baosight.hggp.hg.cw.domain.*;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.hggp.util.contants.ACConstants; import com.baosight.hggp.util.contants.ACConstants;
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;
...@@ -44,6 +47,14 @@ public class ServiceHGCW012A extends ServiceBase { ...@@ -44,6 +47,14 @@ public class ServiceHGCW012A extends ServiceBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
String signingDateFrom = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "signingDateFrom");
String signingDateTo = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "signingDateTo");
if (!signingDateFrom.isEmpty()){
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"signingDateFrom", DateUtils.formatShort(signingDateFrom));
}
if (!signingDateTo.isEmpty()){
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"signingDateTo", DateUtils.formatShort(signingDateTo));
}
inInfo = super.query(inInfo, HGCG003.QUERY, new HGCG003()); inInfo = super.query(inInfo, HGCG003.QUERY, new HGCG003());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
...@@ -54,7 +65,16 @@ public class ServiceHGCW012A extends ServiceBase { ...@@ -54,7 +65,16 @@ public class ServiceHGCW012A extends ServiceBase {
@OperationLogAnnotation(operModul = "采购开票",operType = "查询",operDesc = "查询劳务") @OperationLogAnnotation(operModul = "采购开票",operType = "查询",operDesc = "查询劳务")
public EiInfo queryA(EiInfo inInfo) { public EiInfo queryA(EiInfo inInfo) {
try { try {
String signingDateFrom = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "signingDateFrom");
String signingDateTo = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "signingDateTo");
if (!signingDateFrom.isEmpty()){
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"signingDateFrom", DateUtils.formatShort(signingDateFrom));
}
if (!signingDateTo.isEmpty()){
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"signingDateTo", DateUtils.formatShort(signingDateTo));
}
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGCW002.FIELD_CONTRACT_TYPE, 2); inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGCW002.FIELD_CONTRACT_TYPE, 2);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCW006.FIELD_REMAINING_AMOUNT, 0);
inInfo = super.query(inInfo, HGCW012A.QUERY, new HGCW012A(),false,new HGCW012A().eiMetadata,EiConstant.queryBlock,"resultA","resultA"); inInfo = super.query(inInfo, HGCW012A.QUERY, new HGCW012A(),false,new HGCW012A().eiMetadata,EiConstant.queryBlock,"resultA","resultA");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
...@@ -65,7 +85,15 @@ public class ServiceHGCW012A extends ServiceBase { ...@@ -65,7 +85,15 @@ public class ServiceHGCW012A extends ServiceBase {
@OperationLogAnnotation(operModul = "采购开票",operType = "查询",operDesc = "查询租赁") @OperationLogAnnotation(operModul = "采购开票",operType = "查询",operDesc = "查询租赁")
public EiInfo queryB(EiInfo inInfo) { public EiInfo queryB(EiInfo inInfo) {
try { try {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCW002.FIELD_CONTRACT_TYPE, 2); String signingDateFrom = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "signingDateFrom");
String signingDateTo = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "signingDateTo");
if (!signingDateFrom.isEmpty()){
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"signingDateFrom", DateUtils.formatShort(signingDateFrom));
}
if (!signingDateTo.isEmpty()){
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,"signingDateTo", DateUtils.formatShort(signingDateTo));
}
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGCW006.FIELD_REMAINING_AMOUNT, 0);
inInfo = super.query(inInfo, HGCW006.QUERY, new HGCW006(), false, new HGCW006().eiMetadata, EiConstant.queryBlock, "resultB", "resultB"); inInfo = super.query(inInfo, HGCW006.QUERY, new HGCW006(), false, new HGCW006().eiMetadata, EiConstant.queryBlock, "resultB", "resultB");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
...@@ -144,6 +144,18 @@ ...@@ -144,6 +144,18 @@
<isNotEmpty prepend=" AND " property="companyCodes"> <isNotEmpty prepend=" AND " property="companyCodes">
COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate> COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="remainingAmount">
REMAINING_AMOUNT > #remainingAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="signingDateFrom">
SIGNING_DATE >= #signingDateFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="signingDateTo">
SIGNING_DATE &lt;= #signingDateTo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supName">
PARTY_B like concat('%',#supName#,'%')
</isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
......
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
$orderBy$ $orderBy$
</isNotEmpty> </isNotEmpty>
<isEmpty property="orderBy"> <isEmpty property="orderBy">
ID asc ID desc
</isEmpty> </isEmpty>
</dynamic> </dynamic>
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
T1.COMPANY_NAME as "companyName", <!-- 公司名称 --> T1.COMPANY_NAME as "companyName", <!-- 公司名称 -->
T1.PROJ_CODE as "projCode", <!-- 项目编码 --> T1.PROJ_CODE as "projCode", <!-- 项目编码 -->
T1.PROJ_NAME as "projName", <!-- 项目名称 --> T1.PROJ_NAME as "projName", <!-- 项目名称 -->
B.PARTY_B AS "partyB", <!-- 乙方名称 -->
T1.CONTRACT_NUMBER as "contractNumber", <!-- 合同号 --> T1.CONTRACT_NUMBER as "contractNumber", <!-- 合同号 -->
T1.CONTRACT_NAME as "contractName", <!-- 合同名称 --> T1.CONTRACT_NAME as "contractName", <!-- 合同名称 -->
T1.SETTLEMENT_NUMBER as "settlementNumber", <!-- 结算编号 --> T1.SETTLEMENT_NUMBER as "settlementNumber", <!-- 结算编号 -->
...@@ -182,15 +183,26 @@ ...@@ -182,15 +183,26 @@
B.CONTRACT_TYPE = #contractType# B.CONTRACT_TYPE = #contractType#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCodes"> <isNotEmpty prepend=" AND " property="companyCodes">
COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate> T1.COMPANY_CODE IN <iterate close=")" open="(" conjunction="," property="companyCodes">#companyCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remainingAmount">
T1.REMAINING_AMOUNT > #remainingAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="signingDateFrom">
T1.CONTRACT_DATE >= #signingDateFrom#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="signingDateTo">
T1.CONTRACT_DATE &lt;= #signingDateTo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="supName">
B.PARTY_B like concat('%',#supName#,'%')
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cw.domain.HGCW008"> resultClass="com.baosight.hggp.hg.cw.domain.HGCW008">
SELECT SELECT
<include refid="column"/> <include refid="column"/>
FROM ${hggpSchema}.HGCW008 T1 LEFT JOIN FROM ${hggpSchema}.HGCW008 T1 LEFT JOIN ${hggpSchema}.HGCW002 B
${hggpSchema}.HGCW002 B
ON T1.PROJ_CODE = B.PROJ_CODE ON T1.PROJ_CODE = B.PROJ_CODE
AND T1.CONTRACT_NUMBER = B.CONTRACT_NUMBER AND T1.CONTRACT_NUMBER = B.CONTRACT_NUMBER
AND T1.COMPANY_CODE = B.COMPANY_CODE AND T1.COMPANY_CODE = B.COMPANY_CODE
......
...@@ -137,6 +137,29 @@ public class HGCWTools { ...@@ -137,6 +137,29 @@ public class HGCWTools {
}); });
return results.get(0); return results.get(0);
} }
public static void deductionAmount(String settlementNumber, BigDecimal deductionAmount) {
AssertUtils.isNull(settlementNumber, "来源单号不能为空!");
// if (deductionAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
// throw new PlatException("扣款金额不能小于等于0!");
// }
List<HGCW006> results = DaoBase.getInstance().query(HGCW008.QUERY,new HashMap<String,Object>(){
{put("contractNumber",settlementNumber);}
});
if (CollectionUtils.isEmpty(results)) {
throw new PlatException("找不到对应的结算单!");
}
DecimalFormat decimalFormat = new DecimalFormat("#.000");
HGCW006 hgcw006 = results.get(0);
BigDecimal remainingAmount = new BigDecimal(decimalFormat.format(hgcw006.getRemainingAmount().subtract(deductionAmount)));
if (remainingAmount.compareTo(new BigDecimal(BigInteger.ZERO)) < 0) {
throw new PlatException("扣款金额不能大于结算单剩余金额!");
}
hgcw006.setRemainingAmount(remainingAmount);
DaoUtils.update("HGCW006.updateDeductionAmount", hgcw006);
}
} }
public static class HgCw007 { public static class HgCw007 {
...@@ -525,6 +548,7 @@ public class HGCWTools { ...@@ -525,6 +548,7 @@ public class HGCWTools {
HGCW013.setSettlementNumber(settlementNumber); HGCW013.setSettlementNumber(settlementNumber);
HGCW013.setThisSettlementTax(thisSettlementTax.toString()); HGCW013.setThisSettlementTax(thisSettlementTax.toString());
HGCW013.setThisSettlementAmount(thisSettlementAmount.toString()); HGCW013.setThisSettlementAmount(thisSettlementAmount.toString());
HGCW013.setPartyA(row.get("partyB").toString());
if (mainId != null) { if (mainId != null) {
HGCW013.setMainId(mainId); HGCW013.setMainId(mainId);
} }
...@@ -550,6 +574,7 @@ public class HGCWTools { ...@@ -550,6 +574,7 @@ public class HGCWTools {
HGCW013.setSettlementNumber(settlementNumber); HGCW013.setSettlementNumber(settlementNumber);
HGCW013.setThisSettlementTax(thisSettlementTax.toString()); HGCW013.setThisSettlementTax(thisSettlementTax.toString());
HGCW013.setThisSettlementAmount(thisSettlementAmount.toString()); HGCW013.setThisSettlementAmount(thisSettlementAmount.toString());
HGCW013.setPartyA(row.get("partyB").toString());
if (mainId != null) { if (mainId != null) {
HGCW013.setMainId(mainId); HGCW013.setMainId(mainId);
} }
...@@ -784,7 +809,12 @@ public class HGCWTools { ...@@ -784,7 +809,12 @@ public class HGCWTools {
} }
} }
public static class HgCw052{
public static List<HGCW052> listByCondition(Map param) {
return DaoBase.getInstance().query(HGCW052.QUERY,param);
}
}
public static class HgCw055{ public static class HgCw055{
public static void save(List<Map> rows, UserVO userVO) { public static void save(List<Map> rows, UserVO userVO) {
// AssertUtils.isNull(contractNumber, "合同号不能为空!"); // AssertUtils.isNull(contractNumber, "合同号不能为空!");
......
...@@ -151,7 +151,7 @@ function windowCallback() { ...@@ -151,7 +151,7 @@ function windowCallback() {
function contractDetailFunc(id) { function contractDetailFunc(id) {
JSColorbox.open({ JSColorbox.open({
href: "HGCW012A?methodName=initLoad&efParentFormEname=HGCW010", href: "HGCW012C?methodName=initLoad&inqu_status-0-matId=" + id + "&efParentFormEname=HGCW010",
title: "<div style='text-align: center;'>明细详情</div>", title: "<div style='text-align: center;'>明细详情</div>",
width: "90%", width: "90%",
height: "90%", height: "90%",
......
...@@ -28,16 +28,16 @@ ...@@ -28,16 +28,16 @@
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" autoBind="false"> <EF:EFGrid blockId="result" autoDraw="no" isFloat="true" autoBind="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="140" align="center"/> <EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="140" align="center"/>
<EF:EFColumn ename="partyA" cname="供应商名称" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="partyA" cname="供应商名称" width="220" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="settlementNumber" cname="来源单号" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="settlementNumber" cname="来源单号" width="200" enable="false" readonly="true" align="center"/>
<EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center" required="true" <EF:EFComboColumn ename="billTybe" cname="票据类型" width="120" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" > columnTemplate="#=textField#" itemTemplate="#=textField#" enable="true" >
<EF:EFCodeOption codeName="hggp.cw.billTybe"/> <EF:EFCodeOption codeName="hggp.cw.billTybe"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="receiveDate" cname="收票日期" width="120" enable="true" align="center" editType="date" <EF:EFColumn ename="receiveDate" cname="收票日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true" /> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true" />
<EF:EFColumn ename="signingDate" cname="开票日期" width="120" enable="true" align="center" editType="date" <EF:EFColumn ename="signingDate" cname="开票日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" required="true" /> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true" />
<EF:EFColumn ename="billNumber" cname="发票号" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="billNumber" cname="发票号" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="taxPoints" cname="税率" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="taxPoints" cname="税率" width="120" enable="false" readonly="true" align="center"/>
<EF:EFColumn ename="thisSettlementAmount" cname="不含税金额" width="120" enable="false" readonly="true" align="center"/> <EF:EFColumn ename="thisSettlementAmount" cname="不含税金额" width="120" enable="false" readonly="true" align="center"/>
......
...@@ -37,7 +37,15 @@ $(window).load(function () { ...@@ -37,7 +37,15 @@ $(window).load(function () {
* 查询 * 查询
*/ */
let query = function () { let query = function () {
resultGrid.dataSource.page(1);
if (selectedTab == 0){
resultGrid.dataSource.page(1);
}else if (selectedTab == 1){
resultAGrid.dataSource.page(1);
}else if (selectedTab == 2){
resultBGrid.dataSource.page(1);
}
} }
function cancelFunc() { function cancelFunc() {
...@@ -124,7 +132,14 @@ function btnSaveFunc(btnNode, gridNode) { ...@@ -124,7 +132,14 @@ function btnSaveFunc(btnNode, gridNode) {
}); });
} }
} }
var selectedTab = '';
function onSelect(e) {
var selecTab = e.item; // e.item是被选中的标签DOM元素
selectedTab = $("#info").find("li").index(selecTab); // 获取被选中标签的索引
//var selectedTabText = $(selectedTab).find("a").text(); // 获取被选中标签的文本
}
$(function () { $(function () {
$("#SEARCH").click(function () { $("#SEARCH").click(function () {
var ei = new EiInfo(); var ei = new EiInfo();
...@@ -236,10 +251,18 @@ $(function () { ...@@ -236,10 +251,18 @@ $(function () {
{ {
field: "projName", field: "projName",
title: "项目名称", title: "项目名称",
width: 200,
headerTemplate: "<span style='color: '>项目名称 </span>", headerTemplate: "<span style='color: '>项目名称 </span>",
locked: false locked: false
}, },
{ {
field: "partyB",
title: "供应商",
hidden: true,
headerTemplate: "<span style='color: '>供应商 </span>",
locked: false
},
{
field: "settlementNumber", field: "settlementNumber",
title: "结算编号", title: "结算编号",
headerTemplate: "<span style='color: '>结算编号 </span>", headerTemplate: "<span style='color: '>结算编号 </span>",
...@@ -328,6 +351,13 @@ $(function () { ...@@ -328,6 +351,13 @@ $(function () {
locked: false locked: false
}, },
{ {
field: "partyB",
title: "供应商",
hidden: true,
headerTemplate: "<span style='color: '>供应商 </span>",
locked: false
},
{
field: "contractNumber", field: "contractNumber",
title: "结算编号", title: "结算编号",
headerTemplate: "<span style='color: '>结算编号 </span>", headerTemplate: "<span style='color: '>结算编号 </span>",
...@@ -403,7 +433,8 @@ $(function () { ...@@ -403,7 +433,8 @@ $(function () {
} else if (e.name == "info-tab-3") { } else if (e.name == "info-tab-3") {
$("#info-tab-3").click(); $("#info-tab-3").click();
}*/ }*/
} },
select: onSelect // 绑定select事件处理函数
} }
} }
}); });
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