One 、 Take delivery management project requirements

The business background of the system is as follows : The customer is a semi-finished knitting production and processing workshop , There are a lot of production and processing personnel who take semi-finished products from customers' factories , Processed into finished products and sent back . The customer processes each kind of semi-finished product according to the processing unit price and the finished quantity , Pay for the production and processing personnel . The requirements of the system are simple , It is required to count the quantity of semi-finished products taken and returned by each processing personnel , Time . As well as statistics processing personnel's payable expenses and paid expenses .

Shifu developed the stand-alone version before ( The so-called stand-alone version is database independence , Can't connect to a huge database , This is my understanding , I don't know if it's accurate ) The interface is as follows , Add, delete, modify, etc , I'm demonstrating Microsoft C# The development process of the control .

Two 、 Pick up and deliver WinForm Project development process

( One ) The construction of delivery database

The development of this project started with building a database , After analysis, we need to establish six tables and six views , They are product classification table , Product classification table , Pick up the deliveryman's form , Pick up information sheet , Delivery information form and processing fee payment information form , Views are mainly used to establish the relationship between tables, and temporary tables , The database is named TakeSendMisCSDB, Naming should have practical meaning , The code for creating tables and views is as follows :

 -- Product classification table 
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'CK_ProductType')
DROP TABLE CK_ProductType
CREATE TABLE dbo.CK_ProductType(
CK_ProductTypeID INT IDENTITY NOT NULL PRIMARY KEY NONCLUSTERED,
CK_ProductTypeName VARCHAR() NOT NULL DEFAULT ''
); -- Product information sheet
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'CK_Product')
DROP TABLE CK_Product
CREATE TABLE dbo.CK_Product(
CK_ProductID INT IDENTITY NOT NULL PRIMARY KEY NONCLUSTERED,
CK_ProductTypeID INT NOT NULL FOREIGN KEY REFERENCES CK_ProductType(CK_ProductTypeID) ON UPDATE CASCADE,
CK_ProductName VARCHAR() NOT NULL DEFAULT '',
CK_ProductPrice DECIMAL(,) NOT NULL DEFAULT
);
-- Pick up the deliveryman's form
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'CK_People')
DROP TABLE CK_People
CREATE TABLE dbo.CK_People(
CK_PeopleID INT IDENTITY NOT NULL PRIMARY KEY NONCLUSTERED,
CK_PeopleName VARCHAR() NOT NULL DEFAULT '',
CK_PhoneNo VARCHAR() NOT NULL DEFAULT '',
CK_Comment VARCHAR() NOT NULL DEFAULT ''
); -- Pick up information sheet
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'CK_TakeGoods')
DROP TABLE CK_TakeGoods
CREATE TABLE dbo.CK_TakeGoods(
CK_TakeGoodsID INT IDENTITY NOT NULL PRIMARY KEY NONCLUSTERED,
CK_PeopleID INT NOT NULL FOREIGN KEY REFERENCES CK_People(CK_PeopleID) ON UPDATE CASCADE,
CK_ProductID INT NOT NULL FOREIGN KEY REFERENCES CK_Product(CK_ProductID) ON UPDATE CASCADE,
CK_TakeGoodsNo VARCHAR() NOT NULL DEFAULT '',
CK_TakeGoodsAmount INT NOT NULL DEFAULT ,
CK_TakeGoodsDate DATETIME not NULL DEFAULT ''
); -- Delivery information sheet
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'CK_SendGoods')
DROP TABLE CK_SendGoods
CREATE TABLE dbo.CK_SendGoods(
CK_SendGoodsID INT IDENTITY NOT NULL PRIMARY KEY NONCLUSTERED,
CK_PeopleID INT NOT NULL FOREIGN KEY REFERENCES CK_People(CK_PeopleID) ON UPDATE CASCADE,
CK_ProductID INT NOT NULL FOREIGN KEY REFERENCES CK_Product(CK_ProductID) ON UPDATE CASCADE,
CK_SendGoodsNo VARCHAR() NOT NULL DEFAULT '',
CK_SendGoodsAmount INT NOT NULL DEFAULT ,
CK_SendGoodsDate DATETIME not NULL DEFAULT ''
); -- Processing fee payment information sheet
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'CK_Payment')
DROP TABLE CK_Payment
CREATE TABLE dbo.CK_Payment(
CK_PaymentID INT IDENTITY NOT NULL PRIMARY KEY NONCLUSTERED,
CK_PeopleID INT NOT NULL FOREIGN KEY REFERENCES CK_People(CK_PeopleID) ON UPDATE CASCADE,
CK_PayDate DATETIME NOT NULL DEFAULT '',
CK_PayMoney DECIMAL(,) NOT NULL DEFAULT ,
CK_PayComment VARCHAR() NOT NULL DEFAULT ''
);

Building a database

 CREATE VIEW [dbo].[v_listPayDetailInfo]
AS
select ck_people.ck_peoplename ,PayMoney as needPayMoney ,coalesce(PayedMoney,) as PayedMoney,(PayMoney - coalesce(PayedMoney,)) as unPayedMoney
from (select ck_peopleid,sum(CK_Product.ck_ProductPrice*ck_SendgoodsAmount) PayMoney from ck_Sendgoods
LEFT join CK_Product on CK_Product.ck_ProductID = CK_SendGoods.ck_ProductID
group by ck_peopleid) tab1
left join
(select ck_peopleid,sum(ck_paymoney) PayedMoney from ck_payment group by ck_peopleid) tab2
on tab1.[ck_peopleid] = tab2.ck_peopleid
left join ck_people on tab2.ck_peopleid = ck_people.ck_peopleid CREATE VIEW [dbo].[v_listPaymentInfo]
AS
select ck_payment.ck_paymentid, ck_people.ck_peoplename, ck_paymoney, ck_paydate, ck_paycomment from ck_payment
join ck_people on ck_payment.ck_peopleid = ck_people.ck_peopleid CREATE VIEW [dbo].[v_listProductInfo]
AS
select ck_productid,ck_productname, ck_productprice, ck_productType.ck_productTypename from ck_product
join ck_productType on ck_product.ck_productTypeid = ck_productType.ck_productTypeid CREATE VIEW [dbo].[v_listSendGoodsInfo]
AS
select ck_sendgoods.ck_sendgoodsid
, ck_sendgoods.ck_sendgoodsno
, ck_sendgoods.ck_sendgoodsdate
,ck_people.ck_peoplename,ck_producttype.ck_producttypename
,ck_product.ck_productname , ck_sendgoods.ck_sendgoodsAmount
,ck_product.ck_productprice
,ck_sendgoods.ck_sendgoodsAmount * ck_product.ck_productprice as totalfee
from ck_sendgoods
join ck_product on ck_product.ck_productid = ck_sendgoods.ck_productid
join ck_producttype on ck_producttype.ck_producttypeid = ck_product.ck_producttypeid
join ck_people on ck_people.ck_peopleid = ck_sendgoods.ck_peopleid CREATE VIEW [dbo].[v_listTakeGoodsInfo]
AS
select ck_takegoods.ck_takegoodsid, ck_takegoods.ck_takegoodsno, ck_takegoods.ck_takegoodsdate
,ck_people.ck_peoplename,ck_producttype.ck_producttypename
, ck_product.ck_productname , ck_takegoods.ck_takegoodsAmount from ck_takegoods
join ck_product on ck_product.ck_productid = ck_takegoods.ck_productid
join ck_producttype on ck_producttype.ck_producttypeid = ck_product.ck_producttypeid
join ck_people on ck_people.ck_peopleid = ck_takegoods.ck_peopleid CREATE VIEW [dbo].[v_listTakeSendGoodsInfo]
AS
select CK_People.ck_PeopleName ,CK_ProductType.CK_ProductTypeName
,CK_Product.CK_ProductName,tab1.sum takenum,coalesce(tab2.sum,) backnum,tab1.sum - coalesce(tab2.sum,) diffnum from
(select CK_PeopleID,CK_ProductID,sum(ck_takegoodsAmount) sum from ck_takegoods group by CK_ProductID,CK_PeopleID) tab1
left join
(select CK_PeopleID,CK_ProductID,sum(ck_sendgoodsAmount) sum from ck_sendgoods group by CK_ProductID,CK_PeopleID) tab2
on tab2.CK_PeopleID =tab1.CK_PeopleID and tab2.CK_ProductID = tab1.CK_ProductID
left join CK_Product on CK_Product.CK_ProductID = tab1.CK_ProductID
left join CK_ProductType on CK_ProductType.CK_ProductTypeID = CK_Product.CK_ProductTypeID
left join CK_People on CK_People.CK_PeopleID = tab1.CK_PeopleID

Create view

( Two ) Use dynamic soft code generator to import into WinForm Project under development

Namespace is TSM, Select the database to import , Operation as shown in figure :

