Example #1
0
 //check update luu kho
 public string IsUpdateStoreJP(StorageJP store)
 {
     try
     {
         string s = "";
         if (store.StatusId == 8)
         {
             if (store.Weigh == null || store.Weigh == 0)
             {
                 s = "Vui lòng cập nhật khối lượng";
             }
             if (store.SizeTableId == null && store.SizeInput == null)
             {
                 s = (s == "" ? "Vui lòng cập nhật kích thước" : s + ",kích thước");
             }
             if (store.Image == null || store.Image == "")
             {
                 s = (s == "" ? "Vui lòng cập nhật hình ảnh" : s + ",hình ảnh");
             }
             return(s);
         }
         else
         {
             return("");
         }
     }
     catch { }
     return("Vui lòng cập nhật khối lượng, kích thước, hình ảnh.");
 }
Example #2
0
        //Storage - luu kho
        public SelectListItem StatusJP(StorageJP store, bool flag = false)
        {
            var result = new SelectListItem()
            {
                Value = "1",
                Text  = "<ul class='export-return'><li></li></ul>"
            };

            try
            {
                int i = 0;
                foreach (var item in store.TrackingDetails.Where(n => n.TrackingSubCode != "21"))
                {
                    if (db.ExportGoodDetails.Where(n => n.ExportGood.AgencyId == user.Agency.Id).Where(n => n.TrackingDetailId == item.Id).Count() > 0)
                    {
                        i++;
                    }
                }
                var export = store.TrackingDetails.Where(n => n.TrackingSubCode != "21").Count();
                return(result = new SelectListItem()
                {
                    Value = "2",
                    Text = "<ul class='export-return'><li>" + i + "/" + export + "</li></ul>"
                });
            }
            catch
            {
                return(result);
            }
        }
Example #3
0
 public string AlowEditStoreJP(StorageJP model)
 {
     try
     {
         //kiem tra co xuat kho khong?
         string s = "";
         var    trackingDetails = model.TrackingDetails;
         var    exportDetails   = db.ExportGoodDetails.Where(n => n.ExportGood.AgencyId == user.Agency.Id);
         foreach (var item in trackingDetails)
         {
             if (exportDetails.Where(n => n.TrackingDetailId == item.Id).Count() > 0)
             {
                 s = "Đang có liên kết với kiện xuất kho"; break;
             }
         }
         //kiem tra co tra hang khong?
         var returnPackages = db.ReturnDetails.Where(n => n.PackageReturn.AgencyId == user.Agency.Id);
         foreach (var item in trackingDetails)
         {
             if (returnPackages.Where(n => n.TrackingDetailId == item.Id).Count() > 0)
             {
                 s = (s == "") ? "Đang có liên kết với kiện trả hàng" : "Đang có liên kết với kiện xuất kho, trả hàng";
                 break;
             }
         }
         return(s);
     }
     catch { }
     return("");
 }
Example #4
0
        public SelectListItem StatusReturnJP(StorageJP store, bool flag = false)
        {
            var result = new SelectListItem()
            {
                Value = "1",
                Text  = "<ul class='export-return'><li></li></ul>"
            };

            try
            {
                int j = 0;
                //dem tracking co trong kien tra hang hay chua
                foreach (var item in store.TrackingDetails.Where(n => n.TrackingSubCode == "21"))
                {
                    if (db.ReturnDetails.Where(n => n.PackageReturn.AgencyId == user.Agency.Id).Where(n => n.TrackingDetailId == item.Id).Count() > 0)
                    {
                        j++;
                    }
                }
                var returnPackage = store.TrackingDetails.Where(n => n.TrackingSubCode == "21").Count();
                return(result = new SelectListItem()
                {
                    Value = "2",
                    Text = "<ul class='export-return'><li>" + j + "/" + returnPackage + "</li></ul>"
                });
            }
            catch
            {
                return(result);
            }
        }
