Exemplo n.º 1
0
 public ActionResult Add([ModelBinder(typeof(JsonBinder<LocationEntity>))] LocationEntity entity)
 {
     LocationProvider provider = new LocationProvider();
     if (entity.LocalNum.IsEmpty())
     {
         entity.LocalNum = SequenceProvider.GetSequence(typeof(LocationEntity));
         entity.LocalBarCode = entity.LocalBarCode.IsEmpty() ? entity.LocalNum : entity.LocalBarCode;
         entity.IsForbid = (int)EBool.No;
         entity.IsDelete = (int)EIsDelete.NotDelete;
         entity.UnitNum = "";
         entity.UnitName = "";
         entity.CreateTime = DateTime.Now;
         int line = provider.Add(entity);
         if (line > 0)
         {
             this.ReturnJson.AddProperty("d", "success");
         }
     }
     else
     {
         entity.LocalBarCode = entity.LocalBarCode.IsEmpty() ? entity.LocalNum : entity.LocalBarCode;
         entity.Include(a => new { a.LocalName, a.LocalBarCode, a.StorageNum, a.LocalType, a.IsDefault });
         entity.Where(a => a.LocalNum == entity.LocalNum);
         int line = provider.Update(entity);
         if (line > 0)
         {
             this.ReturnJson.AddProperty("d", "success");
         }
     }
     return Content(this.ReturnJson.ToString());
 }
Exemplo n.º 2
0
 /// <summary>
 /// 库位
 /// </summary>
 /// <param name="roleNum"></param>
 /// <returns></returns>
 public static string GetLocalNumList(string storeNum, string localNum)
 {
     LocationProvider provider = new LocationProvider();
     List<LocationEntity> list = provider.GetList();
     list = list.Where(a => a.StorageNum == storeNum).ToList();
     StringBuilder sb = new StringBuilder();
     string storeTemplate = "<option value='{0}' {1}>{2}</option>";
     if (!list.IsNullOrEmpty())
     {
         foreach (LocationEntity store in list)
         {
             sb.AppendFormat(storeTemplate, store.LocalNum, store.LocalNum == localNum ? "selected='selected'" : string.Empty, store.LocalName);
         }
     }
     return sb.ToString();
 }
Exemplo n.º 3
0
 /// <summary>
 /// 获得某个仓库中某种类型的仓库列表
 /// </summary>
 /// <param name="storeNum">仓库编号</param>
 /// <param name="localType">库位类型</param>
 /// <param name="localNum">选中库位编号</param>
 /// <returns></returns>
 public static string GetLocalNum(string storeNum, ELocalType localType, string localNum)
 {
     LocationProvider provider = new LocationProvider();
     List<LocationEntity> list = provider.GetList();
     StringBuilder sb = new StringBuilder();
     if (!list.IsNullOrEmpty())
     {
         string storeTemplate = "<option value='{0}' {1}>{2}</option>";
         sb.AppendFormat(storeTemplate,"","","请选择库位");
         foreach (LocationEntity entity in list.Where(a=>a.StorageNum==storeNum && a.LocalType==(int)localType))
         {
             sb.AppendFormat(storeTemplate, entity.LocalNum, entity.LocalNum == localNum ? "selected='selected'" : string.Empty, entity.LocalName);
         }
     }
     return sb.ToString();
 }
Exemplo n.º 4
0
        public ActionResult AddProduct()
        {
            string ProductNum = WebUtil.GetFormValue<string>("SnNum", string.Empty);
            string BarCode = WebUtil.GetFormValue<string>("BarCode", string.Empty);
            string ProductName = WebUtil.GetFormValue<string>("ProductName", string.Empty);
            string BatchNum = WebUtil.GetFormValue<string>("ProductBatch", string.Empty);
            string LocalNum = WebUtil.GetFormValue<string>("LocalNum", string.Empty);
            string Size = WebUtil.GetFormValue<string>("Size", string.Empty);
            double LocalQty = WebUtil.GetFormValue<double>("LocalQty", 0);
            double Num = WebUtil.GetFormValue<double>("Num", 0);
            double InPrice = WebUtil.GetFormValue<double>("Price", 0);

            InStorDetailEntity entity = new InStorDetailEntity();
            entity.SnNum = SequenceProvider.GetSequence(typeof(InStorDetailEntity));
            entity.OrderNum = string.Empty;
            entity.ProductName = ProductName;
            entity.BarCode = BarCode;
            entity.ProductNum = ProductNum;
            entity.Num = Num;
            entity.IsPick = (int)EBool.No;
            entity.RealNum = 0;
            entity.InPrice = InPrice;
            entity.CreateTime = DateTime.Now;
            entity.LocalNum = LocalNum;
            LocationEntity localtion = new LocationProvider().GetSingleByNumCache(LocalNum);
            if (localtion != null)
            {
                entity.LocalName = new LocationProvider().GetSingleByNumCache(LocalNum).LocalName;
            }
            else
            {
                entity.LocalName = "";
            }
            entity.Amount = entity.InPrice * entity.Num;
            entity.StorageNum = this.DefaultPStore;
            entity.Size = Size;
            entity.BatchNum = BatchNum;
            entity.TotalPrice = entity.Num * entity.InPrice;
            List<InStorDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] as List<InStorDetailEntity>;
            list = list.IsNull() ? new List<InStorDetailEntity>() : list;
            list.Add(entity);
            Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = list;

            return Content(string.Empty);
        }
Exemplo n.º 5
0
 public ActionResult Audit(string LocalNum, string IsForbid)
 {
     LocationProvider provider = new LocationProvider();
     LocationEntity entity = new LocationEntity();
     entity.IncludeIsForbid(true);
     entity.IsForbid = ConvertHelper.ToType<int>(IsForbid);
     entity.Where(a => a.LocalNum == LocalNum);
     int line = provider.Update(entity);
     if (line > 0)
     {
         this.ReturnJson.AddProperty("d", "success");
     }
     else
     {
         this.ReturnJson.AddProperty("d", "");
     }
     return Content(this.ReturnJson.ToString());
 }
Exemplo n.º 6
0
 public ActionResult Add()
 {
     string LocalNum = WebUtil.GetQueryStringValue<string>("LocalNum");
     if (LocalNum.IsEmpty())
     {
         ViewBag.Storage = LocalHelper.GetStorageNumList(string.Empty);
         ViewBag.LocalTypeList = EnumHelper.GetOptions<ELocalType>(string.Empty, "请选择库位类型");
         ViewBag.IsDefault = EnumHelper.GetOptions<EBool>(string.Empty, "请选择");
         ViewBag.Location = new LocationEntity();
     }
     else
     {
         LocationProvider provider = new LocationProvider();
         LocationEntity entity = provider.GetSingleByNum(LocalNum);
         entity = entity == null ? new LocationEntity() : entity;
         ViewBag.StorageType = EnumHelper.GetOptions<EStorageType>(entity.StorageType, "请选择仓库类型");
         ViewBag.IsDefault = EnumHelper.GetOptions<EBool>(entity.IsDefault, "请选择");
         ViewBag.Storage = LocalHelper.GetStorageNumList(entity.StorageNum);
         ViewBag.LocalTypeList = EnumHelper.GetOptions<ELocalType>(entity.LocalType, "请选择仓库类型");
         ViewBag.Location = entity;
     }
     return View();
 }
Exemplo n.º 7
0
 public ActionResult Delete(string LocalNum)
 {
     LocationProvider provider = new LocationProvider();
     int line = provider.Delete(LocalNum);
     if (line > 0)
     {
         this.ReturnJson.AddProperty("d", "success");
     }
     else
     {
         this.ReturnJson.AddProperty("d", "");
     }
     return Content(this.ReturnJson.ToString());
 }
Exemplo n.º 8
0
        public ActionResult ToExcel()
        {
            PageInfo pageInfo = new Git.Framework.DataTypes.PageInfo() { PageIndex = 1, PageSize = Int32.MaxValue };
            string StorageNum = WebUtil.GetFormValue<string>("StorageName", string.Empty);
            string LocalName = WebUtil.GetFormValue<string>("LocalName", string.Empty);
            string LocalType = WebUtil.GetFormValue<string>("LocalType", string.Empty);
            LocationProvider provider = new LocationProvider();
            LocationEntity entity = new LocationEntity();

            StorageEntity SEntity = new StorageEntity();
            SEntity.Include(a => new { StorageName = a.StorageName });
            entity.Left<StorageEntity>(SEntity, new Params<string, string>() { Item1 = "StorageNum", Item2 = "StorageNum" });
            if (!StorageNum.IsEmpty())
            {
                entity.Where<LocationEntity>("StorageNum", ECondition.Like, "%" + StorageNum + "%");
            }
            if (!LocalName.IsEmpty())
            {
                entity.Begin<LocationEntity>()
                    .Where<LocationEntity>("LocalName", ECondition.Like, "%" + LocalName + "%")
                    .Or<LocationEntity>("LocalNum", ECondition.Like, "%" + LocalName + "%")
                    .Or<LocationEntity>("LocalBarCode", ECondition.Like, "%" + LocalName + "%")
                    .End<LocationEntity>()
                    ;
            }
            if (!LocalType.IsEmpty())
            {
                entity.Where<LocationEntity>("LocalType", ECondition.Like, "%" + LocalType + "%");
            }
            List<LocationEntity> listResult = provider.GetList(entity, ref pageInfo);
            listResult = listResult.IsNull() ? new List<LocationEntity>() : listResult;
            if (listResult.IsNotNull())
            {
                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("序号 "));
                dt.Columns.Add(new DataColumn("库位编号 "));
                dt.Columns.Add(new DataColumn("库位名 "));
                dt.Columns.Add(new DataColumn("所在仓库 "));
                dt.Columns.Add(new DataColumn("库位类型"));
                dt.Columns.Add(new DataColumn("是否禁用"));
                dt.Columns.Add(new DataColumn("是否默认"));
                dt.Columns.Add(new DataColumn("创建时间"));
                int count = 1;
                foreach (LocationEntity t in listResult)
                {
                    DataRow row = dt.NewRow();
                    row[0] = count;
                    row[1] = t.LocalNum;
                    row[2] = t.LocalName;
                    row[3] = t.StorageName;
                    row[4] = EnumHelper.GetEnumDesc<ELocalType>(t.LocalType);
                    row[5] = EnumHelper.GetEnumDesc<EBool>(t.IsForbid);
                    row[6] = EnumHelper.GetEnumDesc<EBool>(t.IsDefault);
                    row[7] = t.CreateTime.ToString("yyyy-MM-dd");
                    dt.Rows.Add(row);
                    count++;
                }
                string filePath = Server.MapPath("~/UploadFiles/");
                if (!System.IO.Directory.Exists(filePath))
                {
                    System.IO.Directory.CreateDirectory(filePath);
                }
                string filename = string.Format("库位管理{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss"));
                NPOIExcel excel = new NPOIExcel("库位管理", "库位", System.IO.Path.Combine(filePath, filename));
                excel.ToExcel(dt);
                this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape());
            }
            else
            {
                this.ReturnJson.AddProperty("d", "无数据导出!");
            }
            return Content(this.ReturnJson.ToString());
        }
Exemplo n.º 9
0
        public ActionResult GetList()
        {
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 1);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 15);
            string LocalName = WebUtil.GetFormValue<string>("LocalName", string.Empty);
            string LocalType = WebUtil.GetFormValue<string>("LocalType", string.Empty);
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            LocationProvider provider = new LocationProvider();
            LocationEntity entity = new LocationEntity();
            StorageEntity SEntity = new StorageEntity();
            SEntity.Include(a => new { StorageName = a.StorageName });
            entity.Left<StorageEntity>(SEntity, new Params<string, string>() { Item1 = "StorageNum", Item2 = "StorageNum" });
            string StorageNum = this.DefaultStore;
            entity.Where<LocationEntity>("StorageNum", ECondition.Eth, StorageNum);
            if (!LocalName.IsEmpty())
            {
                entity.Begin<LocationEntity>()
                    .Where<LocationEntity>("LocalName", ECondition.Like, "%" + LocalName + "%")
                    .Or<LocationEntity>("LocalNum", ECondition.Like, "%" + LocalName + "%")
                    .Or<LocationEntity>("LocalBarCode", ECondition.Like, "%" + LocalName + "%")
                    .End<LocationEntity>()
                    ;
            }
            if (!LocalType.IsEmpty())
            {
                entity.Where<LocationEntity>("LocalType", ECondition.Eth, LocalType);
            }

            List<LocationEntity> listResult = provider.GetList(entity, ref pageInfo);
            string json = ConvertJson.ListToJson<LocationEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Exemplo n.º 10
0
        public ActionResult ToInventoryReportExcel()
        {
            string searchKey = WebUtil.GetFormValue<string>("SearchKey", string.Empty);
            string change = WebUtil.GetFormValue<string>("Change", string.Empty);
            string beginTime = WebUtil.GetFormValue<string>("beginTime", string.Empty);
            string endTime = WebUtil.GetFormValue<string>("endTime", string.Empty);

            string storageNum = this.DefaultStore;

            InventoryProvider provider = new InventoryProvider();
            InventoryBookEntity entity = new InventoryBookEntity();

            if (!searchKey.IsEmpty())
            {
                entity.Begin<InventoryBookEntity>()
                 .Where<InventoryBookEntity>("ProductName", ECondition.Like, "%" + searchKey + "%")
                 .Or<InventoryBookEntity>("ProductNum", ECondition.Like, "%" + searchKey + "%")
                 .Or<InventoryBookEntity>("BarCode", ECondition.Like, "%" + searchKey + "%")
                 .End<InventoryBookEntity>();
            }
            if (!storageNum.IsEmpty())
            {
                entity.Where("StoreNum", ECondition.Eth, storageNum);
            }
            if (!change.IsEmpty())
            {
                entity.Where("Type", ECondition.Eth, change);
            }
            PageInfo pageInfo = new PageInfo() { PageIndex = 1, PageSize = Int32.MaxValue };
            List<InventoryBookEntity> listResult = provider.GetList(entity, ref pageInfo);
            LocationProvider locaProvider = new LocationProvider();
            foreach (InventoryBookEntity item in listResult)
            {
                LocationEntity locaEntity1 = locaProvider.GetSingleByNum(item.FromLocalNum);
                if (locaEntity1.IsNotNull())
                {
                    item.FromLocalName = locaEntity1.LocalName;
                }
                else
                {
                    item.FromLocalName = string.Empty;
                }
                LocationEntity locaEntity2 = locaProvider.GetSingleByNum(item.ToLocalNum);
                if (locaEntity2.IsNotNull())
                {
                    item.ToLocalName = locaEntity2.LocalName;
                }
                else
                {
                    item.ToLocalName = string.Empty;
                }
            }
            if (!listResult.IsNullOrEmpty())
            {

                Workbook book = new Workbook();
                Worksheet sheet = book.Worksheets[0];

                Action<Cell> action = (Cell cellItem) =>
                {
                    cellItem.Style.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;
                    cellItem.Style.Borders[BorderType.BottomBorder].Color = System.Drawing.Color.Black;

                    cellItem.Style.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thin;
                    cellItem.Style.Borders[BorderType.TopBorder].Color = System.Drawing.Color.Black;

                    cellItem.Style.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thin;
                    cellItem.Style.Borders[BorderType.LeftBorder].Color = System.Drawing.Color.Black;

                    cellItem.Style.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thin;
                    cellItem.Style.Borders[BorderType.RightBorder].Color = System.Drawing.Color.Black;
                };

                sheet.Name = "台帐报表";
                sheet.Cells.Merge(0, 0, 1, 11);

                //设置高度
                Cells cells = sheet.Cells;
                cells.SetRowHeight(0, 30);
                for (int i = 0; i < 11; i++)
                {
                    cells.SetColumnWidth(i, 15);
                }

                Cell cell = sheet.Cells[0, 0];
                cell.PutValue("台帐报表");
                cell.Style.HorizontalAlignment = TextAlignmentType.Center;
                cell.Style.Font.Color = System.Drawing.Color.Blue;
                cell.Style.Font.Size = 12;
                cell.Style.Font.IsBold = true;
                action(cell);

                int rowIndex = 1;
                sheet.Cells.SetRowHeight(1, 27);
                sheet.Cells[rowIndex, 0].PutValue("序号");
                sheet.Cells[rowIndex, 1].PutValue("产品编号");
                sheet.Cells[rowIndex, 2].PutValue("产品条码");
                sheet.Cells[rowIndex, 3].PutValue("产品名称");
                sheet.Cells[rowIndex, 4].PutValue("数量");
                sheet.Cells[rowIndex, 5].PutValue("台帐类型");
                sheet.Cells[rowIndex, 6].PutValue("关联订单号");
                sheet.Cells[rowIndex, 7].PutValue("原库位");
                sheet.Cells[rowIndex, 8].PutValue("目标库位");
                sheet.Cells[rowIndex, 9].PutValue("创建时间");
                sheet.Cells[rowIndex, 10].PutValue("操作人");
                for (int i = 0; i < 11; i++)
                {
                    sheet.Cells[rowIndex, i].Style.Font.IsBold = true;
                    action(sheet.Cells[rowIndex, i]);
                }
                rowIndex++;
                Dictionary<string, int> dic = new Dictionary<string, int>();

                string tempProductNum = listResult[0].ProductNum;
                int index = 0;
                int tempIndex = 1;
                foreach (InventoryBookEntity item in listResult)
                {
                    if (item.ProductNum == tempProductNum)
                    {
                        index++;
                    }
                    if (item.ProductNum != tempProductNum)
                    {
                        dic[tempProductNum] = index;
                        index = 1;
                    }
                    if (listResult.Count == tempIndex)
                    {
                        Dictionary<string, int>.KeyCollection keys = dic.Keys;
                        if (!keys.Exists(a => a == item.ProductNum))
                        {
                            dic[item.ProductNum] = index;
                        }

                    }
                    tempProductNum = item.ProductNum;
                    tempIndex++;
                }
                index = 0;
                int number = 1;
                foreach (InventoryBookEntity t in listResult)
                {
                    sheet.Cells.SetRowHeight(rowIndex, 25);
                    sheet.Cells[rowIndex, 0].PutValue(number);
                    if (index == 0)
                    {
                        index = dic[t.ProductNum];
                        sheet.Cells[rowIndex, 1].PutValue(t.ProductNum);
                        sheet.Cells[rowIndex, 2].PutValue(t.BarCode);
                        sheet.Cells[rowIndex, 3].PutValue(t.ProductName);
                        for (int i = 1; i < 4; i++)
                        {
                            sheet.Cells.Merge(rowIndex, i, index, 1);
                            sheet.Cells[rowIndex, i].Style.HorizontalAlignment = TextAlignmentType.Center;
                        }
                    }
                    sheet.Cells[rowIndex, 4].PutValue(t.Num);
                    sheet.Cells[rowIndex, 5].PutValue(EnumHelper.GetEnumDesc<EChange>(t.Type));
                    sheet.Cells[rowIndex, 6].PutValue(t.ContactOrder);
                    sheet.Cells[rowIndex, 7].PutValue(t.FromLocalName);
                    sheet.Cells[rowIndex, 8].PutValue(t.ToLocalName);
                    sheet.Cells[rowIndex, 9].PutValue(t.CreateTime.ToString("yyyy-MM-dd"));
                    sheet.Cells[rowIndex, 10].PutValue(t.UserName);

                    for (int i = 0; i < 11; i++)
                    {
                        //sheet.Cells[rowIndex, i].Style.Font.IsBold = true;
                        sheet.Cells[rowIndex, i].Style.Font.Size = 13;
                        action(sheet.Cells[rowIndex, i]);
                    }
                    number++;
                    rowIndex++;
                    index--;
                }

                string filePath = Server.MapPath("~/UploadFiles/");
                if (!System.IO.Directory.Exists(filePath))
                {
                    System.IO.Directory.CreateDirectory(filePath);
                }
                string filename = string.Format("台帐报表{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss"));
                book.Save(filePath + filename);
                this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape());
                this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape());
            }
            else
            {
                this.ReturnJson.AddProperty("d", "无数据导出!");
            }
            return Content(this.ReturnJson.ToString());
        }
