//[OperationBehavior] public System.String DoEx(ICommonDataContract commonData, System.String contextInfo, System.String docTypeCode, System.String docInfo) { this.CommonData = commonData; try { BeforeInvoke("UFIDA.U9.Cust.ZX.BaiLiSV.CreateSOSV"); CreateSOSV objectRef = new CreateSOSV(); objectRef.ContextInfo = contextInfo; objectRef.DocTypeCode = docTypeCode; objectRef.DocInfo = docInfo; //处理返回类型. System.String result = objectRef.Do(); return(result); return(result); } catch (System.Exception e) { DealException(e); throw; } finally { FinallyInvoke("UFIDA.U9.Cust.ZX.BaiLiSV.CreateSOSV"); } }
public override object Do(object obj) { CreateSOSV bpObj = (CreateSOSV)obj; //get business operation context is as follows //IContext context = ContextManager.Context //auto generating code end,underside is user custom code //and if you Implement replace this Exception Code... throw new NotImplementedException(); }
public override object Do(object obj) { CreateSOSV bpObj = (CreateSOSV)obj; //get business operation context is as follows //IContext context = ContextManager.Context //auto generating code end,underside is user custom code //and if you Implement replace this Exception Code... CreateSOSV svCreateSO = new CreateSOSV(); StringBuilder strbResult = new StringBuilder(); string strSOInfo = "<SOInfo DocNo=\"{0}\" />"; if (string.IsNullOrEmpty(bpObj.DocInfo)) { //logger.Error(string.Format("创建料品失败:传入参数BOMItemInfo为空。")); strbResult.AppendFormat(string.Format("<ResultInfo Error=\"{0}\" />", "创建销售订单失败:传入参数DocInfo为空。")); return(strbResult.ToString()); } SOInfo soInfo = new SOInfo(); ContextInfo cxtInfo = new ContextInfo(); #region 校验数据有效性 try { soInfo = XmlSerializerHelper.XmlDeserialize <SOInfo>(bpObj.DocInfo, Encoding.Unicode); cxtInfo = XmlSerializerHelper.XmlDeserialize <ContextInfo>(bpObj.ContextInfo, Encoding.Unicode); } catch (Exception ex) { strbResult.AppendFormat(string.Format("<ResultInfo Error=\"{0}\" />", string.Format("反序列化销售订单DocInfo失败:{0}", bpObj.DocInfo))); return(strbResult.ToString()); } if (soInfo.Lines.Count <= 0) { strbResult.AppendLine(string.Format("<ResultInfo Error=\"{0}\" />", "传入的DocInfo中没有订货信息")); return(strbResult.ToString()); } Organization beOrgContext = Organization.FindByCode(cxtInfo.OrgCode); //单据类型 string soDocTypeCode = string.Empty; if (!string.IsNullOrEmpty(bpObj.DocTypeCode)) { soDocTypeCode = bpObj.DocTypeCode; } else { soDocTypeCode = cxtInfo.SoDocTypeCode; } if (string.IsNullOrEmpty(soDocTypeCode)) { strbResult.AppendLine(string.Format("<ResultInfo Error=\"{0}\" />", "不能建立生成销售订单单据类型")); return(strbResult.ToString()); } //客户 if (string.IsNullOrEmpty(soInfo.CustCode)) { strbResult.AppendLine(string.Format("<ResultInfo Error=\"{0}\" />", "来源客户不能为空")); return(strbResult.ToString()); } Customer itemCust = Customer.FindByCode(beOrgContext, soInfo.CustCode); if (itemCust == null) { strbResult.AppendLine(string.Format("<ResultInfo Error=\"{0}\" />", string.Format("客户编号{0}在U9中不存在", soInfo.CustCode))); return(strbResult.ToString()); } //订单日期 if (string.IsNullOrEmpty(soInfo.BusinessDate)) { strbResult.AppendLine(string.Format("<ResultInfo Error=\"{0}\" />", "订单日期不能为空")); return(strbResult.ToString()); } #endregion CommonCreateSOSRV sv = new CommonCreateSOSRV(); List <SaleOrderDTO> lstSODTO = new List <SaleOrderDTO>(); try { SaleOrderDTO dtoSO = CreateSOHead(beOrgContext, soDocTypeCode, itemCust, soInfo); CreateSOLines(beOrgContext, soInfo, dtoSO, itemCust); lstSODTO.Add(dtoSO); sv.SOs = lstSODTO; List <CommonArchiveDataDTO> lstSORlt = new List <CommonArchiveDataDTO>(); lstSORlt = sv.Do(); strbResult.AppendLine("<ResultInfo>"); if (lstSORlt.Count > 0) { strbResult.AppendLine(string.Format(strSOInfo, lstSODTO[0].DocNo)); } else { strbResult.AppendLine("<Error Desc=\"未能生成U9销售订单\" ></Error>"); } strbResult.AppendLine("</ResultInfo>"); return(strbResult.ToString()); } catch (Exception ex) { strbResult.AppendFormat(string.Format("<ResultInfo error={0} />", string.Format("创建U9销售订单失败:{0}", bpObj.DocInfo))); return(strbResult.ToString()); } }