コード例 #1
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private IOForm EntityGet()
        {
            IOForm entity = new IOForm();

            entity.ID = HTDataID;
            return(entity);
        }
コード例 #2
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            IOForm entity = new IOForm();

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

            HTDataFormNo          = entity.FormNo;
            txtFormNo.Text        = entity.FormNo.ToString();
            txtFormDate.DateTime  = entity.FormDate;
            drpVendorID.EditValue = entity.VendorID.ToString();
            drpSubType.EditValue  = entity.SubType;
            drpSaleOPID.EditValue = entity.SaleOPID.ToString();
            txtTotalQty.Text      = entity.TotalQty.ToString();
            txtRemark.Text        = entity.Remark;
            txtMakeOPName.Text    = entity.MakeOPName;
            drpAddress.EditValue  = entity.Address;

            drpVendorOPID.EditValue = entity.VendorOPID;
            txtVendorTel.Text       = entity.VendorTel;
            HTDataSubmitFlag        = entity.SubmitFlag;
            HTDataDelFlag           = entity.DelFlag;
            if (!findFlag)
            {
            }
            BindGridDts();
        }
コード例 #3
0
ファイル: frmCodeInWHEdit.cs プロジェクト: zhp-apeng/HTMLTERP
        /// <summary>
        /// 删除
        /// </summary>
        public override void EntityDelete()
        {
            IOFormRule rule   = new IOFormRule();
            IOForm     entity = EntityGet();

            rule.RDelete(entity);
        }
コード例 #4
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                IOForm MasterEntity = (IOForm)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM WH_IOForm 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);
            }
        }
コード例 #5
0
        /// <summary>
        /// 织造加工出库回填方法
        /// </summary>
        /// <param name="entity">单头</param>
        /// <param name="entitydts">单据明细</param>
        /// <param name="p_Type">1/0 审核通过/审核拒绝</param>
        void RFillDataZZCK(IOForm entity, IOFormDts[] entitydts, int p_Type, DataRow drFormList, IDBTransAccess sqlTrans)
        {
            string sql    = string.Empty;
            bool   thFlag = false;

            if (SysConvert.ToInt32(drFormList["DZFlag"]) == (int)EnumDZFlag.对帐负)
            {
                thFlag = true;
            }
            for (int i = 0; i < entitydts.Length; i++)//循环遍历历史
            {
                sql  = "SELECT DtsID,Qty,OutQty,NLQty FROM UV1_WO_WeaveProcessDts2 WHERE FormNo=" + SysString.ToDBString(entitydts[i].DtsSO);
                sql += " AND ItemCode=" + SysString.ToDBString(entitydts[i].ItemCode);
                sql += " AND ItemName=" + SysString.ToDBString(entitydts[i].ItemName);
                sql += " AND ItemStd=" + SysString.ToDBString(entitydts[i].ItemStd);
                sql += " AND ColorNum=" + SysString.ToDBString(entitydts[i].ColorNum);
                sql += " AND ColorName=" + SysString.ToDBString(entitydts[i].ColorName);
                DataTable dtData = sqlTrans.Fill(sql);
                if (dtData.Rows.Count != 0)
                {
                    decimal thisQty = entitydts[i].Qty;
                    if (thFlag)
                    {
                        thisQty = 0 - thisQty;//退货用负数处理
                    }
                    string o_ErrorMsg = "";
                    if (p_Type == (int)YesOrNo.Yes)                                                                                                                               //提交
                    {
                        if (!RFillDataCheckQty(drFormList, SysConvert.ToDecimal(dtData.Rows[0]["Qty"]), SysConvert.ToDecimal(dtData.Rows[0]["NLQty"]) + thisQty, out o_ErrorMsg)) //校验数量合理性
                        {
                            throw new Exception("不能操作,数量不符合设置的规则 :编码:" + entitydts[i].ItemCode + "色号:" + entitydts[i].ColorNum + "  " + o_ErrorMsg);
                        }

                        sql  = "UPDATE WO_WeaveProcessDts2 SET ";
                        sql += " NLFormDate=" + SysString.ToDBString(entity.FormDate.ToString("yyyy-MM-dd"));
                        sql += ",NLQty=ISNULL(NLQty,0)+" + "(" + SysString.ToDBString(thisQty) + ")";
                        sql += " WHERE ID=" + dtData.Rows[0]["DtsID"].ToString();
                    }
                    else//撤销提交
                    {
                        if (!RFillDataCheckQty(drFormList, SysConvert.ToDecimal(dtData.Rows[0]["Qty"]), SysConvert.ToDecimal(dtData.Rows[0]["NLQty"]) - thisQty, out o_ErrorMsg))//校验数量合理性
                        {
                            throw new Exception("不能操作,数量不符合设置的规则:编码:" + entitydts[i].ItemCode + "色号:" + entitydts[i].ColorNum + "   " + o_ErrorMsg);
                        }

                        sql  = "UPDATE WO_WeaveProcessDts2 SET ";
                        sql += " NLFormDate=" + SysString.ToDBString(entity.FormDate.ToString("yyyy-MM-dd"));
                        sql += ",NLQty=ISNULL(NLQty,0)-" + "(" + SysString.ToDBString(thisQty) + ")";
                        sql += " WHERE ID=" + dtData.Rows[0]["DtsID"].ToString();
                    }
                    sqlTrans.ExecuteNonQuery(sql);
                }
                else
                {
                    throw new Exception("回填数据失败,没有找到对应的织造加工单及颜色:" + entitydts[i].DtsSO + "  " + entitydts[i].ItemCode
                                        + "  " + entitydts[i].ColorNum + "  " + entitydts[i].ColorName);
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// 修改销售合同站别
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLoad_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_ID == 0 || m_DtsID == 0)
                {
                    this.ShowMessage("单据有误,请查看");
                    return;
                }
                if (SysConvert.ToString(txtOldSinglePrice.Text.Trim()) == string.Empty)
                {
                    this.ShowMessage("旧单价为空,请检查");
                    return;
                }
                if (SysConvert.ToString(txtNewSinglePrice.Text.Trim()) == string.Empty)
                {
                    this.ShowMessage("新单价为空,请检查");
                    return;
                }
                if (SysConvert.ToString(txtOldSinglePrice.Text.Trim()) == SysConvert.ToString(txtNewSinglePrice.Text.Trim()))
                {
                    this.ShowMessage("新旧单价相同,请检查");
                    return;
                }

                IOForm entity = new IOForm();
                entity.ID = m_ID;
                entity.SelectByID();

                IOFormDts entityDts = new IOFormDts();
                entityDts.ID = m_DtsID;
                entityDts.SelectByID();

                UpdateWHSinglePriceRule rule     = new UpdateWHSinglePriceRule();
                UpdateWHSinglePrice     entityWH = new UpdateWHSinglePrice();
                entityWH.FormNo         = entity.FormNo;
                entityWH.DtsID          = entityDts.ID;
                entityWH.ItemCode       = entityDts.ItemCode;
                entityWH.ColorNum       = entityDts.ColorNum;
                entityWH.ColorName      = entityDts.ColorName;
                entityWH.NewSinglePrice = SysConvert.ToDecimal(txtNewSinglePrice.Text.Trim());
                entityWH.OldSinglePrice = SysConvert.ToDecimal(txtOldSinglePrice.Text.Trim());
                entityWH.UpdateDate     = DateTime.Now;
                entityWH.UpdateOPName   = FParamConfig.LoginName;
                rule.RAdd(entityWH);


                string sql = "UPDATE WH_IOFormDts SET SinglePrice=" + SysString.ToDBString(SysConvert.ToDecimal(txtNewSinglePrice.Text.Trim()));
                sql += ",Amount=ISNULL(DYPrice,0)+ISNULL(Qty,0)*" + SysString.ToDBString(SysConvert.ToDecimal(txtNewSinglePrice.Text.Trim()));
                sql += " WHERE ID=" + SysString.ToDBString(m_DtsID);
                SysUtils.ExecuteNonQuery(sql);
                this.ShowInfoMessage("修改成功");
                this.Close();
            }
            catch (Exception E)
            {
            }
        }
