Exemple #1
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;
            }
        }
Exemple #2
0
        public void StartFlow(string formId)
        {
            string code = this.RequestData.Get <string>("FlowKey");

            Aim.WorkFlow.WorkflowTemplate ne = Aim.WorkFlow.WorkflowTemplate.FindAllByProperties(Aim.WorkFlow.WorkflowTemplate.Prop_Code, code)[0];
            //启动流程
            //表单路径,后面加上参数传入
            StockCheck scEnt   = StockCheck.Find(formId);
            string     formUrl = "/SaleManagement/StockCheckView.aspx?id=" + formId;
            Guid       guid    = Aim.WorkFlow.WorkFlow.StartWorkFlow(formId, formUrl, "盘点单【" + scEnt.StockCheckNo + "】申请人【" + scEnt.CreateName + "】", code, this.UserInfo.UserID, this.UserInfo.Name);

            //返回流程的Id
            this.PageState.Add("FlowId", guid.ToString());
        }
        public void StartFlow()
        {
            string     state = this.RequestData.Get <string>("state");
            string     id    = this.RequestData.Get <string>("Id");
            StockCheck pb    = StockCheck.Find(id);

            pb.State = state;
            pb.Save();
            string code = this.RequestData.Get <string>("FlowKey");

            //启动流程
            //表单路径,后面加上参数传入
            string formUrl = "/StockManagement/FrmInventoryView.aspx?op=u&&id=" + id;
            Guid   guid    = Aim.WorkFlow.WorkFlow.StartWorkFlow(id, formUrl, "仓库盘点异常审批(" + pb.StockCheckNo + ")[" + pb.CreateName + "]", code, this.UserInfo.UserID, this.UserInfo.Name);

            this.PageState.Add("FlowId", guid.ToString());
        }
