Beispiel #1
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);
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// 手动下载
        /// </summary>
        /// <param name="billno"></param>
        /// <returns></returns>
        public bool GetOutBillManual(string billno, string EmployeeCode)
        {
            bool tag = true;

            Employee = EmployeeCode;
            using (PersistentManager dbPm = new PersistentManager())
            {
                DownOutBillDao dao = new DownOutBillDao();
                dao.SetPersistentManager(dbPm);
                billno = "ORDER_ID IN(" + billno + ")";
                DataTable masterdt = this.GetOutBillMaster(billno);
                DataTable detaildt = this.GetOutBillDetail(billno);
                if (masterdt.Rows.Count > 0 && detaildt.Rows.Count > 0)
                {
                    DataSet detailds = this.OutBillDetail(detaildt);
                    DataSet masterds = this.OutBillMaster(masterdt);
                    this.Insert(masterds, detailds);
                }
                else
                {
                    tag = false;
                }
            }
            return(tag);
        }
Beispiel #3
0
        /// <summary>
        /// 自动下载
        /// </summary>
        /// <returns></returns>
        public bool DownOutBillInfoAuto(string EmployeeCode)
        {
            bool tag = true;

            Employee = EmployeeCode;
            using (PersistentManager dbpm = new PersistentManager("YXConnection"))
            {
                DownOutBillDao dao = new DownOutBillDao();
                dao.SetPersistentManager(dbpm);
                DataTable outBillNoTable = this.GetOutBillNo();
                string    billnolist     = UtinString.StringMake(outBillNoTable, "BILLNO");
                billnolist = UtinString.StringMake(billnolist);
                billnolist = "ORDER_ID NOT IN(" + billnolist + ")";
                DataTable masterdt = this.GetOutBillMaster(billnolist);
                DataTable detaildt = this.GetOutBillDetail(billnolist);
                if (masterdt.Rows.Count > 0 && detaildt.Rows.Count > 0)
                {
                    DataSet detailds = this.OutBillDetail(detaildt);
                    DataSet masterds = this.OutBillMaster(masterdt);
                    this.Insert(masterds, detailds);
                }
                else
                {
                    tag = false;
                }
            }
            return(tag);
        }
Beispiel #4
0
        /// <summary>
        /// 选择日期从营销系统下载出库单据
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public bool GetOutBill(string startDate, string endDate, string EmployeeCode)
        {
            bool tag = true;

            Employee = EmployeeCode;
            using (PersistentManager dbpm = new PersistentManager("YXConnection"))
            {
                DownOutBillDao dao = new DownOutBillDao();
                dao.SetPersistentManager(dbpm);

                DataTable outBillNoTable = this.GetOutBillNo();
                string    outBillList    = UtinString.StringMake(outBillNoTable, "BILLNO");
                outBillList = UtinString.StringMake(outBillList);
                outBillList = string.Format("ORDER_DATE >='{0}' AND ORDER_DATE <='{1}' AND ORDER_ID NOT IN({2})", startDate, endDate, outBillList);
                DataTable masterdt = this.GetOutBillMaster(outBillList);

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

                if (masterdt.Rows.Count > 0 && detaildt.Rows.Count > 0)
                {
                    DataSet masterds = this.OutBillMaster(masterdt);
                    DataSet detailds = this.OutBillDetail(detaildt);
                    this.Insert(masterds, detailds);
                }
                else
                {
                    tag = false;
                }
            }
            return(tag);
        }
Beispiel #5
0
 /// <summary>
 /// 根据时间查询仓库出库单据号
 /// </summary>
 /// <returns></returns>
 public DataTable GetOutBillNo(string orderDate)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         DownOutBillDao dao = new DownOutBillDao();
         return(dao.GetOutBillNo(orderDate));
     }
 }
Beispiel #6
0
 /// <summary>
 /// 查询营销系统出库明细表数据
 /// </summary>
 /// <param name="pageIndex"></param>
 /// <param name="pageSize"></param>
 /// <param name="inBillNo"></param>
 /// <returns></returns>
 public DataTable GetOutBillDetail(int pageIndex, int pageSize, string inBillNo)
 {
     using (PersistentManager dbpm = new PersistentManager("YXConnection"))
     {
         DownOutBillDao dao = new DownOutBillDao();
         dao.SetPersistentManager(dbpm);
         return(dao.GetOutBillDetailInfo(inBillNo));
     }
 }
