How to automatically increase the document number through the C # implementation.

zhaozj2021-02-16  123

Below, I give a code. It has a complete comment.

Using system;

Namespace BaseLayer {///

/// document number, generate a self-inclusive number, such as: into "DJ000002", will return "DJ000003" ///

Public class sheetnumber {/// // document number, generate self-inclusive number, such as: into "DJ000002", will return "DJ000003" /// /// ingredient ////

Next value

Public string nextnumber (string newumber = "; // new value int inNumber = 1; // carry int placeValue; // bit value char [] no = BaseNumber.tochararray (); for (int i = basenumber) .Length-1; i> = 0; i - {= === 9 '&& innumber == 1) {Innumber = 1; newNumber = "0" newNumber;} else f (Innumber) == 1 && No [i]> = '0' && no [i] <'9') {PlaceValue = Int32.Parse (No [i] .tostring ()); PlaceValue = (Innumber PlaceValue); Innumber = 0; NewNumber = PlaceValue.ToString () NewNumber;} else {InNumber = 0; NewNumber = No [i] NewNumber;}} if (BaseNumber == NewNumber) NewNumber = "0000000001"; return NewNumber;}}}

OK. If you encounter your own additional document numbers later. This section should be possible to achieve your requirements? ^ _ ^

转载请注明原文地址:https://www.9cbs.com/read-14331.html

New Post(0)