Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
 public int AddProductState(string billNo, string scheduleNo, int itemNo, string productCode, string quantity, string userID, string mixID)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         ProductStateDao psDao = new ProductStateDao();
         return psDao.Insert(billNo, scheduleNo, itemNo, productCode, quantity, userID, mixID);
     }
 }
Exemplo n.º 3
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);
                }
            }
        }
Exemplo n.º 4
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);
                }
            }
        }
Exemplo n.º 5
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);
                }
            }
        }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 7
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);
                }
            }
        }
Exemplo n.º 8
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);
                }
            }
        }
Exemplo n.º 9
0
        public string GenBillFromTask(string billNo, string billType, string userID, string sysDate)
        {
            string newNo = null;
            using (PersistentManager pm = new PersistentManager())
            {
                BillDao billDao = new BillDao();
                ProductStateDao stateDao = new ProductStateDao();

                try
                {
                    pm.BeginTransaction();
                    DataTable stateTable = stateDao.FindBillDetail(billNo);

                    DataTable masterTable = billDao.FindMaster(billNo);

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

                        string target = "";
                        if (billType == "002")//���ɵĵ���Ϊ���ⵥ
                            target = "3";

                        newNo = billDao.FindNewBillNo("P", sysDate);
                        billDao.InsertMaster(newNo, sysDate, billType, masterRow["SCHEDULENO"].ToString(),
                                         masterRow["BILLNO"].ToString(), masterRow["WAREHOUSECODE"].ToString(),
                                         target, "0", "1", userID);
                        int itemNo = 1;
                        foreach (DataRow stateRow in stateTable.Rows)
                        {
                            if (stateRow["REALQUANTITY"].ToString().Trim().Length != 0)
                            {
                                stateRow["REALQUANTITY"] = 0;
                                stateDao.Insert(newNo, billType, itemNo++, stateRow);
                            }
                        }

                        if (itemNo == 1)
                            throw new Exception("û���̰��ѳ��⣬����Ҫ�����˿ⵥ");

                        DataTable detailTable = stateDao.Find(newNo);
                        billDao.InsertDetail(newNo, detailTable);
                    }

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