コード例 #1
0
    public FlowDetailProxy GenerateFlowDetailProxyByReferenceItem(string flowCode, string refItemCode, string partyFromCode, string partyToCode, string moduleType, bool changeRef, DateTime startTime)
    {
        Item item = null;

        if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT)
        {
            item = TheItemReferenceMgr.GetItemReferenceByRefItem(refItemCode, partyFromCode, partyToCode);
        }
        else if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
        {
            item = TheItemReferenceMgr.GetItemReferenceByRefItem(refItemCode, partyToCode, partyFromCode);
        }
        else
        {
            item = TheItemReferenceMgr.GetItemReferenceByRefItem(refItemCode, partyFromCode, partyFromCode);
        }
        if (item != null)
        {
            return(GenerateFlowDetailProxy(flowCode, item.Code, moduleType, partyFromCode, partyToCode, changeRef, startTime));
        }
        else
        {
            return(null);
        }
    }
コード例 #2
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string flowCode = this.tbFlow.Text.Trim();

        if (flowCode == string.Empty)
        {
            ShowErrorMessage("Common.Business.Error.Require.Flow");
            return;
        }
        Flow flow = TheFlowMgr.LoadFlow(flowCode);

        if (flow.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
        {
            this.PartyCode = flow.PartyTo.Code;
        }
        else
        {
            this.PartyCode = flow.PartyFrom.Code;
        }
        IList <CustomerScheduleDetail> customerScheduleDetails = TheCustomerScheduleDetailMgr.GetCustomerScheduleDetails(flowCode, this.StartDate);
        ScheduleView scheduleView = TheCustomerScheduleDetailMgr.TransferCustomerScheduleDetails2ScheduleView(customerScheduleDetails, this.StartDate);

        itemRefs = TheItemReferenceMgr.GetAllItemReference();

        this.GV_List_DataBind(scheduleView);
    }
コード例 #3
0
    protected void GV_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int    id = (int)this.GV_List.DataKeys[e.RowIndex].Values[0];
        string itemReferenceCode = TheItemReferenceMgr.LoadItemReference(id).ReferenceCode;

        TheItemReferenceMgr.DeleteItemReference(id);
        this.GV_List.Execute();
        try
        {
            ShowSuccessMessage("MasterData.ItemReference.DeleteItemReference.Successfully", itemReferenceCode);
        }
        catch (Castle.Facilities.NHibernateIntegration.DataException ex)
        {
            ShowErrorMessage("MasterData.ItemReference.DeleteItemReference.Fail", itemReferenceCode);
        }
    }
コード例 #4
0
    protected void CV_ServerValidate(object source, ServerValidateEventArgs args)
    {
        CustomValidator cv = (CustomValidator)source;

        switch (cv.ID)
        {
        case "cvReferenceCode":
            string partyCode = ((Controls_TextBox)(this.FV_ItemReference.FindControl("tbPartyCode"))).Text;
            if (TheItemReferenceMgr.LoadItemReference(ItemCode, partyCode, args.Value.Trim()) != null)
            {
                ShowErrorMessage("MasterData.ItemReference.AddItemReference.Error", args.Value.Trim());
                args.IsValid = false;
            }
            break;

        default:
            break;
        }
    }
コード例 #5
0
    protected void GV_List_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        ItemReference itemReference = new ItemReference();

        int    id        = (int)this.GV_List.DataKeys[e.RowIndex].Values[0];
        string itemCode  = ((Label)this.GV_List.Rows[e.RowIndex].FindControl("lblItemCode")).Text.Trim();
        string partyCode = ((Label)this.GV_List.Rows[e.RowIndex].FindControl("lblPartyCode")).Text.Trim();

        itemReference               = TheItemReferenceMgr.LoadItemReference(id);
        itemReference.Item          = TheItemMgr.LoadItem(itemCode);
        itemReference.Party         = ThePartyMgr.LoadParty(partyCode);
        itemReference.ReferenceCode = ((Label)this.GV_List.Rows[e.RowIndex].FindControl("lblItemReferenceCode")).Text.Trim();
        itemReference.Description   = ((TextBox)this.GV_List.Rows[e.RowIndex].FindControl("tbDescription")).Text.Trim();
        itemReference.Remark        = ((TextBox)this.GV_List.Rows[e.RowIndex].FindControl("tbRemark")).Text.Trim();
        itemReference.IsActive      = ((CheckBox)this.GV_List.Rows[e.RowIndex].FindControl("cbActive")).Checked;
        TheItemReferenceMgr.UpdateItemReference(itemReference);
        this.GV_List.EditIndex = -1;
        this.GV_List.Execute();
        ShowSuccessMessage("MasterData.ItemReference.UpdateItemReference.Successfully", itemReference.ReferenceCode);
    }
コード例 #6
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());
    }
