Browse Source

发票毛重净重列

java8
han\hanst 8 months ago
parent
commit
ce7ce11009
  1. 5
      src/main/java/com/xujie/sys/common/utils/ExcelTemplate.java
  2. 5
      src/main/java/com/xujie/sys/modules/ecss/mapper/CoDelMapper.java
  3. 13
      src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java
  4. 40
      src/main/resources/mapper/ecss/CoDelMapper.xml
  5. 2
      src/main/resources/mapper/ecss/EcssCommonMapper.xml
  6. BIN
      src/main/resources/templates/declaration-all-showWeight-template-pdf.xlsx
  7. BIN
      src/main/resources/templates/declaration-all-showWeight-template.xlsx
  8. BIN
      src/main/resources/templates/declaration-all-template-pdf.xlsx
  9. BIN
      src/main/resources/templates/declaration-all2-template.xlsx

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

@ -37,6 +37,9 @@ public class ExcelTemplate {
// 价格靠右 发票
@Setter
private boolean priceRight = false;
// 价格靠右 发票
@Setter
private boolean invoiceLie = false;
// 数字靠右 箱单
@Setter
private boolean intRight = false;
@ -308,7 +311,7 @@ public class ExcelTemplate {
style2.setWrapText(true);
c2.setCellStyle(style2);
if (priceRight) { //仅供发票excel使用第678是价格列居右
for (int i = 6; i < 11; i++) {
for (int i = 6; i < (invoiceLie?11:9); i++) {
XSSFRow row = sheet.getRow(dtlRow);
if (row == null) {
continue;

5
src/main/java/com/xujie/sys/modules/ecss/mapper/CoDelMapper.java

@ -179,6 +179,11 @@ public interface CoDelMapper {
List<Map> getCoDelPalletDetailGroupByPn(EcssCoDelNotifyHeaderData data);
/**
* 按发货通知单明细item_no分组获取装箱明细用于Invoice显示重量
*/
List<Map> exportCoDelPalletDetailGroupByItemNo(EcssCoDelNotifyHeaderData data);
List<Map> exportCoDelBoxList(EcssCoDelNotifyHeaderData data);
void updateEcssDeclarationHeader(EcssDeclarationHeaderData data);

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

@ -2237,7 +2237,7 @@ public class CoDelServiceImpl implements CoDelService {
// 设置纸张大小A4
pageSetup.setPaperSize(PaperSizeType.PAPER_A_4);
// 设置缩放比例
pageSetup.setZoom(90);
pageSetup.setZoom(85);
// 设置边距
pageSetup.setLeftMargin(0.5);
pageSetup.setRightMargin(0.5);
@ -2430,6 +2430,7 @@ public class CoDelServiceImpl implements CoDelService {
template.setRangeStyle(true);
template.setPriceRight(true);
template.setMoveSeal(true);
template.setInvoiceLie(data.getShowWeight() != null && data.getShowWeight());
template.addVar("remark", stringInput(data.getFpremark()));
template.addVar("localShipper", notifyHeader.getCustomerName());
template.addVar("localShipAddress", notifyHeader.getLocalShipAddress());
@ -2456,9 +2457,9 @@ public class CoDelServiceImpl implements CoDelService {
template.addVar("shippingMode", stringInput(notifyHeader.getShippingMode()));
Map<String, EcssCoDelNotifyDetailData> notifyDetailMap = notifyDetailList.stream().collect(
Collectors.toMap(EcssCoDelNotifyDetailData::getPartNo,e->e));
// 装箱明细
List<Map> palletDetailList = coDelMapper.exportCoDelPalletDetail(notifyHeader);
Map<Object, Map> palletMap = palletDetailList.stream().collect(Collectors.toMap( o -> o.get("part_no"), o -> o));
// 装箱明细 - 按发货通知单明细item_no分组用于获取每行的重量
List<Map> palletDetailList = coDelMapper.exportCoDelPalletDetailGroupByItemNo(notifyHeader);
Map<Object, Map> palletMap = palletDetailList.stream().collect(Collectors.toMap( o -> o.get("item_no"), o -> o));
// 装箱数据
List<EcssCoDelPalletHeaderData> palletHeaderDataList = coDelMapper.searchEcssCoDelPalletHeaderData(notifyHeader);// 总托数
int totalPlt = palletHeaderDataList.isEmpty()?0:palletHeaderDataList.get(0).getPalletQty();
@ -2476,9 +2477,11 @@ public class CoDelServiceImpl implements CoDelService {
for (int i = 0; i < ndList.size(); i++) {
Map eorder = ndList.get(i);
String partNo = (String) eorder.get("part_no");
Integer itemNo = eorder.get("item_no") != null ? (Integer) eorder.get("item_no") : null;
eorder.put("row_num", i + 1);
EcssCoDelNotifyDetailData nodifyData = notifyDetailMap.get(partNo);
Map pm = palletMap.get(partNo);
// 根据item_no获取该明细行对应的装箱重量
Map pm = itemNo != null ? palletMap.get(itemNo) : null;
int totalQty = pm!=null && pm.get("total_qty")!=null?Integer.parseInt(pm.get("total_qty").toString()):0;
String lossratio = "";
if (nodifyData!=null && nodifyData.getLossratio()!=null && !StringUtils.isBlank(nodifyData.getLossratio())) {

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

@ -917,6 +917,46 @@ left join ecss_CoDelNotifyHeader noHeader on a.site=noHeader.site and a.delNo=no
GROUP BY pn
</select>
<!-- 按发货通知单明细item_no分组获取装箱明细重量(用于Invoice) -->
<select id="exportCoDelPalletDetailGroupByItemNo" resultType="java.util.Map">
-- 按发货通知单明细行号分组,汇总该行对应的装箱重量
WITH BoxDetail AS (
SELECT
b.notify_detail_item_no,
b.part_no,
b.qty,
b.rolls,
a.box_qty,
a.net_weight,
a.gross_weight,
b.site,
b.bu_no,
b.delNo,
b.seq_no,
-- 计算该零件数量占该箱子总数量的比例
CASE
WHEN SUM(b.qty) OVER (PARTITION BY b.site, b.bu_no, b.delNo, b.seq_no) > 0
THEN b.qty * 1.0 / SUM(b.qty) OVER (PARTITION BY b.site, b.bu_no, b.delNo, b.seq_no)
ELSE 0
END as qtyRatio
FROM ecss_CoDelBoxList a
LEFT JOIN ecss_CoDelPalletDetail b ON a.site=b.site AND a.bu_no=b.bu_no AND a.delNo=b.delNo AND a.item_no=b.seq_no
WHERE a.site=#{site} AND a.bu_no=#{buNo} AND a.delNo=#{delNo} AND b.notify_detail_item_no IS NOT NULL
)
SELECT
notify_detail_item_no as item_no,
part_no,
CONVERT(DECIMAL(20, 0), SUM(qty)) as total_qty,
CONVERT(DECIMAL(20, 0), SUM(DISTINCT box_qty)) as box_qty,
CONVERT(DECIMAL(20, 0), SUM(rolls)) as rolls,
-- 按数量比例分配净重和毛重
CONVERT(DECIMAL(20, 2), SUM(ISNULL(net_weight, 0) * qtyRatio)) as net_weight,
CONVERT(DECIMAL(20, 2), SUM(ISNULL(gross_weight, 0) * qtyRatio)) as gross_weight,
CONVERT(DECIMAL(20, 0), SUM(rolls * qty)) as qty_per_carton
FROM BoxDetail
GROUP BY notify_detail_item_no, part_no
</select>
<select id="exportCoDelBoxList" resultType="java.util.Map">
select CONVERT(DECIMAL(20, 0),sum(a.box_qty)) as box_qty
from ecss_CoDelBoxList a

2
src/main/resources/mapper/ecss/EcssCommonMapper.xml

@ -55,7 +55,7 @@
</select>
<select id="searchEcssCoDelNotifyDetailList" resultType="java.util.Map">
select a.customerPO,a.part_no,a.part_description,a.currency,
select a.item_no,a.customerPO,a.part_no,a.part_description,a.currency,
CONVERT(DECIMAL(20, 0), a.qty) as qty,CONVERT(DECIMAL(20, 5), a.tp) as unitPrice,b.hsCode,
a.upc,a.so,a.ttl_amount,a.pn,h.hsCodeDesc,h.hsCodeDescEn,a.cmc_comment,
CASE WHEN a.modifyFlag = 1 THEN '是' ELSE '否' END AS modifyFlag

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

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

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

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

Loading…
Cancel
Save