Ejemplo n.º 1
0
        /// <summary>
        /// 删除
        /// </summary>
        public override void EntityDelete()
        {
            ItemTestFormRule rule   = new ItemTestFormRule();
            ItemTestForm     entity = EntityGet();

            rule.RDelete(entity);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private ItemTestForm EntityGet()
        {
            ItemTestForm entity = new ItemTestForm();

            entity.ID = HTDataID;
            return(entity);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 保存(传入事务处理)
 /// </summary>
 /// <param name="p_Entity"></param>
 /// <param name="p_BE"></param>
 /// <param name="sqlTrans"></param>
 public void RSave(ItemTestForm p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         string sql = "DELETE FROM Att_ItemTestFormDts WHERE MainID=" + p_Entity.ID.ToString();
         sql += " AND ID NOT IN" + string.Format("({0})", GetIDExist(p_BE));
         sqlTrans.ExecuteNonQuery(sql);//删除原单据里应该删除的明细数据,即数据库里有但是UI里已经删除的数据
         for (int i = 0; i < p_BE.Length; i++)
         {
             ItemTestFormDts entitydts = (ItemTestFormDts)p_BE[i];
             if (entitydts.ID != 0)//ID不为0说明数据库中已经存在
             {
                 this.RUpdate(entitydts, sqlTrans);
             }
             else
             {
                 entitydts.MainID = p_Entity.ID;
                 this.RAdd(entitydts, sqlTrans);
             }
         }
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, BaseEntity[] p_BE2, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         ItemTestForm    entity  = (ItemTestForm)p_BE;
         ItemTestFormCtl control = new ItemTestFormCtl(sqlTrans);
         control.Update(entity);
         ItemTestFormDtsRule rule = new ItemTestFormDtsRule();
         rule.RSave(entity, p_BE2, sqlTrans);
         //string sql = "DELETE Att_ItemTestFormDts WHERE MainID="+SysString.ToDBString(entity.ID);
         //sqlTrans.ExecuteNonQuery(sql);
         //for (int i = 0; i < p_BE2.Length; i++)
         //{
         //    ItemTestFormDtsRule rule = new ItemTestFormDtsRule();
         //    ItemTestFormDts entityDts = (ItemTestFormDts)p_BE2[i];
         //    entityDts.MainID = entity.ID;
         //    entityDts.Seq = i + 1;
         //    rule.RAdd(entityDts, sqlTrans);
         //}
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                ItemTestForm MasterEntity = (ItemTestForm)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Att_ItemTestForm 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);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private ItemTestForm EntityGet()
        {
            ItemTestForm entity = new ItemTestForm();

            entity.ID = HTDataID;
            entity.SelectByID();

            entity.FormNo      = txtFormNo.Text.Trim();
            entity.MakeOPID    = FParamConfig.LoginID;
            entity.MakeOPName  = FParamConfig.LoginName;
            entity.MakeDate    = DateTime.Now.Date;
            entity.ShopID      = SysConvert.ToString(txtShopID.Text.Trim());
            entity.FormDate    = DateTime.Now.Date;
            entity.SendDate    = txtSendDate.DateTime.Date;
            entity.RecDate     = txtRecDate.DateTime.Date;
            entity.BGNo        = txtBGNo.Text.Trim();
            entity.ItemCode    = txtItemCode.Text.Trim();
            entity.GoodsCode   = txtGoodsCode.Text.Trim();
            entity.ColorNum    = txtColorNum.Text.Trim();
            entity.ColorName   = txtColorName.Text.Trim();
            entity.ItemName    = txtItemName.Text.Trim();
            entity.CheckComID  = SysConvert.ToString(drpCheckComID.EditValue);
            entity.FormStatus  = SysConvert.ToString(drpFormStatus.EditValue);
            entity.TestFee     = SysConvert.ToDecimal(txtTestFee.Text.Trim());
            entity.TestContext = GetCheckCSItem(chkLamp1);
            entity.YBGNo       = txtYBGNo.Text.Trim();
            entity.YCheckComID = SysConvert.ToString(drpYCheckComID.EditValue);
            entity.Remark      = txtRemark.Text.Trim();
            entity.FormXZ      = txtFormXZ.Text.Trim();
            entity.VendorID    = SysConvert.ToString(drpVendorID.EditValue);
            entity.VendorID2   = SysConvert.ToString(drpVendorID2.EditValue);
            entity.VendorID3   = SysConvert.ToString(drpVendorID3.EditValue);
            entity.VendorID4   = SysConvert.ToString(drpVendorID4.EditValue);
            entity.JSFree      = SysConvert.ToDecimal(txtJSFree.Text.Trim());
            entity.JSFlag      = SysConvert.ToInt32(chkJSFlag.Checked);
            entity.ItemModel   = txtItemModel.Text.Trim();
            entity.ItemStd     = txtItemStd.Text.Trim();
            entity.Used        = txtUsed.Text.Trim();
            entity.KDForm      = txtKDForm.Text.Trim();
            entity.HTNo        = txtHTNo.Text.Trim();
            entity.DLoadID     = SysConvert.ToInt32(txtDLoadID.Text.Trim());
            entity.BGType      = txtBGType.Text.Trim();
            entity.OrderQty    = txtOrderQty.Text.Trim();
            entity.SaleOPID    = SysConvert.ToString(drpSaleOPID.EditValue);
            entity.ItemClass   = txtItemClass.Text.Trim();
            entity.FPNO        = txtFPNO.Text.Trim();
            entity.FPDate      = txtFPDate.DateTime.Date;
            entity.JYOPName    = SysConvert.ToString(drpJYOpName.EditValue);

            if (entity.JSFlag == 1)
            {
                entity.JSDate = DateTime.Now.Date;
            }
            return(entity);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 修改
        /// </summary>
        public override void EntityUpdate()
        {
            ItemTestFormRule rule   = new ItemTestFormRule();
            ItemTestForm     entity = EntityGet();

            ItemTestFormDts[] entitydts = EntityDtsGet();
            //decimal TFree = 0;
            //for (int i = 0; i < entitydts.Length; i++)
            //{
            //    TFree += entitydts[i].TFree;
            //}
            //entity.TestFee = TFree;
            entity.SubmitFlag = this.HTSubmitFlagUpdateGet();
            rule.RUpdate(entity, entitydts);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 新增
        /// </summary>
        public override int EntityAdd()
        {
            ItemTestFormRule rule   = new ItemTestFormRule();
            ItemTestForm     entity = EntityGet();

            ItemTestFormDts[] entitydts = EntityDtsGet();

            //decimal TFree = 0;
            //for (int i = 0; i < entitydts.Length; i++)
            //{
            //    TFree += entitydts[i].TFree;
            //}
            //entity.TestFee = TFree;
            entity.SubmitFlag = this.HTSubmitFlagInsertGet();
            rule.RAdd(entity, entitydts);
            return(entity.ID);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE2, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                ItemTestForm entity = (ItemTestForm)p_BE;

                string    sql = "SELECT FormNo FROM Att_ItemTestForm WHERE FormNo=" + SysString.ToDBString(entity.FormNo);
                DataTable dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("测试单号已存在,请重新生成");
                }
                if (entity.BGNo != "")
                {
                    sql = "SELECT BGNo FROM Att_ItemTestForm WHERE BGNo=" + SysString.ToDBString(entity.BGNo);
                    dt  = sqlTrans.Fill(sql);
                    if (dt.Rows.Count > 0)
                    {
                        throw new BaseException("报告编号已存在,请检查后输入");
                    }
                }
                ItemTestFormCtl control = new ItemTestFormCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Att_ItemTestForm, sqlTrans);
                control.AddNew(entity);
                for (int i = 0; i < p_BE2.Length; i++)
                {
                    ItemTestFormDtsRule rule      = new ItemTestFormDtsRule();
                    ItemTestFormDts     entityDts = (ItemTestFormDts)p_BE2[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    rule.RAdd(entityDts, sqlTrans);
                }
                FormNoControlRule rulest = new FormNoControlRule();
                rulest.RAddSort((int)FormNoControlEnum.检验单号, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Ejemplo n.º 10
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);
         ItemTestForm    entity  = (ItemTestForm)p_BE;
         ItemTestFormCtl control = new ItemTestFormCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Ejemplo n.º 11
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);
         ItemTestForm    entity  = (ItemTestForm)p_BE;
         ItemTestFormCtl control = new ItemTestFormCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Att_ItemTestForm, sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            ItemTestForm entity = new ItemTestForm();

            entity.ID = HTDataID;
            bool findFlag = entity.SelectByID();

            txtFormNo.Text          = entity.FormNo.ToString();
            txtShopID.Text          = entity.ShopID.ToString();
            txtSendDate.DateTime    = entity.SendDate;
            txtRecDate.DateTime     = entity.RecDate;
            txtBGNo.Text            = entity.BGNo.ToString();
            txtItemCode.Text        = entity.ItemCode.ToString();
            txtGoodsCode.Text       = entity.GoodsCode.ToString();
            txtColorNum.Text        = entity.ColorNum.ToString();
            txtColorName.Text       = entity.ColorName.ToString();
            txtItemName.Text        = entity.ItemName.ToString();
            drpFormStatus.EditValue = entity.FormStatus;
            txtTestFee.Text         = entity.TestFee.ToString();
            txtRemark.Text          = entity.Remark.ToString();
            drpCheckComID.EditValue = entity.CheckComID;
            SetTestContext(chkLamp1, entity.TestContext);
            drpYCheckComID.EditValue = entity.YCheckComID;
            txtFormXZ.Text           = entity.FormXZ;
            txtBGType.Text           = entity.BGType.ToString();
            drpVendorID.EditValue    = SysConvert.ToString(entity.VendorID);
            drpVendorID2.EditValue   = SysConvert.ToString(entity.VendorID2);
            drpVendorID3.EditValue   = SysConvert.ToString(entity.VendorID3);
            drpVendorID4.EditValue   = SysConvert.ToString(entity.VendorID4);
            txtOrderQty.Text         = entity.OrderQty.ToString();
            txtDLoadID.Text          = entity.DLoadID.ToString();
            txtItemModel.Text        = entity.ItemModel.ToString();
            txtItemStd.Text          = entity.ItemStd.ToString();
            txtKDForm.Text           = entity.KDForm.ToString();
            txtUsed.Text             = entity.Used.ToString();
            txtHTNo.Text             = entity.HTNo.ToString();
            txtYBGNo.Text            = entity.YBGNo;
            drpSaleOPID.EditValue    = entity.SaleOPID.ToString();
            txtItemClass.Text        = entity.ItemClass.ToString();
            txtFPNO.Text             = entity.FPNO.ToString();
            txtFPDate.DateTime       = entity.FPDate;
            drpJYOpName.EditValue    = entity.JYOPName.ToString();

            if (entity.JSFlag == 1)
            {
                chkJSFlag.Checked = true;
            }
            else
            {
                chkJSFlag.Checked = false;
            }
            txtJSFree.Text   = entity.JSFree.ToString();
            HTDataSubmitFlag = entity.SubmitFlag;
            HTDataDelFlag    = entity.DelFlag;

            if (!findFlag)
            {
            }

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

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Att_ItemTestForm(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("FormNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FormNo) + ",");
                MasterField.Append("MakeOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MakeOPID) + ",");
                MasterField.Append("MakeOPName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MakeOPName) + ",");
                MasterField.Append("MakeDate" + ",");
                if (MasterEntity.MakeDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.MakeDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("CheckOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CheckOPID) + ",");
                MasterField.Append("CheckDate" + ",");
                if (MasterEntity.CheckDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.CheckDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("SubmitFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SubmitFlag) + ",");
                MasterField.Append("DelFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DelFlag) + ",");
                MasterField.Append("ShopID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ShopID) + ",");
                MasterField.Append("FormDate" + ",");
                if (MasterEntity.FormDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.FormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("SendDate" + ",");
                if (MasterEntity.SendDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.SendDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("RecDate" + ",");
                if (MasterEntity.RecDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.RecDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("BGNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.BGNo) + ",");
                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("ItemName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemName) + ",");
                MasterField.Append("CheckComID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CheckComID) + ",");
                MasterField.Append("FormType" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FormType) + ",");
                MasterField.Append("FormStatus" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FormStatus) + ",");
                MasterField.Append("TestFee" + ",");
                if (MasterEntity.TestFee != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.TestFee) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("TestContext" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.TestContext) + ",");
                MasterField.Append("YBGNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.YBGNo) + ",");
                MasterField.Append("YCheckComID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.YCheckComID) + ",");
                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                MasterField.Append("FormXZ" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FormXZ) + ",");
                MasterField.Append("VendorID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VendorID) + ",");
                MasterField.Append("JSFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.JSFlag) + ",");
                MasterField.Append("JSFree" + ",");
                if (MasterEntity.JSFree != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.JSFree) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("JSDate" + ",");
                if (MasterEntity.JSDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.JSDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("VendorID2" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VendorID2) + ",");
                MasterField.Append("VendorID3" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VendorID3) + ",");
                MasterField.Append("VendorID4" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VendorID4) + ",");
                MasterField.Append("BGType" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.BGType) + ",");
                MasterField.Append("DLoadID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DLoadID) + ",");
                MasterField.Append("HTNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.HTNo) + ",");
                MasterField.Append("ItemModel" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemModel) + ",");
                MasterField.Append("ItemStd" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemStd) + ",");
                MasterField.Append("Used" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Used) + ",");
                MasterField.Append("KDForm" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.KDForm) + ",");
                MasterField.Append("SaleOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SaleOPID) + ",");
                MasterField.Append("ItemClass" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ItemClass) + ",");
                MasterField.Append("FPNO" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FPNO) + ",");
                MasterField.Append("FPDate" + ",");
                if (MasterEntity.FPDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.FPDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("JYOPName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.JYOPName) + ",");
                MasterField.Append("OrderQty" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.OrderQty) + ")");



                //执行
                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);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                ItemTestForm MasterEntity = (ItemTestForm)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Att_ItemTestForm SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" FormNo=" + SysString.ToDBString(MasterEntity.FormNo) + ",");
                UpdateBuilder.Append(" MakeOPID=" + SysString.ToDBString(MasterEntity.MakeOPID) + ",");
                UpdateBuilder.Append(" MakeOPName=" + SysString.ToDBString(MasterEntity.MakeOPName) + ",");

                if (MasterEntity.MakeDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" MakeDate=" + SysString.ToDBString(MasterEntity.MakeDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" MakeDate=null,");
                }

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

                if (MasterEntity.CheckDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" CheckDate=" + SysString.ToDBString(MasterEntity.CheckDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" CheckDate=null,");
                }

                UpdateBuilder.Append(" SubmitFlag=" + SysString.ToDBString(MasterEntity.SubmitFlag) + ",");
                UpdateBuilder.Append(" DelFlag=" + SysString.ToDBString(MasterEntity.DelFlag) + ",");
                UpdateBuilder.Append(" ShopID=" + SysString.ToDBString(MasterEntity.ShopID) + ",");

                if (MasterEntity.FormDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" FormDate=" + SysString.ToDBString(MasterEntity.FormDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" FormDate=null,");
                }


                if (MasterEntity.SendDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" SendDate=" + SysString.ToDBString(MasterEntity.SendDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" SendDate=null,");
                }


                if (MasterEntity.RecDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" RecDate=" + SysString.ToDBString(MasterEntity.RecDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" RecDate=null,");
                }

                UpdateBuilder.Append(" BGNo=" + SysString.ToDBString(MasterEntity.BGNo) + ",");
                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) + ",");
                UpdateBuilder.Append(" ItemName=" + SysString.ToDBString(MasterEntity.ItemName) + ",");
                UpdateBuilder.Append(" CheckComID=" + SysString.ToDBString(MasterEntity.CheckComID) + ",");
                UpdateBuilder.Append(" FormType=" + SysString.ToDBString(MasterEntity.FormType) + ",");
                UpdateBuilder.Append(" FormStatus=" + SysString.ToDBString(MasterEntity.FormStatus) + ",");

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

                UpdateBuilder.Append(" TestContext=" + SysString.ToDBString(MasterEntity.TestContext) + ",");
                UpdateBuilder.Append(" YBGNo=" + SysString.ToDBString(MasterEntity.YBGNo) + ",");
                UpdateBuilder.Append(" YCheckComID=" + SysString.ToDBString(MasterEntity.YCheckComID) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");
                UpdateBuilder.Append(" FormXZ=" + SysString.ToDBString(MasterEntity.FormXZ) + ",");
                UpdateBuilder.Append(" VendorID=" + SysString.ToDBString(MasterEntity.VendorID) + ",");
                UpdateBuilder.Append(" JSFlag=" + SysString.ToDBString(MasterEntity.JSFlag) + ",");

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


                if (MasterEntity.JSDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" JSDate=" + SysString.ToDBString(MasterEntity.JSDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" JSDate=null,");
                }

                UpdateBuilder.Append(" VendorID2=" + SysString.ToDBString(MasterEntity.VendorID2) + ",");
                UpdateBuilder.Append(" VendorID3=" + SysString.ToDBString(MasterEntity.VendorID3) + ",");
                UpdateBuilder.Append(" VendorID4=" + SysString.ToDBString(MasterEntity.VendorID4) + ",");
                UpdateBuilder.Append(" BGType=" + SysString.ToDBString(MasterEntity.BGType) + ",");
                UpdateBuilder.Append(" DLoadID=" + SysString.ToDBString(MasterEntity.DLoadID) + ",");
                UpdateBuilder.Append(" HTNo=" + SysString.ToDBString(MasterEntity.HTNo) + ",");
                UpdateBuilder.Append(" ItemModel=" + SysString.ToDBString(MasterEntity.ItemModel) + ",");
                UpdateBuilder.Append(" ItemStd=" + SysString.ToDBString(MasterEntity.ItemStd) + ",");
                UpdateBuilder.Append(" Used=" + SysString.ToDBString(MasterEntity.Used) + ",");
                UpdateBuilder.Append(" KDForm=" + SysString.ToDBString(MasterEntity.KDForm) + ",");
                UpdateBuilder.Append(" SaleOPID=" + SysString.ToDBString(MasterEntity.SaleOPID) + ",");
                UpdateBuilder.Append(" ItemClass=" + SysString.ToDBString(MasterEntity.ItemClass) + ",");
                UpdateBuilder.Append(" FPNO=" + SysString.ToDBString(MasterEntity.FPNO) + ",");

                if (MasterEntity.FPDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" FPDate=" + SysString.ToDBString(MasterEntity.FPDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" FPDate=null,");
                }

                UpdateBuilder.Append(" JYOPName=" + SysString.ToDBString(MasterEntity.JYOPName) + ",");
                UpdateBuilder.Append(" OrderQty=" + SysString.ToDBString(MasterEntity.OrderQty));

                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);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="p_FormID">单据ID</param>
        /// <param name="p_Type">0/1/2/3:弃审/审核</param>
        public void RSubmit(int p_FormID, int p_Type, IDBTransAccess sqlTrans)
        {
            try
            {
                int          p_TempType = p_Type;//处理状态
                string       sql        = string.Empty;
                string       str        = string.Empty;
                ItemTestForm entity     = new ItemTestForm(sqlTrans);
                entity.ID = p_FormID;
                entity.SelectByID();
                if (entity.SubmitFlag == p_Type)//如果相同异常
                {
                    throw new Exception("单据状态重复设置,请关闭程序重新打开操作");
                }
                entity.SubmitFlag = p_Type;
                this.RUpdate(entity, sqlTrans);//更新主表状态
                switch (p_Type)
                {
                case 1:
                    sql  = "SELECT * FROM Att_ItemTestForm WHERE ItemCode=" + SysString.ToDBString(entity.ItemCode);
                    sql += " AND ColorNum=" + SysString.ToDBString(entity.ColorNum);
                    sql += " AND ColorName=" + SysString.ToDBString(entity.ColorName);
                    sql += " AND SubmitFlag=1";
                    DataTable dt = sqlTrans.Fill(sql);
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (str != "")
                            {
                                str += ",";
                            }
                            str += SysConvert.ToString(dt.Rows[i]["FormNo"]);
                        }
                        sql  = "UPDATE Data_ItemGB SET testReportFlag=1,testReportNum=" + SysString.ToDBString(str) + " WHERE 1=1 ";
                        sql += " AND MainID IN(SELECT ID FROM Data_Item WHERE ItemCode=" + SysString.ToDBString(entity.ItemCode);
                        sql += ")";
                        sql += " AND ColorNum=" + SysString.ToDBString(entity.ColorNum);
                        sql += " AND ColorName=" + SysString.ToDBString(entity.ColorName);
                        sqlTrans.ExecuteNonQuery(sql);
                    }

                    sql  = "UPDATE Sale_SaleOrderDts SET BGNo=" + SysString.ToDBString(entity.FormNo);
                    sql += " WHERE ID=" + SysString.ToDBString(entity.DLoadID);
                    sqlTrans.ExecuteNonQuery(sql);

                    sql  = "UPDATE Buy_ItemBuyFormDts SET BGNo=" + SysString.ToDBString(entity.FormNo);
                    sql += " WHERE DLoadID=" + SysString.ToDBString(entity.DLoadID);
                    sqlTrans.ExecuteNonQuery(sql);
                    break;

                case 0:
                    sql  = "SELECT * FROM Att_ItemTestForm WHERE ItemCode=" + SysString.ToDBString(entity.ItemCode);
                    sql += " AND ColorNum=" + SysString.ToDBString(entity.ColorNum);
                    sql += " AND ColorName=" + SysString.ToDBString(entity.ColorName);
                    sql += " AND SubmitFlag=1";
                    dt   = sqlTrans.Fill(sql);
                    if (dt.Rows.Count == 0)
                    {
                        sql  = "UPDATE Data_ItemGB SET testReportFlag=0,testReportNum='' WHERE 1=1 ";
                        sql += " AND MainID IN(SELECT ID FROM Data_Item WHERE ItemCode=" + SysString.ToDBString(entity.ItemCode);
                        sql += ")";
                        sql += " AND ColorNum=" + SysString.ToDBString(entity.ColorNum);
                        sql += " AND ColorName=" + SysString.ToDBString(entity.ColorName);
                        sqlTrans.ExecuteNonQuery(sql);
                    }
                    else
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (str != "")
                            {
                                str += ",";
                            }
                            str += SysConvert.ToString(dt.Rows[i]["FormNo"]);
                        }
                        sql  = "UPDATE Data_ItemGB SET  testReportFlag=1,testReportNum=" + SysString.ToDBString(str) + " WHERE 1=1 ";
                        sql += " AND MainID IN(SELECT ID FROM Data_Item WHERE ItemCode=" + SysString.ToDBString(entity.ItemCode);
                        sql += ")";
                        sql += " AND ColorNum=" + SysString.ToDBString(entity.ColorNum);
                        sql += " AND ColorName=" + SysString.ToDBString(entity.ColorName);
                        sqlTrans.ExecuteNonQuery(sql);
                    }

                    sql  = "UPDATE Sale_SaleOrderDts SET BGNo=''";   // +SysString.ToDBString(entity.BGNo);
                    sql += " WHERE ID=" + SysString.ToDBString(entity.DLoadID);
                    sqlTrans.ExecuteNonQuery(sql);

                    sql  = "UPDATE Buy_ItemBuyFormDts SET BGNo=''";   // +SysString.ToDBString(entity.BGNo);
                    sql += " WHERE DLoadID=" + SysString.ToDBString(entity.DLoadID);
                    sqlTrans.ExecuteNonQuery(sql);
                    break;
                }
            }

            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     ItemTestForm entity = (ItemTestForm)p_BE;
 }