Beispiel #1
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);
                PackOrder entity = (PackOrder)p_BE;

                string sql = "SELECT * FROM WO_PackOrder WHERE FormNo=" + SysString.ToDBString(entity.FormNo);
                if (sqlTrans.Fill(sql).Rows.Count != 0)
                {
                    throw new Exception("单号" + entity.FormNo + "已存在,请检查");
                }

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



                FormNoControlRule fnrule = new FormNoControlRule();
                fnrule.RAddSort("WO_PackOrder", "FormNo", sqlTrans);

                //FormNoControlRule FRule = new FormNoControlRule();
                //FRule.RAddSort((int)FormNoControlEnum.包装单号, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Beispiel #2
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);
                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);
            }
        }
Beispiel #3
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);
                PackBox    entity  = (PackBox)p_BE;
                PackBoxCtl control = new PackBoxCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WH_PackBox, sqlTrans);
                if (entity.BoxNo == string.Empty)//条码号不存在
                {
                    entity.CreateTime = DateTime.Now;

                    FormNoControlRule rulest = new FormNoControlRule();

                    //处理生成箱号
                    entity.BoxNo = rulest.RGetFormNo((int)FormNoControlEnum.码单箱号, sqlTrans);
                    rulest.RAddSort((int)FormNoControlEnum.码单箱号, sqlTrans);
                }
                else//已存在
                {
                    string sql = "SELECT BoxNo FROM WH_PackBox WHERE BoxNo=" + SysString.ToDBString(entity.BoxNo);
                    if (sqlTrans.Fill(sql).Rows.Count != 0)//条码号已存在,则生成新条码
                    {
                        entity.CreateTime = DateTime.Now;

                        FormNoControlRule rulest = new FormNoControlRule();

                        //处理生成箱号
                        entity.BoxNo = rulest.RGetFormNo((int)FormNoControlEnum.码单箱号, sqlTrans);
                        rulest.RAddSort((int)FormNoControlEnum.码单箱号, sqlTrans);
                    }
                }

                control.AddNew(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Beispiel #4
0
        /// <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);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                ReportManage    entity  = (ReportManage)p_BE;
                ReportManageCtl control = new ReportManageCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Data_ReportManage, sqlTrans);
                control.AddNew(entity);

                FormNoControlRule noControlRule = new FormNoControlRule();
                noControlRule.RAddSort((int)FormNoControlEnum.报表流水号, sqlTrans);
                //noControlRule.RAddSort(   ("Data_ReportManage", "FileName", sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
        /// <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);
            }
        }
        /// <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);
            }
        }
Beispiel #8
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.RAdd(p_BE, sqlTrans);
                IOForm        entity  = (IOForm)p_BE;
                IOFormDtsRule ruledts = new IOFormDtsRule();
                for (int i = 0; i < p_BE2.Length; i++)
                {
                    IOFormDts entityDts = (IOFormDts)p_BE2[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    ruledts.RAdd(entityDts, sqlTrans);
                }

                //ruledts.RSave((IOForm)p_BE, p_BE2, sqlTrans);//保存从表
                //FormNoControlRule rulest = new FormNoControlRule();
                //rulest.RAddSort((int)FormNoControlEnum.入库单号,sqlTrans);


                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);

                #region 加载自动保存

                //sql = "SELECT * FROM Enum_FormList WHERE ID=" + SysString.ToDBString(entity.SubType);
                //dt = sqlTrans.Fill(sql);
                //if (dt.Rows.Count != 0)
                //{
                //    int saveLoadFormType = SysConvert.ToInt32(dt.Rows[0]["LoadFormTypeID"]);
                //    if (saveLoadFormType == (int)LoadFormType.送货单)
                //    {
                //        sql = "SELECT LoadDtsID,ID,Seq FROM WH_IOFormDts WHERE MainID=" + SysString.ToDBString(entity.ID);
                //        dt = sqlTrans.Fill(sql);
                //        for (int i = 0; i < dt.Rows.Count; i++)
                //        {
                //            int LoadDtsID = SysConvert.ToInt32(dt.Rows[i]["LoadDtsID"]);
                //            int Seq = SysConvert.ToInt32(dt.Rows[i]["Seq"]);
                //            int ID = SysConvert.ToInt32(dt.Rows[i]["ID"]);
                //            int SubSeq = 1;
                //            if (LoadDtsID > 0)
                //            {
                //                sql = "SELECT * FROM Sale_FHFormDtsPack WHERE DID=" + SysString.ToDBString(LoadDtsID);
                //                DataTable dtfh = sqlTrans.Fill(sql);

                //                for (int j = 0; j < dtfh.Rows.Count; j++)
                //                {
                //                    IOFormDtsPackRule rulePack = new IOFormDtsPackRule();
                //                    IOFormDtsPack entityPack = new IOFormDtsPack();
                //                    entityPack.MainID = entity.ID;
                //                    entityPack.Seq = Seq;
                //                    entityPack.DID = ID;
                //                    entityPack.SubSeq = SubSeq;
                //                    entityPack.BoxNo = SysConvert.ToString(dtfh.Rows[j]["BoxNo"]);
                //                    entityPack.Remark = SysConvert.ToString(dtfh.Rows[j]["BoxNo"]);
                //                    entityPack.Qty = SysConvert.ToDecimal(dtfh.Rows[j]["Qty"]);
                //                    SubSeq++;
                //                    rulePack.RAdd(entityPack,sqlTrans);

                //                }
                //            }
                //        }

                //    }
                //}


                #endregion
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }