Use VB.NET and Excel production plans - one of corporate informationization

zhaozj2021-02-16  50

Plan with VB.NET and Excel

- One of the Enterprise Informationization of Enterprise Sunhai

Development Tools: Microsoft Visual Studio .NET 2003 operating system: Windows XP

Discussion on the Causes of Enterprise Informationization Failure

The success rate of China 's online ERP is not high. Why is this? The practical ERP system has two features: 1. Requirement of highly customizable 2. You must modify the ERP system at any time according to the actual actual

Now that the company's ERP system development basic adopts outsourced mode, the developers can also go deep into the company's departments, master all aspects of information, and then customize development. However, the developer is not the actual practitioner of the company, and the breadth of the information is limited. After all, the depth is limited, so, in general, the ERP system developed is difficult to ensure the first feature: requirements are highly customizable. On the other hand, the actual situation of the company may change at any time, and the ERP system must be modified at any time to meet the needs of the enterprise at any time. If you say, the ERP system is to meet the needs of the company. After a year? Of course, developers can track business needs and modify the ERP system at any time, but is not very convenient.

Ideal enterprise informationization model

Personally, the ideal enterprise information model is like this: 1. The development of enterprise information systems should be conducted by internal personnel, rather than outsource only, the two features required by the practical ERP system: require high customization Sex; can be able to modify the ERP system at any time according to the actual situation. 2. Enterprise informationization should start from actual work, gradually promote the company's actual practitioners (and developers) from the actual work needs to start, develop corresponding information modules, functions, and gradually improve. In reality, many enterprises developed a lot of information systems, but how many people will be used, eventually is a flower stand. Just like the unit of the author, it is impossible to say that small is small, but it is impossible to implement information management. The qualities of various departments of enterprises are different, and it is impossible to be universally accepted. What is the biggest difficulty to implement the ideal enterprise informationization model described? The biggest difficulties are rare talents, and specific managers must have two capabilities: management capabilities and development capabilities. This kind of talent is not available for every company. Although I can't talk about any talents, I have been engaged in corporate management in recent years, and I know a slightly known for the development of the information management system. The author may practice "ideal enterprise information model" and share the relevant experience with everyone.

Company actual situation analysis

Since 2004, my competent program work, including the development and delivery of product production plans, self-cultivation production plans, and external part purchases. It turns out that the company has always been written in hand, because the company's products have more models, if I use it by manual, there is more planning, and I can't do anything about mechanical writing. So I consider replacing some mechanical work with a computer, I can make efforts to catch other things. Can a computer can help, which mechanical work I do? For example, each finished product is assembled from the part, and the part is divided into self-cultivation and external access. Which parts of each product are fixed. Every month's production plan is to be broken down into a self-cultivation plan and a procurement plan. I decided to give a computer to the computer. What is the development tool for program development mode uses what development models implements the required function? The company is temporarily only using my own use. There is not much functionality to achieve, and there is no need to use complex large database systems at the beginning. For the convenience of information sharing, I decided to call Excel with VB.NET to implement functional modules. Why do I use VB.NET without C # because there is a VBA in Excel, which is approximately in the syntax and VB.NET. Moreover, the difference between VB.NET and C # is mainly grammar, not functional. I now use the implementation of the program to automatically arrange the "Self-Material Production Plan". This feature does not need VB.NET, and the VBA can be easily implemented. However, considering the possible functional expansion, upgrade, or use VB.NET. VB.NET is a development tool for development tools, which is very convenient to call Excel. It is not difficult to use VB6, VB.NET and the primary application is not difficult. Why do you have to use an earlier version without using the latest version, master the latest technology! The Software Contemporary Software With VB.NET and Excel Range Plan: First in Excel, the "Self-Material Production Plan" sample table (template) is saved as a self-cultivation plan. Xls, where only one sheet: sample table . Set a variety of formats in the sample form, fill in the fixed item. Create a white Workbook, saved as a 2004 home production plan. Xls. Newly built a VB.NET application, named the production plan. Put a few controls on the form, such as: Several text boxes, used to enter the number of products; Checkbox is used to choose a formal production plan or add a production plan; another use two text boxes to enter the planning time and Plan number. Click on Button, and the program opens the self-cultivated production plan. XLS and the 2004 self-cultivation plan .xls, put the sample table COPY to the 2004 self-cultivation plan .xls, and automatically fill in the number of respective parts that require production in the target sheet. Here is the implementation of code and detailed comments. Note that you must add a COM to Microsoft Excel Object Library, I am Office 2003, reference Microsoft Excel 11.0 Object Library.

Private Sub ProductPlan () call killexcel () Call killexcel () Call Kill Excel process process' The following code determines whether the user fills in the information is complete, if it is not complete, the prompt information is prompted and exits. If ChkMMal.Checked = false and chksubjoin.checked = false kilbox ( "Is it a formal plan or a supplement plan ??", "MsgBoxStyle.critical," Please select Program Properties ") EXIT SUB End if IF txtday.text =" 2004 "THEN MSGBOX (" What month of the production plan??? " , MsgBoxStyle.critical, "Please fill in the plan time") EXIT SUB END IF TXT703.TEXT = Nothing or txt909.text = Nothing or txt931.text = Nothing The msgbox ("Please fill in the planner!" , MsgBoxStyle.critical, "Schedule number fill in") exit sub end if if chkformal.checked = true and chksubjoin.checked = true kilbox ("Formal and adding only one!", Msgboxstyle.critical, "Please Reselect Plan Properties ") EXIT SUB END IF 'The following code is calculated by calculating the number of individual self-powered, using Chinese to free code notes DIM Coated Code Pole 703 AS Integer = CTYPE (TXT703.TEXT, INTEGER) DIM Titanium Golden panel 909 as integer = ctype (txt909.text, integer) DIM Oil mill stainless steel panel 931 as integer = ctype (txt931.text, integer) DIM Oil mill stainless steel panel 932 as integer = ctype (txt932.text, integer) DIM chassis 24 AS Integer = Coated Off Dragon Panel 703 DIM Chassis 22 AS INTEGER = Titanium Gold Panel 909 D IM chassis 41a as integer = oil mill stainless steel panel 931 DIM chassis 41b as integer = oil mill stainless steel panel 931 DIM water tray 25 AS integer = coated fluoro Dragon panel 703 DIM water tray 24 AS INTEGER = Coated fluoro Dragon panel 703 DIM water tray 22 As integer = titanium panel 909 * 2 DIM center bracket 2 AS integer = Coated fluoro panel 703 titanium gold panel 909 DIM long bracket 931 as integer = (oil mill stainless steel panel 931 oil mill stainless steel panel 932) * 2 DIM bracket 931U as integer = oil mill stainless steel panel 931 * 2 DIM bracket 932U As INTEGER = oil mill stainless steel panel 932 * 2 DIM head clipping AS integer = (titanium gold panel 909 oil mill stainless steel panel 932) * 2 DIM battery holdings As integer = (Coated fluorofalake panel 703 titanium gold panel 909 oil mill stainless steel panel 931 oil mill stainless steel panel 932) * 2 DIM Threads Clipping AS INTEGER =

