Пример #1
0
        private void InitData()
        {
            Task.Factory.StartNew(() =>
            {
                SalesRebateRecentParameterLists   = new ObservableCollection <SalesRebateRecentParameterMainModel>();
                SalesRebateK3RecordParameterLists = new ObservableCollection <SalesRebateRecentParameterMainModel>();

                // 按客户、类别、时间生成数据
                SalesRebateService.InsertCurrentOrgRebateClassParameter(BatchParameter);

                RebateClassLists = CommonService.GetEnumLists(6);

                var org  = new OrganizationService().GetOrganizationById(BatchParameter.OrganizationSearchedItem.Id);
                OrgLists = new List <EnumModel> {
                    new EnumModel {
                        ItemSeq = org.Id, ItemValue = org.FName
                    }
                };

                UIExecute.RunAsync(() =>
                {
                    QueryBaseCommand.Execute(null);
                });
            });
        }
Пример #2
0
        private void InitData()
        {
            Task.Factory.StartNew(() =>
            {
                QueryParameter = new SalesRebateQueryParameterModel()
                {
                    SettleDateEnd1 = DateTime.Now.AddYears(-1).Date, SettleDateEnd2 = DateTime.Now.Date
                };
                BatchParameter = new SalesRebateBatchParameterModel()
                {
                    SettleDateBegin = DateTime.Now.AddMonths(-1).Date,
                    SettleDateEnd   = DateTime.Now.Date
                };

                var enums = CommonService.GetEnumLists();

                RebateClassLists  = enums.Where(x => x.GroupSeq == 6);
                OrganizationLists = ComboBoxSearchService.GetOrganizationLists();

                HostConfig = CommonService.GetHostConfig(DataGridId, HostName, User.ID) ?? new HostConfigModel()
                {
                    TypeId = DataGridId, Host = HostName, UserId = User.ID, TypeDesciption = "客户案子销售返利"
                };
                Token = K3ApiXService.GetToken();

                UIExecute.RunAsync(() =>
                {
                    QueryBaseCommand.Execute(null);
                });
            });
        }
Пример #3
0
        private void InitCommand()
        {
            SyncBucketInfo = new DelegateCommand((obj) =>
            {
                int count = Service.SyncBucketInfo();
                MessageBox.Show($"成功更新【{count}】条桶子名称");
            });

            ModifyCommand = new DelegateCommand((obj) =>
            {
                var cloneData           = ObjectDeepCopyHelper <BucketModel, BucketModel> .Trans(BucketSelectedItem);
                BucketModifyWindow view = new BucketModifyWindow();
                (view.DataContext as BucketModifyViewModel).WithParam(cloneData, (type, outputEntity, IsChanged) =>
                {
                    view.Close();
                    if (type == 1)
                    {
                        Service.BucketModify(outputEntity);
                        //if(IsChanged)
                        QueryBaseCommand.Execute(null);
                    }
                });
                view.ShowDialog();
            });

            QueryBaseCommand = new DelegateCommand((obj) =>
            {
                Lists.Clear();
                Service.GetLists($" and FName like '%{BucketName}%'").ForEach(x => Lists.Add(x));
            });
        }
 private void InitData()
 {
     Task.Factory.StartNew(() =>
     {
         PrintLSLists   = new ObservableCollection <LabelPrintLSModel>();
         ProductionDate = DateTime.Now.Date;
         HostConfig     = CommonService.GetHostConfig(DataGridId, HostName, User.ID) ?? new HostConfigModel()
         {
             TypeId = DataGridId, Host = HostName, UserId = User.ID, TypeDesciption = "蓝思标签打印"
         };
         ComputerPrinters = PrintHelper.GetComputerPrinters();
         var config       = CommonService.GetBarTenderPrintConfigXX(User.ID, DataGridId, HostName);
         if (config == null)
         {
             PrintConfiguration = new BarTenderPrintConfigModelXX {
                 TemplateTypeId = DataGridId, HostName = HostName, UserId = User.ID, TemplateTypeName = "蓝思标签打印"
             }
         }
         ;
         else
         {
             PrintConfiguration = config;
             PirntTemplates     = PrintHelper.GetTenderPrintTemplates(config.TemplateSelectedItem.TemplateFolderPath);
         }
         BarcodeTypeLists        = CommonService.GetEnumLists(10);
         BarcodeTypeSelectedItem = BarcodeTypeLists.FirstOrDefault();
         UIExecute.RunAsync(() =>
         {
             QueryBaseCommand.Execute(null);
         });
     });
 }
