Browse Source

毛重净重计算

java8
han\hanst 3 months ago
parent
commit
e009cce508
  1. 28
      src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java
  2. 18
      src/main/resources/mapper/ecss/CoDelMapper.xml

28
src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java

@ -2944,12 +2944,12 @@ public class CoDelServiceImpl implements CoDelService {
totalQty = totalQty + detailData.getQty().intValue();
}
BigDecimal boxWeight = BigDecimal.valueOf(propertiesBoxWeight.getNumValue());// 箱的重量
// Total Qty / 每箱EA
/* // Total Qty / 每箱EA
BigDecimal noCartons = BigDecimal.valueOf(totalQty/((double) propertiesRollQty.getNumValue().intValue() * propertiesBoxRolls.getNumValue().intValue()));
// 箱重量物料维护里取
BigDecimal grossWeight = noCartons.multiply(boxWeight);
// Net Weight = Gross Weight - No of Cartons/2
BigDecimal netWeight = grossWeight.subtract(noCartons.divide(BigDecimal.valueOf(2)));
BigDecimal netWeight = grossWeight.subtract(noCartons.divide(BigDecimal.valueOf(2)));*/
List<EcssCoDelNotifyDetailData> details = palletListMap.getOrDefault(partNo, Collections.emptyList());
for (EcssCoDelNotifyDetailData detailData : details) {
// 每箱 EA = 每卷数量 * 每箱卷数
@ -2987,8 +2987,11 @@ public class CoDelServiceImpl implements CoDelService {
boxListData.setBuNo(inData.getBuNo());
boxListData.setDelNo(inData.getDelNo());
boxListData.setItemNo(seqNo);
boxListData.setGrossWeight(grossWeight);
boxListData.setNetWeight(netWeight);
// 根据实际箱数计算毛重和净重
BigDecimal boxGrossWeight = wholeBoxes.multiply(boxWeight);
BigDecimal boxNetWeight = boxGrossWeight.subtract(wholeBoxes.divide(BigDecimal.valueOf(2)));
boxListData.setGrossWeight(boxGrossWeight);
boxListData.setNetWeight(boxNetWeight);
boxListData.setBoxQty(wholeBoxes);
boxListData.setCreateBy(currentUser.getUsername());
coDelMapper.saveCodelBoxList(boxListData);
@ -3020,8 +3023,11 @@ public class CoDelServiceImpl implements CoDelService {
boxListData.setBuNo(inData.getBuNo());
boxListData.setDelNo(inData.getDelNo());
boxListData.setItemNo(seqNo);
boxListData.setGrossWeight(grossWeight);
boxListData.setNetWeight(netWeight);
// 零数箱按1箱计算毛重和净重
BigDecimal boxGrossWeight = BigDecimal.ONE.multiply(boxWeight);
BigDecimal boxNetWeight = boxGrossWeight.subtract(BigDecimal.ONE.divide(BigDecimal.valueOf(2)));
boxListData.setGrossWeight(boxGrossWeight);
boxListData.setNetWeight(boxNetWeight);
boxListData.setBoxQty(BigDecimal.ONE);
boxListData.setCreateBy(currentUser.getUsername());
coDelMapper.saveCodelBoxList(boxListData);
@ -3048,14 +3054,18 @@ public class CoDelServiceImpl implements CoDelService {
} else {
// 不显示零数箱直接进一
BigDecimal actualBoxQty = detailData.getQty().divide(eaPerBox, 0, RoundingMode.UP);
EcssCoDelBoxListData boxListData = new EcssCoDelBoxListData();
boxListData.setSite(inData.getSite());
boxListData.setBuNo(inData.getBuNo());
boxListData.setDelNo(inData.getDelNo());
boxListData.setItemNo(seqNo);
boxListData.setGrossWeight(grossWeight);
boxListData.setNetWeight(netWeight);
boxListData.setBoxQty(detailData.getQty().divide(eaPerBox, 0, RoundingMode.UP));
// 根据实际箱数计算毛重和净重
BigDecimal boxGrossWeight = actualBoxQty.multiply(boxWeight);
BigDecimal boxNetWeight = boxGrossWeight.subtract(actualBoxQty.divide(BigDecimal.valueOf(2)));
boxListData.setGrossWeight(boxGrossWeight);
boxListData.setNetWeight(boxNetWeight);
boxListData.setBoxQty(actualBoxQty);
boxListData.setCreateBy(currentUser.getUsername());
coDelMapper.saveCodelBoxList(boxListData);

18
src/main/resources/mapper/ecss/CoDelMapper.xml

@ -548,8 +548,8 @@ create_by,create_date,update_by,update_date
<select id="getDefaultEcssDeclarationDetailData" resultType="EcssDeclarationDetailData">
select #{site} as site, b.hsCode,b.hsCodeDesc as hsCodeDesc,sum(a.qty) as qty,sum(distinct c.Net_Weight) as NetWeight
,'CNY' as currency,'中国' as madeArea,#{destination} as destination,'南通其他' as sourceArea ,'照章征免' as levy from
ecss_CoDelPalletDetail a left join part b on a.site=b.site and a.part_no=b.part_no
,'CNY' as currency,'中国' as madeArea,#{destination} as destination,'南通其他' as sourceArea ,'照章征免' as levy
from ecss_CoDelPalletDetail a left join part b on a.site=b.site and a.part_no=b.part_no
left join ecss_CoDelBoxList c on a.site=c.site and a.delNo=c.delNo and a.seq_no=c.item_no
where a.site =#{site} and a.delNo=#{delNo}
GROUP BY b.hsCodeDesc,b.hsCode
@ -1170,7 +1170,7 @@ left join ecss_CoDelNotifyHeader noHeader on a.site=noHeader.site and a.delNo=no
);
</delete>
<select id="selectPalletDetailList" resultType="java.util.Map">
<!--<select id="selectPalletDetailList" resultType="java.util.Map">
select a.*,b.part_description,b.hsCode,b.upc,b.so
from ecss_CoDelPalletDetail a left join (
select a.site,a.bu_no,a.delNo,a.part_no,a.part_description,b.hsCode,a.upc,a.so,a.customerPO
@ -1184,6 +1184,18 @@ left join ecss_CoDelNotifyHeader noHeader on a.site=noHeader.site and a.delNo=no
and a.seq_no=#{seqNo}
</if>
order by a.notify_detail_item_no
</select>-->
<select id="selectPalletDetailList" resultType="java.util.Map">
select a.*,b.part_description,c.hsCode,b.upc,b.so
from ecss_CoDelPalletDetail a
left join ecss_CoDelNotifydetail b on a.site=b.site and a.bu_no=b.bu_no and a.delNo=b.delNo and a.notify_detail_item_no=b.item_no
left join part c on a.site=c.site and a.part_no=c.part_no
where a.site =#{site} and a.bu_no=#{buNo} and a.delNo=#{delNo}
<if test="seqNo != null and seqNo != ''">
and a.seq_no=#{seqNo}
</if>
order by a.notify_detail_item_no
</select>
<!-- 获取客户模板列表 -->

Loading…
Cancel
Save