Esempio n. 1
0
    private void BindNotification()
    {

        StocktakeNotification notification = Service.GetNotification(new StocktakeNotification { NotificationID = NotificationID });
        _existsCSMTPart = Service.NotiExistsCSMTPart(notification);
        _existsRepairPart = Service.NotiExistsRepairPart(notification);

        SelectedLocationTypes = notification.StocktakeLocations.Select(l => l.StoreLocationType.TypeName).ToList();
        Toolbar1.Visible = (notification.StocktakeStatus.StatusID == Consts.STOCKTAKE_NEW_NOTIFICATION);
        //Toolbar1.Items[1].Visible = (notification.StocktakeStatus.StatusID == Consts.STOCKTAKE_PUBLISHED);

        List<StocktakeNotification> list = new List<StocktakeNotification> { notification };
        BindDataControl(fvNotification, list);

        RadioButtonList rblEmergency = fvNotification.FindControl("rblEmergency") as RadioButtonList;
        rblEmergency.Enabled = (Mode != PageMode.View);

        TextBox txtPlanDate = fvNotification.FindControl("txtPlanDate") as TextBox;
        txtPlanDate.ReadOnly = (Mode == PageMode.View);

        ImageButton btnCalendar = fvNotification.FindControl("btnCalendar") as ImageButton;
        btnCalendar.Enabled = (Mode != PageMode.View);

        if (notification.StocktakeStatus.StatusID != Consts.STOCKTAKE_NEW_NOTIFICATION)
        {
            //Toolbar1.Controls[0].Visible = false;
        }
        if (notification.StocktakeStatus.StatusID != Consts.STOCKTAKE_PUBLISHED)
        {
            //Toolbar1.Controls[1].Visible = false;
        }
    }
Esempio n. 2
0
        public List <View_StocktakeDetails> GetNotiDetailsByPage(StocktakeNotification notification, List <View_StocktakeDetails> filter, List <View_StocktakeDetails> addition, int pageSize, int pageNumber, out int pageCount, out int itemCount)
        {
            List <View_StocktakeDetails>       list = GetNotificationDetails(notification).ToList();
            IQueryable <View_StocktakeDetails> detailsQry;

            if (filter != null && filter.Count > 0)
            {
                foreach (var item in filter)
                {
                    int index = list.FindIndex(d => d.DetailsID == item.DetailsID);
                    if (index >= 0)
                    {
                        list.RemoveAt(index);
                    }
                }
            }
            if (addition != null && addition.Count > 0)
            {
                foreach (var item in addition)
                {
                    int index = list.FindIndex(d => d.DetailsID == item.DetailsID);
                    if (index < 0)
                    {
                        list.Add(item);
                    }
                }
            }
            detailsQry = list.AsQueryable().OrderBy(d => d.WorkLocation);//.OrderBy(d => d.PartCode);
            List <View_StocktakeDetails> result = this.GetQueryByPage(detailsQry, pageSize, pageNumber, out pageCount, out itemCount).ToList();

            return(result);
        }
Esempio n. 3
0
        public IQueryable <View_StocktakeDetails> GetNotificationDetails(StocktakeNotification notification)
        {
            long notificationID = notification.NotificationID;
            IQueryable <View_StocktakeDetails> detailsQry = Context.View_StocktakeDetails.Where(d => d.NotificationID == notificationID);

            return(detailsQry);
        }
