Esempio n. 1
0
        /// <summary>
        /// 设置打印数据
        /// </summary>
        /// <returns></returns>
        public ActionResult Print()
        {
            string   CompanyID = WebUtil.GetFormValue <string>("CompanyID");
            string   SnNum     = WebUtil.GetFormValue <string>("SnNum");
            string   PrintUser = WebUtil.GetFormValue <string>("PrintUser");
            DateTime PrintTime = WebUtil.GetFormValue <DateTime>("PrintTime");

            AllocateOrderEntity entity = new AllocateOrderEntity();

            entity.SnNum     = SnNum;
            entity.CompanyID = CompanyID;
            entity.PrintUser = PrintUser;
            entity.PrintTime = PrintTime;

            Bill <AllocateOrderEntity, AllocateDetailEntity> bill = new AllocateOrder(CompanyID);

            string     returnValue = bill.Print(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)));
        }
Esempio n. 2
0
        /// <summary>
        /// 根据调拨单号查询调拨单
        /// </summary>
        /// <param name="OrderNum"></param>
        /// <returns></returns>
        public AllocateOrderEntity GetOrderByNum(string OrderNum)
        {
            AllocateOrderEntity entity = new AllocateOrderEntity();

            entity.IncludeAll();

            AdminEntity admin = new AdminEntity();

            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left <AdminEntity>(admin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            AdminEntity auditeAdmin = new AdminEntity();

            auditeAdmin.Include(a => new { AuditUserName = a.UserName });
            entity.Left <AdminEntity>(auditeAdmin, new Params <string, string>()
            {
                Item1 = "CreateUser", Item2 = "UserNum"
            });

            entity.Where(a => a.OrderNum == OrderNum)
            .And(a => a.CompanyID == this.CompanyID)
            ;

            entity = this.AllocateOrder.GetSingle(entity);
            return(entity);
        }
Esempio n. 3
0
        /// <summary>
        /// 根据调拨单唯一编号删除调拨单
        /// </summary>
        /// <returns></returns>
        public ActionResult DeleteSingle()
        {
            string SnNum     = WebUtil.GetFormValue <string>("SnNum");
            string CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty);

            AllocateOrderEntity entity = new AllocateOrderEntity();

            entity.SnNum     = SnNum;
            entity.CompanyID = CompanyID;

            Bill <AllocateOrderEntity, AllocateDetailEntity> bill = new AllocateOrder(CompanyID);
            string returnValue = bill.Delete(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)));
        }
