예제 #1
0
        public override BaseSearchModel Insert()
        {
            if (ids == null || ids.Length == 0)
            {
                throw new Exception("请输入待重置的用户信息");
            }
            else
            {
                using (TransactionScope ts = new TransactionScope())
                {

                    ModelAdo<LoginHistoryModel> adoUser = new ModelAdo<LoginHistoryModel>();
                    StringBuilder sb = new StringBuilder();
                    foreach (string item in ids)
                    {
                        sb.Append(",'" + item + "'");
                    }
                    sb.Remove(0, 1);

                    string sql = @"update UR05 set UR05005 =0 where UR05002 in( [UIDS] )";
                    sql = sql.Replace("[UIDS]", sb.ToString());
                    adoUser.ExecuteSql(sql, null);
                    ts.Complete();
                    return this;
                }

            }
        }
        public override void OnLoad(HttpContext context)
        {
            base.OnLoad(context);
            requestBody             = new RequestBody();
            requestBody.accessToken = context.Request["accessToken"];
            requestBody.oid         = context.Request["oid"];
            requestBody.action      = Convert.ToInt32(context.Request["action"]);
            if (requestBody.accessToken == null || requestBody.accessToken.Trim().Length == 0 || requestBody.oid.Length == 0 || requestBody.action == 0)
            {
                SystemResponse.Output(SystemResponse.TYPE_NULLPARAMETER, out statusCode, out responseJson);
            }
            else
            {
                //验证用户
                TokenHelper    token          = new TokenHelper();
                UserTokenModel userTokenModel = token.getUserToken(requestBody.accessToken);
                if (userTokenModel == null)
                {
                    SystemResponse.Output(SystemResponse.TYPE_EXPIRE, out statusCode, out responseJson);
                }
                else
                {
                    #region 客服取消供应商抢单数据、修改订单状态回派单中
                    if (requestBody.action == 2)
                    {
                        //获取当前订单信息
                        ModelAdo <OrderModel> modelAdo = new ModelAdo <OrderModel>();
                        OrderModel            order    = modelAdo.GetModel("id=?oid AND ostatus=?ostatus", "",
                                                                           new MySqlParameter("?oid", requestBody.oid),
                                                                           new MySqlParameter("?ostatus", 3));
                        if (order != null)
                        {
                            //获取派单供应商对应订单中间表数据
                            ModelAdo <OrderUserModel> ouModelAdo = new ModelAdo <OrderUserModel>();
                            OrderUserModel            orderUser  = ouModelAdo.GetModel("oid=?oid AND uid=?uid", "",
                                                                                       new MySqlParameter("?oid", requestBody.oid),
                                                                                       new MySqlParameter("?uid", order.sendUid));
                            orderUser.amount     = 0;
                            orderUser.remark     = "被供应商退回抢单数据";
                            orderUser.createTime = 0;
                            orderUser.status     = 1;
                            if (ouModelAdo.Update(orderUser) >= 1)
                            {
                                order.ostatus    = 2;
                                order.sendUid    = 0;
                                order.sendTime   = 0;
                                order.sendRemark = "被供应商退回抢单数据";
                                order.sendAmount = 0;
                                if (modelAdo.Update(order) >= 1)
                                {
                                    SystemResponse.Output(SystemResponse.TYPE_OK, out statusCode, out responseJson);
                                }
                                else
                                {
                                    SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                                }
                            }
                        }
                        else
                        {
                            SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                        }
                    }
                    #endregion

                    #region 客服确认供应商抢单数据
                    else if (requestBody.action == 4)
                    {
                        //获取当前订单信息
                        ModelAdo <OrderModel> modelAdo = new ModelAdo <OrderModel>();
                        OrderModel            order    = modelAdo.GetModel("id=?oid AND ostatus=?ostatus", "",
                                                                           new MySqlParameter("?oid", requestBody.oid),
                                                                           new MySqlParameter("?ostatus", 3));
                        order.ostatus    = 4;
                        order.sendRemark = "客服确认供应商抢单数据";
                        if (order != null)
                        {
                            if (modelAdo.Update(order) >= 1)
                            {
                                //删除派单供应商对应订单中间表数据
                                ModelAdo <OrderUserModel> ouModelAdo = new ModelAdo <OrderUserModel>();
                                int delCount = ouModelAdo.ExecuteSql("DELETE FROM ct_order_user WHERE oid=?oid",
                                                                     new MySqlParameter("?oid", requestBody.oid));
                                if (delCount >= 1)
                                {
                                    SystemResponse.Output(SystemResponse.TYPE_OK, out statusCode, out responseJson);
                                }
                                else
                                {
                                    SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                                }
                            }
                        }
                        else
                        {
                            SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                        }
                    }
                    #endregion

                    #region 客服确认关闭已确认数据
                    else if (requestBody.action == 5)
                    {
                        //获取当前订单信息
                        ModelAdo <OrderModel> closeModelAdo = new ModelAdo <OrderModel>();
                        OrderModel            closeOrder    = closeModelAdo.GetModel("id=?oid AND ostatus=?ostatus", "",
                                                                                     new MySqlParameter("?oid", requestBody.oid),
                                                                                     new MySqlParameter("?ostatus", 4));
                        closeOrder.ostatus    = 5;
                        closeOrder.sendRemark = "客服确认完成订单数据";
                        if (closeOrder != null)
                        {
                            if (closeModelAdo.Update(closeOrder) >= 1)
                            {
                                SystemResponse.Output(SystemResponse.TYPE_OK, out statusCode, out responseJson);

                                //删除派单供应商对应订单中间表数据
                                ModelAdo <OrderUserModel> ouModelAdo = new ModelAdo <OrderUserModel>();
                                int delCount = ouModelAdo.ExecuteSql("DELETE FROM ct_order_user WHERE oid=?oid",
                                                                     new MySqlParameter("?oid", requestBody.oid));
                                //if (delCount >= 1)
                                //{
                                //}
                                //else
                                //{
                                //}
                            }
                            else
                            {
                                SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                            }
                        }
                        else
                        {
                            SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                        }
                    }
                    #endregion

                    #region 其他
                    else
                    {
                        SystemResponse.Output(SystemResponse.TYPE_NULLPARAMETER, out statusCode, out responseJson);
                    }
                    #endregion
                }
            }
        }
