private void dataGrid_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            DefaultQueryFilter query = new DefaultQueryFilter();

            query.PagingInfo = new PagingInfo()
            {
                PageSize  = e.PageSize,
                PageIndex = e.PageIndex,
                SortBy    = e.SortField
            };
            query.CompanyCode = CPApplication.Current.CompanyCode;
            SOQueryFacade facade = new SOQueryFacade(this);

            facade.OZZOOriginNoteQuery(query, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                foreach (var item in args.Result.Rows)
                {
                    string lastEdit = string.Empty;
                    if (item["LastEditUserName"] != null && item["LastEditUserName"].ToString() != "")
                    {
                        lastEdit = string.Format("{0}[{1}]", item["LastEditUserName"], ((DateTime)item["LastEditDate"]).ToString(ResConverter.DateTime_LongFormat));
                    }
                    item["LastEdit"] = lastEdit;
                }
                dataGrid.TotalCount  = args.Result.TotalCount;
                dataGrid.ItemsSource = args.Result.Rows;
            });
        }
Exemplo n.º 2
0
        private void dataGridSOLog_LoadingDataSource(object sender, LoadingDataEventArgs e)
        {
            SOLogQueryFilter query = new SOLogQueryFilter();

            query.SOSysNo    = SOSysNo;
            query.PagingInfo = new PagingInfo()
            {
                PageSize  = e.PageSize,
                PageIndex = e.PageIndex,
                SortBy    = e.SortField
            };
            SOQueryFacade facade = new SOQueryFacade();

            facade.QuerySOSystemLog(query, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                dataGridSOLog.TotalCount = args.Result.TotalCount;

                var list = args.Result.Rows;
                foreach (var item in list)
                {
                    //note需要特殊处理
                    item["Note"] = GetSOLogNote((string)item["Note"]);
                }
                dataGridSOLog.ItemsSource = list;
            });
        }
Exemplo n.º 3
0
        private void dgQueryResult_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            m_queryRequest.PagingInfo = new PagingInfo()
            {
                PageSize  = e.PageSize,
                PageIndex = e.PageIndex,
                SortBy    = e.SortField
            };
            SOQueryFacade facade = new SOQueryFacade(this);

            facade.QuerySOWHUpdate(m_queryRequest, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                this.dgQueryResult.TotalCount = args.Result.TotalCount;
                soWHUpdatelist = DynamicConverter <SOWHUpdateInfoVM> .ConvertToVMList(args.Result.Rows);
                soWHUpdatelist.ForEach(p =>
                {
                    p.StockList = m_stockData;
                });

                this.dgQueryResult.ItemsSource = soWHUpdatelist;
            });
        }
Exemplo n.º 4
0
        private void IniPageData()
        {
            soQueryFacade = new SOQueryFacade(this);
            queryVM       = new SODeliveryAssignTaskSearchVM();
            exportSODeliveryAssignTaskSearchVM = new SODeliveryAssignTaskSearchVM();

            otherFacade = new OtherDomainQueryFacade(this);

            otherFacade.GetFreightManList(true, freightManList =>
            {
                queryVM.FreightMenList = freightManList;
            });

            gridConditions.DataContext = queryVM;

            if (cmbDeliveryTimeRangeFrom.ItemsSource != null)
            {
                cmbDeliveryTimeRangeFrom.SelectedIndex = 0;
            }

            if (cmbDeliveryTimeRangeTo.ItemsSource != null)
            {
                cmbDeliveryTimeRangeTo.SelectedIndex = 1;
            }

            if (cmbOrderType.ItemsSource != null)
            {
                cmbOrderType.SelectedIndex = 0;
            }
        }
Exemplo n.º 5
0
        private void dataGridList_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            SORequestQueryFilter query = new SORequestQueryFilter();

            query.CustomerSysNo = CustomerSysNo;
            query.SOStatusArray = new List <SOStatus> {
                SOStatus.Origin, SOStatus.WaitingOutStock, SOStatus.WaitingManagerAudit
            };

            query.PageInfo = new PagingInfo()
            {
                PageSize  = e.PageSize,
                PageIndex = e.PageIndex,
                SortBy    = e.SortField
            };

            SOQueryFacade facade = new SOQueryFacade();

            facade.QuerySO(query, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                dataGridList.TotalCount  = args.Result.TotalCount;
                dataGridList.ItemsSource = args.Result.Rows.ToList("IsCheck", true);;
            });
        }
