Commit 03c9ec8b by 宋祥
parents 75008b5a ecbe68db
......@@ -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,23 +196,26 @@ 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);
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){
// 更新计划明细状态
if(hgcg002B.getPlanDetailId() != null && hgcg002B.getPlanDetailId().intValue() != 0){
HGCGTools.HgCg001A.updateStatus(hgcg002B.getPlanDetailId(), HGConstant.CgPlanStatus.S_2);
}
}
}
......
......@@ -245,26 +245,27 @@ public class ServiceHGCG003 extends ServiceBase {
HGCG003 dbCg003 = dbCg003Map.get(receiveNo);
dbCg003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG003.DELETE, dbCg003);
if(fCg003.getSource().intValue() == HGConstant.CgSource.DEFAULT){
if (fCg003.getSource().intValue() == HGConstant.CgSource.DEFAULT) {
// 更新合同状态
HGCGTools.HgCg002.updateReceive(dbCg002AMap.get(contractNo), dbCg003.getReceiveQty().negate());
}
}
//子表修改
List<Long> cg003Ids = fCg003s.stream().map(o->o.getId()).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(cg003Ids)){
List<Long> cg003Ids = fCg003s.stream().map(o -> o.getId()).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(cg003Ids)) {
List<HGCG003B> fCg003Bs = HGCGTools.HgCg003B.listByPrimaryIds(cg003Ids);
// 采购合同明细DB数据
Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID));
for (HGCG003B fCg003B : fCg003Bs) {
HGCG003 hgcg003 = fCg003s.stream().filter(o->o.getId().compareTo(fCg003B.getPrimaryId()) == 0).findAny().orElse(null);
HGCG003 hgcg003 = fCg003s.stream().filter(o -> o.getId().compareTo(fCg003B.getPrimaryId()) == 0)
.findAny().orElse(null);
fCg003B.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG003B.DELETE, fCg003B);
//数据来源为合同的才需要更新合同状态
if(Objects.nonNull(hgcg003) && hgcg003.getSource().intValue() == HGConstant.CgSource.DEFAULT){
// 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), fCg003B.getReceiveQty().negate());
// 数据来源为合同的才需要更新合同状态
if (Objects.nonNull(hgcg003) && hgcg003.getSource().intValue() == HGConstant.CgSource.DEFAULT) {
HGCG002B dbCg002b = dbCg002BMap.get(fCg003B.getContractDetailId());
HGCGTools.HgCg002B.updateReceive(dbCg002b, fCg003B.getReceiveQty().negate());
}
}
}
......
......@@ -22,6 +22,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
......@@ -86,12 +87,14 @@ public class ServiceHGCG003A extends ServiceBase {
try {
List<HGCG002B> fCg002Bs = MapUtils.toDaoEPBases(inInfo, HGCG002B.class);
// db数据
Map<Long, HGCG002B> dbCg002AMap = HGCGUtils.HgCg002B.lockGetDataEp(fCg002Bs);
HGCG002 cg001 = HGCGTools.HgCg002.get(fCg002Bs.get(0).getPrimaryId());
Map<Long, HGCG002B> dbCg002bMap = HGCGUtils.HgCg002B.lockGetDataEp(fCg002Bs);
HGCG002 dbCg002 = HGCGTools.HgCg002.get(fCg002Bs.get(0).getPrimaryId());
// 数据校验
this.checkConfirmData(fCg002Bs, dbCg002AMap,cg001);
this.checkConfirmData(fCg002Bs, dbCg002bMap, dbCg002);
// 计算总金额和总重
this.calcAmountAndWeight(fCg002Bs, dbCg002bMap, dbCg002);
// 保存数据
this.confirmData(fCg002Bs, dbCg002AMap,cg001);
this.confirmData(fCg002Bs, dbCg002bMap, dbCg002);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg002Bs.size() + "]条数据保存成功!");
......@@ -121,7 +124,31 @@ public class ServiceHGCG003A extends ServiceBase {
}
/**
* 计算总金额和总重
*
* @param fCg002Bs
* @param dbCg002BMap
* @param dbCg002
*/
private void calcAmountAndWeight(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap, HGCG002 dbCg002) {
for (HGCG002B fCg002B : fCg002Bs) {
Long id = fCg002B.getId();
HGCG002B dbCg002b = dbCg002BMap.get(id);
// 总重
fCg002B.setReceiveWeight(fCg002B.getBcReceiveQty().multiply(dbCg002b.getPurUnitWeight()));
// 含税总金额
BigDecimal amount = fCg002B.getReceiveWeight().multiply(dbCg002b.getPrice());
// 如果税率不为空,总金额减去税额
if (dbCg002b.getTaxRate() != null) {
amount = amount.subtract(amount.multiply(dbCg002b.getTaxRate()).divide(new BigDecimal("100")));
}
fCg002B.setAmount(amount);
}
}
/**
* 数据保存
*
* @param fCg002Bs
* @param dbCg002BMap
* @param cg002
......@@ -129,48 +156,62 @@ public class ServiceHGCG003A extends ServiceBase {
private void confirmData(List<HGCG002B> fCg002Bs, Map<Long, HGCG002B> dbCg002BMap, HGCG002 cg002) {
HGCG002B hgcg002B = fCg002Bs.get(0);
HGCG003 newCg003 = new HGCG003();
BeanUtils.copyProperties(hgcg002B, newCg003,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime");
BeanUtils.copyProperties(hgcg002B, newCg003, "id", "createdBy", "createdName", "createdTime", "updatedBy",
"updatedName", "updatedTime");
newCg003.setReceiveDate(DateUtils.shortDate());
newCg003.setReceiveNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_RECEIVE_NO));
BigDecimal bcReceiveQtySum = fCg002Bs.stream().map(HGCG002B::getBcReceiveQty).reduce(BigDecimal.ZERO,BigDecimal::add);
// 计算收获总数量
BigDecimal bcReceiveQtySum = fCg002Bs.stream().map(HGCG002B::getBcReceiveQty)
.reduce(BigDecimal.ZERO, BigDecimal::add);
newCg003.setReceiveQty(bcReceiveQtySum);
BigDecimal purUnitWeightSum = fCg002Bs.stream().map(HGCG002B::getPurUnitWeight).reduce(BigDecimal.ZERO,BigDecimal::add);
newCg003.setReceiveUnitWeight(purUnitWeightSum);
newCg003.setReceiveWeight(newCg003.getReceiveQty().multiply(newCg003.getReceiveUnitWeight()));
// 计算收货总重
BigDecimal receiveWeight = fCg002Bs.stream().map(HGCG002B::getReceiveWeight)
.reduce(BigDecimal.ZERO, BigDecimal::add);
newCg003.setReceiveWeight(receiveWeight);
newCg003.setReceiveUnitWeight(receiveWeight.divide(bcReceiveQtySum, 3, RoundingMode.HALF_UP));
// 计算收货总金额
BigDecimal receiveAmount = fCg002Bs.stream().map(HGCG002B::getAmount)
.reduce(BigDecimal.ZERO, BigDecimal::add);
newCg003.setAmount(receiveAmount);
newCg003.setStatus(HGConstant.CgReceiveStatus.S_0);
newCg003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
newCg003.setSource(HGConstant.CgSource.DEFAULT);
DaoUtils.insert(HGCG003.INSERT, newCg003);
// 写入明细数据
for (HGCG002B fCg002B : fCg002Bs) {
insertDetails(fCg002B,newCg003);
Long id = fCg002B.getId();
HGCG002B dbCg002b = dbCg002BMap.get(id);
insertDetails(fCg002B, dbCg002b, newCg003);
}
List<HGCG002> hgcg002List = new LinkedList<>();
hgcg002List.add(cg002);
HGCGTools.HgCg002.updateContractPrimary(hgcg002List);
}
private void insertDetails(HGCG002B dbCg002B, HGCG003 newCg003) {
/**
* 新增明细数据
*
* @param fCg002B
* @param dbCg002b
* @param newCg003
*/
private void insertDetails(HGCG002B fCg002B, HGCG002B dbCg002b, HGCG003 newCg003) {
HGCG003B cg003B = new HGCG003B();
//拷贝主表明细信息
BeanUtils.copyProperties(newCg003,cg003B,"id");
BeanUtils.copyProperties(newCg003, cg003B, "id");
//拷贝明细信息
BeanUtils.copyProperties(dbCg002B,cg003B,"id","createdBy","createdName","createdTime","updatedBy","updatedName","updatedTime"
,"contractNo","planNo","supCode","supName","purUserId","purUserName","status");
BeanUtils.copyProperties(fCg002B, cg003B, "id", "createdBy", "createdName", "createdTime", "updatedBy",
"updatedName", "updatedTime", "contractNo", "planNo", "supCode", "supName", "purUserId",
"purUserName", "status");
cg003B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
cg003B.setPrimaryId(newCg003.getId());
cg003B.setReceiveUnitWeight(dbCg002B.getPurUnitWeight());
cg003B.setReceiveQty(dbCg002B.getBcReceiveQty());
cg003B.setReceiveWeight(dbCg002B.getBcReceiveQty().multiply(dbCg002B.getPurUnitWeight()));
cg003B.setContractDetailId(dbCg002B.getId());
DaoUtils.insert(HGCG003B.INSERT,cg003B);
BigDecimal diffQty = cg003B.getReceiveQty().subtract(dbCg002B.getReceiveQty());
Integer status = diffQty.compareTo(BigDecimal.ZERO) == 0 ? HGConstant.CgContractStatus.S_5
: HGConstant.CgContractStatus.S_4;
dbCg002B.setStatus(status);
cg003B.setReceiveUnitWeight(fCg002B.getPurUnitWeight());
cg003B.setReceiveQty(fCg002B.getBcReceiveQty());
cg003B.setReceiveWeight(fCg002B.getReceiveWeight());
cg003B.setContractDetailId(fCg002B.getId());
DaoUtils.insert(HGCG003B.INSERT, cg003B);
// 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002B, cg003B.getReceiveQty());
HGCGTools.HgCg002B.updateReceive(dbCg002b, cg003B.getReceiveQty());
}
}
......@@ -155,7 +155,8 @@ public class ServiceHGCG003B extends ServiceBase {
* @param cg003
* @param dbCg002BMap
*/
private void editData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap, Map<String, HGCG002A> dbCg002AMap, HGCG003 cg003, Map<Long, HGCG002B> dbCg002BMap) {
private void editData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003BMap, Map<String, HGCG002A> dbCg002AMap,
HGCG003 cg003, Map<Long, HGCG002B> dbCg002BMap) {
for (HGCG003B fCg003B : fCg003Bs) {
// 计算重量
fCg003B.setReceiveWeight(fCg003B.getReceiveQty().multiply(fCg003B.getReceiveUnitWeight()));
......@@ -262,15 +263,17 @@ public class ServiceHGCG003B extends ServiceBase {
* @param cg003
* @param dbCg002BMap
*/
private void removeData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003bMap, Map<String, HGCG002A> dbCg002AMap, HGCG003 cg003, Map<Long, HGCG002B> dbCg002BMap) {
private void removeData(List<HGCG003B> fCg003Bs, Map<Long, HGCG003B> dbCg003bMap, Map<String, HGCG002A> dbCg002AMap,
HGCG003 cg003, Map<Long, HGCG002B> dbCg002BMap) {
//数据来源为合同的
if(cg003.getSource().intValue() == HGConstant.CgSource.DEFAULT){
if (cg003.getSource().intValue() == HGConstant.CgSource.DEFAULT) {
for (HGCG003B fCg003B : fCg003Bs) {
HGCG003B dbCg003B = dbCg003bMap.get(fCg003B.getId());
dbCg003B.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGCG003B.DELETE, dbCg003B);
// 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), dbCg003B.getReceiveQty().negate());
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()),
dbCg003B.getReceiveQty().negate());
}
List<HGCG002> hgcg002List = new LinkedList<>();
dbCg002AMap.forEach((k, v)->{
......
......@@ -135,8 +135,7 @@
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cg.domain.HGCG002B">
<select id="query" resultClass="com.baosight.hggp.hg.cg.domain.HGCG002B">
SELECT
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
......@@ -174,7 +173,8 @@
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
PLAN_DETAIL_ID as "planDetailId" <!-- 计划明细id -->
PLAN_DETAIL_ID as "planDetailId", <!-- 计划明细id -->
STATUS as "status"
FROM ${hggpSchema}.HGCG002A WHERE 1=1
<include refid="condition" />
<include refid="idCondition"/>
......
......@@ -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>
......
......@@ -346,6 +346,11 @@ public class HGCGTools {
return results.stream().collect(Collectors.toMap(HGCG002A::getContractNo, item -> item));
}
/**
* 更新合同信息
*
* @param hgcg002List
*/
public static void updateContractPrimary(List<HGCG002> hgcg002List) {
List<Long> primaryIds = hgcg002List.stream().map(o->o.getId()).collect(Collectors.toList());
List<HGCG002B> queryHgcg002BList = HGCGTools.HgCg002B.listByPrimaryIds(primaryIds);
......@@ -569,7 +574,13 @@ public class HGCGTools {
paramMap.put(HGCG002.FIELD_ID, dbCg002B.getId());
paramMap.put(HGCG002.FIELD_RECEIVE_QTY, newReceiveQty);
paramMap.put(HGCG002.FIELD_RECEIVE_WEIGHT, newReceiveQty.multiply(dbCg002B.getPurUnitWeight()));
paramMap.put(HGCG002.FIELD_STATUS, dbCg002B.getStatus());
if (newReceiveQty.compareTo(BigDecimal.ZERO) == 0) {
paramMap.put(HGCG002.FIELD_STATUS, HGConstant.CgContractStatus.S_2);
} else if (dbCg002B.getPurQty().compareTo(newReceiveQty) == 0) {
paramMap.put(HGCG002.FIELD_STATUS, HGConstant.CgContractStatus.S_5);
} else {
paramMap.put(HGCG002.FIELD_STATUS, HGConstant.CgContractStatus.S_4);
}
DaoUtils.update(HGSqlConstant.HgCg002B.UPDATE_RECEIVE, paramMap);
}
......
......@@ -38,14 +38,10 @@ public class HGWD001 extends DaoEPBase {
public static final String FIELD_FILE_ID = "fileId"; /* 文件ID*/
public static final String FIELD_FILE_TYPE = "fileType"; /* 文件类型*/
public static final String FIELD_FILE_NAME = "fileName"; /* 文件名称*/
public static final String FIELD_DOC_ID = "docId"; /* 文件号*/
public static final String FIELD_DOC_NAME = "docName"; /* 文件附件名称*/
public static final String FIELD_DOC_VERSION = "docVersion"; /* 文件版本号*/
public static final String FIELD_STATUS = "status"; /* 状态*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_RELEASE_DATE = "releaseDate"; /* 发布时间*/
public static final String FIELD_PREVIEW_NUM = "previewNum"; /* 预览次数*/
public static final String FIELD_DOWNLOAD_NUM = "downloadNum"; /* 下载次数*/
public static final String COL_ID = "ID";
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
......@@ -64,14 +60,10 @@ public class HGWD001 extends DaoEPBase {
public static final String COL_FILE_ID = "FILE_ID"; /* 文件ID*/
public static final String COL_FILE_TYPE = "FILE_TYPE"; /* 文件类型*/
public static final String COL_FILE_NAME = "FILE_NAME"; /* 文件名称*/
public static final String COL_DOC_ID = "DOC_ID"; /* 文件号*/
public static final String COL_DOC_NAME = "DOC_NAME"; /* 文件附件名称*/
public static final String COL_DOC_VERSION = "DOC_VERSION"; /* 文件版本号*/
public static final String COL_STATUS = "STATUS"; /* 状态*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_RELEASE_DATE = "RELEASE_DATE"; /* 发布时间*/
public static final String COL_PREVIEW_NUM = "PREVIEW_NUM"; /* 预览次数*/
public static final String COL_DOWNLOAD_NUM = "DOWNLOAD_NUM"; /* 下载次数*/
public static final String QUERY = "HGWD001.query";
public static final String COUNT = "HGWD001.count";
......@@ -97,14 +89,10 @@ public class HGWD001 extends DaoEPBase {
private String fileId = " "; /* 文件ID*/
private String fileType = " "; /* 文件类型*/
private String fileName = " "; /* 文件名称*/
private String docId = " "; /* 文件号*/
private String docName = " "; /* 文件附件名称*/
private Integer docVersion = new Integer(0); /* 文件版本号*/
private Integer status = 0; /* 状态*/
private String remark = " "; /* 备注*/
private String releaseDate = " "; /* 发布时间*/
private Integer previewNum = new Integer(0); /* 预览次数*/
private Integer downloadNum = new Integer(0); /* 下载次数*/
/**
* initialize the metadata.
......@@ -181,14 +169,6 @@ public class HGWD001 extends DaoEPBase {
eiColumn.setDescName("文件名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOC_ID);
eiColumn.setDescName("文件号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOC_NAME);
eiColumn.setDescName("文件附件名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOC_VERSION);
eiColumn.setDescName("文件版本号");
eiMetadata.addMeta(eiColumn);
......@@ -205,14 +185,6 @@ public class HGWD001 extends DaoEPBase {
eiColumn.setDescName("发布时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PREVIEW_NUM);
eiColumn.setDescName("预览次数");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DOWNLOAD_NUM);
eiColumn.setDescName("下载次数");
eiMetadata.addMeta(eiColumn);
}
......@@ -496,38 +468,6 @@ public class HGWD001 extends DaoEPBase {
this.fileName = fileName;
}
/**
* get the docId - 文件号.
* @return the docId
*/
public String getDocId() {
return this.docId;
}
/**
* set the docId - 文件号.
*
* @param docId - 文件号
*/
public void setDocId(String docId) {
this.docId = docId;
}
/**
* get the docName - 文件附件名称.
* @return the docName
*/
public String getDocName() {
return this.docName;
}
/**
* set the docName - 文件附件名称.
*
* @param docName - 文件附件名称
*/
public void setDocName(String docName) {
this.docName = docName;
}
/**
* get the docVersion - 文件版本号.
* @return the docVersion
*/
......@@ -592,38 +532,6 @@ public class HGWD001 extends DaoEPBase {
this.releaseDate = releaseDate;
}
/**
* get the previewNum - 预览次数.
* @return the previewNum
*/
public Integer getPreviewNum() {
return this.previewNum;
}
/**
* set the previewNum - 预览次数.
*
* @param previewNum - 预览次数
*/
public void setPreviewNum(Integer previewNum) {
this.previewNum = previewNum;
}
/**
* get the downloadNum - 下载次数.
* @return the downloadNum
*/
public Integer getDownloadNum() {
return this.downloadNum;
}
/**
* set the downloadNum - 下载次数.
*
* @param downloadNum - 下载次数
*/
public void setDownloadNum(Integer downloadNum) {
this.downloadNum = downloadNum;
}
/**
* get the value from Map.
*
* @param map - source data map
......@@ -648,14 +556,10 @@ public class HGWD001 extends DaoEPBase {
setFileId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_ID)), fileId));
setFileType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_TYPE)), fileType));
setFileName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_NAME)), fileName));
setDocId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID)), docId));
setDocName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_NAME)), docName));
setDocVersion(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DOC_VERSION)), docVersion));
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setReleaseDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RELEASE_DATE)), releaseDate));
setPreviewNum(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_PREVIEW_NUM)), previewNum));
setDownloadNum(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DOWNLOAD_NUM)), downloadNum));
}
/**
......@@ -682,14 +586,10 @@ public class HGWD001 extends DaoEPBase {
map.put(FIELD_FILE_ID, StringUtils.toString(fileId, eiMetadata.getMeta(FIELD_FILE_ID)));
map.put(FIELD_FILE_TYPE, StringUtils.toString(fileType, eiMetadata.getMeta(FIELD_FILE_TYPE)));
map.put(FIELD_FILE_NAME, StringUtils.toString(fileName, eiMetadata.getMeta(FIELD_FILE_NAME)));
map.put(FIELD_DOC_ID, StringUtils.toString(docId, eiMetadata.getMeta(FIELD_DOC_ID)));
map.put(FIELD_DOC_NAME, StringUtils.toString(docName, eiMetadata.getMeta(FIELD_DOC_NAME)));
map.put(FIELD_DOC_VERSION, StringUtils.toString(docVersion, eiMetadata.getMeta(FIELD_DOC_VERSION)));
map.put(FIELD_STATUS, StringUtils.toString(status, eiMetadata.getMeta(FIELD_STATUS)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_RELEASE_DATE, StringUtils.toString(releaseDate, eiMetadata.getMeta(FIELD_RELEASE_DATE)));
map.put(FIELD_PREVIEW_NUM, StringUtils.toString(previewNum, eiMetadata.getMeta(FIELD_PREVIEW_NUM)));
map.put(FIELD_DOWNLOAD_NUM, StringUtils.toString(downloadNum, eiMetadata.getMeta(FIELD_DOWNLOAD_NUM)));
return map;
}
......
......@@ -7,6 +7,7 @@ import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001B;
import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
......@@ -54,13 +55,14 @@ public class ServiceHGWD001B extends ServiceBase {
*/
public void setFileInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String fileId = MapUtils.getString(queryRow, HGWD001.FIELD_FILE_ID);
if (StringUtils.isBlank(fileId)) {
String fileId = MapUtils.getString(queryRow, HGWD002.FIELD_FILE_ID);
String docId = MapUtils.getString(queryRow, HGWD002.FIELD_DOC_ID);
if (StringUtils.isBlank(fileId) || StringUtils.isBlank(docId)) {
return;
}
EiBlock block = new EiBlock(EiConstant.queryBlock);
block.addRow(HGWDTools.HgWd001.get(fileId));
block.addBlockMeta(new HGWD001().eiMetadata);
block.addRow(HGWDTools.HgWd002.get(fileId, docId));
block.addBlockMeta(new HGWD002().eiMetadata);
inInfo.setBlock(block);
}
......
......@@ -6,6 +6,7 @@ import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001B;
import com.baosight.hggp.hg.wd.domain.HGWD001C;
import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
......@@ -51,13 +52,14 @@ public class ServiceHGWD001C extends ServiceBase {
*/
public void setFileInfo(EiInfo inInfo) {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String fileId = MapUtils.getString(queryRow, HGWD001.FIELD_FILE_ID);
if (StringUtils.isBlank(fileId)) {
String fileId = MapUtils.getString(queryRow, HGWD002.FIELD_FILE_ID);
String docId = MapUtils.getString(queryRow, HGWD002.FIELD_DOC_ID);
if (StringUtils.isBlank(fileId) || StringUtils.isBlank(docId)) {
return;
}
EiBlock block = new EiBlock(EiConstant.queryBlock);
block.addRow(HGWDTools.HgWd001.get(fileId));
block.addBlockMeta(new HGWD001().eiMetadata);
block.addRow(HGWDTools.HgWd002.get(fileId, docId));
block.addBlockMeta(new HGWD002().eiMetadata);
inInfo.setBlock(block);
}
......
......@@ -20,14 +20,10 @@
FILE_ID as "fileId", <!-- 文件ID -->
FILE_TYPE as "fileType", <!-- 文件类型 -->
FILE_NAME as "fileName", <!-- 文件名称 -->
DOC_ID as "docId", <!-- 文件号 -->
DOC_NAME as "docName", <!-- 文件附件名称 -->
DOC_VERSION as "docVersion", <!-- 文件版本号 -->
STATUS as "status", <!-- 状态 -->
REMARK as "remark", <!-- 备注 -->
RELEASE_DATE as "releaseDate", <!-- 发布时间 -->
PREVIEW_NUM as "previewNum", <!-- 预览次数 -->
DOWNLOAD_NUM as "downloadNum" <!-- 下载次数 -->
RELEASE_DATE as "releaseDate" <!-- 发布时间 -->
</sql>
<sql id="condition">
......@@ -82,12 +78,6 @@
<isNotEmpty prepend=" AND " property="fileName">
FILE_NAME LIKE CONCAT('%', #fileName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docName">
DOC_NAME = #docName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docVersion">
DOC_VERSION = #docVersion#
</isNotEmpty>
......@@ -143,8 +133,6 @@
FILE_ID, <!-- 文件ID -->
FILE_TYPE, <!-- 文件类型 -->
FILE_NAME, <!-- 文件名称 -->
DOC_ID, <!-- 文件号 -->
DOC_NAME, <!-- 文件附件名称 -->
DOC_VERSION, <!-- 文件版本号 -->
STATUS, <!-- 状态 -->
REMARK, <!-- 备注 -->
......@@ -153,7 +141,7 @@
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #projCode#, #projName#,
#fileId#, #fileType#, #fileName#,
#docId#, #docName#, #docVersion#, #status#, #remark#, #releaseDate#
#docVersion#, #status#, #remark#, #releaseDate#
<selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGWD001
</selectKey>
......@@ -171,8 +159,6 @@
SET
FILE_TYPE = #fileType#, <!-- 文件类型 -->
FILE_NAME = #fileName#, <!-- 文件名称 -->
DOC_ID = #docId#, <!-- 文件号 -->
DOC_NAME = #docName#, <!-- 文件附件名称 -->
DOC_VERSION = #docVersion#, <!-- 文件版本号 -->
STATUS = #status#, <!-- 状态 -->
REMARK = #remark#, <!-- 备注 -->
......@@ -191,23 +177,4 @@
WHERE ID = #id#
</update>
<!-- 预览自增 -->
<update id="previewIncr">
UPDATE ${hggpSchema}.HGWD001
SET
PREVIEW_NUM = PREVIEW_NUM + 1,
<include refid="SqlBase.updateRevise"/>
WHERE FILE_ID = #fileId#
</update>
<!-- 下载自增 -->
<update id="downloadIncr">
UPDATE ${hggpSchema}.HGWD001
SET
DOWNLOAD_NUM = DOWNLOAD_NUM + 1,
<include refid="SqlBase.updateRevise"/>
WHERE FILE_ID = #fileId#
</update>
</sqlMap>
......@@ -51,6 +51,9 @@
<isNotEmpty prepend=" AND " property="fileId">
FILE_ID = #fileId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
</sql>
<sql id="orderBy">
......
......@@ -51,6 +51,9 @@
<isNotEmpty prepend=" AND " property="fileId">
FILE_ID = #fileId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId#
</isNotEmpty>
</sql>
<sql id="orderBy">
......
......@@ -5,6 +5,7 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001A;
import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.util.AssertUtils;
import org.apache.commons.collections.CollectionUtils;
......@@ -55,4 +56,28 @@ public class HGWDTools {
}
/**
* HGWD002 定义
*
* @author:songx
* @date:2024/8/19,14:57
*/
public static class HgWd002 {
/**
* @param fileId
* @param docId
* @return
*/
public static HGWD002 get(String fileId, String docId) {
AssertUtils.isEmpty(fileId, "文件ID不能为空");
AssertUtils.isEmpty(docId, "附件ID不能为空");
Map queryMap = new HashMap();
queryMap.put(HGWD002.FIELD_FILE_ID, fileId);
queryMap.put(HGWD002.FIELD_DOC_ID, docId);
List<HGWD002> results = DaoBase.getInstance().query(HGWD002.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
}
}
......@@ -7,16 +7,15 @@ $(function () {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [
{
columns: [{
field: "inventCode",
template: function (item) {
let template = item.inventCode;
if(item.inventCode){
for(let i=0;i<inventRecordBoxBlockId.length;i++){
if(item.inventCode === inventRecordBoxBlockId[i]['valueField']){
if (item.inventCode) {
for (let i = 0; i < inventRecordBoxBlockId.length; i++) {
if (item.inventCode === inventRecordBoxBlockId[i]['valueField']) {
template = inventRecordBoxBlockId[i]['valueField'];
}else{
} else {
template = item.inventCode;
}
}
......@@ -49,23 +48,24 @@ $(function () {
filter: "contains"
});
}
},
{
}, {
field: "primaryId",
template: function (item) {
item['primaryId'] =$("#inqu_status-0-primaryId").val();
item['primaryId'] = $("#inqu_status-0-primaryId").val();
return $("#inqu_status-0-primaryId").val();
}
}
],
}],
onRowClick: function (e){
setPurQty();
},
beforeEdit: function (e) {
var status = $("#inqu_status-0-status").val();
if(status != '0'){
if (status != '0') {
e.preventDefault();
}
let item = e.model;
//只有合同生成的不能编辑
if(item.source === '0'){
if (item.source === '0') {
//选择收货的指定列不让修改
for (let i = 0; i < e.sender.columns.length; i++) {
//指定的列不让修改
......@@ -147,9 +147,45 @@ $(window).load(function () {
$(".k-grid-add").hide();
$(".k-grid-delete").hide();
}
// 勾选事件
resultCheckClick();
});
/**
* 勾选事件
*/
let resultCheckClick = function (){
resultGrid.element.on("click", "input.check-one,input.check-all", function (e) {
let action = $(this).prop("checked");
if (action != true) {
return;
}
setPurQty();
});
}
/**
* 设置采购数量
*/
let setPurQty = function (){
let checkRows = resultGrid.getCheckedRows();
let checkRowIndexs = resultGrid.getCheckedRowsIndex();
for (let rowNo = 0; rowNo < checkRowIndexs.length; rowNo++) {
let index = checkRowIndexs[rowNo];
let purQty = checkRows[rowNo]["purQty"];
let planQty = checkRows[rowNo]["planQty"];
if (isBlank(purQty) || parseFloat(purQty) == 0) {
resultGrid.setCellValue(index, "purQty", planQty);
}
let purWeight = checkRows[rowNo]["purWeight"];
let planWeight = checkRows[rowNo]["planWeight"];
if (isBlank(purWeight) || parseFloat(purWeight) == 0) {
resultGrid.setCellValue(index, "purWeight", planWeight);
}
}
}
/**
* 查询
*/
......
......@@ -59,7 +59,7 @@
<EF:EFColumn ename="contractDate" cname="合同日期" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<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" defaultValue="0">
<EF:EFCodeOption codeName="hggp.hgcg.contractStatus" condition="ITEM_CODE IN ('0','2','4','5')"/>
</EF:EFComboColumn>
......@@ -69,12 +69,18 @@
</EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="purUserName" cname="采购员" width="120" align="center" required="true"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" enable="false" defaultValue="0"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" enable="false" defaultValue="0"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="80" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="80" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="80" align="right" format="{0:N3}" defaultValue="0"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" enable="false"
defaultValue="0" sumType="page"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" enable="false"
defaultValue="0" sumType="page"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N3}"
defaultValue="0" sumType="page"/>
<EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="120" align="right" format="{0:C3}"
defaultValue="0" sumType="page"/>
<EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="120" align="right" format="{0:C3}"
defaultValue="0" sumType="page"/>
<EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="120" align="right" format="{0:C3}"
defaultValue="0" sumType="page"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
......@@ -3,7 +3,7 @@ $(function () {
"result": {
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
pageSizes: [20, 50, 100, 300],
},
columns: [
],
......
......@@ -33,21 +33,26 @@
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventName" cname="存货名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="spec" cname="规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" 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:EFColumn ename="amount" 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="purQty" cname="采购数量" width="120" align="right" format="{0:N3}" enable="false"
sumType="page"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" enable="false"
sumType="page"/>
<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="price" cname="单价" width="80" align="right" format="{0:N3}" required="true"/>
<EF:EFComboColumn ename="taxRate" cname="税率(%)" enable="true" width="100" align="center" required="true"
copy="true">
<EF:EFCodeOption codeName="hggp.cw.taxPoints"/>
</EF:EFComboColumn>
<EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="120" align="right" format="{0:C3}"
sumType="page"/>
<EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="120" align="right" format="{0:C3}"
sumType="page"/>
<EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="120" align="right"
format="{0:C3}" sumType="page"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
......@@ -26,33 +26,41 @@
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="inventCode" required="true" cname="存货编号" />
<EF:EFColumn ename="inventCode" required="true" cname="存货编号"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" required="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="false"
blockName="invent_type_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains" enable="false" >
filter="contains" enable="false">
</EF:EFComboColumn>
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" 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"/>
<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:EFComboColumn ename="taxRate" cname="税率(%)" enable="true" width="80" align="center" required="true">
<EF:EFCodeOption codeName="hggp.cw.taxPoints" />
</EF:EFComboColumn>
<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="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="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" sumType="page"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" required="true"
defaultValue="0" sumType="page"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="120" align="right" format="{0:N3}"
defaultValue="0" sumType="page"/>
<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:EFComboColumn ename="taxRate" cname="税率(%)" enable="true" width="100" align="center" required="true"
copy="true">
<EF:EFCodeOption codeName="hggp.cw.taxPoints"/>
</EF:EFComboColumn>
<EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="120" align="right" format="{0:C3}"
sumType="page"/>
<EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="120" align="right" format="{0:C3}"
sumType="page"/>
<EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="120" align="right" format="{0:C3}"
sumType="page"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
......@@ -9,15 +9,15 @@ $(function () {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: [
{
columns: [{
field: "operator",
title: "操作",
template: function (item) {
let template = '';
if (!isBlank(item.id)){
if (!isBlank(item.id)) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id + ', ' + item.status + ', ' + item.source + ')" >详情</a>';
+ 'onclick="showDetail(' + item.id + ', ' + item.status + ', ' + item.source
+ ')" >详情</a>';
}
if (item.status == 0 && item.source == 1) {
......@@ -37,13 +37,12 @@ $(function () {
}
return dataItem["companyCode"];
}
},
{
}, {
field: "purUserName",
template: function (dataItem) {
for (let i = 0; i < userByCompany.length; i++) {
let purUserName = dataItem['purUserName'];
if(purUserName){
if (purUserName) {
if (userByCompany[i]['userName'] === purUserName.userName) {
return userByCompany[i]['userName'];
}
......
......@@ -69,11 +69,16 @@
</EF:EFComboColumn>
<EF:EFColumn ename="supName" cname="供应商名称" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="purUserName" cname="采购员" width="120" align="center" required="true"/>
<EF:EFColumn ename="receiveQty" cname="收货数量" enable="false" width="120" align="right" format="{0:N3}"/>
<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="amount" cname="金额" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="receiveQty" cname="收货数量" enable="false" width="120" align="right" format="{0:N3}"
sumType="page"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N3}"
sumType="page"/>
<EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N3}"
sumType="page"/>
<EF:EFColumn ename="receiveWeight" cname="收货重量" enable="false" width="120" align="right" format="{0:N3}"
sumType="page"/>
<EF:EFColumn ename="amount" cname="金额" enable="false" width="120" align="right" format="{0:C3}"
sumType="page"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
......@@ -61,6 +61,7 @@
format="{0:N3}"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purQty" cname="采购数量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purUnitWeight" cname="采购单重" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="purWeight" cname="采购重量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFComboColumn ename="supCode" cname="供应商名称" enable="false" width="120" align="left" defaultValue=""
filter="contains">
......@@ -69,9 +70,12 @@
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/>
<EF:EFColumn ename="price" cname="单价" width="80" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="taxRate" cname="税率(%)" width="80" align="right" format="{0:N3}" enable="false"/>
<EF:EFColumn ename="amount" 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="amount" cname="不含税金额" enable="false" width="120" align="right" format="{0:C3}"
sumType="page"/>
<EF:EFColumn ename="taxAmount" cname="税额" enable="false" width="120" align="right" format="{0:C3}"
sumType="page"/>
<EF:EFColumn ename="taxIncludeAmount" cname="含税金额" enable="false" width="120" align="right"
format="{0:C3}" sumType="page"/>
<EF:EFColumn ename="material" 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}"/>
......
......@@ -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 () {
......
......@@ -25,28 +25,35 @@
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="inventCode" required="true" cname="存货编号" />
<EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" enable="false" readonly="true" required="true"/>
<EF:EFColumn ename="inventCode" required="true" cname="存货编号"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" enable="false" readonly="true"
required="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="false"
blockName="invent_type_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains" enable="false" >
filter="contains" enable="false">
</EF:EFComboColumn>
<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="receiveQty" 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: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:EFColumn ename="receiveQty" cname="收货数量" width="120" align="right" format="{0:N3}" required="true"
sumType="page"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N3}"
sumType="page"/>
<EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N3}"
sumType="page"/>
<EF:EFColumn ename="receiveWeight" cname="收货重量" enable="false" width="120" align="right" format="{0:N3}"
sumType="page"/>
<EF:EFColumn ename="receiveUnitWeight" cname="收货单重" enable="false" width="120" align="right" format="{0:N3}"
hidden="true"/>
<EF:EFColumn ename="price" cname="单价" width="120" align="right" format="{0:C3}" required="true"/>
<EF:EFColumn ename="amount" cname="金额" enable="false" width="120" align="right" format="{0:C3}"
sumType="page"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="hggp.hgcg.receiveStatus"/>
</EF:EFComboColumn>
......
......@@ -8,6 +8,7 @@
<EF:EFPage title="预览记录">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput cname="文件ID" ename="fileId" blockId="inqu_status" row="0" colWidth="3" type="hidden"/>
<EF:EFInput cname="附件ID" ename="docId" blockId="inqu_status" row="0" colWidth="3" type="hidden"/>
<div class="row">
<EF:EFInput cname="公司名称" ename="projName" blockId="inqu_status" row="0" colWidth="3" readonly="true"/>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3" readonly="true"/>
......@@ -23,6 +24,7 @@
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="fileId" cname="文件ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="docId" cname="附件ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="createdName" cname="预览人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="预览时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
......@@ -8,6 +8,7 @@
<EF:EFPage title="下载记录">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput cname="文件ID" ename="fileId" blockId="inqu_status" row="0" colWidth="3" type="hidden"/>
<EF:EFInput cname="附件ID" ename="docId" blockId="inqu_status" row="0" colWidth="3" type="hidden"/>
<div class="row">
<EF:EFInput cname="公司名称" ename="projName" blockId="inqu_status" row="0" colWidth="3" readonly="true"/>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3" readonly="true"/>
......@@ -23,6 +24,7 @@
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="fileId" cname="文件ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="docId" cname="附件ID" enable="false" width="100" align="center" hidden="true"/>
<EF:EFColumn ename="createdName" cname="下载人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="下载时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
......@@ -11,11 +11,12 @@ $(function () {
field: "operator",
title: "操作",
template: function (model) {
let param = "'" + model.fileId + "', '" + model.docId + "'";
let template = '';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showQueryRecord(\'' + model.fileId + '\')" >预览记录</a>';
+ 'onclick="showQueryRecord(' + param + ')" >预览记录</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDownloadRecord(\'' + model.fileId + '\')" >下载记录</a>';
+ 'onclick="showDownloadRecord(' + param + ')" >下载记录</a>';
return template;
}
}, {
......@@ -59,10 +60,13 @@ let query = function () {
/**
* 显示查询记录
*
* @param fileId
* @param docId
*/
let showQueryRecord = function (fileId) {
let showQueryRecord = function (fileId, docId) {
JSColorbox.open({
href: "HGWD001B?inqu_status-0-fileId=" + fileId,
href: "HGWD001B?inqu_status-0-fileId=" + fileId + "&inqu_status-0-docId=" + docId,
title: "<div style='text-align: center;'>预览记录</div>",
width: "80%",
height: "80%",
......@@ -71,10 +75,13 @@ let showQueryRecord = function (fileId) {
/**
* 显示下载记录
*
* @param fileId
* @param docId
*/
let showDownloadRecord = function (fileId) {
let showDownloadRecord = function (fileId, docId) {
JSColorbox.open({
href: "HGWD001C?inqu_status-0-fileId=" + fileId,
href: "HGWD001C?inqu_status-0-fileId=" + fileId + "&inqu_status-0-docId=" + docId,
title: "<div style='text-align: center;'>下载记录</div>",
width: "80%",
height: "80%",
......
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