예제 #3
0
        public void ProcessRequest(HttpContext context)
        {
            if (context.Request["oid"] == null)
            {
                status = 0;
                msg    = "订单编号参数不能为空!";
                goto returnJson;
            }
            if (context.Request["type"] == null)
            {
                status = 0;
                msg    = "派单类型参数不能为空!";
                goto returnJson;
            }
            if (context.Request["stid"] == null)
            {
                status = 0;
                msg    = "供应商组编号参数不能为空!";
                goto returnJson;
            }
            int    oid  = Int32.Parse(context.Request["oid"]);
            int    type = Int32.Parse(context.Request["type"]);
            string stid = context.Request["stid"];


            ModelAdo <OrderSTypeModel> orderSTypeModel = new ModelAdo <OrderSTypeModel>();

            if (type == 1)
            {
                int RecordCount = orderSTypeModel.GetRecordCount(" oid = " + oid);
                if (RecordCount >= 1)
                {
                    //删除原有中间表数据
                    int tempSize = orderSTypeModel.ExecuteSql("DELETE FROM ct_order_stype WHERE oid = ?oid",
                                                              new MySqlParameter("?oid", oid));
                    if (tempSize == 0)
                    {
                        //删除成功,插入数据
                    }
                    else
                    {
                        //未能正确删除数据
                        status = 0;
                        msg    = "数据处理失败集合!";
                        goto returnJson;
                    }
                }
                //直接插入数据
                JArray jsonStid = JArray.Parse(stid);
                if (jsonStid.Count == 0)
                {
                    //供应商组不能为空
                    status = 0;
                    msg    = "供应商组不能为空!";
                    goto returnJson;
                }
                string insertStr = "INSERT INTO ct_order_stype(oid,stid,status) VALUES";
                foreach (int item in jsonStid)
                {
                    insertStr += "(" + oid + "," + item + ",1),";
                }
                insertStr = insertStr.Substring(0, insertStr.Length - 1);
                output    = insertStr;
            }



            if (0 == 0)
            {
                status = 0;
                msg    = "未能找到数据集合!";
                goto returnJson;
            }
            else
            {
            }

returnJson:
            Dictionary <string, object> returnJson = new Dictionary <string, object>
            {
                { "status", status },
                { "msg", msg },
                { "output", output }
            };
            string json = JsonConvert.SerializeObject(returnJson, Formatting.Indented);

            context.Response.ContentType = "application/json";
            context.Response.Write(json);
        }
