Esempio n. 1
0
    private Billing fillBill(Bill bill)
    {
        com.Sconit.Entity.Svp.Party supplier = new com.Sconit.Entity.Svp.Party();
        supplier.id          = bill.BillAddress.Party.Code;
        supplier.code        = bill.BillAddress.Party.Code;
        supplier.description = bill.BillAddress.Party.Name;

        supplier.address     = bill.BillAddress.Code;
        supplier.contact     = bill.BillAddress.ContactPersonName;
        supplier.telephone   = bill.BillAddress.TelephoneNumber;
        supplier.mobilephone = bill.BillAddress.MobilePhone;
        supplier.fax         = bill.BillAddress.Fax;
        supplier.postCode    = bill.BillAddress.PostalCode;

        com.Sconit.Entity.Svp.User user = new com.Sconit.Entity.Svp.User();
        user.name = bill.CreateUser.Name;

        com.Sconit.Entity.Svp.Billing billing = new com.Sconit.Entity.Svp.Billing();
        billing.partyFrom            = supplier;
        billing.id                   = bill.BillNo;
        billing.billingNo            = bill.BillNo;
        billing.billingDateSpecified = true;
        billing.billingDate          = bill.CreateDate;
        billing.createDateSpecified  = true;
        billing.createDate           = bill.CreateDate;
        billing.createUser           = user;

        return(billing);
    }
    public InventoryItem[] getSupplierInventory(GetSupplierInventoryRequest request)
    {
        DetachedCriteria criteria = DetachedCriteria.For<SupllierLocationView>();


        if (request.supplierCode != null && request.supplierCode != string.Empty)
        {
            criteria.Add(Expression.Like("PartyFrom.Code", request.supplierCode));
        }

        if (request.company != null && request.company != string.Empty)
        {
            criteria.Add(Expression.Like("PartyFrom.Name", request.company));
        }

        IList<SupllierLocationView> supplierLocationList = TheCriteriaMgr.FindAll<SupllierLocationView>(criteria, request.beginRowIndex, request.beginRowIndex + request.rowSize);
        List<InventoryItem> iItemList = new List<InventoryItem>();

        foreach (SupllierLocationView supplierLocation in supplierLocationList)
        {

            //set region					
            com.Sconit.Entity.Svp.Party party = new com.Sconit.Entity.Svp.Party();
            party.code = supplierLocation.PartyTo.Code;
            party.id = supplierLocation.PartyTo.Code;
            party.description = supplierLocation.PartyTo.Name;
            party.type = supplierLocation.PartyTo.Type;

            //set supplier
            com.Sconit.Entity.Svp.Party supplier = new com.Sconit.Entity.Svp.Party();
            supplier.id = supplierLocation.PartyFrom.Code;
            supplier.code = supplierLocation.PartyFrom.Code;
            supplier.description = supplierLocation.PartyFrom.Name;
            supplier.type = supplierLocation.PartyFrom.Type;

            //set unit of messure
            UOM uom = new UOM();
            uom.id = supplierLocation.Item.Code;
            uom.abbreviation = supplierLocation.Item.Code;
            uom.description = supplierLocation.Item.Description;

            //set supplier Item
            string refItemCode = TheItemReferenceMgr.GetItemReferenceByItem(supplierLocation.Item.Code, supplierLocation.PartyFrom.Code, supplierLocation.PartyTo.Code);
            Material suppItem = new Material();
            suppItem.id = refItemCode;
            suppItem.no = refItemCode;
            suppItem.description = refItemCode;
            suppItem.quantityUOM = uom;

            //set Item
            Material material = new Material();
            material.id = supplierLocation.Item.Code;
            material.no = supplierLocation.Item.Code;
            material.name = supplierLocation.Item.Description;
            material.description = supplierLocation.Item.Description;
            suppItem.quantityUOM = uom;

            //set supplier material
            string2MaterialMapEntry[] suppItemMap = new string2MaterialMapEntry[1];
            suppItemMap[0] = new string2MaterialMapEntry();
            suppItemMap[0].key = supplier.code;
            suppItemMap[0].value = suppItem;
            material.supplierMaterials = suppItemMap;

            //set location
            com.Sconit.Entity.Svp.Location location = new com.Sconit.Entity.Svp.Location();
            location.id = supplierLocation.Location.Code;
            location.name = supplierLocation.Location.Name;

            //set inventory
            InventoryItem iItem = new InventoryItem();
            iItem.ownerParty = party;
            iItem.supplier = supplier;
            iItem.material = material;
            iItem.location = location;
            iItem.quantityOnHand = Convert.ToDouble(supplierLocation.Qty);
            iItem.quantityOnHandSpecified = true;
            iItem.unitCount = Convert.ToDouble(supplierLocation.Item.UnitCount);
            iItem.unitCountSpecified = true;

            iItemList.Add(iItem);
        }

        return iItemList.ToArray();

    }