コード例 #7
0
        /// <summary>
        /// 修改
        /// </summary>
        public override void EntityUpdate()
        {
            IOFormRule rule   = new IOFormRule();
            IOForm     entity = EntityGet();

            IOFormDts[] entitydts = EntityDtsGet();
            entity.SubmitFlag = this.HTSubmitFlagUpdateGet();
            rule.RUpdate(entity, entitydts);
        }
コード例 #8
0
        /// <summary>
        /// 保存(传入事务处理)
        /// </summary>
        /// <param name="p_Entity"></param>
        /// <param name="p_BE"></param>
        /// <param name="sqlTrans"></param>
        public void RSaveOther(IOForm p_Entity, IOFormDts[] p_EntityDts, ArrayList list, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql             = string.Empty;
                int    FormListTopType = IOFormDtsRule.GetFormListTopTypeByFormListID(p_Entity.HeadType, sqlTrans);//顶层单据类型

                sql  = "SELECT BoxNo FROM WH_IOFormDtsPack WHERE MainID=" + p_Entity.ID.ToString();
                sql += " AND ID NOT IN" + string.Format("({0})", GetIDExist(list));
                DataTable dtDelete = sqlTrans.Fill(sql); //删除表结构
                if (dtDelete.Rows.Count != 0)            //有需要删除的数据
                {
                    sql  = "DELETE FROM WH_IOFormDtsPack WHERE MainID=" + p_Entity.ID.ToString();
                    sql += " AND ID NOT IN" + string.Format("({0})", GetIDExist(list));
                    sqlTrans.ExecuteNonQuery(sql);//删除原单据里应该删除的明细数据,即数据库里有但是UI里已经删除的数据
                }
                for (int i = 0; i < list.Count; i++)
                {
                    IOFormDtsPack entitydts    = (IOFormDtsPack)list[i];
                    int           ioformdtsdex = -1;
                    for (int m = 0; m < p_EntityDts.Length; m++)
                    {
                        if (p_EntityDts[m].Seq == entitydts.Seq)//找到相同的SEQ了
                        {
                            ioformdtsdex = m;
                            break;
                        }
                    }
                    if (ioformdtsdex == -1)//未找到,异常
                    {
                        throw new Exception("码单输入异常,未找到单据明细,行号:" + entitydts.Seq);
                    }

                    if (entitydts.ID != 0)//ID不为0说明数据库中已经存在
                    {
                        this.RUpdateOther(p_EntityDts[ioformdtsdex], entitydts, sqlTrans);
                    }
                    else
                    {
                        entitydts.MainID = p_Entity.ID;
                        entitydts.DID    = p_EntityDts[ioformdtsdex].ID;
                        this.RAddOther(p_EntityDts[ioformdtsdex], entitydts, sqlTrans);
                    }
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
コード例 #9
0
        /// <summary>
        /// 新增
        /// </summary>
        public override int EntityAdd()
        {
            IOFormRule rule   = new IOFormRule();
            IOForm     entity = EntityGet();

            IOFormDts[] entitydts = EntityDtsGet();

            entity.SubmitFlag = this.HTSubmitFlagInsertGet();
            rule.RAdd(entity, entitydts);
            return(entity.ID);
        }
コード例 #10
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;
                FabricWHOutForm entity     = new FabricWHOutForm(sqlTrans);
                entity.ID = p_FormID;
                entity.SelectByID();


                if (entity.SubmitFlag == p_Type)//如果相同异常
                {
                    throw new Exception("单据状态重复设置,请关闭程序重新打开操作");
                }

                IOForm entitywh = new IOForm();
                if (p_Type == (int)YesOrNo.Yes)
                {
                    /*创建自动出库单并提交*/
                    entitywh = RAutoCreateWHForm(entity, sqlTrans);
                }
                else
                {
                    /*撤销提交自动出库单并删除*/
                    RAutoDeleteWHForm(entity, sqlTrans);
                }

                /* 更新扣料单据状态*/
                sql = "UPDATE WO_FabricWHOutForm SET SubmitFlag=" + SysString.ToDBString(p_Type);
                //if (p_Type == (int)ConfirmFlag.审核通过 || p_Type == (int)ConfirmFlag.审核拒绝)
                //{
                //    //sql += ",SubmitOPID=" + SysString.ToDBString(ParamConfig.LoginName) + ",SubmitTime=" + SysString.ToDBString(DateTime.Now);
                //}
                sql += ",AutoIOFormID=" + entitywh.ID;
                sql += ",AutoIOFormNo=" + SysString.ToDBString(entitywh.FormNo);
                sql += " WHERE ID=" + p_FormID.ToString();//更新单据主表审核状态
                sqlTrans.ExecuteNonQuery(sql);

                /*更新加工单据扣料状态*/
                sql  = "UPDATE WO_FabricProcess SET WHOutFormFlag=" + SysString.ToDBString(p_Type);
                sql += " WHERE ID=" + entity.MainID.ToString();//更新单据主表审核状态
                sqlTrans.ExecuteNonQuery(sql);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
コード例 #11
0
        /// <summary>
        /// 撤销提交及删除单据
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="sqlTrans"></param>
        void RAutoDeleteWHForm(FabricWHOutForm entity, IDBTransAccess sqlTrans)
        {
            string sql = string.Empty;

            IOForm entitywh = new IOForm(sqlTrans);

            entitywh.ID = entity.AutoIOFormID;
            if (entitywh.SelectByID())
            {
                IOFormRule rulewh = new IOFormRule();
                rulewh.RSubmit(entitywh.ID, (int)YesOrNo.No, sqlTrans);
                rulewh.RDelete(entitywh, sqlTrans);
            }
        }
コード例 #12
0
ファイル: IOFormRule.cs プロジェクト: zhp-apeng/HTMLTERP
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                IOForm    entity  = (IOForm)p_BE;
                IOFormCtl control = new IOFormCtl(sqlTrans);
                //校验单号唯一性
                string sql = "SELECT FormNo FROM WH_IOForm WHERE FormNo=" + SysString.ToDBString(entity.FormNo);
                if (sqlTrans.Fill(sql).Rows.Count != 0)
                {
                    throw new Exception("单号已经存在,请重新生成单号");
                }

                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WH_IOForm, sqlTrans);
                control.AddNew(entity);


                FormNoControlRule rulefn = new FormNoControlRule();//更新单号
                int tempFormNoControlID  = 0;
                sql = "SELECT FormNoControlID FROM Enum_FormList WHERE ID=" + SysString.ToDBString(entity.SubType);
                DataTable dt = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    tempFormNoControlID = SysConvert.ToInt32(dt.Rows[0]["FormNoControlID"].ToString());
                    if (tempFormNoControlID == 0)//子类型没有配置 则读取主类型单号配置
                    {
                        sql = "SELECT FormNoControlID FROM Enum_FormList WHERE ID=" + SysString.ToDBString(entity.HeadType);
                        dt  = sqlTrans.Fill(sql);
                        if (dt.Rows.Count != 0)
                        {
                            tempFormNoControlID = SysConvert.ToInt32(dt.Rows[0]["FormNoControlID"].ToString());
                        }
                    }
                }
                rulefn.RAddSort(tempFormNoControlID, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
コード例 #13
0
ファイル: IOFormRule.cs プロジェクト: zhp-apeng/HTMLTERP
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         IOForm    entity  = (IOForm)p_BE;
         IOFormCtl control = new IOFormCtl(sqlTrans);
         control.Update(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
コード例 #14
0
        //public override void IniData()
        //{
        //    Common.BindOP(drpOPID1, (int)EnumOPDep.仓库, true);
        //    Common.BindOP(drpOPID2, (int)EnumOPDep.仓库, true);
        //}
        /// <summary>
        /// 窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmWait_Load(object sender, EventArgs e)
        {
            try
            {
                Common.BindOP(drpOPID1, (int)EnumOPDep.检验员, true);
                Common.BindOP(drpOPID2, (int)EnumOPDep.检验员, true);

                IOForm entity = new IOForm();
                entity.ID = m_ID;
                entity.SelectByID();

                drpOPID1.EditValue = entity.RecordOPID1;
                drpOPID2.EditValue = entity.RecordOPID2;
            }
            catch (Exception E)
            {
                this.ShowMessage(E.Message);
            }
        }
コード例 #15
0
ファイル: frmYarnInWHEdit.cs プロジェクト: zhp-apeng/HTMLTERP
        /// <summary>
        /// 修改
        /// </summary>
        public override void EntityUpdate()
        {
            IOFormRule rule   = new IOFormRule();
            IOForm     entity = EntityGet();

            IOFormDts[] entitydts   = EntityDtsGet();
            decimal     TotalQty    = 0;
            decimal     TotalAmount = 0;

            for (int i = 0; i < entitydts.Length; i++)
            {
                TotalQty    += SysConvert.ToDecimal(entitydts[i].Qty);
                TotalAmount += SysConvert.ToDecimal(entitydts[i].Amount);
            }
            entity.TotalQty    = TotalQty;
            entity.TotalAmount = TotalAmount;
            entity.SubmitFlag  = this.HTSubmitFlagUpdateGet();
            rule.RUpdate(entity, entitydts);
        }
コード例 #16
0
ファイル: IOFormRule.cs プロジェクト: zhp-apeng/HTMLTERP
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_BE">要删除的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                IOForm    entity  = (IOForm)p_BE;
                IOFormCtl control = new IOFormCtl(sqlTrans);

                string sql             = string.Empty;
                int    FormListTopType = IOFormDtsRule.GetFormListTopTypeByFormListID(entity.HeadType, sqlTrans);//顶层单据类型


                if (FormListTopType == (int)WHFormList.期初入库 || FormListTopType == (int)WHFormList.入库)//如果是入库
                {
                    sql = "DELETE FROM WH_PackBox WHERE BoxNo IN(SELECT BoxNo FROM WH_IOFormDtsPack WHERE MainID=" + entity.ID.ToString() + ")";
                    sqlTrans.ExecuteNonQuery(sql);//删除入库码单数据
                }

                sql = "DELETE FROM WH_IOFormDts WHERE MainID=" + entity.ID.ToString();
                sqlTrans.ExecuteNonQuery(sql);//删除原单据明细数据


                sql = "DELETE FROM WH_IOFormDtsPack WHERE MainID=" + entity.ID.ToString();
                sqlTrans.ExecuteNonQuery(sql);//删除原单据码单明细数据



                sql = "DELETE FROM WH_IOFormDtsInputPack WHERE MainID=" + entity.ID.ToString();
                sqlTrans.ExecuteNonQuery(sql);//删除原单据录入码单明细数据


                control.Delete(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
コード例 #17
0
        /// <summary>
        /// 窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmWait_Load(object sender, EventArgs e)
        {
            try
            {
                IOForm entity = new IOForm();
                entity.ID = m_ID;
                entity.SelectByID();

                IOFormDts entityDts = new IOFormDts();
                entityDts.ID = m_DtsID;
                entityDts.SelectByID();

                lbShow.Text            = "出入库单号:" + entity.FormNo + ",产品编码:" + entityDts.ItemCode + ",颜色:" + entityDts.ColorNum + " " + entityDts.ColorName;
                txtOldSinglePrice.Text = entityDts.SinglePrice.ToString();
                txtNewSinglePrice.Text = entityDts.SinglePrice.ToString();
            }
            catch (Exception E)
            {
            }
        }
コード例 #18
0
ファイル: frmYarnInWHEdit.cs プロジェクト: zhp-apeng/HTMLTERP
        /// <summary>
        /// 新增
        /// </summary>
        public override int EntityAdd()
        {
            IOFormRule rule   = new IOFormRule();
            IOForm     entity = EntityGet();

            IOFormDts[] entitydts   = EntityDtsGet();
            decimal     TotalQty    = 0;
            decimal     TotalAmount = 0;

            for (int i = 0; i < entitydts.Length; i++)
            {
                TotalQty    += SysConvert.ToDecimal(entitydts[i].Qty);
                TotalAmount += SysConvert.ToDecimal(entitydts[i].Amount);
            }
            entity.TotalQty    = TotalQty;
            entity.TotalAmount = TotalAmount;
            entity.SubmitFlag  = this.HTSubmitFlagInsertGet();
            rule.RAdd(entity, entitydts);
            return(entity.ID);
        }
コード例 #19
0
ファイル: IOFormRule.cs プロジェクト: zhp-apeng/HTMLTERP
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd4(BaseEntity p_BE, BaseEntity[] p_BE2, IDBTransAccess sqlTrans)
        {
            try
            {
                this.RAdd(p_BE, sqlTrans);
                IOFormDtsRule ruledts = new IOFormDtsRule();
                ruledts.RSave((IOForm)p_BE, p_BE2, sqlTrans);//保存从表



                IOForm            entity      = (IOForm)p_BE;
                FormNoControlRule rulefn      = new FormNoControlRule();//更新单号
                int       tempFormNoControlID = 0;
                string    sql = "SELECT FormNoControlID FROM Enum_FormList WHERE ID=" + SysString.ToDBString(entity.SubType);
                DataTable dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    tempFormNoControlID = SysConvert.ToInt32(dt.Rows[0]["FormNoControlID"].ToString());
                    if (tempFormNoControlID == 0)//子类型没有配置 则读取主类型单号配置
                    {
                        sql = "SELECT FormNoControlID FROM Enum_FormList WHERE ID=" + SysString.ToDBString(entity.HeadType);
                        dt  = sqlTrans.Fill(sql);
                        if (dt.Rows.Count != 0)
                        {
                            tempFormNoControlID = SysConvert.ToInt32(dt.Rows[0]["FormNoControlID"].ToString());
                        }
                    }
                }
                rulefn.RAddSort(tempFormNoControlID, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
コード例 #20
0
        /// <summary>
        /// 撤销提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void btnSubmitCancel_Click(object sender, EventArgs e)
        {
            try
            {
                if (!FCommon.RightCheck(this.FormID, this.RightFormID, this.FormListAID, this.FormListBID, RightSub.新增))
                {
                    this.ShowMessage("你没有此操作权限");
                    return;
                }
                if (HTDataID == 0)
                {
                    this.ShowMessage("请选择要操作的记录");
                    return;
                }

                if (!CheckLastUpdateDay(txtFormDate.DateTime))
                {
                    return;
                }
                IOForm entity = new IOForm();
                entity.ID = HTDataID;
                entity.SelectByID();
                if (entity.ReadFlag == 1)
                {
                    this.ShowMessage("该单据已阅不能撤销提交");
                    return;
                }
                IOFormRule rule = new IOFormRule();
                rule.RSubmit(HTDataID, (int)ConfirmFlag.未提交);

                FCommon.AddDBLog(this.Text, FormStatus.撤消提交.ToString(), "ID:" + HTDataID, "");
                this.SetPosStatus(HTDataID);
            }
            catch (Exception E)
            {
                this.ShowMessage(E.Message);
            }
        }
コード例 #21
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private IOForm EntityGet()
        {
            IOForm entity = new IOForm();

            entity.ID = HTDataID;
            entity.SelectByID();
            entity.FormNo      = txtFormNo.Text.Trim();
            entity.FormDate    = txtFormDate.DateTime;
            entity.VendorID    = drpVendorID.EditValue.ToString();
            entity.SubType     = SysConvert.ToInt32(drpSubType.EditValue.ToString());
            entity.WHTypeID    = SysConvert.ToInt32(Common.GetWHTypeByFormListID(this.FormListAID));
            entity.SaleOPID    = drpSaleOPID.EditValue.ToString();
            entity.Remark      = txtRemark.Text.Trim();
            entity.HeadType    = this.FormListAID;
            txtMakeOPName.Text = entity.MakeOPName;
            if (HTFormStatus == FormStatus.新增)
            {
                entity.MakeOPID   = FParamConfig.LoginID;
                entity.MakeOPName = FParamConfig.LoginName;
                entity.MakeDate   = DateTime.Now;
            }
            return(entity);
        }
コード例 #22
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            IOForm entity = new IOForm();

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


            HTDataFormNo = entity.FormNo;

            txtFormIOFormID.Text       = entity.FromIOFormID.ToString();
            drpCompanyTypeID.EditValue = SysConvert.ToInt32(entity.CompanyTypeID);
            txtFormNo.Text             = entity.FormNo.ToString();
            //txtHeadType.Text = entity.HeadType.ToString();
            txtHeadType.Text      = this.HeadType.ToString();
            drpSubType.EditValue  = SysConvert.ToInt32(entity.SubType);
            drpVendorID.EditValue = entity.VendorID.ToString();
            txtFormDate.DateTime  = entity.FormDate;
            drpWHID.EditValue     = entity.WHID.ToString();
            drpWHTypeID.EditValue = SysConvert.ToInt32(entity.WHTypeID);

            txtOutDep.Text = entity.OutDep.ToString();
            //txtInDep.Text = entity.InDep.ToString();
            txtWHOP.Text        = entity.WHOP.ToString();
            txtPassOP.Text      = entity.PassOP.ToString();
            drpDutyOP.EditValue = entity.DutyOP.ToString();
            txtRemark.Text      = entity.Remark.ToString();


            HTDataSubmitFlag = entity.SubmitFlag;
            HTDataDelFlag    = entity.DelFlag;
            if (!findFlag)
            {
            }

            BindGridDts();
        }
コード例 #23
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(IOForm p_MainEntity, IOFormDts p_MainDts, BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                IOFormDtsPack entity = (IOFormDtsPack)p_BE;

                PackBox pbentity = new PackBox(sqlTrans);
                pbentity.SourceTypeID = (int)PackBoxSourceType.入库单;
                pbentity.BoxStatusID  = (int)EnumBoxStatus.未入库;
                CopyEntityData(p_MainDts, entity, pbentity);
                //if (entity.BoxNo != string.Empty && p_MainEntity.Remark == "EIN")//仅仅在导数据时使用到
                if (entity.BoxNo != string.Empty)//仅仅在导数据时使用到
                {
                    pbentity.CreateTime = p_MainEntity.FormDate;
                    pbentity.BoxNo      = entity.BoxNo;
                }
                pbentity.DID    = p_MainDts.ID;
                pbentity.SubSeq = entity.SubSeq;
                PackBoxRule pbrule = new PackBoxRule();
                pbrule.RAdd(pbentity, sqlTrans);



                entity.DID   = p_MainDts.ID; //20141009 zhoufc
                entity.BoxNo = pbentity.BoxNo;
                this.RAdd(entity, sqlTrans); //后插入的原因是箱号是在插入箱号实体时生成的
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
コード例 #24
0
ファイル: frmProductOutWH.cs プロジェクト: zhp-apeng/HTMLTERP
        public void btnLoadYY_Click(object sender, EventArgs e)
        {
            if (!FCommon.RightCheck(this.FormID, this.RightFormID, this.FormListAID, this.FormListBID, RightSub.权限0))
            {
                this.ShowMessage("没有此权限,请联系管理员");
                return;
            }
            int        row    = gridView1.FocusedRowHandle;
            ButtonItem btn    = (ButtonItem)sender;
            IOFormRule rule   = new IOFormRule();
            IOForm     entity = new IOForm();

            entity.ID = HTDataID;
            entity.SelectByID();
            if (btn.Text == "撤销已阅")
            {
                if (entity.ReadFlag == 0)
                {
                    this.ShowMessage("该出库单还未阅,无需撤销");
                    return;
                }
                entity.ReadFlag = 0;
                rule.RUpdate(entity);
            }
            if (btn.Text == "已阅")
            {
                if (entity.ReadFlag == 1)
                {
                    this.ShowMessage("该出库单已阅,无需再阅");
                    return;
                }
                entity.ReadFlag = 1;
                rule.RUpdate(entity);
            }
            ID = entity.ID;
            btnQuery_Click(null, null);
        }
コード例 #25
0
        /// <summary>
        /// 保存(传入事务处理)
        /// </summary>
        /// <param name="p_Entity"></param>
        /// <param name="p_BE"></param>
        /// <param name="sqlTrans"></param>
        public void RSave(IOForm p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = string.Empty;

                sql = "";//删除码单明细表,代码待补充;如果是入库要删除原始码单表,需要仔细研究,因为某些情况下(先验布)原始码单还是需要保存的

                sql  = "DELETE FROM WH_IOFormDts 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++)
                {
                    IOFormDts entitydts = (IOFormDts)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);
            }
        }
コード例 #26
0
ファイル: IOFormRule.cs プロジェクト: zhp-apeng/HTMLTERP
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE2, ArrayList list, IDBTransAccess sqlTrans)
        {
            try
            {
                //RCheckMDQty(p_BE, p_BE2, list);//校验码单明细和单据明细数量是否一致

                IOForm entity = (IOForm)p_BE;
                this.RAdd(p_BE, sqlTrans);
                IOFormDtsRule ruledts = new IOFormDtsRule();
                ruledts.RSave((IOForm)p_BE, (IOFormDts[])p_BE2, sqlTrans);//保存从表


                IOFormDtsPackRule dtsprule = new IOFormDtsPackRule();//保存码单明细
                dtsprule.RSave(entity, (IOFormDts[])p_BE2, list, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
コード例 #27
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                IOForm MasterEntity = (IOForm)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO WH_IOForm(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("FromIOFormID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FromIOFormID) + ",");
                MasterField.Append("CompanyTypeID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CompanyTypeID) + ",");
                MasterField.Append("WHTypeID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WHTypeID) + ",");
                MasterField.Append("FormNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FormNo) + ",");
                MasterField.Append("HeadType" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.HeadType) + ",");
                MasterField.Append("SubType" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SubType) + ",");
                MasterField.Append("VendorID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VendorID) + ",");
                MasterField.Append("OutDep" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.OutDep) + ",");
                MasterField.Append("Indep" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Indep) + ",");
                MasterField.Append("WHOP" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WHOP) + ",");
                MasterField.Append("PassOP" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.PassOP) + ",");
                MasterField.Append("DutyOP" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DutyOP) + ",");
                MasterField.Append("SOID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SOID) + ",");
                MasterField.Append("SpecialNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SpecialNo) + ",");
                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("CardNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CardNo) + ",");
                MasterField.Append("ConfirmFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ConfirmFlag) + ",");
                MasterField.Append("CheckOP" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.CheckOP) + ",");
                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("WHID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WHID) + ",");
                MasterField.Append("WHType" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WHType) + ",");
                MasterField.Append("LastUpdTime" + ",");
                if (MasterEntity.LastUpdTime != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.LastUpdTime.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("LastUpdOP" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.LastUpdOP) + ",");
                MasterField.Append("DelFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DelFlag) + ",");
                MasterField.Append("SubmitFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SubmitFlag) + ",");
                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                MasterField.Append("JHCode" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.JHCode) + ",");
                MasterField.Append("XZ" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.XZ) + ",");
                MasterField.Append("SaleOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SaleOPID) + ",");
                MasterField.Append("DM" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DM) + ",");
                MasterField.Append("InvoiceNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.InvoiceNo) + ",");
                MasterField.Append("TotalQty" + ",");
                if (MasterEntity.TotalQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.TotalQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

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

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

                MasterField.Append("FHTypeID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FHTypeID) + ",");
                MasterField.Append("KDNo" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.KDNo) + ",");
                MasterField.Append("DEFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DEFlag) + ",");
                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("VendorOPID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VendorOPID) + ",");
                MasterField.Append("VendorTel" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.VendorTel) + ",");
                MasterField.Append("Address" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Address) + ",");
                MasterField.Append("PackQty" + ",");
                if (MasterEntity.PackQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.PackQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

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

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

                MasterField.Append("Description" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Description) + ",");
                MasterField.Append("Destination" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Destination) + ",");
                MasterField.Append("RecordOPID1" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.RecordOPID1) + ",");
                MasterField.Append("RecordOPID2" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.RecordOPID2) + ",");
                MasterField.Append("RecordSBOPID1" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.RecordSBOPID1) + ",");
                MasterField.Append("RecordSBOPID2" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.RecordSBOPID2) + ",");
                MasterField.Append("RecordSBOPID3" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.RecordSBOPID3) + ",");
                MasterField.Append("RecordSBOPID4" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.RecordSBOPID4) + ",");
                MasterField.Append("RecordSBOPID5" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.RecordSBOPID5) + ",");
                MasterField.Append("RecordYSOPID1" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.RecordYSOPID1) + ",");
                MasterField.Append("DZQty" + ",");
                if (MasterEntity.DZQty != 0)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.DZQty) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

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

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

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

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

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

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

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

                MasterField.Append("ReadFlag" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ReadFlag) + ")");



                //执行
                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);
            }
        }
