Commit f6858725 by liuyang

2024-08-06物料清单和存货档案导入模板调整

parent 9573dd18
......@@ -99,7 +99,7 @@ public enum DdynamicEnum {
* 用途:存货档案下拉框,带id名称等信息
* 编写:
*/
PRODUCT_BLOCK_ID("product_block_id","inventCode","inventName","id","inventType","length","width","thick","inventTypeDetail","HGPZ005.queryProductComboBox"),
PRODUCT_BLOCK_ID("product_block_id","inventCode","inventName","id","inventType","length","width","thick","inventTypeDetail", "spec","HGPZ005.queryProductComboBox"),
/**
* 模块:存货档案(ALL)
* 用途:存货档案下拉框
......
......@@ -323,19 +323,17 @@ public class HGCWTools {
if (CollectionUtils.isEmpty(results)) {
throw new PlatException("找不到对应的合同!");
}
BigDecimal totalAmount = HgCw011.sumSettlementNumber(contractNumber); //获取累计开票金额
BigDecimal totalAmount = HgCw011.sumSettlementNumber(Collections.singletonList(contractNumber)); //获取累计开票金额
DecimalFormat decimalFormat = new DecimalFormat("#.000");
HGCW002 hgcw002 = results.get(0);
BigDecimal remaining = hgcw002.getTotalContractPriceIncluding();
if(hgcw002.getContractType() == 1 || hgcw002.getContractType() == 5){
//获取销售合同金额和补充协议金额
List<HGCW002> hgcw002List = DaoBase.getInstance().query("HGCW010D.sumContractPrice",new HashMap<String,Object>(){
{put("contractNumberStr",contractNumber);}
{put("contractNumber",contractNumber);}
});
//计算销售合同金额的20%的总金额 总金额=合同金额+合同金额的20%
remaining = hgcw002List.get(0).getTotalContractPriceIncluding().add(hgcw002List.get(0).getTotalContractPriceIncluding().multiply(new BigDecimal("0.2")));
}
//合同总金额-(累计开票金额+本次来票金额)
BigDecimal remainingAmount = new BigDecimal(decimalFormat.format(remaining.subtract(deductionAmount.add(totalAmount))));
if (remainingAmount.compareTo(new BigDecimal(BigInteger.ZERO)) < 0) {
......@@ -469,6 +467,55 @@ public class HGCWTools {
}
public static void deductionAmount(Object contractNumber, String settlementNumber, BigDecimal deductionAmount) {
AssertUtils.isNull(contractNumber, "合同不能为空!");
AssertUtils.isNull(settlementNumber, "结算单不能为空!");
// if (deductionAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
// throw new PlatException("扣款金额不能小于等于0!");
// }
List<HGCW008> hgcw008List = DaoBase.getInstance().query(HGCW008.QUERY,new HashMap<String,Object>(){
{put("settlementNumber",settlementNumber);}
});
if (CollectionUtils.isEmpty(hgcw008List)) {
throw new PlatException("找不到对应的结算单!");
}
List<HGCW002> hgcw002s = DaoBase.getInstance().query(HGCW002.QUERY,new HashMap<String,Object>(){
{put("contractNumber",contractNumber);}
});
if (CollectionUtils.isEmpty(hgcw002s)) {
throw new PlatException("找不到对应的合同!");
}
//获取当期项目所以的结算单
List<HGCW008> cw008List = DaoBase.getInstance().query(HGCW008.QUERY,new HashMap<String,Object>(){
{put("contractNumber",contractNumber);}
});
List<String> stringList = cw008List.stream().map(HGCW008::getSettlementNumber).collect(Collectors.toList());
BigDecimal totalAmount = HgCw011.sumSettlementNumber(stringList); //获取累计开票金额
DecimalFormat decimalFormat = new DecimalFormat("#.000");
HGCW002 hgcw002 = hgcw002s.get(0);
BigDecimal remaining = hgcw002.getTotalContractPriceIncluding();
//获取销售合同金额和补充协议金额
List<HGCW002> hgcw002List = DaoBase.getInstance().query("HGCW010D.sumContractPrice",new HashMap<String,Object>(){
{put("contractNumber",contractNumber);}
});
//计算销售合同金额的20%的总金额 总金额=合同金额+合同金额的20%
remaining = hgcw002List.get(0).getTotalContractPriceIncluding().add(hgcw002List.get(0).getTotalContractPriceIncluding().multiply(new BigDecimal("0.2")));
//合同总金额-(累计开票金额+本次来票金额)
BigDecimal remainingAmount = new BigDecimal(decimalFormat.format(remaining.subtract(deductionAmount.add(totalAmount))));
if (remainingAmount.compareTo(new BigDecimal(BigInteger.ZERO)) < 0) {
throw new PlatException("本次开票金额加累计开票金额超出销售合同金额20%,超出20%需要业务新增补充协议!");
}
HGCW008 hgcw008 = hgcw008List.get(0);
BigDecimal remainingCount = new BigDecimal(decimalFormat.format(hgcw008.getRemainingAmount().subtract(deductionAmount)));
if (remainingAmount.compareTo(new BigDecimal(BigInteger.ZERO)) < 0) {
throw new PlatException("扣款金额不能大于结算单剩余金额!");
}
hgcw008.setRemainingAmount(remainingCount);
DaoUtils.update("HGCW008.updateDeductionAmount", hgcw008);
}
}
......@@ -736,10 +783,10 @@ public class HGCWTools {
* @param settlementNumber 来源单号
* @return
*/
public static BigDecimal sumSettlementNumber(String settlementNumber) {
public static BigDecimal sumSettlementNumber(List<String> settlementNumber) {
AssertUtils.isNull(settlementNumber, "来源单号不能为空!");
List<HGCW011> results = DaoBase.getInstance().query(HGCW011.QUERY,new HashMap<String,Object>(){
{put("settlementNumber",settlementNumber);}
{put("settlementNumbers",settlementNumber);}
});
AssertUtils.isEmpty(results, "找不到对应的销售开票记录!");
BigDecimal totalAmount = new BigDecimal("0");
......
......@@ -378,7 +378,8 @@
a.WIDTH as "width", <!-- 宽 -->
a.THICK as "thick", <!-- 厚 -->
b.PAR_INVENT_TYPE as "parInventType",
b.INVENT_TYPE_DETAIL as "inventTypeDetail"
b.INVENT_TYPE_DETAIL as "inventTypeDetail",
a.SPEC as "spec" <!-- 规格 -->
FROM ${hggpSchema}.HGPZ005 a
left join ${hggpSchema}.hgpz004 b on a.INVENT_TYPE = b.INVENT_TYPE and b.STATUS=1 and b.DELETE_FLAG = 0
WHERE a.DELETE_FLAG = 0
......
......@@ -613,7 +613,10 @@ public class HGPZTools {
Map<String, Object> params = new HashMap<>();
params.put(HGPZ005.FIELD_INVENT_CODE, hgpz005.getInventCode());
List hgpz005s = DaoBase.getInstance().query(HGPZ005.QUERY, params);
AssertUtils.isNotEmpty(hgpz005s, String.format("存货编码[%s]已存在", hgpz005.getInventCode()));
if (CollectionUtils.isNotEmpty(hgpz005s)){
continue;
}
//AssertUtils.isNotEmpty(hgpz005s, String.format("存货编码[%s]已存在", hgpz005.getInventCode()));
//hgpz005.setInventCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.INVENT_CODE));
// 设置规格
if (StringUtils.isBlank(hgpz005.getSpec())) {
......
......@@ -40,6 +40,7 @@ public class HGSC004A extends DaoEPBase {
public static final String FIELD_product_name = "productName"; /* 产品名称*/
public static final String FIELD_product_type = "productType"; /* 产品type*/
public static final String FIELD_invent_type = "inventType"; /* 档案类型*/
public static final String FIELD_spec = "spec"; /* 规格*/
public static final String FIELD_length = "length"; /* 长*/
public static final String FIELD_width = "width"; /* 宽*/
public static final String FIELD_thick = "thick"; /* 厚*/
......@@ -125,6 +126,7 @@ public class HGSC004A extends DaoEPBase {
private String productName = " "; /* 产品名称*/
private String productType = " "; /* 产品类型*/
private String inventType = " "; /* 档案类型*/
private String spec = " ";
private BigDecimal length = new BigDecimal("0"); /* 长*/
private BigDecimal width = new BigDecimal("0"); /* 宽*/
private BigDecimal thick = new BigDecimal("0"); /* 厚*/
......@@ -225,17 +227,17 @@ public class HGSC004A extends DaoEPBase {
eiColumn = new EiColumn(FIELD_product_code);
eiColumn.setFieldLength(32);
eiColumn.setDescName("产品编号");
eiColumn.setDescName("存货编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_product_name);
eiColumn.setFieldLength(50);
eiColumn.setDescName("产品名称");
eiColumn.setDescName("存货名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_product_type);
eiColumn.setFieldLength(32);
eiColumn.setDescName("产品类型");
eiColumn.setDescName("存货类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_invent_type);
......@@ -243,6 +245,11 @@ public class HGSC004A extends DaoEPBase {
eiColumn.setDescName("档案类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_spec);
eiColumn.setFieldLength(96);
eiColumn.setDescName("规格");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_length);
eiColumn.setType("N");
eiColumn.setScaleLength(3);
......@@ -840,6 +847,14 @@ public class HGSC004A extends DaoEPBase {
this.thick = thick;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
/**
* get the value from Map.
*
......@@ -866,6 +881,7 @@ public class HGSC004A extends DaoEPBase {
setProductId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_product_id)), productId));
setProductType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_product_type)), productType));
setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_invent_type)), inventType));
setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_spec)), spec));
setLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_length)), length));
setWidth(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_width)), width));
setThick(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_thick)), thick));
......@@ -909,6 +925,7 @@ public class HGSC004A extends DaoEPBase {
map.put(FIELD_product_id, StringUtils.toString(productId, eiMetadata.getMeta(FIELD_product_id)));
map.put(FIELD_product_type, StringUtils.toString(productType, eiMetadata.getMeta(FIELD_product_type)));
map.put(FIELD_invent_type, StringUtils.toString(inventType, eiMetadata.getMeta(FIELD_invent_type)));
map.put(FIELD_spec, StringUtils.toString(spec, eiMetadata.getMeta(FIELD_spec)));
map.put(FIELD_length, StringUtils.toString(length, eiMetadata.getMeta(FIELD_length)));
map.put(FIELD_width, StringUtils.toString(width, eiMetadata.getMeta(FIELD_width)));
map.put(FIELD_thick, StringUtils.toString(thick, eiMetadata.getMeta(FIELD_thick)));
......
......@@ -18,6 +18,7 @@
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
invent_type as "inventType", <!-- 档案类型 -->
spec as "spec", <!-- 规格 -->
length as "length", <!-- 长 -->
width as "width", <!-- 宽 -->
thick as "thick", <!-- 厚 -->
......@@ -84,6 +85,9 @@
<isNotEmpty prepend=" AND " property="inventType">
invent_type = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="quantity">
quantity = #quantity#
</isNotEmpty>
......@@ -199,6 +203,7 @@
a.product_code as "productCode", <!-- 产品编号 -->
a.product_name as "productName", <!-- 产品名称 -->
a.invent_type as "inventType", <!-- 档案类型 -->
a.spec as "spec",
a.length as "length", <!-- 长 -->
a.width as "width", <!-- 宽 -->
a.thick as "thick", <!-- 厚 -->
......@@ -295,6 +300,7 @@
updated_by, <!-- 更新人 -->
updated_name, <!-- 修改人名称 -->
updated_time, <!-- 更新时间 -->
spec, <!-- 规格 -->
length, <!-- 长 -->
width, <!-- 宽 -->
thick <!-- 厚 -->
......@@ -303,7 +309,7 @@
#parentProdCode#, #parentProdName#,#leaf#,#sort#,#lv#, #materialId#, #productId#,#productType#,
#productCode#, #productName#,#inventType#, #productStatus#, #changeType#, #quantity#, #singleWeight#, #totalWeight#,
#approvalStatus#, #accountCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#,
#updatedName#, #updatedTime#, #length#, #width#, #thick#)
#updatedName#, #updatedTime#, #spec#, #length#, #width#, #thick#)
<selectKey resultClass="java.lang.Long" keyProperty="id">
SELECT MAX(ID) FROM ${hggpSchema}.HGSC004A
</selectKey>
......@@ -333,6 +339,7 @@
product_code = #productCode#, <!-- 产品编号 -->
product_name = #productName#, <!-- 产品名称 -->
invent_type = #inventType#, <!-- 档案类型 -->
spec = #spec#,
length = #length#, <!-- 长 -->
width = #width#, <!-- 宽 -->
thick = #thick#, <!-- 厚 -->
......
......@@ -330,16 +330,12 @@ public class HGSCTools {
hgsc004a.setCompanyName(results.get(0).getCompanyName());
hgsc004a.setDepCode(results.get(0).getDepCode());
hgsc004a.setDepName(results.get(0).getDepName());
if (hgsc004a.getLv()==3){
if (hgsc004a.getParentProdCode().trim().isEmpty()){
hgsc004a.setParentProdCode(results.get(0).getProjCode());
hgsc004a.setParentProdName(results.get(0).getProjName());
hgsc004a.setMaterialId(results.get(0).getId());
checkSaveData(hgsc004a);
}else if (hgsc004a.getLv()==4){
if (hgsc004a.getParentProdCode().trim().length()==0){
AssertUtils.isTrue(true, "层级为4级,父节点-产品编号不能为空!");
}
hgsc004a.setLv(3);
}else{
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("companyCode", hgsc004a.getCompanyCode());
paramMap.put("projCode", hgsc004a.getProjCode());
......@@ -348,11 +344,9 @@ public class HGSCTools {
List<HGSC004A> hgsc004aList = list(paramMap);
AssertUtils.isEmpty(hgsc004aList, String.format("父节点-产品编号[%s]数据不存在,导入失败!",hgsc004a.getParentProdCode()));
hgsc004a.setMaterialId(results.get(0).getId());
checkSaveData(hgsc004a);
}else {
AssertUtils.isTrue(true, "层级不能为空!");
hgsc004a.setLv(4);
}
checkSaveData(hgsc004a);
addEntity(hgsc004a);
}
......
......@@ -126,10 +126,10 @@ $(function() {
eiInfo.set("fileName", src);
EiCommunicator.send("HGPZ005", "importDate", eiInfo, {
onSuccess(ei) {
if (notIsExcelFile) {
/*if (notIsExcelFile) {
NotificationUtil("请导入xls或xlsx文件", "error");
return;
}
}*/
if (ei.status == "-1") {
NotificationUtil(
{msg: ei.msg, detailMsg: ei.detailMsg}, "error");
......
......@@ -254,6 +254,7 @@ $(function () {
resultGrid.setCellValue(e.items[0],"width",productCodeBox[i]['param4Field']);
resultGrid.setCellValue(e.items[0],"thick",productCodeBox[i]['param5Field']);
resultGrid.setCellValue(e.items[0],"productType",productCodeBox[i]['param6Field']);
resultGrid.setCellValue(e.items[0],"spec",productCodeBox[i]['param7Field']);
}
}
}
......
......@@ -55,6 +55,7 @@
</EF:EFComboColumn>
<EF:EFColumn ename="productCode" required="true" cname="产品编号" />
<EF:EFColumn ename="productName" cname="产品名称" width="120" align="center" enable="false"/>
<EF:EFColumn ename="spec" cname="规格" width="100" align="right" format="{0:N2}" maxLength="10" enable="false"/>
<EF:EFColumn ename="length" cname="长(MM)" width="100" align="right" format="{0:N2}" maxLength="10" enable="false"/>
<EF:EFColumn ename="width" cname="宽(MM)" width="100" align="right" format="{0:N2}" maxLength="10" enable="false"/>
<EF:EFColumn ename="thick" cname="厚(MM)" width="100" align="right" format="{0:N2}" maxLength="10" enable="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