admin管理员组

文章数量:819745

MVC北京络捷斯特第三方物流系统技术解析(四)订单配送信息

MVC北京络捷斯特第三方物流系统技术解析(四)订单配送信息

进行了订单运输信息,想在到了订单配送信息在“订单信息”页面用户可以编辑此订单的基本信息,此页面包括订单基本信息、托运人信息、收获人信息、付款方式等信息。

如下图所示:

2.5.1.4(图1)

2.5.1.4(图2)

2.5.1.4(图3)

配送订单实现:

第一步:数据库

1.      表和表的关系:

2.5.1.4(图4)

 

第一步:数据库

1.     表和表的关系:

                             

表1:订单配送信息表(SYSDiaryList)

 

列名

数据类型

主键/外键

说明

OrderForGoodsInformationID

int

主键

配送信息ID

OrderForGoodsNumber

nchar (100)

 

订单号

ClientID

int

外键

客户ID

OrderForGoods数据类型ID

int

外键

订单类型ID

UrgentLevelID

int

外键

紧急程度ID

StartShipmentTime

datetime

 

起运时间

PredictArriveTime

datetime

 

预计到达时间

TransportwayID

int

外键

运输方式ID

BispatchingAreaID

int

外键

配送区域ID

ConsigtyperName

nchar (100)

 

托运人名称

ConsigtyperNumber

nchar (100)

 

托运人编号

ConsigtyperBelephone

nchar (100)

 

托运人电话

ConsigtyperUnitID

int

外键

托运人单位ID

ConsignForShipmentPersonAddress

nchar (100)

 

运人地址

ReceivingpersonName

nchar (100)

 

收货人姓名

ConsigneePhoneNumber

nchar (100)

 

收货人电话

TheReceivingUnitID

int

外键

收货人单位ID

ConsigneeAddress

nchar (100)

 

收货人地址

ClientModeOfPaymentID

int

外键

客户付款方式ID

AmountAdvanced

decimal (18, 3)

 

客户预付金额

TransportationExpenses

decimal (18, 3)

 

运费

InsurancePremium

decimal (18, 3)

 

保险费

MiscellaneousExpenses

decimal (18, 3)

 

其他费用

InsuredAmount

decimal (18, 3)

 

投保费用

mustIncomeCostRemark

nchar (100)

 

应收费用备注

ClientAgreementInformationID

int

外键

客户合同ID

ZongTiJi

decimal (18, 3)

 

总金额

ZongShuLiang

decimal (18, 3)

 

应付金额

ZongZhongLiang

decimal (18, 3)

 

单价

ZaiQuFou

bit

 

在取否

DiaoDuFou

bit

 

调度否

QianShouRen

nchar (30)

 

签收否

QianShouShiJian

datetime

 

签收时间

QianShouFou

bit

 

签收否

YouYongFou

bit

 

有用否

ShengChengZhanDanFou

bit

 

生成订单否

 

表2:属性明细表(SYSAttributeDetailList)

用于存放集合信息

 

列名

数据类型

主键/外键

说明

AttributeDetailID

int

主键

属性明细ID

AttributeGatherID

int

外键

属性集合ID

AttributeDetailName

nchar (10)

 

属性明细名称

YouYongFou

bit

 

有效否

 

表3:所属单位表(SYSSubsidiaryUnitList)

用于存放单位信息

 

 

列名

数据类型

主键/外键

说明

SubsidiaryUnitID

int

主键

所属单位ID

InstitutionID

int

外键

机构ID

SubsidiaryUnitDesignation

nchar (50)

 

所属单位名称

YouYongFou

bit

外键

有效否

 

表4:客户表(SYSClientList)

用于存放客户信息

 

 

列名

数据类型

主键/外键

说明

ClientID

int

主键

客户ID

ClientNumber

nchar (50)

 

客户帐号

ClientEncoded

nchar (50)

 

客户码

ClientUnitDesignation

nchar (50)

 

客户单位名称

ClientAbbreviation1

nchar (50)

 

客户简称1

ClientAbbreviation2

nchar (50)

 

客户简称2

ClientManager

nchar (50)

 

客户经理

ClientManagerBelephoneLdentification

nchar (50)

 

客户经理电话

Contacts

nchar (50)

 

联系人

ContactsTelephone

nchar (50)

 

联系人电话

ContactsEmail

nchar (50)

 

联系人Email

ContactsVIP

nchar (50)

 

联系人VIP

ContactsJAI

nchar (50)

 

联系人JAI

ContactsRankID

int

 

客户级别ID

ContactsZipCode

nchar (50)

 

客户邮编

ProjectID

int

外键

项目ID

ContactsFacsimile

nchar (50)

 

客户传真

EnglishAbbreviation

nchar (50)

 

英文缩写

EnglishDesignation

nchar (50)

 

英文名称

ContactsAddress

nchar (50)

 

客户地址

ClientCompanyID

int

外键

客户公司ID

IndustryAttributeID

int

外键

行业属性ID

EnterpriseScaleID

int

外键

企业规模ID

MemberDeputy

nchar (50)

 

会员代表

AgreementGrandfatherAddress

nchar (50)

 

合同存档地

BankOfDeposit

nchar (30)

 

开户行

ClientAgreementID

int

外键

客户合同ID

BankofdepositAccountNumber

nchar (50)

 

开户行帐号

DutyParagraph

nchar (50)

 

税号

YouYongFou

bit

 

有效否

TongBuFou

bit

 

同步否

 

表5:客户合同表(SYSClientList)

用于存放客户合同信息

 

列名

数据类型

主键/外键

说明

ClientAgreementInformationID

int

主键

客户合同信息ID

AgreementNumber

nchar (30)

 

合同编号

AgreementDesignation

nchar (30)

 

合同名称

Agreement数据类型ID

int

外键

合同类型ID

ClientID

int

外键

客户ID

ProjectID

int

外键

项目ID

VocationalPersonDeputy

nchar (30)

 

业务代表人

VocationalPersonDeputyFashion

nchar (30)

 

业务代表联系方式

EndDate

datetime

 

截止日期

CarriageFareValue

decimal (18, 2)

 

运费单价

InsuranceCompanyID

int

外键

保险公司ID

SettleAccountsWayID

int

外键

结算方式ID

AgreementGrandfatherAddress

nchar (30)

 

合同存档地

Oursignatory

nchar (30)

 

我方签署人

TheguestsSigntory

nchar (30)

 

客方签署人

Remarks

nchar (100)

 

备注

WhetherCheck

bit

 

复核否

YouYongFou

bit

 

有用否

InsuranceRate

decimal (18, 3)

 

保险费率

 

表6:保险公司表(SYSInsuranceCompanyList)

用于存放保险公司信息

 

列名

数据类型

主键/外键

说明

InsuranceCompanyID

int

主键

保险公司ID

InsuranceCompanyDesignation

nchar (50)

 

保险公司名称

InsuranceDesignationNumber

nchar (50)

 

保险公司编号

InsuranceRate

nchar (50)

 

保险费率

AmountInsured

nchar (50)

 

投保金额

YouYongFou

bit

 

有用否

 

 

表7:SYSAreaList(区表)

 

 

列名

数据类型

主键/外键

说明

AreaID

int

主键

区ID

StoreroomID

int

外键

库房ID

StoreFunctionID

int

外键

存储功能ID

StoreGenreID

int

外键

存储类型ID

StoreModeID

int

外键

存储方式ID

StoreQualityGenreID

int

外键

存储品质类型ID

StoreSurroundingsID

int

外键

存储环境ID

ConditionID

int

外键

状态ID

AreaCpdeNumber

nchar (50)

 

区编码

AreaCpdeDesignation

nchar (50)

 

区名称

Area

nchar (50)

 

面积

Width

decimal (18)

 

宽度

Length

decimal (18)

 

高度

Height

decimal (18)

 

长度

BearWeight

decimal (18)

 

承重

PassWidth

decimal (18)

 

通道宽度

GyrateRadius

decimal (18)

 

旋转半经

WhetherAllocationStore

bit

 

分配储位否

AllocationStoreStandard

nchar (50)

 

储位分配规格

LeaveWithPriority

nchar (50)

 

存放优先级

Remarks

nchar (50)

 

备注

StoreyNuber

decimal (18)

 

贷架数

SectionNeber

decimal (18)

 

层数

PassNeber

decimal (18)

 

截面数

GoodsFrameNumber

decimal (18)

 

通道号

YouYongFou

bit

 

有用否

 

 

下面的datagrid

表8:订单配送明细表(PWOrderForGoodsDispatchingDetailList)

用于存放订单配送明细信息

 

列名

数据类型

主键/外键

说明

OrderForGoodsDispatchingDetailID

int

主键

订单配送明细ID

OrderForGoodsInformationID

int

外键

订单配送信息ID

GoodsID

int

外键

货品ID

Volume

nchar (50)

 

体积

Quantity

