Esempio n. 1
0
        /*
         *      /// <summary>
         *      /// 分页获取数据列表
         *      /// </summary>
         *      public DataSet GetList(int PageSize,int PageIndex,string strWhere)
         *      {
         *              SqlParameter[] parameters = {
         *                              new SqlParameter("@tblName", SqlDbType.VarChar, 255),
         *                              new SqlParameter("@fldName", SqlDbType.VarChar, 255),
         *                              new SqlParameter("@PageSize", SqlDbType.Int),
         *                              new SqlParameter("@PageIndex", SqlDbType.Int),
         *                              new SqlParameter("@IsReCount", SqlDbType.Bit),
         *                              new SqlParameter("@OrderType", SqlDbType.Bit),
         *                              new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
         *                              };
         *              parameters[0].Value = "BPM_Daily";
         *              parameters[1].Value = "ID_Key";
         *              parameters[2].Value = PageSize;
         *              parameters[3].Value = PageIndex;
         *              parameters[4].Value = 0;
         *              parameters[5].Value = 0;
         *              parameters[6].Value = strWhere;
         *              return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
         *      }*/

        #endregion  BasicMethod

        #region  ExtensionMethod
        /// <summary>
        /// 更新工单状态
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public bool UpdateOrderState(Model.BPM_Order order)
        {
            string sql  = "UPDATE BPM_Daily SET State = '" + order.State + "', ActualEndDate = '" + order.ActualEndDate + "' WHERE(OrderID = '" + order.OrderID + "')";
            int    rows = DbHelperSQL.ExecuteSql(sql);

            return(rows > 0 ? true : false);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取工单WIP
        /// </summary>
        public List <Model.BPM_WIP> GetOrderWIPList(Model.BPM_Order Order)
        {
            if (!Exists(Order))
            {
                CreateOrderWip(Order);
            }
            DataSet ds = dal.GetList("OrderID='" + Order.OrderID + "'");

            return(DataTableToList(ds.Tables[0]));
        }
Esempio n. 3
0
        /// <summary>
        /// 创建工单WIP
        /// </summary>
        /// <param name="Order"></param>
        public void CreateOrderWip(Model.BPM_Order Order)
        {
            BPM_Daily bll_Daily = new BPM_Daily();
            var       lsDaily   = bll_Daily.GetModelList("OrderID='" + Order.OrderID + "'");

            if (Order != null && Order.Product != null && Order.Product.ProcessList.Count > 0)
            {
                foreach (var process in Order.Product.ProcessList)
                {
                    var Model = new Model.BPM_WIP()
                    {
                        OrderID            = Order.OrderID,
                        ClientName         = Order.ClientName,
                        ProductName        = Order.ProductName,
                        Spec               = Order.Spec,
                        Count              = Convert.ToInt32(Order.Count),
                        ProcessCount       = Convert.ToInt32(Order.Count) * process.ConnectorQty,
                        ProcessID          = process.ProcessID,
                        ProcessName        = process.ProcessName,
                        StandardHours      = Convert.ToDouble(process.StandardHours),
                        ConnectorQty       = process.ConnectorQty,
                        ProcessSign        = process.ProcessSign,
                        TotalStandatdHours = Order.Count * process.ConnectorQty * Convert.ToDouble(process.StandardHours),
                        Qty_OK             = lsDaily.Where(x => x.ProcessID == process.ProcessID).Sum(p => p.QtyOK),
                        Qty_NG             = lsDaily.Where(x => x.ProcessID == process.ProcessID).Sum(p => p.QtyNG),
                        Qty       = lsDaily.Where(x => x.ProcessID == process.ProcessID).Sum(p => p.Qty),
                        WorkHours = Convert.ToDouble(lsDaily.Where(x => x.ProcessID == process.ProcessID).Sum(p => p.WorkHours)),
                    };
                    Model.Qty_NotInput = Model.ProcessCount - Model.Qty;
                    Model.GetTime      = Model.Qty * Model.StandardHours;
                    if (Model.GetTime == 0 || Model.WorkHours == 0)
                    {
                        Model.Efficiency = 0;
                    }
                    else
                    {
                        Model.Efficiency = Convert.ToDouble(Model.GetTime / Model.WorkHours);
                    }

                    dal.Add(Model);
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.BPM_Order model)
        {
            if (model.State == "已完工" && model.ActualStartDate.IsNullOrEmpty())
            {
                model.ActualEndDate = DateTime.Now.Date.ToString("yyyyMMdd");
            }

            BPM_Daily daily = new BPM_Daily();

            daily.UpdateOrderState(model);
            if (!dal.Exists(model.OrderID))
            {
                model.IsRemind = true;
                model.Relax    = 1.2;
                return(dal.Add(model));
            }
            else
            {
                //if (!MyMessage.IsOkMessage("本地已存在此工单,继续将更新本地工单,是否继续!")) return false;
                return(dal.Update(model));
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.BPM_Order GetModel(string OrderID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 * from BPM_Order ");
            strSql.Append(" where OrderID=@OrderID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderID", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = OrderID;

            Model.BPM_Order model = new Model.BPM_Order();
            DataSet         ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 6
0
        public Model.BPM_Order DataRowToModel(DataRow row)
        {
            Model.BPM_Order model = new Model.BPM_Order();
            if (row != null)
            {
                if (row["TA001"] != null && row["TA002"] != null)
                {
                    model.OrderID = row["TA001"].ToString().Replace(" ", "") + "-" + row["TA002"].ToString().Replace(" ", "");
                }
                if (row["TA006"] != null)
                {
                    model.ProductID = row["TA006"].ToString();
                }
                if (row["TA034"] != null)
                {
                    model.ProductName = row["TA034"].ToString();
                }
                if (row["TA035"] != null)
                {
                    model.Spec = row["TA035"].ToString();
                }
                if (row["TA015"] != null)
                {
                    model.Count = double.Parse(row["TA015"].ToString());
                }
                if (row["TA009"] != null)
                {
                    model.StartDate = row["TA009"].ToString();
                }
                if (row["TA010"] != null)
                {
                    model.EndDate = row["TA010"].ToString();
                }
                if (row["TA011"] != null)
                {
                    string state = row["TA011"].ToString();
                    switch (state)
                    {
                    case "1":
                        model.State = "未生产"; break;

                    case "2":
                        model.State = "已发料"; break;

                    case "3":
                        model.State = "生产中"; break;

                    case "Y":
                        model.State = "已完工"; break;

                    case "y":
                        model.State = "指定完工"; break;

                    default:
                        break;
                    }
                }
                if (row["TA012"] != null)
                {
                    model.ActualStartDate = row["TA012"].ToString();
                }
                if (row["TA014"] != null)
                {
                    model.ActualEndDate = row["TA014"].ToString();
                }

                if (row["TA017"] != null)
                {
                    model.InStorageCount = double.Parse(row["TA017"].ToString());
                }

                model.IsRemind = false;
            }
            BPM_Product product = new BPM_Product();

            model.Product = product.GetModel(model.ProductID);  //产品信息
            return(model);
        }
Esempio n. 7
0
 public bool Update(Model.BPM_Order model)
 {
     return(false);
 }
Esempio n. 8
0
 public bool Add(Model.BPM_Order model)
 {
     return(false);
 }
Esempio n. 9
0
 /// <summary>
 /// 是否有此工单的WIP档案
 /// </summary>
 /// <param name="Order"></param>
 /// <returns></returns>
 public bool Exists(Model.BPM_Order Order)
 {
     return(GetModelList("OrderID='" + Order.OrderID + "'").Count > 0 ? true:false);
 }
Esempio n. 10
0
 /// <summary>
 /// 更新工单状态
 /// </summary>
 /// <param name="order"></param>
 /// <returns></returns>
 public bool UpdateOrderState(Model.BPM_Order order)
 {
     return(dal.UpdateOrderState(order));
 }
Esempio n. 11
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.BPM_Order model)
 {
     return(dal.Update(model));
 }