Esempio n. 3
0
    private RequisitionOrder fillOrderHead(OrderHead orderHead)
    {
        RequisitionOrder order = new RequisitionOrder();

        com.Sconit.Entity.Svp.User createUser = new com.Sconit.Entity.Svp.User();
        createUser.name = orderHead.CreateUser.Name;

        com.Sconit.Entity.Svp.User planner = new com.Sconit.Entity.Svp.User();
        planner.name = orderHead.CreateUser.Name;

        com.Sconit.Entity.Svp.Party partyFrom = new com.Sconit.Entity.Svp.Party();
        partyFrom.id          = orderHead.PartyFrom.Code;
        partyFrom.code        = orderHead.PartyFrom.Code;
        partyFrom.description = orderHead.PartyFrom.Name;

        if (orderHead.ShipFrom != null)
        {
            partyFrom.address     = orderHead.ShipFrom.Address;
            partyFrom.contact     = orderHead.ShipFrom.ContactPersonName;
            partyFrom.telephone   = orderHead.ShipFrom.TelephoneNumber;
            partyFrom.mobilephone = orderHead.ShipFrom.MobilePhone;
            partyFrom.fax         = orderHead.ShipFrom.Fax;
            partyFrom.postCode    = orderHead.ShipFrom.PostalCode;
        }

        com.Sconit.Entity.Svp.Party partyTo = new com.Sconit.Entity.Svp.Party();
        partyTo.id          = orderHead.PartyTo.Code;
        partyTo.code        = orderHead.PartyTo.Code;
        partyTo.description = orderHead.PartyTo.Name;

        if (orderHead.ShipTo != null)
        {
            partyTo.address     = orderHead.ShipTo.Address;
            partyTo.contact     = orderHead.ShipTo.ContactPersonName;
            partyTo.telephone   = orderHead.ShipTo.TelephoneNumber;
            partyTo.mobilephone = orderHead.ShipTo.MobilePhone;
            partyTo.fax         = orderHead.ShipTo.Fax;
            partyTo.postCode    = orderHead.ShipTo.PostalCode;
        }

        order.id = orderHead.OrderNo;
        order.requisitionOrderNo = orderHead.OrderNo;
        order.type                       = orderHead.Type;
        order.orderType                  = orderHead.SubType;
        order.priority                   = orderHead.Priority;
        order.createUser                 = createUser;
        order.createDate                 = orderHead.CreateDate;
        order.createDateSpecified        = true;
        order.effectiveDate              = orderHead.StartTime;
        order.effectiveDateSpecified     = true;
        order.demandDeliverDate          = orderHead.WindowTime;
        order.demandDeliverDateSpecified = true;

        string t = (orderHead.DockDescription == null || orderHead.DockDescription == string.Empty) ?
                   orderHead.PartyTo.Code : orderHead.PartyTo.Code + "@" + orderHead.DockDescription;

        order.demandDeliverAddr = orderHead.PartyTo.Name + " " + t + " "
                                  + (orderHead.DockDescription != null ? orderHead.DockDescription : string.Empty);

        order.partyFrom = partyFrom;
        order.partyTo   = partyTo;
        if (orderHead.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS)
        {
            order.status = "In_Process";
        }
        else
        {
            order.status = orderHead.Status;
        }
        order.planner = planner;

        order.print          = orderHead.IsPrinted;
        order.printSpecified = true;

        return(order);
    }
