修复销售发票接口返回值调整
This commit is contained in:
		
							parent
							
								
									7f472d5694
								
							
						
					
					
						commit
						d13ff6e55b
					
				|  | @ -40,7 +40,7 @@ import java.util.Map; | ||||||
| @Path("so/saleinvoice/operator") | @Path("so/saleinvoice/operator") | ||||||
| public class saveCommitAction extends AbstractNCCRestResource { | public class saveCommitAction extends AbstractNCCRestResource { | ||||||
| 
 | 
 | ||||||
|     public static String fplxStr = "";//开票申请发票类型 |     public static String fplxStr = "";// 开票申请发票类型 | ||||||
| 
 | 
 | ||||||
|     public saveCommitAction() { |     public saveCommitAction() { | ||||||
| 
 | 
 | ||||||
|  | @ -118,7 +118,7 @@ public class saveCommitAction extends AbstractNCCRestResource { | ||||||
|                                 .queryVOByIDs(ids); |                                 .queryVOByIDs(ids); | ||||||
|                         SaleInvoiceVO saleInvoiceVO22 = saleInvoiceVO[0]; |                         SaleInvoiceVO saleInvoiceVO22 = saleInvoiceVO[0]; | ||||||
|                         SaleInvoiceHVO saleInvoiceHVO = saleInvoiceVO22.getParentVO(); |                         SaleInvoiceHVO saleInvoiceHVO = saleInvoiceVO22.getParentVO(); | ||||||
|                         //销售发票审核开始 |                         // 销售发票审核开始 | ||||||
|                         InvocationInfoProxy.getInstance().setUserId(saleInvoiceHVO.getApprover()); |                         InvocationInfoProxy.getInstance().setUserId(saleInvoiceHVO.getApprover()); | ||||||
|                         CloudPFlowContext context = new CloudPFlowContext(); |                         CloudPFlowContext context = new CloudPFlowContext(); | ||||||
|                         context.setBillType("32"); |                         context.setBillType("32"); | ||||||
|  | @ -133,14 +133,16 @@ public class saveCommitAction extends AbstractNCCRestResource { | ||||||
|                         IBatchRunScriptService service = (IBatchRunScriptService) NCLocator.getInstance() |                         IBatchRunScriptService service = (IBatchRunScriptService) NCLocator.getInstance() | ||||||
|                                 .lookup(IBatchRunScriptService.class); |                                 .lookup(IBatchRunScriptService.class); | ||||||
|                         SCMScriptResultDTO result = service.runBacth(context, SaleInvoiceVO.class); |                         SCMScriptResultDTO result = service.runBacth(context, SaleInvoiceVO.class); | ||||||
|                         //销售发票审核结束 |                         // 销售发票审核结束 | ||||||
|                         TaxInvoiceType typeObj = TaxInvoiceType.SpecialInvoice; |                         TaxInvoiceType typeObj = TaxInvoiceType.SpecialInvoice; | ||||||
|                         SaleInvoiceToTaxInvServiceImpl saleInvoiceToTaxInvService = new SaleInvoiceToTaxInvServiceImpl(); |                         SaleInvoiceToTaxInvServiceImpl saleInvoiceToTaxInvService = new SaleInvoiceToTaxInvServiceImpl(); | ||||||
|                         saleInvoiceToTaxInvService.issueTaxInvoice(saleInvoiceVO, typeObj); |                         saleInvoiceToTaxInvService.issueTaxInvoice(saleInvoiceVO, typeObj); | ||||||
| 
 | 
 | ||||||
|                         return r != null |                         JSONObject desc = r.getDesc(); | ||||||
|                                 ? ResultMessageUtil.toJSON(r.getDesc(), "0") |                         if (desc != null) { | ||||||
|                                 : ResultMessageUtil.exceptionToJSON(new NullPointerException("未知异常")); |                             desc.put("vos", saleInvoiceVO); | ||||||
|  |                         } | ||||||
|  |                         return ResultMessageUtil.toJSON(desc, "0"); | ||||||
|                     } catch (Exception e) { |                     } catch (Exception e) { | ||||||
|                         return ResultMessageUtil.exceptionToJSON(e); |                         return ResultMessageUtil.exceptionToJSON(e); | ||||||
|                     } |                     } | ||||||
|  | @ -173,20 +175,20 @@ public class saveCommitAction extends AbstractNCCRestResource { | ||||||
|             JSONObject bill = new JSONObject(); |             JSONObject bill = new JSONObject(); | ||||||
|             // billhead 结构 |             // billhead 结构 | ||||||
|             JSONObject billhead = new JSONObject(); |             JSONObject billhead = new JSONObject(); | ||||||
|             billhead = originalJson.getJSONObject("billhead");//传入JSON对象 |             billhead = originalJson.getJSONObject("billhead");// 传入JSON对象 | ||||||
|             billhead.put("pk_org_v", originalJson.getJSONObject("billhead").getString("pk_org"));//开票组织版本=开票组织 |             billhead.put("pk_org_v", originalJson.getJSONObject("billhead").getString("pk_org"));// 开票组织版本=开票组织 | ||||||
|             billhead.put("pk_group", "00");//集团 |             billhead.put("pk_group", "00");// 集团 | ||||||
|             fplxStr = originalJson.getJSONObject("billhead").getString("vdef22"); |             fplxStr = originalJson.getJSONObject("billhead").getString("vdef22"); | ||||||
|             billhead.put("vtrantypecode", "32-02");//发票类型编码 |             billhead.put("vtrantypecode", "32-02");// 发票类型编码 | ||||||
|             billhead.put("cbiztypeid", "SO01");//业务流程 |             billhead.put("cbiztypeid", "SO01");// 业务流程 | ||||||
|             billhead.put("approver", "BIP");//审批人 |             billhead.put("approver", "BIP");// 审批人 | ||||||
|             billhead.put("fstatusflag", 1);//单据状态 |             billhead.put("fstatusflag", 1);// 单据状态 | ||||||
|             billhead.put("billmaker", "BIP");//制单人 |             billhead.put("billmaker", "BIP");// 制单人 | ||||||
|             billhead.put("csendcountryid", "CN");//发货国家 |             billhead.put("csendcountryid", "CN");// 发货国家 | ||||||
|             billhead.put("crececountryid", "CN");//收货国家 |             billhead.put("crececountryid", "CN");// 收货国家 | ||||||
|             billhead.put("ctaxcountryid", "CN");//报税国家 |             billhead.put("ctaxcountryid", "CN");// 报税国家 | ||||||
|             //2025-2-8付业要求修改,根据发票类型Q(自定义档案)对照发票类型 |             // 2025-2-8付业要求修改,根据发票类型Q(自定义档案)对照发票类型 | ||||||
|             String ctrantypeidStr = "32-02";//默认普通发票 |             String ctrantypeidStr = "32-02";// 默认普通发票 | ||||||
|             if (fplxStr != null && fplxStr.equals("31")) { |             if (fplxStr != null && fplxStr.equals("31")) { | ||||||
|                 ctrantypeidStr = "32-01"; |                 ctrantypeidStr = "32-01"; | ||||||
|             } else if (fplxStr != null && fplxStr.equals("32")) { |             } else if (fplxStr != null && fplxStr.equals("32")) { | ||||||
|  | @ -194,14 +196,14 @@ public class saveCommitAction extends AbstractNCCRestResource { | ||||||
|             } else if (fplxStr != null && fplxStr.equals("36")) { |             } else if (fplxStr != null && fplxStr.equals("36")) { | ||||||
|                 ctrantypeidStr = "32-Cxx-03"; |                 ctrantypeidStr = "32-Cxx-03"; | ||||||
|             } |             } | ||||||
|             billhead.put("ctrantypeid", ctrantypeidStr);//发票类型 |             billhead.put("ctrantypeid", ctrantypeidStr);// 发票类型 | ||||||
|             //billhead.put("ctrantypeid", "32-02");//发票类型 |             // billhead.put("ctrantypeid", "32-02");//发票类型 | ||||||
|             billhead.put("fbuysellflag", "1");//购销类型 |             billhead.put("fbuysellflag", "1");// 购销类型 | ||||||
|             billhead.put("creator", "BIP");//创建人 |             billhead.put("creator", "BIP");// 创建人 | ||||||
|             billhead.put("ccurrencyid", "CNY");// 本位币 |             billhead.put("ccurrencyid", "CNY");// 本位币 | ||||||
|             billhead.put("corigcurrencyid", "CNY");//币种 |             billhead.put("corigcurrencyid", "CNY");// 币种 | ||||||
|             billhead.put("nexchangerate", 1);//折本汇率 |             billhead.put("nexchangerate", 1);// 折本汇率 | ||||||
|             billhead.put("btriatradeflag", 0);//三角贸易 |             billhead.put("btriatradeflag", 0);// 三角贸易 | ||||||
|             JSONObject newItem = new JSONObject(); |             JSONObject newItem = new JSONObject(); | ||||||
|             JSONObject otherJson = new JSONObject(); |             JSONObject otherJson = new JSONObject(); | ||||||
|             JSONArray csaleinvoicebid = new JSONArray(); |             JSONArray csaleinvoicebid = new JSONArray(); | ||||||
|  | @ -212,36 +214,36 @@ public class saveCommitAction extends AbstractNCCRestResource { | ||||||
| 
 | 
 | ||||||
|                 JSONObject itemDetails = new JSONObject(); |                 JSONObject itemDetails = new JSONObject(); | ||||||
|                 itemDetails = item; |                 itemDetails = item; | ||||||
|                 itemDetails.put("carorgid", originalJson.getJSONObject("billhead").getString("pk_org"));//应收组织 |                 itemDetails.put("carorgid", originalJson.getJSONObject("billhead").getString("pk_org"));// 应收组织 | ||||||
|                 itemDetails.put("csendstockorgid", |                 itemDetails.put("csendstockorgid", | ||||||
|                         originalJson.getJSONObject("billhead").getString("pk_org"));//库存组织原始版本 |                         originalJson.getJSONObject("billhead").getString("pk_org"));// 库存组织原始版本 | ||||||
|                 itemDetails.put("cmaterialid", item.getString("cmaterialvid"));//物料编码 |                 itemDetails.put("cmaterialid", item.getString("cmaterialvid"));// 物料编码 | ||||||
|                 Map<String, Object> value2 = getSaleorderVo(item.getString("csrcbid")); |                 Map<String, Object> value2 = getSaleorderVo(item.getString("csrcbid")); | ||||||
|                 if (value2 == null) { |                 if (value2 == null) { | ||||||
|                     resultJson = new JSONObject(); |                     resultJson = new JSONObject(); | ||||||
|                     resultJson.put("tsType", "1"); |                     resultJson.put("tsType", "1"); | ||||||
|                     return resultJson; |                     return resultJson; | ||||||
|                 } |                 } | ||||||
|                 itemDetails.put("vfirsttype", "30");//源头单据类型 |                 itemDetails.put("vfirsttype", "30");// 源头单据类型 | ||||||
|                 itemDetails.put("vfirstcode", value2.get("vbillcode"));//源头单据号 |                 itemDetails.put("vfirstcode", value2.get("vbillcode"));// 源头单据号 | ||||||
|                 itemDetails.put("blargessflag", value2.get("blargessflag"));//赠品 |                 itemDetails.put("blargessflag", value2.get("blargessflag"));// 赠品 | ||||||
|                 itemDetails.put("vfirsttrantype", "30-01");//源头交易类型 |                 itemDetails.put("vfirsttrantype", "30-01");// 源头交易类型 | ||||||
|                 itemDetails.put("vfirstrowno", value2.get("crowno"));//源头单据行号 |                 itemDetails.put("vfirstrowno", value2.get("crowno"));// 源头单据行号 | ||||||
|                 itemDetails.put("cfirstid", item.getString("csrcid"));//源头单据主表 |                 itemDetails.put("cfirstid", item.getString("csrcid"));// 源头单据主表 | ||||||
|                 itemDetails.put("cfirstbid", item.getString("csrcbid"));//源头单据子表 |                 itemDetails.put("cfirstbid", item.getString("csrcbid"));// 源头单据子表 | ||||||
|                 itemDetails.put("vsrctype", "30");//来源单据类型 |                 itemDetails.put("vsrctype", "30");// 来源单据类型 | ||||||
|                 itemDetails.put("vsrccode", value2.get("vbillcode"));//来源单据号 |                 itemDetails.put("vsrccode", value2.get("vbillcode"));// 来源单据号 | ||||||
|                 itemDetails.put("vsrctrantype", "30-01");//来源交易类型 |                 itemDetails.put("vsrctrantype", "30-01");// 来源交易类型 | ||||||
|                 itemDetails.put("vsrcrowno", value2.get("crowno"));//来源单据行号 |                 itemDetails.put("vsrcrowno", value2.get("crowno"));// 来源单据行号 | ||||||
|                 // 通过 ntaxrate 获取 taxcode |                 // 通过 ntaxrate 获取 taxcode | ||||||
|                 String taxcodeStr = getTaxcode(item.getString("ntaxrate")); |                 String taxcodeStr = getTaxcode(item.getString("ntaxrate")); | ||||||
|                 // 将 taxcodeStr 放入 bodyMap |                 // 将 taxcodeStr 放入 bodyMap | ||||||
|                 itemDetails.put("ctaxcodeid", taxcodeStr);//税码 |                 itemDetails.put("ctaxcodeid", taxcodeStr);// 税码 | ||||||
|                 itemDetails.put("nnum", item.getString("nastnum"));//主数量 |                 itemDetails.put("nnum", item.getString("nastnum"));// 主数量 | ||||||
|                 itemDetails.put("ftaxtypeflag", 1);//扣税类别 |                 itemDetails.put("ftaxtypeflag", 1);// 扣税类别 | ||||||
|                 itemDetails.put("pk_group", "00");//集团 |                 itemDetails.put("pk_group", "00");// 集团 | ||||||
|                 itemDetails.put("pk_org", originalJson.getJSONObject("billhead").getString("pk_org"));//开票组织 |                 itemDetails.put("pk_org", originalJson.getJSONObject("billhead").getString("pk_org"));// 开票组织 | ||||||
|                 itemDetails.put("cunitid", item.getString("castunitid"));//主单位 |                 itemDetails.put("cunitid", item.getString("castunitid"));// 主单位 | ||||||
| 
 | 
 | ||||||
| //                double nastnum = Double.parseDouble(item.getString("nastnum"));//数量 | //                double nastnum = Double.parseDouble(item.getString("nastnum"));//数量 | ||||||
| //                double nqtorigtaxprice = Double.parseDouble(item.getString("nqtorigtaxprice"));//含税单价 | //                double nqtorigtaxprice = Double.parseDouble(item.getString("nqtorigtaxprice"));//含税单价 | ||||||
|  | @ -293,7 +295,7 @@ public class saveCommitAction extends AbstractNCCRestResource { | ||||||
|                 BigDecimal ntaxrate = new BigDecimal(item.getString("ntaxrate")).divide(new BigDecimal("100"));  // 税率 |                 BigDecimal ntaxrate = new BigDecimal(item.getString("ntaxrate")).divide(new BigDecimal("100"));  // 税率 | ||||||
|                 ntaxrate = ntaxrate.setScale(4, RoundingMode.HALF_UP); |                 ntaxrate = ntaxrate.setScale(4, RoundingMode.HALF_UP); | ||||||
| 
 | 
 | ||||||
|                 //含税净价 |                 // 含税净价 | ||||||
|                 BigDecimal norigtaxnetprice = nqtorigtaxprice; |                 BigDecimal norigtaxnetprice = nqtorigtaxprice; | ||||||
|                 // 1. 计算价税合计(含税金额) |                 // 1. 计算价税合计(含税金额) | ||||||
|                 BigDecimal norigtaxmny = nastnum.multiply(norigtaxnetprice).setScale(2, RoundingMode.HALF_UP); |                 BigDecimal norigtaxmny = nastnum.multiply(norigtaxnetprice).setScale(2, RoundingMode.HALF_UP); | ||||||
|  | @ -326,19 +328,19 @@ public class saveCommitAction extends AbstractNCCRestResource { | ||||||
|                 // 税额 |                 // 税额 | ||||||
|                 ntax = ntaxmny.subtract(nmny).setScale(2, RoundingMode.HALF_UP); |                 ntax = ntaxmny.subtract(nmny).setScale(2, RoundingMode.HALF_UP); | ||||||
| 
 | 
 | ||||||
|                 itemDetails.put("nqtorigprice", nqtorigprice);//无税单价 |                 itemDetails.put("nqtorigprice", nqtorigprice);// 无税单价 | ||||||
|                 itemDetails.put("norigprice", nqtorigprice);//主无税单价 |                 itemDetails.put("norigprice", nqtorigprice);// 主无税单价 | ||||||
|                 itemDetails.put("norigmny", norigmny);//无税金额 |                 itemDetails.put("norigmny", norigmny);// 无税金额 | ||||||
|                 itemDetails.put("nmny", nmny);//本币无税金额 |                 itemDetails.put("nmny", nmny);// 本币无税金额 | ||||||
|                 itemDetails.put("norigtaxmny", norigtaxmny);//价税合计 |                 itemDetails.put("norigtaxmny", norigtaxmny);// 价税合计 | ||||||
|                 itemDetails.put("norigtaxprice", norigtaxprice);//主含税单价 |                 itemDetails.put("norigtaxprice", norigtaxprice);// 主含税单价 | ||||||
|                 itemDetails.put("norignetprice", norignetprice);//主无税净价 |                 itemDetails.put("norignetprice", norignetprice);// 主无税净价 | ||||||
|                 itemDetails.put("nqtorigtaxprice", nqtorigtaxprice);//含税单价 |                 itemDetails.put("nqtorigtaxprice", nqtorigtaxprice);// 含税单价 | ||||||
|                 itemDetails.put("ntax", ntax);//税额 |                 itemDetails.put("ntax", ntax);// 税额 | ||||||
|                 itemDetails.put("ncaltaxmny", ncaltaxmny);//计税金额 |                 itemDetails.put("ncaltaxmny", ncaltaxmny);// 计税金额 | ||||||
|                 itemDetails.put("norigtaxnetprice", norigtaxnetprice);//主含税净价 |                 itemDetails.put("norigtaxnetprice", norigtaxnetprice);// 主含税净价 | ||||||
|                 itemDetails.put("nnetprice", nnetprice);//主本币无税净价 |                 itemDetails.put("nnetprice", nnetprice);// 主本币无税净价 | ||||||
|                 itemDetails.put("ntaxmny", ntaxmny);//本币价税合计 |                 itemDetails.put("ntaxmny", ntaxmny);// 本币价税合计 | ||||||
|                 csaleinvoicebid.add(itemDetails); |                 csaleinvoicebid.add(itemDetails); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue