Beispiel #1
0
        /// <summary>
        /// 编辑出库单主体信息
        /// </summary>
        /// <returns></returns>
        public ActionResult EditOrder()
        {
            string           CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty);
            OutStorageEntity entity    = WebUtil.GetFormObject <OutStorageEntity>("Entity");
            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(CompanyID);
            string     returnValue = bill.EditOrder(entity);
            DataResult result      = new DataResult();

            if (EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success) == returnValue)
            {
                result.Code    = (int)EResponseCode.Success;
                result.Message = "出库单主体编辑成功";
            }
            else
            {
                result.Code    = (int)EResponseCode.Exception;
                result.Message = "出库单主体编辑失败";
            }
            return(Content(JsonHelper.SerializeObject(result)));
        }
        public ActionResult Create()
        {
            string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
            int OutType = WebUtil.GetFormValue<int>("OutType", 0);
            int ProductType = WebUtil.GetFormValue<int>("ProductType", 0);
            string ContractOrder = WebUtil.GetFormValue<string>("ContractOrder", string.Empty);
            string CusNum = WebUtil.GetFormValue<string>("CusNum", string.Empty);
            string CusName = WebUtil.GetFormValue<string>("CusName", string.Empty);
            string Address = WebUtil.GetFormValue<string>("Address", string.Empty);
            string ContactName = WebUtil.GetFormValue<string>("ContactName", string.Empty);
            string Phone = WebUtil.GetFormValue<string>("Phone", string.Empty);
            DateTime SendDate = WebUtil.GetFormValue<DateTime>("SendDate", DateTime.Now);
            string Remark = WebUtil.GetFormValue<string>("Remark", string.Empty);

            OutStorageEntity entity = new OutStorageEntity();
            entity.OrderNum = OrderNum.IsEmpty() ? SequenceProvider.GetSequence(typeof(OutStorageEntity)) : OrderNum;
            entity.OutType = OutType;
            entity.ProductType = ProductType;
            entity.CusNum = CusNum;
            entity.CusName = CusName;
            entity.Contact = ContactName;
            entity.Phone = Phone;
            entity.Address = Address;
            entity.ContractOrder = ContractOrder;
            entity.Status = (int)EAudite.Wait;
            entity.IsDelete = (int)EIsDelete.NotDelete;
            entity.SendDate = SendDate;
            entity.CreateTime = DateTime.Now;
            entity.CreateUser = this.LoginUserCode;
            entity.AuditUser = string.Empty;
            entity.AuditeTime = DateTime.MinValue;
            entity.PrintUser = string.Empty;
            entity.PrintTime = DateTime.MinValue;
            entity.Reason = string.Empty;
            entity.OperateType = (int)EOpType.PC;
            entity.EquipmentNum = string.Empty;
            entity.EquipmentCode = string.Empty;
            entity.Remark = Remark;
            entity.StorageNum = this.DefaultStore;

            List<OutStoDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] as List<OutStoDetailEntity>;
            if (list.IsNullOrEmpty())
            {
                this.ReturnJson.AddProperty("Key", "1001");
                this.ReturnJson.AddProperty("Value", "请选择要出库的产品以及数量");
                return Content(this.ReturnJson.ToString());
            }
            list.ForEach(a => { a.OrderNum = entity.OrderNum; });
            Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            if (OrderNum.IsEmpty())
            {
                string returnValue = bill.Create(entity, list);
                if (returnValue == EnumHelper.GetEnumDesc<EReturnStatus>(EReturnStatus.Success))
                {
                    Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = null;
                    this.ReturnJson.AddProperty("Key", "1000");
                    this.ReturnJson.AddProperty("Value", "出库单创建成功");
                }
            }
            else
            {
                string returnValue = bill.EditOrder(entity, list);
                if (returnValue == EnumHelper.GetEnumDesc<EReturnStatus>(EReturnStatus.Success))
                {
                    Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = null;
                    this.ReturnJson.AddProperty("Key", "1000");
                    this.ReturnJson.AddProperty("Value", "出库单编辑成功");
                }
            }
            return Content(this.ReturnJson.ToString());
        }
        public ActionResult Create()
        {
            string   OrderNum      = WebUtil.GetFormValue <string>("OrderNum", string.Empty);
            int      OutType       = WebUtil.GetFormValue <int>("OutType", 0);
            int      ProductType   = WebUtil.GetFormValue <int>("ProductType", 0);
            string   ContractOrder = WebUtil.GetFormValue <string>("ContractOrder", string.Empty);
            string   CusNum        = WebUtil.GetFormValue <string>("CusNum", string.Empty);
            string   CusName       = WebUtil.GetFormValue <string>("CusName", string.Empty);
            string   Address       = WebUtil.GetFormValue <string>("Address", string.Empty);
            string   ContactName   = WebUtil.GetFormValue <string>("ContactName", string.Empty);
            string   Phone         = WebUtil.GetFormValue <string>("Phone", string.Empty);
            DateTime SendDate      = WebUtil.GetFormValue <DateTime>("SendDate", DateTime.Now);
            string   Remark        = WebUtil.GetFormValue <string>("Remark", string.Empty);
            string   UserName      = WebUtil.GetFormValue <string>("UserName", string.Empty);
            string   UserID        = WebUtil.GetFormValue <string>("UserID", string.Empty);
            string   DeptName      = WebUtil.GetFormValue <string>("DeptName", string.Empty);

            OutStorageEntity entity = new OutStorageEntity();

            entity.OrderNum      = OrderNum.IsEmpty() ? SequenceProvider.GetSequence(typeof(OutStorageEntity)) : OrderNum;
            entity.OutType       = OutType;
            entity.ProductType   = ProductType;
            entity.CusNum        = CusNum;
            entity.CusName       = CusName;
            entity.Contact       = ContactName;
            entity.Phone         = Phone;
            entity.Address       = Address;
            entity.ContractOrder = ContractOrder;
            entity.Status        = (int)EAudite.Wait;
            entity.IsDelete      = (int)EIsDelete.NotDelete;
            entity.SendDate      = SendDate;
            entity.CreateTime    = DateTime.Now;
            entity.CreateUser    = this.LoginUserCode;
            entity.AuditUser     = string.Empty;
            entity.AuditeTime    = DateTime.MinValue;
            entity.PrintUser     = string.Empty;
            entity.PrintTime     = DateTime.MinValue;
            entity.Reason        = string.Empty;
            entity.OperateType   = (int)EOpType.PC;
            entity.EquipmentNum  = string.Empty;
            entity.EquipmentCode = string.Empty;
            entity.Remark        = Remark;
            entity.UserID        = UserID;
            entity.UserName      = UserName;
            entity.DeptName      = DeptName;
            entity.StorageNum    = this.DefaultStore;

            List <OutStoDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] as List <OutStoDetailEntity>;

            if (list.IsNullOrEmpty())
            {
                this.ReturnJson.AddProperty("Key", "1001");
                this.ReturnJson.AddProperty("Value", "请选择要出库的产品以及数量");
                return(Content(this.ReturnJson.ToString()));
            }
            list.ForEach(a => { a.OrderNum = entity.OrderNum; });
            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();

            if (OrderNum.IsEmpty())
            {
                string returnValue = bill.Create(entity, list);
                if (returnValue == EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success))
                {
                    Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = null;
                    this.ReturnJson.AddProperty("Key", "1000");
                    this.ReturnJson.AddProperty("Value", "出库单创建成功");
                }
            }
            else
            {
                string returnValue = bill.EditOrder(entity, list);
                if (returnValue == EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success))
                {
                    Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = null;
                    this.ReturnJson.AddProperty("Key", "1000");
                    this.ReturnJson.AddProperty("Value", "出库单编辑成功");
                }
            }
            return(Content(this.ReturnJson.ToString()));
        }