Esempio n. 4
0
        public void GetDetailsByUserTest()
        {
            StocktakeDetailBLL    target       = new StocktakeDetailBLL(); // TODO: Initialize to an appropriate value
            StocktakeNotification notification = null;                     // TODO: Initialize to an appropriate value
            User user = null;                                              // TODO: Initialize to an appropriate value
            List <StocktakeDetails> expected = null;                       // TODO: Initialize to an appropriate value
            List <StocktakeDetails> actual;

            actual = target.GetDetailsByUser(notification, user);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Esempio n. 5
0
    //protected void ddlWorkshop_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    if (!string.IsNullOrEmpty(ddlWorkshop.SelectedValue))
    //    {
    //        Workshop workshop = new Workshop { WorkshopID = Convert.ToInt32(ddlWorkshop.SelectedValue) };
    //        BindSegments(ddlSegment, workshop, true);
    //        ddlSegment.SelectedIndex = 0;
    //    }
    //    else
    //    {
    //        ddlSegment.Items.Clear();
    //    }
    //}

    protected void dlNotification_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item)
        {
            DropDownList ddlPlant = e.Item.FindControl("ddlPlant") as DropDownList;
            BindPlants(ddlPlant);
            StocktakeNotification noti = e.Item.DataItem as StocktakeNotification;

            if (noti != null)
            {
                if (noti.IsStatic != null)
                {
                    RadioButtonList rblIsStatic = e.Item.FindControl("rblIsStatic") as RadioButtonList;
                    rblIsStatic.SelectedIndex = (noti.IsStatic.Value) ? 1 : 0;
                    if (NotificationID != null)
                    {
                        for (int i = rblIsStatic.Items.Count - 1; i >= 0; i--)
                        {
                            if (rblIsStatic.Items[i].Selected == false)
                            {
                                rblIsStatic.Items.RemoveAt(i);
                            }
                        }
                    }
                }
                if (noti.Plant != null)
                {
                    ddlPlant.SelectedValue = noti.Plant.PlantID.ToString();
                    if (NotificationID != null)
                    {
                        int index = ddlPlant.SelectedIndex;
                        for (int i = ddlPlant.Items.Count - 1; i >= 0; i--)
                        {
                            if (i != index)
                            {
                                ddlPlant.Items.RemoveAt(i);
                            }
                        }
                    }
                }
            }
        }
    }
Esempio n. 6
0
    private void RefreshNotiToAnalyse()
    {
        if (gvNew.DataKeys[0].Value != null)
        {
            StocktakeNotification noti = NotiToAnalyse;
            noti.NotificationID = Convert.ToInt64(gvNew.DataKeys[0]["NotificationID"]);

            for (int i = 0; i < gvNew.Rows.Count; i++)
            {
                if (gvNew.DataKeys[i] != null)
                {
                    CheckBox cbSelect = gvNew.Rows[i].Cells[0].FindControl("cbSelect") as CheckBox;
                    if (cbSelect != null)//add selected item
                    {
                        string detailsID = gvNew.DataKeys[i]["DetailsID"].ToString();
                        if (cbSelect.Checked)
                        {
                            View_StocktakeDetails details = new View_StocktakeDetails {
                                DetailsID = long.Parse(detailsID)
                            };
                            if (!noti.DetailsView.Exists(d => d.DetailsID == details.DetailsID))
                            {
                                noti.DetailsView.Add(details);
                            }
                        }
                        else//removed unselected item
                        {
                            int findIndex = noti.DetailsView.FindIndex(d => d.DetailsID.ToString() == detailsID);
                            if (findIndex >= 0)
                            {
                                noti.DetailsView.RemoveAt(findIndex);
                            }
                        }
                    }
                }
            }
            NotiToAnalyse = noti;
        }
    }
Esempio n. 7
0
        /// <summary>
        /// 初始化页面数据
        /// </summary>
        private void InitPageData()
        {
            if (!string.IsNullOrEmpty(Request["id"]))
            {
                this.NoficicationID = Int64.Parse(Request["id"]);
            }

            if (this.NoficicationID == 0)
            {
                ShowPageError("获取通知单ID失败!");
                return;
            }

            if (this.NoficicationID != 0)
            {
                this.Noficication = StocktakeNotification.Find(this.NoficicationID);
            }

            if (this.Noficication == null)
            {
                ShowPageError("获取通知单信息失败!");
                return;
            }
        }
Esempio n. 8
0
 public void CreateAnalyseReport(StocktakeNotification notice, User analyzedBy, out string reportCode, out Int64 reportID) //, string cacheKey, bool submit)
 {
     Channel.CreateAnalyseReport(notice, analyzedBy, out reportCode, out reportID);                                        //,cacheKey,submit);
 }
Esempio n. 9
0
 public void FillStocktakeResult(StocktakeNotification notification, List <View_StocktakeResult> list)
 {
     Channel.FillStocktakeResult(notification, list);
 }