Exemplo n.º 6
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            List <SOWHUpdateInfoVM> selectList = GetCheckStockList(this.dgQueryResult.ItemsSource as List <SOWHUpdateInfoVM>);

            if (selectList != null)
            {
                List <SOWHUpdateInfo> soWHUpdateInfoList = new List <SOWHUpdateInfo>();
                foreach (var item in selectList)
                {
                    item.CompanyCode = CPApplication.Current.CompanyCode;
                    soWHUpdateInfoList.Add(item.ConvertVM <SOWHUpdateInfoVM, SOWHUpdateInfo>());
                }

                SOQueryFacade soQueryFacade = new SOQueryFacade(this);

                soQueryFacade.QuerySOInfo(Convert.ToInt32(soWHUpdateInfoList[0].SOSysNo), vm =>
                {
                    soView = vm;

                    //只有处于审核状态的订单才可以修改
                    if (soView == null ||
                        soView.BaseInfoVM.Status != (int)SOStatus.Origin)
                    {
                        this.Window.Alert(ResSO.Msg_SOUpdate_WarningSOAuditOutStock);
                        return;
                    }

                    #region 更新操作
                    try
                    {
                        bool result       = false;
                        SOFacade soFacade = new SOFacade(this);
                        soFacade.WHUpdateStock(soWHUpdateInfoList[0], (obj, args) =>
                        {
                            if (args.FaultsHandle())
                            {
                                return;
                            }
                            result = (Boolean)args.Result;
                            if (result)
                            {
                                m_WHUpdateQueryView.SOSysNo = SOSysNo.ToString();
                                this.Window.Alert(ResSO.Info_WHUpdate_UpdateSucceed);
                                this.dgQueryResult.Bind();
                            }
                            else
                            {
                                this.Window.Alert(ResSO.Info_WHUpdate_UpdateFail);
                            }
                        });
                    }
                    catch (BusinessException be)
                    {
                        this.Window.Alert(be.ErrorDescription);
                    }
                    #endregion
                });
            }
        }
Exemplo n.º 7
0
 void SOProcesser_Loaded(object sender, RoutedEventArgs e)
 {
     CommonDataFacade     = new CommonDataFacade(Page);
     SOInternalMemoFacade = new Facades.SOInternalMemoFacade(Page);
     SOQueryFacade        = new SOQueryFacade(Page);
     SOFacade             = new SOFacade(Page);
     LoadPage();
 }
Exemplo n.º 8
0
 public override void OnPageLoad(object sender, EventArgs e)
 {
     base.OnPageLoad(sender, e);
     m_commonFacade           = new CommonDataFacade(this);
     m_Facade                 = new SOInterceptFacade(this);
     m_QueryFacde             = new SOQueryFacade(this);
     spConditions.DataContext = m_QueryFilter = new SOInterceptQueryFilter();
     IniPageData();
 }
        private void dataGrid_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            SOQueryFacade facade = new SOQueryFacade(Page);

            facade.QueryOPCTransaction(MasterSysNo, (obj, args) =>
            {
                if (!args.FaultsHandle())
                {
                    dataGrid.ItemsSource = args.Result;
                }
            });
        }
Exemplo n.º 10
0
        private void dgQueryResult_ExportAllClick(object sender, EventArgs e)
        {
            m_queryRequest.PagingInfo = new PagingInfo()
            {
                PageSize  = ConstValue.MaxRowCountLimit,
                PageIndex = 0,
                SortBy    = string.Empty
            };
            SOQueryFacade facade = new SOQueryFacade(this);
            ColumnSet     col    = new ColumnSet(dgQueryResult);

            facade.ExportWHUpdate(m_queryRequest, new ColumnSet[] { col });
        }
