Example #1
0
        public void CancelTaskIn(string billNo)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                TaskDao taskDao = new TaskDao();
                BillDao billDao = new BillDao();
                CellDao cellDao = new CellDao();
                ScheduleDao scheduleDao = new ScheduleDao();
                ProductStateDao productStateDao = new ProductStateDao();

                try
                {
                    pm.BeginTransaction();

                    int count = taskDao.FindExecutingTask(billNo);
                    if (count != 0)
                        throw new Exception("����δִ�л�ִ���е���ҵ��");

                    taskDao.Backup(billNo);
                    taskDao.Delete(billNo);
                    billDao.UpdateMasterState(billNo, "6");//����Ϊȡ��
                    productStateDao.Delete(billNo);
                    //�������ⵥ���̰����������������ƻ�ISOUTΪ�����
                    scheduleDao.UpdateIsIn(billNo);

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }

            }
        }
Example #2
0
        public void ClearBillNo(string scheduleNo, string billNo)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                ScheduleDao scheduleDao = new ScheduleDao();
                BillDao billDao = new BillDao();
                ProductStateDao stateDao = new ProductStateDao();
                try
                {
                    pm.BeginTransaction();

                    DataTable billTable = billDao.FindMaster(billNo);
                    if (billTable.Rows.Count != 0)
                    {
                        if (billTable.Rows[0]["STATE"].ToString() == "1")
                        {
                            billDao.DeleteDetail(billNo);
                            billDao.DeleteMaster(billNo);
                            stateDao.Delete(billNo);
                            scheduleDao.UpdateBillNo(scheduleNo, "");
                        }
                        else
                            throw new Exception("����״̬Ϊ'���'�����ܽ����������");
                    }
                    else
                        throw new Exception(string.Format("���ݱ��Ϊ'{0}'�ĵ��ݲ����ڡ�", billNo));

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
Example #3
0
        public void BackBill(string billNo, string oriBillNo)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    BillDao billDao = new BillDao();
                    ProductStateDao stateDao = new ProductStateDao();

                    pm.BeginTransaction();

                    billDao.DeleteMaster(billNo);
                    billDao.DeleteDetail(billNo);

                    billDao.DeleteMaster("T" + billNo);
                    billDao.DeleteDetail("T" + billNo);
                    billDao.UpdateMasterState(oriBillNo, "2", "SENDER", "", "SENDDATE", "");

                    stateDao.Delete(billNo);
                    stateDao.Delete("T" + billNo);
                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
Example #4
0
        public void SaveBill3(DataRow masterRow, DataTable stateTable)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    BillDao billDao = new BillDao();
                    ProductStateDao stateDao = new ProductStateDao();

                    string billNo = masterRow["BILLNO"].ToString();

                    pm.BeginTransaction();

                    //���뵥������
                    billDao.UpdateMaster(masterRow);

                    //���뵥����ϸ��
                    stateDao.Delete(billNo);
                    stateDao.Insert(billNo, stateTable);

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
Example #5
0
        public void SaveBill(DataRow masterRow, DataTable detailTable, Dictionary<string, DataTable> productState)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    BillDao billDao = new BillDao();
                    ProductStateDao stateDao = new ProductStateDao();
                    ScheduleDao scheduleDao = new ScheduleDao();
                    string billNo = masterRow["BILLNO"].ToString();

                    pm.BeginTransaction();

                    //���뵥������
                    billDao.UpdateMaster(masterRow);

                    //���뵥����ϸ��
                    billDao.DeleteDetail(billNo);
                    billDao.InsertDetail(billNo, detailTable);

                    //����ProductState��
                    if (productState != null)
                    {
                        stateDao.Delete(billNo);
                        int itemNo = 1;
                        foreach (DataTable stateTable in productState.Values)
                        {
                            stateDao.Insert(masterRow["SCHEDULENO"].ToString(),
                                        billNo,
                                        stateTable,
                                        ref itemNo);
                        }
                    }
                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
Example #6
0
        public void DeleteBill3(string billNo)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    BillDao billDao = new BillDao();
                    ProductStateDao stateDao = new ProductStateDao();

                    pm.BeginTransaction();

                    billDao.DeleteMaster(billNo);
                    stateDao.Delete(billNo);

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
Example #7
0
        public void DeleteBill(string scheduleNo, string billNo)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    BillDao billDao = new BillDao();
                    ProductStateDao stateDao = new ProductStateDao();
                    ScheduleDao scheduleDao = new ScheduleDao();

                    pm.BeginTransaction();

                    billDao.DeleteMaster(billNo);
                    billDao.DeleteDetail(billNo);

                    if (scheduleNo != null)
                    {
                        stateDao.Delete(billNo);
                        scheduleDao.UpdateBillNo(scheduleNo, "");
                    }

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }