Пример #1
0
        public DTOResponse BatchChangeUseState(LocationRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    SqlExpression <LocDetailEntity> sqlExpression = dbConn.From <LocDetailEntity>();
                    sqlExpression.Where(x => request.ListLocatioNo.Contains(x.LOCATIONNO));
                    sqlExpression.UpdateFields.Add("USESTATE");
                    sqlExpression.UpdateFields.Add("OPBY");
                    sqlExpression.UpdateFields.Add("OPDATE");
                    sqlExpression.UpdateFields.Add("OPMESSAGE");

                    LocDetailEntity locDetailEntity = new LocDetailEntity();
                    locDetailEntity.USESTATE  = request.USESTATE;
                    locDetailEntity.OPBY      = SysInfo.GetCurrentUserInfo();
                    locDetailEntity.OPDATE    = Utils.GetTodayNow();
                    locDetailEntity.OPMESSAGE = "修改使用状态!";

                    int count = dbConn.UpdateOnly <LocDetailEntity>(locDetailEntity, sqlExpression);

                    dtoResponse.IsSuccess   = count > 0 ? true : false;
                    dtoResponse.MessageText = "操作完成,修改记录" + count.ToString() + "条 " + dtoResponse.IsSuccess.ToString();
                    HelperOplog.InsertOplog("位置使用状态更改:" + request.USESTATE + "/" + request.ListLocatioNo.ToJson());
                    HelperOplog.InsertOplog(dtoResponse);
                    return(dtoResponse);
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Пример #2
0
        public DTOResponse ChangeGroupUseState(LocationRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    LocGroupEntity entity = dbConn.Select <LocGroupEntity>(x => x.GROUPNO == request.GROUPNO).FirstNonDefault();
                    if (entity == null)
                    {
                        throw new Exception(request.LOCATIONNO + "位置不存在!");
                    }
                    entity.USESTATE  = int.Parse(request.USESTATE);
                    entity.OPBY      = SysInfo.GetCurrentUserInfo();
                    entity.OPDATE    = Utils.GetTodayNow();
                    entity.OPMESSAGE = "修改使用状态!";
                    int count = dbConn.UpdateOnly <LocGroupEntity>(
                        entity,
                        new string[4] {
                        "USESTATE", "OPBY", "OPDATE", "OPMESSAGE"
                    },
                        (x => x.GROUPNO == request.GROUPNO));
                    dtoResponse.IsSuccess   = count > 0 ? true : false;
                    dtoResponse.MessageText = "操作成功!" + count.ToString();
                    return(dtoResponse);
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Пример #3
0
        public DTOResponse Save(PlanDetailRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                if (string.IsNullOrEmpty(request.PostData))
                {
                    throw new Exception("传入的参数为空!");
                }
                long count = 0;
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    //获取对象值
                    request.Entity = HelperSerializer.GetObjectFromJsonString <PlanDetailEntity>(request.PostData);

                    if (request.ACTION == OPAction.CREATE)
                    {
                        ProductEntity productEntity = dbConn.Single <ProductEntity>(x => x.PRODUCTNO == request.Entity.PRODUCTNO);
                        if (productEntity == null)
                        {
                            throw new Exception("物料" + request.Entity.PRODUCTNO + "不存在!");
                        }

                        //获取计划序号
                        SysSequenceResult sequenceResult =
                            SysSequenceInstance.Instance().GetSysSequence("PLANID");

                        PlanDetailEntity entity = new PlanDetailEntity();
                        entity.PLANID     = long.Parse(sequenceResult.SEQVALUE);
                        entity.PLANNO     = sequenceResult.SEQVALUE + "#" + request.Entity.PLANNO;
                        entity.PLANTYPE   = request.Entity.PLANTYPE;
                        entity.LINENUM    = 1;
                        entity.LINESTATE  = 0;
                        entity.BPNO       = request.Entity.BPNO;
                        entity.BPNAME     = request.Entity.BPNAME;
                        entity.STATIONNO  = request.Entity.STATIONNO;
                        entity.MODIFYBY   = SysInfo.GetCurrentUserInfo();
                        entity.MODIFYDATE = Utils.GetTodayDateTimeNow();

                        /*entity.BOMID = "";
                         * entity.BOMNO = "";
                         * entity.BOMNAME = "";
                         * entity.BOMBATCHNO = "";*/
                        entity.PRODUCTID    = productEntity.ID;
                        entity.PRODUCTNO    = productEntity.PRODUCTNO;
                        entity.PRODUCTNAME  = productEntity.PRODUCTNAME;
                        entity.PRODUCTSPEC  = productEntity.PRODUCTSPEC;
                        entity.PRODUCTCLASS = productEntity.PRODUCTCLASS;
                        entity.PRODUCTTYPE  = productEntity.PRODUCTTYPE;
                        entity.BATCHNO      = request.Entity.BATCHNO;
                        entity.Q01          = request.Entity.Q01;
                        entity.Q02          = 0;
                        entity.Q03          = 0;
                        entity.Q04          = 0;
                        entity.Q05          = request.Entity.Q05;
                        entity.Q06          = request.Entity.Q06;
                        entity.MAINUNIT     = productEntity.MAINUNIT;
                        entity.BASICUNIT    = productEntity.MAINUNIT;
                        entity.REMARK1      = request.Entity.REMARK1;
                        entity.P01          = request.Entity.P01;
                        entity.P02          = request.Entity.P02;

                        /*entity.REMARK2 = "";
                         *
                         * entity.P03 = "";
                         * entity.P04 = "";
                         * entity.P05 = "";
                         * entity.P06 = "";
                         * entity.P07 = "";
                         * entity.P08 = "";
                         * entity.P09 = "";
                         * entity.P10 = "";
                         * entity.P11 = "";
                         * entity.P12 = "";
                         * entity.P13 = "";
                         * entity.P14 = "";
                         * entity.P15 = "";
                         * entity.P16 = "";
                         * entity.P17 = "";
                         * entity.P18 = "";
                         * entity.P19 = "";
                         * entity.P20 = "";*/

                        //插入记录
                        count = dbConn.Insert <PlanDetailEntity>(entity);
                    }
                    else if (request.ACTION == OPAction.UPDATE)
                    {
                        //更新记录
                        count = dbConn.SaveAll <PlanDetailEntity>(new List <PlanDetailEntity>()
                        {
                            request.Entity
                        });
                    }

                    dtoResponse.IsSuccess   = true;
                    dtoResponse.MessageText = "操作成功!" + count;
                    return(dtoResponse);
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Пример #4
0
        public DTOResponse Save(ProductRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                if (string.IsNullOrEmpty(request.PostData))
                {
                    throw new Exception("传入的参数为空!");
                }
                long count = 0;
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    //获取对象值
                    request.Entity = HelperSerializer.GetObjectFromJsonString <ProductEntity>(request.PostData);

                    if (request.ACTION == OPAction.CREATE)
                    {
                        ProductEntity entity = new ProductEntity();
                        entity.PRODUCTNO   = request.Entity.PRODUCTNO;
                        entity.PRODUCTNAME = request.Entity.PRODUCTNAME;
                        //entity.PRODUCTDESC = "";
                        //entity.PRODUCTSUBDESC = "";
                        //entity.PRODUCTSPEC = "";
                        entity.PRODUCTBARCODE = "0";
                        //entity.PRODUCTNODECODE = "";
                        entity.TURNOVERRATE    = "";
                        entity.ABC             = request.Entity.ABC;
                        entity.PRODUCTCLASS    = "";
                        entity.PRODUCTTYPE     = request.Entity.PRODUCTTYPE;
                        entity.PRODUCTTSTATE   = "1";
                        entity.QUANTITY_PACK   = request.Entity.QUANTITY_PACK;
                        entity.MAINUNIT        = request.Entity.MAINUNIT;
                        entity.BASICUNIT       = request.Entity.MAINUNIT;
                        entity.MAINTOBASICRATE = 1;
                        //entity.MAINTOBASICDESC = "";
                        entity.CREATEBY   = SysInfo.GetCurrentUserInfo();
                        entity.CREATEDATE = Utils.GetDatetime();
                        entity.MODIFYBY   = "";
                        entity.MODIFYDATE = "";
                        entity.REMARK     = request.Entity.REMARK;

                        /*entity.BRANDID = "";
                         * entity.BRANDNAME = "";
                         * entity.VENDORID = "";
                         * entity.VENDORNAME = "";
                         * entity.PRODUCTERID = "";
                         * entity.PRODUCTERNAME = "";
                         * entity.MARKETPRICE = "";
                         * entity.LOWESTSALEPRICE = "";
                         * entity.SELLPRICE = "";
                         * entity.ISDELICATE = "";
                         * entity.IMPORTPRODUCT = "";
                         * entity.IMAGEURL = "";
                         * entity.DEFAULTCOLOR = "";
                         * entity.PALLETEMPLTY = "";
                         * entity.PALLETENTITY = "";
                         * entity.SIZE_LENGTH = "";
                         * entity.SIZE_WIDTH = "";
                         * entity.SIZE_HEIGHT = "";
                         * entity.VOLUME = "";
                         * entity.WEIGHT = "";
                         * entity.NETWEIGHT = "";
                         * entity.WARNSTATE = "";
                         * entity.INV_HIGH = "";
                         * entity.INV_SAFE = "";
                         * entity.INV_ORDER = "";
                         * entity.INV_HIVEDAYS = "";
                         * entity.INV_LIMIT = "";
                         * entity.INV_HIGH_COLOR = "";
                         * entity.INV_SAFE_COLOR = "";
                         * entity.INV_ORDER_COLOR = "";
                         * entity.INV_HIVEDAYS_COLOR = "";
                         * entity.INV_LIMIT_COLOR = "";
                         * entity.CUSTOMCOL01 = "";
                         * entity.CUSTOMCOL02 = "";
                         * entity.CUSTOMCOL03 = "";
                         * entity.CUSTOMCOL04 = "";
                         * entity.CUSTOMCOL05 = "";
                         * entity.CUSTOMCOL06 = "";
                         * entity.CUSTOMCOL07 = "";
                         * entity.CUSTOMCOL08 = "";
                         * entity.CUSTOMCOL09 = "";
                         * entity.CUSTOMCOL10 = "";*/

                        //插入记录
                        count = dbConn.Insert <ProductEntity>(entity);
                    }
                    else if (request.ACTION == OPAction.UPDATE)
                    {
                        //更新记录
                        count = dbConn.SaveAll <ProductEntity>(new List <ProductEntity>()
                        {
                            request.Entity
                        });
                    }
                    else if (request.ACTION == OPAction.OP_01)
                    {
                        SqlExpression <ProductEntity> sqlExpression = dbConn.From <ProductEntity>();
                        sqlExpression.Where(x => x.ID == request.Entity.ID);
                        sqlExpression.UpdateFields.Add("DEFAULTCOLOR");
                        sqlExpression.UpdateFields.Add("PRODUCTTSTATE");

                        //更新记录
                        count = dbConn.UpdateOnly <ProductEntity>(request.Entity, sqlExpression);
                    }

                    dtoResponse.IsSuccess   = true;
                    dtoResponse.MessageText = "操作成功!" + count;
                    return(dtoResponse);
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }
Пример #5
0
        public DTOResponse SaveBasicObject(BasicRequest request)
        {
            DTOResponse dtoResponse = new DTOResponse();

            try
            {
                using (IDbConnection dbConn = HelperConnection.GetConnectionFactory().OpenDbConnection())
                {
                    if (request.BasicType == "PRODUCER")
                    {
                        int maxid = 0;
                        if (dbConn.Count <BasicProducerEntity>() == 0)
                        {
                            maxid = 1;
                        }
                        else
                        {
                            maxid = dbConn.Select <BasicProducerEntity>().Max(x => x.ID) + 1;
                        }

                        BasicProducerEntity entity = new BasicProducerEntity();
                        entity.ID              = maxid;
                        entity.PRODUCERNO      = request.Code;
                        entity.PRODUCERNAME    = request.Name;
                        entity.PRODUCERSUBDESC = request.Subdesc;
                        entity.PRODUCERSTATE   = string.IsNullOrEmpty(request.State) ? "1" : request.State;
                        entity.CREATEDATE      = Utils.GetDatetime();
                        entity.CREATEBY        = SysInfo.GetCurrentUserInfo();
                        bool b = dbConn.Save <BasicProducerEntity>(entity);

                        dtoResponse.IsSuccess   = b;
                        dtoResponse.MessageText = "操作成功!";
                        return(dtoResponse);
                    }
                    else if (request.BasicType == "VENDOR")
                    {
                        int maxid = 0;
                        if (dbConn.Count <BasicVendorEntity>() == 0)
                        {
                            maxid = 1;
                        }
                        else
                        {
                            maxid = dbConn.Select <BasicVendorEntity>().Max(x => x.ID) + 1;
                        }

                        BasicVendorEntity entity = new BasicVendorEntity();
                        entity.ID            = maxid;
                        entity.VENDORNO      = request.Code;
                        entity.VENDORNAME    = request.Name;
                        entity.VENDORSUBDESC = request.Subdesc;
                        entity.VENDORSTATE   = string.IsNullOrEmpty(request.State) ? "1" : request.State;
                        entity.CREATEDATE    = Utils.GetDatetime();
                        entity.CREATEBY      = SysInfo.GetCurrentUserInfo();
                        bool b = dbConn.Save <BasicVendorEntity>(entity);

                        dtoResponse.IsSuccess   = b;
                        dtoResponse.MessageText = "操作成功!";
                        return(dtoResponse);
                    }
                    else
                    {
                        dtoResponse.ResultObject = null;
                        dtoResponse.IsSuccess    = false;
                        dtoResponse.MessageText  = "查询" + request.BasicType + "失败!";
                        return(dtoResponse);
                    }
                }
            }
            catch (Exception ex)
            {
                dtoResponse.IsSuccess   = false;
                dtoResponse.MessageText = ex.Message;
                logger.Error((object)ex);
                return(dtoResponse);
            }
        }