using System;
using System.Linq;
using QMAPP.FJC.Entity.CompleteStatistics.Table;
using QMFrameWork.Data.Attributes;
namespace QMAPP.FJC.Entity.CompleteStatistics
{
///
/// 完工统计表
///
[DBTable(TableName = "T_AW_COMPLETE_STATISTICS", TimeStampColumn = "UPDATETIME")]
public class CompleteStatisticsEntity : T_AW_COMPLETE_STATISTICS
{
public string MATERIALNAME { get; set; }
public string PRODUCTLINE { get; set; }
public string CREATEUSER_DISPLAY { get; set; }
public string UPDATEUSER_DISPLAY { get; set; }
public string SENDTIME { get; set; }
public string EENDTIME { get; set; }
public string DOESEXPORT
{
get
{
if (!string.IsNullOrEmpty(this.DELFLAG) && this.DELFLAG.Equals("1"))
{
return "是";
}
return "否";
}
}
//For File
public string EMPLOYEE { get; set; }
public string SITE { get; set; }
public string SHIFT { get; set; }
public string EDIMAT { get; set; }
public string SERIAL { get; set; }
public string USERID { get; set; }
public override string ToString()
{
string format = "\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\",{6},\"{7}\",\"{8}\",{9},{10}";
return string.Format(format, this.EMPLOYEE, this.SITE, this.SHIFT, this.MATERIALNO.Trim(), this.PRODUCTLINE, this.EDIMAT, this.SERIAL, this.USERID
, this.ORDERNO, this.COMPLETECOUNT, this.STARTTIME.ToString("MM/dd/yy"));
}
public string ToSQL()
{
System.Text.StringBuilder sql = new System.Text.StringBuilder();
sql.Append("INSERT INTO xxmes_bk_det(xxmes_bk_site,xxmes_bk_part,xxmes_bk_qty,xxmes_bk_line,xxmes_bk_doc,xxmes_bk_shift,xxmes_bk_emp,xxmes_bk_effdate,xxmes_bk_prod,xxmes_bk_qadread) ");
sql.Append("values ");
sql.AppendFormat("('{0}'", this.SITE);//xxmes_bk_site
sql.AppendFormat(",'{0}'", this.MATERIALNO);//xxmes_bk_part
sql.AppendFormat(",'{0}'", this.COMPLETECOUNT);//xxmes_bk_qty
sql.AppendFormat(",'{0}'", this.PRODUCTLINE);//xxmes_bk_line
sql.AppendFormat(",'{0}'", this.ORDERNO);//xxmes_bk_doc
sql.AppendFormat(",'{0}'", this.SHIFT);//xxmes_bk_shift
sql.AppendFormat(",'{0}'", this.EMPLOYEE);//xxmes_bk_emp
sql.AppendFormat(",'{0:yyyy-MM-dd HH:mm:ss}'", this.ENDTIME);//xxmes_bk_effdate
sql.AppendFormat(",'{0}'", this.ORDERNO.Substring(0, 4));//xxmes_bk_prod
sql.AppendFormat(",'0')");//xxmes_bk_qadread
//string format = "\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\",{6},\"{7}\",\"{8}\",{9},{10}";
//return string.Format(format, this.EMPLOYEE, this.SITE, this.SHIFT, this.MATERIALNO.Trim(), this.PRODUCTLINE, this.EDIMAT, this.SERIAL, this.USERID
// , this.ORDERNO, this.COMPLETECOUNT, this.STARTTIME.ToString("MM/dd/yy"));
return sql.ToString();
}
///
/// 根据GUID获取16位的唯一字符串
///
///
private string GuidTo16String()
{
long i = Guid.NewGuid().ToByteArray().Aggregate(1, (current, b) => current*((int) b + 1));
return string.Format("{0:x}", i - DateTime.Now.Ticks).PadRight(16, '0').ToUpper();
}
}
}