Esempio n. 4
0
    public InventoryItem[] getSupplierInventory(GetSupplierInventoryRequest request)
    {
        DetachedCriteria criteria = DetachedCriteria.For <SupllierLocationView>();


        if (request.supplierCode != null && request.supplierCode != string.Empty)
        {
            criteria.Add(Expression.Like("PartyFrom.Code", request.supplierCode));
        }

        if (request.company != null && request.company != string.Empty)
        {
            criteria.Add(Expression.Like("PartyFrom.Name", request.company));
        }

        IList <SupllierLocationView> supplierLocationList = TheCriteriaMgr.FindAll <SupllierLocationView>(criteria, request.beginRowIndex, request.beginRowIndex + request.rowSize);
        List <InventoryItem>         iItemList            = new List <InventoryItem>();

        foreach (SupllierLocationView supplierLocation in supplierLocationList)
        {
            //set region
            com.Sconit.Entity.Svp.Party party = new com.Sconit.Entity.Svp.Party();
            party.code        = supplierLocation.PartyTo.Code;
            party.id          = supplierLocation.PartyTo.Code;
            party.description = supplierLocation.PartyTo.Name;
            party.type        = supplierLocation.PartyTo.Type;

            //set supplier
            com.Sconit.Entity.Svp.Party supplier = new com.Sconit.Entity.Svp.Party();
            supplier.id          = supplierLocation.PartyFrom.Code;
            supplier.code        = supplierLocation.PartyFrom.Code;
            supplier.description = supplierLocation.PartyFrom.Name;
            supplier.type        = supplierLocation.PartyFrom.Type;

            //set unit of messure
            UOM uom = new UOM();
            uom.id           = supplierLocation.Item.Code;
            uom.abbreviation = supplierLocation.Item.Code;
            uom.description  = supplierLocation.Item.Description;

            //set supplier Item
            string   refItemCode = TheItemReferenceMgr.GetItemReferenceByItem(supplierLocation.Item.Code, supplierLocation.PartyFrom.Code, supplierLocation.PartyTo.Code);
            Material suppItem    = new Material();
            suppItem.id          = refItemCode;
            suppItem.no          = refItemCode;
            suppItem.description = refItemCode;
            suppItem.quantityUOM = uom;

            //set Item
            Material material = new Material();
            material.id          = supplierLocation.Item.Code;
            material.no          = supplierLocation.Item.Code;
            material.name        = supplierLocation.Item.Description;
            material.description = supplierLocation.Item.Description;
            suppItem.quantityUOM = uom;

            //set supplier material
            string2MaterialMapEntry[] suppItemMap = new string2MaterialMapEntry[1];
            suppItemMap[0]             = new string2MaterialMapEntry();
            suppItemMap[0].key         = supplier.code;
            suppItemMap[0].value       = suppItem;
            material.supplierMaterials = suppItemMap;

            //set location
            com.Sconit.Entity.Svp.Location location = new com.Sconit.Entity.Svp.Location();
            location.id   = supplierLocation.Location.Code;
            location.name = supplierLocation.Location.Name;

            //set inventory
            InventoryItem iItem = new InventoryItem();
            iItem.ownerParty              = party;
            iItem.supplier                = supplier;
            iItem.material                = material;
            iItem.location                = location;
            iItem.quantityOnHand          = Convert.ToDouble(supplierLocation.Qty);
            iItem.quantityOnHandSpecified = true;
            iItem.unitCount               = Convert.ToDouble(supplierLocation.Item.UnitCount);
            iItem.unitCountSpecified      = true;

            iItemList.Add(iItem);
        }

        return(iItemList.ToArray());
    }
    private RequisitionOrder fillOrderHead(OrderHead orderHead)
    {
        RequisitionOrder order = new RequisitionOrder();

        com.Sconit.Entity.Svp.User createUser = new com.Sconit.Entity.Svp.User();
        createUser.name = orderHead.CreateUser.Name;

        com.Sconit.Entity.Svp.User planner = new com.Sconit.Entity.Svp.User();
        planner.name = orderHead.CreateUser.Name;

        com.Sconit.Entity.Svp.Party partyFrom = new com.Sconit.Entity.Svp.Party();
        partyFrom.id = orderHead.PartyFrom.Code;
        partyFrom.code = orderHead.PartyFrom.Code;
        partyFrom.description = orderHead.PartyFrom.Name;

        if (orderHead.ShipFrom != null)
        {
            partyFrom.address = orderHead.ShipFrom.Address;
            partyFrom.contact = orderHead.ShipFrom.ContactPersonName;
            partyFrom.telephone = orderHead.ShipFrom.TelephoneNumber;
            partyFrom.mobilephone = orderHead.ShipFrom.MobilePhone;
            partyFrom.fax = orderHead.ShipFrom.Fax;
            partyFrom.postCode = orderHead.ShipFrom.PostalCode;
        }

        com.Sconit.Entity.Svp.Party partyTo = new com.Sconit.Entity.Svp.Party();
        partyTo.id = orderHead.PartyTo.Code;
        partyTo.code = orderHead.PartyTo.Code;
        partyTo.description = orderHead.PartyTo.Name;

        if (orderHead.ShipTo != null)
        {
            partyTo.address = orderHead.ShipTo.Address;
            partyTo.contact = orderHead.ShipTo.ContactPersonName;
            partyTo.telephone = orderHead.ShipTo.TelephoneNumber;
            partyTo.mobilephone = orderHead.ShipTo.MobilePhone;
            partyTo.fax = orderHead.ShipTo.Fax;
            partyTo.postCode = orderHead.ShipTo.PostalCode;
        }

        order.id = orderHead.OrderNo;
        order.requisitionOrderNo = orderHead.OrderNo;
        order.type = orderHead.Type;
        order.orderType = orderHead.SubType;
        order.priority = orderHead.Priority;
        order.createUser = createUser;
        order.createDate = orderHead.CreateDate;
        order.createDateSpecified = true;
        order.effectiveDate = orderHead.StartTime;
        order.effectiveDateSpecified = true;
        order.demandDeliverDate = orderHead.WindowTime;
        order.demandDeliverDateSpecified = true;

        string t = (orderHead.DockDescription == null || orderHead.DockDescription == string.Empty) ?
            orderHead.PartyTo.Code : orderHead.PartyTo.Code + "@" + orderHead.DockDescription;

        order.demandDeliverAddr = orderHead.PartyTo.Name + " " + t + " "
            + (orderHead.DockDescription != null ? orderHead.DockDescription : string.Empty);

        order.partyFrom = partyFrom;
        order.partyTo = partyTo;
        if (orderHead.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS)
        {
            order.status = "In_Process";
        }else{
        order.status = orderHead.Status;
        }
        order.planner = planner;

        order.print = orderHead.IsPrinted;
        order.printSpecified = true;

        return order;
    }