Exemple #4
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;
            }
        }
        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);
                }
            }
        }
        private void CreateLog()
        {
            IList <InWarehouseDetailDetail> iwddEnts = InWarehouseDetailDetail.FindAll();//入库

            foreach (InWarehouseDetailDetail iwddEnt in iwddEnts)
            {
                StockLog    slEnt = new StockLog();
                InWarehouse iwEnt = null;
                if (!string.IsNullOrEmpty(iwddEnt.InWarehouseDetailId))
                {
                    slEnt.InOrOutDetailId = iwddEnt.InWarehouseDetailId;
                    InWarehouseDetail iwdEnt = InWarehouseDetail.Find(iwddEnt.InWarehouseDetailId);
                    iwEnt = InWarehouse.Find(iwdEnt.InWarehouseId);
                }
                else
                {
                    slEnt.InOrOutDetailId = iwddEnt.OtherInWarehouseDetailId;
                    OtherInWarehouseDetail oiwdEnt = OtherInWarehouseDetail.Find(iwddEnt.OtherInWarehouseDetailId);
                    iwEnt = InWarehouse.Find(oiwdEnt.InWarehouseId);
                }
                slEnt.InOrOutBillNo = iwEnt.InWarehouseNo;
                slEnt.OperateType   = "产品入库";
                slEnt.WarehouseId   = iwEnt.WarehouseId;
                slEnt.WarehouseName = iwEnt.WarehouseName;
                //IList<StockInfo> siEnts = StockInfo.FindAllByProperties(StockInfo.Prop_ProductId, iwddEnt.ProductId, StockInfo.Prop_WarehouseId, iwEnt.WarehouseId);
                //if (siEnts.Count > 0)
                //{
                //    slEnt.StockQuantity = siEnts[0].StockQuantity;
                //}
                slEnt.Quantity  = iwddEnt.Quantity;
                slEnt.ProductId = iwddEnt.ProductId;
                Product pEnt = Product.TryFind(iwddEnt.ProductId);
                if (pEnt != null)
                {
                    slEnt.ProductName = pEnt.Name;
                    slEnt.ProductCode = pEnt.Code;
                    slEnt.ProductIsbn = pEnt.Isbn;
                    slEnt.ProductPcn  = pEnt.Pcn;
                    slEnt.CreateId    = iwddEnt.CreateId;
                    slEnt.CreateName  = iwddEnt.CreateName;
                    slEnt.CreateTime  = iwddEnt.CreateTime;
                    slEnt.DoCreate();
                }
            }
            //生成出库日志
            IList <DelieryOrderPart> dopEnts = DelieryOrderPart.FindAllByProperty(DelieryOrderPart.Prop_State, "已出库");

            foreach (DelieryOrderPart dopEnt in dopEnts)
            {
                StockLog slEnt = new StockLog();
                slEnt.InOrOutDetailId = dopEnt.Id;
                DeliveryOrder doEnt = DeliveryOrder.Find(dopEnt.DId);
                slEnt.InOrOutBillNo = doEnt.Number;
                slEnt.OperateType   = "产品出库";
                slEnt.WarehouseId   = doEnt.WarehouseId;
                slEnt.WarehouseName = doEnt.WarehouseName;
                //IList<StockInfo> siEnts = StockInfo.FindAllByProperties(StockInfo.Prop_ProductId, iwddEnt.ProductId, StockInfo.Prop_WarehouseId, iwEnt.WarehouseId);
                //if (siEnts.Count > 0)
                //{
                //    slEnt.StockQuantity = siEnts[0].StockQuantity;
                //}
                slEnt.Quantity = dopEnt.OutCount;
                if (!string.IsNullOrEmpty(dopEnt.ProductId))
                {
                    slEnt.ProductId = dopEnt.ProductId;
                    Product pEnt = Product.TryFind(dopEnt.ProductId);
                    if (pEnt != null)
                    {
                        slEnt.ProductName = pEnt.Name;
                        slEnt.ProductCode = pEnt.Code;
                        slEnt.ProductIsbn = pEnt.Isbn;
                        slEnt.ProductPcn  = pEnt.Pcn;
                        slEnt.CreateId    = dopEnt.CreateId;
                        slEnt.CreateName  = dopEnt.CreateName;
                        slEnt.CreateTime  = dopEnt.CreateTime;
                        slEnt.DoCreate();
                    }
                }
            }
            //盘点操作库存日志
            string sql = "select * from SHHG_AimExamine..StockCheckDetail where StockCheckResult!='正常' and StockCheckState='盘点结束'";
            IList <EasyDictionary> scdDics = DataHelper.QueryDictList(sql);

            foreach (EasyDictionary scdDic in scdDics)
            {
                StockLog slEnt = new StockLog();
                slEnt.InOrOutDetailId = scdDic.Get <string>("Id");
                StockCheck scEnt = StockCheck.Find(scdDic.Get <string>("StockCheckId"));
                slEnt.InOrOutBillNo = scEnt.StockCheckNo;
                slEnt.OperateType   = "库存盘点";
                slEnt.WarehouseId   = scEnt.WarehouseId;
                slEnt.WarehouseName = scEnt.WarehouseName;
                slEnt.StockQuantity = scdDic.Get <Int32>("StockQuantity");
                slEnt.Quantity      = scdDic.Get <Int32>("StockCheckQuantity") - scdDic.Get <Int32>("StockQuantity");
                slEnt.ProductId     = scdDic.Get <string>("ProductId");
                Product pEnt = Product.TryFind(slEnt.ProductId);
                if (pEnt != null)
                {
                    slEnt.ProductName = pEnt.Name;
                    slEnt.ProductCode = pEnt.Code;
                    slEnt.ProductIsbn = pEnt.Isbn;
                    slEnt.ProductPcn  = pEnt.Pcn;
                    slEnt.CreateId    = scEnt.CreateId;
                    slEnt.CreateName  = scEnt.CreateName;
                    slEnt.CreateTime  = scEnt.CreateTime;
                    slEnt.DoCreate();
                }
            }
        }