Exemplo n.º 11
0
        public ActionResult InventoryList()
        {
            string searchKey = WebUtil.GetFormValue<string>("SearchKey", string.Empty);
            string change = WebUtil.GetFormValue<string>("Change", string.Empty);
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 0);
            string beginTime = WebUtil.GetFormValue<string>("beginTime", string.Empty);
            string endTime = WebUtil.GetFormValue<string>("endTime", string.Empty);
            string storageNum = this.DefaultStore;

            InventoryProvider provider = new InventoryProvider();
            InventoryBookEntity entity = new InventoryBookEntity();

            if (!searchKey.IsEmpty())
            {
                entity.Begin<InventoryBookEntity>()
                 .Where<InventoryBookEntity>("ProductName", ECondition.Like, "%" + searchKey + "%")
                 .Or<InventoryBookEntity>("ProductNum", ECondition.Like, "%" + searchKey + "%")
                 .Or<InventoryBookEntity>("BarCode", ECondition.Like, "%" + searchKey + "%")
                 .End<InventoryBookEntity>();
            }
            if (!storageNum.IsEmpty())
            {
                entity.Where("StoreNum", ECondition.Eth, storageNum);
            }
            if (!change.IsEmpty())
            {
                entity.Where("Type", ECondition.Eth, change);
            }
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            List<InventoryBookEntity> listResult = provider.GetList(entity, ref pageInfo);
            LocationProvider locaProvider = new LocationProvider();

            foreach (InventoryBookEntity item in listResult)
            {
                LocationEntity locaEntity1 = locaProvider.GetSingleByNum(item.FromLocalNum);
                if (locaEntity1.IsNotNull())
                {
                    item.FromLocalName = locaEntity1.LocalName;
                }
                else
                {
                    item.FromLocalName = string.Empty;
                }
                LocationEntity locaEntity2 = locaProvider.GetSingleByNum(item.ToLocalNum);
                if (locaEntity2.IsNotNull())
                {
                    item.ToLocalName = locaEntity2.LocalName;
                }
                else
                {
                    item.ToLocalName = string.Empty;
                }
            }
            string json = ConvertJson.ListToJson<InventoryBookEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Exemplo n.º 12
