Commit 9710629d by liuyang

2024-04-26 采购申请对输入校验和计划数量计算优化

parent 79327b79
......@@ -30,6 +30,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
......@@ -264,15 +265,24 @@ public class ServiceHPCG001 extends ServiceEPBase {
}
}
}
hpcg002a.setPlanAmount(hpcg002a.getApplyAmount().subtract(applyAmount));
BigDecimal planWeight = hpcg002a.getApplyAmount().subtract(applyAmount).multiply(hpcg002a.getApplyUnitWeight()).divide(new BigDecimal("1000"),3,BigDecimal.ROUND_UP);
hpcg002a.setPlanWeight(planWeight);
//判断库存数和申请数
int result = applyAmount.compareTo(hpcg002a.getApplyAmount());
BigDecimal planAmount = BigDecimal.ZERO;
BigDecimal planWeight = BigDecimal.ZERO;
BigDecimal value = BigDecimal.ZERO;
if (result > 0) {
//库存数大于申请数
value = applyAmount.subtract(hpcg002a.getApplyAmount());
planAmount = applyAmount.subtract(hpcg002a.getApplyAmount());
planWeight = applyAmount.subtract(hpcg002a.getApplyAmount()).multiply(hpcg002a.getApplyUnitWeight()).divide(new BigDecimal("1000"),3,RoundingMode.UP);
}else if (result < 0){
//申请数大于库存数
planAmount = hpcg002a.getApplyAmount().subtract(applyAmount);
planWeight = hpcg002a.getApplyAmount().subtract(applyAmount).multiply(hpcg002a.getApplyUnitWeight()).divide(new BigDecimal("1000"),3,RoundingMode.UP);
}
hpcg002a.setPlanAmount(planAmount);
hpcg002a.setPlanWeight(planWeight);
for (HPKC010 hpkc010 : hpkc010List) {
if ( hpkc010.getFactoryCode().equals(hpcg002a.getFactoryCode())
&& hpkc010.getInventRecordId().equals(hpcg002a.getInventRecordId())
......
......@@ -156,7 +156,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
PRO_APPLY_DATE desc,PRO_APPLY_STATUS asc,FACTORY_CODE asc
PRO_APPLY_DATE desc,CREATED_TIME desc,PRO_APPLY_STATUS asc,FACTORY_CODE asc
</isEmpty>
</dynamic>
......
......@@ -74,13 +74,23 @@
<EF:EFColumn ename="inventName" cname="存货名称" width="150" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" width="120" align="center" readonly="true" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" readonly="true"/>
<EF:EFColumn ename="applyAmount" cname="申请数量" format="{0:N0}" maxLength="20" width="100" align="right" required="true"/>
<EF:EFColumn ename="applyAmount" cname="申请数量" format="{0:N0}" width="100" align="right"
data-regex="/^-?[0-9]{1,15}?$/" maxLength="15" required="true"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
<EF:EFColumn ename="unitWeight" cname="单重(KG)" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="总重(T)" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="length" cname="长(MM)" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="width" cname="宽(MM)" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="thick" cname="厚(MM)" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="coefficient" cname="系数" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="length" cname="长(MM)" width="80" align="right" format="{0:N3}" readonly="true"
data-regex="/^-?[0-9]{1,12}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置12位整数和3位小数!"/>
<EF:EFColumn ename="width" cname="宽(MM)" width="80" align="right" format="{0:N3}" readonly="true"
data-regex="/^-?[0-9]{1,12}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置12位整数和3位小数!"/>
<EF:EFColumn ename="thick" cname="厚(MM)" width="80" align="right" format="{0:N3}" readonly="true"
data-regex="/^-?[0-9]{1,12}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置12位整数和3位小数!"/>
<EF:EFColumn ename="coefficient" cname="系数" width="80" align="right" format="{0:N3}" readonly="true"
data-regex="/^-?[0-9]{1,12}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置12位整数和3位小数!"/>
<EF:EFColumn ename="material" cname="材质" width="80" align="center" readonly="true"/>
<EF:EFColumn ename="unit" cname="单位" width="80" align="center" readonly="true"/>
<EF:EFColumn ename="remark" cname="备注" width="150"/>
......
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