Ejemplo n.º 1
0
        public static bool UpLoadSql(List <string> lstSql, UserInfo user, ref string strError)
        {
            if (lstSql == null || lstSql.Count <= 0)
            {
                strError = "上传数据不能为空";
                return(false);
            }

            if (OperationSql.ExecuteNonQueryList(lstSql, ref strError) >= 1)
            {
                return(true);
            }
            else
            {
                if (string.IsNullOrEmpty(strError))
                {
                    try
                    {
                        OperationSql.ExecuteNonQuery2(CommandType.Text, lstSql[0], null);
                        if (lstSql.Count >= 2)
                        {
                            OperationSql.ExecuteNonQuery2(CommandType.Text, lstSql[1], null);
                        }
                    }
                    catch (Exception ex)
                    {
                        strError = ex.Message;
                    }
                }
                return(false);
            }
        }
Ejemplo n.º 2
0
        internal bool ReCheckByCheck(CheckInfo model, ref CheckInfo reCheck, Basic.User.UserInfo user, ref string strError)
        {
            SqlParameter[] param = new SqlParameter[] {
                //new OracleParameter("@ErrorMsg",OracleDbType.NVarchar2,1000),

                //new OracleParameter("@v_UserID", user.ID.ToOracleValue()),
                //new OracleParameter("@xmlCheck", XMLUtil.XmlUtil.Serializer(typeof(CheckInfo),model)),
                //new OracleParameter("@v_ReCheckID",OracleDbType.Int32,18),
            };
            param[0].Direction = ParameterDirection.Output;
            param[1].Direction = ParameterDirection.Input;
            param[2].Direction = ParameterDirection.Input;
            param[3].Direction = ParameterDirection.Output;

            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_ReCheck", param);

            strError = param[0].Value.ToDBString();
            if (strError.StartsWith("执行错误"))
            {
                //throw new Exception(strError);
                return(false);
            }
            else
            {
                reCheck.ID = param[3].Value.ToInt32();
                return(true);
            }
        }
Ejemplo n.º 3
0
        internal bool UpdateCheckAnalyse(CheckDetailsInfo model, ref string strError)
        {
            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@ErrorMsg", SqlDbType.NVarChar, 1000),

                new SqlParameter("@v_ID", SqlDbType.Int),
                new SqlParameter("@v_CheckType", SqlDbType.Int),
            };

            param[0].Direction = ParameterDirection.Output;
            param[1].Value     = model.CheckID;
            param[2].Value     = model.CheckType;

            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_GetCheckAnalyse", param);

            strError = param[0].Value.ToDBString();
            if (strError.StartsWith("执行错误"))
            {
                //throw new Exception(strError);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 4
0
        public bool ExistsAreaNo(AreaInfo model, bool bIncludeDel)
        {
            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@ErrorMsg", SqlDbType.NVarChar, 1000),

                new SqlParameter("@v_AreaNo", model.AreaNo.ToSqlValue()),
                new SqlParameter("@IncludeDel", bIncludeDel.ToSqlValue()),
            };
            param[0].Direction = ParameterDirection.Output;

            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_ExistsAreaNo", param);

            string ErrorMsg = param[0].Value.ToDBString();

            if (!string.IsNullOrEmpty(ErrorMsg))
            {
                throw new Exception(ErrorMsg);
            }
            return(true);
            //if (ErrorMsg.StartsWith("执行错误"))
            //{
            //    throw new Exception(ErrorMsg);
            //}
            //else
            //{
            //    return string.IsNullOrEmpty(ErrorMsg);
            //}
        }
