Beispiel #1
0
        /// <summary>
        ///     查询是否已核对
        /// </summary>
        /// <param name="wonoStr">工单号</param>
        /// <returns></returns>
        private static bool IsChecked(string wonoStr)
        {
            var sql       = $"SELECT checked FROM tf_sgdantwo WHERE shigongdanhao='{wonoStr}'";
            var isChecked = SqlHelper.ExecuteScalar(SqlHelper.GetConnSting(), CommandType.Text, sql);

            return(isChecked != null && (bool)isChecked);
        }
Beispiel #2
0
        /// <summary>
        ///     新增
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnInsert_Click(object sender, EventArgs e)
        {
            var orderId = DateTime.Now.ToString("yyMM").Substring(1, 3);
            var ddaa    = orderId + "0001";
            var aadd    = orderId + "9999";
            var sql     = $"SELECT Max(twoid) FROM mf_sgdan WHERE twoid>={ddaa} AND twoid<={aadd}";
            var scalar  = SqlHelper.ExecuteScalar(SqlHelper.GetConnection(), CommandType.Text, sql);

            if (scalar.ToString() == "")
            {
                txtWONo.Text      = ddaa;
                btnInsert.Enabled = false;
                btnSave.Enabled   = true;
                txtOriWONo.Focus();
                txtSn.Text = @"1";
            }
            else
            {
                if (scalar.ToString() == aadd)
                {
                    MessageBox.Show(@"手工工单已经达到9999份上限,编号要重新生成!", Resources.T提示);
                }
                else
                {
                    var maxtid = (int)scalar;
                    maxtid           += 1;
                    txtWONo.Text      = maxtid.ToString();
                    btnInsert.Enabled = false;
                    btnSave.Enabled   = true;
                    txtOriWONo.Focus();
                    txtSn.Text = @"1";
                }
            }
            EnableCtrls(true);
        }