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