From 48a5679ac45573dbacbae261358ee782dc23e111 Mon Sep 17 00:00:00 2001 From: mzr <1562242162@qq.com> Date: Fri, 7 Mar 2025 10:20:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=80=E5=94=AE=E5=8F=91=E7=A5=A8=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operator/saveCommitAction.java | 124 +++++++++--------- 1 file changed, 64 insertions(+), 60 deletions(-) diff --git a/so/src/public/nccloud/api/so/saleinvoice/operator/saveCommitAction.java b/so/src/public/nccloud/api/so/saleinvoice/operator/saveCommitAction.java index 22687b0..509a3bd 100644 --- a/so/src/public/nccloud/api/so/saleinvoice/operator/saveCommitAction.java +++ b/so/src/public/nccloud/api/so/saleinvoice/operator/saveCommitAction.java @@ -40,7 +40,7 @@ import java.util.Map; @Path("so/saleinvoice/operator") public class saveCommitAction extends AbstractNCCRestResource { - public static String fplxStr = "";// 开票申请发票类型 + public static String fplxStr = "";//开票申请发票类型 public saveCommitAction() { @@ -118,7 +118,7 @@ public class saveCommitAction extends AbstractNCCRestResource { .queryVOByIDs(ids); SaleInvoiceVO saleInvoiceVO22 = saleInvoiceVO[0]; SaleInvoiceHVO saleInvoiceHVO = saleInvoiceVO22.getParentVO(); - // 销售发票审核开始 + //销售发票审核开始 InvocationInfoProxy.getInstance().setUserId(saleInvoiceHVO.getApprover()); CloudPFlowContext context = new CloudPFlowContext(); context.setBillType("32"); @@ -133,7 +133,7 @@ public class saveCommitAction extends AbstractNCCRestResource { IBatchRunScriptService service = (IBatchRunScriptService) NCLocator.getInstance() .lookup(IBatchRunScriptService.class); SCMScriptResultDTO result = service.runBacth(context, SaleInvoiceVO.class); - // 销售发票审核结束 + //销售发票审核结束 TaxInvoiceType typeObj = TaxInvoiceType.SpecialInvoice; SaleInvoiceToTaxInvServiceImpl saleInvoiceToTaxInvService = new SaleInvoiceToTaxInvServiceImpl(); saleInvoiceToTaxInvService.issueTaxInvoice(saleInvoiceVO, typeObj); @@ -173,20 +173,20 @@ public class saveCommitAction extends AbstractNCCRestResource { JSONObject bill = new JSONObject(); // billhead 结构 JSONObject billhead = new JSONObject(); - billhead = originalJson.getJSONObject("billhead");// 传入JSON对象 - billhead.put("pk_org_v", originalJson.getJSONObject("billhead").getString("pk_org"));// 开票组织版本=开票组织 - billhead.put("pk_group", "00");// 集团 + billhead = originalJson.getJSONObject("billhead");//传入JSON对象 + billhead.put("pk_org_v", originalJson.getJSONObject("billhead").getString("pk_org"));//开票组织版本=开票组织 + billhead.put("pk_group", "00");//集团 fplxStr = originalJson.getJSONObject("billhead").getString("vdef22"); - billhead.put("vtrantypecode", "32-02");// 发票类型编码 - billhead.put("cbiztypeid", "SO01");// 业务流程 - billhead.put("approver", "BIP");// 审批人 - billhead.put("fstatusflag", 1);// 单据状态 - billhead.put("billmaker", "BIP");// 制单人 - billhead.put("csendcountryid", "CN");// 发货国家 - billhead.put("crececountryid", "CN");// 收货国家 - billhead.put("ctaxcountryid", "CN");// 报税国家 - // 2025-2-8付业要求修改,根据发票类型Q(自定义档案)对照发票类型 - String ctrantypeidStr = "32-02";// 默认普通发票 + billhead.put("vtrantypecode", "32-02");//发票类型编码 + billhead.put("cbiztypeid", "SO01");//业务流程 + billhead.put("approver", "BIP");//审批人 + billhead.put("fstatusflag", 1);//单据状态 + billhead.put("billmaker", "BIP");//制单人 + billhead.put("csendcountryid", "CN");//发货国家 + billhead.put("crececountryid", "CN");//收货国家 + billhead.put("ctaxcountryid", "CN");//报税国家 + //2025-2-8付业要求修改,根据发票类型Q(自定义档案)对照发票类型 + String ctrantypeidStr = "32-02";//默认普通发票 if (fplxStr != null && fplxStr.equals("31")) { ctrantypeidStr = "32-01"; } else if (fplxStr != null && fplxStr.equals("32")) { @@ -194,14 +194,14 @@ public class saveCommitAction extends AbstractNCCRestResource { } else if (fplxStr != null && fplxStr.equals("36")) { ctrantypeidStr = "32-Cxx-03"; } - billhead.put("ctrantypeid", ctrantypeidStr);// 发票类型 - // billhead.put("ctrantypeid", "32-02");//发票类型 - billhead.put("fbuysellflag", "1");// 购销类型 - billhead.put("creator", "BIP");// 创建人 + billhead.put("ctrantypeid", ctrantypeidStr);//发票类型 + //billhead.put("ctrantypeid", "32-02");//发票类型 + billhead.put("fbuysellflag", "1");//购销类型 + billhead.put("creator", "BIP");//创建人 billhead.put("ccurrencyid", "CNY");// 本位币 - billhead.put("corigcurrencyid", "CNY");// 币种 - billhead.put("nexchangerate", 1);// 折本汇率 - billhead.put("btriatradeflag", 0);// 三角贸易 + billhead.put("corigcurrencyid", "CNY");//币种 + billhead.put("nexchangerate", 1);//折本汇率 + billhead.put("btriatradeflag", 0);//三角贸易 JSONObject newItem = new JSONObject(); JSONObject otherJson = new JSONObject(); JSONArray csaleinvoicebid = new JSONArray(); @@ -212,36 +212,36 @@ public class saveCommitAction extends AbstractNCCRestResource { JSONObject itemDetails = new JSONObject(); itemDetails = item; - itemDetails.put("carorgid", originalJson.getJSONObject("billhead").getString("pk_org"));// 应收组织 + itemDetails.put("carorgid", originalJson.getJSONObject("billhead").getString("pk_org"));//应收组织 itemDetails.put("csendstockorgid", - originalJson.getJSONObject("billhead").getString("pk_org"));// 库存组织原始版本 - itemDetails.put("cmaterialid", item.getString("cmaterialvid"));// 物料编码 + originalJson.getJSONObject("billhead").getString("pk_org"));//库存组织原始版本 + itemDetails.put("cmaterialid", item.getString("cmaterialvid"));//物料编码 Map value2 = getSaleorderVo(item.getString("csrcbid")); if (value2 == null) { resultJson = new JSONObject(); resultJson.put("tsType", "1"); return resultJson; } - itemDetails.put("vfirsttype", "30");// 源头单据类型 - itemDetails.put("vfirstcode", value2.get("vbillcode"));// 源头单据号 - itemDetails.put("blargessflag", value2.get("blargessflag"));// 赠品 - itemDetails.put("vfirsttrantype", "30-01");// 源头交易类型 - itemDetails.put("vfirstrowno", value2.get("crowno"));// 源头单据行号 - itemDetails.put("cfirstid", item.getString("csrcid"));// 源头单据主表 - itemDetails.put("cfirstbid", item.getString("csrcbid"));// 源头单据子表 - itemDetails.put("vsrctype", "30");// 来源单据类型 - itemDetails.put("vsrccode", value2.get("vbillcode"));// 来源单据号 - itemDetails.put("vsrctrantype", "30-01");// 来源交易类型 - itemDetails.put("vsrcrowno", value2.get("crowno"));// 来源单据行号 + itemDetails.put("vfirsttype", "30");//源头单据类型 + itemDetails.put("vfirstcode", value2.get("vbillcode"));//源头单据号 + itemDetails.put("blargessflag", value2.get("blargessflag"));//赠品 + itemDetails.put("vfirsttrantype", "30-01");//源头交易类型 + itemDetails.put("vfirstrowno", value2.get("crowno"));//源头单据行号 + itemDetails.put("cfirstid", item.getString("csrcid"));//源头单据主表 + itemDetails.put("cfirstbid", item.getString("csrcbid"));//源头单据子表 + itemDetails.put("vsrctype", "30");//来源单据类型 + itemDetails.put("vsrccode", value2.get("vbillcode"));//来源单据号 + itemDetails.put("vsrctrantype", "30-01");//来源交易类型 + itemDetails.put("vsrcrowno", value2.get("crowno"));//来源单据行号 // 通过 ntaxrate 获取 taxcode String taxcodeStr = getTaxcode(item.getString("ntaxrate")); // 将 taxcodeStr 放入 bodyMap - itemDetails.put("ctaxcodeid", taxcodeStr);// 税码 - itemDetails.put("nnum", item.getString("nastnum"));// 主数量 - itemDetails.put("ftaxtypeflag", 1);// 扣税类别 - itemDetails.put("pk_group", "00");// 集团 - itemDetails.put("pk_org", originalJson.getJSONObject("billhead").getString("pk_org"));// 开票组织 - itemDetails.put("cunitid", item.getString("castunitid"));// 主单位 + itemDetails.put("ctaxcodeid", taxcodeStr);//税码 + itemDetails.put("nnum", item.getString("nastnum"));//主数量 + itemDetails.put("ftaxtypeflag", 1);//扣税类别 + itemDetails.put("pk_group", "00");//集团 + itemDetails.put("pk_org", originalJson.getJSONObject("billhead").getString("pk_org"));//开票组织 + itemDetails.put("cunitid", item.getString("castunitid"));//主单位 // double nastnum = Double.parseDouble(item.getString("nastnum"));//数量 // double nqtorigtaxprice = Double.parseDouble(item.getString("nqtorigtaxprice"));//含税单价 @@ -286,7 +286,7 @@ public class saveCommitAction extends AbstractNCCRestResource { BigDecimal ntaxrate = new BigDecimal(item.getString("ntaxrate")).divide(new BigDecimal("100")); // 税率 ntaxrate = ntaxrate.setScale(4, RoundingMode.HALF_UP); - // 含税净价 + //含税净价 BigDecimal norigtaxnetprice = nqtorigtaxprice; // 1. 计算价税合计(含税金额) BigDecimal norigtaxmny = nastnum.multiply(norigtaxnetprice).setScale(2, RoundingMode.HALF_UP); @@ -325,19 +325,19 @@ public class saveCommitAction extends AbstractNCCRestResource { norigtaxnetprice = norigtaxnetprice.multiply(nexchangerate); - itemDetails.put("nqtorigprice", nqtorigprice);// 无税单价 - itemDetails.put("norigprice", nqtorigprice);// 主无税单价 - itemDetails.put("norigmny", norigmny);// 无税金额 - itemDetails.put("nmny", norigmny);// 本币无税金额 - itemDetails.put("norigtaxmny", norigtaxmny);// 价税合计 - itemDetails.put("norigtaxprice", norigtaxprice);// 主含税单价 - itemDetails.put("norignetprice", norignetprice);// 主无税净价 - itemDetails.put("nqtorigtaxprice", nqtorigtaxprice);// 含税单价 - itemDetails.put("ntax", ntax);// 税额 - itemDetails.put("ncaltaxmny", ncaltaxmny);// 计税金额 - itemDetails.put("norigtaxnetprice", norigtaxnetprice);// 主含税净价 - itemDetails.put("nnetprice", norignetprice);// 主本币无税净价 - itemDetails.put("ntaxmny", norigtaxmny);// 本币价税合计 + itemDetails.put("nqtorigprice", nqtorigprice);//无税单价 + itemDetails.put("norigprice", nqtorigprice);//主无税单价 + itemDetails.put("norigmny", norigmny);//无税金额 + itemDetails.put("nmny", norigmny);//本币无税金额 + itemDetails.put("norigtaxmny", norigtaxmny);//价税合计 + itemDetails.put("norigtaxprice", norigtaxprice);//主含税单价 + itemDetails.put("norignetprice", norignetprice);//主无税净价 + itemDetails.put("nqtorigtaxprice", nqtorigtaxprice);//含税单价 + itemDetails.put("ntax", ntax);//税额 + itemDetails.put("ncaltaxmny", ncaltaxmny);//计税金额 + itemDetails.put("norigtaxnetprice", norigtaxnetprice);//主含税净价 + itemDetails.put("nnetprice", norignetprice);//主本币无税净价 + itemDetails.put("ntaxmny", norigtaxmny);//本币价税合计 csaleinvoicebid.add(itemDetails); @@ -390,9 +390,13 @@ public class saveCommitAction extends AbstractNCCRestResource { private static Map getSaleorderVo(String csourcebillbidStr) throws BusinessException { IUAPQueryBS queryBS = NCLocator.getInstance().lookup(IUAPQueryBS.class); - String sql = " select s.vbillcode,s.csaleorderid,sb.csaleorderbid,sb.crowno,sb.blargessflag,sb.nexchangerate,s.corigcurrencyid from so_saleorder_b sb\n" - + "inner join so_saleorder s on sb.csaleorderid=s.csaleorderid\n" - + "where sb.csaleorderbid='" + csourcebillbidStr + "' "; + String sql = " select s.vbillcode,s.csaleorderid, s.corigcurrencyid," + + " sb.csaleorderbid,sb.crowno,sb.blargessflag,sb.nexchangerate," + + " bdc.code currencycode" + + " from so_saleorder_b sb" + + " inner join so_saleorder s on sb.csaleorderid=s.csaleorderid" + + " left join bd_currtype bdc on s.corigcurrencyid=bdc.pk_currtype" + + " where sb.csaleorderbid='" + csourcebillbidStr + "' "; Map value2 = (Map) queryBS.executeQuery(sql, new MapProcessor()); return value2; }