Esempio n. 1
0
        /// <summary>
        /// TODO 查詢容量 是否綁定
        /// </summary>
        /// <param name="ctCode"></param>
        /// <returns></returns>
        public bool exists(CapacityRelCus capacityRelCus)
        {
            bool          repeatJudge = false;
            StringBuilder strSql      = new StringBuilder();

            strSql.Append("select count(1) from t_cap_relcus where cus_no=@cusNo and del_matno=@delMatno and capacity_type=@capacityType and del_flag is null");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@cusNo",        MySqlDbType.VarChar, 900),
                new MySqlParameter("@delMatno",     MySqlDbType.VarChar, 900),
                new MySqlParameter("@capacityType", MySqlDbType.VarChar, 900),
                new MySqlParameter("@capacityNo",   MySqlDbType.VarChar, 900)
            };
            parameters[0].Value = capacityRelCus.CusNo;
            parameters[1].Value = capacityRelCus.DelMatno;
            parameters[2].Value = capacityRelCus.CapacityType;
            parameters[3].Value = capacityRelCus.CapacityNo;
            int rows = int.Parse(SQLHelper.ExecuteScalar(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters).ToString().Trim());

            if (rows > 0)
            {
                repeatJudge = true;
            }
            return(repeatJudge);
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text == null || this.textBox1.Text.Trim() == "")
            {
                MessageBox.Show("出貨料號不能為空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.textBox1.Focus();
                return;
            }
            string         boundType      = this.comboBox1.SelectedValue == null ? "1" : this.comboBox3.SelectedValue.ToString();
            CapacityRelCus capacityRelCus = new CapacityRelCus();

            capacityRelCus.DelMatno     = this.textBox1.Text.Trim();
            capacityRelCus.CusNo        = this.comboBox1.SelectedValue.ToString().Trim();
            capacityRelCus.CapacityNo   = this.comboBox2.SelectedValue.ToString().Trim();
            capacityRelCus.CapacityType = boundType;
            if (capacityService.exists(capacityRelCus))
            {
                MessageBox.Show("該客戶和出貨料號已經綁定容量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (capacityService.saveCapacityRelCus(capacityRelCus))
            {
                MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// TODO 保存容量與出貨料號關係
        /// </summary>
        /// <param name="ctRelCarton"></param>
        /// <returns></returns>
        public bool saveCapacityRelCus(CapacityRelCus capacityRelCus)
        {
            capacityRelCus.Uuid       = Auxiliary.Get_UUID();
            capacityRelCus.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            capacityRelCus.OpUser     = Auxiliary.loginName;

            return(capacityDao.saveCapacityRelCus(capacityRelCus));
        }
Esempio n. 4
0
        /// <summary>
        /// 保存容量與出貨料號關係
        /// </summary>
        /// <param name="carton"></param>
        /// <returns></returns>
        public bool saveCapacityRelCus(CapacityRelCus capacityRelCus)
        {
            bool          saveMark = true;
            StringBuilder strSql   = new StringBuilder();

            strSql.Append("insert into t_cap_relcus (uuid,capacity_no,cus_no,del_matno,capacity_type,op_user,create_time)");
            strSql.Append("values(@uuid,@capacityNo,@cusNo,@delMatno,@capacityType,@opuser,@createtime)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@uuid",         MySqlDbType.VarChar, 900),
                new MySqlParameter("@capacityNo",   MySqlDbType.VarChar, 900),
                new MySqlParameter("@cusNo",        MySqlDbType.VarChar, 900),
                new MySqlParameter("@delMatno",     MySqlDbType.VarChar, 900),
                new MySqlParameter("@capacityType", MySqlDbType.VarChar, 900),
                new MySqlParameter("@opuser",       MySqlDbType.VarChar, 900),
                new MySqlParameter("@createtime",   MySqlDbType.VarChar, 900)
            };
            parameters[0].Value = capacityRelCus.Uuid;
            parameters[1].Value = capacityRelCus.CapacityNo;
            parameters[2].Value = capacityRelCus.CusNo;
            parameters[3].Value = capacityRelCus.DelMatno;
            parameters[4].Value = capacityRelCus.CapacityType;
            parameters[5].Value = capacityRelCus.OpUser;
            parameters[6].Value = capacityRelCus.CreateTime;
            int rows = SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                saveMark = true;
            }
            else
            {
                saveMark = false;
            }
            return(saveMark);
        }
Esempio n. 5
0
 /// <summary>
 /// TODO 根據CT碼查詢是否已經 綁定
 /// </summary>
 /// <param name="ctCode"></param>
 /// <returns></returns>
 public bool exists(CapacityRelCus capacityRelCus)
 {
     return(capacityDao.exists(capacityRelCus));
 }