Ejemplo n.º 5
0
        public bool SaveQualityDetailInfo(string strDeliveryXml, UserInfo userModel, ref string strErrMsg)
        {
            try
            {
                int iResult = 0;

                SqlParameter[] cmdParms = new SqlParameter[]
                {
                    new SqlParameter("deliverydetailinfo_xml", SqlDbType.Image),
                    new SqlParameter("struserno", SqlDbType.NVarChar),
                    //new SqlParameter("bresult", SqlDbType.Int,ParameterDirection.Output),
                    new SqlParameter("bresult", SqlDbType.Int),

                    //new SqlParameter("strerrmsg", SqlDbType.NVarChar,100,strErrMsg,ParameterDirection.Output)
                    new SqlParameter("strerrmsg", SqlDbType.NVarChar, 100, strErrMsg)
                };

                cmdParms[0].Value = strDeliveryXml;
                cmdParms[1].Value = userModel.UserNo;


                OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "p_updatequalityqty", cmdParms);
                iResult   = Convert.ToInt32(cmdParms[2].Value.ToString());
                strErrMsg = cmdParms[3].Value.ToString();

                return(iResult == 1 ? true : false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 6
0
        public bool UnLockTaskOperUser(string strTaskXml, BLL.Basic.User.UserInfo userModel, ref string strErrMsg)
        {
            try
            {
                int iResult = 0;

                SqlParameter[] cmdParms = new SqlParameter[]
                {
                    new SqlParameter("Task_xml", SqlDbType.Image),
                    new SqlParameter("strUserNo", SqlDbType.NVarChar),
                    //new SqlParameter("bResult", SqlDbType.Int,ParameterDirection.Output),
                    new SqlParameter("bResult", SqlDbType.Int),

                    //new SqlParameter("strErrMsg", SqlDbType.NVarChar,1000,strErrMsg,ParameterDirection.Output)
                    new SqlParameter("strErrMsg", SqlDbType.NVarChar, 1000, strErrMsg)
                };


                cmdParms[0].Value = strTaskXml;
                cmdParms[1].Value = userModel.UserNo;

                OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "p_unlockoperuser", cmdParms);
                iResult   = Convert.ToInt32(cmdParms[2].Value.ToString());
                strErrMsg = cmdParms[3].Value.ToString();

                return(iResult == 1 ? true : false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 7
0
        public bool UpdateTaskByPost(string strDeliveryXml, BLL.Basic.User.UserInfo userModel, ref string strErrMsg)
        {
            try
            {
                int iResult = 0;

                SqlParameter[] cmdParms = new SqlParameter[]
                {
                    new SqlParameter("deliveryinfo_xml", SqlDbType.Image),
                    new SqlParameter("strUserNo", SqlDbType.NVarChar),
                    //new SqlParameter("bResult", SqlDbType.Int,ParameterDirection.Output),
                    new SqlParameter("bResult", SqlDbType.Int),

                    new SqlParameter("strErrMsg", SqlDbType.NVarChar, 200, strErrMsg)
                };

                cmdParms[0].Value = strDeliveryXml;
                cmdParms[1].Value = userModel.UserNo;

                TOOL.WriteLogMethod.WriteLog("方法:UpdateTaskByPost---操作人:" + userModel.UserName + strDeliveryXml);
                OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "p_updatetaskbypost", cmdParms);
                iResult   = Convert.ToInt32(cmdParms[2].Value.ToString());
                strErrMsg = cmdParms[3].Value.ToString();

                return(iResult == 1 ? true : false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 8
0
        public bool CreateQuanlityReturnVoucher(string strQuanlityXml, ref string strReturnNo, BLL.Basic.User.UserInfo userModel, ref string strErrMsg)
        {
            try
            {
                int iResult = 0;

                SqlParameter[] cmdParms = new SqlParameter[]
                {
                    new SqlParameter("strQuanlityXml", SqlDbType.Image),
                    new SqlParameter("struserno", SqlDbType.NVarChar),
                    new SqlParameter("strreturnno", SqlDbType.NVarChar, 50, strReturnNo),
                    //new SqlParameter("bresult", SqlDbType.Int,ParameterDirection.Output),
                    new SqlParameter("bresult", SqlDbType.Int),

                    new SqlParameter("strerrmsg", SqlDbType.NVarChar, 100, strErrMsg)
                };

                cmdParms[0].Value = strQuanlityXml;
                cmdParms[1].Value = userModel.UserNo;


                OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "p_createquanlityreturnvoucher", cmdParms);
                iResult     = Convert.ToInt32(cmdParms[3].Value.ToString());
                strReturnNo = cmdParms[2].Value.ToString();
                strErrMsg   = cmdParms[4].Value.ToString();

                return(iResult == 1 ? true : false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 9
0
        public bool UpdateCheckStatusByID(CheckInfo model)
        {
            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@ErrorMsg", SqlDbType.NVarChar, 1000),

                new SqlParameter("@v_ID", SqlDbType.Int),
                new SqlParameter("@v_CheckStatus", SqlDbType.Int),
            };
            param[1].Value = model.ID;
            param[2].Value = model.CheckStatus;

            param[0].Direction = ParameterDirection.Output;

            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_UpdateCheckStatusByID", param);

            string ErrorMsg = param[0].Value.ToDBString();

            if (ErrorMsg.StartsWith("执行错误"))
            {
                throw new Exception(ErrorMsg);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 10
0
        public bool PrintQuality(DeliveryReceive_Model deliveryMdl, UserInfo userModel, ref string strErrMsg)
        {
            try
            {
                string strSql = "";
                strSql = string.Format("update t_receive set printqty = ISNULL(printqty,0) + {0} where ID = {1}  ", 1, deliveryMdl.ID);
                int i = OperationSql.ExecuteNonQuery2(CommandType.Text, strSql);
                if (i <= 0)
                {
                    strErrMsg = string.Format("未更新质检主表任何行:{0}", strSql);
                    return(false);
                }

                strSql = string.Format("update t_receivedetails set printqty = ISNULL(printqty,0) + {0}, printtime = sysdate where receive_id = {1} and voucherno = '{2}' ", 1, deliveryMdl.ID, deliveryMdl.VoucherNo);
                i      = OperationSql.ExecuteNonQuery2(CommandType.Text, strSql);
                if (i <= 0)
                {
                    strErrMsg = string.Format("未更新质检子表任何行:{0}", strSql);
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 11
0
        internal bool ChangeUserPassword(UserInfo user, ref string strError)
        {
            string strSql;

            strSql = string.Format("UPDATE T_User SET Password = '******', Modifyer = '{1}', ModifyTime = GETDATE() WHERE ID = {2} ", user.Password, user.Modifyer, user.ID);
            int i = OperationSql.ExecuteNonQuery2(CommandType.Text, strSql);

            return(i >= 1);
        }
Ejemplo n.º 12
0
        public bool PostScanInStockNoSource(string strArraySerialNo, string strAreaNo, string strUserNo, ref string strError)
        {
            bool bResult = false;
            List <StockHead_Model> lstHead;

            try
            {
                QueryStockSumByArraySerialNo(out lstHead, strArraySerialNo, out strError);
                if (lstHead == null || lstHead.Count == 0)
                {
                    if (string.IsNullOrEmpty(strError))
                    {
                        strError = "未找到条码相关数据!";
                    }
                    throw new Exception(strError);
                }
                SqlParameter[] param = new SqlParameter[] {
                    new SqlParameter("strAreaNo", SqlDbType.NVarChar),
                    new SqlParameter("data_xml", SqlDbType.Xml),
                    new SqlParameter("strUserNo", SqlDbType.NVarChar),
                    new SqlParameter("bResult", SqlDbType.Bit),
                    new SqlParameter("strErrMsg", SqlDbType.NVarChar, 1000),
                };

                int i;
                i = 0;
                param[i++].Direction = ParameterDirection.Input;
                param[i++].Direction = ParameterDirection.Input;
                param[i++].Direction = ParameterDirection.Input;
                param[i++].Direction = ParameterDirection.Output;
                param[i++].Direction = ParameterDirection.Output;

                i = 0;
                param[i++].Size = 20;
                param[i++].Size = 30000;
                param[i++].Size = 20;
                param[i++].Size = 1;
                param[i++].Size = 1000;

                param[0].Value = strAreaNo;
                param[1].Value = XMLUtil.XmlUtil.Serializer(typeof(List <StockHead_Model>), lstHead);
                param[2].Value = strUserNo;

                OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "proc_instock_nosource", param);

                bResult  = Convert.ToBoolean(param[3].Value);
                strError = param[4].Value.ToDBString();

                return(bResult);
            }
            catch (Exception ex)
            {
                strError = ex.Message;
                return(false);
            }
        }
Ejemplo n.º 13
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.º 14
0
        public bool UpdateLoginTime(UserInfo user)
        {
            string strSql;

            user.LoginTime = DateTime.Now;
            UserInfo model = new UserInfo();

            if (user.ID >= 1 && user.UserType == 1)
            {
                strSql = string.Format("SELECT LoginIP, LoginDevice FROM T_User WHERE ID = {0}", user.ID);
                using (SqlDataReader dr = OperationSql.ExecuteReader(CommandType.Text, strSql))
                {
                    if (dr.Read())
                    {
                        model.LoginIP     = dr["LoginIP"].ToDBString();
                        model.LoginDevice = dr["LoginDevice"].ToDBString();
                        if (!string.IsNullOrEmpty(model.LoginIP))
                        {
                            if (!string.IsNullOrEmpty(user.LoginIP) && model.LoginIP.IndexOf(user.LoginIP) <= -1)
                            {
                                model.LoginIP     = string.Format("{0};{1}", model.LoginIP, user.LoginIP).Trim(';');
                                model.LoginDevice = string.Format("{0};{1}", model.LoginDevice, user.LoginDevice).Trim(';');
                            }
                        }
                        else
                        {
                            model.LoginIP     = user.LoginIP;
                            model.LoginDevice = user.LoginDevice;
                        }
                    }
                    else
                    {
                        model.LoginIP     = user.LoginIP;
                        model.LoginDevice = user.LoginDevice;
                    }
                }
            }
            else
            {
                model.LoginIP     = user.LoginIP;
                model.LoginDevice = user.LoginDevice;
            }
            strSql = string.Format("UPDATE T_User SET LoginIP = '{0}', LoginTime = GETDATE(), LoginDevice = '{1}' WHERE ID = {2} ", model.LoginIP, model.LoginDevice, user.ID);
            int i = OperationSql.ExecuteNonQuery2(CommandType.Text, strSql);

            return(i >= 1);
        }
Ejemplo n.º 15
0
        internal bool SaveCheckTransList(string xmlTransList, UserInfo user)
        {
            SqlParameter[] param = GetParameterFromModel(xmlTransList, user);

            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_SaveCheckTransList", param);

            string ErrorMsg = param[0].Value.ToDBString();

            if (ErrorMsg.StartsWith("执行错误"))
            {
                throw new Exception(ErrorMsg);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 16
0
        internal bool CheckImportTable(ref string strError)
        {
            try
            {
                string sql = @"
                create table T_P_ImportStock
                (
                  stockid       NUMBER,
                  outbarcodeid  NUMBER,
                  barcode       NVARCHAR2(100),
                  serialno      NVARCHAR2(50),
                  materialno    NVARCHAR2(50),
                  materialdesc  NVARCHAR2(50),
                  isrohs        NUMBER,
                  warehouseno   NVARCHAR2(20),
                  houseno       NVARCHAR2(20),
                  areano        NVARCHAR2(20),
                  qty           NUMBER,
                  tmaterialno   NVARCHAR2(50),
                  tmaterialdesc NVARCHAR2(50),
                  pickareano    NVARCHAR2(20),
                  celareano     NVARCHAR2(20),
                  status        NUMBER,
                  isdel         NUMBER,
                  batchno       NVARCHAR2(30),
                  sn            NVARCHAR2(30),
                  importstatus  NUMBER,
                  importuser    NVARCHAR2(50),
                  importdate    DATE
                )
                ";

                OperationSql.ExecuteNonQuery2(CommandType.Text, sql);
                return(true);
            }
            catch (Exception ex)
            {
                if (ex.Message.IndexOf("ORA-00955") >= 0)
                {
                    return(true);
                }
                strError = (ex.Message);
                return(false);
            }
        }
Ejemplo n.º 17
0
        public bool SaveTaskTrans(ref TaskTransInfo model)
        {
            SqlParameter[] param = GetParameterFromModel(model);

            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_SaveTaskTrans", param);

            string ErrorMsg = param[0].Value.ToDBString();

            if (ErrorMsg.StartsWith("执行错误"))
            {
                throw new Exception(ErrorMsg);
            }
            else
            {
                model.ID = param[1].ToInt32();
                return(true);
            }
        }
Ejemplo n.º 18
0
        public bool InStock(string strToAreaNo, string strTaskXml, UserInfo userModel, ref string strErrMsg)
        {
            #region 验证货位是否合法
            string strsql = string.Format("select 1 from v_area where AREATYPE=1 and AREANO='{0}'", strToAreaNo);
            if (OperationSql.ExecuteScalar(CommandType.Text, strsql, null) == null)
            {
                strErrMsg = "货位不存在或者不是正式货位!";
                return(false);
            }
            #endregion
            try
            {
                int iResult = 0;

                SqlParameter[] cmdParms = new SqlParameter[]
                {
                    new SqlParameter("strToAreaNo", SqlDbType.NVarChar),
                    new SqlParameter("Task_xml", SqlDbType.Xml),
                    new SqlParameter("strUserNo", SqlDbType.NVarChar),
                    //new SqlParameter("bResult", SqlDbType.Int,ParameterDirection.Output),
                    new SqlParameter("bResult", SqlDbType.Int),

                    //new SqlParameter("strErrMsg", SqlDbType.NVarChar,1000,strErrMsg,ParameterDirection.Output)
                    new SqlParameter("strErrMsg", SqlDbType.NVarChar, 1000, strErrMsg)
                };

                cmdParms[0].Value = strToAreaNo;
                cmdParms[1].Value = strTaskXml;
                cmdParms[2].Value = userModel.UserNo;

                cmdParms[3].Direction = ParameterDirection.Output;
                cmdParms[4].Direction = ParameterDirection.Output;

                OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "p_instock", cmdParms);
                iResult   = Convert.ToInt32(cmdParms[3].Value.ToString());
                strErrMsg = cmdParms[4].Value.ToString();

                return(iResult == 1 ? true : false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 19
0
        public bool CheckImportTable(ref string strError)
        {
            try
            {
                string sql = @"
                create table T_P_IMPORTAREA
                (
                  warehouseid       NUMBER,
                  warehouseno       NVARCHAR2(50),
                  warehousename     NVARCHAR2(50),
                  warehouselocation NVARCHAR2(200),
                  warehousestatus   NUMBER,
                  houseid           NUMBER,
                  houseno           NVARCHAR2(50),
                  housename         NVARCHAR2(50),
                  houselocation     NVARCHAR2(200),
                  housestatus       NUMBER,
                  areaid            NUMBER,
                  areano            NVARCHAR2(50),
                  areaname          NVARCHAR2(50),
                  arealocation      NVARCHAR2(200),
                  areastatus        NUMBER,
                  areatype          NUMBER,
                  areatypename      NVARCHAR2(50),
                  importstatus      NUMBER,
                  importuser        NVARCHAR2(50),
                  importdate        DATE
                )
                ";

                OperationSql.ExecuteNonQuery2(CommandType.Text, sql);
                return(true);
            }
            catch (Exception ex)
            {
                if (ex.Message.IndexOf("ORA-00955") >= 0)
                {
                    return(true);
                }
                strError = (ex.Message);
                return(false);
            }
        }
Ejemplo n.º 20
0
        internal bool SaveCheckTransList(ref CheckTransInfo model)
        {
            model.OperationTime = DateTime.Now;
            SqlParameter[] param = GetListParameterFromModel(model);

            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_SaveCheckTransList", param);

            string ErrorMsg = param[0].Value.ToDBString();

            if (ErrorMsg.StartsWith("执行错误"))
            {
                throw new Exception(ErrorMsg);
            }
            else
            {
                model.ID            = param[1].Value.ToInt32();
                model.OperationTime = param[param.Length - 1].Value.ToDateTime();
                return(true);
            }
        }
Ejemplo n.º 21
0
        public bool SaveSpecialReturnMaterial(ref SpecialReturnMaterial model)
        {
            SqlParameter[] param = GetParameterFromModel(model);

            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_SaveSpecialReturnMaterial", param);

            string ErrorMsg = param[0].Value.ToDBString();

            if (ErrorMsg.StartsWith("execution error"))
            {
                throw new Exception(ErrorMsg);
            }
            else
            {
                model.ID         = param[1].Value.ToInt32();
                model.CreateTime = param[param.Length - 3].Value.ToDateTime();
                model.ModifyTime = param[param.Length - 1].Value.ToDateTimeNull();
                return(true);
            }
        }
Ejemplo n.º 22
0
        public bool SaveReceipt(ref ReceiptHead model, UserInfo user)
        {
            SqlParameter[] param = GetParameterFromModel(model, user);

            param[0].Value     = XMLUtil.XmlUtil.Serializer(typeof(ReceiptHead), model);
            param[1].Value     = user.UserNo;
            param[2].Direction = ParameterDirection.Output;

            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_SaveRecipt", param);

            string ErrorMsg = param[2].Value.ToDBString();

            if (ErrorMsg.StartsWith("execution error"))
            {
                throw new Exception(ErrorMsg);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 23
0
        public bool CreateReceiveAndShelveTask(string strReceiveGoodsXml, string strUserWareHouseXml, UserInfo userModel, ref string strTaskNo, ref string strErrMsg)
        {
            try
            {
                int iResult = 0;

                SqlParameter[] cmdParms = new SqlParameter[]
                {
                    new SqlParameter("deliveryinfo_xml", SqlDbType.Image),
                    new SqlParameter("strUserWareHouseXml", SqlDbType.Image),
                    new SqlParameter("struserno", SqlDbType.NVarChar),
                    new SqlParameter("struserid", SqlDbType.NVarChar),
                    //new SqlParameter("strtaskno", SqlDbType.NVarChar,100,strTaskNo,ParameterDirection.Output),
                    new SqlParameter("strtaskno", SqlDbType.NVarChar, 100, strTaskNo),

                    //new SqlParameter("bresult", SqlDbType.Int,ParameterDirection.Output),
                    new SqlParameter("bresult", SqlDbType.Int),

                    //new SqlParameter("strerrmsg", SqlDbType.NVarChar,100,strErrMsg,ParameterDirection.Output)
                    new SqlParameter("strerrmsg", SqlDbType.NVarChar, 100, strErrMsg)
                };

                cmdParms[0].Value = strReceiveGoodsXml;
                cmdParms[1].Value = strUserWareHouseXml;
                cmdParms[2].Value = userModel.UserNo;
                cmdParms[3].Value = userModel.ID;


                OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "p_receivecreateshelvetask", cmdParms);
                iResult   = Convert.ToInt32(cmdParms[5].Value.ToString());
                strTaskNo = cmdParms[4].Value.ToString();
                strErrMsg = cmdParms[6].Value.ToString();

                return(iResult == 1 ? true : false);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 24
0
        public bool SaveWarehouse(ref WarehouseInfo model)
        {
            model.CreateTime = DateTime.Now;
            model.ModifyTime = DateTime.Now;
            SqlParameter[] param = GetParameterFromModel(model);

            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_SaveWarehouse", param);

            string ErrorMsg = param[0].Value.ToDBString();

            if (ErrorMsg.StartsWith("执行错误"))
            {
                throw new Exception(ErrorMsg);
            }
            else
            {
                model.ID         = param[1].Value.ToInt32();
                model.CreateTime = param[param.Length - 3].Value.ToDateTime();
                model.ModifyTime = param[param.Length - 1].Value.ToDateTimeNull();
                return(true);
            }
        }
Ejemplo n.º 25
0
        public bool DeleteWarehouseByID(WarehouseInfo model)
        {
            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@ErrorMsg", SqlDbType.NVarChar, 1000),

                new SqlParameter("@v_ID", model.ID.ToSqlValue()),
            };
            param[0].Direction = ParameterDirection.Output;

            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_DeleteWarehouseByID", param);

            string ErrorMsg = param[0].Value.ToDBString();

            if (ErrorMsg.StartsWith("执行错误"))
            {
                throw new Exception(ErrorMsg);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 26
0
        internal bool DealImport(ref string strError)
        {
            strError = string.Empty;
            SqlParameter[] para = new SqlParameter[] {
                new SqlParameter("ErrStrng", SqlDbType.NVarChar, 200, ParameterDirection.Output, true, 0, 0, "ErrStrng", DataRowVersion.Default, strError)
            };
            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_ImportArea", para);
            strError = para[para.Length - 1].Value.ToString();

            if (string.IsNullOrEmpty(strError))
            {
                return(true);
            }
            else if (strError.ToLower() == "null")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 27
0
        internal bool ClearLoginTime(UserInfo user, ref string strError)
        {
            string strSql;

            strSql = "UPDATE T_User SET LoginIP = null, LoginTime = null, LoginDevice = null WHERE (SUBSTRING(LOGINIP,0,2) = 'PC' AND (LOGINTIME + (30/60/24)) <= GETDATE()) OR (USERTYPE <> 1 AND LOGINTIME IS NULL) ";
            OperationSql.ExecuteNonQuery2(CommandType.Text, strSql);
            if (user.ID >= 1 && user.UserType == 1)
            {
                //strSql = string.Format("UPDATE T_User SET LoginIP = ltrim(rtrim(replace(LoginIP,'{1}',''),';'),';'), LoginTime = null, LoginDevice = ltrim(rtrim(replace(LoginDevice,'{2}',''),';'),';') WHERE ID = {0} ", user.ID, user.LoginIP, user.LoginDevice);
                //SQLSERVER语法不支持上述语句
                strSql = string.Format("UPDATE T_User SET LoginIP = case when left(replace(LoginIP,'{1}',''),1)=';' then right(replace(LoginIP,'{1}',''),len(replace(LoginIP,'{1}',''))-1) when right(replace(LoginIP,'{1}',''),1)=';' then left(replace(LoginIP,'{1}',''),len(replace(LoginIP,'{1}',''))-1) else replace(LoginIP,'{1}','') end, LoginTime = null, LoginDevice = case when left(replace(LoginDevice,'{2}',''),1)=';' then right(replace(LoginDevice,'{2}',''),len(replace(LoginDevice,'{2}',''))-1) when right(replace(LoginDevice,'{2}',''),1)=';' then left(replace(LoginDevice,'{2}',''),len(replace(LoginDevice,'{2}',''))-1) else replace(LoginDevice,'{2}','') end WHERE ID = {0} ", user.ID, user.LoginIP, user.LoginDevice);
            }
            else
            {
                strSql = string.Format("UPDATE T_User SET LoginIP = null, LoginTime = null, LoginDevice = null WHERE ID = {0} ", user.ID);
            }
            int i = OperationSql.ExecuteNonQuery2(CommandType.Text, strSql);

            strSql = "UPDATE T_User SET LoginIP = replace(LoginIP,';;',';'), LoginDevice = replace(LoginDevice,';;',';')";
            OperationSql.ExecuteNonQuery2(CommandType.Text, strSql);
            return(i >= 1);
        }
Ejemplo n.º 28
0
        public bool ExistsTaskTransNo(TaskTransInfo model, bool bIncludeDel)
        {
            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@ErrorMsg", SqlDbType.NVarChar, 1000),

                //new SqlParameter("@v_TaskTransNo", model.TaskTransNo.ToDBValue()),
                new SqlParameter("@IncludeDel", bIncludeDel.ToSqlValue()),
            };
            param[0].Direction = ParameterDirection.Output;

            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_ExistsTaskTransNo", param);

            string ErrorMsg = param[0].Value.ToDBString();

            if (ErrorMsg.StartsWith("执行错误"))
            {
                throw new Exception(ErrorMsg);
            }
            else
            {
                return(string.IsNullOrEmpty(ErrorMsg));
            }
        }
Ejemplo n.º 29
0
        internal bool SaveUserGroupMenuToDB(MenuInfo model, UserGroupInfo UserGroup, ref string strError)
        {
            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@ErrorMsg", SqlDbType.NVarChar, 1000),

                new SqlParameter("@v_MenuID", model.ID.ToSqlValue()),
                new SqlParameter("@v_UserGroupID", UserGroup.ID.ToSqlValue()),
                new SqlParameter("@v_IsChecked", model.BIsChecked.ToSqlValue()),
            };
            param[0].Direction = ParameterDirection.Output;

            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_NewSaveGroupWithMenu", param);

            string ErrorMsg = param[0].Value.ToDBString();

            if (ErrorMsg.StartsWith("执行错误"))
            {
                throw new Exception(ErrorMsg);
            }
            else
            {
                return(string.IsNullOrEmpty(ErrorMsg));
            }
        }
Ejemplo n.º 30
0
        public bool calcData(List <ProdHead> lstProd, ref ProdHead prod, UserInfo user, ref string strError)
        {
            prod     = new ProdHead();
            strError = string.Empty;

            #region 制法及建筑获取
            Building_Func      bf   = new Building_Func();
            Preparation_Func   pf   = new Preparation_Func();
            List <Building>    lstB = new List <Building>();
            Building           b    = new Building();
            List <Preparation> lstP = new List <Preparation>();
            Preparation        p    = new Preparation();
            bf.GetBuildingList(ref lstB, b, user, ref strError);
            pf.GetPreparationList(ref lstP, p, user, ref strError);
            foreach (var outer in lstP)
            {
                foreach (var inner in lstB)
                {
                    if (outer.bid == inner.ID)
                    {
                        if (inner.lstP != null)
                        {
                            lstP = new List <Preparation>();
                        }
                        inner.lstP.Add(outer);
                    }
                }
            }
            #endregion

            List <ProdHead>    lstMetaData     = new List <ProdHead>();
            List <ProdDetails> lstMetaDetails  = new List <ProdDetails>();
            List <ProdDetails> lstGroupDetails = new List <ProdDetails>();//按物料和建筑编号分组的需求信息
            ProdHead           TmpProd         = new ProdHead();
            foreach (var item in lstProd)
            {
                GetProdDetailByProdOrdID(item, ref TmpProd, ref strError);
                lstMetaData.Add(TmpProd);
            }
            List <string> lstMinvtID = new List <string>();
            foreach (var item in lstMetaData)
            {
                lstMinvtID = lstMinvtID.Union <string>(item.lstDetails.Select(s => s.MInvtID).Distinct().ToList()).ToList();
            }
            string workShopNo = string.Empty;
            foreach (var item in lstMetaData)
            {
                item.BuildingNo = lstB.FirstOrDefault(s => s.lstP.Exists(x => x.pCode.Equals(item.ProdMgrID))).bNo;
                workShopNo      = lstB.FirstOrDefault(s => s.lstP.Exists(x => x.pCode.Equals(item.ProdMgrID))).WareHouseNo;
                foreach (var detail in item.lstDetails)
                {
                    detail.ProdMgrID  = item.ProdMgrID;
                    detail.BuildingNo = item.BuildingNo;
                    detail.WorkShopNo = workShopNo;
                    detail.iGrade     = lstB.FirstOrDefault(s => s.bNo.Equals(detail.BuildingNo)).iGrade;
                }
                lstMetaDetails.AddRange(item.lstDetails);
            }
            foreach (var item in lstMetaDetails)
            {
                ProdDetails model = lstGroupDetails.Find(s => s.BuildingNo.Equals(item.BuildingNo) && s.MInvtID.Equals(item.MInvtID));
                if (model == null)
                {
                    lstGroupDetails.Add(item);
                }
                else
                {
                    model.QtyReq += item.QtyReq;
                }
            }
            lstGroupDetails = (from model in lstGroupDetails orderby model.InvtID, model.iGrade select model).ToList();
            string strArrayMaterialNo = string.Empty;
            foreach (var item in lstMinvtID)
            {
                strArrayMaterialNo += item;
            }
            strArrayMaterialNo = strArrayMaterialNo.Substring(0, strArrayMaterialNo.Length - 1);
            #region 获取线边仓及车间仓库存
            Stock_DB stb = new Stock_DB();
            List <StockHead_Model> lstStockSum = new List <StockHead_Model>();
            stb.QueryStockSumForTransfer(out lstStockSum, strArrayMaterialNo, out strError);
            #endregion
            List <StockReader> lstReader = new List <StockReader>();
            foreach (var item in lstGroupDetails)
            {
                StockReader sr     = lstReader.Find(s => s.InvtID.Equals(item.InvtID));
                bool        bFound = true;
                if (string.IsNullOrEmpty(sr.InvtID))
                {
                    bFound           = false;
                    sr               = new StockReader();
                    sr.InvtID        = item.InvtID;
                    sr.workshopStock = lstStockSum.FirstOrDefault(model => model.MaterialNo == item.InvtID && model.WarehouseNo == item.WorkShopNo).iQuantity;
                    sr.currentStock  = lstStockSum.FirstOrDefault(model => model.MaterialNo == item.InvtID && model.WarehouseNo == "01").iQuantity;
                }
                if (bFound)//获取当前料车间库存
                {
                    sr.workshopStock = lstStockSum.FirstOrDefault(model => model.MaterialNo == item.InvtID && model.WarehouseNo == item.WorkShopNo).iQuantity;
                }
                item.CurrentStock  = sr.currentStock;
                item.WorkshopStock = sr.workshopStock;
                if (item.SceneMaterial.Trim().Equals("1"))//现场物料,不用返还
                {
                    item.sInvType = "现场物料";
                    if (item.QtyReq <= sr.workshopStock)
                    {
                        item.iOperate = 0;
                        item.sOperate = "无动作";
                    }
                    else
                    {
                        item.iOperate = 1;
                        item.sOperate = "领料";
                        if (item.QtyReq - sr.workshopStock <= sr.currentStock - sr.useageStock)
                        {
                            item.dTransfer  = item.QtyReq - sr.workshopStock;
                            sr.useageStock += item.QtyReq - sr.workshopStock;
                        }
                        else
                        {
                            item.dTransfer = sr.currentStock - sr.useageStock;
                            sr.useageStock = sr.currentStock;
                        }
                    }
                }
                else if (bMustReturn(item))
                {
                    item.sInvType = "必返品";
                    item.iOperate = -2;
                    if (item.QtyReq <= sr.workshopStock)
                    {
                        //item.iOperate = item.QtyReq == sr.workshopStock ? 0 : -2;
                        item.sOperate  = item.QtyReq == sr.workshopStock ? "无动作" : "返料";
                        item.dTransfer = sr.workshopStock - item.QtyReq;
                    }
                    else
                    {
                        //item.iOperate = 1;
                        item.sOperate = "领料";
                        if (item.QtyReq - sr.workshopStock <= sr.currentStock - sr.useageStock)
                        {
                            item.dTransfer  = item.QtyReq - sr.workshopStock;
                            sr.useageStock += item.QtyReq - sr.workshopStock;
                        }
                        else
                        {
                            item.dTransfer = sr.currentStock - sr.useageStock;
                            sr.useageStock = sr.currentStock;
                        }
                    }
                }
                else//普通料
                {
                    item.sInvType = "普通料";
                    if (item.QtyReq <= sr.workshopStock)
                    {
                        item.iOperate  = item.QtyReq == sr.workshopStock ? 0 : -1;
                        item.sOperate  = item.QtyReq == sr.workshopStock ? "无动作" : "返料";
                        item.dTransfer = sr.workshopStock - item.QtyReq;
                    }
                    else
                    {
                        item.iOperate = 1;
                        item.sOperate = "领料";
                        if (item.QtyReq - sr.workshopStock <= sr.currentStock - sr.useageStock)
                        {
                            item.dTransfer  = item.QtyReq - sr.workshopStock;
                            sr.useageStock += item.QtyReq - sr.workshopStock;
                        }
                        else
                        {
                            item.dTransfer = sr.currentStock - sr.useageStock;
                            sr.useageStock = sr.currentStock;
                        }
                    }
                }

                if (!bFound)
                {
                    lstReader.Add(sr);
                }
            }

            prod.lstDetails = lstGroupDetails;

            #region 给实体类赋伪值,防止部分需要回写属性不被序列化
            prod.AllotNo     = "0000";
            prod.AllotID     = 0;
            prod.AllotDate   = DateTime.MaxValue;
            prod.AllotUserNo = "NO ONE";
            foreach (var item in prod.lstDetails)
            {
                item.AllotDetailID = 0;
                item.AllotRowNo    = 0;
            }
            #endregion

            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("data_xml", SqlDbType.Xml),
                new SqlParameter("strUserNo", SqlDbType.NVarChar),
                new SqlParameter("strErrMsg", SqlDbType.NVarChar, 1000),
            };
            param[0].Direction = ParameterDirection.Input;
            param[1].Direction = ParameterDirection.Input;
            param[2].Direction = ParameterDirection.Output;
            param[0].Size      = 3000;
            param[1].Size      = 20;
            param[2].Size      = 1000;
            param[0].Value     = XMLUtil.XmlUtil.Serializer(typeof(ProdHead), prod);
            param[1].Value     = user.UserNo;
            OperationSql.ExecuteNonQuery2(CommandType.StoredProcedure, "Proc_SaveTransfer", param);

            string ErrorMsg = param[2].Value.ToDBString();
            if (ErrorMsg.StartsWith("execution error"))
            {
                throw new Exception(ErrorMsg);
            }
            prod = (ProdHead)XMLUtil.XmlUtil.Deserialize(typeof(ProdHead), param[0].Value.ToString());

            return(true);
        }