예제 #1
0
        /// <summary>
        /// ѡ�����ڴ�Ӫ��ϵͳ���س��ⵥ��
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public bool GetOutBill(string startDate, string endDate, string EmployeeCode, out string errorInfo, string wareCode, string billType)
        {
            bool tag = true;
            Employee = EmployeeCode;
            errorInfo = string.Empty;
            using (PersistentManager dbpm = new PersistentManager())
            {
                DownOutBillDao dao = new DownOutBillDao();
                DataTable emply = dao.FindEmployee(EmployeeCode);
                DataTable outBillNoTable = this.GetOutBillNo(startDate);
                string outBillList = UtinString.MakeString(outBillNoTable, "bill_no");
                outBillList = string.Format("ORDER_DATE ='{0}' AND ORDER_ID NOT IN({1}) ", startDate, outBillList);
                DataTable masterdt = this.GetOutBillMaster(outBillList);

                string outDetailList = UtinString.MakeString(masterdt, "ORDER_ID");
                outDetailList = "ORDER_ID IN(" + outDetailList + ")";
                DataTable detaildt = this.GetOutBillDetail(outDetailList);

                if (masterdt.Rows.Count > 0 && detaildt.Rows.Count > 0)
                {
                    try
                    {
                        string billno = this.GetNewBillNo();
                        DataSet middleds = this.MiddleTable(masterdt,billno);
                        //DataSet masterds = this.OutBillMaster(masterdt, emply.Rows[0]["employee_id"].ToString(), wareCode, billType);
                        DataSet detailds = this.OutBillDetail(detaildt, emply.Rows[0]["employee_id"].ToString(), wareCode, billType, startDate,billno);
                        this.Insert(detailds, middleds);
                    }
                    catch (Exception e)
                    {
                        errorInfo += e.Message;
                        tag = false;
                    }
                }
                else
                {
                    errorInfo = "û�п����صij������ݣ�";
                    tag = false;
                }
            }
            return tag;
        }
예제 #2
0
 /// <summary>
 /// ���ɳ��ⵥ��
 /// </summary>
 /// <returns></returns>
 public string GetNewBillNo()
 {
     using (PersistentManager persistentManager = new PersistentManager())
     {
         DownOutBillDao dao = new DownOutBillDao();
         DataSet ds = dao.FindOutBillNo(System.DateTime.Now.ToString("yyMMdd"));
         if (ds.Tables[0].Rows.Count == 0)
         {
             return System.DateTime.Now.ToString("yyMMdd") + "0001" + "OU";
         }
         else
         {
             int i = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString().Substring(6, 4));
             i++;
             string newcode = i.ToString();
             for (int j = 0; j < 4 - i.ToString().Length; j++)
             {
                 newcode = "0" + newcode;
             }
             return System.DateTime.Now.ToString("yyMMdd") + newcode + "OU";
         }
     }
 }
예제 #3
0
 /// <summary>
 /// ����ʱ���ѯ�ֿ���ⵥ�ݺ�
 /// </summary>
 /// <returns></returns>
 public DataTable GetOutBillNo(string orderDate)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         DownOutBillDao dao = new DownOutBillDao();
         return dao.GetOutBillNo(orderDate);
     }
 }
예제 #4
0
 /// <summary>
 /// �����ص�������ӵ����ݿ⡣
 /// </summary>
 /// <param name="masterds"></param>
 /// <param name="detailds"></param>
 public void Insert(DataSet detailds,DataSet middleds)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         DownOutBillDao dao = new DownOutBillDao();
         try
         {
             if (middleds.Tables["WMS_MIDDLE_OUT_BILLDETAIL"].Rows.Count > 0)
             {
                 dao.InsertMiddle(middleds);
             }
             if (detailds.Tables["WMS_OUT_BILLMASTER"].Rows.Count > 0)
             {
                 dao.InsertOutBillMaster(detailds);
             }
             if (detailds.Tables["WMS_OUT_BILLDETAILA"].Rows.Count > 0)
             {
                 dao.InsertOutBillDetail(detailds);
             }
         }
         catch (Exception exp)
         {
             throw new Exception(exp.Message);
         }
     }
 }
예제 #5
0
 /// <summary>
 /// ���س���������Ϣ ����
 /// </summary>
 /// <returns></returns>
 public DataTable GetOutBillMasters(string billno)
 {
     using (PersistentManager dbpm = new PersistentManager("YXConnection"))
     {
         DownOutBillDao dao = new DownOutBillDao();
         dao.SetPersistentManager(dbpm);
         return dao.GetOutBillMasters(billno);
     }
 }