Exemple #1
0
        private string adduseraction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Order.BusinessWorkOrder bc = new project.Business.Order.BusinessWorkOrder();
                bc.load(jp.getValue("id"));

                foreach (string it in jp.getValue("labels").Split(';'))
                {
                    Business.Order.BusinessWorkOrderPerson person = new Business.Order.BusinessWorkOrderPerson();
                    if (person.GetWorkOrderPersonListCount(user.Entity.AccID, bc.Entity.OrderNo, it, null, false) == 0)
                    {
                        person.Entity.AccID      = user.Entity.AccID;
                        person.Entity.CreateDate = GetDate();
                        person.Entity.CreateUser = user.Entity.UserName;
                        person.Entity.IsBack     = false;
                        person.Entity.IsDel      = false;
                        person.Entity.OrderNo    = bc.Entity.OrderNo;
                        person.Entity.UserNo     = it;
                        person.Entity.UpdateUser = user.Entity.UserName;
                        person.Entity.UpdateDate = GetDate();
                        int row = person.Save();

                        if (row > 0)
                        {
                            Business.Order.BusinessWorkOrderMsg msg = new Business.Order.BusinessWorkOrderMsg();
                            msg.Entity.AccID      = user.Entity.AccID;
                            msg.Entity.Sender     = user.Entity.UserNo;
                            msg.Entity.SendDate   = GetDate();
                            msg.Entity.ToUser     = person.Entity.UserNo;
                            msg.Entity.Subject    = "您有一张新的工单!";
                            msg.Entity.Context    = "你有新的工单需要处理,工单号:" + bc.Entity.OrderNo;
                            msg.Entity.RefNo      = bc.Entity.OrderNo;
                            msg.Entity.MsgType    = "1";
                            msg.Entity.IsDel      = false;
                            msg.Entity.IsRead     = false;
                            msg.Entity.CreateDate = GetDate();
                            msg.Entity.CreateUser = user.Entity.UserNo;
                            msg.Save();
                        }
                    }
                }

                //修改退回状态
                obj.ExecuteNonQuery("update WO_WorkOrder set IsBack=0,BackDate=null,backReason='' where RowPointer='" + bc.Entity.InnerEntityOID + "' and AccID='" + bc.Entity.AccID + "'");
                obj.ExecuteNonQuery("update WO_WorkOrder_Person set IsBack=0 where OrderNo='" + bc.Entity.OrderNo + "' and AccID='" + bc.Entity.AccID + "'");
            }
            catch { flag = "2"; }

            collection.Add(new JsonStringValue("type", "adduser"));
            collection.Add(new JsonStringValue("flag", flag));

            return(collection.ToString());
        }
Exemple #2
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Order.BusinessWorkOrder bc = new project.Business.Order.BusinessWorkOrder();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    bc.Entity.OrderName = jp.getValue("OrderName");
                    bc.Entity.OrderDate = ParseDateForString(jp.getValue("OrderDate") + " " + jp.getValue("OrderHour") + ":" + jp.getValue("OrderMinute") + ":00");
                    bc.Entity.OrderType = jp.getValue("OrderType");
                    bc.Entity.SaleNo    = jp.getValue("SaleNo");
                    bc.Entity.AlloDept  = jp.getValue("AlloDept");
                    bc.Entity.AlloUser  = jp.getValue("AlloUser");
                    bc.Entity.CustNo    = jp.getValue("CustNo");
                    bc.Entity.LinkMan   = jp.getValue("LinkMan");
                    bc.Entity.LinkTel   = jp.getValue("LinkTel");
                    bc.Entity.Addr      = jp.getValue("Addr");
                    bc.Entity.Region    = jp.getValue("Region");
                    string CustneedTime = "";
                    if (jp.getValue("CustneedTime") != "")
                    {
                        CustneedTime = jp.getValue("CustneedTime") + " " + jp.getValue("CustneedHour") + ":" + jp.getValue("CustneedMinute") + ":00";
                    }
                    bc.Entity.CustneedTime = ParseDateForString(CustneedTime);

                    //bc.Entity.Remark = jp.getValue("Remark");
                    int r = bc.Save();
                    if (r <= 0)
                    {
                        flag = "2";
                    }
                    else
                    {
                        foreach (string it in jp.getValue("TreatUser").Split(';'))
                        {
                            Business.Order.BusinessWorkOrderPerson person = new Business.Order.BusinessWorkOrderPerson();
                            if (person.GetWorkOrderPersonListCount(user.Entity.AccID, bc.Entity.OrderNo, it, null, false) == 0)
                            {
                                person.Entity.AccID      = user.Entity.AccID;
                                person.Entity.CreateDate = GetDate();
                                person.Entity.CreateUser = user.Entity.UserName;
                                person.Entity.IsBack     = false;
                                person.Entity.IsDel      = false;
                                person.Entity.OrderNo    = bc.Entity.OrderNo;
                                person.Entity.UserNo     = it;
                                person.Entity.UpdateUser = user.Entity.UserName;
                                person.Entity.UpdateDate = GetDate();
                                int row = person.Save();

                                if (row > 0)
                                {
                                    Business.Order.BusinessWorkOrderMsg msg = new Business.Order.BusinessWorkOrderMsg();
                                    msg.Entity.AccID      = user.Entity.AccID;
                                    msg.Entity.Sender     = user.Entity.UserNo;
                                    msg.Entity.SendDate   = GetDate();
                                    msg.Entity.ToUser     = person.Entity.UserNo;
                                    msg.Entity.Subject    = "您有一张新的工单!";
                                    msg.Entity.Context    = "你有新的工单需要处理,工单号:" + bc.Entity.OrderNo;
                                    msg.Entity.RefNo      = bc.Entity.OrderNo;
                                    msg.Entity.MsgType    = "1";
                                    msg.Entity.IsDel      = false;
                                    msg.Entity.IsRead     = false;
                                    msg.Entity.CreateDate = GetDate();
                                    msg.Entity.CreateUser = user.Entity.UserNo;
                                    msg.Save();
                                }
                            }
                        }
                    }
                }
                else
                {
                    string    OrderNo = "";
                    string    today   = GetDate().ToString("yyMMdd");
                    DataTable dt      = obj.ExecuteDataSet("select top 1 OrderNo from WO_WorkOrder where OrderNo like N'" + today + "%' and AccID='" + user.Entity.AccID + "' order by OrderNo desc").Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        OrderNo = (long.Parse(dt.Rows[0]["OrderNo"].ToString()) + 1).ToString();
                    }
                    else
                    {
                        OrderNo = today + "0001";
                    }

                    bc.Entity.OrderNo   = OrderNo;
                    bc.Entity.OrderName = jp.getValue("OrderName");
                    bc.Entity.OrderDate = ParseDateForString(jp.getValue("OrderDate") + " " + jp.getValue("OrderHour") + ":" + jp.getValue("OrderMinute") + ":00");
                    bc.Entity.OrderType = jp.getValue("OrderType");
                    bc.Entity.SaleNo    = jp.getValue("SaleNo");
                    bc.Entity.AlloDept  = jp.getValue("AlloDept");
                    bc.Entity.AlloUser  = jp.getValue("AlloUser");
                    bc.Entity.CustNo    = jp.getValue("CustNo");
                    bc.Entity.LinkMan   = jp.getValue("LinkMan");
                    bc.Entity.LinkTel   = jp.getValue("LinkTel");
                    bc.Entity.Addr      = jp.getValue("Addr");
                    bc.Entity.Region    = jp.getValue("Region");
                    //bc.Entity.Remark = jp.getValue("Remark");
                    string CustneedTime = "";
                    if (jp.getValue("CustneedTime") != "")
                    {
                        CustneedTime = jp.getValue("CustneedTime") + " " + jp.getValue("CustneedHour") + ":" + jp.getValue("CustneedMinute") + ":00";
                    }
                    bc.Entity.CustneedTime = ParseDateForString(CustneedTime);
                    bc.Entity.AccID        = user.Entity.AccID;
                    bc.Entity.Status       = "OPEN";
                    bc.Entity.CreateTime   = GetDate();
                    bc.Entity.CreateUser   = user.Entity.UserNo;
                    bc.Entity.UpdateDate   = GetDate();
                    bc.Entity.UpdateUser   = user.Entity.UserName;

                    int r = bc.Save();
                    if (r <= 0)
                    {
                        flag = "2";
                    }
                    else
                    {
                        foreach (string it in jp.getValue("TreatUser").Split(';'))
                        {
                            Business.Order.BusinessWorkOrderPerson person = new Business.Order.BusinessWorkOrderPerson();
                            if (person.GetWorkOrderPersonListCount(user.Entity.AccID, bc.Entity.OrderNo, it, null, false) == 0)
                            {
                                person.Entity.AccID      = user.Entity.AccID;
                                person.Entity.CreateDate = GetDate();
                                person.Entity.CreateUser = user.Entity.UserName;
                                person.Entity.IsBack     = false;
                                person.Entity.IsDel      = false;
                                person.Entity.OrderNo    = bc.Entity.OrderNo;
                                person.Entity.UserNo     = it;
                                person.Entity.UpdateUser = user.Entity.UserName;
                                person.Entity.UpdateDate = GetDate();
                                int row = person.Save();

                                if (row > 0)
                                {
                                    Business.Order.BusinessWorkOrderMsg msg = new Business.Order.BusinessWorkOrderMsg();
                                    msg.Entity.AccID      = user.Entity.AccID;
                                    msg.Entity.Sender     = user.Entity.UserNo;
                                    msg.Entity.SendDate   = GetDate();
                                    msg.Entity.ToUser     = person.Entity.UserNo;
                                    msg.Entity.Subject    = "您有一张新的工单!";
                                    msg.Entity.Context    = "你有新的工单需要处理,工单号:" + bc.Entity.OrderNo;
                                    msg.Entity.RefNo      = bc.Entity.OrderNo;
                                    msg.Entity.MsgType    = "1";
                                    msg.Entity.IsDel      = false;
                                    msg.Entity.IsRead     = false;
                                    msg.Entity.CreateDate = GetDate();
                                    msg.Entity.CreateUser = user.Entity.UserNo;
                                    msg.Save();
                                }
                            }
                        }

                        Business.Order.BusinessWorkOrderLog log = new Business.Order.BusinessWorkOrderLog();
                        log.Entity.AccID   = user.Entity.AccID;
                        log.Entity.OrderNo = bc.Entity.OrderNo;
                        log.Entity.LogDate = GetDate();
                        log.Entity.LogType = "Add";
                        log.Entity.LogUser = user.Entity.UserNo;
                        log.Entity.Remark  = "新建工单:" + bc.Entity.OrderNo;
                        log.Save();
                    }
                }
            }
            catch { flag = "2"; }

            collection.Add(new JsonStringValue("type", "submit"));
            collection.Add(new JsonStringValue("flag", flag));
            if (flag == "1")
            {
                collection.Add(new JsonStringValue("liststr", createList(jp.getValue("OrderNoS"), jp.getValue("OrderNameS"), jp.getValue("MinOrderDate"), jp.getValue("MaxOrderDate"),
                                                                         jp.getValue("StatusS"), jp.getValue("SaleNoS"), jp.getValue("RegionS"), jp.getValue("AlloDeptS"), jp.getValue("AlloUserS"),
                                                                         jp.getValue("CustNoS"), jp.getValue("OrderTypeS"), jp.getValue("IsBackS"), jp.getValue("IsHangUpS"), int.Parse(jp.getValue("page")))));
            }

            return(collection.ToString());
        }