private void CreateShippingBill(object obj)
        {
            int id = _shippingService.AddShippingBill(user.ID);

            if (id > 0)
            {
                ShippingBills.Insert(0, _shippingService.GetShippingBillById(id));
            }
            _commonService.WriteActionLog(new ActionOperationLogModel {
                ActionName = "CreateShippingBill", ActionDesc = "新增托运单", UserId = user.ID, MainMenuId = 7, PKId = id, HostName = _hostName
            });
        }
 public void GetShippingBills()
 {
     ShippingBills.Clear();
     _shippingService.GetAllShippingBills(userDataId, GeneralParameter).ToList().ForEach(x => ShippingBills.Add(x));
 }
        private void DeleteShippingBill(object obj)
        {
            MessageBoxResult result = MessageBox.Show($"将会将合并此单的销售调拨数据\r\n还原到未合并前的状态 \r\n \r\n 物流单号:【{SelectedShippingBill.LogisticsBillNo}】\r\n  总金额:【{SelectedShippingBill.TotalAmount}】"
                                                      + $"\r\n   总重量:【{SelectedShippingBill.TotalQuantity}】"
                                                      + $"\r\n  系统单号:【{SelectedShippingBill.BillNo}】"
                                                      + $"\r\n  托运日期:【{SelectedShippingBill.BillDate}】"
                                                      , "【删除警告!!!】", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                int id = SelectedShippingBill.Id;

                if (SelectedShippingBill.IsSystem == 0)
                {
                    bool succ = _shippingService.DeleteNonSystemShipingBill(id);
                    if (succ)
                    {
                        ShippingBills.Remove(SelectedShippingBill);
                        ShippingBillEntries.Clear();
                        QuerySignmentBill(null);
                    }
                    else
                    {
                        MessageBox.Show("删除出现异常");
                        return;
                    }
                }
                else
                {
                    string billNos = _consignmentService.GetConsignmentBillNosByShippingBillId(id);
                    if (!string.IsNullOrEmpty(billNos))
                    {
                        string lockMessage = _consignmentService.GetConsignmentBillLock(billNos);
                        if (string.IsNullOrEmpty(lockMessage))
                        {
                            string rollbackMessage = _shippingService.DeleteShipingBill(id);
                            if (string.IsNullOrEmpty(rollbackMessage))
                            {
                                ShippingBills.Remove(SelectedShippingBill);
                                ShippingBillEntries.Clear();
                                QuerySignmentBill(null);
                            }
                            else
                            {
                                MessageBox.Show(rollbackMessage);
                            }
                        }
                        else
                        {
                            MessageBox.Show(lockMessage);
                        }
                    }
                    else
                    {
                        MessageBox.Show("合成此托运单的明细单据丢失,请联系管理员");
                    }
                }

                _commonService.WriteActionLog(new ActionOperationLogModel {
                    ActionName = "DeleteShippingBill", ActionDesc = "删除托运单", UserId = user.ID, MainMenuId = 7, PKId = id, HostName = _hostName
                });
            }
        }