Эх сурвалжийг харах

开票代码

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@10760 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
huangct 8 жил өмнө
parent
commit
906ee6274c
45 өөрчлөгдсөн 8479 нэмэгдсэн , 127 устгасан
  1. 834 0
      src/main/java/com/uas/platform/b2b/controller/SaleApBillOutController.java
  2. 13 7
      src/main/java/com/uas/platform/b2b/controller/SaleApCheckController.java
  3. 18 0
      src/main/java/com/uas/platform/b2b/dao/PurchaseApBillOutDao.java
  4. 13 0
      src/main/java/com/uas/platform/b2b/dao/PurchaseApBillOutDoneDao.java
  5. 13 0
      src/main/java/com/uas/platform/b2b/dao/PurchaseApBillOutEndDao.java
  6. 26 0
      src/main/java/com/uas/platform/b2b/dao/PurchaseApBillOutItemDao.java
  7. 10 0
      src/main/java/com/uas/platform/b2b/dao/PurchaseApBillOutTodoDao.java
  8. 8 0
      src/main/java/com/uas/platform/b2b/dao/PurchaseApCheckItemDao.java
  9. 23 0
      src/main/java/com/uas/platform/b2b/dao/PurchaseApCheckItemInfoDao.java
  10. 540 0
      src/main/java/com/uas/platform/b2b/model/PurchaseApBillOut.java
  11. 323 0
      src/main/java/com/uas/platform/b2b/model/PurchaseApBillOutDone.java
  12. 323 0
      src/main/java/com/uas/platform/b2b/model/PurchaseApBillOutEnd.java
  13. 391 0
      src/main/java/com/uas/platform/b2b/model/PurchaseApBillOutItem.java
  14. 100 0
      src/main/java/com/uas/platform/b2b/model/PurchaseApBillOutTaxCode.java
  15. 323 0
      src/main/java/com/uas/platform/b2b/model/PurchaseApBillOutTodo.java
  16. 366 0
      src/main/java/com/uas/platform/b2b/model/PurchaseApCheckInfo.java
  17. 19 16
      src/main/java/com/uas/platform/b2b/model/PurchaseApCheckItem.java
  18. 431 0
      src/main/java/com/uas/platform/b2b/model/PurchaseApCheckItemInfo.java
  19. 336 0
      src/main/java/com/uas/platform/b2b/model/SoapFpArray.java
  20. 164 0
      src/main/java/com/uas/platform/b2b/model/SoapGoods.java
  21. 48 0
      src/main/java/com/uas/platform/b2b/model/SoapInvkind.java
  22. 163 0
      src/main/java/com/uas/platform/b2b/model/SoapInvoiceIssued.java
  23. 158 0
      src/main/java/com/uas/platform/b2b/model/SoapInvoiceItem.java
  24. 38 0
      src/main/java/com/uas/platform/b2b/model/SoapInvoiceStatusUpdate.java
  25. 57 0
      src/main/java/com/uas/platform/b2b/model/SoapKcArray.java
  26. 164 0
      src/main/java/com/uas/platform/b2b/model/SoapListDetail.java
  27. 155 0
      src/main/java/com/uas/platform/b2b/model/SoapMotorInvoiceIssued.java
  28. 426 0
      src/main/java/com/uas/platform/b2b/model/SoapMotorInvoiceQuery.java
  29. 93 0
      src/main/java/com/uas/platform/b2b/model/SoapQueryInvoiceMessage.java
  30. 154 0
      src/main/java/com/uas/platform/b2b/model/SoapQueryNextRepertyMessage.java
  31. 82 0
      src/main/java/com/uas/platform/b2b/model/SoapQueryRepertyMessage.java
  32. 146 0
      src/main/java/com/uas/platform/b2b/model/SoapRepertyMessage.java
  33. 103 0
      src/main/java/com/uas/platform/b2b/model/SoapSIDType.java
  34. 138 0
      src/main/java/com/uas/platform/b2b/model/SoapSingleInvoiceQuery.java
  35. 38 0
      src/main/java/com/uas/platform/b2b/model/SoapStartBillOut.java
  36. 11 40
      src/main/java/com/uas/platform/b2b/search/SearchService.java
  37. 29 64
      src/main/java/com/uas/platform/b2b/search/SearchServiceImpl.java
  38. 151 0
      src/main/java/com/uas/platform/b2b/service/PurchaseApBillOutService.java
  39. 12 0
      src/main/java/com/uas/platform/b2b/service/PurchaseApCheckService.java
  40. 132 0
      src/main/java/com/uas/platform/b2b/service/SOAPConsoleService.java
  41. 481 0
      src/main/java/com/uas/platform/b2b/service/impl/PurchaseApBillOutServiceImpl.java
  42. 57 0
      src/main/java/com/uas/platform/b2b/service/impl/PurchaseApCheckServiceImpl.java
  43. 1302 0
      src/main/java/com/uas/platform/b2b/service/impl/SOAPConsoleServiceImpl.java
  44. 66 0
      src/main/webapp/resources/js/index/services/Fa.js
  45. 1 0
      src/main/webapp/resources/tpl/index/fa/left.html

+ 834 - 0
src/main/java/com/uas/platform/b2b/controller/SaleApBillOutController.java

