Beispiel #1
0
        /// <summary>
        /// 保存(传入事务处理)
        /// </summary>
        /// <param name="p_Entity"></param>
        /// <param name="p_BE"></param>
        /// <param name="sqlTrans"></param>
        public void RSave(CheckOperation p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = "DELETE FROM Finance_CheckOperationDts WHERE MainID=" + p_Entity.ID.ToString();
                sql += " AND ID NOT IN" + string.Format("({0})", GetIDExist(p_BE));
                sqlTrans.ExecuteNonQuery(sql);                                                                                     //删除原单据里应该删除的明细数据,即数据库里有但是UI里已经删除的数据
                sql = "SELECT ISNULL(MAX(Seq),0)+1 As MSEQ FROM Finance_CheckOperationDts WHERE MainID=" + p_Entity.ID.ToString(); ////找到最大的Seq    将获得最大Seq的语句放到循环外更高效(多人操作时会有问题吗?)
                int MSEQ = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0][0].ToString());
                for (int i = 0; i < p_BE.Length; i++)
                {
                    CheckOperationDts entitydts = (CheckOperationDts)p_BE[i];
                    if (entitydts.ID != 0)//ID不为0说明数据库中已经存在
                    {
                        this.RUpdate(entitydts, sqlTrans);
                    }
                    else
                    {
                        entitydts.Seq    = MSEQ;
                        entitydts.MainID = p_Entity.ID;
                        this.RAdd(entitydts, sqlTrans);

                        MSEQ++;//最大值加1
                    }
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                CheckOperationDts MasterEntity = (CheckOperationDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Finance_CheckOperationDts WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID);
                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(Sql);
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(Sql);
                }

                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 获得数据库里没有被删除的ID(即数据库里有而且UI里也没有删除的数据)
        /// </summary>
        /// <param name="p_BE"></param>
        /// <returns></returns>
        private string GetIDExist(BaseEntity[] p_BE)
        {
            string outstr = "0";

            for (int i = 0; i < p_BE.Length; i++)
            {
                CheckOperationDts entitydts = (CheckOperationDts)p_BE[i];
                if (entitydts.ID != 0)
                {
                    outstr += "," + entitydts.ID;
                }
            }
            return(outstr);
        }
Beispiel #4
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="p_BE">要删除的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         CheckOperationDts    entity  = (CheckOperationDts)p_BE;
         CheckOperationDtsCtl control = new CheckOperationDtsCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Beispiel #5
0
 /// <summary>
 /// 新增(传入事务处理)
 /// </summary>
 /// <param name="p_BE">要新增的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         CheckOperationDts    entity  = (CheckOperationDts)p_BE;
         CheckOperationDtsCtl control = new CheckOperationDtsCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Finance_CheckOperationDts, sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private CheckOperationDts[] EntityDtsGet()
        {
            int index = GetDataCompleteNum();

            CheckOperationDts[] entitydts = new CheckOperationDts[index];
            index = 0;
            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (CheckDataCompleteDts(i))
                {
                    entitydts[index]        = new CheckOperationDts();
                    entitydts[index].MainID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "MainID"));
                    if (entitydts[index].MainID == HTDataID && HTDataID != 0)//已存在表示修改
                    {
                        entitydts[index].ID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "ID"));
                        entitydts[index].SelectByID();
                    }
                    else//新增
                    {
                        entitydts[index].MainID = HTDataID;
                        entitydts[index].Seq    = i + 1;
                    }

                    entitydts[index].DLOADID           = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "DLOADID"));
                    entitydts[index].DLOADSEQ          = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "DLOADSEQ"));
                    entitydts[index].DLOADNO           = SysConvert.ToString(gridView1.GetRowCellValue(i, "DLOADNO"));
                    entitydts[index].DLOADDtsID        = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "DLOADDtsID"));
                    entitydts[index].DCheckQty         = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "DCheckQty"));
                    entitydts[index].DCheckSinglePrice = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "DCheckSinglePrice"));
                    entitydts[index].DCheckAmount      = entitydts[index].DCheckQty * entitydts[index].DCheckSinglePrice;
                    entitydts[index].Remark            = SysConvert.ToString(gridView1.GetRowCellValue(i, "Remark"));


                    index++;
                }
            }
            return(entitydts);
        }
Beispiel #7
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     CheckOperationDts entity = (CheckOperationDts)p_BE;
 }
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private CheckOperationDts[] EntityDtsGet()
        {
            int index = GetDataCompleteNum();

            CheckOperationDts[] entitydts = new CheckOperationDts[index];
            index = 0;
            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (CheckDataCompleteDts(i))
                {
                    entitydts[index]        = new CheckOperationDts();
                    entitydts[index].MainID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "MainID"));
                    if (entitydts[index].MainID == HTDataID && HTDataID != 0)//已存在表示修改
                    {
                        entitydts[index].ID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "ID"));
                        entitydts[index].SelectByID();
                    }
                    else//新增
                    {
                        entitydts[index].MainID = HTDataID;
                        entitydts[index].Seq    = i + 1;
                    }

                    entitydts[index].DLOADID    = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "DLOADID"));
                    entitydts[index].DLOADSEQ   = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "DLOADSEQ"));
                    entitydts[index].DLOADNO    = SysConvert.ToString(gridView1.GetRowCellValue(i, "DLOADNO"));
                    entitydts[index].DLOADDtsID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "DLOADDtsID"));
                    entitydts[index].DCheckQty  = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "DCheckQty"));

                    entitydts[index].TZAmount = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "TZAmount"));

                    entitydts[index].DCheckSinglePrice = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "DCheckSinglePrice"));
                    entitydts[index].DCheckDYPrice     = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "DCheckDYPrice"));
                    if (entitydts[index].DCheckSinglePrice != 0)//对账单价不为0;对账金额=对账数量*对账单价+对账打样费+调整金额
                    {
                        entitydts[index].DCheckAmount = entitydts[index].DCheckQty * entitydts[index].DCheckSinglePrice + entitydts[index].DCheckDYPrice + entitydts[index].TZAmount;
                    }
                    else//对账单价为0;//对账单价不为0,对账金额=对账数量*对账单价+对账打样费+调整金额
                    {
                        entitydts[index].DCheckAmount = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "DCheckAmount")) + entitydts[index].DCheckDYPrice + entitydts[index].TZAmount;
                    }
                    entitydts[index].Remark = SysConvert.ToString(gridView1.GetRowCellValue(i, "DtsRemark"));

                    entitydts[index].ItemCode  = SysConvert.ToString(gridView1.GetRowCellValue(i, "ItemCode"));
                    entitydts[index].GoodsCode = SysConvert.ToString(gridView1.GetRowCellValue(i, "GoodsCode"));
                    entitydts[index].ColorNum  = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorNum"));
                    entitydts[index].ColorName = SysConvert.ToString(gridView1.GetRowCellValue(i, "ColorName"));

                    entitydts[index].QSID = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "QSID"));//缺损ID
                    entitydts[index].Unit = SysConvert.ToString(gridView1.GetRowCellValue(i, "Unit"));

                    //entitydts[index]. = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "QSID"));//缺损ID

                    entitydts[index].FAmount1 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "FAmount1")); //小缸费
                    entitydts[index].FAmount2 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "FAmount2")); //打样费
                    entitydts[index].FAmount3 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "FAmount3")); //制版费
                    entitydts[index].FAmount4 = SysConvert.ToDecimal(gridView1.GetRowCellValue(i, "FAmount4")); //上机费



                    index++;
                }
            }
            return(entitydts);
        }
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                CheckOperationDts MasterEntity = (CheckOperationDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Finance_CheckOperationDts(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("MainID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MainID) + ",");
                MasterField.Append("Seq" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Seq) + ",");
                MasterField.Append("DLOADID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DLOADID) + ",");
                MasterField.Append("DLOADSEQ" + ",");
                if (MasterEntity.DLOADSEQ != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.DLOADSEQ) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("DLOADNO" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DLOADNO) + ",");
                MasterField.Append("DLOADDtsID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DLOADDtsID) + ",");
                MasterField.Append("DCheckQty" + ",");
                if (MasterEntity.DCheckQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.DCheckQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("DCheckSinglePrice" + ",");
                if (MasterEntity.DCheckSinglePrice != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.DCheckSinglePrice) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("DCheckAmount" + ",");
                if (MasterEntity.DCheckAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.DCheckAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                MasterField.Append("InvoiceFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.InvoiceFlag) + ",");
                MasterField.Append("ItemCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemCode) + ",");
                MasterField.Append("GoodsCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.GoodsCode) + ",");
                MasterField.Append("ColorNum" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ColorNum) + ",");
                MasterField.Append("ColorName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ColorName) + ",");
                MasterField.Append("DCheckDYPrice" + ",");
                if (MasterEntity.DCheckDYPrice != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.DCheckDYPrice) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("QSID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.QSID) + ",");
                MasterField.Append("Unit" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Unit) + ",");
                MasterField.Append("LoadFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.LoadFlag) + ",");
                MasterField.Append("YuLiaoQty" + ",");
                if (MasterEntity.YuLiaoQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.YuLiaoQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("TZAmount" + ",");
                if (MasterEntity.TZAmount != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.TZAmount) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("FAmount1" + ",");
                if (MasterEntity.FAmount1 != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.FAmount1) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("FAmount2" + ",");
                if (MasterEntity.FAmount2 != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.FAmount2) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("FAmount3" + ",");
                if (MasterEntity.FAmount3 != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.FAmount3) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("FAmount4" + ")");
                if (MasterEntity.FAmount4 != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.FAmount4) + ")");
                }
                else
                {
                    MasterValue.Append("null)");
                }



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E);
            }
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                CheckOperationDts MasterEntity = (CheckOperationDts)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Finance_CheckOperationDts SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ",");
                UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ",");
                UpdateBuilder.Append(" DLOADID=" + SysString.ToDBString(MasterEntity.DLOADID) + ",");

                if (MasterEntity.DLOADSEQ != 0)
                {
                    UpdateBuilder.Append(" DLOADSEQ=" + SysString.ToDBString(MasterEntity.DLOADSEQ) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" DLOADSEQ=null,");
                }

                UpdateBuilder.Append(" DLOADNO=" + SysString.ToDBString(MasterEntity.DLOADNO) + ",");
                UpdateBuilder.Append(" DLOADDtsID=" + SysString.ToDBString(MasterEntity.DLOADDtsID) + ",");

                if (MasterEntity.DCheckQty != 0)
                {
                    UpdateBuilder.Append(" DCheckQty=" + SysString.ToDBString(MasterEntity.DCheckQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" DCheckQty=null,");
                }


                if (MasterEntity.DCheckSinglePrice != 0)
                {
                    UpdateBuilder.Append(" DCheckSinglePrice=" + SysString.ToDBString(MasterEntity.DCheckSinglePrice) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" DCheckSinglePrice=null,");
                }


                if (MasterEntity.DCheckAmount != 0)
                {
                    UpdateBuilder.Append(" DCheckAmount=" + SysString.ToDBString(MasterEntity.DCheckAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" DCheckAmount=null,");
                }

                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");
                UpdateBuilder.Append(" InvoiceFlag=" + SysString.ToDBString(MasterEntity.InvoiceFlag) + ",");
                UpdateBuilder.Append(" ItemCode=" + SysString.ToDBString(MasterEntity.ItemCode) + ",");
                UpdateBuilder.Append(" GoodsCode=" + SysString.ToDBString(MasterEntity.GoodsCode) + ",");
                UpdateBuilder.Append(" ColorNum=" + SysString.ToDBString(MasterEntity.ColorNum) + ",");
                UpdateBuilder.Append(" ColorName=" + SysString.ToDBString(MasterEntity.ColorName) + ",");

                if (MasterEntity.DCheckDYPrice != 0)
                {
                    UpdateBuilder.Append(" DCheckDYPrice=" + SysString.ToDBString(MasterEntity.DCheckDYPrice) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" DCheckDYPrice=null,");
                }

                UpdateBuilder.Append(" QSID=" + SysString.ToDBString(MasterEntity.QSID) + ",");
                UpdateBuilder.Append(" Unit=" + SysString.ToDBString(MasterEntity.Unit) + ",");
                UpdateBuilder.Append(" LoadFlag=" + SysString.ToDBString(MasterEntity.LoadFlag) + ",");

                if (MasterEntity.YuLiaoQty != 0)
                {
                    UpdateBuilder.Append(" YuLiaoQty=" + SysString.ToDBString(MasterEntity.YuLiaoQty) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" YuLiaoQty=null,");
                }


                if (MasterEntity.TZAmount != 0)
                {
                    UpdateBuilder.Append(" TZAmount=" + SysString.ToDBString(MasterEntity.TZAmount) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" TZAmount=null,");
                }


                if (MasterEntity.FAmount1 != 0)
                {
                    UpdateBuilder.Append(" FAmount1=" + SysString.ToDBString(MasterEntity.FAmount1) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" FAmount1=null,");
                }


                if (MasterEntity.FAmount2 != 0)
                {
                    UpdateBuilder.Append(" FAmount2=" + SysString.ToDBString(MasterEntity.FAmount2) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" FAmount2=null,");
                }


                if (MasterEntity.FAmount3 != 0)
                {
                    UpdateBuilder.Append(" FAmount3=" + SysString.ToDBString(MasterEntity.FAmount3) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" FAmount3=null,");
                }


                if (MasterEntity.FAmount4 != 0)
                {
                    UpdateBuilder.Append(" FAmount4=" + SysString.ToDBString(MasterEntity.FAmount4));
                }
                else
                {
                    UpdateBuilder.Append(" FAmount4=null");
                }


                UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID));



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E);
            }
        }
Beispiel #11
0
        /// <summary>
        /// 处理对账回填数据
        /// </summary>
        /// <param name="p_FormID"></param>
        /// <param name="p_Type"></param>
        /// <param name="sqlTrans"></param>
        private void SetCheckOperationTotal(int p_FormID, int p_Type, IDBTransAccess sqlTrans)
        {
            string sql = "SELECT ID,MainID,Seq FROM Finance_CheckOperationDts WHERE MainID=" + SysString.ToDBString(p_FormID);

            sql += " ORDER BY Seq";
            DataTable dt = sqlTrans.Fill(sql);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    //对账单
                    CheckOperation entity = new CheckOperation();
                    entity.ID = p_FormID;

                    ///对账单明细
                    CheckOperationDts entityDts = new CheckOperationDts();
                    entityDts.ID = SysConvert.ToInt32(dr["ID"]);
                    entityDts.SelectByID();

                    ///仓库单据明细
                    IOForm entityIOF = new IOForm(sqlTrans);
                    entityIOF.ID = entityDts.DLOADID;
                    entityIOF.SelectByID();
                    if (entityDts.DLOADID > 0) ///回填仓库出入库数据
                    {
                        if (entityIOF.SelectByID())
                        {
                        }
                        else
                        {
                            throw new Exception("操作异常,没有找到出入库记录 ID:" + entityDts.DLOADID);
                        }
                        if (p_Type == (int)YesOrNo.Yes)//提交
                        {
                            //if (entityIOF.DZFlag == (int)YesOrNo.Yes && entityIOF.Qty == entityDts.DCheckQty)
                            //{
                            //    throw new Exception("不能操作,数据已对账 ID:" + entityDts.DLOADDtsID + " " + entityIOF.ItemCode + " " + entityIOF.ColorNum);
                            //}

                            ///回填数据到出库明细表中:对账数量、对账金额、对账单价、对账标志、对账单、对账日期、对账单号
                            ///
                            sql  = "UPDATE WH_IOForm SET DZQty=ISNULL(DZQty,0)+(" + SysString.ToDBString(entityDts.DCheckQty) + ")";
                            sql += ",DZAmount=ISNULL(DZAmount,0)+(" + SysString.ToDBString(entityDts.DCheckAmount) + ")";
                            sql += ",DZSinglePrice=" + SysString.ToDBString(entityDts.DCheckSinglePrice);
                            sql += ",DZFlag=1";
                            sql += ",DZOPID=" + SysString.ToDBString(entity.SaleOPID);
                            sql += ",DZTime=GetDate()";
                            sql += ",DZNo=" + SysString.ToDBString(entity.FormNo);
                            sql += " WHERE ID=" + SysString.ToDBString(entityIOF.ID);
                            sqlTrans.ExecuteNonQuery(sql);
                        }
                        else//撤销提交
                        {
                            //if (entityIOF.InvoiceQty != 0 && entityIOF.Qty == entityDts.DCheckQty)
                            //{
                            //    throw new Exception("不能操作,数据已有开票数据 ID:" + entityDts.DLOADDtsID + " " + entityIOF.ItemCode + " " + entityIOF.ColorNum);
                            //}

                            sql  = "UPDATE WH_IOForm SET DZQty=ISNULL(DZQty,0)-(" + SysString.ToDBString(entityDts.DCheckQty) + ")";
                            sql += ",DZAmount=ISNULL(DZAmount,0)-(" + SysString.ToDBString(entityDts.DCheckAmount) + ")";
                            sql += ",DZSinglePrice=NULL";
                            if (entityIOF.DZQty == entityDts.DCheckQty)
                            {
                                sql += ",DZFlag=0";
                            }
                            sql += ",DZOPID=''";
                            sql += ",DZTime=NULL";
                            sql += ",DZNo=''";
                            sql += " WHERE ID=" + SysString.ToDBString(entityIOF.ID);
                            sqlTrans.ExecuteNonQuery(sql);
                        }
                    }
                }
            }
        }