Will generate... In the code BLL,DAL,MODEL,DBUtility Copy the folder to the working directory of the same layer of the solution .

How to include it in a project ? Steps are as follows : Right click “ Solution ”—— add to —— Existing items —— find BLL Under the folder BLL.csproj file —— complete , The other three are the same . The screenshot is as follows :

 

Then right click on the project —— Add reference —— project —— Choose all four (BLL,DAL,MODEL,DBUtility)—— determine . And a little bit more DAL Layers also need to be added DBUtility References to , Method is the same as above. .

You can't connect to the database yet , I need to write a App.config file ,App.config By right clicking on the project name , Then add a new item , In the pop-up dialog , find “ Application configuration files ”, Choose , OK, it will be added ,App.config The code in the file is as follows :

 <?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConStringEncrypt" value="false"/>
<!-- Database connection string -->
<add key="ConnectionString" value="Data Source=WIN7-20140110BZ\SQLEXPRESS;database = TakeSendMisCSDB;Integrated security = true" />
</appSettings>
</configuration> //Data Source= Own database service name
//database= Database name , This project database I named TakeSendMisCSDB

App.config Code

( 3、 ... and ) Basic information management interface design and code implementation

Take the product classification management under the basic information as an example ,

The interface design is as follows :( It mainly includes Button,panel,TextBox and DataGridView Other controls )

Code implementation , First, define a few global variables :

 // Define static variables, instantiate product category database logic layer , And then add, delete, modify and query 
private static TSM.BLL.CK_ProductType m_bllCK_ProductType = new TSM.BLL.CK_ProductType();
// Mark whether to modify or add
public string m_strOperationType = "";
// Fields that define the primary key
private int m_CK_ProductTypeID;

Global variables

double-click [ Show all ] Trigger buttonShowAll_Click event , The program code is as follows :

 private void ShowAllRecords(string strWhere)
{
this.dataGridView1.DataSource = null;
DataSet ds = m_bllCK_ProductType.GetList(strWhere);// be used CK_ProductType Of BLL Business logic layer GetList Method , Indirect invocation DAL Layer of GetList Method
if (ds.Tables.Count > && ds.Tables[].Rows.Count > )
{
this.dataGridView1.DataSource = ds.Tables[];
this.dataGridView1.Columns[].Visible = false;
}
} private void buttonShowAll_Click(object sender, EventArgs e)
{
ShowAllRecords(m_strWhere);// Call your own method to display all records
}

Run the program and you can see all the information about the product category , At first, because there was no information in the database , Check the results of the program , You can start with CK_ProductType Insert a few pieces of information into the table . The results are shown in the figure below :

The attribute column is in English , It doesn't look intuitive , Can't meet the needs of users . Can track code GetList Method , Shortcut key F12, Rewriting layer by layer DAL layer ,BLL Layer of GetList Method , Rewriting is actually Select Renaming of statements , Just put DAL The layer code is shown below :

 /// <summary>
/// Get the data list
/// </summary>
public DataSet GetList(string strWhere)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select CK_ProductTypeID as Product category number ,CK_ProductTypeName as Product category name ");
strSql.Append(" FROM CK_ProductType ");
if(strWhere.Trim()!="")
{
strSql.Append(" where "+strWhere);
}
return DbHelperSQL.Query(strSql.ToString());
}
// Is to add a Chinese alias

The operation result is as follows :

That's it for today , The implementation of other button events and the writing of other design modules will be added later , It's very simple , But I think it's very detailed , I hope to make progress together with people with lofty ideals , I also hope that Bo you can give us more valuable opinions and encouragement .