nchar (50)

 

数量

Remarks

nchar (50)

 

备注

UnitID

int

外键

有用否

YouYongFou

bit

 

 

 

 

 

表9:货品表(SYSGoodsList)

用于存放货品信息

 

 

列名

数据类型

主键/外键

说明

GoodsID

int

主键

货品ID

GoodsNumber

nchar (30)

 

货品编码

GoodsDesignation

nchar (30)

 

货品名称

Specifications

nchar (30)

 

规格

Deadweight

decimal (18, 2)

 

重量

UnitID

int

外键

单位ID

ClientID

int

外键

客户ID

ClientGoodsNumber

nchar (30)

 

客户货品编码

Barcode

nchar (30)

 

条形码

Pinyincode

nchar (30)

 

拼音码

GoodsClassificationID

int

外键

货品类别ID

Modelnumber

nchar (30)

 

型号

Producer

nchar (30)

 

生产厂家

GoodstypeID

int

外键

货品类型ID

GoodsSubtypeID

int

外键

货品子类型ID

Length

decimal (18, 2)

 

长度

Width

decimal (18, 2)

 

宽度

Altitude

decimal (18, 2)

 

高度

SizeUnitID

int

外键

尺寸单位ID

SKUPackUnitID

int

主键

SKU包装单位ID

Qualityguaranteeperiod

nchar (30)

 

保质期

Codeofhigh

nchar (10)

 

码高

Loadbearing

decimal (18, 2)

 

承重

QualityID

int

外键

质量ID

DeadweightUnitID

int

外键

重量单位ID

Unitprice

decimal (18, 2)

 

单价

MemoryEnvironmentID

int

外键

存储环境ID

GoodsAttributeID

int

外键

货品属性ID

PolluteAttributeID

int

外键

污染属性ID

DepolluteAttributeID

int

外键

防止污染属性ID

StateID

int

外键

状态ID

Remarks

nchar (100)

 

备注

Monitoringornot

bit

 

监控否

Moisturnot

bit

 

防潮否

Throughweightno

bit

 

贯重否

Easytostealnpnot

bit

 

易盗否

Invertedornot

bit

 

倒置否

Singlproductmanagement

bit

 

单品管理否

Effectofstorageorbatch

bit

 

批次影响存放否

Giftsnot

bit

 

赠品否

Frozenornot

bit

 

冻结否

ScanningID

int

 

扫描品ID

Scanningnot

bit

 

扫描否

Fragileor

bit

 

易碎否

YouYongFou

bit

 

有用否

 

表10:属性明细表(SYSAttributeDetailList)

用于存放集合信息

 

列名

数据类型

主键/外键

说明

AttributeDetailID

int

主键

属性明细ID

AttributeGatherID

int

外键

属性集合ID

AttributeDetailName

nchar (10)

 

属性明细名称

YouYongFou

bit

 

有效否

 

第二步:控制器

                                                                                                             2.5.1.4(图5)

2查询:

(1).查询配送订单信息

 #region 查询订单配送信息public ActionResult SelectOrderForGoodsDispatchingInformationList(){//DiaryList 是 RK.SYSDiaryList 表的已个别名var SYSDiaryList = from DiaryList in RK.SYSDiaryList//通个ID对应将所有的表连关系join ClientList in RK.SYSClientList on DiaryList.ClientID equals ClientList.ClientIDjoin OrderForGoodsTypeList in RK.SYSAttributeDetailList on DiaryList.OrderForGoodsTypeID equals OrderForGoodsTypeList.AttributeDetailIDjoin UrgentLevelIDList in RK.SYSAttributeDetailList on DiaryList.UrgentLevelID equals UrgentLevelIDList.AttributeDetailIDjoin TransportwayIDList in RK.SYSAttributeDetailList on DiaryList.TransportwayID equals TransportwayIDList.AttributeDetailIDjoin BispatchingAreaIDList in RK.SYSAreaList on DiaryList.BispatchingAreaID equals BispatchingAreaIDList.AreaIDjoin ConsignorUnitIDList in RK.SYSSubsidiaryUnitList on DiaryList.ConsignorUnitID equals ConsignorUnitIDList.SubsidiaryUnitIDjoin TheReceivingUnitIDList in RK.SYSSubsidiaryUnitList on DiaryList.TheReceivingUnitID equals TheReceivingUnitIDList.SubsidiaryUnitIDjoin ClientModeOfPaymentIDList in RK.SYSAttributeDetailList on DiaryList.OrderForGoodsTypeID equals ClientModeOfPaymentIDList.AttributeDetailIDjoin ClientAgreementInformationIDList in RK.SYSClientAgreementInformationList on DiaryList.ClientAgreementInformationID equals ClientAgreementInformationIDList.ClientAgreementInformationIDjoin InsuranceCompanyList in RK.SYSInsuranceCompanyList on ClientAgreementInformationIDList.InsuranceCompanyID equals InsuranceCompanyList.InsuranceCompanyIDorderby DiaryList.OrderForGoodsInformationID descending where DiaryList.QianShouFou != true || DiaryList.QianShouFou == nullselect new{//OrderForGoodsInformationID(自己命名的参数)//DiaryList.OrderForGoodsInformationID(这个表对应的参数)OrderForGoodsInformationID = DiaryList.OrderForGoodsInformationID,OrderForGoodsNumber = DiaryList.OrderForGoodsNumber,ClientID = DiaryList.ClientID,ClientName = ClientList.ClientEncoded,OrderForGoodsTypeID = DiaryList.OrderForGoodsTypeID,OrderForGoodsTypeName = OrderForGoodsTypeList.AttributeDetailName,UrgentLevelID = DiaryList.UrgentLevelID,UrgentLevelIDName = UrgentLevelIDList.AttributeDetailName,StartShipmentTime = DiaryList.StartShipmentTime,PredictArriveTime = DiaryList.PredictArriveTime,TransportwayID = DiaryList.TransportwayID,TransportwayIDName = TransportwayIDList.AttributeDetailName,BispatchingAreaID = DiaryList.BispatchingAreaID,BispatchingAreaIDName = BispatchingAreaIDList.AreaCpdeDesignation,ConsignorName = DiaryList.ConsignorName,ConsignorNumber = DiaryList.ConsignorNumber,ConsignorBelephone = DiaryList.ConsignorBelephone,ConsignorUnitID = DiaryList.ConsignorUnitID,ConsignorUnitIDName = ConsignorUnitIDList.SubsidiaryUnitDesignation,ConsignForShipmentPersonAddress = DiaryList.ConsignForShipmentPersonAddress,ReceivingpersonName = DiaryList.ReceivingpersonName,ConsigneePhoneNumber = DiaryList.ConsigneePhoneNumber,TheReceivingUnitID = DiaryList.TheReceivingUnitID,TheReceivingUnitIDName = TheReceivingUnitIDList.SubsidiaryUnitDesignation,ConsigneeAddress = DiaryList.ConsigneeAddress,ClientModeOfPaymentID = DiaryList.ClientModeOfPaymentID,ClientModeOfPaymentIDName = ClientModeOfPaymentIDList.AttributeDetailName,AmountAdvanced = DiaryList.AmountAdvanced,TransportationExpenses = DiaryList.TransportationExpenses,InsurancePremium = DiaryList.InsurancePremium,MiscellaneousExpenses = DiaryList.MiscellaneousExpenses,InsuredAmount = DiaryList.InsuredAmount,mustIncomeCostRemark = DiaryList.mustIncomeCostRemark,AllCosts = DiaryList.TransportationExpenses + DiaryList.InsurancePremium + DiaryList.MiscellaneousExpenses,txtYingFuAgreement = DiaryList.TransportationExpenses + DiaryList.InsurancePremium + DiaryList.MiscellaneousExpenses - DiaryList.AmountAdvanced,ClientAgreementInformationID = DiaryList.ClientAgreementInformationID,CarriageFareValue = ClientAgreementInformationIDList.CarriageFareValue,InsuranceRate = InsuranceCompanyList.InsuranceRate,};List<Dictionary<string, object>> DDitem = new List<Dictionary<string, object>>();
foreach (var item in SYSDiaryList)
{Dictionary<string, object> DingDanItem = new Dictionary<string, object>();string StartShipmentTime1 = item.StartShipmentTime.ToString();DingDanItem.Add("StartShipmentTime2", StartShipmentTime1);string PredictArriveTime1 = item.PredictArriveTime.ToString();DingDanItem.Add("PredictArriveTime2", PredictArriveTime1);foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties()){DingDanItem.Add(p.Name, p.GetValue(item, null));}DDitem.Add(DingDanItem);
}return Json(DDitem, JsonRequestBehavior.AllowGet);}#endregion


 

模糊查询配送订单信息:

