Пример #1
0
        public void CancelTask(string billNo)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                TaskDao taskDao = new TaskDao();
                BillDao billDao = new BillDao();
                CellDao cellDao = new CellDao();

                try
                {
                    pm.BeginTransaction();

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

                    if (cellDao.Update(billNo) > 0)
                    {
                        taskDao.Backup(billNo);
                        taskDao.Delete(billNo);
                        billDao.UpdateMasterState(billNo, "6");//����Ϊȡ��
                    }
                    else
                        throw new Exception("�õ���ȫ����ҵ�����");

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

            }
        }
Пример #2
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);
                }

            }
        }
Пример #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);
                }
            }
        }
Пример #4
0
        /// <summary>
        /// ���������ҵ
        /// </summary>
        /// <param name="billNo"></param>
        /// <param name="userID"></param>
        /// <param name="date"></param>
        public DataTable TaskUrgentBill(string billNo, string status, string userID, string date)
        {
            DataTable table = null;
            using (PersistentManager pm = new PersistentManager())
            {
                BillDao billDao = new BillDao();
                ProductStateDao stateDao = new ProductStateDao();
                TaskDao taskDao = new TaskDao();

                try
                {
                    pm.BeginTransaction();

                    DataTable masterTable = billDao.FindMaster(billNo);
                    if (masterTable.Rows.Count != 0)
                    {
                        string scheduleNo = masterTable.Rows[0]["SCHEDULENO"].ToString();

                        //PRODUCTSTATE��û������
                        //if (stateDao.FindDetail(billNo).Rows.Count == 0)
                        //{
                        //    DataTable detailTable = billDao.FindDetail(billNo);
                        //    int item = 1;
                        //    stateDao.Insert(scheduleNo, billNo, detailTable, ref item);
                        //}

                        string result = billDao.TaskUrgentOutBill(billNo);
                        if (result != "0")
                            throw new Exception("û��Ϊ��Ʒ�ҵ���λ���⡣");

                        ////����billmaster״̬
                        billDao.UpdateMasterState(billNo, "3", "TASKER", userID, "TASKDATE", date);

                        //���ij����ܰ���
                        //int packageCount = taskDao.FindTaskCount(billNo);
                        //ScheduleDao scheduleDao = new ScheduleDao();
                        //scheduleDao.UpdatePackageCount(scheduleNo, packageCount);
                    }
                    else
                        throw new Exception(string.Format("δ�ҵ����ݺ�Ϊ'{0}'�ĵ��ݡ�", billNo));

                    table = stateDao.FindDetail(billNo);
                    pm.Commit();
                    return table;

                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
Пример #5
0
        //�ƿ���ҵ
        public void TaskBillMove(string billNo, string userID, string date)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                BillDao billDao = new BillDao();
                ProductStateDao stateDao = new ProductStateDao();
                TaskDao taskDao = new TaskDao();
                CellDao cellDao = new CellDao();

                try
                {
                    pm.BeginTransaction();
                    DataTable masterTable = billDao.FindMaster(billNo);
                    if (masterTable.Rows.Count != 0)
                    {
                        string taskType = masterTable.Rows[0]["TTYPE"].ToString();
                        string taskLevel = masterTable.Rows[0]["TASKLEVEL"].ToString();
                        string target = masterTable.Rows[0]["TARGET"].ToString();

                        int taskCount = stateDao.FindCount(billNo);

                        //���Ļ�λ����״̬
                        int cellCount = cellDao.Update(billNo, taskType);
                        int newCellCount = cellDao.Update2(billNo, taskType);

                        if (taskCount != cellCount || taskCount != newCellCount)
                            throw new Exception("��ҵ������ɲ�����λ������һ��");

                        //����task��ҵ��
                        taskDao.Insert(billNo, taskType, taskLevel, target);

                        ////����billmaster״̬
                        billDao.UpdateMasterState(billNo, "3", "TASKER", userID, "TASKDATE", date);

                    }
                    else
                        throw new Exception(string.Format("δ�ҵ����ݺ�Ϊ'{0}'�ĵ��ݡ�", billNo));
                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
Пример #6
0
        /// <summary>
        /// �����ҵ
        /// </summary>
        /// <param name="billNo"></param>
        /// <param name="stateTable"></param>
        /// <param name="userID"></param>
        /// <param name="date"></param>
        public void TaskBill(string billNo, DataTable stateTable, string userID, string date)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                BillDao billDao = new BillDao();
                ProductStateDao stateDao = new ProductStateDao();
                TaskDao taskDao = new TaskDao();

                try
                {
                    pm.BeginTransaction();
                    DataTable masterTable = billDao.FindMaster(billNo);
                    if (masterTable.Rows.Count != 0)
                    {
                        string scheduleNo = masterTable.Rows[0]["SCHEDULENO"].ToString();
                        string taskType = masterTable.Rows[0]["TTYPE"].ToString();
                        string taskLevel = masterTable.Rows[0]["TASKLEVEL"].ToString();
                        string target = masterTable.Rows[0]["TARGET"].ToString();

                        //�жϵ�ǰ�����Ƿ���productstaet��������������Ǹ���billdetail����
                        if (stateTable.Rows.Count == 0)
                        {
                            DataTable detailTable = billDao.FindDetail(billNo);
                            int item = 1;
                            stateDao.Insert(scheduleNo, billNo, detailTable, ref item);
                        }

                        stateDao.UpdateBarcode(billNo);

                        //����task��ҵ��
                        taskDao.Insert(billNo, taskType, taskLevel, target);

                        ////����billmaster״̬
                        billDao.UpdateMasterState(billNo, "3", "TASKER", userID, "TASKDATE", date);

                    }
                    else
                        throw new Exception(string.Format("δ�ҵ����ݺ�Ϊ'{0}'�ĵ��ݡ�", billNo));
                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
Пример #7
0
 public void SendBillOutToNC(string billNo,string oriBillNo, string sysDate, string userID)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         try
         {
             pm.BeginTransaction();
             NCServices.NCService service = new NCServices.NCService();
             string returnMsg = service.SendMsg("icss", "1", oriBillNo, "NCSENDOUTBILL");
             if (returnMsg.IndexOf("000") == 0)
             {
                 BillDao billDao = new BillDao();
                 billDao.UpdateMasterState(billNo, "5", "SENDER", userID, "SENDDATE", sysDate);
             }
             else
             {
                 throw new Exception(string.Format("���ͳ��ⵥʧ�ܣ�ԭ���ǣ�'{0}'��", returnMsg));
             }
             pm.Commit();
         }
         catch (Exception e)
         {
             pm.Rollback();
             throw new Exception(e.Message);
         }
     }
 }
Пример #8
0
        public void SendBill(string oriBillNo, string sysDate, string userID, string status)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    BillDao billDao = new BillDao();
                    ProductStateDao stateDao = new ProductStateDao();

                    pm.BeginTransaction();

                    string billNo = billDao.FindNewBillNo("P", sysDate);

                    billDao.UpdateMasterState(oriBillNo, "5", "SENDER", userID, "SENDDATE", sysDate);
                    billDao.SendMaster(billNo, sysDate, oriBillNo, userID, status);

                    DataTable detailTable = stateDao.Find(oriBillNo);
                    billDao.InsertDetail(billNo, detailTable);

                    if (status == "1")//���ⵥ
                    {
                        billDao.InsertDetail("T" + billNo, detailTable);
                        stateDao.Send("T" + billNo, oriBillNo);
                    }

                    //DataTable cigaretteTable = stateDao.FindCigarette(oriBillNo);
                    //stateDao.UpdateCigarette(oriBillNo, cigaretteTable);

                    stateDao.UpdateBarcode2(oriBillNo);
                    stateDao.Send(billNo, oriBillNo);

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
Пример #9
0
 public void CheckBill(string billNo, string state, string userID, string date)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         BillDao billDao = new BillDao();
         billDao.UpdateMasterState(billNo, state, "CHECKER", userID, "CHECKDATE", date);
     }
 }