Example #5
0
        //gereral chuyen hang
        public GeneralShipping GeneralShipping(StorageJP model)
        {
            GeneralShipping result        = new Models.GeneralShipping();
            var             details       = model.TrackingDetails;
            var             exports       = db.ExportGoodDetails.Where(n => n.ExportGood.AgencyId == model.AgencyId);
            var             shippinghawbs = db.ShippingHAWBDetails.Where(n => n.AgencyId == model.AgencyId);
            var             shipping      = new Shipping();
            bool            flag          = false;

            foreach (var item in details)
            {
                if (exports.Where(n => n.TrackingDetailId == item.Id).Count() > 0)
                {
                    var export = exports.Where(n => n.TrackingDetailId == item.Id).First().ExportGood;
                    if (shippinghawbs.Where(n => n.ExportGoodId == export.Id).Count() > 0)
                    {
                        shipping = shippinghawbs.Where(n => n.ExportGoodId == export.Id).First().ShippingHAWB.Shipping;
                        flag     = true;
                        break;
                    }
                }
            }
            if (flag)
            {
                result = new Models.GeneralShipping()
                {
                    ShippingCode = shipping.ShippingCode,
                    Status       = PackageStatus(shipping.StatusId.Value, 5),
                };
            }

            return(result);
        }
Example #6
0
        //general xuat kho
        public GeneralExportGood GeneralExportGood(StorageJP model)
        {
            GeneralExportGood result = new Models.GeneralExportGood();
            var  details             = model.TrackingDetails;
            var  exports             = db.ExportGoodDetails.Where(n => n.ExportGood.AgencyId == model.AgencyId);
            var  export = new ExportGood();
            bool flag   = false;

            foreach (var item in details)
            {
                if (exports.Where(n => n.TrackingDetailId == item.Id).Count() > 0)
                {
                    export = exports.Where(n => n.TrackingDetailId == item.Id).First().ExportGood;
                    flag   = true;
                    break;
                }
            }
            if (flag)
            {
                result = new Models.GeneralExportGood()
                {
                    ShippingMask = export.ShippingMarkVN,
                    Size         = DisplaySize(export.Weigh, export.SizeInput, export.SizeTableId, export.Size),
                    Status       = PackageStatus(export.StatusId.Value, 3),
                    Weigh        = export.Weigh == null ? 0 : export.Weigh.Value
                };
            }
            return(result);
        }
Example #7
0
        public int CheckItemStoreJPCountByOneColumn(StorageJP items, string type = "nameen")
        {
            int count = 0;

            foreach (var item in items.StorageItemJPs)
            {
                count += CheckItemCountOneColumn(item, type);
            }
            return(count);
        }
Example #8
0
        public int CheckItemStoreJPCount(StorageJP items)
        {
            int count = 0;

            foreach (var item in items.StorageItemJPs)
            {
                count += CheckItemCount(item);
            }
            return(count);
        }
Example #9
0
        public GeneralRelation GeneralRelation(StorageJP model)
        {
            GeneralRelation result = new Models.GeneralRelation();

            result.GeneralExportGood = new Models.GeneralExportGood();
            result.GeneralExportGood = GeneralExportGood(model);

            result.GeneralShipping = new Models.GeneralShipping();
            result.GeneralShipping = GeneralShipping(model);

            result.GeneralReturn = new Models.GeneralReturn();
            result.GeneralReturn = GeneralReturn(model);

            return(result);
        }
Example #10
0
        //gereral tra hang
        public GeneralReturn GeneralReturn(StorageJP model)
        {
            GeneralReturn result        = new Models.GeneralReturn();
            var           returnDetails = db.ReturnDetails.Where(n => n.PackageReturn.AgencyId == model.AgencyId).Where(n => n.StoregeJPId == model.Id);

            if (returnDetails.Count() > 0)
            {
                var item = returnDetails.First();
                result = new Models.GeneralReturn()
                {
                    ReturnCode = item.PackageReturn.ReturnCode,
                    Status     = PackageStatus(item.PackageReturn.StatusId.Value, 6)
                };
            }
            return(result);
        }
Example #11
0
 public string Address(StorageJP item)
 {
     if (item.DeliveryAddress == null || item.DeliveryAddress == "")
     {
         return("");
     }
     else
     {
         string id = item.DeliveryAddress.Split(',')[0];
         if (id != "")
         {
             var gid = Guid.Parse(id);
             return(db.DeliveryAddresses.Find(gid).DeliveryCode);
         }
         else
         {
             return("");
         }
     }
 }