コード例 #28
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RSubmitInWH(List <BProductCheckDts> p_BE, string WHID, string SectionID, IDBTransAccess sqlTrans)
        {
            try
            {
                string CheckItem = GetListID(p_BE);
                //1检验是否入库
                string    sql = "SELECT StatusID,ID FROM WO_BProductCheckDts WHERE StatusID>" + (int)EnumBoxStatus.未入库 + " AND ID IN (" + CheckItem + ")";
                DataTable dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    BProductCheckDts entity = new BProductCheckDts(sqlTrans);
                    entity.ID = SysConvert.ToInt32(dt.Rows[0]["ID"]);
                    entity.SelectByID();
                    throw new Exception("条码" + entity.DISN + " 已经入库请检查");
                }

                //2校验通过,开始创建入库单。
                sql  = "SELECT ItemCode,ItemName,ItemStd,ItemModel,ColorNum,ColorName,JarNum,MF,KZ,ShopID,VendorID,SUM(Qty) Qty,SUM(YQty) Weight,DLever,CompactNo,SaleOPID,JSUnit FROM UV1_WO_BProductCheckDts WHERE DID IN(" + CheckItem + ")";
                sql += " GROUP BY ItemCode,ItemName,ItemStd,ItemModel,ColorNum,ColorName,JarNum,MF,KZ,ShopID,VendorID,DLever,CompactNo,SaleOPID,JSUnit";
                dt   = sqlTrans.Fill(sql);

                sql = "SELECT DISTINCT ShopID FROM UV1_WO_BProductCheckDts WHERE DID IN(" + CheckItem + ")";
                DataTable dtshop = sqlTrans.Fill(sql);//本次勾选的是那几家染厂的数据


                sql = "SELECT * FROM UV1_WO_BProductCheckDts WHERE DID IN(" + CheckItem + ")";

                DataTable dtall = sqlTrans.Fill(sql);

                foreach (DataRow drshop in dtshop.Rows)//一家染厂一个入库单
                {
                    IOForm IOentity = new IOForm(sqlTrans);

                    IOentity.FormDate = DateTime.Now.Date;

                    IOentity.WHID     = WHID;
                    IOentity.WHType   = WHID;
                    IOentity.HeadType = 11;
                    IOentity.SubType  = 1107;

                    IOentity.VendorID = drshop["ShopID"].ToString();

                    FormNoControlRule ruleno = new FormNoControlRule();
                    IOentity.FormNo = ruleno.RGetWHFormNo(IOentity.HeadType, IOentity.SubType, IOentity.WHID, sqlTrans);
                    IOentity.Remark = "检验后入库";

                    DataRow[]   Shopinwh  = dt.Select("ShopID=" + SysString.ToDBString(drshop["ShopID"].ToString()));//一家染厂多个缸号或品种
                    IOFormDts[] entitydts = new IOFormDts[Shopinwh.Length];
                    ArrayList   List      = new ArrayList();
                    int         i         = 0;
                    foreach (DataRow drinwh in Shopinwh)//一家染厂多个缸号或品种
                    {
                        entitydts[i]           = new IOFormDts(sqlTrans);
                        entitydts[i].Seq       = i + 1;
                        entitydts[i].WHID      = IOentity.WHID;
                        entitydts[i].SectionID = SectionID;
                        entitydts[i].SBitID    = "";

                        entitydts[i].ItemCode = drinwh["ItemCode"].ToString();
                        //entitydts[i].CPItemCode = entitydts[i].ItemCode;
                        entitydts[i].ItemName  = drinwh["ItemName"].ToString();
                        entitydts[i].ItemModel = drinwh["ItemName"].ToString();
                        entitydts[i].ItemStd   = drinwh["ItemStd"].ToString();
                        entitydts[i].ItemModel = drinwh["ItemModel"].ToString();
                        entitydts[i].ColorNum  = drinwh["ColorNum"].ToString();
                        entitydts[i].ColorName = drinwh["ColorName"].ToString();
                        entitydts[i].JarNum    = drinwh["JarNum"].ToString();

                        entitydts[i].MWeight = SysConvert.ToDecimal(drinwh["KZ"]);
                        entitydts[i].MWidth  = SysConvert.ToDecimal(drinwh["MF"]);

                        entitydts[i].DtsSO          = drinwh["CompactNo"].ToString();
                        entitydts[i].DtsOrderFormNo = drinwh["CompactNo"].ToString();
                        //entitydts[i].DtsOrderFormNo = drinwh["SO"].ToString();
                        //entitydts[i].InSO = drinwh["SO"].ToString();
                        entitydts[i].InSaleOPID  = drinwh["SaleOPID"].ToString();
                        entitydts[i].DtsVendorID = drinwh["VendorID"].ToString();
                        entitydts[i].GoodsLevel  = drinwh["DLever"].ToString();
                        entitydts[i].Qty         = SysConvert.ToDecimal(drinwh["Qty"]);
                        entitydts[i].Weight      = SysConvert.ToDecimal(drinwh["Weight"]);
                        entitydts[i].Remark      = "检验入成品库";
                        entitydts[i].Unit        = drinwh["JSUnit"].ToString();
                        entitydts[i].PackFlag    = 1;//细码标志
                        // ItemCode,ItemName,ItemStd,ColorNum,ColorName,JarNum,ShopID,VendorID,SUM(Qty) Qty,SUM(YQty) Weight,DLever,CompactNo,SO,SaleOPID
                        // ,,,,,,,,SUM(Qty) Qty,SUM(YQty) Weight,,,,

                        DataRow[] ISN = dtall.Select("ISNULL(ItemCode,'')=" + SysString.ToDBString(drinwh["ItemCode"].ToString())
                                                     + " AND ISNULL(ItemName,'')=" + SysString.ToDBString(drinwh["ItemName"].ToString())
                                                     + " AND ISNULL(ItemStd,'')=" + SysString.ToDBString(drinwh["ItemStd"].ToString())
                                                     + " AND ISNULL(ItemModel,'')=" + SysString.ToDBString(drinwh["ItemModel"].ToString())
                                                     + " AND ISNULL(ColorName,'')=" + SysString.ToDBString(drinwh["ColorName"].ToString())
                                                     + " AND ISNULL(ColorNum,'')=" + SysString.ToDBString(drinwh["ColorNum"].ToString())
                                                     + " AND ISNULL(JarNum,'')=" + SysString.ToDBString(drinwh["JarNum"].ToString())
                                                     //+ " AND ISNULL(MF,'')=" + SysString.ToDBString(drinwh["MF"].ToString())
                                                     //      + " AND ISNULL(KZ,'')=" + SysString.ToDBString(drinwh["KZ"].ToString())
                                                     + " AND ISNULL(ShopID,'')=" + SysString.ToDBString(dt.Rows[i]["ShopID"].ToString())
                                                     + " AND ISNULL(VendorID,'')=" + SysString.ToDBString(dt.Rows[i]["VendorID"].ToString())
                                                     + " AND ISNULL(DLever,'')=" + SysString.ToDBString(dt.Rows[i]["DLever"].ToString())
                                                     + " AND ISNULL(CompactNo,'')=" + SysString.ToDBString(dt.Rows[i]["CompactNo"].ToString())
                                                     + " AND ISNULL(SaleOPID,'')=" + SysString.ToDBString(dt.Rows[i]["SaleOPID"].ToString()));
                        entitydts[i].PieceQty = ISN.Length;

                        int m = 0;
                        foreach (DataRow dr in ISN)
                        {
                            IOFormDtsPack entity = new IOFormDtsPack(sqlTrans);
                            entity.Seq    = i + 1;
                            entity.SubSeq = m + 1;
                            entity.BoxNo  = dr["DISN"].ToString();

                            entity.Qty = SysConvert.ToDecimal(dr["Qty"]);

                            entity.Remark = "检验入成品库";
                            List.Add(entity);

                            m++;
                        }
                        i++;
                    }

                    decimal TotalQty = 0;
                    for (int j = 0; j < entitydts.Length; j++)
                    {
                        TotalQty += entitydts[j].Qty;
                    }

                    IOentity.TotalQty = TotalQty;



                    IOFormRule rule2 = new IOFormRule();
                    rule2.RAdd(IOentity, entitydts, List, sqlTrans);



                    rule2.RSubmit(IOentity.ID, (int)ConfirmFlag.已提交, sqlTrans);
                }

                //3更新条码状态(这步动作是在入库提交的时候处理)
                sql = "Update WO_BProductCheckDts Set InWHFlag=1 WHERE ID IN(" + CheckItem + ")";
                sqlTrans.ExecuteNonQuery(sql);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
コード例 #29
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                IOForm MasterEntity = (IOForm)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE WH_IOForm SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" FromIOFormID=" + SysString.ToDBString(MasterEntity.FromIOFormID) + ",");
                UpdateBuilder.Append(" CompanyTypeID=" + SysString.ToDBString(MasterEntity.CompanyTypeID) + ",");
                UpdateBuilder.Append(" WHTypeID=" + SysString.ToDBString(MasterEntity.WHTypeID) + ",");
                UpdateBuilder.Append(" FormNo=" + SysString.ToDBString(MasterEntity.FormNo) + ",");
                UpdateBuilder.Append(" HeadType=" + SysString.ToDBString(MasterEntity.HeadType) + ",");
                UpdateBuilder.Append(" SubType=" + SysString.ToDBString(MasterEntity.SubType) + ",");
                UpdateBuilder.Append(" VendorID=" + SysString.ToDBString(MasterEntity.VendorID) + ",");
                UpdateBuilder.Append(" OutDep=" + SysString.ToDBString(MasterEntity.OutDep) + ",");
                UpdateBuilder.Append(" Indep=" + SysString.ToDBString(MasterEntity.Indep) + ",");
                UpdateBuilder.Append(" WHOP=" + SysString.ToDBString(MasterEntity.WHOP) + ",");
                UpdateBuilder.Append(" PassOP=" + SysString.ToDBString(MasterEntity.PassOP) + ",");
                UpdateBuilder.Append(" DutyOP=" + SysString.ToDBString(MasterEntity.DutyOP) + ",");
                UpdateBuilder.Append(" SOID=" + SysString.ToDBString(MasterEntity.SOID) + ",");
                UpdateBuilder.Append(" SpecialNo=" + SysString.ToDBString(MasterEntity.SpecialNo) + ",");

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

                UpdateBuilder.Append(" CardNo=" + SysString.ToDBString(MasterEntity.CardNo) + ",");
                UpdateBuilder.Append(" ConfirmFlag=" + SysString.ToDBString(MasterEntity.ConfirmFlag) + ",");
                UpdateBuilder.Append(" CheckOP=" + SysString.ToDBString(MasterEntity.CheckOP) + ",");

                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(" WHID=" + SysString.ToDBString(MasterEntity.WHID) + ",");
                UpdateBuilder.Append(" WHType=" + SysString.ToDBString(MasterEntity.WHType) + ",");

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

                UpdateBuilder.Append(" LastUpdOP=" + SysString.ToDBString(MasterEntity.LastUpdOP) + ",");
                UpdateBuilder.Append(" DelFlag=" + SysString.ToDBString(MasterEntity.DelFlag) + ",");
                UpdateBuilder.Append(" SubmitFlag=" + SysString.ToDBString(MasterEntity.SubmitFlag) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");
                UpdateBuilder.Append(" JHCode=" + SysString.ToDBString(MasterEntity.JHCode) + ",");
                UpdateBuilder.Append(" XZ=" + SysString.ToDBString(MasterEntity.XZ) + ",");
                UpdateBuilder.Append(" SaleOPID=" + SysString.ToDBString(MasterEntity.SaleOPID) + ",");
                UpdateBuilder.Append(" DM=" + SysString.ToDBString(MasterEntity.DM) + ",");
                UpdateBuilder.Append(" InvoiceNo=" + SysString.ToDBString(MasterEntity.InvoiceNo) + ",");

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


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

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

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

                UpdateBuilder.Append(" FHTypeID=" + SysString.ToDBString(MasterEntity.FHTypeID) + ",");
                UpdateBuilder.Append(" KDNo=" + SysString.ToDBString(MasterEntity.KDNo) + ",");
                UpdateBuilder.Append(" DEFlag=" + SysString.ToDBString(MasterEntity.DEFlag) + ",");
                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(" VendorOPID=" + SysString.ToDBString(MasterEntity.VendorOPID) + ",");
                UpdateBuilder.Append(" VendorTel=" + SysString.ToDBString(MasterEntity.VendorTel) + ",");
                UpdateBuilder.Append(" Address=" + SysString.ToDBString(MasterEntity.Address) + ",");

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


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


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

                UpdateBuilder.Append(" Description=" + SysString.ToDBString(MasterEntity.Description) + ",");
                UpdateBuilder.Append(" Destination=" + SysString.ToDBString(MasterEntity.Destination) + ",");
                UpdateBuilder.Append(" RecordOPID1=" + SysString.ToDBString(MasterEntity.RecordOPID1) + ",");
                UpdateBuilder.Append(" RecordOPID2=" + SysString.ToDBString(MasterEntity.RecordOPID2) + ",");
                UpdateBuilder.Append(" RecordSBOPID1=" + SysString.ToDBString(MasterEntity.RecordSBOPID1) + ",");
                UpdateBuilder.Append(" RecordSBOPID2=" + SysString.ToDBString(MasterEntity.RecordSBOPID2) + ",");
                UpdateBuilder.Append(" RecordSBOPID3=" + SysString.ToDBString(MasterEntity.RecordSBOPID3) + ",");
                UpdateBuilder.Append(" RecordSBOPID4=" + SysString.ToDBString(MasterEntity.RecordSBOPID4) + ",");
                UpdateBuilder.Append(" RecordSBOPID5=" + SysString.ToDBString(MasterEntity.RecordSBOPID5) + ",");
                UpdateBuilder.Append(" RecordYSOPID1=" + SysString.ToDBString(MasterEntity.RecordYSOPID1) + ",");

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


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


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

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

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

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

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


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

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

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


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

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

                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);
            }
        }