Battery Climb / 2 DIM Furnace AS INTEGER = Battery Clipping * 3 'Defines an array that is convenient to write numbers in Excel, or you can implement DIM allnum () as integer = _ { Coated fluorofalake panel 703, titanium gold panel 909, oil mill stainless steel panel 931, oil mill stainless steel panel 932, _ chassis 24, chassis 22, chassis 41a, chassis 41b, _ water tray 25, water tray 24, water tray 22, _ Center bracket 2, long bracket 931, bracket 931U, bracket 932U, _ magnetic head clipping, battery holdings, three-way clipping, furnace pad} DIM EXCELAPP AS New Excel.Application Dim ExcelBook AS Excel.Workbook "Homemaster Production Plan. XLS DIM EXCELBOOK2004 AS Excel.Workbook '2004 Home Production Plan. XLS DIXELWORKSHEET AS Excel.Worksheet Dim PLANPROPERTY AS STRING' Program Nature, is a formal plan or a supplement plan TRY 'It is recommended to capture errors in a try mode, handle EXCELBOOK = excelApp.Workbooks.Open (Application.StartupPath & "/ self-made parts production plan .xls") excelbook2004 = excelApp.Workbooks.Open (Application.StartupPath & "/ 2004 Nian homemade production planning .xls") excelWorksheet = CType (excelBook. Worksheets, Excel.Worksheet) Excelworksheet.copy (after: = ExcelBook2004.Sheets ("Sheet1")) 'Turn Sample COPY to <2004 Home Production Plan> Workbook SHEET1 in the back Excelapp.visible = True 'Settings Working is Visual if Chkformal.Checked = True Then PlanProperty = "official" elseif chksub Join.checked = TRUE THEN PLANPROPERTY = "Supplement" end if with excelbook2004.activesheet 'Use with simplified code. Range ("D1"). Value = txtday.text' Scheduled time .range ("c2"). Value = "Laoban Company "& TxtDay.Text & PlanProperty &" Purchasing Plan "'Planned. Range (" C25 "). Value = now.date.today.toshortdateString' This is the tabulation date. Range (" f2 "). Value = txtno .Text 'Scheduled number End with for i as integer = 0 to 18' total 19 self-cultivation ExcelBook2004.activesheet.cells (4 i, 4) = allnum (i) '4 i is a line number, second 4 Is the number next '

Cycles Fill each self-made number in the 2004 Self-Material Production Plan> Catch EX AS Exception 'Capture Error, and Recycle Resources, Show Error ExcelBook = Nothing ExcelBook2004 = Nothing ExcelWorksheet = Nothing ExceLapp = Nothing GC. Collect (0) MsgBox (EX.TOSTRING) 'Displays the error message to find the positioning exit sub' error to exit Finally 'The code here will be executed to ExcelBook = Nothing ExcelBook2004 = Nothing ExcelWorksheet = Nothing ExceLapp = Nothing gc.collect ( 0) End Try Msgbox ("Self-factory production plan, please see") ExcelBook = Nothing ExcelBook2004 = Nothing ExcelWorksheet = Nothing ExceLapp = Nothing gc.collect (0) End Sub The following is the process of killing Excel processes:

Private sub killexcel () 'Forces to avoid conflicts, kill existing Excel processes before calling Excel. DIM PPROCESS () AS process pprocess = process.getProcesses () DIM i as integer for i = 0 to pprocess.length () - 1 IF (PPRocess (i) .ProcessName = "Excel") THEN PPROCESS .KILL () Close Process End If Nextend Sub

The above code is very simple, the function is also very limited, but it is very practical, it used to fill in and calculated manually, now all automatic implementation. Originally a half-hour work can now be done in 5 minutes. If the product changes, I can modify the program at any time so that the program always meets the needs of the business. Enterprise information should be like this, starting with a small function. Maybe the old general does not know what is company informationization, you can show the old, see, I have to use half-hour plan before, now I have resolved it in 5 minutes, which is also a corporate informationization. Yesterday I wrote the above code for a night, just one night, how much time can you save? Old is always the first economy, as if he will hide professional developers, or the foreign commission software company is developing, always makes the boss to cut blood, and it is not too possible. I am a manager, it is also understanding, and the informationization begins with my own work. It doesn't have to spend more money, but it can improve work efficiency. Moreover, the company has only a few people who have a rare plan of the company, and now use the program to achieve, everyone will. China's corporate informationization is either Hua, more companies don't know if they don't know. I am in the company's information on enterprise information exploration is limited by many factors. In any case, I will share my experience with everyone. Everyone comes to explore the road of information technology with Chinese characteristics. My QQ: 26624998 My website: http://blog.9cbs.net/2066/ This article address: http://www.9cbs.net/develop/read_article.asp? Id = 24505

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

New Post(0)