Пример #5
0
        private void InitData()
        {
            QueryBaseCommand.Execute(null);

            //RebateClassLists = CommonService.GetEnumLists(6);
            //OrganizationLists = ComboBoxSearchService.GetOrganizationLists();
            //MinusLastPeriodRebateLists = CommonService.GetEnumLists(999);
            //_salesRebateService.GetSalesRebateLists(_userDataId, IsHistory).ForEach(x => SalesRebateLists.Add(x));
        }
 private void InitData()
 {
     Task.Factory.StartNew(() =>
     {
         CommonService.GetEnumLists(12).ToList().ForEach(x => TypeSelectorLists.Add(x));
         UIExecute.RunAsync(() =>
         {
             QueryBaseCommand.Execute(null);
         });
     });
 }
        private void InitCommand()
        {
            SaveCommand = new DelegateCommand((obj) =>
            {
                //验证数据是否异常
                var r = CommonAdjustmentLists.GroupBy(x => new { x.TypeId, x.OrgId, x.Label }).Select(x => new { Rc = x.Count() });
                if (!r.Any(x => x.Rc > 1))
                {
                    // 将界面数据插入到后台
                    CommonService.LoadIEnumerableToDatabase2(CommonAdjustmentLists, "SJPrintCommonAdjustment", true);

                    // 将之前的后台数据删除
                    var ids = string.Join(",", CommonAdjustmentLists.Where(x => x.Id > 0).Select(x => x.Id));
                    if (!string.IsNullOrEmpty(ids))
                    {
                        LabelPrintService.DeletePrintCommonAdjustment(ids);
                    }
                    QueryBaseCommand.Execute(null);
                }
                else
                {
                    MessageBox.Show("类型+客户+标签 必须唯一");
                }
            });

            RemoveCommand = new DelegateCommand((obj) =>
            {
                if (PrintCommonAdjustmentSelectedItem != null)
                {
                    int id = PrintCommonAdjustmentSelectedItem.Id;
                    CommonAdjustmentLists.Remove(PrintCommonAdjustmentSelectedItem);
                    if (id > 0)
                    {
                        LabelPrintService.DeletePrintCommonAdjustment(id);
                    }
                }
            });

            CopyCommand = new DelegateCommand((obj) =>
            {
                var cloneData = PrintCommonAdjustmentSelectedItem == null ? new PrintCommonAdjustmentModel() : ObjectDeepCopyHelper <PrintCommonAdjustmentModel, PrintCommonAdjustmentModel> .Trans(PrintCommonAdjustmentSelectedItem);
                cloneData.Id  = 0;
                CommonAdjustmentLists.Insert(0, cloneData);
            });


            QueryBaseCommand = new DelegateCommand((obj) =>
            {
                CommonAdjustmentLists.Clear();
                LabelPrintService.GetLists(CommonService.GetSqlWhereString(QueryParameter)).ForEach(x => CommonAdjustmentLists.Add(x));
            });
        }
        private void InitCommand()
        {
            DirectorySelectBaseCommand = new DelegateCommand((obj) =>
            {
                // 导出目录选择
                System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();

                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    HostConfig.HostValue = fbd.SelectedPath;
                    var result           = CommonService.SaveHostConfig(HostConfig);
                    if (result)
                    {
                        HostConfig = CommonService.GetHostConfig(Menu.ID, HostName, User.ID);
                    }
                }
            });

            ExportBaseCommand = new DelegateCommand((obj) =>
            {
                if (Directory.Exists(HostConfig.HostValue))
                {
                    ExportView view = new ExportView(Menu.ID, 3);// Menu.ID-SJExportViewTypedColumn中的ViewGroupId; 3 - 第几个radioButton被默认选中从1开始
                    //Export((type - 导出1 取消0, outputEntity 界面选中的radiobuttion 同上, checkBoxValue 选择分类导出的情况下,选择的类别和, orderedColumns 选择分类导出的情况下,选择类别的顺序列表)
                    (view.DataContext as ExportViewModel).Export((type, outputEntity, checkBoxValue, orderedColumns) =>
                    {
                        view.Close();
                        if (type == 1)
                        {
                            if (outputEntity == 3)
                            {
                                DataTable datatable = _service.GetSJBatchBomRequestDeliveryExportData(GeneralParameter.ParamBeginDate.Value, string.Join(",", orderedColumns));
                                if (datatable.Rows.Count > 0)
                                {
                                    ExportHelper.ExportDeliveryDataToExcel(GeneralParameter.ParamBeginDate.Value, datatable, HostConfig.HostValue, HostConfig.TypeDesciption + CommonService.GetQueryParameterValueString(GeneralParameter)
                                                                           , outputEntity, orderedColumns, true, "$$$发料单", true);
                                    MessageBox.Show("导出成功");
                                }
                                else
                                {
                                    MessageBox.Show($"【{GeneralParameter.ParamBeginDate.Value}】 没有可导出的数据");
                                }
                            }
                            else
                            {
                                DataTable datatable = _service.GeSJBatchBOMSummaryExportData(GeneralParameter.ParamBeginDate.Value);
                                if (datatable.Rows.Count > 0)
                                {
                                    ExportHelper.ExportDataTableToExcel(datatable, HostConfig.HostValue, "物料需求" + CommonService.GetQueryParameterValueString(GeneralParameter), outputEntity, null, false, "物料需求", false);
                                    MessageBox.Show("导出成功");
                                }
                                else
                                {
                                    MessageBox.Show($"【{GeneralParameter.ParamBeginDate.Value}】 没有可导出的数据");
                                }
                            }
                        }
                    });
                    view.ShowDialog();
                }
                else
                {
                    MessageBox.Show("目录不存在,请先选择导出的目录");
                    DirectorySelectBaseCommand.Execute(null);
                }
                CommonService.WriteActionLog(new ActionOperationLogModel {
                    ActionName = "ExportBaseCommand", ActionDesc = HostConfig.TypeDesciption + HostConfig.TypeId.ToString(), UserId = User.ID, MainMenuId = Menu.ID, PKId = -1, HostName = HostName
                });
            });

            MaterialRequestGenerateCommand = new DelegateCommand((obj) =>
            {
                _service.SplitBatchBomRequest(GeneralParameter.ParamBeginDate.Value);
                QueryBaseCommand.Execute(null);
                CommonService.WriteActionLog(new ActionOperationLogModel {
                    ActionName = "MaterialRequestGenerateCommand", ActionDesc = "生成物料需求", UserId = User.ID, MainMenuId = Menu.ID, PKId = -1, HostName = HostName
                });
            });

            WorkshopInventoryRefreshCommand = new DelegateCommand((obj) =>
            {
                BatchBomRequestSummaryLists.Clear();
                _service.RefreshWorkshopInventoryQty(CommonService.GetSqlWhereString(Filter));
                QueryBaseCommand.Execute(null);
                CommonService.WriteActionLog(new ActionOperationLogModel {
                    ActionName = "WorkshopInventoryRefreshCommand", ActionDesc = "获取现场库存", UserId = User.ID, MainMenuId = Menu.ID, PKId = -1, HostName = HostName
                });
            });

            QueryBaseCommand = new DelegateCommand((obj) =>
            {
                BatchBomRequestSummaryLists.Clear();
                InventoryLists.Clear();
                DeliverTransferLists.Clear();
                _service.GetBatchBomRequestDetailSummaryLists(CommonService.GetSqlWhereString(Filter)).ForEach(x => BatchBomRequestSummaryLists.Add(x));
            });

            DeliverCommand = new DelegateCommand((obj) =>
            {
                if (BatchBomRequestSummarySelectedItem != null)
                {
                    if (InventorySelectedItem != null && InventorySelectedItem.TransferingWeight > 0 && InventorySelectedItem.TransferingWeight <= InventorySelectedItem.TotalWeight)
                    {
                        if (_service.InsertDeliverTransfer(InventorySelectedItem))
                        {
                            DeliverTransferLists.Clear();
                            _service.GetDeliverTransferLists(BatchBomRequestSummarySelectedItem).ForEach(x => DeliverTransferLists.Add(x));
                            BatchBomRequestSummarySelectedItem.QtyTransfering = DeliverTransferLists.Where(x => string.IsNullOrEmpty(x.TransferedBillNo)).Sum(x => x.TransferingWeight).Value;
                        }
                    }
                    else
                    {
                        MessageBox.Show("发料数量必须大于0且小于总重量");
                    }
                }
                else
                {
                    MessageBox.Show("先选择主表行数据");
                }
                CommonService.WriteActionLog(new ActionOperationLogModel {
                    ActionName = "DeliverCommand", ActionDesc = "发料", UserId = User.ID, MainMenuId = Menu.ID, PKId = -1, HostName = HostName
                });
            });

            DeliveryDeleteCommand = new DelegateCommand((obj) =>
            {
                int id = -1;
                if (BatchBomRequestSummarySelectedItem != null)
                {
                    var selectedLists = ((obj as DataGrid).SelectedItems).Cast <MaterialTimelyInventoryModel>().ToList();
                    if (selectedLists.Count == 1)
                    {
                        var model = selectedLists.First();
                        if (_service.DeleteDeliverTransfer(model.Id))
                        {
                            id = model.Id;
                            DeliverTransferLists.Clear();
                            _service.GetDeliverTransferLists(BatchBomRequestSummarySelectedItem).ForEach(x => DeliverTransferLists.Add(x));
                            BatchBomRequestSummarySelectedItem.QtyTransfering = DeliverTransferLists.Sum(x => x.TransferingWeight).Value;
                        }
                    }
                    else
                    {
                        MessageBox.Show("每次必须选中且删除一行记录");
                    }
                }
                else
                {
                    MessageBox.Show("先选择主表行数据");
                }
                CommonService.WriteActionLog(new ActionOperationLogModel {
                    ActionName = "DeliveryDeleteCommand", ActionDesc = "删除发料", UserId = User.ID, MainMenuId = Menu.ID, PKId = id, HostName = HostName
                });
            });

            TransferDeleteCommand = new DelegateCommand((obj) =>
            {
                if (BatchBomRequestSummarySelectedItem != null)
                {
                    var selectedLists = ((obj as DataGrid).SelectedItems).Cast <MaterialTimelyInventoryModel>().ToList();
                    if (selectedLists.Count == 1)
                    {
                        var model = selectedLists.First();
                        if (!_service.ExistsK3Bill(model.TransferedBillNo))
                        {
                            if (_service.DeleteDeliverTransfer(model.TransferedBillNo))
                            {
                                //重新加载主表格
                                QueryBaseCommand.Execute(null);
                            }
                        }
                        else
                        {
                            MessageBox.Show("请先将选择的调拨单号,在K3里面删除");
                        }
                    }
                    else
                    {
                        MessageBox.Show("每次必须选中且删除一行记录");
                    }
                }
                else
                {
                    MessageBox.Show("先选择主表行数据");
                }
                CommonService.WriteActionLog(new ActionOperationLogModel {
                    ActionName = "TransferDeleteCommand", ActionDesc = "删除调拨单", UserId = User.ID, MainMenuId = Menu.ID, PKId = -1, HostName = HostName
                });
            });

            SelectionChangedCommand = new DelegateCommand((obj) =>
            {
                if (BatchBomRequestSummarySelectedItem == null)
                {
                    return;
                }
                InventoryLists.Clear();
                _service.GetGetMaterialTimelyInventoryLists(BatchBomRequestSummarySelectedItem.MaterialId, BatchBomRequestSummarySelectedItem.ProductionDate, BatchBomRequestSummarySelectedItem.BatchTypeId, BatchBomRequestSummarySelectedItem.StockId).ForEach(x => InventoryLists.Add(x));
                DeliverTransferLists.Clear();
                _service.GetDeliverTransferLists(BatchBomRequestSummarySelectedItem).ForEach(x => DeliverTransferLists.Add(x));
            });

            BatchNoQtyK3InsertCommand = new DelegateCommand((obj) =>
            {
                // 获取当天所有已发料未调拨数据  var selectedLists = ((obj as DataGrid).SelectedItems).Cast<MaterialTimelyInventoryModel>().ToList();
                var selectedLists = _service.GetK3InsertData(GeneralParameter.ParamBeginDate.Value);
                if (selectedLists.Count > 0)
                {
                    var emp = K3ApiFKService.GetEmployeeByUserName(User.UserName);
                    if (emp != null)
                    {
                        TransferMainModel main = new TransferMainModel
                        {
                            FBillerID = new BaseNumberNameModelX {
                                FNumber = emp.FName, FName = emp.FName
                            },
                            FFManagerID = emp, // BaseNumberNameModelX { FNumber = "111", FName = "吴强" },
                            FSManagerID = emp, // new BaseNumberNameModelX { FNumber = "111", FName = "吴强" },
                            FRefType    = new BaseNumberNameModelX {
                                FNumber = "01", FName = "成本调拨"
                            },
                            FClassTypeID = 41,
                            FDate        = DateTime.Now.Date.ToString("yyyy-MM-dd")
                        };

                        List <TransferSonModel> sons = new List <TransferSonModel>();

                        foreach (MaterialTimelyInventoryModel item in selectedLists)
                        {
                            sons.Add(new TransferSonModel
                            {
                                FItemID = new BaseNumberNameModelX {
                                    FNumber = item.MaterialNumber, FName = item.MaterialName
                                },                                                                                              // K3ApiFKService.GetMaterialById
                                FChkPassItem = new BaseNumberNameModelX {
                                    FNumber = "Y", FName = "是"
                                },
                                FPlanMode = new BaseNumberNameModelX {
                                    FNumber = "MTS", FName = "MTS计划模式"
                                },
                                FDCStockID1 = new BaseNumberNameModelX {
                                    FNumber = item.ParentStockNumber, FName = item.ParentStockName
                                },                                                                                                        //K3ApiFKService.GetStockById(item.ParentStockId),
                                FSCStockID1 = new BaseNumberNameModelX {
                                    FNumber = item.StockNumber, FName = item.StockName
                                },
                                FUnitID = new BaseNumberNameModelX {
                                    FNumber = "kg", FName = "kg"
                                },
                                FAuxQty  = item.TransferingWeight.Value,
                                FQty     = item.TransferingWeight.Value,
                                FBatchNo = item.BatchNo,
                            });
                        }
                        var requestModel = new K3ApiInsertRequestModel <TransferMainModel, TransferSonModel>()
                        {
                            Data = new K3ApiInsertDataRequestModel <TransferMainModel, TransferSonModel>()
                            {
                                Page1 = new List <TransferMainModel> {
                                    main
                                },
                                Page2 = sons
                            }
                        };

                        string postJson = JsonHelper.ObjectToJson(requestModel);
                        K3ApiInsertResponseModel response = K3ApiService.Insert("Transfer", postJson);
                        if (response.StatusCode == 200)
                        {
                            //double totalQty = selectedLists.Sum(x => x.TransferingWeight).Value;
                            string ids = string.Join(",", selectedLists.Select(x => x.Id));
                            if (_service.UpdateBillNo(ids, response.Data.BillNo))
                            {
                                QueryBaseCommand.Execute(null);
                            }
                            else
                            {
                                MessageBox.Show($"插入K3调拨单,更新发料表失败,请联系管理员");
                            }
                        }
                        else
                        {
                            MessageBox.Show($"{response.Message}");
                        }
                    }
                    else
                    {
                        MessageBox.Show($"【{User.UserName}】 在K3里面不存在,或不一致");
                    }
                }
                else
                {
                    MessageBox.Show($"【{GeneralParameter.ParamBeginDate.Value}】 没有已发料且未调拨的数据");
                }

                CommonService.WriteActionLog(new ActionOperationLogModel {
                    ActionName = "BatchNoQtyK3InsertCommand", ActionDesc = "生成调拨单", UserId = User.ID, MainMenuId = Menu.ID, PKId = -1, HostName = HostName
                });
            });
        }
        private void InitCommand()
        {
            #region 打印参数
            PrintConfigurationSaveBaseCommand = new DelegateCommand((obj) =>
            {
                string msg = PrintHelper.VerifyPrintConfiguration(PrintConfiguration);
                if (string.IsNullOrEmpty(msg))
                {
                    int id = CommonService.SaveBarTenderPrintConfigXX(PrintConfiguration);
                    if (id > 0)
                    {
                        PrintConfiguration.Id = id;
                        MessageBox.Show("保存成功");
                    }

                    else
                    {
                        MessageBox.Show("保存失败,请联系管理员");
                    }
                }
                else
                {
                    MessageBox.Show(msg);
                }
            });

            TemplateSelectBaseCommand = new DelegateCommand((obj) =>
            {
                System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    PirntTemplates = PrintHelper.GetTenderPrintTemplates(fbd.SelectedPath);
                }
            });
            #endregion

            #region 导出

            //DirectorySelectBaseCommand = new DelegateCommand((obj) =>
            //{
            //	// 导出目录选择
            //	System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();

            //	if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            //	{
            //		HostConfig.HostValue = fbd.SelectedPath;
            //		var result = CommonService.SaveHostConfig(HostConfig);
            //		if (result)
            //		{
            //			HostConfig = CommonService.GetHostConfig(DataGridId, HostName, User.ID);
            //		}
            //	}
            //});

            //ExportBaseCommand = new DelegateCommand((obj) =>
            //{
            //	if (Directory.Exists(HostConfig.HostValue))
            //	{
            //		ExportView view = new ExportView(DataGridId);
            //		(view.DataContext as ExportViewModel).Export(1, (type, outputEntity, checkBoxValue, orderedColumns) =>
            //		{
            //			view.Close();
            //			if (type == 1)
            //			{
            //				DataTable datatable = new DataTable();
            //				if (outputEntity == 1)
            //				{
            //					datatable = _service.GetExportData1("DGPrintA4", User.ID, CommonService.GetSqlWhereString(QueryParameter));
            //					ExportHelper.ExportDataTableToExcel(datatable, HostConfig.HostValue, HostConfig.TypeDesciption + CommonService.GetQueryParameterValueString(QueryParameter));
            //					MessageBox.Show("导出成功");
            //				}
            //				//else if (outputEntity == 2)
            //				//{
            //				//	datatable = _shippingService.GetShippingBillExprotDataTable2(UserDataId);
            //				//	new Helper.DataTableImportExportHelper().ExportDataTableToExcel(datatable, HostConfig.HostValue, HostConfig.TypeDesciption);
            //				//	MessageBox.Show("导出成功");
            //				//}
            //				//else if (outputEntity == 3)
            //				//{
            //				//	datatable = _shippingService.GetShippingBillExprotDataTable3(UserDataId, string.Join(",", orderedColumns));
            //				//	new Helper.DataTableImportExportHelper().ExportDataTableToExcel(datatable, HostConfig.HostValue, HostConfig.TypeDesciption, checkBoxValue, 1, orderedColumns);
            //				//	MessageBox.Show("导出成功");
            //				//}
            //			}
            //		});
            //		view.ShowDialog();
            //	}
            //	else
            //	{
            //		MessageBox.Show("目录不存在,请先选择导出的目录");
            //		DirectorySelectBaseCommand.Execute(null);
            //	}
            //	CommonService.WriteActionLog(new ActionOperationLogModel { ActionName = "ExportBaseCommand", ActionDesc = HostConfig.TypeDesciption + HostConfig.TypeId.ToString(), UserId = User.ID, MainMenuId = Menu.ID, PKId = -1, HostName = HostName });
            //});
            #endregion

            #region 保存表格
            DataGridManageBaseCommand = new DelegateCommand((obj) =>
            {
                var grid = obj as DataGrid;
                UserDataGridFormatConfigurationView view = new UserDataGridFormatConfigurationView("DGPrintLS");
                (view.DataContext as UserDataGridFormatConfigurationViewModel).WithParam(null, (type, outputEntity) =>
                {
                    view.Close();
                    if (type == 1)
                    {
                        // 重新加载DataGrid格式
                        grid.Columns.Clear();
                        CommonService.GetUserDataGridColumn(User.ID, grid, 0);
                    }
                });
                view.ShowDialog();
            });

            DataGridSaveBaseCommand = new DelegateCommand((obj) =>
            {
                DataGridManagementService.SaveColumnConfigurationInUserInterface(obj as DataGrid, User.ID);
                MessageBox.Show("表格格式保存成功");
            });
            #endregion

            #region 其他
            PrintBaseCommand = new DelegateCommand((obj) =>
            {
                string msg = PrintHelper.VerifyPrintConfiguration(PrintConfiguration);
                if (string.IsNullOrEmpty(msg))
                {
                    if (BarcodeTypeSelectedItem.ItemSeq == 1)
                    {
                        MessageBox.Show("工单不能打印,请选择其他类别");
                        return;
                    }
                    var selectedLists = ((obj as DataGrid).SelectedItems).Cast <LabelPrintLSModel>().ToList();
                    if (selectedLists.Count > 0)
                    {
                        string result = _print.BarTenderPrintLS(selectedLists, PrintConfiguration);


                        // 将标签插入PDM系统
                        //string hids = string.Join(",", selectedLists.Select(x => x.HistoryId));
                        //var PdmLists = new PrintLSService().GetPdmBarCodeLists(ProductionDate, hids);
                        var PdmLists = selectedLists.Select(x => new LabelInsertDataModel {
                            BarCode   = x.BarCode, Inventory_Id = x.FNumber, JarmodelId = x.BucketNumber, Unit_weight = x.NetWeight, ProjectBatch = x.HistoryBatchNo
                            , BoxCode = "1", Nbox = "1", CreateDate = DateTime.Now.Date.ToString("yyyy-MM-dd")
                        });
                        foreach (var item in PdmLists)
                        {
                            CommonHelper.InsertBarCode(item);
                        }
                        MessageBox.Show(result);
                        QueryBaseCommand.Execute(null);
                    }
                    else
                    {
                        MessageBox.Show("先选择行数据,【CTRL】或【SHFIT】 多选行");
                    }
                }
                else
                {
                    MessageBox.Show(msg);
                }
            });

            QueryBaseCommand = new DelegateCommand((obj) =>
            {
                PrintLSLists.Clear();
                _service.GetLists(ProductionDate, BarcodeTypeSelectedItem.ItemSeq).ForEach(x => PrintLSLists.Add(x));
            });
            #endregion

            GenerationNewDataCommand = new DelegateCommand((obj) =>
            {
                //if (_service.ExistsPrintData(ProductionDate))
                //{
                //    //提示是否清理
                //    MessageBoxResult result = MessageBox.Show("当天已经有数据,重新生成会将打印记录清除", "温馨提示", MessageBoxButton.YesNo);
                //    if (result == MessageBoxResult.Yes)
                //    {
                //        _service.GenerationPrintData(ProductionDate);
                //    }
                //}
                //else
                //{
                _service.GenerationPrintData(ProductionDate);
                //}
                QueryBaseCommand.Execute(null);
            });
        }