public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            context.Response.ContentType = "text/plain";
            int id = 0;
            int operateId = 0;

            if (!int.TryParse(context.Request.Form["id"], out id) || id <= 0)
            {
                context.Response.Write("序号错误");
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }

            if (!int.TryParse(context.Request.Form["oi"], out operateId) || operateId <= 0)
            {
                context.Response.Write("操作错误");
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }

            NFMT.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL();
            NFMT.WareHouse.BLL.ContractStockIn_BLL refBLL = new NFMT.WareHouse.BLL.ContractStockIn_BLL();

            NFMT.Common.OperateEnum operateEnum = (NFMT.Common.OperateEnum)operateId;
            using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
            {
                switch (operateEnum)
                {
                    case NFMT.Common.OperateEnum.作废:
                        result = contractBLL.ContractInInvalid(user, id);
                        if (result.ResultStatus == 0)
                            result = refBLL.ContractInInvalidStockOperate(user, id);
                        break;
                    case NFMT.Common.OperateEnum.撤返:
                        result = contractBLL.ContractInGoBack(user, id);
                        break;
                    case NFMT.Common.OperateEnum.执行完成:
                        result = contractBLL.ContractInComplete(user, id);
                        if (result.ResultStatus == 0)
                            result = refBLL.ContractInCompleteStockOperate(user, id);
                        break;
                    case NFMT.Common.OperateEnum.执行完成撤销:
                        result = contractBLL.ContractInCompleteCancel(user, id);
                        if (result.ResultStatus == 0)
                            result = refBLL.ContractInCompleteCancelStockOperate(user, id);
                        break;
                }

                if (result.ResultStatus == 0)
                {
                    result.Message = string.Format("{0}成功", operateEnum.ToString());
                    scope.Complete();
                }
            }

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

            string stockName = context.Request.QueryString["stockName"];
            DateTime fromDate = NFMT.Common.DefaultValue.DefaultTime;
            DateTime toDate = NFMT.Common.DefaultValue.DefaultTime;
            int status = 0;

            if (!string.IsNullOrEmpty(context.Request.QueryString["status"]))
            {
                if (!int.TryParse(context.Request.QueryString["status"], out status))
                    status = 0;
            }

            if (!string.IsNullOrEmpty(context.Request.QueryString["fromDate"]))
            {
                if (!DateTime.TryParse(context.Request.QueryString["fromDate"], out fromDate))
                    fromDate = NFMT.Common.DefaultValue.DefaultTime;
            }
            if (!string.IsNullOrEmpty(context.Request.QueryString["toDate"]))
            {
                if (!DateTime.TryParse(context.Request.QueryString["toDate"], out toDate))
                    toDate = NFMT.Common.DefaultValue.DefaultTime;
            }

            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);

            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
                orderStr = string.Format("{0} {1}", context.Request.QueryString["sortdatafield"].Trim(), context.Request.QueryString["sortorder"].Trim());

            NFMT.WareHouse.BLL.ContractStockIn_BLL bll = new NFMT.WareHouse.BLL.ContractStockIn_BLL();
            NFMT.Common.SelectModel select = bll.GetStockInNoContractSelect(pageIndex, pageSize, orderStr, stockName, status, fromDate, toDate);
            NFMT.Common.ResultModel result = bll.Load(user, select);

            context.Response.ContentType = "application/json; charset=utf-8";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
            System.Collections.Generic.Dictionary<string, object> dic = new System.Collections.Generic.Dictionary<string, object>();

            dic.Add("count", result.AffectCount);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic);

            context.Response.Write(postData);
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            string stockLogIds = context.Request.Form["lgs"];

            NFMT.WareHouse.BLL.ContractStockIn_BLL bll = new NFMT.WareHouse.BLL.ContractStockIn_BLL();

            //result = bll.Create(user,

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            context.Response.ContentType = "text/plain";

            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            if (string.IsNullOrEmpty(context.Request.Form["source"]))
            {
                result.Message = "数据源为空";
                result.ResultStatus = -1;
                context.Response.Write(serializer.Serialize(result));
                context.Response.End();
            }

            bool isPass = false;
            if (string.IsNullOrEmpty(context.Request.Form["ispass"]) || !bool.TryParse(context.Request.Form["ispass"], out isPass))
            {
                result.Message = "审核结果错误";
                result.ResultStatus = -1;
                context.Response.Write(serializer.Serialize(result));
                context.Response.End();
            }

            try
            {
                string jsonData = context.Request.Form["source"];
                var obj = serializer.Deserialize<NFMT.WorkFlow.Model.DataSource>(jsonData);

                NFMT.WareHouse.BLL.ContractStockIn_BLL bll = new NFMT.WareHouse.BLL.ContractStockIn_BLL();
                result = bll.Audit(user, obj, isPass);
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                result.ResultStatus = -1;
            }

            context.Response.Write(serializer.Serialize(result));
            context.Response.End();
        }
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();
            context.Response.ContentType = "text/plain";

            int refId = 0;
            int operateId = 0;

            if (!int.TryParse(context.Request.Form["si"], out refId) || refId <= 0)
            {
                result.Message ="入库分配序号错误";
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }

            if (!int.TryParse(context.Request.Form["oi"], out operateId) || operateId <= 0)
            {
                result.Message ="操作错误";
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.OperateEnum operateEnum = (NFMT.Common.OperateEnum)operateId;

            NFMT.WareHouse.BLL.ContractStockIn_BLL bll = new NFMT.WareHouse.BLL.ContractStockIn_BLL();

            switch (operateEnum)
            {
                case NFMT.Common.OperateEnum.撤返:
                    result = bll.Goback(user, refId);
                    break;
                case NFMT.Common.OperateEnum.作废:
                    result = bll.Invalid(user, refId);
                    break;
            }

            if (result.ResultStatus == 0)
                result.Message = string.Format("{0}成功", operateEnum.ToString());

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            int subId = 0;
            int refId = 0;

            if (string.IsNullOrEmpty(context.Request.Form["SubId"]) || !int.TryParse(context.Request.Form["SubId"], out subId))
            {
                result.Message = "未选择分配合约";
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }

            if (string.IsNullOrEmpty(context.Request.Form["RefId"]) || !int.TryParse(context.Request.Form["RefId"], out refId))
            {
                result.Message = "分配序号不存在";
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }

            try
            {

                NFMT.WareHouse.BLL.ContractStockIn_BLL bll = new NFMT.WareHouse.BLL.ContractStockIn_BLL();
                result = bll.Update(user, subId, refId);

                if (result.ResultStatus == 0)
                {
                    result.Message = "入库分配修改成功";
                }
            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 41, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.提交审核, NFMT.Common.OperateEnum.作废, NFMT.Common.OperateEnum.撤返 });

                string redirectUrl = "StockInContractList.aspx";

                this.navigation1.Routes.Add("入库分配列表", "StockInContractList.aspx");
                this.navigation1.Routes.Add("入库分配明细", string.Empty);

                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect(redirectUrl);

                int refId = 0;
                if (!int.TryParse(Request.QueryString["id"], out refId))
                    Response.Redirect(redirectUrl);

                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();
                //获取入库分配
                NFMT.WareHouse.BLL.ContractStockIn_BLL contractStockInBLL = new NFMT.WareHouse.BLL.ContractStockIn_BLL();
                result = contractStockInBLL.Get(user, refId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.WareHouse.Model.ContractStockIn contractStockIn = result.ReturnValue as NFMT.WareHouse.Model.ContractStockIn;
                if (contractStockIn == null || contractStockIn.RefId <= 0)
                    Response.Redirect(redirectUrl);

                this.curContractStockIn = contractStockIn;

                //获取入库登记
                NFMT.WareHouse.BLL.StockInBLL stockInBLL = new NFMT.WareHouse.BLL.StockInBLL();
                result = stockInBLL.Get(user, contractStockIn.StockInId);

                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.WareHouse.Model.StockIn stockIn = result.ReturnValue as NFMT.WareHouse.Model.StockIn;
                if (stockIn == null || stockIn.StockInId <= 0)
                    Response.Redirect(redirectUrl);

                this.curStockIn = stockIn;

                NFMT.WareHouse.CustomTypeEnum customsType = (NFMT.WareHouse.CustomTypeEnum)stockIn.CustomType;
                this.CustomTypeName = customsType.ToString("F");

                NFMT.User.Model.Corporation corp = NFMT.User.UserProvider.Corporations.FirstOrDefault(temp => temp.CorpId == stockIn.CorpId);
                if (corp != null)
                    this.CorpName = corp.CorpName;

                NFMT.Data.Model.Asset asset = NFMT.Data.BasicDataProvider.Assets.FirstOrDefault(temp => temp.AssetId == stockIn.AssetId);
                if (asset != null)
                    this.AssetName = asset.AssetName;

                NFMT.Data.Model.MeasureUnit unit = NFMT.Data.BasicDataProvider.MeasureUnits.FirstOrDefault(temp => temp.MUId == stockIn.UintId);
                if (unit != null)
                    this.MUName = unit.MUName;

                NFMT.WareHouse.BLL.ContractStockIn_BLL bll = new NFMT.WareHouse.BLL.ContractStockIn_BLL();
                NFMT.Common.SelectModel select = bll.GetContractSelect(1, 100, "si.StockInId desc", stockIn.StockInId);
                result = bll.Load(user, select);
                int totalRows = result.AffectCount;
                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                this.curContractJson = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter());

                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                string json = serializer.Serialize(contractStockIn);
                this.hidModel.Value = json;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);

            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
            {
                string sortDataField = context.Request.QueryString["sortdatafield"].Trim();
                string sortOrder = context.Request.QueryString["sortorder"].Trim();

                switch (sortDataField)
                {
                    case "RefNo":
                        sortDataField = "si.RefNo";
                        break;
                    case "StockInDate":
                        sortDataField = "si.StockInDate";
                        break;
                    case "GrossWeight":
                        sortDataField = "si.GrossAmount";
                        break;
                    case "AssetName":
                        sortDataField = "ass.AssetName";
                        break;
                    case "BrandName":
                        sortDataField = "bra.BrandName ";
                        break;
                    case "StatusName":
                        sortDataField = "ref.RefStatus";
                        break;
                }
                orderStr = string.Format("{0} {1}", sortDataField, sortOrder);
            }

            int subId = 0;
            int refId = 0;

            if (string.IsNullOrEmpty(context.Request.QueryString["subId"]) || !int.TryParse(context.Request.QueryString["subId"], out subId))
            {
                context.Response.Write("子合约序号错误");
                context.Response.End();
            }

            if(string.IsNullOrEmpty(context.Request.QueryString["refId"]) || !int.TryParse(context.Request.QueryString["refId"],out refId))
                refId =0 ;

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.WareHouse.BLL.ContractStockIn_BLL bll = new NFMT.WareHouse.BLL.ContractStockIn_BLL();
            NFMT.Common.SelectModel select = bll.GetSelectedModel(pageIndex, pageSize, orderStr,subId,refId);
            NFMT.Common.ResultModel result = bll.Load(user, select);

            context.Response.ContentType = "text/plain";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            int totalRows = result.AffectCount;
            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;

            Dictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("count", totalRows);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic, new Newtonsoft.Json.Converters.DataTableConverter());

            context.Response.Write(postData);
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            string contractStr = context.Request.Form["Contract"];
            string detailStr = context.Request.Form["ContractDetail"];
            string priceStr = context.Request.Form["ContractPrice"];
            string outCorpStr = context.Request.Form["OutCorps"];
            string inCorpStr = context.Request.Form["InCorps"];
            string deptStr = context.Request.Form["Depts"];
            //string isSubmitAuditStr = context.Request.Form["IsSubmitAudit"];
            string checkedClauseStr = context.Request.Form["checkedClause"];
            string subStr = context.Request.Form["sub"];
            string stockLogIds = context.Request.Form["stockLogIds"];
            string contractTypesStr = context.Request.Form["ContractTypes"];

            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            if (string.IsNullOrEmpty(contractStr))
            {
                result.Message = "合约不能为空";
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }
            if (string.IsNullOrEmpty(detailStr))
            {
                result.Message = "合约明细不能为空";
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }
            if (string.IsNullOrEmpty(priceStr))
            {
                result.Message = "合约价格不能为空";
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }
            if (string.IsNullOrEmpty(outCorpStr))
            {
                result.Message = "外部公司不能为空";
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }
            if (string.IsNullOrEmpty(inCorpStr))
            {
                result.Message = "内部公司不能为空";
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }
            if (string.IsNullOrEmpty(deptStr))
            {
                result.Message = "执行不能为空";
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }
            if (string.IsNullOrEmpty(subStr))
            {
                result.Message = "子合约不能为空";
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                context.Response.End();
            }

            //bool isSubmitAudit = false;
            //if (string.IsNullOrEmpty(isSubmitAuditStr) || !bool.TryParse(isSubmitAuditStr, out isSubmitAudit))
            //    isSubmitAudit = false;

            try
            {
                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

                NFMT.Contract.Model.Contract contract = serializer.Deserialize<NFMT.Contract.Model.Contract>(contractStr);
                NFMT.Contract.Model.ContractDetail detail = serializer.Deserialize<NFMT.Contract.Model.ContractDetail>(detailStr);
                NFMT.Contract.Model.ContractPrice price = serializer.Deserialize<NFMT.Contract.Model.ContractPrice>(priceStr);
                List<NFMT.Contract.Model.ContractClause> contractClauses = new List<NFMT.Contract.Model.ContractClause>();
                if (!string.IsNullOrEmpty(checkedClauseStr))
                    contractClauses = serializer.Deserialize<List<NFMT.Contract.Model.ContractClause>>(checkedClauseStr);

                NFMT.Contract.Model.ContractSub contractSub = serializer.Deserialize<NFMT.Contract.Model.ContractSub>(subStr);

                char[] splitStr = new char[1];
                splitStr[0] = ',';
                List<NFMT.Contract.Model.ContractCorporationDetail> outCorps = new List<NFMT.Contract.Model.ContractCorporationDetail>();
                List<NFMT.Contract.Model.ContractCorporationDetail> inCorps = new List<NFMT.Contract.Model.ContractCorporationDetail>();
                List<NFMT.Contract.Model.ContractDept> depts = new List<NFMT.Contract.Model.ContractDept>();

                string[] strs = outCorpStr.Split(splitStr, StringSplitOptions.RemoveEmptyEntries);
                foreach (string s in strs)
                {
                    var obj = serializer.Deserialize<NFMT.Contract.Model.ContractCorporationDetail>(s);
                    outCorps.Add(obj);
                }

                strs = inCorpStr.Split(splitStr, StringSplitOptions.RemoveEmptyEntries);
                foreach (string s in strs)
                {
                    var obj = serializer.Deserialize<NFMT.Contract.Model.ContractCorporationDetail>(s);
                    inCorps.Add(obj);
                }

                strs = deptStr.Split(splitStr, StringSplitOptions.RemoveEmptyEntries);
                foreach (string s in strs)
                {
                    var obj = serializer.Deserialize<NFMT.Contract.Model.ContractDept>(s);
                    depts.Add(obj);
                }

                List<NFMT.Contract.Model.ContractTypeDetail> contractTypes = new List<NFMT.Contract.Model.ContractTypeDetail>();
                if (!string.IsNullOrEmpty(contractTypesStr))
                {
                    strs = contractTypesStr.Split(splitStr, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string s in strs)
                    {
                        var obj = serializer.Deserialize<NFMT.Contract.Model.ContractTypeDetail>(s);
                        obj.ContractId = contract.ContractId;
                        contractTypes.Add(obj);
                    }
                }

                using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
                {
                    NFMT.Contract.BLL.ContractBLL bll = new NFMT.Contract.BLL.ContractBLL();
                    result = bll.ContractInCreate(user, contract, detail, price, outCorps, inCorps, depts, contractClauses, contractSub, contractTypes);

                    NFMT.Contract.Model.Contract resultContract = result.ReturnValue as NFMT.Contract.Model.Contract;
                    if (resultContract == null || resultContract.ContractId <= 0)
                    {
                        result.Message = "合约新增失败";
                        result.ResultStatus = -1;
                        context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                        context.Response.End();
                    }
                    int subId = result.AffectCount;

                    List<int> ids = new List<int>();
                    string[] logIds = stockLogIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string id in logIds)
                    {
                        int stockLogId = 0;
                        if (int.TryParse(id, out stockLogId) && stockLogId > 0)
                            ids.Add(stockLogId);
                    }
                    NFMT.WareHouse.BLL.ContractStockIn_BLL sbll = new NFMT.WareHouse.BLL.ContractStockIn_BLL();
                    result = sbll.ContractInCreateStockOperate(user, resultContract, subId, ids);
                    if (result.ResultStatus != 0)
                    {
                        result.Message = "库存关联新增失败";
                        result.ResultStatus = -1;
                        context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                        context.Response.End();
                    }
                    else
                    {
                        result.Message = "合约添加成功";
                        result.AffectCount = subId;
                        result.ReturnValue = resultContract;
                    }

                    scope.Complete();
                }

            }
            catch (Exception ex)
            {
                result.ResultStatus = -1;
                result.Message = ex.Message;
            }

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result));
        }
        public void ProcessRequest(HttpContext context)
        {
            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);

            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
            {
                string sortDataField = context.Request.QueryString["sortdatafield"].Trim();
                string sortOrder = context.Request.QueryString["sortorder"].Trim();

                switch (sortDataField)
                {
                    case "StockOutId":
                        sortDataField = "so.StockOutId";
                        break;
                    case "StockOutTime":
                        sortDataField = "so.StockOutTime";
                        break;
                    case "SubNo":
                        sortDataField = "cs.SubNo";
                        break;
                    case "ApplyNo":
                        sortDataField = "app.ApplyNo";
                        break;
                    case "InCorpName":
                        sortDataField = "inCorp.CorpName ";
                        break;
                    case "OutCorpName":
                        sortDataField = "outCorp.CorpName";
                        break;
                    case "AssetName":
                        sortDataField = "ass.AssetName";
                        break;
                    case "OutWeight":
                        sortDataField = "od.SumWeight";
                        break;
                    case "ExecutorName":
                        sortDataField = "emp.Name";
                        break;
                    case "StatusName":
                        sortDataField = "so.StockOutStatus";
                        break;
                }
                orderStr = string.Format("{0} {1}", sortDataField, sortOrder);
            }

            int subId = 0;
            if (string.IsNullOrEmpty(context.Request.QueryString["id"]) || !int.TryParse(context.Request.QueryString["id"], out subId))
                subId = 0;
            int stockInId = 0;
            if (string.IsNullOrEmpty(context.Request.QueryString["stockId"]) || !int.TryParse(context.Request.QueryString["stockId"], out stockInId))
                stockInId = 0;

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            NFMT.WareHouse.BLL.StockInBLL stockInBLL = new NFMT.WareHouse.BLL.StockInBLL();
            NFMT.Common.ResultModel result = stockInBLL.Get(user, stockInId);
            int corpId = 0;
            int assetId = 0;
            int customsType = 0;
            if (result.ResultStatus == 0)
            {
                NFMT.WareHouse.Model.StockIn stockIn = result.ReturnValue as NFMT.WareHouse.Model.StockIn;
                if (stockIn != null && stockIn.StockInId > 0)
                {
                    corpId = stockIn.CorpId;
                    assetId = stockIn.AssetId;
                    customsType = stockIn.CustomType;
                }
            }

            NFMT.WareHouse.BLL.ContractStockIn_BLL bll = new NFMT.WareHouse.BLL.ContractStockIn_BLL();
            NFMT.Common.SelectModel select = bll.GetStockInCanSelect(pageIndex, pageSize, orderStr, subId,assetId,corpId,customsType);
            NFMT.Common.IAuthority auth = new NFMT.Authority.ContractAuth();
            result = bll.Load(user, select,auth);

            context.Response.ContentType = "text/plain";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            int totalRows = result.AffectCount;
            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;

            Dictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("count", totalRows);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic, new Newtonsoft.Json.Converters.DataTableConverter());

            context.Response.Write(postData);
        }