Esempio n. 10
0
    private void BindNotification()
    {
        StocktakeNotification noti;

        if (NotificationID != null)
        {
            noti = Service.GetNotification(new StocktakeNotification {
                NotificationID = NotificationID.Value
            });
            //if (noti.Plant!=null)
            //{
            //    ddlPlant.SelectedValue = noti.Plant.PlantID.ToString();
            //    int index = ddlPlant.SelectedIndex;
            //    for (int i = ddlPlant.Items.Count - 1; i >= 0; i--)
            //    {
            //        if (i!=index)
            //        {
            //            ddlPlant.Items.RemoveAt(i);
            //        }
            //    }
            //}
            //RadioButtonList rblIsStatic = dlNotification.Items[0].FindControl("rblIsStatic") as RadioButtonList;
            //ListItem item = rblIsStatic.Items.FindByValue((!noti.IsStatic).ToString());
            //if (item != null)
            //{
            //    rblIsStatic.Items.Remove(item);
            //}
            //if (noti.IsStatic.Value)
            //{
            //    rblIsStatic.Items.RemoveAt(0);
            //}
            //else
            //{
            //    rblIsStatic.Items.RemoveAt(1);
            //}
        }
        else
        {
            noti = new StocktakeNotification {
                Creator = CurrentUser.UserInfo, DateCreated = DateTime.Now
            };
            if (dlNotification.Items.Count > 0)
            {
                DropDownList    ddlPlant    = dlNotification.Items[0].FindControl("ddlPlant") as DropDownList;
                RadioButtonList rblIsStatic = dlNotification.Items[0].FindControl("rblIsStatic") as RadioButtonList;
                if (rblIsStatic != null)
                {
                    noti.IsStatic = bool.Parse(rblIsStatic.SelectedValue);
                }
                if (ddlPlant != null && !string.IsNullOrEmpty(ddlPlant.SelectedValue))
                {
                    noti.Plant = new Plant {
                        PlantID = int.Parse(ddlPlant.SelectedValue), PlantCode = ddlPlant.SelectedItem.Text
                    };
                }
            }
        }
        List <StocktakeNotification> notiList = new List <StocktakeNotification> {
            noti
        };

        BindDataControl(dlNotification, notiList);
        //ddlPlant_CascadingDropDown.SelectedValue = noti.Plant.PlantID.ToString();
    }
Esempio n. 11
0
 public byte[] ExportStocktakeNotice(StocktakeNotification notification, User exportBy, out string notiCode)
 {
     byte[] compressedContent = Channel.ExportStocktakeNotice(notification, exportBy, out notiCode);
     return(SGM.Common.Utility.Utils.DeCompress(compressedContent));
 }
Esempio n. 12
0
 public StocktakeNotification GetNotification(StocktakeNotification notification)
 {
     return(Channel.GetNotification(notification));
 }
Esempio n. 13
0
 public List <View_StocktakeDetails> GetNotiDetailsByPage(StocktakeNotification notice, List <View_StocktakeDetails> filter, List <View_StocktakeDetails> addition, int pageSize, int pageNumber, out int pageCount, out int itemCount)
 {
     return(Channel.GetNotiDetailsByPage(notice, filter, addition, pageSize, pageNumber, out pageCount, out itemCount));
 }
Esempio n. 14
0
 public List <StocktakeDetails> GetDetailsByUser(StocktakeNotification notification, User user)
 {
     return(new List <StocktakeDetails>());
 }
Esempio n. 15
0
 public List <DiffAnalyseReport> GetDiffAnalyseReportsByNoti(StocktakeNotification noti)
 {
     return(Channel.GetDiffAnalyseReportsByNoti(noti));
 }
Esempio n. 16
0
 public byte[] ExportStocktakeResult(StocktakeNotification notification, User userInfo)
 {
     byte[] compressedContent = Channel.ExportStocktakeResult(notification, userInfo);
     return(SGM.Common.Utility.Utils.DeCompress(compressedContent));
 }
Esempio n. 17
0
 public bool NotiExistsRepairPart(StocktakeNotification notification)
 {
     return(Channel.NotiExistsRepairPart(notification));
 }
Esempio n. 18
0
    protected void Toolbar1_ButtonClicked(object sender, SCS.Web.UI.WebControls.ButtonEventArgs e)
    {
        switch (e.CommandName)
        {
        case "Save":
            RefreshComments();
            RadioButtonList       rblIsStatic  = dlNotification.Items[0].FindControl("rblIsStatic") as RadioButtonList;
            StocktakeNotification notifciation = new StocktakeNotification {
                Creator = CurrentUser.UserInfo, IsStatic = (rblIsStatic.SelectedIndex == 1)
            };
            DropDownList ddlPlant = dlNotification.Items[0].FindControl("ddlPlant") as DropDownList;
            notifciation.Plant = new Plant {
                PlantID = Convert.ToInt32(ddlPlant.SelectedValue)
            };
            if (NotificationID != null)    //update
            {
                notifciation.NotificationID = NotificationID.Value;
                Service.UpdateNotification(notifciation, RemovedDetails.Select(d => d.DetailsID).ToList(), IncludedDetails, false);
            }
            else
            {
                List <long> removed = RemovedDetails.Select(d => d.DetailsID).ToList();
                notifciation.DetailsView = IncludedDetails;
                notifciation             = Service.CreateNotification(notifciation, removed);
                NotificationID           = notifciation.NotificationID;
            }
            RemovedDetails.Clear();
            IncludedDetails.Clear();
            BindData();
            ScriptManager.RegisterStartupScript(this, this.GetType(), "closeScript", "closeDialogOnSave();", true);

            break;

        case "SaveDynamic":
            //StocktakeNotification dynamicNotifciation = new StocktakeNotification { Creator = CurrentUser.UserInfo };
            //if (!string.IsNullOrEmpty(ddlPlant.SelectedValue))
            //{
            //    dynamicNotifciation.Plant = new Plant { PlantID = Convert.ToInt32(ddlPlant.SelectedValue) };
            //}
            //if (NotificationID != null)
            //{
            //    dynamicNotifciation.NotificationID = NotificationID.Value;
            //}
            //else
            //{
            //    dynamicNotifciation.IsStatic = false;
            //    dynamicNotifciation = Service.CreateNotification(dynamicNotifciation, RemovedDynamicDetails);
            //    NotificationID = dynamicNotifciation.NotificationID;
            //    rblGenerateBy.Enabled = false;
            //}
            //List<StocktakeNotification> dynamicNotiList = new List<StocktakeNotification> { dynamicNotifciation };
            //BindDataControl(dlDynamic, dynamicNotiList);

            //Toolbar1.Items[3].Enabled = true;
            break;

        case "query":
            BindData();
            break;

        default:
            break;
        }
    }
Esempio n. 19
0
 public StocktakeNotification CreateNotification(StocktakeNotification notification, List <long> removedDetailsList)
 {
     return(Channel.CreateNotification(notification, removedDetailsList));
 }
Esempio n. 20
0
 public void UpdateNotification(StocktakeNotification notification, List <long> removedDetailsList, List <View_StocktakeDetails> changedDetails, bool removeAll)
 {
     Channel.UpdateNotification(notification, removedDetailsList, changedDetails, removeAll);
 }
Esempio n. 21
0
 public void PublishNotification(StocktakeNotification notification, List <StoreLocationType> locationTypes)
 {
     Channel.PublishNotification(notification, locationTypes);
 }
Esempio n. 22
0
 public List <DiffAnalyseReport> GetReportsByNotification(StocktakeNotification noti)
 {
     return(Context.DiffAnalyseReport.Include("StocktakeNotification").Include("DiffAnalyseReportItem").Where(r => r.StocktakeNotification.NotificationCode == noti.NotificationCode).ToList());
 }
Esempio n. 23
0
 public string ImportResult(StocktakeNotification notification, List <View_StocktakeResult> itemList, string cacheKey, bool submit)
 {
     return(Channel.ImportResult(notification, itemList, cacheKey, submit));
 }
Esempio n. 24
0
    void UCFileUpload1_OnUpload(object sender, EventArgs e)
    {
        UploadEventArgs ue = e as UploadEventArgs;
        DataTable       dtSGMStocktakeItem = ue.ContentTable;

        dtSGMStocktakeItem.Columns["序号"].ColumnName    = "RowNumber";
        dtSGMStocktakeItem.Columns["零件号"].ColumnName   = "PartNo";
        dtSGMStocktakeItem.Columns["工厂"].ColumnName    = "Plant";
        dtSGMStocktakeItem.Columns["库位"].ColumnName    = "Store";
        dtSGMStocktakeItem.Columns["线旁"].ColumnName    = "Line";
        dtSGMStocktakeItem.Columns["加工区"].ColumnName   = "Machining";
        dtSGMStocktakeItem.Columns["存储区域"].ColumnName  = "SLOC";
        dtSGMStocktakeItem.Columns["起始CSN"].ColumnName = "StartCSN";
        dtSGMStocktakeItem.Columns["终止CSN"].ColumnName = "EndCSN";
        dtSGMStocktakeItem.DefaultView.Sort            = "PartNo";
        dtSGMStocktakeItem = dtSGMStocktakeItem.DefaultView.ToTable();

        StocktakeNotification notification = Service.GetNotification(new StocktakeNotification {
            NotificationID = long.Parse(NotiID)
        });
        List <View_StocktakeResult> items = new List <View_StocktakeResult>();
        int           userID   = CurrentUser.UserInfo.UserID;
        List <string> errorMsg = new List <string>();
        List <View_StocktakeResult> itemList = new List <View_StocktakeResult>();
        bool hasError = false;

        for (int i = 0; i < dtSGMStocktakeItem.Rows.Count; i++)
        {
            DataRow       row       = dtSGMStocktakeItem.Rows[i];
            string        partNo    = row["PartNo"].ToString();
            string        plantCode = row["Plant"].ToString();
            string        duns      = row["DUNS"].ToString();
            string        sloc      = row["SLOC"].ToString();
            StoreLocation location  = this.StoreLocations.Find(l => l.LogisticsSysSLOC == sloc);
            if (location == null)
            {
                string msg = string.Format("存储区域【{0}】不存在", sloc);// i + 2);
                UCFileUpload1.AddErrorInfo(msg);
                hasError = true;
                continue;
            }


            if (i % 1000 == 0)
            {
                string startCode = partNo;
                int    end       = i + 999;
                if (end >= dtSGMStocktakeItem.Rows.Count)
                {
                    end = dtSGMStocktakeItem.Rows.Count - 1;
                }
                string endCode = dtSGMStocktakeItem.Rows[end]["PartNo"].ToString();
                items = Service.GetStocktakeResultOfScope(new View_StocktakeResult {
                    NotificationID = notification.NotificationID
                }, startCode, endCode);
            }

            View_StocktakeResult result = null;
            if (result == null)
            {
                result = items.Find(r => r.PartCode == partNo && r.PartPlantCode == plantCode && r.DUNS == duns && r.SGMLocationID != null && r.SGMLocationID == location.LocationID);// && r.SGMItemID != null);
            }
            if (result == null)
            {
                result = items.Find(r => r.PartCode == partNo && r.PartPlantCode == plantCode && r.DUNS == duns && r.RepairLocationID != null && r.RepairLocationID == location.LocationID);//&& r.RepairItemID != null);
            }
            if (result == null)
            {
                result = items.Find(r => r.PartCode == partNo && r.PartPlantCode == plantCode && r.DUNS == duns && r.CSMTLocationID != null && r.CSMTLocationID == location.LocationID);//&& r.CSMTItemID != null);
            }
            if (result == null)
            {
                result = items.Find(r => r.PartCode == partNo && r.PartPlantCode == plantCode && r.DUNS == duns && r.GeneralItemID != null && r.GeneralItemID == location.LocationID);//&& r.CSMTItemID != null);
            }
            if (result == null)
            {
                result = items.FirstOrDefault(r => r.PartCode == partNo && r.PartPlantCode == plantCode && r.DUNS == duns && r.RDCLocationID != null && r.RDCLocationID == location.LocationID);//&& r.RDCItemID != null);
            }
            if (result == null)
            {
                string msg = string.Format("工厂【{0}】,DUNS【{1}】,存储区域为【{2}】的零件【{3}】不在盘点通知单中", plantCode, duns, sloc, partNo);
                UCFileUpload1.AddErrorInfo(msg);
                hasError = true;
            }
            else
            {
                string csmtDUNS = CurrentUser.UserInfo.ConsignmentDUNS;
                View_StocktakeResult result1 = null;
                result1 = items.Find(r => r.PartCode == partNo && r.PartPlantCode == plantCode && r.DUNS == duns && r.CSMTLocationID != null && r.CSMTLocationID == location.LocationID);
                if (string.IsNullOrEmpty(csmtDUNS) && (result1 != null))
                {
                    string msg = string.Format("当前用户无权导入工厂【{0}】,DUNS【{1}】,存储区域为【{2}】的零件【{3}】", plantCode, duns, sloc, partNo);
                    UCFileUpload1.AddErrorInfo(msg);
                    hasError = true;
                }
                if (!string.IsNullOrEmpty(csmtDUNS) && !items.Exists(r => r.PartCode == partNo && r.PartPlantCode == plantCode && r.DUNS == duns && string.Equals(r.CSMTDUNS, csmtDUNS)))
                {
                    string msg = string.Format("当前用户无权导入工厂【{0}】,DUNS【{1}】,存储区域为【{2}】的零件【{3}】", plantCode, duns, sloc, partNo);
                    UCFileUpload1.AddErrorInfo(msg);
                    hasError = true;
                }
                View_StocktakeResult result2 = null;
                result2 = items.Find(r => r.PartCode == partNo && r.PartPlantCode == plantCode && r.DUNS == duns && r.SGMLocationID != null && r.SGMLocationID == location.LocationID);
                if ((CurrentUser.UserInfo.Workshop == null) && (result2 != null))
                {
                    string msg = string.Format("当前用户无权导入当前车间,工厂【{0}】,DUNS【{1}】,存储区域为【{2}】的零件【{3}】的实盘结果", plantCode, duns, sloc, partNo);
                    UCFileUpload1.AddErrorInfo(msg);
                    hasError = true;
                }
                if (!hasError)
                {
                    decimal?available = SGM.Common.Utility.Utils.GetDecimalDbCell(row["Available"]);
                    decimal?qi        = SGM.Common.Utility.Utils.GetDecimalDbCell(row["QI"]);
                    decimal?block     = SGM.Common.Utility.Utils.GetDecimalDbCell(row["Block"]);

                    WorkshopStocktakeDetail detail = null;

                    if (CurrentUser.UserInfo.Workshop != null)
                    {
                        detail =
                            result.WorkshopDetails.FirstOrDefault(d => d.WorkshopCode == CurrentUser.UserInfo.Workshop.WorkshopCode);
                    }

                    if (result.SGMItemID != null && result.SGMLocationID == location.LocationID && CurrentUser.UserInfo.Workshop != null && detail != null)
                    {
                        for (int j = result.WorkshopDetails.Count - 1; j >= 0; j--)
                        {
                            if (result.WorkshopDetails[j].ItemDetailID != detail.ItemDetailID)
                            {
                                result.WorkshopDetails.RemoveAt(j);
                            }
                        }
                        detail.SGMFillinBy = userID;
                        detail.SGMBlock    = block;
                        detail.SGMQI       = qi;
                        detail.Line        = SGM.Common.Utility.Utils.GetDecimalDbCell(row["Line"]);
                        detail.Machining   = SGM.Common.Utility.Utils.GetDecimalDbCell(row["Machining"]);
                        detail.Store       = SGM.Common.Utility.Utils.GetDecimalDbCell(row["Store"]);
                        if (row["StartCSN"] != DBNull.Value && row["StartCSN"] + "" != string.Empty)
                        {
                            detail.StartCSN = row["StartCSN"].ToString();
                        }
                        if (row["EndCSN"] != DBNull.Value && row["EndCSN"] + "" != string.Empty)
                        {
                            detail.EndCSN = row["EndCSN"].ToString();
                        }
                    }
                    else
                    {
                        if (result.CSMTItemID != null && result.CSMTLocationID == location.LocationID)
                        {
                            result.CSMTFillinBy  = userID;
                            result.CSMTAvailable = available;
                            result.CSMTBlock     = block;
                            result.CSMTQI        = qi;
                        }
                        else
                        {
                            if (result.RepairItemID != null && result.RepairLocationID == location.LocationID)
                            {
                                result.RepairFillinBy  = userID;
                                result.RepairAvailable = available;
                                result.RepairBlock     = block;
                                result.RepairQI        = qi;
                            }
                            else
                            {
                                if (result.GeneralItemID != null && result.GenerLocationID == location.LocationID)
                                {
                                    result.GenFillinBy      = userID;
                                    result.GeneralAvailable = available;
                                    result.GeneralBlock     = block;
                                    result.GeneralQI        = qi;
                                }
                                else
                                {
                                    if (result.RDCItemID != DefaultValue.LONG && result.RDCLocationID == location.LocationID)
                                    {
                                        result.RDCFillinBy  = userID;
                                        result.RDCAvailable = available;
                                        result.RDCBlock     = block;
                                        result.RDCQI        = qi;
                                    }
                                }
                            }
                        }
                    }
                    //result.SGMBlock = int.Parse(dtSGMStocktakeItem.Rows[i]["Block"].ToString());

                    itemList.Add(result);
                }
            }
        }
        if (!hasError)
        {
            //List<View_StocktakeResult> tmpList = new List<View_StocktakeResult>();
            //string cacheKey = string.Empty;
            //while (itemList.Count > 0)
            //{
            //    tmpList.Clear();
            //    tmpList.AddRange(itemList.Take((itemList.Count < 20) ? itemList.Count : 20));
            //    itemList.RemoveRange(0, (itemList.Count < 20) ? itemList.Count : 20);
            //    if (itemList.Count > 0)
            //    {
            //        cacheKey = Service.ImportResult(notification, tmpList, cacheKey, false);
            //    }
            //    else
            //    {
            //        Service.ImportResult(notification, tmpList, cacheKey, true);
            //    }
            //    //fill in items
            //}
            Service.FillStocktakeResult(notification, itemList);
            BindDataControl(gvItems, dtSGMStocktakeItem);
            //show information
            this.UCFileUpload1.AddSuccessInfo("上传文件成功", string.Empty, string.Empty);
        }
    }
