Browse Source

托盘重量

java8
han\hanst 4 months ago
parent
commit
58cf9edc62
  1. 16
      src/main/java/com/xujie/sys/common/utils/ExcelTemplate.java
  2. 1
      src/main/java/com/xujie/sys/modules/ecss/entity/EcssPallet.java
  3. 56
      src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java
  4. 9
      src/main/resources/mapper/ecss/CoDelMapper.xml
  5. BIN
      src/main/resources/templates/declaration-all-seal-template.xlsx
  6. BIN
      src/main/resources/templates/declaration-all-template.xlsx
  7. BIN
      src/main/resources/templates/declaration-invoice-seal-template.xlsx
  8. BIN
      src/main/resources/templates/declaration-invoice-template.xlsx
  9. BIN
      src/main/resources/templates/declaration-packingList-template.xlsx

16
src/main/java/com/xujie/sys/common/utils/ExcelTemplate.java

@ -157,11 +157,17 @@ public class ExcelTemplate {
XSSFDrawing drawing = (XSSFDrawing) part;
List<XSSFShape> shapes = drawing.getShapes();
for (XSSFShape shape : shapes) {
XSSFPicture simpleShape = (XSSFPicture) shape;
ClientAnchor anchor = (ClientAnchor) simpleShape.getAnchor();
// 调整行坐标实现下移
anchor.setRow1(anchor.getRow1() + listVariables.size() - 1);
anchor.setRow2(anchor.getRow2() + listVariables.size() - 1);
// 只处理图片类型的形状
if (shape instanceof XSSFPicture) {
XSSFPicture picture = (XSSFPicture) shape;
// 调整行坐标实现下移
ClientAnchor anchor = (ClientAnchor) picture.getAnchor();
if (anchor.getRow1() > 10) { // 只下移位于10行之后的图片
anchor.setRow1(anchor.getRow1() + listVariables.size() - 1);
anchor.setRow2(anchor.getRow2() + listVariables.size() - 1);
}
}
}
}
}

1
src/main/java/com/xujie/sys/modules/ecss/entity/EcssPallet.java