Esempio n. 4
0
        /// <summary>
        /// 根据条件查询统计调拨单统计行
        /// </summary>
        /// <returns></returns>
        public ActionResult GetCount()
        {
            string CompanyID     = WebUtil.GetFormValue <string>("CompanyID");
            string OrderNum      = WebUtil.GetFormValue <string>("OrderNum");
            int    AllocateType  = WebUtil.GetFormValue <int>("AllocateType", 0);
            string ContractOrder = WebUtil.GetFormValue <string>("ContractOrder");
            int    Status        = WebUtil.GetFormValue <int>("Status", 0);
            string BeginTime     = WebUtil.GetFormValue <string>("BeginTime");
            string EndTime       = WebUtil.GetFormValue <string>("EndTime");
            string StorageNum    = WebUtil.GetFormValue <string>("StorageNum");

            Bill <AllocateOrderEntity, AllocateDetailEntity> bill = new AllocateOrder(CompanyID);
            AllocateOrderEntity entity = new AllocateOrderEntity();

            entity.CompanyID     = CompanyID;
            entity.OrderNum      = OrderNum;
            entity.AllocateType  = AllocateType;
            entity.ContractOrder = ContractOrder;
            entity.Status        = Status;
            entity.BeginTime     = BeginTime;
            entity.EndTime       = EndTime;
            entity.StorageNum    = StorageNum;

            int Count = bill.GetCount(entity);

            DataResult <int> dataResult = new DataResult <int>();

            dataResult.Code    = (int)EResponseCode.Success;
            dataResult.Message = "响应成功";
            dataResult.Result  = Count;

            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
Esempio n. 5
0
        /// <summary>
        /// 根据调拨单号查询调拨单
        /// </summary>
        /// <returns></returns>
        public ActionResult GetOrderByNum()
        {
            string OrderNum  = WebUtil.GetFormValue <string>("OrderNum");
            string CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty);

            AllocateOrderExt    bill   = new AllocateOrderExt(CompanyID);
            AllocateOrderEntity result = bill.GetOrderByNum(OrderNum);

            DataResult <AllocateOrderEntity> dataResult = new DataResult <AllocateOrderEntity>();

            dataResult.Code    = (int)EResponseCode.Success;
            dataResult.Message = "响应成功";
            dataResult.Result  = result;
            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
        public ActionResult Add()
        {
            AllocateOrderEntity         entity     = WebUtil.GetFormObject <AllocateOrderEntity>("Entity");
            List <AllocateDetailEntity> listDetail = Session[SessionKey.SESSION_ALLOCATE_DETAIL] as List <AllocateDetailEntity>;
            string CompanyID  = this.CompanyID;
            string StorageNum = WebUtil.GetFormValue <string>("StorageNum");

            if (listDetail.IsNullOrEmpty())
            {
                DataResult <string> dataResult = new DataResult <string>()
                {
                    Code = (int)EResponseCode.Exception, Message = "请选择要调拨的产品"
                };
                return(Content(JsonHelper.SerializeObject(dataResult)));
            }
            string ApiName = AllocateApiName.AllocateApiName_Add;

            if (!entity.SnNum.IsEmpty())
            {
                ApiName = AllocateApiName.AllocateApiName_Edit;
            }

            entity.CreateUser = this.LoginUser.UserNum;
            entity.CreateTime = DateTime.Now;
            entity.IsDelete   = (int)EIsDelete.NotDelete;
            entity.Status     = (int)EAudite.Wait;
            entity.StorageNum = this.DefaultStorage.StorageNum;
            entity.CompanyID  = CompanyID;
            entity.StorageNum = this.DefaultStorageNum;

            listDetail.ForEach(a =>
            {
                a.ToStorageNum = StorageNum;
            });

            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("CompanyID", CompanyID);
            dic.Add("Entity", JsonConvert.SerializeObject(entity));
            dic.Add("List", JsonConvert.SerializeObject(listDetail));

            ITopClient client = new TopClientDefault();
            string     result = client.Execute(ApiName, dic);

            return(Content(result));
        }
Esempio n. 7
0
        /// <summary>
        /// 审核调拨单
        /// </summary>
        /// <returns></returns>
        public ActionResult Audite()
        {
            string SnNum         = WebUtil.GetFormValue <string>("SnNum");
            string CompanyID     = WebUtil.GetFormValue <string>("CompanyID", string.Empty);
            int    Status        = WebUtil.GetFormValue <int>("Status", (int)EAudite.NotPass);
            string AuditUser     = WebUtil.GetFormValue <string>("AuditUser", string.Empty);
            string Reason        = WebUtil.GetFormValue <string>("Reason", string.Empty);
            int    OperateType   = WebUtil.GetFormValue <int>("OperateType", 0);
            string EquipmentNum  = WebUtil.GetFormValue <string>("EquipmentNum");
            string EquipmentCode = WebUtil.GetFormValue <string>("EquipmentCode");
            string Remark        = WebUtil.GetFormValue <string>("Remark");

            AllocateOrderEntity entity = new AllocateOrderEntity();

            entity.SnNum         = SnNum;
            entity.CompanyID     = CompanyID;
            entity.Status        = Status;
            entity.AuditUser     = AuditUser;
            entity.Reason        = Reason;
            entity.OperateType   = OperateType;
            entity.EquipmentNum  = EquipmentNum;
            entity.EquipmentCode = EquipmentCode;
            entity.Remark        = Remark;

            Bill <AllocateOrderEntity, AllocateDetailEntity> bill = new AllocateOrder(CompanyID);
            string     returnValue = bill.Audite(entity);
            DataResult result      = new DataResult();

            if ("1000" == returnValue)
            {
                result.Code    = (int)EResponseCode.Success;
                result.Message = "操作成功";
            }
            else if ("1001" == returnValue)
            {
                result.Code    = (int)EResponseCode.Exception;
                result.Message = "调拨单不存在";
            }
            else if ("1002" == returnValue)
            {
                result.Code    = (int)EResponseCode.Exception;
                result.Message = "调拨单已经审核";
            }
            return(Content(JsonHelper.SerializeObject(result)));
        }
Esempio n. 8
0
        /// <summary>
        /// 查询调拨单
        /// </summary>
        /// <returns></returns>
        public ActionResult GetOrder()
        {
            string SnNum               = WebUtil.GetFormValue <string>("SnNum");
            string CompanyID           = WebUtil.GetFormValue <string>("CompanyID", string.Empty);
            AllocateOrderEntity entity = new AllocateOrderEntity();

            entity.SnNum     = SnNum;
            entity.CompanyID = CompanyID;
            Bill <AllocateOrderEntity, AllocateDetailEntity> bill = new AllocateOrder(CompanyID);
            AllocateOrderEntity result = bill.GetOrder(entity);

            DataResult <AllocateOrderEntity> dataResult = new DataResult <AllocateOrderEntity>();

            dataResult.Code    = (int)EResponseCode.Success;
            dataResult.Message = "响应成功";
            dataResult.Result  = result;
            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
Esempio n. 9
0
        /// <summary>
        /// 新增调拨单
        /// </summary>
        /// <returns></returns>
        public ActionResult Create()
        {
            string CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty);
            AllocateOrderEntity         entity = WebUtil.GetFormObject <AllocateOrderEntity>("Entity");
            List <AllocateDetailEntity> list   = WebUtil.GetFormObject <List <AllocateDetailEntity> >("List");

            entity.SnNum         = ConvertHelper.NewGuid();
            entity.ProductType   = (int)EProductType.Goods;
            entity.Status        = (int)EAudite.Wait;
            entity.IsDelete      = (int)EIsDelete.NotDelete;
            entity.CreateTime    = DateTime.Now;
            entity.CompanyID     = entity.CompanyID.IsEmpty() ? CompanyID : entity.CompanyID;
            entity.EquipmentNum  = "";
            entity.EquipmentCode = "";

            Bill <AllocateOrderEntity, AllocateDetailEntity> bill = new AllocateOrder(CompanyID);
            string     returnValue = bill.Create(entity, list);
            DataResult result      = new DataResult();

            if (EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success) == returnValue)
            {
                result.Code    = (int)EResponseCode.Success;
                result.Message = "调拨单创建成功";
            }
            else if (returnValue == "1001")
            {
                result.Code    = (int)EResponseCode.Exception;
                result.Message = "调拨仓库未初始化";
            }
            else if (returnValue == "1002")
            {
                result.Code    = (int)EResponseCode.Exception;
                result.Message = "调拨仓库待入库未初始化";
            }
            else
            {
                result.Code    = (int)EResponseCode.Exception;
                result.Message = "调拨单创建失败";
            }
            return(Content(JsonHelper.SerializeObject(result)));
        }
Esempio n. 10
0
        /// <summary>
        /// 查询调拨单分页列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetOrderList()
        {
            string CompanyID     = WebUtil.GetFormValue <string>("CompanyID");
            int    PageIndex     = WebUtil.GetFormValue <int>("PageIndex", 1);
            int    PageSize      = WebUtil.GetFormValue <int>("PageSize", 10);
            string OrderNum      = WebUtil.GetFormValue <string>("OrderNum");
            int    AllocateType  = WebUtil.GetFormValue <int>("AllocateType", 0);
            string ContractOrder = WebUtil.GetFormValue <string>("ContractOrder");
            int    Status        = WebUtil.GetFormValue <int>("Status", 0);
            string BeginTime     = WebUtil.GetFormValue <string>("BeginTime");
            string EndTime       = WebUtil.GetFormValue <string>("EndTime");
            string StorageNum    = WebUtil.GetFormValue <string>("StorageNum");

            Bill <AllocateOrderEntity, AllocateDetailEntity> bill = new AllocateOrder(CompanyID);
            AllocateOrderEntity entity = new AllocateOrderEntity();

            entity.CompanyID     = CompanyID;
            entity.OrderNum      = OrderNum;
            entity.AllocateType  = AllocateType;
            entity.ContractOrder = ContractOrder;
            entity.Status        = Status;
            entity.BeginTime     = BeginTime;
            entity.EndTime       = EndTime;
            entity.StorageNum    = StorageNum;

            PageInfo pageInfo = new PageInfo()
            {
                PageIndex = PageIndex, PageSize = PageSize
            };

            List <AllocateOrderEntity>           listResult = bill.GetList(entity, ref pageInfo);
            DataListResult <AllocateOrderEntity> dataResult = new DataListResult <AllocateOrderEntity>()
            {
                Code     = (int)EResponseCode.Success,
                Message  = "响应成功",
                Result   = listResult,
                PageInfo = pageInfo
            };

            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
Esempio n. 11
0
        /// <summary>
        /// 编辑调拨单主体信息
        /// </summary>
        /// <returns></returns>
        public ActionResult EditOrder()
        {
            string CompanyID           = WebUtil.GetFormValue <string>("CompanyID", string.Empty);
            AllocateOrderEntity entity = WebUtil.GetFormObject <AllocateOrderEntity>("Entity");

            Bill <AllocateOrderEntity, AllocateDetailEntity> bill = new AllocateOrder(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)));
        }
