//跳转退货单
        public ActionResult ReturnOrder(int id)
        {
            InStorage ins = inStorage.GetByWhere(i => i.Id == id).SingleOrDefault();
            var       mx  = inStorageDetail.GetByWhere(i => i.InStorageId == ins.InSNum && i.IsDelete == 0 && i.IsReturnOrder == 0);

            return(Json(mx, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public static int AddInStorage(InStorage ie)
        {
            WarehouseEntities entities = new WarehouseEntities();

            entities.InStorage.Add(ie);
            return(entities.SaveChanges());
        }
        //全选单选删除
        public ActionResult DeleteOther(List <InStorage> list)
        {
            string msg = "";

            foreach (var item in list)
            {
                InStorage ins = inStorage.GetByWhere(i => i.Id == item.Id).SingleOrDefault();
                List <InStorageDetail> listDetail = inStorageDetail.GetByWhere(i => i.InStorageId == ins.InSNum);
                bool val = true;
                foreach (var listd in listDetail)
                {
                    listd.IsDelete = 1;
                    val            = inStorageDetail.Update(listd);
                }
                if (val)
                {
                    ins.IsDelete = 1;
                    bool vall = inStorage.Update(ins);
                    if (vall)
                    {
                        msg = "删除成功";
                    }
                    else
                    {
                        msg = "删除失败";
                    }
                }
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Example #4
0
        public IHttpActionResult EditInStorage(InStorage storage)
        {
            var inStorageService = new InStorageService();
            var EditInStorage    = inStorageService.EditInStorage(storage);
            var result           = new
            {
                Count = EditInStorage?"编辑成功":"编辑失败"
            };

            return(Json(result));
        }
Example #5
0
        public IHttpActionResult EditCheckInStorage(InStorage storage)
        {
            var inStorageService = new InStorageService();
            var editCheckInStor  = inStorageService.EditCheckInStorage(storage);
            var result           = new
            {
                list = editCheckInStor?"修改成功":"修改失败"
            };

            return(Json(result));
        }
Example #6
0
 public bool SellProduct(InStorage product)
 {
     try
     {
         _warehouseContext.Sales.Add(new Sale(product, _warehouseContext.Sales.Local.Count));
         _warehouseContext.InStorages.Remove(product);
         _warehouseContext.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #7
0
        public IHttpActionResult AddInStorage(InStorage inStorage)
        {
            var inStorageService = new InStorageService();

            inStorage.ProductType   = 2;
            inStorage.StorageNum    = "DSP_0000";
            inStorage.ContractType  = 0;
            inStorage.Status        = 1;
            inStorage.IsDelete      = 0;
            inStorage.NetWeight     = 0;
            inStorage.CreateTime    = DateTime.Now;
            inStorage.GrossWeight   = 0;
            inStorage.OperateType   = 1;
            inStorage.EquipmentNum  = "null";
            inStorage.EquipmentCode = "null";
            var addInStorage = inStorageService.Add(inStorage);
            var result       = new {
                Conut = addInStorage ? "添加成功!" : "添加失败!"
            };

            return(Json(result));
        }
        //修改审核状态
        public ActionResult UpdtStatus(InStorage i, string status)
        {
            var ss = inStorage.GetByWhere(item => item.Id == i.Id).SingleOrDefault();

            i.InSNum     = ss.InSNum;
            i.InSTypeId  = ss.InSTypeId;
            i.SupplierId = ss.SupplierId;
            i.DetailNum  = ss.DetailNum;
            i.Num        = ss.Num;
            i.SumMoney   = ss.SumMoney;
            i.Status     = status;
            i.AuditUser  = ss.AuditUser;
            i.AuditTime  = ss.AuditTime;
            i.IsDelete   = ss.IsDelete;
            i.Remark     = ss.Remark;
            var inStorages = new InStorageManager();
            var s          = inStorages.Update(i);

            if (status.Equals("审核通过"))
            {
                var d = inStorageDetail.GetByWhere(item => item.InStorageId == ss.InSNum);
                foreach (var item in d)
                {
                    var pd = new ProductManager();
                    Expression <Func <Product, bool> > where = iss => iss.ProductNum == item.ProductNum;
                    var pdu1 = pd.GetByWhere(where).SingleOrDefault();
                    pdu1.StockNum = Convert.ToInt32(pdu1.StockNum + item.Quantity);
                    var pdu = productManager.Update(pdu1);
                }
            }
            var result = new
            {
                ActionResult = s
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        //新增入库单
        public ActionResult Insert(List <InStorageDetail> detail, int InSTypeId, int SupplierId, string Remark, string AuditUser)
        {
            //获取明细表最大编号
            string detailNumBig = inStorageDetail.GetByWhere(item => true).OrderByDescending(item => item.DetailNum).Take(1).Select(item => item.DetailNum).FirstOrDefault();
            string detailNum    = "";

            if (string.IsNullOrEmpty(detailNumBig))
            {
                detailNum = "000001";
            }
            else
            {
                detailNum = "00000" + (int.Parse(detailNumBig) + 1);
                int numD = int.Parse(detailNumBig);
                if (numD >= 9)
                {
                    detailNum = "0000" + (int.Parse(detailNumBig) + 1);
                }
                else if (numD >= 99)
                {
                    detailNum = "000" + (int.Parse(detailNumBig) + 1);
                }
            }
            //获取入库表最大编号
            string inSNumBig = inStorage.GetByWhere(item => true).OrderByDescending(item => item.InSNum).Take(1).Select(item => item.InSNum).FirstOrDefault();
            string inSNum    = "";

            if (inSNumBig == null)
            {
                inSNum = "000001";
            }
            else
            {
                inSNum = "00000" + (int.Parse(inSNumBig) + 1);
                int numS = int.Parse(inSNumBig);
                if (numS >= 9)
                {
                    inSNum = "0000" + (int.Parse(inSNumBig) + 1);
                }
                else if (numS >= 99)
                {
                    inSNum = "000" + (int.Parse(inSNumBig) + 1);
                }
            }
            bool   val = true;
            string msg = "";

            foreach (var item in detail)
            {
                item.DetailNum   = detailNum;
                item.InStorageId = inSNum;
                item.CreateTime  = DateTime.Now;
                val = inStorageDetail.Add(item);
            }
            if (val)
            {
                var       num        = inStorageDetail.GetByWhere(item => item.InStorageId == inSNum).Sum(item => item.Quantity);
                var       sumMoney   = inStorageDetail.GetByWhere(item => item.InStorageId == inSNum).Sum(item => item.SumMoney);
                InStorage inStorages = new InStorage();
                inStorages.AuditTime  = DateTime.Now;
                inStorages.AuditUser  = AuditUser;
                inStorages.DetailNum  = detailNum;
                inStorages.InSNum     = inSNum;
                inStorages.InSTypeId  = InSTypeId;
                inStorages.IsDelete   = 0;
                inStorages.Num        = Convert.ToInt32(num);
                inStorages.Remark     = Remark;
                inStorages.Status     = "待审核";
                inStorages.SumMoney   = Convert.ToDouble(sumMoney);
                inStorages.SupplierId = SupplierId;
                bool vall = inStorage.Add(inStorages);
                if (vall)
                {
                    msg = "新增成功";
                }
                else
                {
                    msg = "新增失败";
                }
                msg = "新增成功";
            }
            else
            {
                msg = "新增失败";
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Example #10
0
 public static int DelInStorage(InStorage pc, int id)
 {
     return(InStorageService.DelInStorage(pc, id));
 }
Example #11
0
 public static PageList GetQueryInStorage(int pageIndex, int pageSize, InStorage io)
 {
     return(InStorageService.GetQueryInStorage(pageIndex, pageSize, io));
 }
Example #12
0
 public static int AddInStorage(InStorage ie)
 {
     return(InStorageService.AddInStorage(ie));
 }