Commit 425bd4e4 by 宋祥

1.20240829 BUG修复

parent 98137787
package com.baosight.hggp.hg.cg.constant;
/**
* @author:songx
* @date:2024/8/30,15:53
*/
public class HgCgConst {
/**
* 计算方式
*
* @author:songx
* @date:2024/2/22,13:57
*/
public static class CalculationMethod {
// 数量计算
public static final Integer S0 = 0;
// 重量计算
public static final Integer S1 = 1;
}
}
......@@ -58,6 +58,7 @@ public class HGCG001A extends DaoEPBase {
public static final String FIELD_REMARKS = "remarks"; /*备注*/
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_SOURCE = "source"; /* 数据来源 根据采购数据来源小代码 目前默认0材料计划,1手工录入*/
......@@ -143,6 +144,7 @@ public class HGCG001A extends DaoEPBase {
private String remarks; /*备注*/
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
private Integer calculationMethod; /* 计算方式 0-数量乘单价 1-重量乘单价*/
//选择合同需要信息
private Integer source; /* 数据来源 根据采购数据来源小代码 目前默认0材料计划,1手工录入*/
......@@ -368,6 +370,10 @@ public class HGCG001A 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);
}
/**
......@@ -969,7 +975,15 @@ public class HGCG001A extends DaoEPBase {
public void setProjName(String projName) {
this.projName = projName;
}
public Integer getCalculationMethod() {
return calculationMethod;
}
public void setCalculationMethod(Integer calculationMethod) {
this.calculationMethod = calculationMethod;
}
/**
* get the value from Map.
*
......@@ -1013,6 +1027,7 @@ public class HGCG001A extends DaoEPBase {
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status));
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));
setSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SOURCE)), source));
setPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRICE)), price));
......@@ -1066,6 +1081,7 @@ public class HGCG001A extends DaoEPBase {
map.put(FIELD_REMARKS,StringUtils.toString(remarks, eiMetadata.getMeta(FIELD_REMARKS)));
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)));
map.put(FIELD_SOURCE, StringUtils.toString(source, eiMetadata.getMeta(FIELD_SOURCE)));
map.put(FIELD_PRICE, StringUtils.toString(price, eiMetadata.getMeta(FIELD_PRICE)));
......
......@@ -63,6 +63,8 @@ public class HGCG002B extends DaoEPBase {
//页面需要展示
public static final String FIELD_BC_RECEIVE_QTY = "bcReceiveQty"; /* 本次收货数量*/
public static final String FIELD_BC_MAX_RECEIVE_QTY = "bcMaxReceiveQty"; /* 本次最大收货数量*/
public static final String FIELD_BC_RECEIVE_WEIGHT = "bcReceiveWeight"; /* 本次收货重量*/
public static final String FIELD_BC_MAX_RECEIVE_WEIGHT = "bcMaxReceiveWeight"; /* 本次最大收货重量*/
public static final String FIELD_CONTRACT_DATE = "contractDate"; /* 合同日期*/
public static final String FIELD_CONTRACT_NO = "contractNo"; /* 合同号*/
public static final String FIELD_PLAN_NO = "planNo"; /* 计划单号*/
......@@ -155,6 +157,8 @@ public class HGCG002B extends DaoEPBase {
//页面需要填写、展示字段
private BigDecimal bcReceiveQty = new BigDecimal(0.000); /* 本次收货数量*/
private BigDecimal bcMaxReceiveQty = new BigDecimal(0.000); /* 本次最大收货数量*/
private BigDecimal bcReceiveWeight = new BigDecimal(0.000); /* 本次收货重量*/
private BigDecimal bcMaxReceiveWeight = new BigDecimal(0.000); /* 本次最大收货重量*/
private String contractDate = " "; /* 合同日期*/
private String contractNo = " "; /* 合同号*/
private String planNo = " "; /* 计划单号*/
......@@ -359,7 +363,22 @@ public class HGCG002B extends DaoEPBase {
eiColumn.setFieldLength(20);
eiColumn.setDescName("本次最大收货数量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_BC_RECEIVE_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(20);
eiColumn.setDescName("本次收货重量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_BC_MAX_RECEIVE_WEIGHT);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
eiColumn.setFieldLength(20);
eiColumn.setDescName("本次最大收货重量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CONTRACT_DATE);
eiColumn.setDescName("合同日期");
eiMetadata.addMeta(eiColumn);
......@@ -956,7 +975,23 @@ public class HGCG002B extends DaoEPBase {
public void setBcMaxReceiveQty(BigDecimal bcMaxReceiveQty) {
this.bcMaxReceiveQty = bcMaxReceiveQty;
}
public BigDecimal getBcReceiveWeight() {
return bcReceiveWeight;
}
public void setBcReceiveWeight(BigDecimal bcReceiveWeight) {
this.bcReceiveWeight = bcReceiveWeight;
}
public BigDecimal getBcMaxReceiveWeight() {
return bcMaxReceiveWeight;
}
public void setBcMaxReceiveWeight(BigDecimal bcMaxReceiveWeight) {
this.bcMaxReceiveWeight = bcMaxReceiveWeight;
}
public String getContractDate() {
return contractDate;
}
......@@ -1101,6 +1136,8 @@ public class HGCG002B extends DaoEPBase {
setBcReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_RECEIVE_QTY)), bcReceiveQty));
setBcMaxReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_MAX_RECEIVE_QTY)), bcMaxReceiveQty));
setBcReceiveWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_RECEIVE_WEIGHT)), bcReceiveWeight));
setBcMaxReceiveWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_MAX_RECEIVE_WEIGHT)), bcMaxReceiveWeight));
setContractDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTRACT_DATE)), contractDate));
setContractNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTRACT_NO)), contractNo));
setPlanNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_NO)), planNo));
......@@ -1158,6 +1195,8 @@ public class HGCG002B extends DaoEPBase {
map.put(FIELD_BC_RECEIVE_QTY, StringUtils.toString(bcReceiveQty, eiMetadata.getMeta(FIELD_BC_RECEIVE_QTY)));
map.put(FIELD_BC_MAX_RECEIVE_QTY, StringUtils.toString(bcMaxReceiveQty, eiMetadata.getMeta(FIELD_BC_MAX_RECEIVE_QTY)));
map.put(FIELD_BC_RECEIVE_WEIGHT, StringUtils.toString(bcReceiveWeight, eiMetadata.getMeta(FIELD_BC_RECEIVE_WEIGHT)));
map.put(FIELD_BC_MAX_RECEIVE_WEIGHT, StringUtils.toString(bcMaxReceiveWeight, eiMetadata.getMeta(FIELD_BC_MAX_RECEIVE_WEIGHT)));
map.put(FIELD_CONTRACT_DATE, StringUtils.toString(contractDate, eiMetadata.getMeta(FIELD_CONTRACT_DATE)));
map.put(FIELD_CONTRACT_NO, StringUtils.toString(contractNo, eiMetadata.getMeta(FIELD_CONTRACT_NO)));
map.put(FIELD_PLAN_NO, StringUtils.toString(planNo, eiMetadata.getMeta(FIELD_PLAN_NO)));
......
......@@ -94,11 +94,9 @@ public class ServiceHGCG002A extends ServiceBase {
@OperationLogAnnotation(operModul = "采购计划", operType = "修改", operDesc = "确认")
public EiInfo confirm(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<HGCG001A> fCg001As = MapUtils.toDaoEPBases(inInfo, HGCG001A.class);
// db数据
Map<Long, HGCG001A> dbCg001Map = this.lockGetData(fCg001As);
//计划主表信息
List<String> planNos = fCg001As.stream().map(HGCG001A::getPlanNo).collect(Collectors.toList());
Map<String, HGCG001> hgcg001Map = HGCGTools.HgCg001.map(planNos);
......
......@@ -4,7 +4,11 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.cg.domain.*;
import com.baosight.hggp.hg.cg.constant.HgCgConst;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002B;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.domain.HGCG003B;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant;
......@@ -33,7 +37,7 @@ import java.util.Map;
* @date:2024/5/9,11:04
*/
public class ServiceHGCG003A extends ServiceBase {
/**
* 画面初始化
*
......@@ -54,7 +58,7 @@ public class ServiceHGCG003A extends ServiceBase {
}
return inInfo;
}
/**
* 查询操作
*
......@@ -75,7 +79,7 @@ public class ServiceHGCG003A extends ServiceBase {
}
return inInfo;
}
/**
* 确认操作.
*
......@@ -103,10 +107,11 @@ public class ServiceHGCG003A extends ServiceBase {
}
return inInfo;
}
/**
* 数据校验
* @param fCg002Bs
*
* @param fCg002Bs
* @param dbCg002BMap
* @param cg001
*/
......@@ -120,6 +125,9 @@ public class ServiceHGCG003A extends ServiceBase {
AssertUtils.isGt(fCg002B.getBcReceiveQty(), fCg002B.getBcMaxReceiveQty(),
String.format("合同[%s]本次收货数量(%s)不能大于本次最大收货数量(%s)", cg001.getContractNo(),
fCg002B.getBcReceiveQty(), fCg002B.getBcMaxReceiveQty()));
AssertUtils.isGt(fCg002B.getBcReceiveWeight(), fCg002B.getBcMaxReceiveWeight(),
String.format("合同[%s]本次收货重量(%s)不能大于本次最大收货重量(%s)", cg001.getContractNo(),
fCg002B.getBcReceiveWeight(), fCg002B.getBcMaxReceiveWeight()));
}
}
......@@ -135,9 +143,19 @@ public class ServiceHGCG003A extends ServiceBase {
Long id = fCg002B.getId();
HGCG002B dbCg002b = dbCg002BMap.get(id);
// 总重
fCg002B.setReceiveWeight(fCg002B.getBcReceiveQty().multiply(dbCg002b.getPurUnitWeight()));
BigDecimal bcReceiveWeight = fCg002B.getBcReceiveWeight();
if (bcReceiveWeight == null || bcReceiveWeight.compareTo(BigDecimal.ZERO) == 0) {
fCg002B.setReceiveWeight(fCg002B.getBcReceiveQty().multiply(dbCg002b.getPurUnitWeight()));
} else {
fCg002B.setReceiveWeight(bcReceiveWeight);
}
// 含税总金额
BigDecimal amount = fCg002B.getReceiveWeight().multiply(dbCg002b.getPrice());
BigDecimal amount;
if (HgCgConst.CalculationMethod.S1.equals(fCg002B.getCalculationMethod())) {
amount = fCg002B.getReceiveWeight().multiply(dbCg002b.getPrice());
} else {
amount = fCg002B.getBcReceiveQty().multiply(dbCg002b.getPrice());
}
// 如果税率不为空,总金额减去税额
if (dbCg002b.getTaxRate() != null) {
amount = amount.subtract(amount.multiply(dbCg002b.getTaxRate()).divide(new BigDecimal("100")));
......@@ -213,5 +231,5 @@ public class ServiceHGCG003A extends ServiceBase {
// 更新合同状态
HGCGTools.HgCg002B.updateReceive(dbCg002b, cg003B.getReceiveQty());
}
}
......@@ -6,7 +6,11 @@ import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.domain.*;
import com.baosight.hggp.hg.cg.domain.HGCG002;
import com.baosight.hggp.hg.cg.domain.HGCG002A;
import com.baosight.hggp.hg.cg.domain.HGCG002B;
import com.baosight.hggp.hg.cg.domain.HGCG003;
import com.baosight.hggp.hg.cg.domain.HGCG003B;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant;
......@@ -14,21 +18,30 @@ import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/5/9,11:04
*/
public class ServiceHGCG003B extends ServiceBase {
/**
* 画面初始化
*
......@@ -41,18 +54,18 @@ public class ServiceHGCG003B extends ServiceBase {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID), null, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BOX_BLOCK_ID),
new HashMap<String, Object>(){{
put(HGPZ005.FIELD_STATUS,1);
new HashMap<String, Object>() {{
put(HGPZ005.FIELD_STATUS, 1);
put(HGPZ004.FIELD_INVENT_TYPE_DETAILS, InventTypeDetailEnum.getProdTypeFour());
}}, false);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
EiInfoUtils.addBlock(inInfo, "roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG003B().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
......@@ -69,7 +82,7 @@ public class ServiceHGCG003B extends ServiceBase {
}
return inInfo;
}
/**
* 保存操作.
*
......@@ -81,7 +94,7 @@ public class ServiceHGCG003B extends ServiceBase {
try {
List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBases(inInfo, HGCG003B.class);
HGCG003 cg003 = HGCGTools.HgCg003.get(fCg003Bs.get(0).getPrimaryId());
if(cg003.getSource().intValue() == HGConstant.CgSource.DEFAULT){
if (cg003.getSource().intValue() == HGConstant.CgSource.DEFAULT) {
// 采购收货DB数据
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs);
// 采购合同DB数据
......@@ -91,16 +104,16 @@ public class ServiceHGCG003B extends ServiceBase {
Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID));
// 数据校验
this.checkEditData(fCg003Bs, dbCg003BMap,cg003);
this.checkEditData(fCg003Bs, dbCg003BMap, cg003);
// 保存数据
this.editData(fCg003Bs, dbCg003BMap, dbCg002AMap,cg003,dbCg002BMap);
}else{
this.editData(fCg003Bs, dbCg003BMap, dbCg002AMap, cg003, dbCg002BMap);
} else {
// 写入数据
for (int i = 0; i < fCg003Bs.size(); i++) {
HGCG003B hgcg003B = fCg003Bs.get(i);
if (hgcg003B.getId() == null || hgcg003B.getId() == 0) {
// 修改数据
this.saveData(hgcg003B,cg003);
this.addData(hgcg003B, cg003);
} else {
this.updateData(hgcg003B);
}
......@@ -108,7 +121,6 @@ public class ServiceHGCG003B extends ServiceBase {
//修改主表信息
updateCg003Pur(cg003);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003Bs.size() + "]条数据保存成功!");
......@@ -117,10 +129,11 @@ public class ServiceHGCG003B extends ServiceBase {
}
return inInfo;
}
/**
* 数据校验
* @param fCg003Bs
*
* @param fCg003Bs
* @param dbCg003Map
* @param cg003
*/
......@@ -146,9 +159,10 @@ public class ServiceHGCG003B extends ServiceBase {
}
}
}
/**
* 数据保存
*
* @param fCg003Bs
* @param dbCg003BMap
* @param dbCg002AMap
......@@ -167,7 +181,7 @@ public class ServiceHGCG003B extends ServiceBase {
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), diffQty);
}
List<HGCG002> hgcg002List = new LinkedList<>();
dbCg002AMap.forEach((k, v)->{
dbCg002AMap.forEach((k, v) -> {
hgcg002List.add(v);
});
//根据子表明细刷新合同主表信息
......@@ -175,9 +189,14 @@ public class ServiceHGCG003B extends ServiceBase {
//修改主表信息
updateCg003Pur(cg003);
}
private void saveData(HGCG003B hgcg003B, HGCG003 cg003) {
// 新增数据
/**
* 新增数据
*
* @param hgcg003B
* @param cg003
*/
private void addData(HGCG003B hgcg003B, HGCG003 cg003) {
hgcg003B.setPrimaryId(cg003.getId());
hgcg003B.setReceiveNo(cg003.getReceiveNo());
hgcg003B.setStatus(HGConstant.CgReceiveStatus.S_0);
......@@ -189,24 +208,30 @@ public class ServiceHGCG003B extends ServiceBase {
hgcg003B.setAccountCode(cg003.getAccountCode());
DaoUtils.insert(HGCG003B.INSERT, hgcg003B);
}
/**
* 修改数据
*
* @param hgcg003B
*/
private void updateData(HGCG003B hgcg003B) {
// 新增数据
DaoUtils.update(HGCG003B.UPDATE, hgcg003B);
}
private void updateCg003Pur(HGCG003 cg003) {
List<HGCG003B> queryCG003Bs = HGCGTools.HgCg003B.listByPrimaryId(cg003.getId());
List<HGCG003B> queryCG003Bs = HGCGTools.HgCg003B.listByPrimaryId(cg003.getId());
//修改主表信息
//收货数量
BigDecimal receiveQtySum = queryCG003Bs.stream().map(HGCG003B::getReceiveQty).reduce(BigDecimal.ZERO,BigDecimal::add);
BigDecimal receiveQtySum = queryCG003Bs.stream().map(HGCG003B::getReceiveQty)
.reduce(BigDecimal.ZERO, BigDecimal::add);
cg003.setReceiveQty(receiveQtySum);
//收货重量
BigDecimal receiveWeightSum = queryCG003Bs.stream().map(HGCG003B::getReceiveWeight).reduce(BigDecimal.ZERO,BigDecimal::add);
BigDecimal receiveWeightSum = queryCG003Bs.stream().map(HGCG003B::getReceiveWeight)
.reduce(BigDecimal.ZERO, BigDecimal::add);
cg003.setReceiveWeight(receiveWeightSum);
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_QTY, cg003);
}
/**
* 删除操作.
*
......@@ -227,9 +252,9 @@ public class ServiceHGCG003B extends ServiceBase {
Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID));
// 数据校验
this.checkRemoveData(fCg003Bs, dbCg003BMap,cg003);
this.checkRemoveData(fCg003Bs, dbCg003BMap, cg003);
// 保存数据
this.removeData(fCg003Bs, dbCg003BMap, dbCg002AMap,cg003,dbCg002BMap);
this.removeData(fCg003Bs, dbCg003BMap, dbCg002AMap, cg003, dbCg002BMap);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003Bs.size() + "]条数据删除成功!");
......@@ -238,10 +263,11 @@ public class ServiceHGCG003B extends ServiceBase {
}
return inInfo;
}
/**
* 数据校验
* @param fCg003Bs
*
* @param fCg003Bs
* @param dbCg003BMap
* @param cg003
*/
......@@ -254,9 +280,10 @@ public class ServiceHGCG003B extends ServiceBase {
String.format("收货单[%s]状态不是\"待确认\",不允许操作", receiveNo));
}
}
/**
* 数据保存
*
* @param fCg003Bs
* @param dbCg003bMap
* @param dbCg002AMap
......@@ -276,12 +303,12 @@ public class ServiceHGCG003B extends ServiceBase {
dbCg003B.getReceiveQty().negate());
}
List<HGCG002> hgcg002List = new LinkedList<>();
dbCg002AMap.forEach((k, v)->{
dbCg002AMap.forEach((k, v) -> {
hgcg002List.add(v);
});
//根据子表明细刷新合同主表信息
HGCGTools.HgCg002.updateContractPrimary(hgcg002List);
}else{
} else {
//手工录入的
for (HGCG003B fCg003B : fCg003Bs) {
HGCG003B dbCg003B = dbCg003bMap.get(fCg003B.getId());
......@@ -292,5 +319,5 @@ public class ServiceHGCG003B extends ServiceBase {
//修改主表信息
updateCg003Pur(cg003);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGCG002A">
<sql id="condition">
<sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id">
ID = #id#
......@@ -116,6 +116,7 @@
CALCULATION_METHOD = #calculationMethod#
</isNotEmpty>
</sql>
<!-- 公共修改字段 -->
<sql id="updateRevise">
UPDATED_BY = #updatedBy#,
......@@ -292,9 +293,8 @@
</update>
<select id="queryByReceive" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cg.domain.HGCG002B">
SELECT
<select id="queryByReceive" resultClass="com.baosight.hggp.hg.cg.domain.HGCG002B">
SELECT
a.ID as "id",
a.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
a.DEP_CODE as "depCode", <!-- 部门编码 -->
......@@ -329,6 +329,7 @@
a.INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 -->
a.PRIMARY_ID as "primaryId", <!-- 主表id -->
(a.PUR_QTY - a.RECEIVE_QTY) as "bcMaxReceiveQty",
(a.PUR_WEIGHT - a.RECEIVE_WEIGHT) as "bcMaxReceiveWeight",
a.PROJ_CODE as "projCode", <!-- 项目编码 -->
a.PROJ_NAME as "projName", <!-- 项目名称 -->
a.CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
......@@ -341,10 +342,11 @@
b.PUR_USER_ID as "purUserId", <!-- 采购员 -->
b.PUR_USER_NAME as "purUserName" <!-- 采购员名称 -->
FROM ${hggpSchema}.HGCG002A a
LEFT JOIN ${hggpSchema}.HGCG002 b ON a.PRIMARY_ID = b.id
LEFT JOIN ${hggpSchema}.HGCG002 b ON a.PRIMARY_ID = b.id
WHERE 1=1
AND a.DELETE_FLAG = 0
AND b.DELETE_FLAG = 0
AND (a.PUR_QTY - a.RECEIVE_QTY) > 0
<isNotEmpty prepend=" AND " property="id">
a.ID = #id#
</isNotEmpty>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGCG003A">
<sql id="condition">
<sql id="condition">
AND DELETE_FLAG = 0
<include refid="idCondition"/>
<isNotEmpty prepend=" AND " property="accountCode">
......@@ -259,52 +259,42 @@
ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGCG003A
SET
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
CREATED_BY = #createdBy#, <!-- 记录创建者 -->
CREATED_NAME = #createdName#, <!-- 记录创建名称 -->
CREATED_TIME = #createdTime#, <!-- 记录创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 0-未删除,1-已删除 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 -->
RECEIVE_DATE = #receiveDate#, <!-- 收货日期 -->
RECEIVE_NO = #receiveNo#, <!-- 收货单号 -->
PLAN_NO = #planNo#, <!-- 计划单号 -->
CONTRACT_NO = #contractNo#, <!-- 合同号 -->
INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
SPEC_ID = #specId#, <!-- 规格ID -->
SPEC = #spec#, <!-- 规格 -->
MATERIAL = #material#, <!-- 材质 -->
UNIT = #unit#, <!-- 单位 -->
LENGTH = #length#, <!-- 长度 -->
WIDTH = #width#, <!-- 宽度 -->
THICK = #thick#, <!-- 厚度 -->
RECEIVE_QTY = #receiveQty#, <!-- 收货数量 -->
DELIVER_QTY = #deliverQty#, <!-- 退货数量 -->
DEPOSIT_QTY = #depositQty#, <!-- 入库数量 -->
RECEIVE_UNIT_WEIGHT = #receiveUnitWeight#, <!-- 收货单重 -->
RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 -->
STATUS = #status#, <!-- 状态:0-已收货,1-已入库,2-部分入库,3-退货 -->
PRICE = #price#, <!-- 单价 -->
AMOUNT = #amount#, <!-- 金额(不含税金额) -->
INVENT_TYPE_DETAIL = #inventTypeDetail#, <!-- 存货类型大类 -->
PRIMARY_ID = #primaryId#, <!-- 主表id -->
CONTRACT_DETAIL_ID = #contractDetailId#, <!-- 合同明细id -->
PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 -->
CALCULATION_METHOD = #calculationMethod#,
IS_INVOICING = #isInvoicing#
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hggpSchema}.HGCG003A
SET
UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 -->
RECEIVE_DATE = #receiveDate#, <!-- 收货日期 -->
RECEIVE_NO = #receiveNo#, <!-- 收货单号 -->
CONTRACT_NO = #contractNo#, <!-- 合同号 -->
INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
SPEC_ID = #specId#, <!-- 规格ID -->
SPEC = #spec#, <!-- 规格 -->
MATERIAL = #material#, <!-- 材质 -->
UNIT = #unit#, <!-- 单位 -->
LENGTH = #length#, <!-- 长度 -->
WIDTH = #width#, <!-- 宽度 -->
THICK = #thick#, <!-- 厚度 -->
RECEIVE_QTY = #receiveQty#, <!-- 收货数量 -->
RECEIVE_UNIT_WEIGHT = #receiveUnitWeight#, <!-- 收货单重 -->
RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 -->
STATUS = #status#, <!-- 状态:0-已收货,1-已入库,2-部分入库,3-退货 -->
PRICE = #price#, <!-- 单价 -->
AMOUNT = #amount#, <!-- 金额(不含税金额) -->
INVENT_TYPE_DETAIL = #inventTypeDetail#, <!-- 存货类型大类 -->
PRIMARY_ID = #primaryId#, <!-- 主表id -->
CONTRACT_DETAIL_ID = #contractDetailId#, <!-- 合同明细id -->
PROJ_CODE = #projCode#, <!-- 项目编码 -->
PROJ_NAME = #projName#, <!-- 项目名称 -->
CALCULATION_METHOD = #calculationMethod#,
IS_INVOICING = #isInvoicing#
WHERE ID = #id#
</update>
<!-- 修改开票 -->
<update id="updateIsInvoicing">
......@@ -355,10 +345,9 @@
WHERE ID = #id#
</update>
<select id="queryByQualityTesting" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cg.domain.HGCG003B">
SELECT
a.ID as "id",
<select id="queryByQualityTesting" resultClass="com.baosight.hggp.hg.cg.domain.HGCG003B">
SELECT
a.ID as "id",
a.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
a.DEP_CODE as "depCode", <!-- 部门编码 -->
a.CREATED_BY as "createdBy", <!-- 记录创建者 -->
......
......@@ -373,14 +373,16 @@ public class HGConstant {
//生产报工
public static final String SCBG = "SCBG";
}
/**
*
* 采购计划数据来源
*
* @author:songx
* @date:2024/5/15,15:18
*/
public static class CgSource {
// 合同
public static final Integer DEFAULT = 0;
// 手动录入
public static final Integer SDLR = 1;
......
......@@ -108,14 +108,19 @@ public class HGSqlConstant {
// 收货完成
public static final String UPDATE_CONFIRM = MODULE_NAME + "updateConfirm";
}
/**
* @author:songx
* @date:2024/8/30,16:25
*/
public class HgCg003A {
/**
* 模块名称:HGCW003A
*/
// 模块名称:HGCW003A
private static final String MODULE_NAME = "HGCG003A.";
//
public static final String UPDATE_IS_INVOICING = MODULE_NAME + "updateIsInvoicing";
// 修改数量
public static final String UPDATE_QTY = MODULE_NAME + "updateQty";
}
/**
......
......@@ -68,6 +68,7 @@ public class ServiceHGZL001B extends ServiceEPBase {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HGCG003B.FIELD_SOURCE, HGConstant.CgSource.DEFAULT);
queryMap.put(HGCG003B.FIELD_STATUS, HGConstant.CgReceiveStatus.S_0);
inInfo = super.query(inInfo, HGCG003B.QUERY_BY_QUALITY_TESTING, new HGCG003B());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
......@@ -10,10 +10,8 @@ $(function () {
loadComplete: function (grid) {
grid.dataSource.bind("change", function (e) {
var item = e.items[0];
if (e.field == "price") {
calAmount(item);
}
if (e.field == "taxRate") {
if (e.field == "purQty" || e.field == "purWeight" || e.field == "price"
|| e.field == "taxRate" || e.field == "calculationMethod") {
calAmount(item);
}
});
......@@ -94,13 +92,16 @@ let confirm = function () {
* @param coefficient
*/
let calAmount = function (item) {
//原材料
if(item.inventTypeDetail === '3'){
if(item.purWeight && item.price && item.taxRate){
let price = item.price;
let taxRate = item.taxRate;
// 计算方式为重量乘单价
if (item.calculationMethod == 1) {
let purWeight = item.purWeight;
if (!isBlank(purWeight) && !isBlank(price) && !isBlank(taxRate)) {
// 重量*单价金额
let totalAmount = item.purWeight * item.price;
//不含税金额
let amount = totalAmount / (1 + item.taxRate / 100);
let totalAmount = purWeight * price;
// 不含税金额
let amount = totalAmount / (1 + taxRate / 100);
//税额
let taxAmount = totalAmount - amount;
//含税金额
......@@ -109,12 +110,13 @@ let calAmount = function (item) {
resultGrid.setCellValue(item, 'amount', amount)
resultGrid.setCellValue(item, 'taxIncludeAmount', taxIncludeAmount)
}
}else{
if(item.purQty && item.price && item.taxRate){
} else {
let purQty = item.purQty;
if (!isBlank(purQty) && !isBlank(price) && !isBlank(taxRate)) {
// 数量*单价金额
let totalAmount = item.purQty * item.price;
let totalAmount = purQty * price;
//不含税金额
let amount = totalAmount / (1 + item.taxRate / 100);
let amount = totalAmount / (1 + taxRate / 100);
//税额
let taxAmount = totalAmount - amount;
//含税金额
......
......@@ -42,6 +42,10 @@
required="true"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" sumType="page"
required="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:EFComboColumn ename="taxRate" cname="税率(%)" enable="true" width="100" align="center" required="true"
copy="true">
......
......@@ -106,6 +106,8 @@ let confirm = function () {
for (let i = 0; i < rows.length; i++) {
let bcReceiveQty = rows[i]['bcReceiveQty'];
let bcMaxReceiveQty = rows[i]['bcMaxReceiveQty'];
let bcReceiveWeight = rows[i]['bcReceiveWeight'];
let bcMaxReceiveWeight = rows[i]['bcMaxReceiveWeight'];
if (!isPositiveNumber(bcReceiveQty)) {
message("勾选的第" + (i + 1) + "行本次收货数量必须大于0");
return;
......@@ -114,6 +116,10 @@ let confirm = function () {
message("勾选的第" + (i + 1) + "行本次收货数量不能大于本次最大收货数量");
return;
}
if (!isBlank(bcReceiveWeight) && parseFloat(bcReceiveWeight) > parseFloat(bcMaxReceiveWeight)) {
message("勾选的第" + (i + 1) + "行本次收货重量不能大于本次最大收货重量");
return;
}
}
JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据生成\"采购收货\"吗? ", {
ok: function () {
......
......@@ -59,7 +59,12 @@
required="true"/>
<EF:EFColumn ename="bcMaxReceiveQty" cname="本次最大</br>收货数量" enable="false" width="100" align="right"
format="{0:N3}"/>
<EF:EFColumn ename="bcReceiveWeight" cname="本次</br>收货重量" width="100" align="right" format="{0:N3}"
required="true"/>
<EF:EFColumn ename="bcMaxReceiveWeight" cname="本次最大</br>收货重量" enable="false" width="100" align="right"
format="{0:N3}"/>
<EF:EFColumn ename="receiveQty" cname="已收货数量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="receiveWeight" 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}"/>
......@@ -68,6 +73,9 @@
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/>
<EF:EFComboColumn ename="calculationMethod" cname="计算方式" enable="true" width="100" align="center">
<EF:EFCodeOption codeName="hggp.cg.calculationMethod"/>
</EF:EFComboColumn>
<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="120" align="right" format="{0:C3}"
......
......@@ -153,13 +153,17 @@ $(window).load(function () {
//合同选择的存货不让新增、删除
var source = $("#source").val();
if(source === '0'){
$(".k-grid-add").hide();
$(".k-grid-save-changes").hide();
$(".k-grid-cancel-changes").hide();
$(".k-grid-delete").hide();
}
}
});
/**
* 计算金额
*
* @param item
* @param length
* @param width
......
......@@ -41,20 +41,20 @@
<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="receiveQty" cname="收货数量" width="120" align="right" format="{0:N3}" sumType="page"
required="true"/>
<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:EFComboColumn ename="calculationMethod" cname="计算方式" enable="true" width="120" align="center" required="true">
<EF:EFCodeOption codeName="hggp.cg.calculationMethod" />
<EF:EFColumn ename="receiveWeight" cname="收货重量" width="120" align="right" format="{0:N3}" sumType="page"
required="true"/>
<EF:EFColumn ename="receiveUnitWeight" cname="收货单重" enable="false" width="120" align="right"
format="{0:N3}"/>
<EF:EFComboColumn ename="calculationMethod" cname="计算方式" enable="false" width="120" align="center">
<EF:EFCodeOption codeName="hggp.cg.calculationMethod"/>
</EF:EFComboColumn>
<EF:EFColumn ename="price" cname="单价" width="120" align="right" format="{0:C3}" required="true"/>
<EF:EFColumn ename="price" cname="单价" enable="false" width="120" align="right" format="{0:C3}"/>
<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">
......
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