#region 模糊查询订单配送信息public ActionResult MoHuSelectOrderForGoodsDispatchingInformationList(string OrderForGoodsNumber){//OrderForGoodsNumber 是界面传过来的参数var SYSDiaryList = from DiaryList in RK.SYSDiaryListjoin ClientList in RK.SYSClientList on DiaryList.ClientID equals ClientList.ClientIDjoin OrderForGoodsTypeList in RK.SYSAttributeDetailList on DiaryList.OrderForGoodsTypeID equals OrderForGoodsTypeList.AttributeDetailIDjoin UrgentLevelIDList in RK.SYSAttributeDetailList on DiaryList.UrgentLevelID equals UrgentLevelIDList.AttributeDetailIDjoin TransportwayIDList in RK.SYSAttributeDetailList on DiaryList.TransportwayID equals TransportwayIDList.AttributeDetailIDjoin BispatchingAreaIDList in RK.SYSAreaList on DiaryList.BispatchingAreaIDequals BispatchingAreaIDList.AreaIDjoin ConsignorUnitIDList in RK.SYSSubsidiaryUnitList on DiaryList.ConsignorUnitID equals ConsignorUnitIDList.SubsidiaryUnitIDjoin TheReceivingUnitIDList in RK.SYSSubsidiaryUnitList on DiaryList.TheReceivingUnitID equals TheReceivingUnitIDList.SubsidiaryUnitIDjoin ClientModeOfPaymentIDList in RK.SYSAttributeDetailList on DiaryList.OrderForGoodsTypeID equals ClientModeOfPaymentIDList.AttributeDetailIDjoin ClientAgreementInformationIDList in RK.SYSClientAgreementInformationList onDiaryList.ClientAgreementInformationID equals ClientAgreementInformationIDList.ClientAgreementInformationIDjoin InsuranceCompanyList in RK.SYSInsuranceCompanyList on ClientAgreementInformationIDList.InsuranceCompanyID equals InsuranceCompanyList.InsuranceCompanyIDorderby DiaryList.OrderForGoodsInformationID descending//orderby 排序 新增加的在datagrid的上面//Contains是模糊,只要有其中相同的就可以查出来where (DiaryList.QianShouFou != true || DiaryList.QianShouFou == null) && DiaryList.OrderForGoodsNumber.Contains(OrderForGoodsNumber)select new{OrderForGoodsInformationID = DiaryList.OrderForGoodsInformationID,OrderForGoodsNumber = DiaryList.OrderForGoodsNumber,ClientID = DiaryList.ClientID,ClientName = ClientList.ClientEncoded,OrderForGoodsTypeID = DiaryList.OrderForGoodsTypeID,OrderForGoodsTypeName = OrderForGoodsTypeList.AttributeDetailName,UrgentLevelID = DiaryList.UrgentLevelID,UrgentLevelIDName = UrgentLevelIDList.AttributeDetailName,StartShipmentTime = DiaryList.StartShipmentTime,PredictArriveTime = DiaryList.PredictArriveTime,TransportwayID = DiaryList.TransportwayID,TransportwayIDName = TransportwayIDList.AttributeDetailName,BispatchingAreaID = DiaryList.BispatchingAreaID,BispatchingAreaIDName = BispatchingAreaIDList.AreaCpdeDesignation,ConsignorName = DiaryList.ConsignorName,ConsignorNumber = DiaryList.ConsignorNumber,ConsignorBelephone = DiaryList.ConsignorBelephone,ConsignorUnitID = DiaryList.ConsignorUnitID,ConsignorUnitIDName = ConsignorUnitIDList.SubsidiaryUnitDesignation,ConsignForShipmentPersonAddress = DiaryList.ConsignForShipmentPersonAddress,ReceivingpersonName = DiaryList.ReceivingpersonName,ConsigneePhoneNumber = DiaryList.ConsigneePhoneNumber,TheReceivingUnitID = DiaryList.TheReceivingUnitID,TheReceivingUnitIDName = TheReceivingUnitIDList.SubsidiaryUnitDesignation,ConsigneeAddress = DiaryList.ConsigneeAddress,ClientModeOfPaymentID = DiaryList.ClientModeOfPaymentID,ClientModeOfPaymentIDName = ClientModeOfPaymentIDList.AttributeDetailName,AmountAdvanced = DiaryList.AmountAdvanced,TransportationExpenses = DiaryList.TransportationExpenses,InsurancePremium = DiaryList.InsurancePremium,MiscellaneousExpenses = DiaryList.MiscellaneousExpenses,InsuredAmount = DiaryList.InsuredAmount,mustIncomeCostRemark = DiaryList.mustIncomeCostRemark,//计算费用的总数AllCosts = DiaryList.TransportationExpenses + DiaryList.InsurancePremium +DiaryList.MiscellaneousExpenses,txtYingFuAgreement = DiaryList.TransportationExpenses + DiaryList.InsurancePremium +DiaryList.MiscellaneousExpenses - DiaryList.AmountAdvanced,ClientAgreementInformationID = DiaryList.ClientAgreementInformationID,CarriageFareValue = ClientAgreementInformationIDList.CarriageFareValue,InsuranceRate = InsuranceCompanyList.InsuranceRate,};List<Dictionary<string, object>> DDitem = new List<Dictionary<string, object>>();foreach (var item in SYSDiaryList){Dictionary<string, object> DingDanItem = new Dictionary<string, object>();string StartShipmentTime1 = item.StartShipmentTime.ToString();//将时间转换格式DingDanItem.Add("StartShipmentTime2", StartShipmentTime1);string PredictArriveTime1 = item.PredictArriveTime.ToString();DingDanItem.Add("PredictArriveTime2", PredictArriveTime1);foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties()){DingDanItem.Add(p.Name, p.GetValue(item, null));}DDitem.Add(DingDanItem);}return Json(DDitem, JsonRequestBehavior.AllowGet);}#endregion


 

(2).查询配送订单明细信息

#region 查询明细信息public ActionResult SelectOrderForGoodsDispatchingDetailList(int OrderForGoodsInformationID){//OrderForGoodsInformationID是要选择的订单的明细信息的订单IDvar OrderForGoodsDispatchingDetailList1 = from OrderForGoodsDispatchingDetailList in RK.PWOrderForGoodsDispatchingDetailListjoin GoodsList in RK.SYSGoodsList on OrderForGoodsDispatchingDetailList.GoodsID equals GoodsList.GoodsIDjoin OrderForGeoodsInformationIDList in RK.SYSAttributeDetailList onOrderForGoodsDispatchingDetailList.UnitID equals OrderForGeoodsInformationIDList.AttributeDetailIDorderby OrderForGoodsDispatchingDetailList.OrderForGoodsDispatchingDetailID descending where OrderForGoodsDispatchingDetailList.OrderForGoodsInformationID == OrderForGoodsInformationIDselect new{OrderForGoodsInformationID = OrderForGoodsDispatchingDetailList.OrderForGoodsDispatchingDetailID,GoodsID = OrderForGoodsDispatchingDetailList.GoodsID,GoodsDesignation = GoodsList.GoodsDesignation,Deadweight = GoodsList.Deadweight,Volume = OrderForGoodsDispatchingDetailList.Volume,Quantity = OrderForGoodsDispatchingDetailList.Quantity,Remarks = OrderForGoodsDispatchingDetailList.Remarks,UnitID = OrderForGoodsDispatchingDetailList.UnitID,UnitName = OrderForGeoodsInformationIDList.AttributeDetailName,};//实例化一个字典数组,用于存放各种类型的数据类型List<Dictionary<string, object>> DDitem = new List<Dictionary<string, object>>();foreach (var item in OrderForGoodsDispatchingDetailList1)//将实例化的表放在item(这个别名上){Dictionary<string, object> DingDanItem = new Dictionary<string, object>();//再实例化一个字典数组foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties()){//修改时,有时候因为空格不能修改,可以.ToString().Trim()去空格DingDanItem.Add(p.Name, p.GetValue(item, null).ToString().Trim());}DDitem.Add(DingDanItem);}return Json(DDitem, JsonRequestBehavior.AllowGet);}#endregion


 

2.    新增