WinForm Development of pick up and delivery management 1 More articles about

  1. WinForm Development of pick up and delivery management 2

    It's a little slow , But it's all done step by step , I hope these can become valuable wealth in the future , Don't talk much , Continue the product classification management of the basic information management of the last pick up and delivery , The following is the compilation of additions, deletions and modifications . Add product classification management information records , double-click [ newly added ] Button ( Its addition allows users to Te ...

  2. Hands teach you how to use FineUI To develop a b/s Structure of the delivery management information system series blog index

    Recently, we have received some b/s Types of software projects , But most of the team members have no previous development experience in this area , So I chose a set of development framework which is easy to use on the Internet (FineUI), Plan to record a video lecture , To explain how to use FineUI Fast on ...

  3. Hands teach you how to use FineUI+ Dynamic soft code generator to develop a b/s Structure of the delivery management information system ( Source code attached ) The beginning

    One An overview and background of this series of essays Recently, we have received some b/s Types of software projects , But most of the team members have no previous development experience in this area , So I chose a set of development framework which is easy to use on the Internet (FineUI), Plan to record a video lecture , ...

  4. WinForm Development of general attachment management control design and development reference

    1. introduction stay WinForm In development , File attachment management exists in almost any application , It's a very general and centralized public module . Our daily records are accompanied by pictures . Documents and other attachments to show , If you do an attachment management for each business object , Or every time ...

  5. winform Rapid development platform -&gt; Dynamic menu of general authority management

    I've been busy for months APP Project , No time to update the project , Think about taking the time to sort out development ideas , Share with you , At the same time, I hope to get valuable suggestions . Let's talk about the design idea of our authority management first , First of all, an enterprise information management system must use authority management , ...

  6. RDIFramework.NET V2.8 edition ━ Product management of development examples (WinForm)

    RDIFramework.NET V2.8 edition ━ Product management of development examples (WinForm) Now? , We use .NET Rapid development of integrated frameworks (RDIFramework.NET) To develop an application , This application is all about how to make ...

  7. SNF Development platform WinForm Of the four - Development - Main list management page -SNF Rapid development platform 3.3-Spring.Net.Framework

    4.1 Running effect : 4.2 The development of implementation : 4.2.1          With the development of the first program , There should be no problem with the configuration of the code generator , We just need to create the table structure we need in the corresponding database , as follows : The main table structure is as follows : ...

  8. SNF Development platform WinForm The second - Development - Single form management page -SNF Rapid development platform 3.3-Spring.Net.Framework

    2.1 Running effect : 2.2 The development of implementation : 2.2.1 This development is consistent with the first development step , The difference is that after the code is generated , Leave the following red circle procedure , Other delete . The first development address : Development - Single table edit management page  http: ...

  9. Winform Development framework of general attachment management module --SNF Rapid development platform 3.3-Spring.Net.Framework

    Recently, there are too many projects to write articles , The actual project needs one ,CS End sum windows All tablets need the upload management function of attachments . What I used to do was BS Attachment management and upload function of . It was supposed to be Winform Nested a browser directly on bs The attachment upload function of ...

Random recommendation

  1. from Oracle Incrementally synchronize data to GreenPlum

    brief introduction : GreenPlum It's based on PostgreSQL Database development MPP Database warehouse of Architecture , Apply to OLAP System , Support 50PB(1PB=1000TB) Level massive data storage and processing . background : At present, there is a business that needs ...

  2. Android Card counter

    This article is written in English , You can read it in my English blog .

  3. iOS in Block Using exploration

    Block Introduce Block stay ios 4.0 Then add , And it's widely used in New ios api in .block It's an anonymous block of code , Parameters that can be passed to other objects , And get the return value . essentially ,block Similar to other common variables , ...

  4. Java Program memory analysis : Use mat Tool analysis memory usage

    Jiuding holdings, a domestic private equity firm, has created APP, Send it as soon as you come  20 The address for collecting yuan in cash :http://jdb.jiudingcapital.com/phone.html Internal invitation code :C8E245J ( No invitation code , No cash to send ) Domestic private ...

  5. 【 turn 】 How to analyze and solve Android ANR

    come from : http://blog.csdn.net/tjy1985/article/details/6777346 http://blog.csdn.net/tjy1985/article/detail ...

  6. Win8-64 Bit installation OpenSSL Detailed process

    Related software : 1.ActivePerl 5.22.1 : http://www.activestate.com/activeperl/downloads 2.Microsoft visual_studi ...

  7. net.sf.json.JSONException: Object is null

    The reason for this mistake is net.sf.json.JSONArray or JSONObject On conversion , Object contains another object , And the included object is NULL, So throw an exception . Add : The most hateful thing is , It was a success when Mingming changed ...

  8. The computer already has VS2005 and VS2010 install .NET3.5 Failed solutions

    1. restart MSI Installation services : function - Input “CMD” command , Enter the command in the pop-up dialog box : msiexec/unregserver , enter , And enter it again msiexec/regserver . 2. Enable Pri ...

  9. linux How to produce core, debugging core

    linux How to produce core, debugging core Excerpt from :http://blog.163.com/redhumor@126/blog/static/19554784201131791239753/ It's not in the program ...

  10. php utilize iframe Realize no refresh file upload function

    The principle of uploading is very simple, that is, to open the form as iframe Of name name , In this way, the iframe I'm calling , File upload , recycling js Return to upload results . form target . stay action The attribute states that ...