Exemplo n.º 11
0
        private void IniPageData()
        {
            soQueryFacade = new SOQueryFacade(this);
            queryVM       = new SODeliveryScoreSearchVM();
            exportSODeliveryScoreSearchVM = new SODeliveryScoreSearchVM();

            otherFacade = new OtherDomainQueryFacade(this);

            otherFacade.GetFreightManList(true, freightManList =>
            {
                queryVM.FreightMenList = freightManList;
            });

            gridConditions.DataContext = queryVM;
        }
Exemplo n.º 12
0
        private void IniPageData()
        {
            pageView      = new WHSOOutStockSearchView();
            soQueryFacade = new SOQueryFacade(this);
            exportWHSOOutStockSearchInfo = new WHSOOutStockSearchVM();

            CodeNamePairHelper.GetList(ConstValue.DomainName_Common, ConstValue.Key_TimeRange, CodeNamePairAppendItemType.Custom_All, (sender, e) =>
            {
                pageView.QueryInfo.TimeRangeList = e.Result;
            });

            gridConditions.DataContext = pageView.QueryInfo;

            if (cmbShipTypeConditionType.DataContext != null)
            {
                cmbShipTypeConditionType.SelectedIndex = 0;
            }
        }
Exemplo n.º 13
0
        private void dataGrid_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            m_query.PageInfo = new PagingInfo()
            {
                PageSize  = e.PageSize,
                PageIndex = e.PageIndex,
                SortBy    = e.SortField
            };
            m_query.CompanyCode = CPApplication.Current.CompanyCode;

            //实仓库和虚仓库不能相同
            if (m_query.StockNV == m_query.StockV)
            {
                Window.Alert(ResSO.Msg_Error_VAndNVMustDiff);
                return;
            }

            SOQueryFacade facade = new SOQueryFacade(this);

            facade.QuerySpecialSO(m_query, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                dataGrid.TotalCount = args.Result.TotalCount;

                List <object> resultList = new List <object>();
                //去掉重复数据,将同订单ID不同商品ID合并成一条
                List <object> list = args.Result.Rows.ToList();

                var group = list.GroupBy(p => { return((string)((DynamicXml)p)["SOID"]); });

                foreach (var grpItem in group)
                {
                    var addItem      = grpItem.ElementAt(0);
                    string productID = string.Join(",", grpItem.Select(p => (string)((DynamicXml)p)["ProductID"]).ToArray());
                    ((DynamicXml)addItem)["ProductID"] = productID;
                    resultList.Add(grpItem.ElementAt(0));
                }

                dataGrid.ItemsSource = resultList;
            });
        }
Exemplo n.º 14
0
        //导出数据到Excel
        private void dataGridPackageCoverSearchList_ExportAllClick(object sender, EventArgs e)
        {
            if (!AuthMgr.HasFunctionPoint(AuthKeyConst.SO_ExcelExport))
            {
                Window.Alert(ResSO.Msg_Error_Right, MessageType.Error);
                return;
            }

            m_queryRequest.PagingInfo = new PagingInfo()
            {
                PageSize  = ConstValue.MaxRowCountLimit,
                PageIndex = 0,
                SortBy    = string.Empty
            };
            SOQueryFacade facade = new SOQueryFacade(this);
            ColumnSet     col    = new ColumnSet(QueryResultGrid);

            facade.ExportSOPackageCoverSearch(m_queryRequest, new ColumnSet[] { col });
        }
Exemplo n.º 15
0
        private void QueryResultGrid_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            m_queryRequest.PagingInfo = new PagingInfo()
            {
                PageSize  = e.PageSize,
                PageIndex = e.PageIndex,
                SortBy    = e.SortField
            };
            SOQueryFacade facade = new SOQueryFacade(this);

            facade.QueryComplainList(m_queryRequest, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                QueryResultGrid.TotalCount  = args.Result.TotalCount;
                QueryResultGrid.ItemsSource = args.Result.Rows.ToList("IsCheck", false);
            });
        }
