Copy codeThe Code is as follows:
# Region generate document number
/// <Summary>
/// Generate document No.
/// </Summary>
/// <Param name = "pFromType"> </param>
/// <Returns> </returns>
Public static string GetFormCode (FormType pFromType)
{
String formcode = "";
Switch (pFromType)
{
Case FormType. CaiGou:
{
Formcode = "CG ";
Break;
}
Case FormType. ChaiXie:
{
Formcode = "CX ";
Break;
}
Case FormType. ChuKu:
{
Formcode = "CK ";
Break;
}
Case FormType. LingLiao:
{
Formcode = "LL ";
Break;
}
Case FormType. PeiChang:
{
Formcode = "PC ";
Break;
}
Case FormType. RuKu:
{
Formcode = "RK ";
Break;
}
Case FormType. ShengChan:
{
Formcode = "SC ";
Break;
}
Case FormType. SunYi:
{
Formcode = "SY ";
Break;
}
Case FormType. TuiHuo:
{
Formcode = "TH ";
Break;
}
Case FormType. XiaoShou:
{
Formcode = "XS ";
Break;
}
Case FormType. PeiSong:
{
Formcode = "PS ";
Break;
}
Case FormType. ZengPin:
{
Formcode = "ZP ";
Break;
}
Case FormType. FuKuan:
{
Formcode = "FK ";
Break;
}
Case FormType. ShouKuan:
{
Formcode = "SK ";
Break;
}
}
Formcode + = DateTime. Now. Year. ToString ();
Formcode + = DateTime. Now. Month. ToString (). Length = 1? "0" + DateTime. Now. Month. ToString (): DateTime. Now. Month. ToString ();
Formcode + = DateTime. Now. Day. ToString (). Length = 1? "0" + DateTime. Now. Day. ToString (): DateTime. Now. Day. ToString ();
Formcode + = DateTime. Now. Hour. ToString (). Length = 1? "0" + DateTime. Now. Hour. ToString (): DateTime. Now. Hour. ToString ();
Formcode + = DateTime. Now. Minute. ToString (). Length = 1? "0" + DateTime. Now. Minute. ToString (): DateTime. Now. Minute. ToString ();
Formcode + = DateTime. Now. Second. ToString (). Length = 1? "0" + DateTime. Now. Second. ToString (): DateTime. Now. Second. ToString ();
If (DateTime. Now. Millisecond. ToString (). Length = 1)
{
Formcode + = "00" + DateTime. Now. Millisecond. ToString ();
}
Else if (DateTime. Now. Millisecond. ToString (). Length = 2)
{
Formcode + = "0" + DateTime. Now. Millisecond. ToString ();
}
Else
{
Formcode + = DateTime. Now. Millisecond. ToString ();
}
Return formcode;
}
# Endregion