コード例 #1
0
 private void DoSelect()
 {
     if (!string.IsNullOrEmpty(id))
     {
         IList <StockCheckDetail> scdEnts = StockCheckDetail.FindAllByProperty("StockCheckId", id);
         this.PageState.Add("DataList", scdEnts);
     }
 }
コード例 #2
0
        string type = String.Empty; // 对象类型
        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            StockCheck     scEnt   = null;
            IList <String> strList = RequestData.GetList <string>("data");

            switch (RequestActionString)
            {
            case "update":
                scEnt = this.GetMergedData <StockCheck>();
                scEnt.DoUpdate();
                ProcessDetail(strList, scEnt);
                break;

            case "create":
                scEnt       = this.GetPostedData <StockCheck>();
                scEnt.State = "未结束";
                scEnt.DoCreate();
                ProcessDetail(strList, scEnt);
                break;

            case "delete":
                scEnt = this.GetTargetData <StockCheck>();
                scEnt.DoDelete();
                return;

            default:
                if (op != "c" && op != "cs")
                {
                    if (!String.IsNullOrEmpty(id))
                    {
                        scEnt = StockCheck.Find(id);
                        SetFormData(scEnt);
                        IList <StockCheckDetail> scdEnts = StockCheckDetail.FindAllByProperty("StockCheckId", id);
                        PageState.Add("DataList", scdEnts);
                    }
                }
                else
                {
                    PageState.Add("StockCheckNo", DataHelper.QueryValue("select SHHG_AimExamine.dbo.fun_getStockCheckNo()"));
                    this.PageState.Add("FlowEnum", SysEnumeration.GetEnumDictList("WorkFlow.Simple"));
                    if (RequestActionString == "submitfinish")
                    {
                        StockCheck pc = StockCheck.Find(this.RequestData.Get <string>("id"));
                        pc.State = "End";
                        // pc.InventoryState = this.RequestData.Get<string>("ApprovalState");
                        pc.Save();
                    }
                }
                break;
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            StockCheck ent = null;

            switch (RequestActionString)
            {
            case "delete":
                ent = this.GetTargetData <StockCheck>();
                ent.DoDelete();
                break;

            case "batchdelete":
                DoBatchDelete();
                break;

            case "SubmitExamine":
                string id = this.RequestData.Get <string>("Id");
                ent = StockCheck.Find(id);
                ent.WorkFlowState = RequestData.Get <string>("state");
                ent.ExamineResult = RequestData.Get <string>("ApprovalState");
                ent.DoUpdate();
                StartFlow(id);
                break;

            case "AutoExecuteFlow":
                Task task = Task.FindAllByProperties(Task.Prop_WorkflowInstanceID, this.RequestData.Get <string>("FlowId"))[0];
                //自动执行,关键代码
                Aim.WorkFlow.WorkFlow.AutoExecute(task);
                this.PageState.Add("TaskId", task.ID);
                break;

            default:
                if (RequestData.Get <string>("optype") == "getChildData")
                {
                    string stockCheckId             = RequestData.Get <string>("StockCheckId");
                    IList <StockCheckDetail> scdEnt = StockCheckDetail.FindAllByProperty("StockCheckId", stockCheckId);
                    PageState.Add("DetailList", scdEnt);
                }
                else
                {
                    DoSelect();
                }
                break;
            }
        }
コード例 #4
0
        private void ProcessDetail(IList <string> strList, StockCheck ent)
        {
            IList <StockCheckDetail> scEnts = StockCheckDetail.FindAllByProperty("StockCheckId", ent.Id);

            foreach (StockCheckDetail tent in scEnts)
            {
                tent.DoDelete();
            }
            StockCheckDetail scdEnt = null;

            foreach (string str in strList)
            {
                JObject json = JsonHelper.GetObject <JObject>(str);
                scdEnt = new StockCheckDetail();
                scdEnt.StockCheckId    = ent.Id;
                scdEnt.ProductId       = json.Value <string>("ProductId");
                scdEnt.ProductName     = json.Value <string>("ProductName");
                scdEnt.ProductCode     = json.Value <string>("ProductCode");
                scdEnt.ProductPcn      = json.Value <string>("ProductPcn");
                scdEnt.StockQuantity   = json.Value <int>("StockQuantity");
                scdEnt.StockCheckState = json.Value <string>("StockCheckState");
                scdEnt.DoCreate();
            }
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            ent  = StockCheck.Find(id);
            switch (RequestActionString)
            {
            case "WorkFlowEnd":
                ent.WorkFlowState = RequestData.Get <string>("state");
                ent.ExamineResult = RequestData.Get <string>("ApprovalState");
                ent.State         = "已结束";
                ent.DoUpdate();
                IList <StockCheckDetail> scdEnts = StockCheckDetail.FindAllByProperty("StockCheckId", id);
                foreach (StockCheckDetail scdEnt in scdEnts)
                {
                    if (scdEnt.StockCheckResult != "正常")
                    {
                        scdEnt.StockCheckState = "盘点结束";
                        scdEnt.DoUpdate();
                    }
                }
                if (ent.ExamineResult == "同意")
                {
                    foreach (StockCheckDetail scdEnt in scdEnts)
                    {
                        if (scdEnt.StockCheckResult != "正常")    //创建库存变更日志  并更改库存
                        {
                            StockLog slEnt = new StockLog();
                            slEnt.InOrOutDetailId = scdEnt.Id;
                            StockCheck scEnt = StockCheck.Find(scdEnt.StockCheckId);
                            slEnt.InOrOutBillNo = scEnt.StockCheckNo;
                            slEnt.OperateType   = "库存盘点";
                            slEnt.WarehouseId   = scEnt.WarehouseId;
                            slEnt.WarehouseName = scEnt.WarehouseName;
                            slEnt.StockQuantity = scdEnt.StockQuantity;
                            slEnt.Quantity      = scdEnt.StockCheckQuantity - scdEnt.StockQuantity;
                            slEnt.ProductId     = scdEnt.ProductId;
                            Product pEnt = Product.Find(scdEnt.ProductId);
                            slEnt.ProductName = pEnt.Name;
                            slEnt.ProductCode = pEnt.Code;
                            slEnt.ProductIsbn = pEnt.Isbn;
                            slEnt.ProductPcn  = pEnt.Pcn;
                            slEnt.CreateId    = UserInfo.UserID;
                            slEnt.CreateName  = UserInfo.Name;
                            slEnt.CreateTime  = System.DateTime.Now;
                            slEnt.DoCreate();
                            IList <StockInfo> siEnts = StockInfo.FindAllByProperties("ProductId", scdEnt.ProductId, "WarehouseId", ent.WarehouseId);
                            if (siEnts.Count > 0)
                            {
                                siEnts[0].StockQuantity = scdEnt.StockCheckQuantity;
                                siEnts[0].DoUpdate();
                            }
                        }
                    }
                }
                break;

            default:
                DoSelect();
                break;
            }
            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    SetFormData(ent);
                }
            }
        }