Ejemplo n.º 1
0
        public void DeleteFormula(string formulaCode)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                FormulaDao formulaDao = new FormulaDao();
                ScheduleDao scheduleDao = new ScheduleDao();
                try
                {
                    pm.BeginTransaction();

                    if (scheduleDao.Find(formulaCode) == 0)
                    {
                        formulaDao.DeleteDetail(formulaCode);
                        formulaDao.DeleteMaster(formulaCode);
                    }
                    else
                        throw new Exception("��ǰ�䷽�����������ƻ��Ѱ�");

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
Ejemplo n.º 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);
                }

            }
        }
Ejemplo n.º 3
0
 public void AddSchedule(string scheduleBatch, string cigaretteCode, string cigaretteName, string quantity)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         ScheduleDao scheduleDao = new ScheduleDao();
         string scheduleNo = scheduleBatch;
         //scheduleDao.Insert(scheduleBatch.PadLeft(10, '0'), scheduleUnit, cigaretteCode, cigaretteName, quantity);
         if (scheduleDao.FindSchedule(scheduleNo) == 0)
             scheduleDao.Insert(scheduleBatch, cigaretteCode, cigaretteName, quantity);
         else
             throw new Exception("���κ�'" + scheduleNo + "'�Ѵ��ڣ����������롣");
     }
 }
Ejemplo n.º 4
0
 public void ClearFormula(string scheduleNo, string formulaCode)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         ScheduleDao scheduleDao = new ScheduleDao();
         FormulaDao formulaDao = new FormulaDao();
         try
         {
             pm.BeginTransaction();
             formulaDao.PlusUseCount(formulaCode);
             scheduleDao.UpdateFormula(scheduleNo, "");
             pm.Commit();
         }
         catch (Exception e)
         {
             pm.Rollback();
             throw new Exception(e.Message);
         }
     }
 }
Ejemplo n.º 5
0
        public void AddBill(DataRow masterRow, DataTable detailTable, Dictionary<string, DataTable> productState, string prefix, string billDate)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    BillDao billDao = new BillDao();
                    ProductStateDao stateDao = new ProductStateDao();
                    ScheduleDao scheduleDao = new ScheduleDao();

                    pm.BeginTransaction();
                    string billNo = billDao.FindNewBillNo(prefix, billDate);

                    masterRow["BILLNO"] = billNo;
                    //���뵥������
                    billDao.InsertMaster(masterRow);

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

                    if (productState != null)
                    {
                        //����ProductState��
                        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);
                }
            }
        }
Ejemplo n.º 6
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);
                }
            }
        }
Ejemplo n.º 7
0
        public string GenBill(string formulaCode, string scheduleNo, double quantity, String userID, string sysDate, string sysDate8)
        {
            string billNo = null;
            using (PersistentManager pm = new PersistentManager())
            {

                FormulaDao formulaDao = new FormulaDao();
                DataTable formulaTable = formulaDao.FindDetail(formulaCode);

                BillDao billDao = new BillDao();
                DataTable detailTable = billDao.FindDetailEmpty();

                int itemNo = 1;
                foreach (DataRow formulaRow in formulaTable.Rows)
                {
                    DataRow detailRow = detailTable.NewRow();

                    detailRow["ITEMNO"] = itemNo++;
                    detailRow["PRODUCTCODE"] = formulaRow["PRODUCTCODE"];
                    detailRow["QUANTITY"] = quantity * (Convert.ToDouble(formulaRow["QUANTITY"]) / 100.0);
                    detailRow["PACKAGECOUNT"] = 0;
                    detailRow["NCCOUNT"] = 0;
                    detailRow["OTHERCODE"] = formulaRow["OTHERCODE"];
                    detailTable.Rows.Add(detailRow);
                }
                try
                {
                    pm.BeginTransaction();

                    //string warehousePrefix = "C";
                    //billNo = warehousePrefix + sysDate8 + billDao.FindBillNo(sysDate, warehousePrefix).ToString().PadLeft(5, '0');
                    billNo = billDao.FindNewBillNo("C", sysDate);
                    billDao.InsertMaster(billNo, DateTime.Now.ToShortDateString(), "002", scheduleNo, scheduleNo, "", "", "1", "1", userID);
                    billDao.InsertDetail(billNo, detailTable);

                    ScheduleDao scheduleDao = new ScheduleDao();
                    scheduleDao.UpdateBillNo(scheduleNo, billNo);

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
            return billNo;
        }
Ejemplo n.º 8
0
 public void SaveIsLock(string scheduleNo, string isLock)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         ScheduleDao scheduleDao = new ScheduleDao();
         scheduleDao.UpdateIsLock(scheduleNo, isLock);
     }
 }
Ejemplo n.º 9
0
 public DataTable GetStockSchedule()
 {
     using (PersistentManager pm = new PersistentManager())
     {
         ScheduleDao scheduleDao = new ScheduleDao();
         return scheduleDao.FindStockSchedule();
     }
 }
Ejemplo n.º 10
0
 public int GetFormula(string formulaCode)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         ScheduleDao scheduleDao = new ScheduleDao();
         return scheduleDao.Find(formulaCode);
     }
 }
Ejemplo n.º 11
0
 public DataTable GetAvaliableSchedule()
 {
     using (PersistentManager pm = new PersistentManager())
     {
         ScheduleDao scheduleDao = new ScheduleDao();
         return scheduleDao.FindAvailable();
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// ������ҵ
        /// </summary>
        /// <param name="billNo"></param>
        /// <param name="userID"></param>
        /// <param name="date"></param>
        public DataTable TaskBill(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.TaskOutBill(billNo);
                        if (result != "0")
                            throw new Exception("û��Ϊ��Ʒ�ҵ���λ���⡣");
                        ScheduleDao scheduleDao = new ScheduleDao();
                        scheduleDao.UpdateOutSchedule(scheduleNo);
                        ////����billmaster״̬
                        billDao.UpdateMasterState(billNo, "3", "TASKER", userID, "TASKDATE", date);

                        //���ij����ܰ���
                        int packageCount = taskDao.FindTaskCount(billNo);

                        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);
                }
            }
        }
Ejemplo n.º 13
0
        public void SaveAlcoholizeBill(DataRow masterRow, DataTable detailTable, Dictionary<string, DataTable> productState, string userID)
        {
            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.UpdateMaster2(masterRow);

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

                    //����ProductState��
                    if (productState != null)
                    {

                        foreach (string productCode in productState.Keys)
                        {
                            DataTable stateTable = productState[productCode];

                            //stateDao.Delete(billNo, productCode);
                            stateDao.Insert(billNo,
                                        masterRow["SCHEDULENO"].ToString(),
                                        stateTable,
                                        userID);

                        }
                    }
                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
Ejemplo n.º 14
0
        public string RecoverBill(string outBillNo, string sysDate)
        {
            string billNo = "";
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    BillDao billDao = new BillDao();
                    ProductStateDao stateDao = new ProductStateDao();
                    ScheduleDao scheduleDao = new ScheduleDao();

                    pm.BeginTransaction();

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

                    billDao.UpdateMasterBillNo(billNo, outBillNo, sysDate);
                    billDao.UpdateDetailBillNo(billNo, outBillNo);
                    stateDao.UpdateBillNo(billNo, outBillNo);
                    scheduleDao.UpdateIsOut(billNo);
                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
            return billNo;
        }
Ejemplo n.º 15
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);
                }
            }
        }