//�ƿ���ҵ 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); } } }
public void TaskBill(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); if (taskType == "2") { BillDao billDao = new BillDao(); string result = billDao.TaskOutBill(billNo); if (result != "0") throw new Exception("û��Ϊ��Ʒ�ҵ���λ���⡣"); } else { TaskDao taskDao = new TaskDao(); //����task��ҵ�� taskDao.Insert(billNo, taskType, "1", target); } palletDao.UpdateTasker(billNo, tasker); pm.Commit(); } catch (Exception e) { pm.Rollback(); throw new Exception(e.Message); } } }
/// <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); } } }