Commit 899bbf67 by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

parents ba2dec46 2f2ed119
...@@ -124,19 +124,20 @@ public class DcOpenApi { ...@@ -124,19 +124,20 @@ public class DcOpenApi {
* @return * @return
* @throws IOException * @throws IOException
*/ */
public static List<DcContractList> interactionAdd(String title, String content, String ords) throws IOException { public static void interactionAdd(String title, String content, String ords) throws IOException {
JSONArray dataJsons = new JSONArray(); JSONArray dataJsons = new JSONArray();
dataJsons.add(DcApiUtils.buildValueJson("title", title)); dataJsons.add(DcApiUtils.buildValueJson("title", title));
dataJsons.add(DcApiUtils.buildValueJson("sort2", 451)); // 451:默认分类 dataJsons.add(DcApiUtils.buildValueJson("sort2", 451)); // 451:默认分类
dataJsons.add(DcApiUtils.buildValueJson("intro", content)); dataJsons.add(DcApiUtils.buildValueJson("intro", content));
dataJsons.add(DcApiUtils.buildValueJson("member", 1)); dataJsons.add(DcApiUtils.buildValueJson("member", 1)); // 0:全部,1: 不分,-1:私密
dataJsons.add(DcApiUtils.buildValueJson("share", ords)); dataJsons.add(DcApiUtils.buildValueJson("share", ords));
String param = JSON.toJSONString(DcApiUtils.buildParamJson(dataJsons, "__sys_dosave")); String param = JSON.toJSONString(DcApiUtils.buildParamJson(dataJsons, "__sys_dosave"));
String result = HttpUtils.post(DeChengConst.INTERACTION_ADD, param, HttpUtils.JSON_MEDIA_TYPE); String result = HttpUtils.post(DeChengConst.INTERACTION_ADD, param, HttpUtils.JSON_MEDIA_TYPE);
if (StringUtils.isBlank(result)) { if (StringUtils.isBlank(result)) {
throw new PlatException("【德诚】添加工作互动失败"); throw new PlatException("【德诚】添加工作互动失败");
} }
return DcApiUtils.handleResult(result, DcContractList.class); // 异常处理
DcApiUtils.handleMessage(JSONObject.parseObject(result));
} }
} }
...@@ -143,8 +143,6 @@ public class DcApiUtils { ...@@ -143,8 +143,6 @@ public class DcApiUtils {
String msg = resultJson.getString("Msg"); String msg = resultJson.getString("Msg");
if (DeChengConst.ApiStatus.S400.equals(code)) { if (DeChengConst.ApiStatus.S400.equals(code)) {
DcTokenApi.refreshToken(); DcTokenApi.refreshToken();
} else if (DeChengConst.ApiStatus.S2.equals(code)) {
DcTokenApi.refreshToken();
} }
throw new PlatException("【智邦】" + msg); throw new PlatException("【智邦】" + msg);
} }
...@@ -209,14 +207,15 @@ public class DcApiUtils { ...@@ -209,14 +207,15 @@ public class DcApiUtils {
public static void handleMessage(JSONObject resultJson) { public static void handleMessage(JSONObject resultJson) {
JSONObject headerJson = resultJson.getJSONObject("header"); JSONObject headerJson = resultJson.getJSONObject("header");
String message = headerJson.getString("message"); String message = headerJson.getString("message");
String status = headerJson.getString("status"); Integer status = headerJson.getInteger("status");
// 会话非法 if (status != null && status == 0) {
return;
}
// 会话超时
if (DeChengConst.ApiStatus.S400.equals(status)) { if (DeChengConst.ApiStatus.S400.equals(status)) {
DcTokenApi.refreshToken(); DcTokenApi.refreshToken();
} else if (DeChengConst.ApiStatus.S2.equals(status)) {
DcTokenApi.refreshToken();
throw new PlatException("【智邦】" + message);
} }
throw new PlatException("【智邦】" + message);
} }
/** /**
......
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 { ...@@ -58,6 +58,7 @@ public class HGCG001A extends DaoEPBase {
public static final String FIELD_REMARKS = "remarks"; /*备注*/ public static final String FIELD_REMARKS = "remarks"; /*备注*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/ public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/ public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_CALCULATION_METHOD = "calculationMethod"; /* 计算方式 0-数量乘单价 1-重量乘单价*/
//页面展示 //页面展示
public static final String FIELD_SOURCE = "source"; /* 数据来源 根据采购数据来源小代码 目前默认0材料计划,1手工录入*/ public static final String FIELD_SOURCE = "source"; /* 数据来源 根据采购数据来源小代码 目前默认0材料计划,1手工录入*/
...@@ -143,6 +144,7 @@ public class HGCG001A extends DaoEPBase { ...@@ -143,6 +144,7 @@ public class HGCG001A extends DaoEPBase {
private String remarks; /*备注*/ private String remarks; /*备注*/
private String projCode = " "; /* 项目编码*/ private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/ private String projName = " "; /* 项目名称*/
private Integer calculationMethod; /* 计算方式 0-数量乘单价 1-重量乘单价*/
//选择合同需要信息 //选择合同需要信息
private Integer source; /* 数据来源 根据采购数据来源小代码 目前默认0材料计划,1手工录入*/ private Integer source; /* 数据来源 根据采购数据来源小代码 目前默认0材料计划,1手工录入*/
...@@ -368,6 +370,10 @@ public class HGCG001A extends DaoEPBase { ...@@ -368,6 +370,10 @@ public class HGCG001A extends DaoEPBase {
eiColumn = new EiColumn(FIELD_PROJ_NAME); eiColumn = new EiColumn(FIELD_PROJ_NAME);
eiColumn.setDescName("项目名称"); eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CALCULATION_METHOD);
eiColumn.setDescName("计算方式 0-数量乘单价 1-重量乘单价");
eiMetadata.addMeta(eiColumn);
} }
/** /**
...@@ -970,6 +976,14 @@ public class HGCG001A extends DaoEPBase { ...@@ -970,6 +976,14 @@ public class HGCG001A extends DaoEPBase {
this.projName = projName; this.projName = projName;
} }
public Integer getCalculationMethod() {
return calculationMethod;
}
public void setCalculationMethod(Integer calculationMethod) {
this.calculationMethod = calculationMethod;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -1013,6 +1027,7 @@ public class HGCG001A extends DaoEPBase { ...@@ -1013,6 +1027,7 @@ public class HGCG001A extends DaoEPBase {
setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status)); setStatus(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STATUS)), status));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode)); setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName)); setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setCalculationMethod(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_CALCULATION_METHOD)), calculationMethod));
setSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SOURCE)), source)); setSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SOURCE)), source));
setPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRICE)), price)); setPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRICE)), price));
...@@ -1066,6 +1081,7 @@ public class HGCG001A extends DaoEPBase { ...@@ -1066,6 +1081,7 @@ public class HGCG001A extends DaoEPBase {
map.put(FIELD_REMARKS,StringUtils.toString(remarks, eiMetadata.getMeta(FIELD_REMARKS))); 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_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME))); map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_CALCULATION_METHOD, StringUtils.toString(calculationMethod, eiMetadata.getMeta(FIELD_CALCULATION_METHOD)));
map.put(FIELD_SOURCE, StringUtils.toString(source, eiMetadata.getMeta(FIELD_SOURCE))); map.put(FIELD_SOURCE, StringUtils.toString(source, eiMetadata.getMeta(FIELD_SOURCE)));
map.put(FIELD_PRICE, StringUtils.toString(price, eiMetadata.getMeta(FIELD_PRICE))); map.put(FIELD_PRICE, StringUtils.toString(price, eiMetadata.getMeta(FIELD_PRICE)));
......
...@@ -63,6 +63,8 @@ public class HGCG002B extends DaoEPBase { ...@@ -63,6 +63,8 @@ public class HGCG002B extends DaoEPBase {
//页面需要展示 //页面需要展示
public static final String FIELD_BC_RECEIVE_QTY = "bcReceiveQty"; /* 本次收货数量*/ public static final String FIELD_BC_RECEIVE_QTY = "bcReceiveQty"; /* 本次收货数量*/
public static final String FIELD_BC_MAX_RECEIVE_QTY = "bcMaxReceiveQty"; /* 本次最大收货数量*/ public static final String FIELD_BC_MAX_RECEIVE_QTY = "bcMaxReceiveQty"; /* 本次最大收货数量*/
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_DATE = "contractDate"; /* 合同日期*/
public static final String FIELD_CONTRACT_NO = "contractNo"; /* 合同号*/ public static final String FIELD_CONTRACT_NO = "contractNo"; /* 合同号*/
public static final String FIELD_PLAN_NO = "planNo"; /* 计划单号*/ public static final String FIELD_PLAN_NO = "planNo"; /* 计划单号*/
...@@ -155,6 +157,8 @@ public class HGCG002B extends DaoEPBase { ...@@ -155,6 +157,8 @@ public class HGCG002B extends DaoEPBase {
//页面需要填写、展示字段 //页面需要填写、展示字段
private BigDecimal bcReceiveQty = new BigDecimal(0.000); /* 本次收货数量*/ private BigDecimal bcReceiveQty = new BigDecimal(0.000); /* 本次收货数量*/
private BigDecimal bcMaxReceiveQty = 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 contractDate = " "; /* 合同日期*/
private String contractNo = " "; /* 合同号*/ private String contractNo = " "; /* 合同号*/
private String planNo = " "; /* 计划单号*/ private String planNo = " "; /* 计划单号*/
...@@ -360,6 +364,21 @@ public class HGCG002B extends DaoEPBase { ...@@ -360,6 +364,21 @@ public class HGCG002B extends DaoEPBase {
eiColumn.setDescName("本次最大收货数量"); eiColumn.setDescName("本次最大收货数量");
eiMetadata.addMeta(eiColumn); 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 = new EiColumn(FIELD_CONTRACT_DATE);
eiColumn.setDescName("合同日期"); eiColumn.setDescName("合同日期");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -957,6 +976,22 @@ public class HGCG002B extends DaoEPBase { ...@@ -957,6 +976,22 @@ public class HGCG002B extends DaoEPBase {
this.bcMaxReceiveQty = 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() { public String getContractDate() {
return contractDate; return contractDate;
} }
...@@ -1101,6 +1136,8 @@ public class HGCG002B extends DaoEPBase { ...@@ -1101,6 +1136,8 @@ public class HGCG002B extends DaoEPBase {
setBcReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_RECEIVE_QTY)), bcReceiveQty)); setBcReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_RECEIVE_QTY)), bcReceiveQty));
setBcMaxReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_MAX_RECEIVE_QTY)), bcMaxReceiveQty)); setBcMaxReceiveQty(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_BC_MAX_RECEIVE_QTY)), bcMaxReceiveQty));
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)); setContractDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTRACT_DATE)), contractDate));
setContractNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTRACT_NO)), contractNo)); setContractNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CONTRACT_NO)), contractNo));
setPlanNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_NO)), planNo)); setPlanNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PLAN_NO)), planNo));
...@@ -1158,6 +1195,8 @@ public class HGCG002B extends DaoEPBase { ...@@ -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_RECEIVE_QTY, StringUtils.toString(bcReceiveQty, eiMetadata.getMeta(FIELD_BC_RECEIVE_QTY)));
map.put(FIELD_BC_MAX_RECEIVE_QTY, StringUtils.toString(bcMaxReceiveQty, eiMetadata.getMeta(FIELD_BC_MAX_RECEIVE_QTY))); map.put(FIELD_BC_MAX_RECEIVE_QTY, StringUtils.toString(bcMaxReceiveQty, eiMetadata.getMeta(FIELD_BC_MAX_RECEIVE_QTY)));
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_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_CONTRACT_NO, StringUtils.toString(contractNo, eiMetadata.getMeta(FIELD_CONTRACT_NO)));
map.put(FIELD_PLAN_NO, StringUtils.toString(planNo, eiMetadata.getMeta(FIELD_PLAN_NO))); map.put(FIELD_PLAN_NO, StringUtils.toString(planNo, eiMetadata.getMeta(FIELD_PLAN_NO)));
......
...@@ -94,11 +94,9 @@ public class ServiceHGCG002A extends ServiceBase { ...@@ -94,11 +94,9 @@ public class ServiceHGCG002A extends ServiceBase {
@OperationLogAnnotation(operModul = "采购计划", operType = "修改", operDesc = "确认") @OperationLogAnnotation(operModul = "采购计划", operType = "修改", operDesc = "确认")
public EiInfo confirm(EiInfo inInfo) { public EiInfo confirm(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<HGCG001A> fCg001As = MapUtils.toDaoEPBases(inInfo, HGCG001A.class); List<HGCG001A> fCg001As = MapUtils.toDaoEPBases(inInfo, HGCG001A.class);
// db数据 // db数据
Map<Long, HGCG001A> dbCg001Map = this.lockGetData(fCg001As); Map<Long, HGCG001A> dbCg001Map = this.lockGetData(fCg001As);
//计划主表信息 //计划主表信息
List<String> planNos = fCg001As.stream().map(HGCG001A::getPlanNo).collect(Collectors.toList()); List<String> planNos = fCg001As.stream().map(HGCG001A::getPlanNo).collect(Collectors.toList());
Map<String, HGCG001> hgcg001Map = HGCGTools.HgCg001.map(planNos); Map<String, HGCG001> hgcg001Map = HGCGTools.HgCg001.map(planNos);
......
...@@ -4,7 +4,11 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; ...@@ -4,7 +4,11 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum; 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.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils; import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
...@@ -106,6 +110,7 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -106,6 +110,7 @@ public class ServiceHGCG003A extends ServiceBase {
/** /**
* 数据校验 * 数据校验
*
* @param fCg002Bs * @param fCg002Bs
* @param dbCg002BMap * @param dbCg002BMap
* @param cg001 * @param cg001
...@@ -120,6 +125,9 @@ public class ServiceHGCG003A extends ServiceBase { ...@@ -120,6 +125,9 @@ public class ServiceHGCG003A extends ServiceBase {
AssertUtils.isGt(fCg002B.getBcReceiveQty(), fCg002B.getBcMaxReceiveQty(), AssertUtils.isGt(fCg002B.getBcReceiveQty(), fCg002B.getBcMaxReceiveQty(),
String.format("合同[%s]本次收货数量(%s)不能大于本次最大收货数量(%s)", cg001.getContractNo(), String.format("合同[%s]本次收货数量(%s)不能大于本次最大收货数量(%s)", cg001.getContractNo(),
fCg002B.getBcReceiveQty(), fCg002B.getBcMaxReceiveQty())); 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 { ...@@ -135,9 +143,19 @@ public class ServiceHGCG003A extends ServiceBase {
Long id = fCg002B.getId(); Long id = fCg002B.getId();
HGCG002B dbCg002b = dbCg002BMap.get(id); HGCG002B dbCg002b = dbCg002BMap.get(id);
// 总重 // 总重
BigDecimal bcReceiveWeight = fCg002B.getBcReceiveWeight();
if (bcReceiveWeight == null || bcReceiveWeight.compareTo(BigDecimal.ZERO) == 0) {
fCg002B.setReceiveWeight(fCg002B.getBcReceiveQty().multiply(dbCg002b.getPurUnitWeight())); 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) { if (dbCg002b.getTaxRate() != null) {
amount = amount.subtract(amount.multiply(dbCg002b.getTaxRate()).divide(new BigDecimal("100"))); amount = amount.subtract(amount.multiply(dbCg002b.getTaxRate()).divide(new BigDecimal("100")));
......
...@@ -6,7 +6,11 @@ import com.baosight.hggp.common.InventTypeDetailEnum; ...@@ -6,7 +6,11 @@ import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum; import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils; 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.tools.HGCGTools;
import com.baosight.hggp.hg.cg.utils.HGCGUtils; import com.baosight.hggp.hg.cg.utils.HGCGUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
...@@ -14,14 +18,23 @@ import com.baosight.hggp.hg.constant.HGSqlConstant; ...@@ -14,14 +18,23 @@ import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ004; import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.pz.domain.HGPZ005; import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.xs.domain.Company; 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.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal; 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 * @author:songx
...@@ -41,11 +54,11 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -41,11 +54,11 @@ public class ServiceHGCG003B extends ServiceBase {
try { try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID), null, false); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID), null, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BOX_BLOCK_ID), CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BOX_BLOCK_ID),
new HashMap<String, Object>(){{ new HashMap<String, Object>() {{
put(HGPZ005.FIELD_STATUS,1); put(HGPZ005.FIELD_STATUS, 1);
put(HGPZ004.FIELD_INVENT_TYPE_DETAILS, InventTypeDetailEnum.getProdTypeFour()); put(HGPZ004.FIELD_INVENT_TYPE_DETAILS, InventTypeDetailEnum.getProdTypeFour());
}}, false); }}, 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); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG003B().eiMetadata);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
...@@ -81,7 +94,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -81,7 +94,7 @@ public class ServiceHGCG003B extends ServiceBase {
try { try {
List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBases(inInfo, HGCG003B.class); List<HGCG003B> fCg003Bs = MapUtils.toDaoEPBases(inInfo, HGCG003B.class);
HGCG003 cg003 = HGCGTools.HgCg003.get(fCg003Bs.get(0).getPrimaryId()); HGCG003 cg003 = HGCGTools.HgCg003.get(fCg003Bs.get(0).getPrimaryId());
if(cg003.getSource().intValue() == HGConstant.CgSource.DEFAULT){ if (cg003.getSource().intValue() == HGConstant.CgSource.DEFAULT) {
// 采购收货DB数据 // 采购收货DB数据
Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs); Map<Long, HGCG003B> dbCg003BMap = HGCGUtils.HgCg003B.lockGetDataEp(fCg003Bs);
// 采购合同DB数据 // 采购合同DB数据
...@@ -91,16 +104,16 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -91,16 +104,16 @@ public class ServiceHGCG003B extends ServiceBase {
Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData( Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID)); 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); this.editData(fCg003Bs, dbCg003BMap, dbCg002AMap, cg003, dbCg002BMap);
}else{ } else {
// 写入数据 // 写入数据
for (int i = 0; i < fCg003Bs.size(); i++) { for (int i = 0; i < fCg003Bs.size(); i++) {
HGCG003B hgcg003B = fCg003Bs.get(i); HGCG003B hgcg003B = fCg003Bs.get(i);
if (hgcg003B.getId() == null || hgcg003B.getId() == 0) { if (hgcg003B.getId() == null || hgcg003B.getId() == 0) {
// 修改数据 // 修改数据
this.saveData(hgcg003B,cg003); this.addData(hgcg003B, cg003);
} else { } else {
this.updateData(hgcg003B); this.updateData(hgcg003B);
} }
...@@ -108,7 +121,6 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -108,7 +121,6 @@ public class ServiceHGCG003B extends ServiceBase {
//修改主表信息 //修改主表信息
updateCg003Pur(cg003); updateCg003Pur(cg003);
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003Bs.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + fCg003Bs.size() + "]条数据保存成功!");
...@@ -120,6 +132,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -120,6 +132,7 @@ public class ServiceHGCG003B extends ServiceBase {
/** /**
* 数据校验 * 数据校验
*
* @param fCg003Bs * @param fCg003Bs
* @param dbCg003Map * @param dbCg003Map
* @param cg003 * @param cg003
...@@ -149,6 +162,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -149,6 +162,7 @@ public class ServiceHGCG003B extends ServiceBase {
/** /**
* 数据保存 * 数据保存
*
* @param fCg003Bs * @param fCg003Bs
* @param dbCg003BMap * @param dbCg003BMap
* @param dbCg002AMap * @param dbCg002AMap
...@@ -167,7 +181,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -167,7 +181,7 @@ public class ServiceHGCG003B extends ServiceBase {
HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), diffQty); HGCGTools.HgCg002B.updateReceive(dbCg002BMap.get(fCg003B.getContractDetailId()), diffQty);
} }
List<HGCG002> hgcg002List = new LinkedList<>(); List<HGCG002> hgcg002List = new LinkedList<>();
dbCg002AMap.forEach((k, v)->{ dbCg002AMap.forEach((k, v) -> {
hgcg002List.add(v); hgcg002List.add(v);
}); });
//根据子表明细刷新合同主表信息 //根据子表明细刷新合同主表信息
...@@ -176,8 +190,13 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -176,8 +190,13 @@ public class ServiceHGCG003B extends ServiceBase {
updateCg003Pur(cg003); 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.setPrimaryId(cg003.getId());
hgcg003B.setReceiveNo(cg003.getReceiveNo()); hgcg003B.setReceiveNo(cg003.getReceiveNo());
hgcg003B.setStatus(HGConstant.CgReceiveStatus.S_0); hgcg003B.setStatus(HGConstant.CgReceiveStatus.S_0);
...@@ -190,8 +209,12 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -190,8 +209,12 @@ public class ServiceHGCG003B extends ServiceBase {
DaoUtils.insert(HGCG003B.INSERT, hgcg003B); DaoUtils.insert(HGCG003B.INSERT, hgcg003B);
} }
/**
* 修改数据
*
* @param hgcg003B
*/
private void updateData(HGCG003B hgcg003B) { private void updateData(HGCG003B hgcg003B) {
// 新增数据
DaoUtils.update(HGCG003B.UPDATE, hgcg003B); DaoUtils.update(HGCG003B.UPDATE, hgcg003B);
} }
...@@ -199,10 +222,12 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -199,10 +222,12 @@ public class ServiceHGCG003B extends ServiceBase {
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); 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); cg003.setReceiveWeight(receiveWeightSum);
DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_QTY, cg003); DaoUtils.update(HGSqlConstant.HgCg003.UPDATE_QTY, cg003);
} }
...@@ -227,9 +252,9 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -227,9 +252,9 @@ public class ServiceHGCG003B extends ServiceBase {
Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData( Map<Long, HGCG002B> dbCg002BMap = HGCGUtils.HgCg002B.lockGetData(
ObjectUtils.listEpKey(fCg003Bs, HGCG003B.FIELD_CONTRACT_DETAIL_ID)); 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 = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + fCg003Bs.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + fCg003Bs.size() + "]条数据删除成功!");
...@@ -241,6 +266,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -241,6 +266,7 @@ public class ServiceHGCG003B extends ServiceBase {
/** /**
* 数据校验 * 数据校验
*
* @param fCg003Bs * @param fCg003Bs
* @param dbCg003BMap * @param dbCg003BMap
* @param cg003 * @param cg003
...@@ -257,6 +283,7 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -257,6 +283,7 @@ public class ServiceHGCG003B extends ServiceBase {
/** /**
* 数据保存 * 数据保存
*
* @param fCg003Bs * @param fCg003Bs
* @param dbCg003bMap * @param dbCg003bMap
* @param dbCg002AMap * @param dbCg002AMap
...@@ -276,12 +303,12 @@ public class ServiceHGCG003B extends ServiceBase { ...@@ -276,12 +303,12 @@ public class ServiceHGCG003B extends ServiceBase {
dbCg003B.getReceiveQty().negate()); dbCg003B.getReceiveQty().negate());
} }
List<HGCG002> hgcg002List = new LinkedList<>(); List<HGCG002> hgcg002List = new LinkedList<>();
dbCg002AMap.forEach((k, v)->{ dbCg002AMap.forEach((k, v) -> {
hgcg002List.add(v); hgcg002List.add(v);
}); });
//根据子表明细刷新合同主表信息 //根据子表明细刷新合同主表信息
HGCGTools.HgCg002.updateContractPrimary(hgcg002List); HGCGTools.HgCg002.updateContractPrimary(hgcg002List);
}else{ } else {
//手工录入的 //手工录入的
for (HGCG003B fCg003B : fCg003Bs) { for (HGCG003B fCg003B : fCg003Bs) {
HGCG003B dbCg003B = dbCg003bMap.get(fCg003B.getId()); HGCG003B dbCg003B = dbCg003bMap.get(fCg003B.getId());
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <sqlMap namespace="HGCG002A">
<sql id="condition"> <sql id="condition">
...@@ -116,6 +116,7 @@ ...@@ -116,6 +116,7 @@
CALCULATION_METHOD = #calculationMethod# CALCULATION_METHOD = #calculationMethod#
</isNotEmpty> </isNotEmpty>
</sql> </sql>
<!-- 公共修改字段 --> <!-- 公共修改字段 -->
<sql id="updateRevise"> <sql id="updateRevise">
UPDATED_BY = #updatedBy#, UPDATED_BY = #updatedBy#,
...@@ -292,8 +293,7 @@ ...@@ -292,8 +293,7 @@
</update> </update>
<select id="queryByReceive" parameterClass="java.util.HashMap" <select id="queryByReceive" resultClass="com.baosight.hggp.hg.cg.domain.HGCG002B">
resultClass="com.baosight.hggp.hg.cg.domain.HGCG002B">
SELECT SELECT
a.ID as "id", a.ID as "id",
a.ACCOUNT_CODE as "accountCode", <!-- 企业编码 --> a.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
...@@ -329,6 +329,7 @@ ...@@ -329,6 +329,7 @@
a.INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 --> a.INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型大类 -->
a.PRIMARY_ID as "primaryId", <!-- 主表id --> a.PRIMARY_ID as "primaryId", <!-- 主表id -->
(a.PUR_QTY - a.RECEIVE_QTY) as "bcMaxReceiveQty", (a.PUR_QTY - a.RECEIVE_QTY) as "bcMaxReceiveQty",
(a.PUR_WEIGHT - a.RECEIVE_WEIGHT) as "bcMaxReceiveWeight",
a.PROJ_CODE as "projCode", <!-- 项目编码 --> a.PROJ_CODE as "projCode", <!-- 项目编码 -->
a.PROJ_NAME as "projName", <!-- 项目名称 --> a.PROJ_NAME as "projName", <!-- 项目名称 -->
a.CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 --> a.CALCULATION_METHOD as "calculationMethod", <!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
...@@ -345,6 +346,7 @@ ...@@ -345,6 +346,7 @@
WHERE 1=1 WHERE 1=1
AND a.DELETE_FLAG = 0 AND a.DELETE_FLAG = 0
AND b.DELETE_FLAG = 0 AND b.DELETE_FLAG = 0
AND (a.PUR_QTY - a.RECEIVE_QTY) > 0
<isNotEmpty prepend=" AND " property="id"> <isNotEmpty prepend=" AND " property="id">
a.ID = #id# a.ID = #id#
</isNotEmpty> </isNotEmpty>
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <sqlMap namespace="HGCG003A">
<sql id="condition"> <sql id="condition">
...@@ -262,20 +262,13 @@ ...@@ -262,20 +262,13 @@
<update id="update"> <update id="update">
UPDATE ${hggpSchema}.HGCG003A UPDATE ${hggpSchema}.HGCG003A
SET SET
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
CREATED_BY = #createdBy#, <!-- 记录创建者 -->
CREATED_NAME = #createdName#, <!-- 记录创建名称 -->
CREATED_TIME = #createdTime#, <!-- 记录创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 记录修改者 --> UPDATED_BY = #updatedBy#, <!-- 记录修改者 -->
UPDATED_NAME = #updatedName#, <!-- 记录修改名称 --> UPDATED_NAME = #updatedName#, <!-- 记录修改名称 -->
UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 --> UPDATED_TIME = #updatedTime#, <!-- 记录修改时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 0-未删除,1-已删除 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 --> COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 --> COMPANY_NAME = #companyName#, <!-- 公司名称 -->
RECEIVE_DATE = #receiveDate#, <!-- 收货日期 --> RECEIVE_DATE = #receiveDate#, <!-- 收货日期 -->
RECEIVE_NO = #receiveNo#, <!-- 收货单号 --> RECEIVE_NO = #receiveNo#, <!-- 收货单号 -->
PLAN_NO = #planNo#, <!-- 计划单号 -->
CONTRACT_NO = #contractNo#, <!-- 合同号 --> CONTRACT_NO = #contractNo#, <!-- 合同号 -->
INVENT_TYPE = #inventType#, <!-- 存货类型 --> INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 --> INVENT_CODE = #inventCode#, <!-- 存货编码 -->
...@@ -288,8 +281,6 @@ ...@@ -288,8 +281,6 @@
WIDTH = #width#, <!-- 宽度 --> WIDTH = #width#, <!-- 宽度 -->
THICK = #thick#, <!-- 厚度 --> THICK = #thick#, <!-- 厚度 -->
RECEIVE_QTY = #receiveQty#, <!-- 收货数量 --> RECEIVE_QTY = #receiveQty#, <!-- 收货数量 -->
DELIVER_QTY = #deliverQty#, <!-- 退货数量 -->
DEPOSIT_QTY = #depositQty#, <!-- 入库数量 -->
RECEIVE_UNIT_WEIGHT = #receiveUnitWeight#, <!-- 收货单重 --> RECEIVE_UNIT_WEIGHT = #receiveUnitWeight#, <!-- 收货单重 -->
RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 --> RECEIVE_WEIGHT = #receiveWeight#, <!-- 收货重量 -->
STATUS = #status#, <!-- 状态:0-已收货,1-已入库,2-部分入库,3-退货 --> STATUS = #status#, <!-- 状态:0-已收货,1-已入库,2-部分入库,3-退货 -->
...@@ -302,8 +293,7 @@ ...@@ -302,8 +293,7 @@
PROJ_NAME = #projName#, <!-- 项目名称 --> PROJ_NAME = #projName#, <!-- 项目名称 -->
CALCULATION_METHOD = #calculationMethod#, CALCULATION_METHOD = #calculationMethod#,
IS_INVOICING = #isInvoicing# IS_INVOICING = #isInvoicing#
WHERE WHERE ID = #id#
ID = #id#
</update> </update>
<!-- 修改开票 --> <!-- 修改开票 -->
...@@ -355,8 +345,7 @@ ...@@ -355,8 +345,7 @@
WHERE ID = #id# WHERE ID = #id#
</update> </update>
<select id="queryByQualityTesting" parameterClass="java.util.HashMap" <select id="queryByQualityTesting" resultClass="com.baosight.hggp.hg.cg.domain.HGCG003B">
resultClass="com.baosight.hggp.hg.cg.domain.HGCG003B">
SELECT SELECT
a.ID as "id", a.ID as "id",
a.ACCOUNT_CODE as "accountCode", <!-- 企业编码 --> a.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
......
...@@ -375,12 +375,14 @@ public class HGConstant { ...@@ -375,12 +375,14 @@ public class HGConstant {
} }
/** /**
*
* 采购计划数据来源 * 采购计划数据来源
*
* @author:songx * @author:songx
* @date:2024/5/15,15:18 * @date:2024/5/15,15:18
*/ */
public static class CgSource { public static class CgSource {
// 合同
public static final Integer DEFAULT = 0; public static final Integer DEFAULT = 0;
// 手动录入 // 手动录入
public static final Integer SDLR = 1; public static final Integer SDLR = 1;
......
...@@ -109,13 +109,18 @@ public class HGSqlConstant { ...@@ -109,13 +109,18 @@ public class HGSqlConstant {
public static final String UPDATE_CONFIRM = MODULE_NAME + "updateConfirm"; public static final String UPDATE_CONFIRM = MODULE_NAME + "updateConfirm";
} }
public class HgCg003A {
/** /**
* 模块名称:HGCW003A * @author:songx
* @date:2024/8/30,16:25
*/ */
private static final String MODULE_NAME = "HGCG003A."; public class HgCg003A {
// 模块名称:HGCW003A
private static final String MODULE_NAME = "HGCG003A.";
//
public static final String UPDATE_IS_INVOICING = MODULE_NAME + "updateIsInvoicing"; public static final String UPDATE_IS_INVOICING = MODULE_NAME + "updateIsInvoicing";
// 修改数量
public static final String UPDATE_QTY = MODULE_NAME + "updateQty";
} }
/** /**
......
...@@ -105,7 +105,8 @@ public class ServiceHGWD003 extends ServiceEPBase { ...@@ -105,7 +105,8 @@ public class ServiceHGWD003 extends ServiceEPBase {
return results; return results;
} }
for (HGSC001 dbSc001 : dbSc001s) { for (HGSC001 dbSc001 : dbSc001s) {
results.add(buildLeaf(parentLabel, dbSc001.getProjCode(), dbSc001.getProjName(), HgWdConstant.LeafType.P)); String text = "[" + dbSc001.getProjCode() + "]" + dbSc001.getProjName();
results.add(buildLeaf(parentLabel, dbSc001.getProjCode(), text, HgWdConstant.LeafType.P));
} }
// 设置叶子节点 // 设置叶子节点
setTreeNodeLeaf(results); setTreeNodeLeaf(results);
......
...@@ -68,6 +68,7 @@ public class ServiceHGZL001B extends ServiceEPBase { ...@@ -68,6 +68,7 @@ public class ServiceHGZL001B extends ServiceEPBase {
try { try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
queryMap.put(HGCG003B.FIELD_SOURCE, HGConstant.CgSource.DEFAULT); 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()); inInfo = super.query(inInfo, HGCG003B.QUERY_BY_QUALITY_TESTING, new HGCG003B());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
......
package com.baosight.xservices.xs.service; package com.baosight.xservices.xs.service;
import com.baosight.iplat4j.core.FrameworkInfo; import com.baosight.iplat4j.core.FrameworkInfo;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.log.Logger; import com.baosight.iplat4j.core.log.Logger;
import com.baosight.iplat4j.core.log.LoggerFactory; import com.baosight.iplat4j.core.log.LoggerFactory;
...@@ -11,11 +12,12 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase; ...@@ -11,11 +12,12 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.util.StringUtils; import com.baosight.iplat4j.core.util.StringUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.xservices.xs.jwt.JwtTokenValidator; import com.baosight.xservices.xs.jwt.JwtTokenValidator;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.core.userdetails.UsernameNotFoundException;
import java.util.HashMap;
import java.util.Map;
/** /**
* 重写 * 重写
* *
...@@ -76,6 +78,49 @@ public class ServiceXSUserJwt extends ServiceBase { ...@@ -76,6 +78,49 @@ public class ServiceXSUserJwt extends ServiceBase {
return outInfo; return outInfo;
} }
/**
* 德诚系统对接专用
*
* @param inInfo
* @return
*/
public EiInfo generateJwtDc(EiInfo inInfo) {
String username = inInfo.getString("loginName");
String password = inInfo.getString("password");
String audience = inInfo.getString("audience");
EiInfo outInfo = new EiInfo();
try {
if (!StringUtils.isNotEmpty(audience)) {
audience = FrameworkInfo.getProjectEname().toUpperCase();
}
IUserManager um = SecurityFactory.getUserManager();
User user = um.getUser("DC" + username);
if (user == null) {
throw new UsernameNotFoundException("Can't find user!");
}
Map tokenMap = new HashMap();
tokenMap.put("sub", user.getLoginName());
tokenMap.put("uid", user.getUserId());
Object userCname = user.get("userName");
if (userCname != null) {
tokenMap.put("ucn", userCname.toString());
}
if (!StringUtils.isNotEmpty(audience)) {
audience = FrameworkInfo.getProjectEname().toUpperCase();
}
String token = this.jwtTokenValidator.generateToken(tokenMap, audience);
outInfo.setStatus(EiConstant.STATUS_SUCCESS);
outInfo.setMsg("登录成功!");
outInfo.set("token", token);
} catch (Exception var11) {
this.logger.error(var11.getMessage(), var11);
outInfo.setStatus(EiConstant.STATUS_FAILURE);
outInfo.setMsg(var11.getMessage());
}
return outInfo;
}
public EiInfo validateTest(EiInfo inInfo) { public EiInfo validateTest(EiInfo inInfo) {
new HashMap(); new HashMap();
inInfo.set("userSessionData", new HashMap(UserSession.getData())); inInfo.set("userSessionData", new HashMap(UserSession.getData()));
......
...@@ -10,10 +10,8 @@ $(function () { ...@@ -10,10 +10,8 @@ $(function () {
loadComplete: function (grid) { loadComplete: function (grid) {
grid.dataSource.bind("change", function (e) { grid.dataSource.bind("change", function (e) {
var item = e.items[0]; var item = e.items[0];
if (e.field == "price") { if (e.field == "purQty" || e.field == "purWeight" || e.field == "price"
calAmount(item); || e.field == "taxRate" || e.field == "calculationMethod") {
}
if (e.field == "taxRate") {
calAmount(item); calAmount(item);
} }
}); });
...@@ -94,13 +92,16 @@ let confirm = function () { ...@@ -94,13 +92,16 @@ let confirm = function () {
* @param coefficient * @param coefficient
*/ */
let calAmount = function (item) { let calAmount = function (item) {
//原材料 let price = item.price;
if(item.inventTypeDetail === '3'){ let taxRate = item.taxRate;
if(item.purWeight && item.price && item.taxRate){ // 计算方式为重量乘单价
if (item.calculationMethod == 1) {
let purWeight = item.purWeight;
if (!isBlank(purWeight) && !isBlank(price) && !isBlank(taxRate)) {
// 重量*单价金额 // 重量*单价金额
let totalAmount = item.purWeight * item.price; let totalAmount = purWeight * price;
//不含税金额 // 不含税金额
let amount = totalAmount / (1 + item.taxRate / 100); let amount = totalAmount / (1 + taxRate / 100);
//税额 //税额
let taxAmount = totalAmount - amount; let taxAmount = totalAmount - amount;
//含税金额 //含税金额
...@@ -109,12 +110,13 @@ let calAmount = function (item) { ...@@ -109,12 +110,13 @@ let calAmount = function (item) {
resultGrid.setCellValue(item, 'amount', amount) resultGrid.setCellValue(item, 'amount', amount)
resultGrid.setCellValue(item, 'taxIncludeAmount', taxIncludeAmount) resultGrid.setCellValue(item, 'taxIncludeAmount', taxIncludeAmount)
} }
}else{ } else {
if(item.purQty && item.price && item.taxRate){ 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; let taxAmount = totalAmount - amount;
//含税金额 //含税金额
......
...@@ -42,6 +42,10 @@ ...@@ -42,6 +42,10 @@
required="true"/> required="true"/>
<EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" sumType="page" <EF:EFColumn ename="purWeight" cname="采购重量" width="120" align="right" format="{0:N3}" sumType="page"
required="true"/> 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: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" <EF:EFComboColumn ename="taxRate" cname="税率(%)" enable="true" width="100" align="center" required="true"
copy="true"> copy="true">
......
...@@ -106,6 +106,8 @@ let confirm = function () { ...@@ -106,6 +106,8 @@ let confirm = function () {
for (let i = 0; i < rows.length; i++) { for (let i = 0; i < rows.length; i++) {
let bcReceiveQty = rows[i]['bcReceiveQty']; let bcReceiveQty = rows[i]['bcReceiveQty'];
let bcMaxReceiveQty = rows[i]['bcMaxReceiveQty']; let bcMaxReceiveQty = rows[i]['bcMaxReceiveQty'];
let bcReceiveWeight = rows[i]['bcReceiveWeight'];
let bcMaxReceiveWeight = rows[i]['bcMaxReceiveWeight'];
if (!isPositiveNumber(bcReceiveQty)) { if (!isPositiveNumber(bcReceiveQty)) {
message("勾选的第" + (i + 1) + "行本次收货数量必须大于0"); message("勾选的第" + (i + 1) + "行本次收货数量必须大于0");
return; return;
...@@ -114,6 +116,10 @@ let confirm = function () { ...@@ -114,6 +116,10 @@ let confirm = function () {
message("勾选的第" + (i + 1) + "行本次收货数量不能大于本次最大收货数量"); message("勾选的第" + (i + 1) + "行本次收货数量不能大于本次最大收货数量");
return; return;
} }
if (!isBlank(bcReceiveWeight) && parseFloat(bcReceiveWeight) > parseFloat(bcMaxReceiveWeight)) {
message("勾选的第" + (i + 1) + "行本次收货重量不能大于本次最大收货重量");
return;
}
} }
JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据生成\"采购收货\"吗? ", { JSUtils.confirm("确定对勾选的[" + rows.length + "]条数据生成\"采购收货\"吗? ", {
ok: function () { ok: function () {
......
...@@ -59,7 +59,12 @@ ...@@ -59,7 +59,12 @@
required="true"/> required="true"/>
<EF:EFColumn ename="bcMaxReceiveQty" cname="本次最大</br>收货数量" enable="false" width="100" align="right" <EF:EFColumn ename="bcMaxReceiveQty" cname="本次最大</br>收货数量" enable="false" width="100" align="right"
format="{0:N3}"/> 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="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="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="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:EFColumn ename="purWeight" cname="采购重量" enable="false" width="100" align="right" format="{0:N3}"/>
...@@ -68,6 +73,9 @@ ...@@ -68,6 +73,9 @@
<EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/> <EF:EFOptions blockId="sup_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="purUserName" cname="采购员" enable="false" width="100" align="center"/> <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="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="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}" <EF:EFColumn ename="amount" cname="不含税金额" enable="false" width="120" align="right" format="{0:C3}"
......
...@@ -153,13 +153,17 @@ $(window).load(function () { ...@@ -153,13 +153,17 @@ $(window).load(function () {
//合同选择的存货不让新增、删除 //合同选择的存货不让新增、删除
var source = $("#source").val(); var source = $("#source").val();
if(source === '0'){ if(source === '0'){
$(".k-grid-add").hide();
$(".k-grid-save-changes").hide(); $(".k-grid-save-changes").hide();
$(".k-grid-cancel-changes").hide();
$(".k-grid-delete").hide();
} }
} }
}); });
/** /**
* 计算金额 * 计算金额
*
* @param item * @param item
* @param length * @param length
* @param width * @param width
......
...@@ -41,20 +41,20 @@ ...@@ -41,20 +41,20 @@
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <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="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="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="receiveQty" cname="收货数量" width="120" align="right" format="{0:N3}" required="true" <EF:EFColumn ename="receiveQty" cname="收货数量" width="120" align="right" format="{0:N3}" sumType="page"
sumType="page"/> required="true"/>
<EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N3}" <EF:EFColumn ename="deliverQty" cname="退货数量" enable="false" width="120" align="right" format="{0:N3}"
sumType="page"/> sumType="page"/>
<EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N3}" <EF:EFColumn ename="depositQty" cname="入库数量" enable="false" width="120" align="right" format="{0:N3}"
sumType="page"/> sumType="page"/>
<EF:EFColumn ename="receiveWeight" cname="收货重量" enable="false" width="120" align="right" format="{0:N3}" <EF:EFColumn ename="receiveWeight" cname="收货重量" width="120" align="right" format="{0:N3}" sumType="page"
sumType="page"/> required="true"/>
<EF:EFColumn ename="receiveUnitWeight" cname="收货单重" enable="false" width="120" align="right" format="{0:N3}" <EF:EFColumn ename="receiveUnitWeight" cname="收货单重" enable="false" width="120" align="right"
hidden="true"/> format="{0:N3}"/>
<EF:EFComboColumn ename="calculationMethod" cname="计算方式" enable="true" width="120" align="center" required="true"> <EF:EFComboColumn ename="calculationMethod" cname="计算方式" enable="false" width="120" align="center">
<EF:EFCodeOption codeName="hggp.cg.calculationMethod" /> <EF:EFCodeOption codeName="hggp.cg.calculationMethod"/>
</EF:EFComboColumn> </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}" <EF:EFColumn ename="amount" cname="金额" enable="false" width="120" align="right" format="{0:C3}"
sumType="page"/> sumType="page"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center"> <EF:EFComboColumn ename="status" cname="状态" enable="false" width="80" align="center">
......
...@@ -21,6 +21,20 @@ $(function () { ...@@ -21,6 +21,20 @@ $(function () {
// 显示授权按钮 // 显示授权按钮
showAuthButton(); showAuthButton();
}, },
template: function (node) {
var item = node.item;
let icon = 'fa fa-globe'
switch (item.leafType) {
case 'P':
icon = 'fa fa-clipboard'
break;
case 'C':
icon = 'fa fa-folder'
break;
}
return '<span class="' + icon + '" style="padding-right: 8px"> </span>'
+ '<span class="titleClass" title="' + item.label + '">' + item.text + '</span>'
},
selectNode: { selectNode: {
treeId: '', treeId: '',
leaf: false, leaf: false,
......
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