Beispiel #7
0
 /// <summary>
 /// 合单添加数据
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="table"></param>
 public void InsertOutBillMaster(string tableName, DataTable table)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         DownOutBillDao dao = new DownOutBillDao();
         dao.SetPersistentManager(pm);
         dao.InsertTable(tableName, table);
     }
 }
Beispiel #8
0
 /// <summary>
 /// 查询一个空表
 /// </summary>
 /// <param name="outTable"></param>
 /// <returns></returns>
 public DataTable QueryNullTable(string outTable)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         DownOutBillDao dao = new DownOutBillDao();
         dao.SetPersistentManager(pm);
         return(dao.QueryOutMaterTable(outTable));
     }
 }
Beispiel #9
0
 /// <summary>
 /// 根据单据号查询总数量和总金额
 /// </summary>
 /// <param name="datetime"></param>
 /// <returns></returns>
 public DataTable GetCountQuantity(string billNolist)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         DownOutBillDao dao = new DownOutBillDao();
         dao.SetPersistentManager(pm);
         return(dao.GetCountQuantity(billNolist));
     }
 }
Beispiel #10
0
 /// <summary>
 /// 根据单据号查询合单明细数据
 /// </summary>
 /// <param name="date"></param>
 /// <returns></returns>
 public DataTable GetDetailByBillNo(string billNoList)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         DownOutBillDao dao = new DownOutBillDao();
         dao.SetPersistentManager(pm);
         return(dao.GetOutDetailByBillNo(billNoList));
     }
 }
Beispiel #11
0
 /// <summary>
 /// 下载出库明细表信息
 /// </summary>
 /// <returns></returns>
 public DataTable GetOutBillDetail(string billno)
 {
     using (PersistentManager dbpm = new PersistentManager("YXConnection"))
     {
         DownOutBillDao dao = new DownOutBillDao();
         dao.SetPersistentManager(dbpm);
         return(dao.GetOutBillDetail(billno));
     }
 }
Beispiel #12
0
 /// <summary>
 /// 根据单号查询合单后的明细数据
 /// </summary>
 /// <param name="billno"></param>
 /// <returns></returns>
 public DataTable QueryOutDetailTable(string billno)
 {
     using (PersistentManager pm = new PersistentManager())
     {
         DownOutBillDao dao = new DownOutBillDao();
         dao.SetPersistentManager(pm);
         return(dao.QueryOutDetailTable(billno));
     }
 }
Beispiel #13
0
 /// <summary>
 /// 查询数字仓储7天之内的单据号
 /// </summary>
 /// <returns></returns>
 public DataTable GetOutBillNo()
 {
     using (PersistentManager pm = new PersistentManager())
     {
         DownOutBillDao dao = new DownOutBillDao();
         dao.SetPersistentManager(pm);
         return(dao.GetOutBillNo());
     }
 }
Beispiel #14
0
 /// <summary>
 /// 清除一个星期以前合单后没有作业的数据
 /// </summary>
 public void DeleteOutBillInfo()
 {
     using (PersistentManager pm = new PersistentManager())
     {
         DownOutBillDao dao = new DownOutBillDao();
         dao.SetPersistentManager(pm);
         dao.DeleteOutBillInfo();
     }
 }
Beispiel #15
0
        public DataTable GetOrderGather(string orderDate, string batchNo)
        {
            DataTable ordergather = new DataTable();

            using (PersistentManager pm = new PersistentManager("ServerConnection"))
            {
                DownOutBillDao dao = new DownOutBillDao();
                dao.SetPersistentManager(pm);
                ordergather = dao.GetOrderGather(orderDate, batchNo);
            }
            return(ordergather);
        }
Beispiel #16
0
        public DataTable GetBatchNo()
        {
            DataTable batchnodt = new DataTable();

            using (PersistentManager pm = new PersistentManager("ServerConnection"))
            {
                DownOutBillDao dao = new DownOutBillDao();
                dao.SetPersistentManager(pm);
                batchnodt = dao.GetBatchNo();
            }
            return(batchnodt);
        }
Beispiel #17
0
        public bool GetOrderGather(string billno, string billdate, string batchno, string billtype, string warehouse, decimal quantity)
        {
            bool   tag  = true;
            string memo = "此主单由分拣系统日期为" + billdate + ",批次号为" + batchno + "合成!";

            using (PersistentManager pm = new PersistentManager())
            {
                DownOutBillDao dao = new DownOutBillDao();
                dao.SetPersistentManager(pm);
                dao.InsertOutBillMaster(billno, billdate, batchno, billtype, warehouse, memo, quantity);
            }
            return(tag);
        }
