示例#1
0
        public int AddMix(string billNo, DataRow newRow)
        {
            int result = 1;
            using (PersistentManager pm = new PersistentManager())
            {
                ProductStateDao psDao = new ProductStateDao();
                try
                {
                    pm.BeginTransaction();
                    result = psDao.UpdateMix(billNo, newRow["MIXID"].ToString(), Convert.ToDouble(newRow["QUANTITY"]));
                    if (result != 1)
                        throw new Exception("����������Ϊ1");

                    result = psDao.UpdateMixID(billNo, newRow["PRODUCTCODE"].ToString(), newRow["ITEMNO"].ToString(), newRow["MIXID"].ToString());
                    if (result != 1)
                        throw new Exception("����������Ϊ1");

                    pm.Commit();
                }
                catch
                {
                    pm.Rollback();
                }
            }
            return result;
        }
示例#2
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);
                }
            }
        }
示例#3
0
        public void AddBill(DataRow masterRow, string userID, DataTable detailTable)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    pm.BeginTransaction();
                    string billNo = palletDao.FindNewBillNo(masterRow["BILLDATE"].ToString());

                    masterRow["BILLNO"] = billNo;
                    //���뵥������
                    palletDao.InsertMaster(masterRow, userID);

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

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
示例#4
0
文件: BillDal.cs 项目: SaintLoong/PFK
        public void AddBill3(DataRow masterRow, DataTable detailTable)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    BillDao billDao = new BillDao();
                    ProductStateDao stateDao = new ProductStateDao();

                    pm.BeginTransaction();

                    string billNo = billDao.FindNewBillNo("P", masterRow["BILLDATE"].ToString());

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

                    stateDao.Insert(billNo, detailTable);
                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
示例#5
0
文件: TaskDal.cs 项目: SaintLoong/PFK
        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);
                }

            }
        }
示例#6
0
文件: TaskDal.cs 项目: SaintLoong/PFK
        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);
                }

            }
        }
 public void SaveParameter(Dictionary<string, string> parameters)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         try
         {
             SysSystemParameterDao parameterDao = new SysSystemParameterDao();
             pm.BeginTransaction();
             foreach (string key in parameters.Keys)
             {
                 parameterDao.UpdateEntity(key, parameters[key]);
             }
             pm.Commit();
         }
         catch
         {
             pm.Rollback();
         }
     }
 }
示例#8
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);
         }
     }
 }
示例#9
0
        public void DeleteBill(string billNo)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    pm.BeginTransaction();

                    palletDao.DeleteMaster(billNo);
                    palletDao.DeleteDetail(billNo);

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
示例#10
0
文件: BillDal.cs 项目: SaintLoong/PFK
        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);
                }
            }
        }
示例#11
0
文件: UnitDal.cs 项目: SaintLoong/PFK
 public void AddUnit(DataRow row)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         try
         {
             pm.BeginTransaction();
             UnitDao unitDao = new UnitDao();
             if (unitDao.FindUnit(row["UNITCODE"].ToString()) == 0)
                 unitDao.InsertUnit(row);
             else
                 throw new Exception("������λ�Ѵ��ڣ����������롣");
             pm.Commit();
         }
         catch (Exception e)
         {
             pm.Rollback();
             throw new Exception(e.Message);
         }
     }
 }
示例#12
0
文件: UnitDal.cs 项目: SaintLoong/PFK
 public void AddUnitClass(string classCode, string className, string memo)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         try
         {
             pm.BeginTransaction();
             UnitDao unitDao = new UnitDao();
             if (unitDao.FindUnitClass(classCode) == 0)
                 unitDao.InsertUnitClass(classCode, className, memo);
             else
                 throw new Exception("������λ����Ѵ��ڣ����������롣");
             pm.Commit();
         }
         catch (Exception e)
         {
             pm.Rollback();
             throw new Exception(e.Message);
         }
     }
 }
示例#13
0
 public void AddBillType(string billCode, string billName, int billType, int taskLevel, string memo)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         try
         {
             pm.BeginTransaction();
             BillTypeDao billTypeDao = new BillTypeDao();
             if (billTypeDao.Find(billCode) == 0)
                 billTypeDao.Insert(billCode, billName, billType, taskLevel, memo);
             else
                 throw new Exception("��Ʒ�Ѵ��ڣ����������롣");
             pm.Commit();
         }
         catch (Exception e)
         {
             pm.Rollback();
             throw new Exception(e.Message);
         }
     }
 }