Esempio n. 25
0
    protected void Toolbar1_ButtonClicked(object sender, SCS.Web.UI.WebControls.ButtonEventArgs e)
    {
        switch (e.CommandName)
        {
        case "query":
            pagerNew.CurrentPage = 1;
            //pagerAnalysis.CurrentPage = 1;
            NotiToAnalyse        = null;
            hdnDeleteItems.Value = string.Empty;
            Query();
            break;

        case "add":

            RefreshNotiToAnalyse();

            if (NotiToAnalyse.DetailsView.Count > 0)
            {
                long   reportID;
                string reportCode;

                Service.CreateAnalyseReport(NotiToAnalyse, CurrentUser.UserInfo, out reportCode, out reportID);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "CreateAnaSuccess", "alert('生成差异分析报告成功!')", true);
            }
            break;

        case "AddAll":
            long   reportIDAll;
            string reportCodeAll;
            View_StocktakeDetails filter = BuildNewAnalyseCondition();

            Service.CreateAnalyseRptByCondition(filter, CurrentUser.UserInfo, out reportCodeAll, out reportIDAll);
            ScriptManager.RegisterStartupScript(this, this.GetType(), "CreateAnaSuccess", "alert('生成差异分析报告成功!')", true);
            Query();
            break;

        case "export":
            string notiCode = null;
            Query();
            if (!string.IsNullOrEmpty(txtMgrNoticeNo.Text.Trim()))
            {
                notiCode = txtMgrNoticeNo.Text.Trim();
            }
            byte[] report = Service.ExportAnalyseReport(FilteredDetails);
            if (report != null)
            {
                Response.Clear();
                Response.Buffer      = true;
                Response.ContentType = "application/vnd.ms-excel";
                //string fileName = HttpUtility.UrlEncode(DateTime.Now.ToString("yyyyMMdd") + "差异分析结果(" + DateTime.Now.DayOfWeek + ").xls");
                string fileName = notiCode + HttpUtility.UrlEncode("差异分析结果.xls");
                Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ";filetype=excel");
                Response.OutputStream.Write(report, 0, report.Length);
                Response.Flush();
            }
            break;

        case "delete":

            try
            {
                if (!string.IsNullOrEmpty(hdnDeleteItems.Value))
                {
                    hdnDeleteItems.Value = hdnDeleteItems.Value.Substring(1, hdnDeleteItems.Value.Length - 2);
                    hdnDeleteItems.Value = hdnDeleteItems.Value.Replace(",,", ",");
                    List <string> idList = hdnDeleteItems.Value.Split(',').ToList();
                    List <DiffAnalyseReportItem> list = new List <DiffAnalyseReportItem>();
                    foreach (var id in idList)
                    {
                        if (!string.IsNullOrEmpty(id))
                        {
                            DiffAnalyseReportItem item = new DiffAnalyseReportItem {
                                ItemID = Convert.ToInt64(id)
                            };
                            list.Add(item);
                        }
                    }

                    Service.DeleteAnalyseItems(list);
                    hdnDeleteItems.Value = string.Empty;
                }
            }
            catch (Exception ex)
            {
                hdnDeleteItems.Value = string.Empty;
                throw;
            }
            Query();
            break;

        case "analyse":

            //pagerNew.CurrentPage = 1;
            ////pagerAnalysis.CurrentPage = 1;
            //NotiToAnalyse = null;
            //hdnDeleteItems.Value = string.Empty;
            //Query();
            //if (gvAnalysis.Rows.Count > 0)
            //{
            Response.Redirect("AnalyseReportItem.aspx?NoticeNo=" + txtRptNoticeNo.Text.Trim());
            //}
            break;

        default:
            break;
        }
    }