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); } } }
/// <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); } } }
//�ƿ���ҵ 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); } } }
/// <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); } } }
public DataTable GetMaster(string billType, string prefix) { using (PersistentManager pm = new PersistentManager()) { BillDao billDao = new BillDao(); return billDao.FindMaster(billType, prefix); } }
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; }
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; }