コード例 #30
0
        /// <summary>
        /// 保存(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RSave(int p_ID, int p_MainID, int p_Seq, BaseEntity[] p_BE, bool p_UpdateFlag, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = "";
                if (p_UpdateFlag)                //修改状态下首先清除被删除的码单明细
                {
                    string idStr = string.Empty; //ID字符串
                    idStr = "0";
                    for (int i = 0; i < p_BE.Length; i++)
                    {
                        IOFormDtsPack entity = (IOFormDtsPack)p_BE[i];
                        if (entity.ID != 0)//有ID
                        {
                            if (idStr != string.Empty)
                            {
                                idStr += ",";
                            }
                            idStr += entity.ID.ToString();
                        }
                    }

                    if (idStr != string.Empty)
                    {
                        sql = "DELETE FROM WH_PackBox WHERE BoxNo IN (SELECT BoxNo FROM WH_IOFormDtsPack WHERE DID=" + SysString.ToDBString(p_ID) + " AND ID NOT IN(" + idStr + ") )";
                        sqlTrans.ExecuteNonQuery(sql);                                                                                  //执行条形码删除

                        sql = "DELETE FROM WH_IOFormDtsPack WHERE DID=" + SysString.ToDBString(p_ID) + " AND ID NOT IN(" + idStr + ")"; //WH_IOFormDtsPack WH_PackBox
                        sqlTrans.ExecuteNonQuery(sql);
                    }
                }
                else//新增状态
                {
                    sql = "SELECT TOP 1 ID FROM WH_IOFormDtsPack WHERE DID=" + SysString.ToDBString(p_ID);
                    DataTable dt = sqlTrans.Fill(sql);
                    if (dt.Rows.Count > 0)
                    {
                        throw new BaseException("不能重复保存!");
                    }
                }


                IOForm p_Main = new IOForm(sqlTrans);
                p_Main.ID = p_MainID;
                p_Main.SelectByID();

                IOFormDts p_MainDts = new IOFormDts(sqlTrans);
                p_MainDts.ID = p_ID;
                p_MainDts.SelectByID();



                IOFormDtsPackRule rule     = new IOFormDtsPackRule();
                PackBoxRule       Brule    = new PackBoxRule();
                decimal           Qty      = 0;
                decimal           PieceQty = 0;
                for (int i = 0; i < p_BE.Length; i++)
                {
                    FormNoControlRule frule  = new FormNoControlRule();
                    IOFormDtsPack     entity = (IOFormDtsPack)p_BE[i];
                    int boxNoCreateTypeID    = 0;//箱号条码来源
                    if (entity.ID == 0)
                    {
                        if (entity.BoxNo == string.Empty)//没有箱号条码
                        {
                            entity.BoxNo = frule.RGetFormNo((int)FormNoControlEnum.码单箱号, sqlTrans);
                            rule.RAdd(entity, sqlTrans);
                            frule.RAddSort((int)FormNoControlEnum.码单箱号, sqlTrans);
                        }
                        else//有箱号条码说明是验布产生的条码
                        {
                            boxNoCreateTypeID = 1;//验布来源
                        }
                    }
                    else
                    {
                        rule.RUpdate(entity, sqlTrans);
                    }


                    PackBox entityBox = new PackBox();
                    if (entity.ID != 0)//仓库明细已生成,则寻找箱号ID 此处判断其实无意义,经过上面的代码肯定有ID值了
                    {
                        sql = "SELECT ID FROM WH_PackBox WHERE BoxNo=" + SysString.ToDBString(entity.BoxNo);
                        DataTable dtPackBox = sqlTrans.Fill(sql);
                        if (dtPackBox.Rows.Count != 0)//如果找到条码
                        {
                            entityBox.ID = SysConvert.ToInt32(dtPackBox.Rows[0]["ID"]);
                        }
                        else//如果未找到条码
                        {
                            entityBox.CreateSourceID = boxNoCreateTypeID;////原始条码表加个字段表示来源 0:表示入库录入
                        }
                    }
                    entityBox.BoxNo         = entity.BoxNo;
                    entityBox.WHID          = p_MainDts.WHID;
                    entityBox.SectionID     = p_MainDts.SectionID;
                    entityBox.SBitID        = p_MainDts.SBitID;
                    entityBox.ColorName     = p_MainDts.ColorName;
                    entityBox.ColorNum      = p_MainDts.ColorNum;
                    entityBox.CompanyTypeID = p_MainDts.CompanyTypeID;
                    entityBox.GoodsCode     = p_MainDts.GoodsCode;
                    entityBox.GoodsLevel    = p_MainDts.GoodsLevel;
                    entityBox.ItemCode      = p_MainDts.ItemCode;
                    entityBox.ItemName      = p_MainDts.ItemName;
                    entityBox.ItemStd       = p_MainDts.ItemStd;
                    entityBox.JarNum        = p_MainDts.JarNum;
                    entityBox.Batch         = p_MainDts.Batch;
                    entityBox.VendorBatch   = p_MainDts.VendorBatch;
                    entityBox.MWeight       = p_MainDts.MWeight;
                    entityBox.MWidth        = p_MainDts.MWidth;
                    entityBox.Qty           = entity.Qty;
                    entityBox.Unit          = p_MainDts.Unit;
                    entityBox.BoxStatusID   = (int)EnumBoxStatus.未入库;
                    entityBox.DID           = p_ID;
                    entityBox.InFormNo      = p_Main.FormNo;
                    entityBox.OrderFormNo   = p_MainDts.DtsOrderFormNo;//合同号明细


                    if (entityBox.ID == 0)//没有ID则新增
                    {
                        Brule.RAdd(entityBox, sqlTrans);
                    }
                    else//有ID则修改
                    {
                        Brule.RUpdate(entityBox, sqlTrans);
                    }

                    Qty += entity.Qty;
                    PieceQty++;
                }

                //if (PieceQty == 0)
                //{
                //    throw new BaseException("请填写细码后点击保存");
                //}

                sql  = "UPDATE WH_IOFormDts SET Qty=" + SysString.ToDBString(Qty);
                sql += ",PieceQty=" + SysString.ToDBString(PieceQty);
                sql += ",PackFlag=1 ";
                sql += " WHERE ID=" + SysString.ToDBString(p_ID);
                sqlTrans.ExecuteNonQuery(sql);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }