Exemplo n.º 1
0
        public static void NotifyGIN(Guid truckId)
        {
            IGINProcess    ginProcess     = GetGINProcess(true);
            ILookupSource  lookup         = ginProcess.LookupSource;
            GINProcessInfo ginProcessInfo = ginProcess.GINProcessInformation;
            GINTruckInfo   truck          = (from trk in ginProcessInfo.Trucks where trk.TruckId == truckId select trk).Single();

            ECXCD.WR wr = new WarehouseApplication.ECXCD.WR();
            wr.SaveGIN(
                truck.GIN.GINId,
                truck.GIN.GINNo,
                ginProcessInfo.PickupNoticeId,
                Convert.ToDouble(truck.GIN.GrossWeight),
                Convert.ToDouble(truck.GIN.NetWeight),
                Convert.ToDouble(truck.GIN.Quantity),
                truck.GIN.DateIssued,
                truck.GIN.SignedByClient,
                truck.GIN.DateApproved,
                truck.GIN.ApprovedBy,
                truck.Load.Remark + Environment.NewLine + truck.Weight.Remark,
                lookup.GetLookup("GINStatus")[truck.GIN.Status]);
        }
Exemplo n.º 2
0
        public bool Save()
        {
            bool isSaved = false;

            try
            {
                if (this.CommodityGradeId == Guid.Empty)
                {
                    throw new Exception("Commodity Grade Can't be empty");
                }
                WarehouseApplication.ECXCD.WR mywarehouse = new WarehouseApplication.ECXCD.WR();
                isSaved = mywarehouse.SaveWareHouseReciept(this.GRNId, this.GRNNumber, this.CommodityGradeId, this.WarehouseId, this.BagTypeId,
                                                           this.VoucherId, this.UnloadingId, this.ScalingId, this.GradingId, this.SampleTicketId, this.DateDeposited, this.DateApproved, this.GRN_Status, this.GrossWeight,
                                                           (float)((Math.Round(this.NetWeight * 10000)) / 10000), (float)(Math.Round(this.OriginalQuantity * 10000, 0)) / 10000, (float)(Math.Round(this.CurrentQuantity * 10000, 0)) / 10000, DepositTypeId, Source, NetWeightAdjusted, this.CreatedBy, this.CreatedTimestamp,
                                                           this.ClientId, this.NoBags, this.ProductionYear, this.GRNType);
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to Create Warehouse Reciept", ex);
            }
            return(isSaved);
        }
Exemplo n.º 3
0
 public static void UpdatePUNStatus(Guid pickupNoticeId, string punStatus)
 {
     ECXCD.WR wr = new WarehouseApplication.ECXCD.WR();
     wr.UpdatePUNStatus(pickupNoticeId, punStatus);
 }
Exemplo n.º 4
0
 public static bool RequestCancel(Guid GRNId, string TrackingNo, string Remark)
 {
     WarehouseApplication.ECXCD.WR o = new WarehouseApplication.ECXCD.WR();
     return(o.RequestWHRCancel(GRNId, UserBLL.GetCurrentUser(), Remark, TrackingNo));
 }
Exemplo n.º 5
0
        public static void CachePickupNotices()
        {
            List <Guid> cachedPunIds = new List <Guid>();

            ECXCD.WR wr = new WarehouseApplication.ECXCD.WR();
            List <ECXCD.CPickUpNotice> importedPuns = new List <WarehouseApplication.ECXCD.CPickUpNotice>(wr.GetPun());
            int importedPunsCount = importedPuns.Count;

            if (importedPunsCount == 0)
            {
                return;
            }
            List <PickupNoticeInformation> cachedPuns = new List <PickupNoticeInformation>(
                from ipun in importedPuns
                where ipun.WarehouseId == new Guid(StaticLookupSource.GetLookup("CurrentWarehouse")["Id"])
                select new PickupNoticeInformation()
            {
                ClientId           = ipun.ClientId,
                MemberId           = ipun.MemberId,
                RepId              = ipun.RepId,
                CommodityGradeId   = ipun.CommodityGradeId,
                ProductionYear     = ipun.ProductionYear,
                ExpectedPickupDate = ipun.ExpectedPickupDate,
                ExpirationDate     = ipun.ExpirationDate,
                PickupNoticeId     = ipun.PickupNoticeId,
                WarehouseId        = ipun.WarehouseId,
                Quantity           = ipun.Quantity,
                Weight             = ipun.Weight,
                Status             = 0
            });
            int cachedPunsCount = cachedPuns.Count;
            Dictionary <string, object> contextParameters = new Dictionary <string, object>();

            contextParameters.Add("CurrentUser", new Guid(SystemLookup.LookupSource.GetLookup("CurrentUser")["Id"]));
            cachedPuns.ForEach(
                delegate(PickupNoticeInformation pun)
            {
                pun.PickupNoticeAgents.AddRange(
                    from ipun in importedPuns
                    where ipun.PickupNoticeId == pun.PickupNoticeId
                    from ipuna in ipun.PickupNoticeAgents
                    select new PickupNoticeInformation.PickupNoticeAgentInformation()
                {
                    AgentName      = ipuna.AgentName,
                    AgentTel       = ipuna.AgentTel,
                    Id             = Guid.NewGuid(),
                    NIDNumber      = ipuna.NIDNumber,
                    NIDType        = ipuna.NIDType,
                    PickupNoticeId = ipuna.PickupNoticeId,
                    Status         = ipuna.Status
                });
                pun.WarehouseReceipts.AddRange(
                    from ipun in importedPuns
                    where ipun.PickupNoticeId == pun.PickupNoticeId
                    from iwr in ipun.WarehouseReciepts
                    select new PickupNoticeInformation.WarehouseReceiptInformation()
                {
                    Bags               = iwr.Bags,
                    BagType            = iwr.BagType,
                    GRNID              = iwr.GRNID,
                    GRNNo              = iwr.GRNNo,
                    Id                 = iwr.Id,
                    PickupNoticeId     = iwr.PickupNoticeId,
                    Quantity           = Convert.ToDecimal(iwr.Quantity),
                    ShedId             = iwr.ShedId,
                    WarehouseReceiptId = iwr.WarehouseRecieptId,
                    Weight             = Convert.ToDecimal(iwr.Weight)
                });

                Queue <object[]> queue = new Queue <object[]>();
                queue.Enqueue(new object[] { pun, "spImportPUN" });

                pun.PickupNoticeAgents.ForEach(puna => queue.Enqueue(new object[] { puna, "spImportPUNAgent" }));
                pun.WarehouseReceipts.ForEach(wrct => queue.Enqueue(new object[] { wrct, "spImportWarehouseReceipt" }));

                SqlTransaction transaction = null;
                try
                {
                    transaction = PersistenceTransactionFactory.CreatePersistenceTransaction().Persist(queue, contextParameters);
                    transaction.Commit();
                    cachedPunIds.Add(pun.PickupNoticeId);
                }
                catch (Exception ex)
                {
                    try
                    {
                        if (transaction != null)
                        {
                            transaction.Rollback();
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            });
            wr.AcknowledgePuns(cachedPunIds.ToArray());
        }