0
 public ActionResult LoadProduct([ModelBinder(typeof(JsonBinder<List<MoveOrderDetailEntity>>))] List<MoveOrderDetailEntity> List)
 {
     List<MoveOrderDetailEntity> listResult = Session[CacheKey.TEMPDATA_CACHE_MOVERODUCTDETAIL] as List<MoveOrderDetailEntity>;
     listResult = listResult.IsNull() ? new List<MoveOrderDetailEntity>() : listResult;
     if (!List.IsNullOrEmpty())
     {
         string storageNum = this.DefaultStore;
         ProductProvider provider = new ProductProvider();
         List<ProductEntity> listProduct = provider.GetListByCache();
         LocationProvider localProvider = new LocationProvider();
         List<LocationEntity> listLocals = localProvider.GetList(storageNum);
         foreach (MoveOrderDetailEntity item in List)
         {
             ProductEntity product = listProduct.FirstOrDefault(a => a.BarCode == item.BarCode && a.SnNum == item.ProductNum);
             if (product != null)
             {
                 MoveOrderDetailEntity entity = new MoveOrderDetailEntity();
                 entity.SnNum = SequenceProvider.GetSequence(typeof(MoveOrderDetailEntity));
                 entity.ProductName = product.ProductName;
                 entity.BarCode = product.BarCode;
                 entity.ProductNum = product.SnNum;
                 entity.BatchNum = item.BatchNum;
                 entity.Num = item.Num;
                 entity.InPrice = product.InPrice;
                 entity.Amout = entity.InPrice * item.Num;
                 entity.IsPick = (int)EBool.Yes;
                 entity.RealNum = item.Num;
                 entity.CreateTime = DateTime.Now;
                 entity.StorageNum = storageNum;
                 entity.FromLocalNum = item.FromLocalNum;
                 entity.ToLocalNum = item.ToLocalNum;
                 LocationEntity local = listLocals.FirstOrDefault(a => a.LocalNum == item.FromLocalNum);
                 entity.FromLocalName = local != null ? local.LocalName : "";
                 local = listLocals.FirstOrDefault(a => a.LocalNum == item.ToLocalNum);
                 entity.ToLocalName = local != null ? local.LocalName : "";
                 listResult.Add(entity);
             }
         }
         Session[CacheKey.TEMPDATA_CACHE_MOVERODUCTDETAIL] = listResult;
     }
     return Content(string.Empty);
 }