@@ -0,0 +1,834 @@
+package com.uas.platform.b2b.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2b.dao.CommonDao;
+import com.uas.platform.b2b.dao.PurchaseApBillOutDao;
+import com.uas.platform.b2b.dao.PurchaseApCheckItemInfoDao;
+import com.uas.platform.b2b.model.*;
+import com.uas.platform.b2b.search.SearchService;
+import com.uas.platform.b2b.service.*;
+import com.uas.platform.b2b.support.JxlsExcelView;
+import com.uas.platform.b2b.support.SystemSession;
+import com.uas.platform.b2b.support.UsageBufferedLogger;
+import com.uas.platform.core.exception.IllegalOperatorException;
+import com.uas.platform.core.logging.BufferedLoggerManager;
+import com.uas.platform.core.model.Constant;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
+import com.uas.platform.core.util.serializer.FlexJsonUtils;
+import com.uas.platform.core.web.bind.RequestState;
+import com.uas.search.b2b.model.MultiValue;
+import com.uas.search.b2b.model.SPage;
+import com.uas.search.b2b.model.Sort;
+import com.uas.search.b2b.model.Sort.Type;
+import com.uas.search.b2b.util.SearchConstants;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Sort.Direction;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 
+ * 航天开票
+ *
+ */
+
+@SuppressWarnings("deprecation")
+@Controller
+@RequestMapping("/sale/apBillOut")
+public class SaleApBillOutController {
+
+	@Autowired
+	private ErpProdIODetailService erpProdIODetailService;
+
+	@Autowired
+	PurchaseApCheckService purchaseApCheckService;
+
+	@Autowired
+	private VendorService vendorService;
+
+	@Autowired
+	private UserService userService;
+
+	@Autowired
+	private SearchService searchService;
+
+	@Autowired
+	private  PurchaseApCheckItemInfoDao PurchaseApCheckItemInfoDao;
+
+	@Autowired
+	private PurchaseApBillOutService purchaseApBillOutService;
+
+	@Autowired
+	private CommonDao commonDao;
+
+    @Autowired
+    private PurchaseApBillOutDao purchaseApBillOutDao;
+
+	@Autowired
+	private SOAPConsoleService sOAPConsoleService;
+
+	private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
+	/**
+	 * 打印对账单,增加打印次数
+	 * 
+	 * @param id
+	 * @return
+	 */
+	//hct 此方法只是更新了打印次数  目前处于弃用状态
+	@RequestMapping(value = "/printCount/{id}", method = RequestMethod.POST)
+	@ResponseBody
+	public ResponseEntity<String> printCount(@PathVariable("id") Long id) {
+		purchaseApCheckService.print(id);
+		logger.log("开票单", "打印开票单单据", id.toString());
+		return new ResponseEntity<String>(HttpStatus.OK);
+	}
+
+	/**
+	 * 得到所有的供应商信息便于筛选
+	 * 
+	 * @return
+	 */
+	@RequestMapping(value = "/getAllCustomers", method = RequestMethod.GET)
+	@ResponseBody
+	public Set<Object> getAllApChecksCustomers() {
+		Set<Object> set = new HashSet<>();
+		// 判断当前用户是否被客户分配
+		SearchFilter filter = userService.distribute();
+		// 不是管理员也没被分配客户是直接返回空
+		if (filter != null && filter.getDistribute() == null) {
+			return null;
+		}
+		Set<Role> roles = SystemSession.getUser().getRoles();
+		boolean isSys = false;
+		for (Role role : roles) {
+			if (role.getIssys() == 1) {
+				isSys = true;
+			}
+		}
+		if (!SystemSession.getUser().isSys() && !isSys) { // 不是管理员,被分配客户时
+			List<Vendor> vendors = userService.findChooseVendor(SystemSession.getUser().getUserUU());
+			if (!CollectionUtils.isEmpty(vendors)) {
+				for (Vendor v : vendors) {
+					if (v.getApcheck().equals(Constant.YES)) {// 只有开通了B2B对账的才筛选
+						set.add(v.getMyEnterprise().getEnName()); // 这里添加客户名称
+					}
+				}
+			} else {
+				return null;
+			}
+		} else {
+			List<Vendor> vendors = vendorService.findMyCustomers();
+			for (Vendor vendor : vendors) {
+				set.add(vendor.getMyEnterprise().getEnName());
+			}
+		}
+		return set;
+	}
+
+
+	@RequestMapping(value = "/getDoneByKeywords", method = RequestMethod.GET)
+	@ResponseBody
+	public Set<PurchaseApCheckItemInfo> getDoneApchecksByDate(Long fromDate, Long endDate, String keyword) {
+		List<Long> distributes = null;
+		// 判断当前用户是否被客户分配
+		if (!SystemSession.getUser().isSys()) {
+			List<Vendor> vendors = userService.findChooseVendor(SystemSession.getUser().getUserUU());
+			distributes = new ArrayList<Long>();
+			if (!CollectionUtils.isEmpty(vendors)) {
+				for (Vendor v : vendors) {
+					distributes.add(v.getMyEnUU());
+				}
+			} else {
+				return null;
+			}
+		}
+		List<PurchaseApCheckItem> purchaseApCheckItems = purchaseApCheckService.findDoneApCheckItems(distributes, keyword, fromDate, endDate);  //erpProdIODetailService.findDoneXlsApChecks(distributes, keyword, fromDate, endDate);
+
+		Set<PurchaseApCheckItemInfo> apCheckItems = new HashSet<PurchaseApCheckItemInfo>();
+		for (PurchaseApCheckItem purchaseApCheckItem : purchaseApCheckItems ){
+			Long id = purchaseApCheckItem.getId();
+			PurchaseApCheckItemInfo item = PurchaseApCheckItemInfoDao.findOne(id);
+			apCheckItems.add(item);
+		}
+		return apCheckItems;
+	}
+
+	/**
+	 * 保存生成的开票单主记录
+	 */
+	@RequestMapping(value = "/save", method = RequestMethod.POST)
+	@ResponseBody
+	public ModelMap saveApBillOut(@RequestBody String json) {
+		ModelMap map = new ModelMap();
+		List<String> alters = new ArrayList<String>();
+		JSONObject jsonObject = JSON.parseObject(json);
+		//提取数据来源单据信息
+		String sourceInfos = jsonObject.getString("sourceInfos");
+		List<HashMap<String, Object>> sourceInfoList = FlexJsonUtils.fromJsonArray(sourceInfos, HashMap.class);
+		jsonObject.remove("sourceInfos");
+		json = jsonObject.toJSONString();
+		PurchaseApBillOut apBillOut = FlexJsonUtils.fromJson(json, PurchaseApBillOut.class);
+		if (apBillOut != null) {
+			for (PurchaseApBillOutItem item : apBillOut.getItems()) {
+				List<PurchaseApBillOutItem> items = purchaseApBillOutService
+						.findBySourceTableAndSourceId(item.getSourceTable(), item.getSourceId());
+				for (PurchaseApBillOutItem newitem : items) {
+					if (newitem.getApBillOut().getCheckStatus().equals("未开票")) {
+						alters.add(newitem.getApBillOut().getCode());
+					}
+				}
+			}
+			if (alters.size() > 0) {
+				map.put("alters", alters);
+				throw new IllegalOperatorException("开票单" + alters + "存在未开票的单据,请先进行开票!");
+			} else {
+				apBillOut = purchaseApBillOutService.save(apBillOut,sourceInfoList);
+
+				logger.log("开票单", "多个单据生成同一张开票单", apBillOut.getRemark(), null, apBillOut.getId());
+				map.put("id", apBillOut.getId());
+				return map;
+			}
+		} else {
+			throw new IllegalOperatorException("保存失败!");
+		}
+	}
+
+	/**
+	 * 获得开票单,对应id
+	 * 
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
+	@ResponseBody
+	public PurchaseApBillOut getCreatedPurchaseApBillOutById(@PathVariable("id") Long id) {
+		logger.log("开票单", "查看单个开票单", null, null, id);
+		return purchaseApBillOutService.findById(id);
+	}
+
+	/**
+	 * 作为卖家,获取全部开票单(全部)
+	 * 
+	 * @param params
+	 * @param searchFilter
+	 * @return
+	 */
+	@RequestMapping(method = RequestMethod.GET)
+	@ResponseBody
+	public SPage<PurchaseApBillOut> getAllApBillOuts(PageParams params, String searchFilter) {
+		logger.log("开票单", "获取全部开票单据");
+		JSONObject jsonObject = JSONObject.parseObject(searchFilter);
+		String keyword = jsonObject.getString("keyword");
+		com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
+		// 当前登录企业作为买家
+		pageParams.getFilters().put("pabo_enuu", SystemSession.getUser().getEnterprise().getUu());
+		// TODO 其他过滤条件
+		SearchFilter filter = userService.distribute();
+		if (filter != null && filter.getDistribute() == null) {
+			return null;
+		}
+		if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
+			List<Object> list = new ArrayList<>();
+			for (Object object : filter.getDistribute()) {
+				list.add(object);
+			}
+			pageParams.getFilters().put("pabo_custuu", new MultiValue(list, true));
+		}
+		// 排序条件
+		List<Sort> sortList = new ArrayList<>();
+		sortList.add(new Sort("pabo_id", false, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
+		return searchService.searchPurchaseApBillOutIds(keyword, pageParams);
+	}
+
+	/**
+	 * 作为卖家,获取开票单(未开票)
+	 */
+	@RequestMapping(params = RequestState.TODO, method = RequestMethod.GET)
+	@ResponseBody
+	public SPage<PurchaseApBillOut> getTodoApBillOuts(PageParams params, String searchFilter) {
+		logger.log("开票单", "获取未开票的开票单据");
+		JSONObject jsonObject = JSONObject.parseObject(searchFilter);
+		String keyword = jsonObject.getString("keyword");
+		com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
+		// 当前登录企业作为买家
+		pageParams.getFilters().put("pabo_enuu", SystemSession.getUser().getEnterprise().getUu());
+		// TODO 其他过滤条件
+		SearchFilter filter = userService.distribute();
+		if (filter != null && filter.getDistribute() == null) {
+			return null;
+		}
+		if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
+			List<Object> list = new ArrayList<>();
+			for (Object object : filter.getDistribute()) {
+				list.add(object);
+			}
+			pageParams.getFilters().put("pabo_custuu", new MultiValue(list, true));
+		}
+		pageParams.getFilters().put("pabo_checkstatus", "未开票");
+		// 排序条件
+		List<Sort> sortList = new ArrayList<>();
+		// 如果日期为空,设置的默认时间2000/1/1 1:1:1
+		sortList.add(new Sort("pabo_recorddate", false, Type.LONG, new Long(946659661)));
+		sortList.add(new Sort("pabo_id", false, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
+		return searchService.searchPurchaseApBillOutIds(keyword, pageParams);
+	}
+
+	/**
+	 * 作为卖家,获取开票单(已开票)
+	 */
+	@RequestMapping(params = RequestState.DONE, method = RequestMethod.GET)
+	@ResponseBody
+	public SPage<PurchaseApBillOut> getDoneApBillOuts(PageParams params, String searchFilter) {
+		logger.log("开票单", "获取已开票的开票单据");
+		JSONObject jsonObject = JSONObject.parseObject(searchFilter);
+		String keyword = jsonObject.getString("keyword");
+		com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
+		// 当前登录企业作为买家
+		pageParams.getFilters().put("pabo_enuu", SystemSession.getUser().getEnterprise().getUu());
+		// TODO 其他过滤条件
+		SearchFilter filter = userService.distribute();
+		if (filter != null && filter.getDistribute() == null) {
+			return null;
+		}
+		if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
+			List<Object> list = new ArrayList<>();
+			for (Object object : filter.getDistribute()) {
+				list.add(object);
+			}
+			pageParams.getFilters().put("pabo_custuu", new MultiValue(list, true));
+		}
+		pageParams.getFilters().put("pabo_checkstatus", "已开票");
+		// 排序条件
+		List<Sort> sortList = new ArrayList<>();
+		sortList.add(new Sort("pabo_id", false, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
+		return searchService.searchPurchaseApBillOutIds(keyword, pageParams);
+	}
+
+	/**
+	 * 作为卖家,获取开票单(已作废)
+	 */
+	@RequestMapping(params = RequestState.END, method = RequestMethod.GET)
+	@ResponseBody
+	public SPage<PurchaseApBillOut> getEndApBillOuts(PageParams params, String searchFilter) {
+		logger.log("开票单", "获取已作废开票单据");
+		JSONObject jsonObject = JSONObject.parseObject(searchFilter);
+		String keyword = jsonObject.getString("keyword");
+		com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, searchFilter);
+		// 当前登录企业作为买家
+		pageParams.getFilters().put("pabo_enuu", SystemSession.getUser().getEnterprise().getUu());
+		// TODO 其他过滤条件
+		SearchFilter filter = userService.distribute();
+		if (filter != null && filter.getDistribute() == null) {
+			return null;
+		}
+		if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
+			List<Object> list = new ArrayList<>();
+			for (Object object : filter.getDistribute()) {
+				list.add(object);
+			}
+			pageParams.getFilters().put("pabo_custuu", new MultiValue(list, true));
+		}
+		List<Object> list = new ArrayList<>();
+		//list.add("不同意");
+		list.add("已作废");
+		pageParams.getFilters().put("pabo_checkstatus", new MultiValue(list, true));
+		// 排序条件
+		List<Sort> sortList = new ArrayList<>();
+		sortList.add(new Sort("pabo_id", false, Type.LONG, new Long(1)));
+		pageParams.getFilters().put(SearchConstants.SORT_KEY, sortList);
+		return searchService.searchPurchaseApBillOutIds(keyword, pageParams);
+	}
+
+	/**
+	 * 导出 - 全部
+	 * 
+	 * @param searchFilter
+	 * @return
+	 */
+	@RequestMapping(value = "/allxls", method = RequestMethod.GET)
+	public ModelAndView exportApBillOut(String searchFilter) {
+		SearchFilter filter = FlexJsonUtils.fromJson(searchFilter, SearchFilter.class);
+		PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
+		pageInfo.sorting("recordDate", Direction.DESC);
+		pageInfo.filter("enUu", SystemSession.getUser().getEnterprise().getUu());
+		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
+		ModelAndView modelAndView = new ModelAndView();
+		modelAndView.addObject("dateFormat", dateFormat);
+		modelAndView.addObject("state", "全部");
+		modelAndView.addObject("data",
+				purchaseApBillOutService.findAllByPageInfo(pageInfo, filter.getKeyword(), filter).getContent());
+		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/saleApBillOut", "开票单列表_全部"));
+		logger.log("开票单", "导出Excel列表", "导出全部Excel列表");
+		return modelAndView;
+	}
+
+	/**
+	 * 导出 - 已开票
+	 * 
+	 * @param searchFilter
+	 * @return
+	 */
+	@RequestMapping(value = "/allxls", params = RequestState.DONE, method = RequestMethod.GET)
+	public ModelAndView exportApBillOutDone(String searchFilter) {
+		SearchFilter filter = FlexJsonUtils.fromJson(searchFilter, SearchFilter.class);
+		PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
+		pageInfo.sorting("recordDate", Direction.DESC);
+		pageInfo.filter("enUu", SystemSession.getUser().getEnterprise().getUu());
+		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
+		ModelAndView modelAndView = new ModelAndView();
+		modelAndView.addObject("dateFormat", dateFormat);
+		modelAndView.addObject("state", "已开票");
+		modelAndView.addObject("data",
+				purchaseApBillOutService.findDoneByPageInfo(pageInfo, filter.getKeyword(), filter).getContent());
+		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/saleApBillOut", "开票单列表_已开票"));
+		logger.log("开票单", "导出Excel列表", "导出已开票Excel列表");
+		return modelAndView;
+	}
+
+	/**
+	 * 导出 - 未开票
+	 * 
+	 * @param searchFilter
+	 * @return
+	 */
+	@RequestMapping(value = "/allxls", params = RequestState.TODO, method = RequestMethod.GET)
+	public ModelAndView exportApBillOutTodo(String searchFilter) {
+		SearchFilter filter = FlexJsonUtils.fromJson(searchFilter, SearchFilter.class);
+		PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
+		pageInfo.sorting("recordDate", Direction.DESC);
+		pageInfo.filter("enUu", SystemSession.getUser().getEnterprise().getUu());
+		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
+		ModelAndView modelAndView = new ModelAndView();
+		modelAndView.addObject("dateFormat", dateFormat);
+		modelAndView.addObject("state", "未开票");
+		modelAndView.addObject("data",
+				purchaseApBillOutService.findTodoByPageInfo(pageInfo, filter.getKeyword(), filter).getContent());
+		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/saleApBillOut", "开票单列表_未开票"));
+		logger.log("开票单", "导出Excel列表", "导出未开票Excel列表");
+		return modelAndView;
+	}
+
+	/**
+	 * 导出 - 已作废
+	 * 
+	 * @param searchFilter
+	 * @return
+	 */
+	@RequestMapping(value = "/allxls", params = RequestState.END, method = RequestMethod.GET)
+	public ModelAndView exportApBillOutEnd(String searchFilter) {
+		SearchFilter filter = FlexJsonUtils.fromJson(searchFilter, SearchFilter.class);
+		PageInfo pageInfo = new PageInfo(1, JxlsExcelView.MAX_SIZE, 0);
+		pageInfo.sorting("recordDate", Direction.DESC);
+		pageInfo.filter("enUu", SystemSession.getUser().getEnterprise().getUu());
+		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
+		ModelAndView modelAndView = new ModelAndView();
+		modelAndView.addObject("dateFormat", dateFormat);
+		modelAndView.addObject("state", "已作废");
+		modelAndView.addObject("data",
+				purchaseApBillOutService.findEndByPageInfo(pageInfo, filter.getKeyword(), filter).getContent());
+		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/saleApBillOut", "开票单列表_已作废"));
+		logger.log("开票单", "导出Excel列表", "导出已作废Excel列表");
+		return modelAndView;
+	}
+
+	/**
+	 * 全部导出
+	 * 
+	 * @param keyword
+	 * @param fromDate
+	 * @param endDate
+	 * @return
+	 */
+	@RequestMapping(value = "/xls", method = RequestMethod.GET)
+	public ModelAndView export(String keyword, Long fromDate, Long endDate) {
+		List<Long> distributes = null;
+		// 判断当前用户是否被客户分配
+		if (!SystemSession.getUser().isSys()) {
+			List<Vendor> vendors = userService.findChooseVendor(SystemSession.getUser().getUserUU());
+			distributes = new ArrayList<Long>();
+			if (!CollectionUtils.isEmpty(vendors)) {
+				for (Vendor v : vendors) {
+					distributes.add(v.getMyEnUU());
+				}
+			} else {
+				return null;
+			}
+		}
+		ModelAndView modelAndView = new ModelAndView();
+		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
+		modelAndView.addObject("dateFormat", dateFormat);
+		modelAndView.addObject("data", erpProdIODetailService.findXlsApChecks(distributes, keyword, fromDate, endDate));
+		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/faApCheck", "客户应收对账单"));
+		logger.log("客户应收对账单", "导出Excel列表", "导出全部Excel列表");
+		return modelAndView;
+	}
+
+    @RequestMapping(value = "/doExcel", method = RequestMethod.GET)
+    @ResponseBody
+	public void doTaxCodeExcel() {
+		Workbook workbook = null;
+		InputStream is = null;
+		try {
+			is = new FileInputStream("C:\\Users\\黄诚天\\Desktop\\税收分类编码.xlsx");
+			workbook = new XSSFWorkbook(is);
+		} catch (java.io.IOException e) {
+			e.printStackTrace();
+		}
+
+		Sheet sheet = workbook.getSheetAt(0);
+		int rowNum = sheet.getLastRowNum();
+		Row headerRow = sheet.getRow(0);
+        DecimalFormat df = new DecimalFormat("#.##");
+		if (headerRow != null) {
+			for (int r = 1; r <= rowNum; r++) {
+				Row row = sheet.getRow(r);
+				if (row != null && row.getCell(0) != null && row.getCell(0).getCellType() != Cell.CELL_TYPE_BLANK) {
+					String a = "",b,c,d,e,f,g,h = "";
+
+					if (row.getCell(0) != null) {
+						row.getCell(0).setCellType(Cell.CELL_TYPE_STRING);
+						a = row.getCell(0).getStringCellValue().trim();
+
+                        a = df.format(Double.parseDouble(a));
+					}
+
+					if (row.getCell(1) != null) {
+						row.getCell(1).setCellType(Cell.CELL_TYPE_STRING);
+						b = row.getCell(1).getStringCellValue().trim();
+					} else {
+						b = "";
+					}
+
+					if (row.getCell(2) != null) {
+						row.getCell(2).setCellType(Cell.CELL_TYPE_STRING);
+						c = row.getCell(2).getStringCellValue().trim();
+					} else {
+						c = "";
+					}
+
+					if (row.getCell(3) != null) {
+						row.getCell(3).setCellType(Cell.CELL_TYPE_STRING);
+						d = row.getCell(3).getStringCellValue().trim();
+					} else {
+						d = "";
+					}
+
+					if (row.getCell(4) != null) {
+						row.getCell(4).setCellType(Cell.CELL_TYPE_STRING);
+						e = row.getCell(4).getStringCellValue().trim();
+					} else {
+						e = "";
+					}
+
+					if (row.getCell(5) != null) {
+						row.getCell(5).setCellType(Cell.CELL_TYPE_STRING);
+						f = row.getCell(5).getStringCellValue().trim();
+					} else {
+						f = "";
+					}
+
+					if (row.getCell(6) != null) {
+						row.getCell(6).setCellType(Cell.CELL_TYPE_STRING);
+						g = row.getCell(6).getStringCellValue().trim();
+					} else {
+						g = "";
+					}
+
+					if (row.getCell(7) != null) {
+						row.getCell(7).setCellType(Cell.CELL_TYPE_STRING);
+						h = row.getCell(7).getStringCellValue().trim();
+
+						h = df.format(Double.parseDouble(a));
+					}
+
+					//purchaseApBillOutDao.saveData(a,b,c,d,e,f,g,h);
+
+				}
+			}
+		}
+
+	}
+
+	/**
+	 * 删除未开票单
+	 * @param id
+	 */
+	@RequestMapping(value = "/deleteApBillOut/{id}", method = RequestMethod.GET)
+	@ResponseBody
+	public void deleteApBillOut(@PathVariable("id") Long id){
+		purchaseApBillOutService.deleteApBillOut(id);
+		logger.log("开票单", "删除开票单", null, null, id);
+	}
+
+	/**
+	 * 开具发票
+	 * @return
+	 */
+	@RequestMapping(value = "/invoiceIssued/{id}", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap invoiceIssued(@PathVariable("id") Long id) {
+		ModelMap map = new ModelMap();
+		map = purchaseApBillOutService.doBillOut(id);
+		if (map.get("dbError") != null) {
+			logger.log("开票单", "开具发票", (String)map.get("dbError"), null, id);
+		}
+		return map;
+	}
+
+	/**
+	 * 启动开票服务
+	 * @return
+	 */
+	@RequestMapping(value = "/startBillOut", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap startBillOut() {
+		ModelMap map = new ModelMap();
+		map = sOAPConsoleService.startBillOut();
+		return map;
+	}
+
+	/**
+	 * 关闭开票服务
+	 * @return
+	 */
+	@RequestMapping(value = "/closeBillOut", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap closeBillOut() {
+		ModelMap map = new ModelMap();
+		map = sOAPConsoleService.closeBillOut();
+		return map;
+	}
+
+	/**
+	 * 获取每种发票的库存信息
+	 * @return
+	 */
+	@RequestMapping(value = "/getRepertoryMessage", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap getRepertoryMessage() {
+		ModelMap map = new ModelMap();
+		map = sOAPConsoleService.getRepertoryMessage();
+		return map;
+	}
+
+	/**
+	 * 发票打印
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/invoicePrint/{id}", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap invoicePrint(@PathVariable("id") Long id){
+		ModelMap map = new ModelMap();
+		PurchaseApBillOut apBillOut = purchaseApBillOutService.findById(id);
+		if (apBillOut == null) {
+			map.put("error", "不存在此开票单");
+			return map;
+		}
+		map = sOAPConsoleService.invoicePrint(apBillOut, 0);
+		return map;
+	}
+
+
+	/**
+	 * 清单打印
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/listPrint/{id}", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap listPrint(@PathVariable("id") Long id){
+		ModelMap map = new ModelMap();
+		PurchaseApBillOut apBillOut = purchaseApBillOutService.findById(id);
+		if (apBillOut == null) {
+			map.put("error", "不存在此开票单");
+			return map;
+		}
+		map = sOAPConsoleService.listPrint(apBillOut);
+		return map;
+	}
+
+	/**
+	 * 发票作废
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/InvoiceCancel/{id}", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap InvoiceCancel(@PathVariable("id") Long id){
+		ModelMap map = new ModelMap();
+		PurchaseApBillOut apBillOut = purchaseApBillOutService.findById(id);
+		if (apBillOut == null) {
+			map.put("error", "不存在此开票单");
+			return map;
+		}
+		map = purchaseApBillOutService.invoiceCancel(apBillOut);//sOAPConsoleService.InvoiceCancel(apBillOut);
+		if (map.get("dbError") != null) {
+			logger.log("开票单", "开具发票", (String)map.get("dbError"), null, id);
+			map.remove("dbError");
+			map.put("error","开票失败,系统错误,请联系管理员");
+		}
+		return map;
+	}
+
+	/**
+	 * 查询发票信息
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/queryInvoiceMessage/{id}/{qdbz}/{dybz}", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap queryInvoiceMessage(@PathVariable("id") Long id,
+										@PathVariable("qdbz") Integer qdbz,
+										@PathVariable("dybz") Integer dybz){
+		ModelMap map = new ModelMap();
+		PurchaseApBillOut apBillOut = purchaseApBillOutService.findById(id);
+		if (apBillOut == null) {
+			map.put("error", "不存在此开票单");
+			return map;
+		}
+		map = sOAPConsoleService.queryInvoiceMessage(apBillOut,qdbz,dybz);
+		return map;
+	}
+
+	/**
+	 * 查询库存信息
+	 * @return
+	 */
+	@RequestMapping(value = "/queryRepertyMessage", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap queryRepertyMessage() {
+		ModelMap map = new ModelMap();
+		map = sOAPConsoleService.queryRepertyMessage();
+		return map;
+	}
+
+	/**
+	 * 查询下一发票机库存信息
+	 * @return
+	 */
+	@RequestMapping(value = "/queryNextRepertyMessage", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap queryNextRepertyMessage() {
+		ModelMap map = new ModelMap();
+		map = sOAPConsoleService.queryNextRepertyMessage();
+		return map;
+	}
+
+	/**
+	 * 发票上传
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/invoiceUpload/{id}", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap invoiceUpload(@PathVariable("id") Long id){
+		ModelMap map = new ModelMap();
+		PurchaseApBillOut apBillOut = purchaseApBillOutService.findById(id);
+		if (apBillOut == null) {
+			map.put("error", "不存在此开票单");
+			return map;
+		}
+		map = sOAPConsoleService.invoiceUpload(apBillOut);
+		return map;
+	}
+
+	/**
+	 * 发票状态更新
+	 * @return
+	 */
+	@RequestMapping(value = "/invoiceStatusUpdate", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap invoiceStatusUpdate() {
+		ModelMap map = new ModelMap();
+		map = sOAPConsoleService.invoiceStatusUpdate();
+		return map;
+	}
+
+	/**
+	 * 单张发票查询
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/singleInvoiceQuery/{id}", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap singleInvoiceQuery(@PathVariable("id") Long id){
+		ModelMap map = new ModelMap();
+		PurchaseApBillOut apBillOut = purchaseApBillOutService.findById(id);
+		if (apBillOut == null) {
+			map.put("error", "不存在此开票单");
+			return map;
+		}
+		map = sOAPConsoleService.singleInvoiceQuery(apBillOut);
+		return map;
+	}
+
+	/**
+	 * 金税设备查询
+	 * @return
+	 */
+	@RequestMapping(value = "/taxEquipmentQuery", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap taxEquipmentQuery(){
+		ModelMap map = new ModelMap();
+		map = sOAPConsoleService.taxEquipmentQuery();
+		return map;
+	}
+
+	/**
+	 * 获取分类编码信息
+	 * @param spbm
+	 * @param version
+	 * @return
+	 */
+	@RequestMapping(value = "/taxCode/{spbm}/{version}", method = RequestMethod.GET)
+	@ResponseBody
+	public ModelMap taxCode(@PathVariable("spbm") String spbm,
+										@PathVariable("version") String version){
+		ModelMap map = new ModelMap();
+		PurchaseApBillOutTaxCode taxCode = purchaseApBillOutService.getTaxCode(spbm, version);
+		if (taxCode == null) {
+			map.put("error", "不存在此分类信息,请尽快联系管理员");
+			return map;
+		}
+
+		//科学计数转数字
+		String spbmStr = taxCode.getSpbm();
+		BigDecimal db = new BigDecimal(spbmStr);
+		String ii = db.toPlainString();
+		Long spbmLong = Long.parseLong(ii);
+
+		//数字转科学计数
+		String spbmBackStr = new BigDecimal(spbmLong).stripTrailingZeros().toString();
+
+		map.put("taxCode", taxCode);
+		map.put("spbmstr", spbmStr);
+		map.put("spbmLong", spbmLong);
+		map.put("spbmBackStr", spbmBackStr);
+
+		return map;
+	}
+}

+ 13 - 7
src/main/java/com/uas/platform/b2b/controller/SaleApCheckController.java

@@ -103,6 +103,7 @@ public class SaleApCheckController {
 	/**
 	 * 作为卖家,获取应收对账单(全部)
 	 * 
+	 * @param json
 	 * @return
 	 */
 	@RequestMapping(value = "/getAll", method = RequestMethod.GET)
@@ -278,6 +279,7 @@ public class SaleApCheckController {
 	 * 作为卖家,获取应收对账单(全部)
 	 * 
 	 * @param params
+	 * @param keyword
 	 * @param searchFilter
 	 * @return
 	 */
@@ -413,7 +415,7 @@ public class SaleApCheckController {
 	/**
 	 * 导出 - 全部
 	 * 
-	 * @param searchFilter
+	 * @param params
 	 * @return
 	 */
 	@RequestMapping(value = "/allxls", method = RequestMethod.GET)
@@ -436,7 +438,7 @@ public class SaleApCheckController {
 	/**
 	 * 导出 - 已确认
 	 * 
-	 * @param searchFilter
+	 * @param params
 	 * @return
 	 */
 	@RequestMapping(value = "/allxls", params = RequestState.DONE, method = RequestMethod.GET)
@@ -459,7 +461,7 @@ public class SaleApCheckController {
 	/**
 	 * 导出 - 未对账
 	 * 
-	 * @param searchFilter
+	 * @param params
 	 * @return
 	 */
 	@RequestMapping(value = "/allxls", params = RequestState.TODO, method = RequestMethod.GET)
@@ -482,7 +484,7 @@ public class SaleApCheckController {
 	/**
 	 * 导出 - 已做废
 	 * 
-	 * @param searchFilter
+	 * @param params
 	 * @return
 	 */
 	@RequestMapping(value = "/allxls", params = RequestState.END, method = RequestMethod.GET)
@@ -505,9 +507,7 @@ public class SaleApCheckController {
 	/**
 	 * 全部导出
 	 * 
-	 * @param keyword
-	 * @param fromDate
-	 * @param endDate
+	 * @param params
 	 * @return
 	 */
 	@RequestMapping(value = "/xls", method = RequestMethod.GET)
@@ -587,4 +587,10 @@ public class SaleApCheckController {
 		modelMap.put("all", all);
 		return modelMap;
 	}
+
+	@RequestMapping(value = "/getBilled", method = RequestMethod.GET)
+	@ResponseBody
+	public Double getBilled(Long id) {
+		return purchaseApCheckService.getBilledByItemId(id);
+	}
 }

+ 18 - 0
src/main/java/com/uas/platform/b2b/dao/PurchaseApBillOutDao.java

@@ -0,0 +1,18 @@
+package com.uas.platform.b2b.dao;
+
+import com.uas.platform.b2b.model.PurchaseApBillOut;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.jpa.repository.query.Procedure;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface PurchaseApBillOutDao extends JpaSpecificationExecutor<PurchaseApBillOut>, JpaRepository<PurchaseApBillOut, Long> {
+
+    @Procedure(procedureName = "TAXCODE_INSERT")
+    public void  saveData(String a,String b,String c,String d,String e,String f,String g,String h,String i,String j,String k,String l,String m,String n,String o,String p,String q,String s);
+
+}

+ 13 - 0
src/main/java/com/uas/platform/b2b/dao/PurchaseApBillOutDoneDao.java

@@ -0,0 +1,13 @@
+package com.uas.platform.b2b.dao;
+
+import com.uas.platform.b2b.model.PurchaseApBillOut;
+import com.uas.platform.b2b.model.PurchaseApBillOutDone;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface PurchaseApBillOutDoneDao extends JpaSpecificationExecutor<PurchaseApBillOutDone>, JpaRepository<PurchaseApBillOutDone, Long> {
+
+
+}

+ 13 - 0
src/main/java/com/uas/platform/b2b/dao/PurchaseApBillOutEndDao.java

@@ -0,0 +1,13 @@
+package com.uas.platform.b2b.dao;
+
+import com.uas.platform.b2b.model.PurchaseApBillOutDone;
+import com.uas.platform.b2b.model.PurchaseApBillOutEnd;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface PurchaseApBillOutEndDao extends JpaSpecificationExecutor<PurchaseApBillOutEnd>, JpaRepository<PurchaseApBillOutEnd, Long> {
+
+
+}

+ 26 - 0
src/main/java/com/uas/platform/b2b/dao/PurchaseApBillOutItemDao.java

@@ -0,0 +1,26 @@
+package com.uas.platform.b2b.dao;
+
+import com.uas.platform.b2b.model.PurchaseApBillOutItem;
+import com.uas.platform.b2b.model.PurchaseApCheckItem;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface PurchaseApBillOutItemDao
+		extends JpaSpecificationExecutor<PurchaseApBillOutItem>, JpaRepository<PurchaseApBillOutItem, Long> {
+
+	/**
+	 * 通过sourceTable、sourceId判断是否已提交未对账
+	 *
+	 * @param sourceTable
+	 * @param sourceId
+	 * @return
+	 */
+	public List<PurchaseApBillOutItem> findBySourceTableAndSourceId(String sourceTable, Long sourceId);
+
+}

+ 10 - 0
src/main/java/com/uas/platform/b2b/dao/PurchaseApBillOutTodoDao.java

@@ -0,0 +1,10 @@
+package com.uas.platform.b2b.dao;
+
+import com.uas.platform.b2b.model.PurchaseApBillOutTodo;
+import com.uas.platform.b2b.model.PurchaseApCheckTodo;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface PurchaseApBillOutTodoDao extends JpaSpecificationExecutor<PurchaseApBillOutTodo>, JpaRepository<PurchaseApBillOutTodo, Long> {
+
+}

+ 8 - 0
src/main/java/com/uas/platform/b2b/dao/PurchaseApCheckItemDao.java

@@ -32,4 +32,12 @@ public interface PurchaseApCheckItemDao
 	 * @return
 	 */
 	public List<PurchaseApCheckItem> findBySourceTableAndSourceId(String sourceTable, Long sourceId);
+
+	/**
+	 * 通过id获取已开票数
+	 * @param id
+	 * @return
+	 */
+	@Query("select p.billed from PurchaseApCheckItem p where p.id= :id")
+	public Double getBilledById(@Param("id") Long id);
 }

+ 23 - 0
src/main/java/com/uas/platform/b2b/dao/PurchaseApCheckItemInfoDao.java

@@ -0,0 +1,23 @@
+package com.uas.platform.b2b.dao;
+
+import com.uas.platform.b2b.model.PurchaseApCheckItemInfo;
+import com.uas.platform.b2b.model.PurchaseApCheckTodo;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * Created by 黄诚天 on 2017/7/4.
+ */
+@Repository
+public interface PurchaseApCheckItemInfoDao extends JpaSpecificationExecutor<PurchaseApCheckItemInfo>, JpaRepository<PurchaseApCheckItemInfo, Long> {
+
+    /**
+     * 通过主表id查询详情
+     * @param paid
+     * @return
+     */
+    List<PurchaseApCheckItemInfo> findByPaid(Long paid);
+}

+ 540 - 0
src/main/java/com/uas/platform/b2b/model/PurchaseApBillOut.java

@@ -0,0 +1,540 @@
+package com.uas.platform.b2b.model;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * ...
+ */
+@Entity
+@Table(name = "purc$apbillout")
+public class PurchaseApBillOut implements Serializable {
+
+	/**
+	 * 序列号
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * ID
+	 */
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "purc$apbillout_gen")
+	@SequenceGenerator(name = "purc$apbillout_gen", sequenceName = "purc$apbillout_seq", allocationSize = 1)
+	@Column(name = "pabo_id")
+	private Long id;
+
+	/**
+	 * 税金合计
+	 */
+	@Column(name = "pabo_taxsum")
+	private Double taxSum;
+
+	/**
+	 * 税金差异
+	 */
+	@Column(name = "pabo_differ")
+	private Double differ;
+
+	/**
+	 * 对账起始日期
+	 */
+	@Column(name = "pabo_begindate")
+	private Date beginDate;
+
+	/**
+	 * 对账截止日期
+	 */
+	@Column(name = "pabo_enddate")
+	private Date endDate;
+
+	/**
+	 * 录单日期
+	 */
+	@Column(name = "pabo_recorddate")
+	private Date recordDate;
+
+	/**
+	 * 录单人
+	 */
+	@Column(name = "pabo_recorder")
+	private String recorder;
+
+
+	/**
+	 * 开票状态
+	 */
+	@Column(name = "pabo_checkstatus")
+	private String checkStatus;
+
+	/**
+	 * 备注
+	 */
+	@Column(name = "pabo_remark")
+	private String remark;
+
+	/**
+	 * 提交日期
+	 */
+	@Column(name = "pabo_auditdate")
+	private Date auditDate;
+
+	/**
+	 * 作废日期
+	 */
+	@Column(name = "pabo_resdate")
+	private Date resDate;
+
+	/**
+	 * 作废人
+	 */
+	@Column(name = "pabo_resman")
+	private String resMan;
+
+	/**
+	 * 状态
+	 */
+	@Column(name = "pabo_status")
+	private Short status;
+
+	/**
+	 * 开票金额
+	 */
+	@Column(name = "pabo_amount")
+	private Double amount;
+
+	/**
+	 * 已付款金额
+	 */
+	@Column(name = "pabo_payamount")
+	private Double payAmount;
+
+	/**
+	 * 币别
+	 */
+	@Column(name = "pabo_currency")
+	private String currency;
+
+	/**
+	 * 汇率
+	 */
+	@Column(name = "pabo_rate")
+	private Double rate;
+
+	@OneToOne(cascade = { CascadeType.REFRESH })
+	@JoinColumn(name = "pabo_custuu", insertable = false, updatable = false)
+	private PurchaseApBillOutInfo customerApBillOutInfo;
+
+	/**
+	 * 客户UU
+	 */
+	@Column(name = "pabo_custuu")
+	private Long custUu;
+
+	/**
+	 * 客户名称
+	 */
+	@Column(name = "pabo_custname")
+	private String custName;
+
+	@OneToOne(cascade = { CascadeType.REFRESH })
+	@JoinColumn(name = "pabo_enuu", insertable = false, updatable = false)
+	private PurchaseApBillOutInfo apBillOutInfo;
+
+	/**
+	 * 本企业UU
+	 */
+	@Column(name = "pabo_enuu")
+	private Long enUu;
+
+	/**
+	 * 单据编号
+	 */
+	@Column(name = "pabo_code")
+	private String code;
+
+	/**
+	 * 打印次数
+	 */
+	@Column(name = "pabo_print")
+	private Short print;
+
+	/**
+	 * 开票单明细行
+	 */
+	@OneToMany(mappedBy = "apBillOut", cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.REMOVE,
+			CascadeType.MERGE }, fetch = FetchType.EAGER)
+	@OrderBy("number")
+	private Set<PurchaseApBillOutItem> items;
+
+
+	//以下为开票接口返回信息
+
+	/**
+	 * 返回信息
+	 */
+	@Column(name = "pabo_retmsg")
+	private String retmsg;
+
+	/**
+	 * 开具的金额
+	 */
+	@Column(name = "pabo_infoamount")
+	private Double infoAmount;
+
+	/**
+	 * 开具的税额
+	 */
+	@Column(name = "pabo_infotaxamount")
+	private Double infoTaxAmount;
+
+	/**
+	 * 开票日期(格式:yyyy-mm-dd)
+	 */
+	@Column(name = "pabo_infodate")
+	private String infoDate;
+
+	/**
+	 * 开具的发票代码
+	 */
+	@Column(name = "pabo_infotypecode")
+	private String infoTypeCode;
+
+	/**
+	 * 开具的发票号码
+	 */
+	@Column(name = "pabo_infonumber")
+	private String infoNumber;
+
+	/**
+	 * 上一张发票代码
+	 */
+	@Column(name = "pabo_hisinfotypecode")
+	private String hisInfoTypeCode;
+
+	/**
+	 * 上一张发票号码
+	 */
+	@Column(name = "pabo_hisinfonumber")
+	private String hisInfoNumber;
+
+	/**
+	 * 上一张发票种类
+	 */
+	@Column(name = "pabo_hisinfokind")
+	private String hisInfoKind;
+
+	/**
+	 * 清单标志 0:非清单发票 1:清单发票
+	 */
+	@Column(name = "pabo_listflag")
+	private Integer listFlag;
+
+	/**
+	 * 销方税号
+	 */
+	@Column(name = "pabo_nsrsbh")
+	private String nsrsbh;
+
+	/**
+	 * 开票服务器号
+	 */
+	@Column(name = "pabo_kpfwqh")
+	private String kpfwqh;
+
+	/**
+	 * 开票点号
+	 */
+	@Column(name = "pabo_kpdh")
+	private String kpdh;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Double getTaxSum() {
+		return taxSum;
+	}
+
+	public void setTaxSum(Double taxSum) {
+		this.taxSum = taxSum;
+	}
+
+	public Double getDiffer() {
+		return differ;
+	}
+
+	public void setDiffer(Double differ) {
+		this.differ = differ;
+	}
+
+	public Date getRecordDate() {
+		return recordDate;
+	}
+
+	public void setRecordDate(Date recordDate) {
+		this.recordDate = recordDate;
+	}
+
+	public String getRecorder() {
+		return recorder;
+	}
+
+	public void setRecorder(String recorder) {
+		this.recorder = recorder;
+	}
+
+	public String getCheckStatus() {
+		return checkStatus;
+	}
+
+	public void setCheckStatus(String checkStatus) {
+		this.checkStatus = checkStatus;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public Date getAuditDate() {
+		return auditDate;
+	}
+
+	public void setAuditDate(Date auditDate) {
+		this.auditDate = auditDate;
+	}
+
+	public Date getResDate() {
+		return resDate;
+	}
+
+	public void setResDate(Date resDate) {
+		this.resDate = resDate;
+	}
+
+	public String getResMan() {
+		return resMan;
+	}
+
+	public void setResMan(String resMan) {
+		this.resMan = resMan;
+	}
+
+	public Short getStatus() {
+		return status;
+	}
+
+	public void setStatus(Short status) {
+		this.status = status;
+	}
+
+	public Double getAmount() {
+		return amount;
+	}
+
+	public void setAmount(Double amount) {
+		this.amount = amount;
+	}
+
+	public Double getPayAmount() {
+		return payAmount;
+	}
+
+	public void setPayAmount(Double payAmount) {
+		this.payAmount = payAmount;
+	}
+
+	public String getCurrency() {
+		return currency;
+	}
+
+	public void setCurrency(String currency) {
+		this.currency = currency;
+	}
+
+	public Double getRate() {
+		return rate;
+	}
+
+	public void setRate(Double rate) {
+		this.rate = rate;
+	}
+
+	public Long getCustUu() {
+		return custUu;
+	}
+
+	public void setCustUu(Long custUu) {
+		this.custUu = custUu;
+	}
+
+	public String getCustName() {
+		return custName;
+	}
+
+	public void setCustName(String custName) {
+		this.custName = custName;
+	}
+
+	public Long getEnUu() {
+		return enUu;
+	}
+
+	public void setEnUu(Long enUu) {
+		this.enUu = enUu;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public Short getPrint() {
+		return print;
+	}
+
+	public void setPrint(Short print) {
+		this.print = print;
+	}
+
+	public Set<PurchaseApBillOutItem> getItems() {
+		return items;
+	}
+
+	public void setItems(Set<PurchaseApBillOutItem> items) {
+		this.items = items;
+	}
+
+	public PurchaseApBillOutInfo getCustomerApBillOutInfo() {
+		return customerApBillOutInfo;
+	}
+
+	public void setCustomerApBillOutInfo(PurchaseApBillOutInfo customerApBillOutInfo) {
+		this.customerApBillOutInfo = customerApBillOutInfo;
+	}
+
+	public PurchaseApBillOutInfo getApBillOutInfo() {
+		return apBillOutInfo;
+	}
+
+	public void setApBillOutInfo(PurchaseApBillOutInfo apBillOutInfo) {
+		this.apBillOutInfo = apBillOutInfo;
+	}
+
+	public String getRetmsg() {
+		return retmsg;
+	}
+
+	public void setRetmsg(String retmsg) {
+		this.retmsg = retmsg;
+	}
+
+	public Double getInfoAmount() {
+		return infoAmount;
+	}
+
+	public void setInfoAmount(Double infoAmount) {
+		this.infoAmount = infoAmount;
+	}
+
+	public Double getInfoTaxAmount() {
+		return infoTaxAmount;
+	}
+
+	public void setInfoTaxAmount(Double infoTaxAmount) {
+		this.infoTaxAmount = infoTaxAmount;
+	}
+
+	public String getInfoDate() {
+		return infoDate;
+	}
+
+	public void setInfoDate(String infoDate) {
+		this.infoDate = infoDate;
+	}
+
+	public String getInfoTypeCode() {
+		return infoTypeCode;
+	}
+
+	public void setInfoTypeCode(String infoTypeCode) {
+		this.infoTypeCode = infoTypeCode;
+	}
+
+	public String getInfoNumber() {
+		return infoNumber;
+	}
+
+	public void setInfoNumber(String infoNumber) {
+		this.infoNumber = infoNumber;
+	}
+
+	public String getHisInfoTypeCode() {
+		return hisInfoTypeCode;
+	}
+
+	public void setHisInfoTypeCode(String hisInfoTypeCode) {
+		this.hisInfoTypeCode = hisInfoTypeCode;
+	}
+
+	public String getHisInfoNumber() {
+		return hisInfoNumber;
+	}
+
+	public void setHisInfoNumber(String hisInfoNumber) {
+		this.hisInfoNumber = hisInfoNumber;
+	}
+
+	public String getHisInfoKind() {
+		return hisInfoKind;
+	}
+
+	public void setHisInfoKind(String hisInfoKind) {
+		this.hisInfoKind = hisInfoKind;
+	}
+
+	public Integer getListFlag() {
+		return listFlag;
+	}
+
+	public void setListFlag(Integer listFlag) {
+		this.listFlag = listFlag;
+	}
+
+	public String getNsrsbh() {
+		return nsrsbh;
+	}
+
+	public void setNsrsbh(String nsrsbh) {
+		this.nsrsbh = nsrsbh;
+	}
+
+	public String getKpfwqh() {
+		return kpfwqh;
+	}
+
+	public void setKpfwqh(String kpfwqh) {
+		this.kpfwqh = kpfwqh;
+	}
+
+	public String getKpdh() {
+		return kpdh;
+	}
+
+	public void setKpdh(String kpdh) {
+		this.kpdh = kpdh;
+	}
+}

+ 323 - 0
src/main/java/com/uas/platform/b2b/model/PurchaseApBillOutDone.java

@@ -0,0 +1,323 @@
+package com.uas.platform.b2b.model;
+
+import org.hibernate.annotations.Where;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * ...
+ */
+@Entity
+@Where(clause = "pabo_checkstatus = '已开票' ")
+@Table(name = "purc$apbillout")
+public class PurchaseApBillOutDone implements Serializable {
+
+	/**
+	 * 序列号
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * ID
+	 */
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "purc$apbillout_gen")
+	@SequenceGenerator(name = "purc$apbillout_gen", sequenceName = "purc$apbillout_seq", allocationSize = 1)
+	@Column(name = "pabo_id")
+	private Long id;
+
+	/**
+	 * 税金合计
+	 */
+	@Column(name = "pabo_taxsum")
+	private Double taxSum;
+
+	/**
+	 * 税金差异
+	 */
+	@Column(name = "pabo_differ")
+	private Double differ;
+
+	/**
+	 * 录单日期
+	 */
+	@Column(name = "pabo_recorddate")
+	private Date recordDate;
+
+	/**
+	 * 录单人
+	 */
+	@Column(name = "pabo_recorder")
+	private String recorder;
+
+
+	/**
+	 * 开票状态
+	 */
+	@Column(name = "pabo_checkstatus")
+	private String checkStatus;
+
+	/**
+	 * 备注
+	 */
+	@Column(name = "pabo_remark")
+	private String remark;
+
+	/**
+	 * 提交日期
+	 */
+	@Column(name = "pabo_auditdate")
+	private Date auditDate;
+
+	/**
+	 * 作废日期
+	 */
+	@Column(name = "pabo_resdate")
+	private Date resDate;
+
+	/**
+	 * 作废人
+	 */
+	@Column(name = "pabo_resman")
+	private String resMan;
+
+	/**
+	 * 状态
+	 */
+	@Column(name = "pabo_status")
+	private Short status;
+
+	/**
+	 * 开票金额
+	 */
+	@Column(name = "pabo_amount")
+	private Double amount;
+
+	/**
+	 * 已付款金额
+	 */
+	@Column(name = "pabo_payamount")
+	private Double payAmount;
+
+	/**
+	 * 币别
+	 */
+	@Column(name = "pabo_currency")
+	private String currency;
+
+	/**
+	 * 汇率
+	 */
+	@Column(name = "pabo_rate")
+	private Double rate;
+
+
+	/**
+	 * 客户UU
+	 */
+	@Column(name = "pabo_custuu")
+	private Long custUu;
+
+	/**
+	 * 客户名称
+	 */
+	@Column(name = "pabo_custname")
+	private String custName;
+
+	/**
+	 * 本企业UU
+	 */
+	@Column(name = "pabo_enuu")
+	private Long enUu;
+
+	/**
+	 * 单据编号
+	 */
+	@Column(name = "pabo_code")
+	private String code;
+
+	/**
+	 * 打印次数
+	 */
+	@Column(name = "pabo_print")
+	private Short print;
+
+	/**
+	 * 开票单明细行
+	 */
+	@OneToMany(mappedBy = "apBillOut", cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.REMOVE,
+			CascadeType.MERGE }, fetch = FetchType.EAGER)
+	@OrderBy("number")
+	private Set<PurchaseApBillOutItem> items;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Double getTaxSum() {
+		return taxSum;
+	}
+
+	public void setTaxSum(Double taxSum) {
+		this.taxSum = taxSum;
+	}
+
+	public Double getDiffer() {
+		return differ;
+	}
+
+	public void setDiffer(Double differ) {
+		this.differ = differ;
+	}
+
+	public Date getRecordDate() {
+		return recordDate;
+	}
+
+	public void setRecordDate(Date recordDate) {
+		this.recordDate = recordDate;
+	}
+
+	public String getRecorder() {
+		return recorder;
+	}
+
+	public void setRecorder(String recorder) {
+		this.recorder = recorder;
+	}
+
+	public String getCheckStatus() {
+		return checkStatus;
+	}
+
+	public void setCheckStatus(String checkStatus) {
+		this.checkStatus = checkStatus;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public Date getAuditDate() {
+		return auditDate;
+	}
+
+	public void setAuditDate(Date auditDate) {
+		this.auditDate = auditDate;
+	}
+
+	public Date getResDate() {
+		return resDate;
+	}
+
+	public void setResDate(Date resDate) {
+		this.resDate = resDate;
+	}
+
+	public String getResMan() {
+		return resMan;
+	}
+
+	public void setResMan(String resMan) {
+		this.resMan = resMan;
+	}
+
+	public Short getStatus() {
+		return status;
+	}
+
+	public void setStatus(Short status) {
+		this.status = status;
+	}
+
+	public Double getAmount() {
+		return amount;
+	}
+
+	public void setAmount(Double amount) {
+		this.amount = amount;
+	}
+
+	public Double getPayAmount() {
+		return payAmount;
+	}
+
+	public void setPayAmount(Double payAmount) {
+		this.payAmount = payAmount;
+	}
+
+	public String getCurrency() {
+		return currency;
+	}
+
+	public void setCurrency(String currency) {
+		this.currency = currency;
+	}
+
+	public Double getRate() {
+		return rate;
+	}
+
+	public void setRate(Double rate) {
+		this.rate = rate;
+	}
+
+	public Long getCustUu() {
+		return custUu;
+	}
+
+	public void setCustUu(Long custUu) {
+		this.custUu = custUu;
+	}
+
+	public String getCustName() {
+		return custName;
+	}
+
+	public void setCustName(String custName) {
+		this.custName = custName;
+	}
+
+	public Long getEnUu() {
+		return enUu;
+	}
+
+	public void setEnUu(Long enUu) {
+		this.enUu = enUu;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public Short getPrint() {
+		return print;
+	}
+
+	public void setPrint(Short print) {
+		this.print = print;
+	}
+
+	public Set<PurchaseApBillOutItem> getItems() {
+		return items;
+	}
+
+	public void setItems(Set<PurchaseApBillOutItem> items) {
+		this.items = items;
+	}
+}

+ 323 - 0
src/main/java/com/uas/platform/b2b/model/PurchaseApBillOutEnd.java

@@ -0,0 +1,323 @@
+package com.uas.platform.b2b.model;
+
+import org.hibernate.annotations.Where;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * ...
+ */
+@Entity
+@Where(clause = "pabo_checkstatus = '已作废' ")
+@Table(name = "purc$apbillout")
+public class PurchaseApBillOutEnd implements Serializable {
+
+	/**
+	 * 序列号
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * ID
+	 */
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "purc$apbillout_gen")
+	@SequenceGenerator(name = "purc$apbillout_gen", sequenceName = "purc$apbillout_seq", allocationSize = 1)
+	@Column(name = "pabo_id")
+	private Long id;
+
+	/**
+	 * 税金合计
+	 */
+	@Column(name = "pabo_taxsum")
+	private Double taxSum;
+
+	/**
+	 * 税金差异
+	 */
+	@Column(name = "pabo_differ")
+	private Double differ;
+
+	/**
+	 * 录单日期
+	 */
+	@Column(name = "pabo_recorddate")
+	private Date recordDate;
+
+	/**
+	 * 录单人
+	 */
+	@Column(name = "pabo_recorder")
+	private String recorder;
+
+
+	/**
+	 * 开票状态
+	 */
+	@Column(name = "pabo_checkstatus")
+	private String checkStatus;
+
+	/**
+	 * 备注
+	 */
+	@Column(name = "pabo_remark")
+	private String remark;
+
+	/**
+	 * 提交日期
+	 */
+	@Column(name = "pabo_auditdate")
+	private Date auditDate;
+
+	/**
+	 * 作废日期
+	 */
+	@Column(name = "pabo_resdate")
+	private Date resDate;
+
+	/**
+	 * 作废人
+	 */
+	@Column(name = "pabo_resman")
+	private String resMan;
+
+	/**
+	 * 状态
+	 */
+	@Column(name = "pabo_status")
+	private Short status;
+
+	/**
+	 * 开票金额
+	 */
+	@Column(name = "pabo_amount")
+	private Double amount;
+
+	/**
+	 * 已付款金额
+	 */
+	@Column(name = "pabo_payamount")
+	private Double payAmount;
+
+	/**
+	 * 币别
+	 */
+	@Column(name = "pabo_currency")
+	private String currency;
+
+	/**
+	 * 汇率
+	 */
+	@Column(name = "pabo_rate")
+	private Double rate;
+
+
+	/**
+	 * 客户UU
+	 */
+	@Column(name = "pabo_custuu")
+	private Long custUu;
+
+	/**
+	 * 客户名称
+	 */
+	@Column(name = "pabo_custname")
+	private String custName;
+
+	/**
+	 * 本企业UU
+	 */
+	@Column(name = "pabo_enuu")
+	private Long enUu;
+
+	/**
+	 * 单据编号
+	 */
+	@Column(name = "pabo_code")
+	private String code;
+
+	/**
+	 * 打印次数
+	 */
+	@Column(name = "pabo_print")
+	private Short print;
+
+	/**
+	 * 开票单明细行
+	 */
+	@OneToMany(mappedBy = "apBillOut", cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.REMOVE,
+			CascadeType.MERGE }, fetch = FetchType.EAGER)
+	@OrderBy("number")
+	private Set<PurchaseApBillOutItem> items;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Double getTaxSum() {
+		return taxSum;
+	}
+
+	public void setTaxSum(Double taxSum) {
+		this.taxSum = taxSum;
+	}
+
+	public Double getDiffer() {
+		return differ;
+	}
+
+	public void setDiffer(Double differ) {
+		this.differ = differ;
+	}
+
+	public Date getRecordDate() {
+		return recordDate;
+	}
+
+	public void setRecordDate(Date recordDate) {
+		this.recordDate = recordDate;
+	}
+
+	public String getRecorder() {
+		return recorder;
+	}
+
+	public void setRecorder(String recorder) {
+		this.recorder = recorder;
+	}
+
+	public String getCheckStatus() {
+		return checkStatus;
+	}
+
+	public void setCheckStatus(String checkStatus) {
+		this.checkStatus = checkStatus;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public Date getAuditDate() {
+		return auditDate;
+	}
+
+	public void setAuditDate(Date auditDate) {
+		this.auditDate = auditDate;
+	}
+
+	public Date getResDate() {
+		return resDate;
+	}
+
+	public void setResDate(Date resDate) {
+		this.resDate = resDate;
+	}
+
+	public String getResMan() {
+		return resMan;
+	}
+
+	public void setResMan(String resMan) {
+		this.resMan = resMan;
+	}
+
+	public Short getStatus() {
+		return status;
+	}
+
+	public void setStatus(Short status) {
+		this.status = status;
+	}
+
+	public Double getAmount() {
+		return amount;
+	}
+
+	public void setAmount(Double amount) {
+		this.amount = amount;
+	}
+
+	public Double getPayAmount() {
+		return payAmount;
+	}
+
+	public void setPayAmount(Double payAmount) {
+		this.payAmount = payAmount;
+	}
+
+	public String getCurrency() {
+		return currency;
+	}
+
+	public void setCurrency(String currency) {
+		this.currency = currency;
+	}
+
+	public Double getRate() {
+		return rate;
+	}
+
+	public void setRate(Double rate) {
+		this.rate = rate;
+	}
+
+	public Long getCustUu() {
+		return custUu;
+	}
+
+	public void setCustUu(Long custUu) {
+		this.custUu = custUu;
+	}
+
+	public String getCustName() {
+		return custName;
+	}
+
+	public void setCustName(String custName) {
+		this.custName = custName;
+	}
+
+	public Long getEnUu() {
+		return enUu;
+	}
+
+	public void setEnUu(Long enUu) {
+		this.enUu = enUu;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public Short getPrint() {
+		return print;
+	}
+
+	public void setPrint(Short print) {
+		this.print = print;
+	}
+
+	public Set<PurchaseApBillOutItem> getItems() {
+		return items;
+	}
+
+	public void setItems(Set<PurchaseApBillOutItem> items) {
+		this.items = items;
+	}
+}

+ 391 - 0
src/main/java/com/uas/platform/b2b/model/PurchaseApBillOutItem.java

@@ -0,0 +1,391 @@
+package com.uas.platform.b2b.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import org.codehaus.jackson.annotate.JsonIgnore;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 买家应付(卖家应收)对账单明细
+ */
+@Table(name = "purc$apbilloutitem")
+@Entity
+public class PurchaseApBillOutItem implements Serializable {
+
+	/**
+	 * 序列号
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * ID
+	 */
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "purc$apbilloutitem_gen")
+	@SequenceGenerator(name = "purc$apbilloutitem_gen", sequenceName = "purc$apbilloutitem_seq", allocationSize = 1)
+	@Column(name = "pai_id")
+	private Long id;
+
+	/**
+	 * 行号
+	 */
+	@Column(name = "pai_number")
+	private Short number;
+
+	/**
+	 * 状态
+	 */
+	@Column(name = "pai_status")
+	private Integer status;
+
+	/**
+	 * 状态码
+	 */
+	@Column(name = "pai_statuscode")
+	private Integer statusCode;
+
+	/**
+	 * 开票单价  //已用作明细开票金额
+	 */
+	@Column(name = "pai_nowprice")
+	private Double nowPrice;
+
+	/**
+	 * 成本单价
+	 */
+	@Column(name = "pai_costprice")
+	private Double costPrice;
+
+	/**
+	 * 发票单价  //已用作产品单价
+	 */
+	@Column(name = "pai_price")
+	private Double price;
+
+	/**
+	 * 税率(%)
+	 */
+	@Column(name = "pai_taxrate")
+	private Double taxrate;
+
+	/**
+	 * 发票数量
+	 */
+	@Column(name = "pai_qty")
+	private Double qty;
+
+	/**
+	 * 开票数量
+	 */
+	@Column(name = "pai_nowqty")
+	private Double NowQty;
+
+	@OneToOne(cascade = { CascadeType.REFRESH })
+	@JoinColumn(name = "pai_prid", insertable = false, updatable = false)
+	private Product product;
+
+	/**
+	 * 客户物料ID
+	 */
+	@Column(name = "pai_prid")
+	private Long prid;
+
+	/**
+	 * 客户料号
+	 */
+	@Column(name = "pai_prodcode")
+	private String prodCode;
+
+	/**
+	 * 客户订单单号
+	 */
+	@Column(name = "pai_ordercode")
+	private String orderCode;
+
+	/**
+	 * 客户出入库类型
+	 */
+	@Column(name = "pai_orderclass")
+	private String orderClass;
+
+	/**
+	 * 客户订单序号
+	 */
+	@Column(name = "pai_orderdetno")
+	private Long orderDetno;
+
+	/**
+	 * 客户出入库单号
+	 */
+	@Column(name = "pai_inoutno")
+	private String inoutno;
+
+	/**
+	 * 出入库单序号
+	 */
+	@Column(name = "pai_inoutnodetno")
+	private Long inoutnodetno;
+
+	/**
+	 * 单据编号
+	 */
+	@Column(name = "pai_code")
+	private String code;
+
+	/**
+	 * 主表ID
+	 */
+	@Column(name = "pai_billoutid")
+	private Long billOutId;
+
+	/**
+	 * 发票ID
+	 */
+	@Column(name = "pai_orderid")
+	private Long orderId;
+
+	/**
+	 * 明细行数据来源表
+	 */
+	@Column(name = "pai_sourcetable")
+	private String sourceTable;
+
+	/**
+	 * 明细行数据来源对应ID
+	 */
+	@Column(name = "pai_sourceid")
+	private Long sourceId;
+
+	/**
+	 * 此次开票之前的开票数(用于作废开票单时)
+	 */
+	@Column(name = "pai_oldqty")
+	private Double oldQty;
+
+
+	/**
+	 * 开票账单主记录
+	 */
+	@ManyToOne(cascade = CascadeType.ALL, optional = true)
+	@JoinColumn(name = "pai_paboid", nullable = false)
+	private PurchaseApBillOut apBillOut;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Short getNumber() {
+		return number;
+	}
+
+	public void setNumber(Short number) {
+		this.number = number;
+	}
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	public Integer getStatusCode() {
+		return statusCode;
+	}
+
+	public void setStatusCode(Integer statusCode) {
+		this.statusCode = statusCode;
+	}
+
+	public Double getNowPrice() {
+		return nowPrice;
+	}
+
+	public void setNowPrice(Double nowPrice) {
+		this.nowPrice = nowPrice;
+	}
+
+	public Double getCostPrice() {
+		return costPrice;
+	}
+
+	public void setCostPrice(Double costPrice) {
+		this.costPrice = costPrice;
+	}
+
+	public Double getPrice() {
+		return price;
+	}
+
+	public void setPrice(Double price) {
+		this.price = price;
+	}
+
+	public Double getTaxrate() {
+		return taxrate;
+	}
+
+	public void setTaxrate(Double taxrate) {
+		this.taxrate = taxrate;
+	}
+
+	public Double getQty() {
+		return qty;
+	}
+
+	public void setQty(Double qty) {
+		this.qty = qty;
+	}
+
+	public Double getNowQty() {
+		return NowQty;
+	}
+
+	public void setNowQty(Double nowQty) {
+		NowQty = nowQty;
+	}
+
+	public String getOrderCode() {
+		return orderCode;
+	}
+
+	public void setOrderCode(String orderCode) {
+		this.orderCode = orderCode;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public Long getBillOutId() {
+		return billOutId;
+	}
+
+	public void setBillOutId(Long billOutId) {
+		this.billOutId = billOutId;
+	}
+
+	public Long getPrid() {
+		return prid;
+	}
+
+	public void setPrid(Long prid) {
+		this.prid = prid;
+	}
+
+	public String getProdCode() {
+		return prodCode;
+	}
+
+	public void setProdCode(String prodCode) {
+		this.prodCode = prodCode;
+	}
+
+	public String getSourceTable() {
+		return sourceTable;
+	}
+
+	public void setSourceTable(String sourceTable) {
+		this.sourceTable = sourceTable;
+	}
+
+	public Long getSourceId() {
+		return sourceId;
+	}
+
+	public void setSourceId(Long sourceId) {
+		this.sourceId = sourceId;
+	}
+
+	public Double getOldQty() {
+		return oldQty;
+	}
+
+	public void setOldQty(Double oldQty) {
+		this.oldQty = oldQty;
+	}
+
+	public Long getOrderId() {
+		return orderId;
+	}
+
+	public void setOrderId(Long orderId) {
+		this.orderId = orderId;
+	}
+
+	public Product getProduct() {
+		return product;
+	}
+
+	public void setProduct(Product product) {
+		this.product = product;
+	}
+
+	@JSONField(serialize = false)
+	@JsonIgnore
+	public PurchaseApBillOut getApBillOut() {
+		return apBillOut;
+	}
+
+	public void setApBillOut(PurchaseApBillOut apBillOut) {
+		this.apBillOut = apBillOut;
+	}
+
+	public static List<PurchaseApBillOut> distinct(List<PurchaseApBillOutItem> items) {
+		List<PurchaseApBillOut> PurchaseApBillOuts = new ArrayList<PurchaseApBillOut>();
+		Set<Long> keys = new HashSet<Long>();
+		for (PurchaseApBillOutItem item : items) {
+			if (!keys.contains(item.apBillOut.getId())) {
+				PurchaseApBillOuts.add(item.apBillOut);
+				keys.add(item.apBillOut.getId());
+			}
+		}
+		return PurchaseApBillOuts;
+	}
+
+	public String getOrderClass() {
+		return orderClass;
+	}
+
+	public void setOrderClass(String orderClass) {
+		this.orderClass = orderClass;
+	}
+
+	public Long getOrderDetno() {
+		return orderDetno;
+	}
+
+	public void setOrderDetno(Long orderDetno) {
+		this.orderDetno = orderDetno;
+	}
+
+	public String getInoutno() {
+		return inoutno;
+	}
+
+	public void setInoutno(String inoutno) {
+		this.inoutno = inoutno;
+	}
+
+	public Long getInoutnodetno() {
+		return inoutnodetno;
+	}
+
+	public void setInoutnodetno(Long inoutnodetno) {
+		this.inoutnodetno = inoutnodetno;
+	}
+}

+ 100 - 0
src/main/java/com/uas/platform/b2b/model/PurchaseApBillOutTaxCode.java

@@ -0,0 +1,100 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017-08-01.
+ */
+public class PurchaseApBillOutTaxCode {
+    Integer id;
+    String spbm;
+    String spmc;
+    String zzssl;
+    String hzx;
+    String kyzt;
+    String zzstsgl;
+    String tjjbm;
+    String pid;
+    String version;
+
+    public PurchaseApBillOutTaxCode() {
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getSpbm() {
+        return spbm;
+    }
+
+    public void setSpbm(String spbm) {
+        this.spbm = spbm;
+    }
+
+    public String getSpmc() {
+        return spmc;
+    }
+
+    public void setSpmc(String spmc) {
+        this.spmc = spmc;
+    }
+
+    public String getZzssl() {
+        return zzssl;
+    }
+
+    public void setZzssl(String zzssl) {
+        this.zzssl = zzssl;
+    }
+
+    public String getHzx() {
+        return hzx;
+    }
+
+    public void setHzx(String hzx) {
+        this.hzx = hzx;
+    }
+
+    public String getKyzt() {
+        return kyzt;
+    }
+
+    public void setKyzt(String kyzt) {
+        this.kyzt = kyzt;
+    }
+
+    public String getZzstsgl() {
+        return zzstsgl;
+    }
+
+    public void setZzstsgl(String zzstsgl) {
+        this.zzstsgl = zzstsgl;
+    }
+
+    public String getTjjbm() {
+        return tjjbm;
+    }
+
+    public void setTjjbm(String tjjbm) {
+        this.tjjbm = tjjbm;
+    }
+
+    public String getPid() {
+        return pid;
+    }
+
+    public void setPid(String pid) {
+        this.pid = pid;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+}

+ 323 - 0
src/main/java/com/uas/platform/b2b/model/PurchaseApBillOutTodo.java

@@ -0,0 +1,323 @@
+package com.uas.platform.b2b.model;
+
+import org.hibernate.annotations.Where;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * ...
+ */
+@Entity
+@Where(clause = "pabo_checkstatus = '未开票' ")
+@Table(name = "purc$apbillout")
+public class PurchaseApBillOutTodo implements Serializable {
+
+	/**
+	 * 序列号
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * ID
+	 */
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "purc$apbillout_gen")
+	@SequenceGenerator(name = "purc$apbillout_gen", sequenceName = "purc$apbillout_seq", allocationSize = 1)
+	@Column(name = "pabo_id")
+	private Long id;
+
+	/**
+	 * 税金合计
+	 */
+	@Column(name = "pabo_taxsum")
+	private Double taxSum;
+
+	/**
+	 * 税金差异
+	 */
+	@Column(name = "pabo_differ")
+	private Double differ;
+
+	/**
+	 * 录单日期
+	 */
+	@Column(name = "pabo_recorddate")
+	private Date recordDate;
+
+	/**
+	 * 录单人
+	 */
+	@Column(name = "pabo_recorder")
+	private String recorder;
+
+
+	/**
+	 * 开票状态
+	 */
+	@Column(name = "pabo_checkstatus")
+	private String checkStatus;
+
+	/**
+	 * 备注
+	 */
+	@Column(name = "pabo_remark")
+	private String remark;
+
+	/**
+	 * 提交日期
+	 */
+	@Column(name = "pabo_auditdate")
+	private Date auditDate;
+
+	/**
+	 * 作废日期
+	 */
+	@Column(name = "pabo_resdate")
+	private Date resDate;
+
+	/**
+	 * 作废人
+	 */
+	@Column(name = "pabo_resman")
+	private String resMan;
+
+	/**
+	 * 状态
+	 */
+	@Column(name = "pabo_status")
+	private Short status;
+
+	/**
+	 * 开票金额
+	 */
+	@Column(name = "pabo_amount")
+	private Double amount;
+
+	/**
+	 * 已付款金额
+	 */
+	@Column(name = "pabo_payamount")
+	private Double payAmount;
+
+	/**
+	 * 币别
+	 */
+	@Column(name = "pabo_currency")
+	private String currency;
+
+	/**
+	 * 汇率
+	 */
+	@Column(name = "pabo_rate")
+	private Double rate;
+
+
+	/**
+	 * 客户UU
+	 */
+	@Column(name = "pabo_custuu")
+	private Long custUu;
+
+	/**
+	 * 客户名称
+	 */
+	@Column(name = "pabo_custname")
+	private String custName;
+
+	/**
+	 * 本企业UU
+	 */
+	@Column(name = "pabo_enuu")
+	private Long enUu;
+
+	/**
+	 * 单据编号
+	 */
+	@Column(name = "pabo_code")
+	private String code;
+
+	/**
+	 * 打印次数
+	 */
+	@Column(name = "pabo_print")
+	private Short print;
+
+	/**
+	 * 开票单明细行
+	 */
+	@OneToMany(mappedBy = "apBillOut", cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.REMOVE,
+			CascadeType.MERGE }, fetch = FetchType.EAGER)
+	@OrderBy("number")
+	private Set<PurchaseApBillOutItem> items;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Double getTaxSum() {
+		return taxSum;
+	}
+
+	public void setTaxSum(Double taxSum) {
+		this.taxSum = taxSum;
+	}
+
+	public Double getDiffer() {
+		return differ;
+	}
+
+	public void setDiffer(Double differ) {
+		this.differ = differ;
+	}
+
+	public Date getRecordDate() {
+		return recordDate;
+	}
+
+	public void setRecordDate(Date recordDate) {
+		this.recordDate = recordDate;
+	}
+
+	public String getRecorder() {
+		return recorder;
+	}
+
+	public void setRecorder(String recorder) {
+		this.recorder = recorder;
+	}
+
+	public String getCheckStatus() {
+		return checkStatus;
+	}
+
+	public void setCheckStatus(String checkStatus) {
+		this.checkStatus = checkStatus;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public Date getAuditDate() {
+		return auditDate;
+	}
+
+	public void setAuditDate(Date auditDate) {
+		this.auditDate = auditDate;
+	}
+
+	public Date getResDate() {
+		return resDate;
+	}
+
+	public void setResDate(Date resDate) {
+		this.resDate = resDate;
+	}
+
+	public String getResMan() {
+		return resMan;
+	}
+
+	public void setResMan(String resMan) {
+		this.resMan = resMan;
+	}
+
+	public Short getStatus() {
+		return status;
+	}
+
+	public void setStatus(Short status) {
+		this.status = status;
+	}
+
+	public Double getAmount() {
+		return amount;
+	}
+
+	public void setAmount(Double amount) {
+		this.amount = amount;
+	}
+
+	public Double getPayAmount() {
+		return payAmount;
+	}
+
+	public void setPayAmount(Double payAmount) {
+		this.payAmount = payAmount;
+	}
+
+	public String getCurrency() {
+		return currency;
+	}
+
+	public void setCurrency(String currency) {
+		this.currency = currency;
+	}
+
+	public Double getRate() {
+		return rate;
+	}
+
+	public void setRate(Double rate) {
+		this.rate = rate;
+	}
+
+	public Long getCustUu() {
+		return custUu;
+	}
+
+	public void setCustUu(Long custUu) {
+		this.custUu = custUu;
+	}
+
+	public String getCustName() {
+		return custName;
+	}
+
+	public void setCustName(String custName) {
+		this.custName = custName;
+	}
+
+	public Long getEnUu() {
+		return enUu;
+	}
+
+	public void setEnUu(Long enUu) {
+		this.enUu = enUu;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public Short getPrint() {
+		return print;
+	}
+
+	public void setPrint(Short print) {
+		this.print = print;
+	}
+
+	public Set<PurchaseApBillOutItem> getItems() {
+		return items;
+	}
+
+	public void setItems(Set<PurchaseApBillOutItem> items) {
+		this.items = items;
+	}
+}

+ 366 - 0
src/main/java/com/uas/platform/b2b/model/PurchaseApCheckInfo.java

@@ -0,0 +1,366 @@
+package com.uas.platform.b2b.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import org.codehaus.jackson.annotate.JsonIgnore;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * 买家应付(卖家应收)对账单
+ */
+@Entity
+@Table(name = "purc$apcheck")
+public class PurchaseApCheckInfo implements Serializable {
+
+	/**
+	 * 序列号
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * ID
+	 */
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "purc$apcheck_gen")
+	@SequenceGenerator(name = "purc$apcheck_gen", sequenceName = "purc$apcheck_seq", allocationSize = 1)
+	@Column(name = "pa_id")
+	private Long id;
+
+	/**
+	 * 对账起始日期
+	 */
+	@Column(name = "pa_begindate")
+	private Date beginDate;
+
+	/**
+	 * 对账截止日期
+	 */
+	@Column(name = "pa_enddate")
+	private Date endDate;
+
+	/**
+	 * 录单日期
+	 */
+	@Column(name = "pa_recorddate")
+	private Date recordDate;
+
+	/**
+	 * 录单人
+	 */
+	@Column(name = "pa_recorder")
+	private String recorder;
+
+	/**
+	 * 应收日期
+	 */
+	@Column(name = "pa_apdate")
+	private Date apDate;
+
+	/**
+	 * 对账状态
+	 */
+	@Column(name = "pa_checkstatus")
+	private String checkStatus;
+
+	/**
+	 * 备注
+	 */
+	@Column(name = "pa_remark")
+	private String remark;
+
+	/**
+	 * 提交日期
+	 */
+	@Column(name = "pa_commitdate")
+	private Date commitDate;
+
+	/**
+	 * 作废日期
+	 */
+	@Column(name = "pa_resdate")
+	private Date resDate;
+
+	/**
+	 * 作废人
+	 */
+	@Column(name = "pa_resman")
+	private String resMan;
+
+	/**
+	 * 上传状态
+	 */
+	@Column(name = "pa_status")
+	private Short status;
+
+	/**
+	 * 对账总额
+	 */
+	@Column(name = "pa_checkamount")
+	private Double checkAmount;
+
+	/**
+	 * 币别
+	 */
+	@Column(name = "pa_currency")
+	private String currency;
+
+	/**
+	 * 汇率
+	 */
+	@Column(name = "pa_taxrate")
+	private Double taxrate;
+
+	/**
+	 * 汇率
+	 */
+	@Column(name = "pa_rate")
+	private Double rate;
+
+	/**
+	 * 收款方式
+	 */
+	@Column(name = "pa_payments")
+	private String payments;
+
+	/**
+	 * 客户UU
+	 */
+	@Column(name = "pa_custuu")
+	private Long custUu;
+
+	/**
+	 * 客户名称
+	 */
+	@Column(name = "pa_custname")
+	private String custName;
+
+	/**
+	 * 本企业UU
+	 */
+	@Column(name = "pa_enuu")
+	private Long enUu;
+
+	/**
+	 * 单据编号
+	 */
+	@Column(name = "pa_code")
+	private String code;
+
+	/**
+	 * 客户回复原因
+	 */
+	@Column(name = "pa_custreply")
+	private String custreply;
+
+	/**
+	 * 打印次数
+	 */
+	@Column(name = "pa_print")
+	private Short print;
+
+	/**
+	 * 对账单明细行
+	 */
+	@OneToMany(mappedBy = "apCheck", cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.REMOVE,
+			CascadeType.MERGE }, fetch = FetchType.EAGER)
+	@OrderBy("number")
+	private Set<PurchaseApCheckItemInfo> items;
+
+	public String getCustreply() {
+		return custreply;
+	}
+
+	public void setCustreply(String custreply) {
+		this.custreply = custreply;
+	}
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Date getBeginDate() {
+		return beginDate;
+	}
+
+	public void setBeginDate(Date beginDate) {
+		this.beginDate = beginDate;
+	}
+
+	public Date getEndDate() {
+		return endDate;
+	}
+
+	public void setEndDate(Date endDate) {
+		this.endDate = endDate;
+	}
+
+	public Date getRecordDate() {
+		return recordDate;
+	}
+
+	public void setRecordDate(Date recordDate) {
+		this.recordDate = recordDate;
+	}
+
+	public String getRecorder() {
+		return recorder;
+	}
+
+	public void setRecorder(String recorder) {
+		this.recorder = recorder;
+	}
+
+	public Date getApDate() {
+		return apDate;
+	}
+
+	public void setApDate(Date apDate) {
+		this.apDate = apDate;
+	}
+
+	public String getCheckStatus() {
+		return checkStatus;
+	}
+
+	public void setCheckStatus(String checkStatus) {
+		this.checkStatus = checkStatus;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public Date getCommitDate() {
+		return commitDate;
+	}
+
+	public void setCommitDate(Date commitDate) {
+		this.commitDate = commitDate;
+	}
+
+	public Date getResDate() {
+		return resDate;
+	}
+
+	public void setResDate(Date resDate) {
+		this.resDate = resDate;
+	}
+
+	public String getResMan() {
+		return resMan;
+	}
+
+	public void setResMan(String resMan) {
+		this.resMan = resMan;
+	}
+
+	public Short getStatus() {
+		return status;
+	}
+
+	public void setStatus(Short status) {
+		this.status = status;
+	}
+
+	public Double getCheckAmount() {
+		return checkAmount;
+	}
+
+	public void setCheckAmount(Double checkAmount) {
+		this.checkAmount = checkAmount;
+	}
+
+	public String getCurrency() {
+		return currency;
+	}
+
+	public void setCurrency(String currency) {
+		this.currency = currency;
+	}
+
+	public Double getTaxrate() {
+		return taxrate;
+	}
+
+	public void setTaxrate(Double taxrate) {
+		this.taxrate = taxrate;
+	}
+
+	public String getPayments() {
+		return payments;
+	}
+
+	public void setPayments(String payments) {
+		this.payments = payments;
+	}
+
+	public Long getCustUu() {
+		return custUu;
+	}
+
+	public void setCustUu(Long custUu) {
+		this.custUu = custUu;
+	}
+
+	public String getCustName() {
+		return custName;
+	}
+
+	public void setCustName(String custName) {
+		this.custName = custName;
+	}
+
+	public Long getEnUu() {
+		return enUu;
+	}
+
+	public void setEnUu(Long enUu) {
+		this.enUu = enUu;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	@JsonIgnore
+	@JSONField(serialize = false)
+	public Set<PurchaseApCheckItemInfo> getItems() {
+		return items;
+	}
+
+	public void setItems(Set<PurchaseApCheckItemInfo> items) {
+		this.items = items;
+	}
+
+	public Double getRate() {
+		return rate;
+	}
+
+	public void setRate(Double rate) {
+		this.rate = rate;
+	}
+
+	public Short getPrint() {
+		return print;
+	}
+
+	public void setPrint(Short print) {
+		this.print = print;
+	}
+
+}

+ 19 - 16
src/main/java/com/uas/platform/b2b/model/PurchaseApCheckItem.java

@@ -1,26 +1,15 @@
 package com.uas.platform.b2b.model;
 
+import com.alibaba.fastjson.annotation.JSONField;
+import org.codehaus.jackson.annotate.JsonIgnore;
+
+import javax.persistence.*;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
-import org.codehaus.jackson.annotate.JsonIgnore;
-
-import com.alibaba.fastjson.annotation.JSONField;
-
 /**
  * 买家应付(卖家应收)对账单明细
  */
@@ -186,6 +175,12 @@ public class PurchaseApCheckItem implements Serializable {
 	@Column(name = "pai_whname")
 	private String whname;
 
+	/**
+	 * 已开票数量
+	 */
+	@Column(name = "pai_billed")
+	private Double billed;
+
 	/**
 	 * 应收对账单主记录
 	 */
@@ -362,7 +357,7 @@ public class PurchaseApCheckItem implements Serializable {
 	}
 
 	@JsonIgnore
-	@JSONField(serialize = false)
+	@JSONField(serialize =  false)
 	public PurchaseApCheck getApCheck() {
 		return apCheck;
 	}
@@ -403,6 +398,14 @@ public class PurchaseApCheckItem implements Serializable {
 		this.whname = whname;
 	}
 
+	public Double getBilled() {
+		return billed;
+	}
+
+	public void setBilled(Double billed) {
+		this.billed = billed;
+	}
+
 	public static List<PurchaseApCheck> distinct(List<PurchaseApCheckItem> items) {
 		List<PurchaseApCheck> purchaseApChecks = new ArrayList<PurchaseApCheck>();
 		Set<Long> keys = new HashSet<Long>();

+ 431 - 0
src/main/java/com/uas/platform/b2b/model/PurchaseApCheckItemInfo.java

@@ -0,0 +1,431 @@
+package com.uas.platform.b2b.model;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.sym.Name;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 买家应付(卖家应收)对账单明细
+ */
+@Table(name = "purc$apcheckitem")
+@Entity
+public class PurchaseApCheckItemInfo implements Serializable {
+
+	/**
+	 * 序列号
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * ID
+	 */
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "purc$apcheckitem_gen")
+	@SequenceGenerator(name = "purc$apcheckitem_gen", sequenceName = "purc$apcheckitem_seq", allocationSize = 1)
+	@Column(name = "pai_id")
+	private Long id;
+
+	/**
+	 * 行号
+	 */
+	@Column(name = "pai_number")
+	private Short number;
+
+	/**
+	 * 客户物料ID
+	 */
+	@Column(name = "pai_prid")
+	private Long prid;
+
+	/**
+	 * 客户订单单号
+	 */
+	@Column(name = "pai_ordercode")
+	private String orderCode;
+
+	/**
+	 * 客户出入库类型
+	 */
+	@Column(name = "pai_orderclass")
+	private String orderClass;
+
+	/**
+	 * 客户订单序号
+	 */
+	@Column(name = "pai_orderdetno")
+	private Long orderDetno;
+
+	/**
+	 * 客户出入库单号
+	 */
+	@Column(name = "pai_inoutno")
+	private String inoutno;
+
+	/**
+	 * 出入库单序号
+	 */
+	@Column(name = "pai_inoutnodetno")
+	private Long inoutnodetno;
+
+	/**
+	 * 客户料号
+	 */
+	@Column(name = "pai_prodcode")
+	private String prodCode;
+
+	/**
+	 * 物料名称
+	 */
+	@Column(name = "pai_prodtitle")
+	private String prodTitle;
+
+	/**
+	 * 物料规格
+	 */
+	@Column(name = "pai_prodspec")
+	private String prodSpec;
+
+	/**
+	 * 单价
+	 */
+	@Column(name = "pai_price")
+	private Double price;
+
+	/**
+	 * 税率
+	 */
+	@Column(name = "pai_taxrate")
+	private Double taxrate;
+
+	/**
+	 * 对账数量
+	 */
+	@Column(name = "pai_checkqty")
+	private Double checkQty;
+
+	/**
+	 * 对账金额
+	 */
+	@Column(name = "pai_amount")
+	private Double amount;
+
+	/**
+	 * 客户确认数量
+	 */
+	@Column(name = "pai_custcheckqty")
+	private Double custCheckQty;
+
+	/**
+	 * 备注
+	 */
+	@Column(name = "pai_remark")
+	private String remark;
+
+	/**
+	 * 对账状态
+	 */
+	@Column(name = "pai_status")
+	private Integer status;
+
+	/**
+	 * 明细行数据来源表
+	 */
+	@Column(name = "pai_sourcetable")
+	private String sourceTable;
+
+	/**
+	 * 明细行数据来源对应ID
+	 */
+	@Column(name = "pai_sourceid")
+	private Long sourceId;
+
+	/**
+	 * 此次转账之前的已对账数(用于删除应收对账单时)
+	 */
+	@Column(name = "pai_oldycheckqty")
+	private Double oldYCheckQty;
+
+	/**
+	 * 应付供应商编号
+	 */
+	@Column(name = "pai_receivecode")
+	private String receiveCode;
+
+	/**
+	 * 应付供应商名称
+	 */
+	@Column(name = "pai_receivename")
+	private String receiveName;
+
+	/**
+	 * 送货单号
+	 */
+	@Column(name = "pai_sendcode")
+	private String sendcode;
+
+	/**
+	 * 仓库
+	 */
+	@Column(name = "pai_whname")
+	private String whname;
+
+	/**
+	 * 已开票数量
+	 */
+	@Column(name = "pai_billed")
+	private Double billed;
+
+	@Column(name = "pai_paid")
+	private Long paid;
+
+	/**
+	 * 应收对账单主记录
+	 */
+	@ManyToOne(cascade = { CascadeType.REFRESH, CascadeType.MERGE })
+	@JoinColumn(name = "pai_paid", insertable = false, updatable = false)
+	private PurchaseApCheckInfo apCheck;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Short getNumber() {
+		return number;
+	}
+
+	public void setNumber(Short number) {
+		this.number = number;
+	}
+
+	public Long getPrid() {
+		return prid;
+	}
+
+	public void setPrid(Long prid) {
+		this.prid = prid;
+	}
+
+	public String getOrderCode() {
+		return orderCode;
+	}
+
+	public void setOrderCode(String orderCode) {
+		this.orderCode = orderCode;
+	}
+
+	public String getOrderClass() {
+		return orderClass;
+	}
+
+	public void setOrderClass(String orderClass) {
+		this.orderClass = orderClass;
+	}
+
+	public Long getOrderDetno() {
+		return orderDetno;
+	}
+
+	public void setOrderDetno(Long orderDetno) {
+		this.orderDetno = orderDetno;
+	}
+
+	public String getProdCode() {
+		return prodCode;
+	}
+
+	public void setProdCode(String prodCode) {
+		this.prodCode = prodCode;
+	}
+
+	public Double getPrice() {
+		return price;
+	}
+
+	public void setPrice(Double price) {
+		this.price = price;
+	}
+
+	public Double getTaxrate() {
+		return taxrate;
+	}
+
+	public void setTaxrate(Double taxrate) {
+		this.taxrate = taxrate;
+	}
+
+	public Double getCheckQty() {
+		return checkQty;
+	}
+
+	public void setCheckQty(Double checkQty) {
+		this.checkQty = checkQty;
+	}
+
+	public Double getAmount() {
+		return amount;
+	}
+
+	public void setAmount(Double amount) {
+		this.amount = amount;
+	}
+
+	public Double getCustCheckQty() {
+		return custCheckQty;
+	}
+
+	public void setCustCheckQty(Double custCheckQty) {
+		this.custCheckQty = custCheckQty;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	public String getSourceTable() {
+		return sourceTable;
+	}
+
+	public void setSourceTable(String sourceTable) {
+		this.sourceTable = sourceTable;
+	}
+
+	public Long getSourceId() {
+		return sourceId;
+	}
+
+	public void setSourceId(Long sourceId) {
+		this.sourceId = sourceId;
+	}
+
+	public Double getOldYCheckQty() {
+		return oldYCheckQty;
+	}
+
+	public void setOldYCheckQty(Double oldYCheckQty) {
+		this.oldYCheckQty = oldYCheckQty;
+	}
+
+	public String getInoutno() {
+		return inoutno;
+	}
+
+	public void setInoutno(String inoutno) {
+		this.inoutno = inoutno;
+	}
+
+	public Long getInoutnodetno() {
+		return inoutnodetno;
+	}
+
+	public void setInoutnodetno(Long inoutnodetno) {
+		this.inoutnodetno = inoutnodetno;
+	}
+
+	public String getReceiveCode() {
+		return receiveCode;
+	}
+
+	public void setReceiveCode(String receiveCode) {
+		this.receiveCode = receiveCode;
+	}
+
+	public String getReceiveName() {
+		return receiveName;
+	}
+
+	public void setReceiveName(String receiveName) {
+		this.receiveName = receiveName;
+	}
+
+	public Long getPaid() {
+		return paid;
+	}
+
+	public void setPaid(Long paid) {
+		this.paid = paid;
+	}
+
+	public PurchaseApCheckInfo getApCheck() {
+		return apCheck;
+	}
+
+	public void setApCheck(PurchaseApCheckInfo apCheck) {
+		this.apCheck = apCheck;
+	}
+
+	public String getProdTitle() {
+		return prodTitle;
+	}
+
+	public void setProdTitle(String prodTitle) {
+		this.prodTitle = prodTitle;
+	}
+
+	public String getProdSpec() {
+		return prodSpec;
+	}
+
+	public void setProdSpec(String prodSpec) {
+		this.prodSpec = prodSpec;
+	}
+
+	public String getSendcode() {
+		return sendcode;
+	}
+
+	public void setSendcode(String sendcode) {
+		this.sendcode = sendcode;
+	}
+
+	public String getWhname() {
+		return whname;
+	}
+
+	public void setWhname(String whname) {
+		this.whname = whname;
+	}
+
+	public Double getBilled() {
+		return billed;
+	}
+
+	public void setBilled(Double billed) {
+		this.billed = billed;
+	}
+
+	public static List<PurchaseApCheckInfo> distinct(List<PurchaseApCheckItemInfo> items) {
+		List<PurchaseApCheckInfo> purchaseApChecks = new ArrayList<PurchaseApCheckInfo>();
+		Set<Long> keys = new HashSet<Long>();
+		for (PurchaseApCheckItemInfo item : items) {
+			if (!keys.contains(item.apCheck.getId())) {
+				purchaseApChecks.add(item.apCheck);
+				keys.add(item.apCheck.getId());
+			}
+		}
+		return purchaseApChecks;
+	}
+
+}

+ 336 - 0
src/main/java/com/uas/platform/b2b/model/SoapFpArray.java

@@ -0,0 +1,336 @@
+package com.uas.platform.b2b.model;
+
+import java.util.List;
+
+/**
+ * Created by 黄诚天 on 2017-08-03.
+ */
+public class SoapFpArray {
+    Double SLV;//税率
+    String SKR;//收款人
+    String KPR;//开票人
+    String FHR;//复核人
+    String GFYHZH;//购方银行账户
+    String GFDZDH;//购方地址电话
+    List<SoapListDetail> QD;//清单明细
+    List<SoapGoods> MX;//商品明细
+    String BZ;//备注
+    String XFYHZH;//销方银行账户
+    String XFDZDH;//销方地址电话
+    String ZFRQ; //作废日期yyyy-MM-dd hh:mm:ss//TODO 猜测
+    Integer ZFBZ;//作废标志
+    String XSDH;//单据号
+    String XFSH;//销方税号
+    String XFMC;//销方名称
+    Integer QDBZ;//清单标志
+    String KPRQ;//开具日期yyyy-MM-dd hh:mm:ss
+    Integer KPJH;//开票机号
+    Double HJSE;//税额
+    Double HJJE;//商品金额
+    String GFSH;//购方税号
+    String GFMC;//购方名称
+    Integer FPZL;//发票种类
+    String FPDM;//发票代码
+    String FPHM;//发票号码
+    String ZYSPMC;//主要商品名称
+    String BMBBBH;//编码表版本号
+    String YYSBZ;//红字发票原因
+    String HZTZDH;//红字通知单号
+    String LZFPDM;//蓝字发票代码
+    String LZFPHM;//蓝字发票号码
+    Integer DYBZ;//打印标志
+    Integer XFBZ;//修复标志
+    Integer BSZT;//报送状态
+    Integer BSBZ;//报税标志
+
+    public SoapFpArray() {
+    }
+
+    public Double getSLV() {
+        return SLV;
+    }
+
+    public void setSLV(Double SLV) {
+        this.SLV = SLV;
+    }
+
+    public String getSKR() {
+        return SKR;
+    }
+
+    public void setSKR(String SKR) {
+        this.SKR = SKR;
+    }
+
+    public String getKPR() {
+        return KPR;
+    }
+
+    public void setKPR(String KPR) {
+        this.KPR = KPR;
+    }
+
+    public String getFHR() {
+        return FHR;
+    }
+
+    public void setFHR(String FHR) {
+        this.FHR = FHR;
+    }
+
+    public String getGFYHZH() {
+        return GFYHZH;
+    }
+
+    public void setGFYHZH(String GFYHZH) {
+        this.GFYHZH = GFYHZH;
+    }
+
+    public String getGFDZDH() {
+        return GFDZDH;
+    }
+
+    public void setGFDZDH(String GFDZDH) {
+        this.GFDZDH = GFDZDH;
+    }
+
+    public List<SoapListDetail> getQD() {
+        return QD;
+    }
+
+    public void setQD(List<SoapListDetail> QD) {
+        this.QD = QD;
+    }
+
+    public List<SoapGoods> getMX() {
+        return MX;
+    }
+
+    public void setMX(List<SoapGoods> MX) {
+        this.MX = MX;
+    }
+
+    public String getBZ() {
+        return BZ;
+    }
+
+    public void setBZ(String BZ) {
+        this.BZ = BZ;
+    }
+
+    public String getXFYHZH() {
+        return XFYHZH;
+    }
+
+    public void setXFYHZH(String XFYHZH) {
+        this.XFYHZH = XFYHZH;
+    }
+
+    public String getXFDZDH() {
+        return XFDZDH;
+    }
+
+    public void setXFDZDH(String XFDZDH) {
+        this.XFDZDH = XFDZDH;
+    }
+
+    public String getZFRQ() {
+        return ZFRQ;
+    }
+
+    public void setZFRQ(String ZFRQ) {
+        this.ZFRQ = ZFRQ;
+    }
+
+    public Integer getZFBZ() {
+        return ZFBZ;
+    }
+
+    public void setZFBZ(Integer ZFBZ) {
+        this.ZFBZ = ZFBZ;
+    }
+
+    public String getXSDH() {
+        return XSDH;
+    }
+
+    public void setXSDH(String XSDH) {
+        this.XSDH = XSDH;
+    }
+
+    public String getXFSH() {
+        return XFSH;
+    }
+
+    public void setXFSH(String XFSH) {
+        this.XFSH = XFSH;
+    }
+
+    public String getXFMC() {
+        return XFMC;
+    }
+
+    public void setXFMC(String XFMC) {
+        this.XFMC = XFMC;
+    }
+
+    public Integer getQDBZ() {
+        return QDBZ;
+    }
+
+    public void setQDBZ(Integer QDBZ) {
+        this.QDBZ = QDBZ;
+    }
+
+    public String getKPRQ() {
+        return KPRQ;
+    }
+
+    public void setKPRQ(String KPRQ) {
+        this.KPRQ = KPRQ;
+    }
+
+    public Integer getKPJH() {
+        return KPJH;
+    }
+
+    public void setKPJH(Integer KPJH) {
+        this.KPJH = KPJH;
+    }
+
+    public Double getHJSE() {
+        return HJSE;
+    }
+
+    public void setHJSE(Double HJSE) {
+        this.HJSE = HJSE;
+    }
+
+    public Double getHJJE() {
+        return HJJE;
+    }
+
+    public void setHJJE(Double HJJE) {
+        this.HJJE = HJJE;
+    }
+
+    public String getGFSH() {
+        return GFSH;
+    }
+
+    public void setGFSH(String GFSH) {
+        this.GFSH = GFSH;
+    }
+
+    public String getGFMC() {
+        return GFMC;
+    }
+
+    public void setGFMC(String GFMC) {
+        this.GFMC = GFMC;
+    }
+
+    public Integer getFPZL() {
+        return FPZL;
+    }
+
+    public void setFPZL(Integer FPZL) {
+        this.FPZL = FPZL;
+    }
+
+    public String getFPDM() {
+        return FPDM;
+    }
+
+    public void setFPDM(String FPDM) {
+        this.FPDM = FPDM;
+    }
+
+    public String getFPHM() {
+        return FPHM;
+    }
+
+    public void setFPHM(String FPHM) {
+        this.FPHM = FPHM;
+    }
+
+    public String getZYSPMC() {
+        return ZYSPMC;
+    }
+
+    public void setZYSPMC(String ZYSPMC) {
+        this.ZYSPMC = ZYSPMC;
+    }
+
+    public String getBMBBBH() {
+        return BMBBBH;
+    }
+
+    public void setBMBBBH(String BMBBBH) {
+        this.BMBBBH = BMBBBH;
+    }
+
+    public String getYYSBZ() {
+        return YYSBZ;
+    }
+
+    public void setYYSBZ(String YYSBZ) {
+        this.YYSBZ = YYSBZ;
+    }
+
+    public String getHZTZDH() {
+        return HZTZDH;
+    }
+
+    public void setHZTZDH(String HZTZDH) {
+        this.HZTZDH = HZTZDH;
+    }
+
+    public String getLZFPDM() {
+        return LZFPDM;
+    }
+
+    public void setLZFPDM(String LZFPDM) {
+        this.LZFPDM = LZFPDM;
+    }
+
+    public String getLZFPHM() {
+        return LZFPHM;
+    }
+
+    public void setLZFPHM(String LZFPHM) {
+        this.LZFPHM = LZFPHM;
+    }
+
+    public Integer getDYBZ() {
+        return DYBZ;
+    }
+
+    public void setDYBZ(Integer DYBZ) {
+        this.DYBZ = DYBZ;
+    }
+
+    public Integer getXFBZ() {
+        return XFBZ;
+    }
+
+    public void setXFBZ(Integer XFBZ) {
+        this.XFBZ = XFBZ;
+    }
+
+    public Integer getBSZT() {
+        return BSZT;
+    }
+
+    public void setBSZT(Integer BSZT) {
+        this.BSZT = BSZT;
+    }
+
+    public Integer getBSBZ() {
+        return BSBZ;
+    }
+
+    public void setBSBZ(Integer BSBZ) {
+        this.BSBZ = BSBZ;
+    }
+}

+ 164 - 0
src/main/java/com/uas/platform/b2b/model/SoapGoods.java

@@ -0,0 +1,164 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017/7/10.
+ */
+public class SoapGoods {
+    Double SLV;//税率
+    String HSJBZ;//含税价标志
+    Double SL;//数量
+    Double SE;//税额
+    Double JE;//金额
+    Double DJ;//单价
+    Double FPHXZ;//发票行性质
+    String LSLVBS;//零税率标识
+    String YHSM;//享受优惠内容
+    String XSYH;//是否享受优惠
+    String SPSM;//商品税目
+    String SPMC;//商品名称
+    String SPBH;//商品编号
+    String JLDW;//计量单位
+    String GGXH;//规格型号
+    String FLBM;//税收分类编码
+    String FPMXXH;//明细序号
+
+    public SoapGoods() {
+    }
+
+    public Double getSLV() {
+        return SLV;
+    }
+
+    public void setSLV(Double SLV) {
+        this.SLV = SLV;
+    }
+
+    public String getHSJBZ() {
+        return HSJBZ;
+    }
+
+    public void setHSJBZ(String HSJBZ) {
+        this.HSJBZ = HSJBZ;
+    }
+
+    public Double getSL() {
+        return SL;
+    }
+
+    public void setSL(Double SL) {
+        this.SL = SL;
+    }
+
+    public Double getDJ() {
+        return DJ;
+    }
+
+    public void setDJ(Double DJ) {
+        this.DJ = DJ;
+    }
+
+    public Double getJE() {
+        return JE;
+    }
+
+    public void setJE(Double JE) {
+        this.JE = JE;
+    }
+
+    public Double getSE() {
+        return SE;
+    }
+
+    public void setSE(Double SE) {
+        this.SE = SE;
+    }
+
+    public Double getFPHXZ() {
+        return FPHXZ;
+    }
+
+    public void setFPHXZ(Double FPHXZ) {
+        this.FPHXZ = FPHXZ;
+    }
+
+    public String getLSLVBS() {
+        return LSLVBS;
+    }
+
+    public void setLSLVBS(String LSLVBS) {
+        this.LSLVBS = LSLVBS;
+    }
+
+    public String getYHSM() {
+        return YHSM;
+    }
+
+    public void setYHSM(String YHSM) {
+        this.YHSM = YHSM;
+    }
+
+    public String getXSYH() {
+        return XSYH;
+    }
+
+    public void setXSYH(String XSYH) {
+        this.XSYH = XSYH;
+    }
+
+    public String getSPSM() {
+        return SPSM;
+    }
+
+    public void setSPSM(String SPSM) {
+        this.SPSM = SPSM;
+    }
+
+    public String getSPMC() {
+        return SPMC;
+    }
+
+    public void setSPMC(String SPMC) {
+        this.SPMC = SPMC;
+    }
+
+    public String getSPBH() {
+        return SPBH;
+    }
+
+    public void setSPBH(String SPBH) {
+        this.SPBH = SPBH;
+    }
+
+    public String getJLDW() {
+        return JLDW;
+    }
+
+    public void setJLDW(String JLDW) {
+        this.JLDW = JLDW;
+    }
+
+    public String getGGXH() {
+        return GGXH;
+    }
+
+    public void setGGXH(String GGXH) {
+        this.GGXH = GGXH;
+    }
+
+    public String getFLBM() {
+        return FLBM;
+    }
+
+    public void setFLBM(String FLBM) {
+        this.FLBM = FLBM;
+    }
+
+    public String getFPMXXH() {
+        return FPMXXH;
+    }
+
+    public void setFPMXXH(String FPMXXH) {
+        this.FPMXXH = FPMXXH;
+    }
+
+}

+ 48 - 0
src/main/java/com/uas/platform/b2b/model/SoapInvkind.java

@@ -0,0 +1,48 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017-08-04.
+ *
+ * 查询下一发票机库存信息中列表
+ */
+public class SoapInvkind {
+    String CurInvTypeCode;//当前发票类别代码
+    String CurInvNumber;//当前发票号码
+    Integer InvStock;//库存剩余发票
+    String Name;//发票种类名称
+
+    public SoapInvkind() {
+    }
+
+    public String getCurInvTypeCode() {
+        return CurInvTypeCode;
+    }
+
+    public void setCurInvTypeCode(String curInvTypeCode) {
+        CurInvTypeCode = curInvTypeCode;
+    }
+
+    public String getCurInvNumber() {
+        return CurInvNumber;
+    }
+
+    public void setCurInvNumber(String curInvNumber) {
+        CurInvNumber = curInvNumber;
+    }
+
+    public Integer getInvStock() {
+        return InvStock;
+    }
+
+    public void setInvStock(Integer invStock) {
+        InvStock = invStock;
+    }
+
+    public String getName() {
+        return Name;
+    }
+
+    public void setName(String name) {
+        Name = name;
+    }
+}

+ 163 - 0
src/main/java/com/uas/platform/b2b/model/SoapInvoiceIssued.java

@@ -0,0 +1,163 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017/7/10.
+ */
+public class SoapInvoiceIssued {
+    Integer SID;
+    String hisInfoKind;//上一张发票种类
+    String Cipher;//发票的密文
+    Double InfoAmount;//开具的金额
+    String retcode;//返回码
+    String retmsg;//返回信息
+    String InfoNumber;//开具的发票号码
+    String InfoDate;//开票日期(格式:yyyy-mm-dd)
+    String hisInfoNumber;//上一张发票号码
+    String Sign; //发票的签名值
+    Double InfoTaxAmount;//开具的税额
+    String hisInfoTypeCode;//上一张发票代码
+    Integer ListFlag;//清单标志 0:非清单发票 1:清单发票
+    String InfoTypeCode;//开具的发票代码
+    String nsrsbh;//销方税号
+    String kpfwqh;//开票服务器号
+    String kpdh;//开票点号
+
+    public SoapInvoiceIssued() {
+    }
+
+    public String getRetcode() {
+        return retcode;
+    }
+
+    public void setRetcode(String retcode) {
+        this.retcode = retcode;
+    }
+
+    public String getRetmsg() {
+        return retmsg;
+    }
+
+    public void setRetmsg(String retmsg) {
+        this.retmsg = retmsg;
+    }
+
+    public Double getInfoAmount() {
+        return InfoAmount;
+    }
+
+    public void setInfoAmount(Double infoAmount) {
+        this.InfoAmount = infoAmount;
+    }
+
+    public Double getInfoTaxAmount() {
+        return InfoTaxAmount;
+    }
+
+    public void setInfoTaxAmount(Double infoTaxAmount) {
+        this.InfoTaxAmount = infoTaxAmount;
+    }
+
+    public String getInfoDate() {
+        return InfoDate;
+    }
+
+    public void setInfoDate(String infoDate) {
+        this.InfoDate = infoDate;
+    }
+
+    public String getInfoTypeCode() {
+        return InfoTypeCode;
+    }
+
+    public void setInfoTypeCode(String infoTypeCode) {
+        this.InfoTypeCode = infoTypeCode;
+    }
+
+    public String getInfoNumber() {
+        return InfoNumber;
+    }
+
+    public void setInfoNumber(String infoNumber) {
+        this.InfoNumber = infoNumber;
+    }
+
+    public String getHisInfoTypeCode() {
+        return hisInfoTypeCode;
+    }
+
+    public void setHisInfoTypeCode(String hisInfoTypeCode) {
+        this.hisInfoTypeCode = hisInfoTypeCode;
+    }
+
+    public String getHisInfoNumber() {
+        return hisInfoNumber;
+    }
+
+    public void setHisInfoNumber(String hisInfoNumber) {
+        this.hisInfoNumber = hisInfoNumber;
+    }
+
+    public String getHisInfoKind() {
+        return hisInfoKind;
+    }
+
+    public void setHisInfoKind(String hisInfoKind) {
+        this.hisInfoKind = hisInfoKind;
+    }
+
+    public Integer getListFlag() {
+        return ListFlag;
+    }
+
+    public void setListFlag(Integer listFlag) {
+        this.ListFlag = listFlag;
+    }
+
+    public String getNsrsbh() {
+        return nsrsbh;
+    }
+
+    public void setNsrsbh(String nsrsbh) {
+        this.nsrsbh = nsrsbh;
+    }
+
+    public String getKpfwqh() {
+        return kpfwqh;
+    }
+
+    public void setKpfwqh(String kpfwqh) {
+        this.kpfwqh = kpfwqh;
+    }
+
+    public String getKpdh() {
+        return kpdh;
+    }
+
+    public void setKpdh(String kpdh) {
+        this.kpdh = kpdh;
+    }
+
+    public Integer getSID() {
+        return SID;
+    }
+
+    public void setSID(Integer SID) {
+        this.SID = SID;
+    }
+
+    public String getCipher() {
+        return Cipher;
+    }
+
+    public void setCipher(String cipher) {
+        this.Cipher = cipher;
+    }
+
+    public String getSign() {
+        return Sign;
+    }
+
+    public void setSign(String sign) {
+        this.Sign = sign;
+    }
+}

+ 158 - 0
src/main/java/com/uas/platform/b2b/model/SoapInvoiceItem.java

@@ -0,0 +1,158 @@
+package com.uas.platform.b2b.model;
+
+import java.util.Arrays;
+
+/**
+ * Created by 黄诚天 on 2017/7/11.
+ */
+public class SoapInvoiceItem {
+    String productName;//商品名称
+    Boolean includeTax;//true为含税价
+    Double taxRate;//税率
+    Double value;//金额
+    Double price;//单价
+    String productUnit;//商品单位
+    String productSpec;//商品规格
+    Double tax;//税额
+    Double quantity;//数量
+    String GoodsNoVer; //编码版本号
+    String GoodsTaxNo;// 税收分类编码
+    String TaxPre;// 是否享受税收优惠政策
+    String TaxPreCon;// 享受税收优惠政策内容
+    String ZeroTax;// 零税率标识
+    String CropGoodsNo;// 企业自编码
+    String TaxDeduction; //扣除额
+
+    public SoapInvoiceItem() {
+    }
+
+
+    public String getProductName() {
+        return productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    public Boolean getIncludeTax() {
+        return includeTax;
+    }
+
+    public void setIncludeTax(Boolean includeTax) {
+        this.includeTax = includeTax;
+    }
+
+    public Double getTaxRate() {
+        return taxRate;
+    }
+
+    public void setTaxRate(Double taxRate) {
+        this.taxRate = taxRate;
+    }
+
+    public Double getValue() {
+        return value;
+    }
+
+    public void setValue(Double value) {
+        this.value = value;
+    }
+
+    public Double getPrice() {
+        return price;
+    }
+
+    public void setPrice(Double price) {
+        this.price = price;
+    }
+
+    public String getProductUnit() {
+        return productUnit;
+    }
+
+    public void setProductUnit(String productUnit) {
+        this.productUnit = productUnit;
+    }
+
+    public String getProductSpec() {
+        return productSpec;
+    }
+
+    public void setProductSpec(String productSpec) {
+        this.productSpec = productSpec;
+    }
+
+    public Double getTax() {
+        return tax;
+    }
+
+    public void setTax(Double tax) {
+        this.tax = tax;
+    }
+
+    public Double getQuantity() {
+        return quantity;
+    }
+
+    public void setQuantity(Double quantity) {
+        this.quantity = quantity;
+    }
+
+    public String getGoodsNoVer() {
+        return GoodsNoVer;
+    }
+
+    public void setGoodsNoVer(String GoodsNoVer) {
+        this.GoodsNoVer = GoodsNoVer;
+    }
+
+    public String getGoodsTaxNo() {
+        return GoodsTaxNo;
+    }
+
+    public void setGoodsTaxNo(String GoodsTaxNo) {
+        this.GoodsTaxNo = GoodsTaxNo;
+    }
+
+    public String getTaxPre() {
+        return TaxPre;
+    }
+
+    public void setTaxPre(String TaxPre) {
+        this.TaxPre = TaxPre;
+    }
+
+    public String getTaxPreCon() {
+        return TaxPreCon;
+    }
+
+    public void setTaxPreCon(String TaxPreCon) {
+        this.TaxPreCon = TaxPreCon;
+    }
+
+    public String getZeroTax() {
+        return ZeroTax;
+    }
+
+    public void setZeroTax(String ZeroTax) {
+        this.ZeroTax = ZeroTax;
+    }
+
+    public String getCropGoodsNo() {
+        return CropGoodsNo;
+    }
+
+    public void setCropGoodsNo(String CropGoodsNo) {
+        this.CropGoodsNo = CropGoodsNo;
+    }
+
+    public String getTaxDeduction() {
+        return TaxDeduction;
+    }
+
+    public void setTaxDeduction(String TaxDeduction) {
+        this.TaxDeduction = TaxDeduction;
+    }
+
+}

+ 38 - 0
src/main/java/com/uas/platform/b2b/model/SoapInvoiceStatusUpdate.java

@@ -0,0 +1,38 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017/7/11.
+ */
+public class SoapInvoiceStatusUpdate {
+    String retcode;//返回码 8050:更新成功 其它失败
+    String retmsg;//返回信息
+    String info;// 局端返回信息
+
+    public SoapInvoiceStatusUpdate() {
+    }
+
+    public String getRetcode() {
+        return retcode;
+    }
+
+    public void setRetcode(String retcode) {
+        this.retcode = retcode;
+    }
+
+    public String getRetmsg() {
+        return retmsg;
+    }
+
+    public void setRetmsg(String retmsg) {
+        this.retmsg = retmsg;
+    }
+
+    public String getInfo() {
+        return info;
+    }
+
+    public void setInfo(String info) {
+        this.info = info;
+    }
+
+}

+ 57 - 0
src/main/java/com/uas/platform/b2b/model/SoapKcArray.java

@@ -0,0 +1,57 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017-08-04.
+ *
+ * 查询库存信息返回数据中的列表
+ */
+public class SoapKcArray {
+    int fpsysl;//发票剩余数量
+    String gmrq; // (格式:yyyy-mm-dd)购买日期
+    Integer fpzl;//发票种类
+    String fphm;//发票号码
+    String fpdm;//发票代码 Integer
+
+    public SoapKcArray() {
+    }
+
+    public int getFpsysl() {
+        return fpsysl;
+    }
+
+    public void setFpsysl(int fpsysl) {
+        this.fpsysl = fpsysl;
+    }
+
+    public String getGmrq() {
+        return gmrq;
+    }
+
+    public void setGmrq(String gmrq) {
+        this.gmrq = gmrq;
+    }
+
+    public Integer getFpzl() {
+        return fpzl;
+    }
+
+    public void setFpzl(Integer fpzl) {
+        this.fpzl = fpzl;
+    }
+
+    public String getFphm() {
+        return fphm;
+    }
+
+    public void setFphm(String fphm) {
+        this.fphm = fphm;
+    }
+
+    public String getFpdm() {
+        return fpdm;
+    }
+
+    public void setFpdm(String fpdm) {
+        this.fpdm = fpdm;
+    }
+}

+ 164 - 0
src/main/java/com/uas/platform/b2b/model/SoapListDetail.java

@@ -0,0 +1,164 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017/7/10.
+ */
+public class SoapListDetail {
+    Double SLV;//税率
+    String HSJBZ;//含税价标志
+    Double SL;//数量
+    Double SE;//税额
+    Double JE;//金额
+    Double DJ;//单价
+    Double FPHXZ;//发票行性质
+    String LSLVBS;//零税率标识
+    String YHSM;//享受优惠内容
+    String XSYH;//是否享受优惠
+    String SPSM;//商品税目
+    String SPMC;//商品名称
+    String SPBH;//商品编号
+    String JLDW;//计量单位
+    String GGXH;//规格型号
+    String FLBM;//税收分类编码
+    String FPMXXH;//明细序号
+
+    public SoapListDetail() {
+    }
+
+    public Double getSLV() {
+        return SLV;
+    }
+
+    public void setSLV(Double SLV) {
+        this.SLV = SLV;
+    }
+
+    public String getHSJBZ() {
+        return HSJBZ;
+    }
+
+    public void setHSJBZ(String HSJBZ) {
+        this.HSJBZ = HSJBZ;
+    }
+
+    public Double getSL() {
+        return SL;
+    }
+
+    public void setSL(Double SL) {
+        this.SL = SL;
+    }
+
+    public Double getDJ() {
+        return DJ;
+    }
+
+    public void setDJ(Double DJ) {
+        this.DJ = DJ;
+    }
+
+    public Double getJE() {
+        return JE;
+    }
+
+    public void setJE(Double JE) {
+        this.JE = JE;
+    }
+
+    public Double getSE() {
+        return SE;
+    }
+
+    public void setSE(Double SE) {
+        this.SE = SE;
+    }
+
+    public Double getFPHXZ() {
+        return FPHXZ;
+    }
+
+    public void setFPHXZ(Double FPHXZ) {
+        this.FPHXZ = FPHXZ;
+    }
+
+    public String getLSLVBS() {
+        return LSLVBS;
+    }
+
+    public void setLSLVBS(String LSLVBS) {
+        this.LSLVBS = LSLVBS;
+    }
+
+    public String getYHSM() {
+        return YHSM;
+    }
+
+    public void setYHSM(String YHSM) {
+        this.YHSM = YHSM;
+    }
+
+    public String getXSYH() {
+        return XSYH;
+    }
+
+    public void setXSYH(String XSYH) {
+        this.XSYH = XSYH;
+    }
+
+    public String getSPSM() {
+        return SPSM;
+    }
+
+    public void setSPSM(String SPSM) {
+        this.SPSM = SPSM;
+    }
+
+    public String getSPMC() {
+        return SPMC;
+    }
+
+    public void setSPMC(String SPMC) {
+        this.SPMC = SPMC;
+    }
+
+    public String getSPBH() {
+        return SPBH;
+    }
+
+    public void setSPBH(String SPBH) {
+        this.SPBH = SPBH;
+    }
+
+    public String getJLDW() {
+        return JLDW;
+    }
+
+    public void setJLDW(String JLDW) {
+        this.JLDW = JLDW;
+    }
+
+    public String getGGXH() {
+        return GGXH;
+    }
+
+    public void setGGXH(String GGXH) {
+        this.GGXH = GGXH;
+    }
+
+    public String getFLBM() {
+        return FLBM;
+    }
+
+    public void setFLBM(String FLBM) {
+        this.FLBM = FLBM;
+    }
+
+    public String getFPMXXH() {
+        return FPMXXH;
+    }
+
+    public void setFPMXXH(String FPMXXH) {
+        this.FPMXXH = FPMXXH;
+    }
+
+}

+ 155 - 0
src/main/java/com/uas/platform/b2b/model/SoapMotorInvoiceIssued.java

@@ -0,0 +1,155 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017/7/11.
+ */
+public class SoapMotorInvoiceIssued {
+    String retcode;//返回码 4011 或 4016,	"开票成功" 其它失败
+    String retmsg;//返回信息
+    Double InfoAmount;//开具的金额
+    Double InfoTaxAmount;//开具的税额
+    String InfoDate; //(格式:yyyy-mm-dd)开票日期
+    String InfoTypeCode;//开具的发票代码
+    String InfoNumber;//开具的发票号码
+    String hisInfoTypeCode;//上一张发票代码
+    String hisInfoNumber;//上一张发票号码
+    String hisInfoKind;//上一张发票种类
+    String machineryNo;//机器编码
+    String authorityPart;//主管机关
+    String authorityPartCode;//主管机关编码
+    String nsrsbh;//销方税号
+    Integer kpfwqh;//开票服务器号
+    Integer kpdh;//开票点号
+
+    public SoapMotorInvoiceIssued() {
+    }
+
+    public String getRetcode() {
+        return retcode;
+    }
+
+    public void setRetcode(String retcode) {
+        this.retcode = retcode;
+    }
+
+    public String getRetmsg() {
+        return retmsg;
+    }
+
+    public void setRetmsg(String retmsg) {
+        this.retmsg = retmsg;
+    }
+
+    public Double getInfoAmount() {
+        return InfoAmount;
+    }
+
+    public void setInfoAmount(Double infoAmount) {
+        this.InfoAmount = infoAmount;
+    }
+
+    public Double getInfoTaxAmount() {
+        return InfoTaxAmount;
+    }
+
+    public void setInfoTaxAmount(Double infoTaxAmount) {
+        this.InfoTaxAmount = infoTaxAmount;
+    }
+
+    public String getInfoDate() {
+        return InfoDate;
+    }
+
+    public void setInfoDate(String infoDate) {
+        this.InfoDate = infoDate;
+    }
+
+    public String getInfoTypeCode() {
+        return InfoTypeCode;
+    }
+
+    public void setInfoTypeCode(String infoTypeCode) {
+        this.InfoTypeCode = infoTypeCode;
+    }
+
+    public String getInfoNumber() {
+        return InfoNumber;
+    }
+
+    public void setInfoNumber(String infoNumber) {
+        this.InfoNumber = infoNumber;
+    }
+
+    public String getHisInfoTypeCode() {
+        return hisInfoTypeCode;
+    }
+
+    public void setHisInfoTypeCode(String hisInfoTypeCode) {
+        this.hisInfoTypeCode = hisInfoTypeCode;
+    }
+
+    public String getHisInfoNumber() {
+        return hisInfoNumber;
+    }
+
+    public void setHisInfoNumber(String hisInfoNumber) {
+        this.hisInfoNumber = hisInfoNumber;
+    }
+
+    public String getHisInfoKind() {
+        return hisInfoKind;
+    }
+
+    public void setHisInfoKind(String hisInfoKind) {
+        this.hisInfoKind = hisInfoKind;
+    }
+
+    public String getMachineryNo() {
+        return machineryNo;
+    }
+
+    public void setMachineryNo(String machineryNo) {
+        this.machineryNo = machineryNo;
+    }
+
+    public String getAuthorityPart() {
+        return authorityPart;
+    }
+
+    public void setAuthorityPart(String authorityPart) {
+        this.authorityPart = authorityPart;
+    }
+
+    public String getAuthorityPartCode() {
+        return authorityPartCode;
+    }
+
+    public void setAuthorityPartCode(String authorityPartCode) {
+        this.authorityPartCode = authorityPartCode;
+    }
+
+    public String getNsrsbh() {
+        return nsrsbh;
+    }
+
+    public void setNsrsbh(String nsrsbh) {
+        this.nsrsbh = nsrsbh;
+    }
+
+    public Integer getKpfwqh() {
+        return kpfwqh;
+    }
+
+    public void setKpfwqh(Integer kpfwqh) {
+        this.kpfwqh = kpfwqh;
+    }
+
+    public Integer getKpdh() {
+        return kpdh;
+    }
+
+    public void setKpdh(Integer kpdh) {
+        this.kpdh = kpdh;
+    }
+
+}

+ 426 - 0
src/main/java/com/uas/platform/b2b/model/SoapMotorInvoiceQuery.java

@@ -0,0 +1,426 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017/7/11.
+ */
+public class SoapMotorInvoiceQuery {
+    String TypeCode;//发票代码
+    String InvNo;//发票号码
+    String InvDate;//开具日期yyyy-MM-dd hh:mm:ss
+    String GFMC_JDC;//购方名称
+    String SFZHM_JDC;// 身份证号码
+    String CLLX_JDC;//车辆类型
+    String CPXH_JDC;// 厂牌型号
+    String CD_JDC;// 产地
+    String HGZH_JDC;// 合格证书
+    String JKZMSH_JDC;// 进口证明书号
+    String SJDH_JDC;// 商检单号
+    String FDJHM_JDC;// 发动机号码
+    String CJHM_JDC;// 车架号码
+    String XHDWMC_JDC;//销方名称
+    String NSRSBH_JDC;//纳税人识别号
+    String DZ_JDC;//地址
+    String DH_JDC;// 电话
+    String KHYHMC_JDC;// 开户银行
+    String ZH_JDC;// 账号
+    Double JSHJ_JDC;//价税合计
+    Double SLV_JDC;//税率
+    Double HJSE_JDC;//税额
+    String SWJGDM_JDC;// 税务机关代码
+    String SWJGMC_JDC;// 税务机关名称
+    String DW_JDC;// 吨位
+    String XCRS_JDC;// 限乘人数
+    String SCCJMC_JDC;// 生产厂家名称
+    String GFNSRSBH_JDC;// 购方纳税人识别号
+    String Memo;//备注
+    String KPR;//开票人
+    String FHR;//复核人
+    Integer KPJH;//开票机号
+    String BMBBBH;//编码表版本号
+    String SSFLBM;//税收分类编码
+    Integer ZFBZ;//作废标志
+    Integer XFBZ;//修复标志
+    Integer DYBZ;//打印标志
+    Integer BSZT;//报送状态
+    Integer BSBZ;//报税标志
+    String BillNumber;//单据号
+
+    String retcode;//返回码    0 查询成功;其它失败
+    String retmsg;//返回信息
+    Integer RecNo;//当前记录数
+    String nsrsbh;//销方税号
+    Integer kpfwqh;//开票服务器号
+    Integer kpdh;//开票点号
+
+    public SoapMotorInvoiceQuery() {
+    }
+
+    public String getTypeCode() {
+        return TypeCode;
+    }
+
+    public void setTypeCode(String typeCode) {
+        this.TypeCode = typeCode;
+    }
+
+    public String getInvNo() {
+        return InvNo;
+    }
+
+    public void setInvNo(String invNo) {
+        this.InvNo = invNo;
+    }
+
+    public String getInvDate() {
+        return InvDate;
+    }
+
+    public void setInvDate(String invDate) {
+        this.InvDate = invDate;
+    }
+
+    public String getGFMC_JDC() {
+        return GFMC_JDC;
+    }
+
+    public void setGFMC_JDC(String GFMC_JDC) {
+        this.GFMC_JDC = GFMC_JDC;
+    }
+
+    public String getSFZHM_JDC() {
+        return SFZHM_JDC;
+    }
+
+    public void setSFZHM_JDC(String SFZHM_JDC) {
+        this.SFZHM_JDC = SFZHM_JDC;
+    }
+
+    public String getCLLX_JDC() {
+        return CLLX_JDC;
+    }
+
+    public void setCLLX_JDC(String CLLX_JDC) {
+        this.CLLX_JDC = CLLX_JDC;
+    }
+
+    public String getCPXH_JDC() {
+        return CPXH_JDC;
+    }
+
+    public void setCPXH_JDC(String CPXH_JDC) {
+        this.CPXH_JDC = CPXH_JDC;
+    }
+
+    public String getCD_JDC() {
+        return CD_JDC;
+    }
+
+    public void setCD_JDC(String CD_JDC) {
+        this.CD_JDC = CD_JDC;
+    }
+
+    public String getHGZH_JDC() {
+        return HGZH_JDC;
+    }
+
+    public void setHGZH_JDC(String HGZH_JDC) {
+        this.HGZH_JDC = HGZH_JDC;
+    }
+
+    public String getJKZMSH_JDC() {
+        return JKZMSH_JDC;
+    }
+
+    public void setJKZMSH_JDC(String JKZMSH_JDC) {
+        this.JKZMSH_JDC = JKZMSH_JDC;
+    }
+
+    public String getSJDH_JDC() {
+        return SJDH_JDC;
+    }
+
+    public void setSJDH_JDC(String SJDH_JDC) {
+        this.SJDH_JDC = SJDH_JDC;
+    }
+
+    public String getFDJHM_JDC() {
+        return FDJHM_JDC;
+    }
+
+    public void setFDJHM_JDC(String FDJHM_JDC) {
+        this.FDJHM_JDC = FDJHM_JDC;
+    }
+
+    public String getCJHM_JDC() {
+        return CJHM_JDC;
+    }
+
+    public void setCJHM_JDC(String CJHM_JDC) {
+        this.CJHM_JDC = CJHM_JDC;
+    }
+
+    public String getXHDWMC_JDC() {
+        return XHDWMC_JDC;
+    }
+
+    public void setXHDWMC_JDC(String XHDWMC_JDC) {
+        this.XHDWMC_JDC = XHDWMC_JDC;
+    }
+
+    public String getNSRSBH_JDC() {
+        return NSRSBH_JDC;
+    }
+
+    public void setNSRSBH_JDC(String NSRSBH_JDC) {
+        this.NSRSBH_JDC = NSRSBH_JDC;
+    }
+
+    public String getDZ_JDC() {
+        return DZ_JDC;
+    }
+
+    public void setDZ_JDC(String DZ_JDC) {
+        this.DZ_JDC = DZ_JDC;
+    }
+
+    public String getDH_JDC() {
+        return DH_JDC;
+    }
+
+    public void setDH_JDC(String DH_JDC) {
+        this.DH_JDC = DH_JDC;
+    }
+
+    public String getKHYHMC_JDC() {
+        return KHYHMC_JDC;
+    }
+
+    public void setKHYHMC_JDC(String KHYHMC_JDC) {
+        this.KHYHMC_JDC = KHYHMC_JDC;
+    }
+
+    public String getZH_JDC() {
+        return ZH_JDC;
+    }
+
+    public void setZH_JDC(String ZH_JDC) {
+        this.ZH_JDC = ZH_JDC;
+    }
+
+    public Double getJSHJ_JDC() {
+        return JSHJ_JDC;
+    }
+
+    public void setJSHJ_JDC(Double JSHJ_JDC) {
+        this.JSHJ_JDC = JSHJ_JDC;
+    }
+
+    public Double getSLV_JDC() {
+        return SLV_JDC;
+    }
+
+    public void setSLV_JDC(Double SLV_JDC) {
+        this.SLV_JDC = SLV_JDC;
+    }
+
+    public Double getHJSE_JDC() {
+        return HJSE_JDC;
+    }
+
+    public void setHJSE_JDC(Double HJSE_JDC) {
+        this.HJSE_JDC = HJSE_JDC;
+    }
+
+    public String getSWJGDM_JDC() {
+        return SWJGDM_JDC;
+    }
+
+    public void setSWJGDM_JDC(String SWJGDM_JDC) {
+        this.SWJGDM_JDC = SWJGDM_JDC;
+    }
+
+    public String getSWJGMC_JDC() {
+        return SWJGMC_JDC;
+    }
+
+    public void setSWJGMC_JDC(String SWJGMC_JDC) {
+        this.SWJGMC_JDC = SWJGMC_JDC;
+    }
+
+    public String getDW_JDC() {
+        return DW_JDC;
+    }
+
+    public void setDW_JDC(String DW_JDC) {
+        this.DW_JDC = DW_JDC;
+    }
+
+    public String getXCRS_JDC() {
+        return XCRS_JDC;
+    }
+
+    public void setXCRS_JDC(String XCRS_JDC) {
+        this.XCRS_JDC = XCRS_JDC;
+    }
+
+    public String getSCCJMC_JDC() {
+        return SCCJMC_JDC;
+    }
+
+    public void setSCCJMC_JDC(String SCCJMC_JDC) {
+        this.SCCJMC_JDC = SCCJMC_JDC;
+    }
+
+    public String getGFNSRSBH_JDC() {
+        return GFNSRSBH_JDC;
+    }
+
+    public void setGFNSRSBH_JDC(String GFNSRSBH_JDC) {
+        this.GFNSRSBH_JDC = GFNSRSBH_JDC;
+    }
+
+    public String getMemo() {
+        return Memo;
+    }
+
+    public void setMemo(String memo) {
+        this.Memo = memo;
+    }
+
+    public String getKPR() {
+        return KPR;
+    }
+
+    public void setKPR(String KPR) {
+        this.KPR = KPR;
+    }
+
+    public String getFHR() {
+        return FHR;
+    }
+
+    public void setFHR(String FHR) {
+        this.FHR = FHR;
+    }
+
+    public Integer getKPJH() {
+        return KPJH;
+    }
+
+    public void setKPJH(Integer KPJH) {
+        this.KPJH = KPJH;
+    }
+
+    public String getBMBBBH() {
+        return BMBBBH;
+    }
+
+    public void setBMBBBH(String BMBBBH) {
+        this.BMBBBH = BMBBBH;
+    }
+
+    public String getSSFLBM() {
+        return SSFLBM;
+    }
+
+    public void setSSFLBM(String SSFLBM) {
+        this.SSFLBM = SSFLBM;
+    }
+
+    public Integer getZFBZ() {
+        return ZFBZ;
+    }
+
+    public void setZFBZ(Integer ZFBZ) {
+        this.ZFBZ = ZFBZ;
+    }
+
+    public Integer getXFBZ() {
+        return XFBZ;
+    }
+
+    public void setXFBZ(Integer XFBZ) {
+        this.XFBZ = XFBZ;
+    }
+
+    public Integer getDYBZ() {
+        return DYBZ;
+    }
+
+    public void setDYBZ(Integer DYBZ) {
+        this.DYBZ = DYBZ;
+    }
+
+    public Integer getBSZT() {
+        return BSZT;
+    }
+
+    public void setBSZT(Integer BSZT) {
+        this.BSZT = BSZT;
+    }
+
+    public Integer getBSBZ() {
+        return BSBZ;
+    }
+
+    public void setBSBZ(Integer BSBZ) {
+        this.BSBZ = BSBZ;
+    }
+
+    public String getBillNumber() {
+        return BillNumber;
+    }
+
+    public void setBillNumber(String billNumber) {
+        this.BillNumber = billNumber;
+    }
+
+    public String getRetcode() {
+        return retcode;
+    }
+
+    public void setRetcode(String retcode) {
+        this.retcode = retcode;
+    }
+
+    public String getRetmsg() {
+        return retmsg;
+    }
+
+    public void setRetmsg(String retmsg) {
+        this.retmsg = retmsg;
+    }
+
+    public Integer getRecNo() {
+        return RecNo;
+    }
+
+    public void setRecNo(Integer recNo) {
+        this.RecNo = recNo;
+    }
+
+    public String getNsrsbh() {
+        return nsrsbh;
+    }
+
+    public void setNsrsbh(String nsrsbh) {
+        this.nsrsbh = nsrsbh;
+    }
+
+    public Integer getKpfwqh() {
+        return kpfwqh;
+    }
+
+    public void setKpfwqh(Integer kpfwqh) {
+        this.kpfwqh = kpfwqh;
+    }
+
+    public Integer getKpdh() {
+        return kpdh;
+    }
+
+    public void setKpdh(Integer kpdh) {
+        this.kpdh = kpdh;
+    }
+
+}

+ 93 - 0
src/main/java/com/uas/platform/b2b/model/SoapQueryInvoiceMessage.java

@@ -0,0 +1,93 @@
+package com.uas.platform.b2b.model;
+
+import java.util.List;
+
+/**
+ * Created by 黄诚天 on 2017/7/10.
+ */
+public class SoapQueryInvoiceMessage {
+    Integer SID;
+    Integer kpfwqh;//开票服务器号
+    String retcode;//返回码
+    Integer uploadMode;
+    SoapFpArray[] fpArray;//TODO 或records?
+    String retmsg;//返回信息
+    Integer kpdh;//开票点号
+    String nsrsbh;//销方税号
+    Integer RecNo;//当前记录数
+
+    public SoapQueryInvoiceMessage() {
+    }
+
+    public Integer getSID() {
+        return SID;
+    }
+
+    public void setSID(Integer SID) {
+        this.SID = SID;
+    }
+
+    public Integer getKpfwqh() {
+        return kpfwqh;
+    }
+
+    public void setKpfwqh(Integer kpfwqh) {
+        this.kpfwqh = kpfwqh;
+    }
+
+    public String getRetcode() {
+        return retcode;
+    }
+
+    public void setRetcode(String retcode) {
+        this.retcode = retcode;
+    }
+
+    public Integer getUploadMode() {
+        return uploadMode;
+    }
+
+    public void setUploadMode(Integer uploadMode) {
+        this.uploadMode = uploadMode;
+    }
+
+    public SoapFpArray[] getFpArray() {
+        return fpArray;
+    }
+
+    public void setFpArray(SoapFpArray[] fpArray) {
+        this.fpArray = fpArray;
+    }
+
+    public String getRetmsg() {
+        return retmsg;
+    }
+
+    public void setRetmsg(String retmsg) {
+        this.retmsg = retmsg;
+    }
+
+    public Integer getKpdh() {
+        return kpdh;
+    }
+
+    public void setKpdh(Integer kpdh) {
+        this.kpdh = kpdh;
+    }
+
+    public String getNsrsbh() {
+        return nsrsbh;
+    }
+
+    public void setNsrsbh(String nsrsbh) {
+        this.nsrsbh = nsrsbh;
+    }
+
+    public Integer getRecNo() {
+        return RecNo;
+    }
+
+    public void setRecNo(Integer recNo) {
+        this.RecNo = recNo;
+    }
+}

+ 154 - 0
src/main/java/com/uas/platform/b2b/model/SoapQueryNextRepertyMessage.java

@@ -0,0 +1,154 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017/7/11.
+ */
+public class SoapQueryNextRepertyMessage {
+    Integer MachineNo;//开票机号(开票点号)
+    String CorpName;//开票机企业名称
+    Integer Kpfwqh;//开票服务器号
+    String retcode;//返回码  0 读取成功;其它为失败
+    SoapInvkind invkind0;
+    SoapInvkind invkind2;
+    SoapInvkind invkind11;
+    SoapInvkind invkind12;
+    SoapInvkind invkind41;
+    SoapInvkind invkind51;
+    String retmsg;//返回信息
+    String CheckCode;//金税盘号
+    String taxclock;//金税卡时间 yyyy-MM-dd hh:mm:ss
+    String IsRepReached;//是否报税期 Integer
+    String IsLockReached;//是否锁死期 Integer
+    String TaxCode;//开票机税号
+
+    public SoapQueryNextRepertyMessage() {
+    }
+
+    public Integer getMachineNo() {
+        return MachineNo;
+    }
+
+    public void setMachineNo(Integer machineNo) {
+        this.MachineNo = machineNo;
+    }
+
+    public String getCorpName() {
+        return CorpName;
+    }
+
+    public void setCorpName(String corpName) {
+        this.CorpName = corpName;
+    }
+
+    public Integer getKpfwqh() {
+        return Kpfwqh;
+    }
+
+    public void setKpfwqh(Integer kpfwqh) {
+        this.Kpfwqh = kpfwqh;
+    }
+
+    public String getRetcode() {
+        return retcode;
+    }
+
+    public void setRetcode(String retcode) {
+        this.retcode = retcode;
+    }
+
+    public SoapInvkind getInvkind0() {
+        return invkind0;
+    }
+
+    public void setInvkind0(SoapInvkind invkind0) {
+        this.invkind0 = invkind0;
+    }
+
+    public SoapInvkind getInvkind2() {
+        return invkind2;
+    }
+
+    public void setInvkind2(SoapInvkind invkind2) {
+        this.invkind2 = invkind2;
+    }
+
+    public SoapInvkind getInvkind11() {
+        return invkind11;
+    }
+
+    public void setInvkind11(SoapInvkind invkind11) {
+        this.invkind11 = invkind11;
+    }
+
+    public SoapInvkind getInvkind12() {
+        return invkind12;
+    }
+
+    public void setInvkind12(SoapInvkind invkind12) {
+        this.invkind12 = invkind12;
+    }
+
+    public SoapInvkind getInvkind41() {
+        return invkind41;
+    }
+
+    public void setInvkind41(SoapInvkind invkind41) {
+        this.invkind41 = invkind41;
+    }
+
+    public SoapInvkind getInvkind51() {
+        return invkind51;
+    }
+
+    public void setInvkind51(SoapInvkind invkind51) {
+        this.invkind51 = invkind51;
+    }
+
+    public String getRetmsg() {
+        return retmsg;
+    }
+
+    public void setRetmsg(String retmsg) {
+        this.retmsg = retmsg;
+    }
+
+    public String getCheckCode() {
+        return CheckCode;
+    }
+
+    public void setCheckCode(String checkCode) {
+        this.CheckCode = checkCode;
+    }
+
+    public String getTaxclock() {
+        return taxclock;
+    }
+
+    public void setTaxclock(String taxclock) {
+        this.taxclock = taxclock;
+    }
+
+    public String getIsRepReached() {
+        return IsRepReached;
+    }
+
+    public void setIsRepReached(String isRepReached) {
+        this.IsRepReached = isRepReached;
+    }
+
+    public String getIsLockReached() {
+        return IsLockReached;
+    }
+
+    public void setIsLockReached(String isLockReached) {
+        this.IsLockReached = isLockReached;
+    }
+
+    public String getTaxCode() {
+        return TaxCode;
+    }
+
+    public void setTaxCode(String taxCode) {
+        this.TaxCode = taxCode;
+    }
+}

+ 82 - 0
src/main/java/com/uas/platform/b2b/model/SoapQueryRepertyMessage.java

@@ -0,0 +1,82 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017/7/10.
+ */
+public class SoapQueryRepertyMessage {
+    Integer SID;
+    String retcode;//返回码  0 读取成功;其它为失败
+    String retmsg;//返回信息
+    SoapKcArray[] kcArray;
+    String nsrsbh; //Integer
+    Integer kpfwqh;
+    Integer kpdh;
+    Integer uploadMode;
+
+    public SoapQueryRepertyMessage() {
+    }
+
+    public Integer getSID() {
+        return SID;
+    }
+
+    public void setSID(Integer SID) {
+        this.SID = SID;
+    }
+
+    public String getRetcode() {
+        return retcode;
+    }
+
+    public void setRetcode(String retcode) {
+        this.retcode = retcode;
+    }
+
+    public String getRetmsg() {
+        return retmsg;
+    }
+
+    public void setRetmsg(String retmsg) {
+        this.retmsg = retmsg;
+    }
+
+    public SoapKcArray[] getKcArray() {
+        return kcArray;
+    }
+
+    public void setKcArray(SoapKcArray[] kcArray) {
+        this.kcArray = kcArray;
+    }
+
+    public String getNsrsbh() {
+        return nsrsbh;
+    }
+
+    public void setNsrsbh(String nsrsbh) {
+        this.nsrsbh = nsrsbh;
+    }
+
+    public Integer getKpfwqh() {
+        return kpfwqh;
+    }
+
+    public void setKpfwqh(Integer kpfwqh) {
+        this.kpfwqh = kpfwqh;
+    }
+
+    public Integer getKpdh() {
+        return kpdh;
+    }
+
+    public void setKpdh(Integer kpdh) {
+        this.kpdh = kpdh;
+    }
+
+    public Integer getUploadMode() {
+        return uploadMode;
+    }
+
+    public void setUploadMode(Integer uploadMode) {
+        this.uploadMode = uploadMode;
+    }
+}

+ 146 - 0
src/main/java/com/uas/platform/b2b/model/SoapRepertyMessage.java

@@ -0,0 +1,146 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017/7/10.
+ */
+public class SoapRepertyMessage {
+    String retcode;//返回码
+    String retmsg;//返回信息
+    String InfoNumber;//发票号码
+    String InfoTypeCode;//发票代码
+    Integer InvStock;//库存
+    String TaxClock;//金税设备日期(格式yyyy-mm-ddhh:nn:ss )
+    String TaxCode;//税号
+    Integer UploadMode;//0手动上传 1自动上传
+    Integer MachineNo;//机器号或分机号
+    Integer IsRepReached;//是否已到抄税期 1已到
+    Integer IsLockReached;//是否已到锁死期 1 已到
+    Integer InvMcType;//0打开的是防伪开票;1打开的是开票服务器
+    Integer Kpfwqh;//默认为-1,标识未知
+    String CheckCode;//机器码
+    String CorpName;//企业名称
+
+    public SoapRepertyMessage() {
+    }
+
+    public String getRetcode() {
+        return retcode;
+    }
+
+    public void setRetcode(String retcode) {
+        this.retcode = retcode;
+    }
+
+    public String getRetmsg() {
+        return retmsg;
+    }
+
+    public void setRetmsg(String retmsg) {
+        this.retmsg = retmsg;
+    }
+
+    public String getInfoNumber() {
+        return InfoNumber;
+    }
+
+    public void setInfoNumber(String infoNumber) {
+        this.InfoNumber = infoNumber;
+    }
+
+    public String getInfoTypeCode() {
+        return InfoTypeCode;
+    }
+
+    public void setInfoTypeCode(String infoTypeCode) {
+        this.InfoTypeCode = infoTypeCode;
+    }
+
+    public Integer getInvStock() {
+        return InvStock;
+    }
+
+    public void setInvStock(Integer invStock) {
+        this.InvStock = invStock;
+    }
+
+    public String getTaxClock() {
+        return TaxClock;
+    }
+
+    public void setTaxClock(String taxClock) {
+        this.TaxClock = taxClock;
+    }
+
+    public String getTaxCode() {
+        return TaxCode;
+    }
+
+    public void setTaxCode(String taxCode) {
+        this.TaxCode = taxCode;
+    }
+
+    public Integer getUploadMode() {
+        return UploadMode;
+    }
+
+    public void setUploadMode(Integer uploadMode) {
+        this.UploadMode = uploadMode;
+    }
+
+    public Integer getMachineNo() {
+        return MachineNo;
+    }
+
+    public void setMachineNo(Integer machineNo) {
+        this.MachineNo = machineNo;
+    }
+
+    public Integer getIsRepReached() {
+        return IsRepReached;
+    }
+
+    public void setIsRepReached(Integer isRepReached) {
+        this.IsRepReached = isRepReached;
+    }
+
+    public Integer getIsLockReached() {
+        return IsLockReached;
+    }
+
+    public void setIsLockReached(Integer isLockReached) {
+        this.IsLockReached = isLockReached;
+    }
+
+    public Integer getInvMcType() {
+        return InvMcType;
+    }
+
+    public void setInvMcType(Integer invMcType) {
+        this.InvMcType = invMcType;
+    }
+
+    public Integer getKpfwqh() {
+        return Kpfwqh;
+    }
+
+    public void setKpfwqh(Integer kpfwqh) {
+        this.Kpfwqh = kpfwqh;
+    }
+
+    public String getCheckCode() {
+        return CheckCode;
+    }
+
+    public void setCheckCode(String checkCode) {
+        this.CheckCode = checkCode;
+    }
+
+    public String getCorpName() {
+        return CorpName;
+    }
+
+    public void setCorpName(String corpName) {
+        this.CorpName = corpName;
+    }
+
+}

+ 103 - 0
src/main/java/com/uas/platform/b2b/model/SoapSIDType.java

@@ -0,0 +1,103 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017/7/10.
+ */
+public enum SoapSIDType {
+    /**
+     * {@code 0 获取库存信息}
+     */
+    GETREPERTORYMEAASGE(0),
+
+    /**
+     * {@code 1 发票开具}
+     */
+    INVOICEISSUED(1),
+
+    /**
+     * {@code 2 发票打印}
+     */
+    INVOICEPRINT(2),
+
+    /**
+     * {@code 3 清单打印}
+     */
+    LISTPRINT(3),
+
+    /**
+     * {@code 4 发票作废}
+     */
+    INVOICECANCEL(4),
+
+    /**
+     * {@code 5 查询发票信息}
+     */
+    QUERYINVOICEMESSAGE(5),
+
+    /**
+     * {@code 6 查询库存信息}
+     */
+    QUERYREPERTORYMEAASGE(6),
+
+    /**
+     * {@code 7 查询下一发票机库存信息}
+     */
+    QUERYNEXTREPERTORYMEAASGE(7),
+
+    /**
+     * {@code 12 启动开票服务}
+     */
+    STARTBILLOUT(12),
+
+    /**
+     * {@code 13 关闭开票服务}
+     */
+    CLOSEBILLOUT(13),
+
+    /**
+     * {@code 15 发票上传}
+     */
+    INVOICEUPLOAD(15),
+
+    /**
+     * {@code 16 发票状态更新}
+     */
+    INVOICESTATUSUPDATE(16),
+
+    /**
+     * {@code 17 单张发票查询}
+     */
+    SINGLEINVOICEQUERY(17),
+
+    /**
+     * {@code 20 批量报送}
+     */
+    BATCHSUBMIT(20),
+
+    /**
+     * {@code 22 机动车发票填开}
+     */
+    MOTORINVOICEISSUED(22),
+
+    /**
+     * {@code 24 机动车发票查询}
+     */
+    MOTORINVOICEQUERY(24),
+
+    /**
+     * {@code 25 金税设备查询}
+     */
+    TAXEQUIPMENTQUERY(25);
+
+
+    SoapSIDType(int value) {
+        this.value = value;
+    }
+
+    private final int value;
+
+    public int getValue() {
+        return this.value;
+    }
+
+}

+ 138 - 0
src/main/java/com/uas/platform/b2b/model/SoapSingleInvoiceQuery.java

@@ -0,0 +1,138 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017/7/11.
+ */
+public class SoapSingleInvoiceQuery {
+    Integer SID;
+    String retcode;//返回码  0 查询成功;其它失败
+    Double hjbhsje;//合计不含税金额
+    String retmsg;//返回信息
+    Integer fpbszt;//发票保送状态 0 未报送,1 已报送,2报送失败,3 报送中,4 验签失败
+    String xsdjbh;//销售单据编号
+    String infoxml;//发票信息的XML
+    Integer zfbz;//作废标志 0 未作废 1已作废
+    String kprq;//开票日期(yyyy-mm-dd)
+    Double hjse;//合计税额
+    Integer fpzl;//发票种类
+    String fphm;//发票号码
+    String fpdm;//发票代码
+    Integer dybz;//打印标志1已打印 0未打印
+
+
+    public SoapSingleInvoiceQuery() {
+    }
+
+    public Integer getSID() {
+        return SID;
+    }
+
+    public void setSID(Integer SID) {
+        this.SID = SID;
+    }
+
+    public String getRetcode() {
+        return retcode;
+    }
+
+    public void setRetcode(String retcode) {
+        this.retcode = retcode;
+    }
+
+    public String getRetmsg() {
+        return retmsg;
+    }
+
+    public void setRetmsg(String retmsg) {
+        this.retmsg = retmsg;
+    }
+
+    public Integer getFpzl() {
+        return fpzl;
+    }
+
+    public void setFpzl(Integer fpzl) {
+        this.fpzl = fpzl;
+    }
+
+    public String getFpdm() {
+        return fpdm;
+    }
+
+    public void setFpdm(String fpdm) {
+        this.fpdm = fpdm;
+    }
+
+    public String getFphm() {
+        return fphm;
+    }
+
+    public void setFphm(String fphm) {
+        this.fphm = fphm;
+    }
+
+    public String getXsdjbh() {
+        return xsdjbh;
+    }
+
+    public void setXsdjbh(String xsdjbh) {
+        this.xsdjbh = xsdjbh;
+    }
+
+    public Double getHjbhsje() {
+        return hjbhsje;
+    }
+
+    public void setHjbhsje(Double hjbhsje) {
+        this.hjbhsje = hjbhsje;
+    }
+
+    public Double getHjse() {
+        return hjse;
+    }
+
+    public void setHjse(Double hjse) {
+        this.hjse = hjse;
+    }
+
+    public String getKprq() {
+        return kprq;
+    }
+
+    public void setKprq(String kprq) {
+        this.kprq = kprq;
+    }
+
+    public Integer getDybz() {
+        return dybz;
+    }
+
+    public void setDybz(Integer dybz) {
+        this.dybz = dybz;
+    }
+
+    public Integer getFpbszt() {
+        return fpbszt;
+    }
+
+    public void setFpbszt(Integer fpbszt) {
+        this.fpbszt = fpbszt;
+    }
+
+    public Integer getZfbz() {
+        return zfbz;
+    }
+
+    public void setZfbz(Integer zfbz) {
+        this.zfbz = zfbz;
+    }
+
+    public String getInfoxml() {
+        return infoxml;
+    }
+
+    public void setInfoxml(String infoxml) {
+        this.infoxml = infoxml;
+    }
+
+}

+ 38 - 0
src/main/java/com/uas/platform/b2b/model/SoapStartBillOut.java

@@ -0,0 +1,38 @@
+package com.uas.platform.b2b.model;
+
+/**
+ * Created by 黄诚天 on 2017/7/11.
+ */
+public class SoapStartBillOut {
+    String retcode;//返回码,1011 表示启动开票服务成功
+    String retmsg;//返回信息
+    Integer PtVer;//平台版本标志,0:非平台 其它:平台,可以由对接系统校验必须是系统登记的才允许开票
+
+    public SoapStartBillOut() {
+    }
+
+    public String getRetcode() {
+        return retcode;
+    }
+
+    public void setRetcode(String retcode) {
+        this.retcode = retcode;
+    }
+
+    public String getRetmsg() {
+        return retmsg;
+    }
+
+    public void setRetmsg(String retmsg) {
+        this.retmsg = retmsg;
+    }
+
+    public Integer getPtVer() {
+        return PtVer;
+    }
+
+    public void setPtVer(Integer ptVer) {
+        this.PtVer = ptVer;
+    }
+
+}

+ 11 - 40
src/main/java/com/uas/platform/b2b/search/SearchService.java

@@ -8,46 +8,7 @@ import com.uas.account.support.Page;
 import com.uas.platform.b2b.erp.model.B2BCustomer;
 import com.uas.platform.b2b.erp.model.B2BVendor;
 import com.uas.platform.b2b.erp.model.SaleTenderErp;
-import com.uas.platform.b2b.model.Cart;
-import com.uas.platform.b2b.model.Component;
-import com.uas.platform.b2b.model.DeputyOrder;
-import com.uas.platform.b2b.model.Enterprise;
-import com.uas.platform.b2b.model.InvitationRecord;
-import com.uas.platform.b2b.model.Kind;
-import com.uas.platform.b2b.model.MakeAccept;
-import com.uas.platform.b2b.model.MakeOrder;
-import com.uas.platform.b2b.model.MakeOrderChangeItem;
-import com.uas.platform.b2b.model.MakeReturn;
-import com.uas.platform.b2b.model.PagingReleaseDetail;
-import com.uas.platform.b2b.model.Product;
-import com.uas.platform.b2b.model.PurcInquiry;
-import com.uas.platform.b2b.model.PurcInquiryItemInfo;
-import com.uas.platform.b2b.model.PurchaseAccept;
-import com.uas.platform.b2b.model.PurchaseApBill;
-import com.uas.platform.b2b.model.PurchaseApCheck;
-import com.uas.platform.b2b.model.PurchaseBadIn;
-import com.uas.platform.b2b.model.PurchaseBadOut;
-import com.uas.platform.b2b.model.PurchaseForecastAll;
-import com.uas.platform.b2b.model.PurchaseInquiryItem;
-import com.uas.platform.b2b.model.PurchaseInquiryMould;
-import com.uas.platform.b2b.model.PurchaseMRB;
-import com.uas.platform.b2b.model.PurchaseNotice;
-import com.uas.platform.b2b.model.PurchaseOrderAll;
-import com.uas.platform.b2b.model.PurchaseOrderChange;
-import com.uas.platform.b2b.model.PurchaseOrderDone;
-import com.uas.platform.b2b.model.PurchaseOrderEnd;
-import com.uas.platform.b2b.model.PurchaseOrderReceived;
-import com.uas.platform.b2b.model.PurchaseOrderTodo;
-import com.uas.platform.b2b.model.PurchaseOrderWaiting;
-import com.uas.platform.b2b.model.PurchaseProofingApproval;
-import com.uas.platform.b2b.model.PurchaseProofingItem;
-import com.uas.platform.b2b.model.PurchaseProofingSend;
-import com.uas.platform.b2b.model.PurchaseReturn;
-import com.uas.platform.b2b.model.PurchaseTender;
-import com.uas.platform.b2b.model.SaleARCheck;
-import com.uas.platform.b2b.model.SaleQuotationAll;
-import com.uas.platform.b2b.model.SaleSendAll;
-import com.uas.platform.b2b.model.Vendor;
+import com.uas.platform.b2b.model.*;
 import com.uas.search.b2b.model.PageParams;
 import com.uas.search.b2b.model.SPage;
 
@@ -526,4 +487,14 @@ public interface SearchService {
 	Page<B2BVendor> searchVendorForErp(String keyword, PageParams pageParams);
 
 	Page<B2BCustomer> searchCustomerForErp(String keyword, PageParams pageParams);
+
+	/**
+	 *
+	 * 航天开票单
+	 *
+	 * @param keyword
+	 * @param pageParams
+	 * @return
+	 */
+	public SPage<PurchaseApBillOut> searchPurchaseApBillOutIds(String keyword, PageParams pageParams);
 }

+ 29 - 64
src/main/java/com/uas/platform/b2b/search/SearchServiceImpl.java

@@ -1,27 +1,5 @@
 package com.uas.platform.b2b.search;
 
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.jpa.domain.Specification;
-import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
-
 import com.alibaba.fastjson.JSONObject;
 import com.uas.account.entity.UserSpaceDetail;
 import com.uas.account.support.Page;
@@ -69,52 +47,12 @@ import com.uas.platform.b2b.dao.SaleSendAllDao;
 import com.uas.platform.b2b.dao.SaleTenderDao;
 import com.uas.platform.b2b.dao.SaleTenderErpDao;
 import com.uas.platform.b2b.dao.VendorDao;
+import com.uas.platform.b2b.dao.*;
 import com.uas.platform.b2b.erp.model.B2BCustomer;
 import com.uas.platform.b2b.erp.model.B2BVendor;
 import com.uas.platform.b2b.erp.model.SaleTenderErp;
 import com.uas.platform.b2b.erp.model.SaleTenderItemErp;
-import com.uas.platform.b2b.model.Brand;
-import com.uas.platform.b2b.model.Cart;
-import com.uas.platform.b2b.model.Component;
-import com.uas.platform.b2b.model.DeputyOrder;
-import com.uas.platform.b2b.model.Enterprise;
-import com.uas.platform.b2b.model.InvitationRecord;
-import com.uas.platform.b2b.model.Kind;
-import com.uas.platform.b2b.model.MakeAccept;
-import com.uas.platform.b2b.model.MakeOrder;
-import com.uas.platform.b2b.model.MakeOrderChangeItem;
-import com.uas.platform.b2b.model.MakeReturn;
-import com.uas.platform.b2b.model.PagingReleaseDetail;
-import com.uas.platform.b2b.model.Product;
-import com.uas.platform.b2b.model.PurcInquiry;
-import com.uas.platform.b2b.model.PurcInquiryItemInfo;
-import com.uas.platform.b2b.model.PurchaseAccept;
-import com.uas.platform.b2b.model.PurchaseApBill;
-import com.uas.platform.b2b.model.PurchaseApCheck;
-import com.uas.platform.b2b.model.PurchaseBadIn;
-import com.uas.platform.b2b.model.PurchaseBadOut;
-import com.uas.platform.b2b.model.PurchaseForecastAll;
-import com.uas.platform.b2b.model.PurchaseInquiryItem;
-import com.uas.platform.b2b.model.PurchaseInquiryMould;
-import com.uas.platform.b2b.model.PurchaseMRB;
-import com.uas.platform.b2b.model.PurchaseNotice;
-import com.uas.platform.b2b.model.PurchaseOrderAll;
-import com.uas.platform.b2b.model.PurchaseOrderChange;
-import com.uas.platform.b2b.model.PurchaseOrderDone;
-import com.uas.platform.b2b.model.PurchaseOrderEnd;
-import com.uas.platform.b2b.model.PurchaseOrderReceived;
-import com.uas.platform.b2b.model.PurchaseOrderTodo;
-import com.uas.platform.b2b.model.PurchaseOrderWaiting;
-import com.uas.platform.b2b.model.PurchaseProofingApproval;
-import com.uas.platform.b2b.model.PurchaseProofingItem;
-import com.uas.platform.b2b.model.PurchaseProofingSend;
-import com.uas.platform.b2b.model.PurchaseReturn;
-import com.uas.platform.b2b.model.PurchaseTender;
-import com.uas.platform.b2b.model.PurchaseTenderProd;
-import com.uas.platform.b2b.model.SaleARCheck;
-import com.uas.platform.b2b.model.SaleQuotationAll;
-import com.uas.platform.b2b.model.SaleSendAll;
-import com.uas.platform.b2b.model.Vendor;
+import com.uas.platform.b2b.model.*;
 import com.uas.platform.b2b.support.SystemSession;
 import com.uas.platform.core.persistence.criteria.PredicateFactory;
 import com.uas.platform.core.persistence.criteria.PredicateUtils;
@@ -122,6 +60,19 @@ import com.uas.search.b2b.model.PageParams;
 import com.uas.search.b2b.model.SPage;
 import com.uas.search.b2b.service.SearchService.Table_name;
 import com.uas.search.b2b.util.SearchConstants;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import java.lang.reflect.Field;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * 搜索实现
@@ -268,6 +219,9 @@ public class SearchServiceImpl implements com.uas.platform.b2b.search.SearchServ
 	@Autowired
 	private SaleTenderDao saleTenderDao;
 
+	@Autowired
+	private PurchaseApBillOutDao purchaseApBillOutDao;
+
 	/**
 	 * 联想词size
 	 */
@@ -1442,4 +1396,15 @@ public class SearchServiceImpl implements com.uas.platform.b2b.search.SearchServ
 		return kindDao.findByNameCn(keyword).get(0);
 	}
 
+	/**
+	 * 航天开票单: purc$apbillout
+	 */
+	@Override
+	public SPage<PurchaseApBillOut> searchPurchaseApBillOutIds(String keyword, PageParams pageParams) {
+		SPage<Long> idsPage = searchService.searchIds(keyword, Table_name.PURC$APBILLOUT, pageParams);
+		List<PurchaseApBillOut> content = purchaseApBillOutDao.findAll(idsPage.getContent());
+		sortByProperty(content, PurchaseApBillOut.class, "id", idsPage.getContent());
+		return toSPage(idsPage, content);
+	}
+
 }

+ 151 - 0
src/main/java/com/uas/platform/b2b/service/PurchaseApBillOutService.java

@@ -0,0 +1,151 @@
+package com.uas.platform.b2b.service;
+
+import com.uas.platform.b2b.model.*;
+import com.uas.platform.core.model.PageInfo;
+import org.springframework.data.domain.Page;
+import org.springframework.ui.ModelMap;
+
+import java.util.HashMap;
+import java.util.List;
+
+public interface PurchaseApBillOutService {
+
+	/**
+	 * 获取需要上传到供应商ERP的客户委外订单
+	 * 
+	 * @return
+	 */
+	//public List<PurchaseApBillOut> findNotUploadApBillOut();
+
+	/**
+	 * 平台的应收对账传到供应商ERP之后,修改平台里面的订单的上传状态
+	 * 
+	 * @param idArray
+	 */
+	//public void onApBillOutSuccess(String[] idArray);
+
+	/**
+	 * 批量保存开票单
+	 * 
+	 * @param checkItems
+	 * @return
+	 */
+	public void saveApBillOuts(List<PurchaseApBillOutItem> checkItems);
+
+	/**
+	 * 作废开票单
+	 * 
+	 * @param id
+	 */
+	public boolean cancelApBillOut(Long id);
+
+	/**
+	 * 保存生成的开票单主记录
+	 */
+	public PurchaseApBillOut save(PurchaseApBillOut purchaseApBillOut, List<HashMap<String, Object>> sourceInfoList);
+
+	/**
+	 * 根据ID获取生成的开票单
+	 * 
+	 * @param id
+	 * @return
+	 */
+	public PurchaseApBillOut findById(Long id);
+
+	/**
+	 * 根据来源表的ID更新来源单据已开票数
+	 */
+	public void updateApCheckItemBilled(List<HashMap<String, Object>> list);
+
+	/**
+	 * 根据开票单更新来源单据已开票数
+	 */
+	public void updateBilledByApBillOut(PurchaseApBillOut apBillOut);
+
+	/**
+	 * 删除新生成的开票单
+	 */
+	public void deleteApBillOut(Long id);
+
+	/**
+	 * 提交生成的未开票单
+	 */
+	public ModelMap doBillOut(Long id);
+
+	/**
+	 * 分页查找开票单,包括明细(全部)
+	 * 
+	 * @param pageInfo
+	 * @param keyword
+	 *            查找关键字
+	 * @return
+	 */
+	public Page<PurchaseApBillOut> findAllByPageInfo(PageInfo pageInfo, String keyword, SearchFilter searchFilter);
+
+	/**
+	 * 分页查找开票单,包括明细(未开票)
+	 * 
+	 * @param pageInfo
+	 * @param keyword
+	 *            查找关键字
+	 * @return
+	 */
+	public Page<PurchaseApBillOutTodo> findTodoByPageInfo(PageInfo pageInfo, String keyword, SearchFilter searchFilter);
+
+	/**
+	 * 分页查找开票单,包括明细(已开票)
+	 * 
+	 * @param pageInfo
+	 * @param keyword
+	 *            查找关键字
+	 * @return
+	 */
+	public Page<PurchaseApBillOutDone> findDoneByPageInfo(PageInfo pageInfo, String keyword, SearchFilter searchFilter);
+
+	/**
+	 * 分页查找开票单,包括明细(不同意 已作废 )
+	 * 
+	 * @param pageInfo
+	 * @param keyword
+	 *            查找关键字
+	 * @return
+	 */
+	public Page<PurchaseApBillOutEnd> findEndByPageInfo(PageInfo pageInfo, String keyword, SearchFilter searchFilter);
+
+	/**
+	 * 打印订单,订单打印此次 +1
+	 * 
+	 * @param id
+	 */
+	public void print(Long id);
+
+	/**
+	 * 通过sourceTable和sourceId判断是否存在未开票的单据
+	 * 
+	 * @param sourceTable
+	 * @param sourceId
+	 * @return
+	 */
+	public List<PurchaseApBillOutItem> findBySourceTableAndSourceId(String sourceTable, Long sourceId);
+
+	/**
+	 * 待处理的开票单
+	 * 
+	 * @return
+	 */
+	public long getCountByenUUAndStatus();
+
+	/**
+	 * 获取分类编码信息
+	 *
+	 * @return
+	 */
+	public PurchaseApBillOutTaxCode getTaxCode(String spbm, String version);
+
+	/**
+	 * 作废发票
+	 *
+	 * @return
+	 */
+	public ModelMap invoiceCancel(PurchaseApBillOut apBillOut);
+}

+ 12 - 0
src/main/java/com/uas/platform/b2b/service/PurchaseApCheckService.java

@@ -142,4 +142,16 @@ public interface PurchaseApCheckService {
     List<Long> getUnreadIds(String category);
 
 	void setReadByOrder(String category, Long[] sourceId);
+
+	/**
+	 * 获取明细表中已开票数
+	 *
+	 * @return
+	 */
+	public Double getBilledByItemId(Long id);
+
+	/**
+	 * 查找已确认应收对账单明细,用于新增开票单时数据来源
+	 */
+	public List<PurchaseApCheckItem> findDoneApCheckItems(List<Long> filter, String keyword, Long fromDate, Long endDate);
 }

+ 132 - 0
src/main/java/com/uas/platform/b2b/service/SOAPConsoleService.java

@@ -0,0 +1,132 @@
+package com.uas.platform.b2b.service;
+
+import com.uas.platform.b2b.model.*;
+import org.springframework.ui.ModelMap;
+
+/**
+ * Created by 黄诚天 on 2017/7/11.
+ */
+public interface SOAPConsoleService {
+    /**
+     * 获取库存信息
+     *
+     * @param
+     * @return
+     */
+    public ModelMap getRepertoryMessage();
+
+    /**
+     * 发票开具
+     *
+     * @param apBillOut
+     * @return
+     */
+    public ModelMap invoiceIssued(PurchaseApBillOut apBillOut);
+
+
+    /**
+     * 发票打印
+     *
+     * @param apBillOut
+     * @return
+     */
+    public ModelMap invoicePrint(PurchaseApBillOut apBillOut, Integer PrintKind);
+
+    /**
+     * 清单打印
+     *
+     * @param apBillOut
+     * @return
+     */
+    public ModelMap listPrint(PurchaseApBillOut apBillOut);
+
+    /**
+     * 发票作废
+     *
+     * @param apBillOut
+     * @return
+     */
+    public ModelMap InvoiceCancel(PurchaseApBillOut apBillOut);
+
+    /**
+     * 查询发票信息
+     *
+     * @param apBillOut
+     * @return
+     */
+    public ModelMap queryInvoiceMessage(PurchaseApBillOut apBillOut, Integer a, Integer b);
+
+    /**
+     * 查询库存信息
+     *
+     * @return
+     */
+    public ModelMap queryRepertyMessage();
+
+    /**
+     * 查询下一发票机库存信息
+     *
+     * @return
+     */
+    public ModelMap queryNextRepertyMessage();
+
+    /**
+     * 启动开票服务
+     *
+     * @return
+     */
+    public ModelMap startBillOut();
+
+    /**
+     * 关闭开票服务
+     *
+     * @return
+     */
+    public ModelMap closeBillOut();
+
+    /**
+     * 发票上传
+     *
+     * @param apBillOut
+     * @return
+     */
+    public ModelMap invoiceUpload(PurchaseApBillOut apBillOut);
+
+    /**
+     * 发票状态更新
+     *
+     * @return
+     */
+    public ModelMap invoiceStatusUpdate();
+
+    /**
+     * 单张发票查询
+     *
+     * @param apBillOut
+     * @return
+     */
+    public ModelMap singleInvoiceQuery(PurchaseApBillOut apBillOut);
+
+    /**
+     * 机动车发票填开
+     *
+     * @param json
+     * @return
+     */
+    public SoapMotorInvoiceIssued motorInvoiceIssued(String json);
+
+    /**
+     * 机动车发票查询
+     *
+     * @param json
+     * @return
+     */
+    public SoapMotorInvoiceQuery motorInvoiceQuery(String json);
+
+    /**
+     * 查询金税设备
+     *
+     * @return
+     */
+    public ModelMap taxEquipmentQuery();
+}

+ 481 - 0
src/main/java/com/uas/platform/b2b/service/impl/PurchaseApBillOutServiceImpl.java

@@ -0,0 +1,481 @@
+package com.uas.platform.b2b.service.impl;
+
+import com.uas.platform.b2b.dao.*;
+import com.uas.platform.b2b.model.*;
+import com.uas.platform.b2b.search.SearchService;
+import com.uas.platform.b2b.service.PurchaseApBillOutService;
+import com.uas.platform.b2b.service.SOAPConsoleService;
+import com.uas.platform.b2b.support.SystemSession;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.persistence.criteria.PredicateUtils;
+import com.uas.search.b2b.model.PageParams;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.ui.ModelMap;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@Service
+public class PurchaseApBillOutServiceImpl implements PurchaseApBillOutService {
+
+	@Autowired
+	PurchaseApBillOutDao purchaseApBillOutDao;
+
+	@Autowired
+	PurchaseApBillOutTodoDao purchaseApBillOutTodoDao;
+
+	@Autowired
+	PurchaseApBillOutDoneDao purchaseApBillOutDoneDao;
+
+	@Autowired
+	PurchaseApBillOutEndDao purchaseApBillOutEndDao;
+
+	@Autowired
+	PurchaseApBillOutItemDao purchaseApBillOutItemDao;
+
+	@Autowired
+	PurchaseApCheckItemDao purchaseApCheckItemDao;
+
+
+	@Autowired
+	private JdbcTemplate jdbcTemplate;
+
+	@Autowired
+	private CommonDao commonDao;
+
+	@Autowired
+	private SearchService searchService;
+
+	@Autowired
+	private ProductDao productDao;
+
+	@Autowired
+	private SOAPConsoleService soapConsoleService;
+
+	/*@Override
+	public List<PurchaseApCheck> findNotUploadAPcheck() {
+		return purchaseApCheckDao.findByCustUuAndStatusAndCheckStatus(SystemSession.getUser().getEnterprise().getUu(),
+				(short) Status.NOT_UPLOAD.value(), "未对账");
+	}
+
+	@Override
+	public void onApCheckSuccess(String[] idArray) {
+		for (String id : idArray) {
+			PurchaseApCheck apCheck = purchaseApCheckDao.findOne(Long.parseLong(id));
+			if (apCheck != null) {
+				apCheck.setStatus((short) Status.DOWNLOADED.value());
+				purchaseApCheckDao.save(apCheck);
+			}
+		}
+	}*/
+
+	@Override
+	public void saveApBillOuts(List<PurchaseApBillOutItem> checkItems) {
+		if (checkItems != null && checkItems.size() > 0) {
+			purchaseApBillOutItemDao.save(checkItems);
+		} else {
+
+		}
+	}
+
+	@Override
+	public boolean cancelApBillOut(Long id) {
+		/*PurchaseApBillOut check = purchaseApBillOutDao.findOne(id);
+		if (check != null) {
+			if (!CollectionUtils.isEmpty(check.getItems()) && check.getCheckStatus().equals("不同意")) {
+				for (PurchaseApBillOutItem item : check.getItems()) {
+					item.setCheckQty(0.0);
+					Double newYCheckQtyVal = item.getOldYCheckQty();
+					Long sourceIdVal = item.getSourceId();
+					String sourceTable = null;
+					String idName = null;
+					String yCheckQtyName = null;
+					if (item.getSourceTable() != null) {
+						sourceTable = item.getSourceTable();
+					} else {
+						sourceTable = "";
+					}
+					if (sourceTable.equals("purc$returnitem")) {
+						idName = "pri_id";
+						yCheckQtyName = "pri_ycheckqty";
+					} else if (sourceTable.equals("purc$acceptitem")) {
+						idName = "pai_id";
+						yCheckQtyName = "pai_ycheckqty";
+					} else if (sourceTable.equals("purc$badinitem")) {
+						idName = "pbi_id";
+						yCheckQtyName = "pbi_ycheckqty";
+					} else if (sourceTable.equals("purc$badoutitem")) {
+						idName = "poi_id";
+						yCheckQtyName = "poi_ycheckqty";
+					} else if (sourceTable.equals("make$acceptitem")) {
+						idName = "mai_id";
+						yCheckQtyName = "mai_ycheckqty";
+					} else if (sourceTable.equals("make$returnitem")) {
+						idName = "mri_id";
+						yCheckQtyName = "mri_ycheckqty";
+					} else if (sourceTable.equals("purc$apbilladjustment")) {
+						idName = "aa_id";
+						yCheckQtyName = "aa_ycheckqty";
+					}
+					String sql = "update " + sourceTable + " set " + yCheckQtyName + " = " + newYCheckQtyVal + " where "
+							+ idName + " = " + sourceIdVal;
+					jdbcTemplate.execute(sql);
+				}
+			}
+			check.setCheckStatus("已作废");
+			purchaseApBillOutDao.save(check);
+			return true;
+		}*/
+		return false;
+	}
+
+	@Override
+	public PurchaseApBillOut findById(Long id) {
+		return purchaseApBillOutDao.findOne(id);
+	}
+
+	@Override
+	public void updateApCheckItemBilled(List<HashMap<String, Object>> list) {
+		if (!CollectionUtils.isEmpty(list)) {
+			for (HashMap<String, Object> map : list) {
+				Set<String> keySet = map.keySet();
+				Double billedVal = null;
+				Long sourceIdVal = null;
+				String sourceTable = null;
+				String idName = null;
+				String billedName = null;
+				for (String key : keySet) {
+					if (key.equals("newBilledQty")) {
+						billedVal = Double.valueOf(map.get(key).toString());
+					} else if (key.equals("sourceId")) {
+						sourceIdVal = Long.parseLong(map.get(key).toString());
+					} else if (key.equals("sourceTable")) {
+						sourceTable = map.get(key).toString();
+					}
+				}
+				if (sourceTable.equals("PURC$APCHECKITEM")) {
+					idName = "pai_id";
+					billedName = "pai_billed";
+				}
+				String sql = "update " + sourceTable + " set " + billedName + " = " + billedVal + " where "
+						+ idName + " = " + sourceIdVal;
+				jdbcTemplate.execute(sql);
+
+			}
+		}
+	}
+
+	@Override
+	public void updateBilledByApBillOut(PurchaseApBillOut apBillOut) {
+		List<HashMap<String, Object>> list = new ArrayList<>();
+		for (PurchaseApBillOutItem item : apBillOut.getItems()) {
+			//items.add(item);
+
+			//查询当前开票数
+			Double nowQTY = item.getNowQty();
+			//查询对账单明细表中已开票数
+			Double oldBilledQty = purchaseApCheckItemDao.getBilledById(item.getSourceId());
+
+			//计算新的已开票数
+			Double newBilledQty = oldBilledQty - nowQTY;
+			HashMap<String, Object> map = new HashMap<>();
+			map.put("newBilledQty", newBilledQty);
+			map.put("sourceId", item.getSourceId());
+			map.put("sourceTable", item.getSourceTable());
+			list.add(map);
+		}
+
+		//更新新的已开票数到对账单明细表
+		this.updateApCheckItemBilled(list);
+	}
+
+	@Override
+	@Transactional
+	public void deleteApBillOut(Long id) {
+		PurchaseApBillOut apBillOut = purchaseApBillOutDao.findOne(id);
+		this.updateBilledByApBillOut(apBillOut);
+		purchaseApBillOutDao.delete(apBillOut);
+
+	}
+
+	@Override
+	public ModelMap doBillOut(Long id) {
+		ModelMap map = new ModelMap();
+		PurchaseApBillOut apBillOut = purchaseApBillOutDao.findOne(id);
+		if (apBillOut != null) {
+			//调用航天接口开具发票
+			map =soapConsoleService.invoiceIssued(apBillOut);
+		} else {
+			map.put("error", "不存在此开票单");
+		}
+		return map;
+	}
+
+	@Override
+	@Transactional
+	public PurchaseApBillOut save(PurchaseApBillOut purchaseApBillOut, List<HashMap<String, Object>> sourceInfoList) {
+		purchaseApBillOut.setRecordDate(new Date());
+		Date d = new Date();
+		SimpleDateFormat sdf = new SimpleDateFormat("yyMMddhhmmss_SSS");
+		String code = sdf.format(d);
+		purchaseApBillOut.setCode(code);
+		purchaseApBillOut.setRecorder(SystemSession.getUser().getUserName());
+		Short number = 0;
+		List<PurchaseApBillOutItem> items = new ArrayList<PurchaseApBillOutItem>();
+		Double amount = 0.0; //开票单总开票金额
+
+		for (PurchaseApBillOutItem item : purchaseApBillOut.getItems()) {
+			//通过通过所属企业的ID和产品的编号查找产品ID并插入到开票明细表中
+			if (purchaseApBillOut.getCustUu() != null && item.getProdCode() != null) {
+				List<Product> products = productDao.findByEnUUAndCode(purchaseApBillOut.getCustUu(), item.getProdCode());
+				if (products.get(0) != null) {
+					item.setPrid(products.get(0).getId());
+				}
+			}
+
+			item.setNumber(++number);
+			item.setNowPrice(item.getNowQty()*item.getPrice());
+			item.setApBillOut(purchaseApBillOut);
+			items.add(item);
+			amount = amount + item.getNowPrice();
+		}
+
+		purchaseApBillOut.setAmount(amount);
+		items = purchaseApBillOutItemDao.save(items);
+		this.updateApCheckItemBilled(sourceInfoList);
+		/*if (!CollectionUtils.isEmpty(items)) {
+			ContextUtils.publishEvent(new PurchaseApBillOutSaveEvent(PurchaseApBillOutItem.distinct(items)));
+		}*/
+		return purchaseApBillOut;
+	}
+
+
+	@Override
+	public Page<PurchaseApBillOut> findAllByPageInfo(final PageInfo pageInfo, final String keyword,
+			SearchFilter searchFilter) {
+		if (searchFilter != null) {
+			if (!CollectionUtils.isEmpty(searchFilter.getDistribute()))
+				pageInfo.expression(PredicateUtils.in("vendUU", searchFilter.getDistribute(), false));
+			if (searchFilter.getFromDate() != null)
+				pageInfo.expression(PredicateUtils.gte("recordDate", new Date(searchFilter.getFromDate()), false));
+			if (searchFilter.getEndDate() != null)
+				pageInfo.expression(PredicateUtils.lte("recordDate", new Date(searchFilter.getEndDate()), false));
+		}
+		return purchaseApBillOutDao.findAll(new Specification<PurchaseApBillOut>() {
+			public Predicate toPredicate(Root<PurchaseApBillOut> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
+				if (StringUtils.hasText(keyword)) {
+					List<Object> lists = new ArrayList<>();
+					PageParams pageParams = new PageParams();
+					ModelMap map = new ModelMap();
+					map.put("pa_enuu", SystemSession.getUser().getEnterprise().getUu());
+					pageParams.setFilters(map);
+					for (PurchaseApBillOut list : searchService.searchPurchaseApBillOutIds(keyword, pageParams)
+							.getContent()) {
+						lists.add(list.getId());
+					}
+					pageInfo.expression(PredicateUtils.in("id", lists, false));
+				}
+				query.where(pageInfo.getPredicates(root, query, builder));
+				return null;
+			}
+		}, pageInfo);
+	}
+
+	public Page<PurchaseApBillOutTodo> findTodoByPageInfo(final PageInfo pageInfo, final String keyword,
+			SearchFilter searchFilter) {
+		if (searchFilter != null) {
+			if (!CollectionUtils.isEmpty(searchFilter.getDistribute()))
+				pageInfo.expression(PredicateUtils.in("vendUU", searchFilter.getDistribute(), false));
+			if (searchFilter.getFromDate() != null)
+				pageInfo.expression(PredicateUtils.gte("recordDate", new Date(searchFilter.getFromDate()), false));
+			if (searchFilter.getEndDate() != null)
+				pageInfo.expression(PredicateUtils.lte("recordDate", new Date(searchFilter.getEndDate()), false));
+		}
+		return purchaseApBillOutTodoDao.findAll(new Specification<PurchaseApBillOutTodo>() {
+			public Predicate toPredicate(Root<PurchaseApBillOutTodo> root, CriteriaQuery<?> query,
+					CriteriaBuilder builder) {
+				if (StringUtils.hasText(keyword)) {
+					List<Object> lists = new ArrayList<>();
+					PageParams pageParams = new PageParams();
+					ModelMap map = new ModelMap();
+					map.put("pa_enuu", SystemSession.getUser().getEnterprise().getUu());
+					pageParams.setFilters(map);
+					for (PurchaseApBillOut list : searchService.searchPurchaseApBillOutIds(keyword, pageParams)
+							.getContent()) {
+						lists.add(list.getId());
+					}
+					pageInfo.expression(PredicateUtils.in("id", lists, false));
+				}
+				query.where(pageInfo.getPredicates(root, query, builder));
+				return null;
+			}
+		}, pageInfo);
+	}
+
+	public Page<PurchaseApBillOutDone> findDoneByPageInfo(final PageInfo pageInfo, final String keyword,
+			SearchFilter searchFilter) {
+		if (searchFilter != null) {
+			if (!CollectionUtils.isEmpty(searchFilter.getDistribute()))
+				pageInfo.expression(PredicateUtils.in("vendUU", searchFilter.getDistribute(), false));
+			if (searchFilter.getFromDate() != null)
+				pageInfo.expression(PredicateUtils.gte("recordDate", new Date(searchFilter.getFromDate()), false));
+			if (searchFilter.getEndDate() != null)
+				pageInfo.expression(PredicateUtils.lte("recordDate", new Date(searchFilter.getEndDate()), false));
+		}
+		return purchaseApBillOutDoneDao.findAll(new Specification<PurchaseApBillOutDone>() {
+			public Predicate toPredicate(Root<PurchaseApBillOutDone> root, CriteriaQuery<?> query,
+					CriteriaBuilder builder) {
+				if (StringUtils.hasText(keyword)) {
+					List<Object> lists = new ArrayList<>();
+					PageParams pageParams = new PageParams();
+					ModelMap map = new ModelMap();
+					map.put("pa_enuu", SystemSession.getUser().getEnterprise().getUu());
+					pageParams.setFilters(map);
+					for (PurchaseApBillOut list : searchService.searchPurchaseApBillOutIds(keyword, pageParams)
+							.getContent()) {
+						lists.add(list.getId());
+					}
+					pageInfo.expression(PredicateUtils.in("id", lists, false));
+				}
+				query.where(pageInfo.getPredicates(root, query, builder));
+				return null;
+			}
+		}, pageInfo);
+	}
+
+	public Page<PurchaseApBillOutEnd> findEndByPageInfo(final PageInfo pageInfo, final String keyword,
+			SearchFilter searchFilter) {
+		if (searchFilter != null) {
+			if (!CollectionUtils.isEmpty(searchFilter.getDistribute()))
+				pageInfo.expression(PredicateUtils.in("vendUU", searchFilter.getDistribute(), false));
+			if (searchFilter.getFromDate() != null)
+				pageInfo.expression(PredicateUtils.gte("recordDate", new Date(searchFilter.getFromDate()), false));
+			if (searchFilter.getEndDate() != null)
+				pageInfo.expression(PredicateUtils.lte("recordDate", new Date(searchFilter.getEndDate()), false));
+		}
+		return purchaseApBillOutEndDao.findAll(new Specification<PurchaseApBillOutEnd>() {
+			public Predicate toPredicate(Root<PurchaseApBillOutEnd> root, CriteriaQuery<?> query,
+					CriteriaBuilder builder) {
+				if (StringUtils.hasText(keyword)) {
+					List<Object> lists = new ArrayList<>();
+					PageParams pageParams = new PageParams();
+					ModelMap map = new ModelMap();
+					map.put("pa_enuu", SystemSession.getUser().getEnterprise().getUu());
+					pageParams.setFilters(map);
+					for (PurchaseApBillOut list : searchService.searchPurchaseApBillOutIds(keyword, pageParams)
+							.getContent()) {
+						lists.add(list.getId());
+					}
+					pageInfo.expression(PredicateUtils.in("id", lists, false));
+				}
+				query.where(pageInfo.getPredicates(root, query, builder));
+				return null;
+			}
+		}, pageInfo);
+	}
+
+	/**
+	 * 获取出入库单数据信息
+	 * 
+	 * @param sourceTable
+	 * @param idName
+	 * @param yCheckQtyName
+	 * @return
+	 */
+	public List<String> getSourceInfo(String sourceTable, String idName, String yCheckQtyName, String prodId) {
+		List<String> list = new ArrayList<String>();
+		/*if (sourceTable != null) {
+			if (sourceTable.equals("purc$returnitem")) {
+				idName = "pri_id";
+				yCheckQtyName = "pri_ycheckqty";
+				prodId = "pri_prodid";
+			} else if (sourceTable.equals("purc$acceptitem")) {
+				idName = "pai_id";
+				yCheckQtyName = "pai_ycheckqty";
+				prodId = "pai_prodid";
+			} else if (sourceTable.equals("purc$badinitem")) {
+				idName = "pbi_id";
+				yCheckQtyName = "pbi_ycheckqty";
+			} else if (sourceTable.equals("purc$badoutitem")) {
+				idName = "poi_id";
+				yCheckQtyName = "poi_ycheckqty";
+			} else if (sourceTable.equals("make$acceptitem")) {
+				idName = "mai_id";
+				yCheckQtyName = "mai_ycheckqty";
+			} else if (sourceTable.equals("make$returnitem")) {
+				idName = "mri_id";
+				yCheckQtyName = "mri_ycheckqty";
+			} else if (sourceTable.equals("purc$apbilladjustment")) {
+				idName = "aa_id";
+				yCheckQtyName = "aa_ycheckqty";
+			}
+			list.add(sourceTable);
+			list.add(idName);
+			list.add(yCheckQtyName);
+			list.add(prodId);
+		}*/
+		return list;
+	}
+
+	//处于弃用状态
+	@Override
+	public void print(Long id) {
+		PurchaseApBillOut apBillOut = purchaseApBillOutDao.findOne(id);
+		if (apBillOut != null) {
+			apBillOut.setPrint((short) ((apBillOut.getPrint() == null ? 0 : apBillOut.getPrint()) + 1));
+		}
+		purchaseApBillOutDao.save(apBillOut);
+
+	}
+
+	@Override
+	public List<PurchaseApBillOutItem> findBySourceTableAndSourceId(String sourceTable, Long sourceId) {
+		return purchaseApBillOutItemDao.findBySourceTableAndSourceId(sourceTable, sourceId);
+	}
+
+	@Override
+	public long getCountByenUUAndStatus() {
+		return 0;
+		//
+		//return purchaseApBillOutDao.getCountByenUUAndStatus(SystemSession.getUser().getEnterprise().getUu(), "未对账");
+	}
+
+	@Override
+	public PurchaseApBillOutTaxCode getTaxCode(String spbm, String version) {
+		//数据库中spbm的科学计数格式是没有“+”号,倘若传过来的科学计数包含加号,java会自动转换,不需要做处理
+		String sql = "select t.id id,t.spbm spbm,t.spmc spmc,t.zzssl zzssl,t.hzx hzx,t.kyzt kyzt,t.zzstsgl zzstsgl,t.tjjbm tjjbm,t.pid pid,t.version version " +
+				"from TAX$CLASSIFICATION t where t.spbm=" + spbm + " and t.version=" + version;
+		List<PurchaseApBillOutTaxCode> taxCodes = commonDao.query(sql, PurchaseApBillOutTaxCode.class);
+		if (taxCodes == null) {
+			return null;
+		} else {
+			if (taxCodes.size() < 1) {
+				return null;
+			}
+		}
+		PurchaseApBillOutTaxCode taxCode = taxCodes.get(0);
+		return taxCode;
+	}
+
+	@Override
+	@Transactional
+	public ModelMap invoiceCancel(PurchaseApBillOut apBillOut) {
+		ModelMap map = new ModelMap();
+		map = soapConsoleService.InvoiceCancel(apBillOut);
+		if ("6011".equals(map.get("retcode"))) {
+			this.updateBilledByApBillOut(apBillOut);
+		}
+		return map;
+	}
+}

+ 57 - 0
src/main/java/com/uas/platform/b2b/service/impl/PurchaseApCheckServiceImpl.java

@@ -55,6 +55,9 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
 	@Autowired
 	private JdbcTemplate jdbcTemplate;
 
+	@Autowired
+	private CommonDao commonDao;
+
 	@Autowired
 	private SearchService searchService;
 
@@ -557,4 +560,58 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
 	public void setReadByOrder(String category, Long[] sourceId) {
 		userOrderDao.setReadStatus(SystemSession.getUser().getEnterprise().getUu(), SystemSession.getUser().getUserUU(), "purc$apcheck", category, (short) Status.READ.value(), sourceId);
 	}
+
+	@Override
+	public List<PurchaseApCheckItem> findDoneApCheckItems(List<Long> filter, String keyword, Long fromDate, Long endDate) {
+		Long enUu = SystemSession.getUser().getEnterprise().getUu();
+		/*String sql = "select c.pa_id id,c.pa_apdate apDate,c.pa_begindate beginDate,c.pa_checkamount checkAmount," +
+				"c.pa_checkstatus checkStatus,c.pa_code code,c.pa_commitdate commitDate,c.pa_currency currency," +
+				"c.pa_custuu custUu,c.pa_enuu enUu,c.pa_enddate endDate,c.pa_payments payments," +
+				"c.pa_recorddate recordDate,c.pa_recorder recorder,c.pa_remark remark,c.pa_resdate resDate," +
+				"c.pa_resman resMan,c.pa_status status,c.pa_taxrate taxrate,c.pa_custname custName," +
+				"c.pa_custreply custreply,c.pa_rate rate,c.pa_print print " +
+				" from purc$apcheck c  where c.PA_CHECKSTATUS='已确认' and c.PA_ENUU = ?";*/
+		String sql = "select i.pai_id id from purc$apcheck c,purc$apcheckItem i  where i.pai_paid=c.pa_id and i.PAI_CHECKQTY>0 and i.PAI_CHECKQTY>nvl(i.PAI_BILLED,0) and c.PA_CHECKSTATUS='已确认' and c.PA_ENUU = ?";
+		if (!org.apache.axis.utils.StringUtils.isEmpty(keyword)) {
+			// 物料名称和规格存在特殊符号,用|做分隔符
+			String[] strs = keyword.split("\\|");
+			if (strs.length == 1) {
+				sql = sql + " and PA_CUSTNAME = '" + strs[0] + "'";
+			}
+		}
+		if (fromDate != null) {
+			sql = sql + " and PA_BEGINDATE>=" + "to_date('" + new java.sql.Date(new Date(fromDate).getTime())
+					+ "','yyyy-mm-dd')";
+		}
+		if (endDate != null) {
+			sql = sql + " and PA_ENDDATE<=" + "to_date('" + new java.sql.Date(new Date(endDate).getTime())
+					+ "','yyyy-mm-dd')";
+		}
+		Object[] args = new Object[] { enUu };
+		if (!CollectionUtils.isEmpty(filter)) {
+			String[] str = new String[filter.size()];
+			Long[] lon = new Long[filter.size() + 1];
+			String s = "";
+			for (int i = 0; i < filter.size(); i++) {
+				if (i != filter.size() - 1) {
+					str[i] = "?,";
+				} else {
+					str[i] = "?";
+				}
+				lon[i + 1] = filter.get(i);
+				s = s + str[i];
+			}
+			sql = sql + " and PA_CUSTUU in (" + s + ")";
+			lon[0] = enUu;
+			args = lon;
+		}
+		sql = sql + " order by c.pa_apdate desc";
+		List<PurchaseApCheckItem> purchaseApCheckItems = commonDao.query(sql, args, PurchaseApCheckItem.class);
+		return purchaseApCheckItems;
+	}
+
+    @Override
+    public Double getBilledByItemId(Long id) {
+        return purchaseApCheckItemDao.getBilledById(id);
+    }
 }

+ 1302 - 0
src/main/java/com/uas/platform/b2b/service/impl/SOAPConsoleServiceImpl.java

@@ -0,0 +1,1302 @@
+package com.uas.platform.b2b.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2b.dao.PurchaseApBillOutDao;
+import com.uas.platform.b2b.dao.PurchaseApBillOutInfoDao;
+import com.uas.platform.b2b.model.*;
+import com.uas.platform.b2b.service.SOAPConsoleService;
+import com.uas.platform.b2b.support.SystemSession;
+import com.uas.platform.core.util.HttpUtil;
+
+import com.uas.sso.common.encrypt.base64.Base64;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.ui.ModelMap;
+import sun.misc.BASE64Decoder;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Field;
+import java.net.*;
+import java.text.DecimalFormat;
+import java.util.*;
+
+
+/**
+ * Created by 黄诚天 on 2017/7/10.
+ */
+@Service
+public class SOAPConsoleServiceImpl implements SOAPConsoleService {
+
+    @Autowired
+    PurchaseApBillOutDao purchaseApBillOutDao;
+
+    @Autowired
+    PurchaseApBillOutInfoDao purchaseApBillOutInfoDao;
+
+    DecimalFormat df = new DecimalFormat("#.00");
+
+    //获取每种发票的库存信息
+    @Override
+    public ModelMap getRepertoryMessage() {
+        ModelMap map = new ModelMap();
+        Integer InfoKind = 0; //发票类型; 0-专票  2-普票
+
+        int SID = SoapSIDType.GETREPERTORYMEAASGE.getValue();
+        JSONObject SIDParam = new JSONObject();
+        SIDParam.put("InfoKind",InfoKind);
+        JSONObject resultJo = getSOAPJson(SID, SIDParam);
+
+        if ("3011".equals(resultJo.getString("retcode"))) {
+            SoapRepertyMessage srm = JSONObject.parseObject(resultJo.toJSONString(),SoapRepertyMessage.class);
+            map.put("srm",srm);
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",resultJo.getString("error"));
+        } else {
+            map.put("error",resultJo.getString("retmsg"));
+        }
+
+        return map;
+    }
+
+    //发票开具
+    @Override
+    public ModelMap invoiceIssued(PurchaseApBillOut apBillOut) {
+        ModelMap map = new ModelMap();
+        StringBuilder errorMsg = new StringBuilder();
+
+        Integer invoiceType = 0;//专票
+        //获取购方开票信息
+        PurchaseApBillOutInfo customerApBillOutInfo = apBillOut.getCustomerApBillOutInfo();
+        String customerTaxNr = customerApBillOutInfo.getTaxNr();
+        //发票种类为普票时可以为空值,专票时为必填
+        if (invoiceType != 2 && customerTaxNr == null) {
+            map.put("error", errorMsg.append("获取不到购方税号"));
+        }
+
+        String customerName = customerApBillOutInfo.getEnName();
+        //普票时,若购方税号为空,则购方名称必填
+        if (invoiceType == 2 && customerTaxNr == null && customerName == null) {
+            map.put("error", errorMsg.append("获取不到购方名"));
+        }
+
+        String issuer = SystemSession.getUser().getUserName();
+        if (issuer == null) {
+            map.put("error", errorMsg.append("获取不到开票人信息"));
+        } else if (issuer.length() > 8) {
+            map.put("error", errorMsg.append("开票人名字不得超过八个字母或四个汉字"));
+        }
+
+        Boolean listed = false; //false:不开具清单 true:开具清单
+        if (listed == null) {
+            map.put("error", errorMsg.append("获取不到清单标志,系统无法判断是否开具清单"));
+
+        }
+
+        String customerAddressTel = customerApBillOutInfo.getAddress() + " " + customerApBillOutInfo.getTel();
+
+        //发票种类为普票时可以为空值,专票时为必填
+        if (invoiceType != 2 && customerAddressTel == null) {
+            map.put("error", errorMsg.append("获取不到购方地址电话"));
+        }
+
+        String customerBankAccountNr = customerApBillOutInfo.getBankAccountNr();
+        //发票种类为普票时可以为空值,专票时为必填
+        if (invoiceType != 2 && customerBankAccountNr == null) {
+            map.put("error", errorMsg.append("获取不到购方银行账户"));
+        }
+
+        //获取销方开票信息
+        PurchaseApBillOutInfo apBillOutInfo = apBillOut.getApBillOutInfo();
+        String sellerTaxNr = apBillOutInfo.getTaxNr();
+        String sellerBankAccountNr = apBillOutInfo.getBankAccountNr();
+        if (sellerBankAccountNr == null) {
+            sellerBankAccountNr = "";
+        }
+
+        String payee = apBillOutInfo.getPayee();
+        if (payee == null) {
+            map.put("error", errorMsg.append("获取不到收款人信息"));
+        } else if (payee.length() > 8) {
+            map.put("error", errorMsg.append("收款人名字不得超过八个字母或四个汉字"));
+        }
+
+        String checker = apBillOutInfo.getChecker();
+        if (checker == null) {
+            map.put("error", errorMsg.append("获取不到复核人信息"));
+        } else if (checker.length() > 8) {
+            map.put("error", errorMsg.append("复核人名字不得超过八个字母或四个汉字"));
+        }
+
+
+        String sellerAddressTel = apBillOutInfo.getAddress() + " " + apBillOutInfo.getTel();
+        if (sellerAddressTel == null) {
+            sellerAddressTel = "";
+        }
+
+        String documentNr = apBillOut.getCode();//TODO 数据来源  判断
+        if (documentNr == null) {
+            documentNr = "";
+        }
+
+        String memo = null;//TODO
+        if (memo == null) {
+            memo = "";
+        }
+
+        Integer CheckEWM = 0; //TODO
+
+
+        //获取明细信息
+        Set<PurchaseApBillOutItem> apBillOutItems = apBillOut.getItems();
+        PurchaseApBillOutItem[] items = new PurchaseApBillOutItem[apBillOutItems.size()];
+        apBillOutItems.toArray(items);
+        SoapInvoiceItem[] invoiceItems = new SoapInvoiceItem[apBillOutItems.size()];
+        for (int i = 0; i < items.length; i++) {
+            Product product = items[i].getProduct();
+            SoapInvoiceItem invoiceItem = new SoapInvoiceItem();
+
+            String productName = product.getTitle();
+            //productName = "测试商品";
+            if (productName == null) {
+                map.put("error", errorMsg.append("获取不到商品名称"));
+            } else {
+                invoiceItem.setProductName(productName);
+            }
+
+            Boolean includeTax = true;
+            if (includeTax == null) {
+                map.put("error", errorMsg.append("获取不到" + productName + "的含税标志"));
+            } else {
+                invoiceItem.setIncludeTax(includeTax);
+            }
+
+            Double taxRate = 0.17; //items[i].getTaxrate()/100
+            if (taxRate == null) {
+                map.put("error", errorMsg.append("获取不到" + productName + "的税率"));
+            } else {
+                invoiceItem.setTaxRate(taxRate);
+            }
+
+            Double value = items[i].getPrice() * items[i].getNowQty();
+            if (value == null) {
+                map.put("error", errorMsg.append("获取不到" + productName + "的金额"));
+            } else {
+                invoiceItem.setValue(Double.parseDouble(df.format(value)));
+            }
+            Double tax = (value*taxRate)/1.17;
+            if (tax == null) {
+                map.put("error", errorMsg.append("获取不到" + productName + "的税额"));
+            } else {
+                invoiceItem.setTax(Double.parseDouble(df.format(tax)));
+            }
+
+            String GoodsNoVer = product.getGoodsnover();
+            GoodsNoVer = "13.0";
+            if (GoodsNoVer == null) {
+                map.put("error", errorMsg.append("获取不到" + productName + "编码版本号"));
+            } else {
+                invoiceItem.setGoodsNoVer(GoodsNoVer);
+            }
+
+            String GoodsTaxNo = product.getGoodstaxno();
+            GoodsTaxNo = "109051303"; //1080413020000000000 //1090513030000000000
+            if (GoodsTaxNo == null) {
+                map.put("error", errorMsg.append("获取不到" + productName + "的税收分类编码"));
+            } else {
+                invoiceItem.setGoodsTaxNo(GoodsTaxNo);
+            }
+
+            String TaxPre = product.getTaxpre();
+            TaxPre = "0";
+            if (TaxPre == null) {
+                map.put("error", errorMsg.append("获取不到" + productName + "的是否享受优惠政策"));
+            } else {
+                invoiceItem.setTaxPre(TaxPre);
+            }
+
+            Double price = items[i].getPrice();//不能从产品库中获取单价
+            Double quantity = items[i].getNowQty();
+            //数量和单价要一起传或者一起不传,不能只传其中一个
+            if (price != null && quantity != null) {
+                invoiceItem.setPrice(price);
+                invoiceItem.setQuantity(quantity);
+            } else {
+                map.put("error", errorMsg.append("明细" + productName + "的单价或数量缺失"));
+            }
+
+            String productUnit = product.getUnit();
+            if (productUnit == null) {
+                productUnit = "";
+            }
+            invoiceItem.setProductUnit(productUnit);
+
+            String productSpec = product.getSpec();
+            if (productSpec == null) {
+                productSpec = "";
+            }
+            invoiceItem.setProductSpec(productSpec);
+
+            String TaxPreCon = product.getTaxprecon();
+            if (TaxPreCon == null) {
+                TaxPreCon = "";
+            }
+            invoiceItem.setTaxPreCon(TaxPreCon);
+
+            String ZeroTax = null; //TODO
+            if (ZeroTax == null) {
+                ZeroTax = "";
+            }
+            invoiceItem.setZeroTax(ZeroTax);
+
+            String CropGoodsNo = null; //TODO
+            if (CropGoodsNo == null) {
+                CropGoodsNo = "";
+            }
+            invoiceItem.setCropGoodsNo(CropGoodsNo);
+
+            //TaxDeduction 差额税使用,非差额税可以为空
+            String TaxDeduction = null; //TODO
+            if (TaxDeduction == null) {
+                TaxDeduction = "";
+            }
+            invoiceItem.setTaxDeduction(TaxDeduction);
+
+            invoiceItems[i] = invoiceItem;
+        }
+
+        int SID = SoapSIDType.INVOICEISSUED.getValue();
+        JSONObject SIDParam = new JSONObject(16,true);
+
+        SIDParam.put("invoiceType",invoiceType);
+        SIDParam.put("customerName",customerName);
+        SIDParam.put("customerTaxNr",customerTaxNr );
+        SIDParam.put("customerAddressTel",customerAddressTel);
+        SIDParam.put("customerBankAccountNr",customerBankAccountNr);
+        SIDParam.put("sellerBankAccountNr",sellerBankAccountNr);
+        SIDParam.put("sellerAddressTel",sellerAddressTel);
+        SIDParam.put("invoiceItems",invoiceItems);
+        SIDParam.put("documentNr",documentNr);
+        SIDParam.put("payee",payee);
+        SIDParam.put("checker",checker);
+        SIDParam.put("listed",listed);
+        SIDParam.put("issuer",issuer);
+        SIDParam.put("memo",memo);
+        SIDParam.put("CheckEWM",CheckEWM);
+
+        /*InvoiceParam invoiceParam = new InvoiceParam();
+        invoiceParam.setInvoiceType(invoiceType);
+        invoiceParam.setCustomerName(customerName);
+        invoiceParam.setCustomerTaxNr(customerTaxNr);
+        invoiceParam.setCustomerAddressTel(customerAddressTel);
+        invoiceParam.setCustomerBankAccountNr(customerBankAccountNr);
+        invoiceParam.setSellerBankAccountNr(sellerBankAccountNr);
+        invoiceParam.setSellerAddressTel(sellerAddressTel);
+        invoiceParam.setInvoiceItems(Arrays.asList(invoiceItems));
+        invoiceParam.setDocumentNr(documentNr);
+        invoiceParam.setPayee(payee);
+        invoiceParam.setChecker(checker);
+        invoiceParam.setListed(listed);
+        invoiceParam.setIssuer(issuer);
+        invoiceParam.setMemo(memo);
+        invoiceParam.setCheckEWM(CheckEWM);
+
+        String hehe = JsonUtil2.parse(invoiceParam);*/
+
+        /*SIDParam.put("sellerTaxNr",sellerTaxNr);
+        SIDParam.put("kpdh",kpdh);
+        SIDParam.put("kpfwqh",kpfwqh);*/
+
+        if (map.size() > 0) {
+            return map;
+        }
+
+        JSONObject resultJo = getSOAPJson(SID, SIDParam);
+        if ("4011".equals(resultJo.getString("retcode"))) {
+            apBillOut.setRetmsg(resultJo.getString("retmsg"));
+            apBillOut.setInfoAmount(resultJo.getDouble("InfoAmount"));
+            apBillOut.setInfoTaxAmount(resultJo.getDouble("InfoTaxAmount"));
+            apBillOut.setInfoDate(resultJo.getString("InfoDate"));
+            apBillOut.setInfoTypeCode(resultJo.getString("InfoTypeCode"));
+            apBillOut.setInfoNumber(resultJo.getString("InfoNumber"));
+            apBillOut.setHisInfoTypeCode(resultJo.getString("hisInfoTypeCode"));
+            apBillOut.setHisInfoNumber(resultJo.getString("hisInfoNumber"));
+            apBillOut.setHisInfoKind(resultJo.getString("hisInfoKind"));
+            apBillOut.setListFlag(resultJo.getInteger("ListFlag"));
+            apBillOut.setNsrsbh(resultJo.getString("nsrsbh"));
+            apBillOut.setKpdh(resultJo.getString("kpdh"));
+            apBillOut.setKpfwqh(resultJo.getString("kpfwqh"));
+            //修改开票单状态
+            apBillOut.setCheckStatus("已开票");
+
+            try {
+                purchaseApBillOutDao.save(apBillOut);
+            } catch (Exception e) {
+                map.put("dbError","开具发票成功,但过程中数据库更新开票单失败,需要人工紧急处理,作废此开票单据");
+            }
+
+            map.put("apBillOut",apBillOut);
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",errorMsg.append(resultJo.getString("error")));
+        } else {
+            map.put("resultJo",resultJo);
+            //map.put("error","发票开具失败");
+            map.put("error",errorMsg.append(resultJo.getString("retmsg")));
+        }
+
+        String s = SIDParam.toString();
+
+        map.put("SIDParam",SIDParam.toJSONString());
+        return map;
+    }
+
+    //发票打印
+    @Override
+    public ModelMap invoicePrint(PurchaseApBillOut apBillOut, Integer PrintKind) {
+        ModelMap map = new ModelMap();
+        StringBuilder errorMsg = new StringBuilder();
+        Integer InfoKind = 0;//发票种类
+
+        String InfoNumber = apBillOut.getInfoNumber();
+        if (InfoNumber == null) {
+            map.put("error",errorMsg.append("获取发票号码失败"));
+        }
+
+        String InfoTypeCode = apBillOut.getInfoTypeCode();
+        if (InfoTypeCode == null) {
+            map.put("error",errorMsg.append("获取发票代码失败"));
+        }
+
+        //可为空,0:打印发票  1:打印清单(与SID=3效果一样)
+        if (PrintKind != null && PrintKind != 0 && PrintKind != 1) {
+            map.put("error",errorMsg.append("打印类型错误"));
+        }
+
+        if (map.size() > 0) {
+            return map;
+        }
+
+        int SID = SoapSIDType.INVOICEPRINT.getValue();
+        JSONObject SIDParam = new JSONObject(true);
+        if (InfoKind == null) {
+            SIDParam.put("InfoKind", "");
+        } else {
+            SIDParam.put("InfoKind", InfoKind);
+        }
+
+        SIDParam.put("InfoNumber", InfoNumber);
+        SIDParam.put("InfoTypeCode", InfoTypeCode);
+        SIDParam.put("PrintKind", PrintKind);
+
+        Integer ShowPrintDlg = 1;//可为空,固定值0:不弹出参数设置窗口1:弹出参数设置窗口
+        if (ShowPrintDlg == null) {
+            SIDParam.put("ShowPrintDlg", "");
+        } else {
+            SIDParam.put("ShowPrintDlg", ShowPrintDlg);
+        }
+
+        JSONObject resultJo = getSOAPJson(SID, SIDParam);
+        if ("5011".equals(resultJo.getString("retcode"))) {
+            map.put("retmsg",resultJo.getString("retmsg"));
+
+            //添加打印次数
+            apBillOut.setPrint((short) ((apBillOut.getPrint() == null ? 0 : apBillOut.getPrint()) + 1));
+
+            try {
+                purchaseApBillOutDao.save(apBillOut);
+            } catch (Exception e) {
+                map.put("dbError","发票打印成功,但过程中数据库更新开票单打印次数失败,需要人工处理干预");
+            }
+
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",errorMsg.append(resultJo.getString("error")));
+        } else {
+            map.put("resultJo",resultJo);
+            //map.put("error","发票打印失败");
+            map.put("error",errorMsg.append(resultJo.getString("retmsg")));
+        }
+
+        return map;
+    }
+
+    //清单打印  (需发票中有清单(开票是可以选择是否开具清单))
+    @Override
+    public ModelMap listPrint(PurchaseApBillOut apBillOut) {
+        ModelMap map = new ModelMap();
+        StringBuilder errorMsg = new StringBuilder();
+        Integer InfoKind = 0;//发票种类
+
+        String InfoNumber = apBillOut.getInfoNumber();
+        if (InfoNumber == null) {
+            map.put("error",errorMsg.append("获取发票号码失败"));
+        }
+
+        String InfoTypeCode = apBillOut.getInfoTypeCode();
+        if (InfoTypeCode == null) {
+            map.put("error",errorMsg.append("获取发票代码失败"));
+        }
+
+        Integer ShowPrintDlg = 1;//可为空,固定值0:不弹出参数设置窗口1:弹出参数设置窗口
+
+        if (map.size() > 0) {
+            return map;
+        }
+
+        int SID = SoapSIDType.LISTPRINT.getValue();
+        JSONObject SIDParam = new JSONObject(true);
+        if (InfoKind == null) {
+            SIDParam.put("InfoKind", "");
+        } else {
+            SIDParam.put("InfoKind", InfoKind);
+        }
+        SIDParam.put("InfoNumber", InfoNumber);
+        SIDParam.put("InfoTypeCode", InfoTypeCode);
+        if (ShowPrintDlg == null) {
+            SIDParam.put("ShowPrintDlg", "");
+        } else {
+            SIDParam.put("ShowPrintDlg", ShowPrintDlg);
+        }
+
+        JSONObject resultJo = getSOAPJson(SID, SIDParam);
+        if ("5011".equals(resultJo.getString("retcode"))) {
+            map.put("retmsg",resultJo.getString("retmsg"));
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",errorMsg.append(resultJo.getString("error")));
+        } else {
+            //map.put("error","清单打印失败");
+            map.put("error",errorMsg.append(resultJo.getString("retmsg")));
+        }
+
+        return map;
+    }
+
+    //发票作废
+    @Override
+    public ModelMap InvoiceCancel(PurchaseApBillOut apBillOut) {
+        ModelMap map = new ModelMap();
+        StringBuilder errorMsg = new StringBuilder();
+        Integer InfoKind = 0;//发票种类
+        String InfoNumber = apBillOut.getInfoNumber();
+        if (InfoNumber == null) {
+            map.put("error",errorMsg.append("获取发票号码失败"));
+        }
+
+        String InfoTypeCode = apBillOut.getInfoTypeCode();
+        if (InfoTypeCode == null) {
+            map.put("error",errorMsg.append("获取发票代码失败"));
+        }
+
+        if (map.size() > 0) {
+            return map;
+        }
+
+
+        int SID = SoapSIDType.INVOICECANCEL.getValue();
+        JSONObject SIDParam = new JSONObject();
+        if (InfoKind == null) {
+            SIDParam.put("InfoKind", "");
+        } else {
+            SIDParam.put("InfoKind", InfoKind);
+        }
+        SIDParam.put("InfoNumber", InfoNumber);
+        SIDParam.put("InfoTypeCode", InfoTypeCode);
+        JSONObject resultJo = getSOAPJson(SID, SIDParam);
+
+        if ("6011".equals(resultJo.getString("retcode"))) {
+            System.out.print(resultJo.toJSONString());
+            map.put("retmsg",resultJo.getString("retmsg"));
+            map.put("retcode",resultJo.getString("retcode"));
+            //修改开票单状态
+            apBillOut.setCheckStatus("已作废");
+            apBillOut.setRetmsg(resultJo.getString("retmsg"));
+
+            try {
+                purchaseApBillOutDao.save(apBillOut);
+            } catch (Exception e) {
+                map.put("dbError","发票作废成功,但过程中数据库更新开票单失败,需要人工处理干预");
+            }
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",errorMsg.append(resultJo.getString("error")));
+        } else {
+            //map.put("error","发票作废失败");
+            map.put("error",errorMsg.append(resultJo.getString("retmsg")));
+        }
+
+        return map;
+    }
+
+    //查询发票信息  //ToDO 批量查询发票
+    @Override
+    public ModelMap queryInvoiceMessage(PurchaseApBillOut apBillOut, Integer mqdbz, Integer mdybz) {
+        ModelMap map = new ModelMap();
+        StringBuilder errorMsg = new StringBuilder();
+        Boolean flag = true;  //默认true为查询发票信息,false为批量发票查询
+
+        Integer fpzl = 0;//发票种类 0:专票2:普票
+        String xsdh = null;//销售单号  //TODO 是否必填
+        String gfmc = null;
+        String gfsh = null;
+        String kpjh = null;//开票机号  //TODO
+        String xfmc = null;//销方名称
+        String xfsh = null;//销方税号
+        String fpdm = null;//发票代码
+        String fphm = null;//发票号码
+        Integer zfbz = 0;//作废标志  //TODO(0未作废 1已作废)
+        Integer qdbz = mqdbz;//清单标志 默认0//TODO(0:非清单发票 1:清单发票)
+        //以下为非必填项
+        String kpdh = null; //TODO 对方说暂留
+        Integer dybz = mdybz;//打印标志  //TODO(1已打印 0未打印)
+        Integer bsbz = 0;//报税标志  //TODO
+        Integer RecNo = null; //TODO 对方说暂留
+        String BeginDate = null; //"2017-07-01";//开始日期yyyy-MM-dd//TODO
+        String EndDate = null; //"2017-08--30";//截至日期yyyy-MM-dd//TODO
+        //下面分页可根据需要传
+        Integer PageSize = null;//分页大小:一次查询返回的最大记录数//TODO
+        Integer PageIndex = null;//当前页序号,第一页为1
+
+        if (apBillOut != null) {
+            xsdh= apBillOut.getCode();
+            kpjh = apBillOut.getKpdh();
+            fpdm= apBillOut.getInfoTypeCode();
+            fphm = apBillOut.getInfoNumber();
+
+            PurchaseApBillOutInfo custApBillOutInfo = apBillOut.getCustomerApBillOutInfo();
+            if (custApBillOutInfo == null) {
+                map.put("error",errorMsg.append("获取购方企业开票信息失败"));
+            } else {
+                gfmc= custApBillOutInfo.getEnName();//购方名称
+                if (gfmc == null) {
+                    map.put("error",errorMsg.append("获取购方企业名称失败"));
+                }
+
+                gfsh= custApBillOutInfo.getTaxNr();//购方税号
+                if (gfsh == null) {
+                    map.put("error",errorMsg.append("获取购方企业税号失败"));
+                }
+            }
+
+            PurchaseApBillOutInfo apBillOutInfo = apBillOut.getApBillOutInfo();
+            if (apBillOutInfo == null) {
+                map.put("error",errorMsg.append("获取购方企业信息失败"));
+            } else {
+                xfmc= apBillOutInfo.getEnName();
+                if (xfmc == null) {
+                    map.put("error",errorMsg.append("获取销方企业名称失败"));
+                }
+
+                xfsh= apBillOutInfo.getTaxNr();
+                if (xfsh == null) {
+                    map.put("error",errorMsg.append("获取销方企业税号失败"));
+                }
+            }
+        }
+
+        if (xsdh == null) {
+            map.put("error",errorMsg.append("获取销售单号失败"));
+        }
+        if (fpdm == null) {
+            map.put("error",errorMsg.append("获取发票代码失败"));
+        }
+        if (fphm == null) {
+            map.put("error",errorMsg.append("获取发票号码失败"));
+        }
+        if (kpjh == null) {
+            map.put("error",errorMsg.append("获取开票机号失败"));
+        }
+        if (zfbz == null) {
+            map.put("error",errorMsg.append("获取作废标志失败"));
+        }
+        if (qdbz == null) {
+            map.put("error",errorMsg.append("获取清单标志失败"));
+        }
+
+        //批量查询发票 kpdh RecNo
+        if (xsdh == null && gfmc == null && gfsh == null &&
+            kpjh == null && xfmc == null && xfsh == null &&
+            fpdm == null && fphm == null && zfbz == null &&
+            qdbz == null && dybz == null && bsbz == null &&
+            fpzl != null && BeginDate != null && EndDate != null) {
+
+            map.clear();
+            flag = false;
+            //TODO 置""?
+
+        } else {
+            if (map.size() > 0) {
+                return map;
+            }
+        }
+
+        //非必填项
+        if (kpdh == null && flag) {
+            kpdh = "";
+        }
+        if (BeginDate == null && flag) {
+            BeginDate = "";
+        }
+        if (EndDate == null && flag) {
+            EndDate = "";
+        }
+
+
+        int SID = SoapSIDType.QUERYINVOICEMESSAGE.getValue();
+        JSONObject SIDParam = new JSONObject(true);
+        if (fpzl == null && flag) {
+            SIDParam.put("fpzl", "");
+        } else {
+            SIDParam.put("fpzl", fpzl);
+        }
+
+        SIDParam.put("xsdh", xsdh);
+        SIDParam.put("gfmc", gfmc);
+        SIDParam.put("gfsh", gfsh);
+        SIDParam.put("kpjh", kpjh);
+        SIDParam.put("xfmc", xfmc);
+        SIDParam.put("xfsh", xfsh);
+        SIDParam.put("fpdm", fpdm);
+        SIDParam.put("fphm", fphm);
+        SIDParam.put("kpdh", kpdh);
+        SIDParam.put("zfbz", zfbz);
+        SIDParam.put("qdbz", qdbz);
+
+        if (dybz == null && flag) {
+            SIDParam.put("dybz", "");
+        } else {
+            SIDParam.put("dybz", dybz);
+        }
+        if (bsbz == null && flag) {
+            SIDParam.put("bsbz", "");
+        } else {
+            SIDParam.put("bsbz", bsbz);
+        }
+        if (RecNo == null && flag) {
+            SIDParam.put("RecNo", "");
+        } else {
+            SIDParam.put("RecNo", RecNo);
+        }
+
+        SIDParam.put("BeginDate", BeginDate);
+        SIDParam.put("EndDate", EndDate);
+
+        if (PageSize == null && flag) {
+            SIDParam.put("PageSize", "");
+        } else {
+            SIDParam.put("PageSize", PageSize);
+        }
+        if (PageIndex == null && flag) {
+            SIDParam.put("PageIndex", "");
+        } else {
+            SIDParam.put("PageIndex", PageIndex);
+        }
+
+        JSONObject resultJo = getSOAPJson(SID, SIDParam);
+
+        if ("0".equals(resultJo.getString("retcode"))) {
+            SoapQueryInvoiceMessage sqim = JSONObject.parseObject(resultJo.toJSONString(), SoapQueryInvoiceMessage.class);
+            map.put("sqim",sqim);
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",errorMsg.append(resultJo.getString("error")));
+        } else {
+            //map.put("error","查询发票失败");
+            map.put("error",errorMsg.append(resultJo.getString("retmsg")));
+        }
+
+        return map;
+    }
+
+    //查询库存信息 //TODO SoapQueryRepertyMessage字段类型Integet改为了String
+    @Override
+    public ModelMap queryRepertyMessage() {
+        ModelMap map = new ModelMap();
+        int SID = SoapSIDType.QUERYREPERTORYMEAASGE.getValue();
+        JSONObject resultJo = getSOAPJson(SID, null);
+
+        if ("0".equals(resultJo.getString("retcode"))) {
+            SoapQueryRepertyMessage sqrm = JSONObject.parseObject(resultJo.toJSONString(), SoapQueryRepertyMessage.class);
+            map.put("sqrm",sqrm);
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",resultJo.getString("error"));
+        } else {
+            //map.put("error","查询库存信息失败");
+            map.put("error",resultJo.getString("retmsg"));
+        }
+
+        return map;
+    }
+
+    //查询下一发票机库存信息  //TODO SoapQueryNextRepertyMessage Integer
+    @Override
+    public ModelMap queryNextRepertyMessage() {
+        ModelMap map = new ModelMap();
+        int SID = SoapSIDType.QUERYNEXTREPERTORYMEAASGE.getValue();
+        JSONObject resultJo = getSOAPJson(SID, null);
+
+        if ("1011".equals(resultJo.getString("retcode"))) {
+            SoapQueryNextRepertyMessage sqnrm = JSONObject.parseObject(resultJo.toJSONString(), SoapQueryNextRepertyMessage.class);
+            map.put("sqnrm",sqnrm);
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",resultJo.getString("error"));
+        } else {
+            //map.put("error","查询下一发票机库存信息失败");
+            map.put("error",resultJo.getString("retmsg"));
+        }
+
+        return map;
+    }
+
+    //启动开票服务
+    @Override
+    public ModelMap startBillOut() {
+        ModelMap map = new ModelMap();
+        int SID = SoapSIDType.STARTBILLOUT.getValue();
+        JSONObject resultJo = getSOAPJson(SID, null);
+
+        if ("1011".equals(resultJo.getString("retcode"))) {
+            SoapStartBillOut ssbo = JSONObject.parseObject(resultJo.toJSONString(), SoapStartBillOut.class);//TODO PtVer
+            map.put("ssbo",ssbo);
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",resultJo.getString("error"));
+        } else {
+            //map.put("error","启动开票服务信息失败");
+            map.put("error",resultJo.getString("retmsg"));
+        }
+
+        return map;
+    }
+
+    //关闭开票服务
+    @Override
+    public ModelMap closeBillOut() {
+        ModelMap map = new ModelMap();
+        int SID = SoapSIDType.CLOSEBILLOUT.getValue();
+        JSONObject resultJo = getSOAPJson(SID, null);
+
+        if ("0".equals(resultJo.getString("retcode"))) {
+            map.put("retmsg",resultJo.getString("retmsg"));
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",resultJo.getString("error"));
+        } else {
+            //map.put("error","关闭开票服务信息失败");
+            map.put("error",resultJo.getString("retmsg"));
+        }
+
+        return map;
+    }
+
+    //发票上传  //TODO
+    @Override
+    public ModelMap invoiceUpload(PurchaseApBillOut apBillOut) {
+        ModelMap map = new ModelMap();
+        StringBuilder errorMsg = new StringBuilder();
+        //TODO 获取属性值
+        String fpdm = apBillOut.getInfoTypeCode();//上传的发票代码
+        if (fpdm == null) {
+            map.put("error",errorMsg.append("获取上传的发票代码失败"));
+        }
+
+        String fphm = apBillOut.getInfoNumber();//上传的发票号码
+        if (fphm == null) {
+            map.put("error",errorMsg.append("获取上传的发票号码失败"));
+        }
+
+        if (map.size() > 0) {
+            return map;
+        }
+
+        int SID = SoapSIDType.INVOICEUPLOAD.getValue();
+        JSONObject SIDParam = new JSONObject(true);
+        SIDParam.put("fpdm", fpdm);
+        SIDParam.put("fphm", fphm);
+
+        JSONObject resultJo = getSOAPJson(SID, SIDParam);
+
+        if ("0".equals(resultJo.getString("retcode"))) {
+            map.put("retmsg",resultJo.getString("retmsg"));
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",errorMsg.append(resultJo.getString("error")));
+        } else  {
+            //map.put("error","发票上传失败");
+            map.put("error",errorMsg.append(resultJo.getString("retmsg")));
+        }
+        return map;
+    }
+
+    //发票状态更新  //TODO 需先上传发票
+    @Override
+    public ModelMap invoiceStatusUpdate() {
+        ModelMap map = new ModelMap();
+        int SID = SoapSIDType.INVOICESTATUSUPDATE.getValue();
+        JSONObject resultJo = getSOAPJson(SID, null);
+
+        if ("8050".equals(resultJo.getString("retcode"))) {
+            SoapInvoiceStatusUpdate sisu = JSONObject.parseObject(resultJo.toJSONString(), SoapInvoiceStatusUpdate.class);
+            map.put("sisu",sisu);
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",resultJo.getString("error"));
+        } else {
+            //map.put("error","发票状态更新失败");
+            map.put("error",resultJo.getString("retmsg"));
+        }
+
+        return map;
+    }
+
+    //单张发票查询
+    @Override
+    public ModelMap singleInvoiceQuery(PurchaseApBillOut apBillOut) {
+        ModelMap map = new ModelMap();
+        StringBuilder errorMsg = new StringBuilder();
+        //注意:xsdbh与fpzl、fpdm、fphm是互斥条件,传销售单号就不按照fpzl,fpdm,fphm来查询
+        Integer fpzl = 0;//发票种类 0专票,2普票,11货运发票,12机动车发票,51电子发票  //TODO
+        String fpdm = apBillOut.getInfoTypeCode();//发票代码 10位
+        if (fpdm == null) {
+            fpdm = "";
+        }
+
+        String fphm = apBillOut.getInfoNumber();//发票号码8位
+        if (fphm == null) {
+            fphm = "";
+        }
+
+        //以下为非必填项
+        String xsdbh = null; //apBillOut.getCode();//销售单编号
+        if (xsdbh == null) {
+            xsdbh = "";
+        }
+
+        if (!((fpzl != null && !"".equals(fpdm) && !"".equals(fphm)) ^ (!"".equals(xsdbh)))) {
+            if (fpzl == null) {
+                map.put("error",errorMsg.append("获取发票种类失败"));
+            }
+            if ("".equals(fpdm)) {
+                map.put("error",errorMsg.append("获取发票代码失败"));
+            }
+            if ("".equals(fphm)) {
+                map.put("error",errorMsg.append("获取发票号码失败"));
+            }
+            if ("".equals(xsdbh)) {
+                map.put("error",errorMsg.append("获取销售单编号失败"));
+            }
+            map.put("error",errorMsg.append("销售单编号与发票种类、发票代码、发票号码是互斥条件"));
+        }
+
+        if (map.size() > 0) {
+            return map;
+        }
+
+        int SID = SoapSIDType.SINGLEINVOICEQUERY.getValue();
+        JSONObject SIDParam = new JSONObject(true);
+        SIDParam.put("xsdbh", xsdbh);
+        SIDParam.put("fpzl", fpzl);
+        SIDParam.put("fpdm", fpdm);
+        SIDParam.put("fphm", fphm);
+
+        JSONObject resultJo = getSOAPJson(SID, SIDParam);
+
+        if ("0".equals(resultJo.getString("retcode"))) {
+            SoapSingleInvoiceQuery ssiq = JSONObject.parseObject(resultJo.toJSONString(), SoapSingleInvoiceQuery.class);
+            map.put("ssiq", ssiq);
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",errorMsg.append(resultJo.getString("error")));
+        } else {
+            //map.put("error","单张发票查询失败");
+            map.put("error",errorMsg.append(resultJo.getString("retmsg")));
+        }
+
+        return map;
+    }
+
+
+
+    //TODO 批处理接口 SID=20
+
+    //机动车发票填开
+    @Override
+    public SoapMotorInvoiceIssued motorInvoiceIssued(String json) {
+        String documentNr = "";//单据号
+        Integer CheckEWM = 0;//开票标志 0:开票 1:校验 2:空白作废
+        Integer infoKind = 12;//发票种类 12 为机动车 //TODO ?
+        String Jdckind = "1";//1 旧机动车,2新机动车
+        String infoClientName = "";//购货单位
+        String idCard = "";//身份证号、组织机构代码
+        String vehicleKind = "";//车辆类型
+        String brandModel = "";//厂牌型号
+        String originPlace = "";//产地
+        String vehicleNo = "";//车辆识别代号、车辆号码
+        //String documentNr = "";//销售单号  //TODO ?
+        String infoInvoicer = "";//开票人
+        Double amountTaxTotal = 0.0;//价税合计
+        Integer infoTaxRate = 0;//11标识11%
+
+        //以下为非必填项
+        String sellerTaxNr = null;//销方税号(可为空)
+        Integer kpdh = null;//开票点号(可为空)
+        Integer kpfwqh = 0;//开票服务器号
+        //以上信息传入则会比较是否一致,不一致就不能开票
+        String infoClientTaxCode = "";//新机动车纳税人识别号
+        String qualityCertificate = "";//合格证号
+        String impCertificateNo = "";//进口证明文书号
+        String commInspectionNo = "";//商标单号(商检单号)
+        String enginNo = "";//发动机号
+        String manufacturerName = "";//生产厂家名称
+        String sellerPhone = "";//销货单位电话
+        String sellerAccount = "";//销货单位账号
+        String sellerAddress = "";//地址
+        String sellerBank = "";//开户行
+        String tonnage = "";//吨位
+        String peopleNo = "";//限乘人数
+        String infoNotes = "";//备注
+        String GoodsNoVer = "";//税收分类编码版本号
+        String GoodsTaxNo = "";//税收分类编码
+        String TaxPre = "";//是否享受优惠政策
+        String TaxPreCon = "";//优惠正常内容(可不传)
+        String ZeroTax = "";//零税率标识(可不传)
+        String CropGoodsNo = "";//企业自编码(可不传)
+
+        JSONObject jo = JSON.parseObject(json);
+        //TODO 获取属性值
+
+        int SID = SoapSIDType.MOTORINVOICEISSUED.getValue();
+        JSONObject SIDParam = new JSONObject();
+        SIDParam.put("sellerTaxNr", sellerTaxNr);
+        SIDParam.put("kpdh", kpdh);
+        SIDParam.put("kpfwqh", kpfwqh);
+        SIDParam.put("documentNr", documentNr);
+        SIDParam.put("CheckEWM", CheckEWM);
+        SIDParam.put("infoKind", infoKind);
+        SIDParam.put("Jdckind", Jdckind);
+        SIDParam.put("infoClientName", infoClientName);
+        SIDParam.put("infoClientTaxCode", infoClientTaxCode);
+        SIDParam.put("idCard", idCard);
+        SIDParam.put("vehicleKind", vehicleKind);
+        SIDParam.put("brandModel", brandModel);
+        SIDParam.put("originPlace", originPlace);
+        SIDParam.put("qualityCertificate", qualityCertificate);
+        SIDParam.put("impCertificateNo", impCertificateNo);
+        SIDParam.put("commInspectionNo", commInspectionNo);
+        SIDParam.put("enginNo", enginNo);
+        SIDParam.put("vehicleNo", vehicleNo);
+        SIDParam.put("manufacturerName", manufacturerName);
+        SIDParam.put("infoInvoicer", infoInvoicer);
+        SIDParam.put("amountTaxTotal", amountTaxTotal);
+        SIDParam.put("sellerPhone", sellerPhone);
+        SIDParam.put("sellerAccount", sellerAccount);
+        SIDParam.put("sellerAddress", sellerAddress);
+        SIDParam.put("sellerBank", sellerBank);
+        SIDParam.put("infoTaxRate", infoTaxRate);
+        SIDParam.put("tonnage", tonnage);
+        SIDParam.put("peopleNo", peopleNo);
+        SIDParam.put("infoNotes", infoNotes);
+        SIDParam.put("GoodsNoVer", GoodsNoVer);
+        SIDParam.put("GoodsTaxNo", GoodsTaxNo);
+        SIDParam.put("TaxPre", TaxPre);
+        SIDParam.put("TaxPreCon", TaxPreCon);
+        SIDParam.put("ZeroTax", ZeroTax);
+        SIDParam.put("CropGoodsNo", CropGoodsNo);
+
+        JSONObject resultJo = getSOAPJson(SID, SIDParam);
+        SoapMotorInvoiceIssued smii = JSON.toJavaObject(resultJo, SoapMotorInvoiceIssued.class);
+        return smii;
+    }
+
+
+    //机动车发票查询
+    @Override
+    public SoapMotorInvoiceQuery motorInvoiceQuery(String json) {
+        String xsdh = "";//销售单号 //TODO 是否必填
+        String gfmc = "";//购方名称
+        String xfmc = "";//销方名称
+        String xfsh = "";//销方税号
+        String fpdm = "";//发票代码
+        String fphm = "";//发票号码
+        Integer kpjh = 0;//开票机号
+        Integer zfbz = 0;//作废标志
+        Integer qdbz = 0;//清单标志
+        Integer dybz = 0;//打印标志
+
+        //以下为非必填项
+        String gfsh = "";//购方税号
+        Integer bsbz = 0;//报税标志
+        String BeginDate = "";//开始日期yyyy-MM-dd
+        String EndDate = "";//截至日期yyyy-MM-dd
+        //下面分页可根据需要传
+        Integer PageSize = 0;//分页大小:一次查询返回的最大记录数
+        Integer PageIndex = 1;//当前页序号,第一页为1
+
+        JSONObject jo = JSON.parseObject(json);
+        //TODO 获取属性值
+
+        int SID = SoapSIDType.MOTORINVOICEQUERY.getValue();
+        JSONObject SIDParam = new JSONObject();
+        SIDParam.put("xsdh", xsdh);
+        SIDParam.put("gfmc", gfmc);
+        SIDParam.put("gfsh", gfsh);
+        SIDParam.put("xfmc", xfmc);
+        SIDParam.put("xfsh", xfsh);
+        SIDParam.put("fpdm", fpdm);
+        SIDParam.put("fphm", fphm);
+        SIDParam.put("kpjh", kpjh);
+        SIDParam.put("zfbz", zfbz);
+        SIDParam.put("qdbz", qdbz);
+        SIDParam.put("dybz", dybz);
+        SIDParam.put("bsbz", bsbz);
+        SIDParam.put("BeginDate", BeginDate);
+        SIDParam.put("EndDate", EndDate);
+        SIDParam.put("PageSize", PageSize);
+        SIDParam.put("PageIndex", PageIndex);
+
+        JSONObject resultJo = getSOAPJson(SID, SIDParam);
+        SoapMotorInvoiceQuery smiq = JSON.toJavaObject(resultJo, SoapMotorInvoiceQuery.class);
+        return smiq;
+    }
+
+    //金税设备查询 SID=25
+    @Override
+    public ModelMap taxEquipmentQuery() {
+        ModelMap map = new ModelMap();
+
+        int SID = SoapSIDType.TAXEQUIPMENTQUERY.getValue();
+        JSONObject SIDParam = new JSONObject();
+        String str = "<?xml version=\"1.0\" encoding=\"GBK\"?><FPXT_COM_INPUT><ID>0400</ID><DATA></DATA></FPXT_COM_INPUT>";
+        SIDParam.put("SIDParam", str);
+
+        JSONObject resultJo = getSOAPJson(SID, SIDParam);
+
+        if ("0".equals(resultJo.getString("retcode"))) {
+            map.put("resultJo",resultJo);
+
+            //单纯想查看responseMsg解析后的内容
+            String responseMsg = resultJo.getString("responseMsg");
+            responseMsg = responseMsg.split("<DATA>")[1].split("</DATA>")[0];
+            responseMsg = getFromBase64(responseMsg);
+            map.put("responseMsg",responseMsg);
+
+        } else if (resultJo.getString("error") != null) {
+            map.put("error",resultJo.getString("error"));
+        } else {
+            //map.put("error","查询金税设备失败");
+            map.put("error",resultJo.getString("retmsg"));
+        }
+
+        return map;
+    }
+
+    private JSONObject getSOAPJson(int SID, JSONObject SIDParam) {
+
+        //获取当前企业
+        Long enUu = SystemSession.getUser().getEnterprise().getUu();
+        String ipAndPort = purchaseApBillOutInfoDao.findByUu(enUu).getIp();
+        String[] ipAndPortArr = ipAndPort.split(":");
+        String ip = ipAndPortArr[0].trim();
+        String port = "8888";//默认端口号
+        if (ipAndPortArr.length == 2 && !"".equals(ipAndPortArr[1].trim()))
+        {
+            port = ipAndPortArr[1].trim();
+        }
+
+        JSONObject resultJo = new JSONObject();
+        String param = null;
+        if (SIDParam != null) {
+            String SIDParamString = SIDParam.toJSONString(); //JSON.toJSONString(SIDParam, new PascalNameFilter())
+            if (SID == 1) {
+                SIDParamString = SIDParamString.replaceAll("cropGoodsNo", "CropGoodsNo").replaceAll("goodsTaxNo", "GoodsTaxNo").replaceAll("taxDeduction", "TaxDeduction").replaceAll("taxPre", "TaxPre").replaceAll("taxPreCon", "TaxPreCon").replaceAll("zeroTax", "ZeroTax");
+            }
+            param = getBase64(SIDParamString);
+        }
+
+        try {
+            String url = "http://" +ip + ":" + port + "/InvSvr?SID=" + SID + "&SIDParam=" + param;
+            String response = HttpUtil.sendPost(url, null);
+            JSONObject responseJo = JSON.parseObject(response);
+            String result = responseJo.getString("ENCMSG");
+            result = getFromBase64(result);
+            resultJo = JSON.parseObject(result);
+        } catch (NullPointerException e) { // 加一个connectException
+            resultJo.put("error", "从开票接口获取数据失败");
+            e.printStackTrace();
+        } catch (Exception e) {
+            resultJo.put("error", "链接航天开票接口失败");
+            e.printStackTrace();
+        } finally {
+            return resultJo;
+        }
+    }
+
+    private JSONObject getSOAPJson1(int SID, JSONObject SIDParam) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("http://127.0.0.1:8888/InvSvr?");//192.168.253.112
+        sb.append("SID=").append(SID);
+        String str = SIDParam.toJSONString();
+
+        str = getBase64(str);
+
+        sb.append("&SIDParam=").append(str);
+        URLConnection conn = null;
+        BufferedReader rd = null;
+        JSONObject resultJo = new JSONObject();
+        String result = "";
+        String res = "";
+        try {
+            URL url = new URL(str);
+            conn = url.openConnection();
+            conn.setRequestProperty("accept", "*/*");
+            //conn.setRequestProperty("Accept-Charset", "GBK");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
+            conn.connect();
+            rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+            while ((result = rd.readLine()) != null) {
+                res = res + result;
+            }
+            resultJo = JSON.parseObject(res);
+
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (ConnectException e) {
+            resultJo.put("error", "链接航天开票接口失败");
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (rd != null) {
+                    rd.close();
+                }
+
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            return resultJo;
+        }
+
+        //return resultJo;
+    }
+
+     // 加密  
+    public static String getBase64(String str) {
+        byte[] b = null;  
+        String s = null;  
+        try {  
+            b = str.getBytes("GB2312");
+//          s = URLEncoder.encode(str,"GB2312");
+//          str = new String(str.getBytes("UTF-8"), "GB2312");
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }  
+        if (b != null) {
+//          s = new BASE64Encoder().encode(b);
+            s = Base64.toBase64String(b);
+            s= s.replaceAll("\\+","_");
+        }  
+        return s;  
+    }
+
+    // 解密
+    public static String getFromBase64(String s) {
+        s = s.replaceAll("_", "+");
+
+        byte[] b = null;
+        String result = null;
+        if (s != null) {
+            BASE64Decoder decoder = new BASE64Decoder();
+            try {
+                b = decoder.decodeBuffer(s);
+                result = new String(b, "GB2312");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return result;
+    }
+
+    private static class JsonUtil2 {
+
+        /**
+         * 将对象转化为JSON字符串
+         *
+         * @param object 要转化成json的对象
+         * @return 返回Json字符串
+         */
+        public static String parse(Object object) {
+            // TODO 请完成
+            if (object == null)
+                return "{}";
+            Class clazz = object.getClass();
+
+            try {
+                if (clazz.getName().startsWith("java.lang.String")) { // String字符串
+                    return parseString(object);
+                } else if (clazz.isPrimitive() || clazz.getName().startsWith("java.lang")) { // 基本属性类型及其封装类型
+                    return parsePrimitive(object);
+                } else if (Collection.class.isAssignableFrom(clazz)) { //集合
+                    return parseCollection(object);
+                } else if (Object.class.isAssignableFrom(clazz)) { //其他对象
+                    return parseObject(object);
+                }
+            } catch (IllegalAccessException e) {
+                e.printStackTrace();
+            }
+            return "{}";
+        }
+
+        private static String parseObject(Object object) throws IllegalAccessException {
+            StringBuffer tempSb = new StringBuffer(); //用于临时拼接集合的解析
+            tempSb.append("{");
+
+            Class c = object.getClass();
+            Field[] fs = c.getDeclaredFields();
+            for (int i = 0; i < fs.length; i++) {//遍历对象的所有属性
+                Field field = fs[i];
+                field.setAccessible(true);
+                String key = field.getName(); // Json字符串的key值
+                Object value = field.get(object);   // 解析前的值,为Object对象
+                if (Collection.class.isAssignableFrom(field.getType())) {
+                    tempSb.append("\"" + key + "\":" + parseCollection(value));
+                    continue;
+                }
+                tempSb.append("\"" + key + "\":" + parse(value));
+                if (i != fs.length - 1) { // 当不是最后一个属性时,添加逗号
+                    tempSb.append(",");
+                }
+            }
+
+            tempSb.append("}");
+            return String.valueOf(tempSb);
+        }
+
+        private static String parseCollection(Object object) {
+            if (object == null) {
+                return "[]";
+            }
+
+            StringBuffer tempSb = new StringBuffer(); //用于临时拼接集合的解析
+            tempSb.append("[");
+
+            //使用迭代器遍历集合中的对象
+            Iterator iterator = ((Collection<?>) object).iterator();
+            while (iterator.hasNext()) {
+                Object obj = iterator.next();
+                tempSb.append(parse(obj));
+                if (iterator.hasNext()) {
+                    tempSb.append(",");
+                }
+            }
+            tempSb.append("]");
+            return String.valueOf(tempSb);
+        }
+
+        private static String parsePrimitive(Object object) {
+            return String.valueOf(object);
+        }
+
+        private static String parseString(Object object) {
+            return "\"" + object + "\"";
+        }
+    }
+
+}
+
+

+ 66 - 0
src/main/webapp/resources/js/index/services/Fa.js

@@ -3,6 +3,68 @@ define([ 'ngResource'], function() {
 	]).factory('FaApBill', ['$resource', function($resource) {
 		return $resource('sale/apBill/:id', {}, {
 		});
+	}]).factory('FaApBillOut', ['$resource', function($resource) {
+		return $resource('sale/apBillOut/:id', {}, {
+			getAll: {
+				url: 'sale/apBillOut/getAll',
+				method: 'GET',
+				isArray: true
+			},
+			getAllCustomers: {
+				url: 'sale/apBillOut/getAllCustomers',
+				method: 'GET',
+				isArray: true
+			},
+			getAllByKeywords: {
+				url: 'sale/apBillOut/getAllByKeywords',
+				method: 'GET',
+				isArray: true
+			},getDoneApCheckByKeywords: {
+				url: 'sale/apBillOut/getDoneByKeywords',
+				method: 'GET',
+				isArray: true
+			},
+			saveApBillOut: {
+				url : 'sale/apBillOut/save',
+				method: 'POST'
+			},
+			updateApCheckItemBilled: {
+				url: 'sale/apBillOut/updateApCheckItemBilled',
+				method: 'POST'
+			},
+			deleteApBillOut: {
+				url: 'sale/apBillOut/deleteApBillOut/:id',
+				method: 'GET'
+			},
+			invoiceIssued: {
+				url: 'sale/apBillOut/invoiceIssued/:id'
+			},
+			printCount: {
+				url: 'sale/apBillOut/invoicePrint/:id',
+				method: 'GET'
+			},
+			InvoiceCancel: {
+				url: 'sale/apBillOut/InvoiceCancel/:id'
+			},
+			getTodo: {
+				params: {
+					_state: 'todo'
+				}
+			},
+			getDone: {
+				params: {
+					_state: 'done'
+				}
+			},
+			getEnd: {
+				params: {
+					_state: 'end'
+				}
+			},
+			cancel: {
+				url: 'sale/apBillOut/cancel'
+			}
+		});
 	}]).factory('FaArCheck', ['$resource', function($resource) {
 		return $resource('purchase/arCheck/:id', {}, {
 			agree: {
@@ -107,6 +169,10 @@ define([ 'ngResource'], function() {
 			getUnreadCount:{
 				url: 'sale/apCheck/unread',
 				method: 'GET'
+			},
+			getBilled: {
+				url: 'sale/apCheck/getBilled',
+				method: 'GET',
 			}
 		});
 	}]).factory('ApbillAdjustment', ['$resource', function($resource) {

+ 1 - 0
src/main/webapp/resources/tpl/index/fa/left.html

@@ -5,6 +5,7 @@
 	<ul class="list-unstyled">
 		<li ui-sref-active="active"><a ui-sref="fa.apBill"><em class="new-dot" ng-if="false"></em>发票</a></li>
 		<li ui-sref-active="active"><a ui-sref="fa.apCheck"><em class="new-dot" ng-if="unread.apCheck > 0"></em>应收对账单</a></li>
+		<!--<li ui-sref-active="active"><a ui-sref="fa.apBillOut">开票明细</a></li>-->
 		<!-- <li ui-sref-active="active"><a ui-sref="fa.adjustList">货款调账</a></li> -->
 	</ul>
 </div>