博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何利用极致业务基础平台做一个通用企业ERP之十一销售出库单设计
阅读量:5285 次
发布时间:2019-06-14

本文共 31139 字,大约阅读时间需要 103 分钟。

1.销售出库单设计界面如下:

要求实现功能点:

1界面本身和销售订单界面类似,比如一些初始值,可以实现选单,实现下推。

2审核的时候更改即时库存,并生成应收应收清单。

3反审核的时候判断应收清单是否有相应的收款记录,如果没有,则回写即时库存审核前状态,并删除这条应收记录。

客户端代码如下:

///     /// 销售出库单    ///     class SaleChuku : SCMBaseBill    {        //控件声明定义        private Jeez.Control.JeezUltraTextBox.JeezUltraTextBox txWLDW;//往来单位        private Jeez.Control.JeezUltraTextBox.JeezUltraTextBox txOrg;//组织机构        private Jeez.Control.JeezUltraTextBox.JeezUltraTextBox txDept;//部门        private Jeez.Control.JeezUltraTextBox.JeezUltraTextBox txEmployee;//业务员        private Jeez.Control.JeezUltraTextBox.JeezUltraTextBox txBibie;//币别        private Jeez.Control.JeezNumberTextBox.JeezNumberTextBox txRat;//汇率        private Jeez.Control.JeezCurrencyTextBox.JeezCurrencyTextBox txYBMoney;//原币金额        private Jeez.Control.JeezCurrencyTextBox.JeezCurrencyTextBox txYBYF;//原币运费        private Jeez.Control.JeezCurrencyTextBox.JeezCurrencyTextBox txRMBMoney;//人民币金额        private Jeez.Control.JeezCurrencyTextBox.JeezCurrencyTextBox txRMBYF;//人民币运费        private Jeez.Control.JeezUltraCalendarCombo.JeezUltraCalendarCombo dtDate;//日期        private Jeez.Control.JeezGrid.JeezGrid gridZY;//明细grid        private Jeez.Control.JeezUltraTabControl.JeezUltraTabControl pagecontrol1 = null;//下方页框控件        private Jeez.Control.JeezGrid.JeezGrid gridKucun;//库存        private Jeez.Control.JeezGrid.JeezGrid gridBaojiaHistory;//历史报价        private bool isLoading = true;        //定义几个初始化常见的值        private static int BibieID = 0;//默认币别ID        private static int WLDWID = 0;//默认往来单位ID        private static bool IsNext = false;//是否下推,下推过来的数据,单价不参与计算        ///         /// 加载控件,以及控件相关事件定义        ///         /// 
public override bool LoadUI() { bool b = base.LoadUI(); if (b) { txWLDW = base.GetControlByName("JeezTextBox5") as Jeez.Control.JeezUltraTextBox.JeezUltraTextBox; txOrg = base.GetControlByName("JeezTextBox3") as Jeez.Control.JeezUltraTextBox.JeezUltraTextBox; txDept = base.GetControlByName("JeezTextBox4") as Jeez.Control.JeezUltraTextBox.JeezUltraTextBox; txEmployee = base.GetControlByName("JeezTextBox6") as Jeez.Control.JeezUltraTextBox.JeezUltraTextBox; txBibie = base.GetControlByName("JeezTextBox8") as Jeez.Control.JeezUltraTextBox.JeezUltraTextBox; txRat = base.GetControlByName("JeezNumberTextBox1") as Jeez.Control.JeezNumberTextBox.JeezNumberTextBox; txYBMoney = base.GetControlByName("JeezCurrencyTextBox1") as Jeez.Control.JeezCurrencyTextBox.JeezCurrencyTextBox; txYBYF = base.GetControlByName("JeezCurrencyTextBox2") as Jeez.Control.JeezCurrencyTextBox.JeezCurrencyTextBox; txRMBMoney = base.GetControlByName("JeezCurrencyTextBox3") as Jeez.Control.JeezCurrencyTextBox.JeezCurrencyTextBox; txRMBYF = base.GetControlByName("JeezCurrencyTextBox4") as Jeez.Control.JeezCurrencyTextBox.JeezCurrencyTextBox; gridZY = base.GetControlByName("JeezGrid1") as Jeez.Control.JeezGrid.JeezGrid; dtDate = base.GetControlByName("JeezCalendarCombo1") as Jeez.Control.JeezUltraCalendarCombo.JeezUltraCalendarCombo; pagecontrol1 = base.GetControlByName("JeezTabControl1") as Jeez.Control.JeezUltraTabControl.JeezUltraTabControl; gridKucun = base.GetControlByName("gridKucun") as Jeez.Control.JeezGrid.JeezGrid; gridBaojiaHistory = base.GetControlByName("gridRefHistory") as Jeez.Control.JeezGrid.JeezGrid; } return b; } protected override void BillUI_Load(object sender, EventArgs e) { base.BillUI_Load(sender, e); if (this.entityobject == null) { //装载报价单下推过来的数据 if (UserData != null && UserData is Hashtable) { this.gridZY.RowCount = 0; Hashtable ht = UserData as Hashtable; ArrayList arr = ht["DetailList"] as ArrayList; EntityObjectFactory eof = EntityObjectFactory.GetInstance(objContext, EntityIDEnum.SaleOrderDetail); int i = 0; foreach (Hashtable htv in arr) { EntityObject eoChild = eof.FindObject(Convert.ToInt32(htv["DetailID"])); this.gridZY.InsertRow(i); this.gridZY.Rows[i].Cells["UpBillNo"].Value = eoChild.GetRelatedObject("SaleOrderID").GetProperty("BillNO"); EntityObject eoOrder = eoChild.GetRelatedObject("SaleOrderID"); if (eoOrder != null && i == 0) { //保证只执行一次 txOrg.Tag = eoOrder.GetRelatedObject("OrganizationID").PrimaryKeyValue; txOrg.VALUE = eoOrder.GetRelatedObject("OrganizationID").ToString(); txDept.Tag = eoOrder.GetRelatedObject("DepartMentID").PrimaryKeyValue; txDept.VALUE = eoOrder.GetRelatedObject("DepartMentID").ToString(); txWLDW.Tag = eoOrder.GetRelatedObject("RefUnitID").PrimaryKeyValue; txWLDW.VALUE = eoOrder.GetRelatedObject("RefUnitID").ToString(); txEmployee.Tag = eoOrder.GetRelatedObject("EmployeeID").PrimaryKeyValue; txEmployee.VALUE = eoOrder.GetRelatedObject("EmployeeID").ToString(); txBibie.Tag = eoOrder.GetRelatedObject("CurrencyID").PrimaryKeyValue; txBibie.VALUE = eoOrder.GetRelatedObject("CurrencyID").ToString(); txRat.PropertyPage.Value = (decimal)eoOrder.GetProperty("Rate"); txYBMoney.PropertyPage.Value = (decimal)eoOrder.GetProperty("Amount"); txRMBMoney.PropertyPage.Value = (decimal)eoOrder.GetProperty("RAmount"); txYBYF.PropertyPage.Value = (decimal)eoOrder.GetProperty("YAmount"); txRMBYF.PropertyPage.Value = (decimal)eoOrder.GetProperty("RYAmount"); } this.gridZY.Rows[i].Cells["MatID"].Tag = eoChild.GetRelatedObject("MatID").PrimaryKeyValue; this.gridZY.Rows[i].Cells["MatID"].Value = eoChild.GetRelatedObject("MatID").ToString(); this.gridZY.Rows[i].Cells["JiliangdanweiID"].Tag = eoChild.GetRelatedObject("JiliangdanweiID").PrimaryKeyValue; this.gridZY.Rows[i].Cells["JiliangdanweiID"].Value = eoChild.GetRelatedObject("JiliangdanweiID").ToString(); this.gridZY.Rows[i].Cells["Danjia"].Value = eoChild.GetProperty("Danjia"); this.gridZY.Rows[i].Cells["UpMany"].Value = eoChild.GetProperty("Many"); this.gridZY.Rows[i].Cells["SMany"].Value = eoChild.GetProperty("SMany"); this.gridZY.Rows[i].Cells["Many"].Value = htv["Many"]; this.gridZY.Rows[i].Cells["RDanjia"].Value = eoChild.GetProperty("RDanjia"); this.gridZY.Rows[i].Cells["Amount"].Value = (decimal)eoChild.GetProperty("Danjia") * (decimal)htv["Many"]; ; this.gridZY.Rows[i].Cells["RAmount"].Value = (decimal)eoChild.GetProperty("Danjia") * (decimal)htv["Many"] *(decimal)eoOrder.GetProperty("Rate"); this.gridZY.Rows[i].Cells["SaleOrderDetailID"].Value = eoChild.PrimaryKeyValue; this.gridZY.Rows[i].Cells["Date"].Value = eoChild.GetProperty("Date"); ; i++; } this.UserData = null; } else { InitByDefineOrder(); } } } /// /// 指定服务端调用的类 /// /// /// protected override void SetInvokeBusiLogicName(out string ServerDllName, out string ServerClassName) { ServerDllName = "FolyerERPServer.dll"; ServerClassName = "FolyerERPServer.FolyerERPServer_SCM.SaleChukuServer"; } /// /// 设置默认值 /// void InitByDefineOrder() { if (!Jeez.Common.UI.AccessControl.CheckACLWithNoMsg(EntityRightIDEnum.销售出库管理查看价格)) { this.gridZY.Rows.Band.Columns["Danjia"].Hidden = true; this.gridZY.Rows.Band.Columns["Amount"].Hidden = true; this.gridZY.Rows.Band.Columns["RDanjia"].Hidden = true; this.gridZY.Rows.Band.Columns["RAmount"].Hidden = true; txRMBMoney.Visible = false; txRMBYF.Visible = false; txYBMoney.Visible = false; txYBYF.Visible = false; } else { this.gridZY.Rows.Band.Columns["Danjia"].Hidden = false; this.gridZY.Rows.Band.Columns["Amount"].Hidden = false; this.gridZY.Rows.Band.Columns["RDanjia"].Hidden = false; this.gridZY.Rows.Band.Columns["RAmount"].Hidden = false; txRMBMoney.Visible = true; txRMBYF.Visible = true; txYBMoney.Visible = true; txYBYF.Visible = true; } } protected override void LoadEntityDataToControl() { base.LoadEntityDataToControl(); InitByDefineOrder(); } }
View Code

服务端代码如下:

///     /// 销售出库服务端类    ///     class SaleChukuServer : SCMBaseServer    {        protected override bool CheckValidate(EntityObject eo, bool IsCheck, ref string strMessage)        {            bool b = base.CheckValidate(eo, IsCheck, ref strMessage);            if (b)            {                if (IsCheck)                {                     //审核执行自己的业务逻辑扣库存动作,生成应收清单                    //更新即时库存表数据                    EntityObjectList eolDetail = eo.GetChildEntityObjects(EntityIDEnum.SaleChukuDetail);//明细物料                    EntityObjectFactory eof = EntityObjectFactory.GetInstance(this.Context, EntityIDEnum.NowKucun);//库存                     foreach (EntityObject eoDetail in eolDetail)                    {                        EntityObject eoMalUpdate = eof.FindFirst("MatID={0} and WareHouseID={1} and JiliangdanweiID={2} ", eoDetail.GetProperty("MatID"), eoDetail.GetProperty("WareHouseID"), eoDetail.GetProperty("JiliangdanweiID"));                        float currentQty = 0f;                        float currentAmount = 0f;                        if (eoMalUpdate != null)                        {                            currentQty = float.Parse(eoMalUpdate.GetProperty("Many").ToString());                            currentAmount = float.Parse(eoMalUpdate.GetProperty("Amount").ToString());                            if (currentQty >= float.Parse(eoDetail.GetProperty("Many").ToString()))                            {                                eoMalUpdate.SetProperty("Many", currentQty - float.Parse(eoDetail.GetProperty("Many").ToString()));                                eoMalUpdate.SetProperty("Amount", currentAmount - float.Parse(eoDetail.GetProperty("Amount").ToString()));                                if ((currentQty - float.Parse(eoDetail.GetProperty("Many").ToString())) != 0)                                    eoMalUpdate.SetProperty("Danjia", (currentAmount - float.Parse(eoDetail.GetProperty("Amount").ToString())) / (currentQty - float.Parse(eoDetail.GetProperty("Many").ToString())));                            }                        }                        else                        {                            strMessage = string.Format("库存里面没有该物料{0},无法出库", eoDetail.GetRelatedObject("MatID").ToString());                            return false;                         }                     }                    //生成应收清单                    EntityObjectFactory eofYingshou = EntityObjectFactory.GetInstance(Context, EntityIDEnum.Yingshou);                    EntityObject eoYingshou = eofYingshou.CreateObject();                    eoYingshou.SetProperty("OrganizationID", eo.GetProperty("OrganizationID"));                    eoYingshou.SetProperty("BillNo", eo.GetProperty("BillNo"));                    eoYingshou.SetProperty("BillID", eo.PrimaryKeyValue);                    eoYingshou.SetProperty("BillName", "销售出库单");                    eoYingshou.SetProperty("RefUnitID", eo.GetProperty("RefUnitID"));                    eoYingshou.SetProperty("Amount", eo.GetProperty("Amount"));                    eoYingshou.SetProperty("CurrencyID", eo.GetProperty("CurrencyID"));                    eoYingshou.SetProperty("Rate", eo.GetProperty("Rate"));                    eoYingshou.SetProperty("YAmount", 0m);                    eoYingshou.SetProperty("WAmount", eo.GetProperty("Amount"));                    eoYingshou.SetProperty("Description", "出库单审核自动产生");                    eoYingshou.SetProperty("WAmount", eo.GetProperty("Amount"));                    if (eo.GetRelatedObject("EmployeeID")!=null)                    eoYingshou.SetProperty("EmployeeID", eo.GetRelatedObject("EmployeeID").GetProperty("Name"));                    eoYingshou.SetProperty("Type", 0);                    Context.SaveChanges();                    return true;                }                else                {                    //反审核执行自己业务逻辑,如果已经下推了,不允许反审核                                        if (!ERPServerFunc.IsNextBill(Context, eo, EntityIDEnum.SaleRukuDetail,EntityIDEnum.SaleChukuDetail, "SaleRukuID", "SaleChukuDetailID", ref strMessage))                        return false;                    if(!ERPServerFunc.IsExitPOPA(Context,eo,EntityIDEnum.Yingshou,"销售出库单",ref strMessage))                        return false;                    if (Convert.ToInt32(eo.GetProperty("UseFlag").ToString()) == 1)                    {                        strMessage = "库存已经有占用,不允许反审核,请先释放占用在反审核";                        return false;                    }                    eo.SetProperty("UseFlag", 0);//反审核后恢复占用标识                    Context.SaveChanges();                }            }            return b;        }        ///         /// 更新价格,从单据上过来的        ///         public object UpadatePrice(int entiyID)        {            StringBuilder strResult = new StringBuilder();            try            {                //先获取当前传过来的id                EntityObjectFactory eofParent = EntityObjectFactory.GetInstance(this.Context, EntityIDEnum.SaleOrder);                EntityObject eoParent = eofParent.FindObject(entiyID);                EntityObjectList eolChildDetail = eoParent.GetChildEntityObjects(EntityIDEnum.SaleOrderDetail);                //获取销售价格表                EntityObjectFactory eofSalePrice = EntityObjectFactory.GetInstance(this.Context, EntityIDEnum.MatSalePrice);                int WLDWID = (int)eoParent.GetRelatedObject("RefUnitID").PrimaryKeyValue;                int BIBIEID = (int)eoParent.GetRelatedObject("CurrencyID").PrimaryKeyValue;                foreach (EntityObject eoChild in eolChildDetail)                {                    int UnitID = (int)eoChild.GetRelatedObject("JiliangdanweiID").PrimaryKeyValue;                    int MatID = (int)eoChild.GetRelatedObject("MatID").PrimaryKeyValue;                    EntityObject eoSalePrice = eofSalePrice.FindFirst("RefUnitID={0} and CurrencyID={1} and JiliangdanweiID={2} and MatID={3}", WLDWID, BIBIEID, UnitID, MatID);                    if (eoSalePrice == null)                    {                        //如果没有价格记录                        //添加本次价格记录                        eoSalePrice = eofSalePrice.CreateObject();                        eoSalePrice.SetProperty("MatID", MatID);                        eoSalePrice.SetProperty("RefUnitID", WLDWID);                        eoSalePrice.SetProperty("jiliangdanweiID", UnitID);                        eoSalePrice.SetProperty("CurrencyID", BIBIEID);                        eoSalePrice.SetProperty("MinQty", 1.0m);                        eoSalePrice.SetProperty("Date", eoParent.GetProperty("Date"));                        eoSalePrice.SetProperty("Danjia", eoChild.GetProperty("Danjia"));                        eoSalePrice.SetProperty("Description", string.Format("销售订单{0}更新而产生", eoParent.GetProperty("BillNo")));                        strResult.AppendLine(string.Format(@"物料:{0}单位:{1}:币别:{2}价格更新成功!", eoSalePrice.GetRelatedObject("MatID").ToString(), eoSalePrice.GetRelatedObject("JiliangdanweiID").ToString(), eoSalePrice.GetRelatedObject("CurrencyID").ToString()));                    }                    else                    {                        strResult.AppendLine(string.Format(@"物料:{0}单位:{1}:币别:{2}价格已经存在,无法更新!", eoSalePrice.GetRelatedObject("MatID").ToString(), eoSalePrice.GetRelatedObject("JiliangdanweiID").ToString(), eoSalePrice.GetRelatedObject("CurrencyID").ToString()));                    }                }                Context.SaveChanges();            }            catch (Exception ex)            {                return ex.Message;            }            return strResult.ToString();        }        ///         /// 更新价格,从一览表上过来的        ///         public object UpadatePrice(Hashtable ht)        {            StringBuilder strResult = new StringBuilder();            try            {                ArrayList arr = (ArrayList)ht["childID"];                int i = arr.Count; ;                for (int j = 0; j < i; j++)                {                    //先获取当前传过来的id                    int childID = Convert.ToInt32(arr[j].ToString());                    EntityObject eoDetail = EntityObjectFactory.GetInstance(Context, EntityIDEnum.SaleOrderDetail).FindObject(childID);                    //获取销售价格表                    EntityObjectFactory eofSalePrice = EntityObjectFactory.GetInstance(this.Context, EntityIDEnum.MatSalePrice);                    int WLDWID = (int)eoDetail.GetRelatedObject("SaleOrderID").GetRelatedObject("RefUnitID").PrimaryKeyValue;                    int BIBIEID = (int)eoDetail.GetRelatedObject("SaleOrderID").GetRelatedObject("CurrencyID").PrimaryKeyValue;                    int UnitID = (int)eoDetail.GetRelatedObject("JiliangdanweiID").PrimaryKeyValue;                    int MatID = (int)eoDetail.GetRelatedObject("MatID").PrimaryKeyValue;                    EntityObject eoSalePrice = eofSalePrice.FindFirst("RefUnitID={0} and CurrencyID={1} and JiliangdanweiID={2} and MatID={3}", WLDWID, BIBIEID, UnitID, MatID);                    if (eoSalePrice == null)                    {                        //如果没有价格记录                        //添加本次价格记录                        eoSalePrice = eofSalePrice.CreateObject();                        eoSalePrice.SetProperty("MatID", MatID);                        eoSalePrice.SetProperty("RefUnitID", WLDWID);                        eoSalePrice.SetProperty("jiliangdanweiID", UnitID);                        eoSalePrice.SetProperty("CurrencyID", BIBIEID);                        eoSalePrice.SetProperty("MinQty", 1.0m);                        eoSalePrice.SetProperty("Date", eoDetail.GetRelatedObject("SaleBaojiaID").GetProperty("Date"));                        eoSalePrice.SetProperty("Danjia", eoDetail.GetProperty("Danjia"));                        eoSalePrice.SetProperty("Description", string.Format("销售报价单{0}更新而产生", eoDetail.GetRelatedObject("SaleBaojiaID").GetProperty("BillNo")));                        strResult.AppendLine(string.Format(@"物料:{0}单位:{1}:币别:{2}价格更改成功!", eoSalePrice.GetRelatedObject("MatID").ToString(), eoSalePrice.GetRelatedObject("JiliangdanweiID").ToString(), eoSalePrice.GetRelatedObject("CurrencyID").ToString()));                    }                    else                    {                        strResult.AppendLine(string.Format(@"物料:{0}单位:{1}:币别:{2}价格已经存在,无法更新!", eoSalePrice.GetRelatedObject("MatID").ToString(), eoSalePrice.GetRelatedObject("JiliangdanweiID").ToString(), eoSalePrice.GetRelatedObject("CurrencyID").ToString()));                    }                }                Context.SaveChanges();            }            catch (Exception ex)            {                return ex.Message;            }            return strResult.ToString();        }        ///         /// 占用库存,从单据上过来的        ///         public object UseKucun(int entiyID)        {            //先获取当前传过来的id            EntityObjectFactory eofOrder = EntityObjectFactory.GetInstance(this.Context, EntityIDEnum.SaleChukuBill);            EntityObject eoOrder = eofOrder.FindObject(entiyID);            try            {                if ((int)eoOrder.GetProperty("UseFlag") == 1)                {                    return string.Format(@"销售出库单号:{0}库存已经占用,请不要重新占用!", eoOrder.GetProperty("BillNo"));                }                else if ((int)eoOrder.GetProperty("UseFlag") == 2)                {                    return string.Format(@"销售出库单号:{0}库存释放占用,请不要重新占用!", eoOrder.GetProperty("BillNo"));                }                else                {                    EntityObjectList eolChild = eoOrder.GetChildEntityObjects(EntityIDEnum.SaleChukuDetail);                    //获取即时库存表                    EntityObjectFactory eofKucun = EntityObjectFactory.GetInstance(this.Context, EntityIDEnum.NowKucun);                    StringBuilder strResult = new StringBuilder();                    foreach (EntityObject eoChild in eolChild)                    {                        int UnitID = (int)eoChild.GetRelatedObject("JiliangdanweiID").PrimaryKeyValue;                        int MatID = (int)eoChild.GetRelatedObject("MatID").PrimaryKeyValue;                        EntityObject eoKucun = eofKucun.FindFirst("JiliangdanweiID={0} and MatID={1}", UnitID, MatID);                        if (eoKucun == null)                        {                            //如果没有库存记录                            strResult.AppendLine(string.Format(@"{0}在库存中没有记录", eoChild.GetRelatedObject("MatID").ToString()));                        }                        else                        {                            decimal oldUseflag = (decimal)eoKucun.GetProperty("CUseMany");                            eoKucun.SetProperty("CUseMany", oldUseflag + (decimal)eoChild.GetProperty("Many"));                        }                    }                    if (strResult.ToString() == "")                    {   //如果更新成功,则统一占用                        eoOrder.SetProperty("UseFlag", 1);                        Context.SaveChanges();                    }                    else                    {                        return strResult.ToString();                    }                }            }            catch (Exception ex)            {                return ex.Message;            }            return string.Format(@"销售出库单号:{0}库存占用成功!", eoOrder.GetProperty("BillNo"));        }        ///         /// 占用库存,从一览表上过来的        ///         public object UseKucun(Hashtable ht)        {            StringBuilder strResult = new StringBuilder();            try            {                ArrayList arr = (ArrayList)ht["childID"];                int i = arr.Count; ;                for (int j = 0; j < i; j++)                {                    //先获取当前传过来的id                    int childID = Convert.ToInt32(arr[j].ToString());                    EntityObject eoDetail = EntityObjectFactory.GetInstance(Context, EntityIDEnum.SaleChukuDetail).FindFirst("ID={0}", childID);                    if (eoDetail != null)                    {                        string str = (string)UseKucun(Convert.ToInt32(eoDetail.GetProperty("SaleChukuID").ToString()));                        strResult.AppendLine(str);                    }                }            }            catch (Exception ex)            {                return ex.Message;            }            return strResult.ToString();        }        ///         /// 释放库存,从单据上过来的        ///         public object NoUseKucun(int entiyID)        {            //先获取当前传过来的id            EntityObjectFactory eofOrder = EntityObjectFactory.GetInstance(this.Context, EntityIDEnum.SaleChukuBill);            EntityObject eoOrder = eofOrder.FindObject(entiyID);            try            {                if ((int)eoOrder.GetProperty("UseFlag") == 2)                {                    return string.Format(@"销售出库单{0}库存已经释放占用,请不要重新释放占用!", eoOrder.GetProperty("BillNo"));                }                else                {                    EntityObjectList eolChild = eoOrder.GetChildEntityObjects(EntityIDEnum.SaleChukuDetail);                    //获取即时库存表                    EntityObjectFactory eofKucun = EntityObjectFactory.GetInstance(this.Context, EntityIDEnum.NowKucun);                    StringBuilder strResult = new StringBuilder();                    foreach (EntityObject eoChild in eolChild)                    {                        int UnitID = (int)eoChild.GetRelatedObject("JiliangdanweiID").PrimaryKeyValue;                        int MatID = (int)eoChild.GetRelatedObject("MatID").PrimaryKeyValue;                        EntityObject eoKucun = eofKucun.FindFirst("JiliangdanweiID={0} and MatID={1}", UnitID, MatID);                        if (eoKucun == null)                        {                            //如果没有库存记录                            strResult.AppendLine(string.Format(@"销售出库单{1}:{0}在库存中没有库存记录", eoChild.GetRelatedObject("MatID").ToString(), eoOrder.GetProperty("BillNo"))); ;                            return strResult.ToString();                        }                        else                        {                            decimal oldUseflag = (decimal)eoKucun.GetProperty("CUseMany");                            eoKucun.SetProperty("CUseMany", oldUseflag - (decimal)eoChild.GetProperty("Many"));                        }                    }                    if (strResult.ToString() == "")                    {   //如果更新成功,则统一释放占用                        eoOrder.SetProperty("UseFlag", 2);                        Context.SaveChanges();                        // int aa = (int)eoOrder.GetProperty("UseFlag");                    }                    else                    {                        return strResult.ToString();                    }                }            }            catch (Exception ex)            {                return ex.Message;            }            return string.Format(@"销售出库单{0}库存释放占用成功!", eoOrder.GetProperty("BillNo"));        }        ///         /// 释放库存,从单据上过来的        ///         public object NoUseKucun(Hashtable ht)        {            StringBuilder strResult = new StringBuilder();            try            {                ArrayList arr = (ArrayList)ht["childID"];                int i = arr.Count; ;                for (int j = 0; j < i; j++)                {                    //先获取当前传过来的id                    int childID = Convert.ToInt32(arr[j].ToString());                    EntityObject eoDetail = EntityObjectFactory.GetInstance(Context, EntityIDEnum.SaleChukuDetail).FindFirst("ID={0}", childID);                    if (eoDetail != null)                    {                        string str = (string)NoUseKucun(Convert.ToInt32(eoDetail.GetProperty("SaleChukuID").ToString()));                        strResult.AppendLine(str);                    }                }            }            catch (Exception ex)            {                return ex.Message;            }            return strResult.ToString();        }    }
View Code

服务端公共方法类

///     /// 服务端公共方法    ///     class ERPServerFunc    {                ///         ///  判断当前单据是否有下推,如果没有下推,返回true        ///         /// 数据实体环境        /// 当前单据对象        /// 下推目标单据子表实体ID        /// 当前单据对象子表实体ID        /// 下推目标单据子表和父表关联ID,ParentID        /// 当前单据对象和下推单据对象子表的关联字段        /// 返回信息值        /// 
返回true表示还未下推
static public bool IsNextBill(ObjectContext Context, EntityObject eo, int NextEntityChildID, int ChildEntityID, string RefParent, string RefDetail, ref string strMesssage) { EntityObjectFactory eofNext = EntityObjectFactory.GetInstance(Context, NextEntityChildID); foreach (EntityObject eoChild in eo.GetChildEntityObjects(ChildEntityID)) { EntityObject eoNext = eofNext.FindFirst(string.Format(@"{0}={1}", RefDetail, (int)eoChild.PrimaryKeyValue)); if (eoNext != null) { strMesssage = string.Format(@"单据已经下推,不能反审核!先删除下推单据再反审核!下推单号:{0}", eoNext.GetRelatedObject(RefParent).GetProperty("BillNO")); return false; } } return true; } /// /// 判断是否存在应收应付已经产生收付款动作 /// /// 数据实体环境 /// 当前单据对象 /// 应收或应付实体ID /// 当前单据中文名称 /// 返回消息值 ///
static public bool IsExitPOPA(ObjectContext Context, EntityObject eo, int POPAEntityID, string eoTableChineseName, ref string strMesssage) { EntityObjectFactory eofPOPA = EntityObjectFactory.GetInstance(Context, POPAEntityID); EntityObject eoPOPA = eofPOPA.FindFirst("BillNO={0} and BillID={1} and BillName={2} ",eo.GetProperty("BillNO"),eo.PrimaryKeyValue,eoTableChineseName); if(eoPOPA!=null) { if ((decimal)eoPOPA.GetProperty("YAmount") > 0) { strMesssage = string.Format(@"单据已经产生应收应付并已经结算,不允许反审核"); return false; } else { eoPOPA.Delete(); strMesssage = string.Format(@"反审核成功,并且将单据审核时候产生的应收应付清单记录删除"); Context.SaveChanges(); return true; } } return true; } //占用库存,释放库存,更新价格,变动库存,生成应收应付 }
View Code

 

 

 

极致平台开发十大特点:

1. 一个数据库下可以同时进行N套业务系统开发,开发出来的产品可以根据您客户的需要按模块界面组发布,客户想要啥模块就可以给啥模块。而且一个数据库下开发所有功能,当客户需要从你的人力资源增加客户关系管理模块的时候,你只要做个升级包就可以了。解决企业多个业务系统信息孤岛问题。

2. 智能升级功能,当客户从A模块增加B模块的时候,您只需要做一个升级包即可,给客户升级后,客户原来录入的数据不会有影响,而且所有客户端都是智能感应智能升级,大大节省您的部署成本。
3. 工作流套打报表均可以运行时候自定义,比如费用报销单,您100家客户就有一百种费用报销的流程,套打的格式,用我们平台您只需要设计好这个费用报销单,至于哪个客户走什么流程,完全可以让客户自己去定义,而不需要像传统开发那样,提前在开发中设置好,100个客户就维护100套代码。套打也是如此。
4. 支持数据授权,当您开发多组织架构的系统的时候,我们只要业务单据引用组织机构即可,然后组织机构支持数据授权,这样就可以不需要编写任何一行代码就可以做到,组织与组织之间数据彼此隔离,我想给哪个用户看哪个组织的数据只要给这个用户这个组织的数据权限即可。
5. 支持字段授权,对于一些表的核心字段对用户进行屏蔽直接利用我们平台的字段授权功能即可,比如职员薪酬字段进行字段授权,让有的用户在看职员信息的时候,自动隐藏薪酬的数据。这也是无需编写任何一行代码。
6. 单据界面自动生成,我们开发的时候只要设计好实体,也就是传统开发所说的表结构即可,还可以设置哪些字段是必录,可见,不允许重复,在界面生成的时候,会自动生成一个界面,而且这个界面的增删改查是无需写一行代码的,您只要对您特有业务逻辑编码即可,相对传统开发,你代码量可以节省2/3,开发周期缩短2/3
7.一次开发同时具有单机局域互联网三个版本,客户想要单机就给单机想要互联网版就给互联网版。 

8.强大的公式引擎,让您可以灵活设计计算类的项目,比如工资,预算。

9.包含强大的各种控件,比如文本控件支持F8调用,编码名称自动带出。Grid控件支持表头过滤,单元格融合,固定列,表格列,表格行各种公式汇总,复合表头,表格宽度可以自己随意调整,而且关闭后会自动记录之前的宽度。还支持表格列随意调整顺序。

10.平台内置很多基础功能,比如权限管理,用户角色管理,还有实施的一些导入导出工具都能帮助客户大大提高一个项目验收进度。

 

官网:

平台介绍:  
平台下载地址:

联系电话:13826519021 18988763421 QQ:180315586  420977542 (加我注明极致软件即可)

平台销售经理:李先生 

将互联网时代的管理软件做到极致!

==================================================================

 

 

 

转载于:https://www.cnblogs.com/Jeez_JBF/p/ERP12.html

你可能感兴趣的文章
mysql 事务 存储过程 函数
查看>>
【MOSS】SPListItems操作
查看>>
转载 修改 Linux 内核 DM9000 支持 tiny210 开发板
查看>>
Sqoop2 环境搭建
查看>>
2018-2019-1 20165237 20165227 20165228 实验三 实时系统
查看>>
跳棋算法
查看>>
第三方库 jsoncpp 读写json
查看>>
使用git提交代码简单说明
查看>>
[leedcode 94] Binary Tree Inorder Traversal
查看>>
Session的配置
查看>>
SQL Server 行转列,列转行。多行转成一列
查看>>
如何做职业规划,才能跑赢90%的竞争者
查看>>
制作安装包遇到的问题安装netframewo
查看>>
JS新建MAP对象,并对其进行操作
查看>>
smtp
查看>>
jquery Validation的本地化文件
查看>>
《Android开发指南 进阶版》之Android简介
查看>>
你还单纯么
查看>>
[北航软工]第一次结对作业-最长单词链
查看>>
Parallel Tests
查看>>