示例#11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 41, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.查询 });

                string redirectUrl = "StockInContractList.aspx";

                this.navigation1.Routes.Add("入库分配列表", "StockInContractList.aspx");
                this.navigation1.Routes.Add("合约列表", "StockInNoContractList.aspx");
                this.navigation1.Routes.Add("入库分配", string.Empty);

                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect(redirectUrl);

                int stockInId = 0;
                if (!int.TryParse(Request.QueryString["id"], out stockInId))
                    Response.Redirect(redirectUrl);

                //获取入库登记
                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

                NFMT.WareHouse.BLL.StockInBLL stockInBLL = new NFMT.WareHouse.BLL.StockInBLL();
                result = stockInBLL.Get(user, stockInId);

                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.WareHouse.Model.StockIn stockIn = result.ReturnValue as NFMT.WareHouse.Model.StockIn;
                if (stockIn == null || stockIn.StockInId <= 0)
                    Response.Redirect(redirectUrl);

                this.curStockIn = stockIn;

                NFMT.WareHouse.CustomTypeEnum customsType = (NFMT.WareHouse.CustomTypeEnum)stockIn.CustomType;
                this.CustomTypeName = customsType.ToString("F");

                NFMT.User.Model.Corporation corp = NFMT.User.UserProvider.Corporations.FirstOrDefault(temp => temp.CorpId == stockIn.CorpId);
                if (corp != null)
                    this.CorpName = corp.CorpName;

                NFMT.Data.Model.Asset asset = NFMT.Data.BasicDataProvider.Assets.FirstOrDefault(temp => temp.AssetId == stockIn.AssetId);
                if (asset != null)
                    this.AssetName = asset.AssetName;

                NFMT.Data.Model.MeasureUnit unit = NFMT.Data.BasicDataProvider.MeasureUnits.FirstOrDefault(temp => temp.MUId == stockIn.UintId);
                if (unit != null)
                    this.MUName = unit.MUName;

                NFMT.WareHouse.BLL.ContractStockIn_BLL bll = new NFMT.WareHouse.BLL.ContractStockIn_BLL();
                NFMT.Common.SelectModel select = bll.GetContractSelect(1, 100, "si.StockInId desc",stockIn.StockInId);
                result = bll.Load(user, select);
                int totalRows = result.AffectCount;
                System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
                this.curContractJson = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter());

                if (result.AffectCount > 0)
                {
                    //合约存在,即修改状态
                    System.Data.DataRow dr = dt.Rows[0];
                    if (dr["ContractId"] == DBNull.Value || !int.TryParse(dr["ContractId"].ToString(), out this.curSubContractId))
                        Response.Redirect(redirectUrl);
                }

                NFMT.Data.Model.Brand brand =  NFMT.Data.BasicDataProvider.Brands.FirstOrDefault(temp => temp.BrandId == this.curStockIn.BrandId);
                if (brand != null && brand.BrandId > 0)
                    this.curBrandName = brand.BrandName;
            }
        }