예제 #4
0
        public override void OnLoad(HttpContext context)
        {
            base.OnLoad(context);
            requestBody             = new RequestBody();
            requestBody.accessToken = context.Request["accessToken"];
            requestBody.oid         = context.Request["oid"];
            requestBody.uid         = context.Request["uid"];
            if (requestBody.accessToken == null || requestBody.accessToken.Trim().Length == 0 || requestBody.oid.Length == 0 || requestBody.uid.Length == 0)
            {
                SystemResponse.Output(SystemResponse.TYPE_NULLPARAMETER, out statusCode, out responseJson);
            }
            else
            {
                List <int> values = JsonConvert.DeserializeObject <List <int> >(requestBody.uid);

                //验证用户
                TokenHelper    token          = new TokenHelper();
                UserTokenModel userTokenModel = token.getUserToken(requestBody.accessToken);
                if (userTokenModel == null)
                {
                    SystemResponse.Output(SystemResponse.TYPE_EXPIRE, out statusCode, out responseJson);
                }
                else
                {
                    //获取订单表数据
                    ModelAdo <OrderModel> modelAdoOrder = new ModelAdo <OrderModel>();
                    OrderModel            orderModel    = modelAdoOrder.GetModel("(id=?id AND ostatus=?ostatus) or (id=?id AND ostatus=?ostatus1) ", "",
                                                                                 new MySqlParameter("?id", requestBody.oid),
                                                                                 new MySqlParameter("?ostatus", 2),
                                                                                 new MySqlParameter("?ostatus1", 1));

                    if (orderModel != null)
                    {
                        ModelAdo <OrderUserModel> modelAdo = new ModelAdo <OrderUserModel>();
                        int existCount = modelAdo.GetRecordCount("oid=?oid",
                                                                 new MySqlParameter("?oid", requestBody.oid));
                        if (existCount >= 1)
                        {
                            int delCount = modelAdo.ExecuteSql("DELETE FROM ct_order_user WHERE oid=?oid",
                                                               new MySqlParameter("?oid", requestBody.oid));
                            if (delCount >= 1)
                            {
                                StringBuilder sbValues = new StringBuilder();
                                sbValues.Append(" INSERT INTO ct_order_user(oid,uid,status,remark) VALUES ");
                                for (int i = 0; i < values.Count; i++)
                                {
                                    sbValues.Append("(" + requestBody.oid + "," + values[i] + ",1,'派送中的订单'),");
                                }
                                sbValues.Remove(sbValues.Length - 1, 1).Append(";");
                                int inCount = modelAdo.ExecuteSql(sbValues.ToString());
                                if (inCount >= 1)
                                {
                                    if (orderModel != null)
                                    {
                                        orderModel.ostatus = 2;
                                        modelAdoOrder.Update(orderModel);
                                    }
                                    SystemResponse.Output(SystemResponse.TYPE_OK, out statusCode, out responseJson);
                                }
                                else
                                {
                                    SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                                }
                            }
                            else
                            {
                                SystemResponse.Output(SystemResponse.TYPE_ERROR, out statusCode, out responseJson);
                            }
                        }
                        else
                        {
                            StringBuilder sbValues = new StringBuilder();
                            sbValues.Append(" INSERT INTO ct_order_user(oid,uid,status) VALUES ");
                            for (int i = 0; i < values.Count; i++)
                            {
                                sbValues.Append("(" + requestBody.oid + "," + values[i] + ",1),");
                            }
                            sbValues.Remove(sbValues.Length - 1, 1).Append(";");
                            int inCount = modelAdo.ExecuteSql(sbValues.ToString());
                            if (inCount >= 1)
                            {
                                SystemResponse.Output(SystemResponse.TYPE_OK, out statusCode, out responseJson);
                            }
                            else
                            {
                                SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                            }
                        }
                    }
                    else
                    {
                        SystemResponse.Output(SystemResponse.TYPE_NULL, out statusCode, out responseJson);
                    }
                }
            }
        }
예제 #5
0
 /// <summary>
 /// 重置盘点数据
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public override int Delete(string id)
 {
     ModelAdo<CheckModel> adoCheck = new ModelAdo<CheckModel>();
     string sql = @"delete  RW12";
     return adoCheck.ExecuteSql(sql, null);
 }
예제 #6
0
        public override BaseSearchModel Insert()
        {
            if (String.IsNullOrEmpty(BarcodeID))
                throw new Exception("请扫描或输入待入库的条码标签");
            else
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    string sql = @"INSERT INTO [RW12]([RW12002],[RW12003],[RW12004],[RW12005],[RW12006])
             VALUES
               (GETDATE() ,@UserID ,@UserName,@PlanID,@Barcode);";

                    ModelAdo<CheckModel> adoRW = new ModelAdo<CheckModel>();
                    int count = adoRW.ExecuteSql(sql, new SqlParameter("@UserID", this.LoginUserID),
                        new SqlParameter("@UserName", this.LoginUserName),
                        new SqlParameter("@PlanID", ""),
                        new SqlParameter("@Barcode", this.BarcodeID));
                    if (count == 0)
                    {
                        throw new Exception("插入失败");
                    }
                    ts.Complete();
                    return this;
                }
            }
        }