Пример #1
0
 public ActionResult Edit(NoStockType obj)
 {
     try
     {
         NSession.Update(obj);
         NSession.Flush();
         List <NoStockLinkType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <NoStockLinkType> >(obj.rowse);
         NSession.Delete("from NoStockLinkType where PId='" + obj.Id + "'");
         NSession.Flush();
         NSession.Clear();
         foreach (NoStockLinkType link in list1)
         {
             link.OldSKU   = obj.OldSKU;
             link.SKU      = obj.SKU;
             link.PId      = obj.Id;
             link.CreateBy = CurrentUser.Realname;
             link.CreateOn = DateTime.Now;
             NSession.Save(link);
             NSession.Flush();
         }
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = "true" }));
 }
Пример #2
0
 public JsonResult Create(NoStockType obj)
 {
     try
     {
         obj.Enabled  = 1;
         obj.CreateBy = CurrentUser.Realname;
         obj.CreateOn = DateTime.Now;
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
         List <NoStockLinkType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <NoStockLinkType> >(obj.rows);
         foreach (NoStockLinkType link in list1)
         {
             link.OldSKU   = obj.OldSKU;
             link.SKU      = obj.SKU;
             link.PId      = obj.Id;
             link.CreateBy = CurrentUser.Realname;
             link.CreateOn = DateTime.Now;
             NSession.Save(link);
             NSession.Flush();
         }
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = "true" }));
 }
Пример #3
0
        public ActionResult SetSKUCode2(int code)
        {
            IList <SKUCodeType> list =
                NSession.CreateQuery("from SKUCodeType where Code=:p").SetInt32("p", code).SetMaxResults(1).List
                <SKUCodeType>();

            if (list.Count > 0)
            {
                SKUCodeType sku = list[0];
                if (sku.IsOut == 1 || sku.IsSend == 1)
                {
                    return(Json(new { IsSuccess = false, Result = "条码:" + code + " 已经配过货,SKU:" + sku.SKU + " 出库时间:" + sku.PeiOn + ",出库订单:" + sku.OrderNo + " ,请将此产品单独挑出来!" }));
                }
                if (sku.IsScan == 1)
                {
                    return(Json(new { IsSuccess = false, Result = "条码:" + code + " 已经清点扫描了,SKU:" + sku.SKU + " 刚刚已经扫描过了。你查看下是条码重复扫描了,还是有贴重复的了!" }));
                }
                sku.IsScan = 1;
                NSession.Save(sku);
                NSession.Flush();
                object obj =
                    NSession.CreateQuery("select count(Id) from SKUCodeType where SKU=:p and IsScan=1 and IsOut=0").SetString("p", sku.SKU).
                    UniqueResult();
                return(Json(new { IsSuccess = true, Result = "条码:" + code + " 的信息.SKU:" + sku.SKU + " 此条码未出库。条码正确!!!", ccc = sku.SKU + "已经扫描了" + obj + "个" }));
            }
            else
            {
                return(Json(new { IsSuccess = false, Result = "条码:" + code + " 无法找到 ,请查看扫描是否正确!" }));
            }
        }
        public ActionResult ImportPlan(string fileName)
        {
            DataTable             dt   = OrderHelper.GetDataTable(fileName);
            IList <WarehouseType> list = NSession.CreateQuery(" from WarehouseType").List <WarehouseType>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                PurchasePlanType p = new PurchasePlanType {
                    CreateOn = DateTime.Now, BuyOn = DateTime.Now, ReceiveOn = DateTime.Now, SendOn = DateTime.Now
                };
                p.PlanNo        = Utilities.GetPlanNo(NSession);
                p.SKU           = dt.Rows[i]["SKU"].ToString();
                p.Price         = Convert.ToDouble(dt.Rows[i]["单价"].ToString());
                p.Qty           = Convert.ToInt32(dt.Rows[i]["Qty"].ToString());
                p.DaoQty        = 0;
                p.ProductName   = "";
                p.Freight       = Convert.ToDouble(dt.Rows[i]["运费"].ToString());
                p.ProductUrl    = dt.Rows[i]["产品链接"].ToString();
                p.PicUrl        = dt.Rows[i]["图片链接"].ToString();
                p.Suppliers     = dt.Rows[i]["供应商"].ToString();
                p.LogisticsMode = dt.Rows[i]["发货方式"].ToString();
                p.TrackCode     = dt.Rows[i]["追踪码"].ToString();
                p.Status        = dt.Rows[i]["状态"].ToString();
                p.Memo          = dt.Rows[i]["备注"].ToString();

                NSession.Save(p);
                NSession.Flush();
            }
            return(Json(new { IsSuccess = true }));
        }
 public JsonResult Create(MachineType obj)
 {
     try
     {
         if (obj.StartDate < Convert.ToDateTime("2000-01-01"))
         {
             obj.StartDate = Convert.ToDateTime("2000-01-01");
         }
         if (obj.EndDate < Convert.ToDateTime("2000-01-01"))
         {
             obj.EndDate = Convert.ToDateTime("2000-01-01");
         }
         if (obj.BuyDate < Convert.ToDateTime("2000-01-01"))
         {
             obj.BuyDate = Convert.ToDateTime("2000-01-01");
         }
         if (IsCreateOk(obj.Code))
         {
             return(Json(new { errorMsg = "编号已经存在" }));
         }
         NSession.Save(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
        public JsonResult Create(EbayMessageReType obj)
        {
            try
            {
                EbayMessageType ebaymessage = ebay.GetById(obj.MessageId);

                obj.ItemId      = ebaymessage.ItemId;
                obj.EbayId      = ebaymessage.MessageId;
                obj.ReplayBy    = CurrentUser.Realname;
                obj.SenderEmail = ebaymessage.SenderEmail;
                obj.SenderID    = ebaymessage.SenderID;
                obj.Account     = ebaymessage.Shop;
                obj.ReplayOn    = DateTime.Now;
                obj.UploadTime  = Convert.ToDateTime("2000-01-01");
                NSession.Save(obj);
                NSession.Flush();
                ebaymessage.ReplayBy      = obj.ReplayBy;
                ebaymessage.ReplayOn      = obj.ReplayOn;
                ebaymessage.MessageStatus = "已回复";
                NSession.Update(ebaymessage);
                NSession.Flush();
            }
            catch (Exception ee)
            {
                return(Json(new { errorMsg = "出错了" }));
            }
            return(Json(new { IsSuccess = "true" }));
        }
        public JsonResult UpdateRate()
        {
            try
            {
                cn.com.webxml.webservice.ForexRmbRateWebService server = new cn.com.webxml.webservice.ForexRmbRateWebService();
                DataSet ds = server.getForexRmbRate();


                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    CurrencyType c = new CurrencyType();
                    c.CurrencyCode = dr["Symbol"].ToString();
                    c.CurrencyName = dr["Name"].ToString();
                    NSession.Delete(" from CurrencyType where CurrencyCode='" + c.CurrencyCode + "'");
                    NSession.Flush();
                    c.CurrencySign = "";
                    string str = dr["fBuyPrice"].ToString();
                    if (string.IsNullOrEmpty(str))
                    {
                        str = "0";
                    }
                    c.CurrencyValue = Math.Round(Convert.ToDecimal(str) / 100, 5);
                    c.CreateOn      = DateTime.Now;;
                    NSession.Save(c);
                }
            }
            catch (Exception ee)
            {
                return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
            }
            return(Json(new { IsSuccess = true }));
        }
        public JsonResult EditProcessed(int Id)
        {
            EbayMessageType   ebaymessage = ebay.GetById(Id);
            EbayMessageReType obj         = new EbayMessageReType();

            obj.ItemId      = ebaymessage.ItemId;
            obj.EbayId      = ebaymessage.MessageId;
            obj.Account     = ebaymessage.Shop;
            obj.BodyRe      = "";
            obj.ItemId      = ebaymessage.ItemId;
            obj.SenderID    = ebaymessage.SenderID;
            obj.SenderEmail = ebaymessage.SenderEmail;
            obj.EbayId      = ebaymessage.MessageId;
            obj.ReplayBy    = CurrentUser.Realname;
            obj.SenderEmail = ebaymessage.SenderEmail;
            obj.SenderID    = ebaymessage.SenderID;
            obj.Account     = ebaymessage.Shop;
            obj.ReplayOn    = DateTime.Now;
            obj.UploadTime  = Convert.ToDateTime("2000-01-01");
            NSession.Save(obj);
            NSession.Flush();
            ebaymessage.ReplayBy      = CurrentUser.Realname;
            ebaymessage.ReplayOn      = DateTime.Now;
            ebaymessage.MessageStatus = "已回复";
            NSession.Update(ebaymessage);
            NSession.Flush();
            return(Json(new { IsSuccess = "true" }));
        }
Пример #9
0
        public ActionResult SetMP(string a, string m, string p, int uid)
        {
            string[]            ms  = m.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            string[]            ps  = p.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            string[]            fos = a.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            PermissionScopeType sc  = null;

            NSession.CreateQuery("delete from PermissionScopeType where ResourceCategory='" +
                                 ResourceCategoryEnum.User.ToString() + "' and ResourceId=" + uid).ExecuteUpdate();
            foreach (var item in ms)
            {
                if (string.IsNullOrEmpty(item))
                {
                    continue;
                }
                sc = new PermissionScopeType();
                sc.ResourceCategory = ResourceCategoryEnum.User.ToString();
                sc.ResourceId       = uid;
                sc.TargetCategory   = TargetCategoryEnum.Module.ToString();
                sc.TargetId         = Convert.ToInt32(item);
                NSession.Save(sc);
                NSession.Flush();
            }

            foreach (var item in ps)
            {
                if (string.IsNullOrEmpty(item))
                {
                    continue;
                }
                ;
                sc = new PermissionScopeType();
                sc.ResourceCategory = ResourceCategoryEnum.User.ToString();
                sc.ResourceId       = uid;
                sc.TargetCategory   = TargetCategoryEnum.PermissionItem.ToString();
                sc.TargetId         = Convert.ToInt32(item);
                NSession.Save(sc);
                NSession.Flush();
            }
            foreach (var item in fos)
            {
                if (string.IsNullOrEmpty(item))
                {
                    continue;
                }
                ;
                sc = new PermissionScopeType();
                sc.ResourceCategory = ResourceCategoryEnum.User.ToString();
                sc.ResourceId       = uid;
                sc.TargetCategory   = TargetCategoryEnum.Account.ToString();
                sc.TargetId         = Convert.ToInt32(item);
                NSession.Save(sc);
                NSession.Flush();
            }
            return(Json(new { IsSuccess = true }));
        }
        public void AddAreaCountry(string id, int tid)
        {
            NSession.Delete("from LogisticsAreaCountryType where  CountryCode=" + id +
                            " and AreaCode in (select Id from LogisticsAreaType where LId =(select LId from LogisticsAreaType where Id=" +
                            tid + "))");
            NSession.Flush();
            LogisticsAreaCountryType logcountry = new LogisticsAreaCountryType {
                CountryCode = id, AreaCode = tid
            };

            NSession.Save(logcountry);
        }
Пример #11
0
 public JsonResult Create(LogisticsAreaType obj)
 {
     obj.LId = int.Parse(Session["lid"].ToString());
     try
     {
         NSession.Save(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
        public void NoAttend(DateTime LastAttend)
        {
            TimeSpan day = DateTime.Now.Date - LastAttend;

            for (int i = 1; i < day.Days; i++)
            {
                AttendType obj = new AttendType()
                {
                    CurrentDate = DateTime.Now.Date.AddDays(-i), UserId = CurrentUser.Id, UserCode = CurrentUser.Code, RealName = CurrentUser.Realname
                };
                NSession.Save(obj);
                NSession.Flush();
            }
        }
Пример #13
0
 public ActionResult Copy(NewGuideType obj)
 {
     try
     {
         obj.CreateOn = DateTime.Now;
         NSession.Save(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
        public JsonResult PrintSKU(int Id)
        {
            PlanDaoType obj = NSession.Get <PlanDaoType>(Id);

            if (obj != null)
            {
                NSession.Flush();
                IList <PurchasePlanType> plans = NSession.CreateQuery("from PurchasePlanType where PlanNo=:p and SKU=:p2").SetString("p", obj.PlanNo).SetString("p2", obj.SKU).SetMaxResults(1).List <PurchasePlanType>();
                PurchasePlanType         plan  = plans[0];
                IList <SKUCodeType>      list  =
                    NSession.CreateQuery("from SKUCodeType where SKU=:p1 and PlanNo=:p2 and Code >=:p3 order by Id").SetString("p1", obj.SKU).
                    SetString("p2", obj.PlanNo).SetInt32("p3", obj.SKUCode).SetMaxResults(obj.RealQty).List <SKUCodeType>();
                DataTable dt = new DataTable();
                dt.Columns.Add("sku");
                dt.Columns.Add("name");
                dt.Columns.Add("num");
                dt.Columns.Add("date");
                dt.Columns.Add("people");
                dt.Columns.Add("desc");
                dt.Columns.Add("code");
                int i = 1;
                foreach (SKUCodeType skuCodeType in list)
                {
                    DataRow dr = dt.NewRow();
                    dr[0] = plan.SKU;
                    dr[1] = plan.ProductName;
                    dr[2] = i + "/" + obj.RealQty;
                    dr[3] = plan.BuyOn;
                    dr[4] = plan.BuyBy;
                    dr[5] = plan.PlanNo;
                    dr[6] = skuCodeType.Code;
                    dt.Rows.Add(dr);
                    i++;
                }
                DataSet ds = new DataSet();
                ds.Tables.Add(dt);
                if (plan.ExpectReceiveOn < (new DateTime(2000, 1, 1)))
                {
                    plan.ExpectReceiveOn = new DateTime(2000, 1, 1);
                }
                PrintDataType data = new PrintDataType();
                data.Content  = ds.GetXml();
                data.CreateOn = DateTime.Now;
                NSession.Save(data);
                NSession.Flush();
                return(Json(new { IsSuccess = true, Result = data.Id }));
            }
            return(Json(new { IsSuccess = false }));
        }
Пример #15
0
        public JsonResult Create(ProductType obj)
        {
            try
            {
                string filePath = Server.MapPath("~");
                obj.CreateOn = DateTime.Now;
                string pic = obj.PicUrl;
                if (!string.IsNullOrEmpty(pic))
                {
                    obj.PicUrl  = Utilities.BPicPath + obj.SKU + ".jpg";
                    obj.SPicUrl = Utilities.SPicPath + obj.SKU + ".png";

                    Utilities.DrawImageRectRect(pic, filePath + obj.PicUrl, 310, 310);
                    Utilities.DrawImageRectRect(pic, filePath + obj.SPicUrl, 64, 64);
                }

                List <ProductComposeType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ProductComposeType> >(obj.rows);
                if (list1.Count > 0)
                {
                    obj.IsZu = 1;
                }
                obj.Enabled = 1;
                NSession.SaveOrUpdate(obj);
                NSession.Flush();
                foreach (ProductComposeType productCompose in list1)
                {
                    productCompose.SKU = obj.SKU;
                    productCompose.PId = obj.Id;
                    NSession.Save(productCompose);
                    NSession.Flush();
                }
                List <ProductIsInfractionType> list2 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ProductIsInfractionType> >(obj.rows2);
                foreach (ProductIsInfractionType item in list2)
                {
                    item.OldSKU = obj.OldSKU;
                    item.SKU    = obj.SKU;
                    NSession.Save(item);
                    NSession.Flush();
                }

                AddToWarehouse(obj);
                LoggerUtil.GetProductRecord(obj, "商品创建", "创建一件商品", CurrentUser, NSession);
            }
            catch (Exception ee)
            {
                return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
            }
            return(Json(new { IsSuccess = true }));
        }
Пример #16
0
 public JsonResult Create(PlacardType obj)
 {
     try
     {
         obj.CreateOn = DateTime.Now;
         obj.CreateBy = CurrentUser.Realname;
         NSession.Save(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
Пример #17
0
        public ActionResult SetSKUCode(int code, string sku)
        {
            return(Json(new { IsSuccess = false, Result = "此功能作废,请不要这个功能!" }));

            object count = NSession.CreateQuery("select count(Id) from ProductType where SKU='" + sku + "'").UniqueResult();

            sku = sku.Trim();
            SqlConnection conn = new SqlConnection("server=122.227.207.204;database=Feidu;uid=sa;pwd=`1q2w3e4r");
            string        sql  = "select top 1 SKU from SkuCode where Code={0}or Code={1} ";

            conn.Open();
            SqlCommand sqlCommand = new SqlCommand(string.Format(sql, code, (code + 1000000)), conn);
            object     objSKU     = sqlCommand.ExecuteScalar();

            conn.Close();
            if (objSKU != null)
            {
                if (objSKU.ToString().Trim().ToUpper() != sku.Trim().ToUpper())
                {
                    return(Json(new { IsSuccess = false, Result = "这个条码对应是的" + objSKU + ",不是现在的:" + sku + "!" }));
                }
            }

            if (Convert.ToInt32(count) > 0)
            {
                object count1 =
                    NSession.CreateQuery("select count(Id) from SKUCodeType where Code=:p").SetInt32("p", code).
                    UniqueResult();
                if (Convert.ToInt32(count1) == 0)
                {
                    SKUCodeType skuCode = new SKUCodeType {
                        Code = code, SKU = sku, IsNew = 0, IsOut = 0
                    };
                    NSession.Save(skuCode);
                    NSession.Flush();
                    Utilities.StockIn(1, sku, 1, 0, "条码清点入库", CurrentUser.Realname, "", NSession);
                    return(Json(new { IsSuccess = true, Result = "添加成功!" }));
                }
                else
                {
                    return(Json(new { IsSuccess = false, Result = "这个条码已经添加!" }));
                }
            }
            else
            {
                return(Json(new { IsSuccess = false, Result = "没有这个产品!" }));
            }
        }
Пример #18
0
        private void UserLogin()
        {
            string        ip  = GetClientIP();
            string        mac = GetMACByIP(ip);
            UserLoginType obj = new UserLoginType
            {
                UserCode = CurrentUser.Code,
                UserName = CurrentUser.Realname,
                IP       = ip,
                MAC      = mac,
                CreateOn = DateTime.Now
            };

            NSession.Save(obj);
            NSession.Flush();
        }
 public JsonResult Create(LogisticsModeType obj)
 {
     try
     {
         if (IsCreateOk(obj.ParentID, obj.LogisticsCode))
         {
             return(Json(new { errorMsg = "此代码已存在!" }));
         }
         NSession.Save(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
Пример #20
0
        public ActionResult PrintSKU(int Id)
        {
            StockInType obj = NSession.Get <StockInType>(Id);

            if (obj != null)
            {
                NSession.Flush();
                IList <SKUCodeType> list =
                    NSession.CreateQuery("from SKUCodeType where PlanNo='" + obj.Id + "'").
                    List <SKUCodeType>();
                DataTable dt = new DataTable();
                dt.Columns.Add("sku");
                dt.Columns.Add("name");
                dt.Columns.Add("num");
                dt.Columns.Add("date");
                dt.Columns.Add("people");
                dt.Columns.Add("desc");
                dt.Columns.Add("code");
                int i = 1;
                foreach (SKUCodeType skuCodeType in list)
                {
                    DataRow dr = dt.NewRow();
                    dr[0] = obj.SKU;
                    dr[1] = obj.SKU;
                    dr[2] = i + "/" + obj.Qty;
                    dr[3] = obj.CreateOn;
                    dr[4] = obj.CreateBy;
                    dr[5] = "手动入库";
                    dr[6] = skuCodeType.Code;
                    dt.Rows.Add(dr);
                    i++;
                }
                DataSet ds = new DataSet();
                ds.Tables.Add(dt);

                PrintDataType data = new PrintDataType();
                data.Content  = ds.GetXml();
                data.CreateOn = DateTime.Now;
                NSession.Save(data);
                NSession.Flush();
                return(Json(new { IsSuccess = true, Result = data.Id }));
            }
            return(Json(new { IsSuccess = false }));
        }
 public JsonResult Create(ProjectType obj)
 {
     try
     {
         if (obj.RealEndDate < Convert.ToDateTime("2000-01-01"))
         {
             obj.RealEndDate = Convert.ToDateTime("2000-01-01");
         }
         obj.CreateOn = DateTime.Now;
         obj.CreateBy = CurrentUser.Realname;
         NSession.Save(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
 public JsonResult Create(PurchaseTroubleType obj)
 {
     try
     {
         obj.CreateBy = CurrentUser.Realname;
         obj.CreateOn = DateTime.Now;
         obj.DealOn   = Convert.ToDateTime("2000-01-01");
         NSession.Save(obj);
         NSession.Flush();
         PurchasePlanController a  = new PurchasePlanController();
         PurchasePlanType       pu = a.GetById(obj.PurchaseId);
         LoggerUtil.GetPurchasePlanRecord(pu, "采购问题", "采购出现问题:" + obj.TroubleDetail, CurrentUser, NSession);
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = "true" }));
 }
Пример #23
0
 public JsonResult Create(SupplierType obj)
 {
     try
     {
         List <SuppliersProductType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <SuppliersProductType> >(obj.rows);
         NSession.Save(obj);
         NSession.Flush();
         foreach (SuppliersProductType product in list1)
         {
             product.SId = obj.Id;
             NSession.Save(product);
             NSession.Flush();
         }
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
Пример #24
0
        public ActionResult EditStatus(string p, string s)
        {
            List <ProductType> products =
                NSession.CreateQuery("from ProductType where Id in(" + p + ")").List <ProductType>().ToList();

            foreach (ProductType productType in products)
            {
                productType.Status = s;
                NSession.Update(productType);
                NSession.Flush();
                LoggerUtil.GetProductRecord(productType, "订单产品属性修改",
                                            "产品:" + productType.SKU + "状态修改为“" + s + "”",
                                            CurrentUser, NSession);
                if (s == "停产")
                {
                    int              count      = 0;
                    string           orderid    = "";
                    List <OrderType> orderTypes =
                        NSession.CreateQuery(
                            "from OrderType where Id in(select OId from OrderProductType where SKU='" + productType.SKU + "') and Status='已处理' and Enabled=1")
                        .List <OrderType>().ToList();
                    foreach (OrderType orderType in orderTypes)
                    {
                        orderType.IsStop = 1;
                        NSession.Update(orderType);
                        NSession.Flush();
                        LoggerUtil.GetOrderRecord(orderType, "订单产品属性修改",
                                                  "产品:" + productType.SKU + "状态修改为“" + s + "”,同时订单属性设置为停售订单", CurrentUser, NSession);
                        orderid += orderType.OrderNo + "  ";
                        count++;
                    }
                    NSession.CreateQuery("update OrderProductType set IsQue=2 where SKU='" + productType.SKU + "'").UniqueResult();
                    PlacardType placard = new PlacardType {
                        CardType = "产品", Title = productType.SKU + " 停产", Content = "相关" + count + "条订单编号: " + orderid, CreateBy = "系统自动", CreateOn = DateTime.Now, IsTop = 1
                    };
                    NSession.Save(placard);
                    NSession.Flush();
                }
            }
            return(Json(new { IsSuccess = true }));
        }
        private void SaveSupplier(PurchasePlanType obj)
        {
            object exit = NSession.CreateQuery("from SupplierType where SuppliersName='" + obj.Suppliers + "'").UniqueResult();

            if (exit == null)
            {
                SupplierType super = new SupplierType
                {
                    SuppliersName = obj.Suppliers
                };
                NSession.Save(super);
                NSession.Flush();
                SuppliersProductType product = new SuppliersProductType
                {
                    SId   = super.Id,
                    SKU   = obj.SKU,
                    Price = obj.Price,
                    Web   = obj.ProductUrl
                };
                NSession.Save(product);
                NSession.Flush();
            }
            else
            {
                IList <SupplierType> list = NSession.CreateQuery("from SupplierType where SuppliersName='" + obj.Suppliers + "'").List <SupplierType>();
                object productexit        = NSession.CreateQuery("from SuppliersProductType where SId='" + list[0].Id + "' and SKU='" + obj.SKU + "' ").UniqueResult();
                if (productexit == null)
                {
                    SuppliersProductType product = new SuppliersProductType
                    {
                        SId   = list[0].Id,
                        SKU   = obj.SKU,
                        Price = obj.Price,
                        Web   = obj.ProductUrl
                    };
                    NSession.Save(product);
                    NSession.Flush();
                }
            }
        }
Пример #26
0
        public JsonResult ReturnOrder(string o, string p)
        {
            List <OrderType> orders =
                NSession.CreateQuery("from OrderType where OrderNo='" + o + "'").List <OrderType>().ToList();

            if (orders.Count > 0)
            {
                OrderType order = orders[0];
                order.Status    = OrderStatusEnum.退货订单.ToString();
                order.BuyerMemo = p + "  " + order.BuyerMemo;
                NSession.Update(order);
                NSession.Flush();
                OrderReturnRecordType record = new OrderReturnRecordType();
                record.Account             = order.Account;
                record.Platform            = order.Platform;
                record.ReturnLogisticsMode = order.LogisticMode;
                record.OrderExNO           = order.OrderExNo;
                record.OrderNo             = order.OrderNo;
                record.OrderSendOn         = order.ScanningOn;
                record.ReturnType          = p;
                record.OldTrackCode        = order.TrackCode;
                record.CreateOn            = DateTime.Now;
                record.Country             = order.Country;
                record.CurrencyCode        = order.CurrencyCode;
                record.Amount        = order.Amount;
                record.BuyerName     = order.BuyerName;
                record.OrderCreateOn = order.CreateOn;
                record.OId           = order.Id;


                NSession.Save(record);
                NSession.Flush();

                LoggerUtil.GetOrderRecord(order, "订单退货扫描!", "订单设置为退货", CurrentUser, NSession);

                return(Json(new { IsSuccess = true, Result = "订单:" + order.OrderNo + "  已经添加到退货~!" }));
            }
            return(Json(new { IsSuccess = false, Result = "找不到该订单" }));
        }
Пример #27
0
        public JsonResult EmailRe(EmailReturnType obj)
        {
            try
            {
                DateTime ReTime = DateTime.Now;
                SendMail(obj.REmail, obj.Subject, obj.Content);
                obj.CreateOn = ReTime;
                obj.CreateBy = ReTime;

                NSession.Save(obj);
                IList <EmailType> mail = NSession.CreateQuery("from EmailType c where c.Id=:id").SetInt32("id", obj.EId).List <EmailType>();
                mail[0].IsReply = 1;
                mail[0].ReplyOn = ReTime;
                NSession.Update(mail[0]);
                NSession.Flush();
            }
            catch (Exception ee)
            {
                return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
            }
            return(Json(new { IsSuccess = true }));
        }
Пример #28
0
        public void SaveAmount(DisputeType obj)
        {
            RefundAmountType amount = new RefundAmountType
            {
                DId           = obj.Id,
                OrderNo       = obj.OrderNo,
                OrderExNo     = obj.OrderExNo,
                Platform      = obj.Platform,
                Account       = obj.Account,
                Amount        = obj.Amount,
                CreateBy      = CurrentUser.Realname,
                CreateOn      = DateTime.Now,
                EmailAccount  = obj.EmailAccount,
                TransactionNo = obj.TransactionNo,
                Status        = "未审核",
                AmountType    = obj.AmountType,
                AuditOn       = Convert.ToDateTime("2000-01-01")
            };

            NSession.Save(amount);
            NSession.Flush();
        }
Пример #29
0
        public ActionResult Edit(ProductType obj)
        {
            try
            {
                string str = "";
                obj.Enabled = 1;
                ProductType obj2 = GetById(obj.Id);
                List <ProductComposeType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ProductComposeType> >(obj.rows);
                List <ProductComposeType> pis   = NSession.CreateQuery("from ProductComposeType where SKU='" + obj.SKU + "'").List <ProductComposeType>().ToList <ProductComposeType>();
                if (list1.Count != pis.Count)
                {
                    str += "组合产品由<br>";
                    foreach (var item in pis)
                    {
                        str += Zu(item);
                    }
                    str += "修改为<br> ";
                    foreach (var item in list1)
                    {
                        str += Zu(item);
                    }
                    str += "<br>";
                }
                else
                {
                    foreach (var item in pis)
                    {
                        int check = 0;
                        foreach (var it in list1)
                        {
                            if (it.SrcSKU == item.SrcSKU && it.SrcQty == item.SrcQty)
                            {
                                check = 1;
                            }
                        }
                        if (check != 1)
                        {
                            str += "组合产品由<br>";
                            foreach (var zu in pis)
                            {
                                str += Zu(zu);
                            }
                            str += "修改为<br> ";
                            foreach (var zu in list1)
                            {
                                str += Zu(zu);
                            }
                            str += "<br>";
                        }
                    }
                }
                NSession.Delete("from ProductComposeType where SKU='" + obj.SKU + "'");
                NSession.Flush();
                NSession.Clear();
                foreach (ProductComposeType productCompose in list1)
                {
                    productCompose.SKU = obj.SKU;
                    productCompose.PId = obj.Id;
                    NSession.Save(productCompose);
                    NSession.Flush();
                    NSession.Clear();
                    obj.IsZu = 1;
                }

                str += Utilities.GetObjEditString(obj2, obj) + "<br>";
                List <ProductIsInfractionType> list2 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ProductIsInfractionType> >(obj.rows2);
                foreach (ProductIsInfractionType item in list2)
                {
                    IList <ProductIsInfractionType> qin = NSession.CreateQuery("from ProductIsInfractionType where SKU='" + obj.SKU + "' and Platform='" + item.Platform + "'").List <ProductIsInfractionType>();
                    if (qin.Count != 0)
                    {
                        foreach (var s in qin)
                        {
                            if (item.Isinfraction != s.Isinfraction)
                            {
                                str += item.Platform + "是否侵权由" + s.Isinfraction + "修改为" + item.Isinfraction + "<br>";
                            }
                        }
                    }
                }
                NSession.Delete("from ProductIsInfractionType where SKU='" + obj.SKU + "'");
                NSession.Flush();
                NSession.Clear();
                foreach (ProductIsInfractionType item in list2)
                {
                    item.OldSKU = obj.OldSKU;
                    item.SKU    = obj.SKU;
                    NSession.Save(item);
                    NSession.Flush();
                    NSession.Clear();
                }
                NSession.Update(obj);
                NSession.Flush();
                NSession.Clear();

                //修改库存中的数据
                IList <WarehouseStockType> list = NSession.CreateQuery(" from WarehouseStockType where PId=" + obj.Id).List <WarehouseStockType>();
                //
                //在仓库中添加产品库存
                //
                if (list.Count > 0)
                {
                    foreach (var item in list)
                    {
                        item.Pic      = obj.SPicUrl;
                        item.SKU      = obj.SKU;
                        item.Title    = obj.ProductName;
                        item.UpdateOn = DateTime.Now;
                        NSession.Update(item);
                        NSession.Flush();
                    }
                }
                else
                {
                    AddToWarehouse(obj);
                }
                LoggerUtil.GetProductRecord(obj, "商品修改", str, CurrentUser, NSession);
            }
            catch (Exception ee)
            {
                return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
            }
            return(Json(new { IsSuccess = true }));
        }
Пример #30
0
        public ActionResult SetPrintData(string m, string r, string d, string t)
        {
            d = d.Replace("\r", "").Replace("\n", ",");
            IList <OrderType> objectses = NSession.CreateQuery("from OrderType where IsAudit=0 and OrderNo IN('" +
                                                               d.Replace(",", "','") + "')").List <OrderType>();
            string NotPrint = "";

            foreach (OrderType c in objectses)
            {
                NotPrint += c.OrderNo + " ;";
            }
            string sql = "";

            sql = @"select (select COUNT(1) from OrderProducts where OrderProducts.OId=O.id) as 'GCount',O.IsPrint as 'PCount' ,O.Id,O.OrderNo,o.OrderExNo,O.Account,O.Platform,O.Amount,O.CurrencyCode,O.BuyerEmail,O.BuyerName,O.LogisticMode,O.IsSplit,O.IsRepeat,O.IsAudit,
O.BuyerMemo,O.SellerMemo,O.CreateOn,O.Freight,O.Weight,O.TrackCode,O.Country,OA.Addressee,OA.Street,OA.County,OA.City,OA.Province,
OA.Phone,OA.Tel,OA.PostCode,OA.CountryCode,OP.SKU,OP.Standard,OP.Remark,OP.Title,OP.Qty,OP.ExSKU,P.OldSKU,P.Category,P.SPicUrl,P.OldSKU,P.Location,P.ProductName,
R.RetuanName ,R.City as 'RCity',R.Street as 'RStreet',R.Phone as 'RPhone',R.Tel as 'RTel',R.County as 'RCounty',(select top 1 CCountry from Country where ECountry=O.Country) as CCountry,O.GenerateOn,
R.Country as 'RCountry',R.PostCode as 'RPostCode',R.Province as 'RProvince' from Orders O 
left join OrderProducts OP on o.Id=op.OId
left join OrderAddress OA on o.AddressId=oa.Id
Left Join Products P ON OP.SKU=P.SKU
left join ReturnAddress R On r.Id=" + r;


            //2013.9.22 添加 sal不打印,直接硬编码.--> 看后期是否可以变成过滤模块吧,
            sql += " where O.IsAudit=1 and  O.OrderNo IN('" + d.Replace(",", "','") + "') and O.LogisticMode not like '%sal%' and O.Account not in ('wunderschoen_dream')";
            DataSet    ds      = new DataSet();
            IDbCommand command = NSession.Connection.CreateCommand();

            command.CommandText = sql;
            SqlDataAdapter da = new SqlDataAdapter(command as SqlCommand);

            da.Fill(ds);
            ds.Tables[0].DefaultView.Sort = " OrderNo Asc";
            if (t == "多物品订单")
            {
                ds.Tables[0].DefaultView.RowFilter = " GCount >1";
            }
            else
            {
                List <string> list = new List <string>();
                DataTable     dt1  = ds.Tables[0];
                foreach (DataRow dr in dt1.Rows)
                {
                    if (list.Contains(dr["OrderNo"].ToString()))
                    {
                        dr.Delete();
                    }
                    else
                    {
                        list.Add(dr["OrderNo"].ToString());
                    }
                }
                ds.Tables[0].DefaultView.Sort = " OrderNo Asc";
            }
            DataTable dt = ds.Tables[0].DefaultView.ToTable();

            dt.Columns.Add("PrintName");
            dt.Columns.Add("AreaName");

            List <string> list2 = new List <string>();

            foreach (DataRow dr in dt.Rows)
            {
                dr["PrintName"] = CurrentUser.Realname;
                if (dr["LogisticMode"].ToString() == "BLS")
                {
                    dr["TrackCode"] = "1372100" + dr["OrderNo"].ToString();
                }

                object obj = NSession.CreateSQLQuery("select top 1 AreaName from [LogisticsArea] where LId = (select top 1 ParentID from LogisticsMode where LogisticsCode='" + dr["LogisticMode"] + "')  and Id =(select top 1 AreaCode from LogisticsAreaCountry where [LogisticsArea].Id=AreaCode  and CountryCode in (select ID from Country where ECountry='" + dr["Country"] + "') )").UniqueResult();
                dr["AreaName"] = obj;
                if (list2.Contains(dr["OrderNo"].ToString()))
                {
                }
                else
                {
                    LoggerUtil.GetOrderRecord(Convert.ToInt32(dr["Id"]), dr["OrderNo"].ToString(), "订单打印", CurrentUser.Realname + "订单打印!", CurrentUser, NSession);
                    list2.Add(dr["OrderNo"].ToString());
                }
            }
            //标记打印
            NSession.CreateQuery("update OrderType set IsPrint=IsPrint+1 where  IsAudit=1 and  OrderNo IN('" + d.Replace(",", "','") + "') and LogisticMode not like '%sal%'").ExecuteUpdate();
            ds.Tables.Clear();
            ds.Tables.Add(dt);
            if (NotPrint != "")
            {
                NotPrint = "有" + objectses.Count + "条订单没有审核,无法发打印,订单号:" + NotPrint;
            }
            PrintDataType data = new PrintDataType();

            data.Content  = ds.GetXml();
            data.CreateOn = DateTime.Now;
            NSession.Save(data);
            NSession.Flush();
            return(Json(new { IsSuccess = true, Result = data.Id }));
        }