/// <summary> /// 测试调用方法 /// </summary> /// <returns></returns> public static String execTest() { BillBean bb = new BillBean(); bb.bizDate = DateTime.Now; bb.adminOrgUnit = new BillObject("123"); bb.number = "456"; BillEntryToken bet = new BillEntryToken(); bet.material = new BillObject("789"); bet.qty = 10; bb.entry.Add(bet); BillBeanList bbl = new BillBeanList(); bbl.Add(bb); String result = JsonConvert.SerializeObject(bbl); return(result); }
/// <summary> /// 生成销售订单 /// </summary> /// <returns></returns> public String renderXSDD() { //初始化 init(); //查找未上传的出库单 DataTable dt = queryDD(); //拼入参 if (dt != null) { foreach (DataRow dr in dt.Rows) { #region 拼表头 XSBean bb = new XSBean(); String seqno = dr["SEQNO"].ToString(); DateTime bizDate = Convert.ToDateTime(dr["XDRQ"]); //String sql = "select * from dat_dd_com where seqno = '" + seqno + "' and custid = '" + dr["CUSTID"].ToString() + "'"; //DataTable dResult = DbHelperOra.Query(sql).Tables[0]; bb.bizDate = bizDate; String customerSql = "select CODE,COSTCENTER,USERCODE,WAREHOUSE,SALEPERSON,STORAGEUNIT,COMPANYUNIT,STOCKER,DCBM,DRBM,XSZ,SALEBM,EASCODE from doc_customer where code = '" + dr["CUSTID"].ToString() + "'"; DataTable customerInfo = DbHelperOra.Query(customerSql).Tables[0]; String custId = customerInfo.Rows[0]["EASCODE"].ToString(); String creator = customerInfo.Rows[0]["USERCODE"].ToString(); String salePerson = customerInfo.Rows[0]["SALEPERSON"].ToString(); String saleOrgUnit = customerInfo.Rows[0]["STORAGEUNIT"].ToString(); String saleGroup = customerInfo.Rows[0]["XSZ"].ToString(); bb.number = seqno + "_" + custId; bb.orderCustomer = new BillObject(custId); bb.creator = new BillObject(creator); bb.salePerson = new BillObject(salePerson); bb.saleOrgUnit = new BillObject(saleOrgUnit); bb.saleGroup = new BillObject(saleGroup); bb.description = dr["MEMO"].ToString(); String sql = "select * from dat_dd_com where seqno = '" + seqno + "' and custid = '" + dr["CUSTID"].ToString() + "'"; DataTable dResult = DbHelperOra.Query(sql).Tables[0]; #endregion #region 拼表体 Boolean canContinue = true; foreach (DataRow comdr in dResult.Rows) { XSEntryToken bet = new XSEntryToken(); String easGDSEQ = getEasGDSEQ(comdr["GDSEQ"].ToString()); String unit = comdr["UNIT"].ToString(); if (easGDSEQ == null) { canContinue = false; this.errorDetail += "订单[" + comdr["SEQNO"].ToString() + "]中的商品[" + comdr["GDSEQ"].ToString() + "] 不是 EAS 商品. "; UpdateBill(comdr["SEQNO"].ToString(), "E", dr["CUSTID"].ToString(), "DAT_DD_DOC"); break; } Decimal qty = Convert.ToDecimal(comdr["DHS"]); bet.qty = qty; bet.remark = comdr["MEMO"].ToString(); //bet.customer = new BillObject(custId); bet.material = new BillObject(easGDSEQ); bet.storageOrgUnit = new BillObject(saleOrgUnit); bet.deliveryCustomer = new BillObject(custId); bet.receiveCustomer = bet.deliveryCustomer; bet.paymentCustomer = bet.deliveryCustomer; bet.unit = new BillObject(unit); bet.sendDate = DateTime.Now; bb.entries.Add(bet); } #endregion if (canContinue) { billBeanList.Add(bb); } } this.resultDT = dt; } if (billBeanList.Count <= 0) { this.errorDetail += "没有符合条件的数据"; } else { this.total = billBeanList.Count; } return(JsonConvert.SerializeObject(billBeanList, settings)); //TODO 调用接口方法,获取返回值 //TODO 处理返回值 #region 测试用 ////表头 //XSBean bb = new XSBean(); //bb.number = "TESTXSDD0002"; //bb.creator = new BillObject("whfy"); //bb.bizDate = DateTime.Now; ////bb.costCenterOrgUnit = new BillObject("01.05.04.01.11.01.02"); //bb.description = "测试库存调拨单"; ////bb.storageOrgUnit = new BillObject("01.05.04.01.09"); ////bb.issueStorageOrgUnit = bb.storageOrgUnit; ////bb.receiptStorageOrgUnit = bb.storageOrgUnit; ////bb.issueAdminOrgUnit = new BillObject("01.05.04.01.09"); ////bb.receiptAdminOrgUnit = new BillObject("01.05.04.01.11.01"); ////bb.adminOrgUnit = new BillObject("01.05.04.01"); ////bb.stocker = new BillObject("00011846"); //bb.salePerson = new BillObject("00011846"); //bb.saleOrgUnit = new BillObject("01.05.04.01.09"); //bb.saleGroup = new BillObject("YYBB-02"); //bb.orderCustomer = new BillObject("37.11.0045"); ////表体 //XSEntryToken bet = new XSEntryToken(); //bet.material = new BillObject("01.12.02.0003"); //bet.qty = 2; //bet.remark = "测试"; //bet.storageOrgUnit = new BillObject("01.05.04.01.09"); //bet.deliveryCustomer = new BillObject("37.11.0045"); //bet.receiveCustomer = bet.deliveryCustomer; //bet.paymentCustomer = bet.deliveryCustomer; //bet.unit = new BillObject("Set"); ////bet.warehouse = new BillObject("YYBB-15-1"); ////bet.receiptPlanDate = DateTime.Now.ToString(BillConfig.timestring); ////bet.issuePlanDate = DateTime.Now.ToString(BillConfig.timestring); //bet.sendDate = DateTime.Now; //bb.entries.Add(bet); ////添加到结果中 //billBeanList.Add(bb); #endregion //return JsonConvert.SerializeObject(billBeanList,settings); }