示例#14
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);
                }
            }
        }
示例#15
0
文件: BillDal.cs 项目: SaintLoong/PFK
        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);
                }
            }
        }
示例#16
0
文件: BillDal.cs 项目: SaintLoong/PFK
        public int SetOperater(string billNo, string productCode, string operater, string style)
        {
            int result = 0;
            using (PersistentManager pm = new PersistentManager())
            {
                BillDao billDao = new BillDao();
                try
                {
                    pm.BeginTransaction();
                    result = billDao.UpdateOperater(billNo, productCode, operater);

                    if (result == 1)
                    {
                        if (style == "����")
                            billDao.UpdateOperaterByOtherCode(billNo, productCode, operater);
                    }
                    else
                        throw new Exception("ֻ�ܸ���һ����¼");
                    pm.Commit();
                }
                catch
                {
                    pm.Rollback();
                }
            }
            return result;
        }
示例#17
0
文件: BillDal.cs 项目: SaintLoong/PFK
        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);
                }
            }
        }
示例#18
0
        public void SaveBill(string billNo, string operater, DataTable detailTable)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    pm.BeginTransaction();

                    //���뵥������
                    palletDao.UpdateMaster(billNo, operater);

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

                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
示例#19
0
文件: BillDal.cs 项目: SaintLoong/PFK
        /// <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);
                }
            }
        }
示例#20
0
文件: BillDal.cs 项目: SaintLoong/PFK
        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);
                }
            }
        }
示例#21
0
文件: BillDal.cs 项目: SaintLoong/PFK
        //�ƿ���ҵ
        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);
                }
            }
        }
示例#22
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;
        }
示例#23
0
        public void TaskOutBill(DataRow masterRow, string tasker)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    pm.BeginTransaction();

                    string billNo = masterRow["BILLNO"].ToString();
                    DataTable detailTable = palletDao.FindDetail(billNo);

                    string billType = masterRow["BILLTYPE"].ToString();
                    string taskType = billType == "001" ? "1" : "2";
                    string target = billType == "001" ? "" : "3";

                    ProductStateDao stateDao = new ProductStateDao();

                    int itemNo = 1;
                    stateDao.Insert("", billNo, detailTable, ref itemNo);

                    BillDao billDao = new BillDao();
                    billDao.TaskOutBill(billNo);

                    palletDao.UpdateTasker(billNo, tasker);
                    pm.Commit();
                }
                catch (Exception e)
                {
                    pm.Rollback();
                    throw new Exception(e.Message);
                }
            }
        }
示例#24
0
文件: BillDal.cs 项目: SaintLoong/PFK
        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);
                }
            }
        }
示例#25
0
文件: BillDal.cs 项目: SaintLoong/PFK
 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);
         }
     }
 }
示例#26
0
文件: BillDal.cs 项目: SaintLoong/PFK
        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;
        }