Esempio n. 12
0
        public ActionResult Detail()
        {
            string SnNum = WebUtil.GetQueryStringValue <string>("SnNum");

            AllocateOrderEntity entity = null;

            if (!SnNum.IsEmpty())
            {
                ITopClient client = new TopClientDefault();
                Dictionary <string, string> dic = new Dictionary <string, string>();

                dic.Add("CompanyID", CompanyID);
                dic.Add("SnNum", SnNum);

                string result = client.Execute(AllocateApiName.AllocateApiName_GetOrder, dic);
                DataResult <AllocateOrderEntity> dataResult = JsonConvert.DeserializeObject <DataResult <AllocateOrderEntity> >(result);
                entity = dataResult.Result;
            }
            entity         = entity.IsNull() ? new AllocateOrderEntity() : entity;
            ViewBag.Entity = entity;
            return(View());
        }
Esempio n. 13
0
        public ActionResult Add()
        {
            string SnNum = WebUtil.GetQueryStringValue <string>("SnNum");

            AllocateOrderEntity         entity = null;
            List <AllocateDetailEntity> list   = null;

            ITopClient client = new TopClientDefault();

            if (!SnNum.IsEmpty())
            {
                Dictionary <string, string> dic = new Dictionary <string, string>();

                dic.Add("CompanyID", CompanyID);
                dic.Add("SnNum", SnNum);

                string result = client.Execute(AllocateApiName.AllocateApiName_GetOrder, dic);
                DataResult <AllocateOrderEntity> dataResult = JsonConvert.DeserializeObject <DataResult <AllocateOrderEntity> >(result);
                entity = dataResult.Result;

                result = client.Execute(AllocateApiName.AllocateApiName_GetDetail, dic);
                DataResult <List <AllocateDetailEntity> > dataList = JsonConvert.DeserializeObject <DataResult <List <AllocateDetailEntity> > >(result);
                list = dataList.Result;
            }
            if (entity.IsNull())
            {
                entity                = new AllocateOrderEntity();
                entity.CreateUser     = this.LoginUser.UserNum;
                entity.CreateUserName = this.LoginUser.UserName;
                entity.CreateTime     = DateTime.Now;
            }
            ViewBag.Entity = entity;

            list = list.IsNull() ? new List <AllocateDetailEntity>() : list;
            Session[SessionKey.SESSION_ALLOCATE_DETAIL] = list;

            ViewBag.AllocateType = EnumHelper.GetOptions <EAllocateType>(entity.AllocateType);

            //加载仓库
            Dictionary <string, string> dicStorage = new Dictionary <string, string>();

            dicStorage.Add("CompanyID", CompanyID);
            dicStorage.Add("PageIndex", "1");
            dicStorage.Add("PageSize", "100");
            string storageResult    = client.Execute(StorageApiName.StorageApiName_GetPage, dicStorage);
            string StorageList      = string.Empty;
            string defautStorageNum = list.Count > 0 ? list[0].ToStorageNum : "";

            if (storageResult.IsNotEmpty())
            {
                DataListResult <StorageEntity> dataStorage = JsonConvert.DeserializeObject <DataListResult <StorageEntity> >(storageResult);
                List <StorageEntity>           listStorage = dataStorage.Result;
                StringBuilder sb = new StringBuilder();
                sb.Append("<option value=''>请选择</option>");
                if (!listStorage.IsNullOrEmpty())
                {
                    foreach (StorageEntity item in listStorage)
                    {
                        sb.AppendFormat("<option value='{0}' {1}>{2}</option>", item.SnNum, item.SnNum == defautStorageNum ? "selected='selected'" : "", item.StorageName);
                    }
                }
                StorageList = sb.ToString();
            }
            ViewBag.Storage = StorageList;
            return(View());
        }