示例#12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            string redirectUrl = string.Format("{0}WareHouse/StockInList.aspx", NFMT.Common.DefaultValue.NftmSiteName);

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 41, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.提交审核, NFMT.Common.OperateEnum.作废, NFMT.Common.OperateEnum.撤返, NFMT.Common.OperateEnum.确认完成 });

                this.navigation1.Routes.Add("入库登记", redirectUrl);
                this.navigation1.Routes.Add("入库登记明细", string.Empty);

                this.curStockType = (int)NFMT.Data.StyleEnum.库存类型;
                this.curCustomType = (int)NFMT.Data.StyleEnum.报关状态;

                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect(redirectUrl);

                int stockInId = 0;
                if (!int.TryParse(Request.QueryString["id"], out stockInId) || stockInId <= 0)
                    Response.Redirect(redirectUrl);

                NFMT.WareHouse.BLL.StockInBLL stockInBLL = new NFMT.WareHouse.BLL.StockInBLL();
                NFMT.Common.ResultModel result = stockInBLL.Get(user, stockInId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.WareHouse.Model.StockIn stockIn = result.ReturnValue as NFMT.WareHouse.Model.StockIn;
                this.curStockIn = stockIn;

                if (stockIn != null)
                {
                    NFMT.Common.AuditModel model = new NFMT.Common.AuditModel()
                    {
                        AssName = stockIn.AssName,
                        DalName = stockIn.DalName,
                        DataBaseName = stockIn.DataBaseName,
                        Id = stockIn.Id,
                        Status = stockIn.Status,
                        TableName = stockIn.TableName
                    };
                    string json = serializer.Serialize(model);
                    this.hidmodel.Value = json;
                }

                //获取入库合约关联表
                NFMT.WareHouse.BLL.ContractStockIn_BLL contractStockInBLL = new NFMT.WareHouse.BLL.ContractStockIn_BLL();
                NFMT.Common.ResultModel res = contractStockInBLL.GetByStockInId(user, stockIn.StockInId, NFMT.Common.StatusEnum.已录入);
                if (res.ResultStatus == 0)
                {
                    NFMT.WareHouse.Model.ContractStockIn contractStockIn = res.ReturnValue as NFMT.WareHouse.Model.ContractStockIn;
                    if (contractStockIn != null && contractStockIn.RefId > 0)
                    {
                        this.curContractStockIn = contractStockIn;

                        //获取子合约
                        NFMT.Contract.BLL.ContractSubBLL contractSubBLL = new NFMT.Contract.BLL.ContractSubBLL();
                        res = contractSubBLL.Get(user, contractStockIn.ContractSubId);
                        if (res.ResultStatus != 0)
                            Response.Redirect(redirectUrl);

                        NFMT.Contract.Model.ContractSub contractSub = res.ReturnValue as NFMT.Contract.Model.ContractSub;
                        if (contractSub == null)
                            Response.Redirect(redirectUrl);

                        this.curSubId = contractSub.SubId;

                        res = stockInBLL.Load(user, contractSub.SubId, NFMT.Common.StatusEnum.已录入);
                        if (res.ResultStatus != 0)
                            Response.Redirect(redirectUrl);

                        List<NFMT.WareHouse.Model.StockIn> stockIns = res.ReturnValue as List<NFMT.WareHouse.Model.StockIn>;
                        if (stockIns == null)
                            Response.Redirect(redirectUrl);

                        decimal sumWeight = stockIns.Sum(temp => temp.GrossAmount);
                        int contractId = contractSub.ContractId;

                        //获取合约
                        NFMT.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL();
                        res = contractBLL.Get(user, contractId);
                        if (res.ResultStatus != 0)
                            Response.Redirect(redirectUrl);

                        NFMT.Contract.Model.Contract contract = res.ReturnValue as NFMT.Contract.Model.Contract;
                        if (contract == null)
                            Response.Redirect(redirectUrl);

                        this.contractExpander1.CurContract = contract;
                        this.contractExpander1.CurContractSub = contractSub;
                        this.contractExpander1.RedirectUrl = redirectUrl;
                    }
                }
            }
        }
示例#13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            NFMT.User.UserSecurity security = user as NFMT.User.UserSecurity;
            this.curDeptId = security.Dept.DeptId;

            string redirectUrl = string.Format("{0}WareHouse/StockInList.aspx", NFMT.Common.DefaultValue.NftmSiteName);

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 41, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

                this.navigation1.Routes.Add("入库登记", string.Format("{0}WareHouse/StockInList.aspx", NFMT.Common.DefaultValue.NftmSiteName));
                this.navigation1.Routes.Add("入库登记修改", string.Empty);

                this.curStockType = (int)NFMT.Data.StyleEnum.库存类型;
                this.curCustomType = (int)NFMT.Data.StyleEnum.报关状态;

                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect(redirectUrl);

                int stockInId = 0;

                if (!int.TryParse(Request.QueryString["id"], out stockInId) || stockInId <= 0)
                    Response.Redirect(redirectUrl);

                NFMT.WareHouse.BLL.StockInBLL stockInBLL = new NFMT.WareHouse.BLL.StockInBLL();
                NFMT.Common.ResultModel result = stockInBLL.Get(user, stockInId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.WareHouse.Model.StockIn stockIn = result.ReturnValue as NFMT.WareHouse.Model.StockIn;
                if (stockIn == null || stockIn.StockInId <= 0)
                    Response.Redirect(redirectUrl);

                this.curStockIn = stockIn;

                //获取入库合约关联表
                NFMT.WareHouse.BLL.ContractStockIn_BLL contractStockInBLL = new NFMT.WareHouse.BLL.ContractStockIn_BLL();
                NFMT.Common.ResultModel res = contractStockInBLL.GetByStockInId(user, stockIn.StockInId);
                if (res.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.WareHouse.Model.ContractStockIn contractStockIn = res.ReturnValue as NFMT.WareHouse.Model.ContractStockIn;
                if (contractStockIn == null)
                    Response.Redirect(redirectUrl);

                //获取子合约
                NFMT.Contract.BLL.ContractSubBLL contractSubBLL = new NFMT.Contract.BLL.ContractSubBLL();
                res = contractSubBLL.Get(user, contractStockIn.ContractSubId);
                if (res.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Contract.Model.ContractSub contractSub = res.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (contractSub == null)
                    Response.Redirect(redirectUrl);

                this.curSubId = contractSub.SubId;
                int contractId = contractSub.ContractId;

                this.curContractId = contractSub.ContractId;

                //获取合约
                NFMT.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL();
                res = contractBLL.Get(user, contractId);
                if (res.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.Contract.Model.Contract contract = res.ReturnValue as NFMT.Contract.Model.Contract;
                if (contract == null)
                    Response.Redirect(redirectUrl);

                this.contractExpander1.CurContract = contract;
                this.contractExpander1.CurContractSub = contractSub;
                this.contractExpander1.RedirectUrl = redirectUrl;

            }
        }