コード例 #7
0
    public FlowDetailProxy GenerateFlowDetailProxy(string flowCode, string itemCode, string moduleType, string partyFromCode, string partyToCode, bool changeRef, DateTime startTime)
    {
        IList <FlowDetail> flowDetailList = TheFlowDetailMgr.GetFlowDetail(flowCode, true);

        if (flowDetailList != null && flowDetailList.Count > 0)
        {
            foreach (FlowDetail fd in flowDetailList)
            {
                if (fd.Item.Code == itemCode)
                {
                    FlowDetailProxy flowDetailProxy = new FlowDetailProxy();
                    flowDetailProxy.ItemCode        = fd.Item.Code;
                    flowDetailProxy.ItemDescription = fd.Item.Description;
                    if (changeRef)
                    {
                        flowDetailProxy.ItemReferenceCode = fd.ReferenceItemCode;
                    }
                    flowDetailProxy.UomCode   = fd.Uom.Code;
                    flowDetailProxy.UnitCount = fd.UnitCount;
                    flowDetailProxy.HuLotSize = fd.HuLotSize == null?Convert.ToInt32(fd.UnitCount) : fd.HuLotSize;

                    if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT)
                    {
                        if (fd.DefaultPriceListFrom != null)
                        {
                            flowDetailProxy.PriceListCode = fd.DefaultPriceListFrom.Code;
                            PriceListDetail priceListDetailFrom = ThePriceListDetailMgr.GetLastestPriceListDetail(fd.DefaultPriceListFrom, fd.Item, startTime, fd.Flow.Currency, fd.Uom);
                            if (priceListDetailFrom != null)
                            {
                                flowDetailProxy.UnitPrice         = priceListDetailFrom.UnitPrice;
                                flowDetailProxy.PriceListDetailId = priceListDetailFrom.Id;
                            }
                        }
                    }
                    else if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
                    {
                        if (fd.DefaultPriceListTo != null)
                        {
                            flowDetailProxy.PriceListCode = fd.DefaultPriceListTo.Code;
                            PriceListDetail priceListDetailTo = ThePriceListDetailMgr.GetLastestPriceListDetail(fd.DefaultPriceListTo, fd.Item, startTime, fd.Flow.Currency, fd.Uom);
                            if (priceListDetailTo != null)
                            {
                                flowDetailProxy.UnitPrice         = priceListDetailTo.UnitPrice;
                                flowDetailProxy.PriceListDetailId = priceListDetailTo.Id;
                            }
                        }
                        flowDetailProxy.PackageVolumn = fd.PackageVolumn;
                    }

                    if (changeRef)
                    {
                        if (fd.ReferenceItemCode != null && fd.ReferenceItemCode != string.Empty)
                        {
                            flowDetailProxy.ItemReferenceCode = fd.ReferenceItemCode;
                        }
                        else
                        {
                            flowDetailProxy.ItemReferenceCode = TheItemReferenceMgr.GetItemReferenceByItem(itemCode, partyToCode, partyFromCode);
                        }
                    }
                    return(flowDetailProxy);
                }
            }
        }

        Item item = TheItemMgr.LoadItem(itemCode);

        if (item != null)
        {
            Flow            flow            = TheFlowMgr.LoadFlow(flowCode);
            FlowDetailProxy flowDetailProxy = new FlowDetailProxy();
            flowDetailProxy.ItemCode        = item.Code;
            flowDetailProxy.ItemDescription = item.Description;
            flowDetailProxy.UomCode         = item.Uom.Code;

            if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT)
            {
                if (flow.PriceListFrom != null)
                {
                    flowDetailProxy.PriceListCode = flow.PriceListFrom.Code;
                    PriceListDetail priceListDetailFrom = ThePriceListDetailMgr.GetLastestPriceListDetail(flow.PriceListFrom, item, startTime, flow.Currency, item.Uom);
                    if (priceListDetailFrom != null)
                    {
                        flowDetailProxy.UnitPrice         = priceListDetailFrom.UnitPrice;
                        flowDetailProxy.PriceListDetailId = priceListDetailFrom.Id;
                    }
                }
            }
            else if (moduleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
            {
                if (flow.PriceListTo != null)
                {
                    flowDetailProxy.PriceListCode = flow.PriceListTo.Code;
                    PriceListDetail priceListDetailTo = ThePriceListDetailMgr.GetLastestPriceListDetail(flow.PriceListTo, item, startTime, flow.Currency, item.Uom);
                    if (priceListDetailTo != null)
                    {
                        flowDetailProxy.UnitPrice         = priceListDetailTo.UnitPrice;
                        flowDetailProxy.PriceListDetailId = priceListDetailTo.Id;
                    }
                }
            }

            if (changeRef)
            {
                flowDetailProxy.ItemReferenceCode = TheItemReferenceMgr.GetItemReferenceByItem(itemCode, partyToCode, partyFromCode);
            }
            flowDetailProxy.UnitCount = item.UnitCount;
            flowDetailProxy.HuLotSize = Convert.ToInt32(item.UnitCount);
            return(flowDetailProxy);
        }

        return(null);
    }