Ejemplo n.º 1
0
        private void ModifyOilSampleFlowLog(object obj)
        {
            if (OilSampleFlowLogSelectedItem != null)
            {
                if (OilSampleFlowLogSelectedItem.TypeId == 1)
                {
                    MessageBox.Show("快递单次数不允许修改");
                    return;
                }
                OilSampleFlowLogModifyView edit = new OilSampleFlowLogModifyView();
                var cloneData = ObjectDeepCopyHelper <OilSampleFlowPrintLogModel, OilSampleFlowPrintLogModel> .Trans(OilSampleFlowLogSelectedItem);

                (edit.DataContext as OilSampleFlowLogModifyViewModel).WithParam(cloneData, (type, entry) =>
                {
                    edit.Close();
                    if (type == 1)
                    {
                        var r = _oilSampleService.UpdateOilSampleFlowLog(entry);
                        if (r)
                        {
                            OilSampleFlowLogSelectedItem.PrintedCount = entry.PrintedCount;
                            //重新加载明细
                            if (OilSampleFlowSelectedItem != null)
                            {
                                OilSampleEntries.Clear();
                                _oilSampleService.GetOilSampleEntries(OilSampleFlowSelectedItem.Id).ToList().ForEach(x => OilSampleEntries.Add(x));
                            }
                        }
                    }
                });
                edit.ShowDialog();
            }
        }
Ejemplo n.º 2
0
 private void ChangeOilSampleFlowSelection(object obj)
 {
     if (obj != null)
     {
         OilSampleFlowSelectedItem = (OilSampleFlowModel)obj;
         OilSampleEntries.Clear();
         _oilSampleService.GetOilSampleEntries(OilSampleFlowSelectedItem.Id).ToList().ForEach(x => OilSampleEntries.Add(x));
     }
 }
Ejemplo n.º 3
0
        private void MergePrintOilSampleEntry(object obj)
        {
            int printCount = 0;

            if (string.IsNullOrEmpty(OilSamplePrintConfig.PrinterName) || OilSamplePrintConfig.TemplateFileName == null)
            {
                MessageBox.Show("请选择模板和打印机");
                return;
            }

            if (OilSampleEntries.Count == 0)
            {
                MessageBox.Show($"请先选择样油明细");
                return;
            }

            var data = new ObservableCollection <OilSampleEntryModel>();

            foreach (var item in OilSampleEntries)
            {
                if (item.IsChecked && item.CurrencyPrintCount > 0)
                {
                    printCount += item.CurrencyPrintCount;
                    data.Add(item);
                }
            }

            if (OilSampleEntries.Count > 1 && printCount > 4)
            {
                MessageBox.Show($"多条明细最多选择打印4小张");
                return;
            }


            if (printCount == 0)
            {
                MessageBox.Show($"打印张数为0,请修改数量");
                return;
            }

            if (printCount > 4)
            {
                printCount = 4;
            }

            var r = new PrintService().BarTenderOilSampleEntryMergePrint(OilSamplePrintConfig, data, printCount, OilSampleTemplates);

            if (r)
            {
                // 重新加载明细
                OilSampleEntries.Clear();
                OilSampleFlowLogs.Clear();
                _oilSampleService.GetOilSampleEntries(OilSampleFlowSelectedItem.Id).ToList().ForEach(x => OilSampleEntries.Add(x));
                _oilSampleService.GetOilSampleFlowLog().ToList().ForEach(x => OilSampleFlowLogs.Add(x));
                MessageBox.Show("打印成功");
            }
            else
            {
                MessageBox.Show("打印过程出错,请联系管理员 ");
            }
        }
Ejemplo n.º 4
0
        private void ModifyOilSampleEntryPrintLog(object obj)
        {
            if (OilSampleEntrySelectedItem == null)
            {
                return;
            }
            var r = _oilSampleService.UpdateOilSampleFlowLog(OilSampleEntrySelectedItem.Id);

            if (r)
            {
                // 重新加载entries 和log
                OilSampleEntries.Clear();
                OilSampleFlowLogs.Clear();
                _oilSampleService.GetOilSampleEntries(OilSampleFlowSelectedItem.Id).ToList().ForEach(x => OilSampleEntries.Add(x));
                _oilSampleService.GetOilSampleFlowLog().ToList().ForEach(x => OilSampleFlowLogs.Add(x));
                MessageBox.Show("该行打印张数已全部清0");
            }
            else
            {
                MessageBox.Show("清空日志失败,请联系管理员");
            }
        }
Ejemplo n.º 5
0
        private void OrderPrintOilSampleEntry(object obj)
        {
            int printCount     = 0;
            int previousCounts = 0;

            if (string.IsNullOrEmpty(OilSamplePrintConfig.PrinterName) || OilSamplePrintConfig.TemplateFileName == null)
            {
                MessageBox.Show("请选择模板和打印机");
                return;
            }

            var data = new ObservableCollection <OilSampleEntryModel>();

            foreach (var item in OilSampleEntries)
            {
                if (item.CurrencyPrintCount > 0)
                {
                    printCount += item.CurrencyPrintCount;

                    if (printCount >= 4)
                    {
                        item.CurrencyPrintCount = 4 - previousCounts;
                        printCount = 4;
                        data.Add(item);
                        break;
                    }
                    else
                    {
                        previousCounts += item.CurrencyPrintCount;
                        data.Add(item);
                    }
                }
            }
            if (printCount == 0 || printCount > 4)
            {
                MessageBox.Show("本流程明细已经全部打印完毕");
                return;
            }


            var r = new PrintService().BarTenderOilSampleEntryMergePrint(OilSamplePrintConfig, data, printCount, OilSampleTemplates);

            if (r)
            {
                // 重新加载明细
                OilSampleEntries.Clear();
                OilSampleFlowLogs.Clear();
                _oilSampleService.GetOilSampleEntries(OilSampleFlowSelectedItem.Id).ToList().ForEach(x => OilSampleEntries.Add(x));
                _oilSampleService.GetOilSampleFlowLog().ToList().ForEach(x => OilSampleFlowLogs.Add(x));
                MessageBox.Show("打印成功");
            }
            else
            {
                MessageBox.Show("打印过程出错,请联系管理员 ");
            }
        }