Exemplo n.º 13
0
 public ActionResult LoadProduct([ModelBinder(typeof(JsonBinder<List<LocalProductEntity>>))]List<LocalProductEntity> list)
 {
     List<BadReportDetailEntity> ListProducts = Session[CacheKey.TEMPDATA_CACHE_BADPRODUCTDETAIL] as List<BadReportDetailEntity>;
     ListProducts = ListProducts.IsNull() ? new List<BadReportDetailEntity>() : ListProducts;
     if (!list.IsNullOrEmpty())
     {
         LocationProvider localProvider = new LocationProvider();
         foreach (LocalProductEntity item in list)
         {
             string BarCode = item.BarCode;
             string ProductNum = item.ProductNum;
             string StorageNum = item.StorageNum;
             string FromLocalNum = item.LocalNum;
             string BatchNum = item.BatchNum;
             if (ListProducts.Exists(a => a.BarCode == BarCode && a.ProductNum == ProductNum && a.BatchNum == BatchNum && a.StorageNum == StorageNum && a.FromLocalNum == FromLocalNum))
             {
                 BadReportDetailEntity entity = ListProducts.FirstOrDefault(a => a.BarCode == BarCode && a.ProductNum == ProductNum && a.BatchNum == BatchNum && a.StorageNum == StorageNum && a.FromLocalNum == FromLocalNum);
                 entity.Num += item.Num;
             }
             else
             {
                 BadReportDetailEntity entity = new BadReportDetailEntity();
                 entity.SnNum = SequenceProvider.GetSequence(typeof(BadReportDetailEntity));
                 ProductProvider provider = new ProductProvider();
                 ProductEntity product = provider.GetProductBySn(ProductNum);
                 entity.ProductName = product.ProductName;
                 entity.BarCode = product.BarCode;
                 entity.ProductNum = product.SnNum;
                 entity.BatchNum = item.BatchNum;
                 entity.LocalNum = item.Num;
                 entity.Num = item.Qty;
                 entity.Amount = product.InPrice * item.Num;
                 entity.InPrice = product.InPrice;
                 entity.CreateTime = DateTime.Now;
                 entity.StorageNum = StorageNum;
                 entity.FromLocalNum = item.LocalNum;
                 LocationEntity fromLocal = localProvider.GetSingleByNumCache(item.LocalNum);
                 if (fromLocal != null)
                 {
                     entity.FromLocalName = fromLocal.LocalName;
                 }
                 LocationEntity localtion = localProvider.GetDefaultLocal(StorageNum, ELocalType.Bad);
                 if (localtion != null)
                 {
                     entity.ToLocalNum = localtion.LocalNum;
                 }
                 ListProducts.Add(entity);
             }
         }
         Session[CacheKey.TEMPDATA_CACHE_BADPRODUCTDETAIL] = ListProducts;
     }
     return Content(string.Empty);
 }
Exemplo n.º 14
0
 /// <summary>
 /// 获得订单详细查询
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public List<OutStoDetailEntity> GetOrderDetail(OutStoDetailEntity entity)
 {
     entity.IncludeAll();
     List<OutStoDetailEntity> list = this.OutStoDetail.GetList(entity);
     if (!list.IsNullOrEmpty())
     {
         List<LocationEntity> listLocation = new LocationProvider().GetList();
         listLocation = listLocation == null ? new List<LocationEntity>() : listLocation;
         foreach (OutStoDetailEntity item in list)
         {
             LocationEntity location = listLocation.FirstOrDefault(a => a.LocalNum == item.LocalNum);
             item.LocalName = location == null ? "" : location.LocalName;
             if (item.Amount == 0)
             {
                 item.Amount = item.OutPrice * item.Num;
             }
         }
     }
     return list;
 }
Exemplo n.º 15
0
 public ActionResult GetLocal()
 {
     string StorageNum = WebUtil.GetFormValue<string>("StorageNum", string.Empty);
     List<LocationEntity> listResult = new List<LocationEntity>();
     LocationProvider provider = new LocationProvider();
     if (!StorageNum.IsEmpty())
     {
         listResult = provider.GetList(StorageNum);
     }
     string json = ConvertJson.ListToJson<LocationEntity>(listResult, "List");
     this.ReturnJson.AddProperty("Data", new JsonObject(json));
     this.ReturnJson.AddProperty("RowCount", listResult.Count);
     return Content(this.ReturnJson.ToString());
 }