コード例 #1
0
 private void MapToDetailRow(OrderDtlRow row, SO_DETAIL entity)
 {
     row.Company           = entity.CompanyCode;
     row.LineDesc          = entity.LineDesc;
     row.PartNum           = entity.ProductCode;
     row.SalesUM           = entity.SaleUM;
     row.IUM               = entity.IUM;
     row.SellingQuantity   = entity.Quantity;
     row.WarehouseCode     = entity.WhsCode;
     row.DocUnitPrice      = entity.Price;
     row.DiscountPercent   = entity.DiscountPercent.HasValue ? entity.DiscountPercent.Value : 0;
     row.PriceListCode     = entity.PriceListCode;
     row.BreakListCode     = entity.BreakListCode;
     row.DiscBreakListCode = entity.DisBreakListCode;
     row.ProdCode          = entity.ProdCode;
 }
コード例 #2
0
        public static SO_HEADER GetData(SAPbobsCOM.Company oCompany, int id)
        {
            Utils            control    = new Utils();
            List <SO_DETAIL> details    = new List <SO_DETAIL>();
            XDocument        xDoc       = new XDocument();
            XDocument        xDocDetail = new XDocument();

            string sql = "select U_PrimaryNumberingPOS, U_DocumentNumberingPOS, docentry, docnum, CardCode, " +
                         "CardName, DocDate, DocDueDate, TaxDate, DocTotal, t0.slpcode, slpname from ordr t0 " +
                         "join oslp t1 on t0.slpcode = t1.slpcode where docentry = " + id;

            Recordset rs = control._IDU_Recordset(oCompany, sql);

            xDoc = XDocument.Parse(rs.GetAsXML());

            sql = "select t1.LineNum, ItemCode, dscription, UomEntry, UomCode, Quantity,Price, t2.WhsCode, t2.WhsName, t1.DiscPrcnt from rdr1 t1 " +
                  "join owhs t2 on t1.WhsCode = t2.WhsCode where t1.docentry = " + id;
            rs         = control._IDU_Recordset(oCompany, sql);
            xDocDetail = XDocument.Parse(rs.GetAsXML());

            XElement xEle       = xDoc.Element("BOM").Element("BO").Element("ordr").Element("row");
            XElement xEleDetail = xDocDetail.Element("BOM").Element("BO").Element("rdr1");

            foreach (var item in xEleDetail.Elements("row"))
            {
                SO_DETAIL model_detail = new SO_DETAIL()
                {
                    LineNum         = Convert.ToInt32(item.Element("LineNum").Value),
                    ItemCode        = item.Element("ItemCode").Value,
                    Description     = item.Element("dscription").Value,
                    UomEntry        = Convert.ToInt32(item.Element("UomEntry").Value),
                    UomCode         = item.Element("UomCode").Value,
                    Quantity        = Convert.ToDouble(item.Element("Quantity").Value),
                    Price           = Convert.ToDouble(item.Element("Price").Value),
                    WarehouseCode   = item.Element("WhsCode").Value,
                    WarehouseName   = item.Element("WhsName").Value,
                    DiscountPercent = Convert.ToDouble(item.Element("DiscPrcnt").Value)
                };

                details.Add(model_detail);
            }

            SO_HEADER model = new SO_HEADER()
            {
                PrimaryNumberingPOS  = xEle.Element("U_PrimaryNumberingPOS").Value,
                DocumentNumberingPOS = xEle.Element("U_DocumentNumberingPOS").Value,
                DocEntry             = xEle.Element("docentry").Value,
                DocNum          = xEle.Element("docnum").Value,
                CardCode        = xEle.Element("CardCode").Value,
                CardName        = xEle.Element("CardName").Value,
                SalesPersonCode = xEle.Element("slpcode").Value,
                SalesPersonName = xEle.Element("slpname").Value,
                PostingDate     = DateTime.ParseExact(xEle.Element("DocDate").Value, "yyyyMMdd",
                                                      CultureInfo.InvariantCulture, DateTimeStyles.None),
                DocDueDate = DateTime.ParseExact(xEle.Element("DocDueDate").Value, "yyyyMMdd",
                                                 CultureInfo.InvariantCulture, DateTimeStyles.None),
                TaxDate = DateTime.ParseExact(xEle.Element("TaxDate").Value, "yyyyMMdd",
                                              CultureInfo.InvariantCulture, DateTimeStyles.None),
                TotalTransaction = Convert.ToDouble(xEle.Element("DocTotal").Value),

                Lines = details
            };

            return(model);
        }