Ejemplo n.º 1
0
 /// <summary>
 /// 锁定物料操作人
 /// </summary>
 /// <param name="taskDetailsMdl"></param>
 /// <param name="userMdl"></param>
 /// <returns></returns>
 public int LockTaskOperUser(TaskDetails_Model taskDetailsMdl, BLL.Basic.User.UserInfo userMdl)
 {
     try
     {
         string strSql = "update t_taskdetails set operatoruserno='{0}' where id = '{1}'";
         strSql = string.Format(strSql, userMdl.UserNo, taskDetailsMdl.ID);
         return(OperationSql.ExecuteNonQuery2(System.Data.CommandType.Text, strSql));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message + ex.TargetSite);
     }
 }
Ejemplo n.º 2
0
        public Task_Model GetTaskDetailsInfo(string strTaskNo)
        {
            try
            {
                Task_Model TM = new Task_Model();
                TM.lstTaskDetails = new List <TaskDetails_Model>();

                string strSql = string.Format("select * from V_GETTASKDETAILSINFO where taskno = '{0}'", strTaskNo);

                using (SqlDataReader dr = OperationSql.ExecuteReader(System.Data.CommandType.Text, strSql))
                {
                    while (dr.Read())
                    {
                        TM.ID           = dr["task_id"].ToInt32();
                        TM.TaskNo       = dr["taskno"].ToDBString();
                        TM.TaskStatus   = dr["taskstatus"].ToInt32();
                        TM.IsShelvePost = dr["isshelvepost"].ToInt32();
                        TM.IsQuality    = dr["isquality"].ToInt32();
                        TM.VoucherType  = dr["VoucherType"].ToInt32();
                        TM.Plant        = dr["plant"].ToDBString();
                        TM.DeliveryNo   = dr["deliveryno"].ToDBString();

                        TaskDetails_Model TDM = new TaskDetails_Model();
                        TDM.ID              = dr["id"].ToInt32();
                        TDM.MaterialNo      = dr["materialno"].ToDBString();
                        TDM.MaterialDesc    = dr["materialdesc"].ToDBString();
                        TDM.MaterialStd     = dr["MaterialStd"].ToDBString();
                        TDM.TaskQty         = dr["taskqty"].ToDecimal();
                        TDM.QuanlityQty     = dr["qualityqty"].ToDecimal();
                        TDM.RemainQty       = dr["remainqty"].ToDecimal();
                        TDM.ShelveQty       = dr["shelveqty"].ToDecimal();
                        TDM.RowNo           = dr["RowNo"].ToDBString();
                        TDM.VoucherNo       = dr["VoucherNo"].ToDBString();
                        TDM.PackCount       = dr["PackCount"].ToDecimal();
                        TDM.ShelvePackCount = dr["ShelvePackCount"].ToDecimal();
                        TDM.RemainPackCount = dr["RemainPackCount"].ToDecimal();
                        TM.lstTaskDetails.Add(TDM);
                    }
                }
                strSql         = string.Format(@"SELECT A.warehouseno FROM T_WAREHOUSE A JOIN T_TASKWAREHOUSE B ON A.id=B.warehouse_id JOIN T_TASK C ON B.task_id=C.id
WHERE C.taskno = '{0}'", strTaskNo);
                TM.WareHouseNo = OperationSql.ExecuteScalar(CommandType.Text, strSql, null).ToString();
                return(TM);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 查看物料被哪个用户锁定
 /// </summary>
 /// <param name="taskDetailsMdl"></param>
 /// <param name="userMdl"></param>
 /// <returns></returns>
 public string QueryUserNameByTaskDetails(TaskDetails_Model taskDetailsMdl, BLL.Basic.User.UserInfo userMdl)
 {
     try
     {
         string strUserName = string.Empty;
         string strSql      = "select b.UserName from t_taskdetails a left join t_user b on a.operatoruserno = b.userno where a.id = {0} " +
                              " and  a.operatoruserno!='{1}'";
         strSql = string.Format(strSql, taskDetailsMdl.ID, userMdl.UserNo);
         return((string)OperationSql.ExecuteScalar(System.Data.CommandType.Text, strSql));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message + ex.TargetSite);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 锁定任务操作人
        /// </summary>
        /// <param name="taskDetailsMdl"></param>
        /// <param name="userMdl"></param>
        /// <param name="strErrMsg"></param>
        /// <returns></returns>
        public string LockTaskOperUser(string strTaskDetailsJson, string strUserJson)
        {
            TaskHead_Model taskHeadModel = new TaskHead_Model();

            try
            {
                int    iLock       = 0;
                string strUserName = string.Empty;

                TaskDetails_Model taskDetailsModel = JSONUtil.JSONHelper.JsonToObject <TaskDetails_Model>(strTaskDetailsJson);

                if (taskDetailsModel == null || (string.IsNullOrEmpty(taskDetailsModel.MaterialNo) && string.IsNullOrEmpty(taskDetailsModel.TMaterialNo)))
                {
                    return(GetFailJson(ref taskHeadModel, "没有物料信息"));
                }

                Basic.User.UserInfo userModel = JSONUtil.JSONHelper.JsonToObject <Basic.User.UserInfo>(strUserJson);
                if (userModel == null || string.IsNullOrEmpty(userModel.UserNo))
                {
                    return(GetFailJson(ref taskHeadModel, "没有用户信息"));
                }

                Task_DB TD = new Task_DB();
                strUserName = TD.QueryUserNameByTaskDetails(taskDetailsModel, userModel);
                if (!string.IsNullOrEmpty(strUserName))
                {
                    return(GetFailJson(ref taskHeadModel, "物料:" + taskDetailsModel.MaterialNo + taskDetailsModel.TMaterialNo + "\r\n" + "被:" + strUserName + "锁定!"));
                }
                iLock = TD.LockTaskOperUser(taskDetailsModel, userModel);

                if (iLock == 0)
                {
                    return(GetFailJson(ref taskHeadModel, "物料:" + taskDetailsModel.MaterialNo + "锁定失败!"));
                }
                return(GetSuccessJson(ref taskHeadModel));
            }
            catch (Exception ex)
            {
                return(GetFailJson(ref taskHeadModel, "Web异常:" + ex));
            }
        }