Example #1
0
        public bool AllotCancelConfirm(string billNo, out string strResult)
        {
            bool result = false;
            var  ibm    = OutBillMasterRepository.GetQueryable().FirstOrDefault(i => i.BillNo == billNo && i.Status == "4");

            if (ibm != null)
            {
                if (string.IsNullOrEmpty(ibm.LockTag))
                {
                    try
                    {
                        using (var scope = new TransactionScope())
                        {
                            if (ibm.MoveBillMaster != null)
                            {
                                try
                                {
                                    MoveBillCreater.DeleteMoveBillDetail(ibm.MoveBillMaster);
                                    MoveBillMasterRepository.Delete(ibm.MoveBillMaster);
                                    MoveBillMasterRepository.SaveChanges();
                                }
                                catch (Exception)
                                {
                                    strResult = "删除同步移库单失败,请重新取消!";
                                    return(false);
                                }
                            }

                            ibm.Status     = "3";
                            ibm.UpdateTime = DateTime.Now;
                            OutBillMasterRepository.SaveChanges();
                            result    = true;
                            strResult = "取消成功";

                            scope.Complete();
                        }
                    }
                    catch (Exception)
                    {
                        strResult = "当前订单其他人正在操作,请稍候重试!";
                    }
                }
                else
                {
                    strResult = "当前订单其他人正在操作,请稍候重试!";
                }
            }
            else
            {
                strResult = "当前订单状态不是已确认,或当前订单不存在!";
            }
            return(result);
        }
        public bool Delete(string BillNo, out string strResult)
        {
            bool result = false;
            var  mbm    = MoveBillMasterRepository.GetQueryable().FirstOrDefault(i => i.BillNo == BillNo && i.Status == "1");

            if (LockBillMaster(BillNo))
            {
                if (mbm != null)
                {
                    MoveBillCreater.DeleteMoveBillDetail(mbm);
                    Del(MoveBillDetailRepository, mbm.MoveBillDetails);
                    MoveBillMasterRepository.Delete(mbm);
                    MoveBillMasterRepository.SaveChanges();
                    result = true;
                }
            }
            else
            {
                result = false;
            }
            strResult = resultStr;
            return(result);
        }
Example #3
0
        public bool Delete(string BillNo, out string strResult)
        {
            strResult = string.Empty;
            bool result = false;
            var  mbm    = MoveBillMasterRepository.GetQueryable().FirstOrDefault(i => i.BillNo == BillNo && i.Status == "1");

            if (LockBillMaster(BillNo))
            {
                if (mbm != null)
                {
                    try
                    {
                        MoveBillCreater.DeleteMoveBillDetail(mbm);
                        Del(MoveBillDetailRepository, mbm.MoveBillDetails);
                        MoveBillMasterRepository.Delete(mbm);
                        MoveBillMasterRepository.SaveChanges();
                        result = true;
                    }
                    catch (Exception ex)
                    {
                        strResult = "删除失败,原因:" + ex.Message;
                    }
                }
                else
                {
                    strResult = "删除失败!未找到当前需要删除的数据!";
                    result    = false;
                }
            }
            else
            {
                strResult = resultStr;
                result    = false;
            }
            return(result);
        }