Exemplo n.º 1
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="connection">数据连接</param>
 public CStockUpBillBC(SqlConnection connection)
 {
     this.connection = connection;
     this.stockUpBillBB = new CStockUpBillBB(this.connection);
     this.errorDiaryBB = new SErrorDiaryBB(this.connection);
     this.operatDiaryBB = new SOperatDiaryBB(this.connection);
 }
Exemplo n.º 2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public CStockUpBillBC()
 {
     this.selfConn = true;
     this.connection = new SqlConnection(HS.Config.SqlDataObject.GetSqlConnectionString);
     this.connection.Open();
     this.stockUpBillBB = new CStockUpBillBB(this.connection);
     this.errorDiaryBB = new SErrorDiaryBB(this.connection);
     this.operatDiaryBB = new SOperatDiaryBB(this.connection);
 }
Exemplo n.º 3
0
        //*****************************************************************************
        //do it later      do it later      do it later
        //*****************************************************************************
        /// <summary>
        /// 保存备货计划
        /// </summary>
        /// <param name="data">备货单实例</param>
        /// <param name="dtStockUpDetall">备货明细数据源</param>
        /// <param name="issubmit">是否提交</param>
        /// <returns></returns>
        public bool SaveBArrangeBill(CStockUpBillData data, DataTable dtStockUpDetall, bool isSubmit)
        {
            bool ret = false;
            CStockUpDetailBB stockUpDetailBB = new CStockUpDetailBB(connection);
            CStockUpBillBB stockUpBillBB = new CStockUpBillBB(connection);
            SCommBB commBB = new SCommBB(this.connection);
            SqlTransaction trans = null;

            try
            {
                if (this.transaction == null)
                {
                    trans = this.connection.BeginTransaction("TransSave");
                    stockUpDetailBB.Transaction = trans;
                    stockUpBillBB.Transaction = trans;
                    commBB.Transaction = trans;
                }
                else
                {
                    stockUpDetailBB.Transaction = this.transaction;
                    stockUpBillBB.Transaction = this.transaction;
                    commBB.Transaction = this.transaction;
                }

                int mainId = 0;
                CStockUpDetailData stockUpDetailModel = new CStockUpDetailData();
                string strSaleBillNos = "", strAbsEntrys = "", strLineNums = "";
                string[] saleBillNoArray = null, absEntryArray = null, lineNumArray = null;

                if (data.id == 0)
                {
                    #region 新增备货单

                    //新增备货主表数据
                    mainId = stockUpBillBB.AddRecord(data);

                    //新增备货单明细数据
                    foreach (DataRow dr in dtStockUpDetall.Rows)
                    {
                        if (dr["isdel"].ToString() == "0")
                        {
                            stockUpDetailModel = new CStockUpDetailData();

                            stockUpDetailModel.financeBillNo = dr["financeBillNo"].ToString();
                            stockUpDetailModel.financeBillSort = dr["financeBillSort"].ToString();
                            stockUpDetailModel.materialNo = dr["materialNo"].ToString();
                            stockUpDetailModel.num = Convert.ToInt32(dr["num"]);
                            stockUpDetailModel.instantState = "01";
                            stockUpDetailModel.palletIndex = Convert.ToInt32(dr["palletIndex"]);
                            stockUpDetailModel.stockUpBillNo = data.stockUpBillNo;
                            stockUpDetailModel.saleBillNo = dr["saleBillNo"].ToString();
                            stockUpDetailModel.DocEntry = Convert.ToInt32(dr["DocEntry"]);
                            stockUpDetailModel.absEntry = Convert.ToInt32(dr["absEntry"]);//销售提货单ID
                            stockUpDetailModel.lineNum = Convert.ToInt32(dr["lineNum"]);//销售订单行号
                            stockUpDetailModel.GZT = "";//分配工作台

                            stockUpDetailBB.AddRecord(stockUpDetailModel);
                        }
                    }

                    #endregion 新增备货单
                }
                else
                {
                    #region 修改备货单

                    //修改备货主表数据
                    stockUpBillBB.ModifyRecord(data);

                    //维护备货单明细数据
                    foreach (DataRow dr in dtStockUpDetall.Rows)
                    {
                        if (Convert.ToInt32(dr["id"]) > 0 && dr["isdel"].ToString() == "1")//删除方法
                        {
                            stockUpDetailBB.DeleteRecord(Convert.ToInt32(dr["id"]));

                        }
                        else if (Convert.ToInt32(dr["id"]) > 0 && dr["isdel"].ToString() == "0")//修改
                        {
                            stockUpDetailModel = stockUpDetailBB.GetModel(Convert.ToInt32(dr["id"]));

                            stockUpDetailModel.num = Convert.ToInt32(dr["num"]);

                            stockUpDetailBB.ModifyRecord(stockUpDetailModel);

                        }
                        else if (Convert.ToInt32(dr["id"]) == 0 && dr["isdel"].ToString() == "0")//添加
                        {
                            stockUpDetailModel = new CStockUpDetailData();

                            stockUpDetailModel.financeBillNo = dr["financeBillNo"].ToString();
                            stockUpDetailModel.financeBillSort = dr["financeBillSort"].ToString();
                            stockUpDetailModel.materialNo = dr["materialNo"].ToString();
                            stockUpDetailModel.num = Convert.ToInt32(dr["num"]);
                            stockUpDetailModel.instantState = "01";
                            stockUpDetailModel.palletIndex = Convert.ToInt32(dr["palletIndex"]);
                            stockUpDetailModel.stockUpBillNo = data.stockUpBillNo;
                            stockUpDetailModel.saleBillNo = dr["saleBillNo"].ToString();
                            stockUpDetailModel.DocEntry = Convert.ToInt32(dr["DocEntry"]);//销售订单ID
                            stockUpDetailModel.absEntry = Convert.ToInt32(dr["absEntry"]);//销售提货单ID
                            stockUpDetailModel.lineNum = Convert.ToInt32(dr["lineNum"]);//销售订单行号
                            stockUpDetailModel.GZT = "";//分配工作台

                            stockUpDetailBB.AddRecord(stockUpDetailModel);

                        }
                    }

                    #endregion 修改备货单
                }

                //根据提货单ID,更改销售订单状态
                strSaleBillNos = data.saleBillNos;
                strAbsEntrys = data.absEntrys;//提货单ID组合
                strLineNums = data.lineNums;
                saleBillNoArray = strSaleBillNos.Split(',');//销售订单编号数组
                absEntryArray = strAbsEntrys.Split(',');//提货单ID数组
                lineNumArray = strLineNums.Split(',');

                for (int n = 0; n < saleBillNoArray.Length; n++)
                {
                    //更改提货单状态
                    commBB.ExecuteSql("update dbo.CSaleBill set instantState='02',stockupBillNo='" + data.stockUpBillNo
                        + "' where saleBillNo='" + saleBillNoArray[n] + "' and absEntry='" + absEntryArray[n]
                        + "' and lineNum='" + lineNumArray[n] + "'");
                }

                if (this.transaction == null) trans.Commit();
                ret = true;
            }
            catch (Exception ex)
            {
                if (this.transaction == null) trans.Rollback("TransSave");
                throw ex;
            }
            finally
            {
                stockUpDetailBB.Dispose();
                stockUpBillBB.Dispose();
                commBB.Dispose();
            }

            return ret;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 删除提货单
        /// </summary>
        /// <param name="absEntry">提货单ID</param>
        /// <returns></returns>
        public bool DeleteSaleBill(int absEntry)
        {
            bool ret = false;
            SCommBB commBB = new SCommBB(this.connection);
            CStockUpBillBB stockUpBillBB = new CStockUpBillBB(this.connection);
            CPickOutPlanBB pickOutPlanBB = new CPickOutPlanBB(this.connection);
            SqlTransaction trans = null;

            try
            {
                if (this.transaction == null)
                {
                    trans = this.connection.BeginTransaction("TransDelete");
                    commBB.Transaction = trans;
                    stockUpBillBB.Transaction = trans;
                    pickOutPlanBB.Transaction = trans;
                }
                else
                {
                    commBB.Transaction = this.transaction;
                    stockUpBillBB.Transaction = this.transaction;
                    pickOutPlanBB.Transaction = this.transaction;
                }

                string strStockUpBillNo = "";
                DataTable dtStockUpBill = new DataTable();
                DataTable dtPickOutPlan = new DataTable();

                //删除销售订单
                commBB.ExecuteSql("delete from dbo.CSaleBill where absEntry=" + absEntry.ToString());

                //删除销售订单明细
                commBB.ExecuteSql("delete from dbo.CSaleDetail where absEntry=" + absEntry.ToString());

                //删除销售订单临时表
                //commBB.ExecuteSql("delete from dbo.CSaleBill_HangHao where absEntry=" + absEntry.ToString());

                //删除销售订单明细临时表
                //commBB.ExecuteSql("delete from dbo.CSaleDetail_HangHao where absEntry=" + absEntry.ToString());

                //获取备货单编号
                //dtStockUpBill = stockUpBillBB.GetList("absEntrys='" + absEntry.ToString() + "'").Tables[0];
                //if (dtStockUpBill.Rows.Count > 0)
                //{
                //    strStockUpBillNo = dtStockUpBill.Rows[0]["stockUpBillNo"].ToString();//备货单编号

                //    dtPickOutPlan = pickOutPlanBB.GetList("stockUpBillNo='" + strStockUpBillNo + "'").Tables[0];
                //    foreach (DataRow row in dtPickOutPlan.Rows)
                //    {
                //        commBB.ExecuteSql("update dbo.UStock set isOutStocking=0 where wareLocatorNo='" + row["wareLocatorNo"].ToString() + "'");
                //    }

                //    //删除备货单
                //    commBB.ExecuteSql("delete from dbo.CStockUpBill where stockUpBillNo='" + strStockUpBillNo + "'");

                //    //删除备货单明细
                //    commBB.ExecuteSql("delete from dbo.CStockUpDetail where stockUpBillNo='" + strStockUpBillNo + "'");

                //    //删除拣货计划
                //    commBB.ExecuteSql("delete from dbo.CPickOutPlan where stockUpBillNo='" + strStockUpBillNo + "'");
                //}

                if (this.transaction == null) trans.Commit();
                ret = true;
            }
            catch (Exception ex)
            {
                if (this.transaction == null) trans.Rollback("TransDelete");
                throw ex;
            }
            finally
            {
                commBB.Dispose();
                stockUpBillBB.Dispose();
                pickOutPlanBB.Dispose();
            }

            return ret;
        }