@ -27,6 +27,7 @@ public class EcssPallet extends QueryPage {
private BigDecimal width;
private BigDecimal height;
private String applicationArea;
private BigDecimal palletWeight;
/**
*

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

@ -1693,6 +1693,13 @@ public class CoDelServiceImpl implements CoDelService {
eorder.put("net_weight", "");
eorder.put("weight_unit", "");
}
if (eorder.get("currency") != null) {
String currency = stringInput((String) eorder.get("currency"));
if (currency.toUpperCase().startsWith("RMB")) {
currency = "CNY";
}
eorder.put("currency", currency);
}
eorder.put("hs_code_desc", eorder.get("hs_code_desc"));
}
template.addListVarAll(detailList);
@ -1769,6 +1776,7 @@ public class CoDelServiceImpl implements CoDelService {
template.setCellStyle(true);
template.setRangeStyle(true);
template.setPriceRight(true);
template.setMoveSeal(true);
template.addVar("remark", stringInput(data.getFpremark()));
template.addVar("localShipper", notifyHeader.getCustomerName());
template.addVar("localShipAddress", notifyHeader.getLocalShipAddress());
@ -1778,7 +1786,19 @@ public class CoDelServiceImpl implements CoDelService {
template.addVar("cmc_invoice", notifyHeader.getCmcInvoice());
template.addVar("dateStr", DateUtils.format(notifyHeader.getReadyDate(), "yyyy-MM-dd"));
List<Map> detailList = coDelMapper.exportEcssCoDelNotifyDetail(data);
template.addVar("Currency", detailList.isEmpty()?"CNY":detailList.get(0).get("currency"));
String currency = "CNY";
if (!detailList.isEmpty()) {
Object cur = detailList.get(0).get("currency");
if (cur != null) {
String curStr = cur.toString().trim();
if (curStr.toUpperCase().startsWith("RMB")) {
currency = "CNY";
} else {
currency = curStr;
}
}
}
template.addVar("Currency", currency);
template.addVar("Incoterm", "EXW ");
template.addVar("shippingMode", stringInput(notifyHeader.getShippingMode()));
Map<String, EcssCoDelNotifyDetailData> notifyDetailMap = notifyDetailList.stream().collect(
@ -1872,6 +1892,7 @@ public class CoDelServiceImpl implements CoDelService {
Collectors.toMap(EcssCoDelNotifyDetailData::getPartNo,e->e));
template.setCellStyle(true);
template.setRangeStyle(true);
template.setMoveSeal(true);
if (notifyHeader.getBuNo().equals("03-RFID") || notifyHeader.getBuNo().equals("01-Label")){
template.setCellStyle2(true);
}
@ -1965,8 +1986,22 @@ public class CoDelServiceImpl implements CoDelService {
grossWeight = grossWeight.add(list.get(m).get("gross_weight") !=null?new BigDecimal(list.get(m).get("gross_weight").toString()):BigDecimal.valueOf(0.0));
netWeight = netWeight.add(list.get(m).get("net_weight") !=null?new BigDecimal(list.get(m).get("net_weight").toString()):BigDecimal.valueOf(0.0));
}
// 托盘重量=总托数*维护参数
BigDecimal palletWeight = data.getPalletWeight()!=null? data.getPalletWeight().multiply(BigDecimal.valueOf(totalPlt)):BigDecimal.valueOf(0.0);
// 托盘重量=根据每个pallet的重量*数量累加
BigDecimal palletWeight = BigDecimal.ZERO;
for (EcssCoDelPalletHeaderData palletHeader : palletHeaderDataList) {
if (palletHeader.getPallet() != null && !palletHeader.getPallet().isEmpty()) {
// 根据pallet编号查询EcssPallet信息
List<EcssPalletData> palletDataList = coDelMapper.getPallet(notifyHeader.getSite(), notifyHeader.getBuNo(), palletHeader.getPallet());
if (!palletDataList.isEmpty()) {
EcssPalletData palletData = palletDataList.get(0);
if (palletData.getPalletWeight() != null && palletHeader.getPalletQty() != null) {
// 栈板重量 = 单个栈板重量 * 数量
BigDecimal singlePalletWeight = palletData.getPalletWeight().multiply(BigDecimal.valueOf(palletHeader.getPalletQty()));
palletWeight = palletWeight.add(singlePalletWeight);
}
}
}
}
template.addVar("Total_Cartons", totalCartons.setScale(0, RoundingMode.HALF_UP));
template.addVar("Gross_Weight", grossWeight.setScale(2, RoundingMode.HALF_UP));
template.addVar("Net_Weight", netWeight.setScale(2, RoundingMode.HALF_UP));
@ -1978,7 +2013,11 @@ public class CoDelServiceImpl implements CoDelService {
// 下面是可选的或者手动维护的
// RFID需要的
if (notifyHeader.getBuNo().equals("01-Label") || notifyHeader.getBuNo().equals("03-RFID")) {
template.addVar("total_plt", totalPlt);
String plt = "CTN";
if (!palletHeaderDataList.isEmpty()) {
plt = "PLT";
}
template.addVar("total_plt", totalPlt+plt);
template.addVar("total:", "total:");
template.addVar("madein", stringInput(data.getOrigin()));
template.addVar("shippingNo", "shipping no");
@ -2064,7 +2103,11 @@ public class CoDelServiceImpl implements CoDelService {
template.addVar("cmc_invoice", stringInput(notifyHeader.getCmcInvoice()));
// 导出时默认可编辑的栏目
template.addVar("sales_method", stringInput(data.getSalesMethod()));//贸易方式
template.addVar("currency", stringInput(data.getCurrency()));//币制
String currency = stringInput(data.getCurrency());
if (currency.toUpperCase().startsWith("RMB")) {
currency = "CNY";
}
template.addVar("currency", currency);//币制
template.addVar("made_area", stringInput(data.getMadeArea()));//货物产地
template.addVar("send_port", stringInput(data.getSendPort()));//发货港
template.addVar("shipper", stringInput(data.getShipper()));//发货人
@ -2309,6 +2352,7 @@ public class CoDelServiceImpl implements CoDelService {
wholeBoxData.setQty(wholeBoxQty); // 整箱数量
wholeBoxData.setBoxQty(wholeBoxes);
wholeBoxData.setRolls(wholeBoxQty.divide(BigDecimal.valueOf(propertiesRollQty.getNumValue()), 4, RoundingMode.HALF_UP));
wholeBoxData.setNotifyDetailItemNo(detailData.getItemNo());
coDelMapper.saveCodelPalletDetail(wholeBoxData);
seqNo++;
}
@ -2341,6 +2385,7 @@ public class CoDelServiceImpl implements CoDelService {
remainderBoxData.setQty(remainderQty);
remainderBoxData.setBoxQty(BigDecimal.ONE);
remainderBoxData.setRolls(remainderQty.divide(BigDecimal.valueOf(propertiesRollQty.getNumValue()), 4, RoundingMode.HALF_UP));
remainderBoxData.setNotifyDetailItemNo(detailData.getItemNo());
coDelMapper.saveCodelPalletDetail(remainderBoxData);
seqNo++;
}
@ -2373,6 +2418,7 @@ public class CoDelServiceImpl implements CoDelService {
palletDetailData.setQty(detailData.getQty());
palletDetailData.setBoxQty(detailData.getQty().divide(eaPerBox, 0, RoundingMode.UP));
palletDetailData.setRolls(detailData.getQty().divide(BigDecimal.valueOf(propertiesRollQty.getNumValue()), 4, RoundingMode.HALF_UP));
palletDetailData.setNotifyDetailItemNo(detailData.getItemNo());
coDelMapper.saveCodelPalletDetail(palletDetailData);
seqNo++;
}

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

@ -621,7 +621,7 @@ left join ecss_CoDelNotifyHeader noHeader on a.site=noHeader.site and a.delNo=no
<select id="searchPalletData" resultType="EcssPalletData">
select a.id,a.Site,a.BuNo,a.pallet_type as palletType,a.Remark,a.CreateBy,a.CreateDate,a.UpdateBy,a.UpdateDate,
a.length, a.width, a.height, a.application_area as applicationArea
a.length, a.width, a.height, a.application_area as applicationArea, a.pallet_weight as palletWeight
,dbo.get_bu_desc(a.site,a.BuNo) as BuDesc,a.pallet_no as palletNo
from ecss_pallet a
left join accessBu D on A.site=D.site and A.BuNo=d.bu_no and D.username=#{query.username}
@ -639,16 +639,16 @@ left join ecss_CoDelNotifyHeader noHeader on a.site=noHeader.site and a.delNo=no
<insert id="insertPalletData" >
insert into ecss_pallet (Site,BuNo,pallet_type,Remark,CreateBy,CreateDate,length,width,
height,application_area,pallet_no)
height,application_area,pallet_weight,pallet_no)
values(#{site},#{buNo},#{palletType},#{remark},#{createBy},GetDate(),#{length},#{width},
#{height},#{applicationArea},#{palletNo})
#{height},#{applicationArea},#{palletWeight},#{palletNo})
</insert>
<update id="updatePalletData">
update ecss_pallet set Remark=#{remark} ,pallet_type=#{palletType} ,
length=#{length} ,width=#{width} ,
height=#{height} ,application_area=#{applicationArea} ,
pallet_no=#{palletNo},
pallet_weight=#{palletWeight} ,pallet_no=#{palletNo},
UpdateDate=GetDate(),UpdateBy=#{updateBy}
where site=#{site} and buNo=#{buNo} and id=#{id}
</update>
@ -1140,6 +1140,7 @@ left join ecss_CoDelNotifyHeader noHeader on a.site=noHeader.site and a.delNo=no
<if test="seqNo != null and seqNo != ''">
and a.seq_no=#{seqNo}
</if>
order by a.notify_detail_item_no
</select>
<!-- 获取客户模板列表 -->

BIN
src/main/resources/templates/declaration-all-seal-template.xlsx

BIN
src/main/resources/templates/declaration-all-template.xlsx

BIN
src/main/resources/templates/declaration-invoice-seal-template.xlsx

BIN
src/main/resources/templates/declaration-invoice-template.xlsx

BIN
src/main/resources/templates/declaration-packingList-template.xlsx

Loading…
Cancel
Save