(1).新增配送订单信息

 #region 新增订单配送信息//InsertOrderForGoodsDispatchingInformationList 方法名    OrderForGoodsNumber、VocationalTypeID。。。。。。。。对应的参数public int InsertOrderForGoodsDispatchingInformationList(string OrderForGoodsNumber, int ClientID, int OrderForGoodsTypeID, int UrgentLevelID, DateTime StartShipmentTime, DateTime PredictArriveTime,int TransportwayID, int BispatchingAreaID, string ConsignorName,string ConsignorNumber, string ConsignorBelephone, int ConsignorUnitID, string ConsignForShipmentPersonAddress, string ReceivingpersonName, string ConsigneePhoneNumber, int TheReceivingUnitID, string ConsigneeAddress,int ClientModeOfPaymentID, decimal AmountAdvanced, decimal TransportationExpenses, decimal InsurancePremium,decimal MiscellaneousExpenses, decimal InsuredAmount, string mustIncomeCostRemark, int ClientAgreementInformationID, decimal ZongTiJi, decimal ZongShuLiang, decimal ZongZhongLiang)
{//实例化models中的一个表 给一个别名(DiaryList)Models.SYSDiaryList DiaryList = new Models.SYSDiaryList();//DiaryList.OrderForGoodsNumber (是实例化表中的一个字段)//OrderForGoodsNumber 是用于从界面传过来的参数DiaryList.OrderForGoodsNumber = OrderForGoodsNumber;DiaryList.ClientID = ClientID;DiaryList.OrderForGoodsTypeID = OrderForGoodsTypeID;DiaryList.UrgentLevelID = UrgentLevelID;DiaryList.StartShipmentTime = StartShipmentTime;DiaryList.PredictArriveTime = PredictArriveTime;DiaryList.TransportwayID = TransportwayID;DiaryList.BispatchingAreaID = BispatchingAreaID;DiaryList.ConsignorName = ConsignorName;DiaryList.ConsignorNumber = ConsignorNumber;DiaryList.ConsignorBelephone = ConsignorBelephone;DiaryList.ConsignorUnitID = ConsignorUnitID;DiaryList.ConsignForShipmentPersonAddress = ConsignForShipmentPersonAddress;DiaryList.ReceivingpersonName = ReceivingpersonName;DiaryList.ConsigneePhoneNumber = ConsigneePhoneNumber;DiaryList.TheReceivingUnitID = TheReceivingUnitID;DiaryList.ConsigneeAddress = ConsigneeAddress;DiaryList.ClientModeOfPaymentID = ClientModeOfPaymentID;DiaryList.AmountAdvanced = AmountAdvanced;DiaryList.TransportationExpenses = TransportationExpenses;DiaryList.InsurancePremium = InsurancePremium;DiaryList.MiscellaneousExpenses = MiscellaneousExpenses;DiaryList.InsuredAmount = InsuredAmount;DiaryList.mustIncomeCostRemark = mustIncomeCostRemark;DiaryList.ClientAgreementInformationID = ClientAgreementInformationID;DiaryList.ZongTiJi = ZongTiJi;DiaryList.ZongShuLiang = ZongShuLiang;DiaryList.ZongZhongLiang = ZongZhongLiang;//AddObject(是新增多一条数据)RK.SYSDiaryList(是对应的表)RK.SYSDiaryList.AddObject(DiaryList);//将这个表的改变作为一个变量int i = RK.SaveChanges();if (i > 0){//如果新增成功,改变的行数就大于零// BaoXianID对应新增产生的那个主键ID,返回他用于传值到新增明细var BaoXianID = (from bx in RK.SYSDiaryList select bx.OrderForGoodsInformationID).Max();return BaoXianID;}else{//否则就没有新增数据return 0;}}#endregion


 

(2).新增配送订单明细信息

 #region 新增明细信息//InsertOrderForGoodsDispatchingInformationList 方法名    OrderForGoodsNumber、VocationalTypeID。。。。。。。。对应的参数public int InsertOrderForGoodsDispatchingDetailList(int OrderForGoodsInformationID, int GoodsID, string Volume, string Quantity, string Remarks, int UnitID){//实例化models中的一个表 给一个别名(DiaryList)Models.PWOrderForGoodsDispatchingDetailList OrderForGoodsDispatchingDetailList = new Models.PWOrderForGoodsDispatchingDetailList();//DiaryList.OrderForGoodsNumber (是实例化表中的一个字段)//OrderForGoodsNumber 是用于从界面传过来的参数OrderForGoodsDispatchingDetailList.OrderForGoodsInformationID = OrderForGoodsInformationID;OrderForGoodsDispatchingDetailList.GoodsID = GoodsID;OrderForGoodsDispatchingDetailList.Volume = Volume;OrderForGoodsDispatchingDetailList.Quantity = Quantity;OrderForGoodsDispatchingDetailList.Remarks = Remarks;OrderForGoodsDispatchingDetailList.UnitID = UnitID;RK.PWOrderForGoodsDispatchingDetailList.AddObject(OrderForGoodsDispatchingDetailList);int i = RK.SaveChanges();if (i > 0){return i;}else{return 0;}}#endregion


3.     修改

(1).修改配送订单信息

#region 修改订单配送信息public int UpdateOrderForGoodsDispatchingInformationList(int OrderForTransportationID, string OrderForGoodsNumber, int ClientID,int OrderForGoodsTypeID, int UrgentLevelID, DateTime StartShipmentTime, DateTime PredictArriveTime, int TransportwayID, int BispatchingAreaID, string ConsignorName,string ConsignorNumber, string ConsignorBelephone, int ConsignorUnitID, string ConsignForShipmentPersonAddress){//实例化models中的一个表 给一个别名(DiaryList)//DiaryList.OrderForGoodsNumber (是实例化表中的一个字段)//OrderForGoodsNumber 是用于从界面传过来的参数int OrderForGoodsDetailID = OrderForTransportationID;Models.SYSDiaryList DiaryList = (from CheLiang in RK.SYSDiaryList where CheLiang.OrderForGoodsInformationID == OrderForTransportationID select CheLiang).Single<Models.SYSDiaryList>();DiaryList.OrderForGoodsNumber = OrderForGoodsNumber;DiaryList.ClientID = ClientID;DiaryList.OrderForGoodsTypeID = OrderForGoodsTypeID;DiaryList.UrgentLevelID = UrgentLevelID;DiaryList.StartShipmentTime = StartShipmentTime;DiaryList.PredictArriveTime = PredictArriveTime;DiaryList.TransportwayID = TransportwayID;DiaryList.BispatchingAreaID = BispatchingAreaID;DiaryList.ConsignorName = ConsignorName;DiaryList.ConsignorNumber = ConsignorNumber;DiaryList.ConsignorBelephone = ConsignorBelephone;DiaryList.ConsignorUnitID = ConsignorUnitID;DiaryList.ConsignForShipmentPersonAddress = ConsignForShipmentPersonAddress;//将这个表的改变作为一个变量//如果新增成功,改变的行数就大于零// BaoXianID对应新增产生的那个主键ID,返回他用于传值到新增明细int i = RK.SaveChanges();if (i > 0){return OrderForGoodsDetailID;}else{return 0;}}#endregion


 

 #region 修改订单配送信息//因为参数太多,不能一次修改,要分多次修改public int UpdateOrderForGoodsDispatchingInformationList1(int OrderForTransportationID, string ReceivingpersonName,string ConsigneePhoneNumber, int TheReceivingUnitID,string ConsigneeAddress,int ClientModeOfPaymentID, decimal AmountAdvanced, decimal TransportationExpenses, decimal InsurancePremium, decimal MiscellaneousExpenses,decimal InsuredAmount, string mustIncomeCostRemark, int ClientAgreementInformationID,decimal ZongTiJi, decimal ZongShuLiang, decimal ZongZhongLiang){int OrderForGoodsDetailID = OrderForTransportationID;Models.SYSDiaryList DiaryList = (from CheLiang in RK.SYSDiaryListwhere CheLiang.OrderForGoodsInformationID == OrderForTransportationID select CheLiang).Single<Models.SYSDiaryList>();DiaryList.ReceivingpersonName = ReceivingpersonName;DiaryList.ConsigneePhoneNumber = ConsigneePhoneNumber;DiaryList.TheReceivingUnitID = TheReceivingUnitID;DiaryList.ConsigneeAddress = ConsigneeAddress;DiaryList.ClientModeOfPaymentID = ClientModeOfPaymentID;DiaryList.AmountAdvanced = AmountAdvanced;DiaryList.TransportationExpenses = TransportationExpenses;DiaryList.InsurancePremium = InsurancePremium;DiaryList.MiscellaneousExpenses = MiscellaneousExpenses;DiaryList.InsuredAmount = InsuredAmount;DiaryList.mustIncomeCostRemark = mustIncomeCostRemark;DiaryList.ClientAgreementInformationID = ClientAgreementInformationID;DiaryList.ZongTiJi = ZongTiJi;DiaryList.ZongShuLiang = ZongShuLiang;DiaryList.ZongZhongLiang = ZongZhongLiang;//将这个表的改变作为一个变量//如果新增成功,改变的行数就大于零// BaoXianID对应新增产生的那个主键ID,返回他用于传值到新增明细int i = RK.SaveChanges();if (i > 0){return OrderForGoodsDetailID;}else{return 0;}}#endregion


 

(2).修改配送订单明细信息

#region 修改明细信息public int UpdateOrderForGoodsDispatchingDetailList(int OrderForGoodsDetailID, int OrderForGoodsInformationID, int GoodsID, string Volume, string Quantity, string Remarks, int UnitID, string Update){//update界面传过来的参数,判断执行了哪一个方法//如果update的至等于1就修改if (Update.Equals("1")){Models.PWOrderForGoodsDispatchingDetailList OrderForGoodsDispatchingDetailList = (from OrderForGoodsDispatchingDetail in RK.PWOrderForGoodsDispatchingDetailList where OrderForGoodsDispatchingDetail.OrderForGoodsDispatchingDetailID== OrderForGoodsDetailID select OrderForGoodsDispatchingDetail).Single<Models.PWOrderForGoodsDispatchingDetailList>();OrderForGoodsDispatchingDetailList.OrderForGoodsInformationID = OrderForGoodsInformationID;OrderForGoodsDispatchingDetailList.GoodsID = GoodsID;OrderForGoodsDispatchingDetailList.Volume = Volume;OrderForGoodsDispatchingDetailList.Quantity = Quantity;OrderForGoodsDispatchingDetailList.Remarks = Remarks;OrderForGoodsDispatchingDetailList.UnitID = UnitID;}if (Update.Equals("2"))//如果update的至等于2就修改{Models.PWOrderForGoodsDispatchingDetailList OrderForGoodsDispatchingDetailList = new Models.PWOrderForGoodsDispatchingDetailList();OrderForGoodsDispatchingDetailList.OrderForGoodsInformationID = OrderForGoodsInformationID;OrderForGoodsDispatchingDetailList.GoodsID = GoodsID;OrderForGoodsDispatchingDetailList.Volume = Volume;OrderForGoodsDispatchingDetailList.Quantity = Quantity;OrderForGoodsDispatchingDetailList.Remarks = Remarks;OrderForGoodsDispatchingDetailList.UnitID = UnitID;RK.PWOrderForGoodsDispatchingDetailList.AddObject(OrderForGoodsDispatchingDetailList);}if (Update.Equals("3"))//如果update的至等于3就修改{var CheLiangID = (from CheLiangTiaoMuID in RK.PWOrderForGoodsDispatchingDetailListwhere CheLiangTiaoMuID.OrderForGoodsDispatchingDetailID == OrderForGoodsDetailIDselect CheLiangTiaoMuID).Single<Models.PWOrderForGoodsDispatchingDetailList>();RK.PWOrderForGoodsDispatchingDetailList.DeleteObject(CheLiangID);}int i = RK.SaveChanges();if (i > 0){return i;}else{return 0;}}#endregion


4.   删除配送订单信息

(1).删除配送订单信息

#region 删除订单配送信息public int DeleteSYSDiaryList(int OrderForTransportationID){//同个寻找 RK.SYSDiaryList(表)的主键ID来删除明细var CheLiangID = (from CheLiang in RK.SYSDiaryList where CheLiang.OrderForGoodsInformationID== OrderForTransportationID select CheLiang).Single<Models.SYSDiaryList>();RK.DeleteObject(CheLiangID);//DeleteObject(是删除传过来属于哪一个主键ID的那一行,因为主键是唯一的)int i = RK.SaveChanges();if (i > 0){return i;}else{return 0;}}#endregion


 

(2).删除配送订单明细信息

#region 删除订单配送货品信息public int DeleteOrderForGoodsDispatchingDetailList(int OrderForGoodsDetailID){//同个寻找 RK.PWOrderForGoodsDispatchingDetailList(表)的外键ID(订单ID)来删除明细var CheLiangID = (from CheLiangTiaoMuID in RK.PWOrderForGoodsDispatchingDetailList where CheLiangTiaoMuID.OrderForGoodsInformationID == OrderForGoodsDetailID select CheLiangTiaoMuID).ToList<Models.PWOrderForGoodsDispatchingDetailList>();//ToList,因为明细信息不会只用一条。所以要用数组来循环删除for (int j = 0; j < CheLiangID.Count; j++){RK.DeleteObject(CheLiangID[j]);}//DeleteObject(是删除传过来属于哪一个主键ID的那一行,因为主键是唯一的)int i = RK.SaveChanges();if (i > 0){return i;}else{return 0;}}#endregion

 

第三步:视图

2.5.1.4(图5)

如下图所示:

2.5.1.4(图6)

2.5.1.4(图7)

2.5.1.4(图8)

Html代码:

1.   查询

(1). 查询配送订单信息

@*                       URL:用路径来加载数据  url:'/DingDanGuanL/SelectOrderForGoodsDispatchingInformationList*@<table id="tbOrderForGoodsDispatchingInformationList" class="easyui-datagrid" style=" width:auto; height:300px;" data-options="url:'/DingDanGuanL/SelectOrderForGoodsDispatchingInformationList',rownumbers:true,singleSelect:true,rowStyler:function(index,row){if (index%2==0){@*//rownumbers:true显示行数*@}}"><thead><tr><th data-options="field:'ok',align:'center',checkbox:true"></th><th data-options="field:'ShanChu',width:80,align:'center',formatter:myformatter1">删除</th><th data-options="field:'Update',width:80,align:'center',formatter:myformatter2">修改</th><th data-options="field:'Select',width:80,align:'center',formatter:myformatter3">查看</th><th data-options="field:'OrderForGoodsInformationID',width:130,align:'center',hidden:true">配送信息ID</th><th data-options="field:'OrderForGoodsNumber',width:130,align:'center'">订单号</th><th data-options="field:'ClientID',width:130,align:'center',hidden:true">客户ID</th><th data-options="field:'ClientName',width:130,align:'center'">客户码</th><th data-options="field:'OrderForGoodsTypeID',width:130,align:'center',hidden:true">订单类型ID</th><th data-options="field:'OrderForGoodsTypeName',width:130,align:'center'">订单类型</th><th data-options="field:'UrgentLevelID',width:130,align:'center',hidden:true">紧急程度ID</th><th data-options="field:'UrgentLevelIDName',width:130,align:'center'">紧急程度</th><th data-options="field:'StartShipmentTime2',width:130,align:'center'">起运时间</th><th data-options="field:'PredictArriveTime2',width:130,align:'center'">预计到达时间</th><th data-options="field:'TransportwayID',width:130,align:'center',hidden:true">运输方式ID</th><th data-options="field:'TransportwayIDName',width:130,align:'center'">运输方式</th><th data-options="field:'BispatchingAreaID',width:130,align:'center',hidden:true">配送区域ID</th><th data-options="field:'BispatchingAreaIDName',width:130,align:'center'">配送区域</th><th data-options="field:'ConsignorName',width:130,align:'center'">托运人名称</th><th data-options="field:'ConsignorNumber',width:130,align:'center'">托运人编号</th><th data-options="field:'ConsignorBelephone',width:130,align:'center'">托运人电话</th><th data-options="field:'ConsignorUnitID',width:130,align:'center',hidden:true">托运人单位ID</th><th data-options="field:'ConsignorUnitIDName',width:130,align:'center'">托运人单位</th><th data-options="field:'ConsignForShipmentPersonAddress',width:130,align:'center'">托运人地址</th><th data-options="field:'ReceivingpersonName',width:130,align:'center',hidden:true">收货人姓名</th><th data-options="field:'ConsigneePhoneNumber',width:130,align:'center'">收货人电话</th><th data-options="field:'TheReceivingUnitID',width:130,align:'center',hidden:true">收货人单位ID</th><th data-options="field:'TheReceivingUnitIDName',width:130,align:'center'">收货人单位</th><th data-options="field:'ConsigneeAddress',width:130,align:'center'">收货人地址</th><th data-options="field:'ClientModeOfPaymentID',width:130,align:'center',hidden:true">客户付款方式ID</th><th data-options="field:'ClientModeOfPaymentIDName',width:130,align:'center'">客户付款方式</th><th data-options="field:'AmountAdvanced',width:130,align:'center'">客户预付金额</th><th data-options="field:'TransportationExpenses',width:130,align:'center'">运费</th><th data-options="field:'InsurancePremium',width:130,align:'center'">保险费</th><th data-options="field:'MiscellaneousExpenses',width:130,align:'center'">其他费用</th><th data-options="field:'InsuredAmount',width:130,align:'center'">投保费用</th><th data-options="field:'mustIncomeCostRemark',width:130,align:'center',hidden:true">应收费用备注</th><th data-options="field:'AllCosts',width:130,align:'center'">总金额</th><th data-options="field:'txtYingFuAgreement',width:130,align:'center'">应付金额</th><th data-options="field:'ClientAgreementInformationID',width:130,align:'center',hidden:true">客户合同ID</th><th data-options="field:'CarriageFareValue',width:130,align:'center'">单价</th><th data-options="field:'InsuranceRate',width:130,align:'center'">费率</th></tr></thead></table>


 

(2).查询配送订单明细信息

<table id="tbGoodsListMingXiS" class="easyui-datagrid" style="width: auto; height: 180px;"data-options="singleSelect:true,rownumbers:true,rowStyler:function(index,row){if (index%2==0){}}"><thead><tr><th data-options="field:'OrderForGoodsInformationID',width:130,align:'center',hidden:true">货品ID</th><th data-options="field:'GoodsID',width:130,align:'center',hidden:true">货品ID</th><th data-options="field:'GoodsDesignation',width:130,align:'center'">货品名称</th><th data-options="field:'UnitID',width:130,align:'center',hidden:true">单位ID</th><th data-options="field:'UnitName',width:130,align:'center'">单位</th><th data-options="field:'Volume',width:130,align:'center'">体积</th><th data-options="field:'Deadweight',width:130,align:'center'">重量</th><th data-options="field:'Quantity',width:130,align:'center'">数量</th><th data-options="field:'Remarks',width:130,align:'center'">备注</th></tr></thead></table>


 

JavaScript代码:

(1).模糊查询配送订单信息

 

function ChaXunCaiGouDingDan() {///DingDanGuanL/MoHuSelectOrderForGoodsDispatchingInformationList?OrderForGoodsNumber=(DingDanGuanL是哪一个控制器//   MoHuSelectOrderForGoodsDispatchingInformationList(是这个控制器的方法名))//OrderForGoodsNumber是这个方法的一个参数$.getJSON("/DingDanGuanL/MoHuSelectOrderForGoodsDispatchingInformationList?OrderForGoodsNumber=" + $("#CaiGouDingDanHaoChaXun").val(),function (data) {//执行类这个方法就用哪一个方法来加载数据,显示到datagrid中$("#tbOrderForGoodsDispatchingInformationList").datagrid('loadData', data);});}


 

2.新增

(1).新增配送订单信息

Html代码:

 <div id="WinInsert" class="reveal-modal" style="width: auto; height: auto; left: 350px;right: auto; top: 80px; background-color: White"><div><table><tr><td style="font-size: 16px">订单号:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtOrderForGoodsNumber"readonly /></td><td style="font-size: 16px">订单类型:</td><td><input style="width: 130px; height: 30px; color: #FF0000;" class="easyui-combobox"id="cboOrderForGoodsTypeID" data-options=" url:'/XiaLaKuang/ChaXunShuXingMingXiXinXi?ShuXingJiHeID=22',valueField:'id', textField:'text'"readonly /></td><td style="font-size: 16px">客户码:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtClientManager"οnclick="btnClientManager()" οnkeyup="btnClientManager()" readonly /></td><td style="font-size: 16px">起运时间:</td><td><input style="width: 130px; height: 30px; color: #FF0000;" class="easyui-datebox"id="dtStartShipmentTime" data-options="onSelect:BiJiaoDaXiao,formatter:ShiJians" /></td></tr><tr><td style="font-size: 16px">预计到达时间:</td><td><input style="width: 125px; height: 30px; color: #FF0000;" class="easyui-datebox"id="dtPredictArriveTime" data-options="onSelect:BiJiaoDaXiao1,formatter:ShiJians" /></td><td style="font-size: 16px">配送区域:</td><td><input style="width: 130px; height: 30px; color: #FF0000;" class="easyui-combobox"id="cboBispatchingAreaID" data-options=" url:'/XiaLaKuang/SelecAreaList',valueField:'id', textField:'text'" /></td><td style="font-size: 16px">紧急程度:</td><td><input style="width: 130px; height: 30px; color: #FF0000;" class="easyui-combobox"id="cboUrgentLevelID" data-options=" url:'/XiaLaKuang/ChaXunShuXingMingXiXinXi?ShuXingJiHeID=23',valueField:'id', textField:'text'" /></td><td style="font-size: 16px">托运人姓名:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtShipperName"οnclick="btnClientContractsConsignList()" οnkeyup="btnClientContractsConsignList()"readonly /></td></tr><tr><td style="font-size: 16px">托运人电话:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtShipperPhoneNumber" /></td><span class="input input--madoka"><td style="font-size: 16px">托运人单位:</td><td><input style="width: 130px; height: 30px; color: #FF0000;" class="easyui-combobox"id="txtShipperUnitsID" data-options="url:'/XiaLaKuang/ChaXunDanWei',valueField:'SouShuDanWeiID',textField:'SouShuDanWeiMingCheng'" /></td><td style="font-size: 16px">托运人编号:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtConsignorNumber" /></td><td style="font-size: 16px">托运人地址:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtShipperLocation" /></td></tr><tr><td style="font-size: 16px">收货人姓名:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtClientReceivingpersonName"οnclick="btnClientReceivingpersonInformationList()" οnkeyup="btnClientReceivingpersonInformationList()"readonly /></td><td style="font-size: 16px">收货人电话:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtClientReceivingpersonNumber" /></td><td style="font-size: 16px">收货人单位:</td><td><input style="width: 130px; height: 30px; color: #FF0000;" class="easyui-combobox"id="txtClientReceivingpersonUnit" data-options="url:'/XiaLaKuang/ChaXunDanWei',valueField:'SouShuDanWeiID',textField:'SouShuDanWeiMingCheng'" /></td><td style="font-size: 16px">收货人地址:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtClientReceivingpersonAddress" /></td></tr><tr><td style="font-size: 16px">投保金额:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtAmountInsured"readonly οnclick="btnClientAgreementInformationList()" οnkeyup="btnClientAgreementInformationList()" /></td><td style="font-size: 16px">运费:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtTransportationExpenses" /></td><td style="font-size: 16px">保险费:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtInsurancePremium"readonly /></td><td style="font-size: 16px">其他费用:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtIncidentalExpenses"value="0" /></td></tr><tr><td style="font-size: 16px">客户预付金额:</td><td><input style="width: 125px; height: 30px; color: #FF0000;" type="text" id="txtAmountAdvanced"value="0" /></td><td style="font-size: 16px">总金额:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtTotalMoney"readonly /></td><td style="font-size: 16px">应付金额:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtYingFuAgreement"readonly /></td><td style="font-size: 16px">应收费用备注:</td><td><input style="width: 125px; height: 25px; color: #FF0000;" type="text" id="txtmustIncomeCostRemark" /></td></tr></table></div>


 

(2).新增配送订单明细信息

<table id="tbGoodsListMingXi" class="easyui-datagrid" style="width: auto; height: 180px;"data-options="onAfterEdit:onAfterEdit,singleSelect:true,onClickRow:onClickRowDingDan,rownumbers:true,rowStyler:function(index,row){if (index%2==0){}}"><thead><tr><th data-options="field:'DeleteGoods',width:130,align:'center',formatter:myformatter5">删除</th><th data-options="field:'OrderForGoodsInformationID',width:130,align:'center',hidden:true">货品ID</th><th data-options="field:'GoodsID',width:130,align:'center',hidden:true">货品ID</th><th data-options="field:'GoodsDesignation',width:130,align:'center'">货品名称</th><th data-options="field:'UnitID',width:130,align:'center',formatter:function(value,row){return row.text;},editor:{type:'combobox',options:{valueField:'id',textField:'text',url:'/XiaLaKuang/ChaXunShuXingMingXiXinXi?ShuXingJiHeID=68'}}">单位</th><th data-options="field:'Volume',width:130,align:'center'">体积</th><th data-options="field:'Deadweight',width:130,align:'center'">重量</th><th data-options="field:'Quantity',width:130,align:'center',editor:'text'">数量</th><th data-options="field:'Remarks',width:130,align:'center',editor:'text'">备注</th></tr></thead></table>


 

JavaScript代码:

(1).打开新增界面

//点击新增按钮(打开新增界面)function XingZengYunShuXinXi() {//block,将新增按钮显示出来//none将修改按钮隐藏起来document.getElementById("InsertButton").style.display = "block";document.getElementById("updateButton").style.display = "none";$("#txtOrderForGoodsNumber").val("");id1 = 0;$("#txtClientManager").val("");$("#cboOrderForGoodsTypeID")bobox("clear");$("#cboUrgentLevelID")bobox("clear")$("#dtStartShipmentTime").datebox("clear");$("#dtPredictArriveTime").datebox("clear");//PeiGongLuZhengChe 将单选框 和多选框 被选择为假(开始不选择)$("#PeiGongLuZhengChe").attr('checked', false);$("#PeiGongLuLingDan").attr('checked', false);$("#PeiHuoWuPeiSong").attr('checked', false);$("#PeiTieLu").attr('checked', false);$("#PeiGongYun").attr('checked', false);$("#DaoFu").attr('checked', false);$("#QianFan").attr('checked', false);$("#XianFu").attr('checked', false);$("#YueFu").attr('checked', false);$("#cboBispatchingAreaID")bobox("clear");$("#txtShipperName").val("");$("#txtConsignorNumber").val("");$("#txtShipperPhoneNumber").val("");$("#txtShipperUnitsID")bobox("clear");$("#txtShipperLocation").val("");$("#txtClientReceivingpersonName").val("");$("#txtClientReceivingpersonNumber").val("");//将下拉框清空//将文本款赋值为空$("#txtClientReceivingpersonUnit")bobox("clear");$("#txtClientReceivingpersonAddress").val("");$("#txtAmountAdvanced").val("");$("#txtTransportationExpenses").val("");$("#txtInsurancePremium").val("");$("#txtIncidentalExpenses").val("");$("#txtAmountInsured").val("");$("#txtmustIncomeCostRemark").val("");$("#txtTotalMoney").val("");$("#txtYingFuAgreement").val("");id5 = 0;id6 = 0;id7 = 0;//清空datagrid tatol(全部为空)rows为空$("#tbGoodsListMingXi").datagrid('loadData', { tatol: 0, rows: [] });$.getJSON("/DingDanGuanL/SelectOrderForGoodsInformationID",function (data) {var CheLiangBianHao = data[0].ShiJian1;$("#txtOrderForGoodsNumber").val(CheLiangBianHao);});$('#WinInsert').reveal($(this).data());$("#cboOrderForGoodsTypeID")bobox("select", 65);}


 

(2).保存新增信息


 

function InsertShiBei() {if (confirm("是否新增")) {endEditing(false);//先结束编辑,否则不能新增明细var TransportwayID = 0;//判断如果那个单选框打上钩就赋值给他if (document.getElementById("PeiGongLuZhengChe").checked) {TransportwayID = 87;} else if (document.getElementById("PeiGongLuLingDan").checked) {TransportwayID = 88;}else if (document.getElementById("PeiHuoWuPeiSong").checked) {TransportwayID = 89;}else if (document.getElementById("PeiTieLu").checked) {TransportwayID = 90;} else {TransportwayID = 91;}var ClientModeOfPaymentID = 0;//判断如果那个多选框打上钩就赋值给他if (document.getElementById("DaoFu").checked) {ClientModeOfPaymentID = 92;} else if (document.getElementById("QianFan").checked) {ClientModeOfPaymentID = 93;}else if (document.getElementById("XianFu").checked) {ClientModeOfPaymentID = 94;}else {ClientModeOfPaymentID = 95;}$.getJSON("/DingDanGuanL/InsertOrderForGoodsDispatchingInformationList?OrderForGoodsNumber="+ $("#txtOrderForGoodsNumber").val() + "&"+ "ClientID=" + id1 + "&"+ "OrderForGoodsTypeID=" + $("#cboOrderForGoodsTypeID")bobox('getValue') + "&"+ "UrgentLevelID=" + $("#cboUrgentLevelID")bobox('getValue') + "&"+ "StartShipmentTime=" + $("#dtStartShipmentTime").datebox('getValue') + "&"+ "PredictArriveTime=" + $("#dtPredictArriveTime").datebox('getValue') + "&"+ "TransportwayID=" + TransportwayID + "&"+ "BispatchingAreaID=" + $("#cboBispatchingAreaID")bobox('getValue') + "&"+ "ConsignorName=" + $("#txtShipperName").val() + "&"+ "ConsignorNumber=" + $("#txtConsignorNumber").val() + "&"+ "ConsignorBelephone=" + $("#txtShipperPhoneNumber").val() + "&"+ "ConsignorUnitID=" + $("#txtShipperUnitsID")bobox('getValue') + "&"+ "ConsignForShipmentPersonAddress=" + $("#txtShipperLocation").val() + "&"+ "ReceivingpersonName=" + $("#txtClientReceivingpersonName").val() + "&"+ "ConsigneePhoneNumber=" + $("#txtClientReceivingpersonNumber").val() + "&"+ "TheReceivingUnitID=" + $("#txtClientReceivingpersonUnit")bobox('getValue') + "&"+ "ConsigneeAddress=" + $("#txtClientReceivingpersonAddress").val() + "&"+ "ClientModeOfPaymentID=" + ClientModeOfPaymentID + "&"+ "AmountAdvanced=" + $("#txtAmountAdvanced").val() + "&"+ "TransportationExpenses=" + $("#txtTransportationExpenses").val() + "&"+ "InsurancePremium=" + $("#txtInsurancePremium").val() + "&"+ "MiscellaneousExpenses=" + $("#txtIncidentalExpenses").val() + "&"+ "InsuredAmount=" + $("#txtAmountInsured").val() + "&"+ "mustIncomeCostRemark=" + $("#txtmustIncomeCostRemark").val() + "&"+ "ClientAgreementInformationID=" + id5 + "&"+ "ZongTiJi=" + $("#txtZongShuLiang").val() + "&"+ "ZongShuLiang=" + $("#txtZhongTiCi").val() + "&"+ "ZongZhongLiang=" + $("#txtZongZhongLiang").val(),function (data) {//data 是controllers 返回的 var BaoXianID = (from bx in RK.PWOrderForTransportationList select bx.OrderForTransportationID).Max();// 最大IDvar CheLiangBaoXianTiaoMu = $("#tbGoodsListMingXi").datagrid('getData');for (var i = 0; i < CheLiangBaoXianTiaoMu.rows.length; i++) {{// CheLiangBaoXianTiaoMu.rows.length是datagrid的行数//CheLiangBaoXianTiaoMu.rows[i].GoodsID 对应的几行的单元格ID$.getJSON("/DingDanGuanL/InsertOrderForGoodsDispatchingDetailList?OrderForGoodsInformationID=" + data + "&"+ "GoodsID=" + CheLiangBaoXianTiaoMu.rows[i].GoodsID + "&"+ "Volume=" + CheLiangBaoXianTiaoMu.rows[i].Volume + "&"+ "Quantity=" + CheLiangBaoXianTiaoMu.rows[i].Quantity + "&"+ "Remarks=" + CheLiangBaoXianTiaoMu.rows[i].Remarks + "&"+ "UnitID=" + CheLiangBaoXianTiaoMu.rows[i].UnitID,function (data1) {});}if (data > 0) {alert("新增成功");window.location.href = "/DingDanGuanL/PeiSongDingDan";} else {alert("新增失败");}}});}}


 

2.  修改

Html代码和上面的新增代码一样,现在不做解析。

JavaScript代码:

(1).打开修改界面:

 

var OrderForGoodsInformationID = 0;//主键ID function Update() {//点击一条明细进行修改//隐藏新增按钮,显示修改按钮//通过用document.getElementById来找到那个ID,然后就对他进行操作document.getElementById("InsertButton").style.display = "none";document.getElementById("updateButton").style.display = "block";$('#WinInsert').reveal($(this).data());var ROW = $("#tbOrderForGoodsDispatchingInformationList").datagrid('getSelected');OrderForGoodsInformationID = ROW.OrderForGoodsInformationID;$("#txtOrderForGoodsNumber").val(ROW.OrderForGoodsNumber);id1 = ROW.ClientID;$("#txtClientManager").val(ROW.ClientName);$("#cboOrderForGoodsTypeID")bobox('setValue', ROW.OrderForGoodsTypeID);//对于下拉框用setValue的方法获取那个ID,不是文本值$("#cboUrgentLevelID")bobox('setValue', ROW.UrgentLevelID)$("#dtStartShipmentTime").datebox('setValue', ROW.StartShipmentTime2);$("#dtPredictArriveTime").datebox('setValue', ROW.PredictArriveTime2);if (ROW.TransportwayID == 87) {$("#PeiGongLuZhengChe").attr('checked', true)} else if (ROW.TransportwayID == 88) {$("#PeiGongLuLingDan").attr('checked', true)} else if (ROW.TransportwayID == 89) {$("#PeiHuoWuPeiSong").attr('checked', true)}else if (ROW.TransportwayID == 90) {$("#PeiTieLu").attr('checked', true)} else {$("#PeiGongYun").attr('checked', true)}if (ROW.ClientModeOfPaymentID == 92) {$("#DaoFu").attr('checked', true)} else if (ROW.ClientModeOfPaymentID == 93) {$("#QianFan").attr('checked', true)} else if (ROW.ClientModeOfPaymentID == 94) {$("#XianFu").attr('checked', true)}else {$("#YueFu").attr('checked', true)}$("#cboBispatchingAreaID")bobox('setValue', ROW.BispatchingAreaID);$("#txtShipperName").val(ROW.ConsignorName);$("#txtConsignorNumber").val(ROW.ConsignorNumber);$("#txtShipperPhoneNumber").val(ROW.ConsignorBelephone);$("#txtShipperUnitsID")bobox('setValue', ROW.ConsignorUnitID);$("#txtShipperLocation").val(ROW.ConsignForShipmentPersonAddress);$("#txtClientReceivingpersonName").val(ROW.ReceivingpersonName);$("#txtClientReceivingpersonNumber").val(ROW.ConsigneePhoneNumber);$("#txtClientReceivingpersonUnit")bobox('setValue', ROW.ConsignorUnitID);$("#txtClientReceivingpersonAddress").val(ROW.ConsigneeAddress);$("#txtAmountAdvanced").val(ROW.AmountAdvanced);$("#txtTransportationExpenses").val(ROW.TransportationExpenses);$("#txtInsurancePremium").val(ROW.InsurancePremium);$("#txtIncidentalExpenses").val(ROW.MiscellaneousExpenses);$("#txtAmountInsured").val(ROW.InsuredAmount);$("#txtmustIncomeCostRemark").val(ROW.mustIncomeCostRemark);$("#txtTotalMoney").val(ROW.AllCosts);$("#txtYingFuAgreement").val(ROW.txtYingFuAgreement);id5 = ROW.ClientAgreementInformationID;id6 = ROW.CarriageFareValue;id7 = ROW.InsuranceRate;$.getJSON("/DingDanGuanL/SelectOrderForGoodsDispatchingDetailList?OrderForGoodsInformationID=" + ROW.OrderForGoodsInformationID,function (data) {$("#tbGoodsListMingXi").datagrid('loadData', data);var dt = $("#tbGoodsListMingXi").datagrid('getData');for (var i = 0; i < dt.rows.length; i++) {//绑定时,因为datagrid有combobox不能显示出来,可用这个方法$("#tbGoodsListMingXi").datagrid('getRows')[i]["text"] = data[i]["UnitName"];$("#tbGoodsListMingXi").datagrid('beginEdit', i);$("#tbGoodsListMingXi").datagrid('endEdit', i);}});DeleteList();}


 

(2).保存修改信息

function UpdateShiBei() {if (confirm("是否修改")) {endEditing(false);//endEditing(false);结束编辑var TransportwayID = 0;if (document.getElementById("PeiGongLuZhengChe").checked) {TransportwayID = 87;} else if (document.getElementById("PeiGongLuLingDan").checked) {TransportwayID = 88;}else if (document.getElementById("PeiHuoWuPeiSong").checked) {TransportwayID = 89;}else if (document.getElementById("PeiTieLu").checked) {TransportwayID = 90;} else {TransportwayID = 91;}var ClientModeOfPaymentID = 0;if (document.getElementById("DaoFu").checked) {ClientModeOfPaymentID = 92;} else if (document.getElementById("QianFan").checked) {ClientModeOfPaymentID = 93;}else if (document.getElementById("XianFu").checked) {ClientModeOfPaymentID = 94;}else {ClientModeOfPaymentID = 95;}//第一次修改$.getJSON("/DingDanGuanL/UpdateOrderForGoodsDispatchingInformationList?OrderForTransportationID="+ OrderForGoodsInformationID + "&"+ "OrderForGoodsNumber=" + $("#txtOrderForGoodsNumber").val() + "&"+ "ClientID=" + id1 + "&"+ "OrderForGoodsTypeID=" + $("#cboOrderForGoodsTypeID")bobox('getValue') + "&"+ "UrgentLevelID=" + $("#cboUrgentLevelID")bobox('getValue') + "&"+ "StartShipmentTime=" + $("#dtStartShipmentTime").datebox('getValue') + "&"+ "PredictArriveTime=" + $("#dtPredictArriveTime").datebox('getValue') + "&"+ "TransportwayID=" + TransportwayID + "&"+ "BispatchingAreaID=" + $("#cboBispatchingAreaID")bobox('getValue') + "&"+ "ConsignorName=" + $("#txtShipperName").val() + "&"+ "ConsignorNumber=" + $("#txtConsignorNumber").val() + "&"+ "ConsignorBelephone=" + $("#txtShipperPhoneNumber").val() + "&"+ "ConsignorUnitID=" + $("#txtShipperUnitsID")bobox('getValue') + "&"+ "ConsignForShipmentPersonAddress=" + $("#txtShipperLocation").val(),function (data1) {//第二次修改$.getJSON("/DingDanGuanL/UpdateOrderForGoodsDispatchingInformationList1?OrderForTransportationID=" +OrderForGoodsInformationID + "&"+ "ReceivingpersonName=" + $("#txtClientReceivingpersonName").val() + "&"+ "ConsigneePhoneNumber=" + $("#txtClientReceivingpersonNumber").val() + "&"+ "TheReceivingUnitID=" + $("#txtClientReceivingpersonUnit")bobox('getValue') + "&"+ "ConsigneeAddress=" + $("#txtClientReceivingpersonAddress").val() + "&"+ "ClientModeOfPaymentID=" + ClientModeOfPaymentID + "&"+ "AmountAdvanced=" + $("#txtAmountAdvanced").val() + "&"+ "TransportationExpenses=" + $("#txtTransportationExpenses").val() + "&"+ "InsurancePremium=" + $("#txtInsurancePremium").val() + "&"+ "MiscellaneousExpenses=" + $("#txtIncidentalExpenses").val() + "&"+ "InsuredAmount=" + $("#txtAmountInsured").val() + "&"+ "mustIncomeCostRemark=" + $("#txtmustIncomeCostRemark").val() + "&"+ "ClientAgreementInformationID=" + id5 + "&"+ "ZongTiJi=" + $("#txtZongShuLiang").val() + "&"+ "ZongShuLiang=" + $("#txtZhongTiCi").val() + "&"+ "ZongZhongLiang=" + $("#txtZongZhongLiang").val(),function (data) {//修改明细信息var delRow = $("#tbGoodsListMingXi").datagrid('getChanges', 'deleted');rowsCount = delRow.length;//同个getchanges的方法获取删除的行数for (var i = 0; i < rowsCount; i++) {//for改变多少行就执行多少次方法$.getJSON("/DingDanGuanL/UpdateOrderForGoodsDispatchingDetailList?OrderForGoodsDetailID="+ delRow[i].OrderForGoodsInformationID + "&"+ "OrderForGoodsInformationID=" + OrderForGoodsInformationID + "&"+ "GoodsID=" + delRow[i].GoodsID + "&"+ "Volume=" + delRow[i].Volume + "&"+ "Quantity=" + delRow[i].Quantity + "&"+ "Remarks=" + delRow[i].Remarks + "&"+ "UnitID=" + delRow[i].UnitID + "&"+ "Update=" + 3,function (data2) {});}var insRow = $("#tbGoodsListMingXi").datagrid('getChanges', 'inserted');//同个getchanges的方法获取新增的行数rowsCount = insRow.length;for (var j = 0; j < rowsCount; j++) {$.getJSON("/DingDanGuanL/UpdateOrderForGoodsDispatchingDetailList?OrderForGoodsDetailID=" + 0 + "&"+ "OrderForGoodsInformationID=" + OrderForGoodsInformationID + "&"+ "GoodsID=" + insRow[j].GoodsID + "&"+ "Volume=" + insRow[j].Volume + "&"+ "Quantity=" + insRow[j].Quantity + "&"+ "Remarks=" + insRow[j].Remarks + "&"+ "UnitID=" + insRow[j].UnitID + "&"+ "Update=" + 2,function (data3) {});}var UpdatRow = $("#tbGoodsListMingXi").datagrid('getChanges', 'updated');//同个getchanges的方法获取修改的行数rowsCount = UpdatRow.length;for (var k = 0; k < rowsCount; k++) {$.getJSON("/DingDanGuanL/UpdateOrderForGoodsDispatchingDetailList?OrderForGoodsDetailID="+ UpdatRow[k].OrderForGoodsInformationID + "&"+ "OrderForGoodsInformationID=" + OrderForGoodsInformationID + "&"+ "GoodsID=" + UpdatRow[k].GoodsID + "&"+ "Volume=" + UpdatRow[k].Volume + "&"+ "Quantity=" + UpdatRow[k].Quantity + "&"+ "Remarks=" + UpdatRow[k].Remarks + "&"+ "UnitID=" + UpdatRow[k].UnitID + "&"+ "Update=" + 1,function (data4) {});}});if (data1 > 0) {alert("修改成功!");setTimeout(function () {window.location.href = "/DingDanGuanL/PeiSongDingDan";}, 2000);} else {alert("修改失败");}});}}


 

4.  删除配送订单信息

JavaScript代码:

function ShanChu() {var row = $("#tbOrderForGoodsDispatchingInformationList").datagrid('getSelected');//getSelected 是获取你要删除的那一行if (confirm("是否删除!")) {//先删除明细,再删除订单$.getJSON("/DingDanGuanL/DeleteSYSDiaryList?OrderForTransportationID=" + row.OrderForGoodsInformationID,function (data) {$.getJSON("/DingDanGuanL/DeleteOrderForGoodsDispatchingDetailList?OrderForGoodsDetailID=" + row.OrderForGoodsInformationID,function (data1) {$("#tbGoodsListMingXiS").datagrid('loadData', data);$("#tbOrderForGoodsDispatchingInformationList").datagrid('loadData', data1);});if (data > 0) {alert("删除成功!");$("#tbOrderForGoodsDispatchingInformationList").datagrid('reload');} else {alert("删除失败");}});}}



仅供学习,禁止用于商业用途

 

 

本文标签: MVC北京络捷斯特第三方物流系统技术解析(四)订单配送信息