Exemplo n.º 16
0
        private void dataGrid_LoadingDataSource(object sender, LoadingDataEventArgs e)
        {
            m_QueryFilter.PagingInfo = new PagingInfo()
            {
                PageSize  = e.PageSize,
                PageIndex = e.PageIndex,
                SortBy    = e.SortField
            };
            SOQueryFacade facade = new SOQueryFacade(this);

            facade.QuerySOIntercept(m_QueryFilter, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                searchResultsDataGrid.TotalCount  = args.Result.TotalCount;
                searchResultsDataGrid.ItemsSource = args.Result.Rows.ToList("IsCheck", false);
            });
        }
Exemplo n.º 17
0
        private void IniPageData()
        {
            soQueryFacade = new SOQueryFacade(this);
            queryVM       = new SODeliveryHistorySearchVM();
            exportSODeliveryHistorySearchVM = new SODeliveryHistorySearchVM();

            otherFacade = new OtherDomainQueryFacade(this);

            otherFacade.GetFreightManList(true, freightManList =>
            {
                queryVM.FreightMenList = freightManList;
            });

            gridConditions.DataContext = queryVM;

            if (cmbOrderType.DataContext != null)
            {
                cmbOrderType.SelectedIndex = 0;
            }
        }
Exemplo n.º 18
0
        private void dataGridPendingList_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            m_query.PagingInfo = new PagingInfo()
            {
                PageSize  = e.PageSize,
                PageIndex = e.PageIndex,
                SortBy    = e.SortField
            };
            SOQueryFacade facade = new SOQueryFacade(this);

            facade.QuerySOPending(m_query, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                dataGridPendingList.TotalCount  = args.Result.TotalCount;
                dataGridPendingList.ItemsSource = args.Result.Rows;
            });
        }
Exemplo n.º 19
0
        private void BindData(int sysNo)
        {
            SOInternalMemoQueryFilter query = new SOInternalMemoQueryFilter();

            query.SysNo      = sysNo;
            query.PagingInfo = new PagingInfo();
            SOQueryFacade facade = new SOQueryFacade(Page);

            facade.QuerySOInternalMemo(query, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                SOInternalMemoInfoVM vm = DynamicConverter <SOInternalMemoInfoVM> .ConvertToVM(args.Result.Rows[0], "SourceSysNo", "Importance");
                this.DataContext        = vm;
                this.m_oldNote          = vm.Note;
                this.btnSave.Visibility = System.Windows.Visibility.Visible;
            });
        }
Exemplo n.º 20
0
        private void dataGridPackageList_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            m_queryRequest.PagingInfo = new PagingInfo()
            {
                PageSize  = e.PageSize,
                PageIndex = e.PageIndex,
                SortBy    = e.SortField
            };
            m_queryRequest.ReceiveAreaSysNo = ucReceiveArea.QueryAreaSysNo;
            SOQueryFacade facade = new SOQueryFacade(this);

            facade.QuerySOPackageCoverSearch(m_queryRequest, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                this.QueryResultGrid.TotalCount  = args.Result.TotalCount;
                this.QueryResultGrid.ItemsSource = args.Result.Rows.ToList("IsCheck", false);
            });
        }
Exemplo n.º 21
0
        private void dataGrid_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            m_query.PagingInfo = new PagingInfo()
            {
                PageSize  = e.PageSize,
                PageIndex = e.PageIndex,
                SortBy    = e.SortField
            };
            SOQueryFacade facade = new SOQueryFacade(this);

            m_query.CompanyCode = CPApplication.Current.CompanyCode;
            facade.QueryOPCMaster(m_query, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                dataGrid.TotalCount  = args.Result.TotalCount;
                dataGrid.ItemsSource = args.Result.Rows;
            });
        }
Exemplo n.º 22
0
        private void QueryResultGrid_LoadingDataSource(object sender, Newegg.Oversea.Silverlight.Controls.Data.LoadingDataEventArgs e)
        {
            m_queryRequest.PageInfo = new PagingInfo()
            {
                PageSize  = e.PageSize,
                PageIndex = e.PageIndex,
                SortBy    = e.SortField
            };
            m_queryRequest.CompanyCode      = CPApplication.Current.CompanyCode;
            m_queryRequest.ReceiveAreaSysNo = ucReceiveArea.QueryAreaSysNo;
            SOQueryFacade facade = new SOQueryFacade(this);

            facade.QueryOutStock4Finance(m_queryRequest, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                QueryResultGrid.TotalCount  = args.Result.TotalCount;
                QueryResultGrid.ItemsSource = args.Result.Rows;
            });
        }
Exemplo n.º 23
0
        //按查询条件导出数据到Excel
        private void QueryResultGrid_ExportAllClick(object sender, EventArgs e)
        {
            if (!AuthMgr.HasFunctionPoint(AuthKeyConst.SO_ExcelExport))
            {
                Window.Alert(ResSO.Msg_Error_Right, MessageType.Error);
                return;
            }

            m_queryRequest.PagingInfo = new PagingInfo()
            {
                PageSize  = ConstValue.MaxRowCountLimit,
                PageIndex = 0,
                SortBy    = string.Empty
            };
            SOQueryFacade facade = new SOQueryFacade(this);
            ColumnSet     col    = new ColumnSet(QueryResultGrid);

            col.Insert(0, "CSConfirmComplainType", ResSO.DataGrid_CSConfirmComplainType);
            col.Insert(1, "CSConfirmComplainTypeDetail", ResSO.DataGrid_CSConfirmComplainTypeDetail);

            facade.ExportComplain(m_queryRequest, new ColumnSet[] { col });
        }
Exemplo n.º 24
0
        private void dataGridComplainList_LoadingDataSource(object sender, LoadingDataEventArgs e)
        {
            ComplainQueryFilter query = new ComplainQueryFilter();

            query.SOSysNo    = SOSysNo;
            query.PagingInfo = new PagingInfo()
            {
                PageSize  = e.PageSize,
                PageIndex = e.PageIndex,
                SortBy    = e.SortField
            };
            SOQueryFacade facade = new SOQueryFacade();

            facade.QueryComplainList(query, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                dataGridComplainList.TotalCount  = args.Result.TotalCount;
                dataGridComplainList.ItemsSource = args.Result.Rows;
            });
        }
Exemplo n.º 25
0
        private void IniPageData()
        {
            CommonDataFacade               = new CommonDataFacade(this);
            PageView                       = new SOQueryView();
            PageView.QueryInfo.SOSysNo     = SOSysNo;
            PageView.QueryInfo.CompanyCode = CPApplication.Current.CompanyCode;
            SOQueryFacade                  = new SOQueryFacade(this);
            SOFacade                       = new SOFacade(this);
            ExportSOQueryInfo              = new SOQueryVM();
            CommonDataFacade.GetStockList(true, (sender, e) =>
            {
                PageView.QueryInfo.StockList = e.Result;
            });

            CommonDataFacade.GetAllSystemUser(CPApplication.Current.CompanyCode, (obj, args) =>
            {
                List <ECCentral.BizEntity.Common.UserInfo> userList = new List <BizEntity.Common.UserInfo>();
                userList.Add(new BizEntity.Common.UserInfo {
                    SysNo = null, UserDisplayName = ECCentral.BizEntity.Enum.Resources.ResCommonEnum.Enum_All
                });
                if (!args.FaultsHandle() && args.Result != null)
                {
                    userList.AddRange(args.Result);
                }
                cmbOutStockUser.ItemsSource = userList;
            });
            CommonDataFacade.GetCustomerServiceList(CPApplication.Current.CompanyCode, (r) =>
            {
                List <ECCentral.BizEntity.Common.UserInfo> userList = new List <BizEntity.Common.UserInfo>();
                userList.Add(new BizEntity.Common.UserInfo {
                    SysNo = null, UserDisplayName = ECCentral.BizEntity.Enum.Resources.ResCommonEnum.Enum_All
                });
                if (r != null)
                {
                    userList.AddRange(r);
                }
                cmbAuditUser.ItemsSource = userList;
            });

            CodeNamePairHelper.GetList(ConstValue.DomainName_SO
                                       , new string[] { ConstValue.Key_FPStatus, ConstValue.Key_KFCType }
                                       , CodeNamePairAppendItemType.All, (sender, e) =>
            {
                if (e.Result != null)
                {
                    PageView.QueryInfo.FPStatusList = e.Result[ConstValue.Key_FPStatus];
                    PageView.QueryInfo.KFCTypeList  = e.Result[ConstValue.Key_KFCType];
                }
            });

            CodeNamePairHelper.GetList(ConstValue.DomainName_Common, ConstValue.Key_TimeRange, CodeNamePairAppendItemType.Custom_All, (sender, e) =>
            {
                PageView.QueryInfo.TimeRangeList = e.Result;
            });

            CommonDataFacade.GetWebChannelList(true, (sender, e) => {
                cmbThirdPlatform.ItemsSource = e.Result;
            });

            spConditions.DataContext = PageView.QueryInfo;
            dataGridSO.DataContext   = PageView;
            if (!string.IsNullOrEmpty(PageView.QueryInfo.SOSysNo))
            {
                if (Regex.IsMatch(PageView.QueryInfo.SOSysNo, @"^\d+([, \.]+\d+)*$"))
                {
                    btnSearch_Click(null, null);
                }
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// 添加赠品订单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddGiftSO_Click(object sender, RoutedEventArgs e)
        {
            if (giftList != null && giftList.Count > 0)
            {
                SOVM giftSOVM = new SOVM();
                giftSOVM.BaseInfoVM.SOType          = SOType.Gift;
                giftSOVM.BaseInfoVM.Memo            = txtAddGiftNote.Text;
                giftSOVM.BaseInfoVM.CustomerChannel = CurrentSOVM.BaseInfoVM.CustomerChannel;
                giftSOVM.BaseInfoVM.CustomerSysNo   = CurrentSOVM.BaseInfoVM.CustomerSysNo;
                SOItemInfoVM soItem = null;

                foreach (dynamic g in dataGridGift.ItemsSource)
                {
                    if (g.IsChecked)
                    {
                        soItem = giftSOVM.ItemsVM.FirstOrDefault(item => item.ProductSysNo == g.ProductSysNo);
                        if (soItem == null)
                        {
                            soItem = new SOItemInfoVM
                            {
                                Quantity           = 1,
                                Price              = 0,
                                ProductSysNo       = g.ProductSysNo,
                                ProductType        = 0,
                                OriginalPrice      = 0,
                                MasterProductSysNo = g.MasterProductSysNo.ToString()
                            };
                            giftSOVM.ItemsVM.Add(soItem);
                        }
                        else
                        {
                            soItem.Quantity += 1;
                        }
                    }
                }
                if (giftSOVM.ItemsVM.Count > 0)
                {
                    string errMsg = string.Empty;
                    #region 原订单中是否已经存在赠品

                    List <string> existsGifts = new List <string>();
                    foreach (var gift in giftSOVM.ItemsVM)
                    {
                        if (CurrentSOVM.ItemsVM.FirstOrDefault(x => { return(x.ProductSysNo == gift.ProductSysNo); }) != null)
                        {
                            existsGifts.Add(gift.ProductID);
                        }
                    }

                    if (existsGifts.Count > 0)
                    {
                        errMsg = string.Format(ResSO.Msg_ConfirmCreateRepeatGiftSOOrder, string.Join(",", existsGifts.ToArray()));
                    }

                    #endregion

                    #region 订单是否创建过赠品单
                    SOLogQueryFilter query = new SOLogQueryFilter();
                    query.SOSysNo    = SOSysNo;
                    query.PagingInfo = new PagingInfo()
                    {
                        PageSize  = int.MaxValue,
                        PageIndex = 0,
                        SortBy    = "SO_Log.OptTime DESC"
                    };
                    SOQueryFacade facade = new SOQueryFacade();
                    facade.QuerySOSystemLog(query, (obj, args) =>
                    {
                        if (args.FaultsHandle())
                        {
                            return;
                        }
                        foreach (var item in args.Result.Rows)
                        {
                            //note需要特殊处理
                            if ((BizLogType)item["OptType"] == BizLogType.Sale_SO_CreateGiftSO)
                            {
                                errMsg += string.Format(ResSO.Msg_ConfirmCreateRepeatSOGiftOrder
                                                        , item["OptTime"]
                                                        , item["Note"]);
                                break;
                            }
                        }
                        if (errMsg.Length > 0)
                        {
                            Window.Confirm(errMsg, (giftCreaterSender, giftCreaterArgs) =>
                            {
                                if (giftCreaterArgs.DialogResult == DialogResultType.OK)
                                {
                                    ConfirmCreateGiftSO(giftSOVM);
                                }
                            });
                        }
                        else
                        {
                            ConfirmCreateGiftSO(giftSOVM);
                        }
                    });
                    #endregion
                }
                else
                {
                    Page.Context.Window.Alert(ResSO.Info_GiftSO_ItemIsNull);
                }
            }
            else
            {
                Page.Context.Window.Alert(ResSO.Info_GiftSO_ItemIsNull);
            }
        }
Exemplo n.º 27
0
        void SplitInvoice_Loaded(object sender, RoutedEventArgs e)
        {
            SOQueryFacade = new SOQueryFacade(Page);
            SOFacade      = new SOFacade(Page);
            int totalQty = 0;

            //need reload sovm
            SOQueryFacade.QuerySOInfo(m_soSysNo, vm =>
            {
                if (vm == null)
                {
                    Window.Alert(ResSO.Info_SOIsNotExist, ResSO.Info_SOIsNotExist, MessageType.Warning, (obj, args) =>
                    {
                        Window.Close();
                    });
                    return;
                }
                m_soVM = vm;
                m_soVM.ItemsVM.ForEach(soItem =>
                {
                    if (soItem.ProductType != SOProductType.Coupon)
                    {
                        if (soItem.ProductType != SOProductType.ExtendWarranty)
                        {
                            totalQty += soItem.Quantity.Value;
                        }

                        InvoiceProductVM invoiceProductVM = new InvoiceProductVM
                        {
                            InvoiceNo            = 1,
                            Price                = soItem.Price.Value,
                            ProductID            = soItem.ProductID,
                            ProductName          = soItem.ProductName,
                            ProductSysNo         = soItem.ProductSysNo.Value,
                            Quantity             = soItem.Quantity.Value,
                            StockSysNo           = soItem.StockSysNo,
                            InvoiceQuantity      = soItem.Quantity.Value,
                            IsExtendWarrantyItem = soItem.ProductType == SOProductType.ExtendWarranty
                        };

                        string[] mpSysNo = null;
                        if (soItem.MasterProductSysNo != null)
                        {
                            mpSysNo = soItem.MasterProductSysNo.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        }

                        if (mpSysNo != null)
                        {
                            invoiceProductVM.MasterProductSysNo = invoiceProductVM.MasterProductSysNo ?? new List <int>();
                            mpSysNo.ForEach(n =>
                            {
                                int no; if (int.TryParse(n, out no))
                                {
                                    invoiceProductVM.MasterProductSysNo.Add(no);
                                }
                            });
                        }
                        PageView.OriginalProductList.Add(invoiceProductVM);
                    }
                });
                SOFacade.GetSOInvoiceList(m_soSysNo, PageView.OriginalProductList, (isSplited, invoiceList) =>
                {
                    if (isSplited)
                    {
                        PageView.SplitedProductList = invoiceList;
                        btnSave.IsEnabled           = false;
                        btnCancelSplit.IsEnabled    = true;
                    }
                    else
                    {
                        PageView.SplitedProductList = PageView.OriginalProductList.DeepCopy();
                        ECCentral.BizEntity.SO.SOStatus soStatus = m_soVM.BaseInfoVM.Status.Value;
                        btnSave.IsEnabled = totalQty > 1 &&
                                            (soStatus == ECCentral.BizEntity.SO.SOStatus.Origin ||
                                             soStatus == ECCentral.BizEntity.SO.SOStatus.WaitingOutStock ||
                                             soStatus == ECCentral.BizEntity.SO.SOStatus.Shipping);
                        btnCancelSplit.IsEnabled = false;
                    }
                    btnGroupSort.IsEnabled = btnSave.IsEnabled;
                    SortInvoice();
                });
            });
        }