示例#27
0
文件: BillDal.cs 项目: SaintLoong/PFK
        /// <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);
                }
            }
        }
        /// <summary>
        /// 清除历史数据,并下载数据。
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="batchNo"></param>
        public void DownloadData(string orderDate, int batchNo,string dataBase)
        {
            try
            {
                DateTime dtOrder = DateTime.Parse(orderDate);
                string historyDate = dtOrder.AddDays(-7).ToShortDateString();
                using (PersistentManager pm = new PersistentManager())
                {
                    BatchDao batchDao = new BatchDao();
                    using (PersistentManager ssPM = new PersistentManager(dataBase))
                    {
                        SalesSystemDao ssDao = new SalesSystemDao();
                        ssDao.SetPersistentManager(ssPM);
                        try
                        {
                            pm.BeginTransaction();

                            //AS_BI_BATCH
                            batchDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 1, 14));

                            //AS_SC_CHANNELUSED
                            ChannelScheduleDao csDao = new ChannelScheduleDao();
                            csDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 2, 14));

                            //AS_SC_LINE
                            LineScheduleDao lsDao = new LineScheduleDao();
                            lsDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 3, 14));

                            //AS_SC_PALLETMASTER ,AS_SC_ORDER
                            OrderScheduleDao osDao = new OrderScheduleDao();
                            osDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 4, 14));

                            //AS_I_ORDERMASTER,AS_I_ORDERDETAIL,
                            OrderDao orderDao = new OrderDao();
                            orderDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 5, 14));

                            //AS_SC_STOCKMIXCHANNEL
                            StockChannelDao scDao = new StockChannelDao();
                            scDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 6, 14));

                            //AS_SC_SUPPLY
                            SupplyDao supplyDao = new SupplyDao();
                            supplyDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 7, 14));

                            //AS_SC_HANDLESUPPLY
                            HandleSupplyDao handleSupplyDao = new HandleSupplyDao();
                            handleSupplyDao.DeleteHistory(historyDate);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 8, 14));

                            ClearSchedule(orderDate, batchNo);

                            //////////////////////////////////////////////////////////////////////////

                            //下载区域表
                            AreaDao areaDao = new AreaDao();
                            DataTable areaTable = ssDao.FindArea();
                            areaDao.SynchronizeArea(areaTable);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 9, 14));

                            //下载配送线路表
                            RouteDao routeDao = new RouteDao();
                            DataTable routeTable = ssDao.FindRoute();
                            routeDao.SynchronizeRoute(routeTable);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 10, 14));

                            //下载客户表
                            CustomerDao customerDao = new CustomerDao();
                            DataTable customerTable = ssDao.FindCustomer(dtOrder);
                            customerDao.SynchronizeCustomer(customerTable);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 11, 14));

                            //下载卷烟表 进行同步
                            CigaretteDao cigaretteDao = new CigaretteDao();
                            DataTable cigaretteTable = ssDao.FindCigarette(dtOrder);
                            cigaretteDao.SynchronizeCigarette(cigaretteTable);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 12, 14));

                            //查询已优化过的线路,以进行排除。
                            string routes = lsDao.FindRoutes(orderDate);

                            //下载订单主表
                            DataTable masterTable = ssDao.FindOrderMaster(dtOrder, batchNo, routes);
                            orderDao.BatchInsertMaster(masterTable);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 13, 14));

                            //下载订单明细
                            DataTable detailTable = ssDao.FindOrderDetail(dtOrder, batchNo, routes);
                            orderDao.BatchInsertDetail(detailTable);
                            if (OnSchedule != null)
                                OnSchedule(this, new ScheduleEventArgs(1, "数据清除与下载", 14, 14));

                            pm.Commit();
                        }
                        catch (Exception e)
                        {
                            pm.Rollback();
                            throw e;
                        }
                    }
                }
            }
            catch (Exception ee)
            {
                if (OnSchedule != null)
                    OnSchedule(this, new ScheduleEventArgs(OptimizeStatus.ERROR, ee.Message));
                throw ee;
            }
        }
示例#29
0
        public int SaveItemNo(string billNo, DataTable table)
        {
            int result = 1;
            using (PersistentManager pm = new PersistentManager())
            {
                ProductStateDao psDao = new ProductStateDao();
                try
                {
                    pm.BeginTransaction();

                    int itemNo = 1;
                    foreach (DataRow row in table.Rows)
                    {
                        result = psDao.UpdateMix(billNo, row["MIXID"].ToString(), itemNo++);
                        if (result != 1)
                            throw new Exception("����������Ϊ1");
                    }

                    pm.Commit();
                }
                catch
                {
                    pm.Rollback();
                }
            }
            return result;
        }
示例#30
0
文件: BillDal.cs 项目: SaintLoong/PFK
        public string GenRequestBill(string billNo, string userID, string sysDate)
        {
            string newNo = null;
            using (PersistentManager pm = new PersistentManager())
            {
                BillDao billDao = new BillDao();
                DataTable masterTable = billDao.FindMaster(billNo);
                DataTable detailTable = billDao.FindDetail(billNo);
                try
                {
                    pm.BeginTransaction();

                    if (masterTable.Rows.Count != 0)
                    {
                        DataRow masterRow = masterTable.Rows[0];

                        newNo = billDao.FindNewBillNo("C", sysDate);

                        billDao.InsertMaster(newNo, sysDate, "002", masterRow["SCHEDULENO"].ToString(), billNo, "", "", "1", "1", userID);
                        billDao.InsertAlchoholizeDetail(newNo, detailTable);
                        //billDao.UpdateOutBillNo(billNo, newNo);
                    }

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