Beispiel #18
0
        /// <summary>
        /// 查询营销系统出库主表数据
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public DataTable GetOutBillMaster(int pageIndex, int pageSize, string startDate, string endDate)
        {
            using (PersistentManager dbpm = new PersistentManager("YXConnection"))
            {
                DownOutBillDao dao = new DownOutBillDao();
                dao.SetPersistentManager(dbpm);
                DataTable outBillNoTable = this.GetOutBillNo();
                string    billnolist     = UtinString.StringMake(outBillNoTable, "BILLNO");
                billnolist = UtinString.StringMake(billnolist);
                billnolist = "ORDER_ID NOT IN(" + billnolist + ")";

                DataTable unitedt   = this.UniteBillNo();
                string    unitelist = UtinString.StringMake(unitedt, "DOWNBILLINO");
                unitelist = UtinString.StringMake(unitelist);
                return(dao.GetOutBillMaster(billnolist, unitelist));
            }
        }
Beispiel #19
0
        public bool GetOrderGather(string billno, string billdate, string batchno)
        {
            bool tag = true;

            using (PersistentManager pm = new PersistentManager())
            {
                DownOutBillDao dao = new DownOutBillDao();
                dao.SetPersistentManager(pm);
                DataTable detaildt = this.GetOrderGather(billdate, batchno);
                DataRow[] dr       = detaildt.Select("ORDERDATE='" + billdate + "' and BATCHNO ='" + batchno + "'");
                DataSet   detailds = this.GetOrderGather(dr, billno);
                if (detailds.Tables["WMS_OUT_BILLDETAIL"].Rows.Count > 0)
                {
                    dao.InsertOutBillDetail(detailds);
                }
            }
            return(tag);
        }
Beispiel #20
0
        /// <summary>
        /// 选择日期从营销系统下载出库单据 创联
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public bool GetOutBills(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.GetOutBillMasters(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 = "没有可下载的出库数据!";
                    tag       = false;
                }
            }
            return(tag);
        }
Beispiel #21
0
        /// <summary>
        /// 把下载的数据添加到数据库。
        /// </summary>
        /// <param name="masterds"></param>
        /// <param name="detailds"></param>
        public void Insert(DataSet masterds, DataSet detailds)
        {
            using (PersistentManager pm = new PersistentManager())
            {
                DownOutBillDao dao = new DownOutBillDao();
                dao.SetPersistentManager(pm);
                //pm.BeginTransaction();
                try
                {
                    if (masterds.Tables["WMS_OUT_BILLMASTER"].Rows.Count > 0)
                    {
                        dao.InsertOutBillMaster(masterds);
                    }

                    if (masterds.Tables["DWV_IWMS_OUT_STORE_BILL"].Rows.Count > 0)
                    {
                        dao.InsertOutStoreBill(masterds);
                    }

                    if (detailds.Tables["WMS_OUT_BILLDETAILA"].Rows.Count > 0)
                    {
                        dao.InsertOutBillDetail(detailds);
                    }

                    if (detailds.Tables["DWV_IWMS_OUT_STORE_BILL_DETAIL"].Rows.Count > 0)
                    {
                        dao.InsertOutStoreBillDetail(detailds);
                    }
                    //pm.Commit();
                }

                catch (Exception exp)
                {
                    //pm.Rollback();
                    throw new Exception(exp.Message);
                }
            }
        }
Beispiel #22
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");
         }
     }
 }
Beispiel #23
0
 /// <summary>
 /// 为从分拣系统下载单据生成编号
 /// </summary>
 /// <returns></returns>
 public string GetStoreBillDetailId()
 {
     using (PersistentManager pm = new PersistentManager())
     {
         DownOutBillDao dao = new DownOutBillDao();
         dao.SetPersistentManager(pm);
         DataTable dt = dao.GetOutStoreDetailId();
         if (dt.Rows.Count == 0)
         {
             return(DateTime.Now.ToString("yyyyMMdd") + "0001");
         }
         else
         {
             int i = Convert.ToInt32(dt.Rows[0][0].ToString().Substring(8, 4));
             i++;
             string newcode = i.ToString();
             for (int j = 0; j < 4 - i.ToString().Length; j++)
             {
                 newcode = "0" + newcode;
             }
             return(DateTime.Now.ToString("yyyyMMdd") + newcode);
         }
     }
 }