Esempio n. 6
0
    private Billing fillBill(Bill bill)
    {
        com.Sconit.Entity.Svp.Party supplier = new com.Sconit.Entity.Svp.Party();
        supplier.id = bill.BillAddress.Party.Code;
        supplier.code = bill.BillAddress.Party.Code;
        supplier.description = bill.BillAddress.Party.Name;

        supplier.address = bill.BillAddress.Code;
        supplier.contact = bill.BillAddress.ContactPersonName;
        supplier.telephone = bill.BillAddress.TelephoneNumber;
        supplier.mobilephone = bill.BillAddress.MobilePhone;
        supplier.fax = bill.BillAddress.Fax;
        supplier.postCode = bill.BillAddress.PostalCode;

        com.Sconit.Entity.Svp.User user = new com.Sconit.Entity.Svp.User();
        user.name = bill.CreateUser.Name;

        com.Sconit.Entity.Svp.Billing billing = new com.Sconit.Entity.Svp.Billing();
        billing.partyFrom = supplier;
        billing.id = bill.BillNo;
        billing.billingNo = bill.BillNo;
        billing.billingDateSpecified = true;
        billing.billingDate = bill.CreateDate;
        billing.createDateSpecified = true;
        billing.createDate = bill.CreateDate;
        billing.createUser = user;

        return billing;
    }
    public ReceivingNote[] getReceivingNote(GetReceivingNoteRequest request)
    {
        DetachedCriteria criteria = DetachedCriteria.For <Receipt>();

        criteria.AddOrder(Order.Desc("ReceiptNo"));

        if (request.supplier != null && request.supplier != string.Empty)
        {
            criteria.Add(Expression.Like("PartyFrom.Name", request.supplier));
        }
        if (request.supplierPartyCode != null && request.supplierPartyCode != string.Empty)
        {
            criteria.Add(Expression.Eq("PartyFrom.Code", request.supplierPartyCode));
        }
        if (request.customerPartyCode != null && request.customerPartyCode != string.Empty)
        {
            criteria.Add(Expression.Eq("PartyTo.Code", request.customerPartyCode));
        }

        if (request.customer != null && request.customer != string.Empty)
        {
            criteria.Add(Expression.Like("PartyTo.Name", request.customer));
        }

        if (request.receivingNo != null && request.receivingNo != string.Empty)
        {
            criteria.Add(Expression.Eq("ReceiptNo", request.receivingNo));
        }

        if (request.receiveDateFromSpecified)
        {
            criteria.Add(Expression.Ge("CreateDate", request.receiveDateFrom));
        }

        if (request.receiveDateToSpecified)
        {
            criteria.Add(Expression.Le("CreateDate", request.receiveDateTo));
        }


        IList <Receipt> receiptList = TheCriteriaMgr.FindAll <Receipt>(criteria);

        List <ReceivingNote> noteList = new List <ReceivingNote>();
        ReceivingNote        note     = new ReceivingNote();

        foreach (Receipt receipt in receiptList)
        {
            note.id                   = receipt.ReceiptNo;
            note.receivingNo          = receipt.ReceiptNo;
            note.receiveDate          = receipt.CreateDate;
            note.receiveDateSpecified = true;

            DeliveryOrder deliveryOrder = new DeliveryOrder();
            deliveryOrder.deliveryOrderNo = receipt.ReferenceIpNo;
            note.deliveryOrder            = deliveryOrder;

            com.Sconit.Entity.Svp.Party partyFrom = new com.Sconit.Entity.Svp.Party();
            partyFrom.code        = receipt.PartyFrom.Code;
            partyFrom.id          = receipt.PartyFrom.Code;
            partyFrom.description = receipt.PartyFrom.Name;
            note.partyFrom        = partyFrom;

            com.Sconit.Entity.Svp.Party partyTo = new com.Sconit.Entity.Svp.Party();
            partyTo.code        = receipt.PartyTo.Code;
            partyTo.id          = receipt.PartyTo.Code;
            partyTo.description = receipt.PartyTo.Name;
            note.partyTo        = partyTo;

            com.Sconit.Entity.Svp.User receiveUser = new com.Sconit.Entity.Svp.User();
            receiveUser.id   = receipt.CreateUser.Code;
            receiveUser.name = receipt.CreateUser.Name;
            note.receiveUser = receiveUser;

            noteList.Add(note);
        }

        return(noteList.ToArray());
    }
    public ReceivingNote[] getReceivingNote(GetReceivingNoteRequest request)
    {

        DetachedCriteria criteria = DetachedCriteria.For<Receipt>();
        criteria.AddOrder(Order.Desc("ReceiptNo"));

        if (request.supplier != null && request.supplier != string.Empty)
        {
            criteria.Add(Expression.Like("PartyFrom.Name", request.supplier));
        }
        if (request.supplierPartyCode != null && request.supplierPartyCode != string.Empty)
        {
            criteria.Add(Expression.Eq("PartyFrom.Code", request.supplierPartyCode));
        }
        if (request.customerPartyCode != null && request.customerPartyCode != string.Empty)
        {
            criteria.Add(Expression.Eq("PartyTo.Code", request.customerPartyCode));
        }

        if (request.customer != null && request.customer != string.Empty)
        {
            criteria.Add(Expression.Like("PartyTo.Name", request.customer));
        }

        if (request.receivingNo != null && request.receivingNo != string.Empty)
        {
            criteria.Add(Expression.Eq("ReceiptNo", request.receivingNo));
        }

        if (request.receiveDateFromSpecified)
        {
            criteria.Add(Expression.Ge("CreateDate", request.receiveDateFrom));
        }

        if (request.receiveDateToSpecified)
        {
            criteria.Add(Expression.Le("CreateDate", request.receiveDateTo));
        }


        IList<Receipt> receiptList = TheCriteriaMgr.FindAll<Receipt>(criteria);

        List<ReceivingNote> noteList = new List<ReceivingNote>();
        ReceivingNote note = new ReceivingNote();
        foreach (Receipt receipt in receiptList)
        {
            note.id = receipt.ReceiptNo;
            note.receivingNo = receipt.ReceiptNo;
            note.receiveDate = receipt.CreateDate;
            note.receiveDateSpecified = true;

            DeliveryOrder deliveryOrder = new DeliveryOrder();
            deliveryOrder.deliveryOrderNo = receipt.ReferenceIpNo;
            note.deliveryOrder = deliveryOrder;

            com.Sconit.Entity.Svp.Party partyFrom = new com.Sconit.Entity.Svp.Party();
            partyFrom.code = receipt.PartyFrom.Code;
            partyFrom.id = receipt.PartyFrom.Code;
            partyFrom.description = receipt.PartyFrom.Name;
            note.partyFrom = partyFrom;

            com.Sconit.Entity.Svp.Party partyTo = new com.Sconit.Entity.Svp.Party();
            partyTo.code = receipt.PartyTo.Code;
            partyTo.id = receipt.PartyTo.Code;
            partyTo.description = receipt.PartyTo.Name;
            note.partyTo = partyTo;

            com.Sconit.Entity.Svp.User receiveUser = new com.Sconit.Entity.Svp.User();
            receiveUser.id = receipt.CreateUser.Code;
            receiveUser.name = receipt.CreateUser.Name;
            note.receiveUser = receiveUser;

            noteList.Add(note);
        }

        return noteList.ToArray();

    }