您的位置:首页 > 其它

MVC北京络捷斯特第三方物流系统技术解析(三)订单运输管理

2015-05-30 14:42 369 查看
MVC北京络捷斯特第三方物流系统技术解析(三)订单运输管理

在“运输订单信息”页面用户可以编辑此订单的基本信息,如下图所示。在此页面用户选择【新增】按钮,此时系统会显示选择订单类型的界面,在此页面选择订单类型为“入库订单”,单击【确定】,进入入库订单的编辑界面。此页面包括“订单信息”、“订单入库信息”、“订单货品”三个标签页。其中若用户添“质押银行”信息,则表明此批货品已经质押给银行,其各种作业操作需要银行监控。银行用户可以选择2.6仓库管理库存监控-质押查询来跟踪此批货品的状态。
界面效果图:



2.5.1.3图(1)
从界面上可以看到我们这里用到的控件有
从界面上可以看到我们这里用到的控件有

控件名称
说明
日期控件(easyui-datebox)

每个控件都要设置id,第二设置大小不设置也有默认,第三(data-options)是数据操作:可以设置控件的一些属性和事件

单行文本控件(text)

按钮(easyui-linkbutton)

表格(easyui-datagrid)

查询功能实现:
第一步:数据库
1、表和表关系
上面的datagrid



2.5.1.3图(2)

表1:运输订单表(PWOrderForTransportationList)

用于存放运输订单的信息

PrimaryKey(s):OrderForTransportationID

列名

数据类型

主键/外键

说明

OrderForTransportationID

int

主键

订单运输信息ID

OrderForGoodsNumber

nchar(50)

订单号

VocationalTypeID

int

外键

业务类型ID

HeadstreamID

int

外键

始发地ID

DestinationID

int

外键

目的地ID

TakeDeliveryTime

datetime

取货时间

ArriveTime

datetime

到货时间

TakeDeliveryID

int

外键

取货ID

DeliverGoodsID

int

外键

签单ID

WrittenPermissionID

int

外键

返回ID

ClientContractsConsignID

int

外键

合同托运客户ID

ShipperName

nchar(50)

托运人姓名

ShipperPhoneNumber

nchar(50)

托运人电话

ShipperUnitsID

int

外键

托运人单位ID

ShipperLocation

nchar(50)

托运人地址

ShipperAccount

nchar(50)

托运帐号

ShipperPostcode

nchar(50)

托运人邮编

ClientManager

nchar(50)

客户经理

StorePickupPersonID

int

外键

取货人ID

StorePickupPersonName

nchar(50)

取货联系人

StorePickupPersonPhoneNumber

nchar(50)

取货联系人电话

StorePickupPersonAddress

nchar(50)

取货地址

ProjectID

int

外键

项目ID

ConsigneeName

nchar(10)

收货人姓名

ConsigneePhoneNumber

nchar(50)

收货人电话

ConsigneeUnit

nchar(50)

收货人单位

ConsigneeAddress

nchar(50)

收货人地址

ConsigneeAccount

nchar(50)

收货人帐号

ConsigneePostcode

nchar(50)

收货人邮编

ConsigneeID

int

外键

收货人ID

CarriageFare

decimal(18,2)

运费

IncidentalExpenses

decimal(18,2)

杂费

CostSumUp

decimal(18,2)

费用小计

WhetherOrNotInsureDeclare

bit

保声明否

SettleAccountsWayID

int

外键

保险费

AdvanceReceipts

decimal(18,2)

结算方式ID

InsureExpenses

decimal(18,2)

预收款

PayNumber

nchar(50)

付费帐号

Remarks

nchar(100)

备注

FabricationOrderFormID

int

外键

制单人ID

AcceptanceTime

datetime

受理时间

AcceptanceUnitID

int

外键

受理单位ID

Receiver

nchar(10)

签收人

SignForTime

datetime

签收时间

WhetherOrNotSignFor

bit

签收否

RepeatOrderStateID

int

外键

返单状态ID

RepeatOrderPeopleID

int

外键

返单人ID

RepeatOrderTime

datetime

返单时间

RepeatOrderReceive

bit

返单时间

BeforeOneTime

nchar(100)

当前地点

CheckEmploy

bit

复核否

ClientID

int

外键

客户ID

ClientAgreementInformationID

int

外键

客户合同ID

TongZhiCiShu

int

外键

QuHuoFou

bit

ShengChenJiHuaDan

nchar(30)

生成计划单号

ShengChenFou

bit

生成否

DingDanZhuangTai

bit

订单状态

ZongTiJi

decimal(18,3)

总体积

ZongShuLiang

decimal(18,3)

总数量

ZongZhongLiang

decimal(18,3)

总重量

RouteID

int

外键

路由ID

ZhanCunFou

bit

暂存否

HuoWeiID

int

外键

货位ID

HuoWeiHao

nchar(50)

货位号

YiQuHuo

bit

已取否

YiPaiHuo

bit

已派否

QuPaiLeiXingFou

bit

取派类型否

LunLiID

int

外键

运力ID

ShuaiHuoFou

bit

甩货否

YouYongFou

bit

有否否

ShengChengZhanDanFou

bit

生成账单否

表2:属性明细表(SYSAttributeDetailList)

用于存放集合信息

列名

数据类型

主键/外键

说明

AttributeDetailID

int

主键

属性明细ID

AttributeGatherID

int

外键

属性集合ID

AttributeDetailName

nchar(10)

属性明细名称

YouYongFou

bit

有效否

表3:站点信息表(SYSSiteInformationList)

用于存放站点信息

列名

数据类型

主键/外键

说明

SiteInformationID

int

主键

站点信息ID

SiteTypeID

int

外键

站点类型ID

SiteNumber

nchar(50)

站点编号

SiteDesignation

nchar(50)

站点名称

SiteAddress

nchar(50)

站点详细地址

SiteTelephone

nchar(50)

站点电话

SitePortraiture

nchar(50)

站点传真

ZipCode

nchar(50)

邮编

FenJianQu

nchar(50)

分拣区

ChuCunQu

nchar(50)

储存区

Contacts

nchar(10)

Contacts

Remarks

nchar(100)

备注

PlaceArea

decimal(18)

场地面积

CarparkArea

decimal(18)

停车场面积

Quantity

decimal(18)

车位数量

YouYongFou

bit

有效否

表4:所属单位表(SYSSubsidiaryUnitList)

用于存放单位信息

列名

数据类型

主键/外键

说明

SubsidiaryUnitID

int

主键

所属单位ID

InstitutionID

int

外键

机构ID

SubsidiaryUnitDesignation

nchar(50)

所属单位名称

YouYongFou

bit

有效否

表5:项目表(SYSProjectList)

用于存放项目信息

列名

数据类型

主键/外键

说明

ProjectID

int

主键

项目ID

WhetherProjectSpecialtype

bit

项目特殊类型否

ProjectNumber

nchar(100)

项目代码

ProjectDesignation

nchar(100)

项目名称

ProjectDescribe

nchar(100)

项目描述

YouYongFou

bit

有效否

表6:员工表(SYSPersonnelList)

用于存放员工信息

列名

数据类型

主键/外键

说明

PersonnelID

int

主键

员工ID

DepartmentID

int

外键

部门ID

UseOrganization

int

外键

使用机构ID

OrganizationID

int

外键

所属机构ID

GenreID

int

外键

所属类型ID

SubsidiaryUnitID

int

外键

所属单位ID

SexID

int

外键

性别ID

CredentialsGenreID

int

外键

证件类型ID

StateID

int

外键

状态ID

Birthday

date

人员编码

WorkDate

date

区别码

PersonnelCode

nchar(50)

姓名

DifferenceCode

nchar(50)

出生日期

Name

nchar(10)

工作日期

Duties

nchar(50)

职务

CredentialsNumber

nchar(50)

证件号码

Address

nchar(50)

住址

PhoneNumber

nchar(50)

电话

MobilePhone

nchar(50)

手机

Email

nchar(50)

Email

Remarks

nchar(50)

备注

YouYongFou

bit

有效否

表6:客户表(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

同步否

表7:客户合同表(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)

保险费率

表8:保险公司表(SYSInsuranceCompanyList)

用于存放保险公司信息

列名

数据类型

主键/外键

说明

InsuranceCompanyID

int

主键

保险公司ID

InsuranceCompanyDesignation

nchar(50)

保险公司名称

InsuranceDesignationNumber

nchar(50)

保险公司编号

InsuranceRate

nchar(50)

保险费率

AmountInsured

nchar(50)

投保金额

YouYongFou

bit

有用否

下面的datagrid



2.5.1.3图(3)
下面的datagrid

表和表的关系:

表9:订单运输明细表(PWOrderForGoodsDetailList)

用于存放订单运输明细信息

列名

数据类型

主键/外键

说明

OrderForGoodsDetailID

int

主键

订单运输明细ID

OrderForGoodsTransportinformationID

int

外键

订单运输信息ID

GoodsID

int

外键

货品ID

Cubage

nchar(50)

体积

Quantity

nchar(50)

数量

Remarks

nchar(50)

备注

UnitsID

int

外键

单位ID

QualityID

int

外键

质量ID

ZhongLiang

nchar(50)

数量

TiChi

nchar(50)

体积

YouYongFou

bit

有用否

表10:货品表(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

有用否

控件使用方法:

1.文本框(type=”text”)
文本框截图:



创建文本框控件界面代码:
<td>
<inputid="DingDanHaoChaXun"style="width:180px;height:25px;"/>
</td>


linq获取值
获取界面控件的值代码:
$("#DingDanHaoChaXun").val();//DingDanHaoChaXun对应的ID




创建按钮控件界面代码:
<td>
<buttonclass="btnblue"data-toggle="modal"style="font-family:楷体;"onclick="ChaXunCaiGouDingDan()">查询</button</td>
//class="btnblue"是css文件的一种类<td>
<buttonclass="btnblue"data-toggle="modal"style="font-family:楷体;"
onclick="WinInsert()">
//点击打开新增新增</button>
</td>
创建按钮点击事件:
//模糊查询加载数据
functionChaXunCaiGouDingDan(){
DingDanGuanL/MoHuYunShuGuanLi对应controllers的路径#DingDanHaoChaXun对应的ID
$.getJSON("/DingDanGuanL/MoHuYunShuGuanLi?OrderForGoodsNumber="+$("#DingDanHaoChaXun").val(),function(data){$("#tbOrderForTransportationList").datagrid('loadData',data);
});}
//点击新增打开窗体
$('#WinInsert').reveal($(this).data());
//关闭窗体
functionGuanBiKeHuHuoPinXinXi(){
$(".reveal-modal-bg").css("visibility","hidden");
$("#IGoodsList").css("visibility","hidden");
}

3.datagrid中的按钮



[align=left][/align]

2.5.1.3图(6)
//LuYouIDs是ID,row是指定的行,rowIndex是那一行的索引
functionmyformatter1(LuYouIDS,row,rowIndex){
return"<ahref='javascript:ShanChu("+LuYouIDS+","+rowIndex+")'>"+'<imgsrc="../../Content/图/icons/cancel.png"/></a>';
}
functionmyformatter2(LuYouIDS,row,rowIndex){
return"<ahref='javascript:Updata("+LuYouIDS+","+rowIndex+")'>"+'<imgsrc="../../Content/图/icons/pencil.png"/></a>';
}
functionmyformatter3(LuYouIDS,row,rowIndex){
return"<ahref='javascript:SelectMingXi("+LuYouIDS+","+rowIndex+")'>"+'<imgsrc="../../Content/图/icons/search.png"/></a>';
}
functionmyformatter5(LuYouIDS,row,rowIndex){
return"<ahref='javascript:DeleteGoods("+LuYouIDS+","+rowIndex+")'>"+'<imgsrc="../../Content/图/icons/cancel.png"/></a>';
}
functionmyformatter6(LuYouIDS,row,rowIndex){
return"<ahref='javascript:ShengChenJiHuaDan1("+LuYouIDS+","+rowIndex+")'>"+'生成计划单</a>';
}
functionmyformatter7(LuYouIDS,row,rowIndex){
return"<ahref='javascript:ZhuanYunFenDan("+LuYouIDS+","+rowIndex+")'>"+'转运运输单</a>';
}


第二步:控制器(Controllers)




2.5.1.3图(7)
#region运输管理
publicActionResultYunShuGuanLi()
{
varOrderForGoodsTransportinformationList=fromOrderForGoodsTransportinformation
inRK.PWOrderForTransportationList//订单运输信息表
joinVocationalTypeListinRK.SYSAttributeDetailListonOrderForGoodsTransportinformation.VocationalTypeID
equalsVocationalTypeList.AttributeDetailID//业务类型ID
joinHeadstreamListinRK.SYSSiteInformationListonOrderForGoodsTransportinformation.HeadstreamID
equalsHeadstreamList.SiteInformationID//始发地ID
joinDestinationListinRK.SYSSiteInformationListonOrderForGoodsTransportinformation.DestinationID
equalsDestinationList.SiteInformationID//目的地ID
joinShipperUnitsIDListinRK.SYSSubsidiaryUnitListonOrderForGoodsTransportinformation.ShipperUnitsID
equalsShipperUnitsIDList.SubsidiaryUnitID//托运人单位ID
joinProjectListinRK.SYSProjectListonOrderForGoodsTransportinformation.ProjectIDequalsProjectList.ProjectID//项目ID
joinSettleAccountsWayListinRK.SYSAttributeDetailListonOrderForGoodsTransportinformation.SettleAccountsWayID
equalsSettleAccountsWayList.AttributeDetailID//结算方式ID
joinFabricationOrderFormListinRK.SYSPersonnelListonOrderForGoodsTransportinformation.FabricationOrderFormID
equalsFabricationOrderFormList.PersonnelID//制单人ID
joinAcceptanceUnitListinRK.SYSSubsidiaryUnitListonOrderForGoodsTransportinformation.AcceptanceUnitID
equalsAcceptanceUnitList.SubsidiaryUnitID//受理单位ID
joinClientListinRK.SYSClientListonOrderForGoodsTransportinformation.ClientIDequalsClientList.ClientID//受理单位ID
joinClientAgreementInformationListinRK.SYSClientAgreementInformationListon
OrderForGoodsTransportinformation.ClientAgreementInformationID
equalsClientAgreementInformationList.ClientAgreementInformationID//受理单位ID
joinInsuranceCompanyListinRK.SYSInsuranceCompanyListonClientAgreementInformationList.InsuranceCompanyID
equalsInsuranceCompanyList.InsuranceCompanyID
orderbyOrderForGoodsTransportinformation.OrderForTransportationIDdescending
//查询条件是还没有生成单号的数据
whereOrderForGoodsTransportinformation.ShengChenFou==null
selectnew
{
//
OrderForTransportationID=OrderForGoodsTransportinformation.OrderForTransportationID,//运输订单ID
OrderForGoodsNumber=OrderForGoodsTransportinformation.OrderForGoodsNumber,//运输单号
//。。。。。。对应数据库的参数
VocationalTypeID=OrderForGoodsTransportinformation.VocationalTypeID,
VocationalTypeName=VocationalTypeList.AttributeDetailName,
HeadstreamID=OrderForGoodsTransportinformation.HeadstreamID,
HeadstreamName=HeadstreamList.SiteDesignation,
DestinationID=OrderForGoodsTransportinformation.DestinationID,
DestinationName=DestinationList.SiteDesignation,
TakeDeliveryTime=OrderForGoodsTransportinformation.TakeDeliveryTime,
ArriveTime=OrderForGoodsTransportinformation.ArriveTime,
TakeDeliveryID=OrderForGoodsTransportinformation.TakeDeliveryID,
DeliverGoodsID=OrderForGoodsTransportinformation.DeliverGoodsID,
WrittenPermissionID=OrderForGoodsTransportinformation.WrittenPermissionID,
PeturnID=OrderForGoodsTransportinformation.PeturnID,
ClientContractsConsignID=OrderForGoodsTransportinformation.ClientContractsConsignID,
ShipperName=OrderForGoodsTransportinformation.ShipperName,
ShipperPhoneNumber=OrderForGoodsTransportinformation.ShipperPhoneNumber,
ShipperUnitsID=OrderForGoodsTransportinformation.ShipperUnitsID,
ShipperUnitsName=ShipperUnitsIDList.SubsidiaryUnitDesignation,
ShipperLocation=OrderForGoodsTransportinformation.ShipperLocation,
ShipperAccount=OrderForGoodsTransportinformation.ShipperAccount,
ShipperPostcode=OrderForGoodsTransportinformation.ShipperPostcode,
ClientManager=OrderForGoodsTransportinformation.ClientManager,
StorePickupPersonID=OrderForGoodsTransportinformation.StorePickupPersonID,
StorePickupPersonName=OrderForGoodsTransportinformation.StorePickupPersonName,
StorePickupPersonPhoneNumber=OrderForGoodsTransportinformation.StorePickupPersonPhoneNumber,
StorePickupPersonAddress=OrderForGoodsTransportinformation.StorePickupPersonAddress,
ProjectID=OrderForGoodsTransportinformation.ProjectID,
ProjectName=ProjectList.ProjectDesignation,
ConsigneeName=OrderForGoodsTransportinformation.ConsigneeName,
ConsigneePhoneNumber=OrderForGoodsTransportinformation.ConsigneePhoneNumber,
ConsigneeUnit=OrderForGoodsTransportinformation.ConsigneeUnit,
ConsigneeAddress=OrderForGoodsTransportinformation.ConsigneeAddress,
ConsigneeAccount=OrderForGoodsTransportinformation.ConsigneeAccount,
ConsigneePostcode=OrderForGoodsTransportinformation.ConsigneePostcode,
ConsigneeID=OrderForGoodsTransportinformation.ConsigneeID,
CarriageFare=OrderForGoodsTransportinformation.CarriageFare,
IncidentalExpenses=OrderForGoodsTransportinformation.IncidentalExpenses,
CostSumUp=OrderForGoodsTransportinformation.CostSumUp,
WhetherOrNotInsureDeclare=OrderForGoodsTransportinformation.WhetherOrNotInsureDeclare,
SettleAccountsWayID=OrderForGoodsTransportinformation.SettleAccountsWayID,
SettleAccountsWayName=SettleAccountsWayList.AttributeDetailName,
AdvanceReceipts=OrderForGoodsTransportinformation.AdvanceReceipts,
InsureExpenses=OrderForGoodsTransportinformation.InsureExpenses,
PayNumber=OrderForGoodsTransportinformation.PayNumber,
Remarks=OrderForGoodsTransportinformation.Remarks,
FabricationOrderFormID=OrderForGoodsTransportinformation.FabricationOrderFormID,
FabricationOrderFormName=FabricationOrderFormList.Name,
AcceptanceTime=OrderForGoodsTransportinformation.AcceptanceTime,
AcceptanceUnitID=OrderForGoodsTransportinformation.AcceptanceUnitID,
AcceptanceUnitName=AcceptanceUnitList.SubsidiaryUnitDesignation,
InsuredAmount=OrderForGoodsTransportinformation.InsuredAmount,
//全部费用=OrderForGoodsTransportinformation.InsuredAmount(运费)
AllFeiCount=OrderForGoodsTransportinformation.InsuredAmount+
//CarriageFare(费用小计)
OrderForGoodsTransportinformation.CarriageFare+
//IncidentalExpenses(保险费)
OrderForGoodsTransportinformation.IncidentalExpenses
//CostSumUp(其他费用)
+OrderForGoodsTransportinformation.CostSumUp,
ClientID=OrderForGoodsTransportinformation.ClientID,
ClientAgreementInformationID=OrderForGoodsTransportinformation.ClientAgreementInformationID,
CarriageFareValue=ClientAgreementInformationList.CarriageFareValue,
InsuranceCompanyName=InsuranceCompanyList.InsuranceRate,
CheckEmploy=OrderForGoodsTransportinformation.CheckEmploy,
SignForTime=OrderForGoodsTransportinformation.SignForTime,
WhetherOrnotSignFor=OrderForGoodsTransportinformation.WhetherOrNotSignFor,
Receiver=OrderForGoodsTransportinformation.Receiver,
ShengChenJiHuaDan=OrderForGoodsTransportinformation.ShengChenJiHuaDan,

ZongTiJi=OrderForGoodsTransportinformation.ZongTiJi,
ZongShuLiang=OrderForGoodsTransportinformation.ZongShuLiang,
ZongZhongLiang=OrderForGoodsTransportinformation.ZongZhongLiang,
};
List<Dictionary<string,object>>DDitem=newList<Dictionary<string,object>>();
foreach(variteminOrderForGoodsTransportinformationList)
{
Dictionary<string,object>DingDanItem=newDictionary<string,object>();
//TakeDeliveryTime.ToString()将这些的时间转换成字符串
//TakeDeliveryTime2就是将这些时间加入到数据字典中
stringTakeDeliveryTime1=item.TakeDeliveryTime.ToString();
DingDanItem.Add("TakeDeliveryTime2",TakeDeliveryTime1);
stringArriveTime1=item.ArriveTime.ToString();
DingDanItem.Add("ArriveTime2",ArriveTime1);
stringAcceptanceTime1=item.AcceptanceTime.ToString();
DingDanItem.Add("AcceptanceTime2",AcceptanceTime1);
stringSignForTime1=item.SignForTime.ToString();
DingDanItem.Add("SignForTime2",SignForTime1);
foreach(System.Reflection.PropertyInfopinitem.GetType().GetProperties())
{
DingDanItem.Add(p.Name,p.GetValue(item,null));
}
stringTakeDeliveryID1=item.TakeDeliveryID.ToString();
//TakeDeliveryID(取货)
//如果TakeDeliveryID1==74就是不为零,代表他已经选择取货
if(TakeDeliveryID1=="74")
{

DingDanItem.Add("TakeDeliveryID2","取货");
}
else
{
//如果TakeDeliveryID1不等74就是为零,代表他未选择取货
//TakeDeliveryTime2就是将这些时间加入到数据字典中,传给界面,显示后面的值(“取货”)
DingDanItem.Add("TakeDeliveryID2","");
}
//TakeDeliveryID(派货)
//如果TakeDeliveryID1==75就是不为零,代表他已经选择派货
stringDeliverGoodsID1=item.DeliverGoodsID.ToString();
if(DeliverGoodsID1=="75")
{
//如果TakeDeliveryID1不等75就是为零,代表他未选择派货
DingDanItem.Add("DeliverGoodsID2","送货");
}
else
{
DingDanItem.Add("DeliverGoodsID2","");
}
//TakeDeliveryID(运单)
//如果TakeDeliveryID1==77就是不为零,代表他已经选择运单
stringPeturnID1=item.PeturnID.ToString();
if(PeturnID1=="77")
{
//如果TakeDeliveryID1不等77就是为零,代表他未选择运单
DingDanItem.Add("PeturnID2","运单");
}
else
{
DingDanItem.Add("PeturnID2","");
}
//TakeDeliveryID(客户单据)
//如果TakeDeliveryID1==76就是不为零,代表他已经选择客户单据
stringWrittenPermissionID1=item.WrittenPermissionID.ToString();
if(WrittenPermissionID1=="76")
{

DingDanItem.Add("WrittenPermissionID2","客户单据");
}
else
{
DingDanItem.Add("WrittenPermissionID2","");
}
stringWhetherOrnotInsureDeclare1=item.WhetherOrNotInsureDeclare.ToString();
//WhetherOrNotInsureDeclare,是保险否。
if(WhetherOrnotInsureDeclare1=="True")
{
//如果选择就是true,不选择就是未复核,把是和否显示到界面
DingDanItem.Add("WhetherOrnotInsureDeclare2","是");
}
else
{
DingDanItem.Add("WhetherOrnotInsureDeclare2","否");
}
stringCheckEmploy1=item.CheckEmploy.ToString();
if(CheckEmploy1=="True")
{
//WhetherOrNotInsureDeclare,是复核否。
DingDanItem.Add("CheckEmploy2","已复核");
}
//如果选择就是true,不选择就是未复核,把是和否显示到界面
elseif(CheckEmploy1=="False")
{
DingDanItem.Add("CheckEmploy2","复核中");
}
else
{
DingDanItem.Add("CheckEmploy2","未复核");
}
DDitem.Add(DingDanItem);
}
returnJson(DDitem,JsonRequestBehavior.AllowGet);

}


第三步、视图层(views)



2.5.1.3图(8)
html代码:



2.5.1.3图(9)
html代码
<tableid="tbOrderForTransportationList"title="运输订单"class="easyui-datagrid"style="width:auto;
height:280px;"data-
//rownumbers:true行号
//singleSelect:true单选
//rowStyler:function设计datagrid行的风格或者单元格的风格
options="url:'/DingDanGuanL/YunShuGuanLi',rownumbers:true,singleSelect:true,rowStyler:function(index,row){
if(index%2==0){
}
}">
<thead>
<tr>
<thdata-options="field:'ok',align:'center',checkbox:true">
</th>
<thdata-options="field:'ShanChu',width:38,align:'center',formatter:myformatter1">
删除
</th>
<thdata-options="field:'Updata',width:38,align:'center',formatter:myformatter2">
修改
</th>
<thdata-options="field:'SelectMingXi',width:38,align:'center',formatter:myformatter3">
查看
</th>
<thdata-options="field:'ZhuanYunFenDan',width:80,align:'center',formatter:myformatter7">
转运运输单
</th>
<thdata-options="field:'ShengChenJiHuaDan1',width:80,align:'center',formatter:myformatter6">
生成计划单
</th>
<thdata-options="field:'OrderForTransportationID',width:118,align:'center',hidden:true">
订单号ID
</th>
<thdata-options="field:'OrderForGoodsNumber',width:118,align:'center'">
订单号
</th>
<thdata-options="field:'VocationalTypeID',width:118,align:'center',hidden:true">
业务类型ID
</th>
<thdata-options="field:'VocationalTypeName',width:118,align:'center',hidden:true">
业务类型
</th>
<thdata-options="field:'HeadstreamID',width:118,align:'center',hidden:true">
始发站ID
</th>
<thdata-options="field:'HeadstreamName',width:118,align:'center',hidden:true">
始发站
</th>
<thdata-options="field:'DestinationID',width:118,align:'center',hidden:true">
目的站ID
</th>
<thdata-options="field:'DestinationName',width:118,align:'center',hidden:true">
目的站
</th>
<thdata-options="field:'TakeDeliveryTime2',width:118,align:'center',hidden:true">
取货时间
</th>
<thdata-options="field:'ArriveTime2',width:118,align:'center',hidden:true">
到货时间
</th>
<thdata-options="field:'TakeDeliveryID2',width:118,align:'center',hidden:true">
取货
</th>
<thdata-options="field:'DeliverGoodsID2',width:118,align:'center',hidden:true">
送货
</th>
<thdata-options="field:'PeturnID2',width:118,align:'center',hidden:true">
运单
</th>
<thdata-options="field:'WrittenPermissionID2',width:118,align:'center',hidden:true">
客户单据
</th>
<thdata-options="field:'ClientContractsConsignID',width:118,align:'center',hidden:true">
托运人姓名ID
</th>
<thdata-options="field:'ShipperName',width:118,align:'center'">
托运人姓名
</th>
<thdata-options="field:'ShipperPhoneNumber',width:118,align:'center',hidden:true">
托运人电话
</th>
<thdata-options="field:'ShipperUnitsID',width:118,align:'center',hidden:true">
托运人单位ID
</th>
<thdata-options="field:'ShipperUnitsName',width:118,align:'center',hidden:true">
托运人单位
</th>
<thdata-options="field:'ShipperLocation',width:118,align:'center',hidden:true">
托运人地址
</th>
<thdata-options="field:'ShipperAccount',width:118,align:'center',hidden:true">
托运人账号
</th>
<thdata-options="field:'ShipperPostcode',width:118,align:'center',hidden:true">
托运人邮编
</th>
<thdata-options="field:'ClientManager',width:118,align:'center',hidden:true">
客户经理
</th>
<thdata-options="field:'StorePickupPersonID',width:118,align:'center',hidden:true">
取货联系人ID
</th>
<thdata-options="field:'StorePickupPersonName',width:118,align:'center'">
取货联系人
</th>
<thdata-options="field:'StorePickupPersonPhoneNumber',width:118,align:'center',hidden:true">
取货联系人电话
</th>
<thdata-options="field:'StorePickupPersonAddress',width:118,align:'center',hidden:true">
取货地址
</th>
<thdata-options="field:'ProjectID',width:118,align:'center',hidden:true">
项目ID
</th>
<thdata-options="field:'ProjectName',width:118,align:'center',hidden:true">
项目名称
</th>
<thdata-options="field:'ConsigneeName',width:118,align:'center'">
收货人姓名
</th>
<thdata-options="field:'ConsigneePhoneNumber',width:118,align:'center'">
收货人电话
</th>
<thdata-options="field:'ConsigneeUnit',width:118,align:'center',hidden:true">
收货人单位
</th>
<thdata-options="field:'ConsigneeAddress',width:118,align:'center',hidden:true">
收货人地址
</th>
<thdata-options="field:'ConsigneeAccount',width:118,align:'center',hidden:true">
收货人账号
</th>
<thdata-options="field:'ConsigneePostcode',width:118,align:'center',hidden:true">
收货人邮编
</th>
<thdata-options="field:'ConsigneeID',width:118,align:'center',hidden:true">
收货人ID
</th>
<thdata-options="field:'CarriageFare',width:118,align:'center',hidden:true">
运费
</th>
<thdata-options="field:'IncidentalExpenses',width:118,align:'center',hidden:true">
杂费
</th>
<thdata-options="field:'CostSumUp',width:118,align:'center',hidden:true">
费用小计
</th>
<thdata-options="field:'WhetherOrnotInsureDeclare2',width:118,align:'center',hidden:true">
投保声明
</th>
<thdata-options="field:'InsuredAmount',width:118,align:'center',hidden:true">
投保金额
</th>
<thdata-options="field:'InsureExpenses',width:118,align:'center',hidden:true">
保险费
</th>
<thdata-options="field:'AllFeiCount',width:118,align:'center',hidden:true">
运杂费合计
</th>
<thdata-options="field:'SettleAccountsWayID',width:118,align:'center',hidden:true">
结算方式ID
</th>
<thdata-options="field:'SettleAccountsWayName',width:118,align:'center',hidden:true">
结算方式
</th>
<thdata-options="field:'AdvanceReceipts',width:118,align:'center',hidden:true">
预收款
</th>
<thdata-options="field:'PayNumber',width:118,align:'center',hidden:true">
付款账号
</th>
<thdata-options="field:'Remarks',width:118,align:'center',hidden:true">
备注
</th>
<thdata-options="field:'FabricationOrderFormID',width:118,align:'center',hidden:true">
制单人
</th>
<thdata-options="field:'FabricationOrderFormName',width:118,align:'center',hidden:true">
制单人
</th>
<thdata-options="field:'AcceptanceTime2',width:118,align:'center',hidden:true">
受理日期
</th>
<thdata-options="field:'AcceptanceUnitID',width:118,align:'center',hidden:true">
受理单位ID
</th>
<thdata-options="field:'AcceptanceUnitName',width:118,align:'center',hidden:true">
受理单位
</th>
<thdata-options="field:'ClientAgreementInformationID',width:118,align:'center',hidden:true">
合同ID
</th>
<thdata-options="field:'CarriageFareValue',width:118,align:'center',hidden:true">
单价
</th>
<thdata-options="field:'InsuranceCompanyName',width:118,align:'center',hidden:true">
费率
</th>
<thdata-options="field:'CheckEmploy2',width:118,align:'center',hidden:true">
复核状态
</th>
<thdata-options="field:'ShengChenJiHuaDan',width:118,align:'center'">
计划单号
</th>
<thdata-options="field:'ZongTiJi',width:118,align:'center',hidden:true">
总体积
</th>
<thdata-options="field:'ZongShuLiang',width:118,align:'center',hidden:true">
总数量
</th>
<thdata-options="field:'ZongZhongLiang',width:118,align:'center',hidden:true">
总重量
</th>
</tr>
</thead>
</table>
<tableid="tbGoodsListMingXiS"title="运输订单货品明细"class="easyui-datagrid"style="width:auto;
height:200px;"data-options="singleSelect:true,rownumbers:true,rowStyler:function(index,row){
if(index%2==0){

}
}">
<thead>
<tr>
<thdata-options="field:'OrderForGoodsDetailID',width:118,align:'center',hidden:true">
货品ID
</th>
<thdata-options="field:'GoodsID',width:118,align:'center',hidden:true">
货品ID
</th>
<thdata-options="field:'GoodsDesignation',width:118,align:'center'">
货品名称
</th>
<thdata-options="field:'PiCis',width:118,align:'center'">
批次
</th>
<thdata-options="field:'Specifications',width:118,align:'center'">
规格
</th>
<thdata-options="field:'UnitID',width:118,align:'center',hidden:true">
单位ID
</th>
<thdata-options="field:'UnitName',width:118,align:'center'">
单位
</th>
<thdata-options="field:'QualityID',width:118,align:'center',hidden:true">
质量ID
</th>
<thdata-options="field:'QualityName',width:118,align:'center'">
质量
</th>
<thdata-options="field:'Quantity',width:118,align:'center'">
重量
</th>
<thdata-options="field:'ZhongLiang',width:118,align:'center'">
数量
</th>
<thdata-options="field:'TiChi',width:118,align:'center'">
体积
</th>
<thdata-options="field:'Remarks',width:118,align:'center'">
备注
</th>
</tr>
</thead>
</table>

创建datagrid的加载数据事件


<tableid="tbOrderForTransportationList"title=运输订单"class="easyui-datagrid"style="width:auto;
height:280px;"data-
3-3、jQuery代码//第一种使用url方法options="url:'/DingDanGuanL/YunShuGuanLi',rownumbers:true,singleSelect:true,rowStyler:function(index,row){ if(index%2==0){ } }">
<thead>//第二种使用getJSON方法functionSelectMingXi()
{//getSelected是单机行是获取当前行的索引和获取当前行的数据(ROW.OrderForTransp)
varROW=$("#tbOrderForTransportationList").datagrid('getSelected');
//OrderForGoodsTransportinformationID="是控制器传过来的参数$.getJSON("/DingDanGuanL/SelectSYSGoodsListTwo?OrderForGoodsTransportinformationID="+ROW.OrderForTransportationID,function(data){
$("#tbGoodsListMingXiS").datagrid('loadData',data);});






新增、修改、删除

在新增页面分为下面几个部分,分别为订单概况、托运人信息、收货人信息、费用信息、结算方式及其他信息。在订单概括部分客服人员如果钩选“是否取送”中的“取货”“送货”,在后面部分系统将会生成对应的“取/派”任务。客服人员如果选择了“签单返回”中的“运单”和“客户单据”,当完成运输任务后,客服人员必须在运单管理中完成“返单”操作,详见择【运单】-》【运单管理】-》【返单】。在托运人信息部分,如果合同客户,可以点击托运人帐号旁的“”选择客户账号,则该客户的相关信息会自动弹出。点击取货联系人旁的“
”,系统会根据选择的客户帐号列出当前客户的取货联系人。
对于合同客户的收货人信息,可以点收货人帐号旁的“”,选择当前客户的收获人;如是
合同客户的新增的收货人信息,则录入收货人信息后点击“”,把该收货人信息维
护到系统中。客户和取货联系人、收货人之间的关系,在“系统维护”中的“客户信息维护”中维护。运费可以自行录入,对于合同客户,也可以点击“”,系统会根据货品信息部分中的货品信息算出运费。运费=货品总重量乘以运费单价,如果用户在投保声明中选择“是”,则保险费=运费×保险费率。其中运费单价和保险费率在“系统维护”中的“客户信息维护”中维护。
界面效果图:



2.5.1.3图(10)



2.5.1.3图(11)



2.5.1.3图(12)

控件使用方法:

1.单选框



2.5.1.3图(13)

<tdstyle="font-size:16px">
结算方式:
</td>
<tdstyle="font-size:16px">
<inputtype="radio"name="txtSettleAccountsWayID"id="PeiGongLuZhengChe"/>公路整车
</td>
<td>
</td>
<tdstyle="font-size:16px">
<inputtype="radio"name="txtSettleAccountsWayID"id="PeiGongLuLingDan"/>
公路零担
</td>
<td>
</td>
<tdstyle="font-size:16px">
<inputtype="radio"name="txtSettleAccountsWayID"id="PeiHuoWuPeiSong"/>货物配送
</td>
<td>
</td>
<tdstyle="font-size:16px">
<inputtype="radio"name="txtSettleAccountsWayID"id="PeiTieLu"/>铁路
</td>
<td>
</td>
<tdstyle="font-size:16px">
<inputtype="radio"name="txtSettleAccountsWayID"id="PeiGongYun"/>空运
</td>
</tr>
</table>




2多选框

<tdstyle="font-size:16px">
是否取送:
</td>
<tdstyle="font-size:16px">
<inputtype="checkbox"name="txtShiFouQuSong"id="TakeDeliveryID"/>取货
</td>
<td>
</td>
<tdstyle="font-size:16px">
<inputtype="checkbox"name="txtShiFouQuSong"id="DeliverGoodsID"/>
送货
</td>
</td>
<td>
</td>
<td>
<tdstyle="font-size:16px">
签单返还:
</td>
<tdstyle="font-size:16px">
//name:name是相同的,表示是属于同种多选框
<inputtype="checkbox"name="txtqIanDanFanHuan"id="WrittenPermissionID"/>运单
</td>
<td>
</td>
<tdstyle="font-size:16px">
<inputtype="checkbox"name="txtqIanDanFanHuan"id="PeturnID"/>
客户单据
</td>


3、下拉框(easyui-combobox)



[align=left][/align]

2.5.1.3图(14)

<tdstyle="font-size:15px">
业务类型:
</td>
<td>
<inputid="cboVocationalTypeID"class="easyui-combobox"style="width:125px;height:30px;"
data-


//下拉款数据绑定
options="url:'/XiaLaKuang/ChaXunShuXingMingXiXinXi?ShuXingJiHeID=32',valueField:'id',textField:'text'"></input>
</td>
Linq:绑定方式
//一个方法绑定多个下拉框
functioncboBanDingXiaLaKuang(YuanSuMing,ShuXingJiHeID){
$.getJSON("/XiaLaKuang/ChaXunShuXingMingXiXinXi?ShuXingJiHeID="+ShuXingJiHeID,
function(data){
$(YuanSuMing).combobox({data:data,valueField:'id',textField:'text'});
}
);
}
//、要绑定下拉框的ID
cboBanDingXiaLaKuang("#cboGongZhongLeiXing",5);
cboBanDingXiaLaKuang("#cboJingYan",6);
cboBanDingXiaLaKuang("#cboXingBie",57);
cboBanDingXiaLaKuang("#comSuoShuLeiXing",1);
cboBanDingXiaLaKuang("#cboZhengJianLeiXing",3);
cboBanDingXiaLaKuang("#cboZhuangTai",4);
//加载时设置下拉框的默认值
$("#cboAcceptanceUnitID").combobox('select',1);
$("#cboFabricationOrderFormID").combobox('select',26);

4.时间(easyui-databox)
<tdstyle="font-size:16px">
取货时间:
</td>
<td>
<inputstyle="width:130px;height:30px;color:#FF0000;"class="easyui-datebox"
id="datTakeDeliveryTime"data-options="onSelect:BiJiaoDaXiao,formatter:ShiJians"/>
</td>
<tdstyle="font-size:16px">
到货时间:
</td>
<td>
<inputstyle="width:130px;height:30px;color:#FF0000;"class="easyui-datebox"
id="datArriveTime"data-options="onSelect:BiJiaoDaXiao1,formatter:ShiJians"/>
</td>

第二步:控制器(Controllers)



2.5.1.3图(17)
controllers新增订单:
1.新增订单
#region新增订单运输信息
//InsertOrderForTransportationList方法名OrderForGoodsNumber、VocationalTypeID。。。。。。。。对应的参数
publicintInsertOrderForTransportationList(stringOrderForGoodsNumber,intVocationalTypeID,intHeadstreamID,intDestinationID,DateTimeTakeDeliveryTime,DateTimeArriveTime,
intTakeDeliveryID,intDeliverGoodsID,intWrittenPermissionID,intPeturnID,
stringShipperName,stringShipperPhoneNumber,intShipperUnitsID,stringShipperLocation,stringShipperAccount,
stringShipperPostcode,stringClientManager,
stringStorePickupPersonName,stringStorePickupPersonPhoneNumber,stringStorePickupPersonAddress,
intProjectID,stringConsigneeName,stringConsigneePhoneNumber,stringConsigneeUnit,stringConsigneeAddress,stringConsigneeAccount,
stringConsigneePostcode,decimalCarriageFare,decimalIncidentalExpenses,decimalCostSumUp,
BooleanWhetherOrNotInsureDeclare,decimalInsureExpenses,intSettleAccountsWayID,decimalAdvanceReceipts,stringPayNumber,stringRemarks,intFabricationOrderFormID,DateTimeAcceptanceTime,intAcceptanceUnitID,decimalInsuredAmount)
{
Models.PWOrderForTransportationListTransportation=newModels.PWOrderForTransportationList();
Transportation.OrderForGoodsNumber=OrderForGoodsNumber;
Transportation.VocationalTypeID=VocationalTypeID;
Transportation.HeadstreamID=HeadstreamID;
Transportation.DestinationID=DestinationID;
Transportation.TakeDeliveryTime=TakeDeliveryTime;
Transportation.ArriveTime=ArriveTime;
Transportation.TakeDeliveryID=TakeDeliveryID;
Transportation.DeliverGoodsID=DeliverGoodsID;
Transportation.WrittenPermissionID=WrittenPermissionID;
Transportation.PeturnID=PeturnID;
Transportation.ShipperName=ShipperName;
Transportation.ShipperPhoneNumber=ShipperPhoneNumber;
Transportation.ShipperUnitsID=ShipperUnitsID;
Transportation.ShipperLocation=ShipperLocation;
Transportation.ShipperAccount=ShipperAccount;
Transportation.ShipperPostcode=ShipperPostcode;
Transportation.ClientManager=ClientManager;
Transportation.StorePickupPersonName=StorePickupPersonName;
Transportation.StorePickupPersonPhoneNumber=StorePickupPersonPhoneNumber;
Transportation.StorePickupPersonAddress=StorePickupPersonAddress;
Transportation.ProjectID=ProjectID;
Transportation.ConsigneeName=ConsigneeName;
Transportation.ConsigneePhoneNumber=ConsigneePhoneNumber;
Transportation.ConsigneeUnit=ConsigneeUnit;
Transportation.ConsigneeAddress=ConsigneeAddress;
Transportation.ConsigneeAccount=ConsigneeAccount;
Transportation.ConsigneePostcode=ConsigneePostcode;
Transportation.CarriageFare=CarriageFare;
Transportation.IncidentalExpenses=IncidentalExpenses;
Transportation.CostSumUp=CostSumUp;
Transportation.WhetherOrNotInsureDeclare=WhetherOrNotInsureDeclare;
Transportation.InsureExpenses=InsureExpenses;
Transportation.SettleAccountsWayID=SettleAccountsWayID;
Transportation.AdvanceReceipts=AdvanceReceipts;
Transportation.PayNumber=PayNumber;
Transportation.Remarks=Remarks;
Transportation.FabricationOrderFormID=FabricationOrderFormID;
Transportation.AcceptanceTime=AcceptanceTime;
Transportation.AcceptanceUnitID=AcceptanceUnitID;
Transportation.InsuredAmount=InsuredAmount;
RK.PWOrderForTransportationList.AddObject(Transportation);
inti=RK.SaveChanges();
if(i>0)
{
//BaoXianID对应新增产生的那个主键ID,返回他用于传值到新增明细
varBaoXianID=(frombxinRK.PWOrderForTransportationListselectbx.OrderForTransportationID).Max();
returnBaoXianID;
}
else
{
return0;
}
}
#endregion


#region新增订单运输信息
//因为字符串过长(参数太多),要新增完后,再修改(再新增你需要的字段)
publicintInsertOrderForTransportationList1(intOrderForTransportation1ID,stringZongTiJi,stringZongShuLiang,
stringZongZhongLiang,stringClientID,stringClientAgreementInformationID
)
{
Models.PWOrderForTransportationListTransportation=(fromtbinRK.PWOrderForTransportationList
wheretb.OrderForTransportationID==OrderForTransportation1IDselect
tb).Single<Models.PWOrderForTransportationList>();

Transportation.ZongTiJi=Convert.ToDecimal(ZongTiJi);
Transportation.ZongShuLiang=Convert.ToDecimal(ZongShuLiang);;
Transportation.ZongZhongLiang=Convert.ToDecimal(ZongZhongLiang);;
Transportation.ClientID=Convert.ToInt32(ClientID);
Transportation.ClientAgreementInformationID=Convert.ToInt32(ClientAgreementInformationID);
inti=RK.SaveChanges();
if(i>0)
{
//返回id
varBaoXianID=(frombxinRK.PWOrderForTransportationListselectbx.OrderForTransportationID).Max();
returnBaoXianID;
}
else
{
return0;
}
}
#endregion


2,新增明细
#region新增订单运输明细信息
publicintInsertOrderForGoodsDetailList(intOrderForGoodsTransportinformationID,intGoodsID,stringCubage,
stringQuantity,stringRemarks,intUnitsID,intQualityID,stringZhongLiang,stringTiChi)
{

Models.PWOrderForGoodsDetailListOrderForGoodsDetailList=newModels.PWOrderForGoodsDetailList();
OrderForGoodsDetailList.OrderForGoodsTransportinformationID=OrderForGoodsTransportinformationID;
OrderForGoodsDetailList.GoodsID=GoodsID;
OrderForGoodsDetailList.Cubage=Cubage;
OrderForGoodsDetailList.Quantity=Quantity;
OrderForGoodsDetailList.Remarks=Remarks;
OrderForGoodsDetailList.UnitsID=UnitsID;
OrderForGoodsDetailList.QualityID=QualityID;
OrderForGoodsDetailList.ZhongLiang=ZhongLiang;
OrderForGoodsDetailList.TiChi=TiChi;
//RK.PWOrderForGoodsDetailList.AddObject(OrderForGoodsDetailList);对应要新增的那张表
RK.PWOrderForGoodsDetailList.AddObject(OrderForGoodsDetailList);
inti=RK.SaveChanges();
if(i>0)
{
returni;
}
else
{
return0;
}
}

#endregion


JavaScript代码:
functionInsertShiBei(){
//先结束编辑,否则不能新增明细
endEditing(false);
if(confirm("是否新增")){
varTakeDeliveryID=0;
//判断如果那个单选框如果打上钩就赋值给他
if(document.getElementById("TakeDeliveryID").checked){
TakeDeliveryID=74;
}else{
}
varDeliverGoodsID=0;
//判断如果那个单选框如果打上钩就赋值给他
if(document.getElementById("DeliverGoodsID").checked){
DeliverGoodsID=75;
}else{
}
varWrittenPermissionID=0;

if(document.getElementById("WrittenPermissionID").checked){
WrittenPermissionID=76;
}else{
}

varPeturnID=0;
if(document.getElementById("PeturnID").checked){
PeturnID=77;
}else{
}

varWhetherOrnotInsureDeclare=0;
if(document.getElementById('Yes').checked){
WhetherOrnotInsureDeclare=true;
}else{
WhetherOrnotInsureDeclare=false;
}
vartxtSettleAccountsWayID=0;
//判断如果那个多选框如果打上钩就赋值给他
if(document.getElementById("PeiGongLuZhengChe").checked){
txtSettleAccountsWayID=42;
}elseif(document.getElementById("PeiGongLuLingDan").checked){
txtSettleAccountsWayID=43;
}
elseif(document.getElementById("PeiHuoWuPeiSong").checked){
txtSettleAccountsWayID=44;
}
elseif(document.getElementById("PeiTieLu").checked){
txtSettleAccountsWayID=45;
}else{
txtSettleAccountsWayID=46;
}
$.getJSON("/DingDanGuanL/InsertOrderForTransportationList?OrderForGoodsNumber="+$("#txtOrderForGoodsNumber").val()+"&"
+"VocationalTypeID="+$("#cboVocationalTypeID").combobox('getValue')+"&"
+"HeadstreamID="+id8+"&"
+"DestinationID="+id9+"&"
+"TakeDeliveryTime="+$("#datTakeDeliveryTime").datebox('getValue')+"&"
+"ArriveTime="+$("#datArriveTime").datebox('getValue')+"&"
+"TakeDeliveryID="+TakeDeliveryID+"&"
+"DeliverGoodsID="+DeliverGoodsID+"&"
+"WrittenPermissionID="+WrittenPermissionID+"&"
+"PeturnID="+PeturnID+"&"
+"ShipperName="+$("#txtShipperName").val()+"&"
+"ShipperPhoneNumber="+$("#txtShipperPhoneNumber").val()+"&"
+"ShipperUnitsID="+$("#txtShipperUnitsID").combobox('getValue')+"&"
+"ShipperLocation="+$("#txtShipperLocation").val()+"&"
+"ShipperAccount="+$("#txtShipperAccount").val()+"&"
+"ShipperPostcode="+$("#txtShipperPostcode").val()+"&"
+"ClientManager="+$("#txtClientManager").val()+"&"
+"StorePickupPersonName="+$("#txtClientGetingpersonNumber").val()+"&"
+"StorePickupPersonPhoneNumber="+$("#txtClientGetingpersonBelephone").val()+"&"
+"StorePickupPersonAddress="+$("#txtClientGetingpersonAddress").val()+"&"
+"ProjectID="+$("#cboProjectID").combobox('getValue')+"&"
+"ConsigneeName="+$("#txtClientReceivingpersonName").val()+"&"
+"ConsigneePhoneNumber="+$("#txtClientReceivingpersonBelephone").val()+"&"
+"ConsigneeUnit="+$("#txtClientReceivingpersonUnit").val()+"&"
+"ConsigneeAddress="+$("#txtClientReceivingpersonAddress").val()+"&"
+"ConsigneeAccount="+$("#txtClientReceivingpersonNumber").val()+"&"
+"ConsigneePostcode="+$("#txtClientReceivingpersonZipCode").val()+"&"
+"CarriageFare="+$("#txtTransportationExpenses").val()+"&"
+"IncidentalExpenses="+$("#txtIncidentalExpenses").val()+"&"
+"CostSumUp="+$("#txtCostSumUp").val()+"&"
+"WhetherOrNotInsureDeclare="+WhetherOrnotInsureDeclare+"&"
+"InsureExpenses="+$("#txtInsurancePremium").val()+"&"
+"SettleAccountsWayID="+txtSettleAccountsWayID+"&"
+"AdvanceReceipts="+$("#txtAdvanceReceipts").val()+"&"
+"PayNumber="+$("#txtPayNumber").val()+"&"
+"Remarks="+$("#txtRemarks").val()+"&"
+"FabricationOrderFormID="+$("#cboFabricationOrderFormID").combobox('getValue')+"&"
+"AcceptanceTime="+$("#datAcceptanceTime").datebox('getValue')+"&"
+"AcceptanceUnitID="+$("#cboAcceptanceUnitID").combobox('getValue')+"&"
+"InsuredAmount="+$("#txtAmountInsured").val(),
function(data){
//data是controllers返回的varBaoXianID=(frombxinRK.PWOrderForTransportationListselectbx.OrderForTransportationID).Max();
//最大ID
$.getJSON("/DingDanGuanL/InsertOrderForTransportationList1?OrderForTransportation1ID="+data+"&"
+"ZongTiJi="+$("#txtZongShuLiang").val()+"&"
+"ZongShuLiang="+$("#txtZhongTiCi").val()+"&"
+"ZongZhongLiang="+$("#txtZongZhongLiang").val()+"&"
+"ClientID="+id1+"&"
+"ClientAgreementInformationID="+id5,function(data2){
varCheLiangBaoXianTiaoMu=$("#tbGoodsListMingXi").datagrid('getData');
//获取新增明细的行数,要便利所用行,用for循环执行所用字段
for(vari=0;i<CheLiangBaoXianTiaoMu.rows.length;i++){
//CheLiangBaoXianTiaoMu.rows.length是datagrid的行数
//CheLiangBaoXianTiaoMu.rows[i].GoodsID对应的几行的单元格ID
$.getJSON("/DingDanGuanL/InsertOrderForGoodsDetailList?OrderForGoodsTransportinformationID="+data+"&"
+"GoodsID="+CheLiangBaoXianTiaoMu.rows[i].GoodsID+"&"
+"Cubage="+CheLiangBaoXianTiaoMu.rows[i].PiCis+"&"
+"Quantity="+CheLiangBaoXianTiaoMu.rows[i].Quantity+"&"
+"UnitsID="+CheLiangBaoXianTiaoMu.rows[i].UnitID+"&"
+"QualityID="+CheLiangBaoXianTiaoMu.rows[i].QualityID+"&"
+"Remarks="+CheLiangBaoXianTiaoMu.rows[i].Remarks+"&"
+"ZhongLiang="+CheLiangBaoXianTiaoMu.rows[i].ZhongLiang+"&"
+"TiChi="+CheLiangBaoXianTiaoMu.rows[i].TiChi,
function(data1){

});

}
if(data2>0){
alert("新增成功");
//返回到开始的界面
window.location.href="/DingDanGuanL/YunShuDingDan";
}else{
alert("新增失败");
}
});
});
}
}


2.修改
controllers代码
修改订单:
#region修改订单运输信息
//因为字符串过长(参数太多),要修改完一次后,再修改(再修改你需要的字段)
publicintUpdateOrderForTransportationList(intOrderForTransportationID,stringOrderForGoodsNumber,intVocationalTypeID,
intHeadstreamID,intDestinationID,DateTimeTakeDeliveryTime,DateTimeArriveTime,
intTakeDeliveryID,intDeliverGoodsID,intWrittenPermissionID,intPeturnID,
stringShipperName,stringShipperPhoneNumber,intShipperUnitsID
)
{
intOrderForTransportation1ID=OrderForTransportationID;
//tb.OrderForTransportationID对应这张表的主键ID
//==OrderForTransportation1ID界面传过来的ID
Models.PWOrderForTransportationListTransportation=(fromtbinRK.PWOrderForTransportationListwhere
tb.OrderForTransportationID==OrderForTransportation1IDselect
tb).Single<Models.PWOrderForTransportationList>();
Transportation.OrderForGoodsNumber=OrderForGoodsNumber;
Transportation.VocationalTypeID=VocationalTypeID;
Transportation.HeadstreamID=HeadstreamID;
Transportation.DestinationID=DestinationID;
Transportation.TakeDeliveryTime=TakeDeliveryTime;
Transportation.ArriveTime=ArriveTime;
Transportation.TakeDeliveryID=TakeDeliveryID;
Transportation.DeliverGoodsID=DeliverGoodsID;
Transportation.WrittenPermissionID=WrittenPermissionID;
Transportation.PeturnID=PeturnID;
Transportation.ShipperName=ShipperName;
Transportation.ShipperPhoneNumber=ShipperPhoneNumber;
Transportation.ShipperUnitsID=ShipperUnitsID;
inti=RK.SaveChanges();
if(i>0)
{
//返回主键ID
returnOrderForTransportation1ID;
}
else
{
return0;
}
}
publicintUpdateOrderForTransportationList1(intOrderForTransportationID,stringShipperLocation,stringShipperAccount,
stringShipperPostcode,stringClientManager,
stringStorePickupPersonName,stringStorePickupPersonPhoneNumber,stringStorePickupPersonAddress,
intProjectID,stringConsigneeName,stringConsigneePhoneNumber,
stringConsigneeUnit,stringConsigneeAddress,stringConsigneeAccount

)
{
intOrderForTransportation1ID=OrderForTransportationID;
Models.PWOrderForTransportationListTransportation=(fromtbinRK.PWOrderForTransportationListwhere
tb.OrderForTransportationID==OrderForTransportation1IDselect
tb).Single<Models.PWOrderForTransportationList>();

Transportation.ShipperLocation=ShipperLocation;
Transportation.ShipperAccount=ShipperAccount;
Transportation.ShipperPostcode=ShipperPostcode;
Transportation.ClientManager=ClientManager;
Transportation.StorePickupPersonName=StorePickupPersonName;
Transportation.StorePickupPersonPhoneNumber=StorePickupPersonPhoneNumber;
Transportation.StorePickupPersonAddress=StorePickupPersonAddress;
Transportation.ProjectID=ProjectID;
Transportation.ConsigneeName=ConsigneeName;
Transportation.ConsigneePhoneNumber=ConsigneePhoneNumber;
Transportation.ConsigneeUnit=ConsigneeUnit;
Transportation.ConsigneeAddress=ConsigneeAddress;
Transportation.ConsigneeAccount=ConsigneeAccount;
inti=RK.SaveChanges();
if(i>0)
{
returnOrderForTransportation1ID;
}
else
{
return0;
}
}
publicintUpdateOrderForTransportationList2(intOrderForTransportationID,
stringConsigneePostcode,decimalCarriageFare,decimalIncidentalExpenses,decimalCostSumUp,
BooleanWhetherOrNotInsureDeclare,decimalInsureExpenses,intSettleAccountsWayID,decimalAdvanceReceipts,stringPayNumber,stringRemarks,
intFabricationOrderFormID,
DateTimeAcceptanceTime,intAcceptanceUnitID,decimalInsuredAmount,
intClientID,decimalZongTiJi,decimalZongShuLiang,decimalZongZhongLiang,intClientAgreementInformationID
)
{
intOrderForTransportation1ID=OrderForTransportationID;
Models.PWOrderForTransportationListTransportation=(fromtbinRK.PWOrderForTransportationListwhere
tb.OrderForTransportationID==OrderForTransportation1ID
selecttb).Single<Models.PWOrderForTransportationList>();

Transportation.ConsigneePostcode=ConsigneePostcode;
Transportation.CarriageFare=CarriageFare;
Transportation.IncidentalExpenses=IncidentalExpenses;
Transportation.CostSumUp=CostSumUp;
Transportation.WhetherOrNotInsureDeclare=WhetherOrNotInsureDeclare;
Transportation.InsureExpenses=InsureExpenses;
Transportation.SettleAccountsWayID=SettleAccountsWayID;
Transportation.AdvanceReceipts=AdvanceReceipts;
Transportation.PayNumber=PayNumber;
Transportation.Remarks=Remarks;
Transportation.FabricationOrderFormID=FabricationOrderFormID;
Transportation.AcceptanceTime=AcceptanceTime;
Transportation.AcceptanceUnitID=AcceptanceUnitID;
Transportation.InsuredAmount=InsuredAmount;
Transportation.ClientID=ClientID;
Transportation.ZongTiJi=ZongTiJi;
Transportation.ZongShuLiang=ZongShuLiang;
Transportation.ZongZhongLiang=ZongZhongLiang;
Transportation.ClientAgreementInformationID=ClientAgreementInformationID;
inti=RK.SaveChanges();
if(i>0)
{
returnOrderForTransportation1ID;
}
else
{
return0;
}
}
#endregion

修改明细:

#region修改订单运输明细信息
//
publicintUpdateOrderForGoodsDetailList(intOrderForGoodsDetailID,intOrderForGoodsTransportinformationID,intGoodsID,
stringCubage,stringQuantity,stringRemarks,intUnitsID,intQualityID,stringZhongLiang,stringTiChi,stringUpdate)
{
//update界面传过来的方法,
//如果update的至等于1就修改

if(Update.Equals("1"))
{
Models.PWOrderForGoodsDetailListOrderForGoodsDetailList=(fromtbinRK.PWOrderForGoodsDetailListwhere
tb.OrderForGoodsDetailID==OrderForGoodsDetailIDselect
tb).Single<Models.PWOrderForGoodsDetailList>();
OrderForGoodsDetailList.OrderForGoodsTransportinformationID=OrderForGoodsTransportinformationID;
OrderForGoodsDetailList.GoodsID=GoodsID;
OrderForGoodsDetailList.Cubage=Cubage;
OrderForGoodsDetailList.Quantity=Quantity;
OrderForGoodsDetailList.Remarks=Remarks;
OrderForGoodsDetailList.UnitsID=UnitsID;
OrderForGoodsDetailList.QualityID=QualityID;
OrderForGoodsDetailList.ZhongLiang=ZhongLiang;
OrderForGoodsDetailList.TiChi=TiChi;
}
//如果update的值等于2就新增
if(Update.Equals("2"))
{
Models.PWOrderForGoodsDetailListOrderForGoodsDetailList=newModels.PWOrderForGoodsDetailList();
OrderForGoodsDetailList.OrderForGoodsTransportinformationID=OrderForGoodsTransportinformationID;
OrderForGoodsDetailList.GoodsID=GoodsID;
OrderForGoodsDetailList.Cubage=Cubage;
OrderForGoodsDetailList.Quantity=Quantity;
OrderForGoodsDetailList.Remarks=Remarks;
OrderForGoodsDetailList.UnitsID=UnitsID;
OrderForGoodsDetailList.QualityID=QualityID;
OrderForGoodsDetailList.ZhongLiang=ZhongLiang;
OrderForGoodsDetailList.TiChi=TiChi;
RK.PWOrderForGoodsDetailList.AddObject(OrderForGoodsDetailList);
}
//如歌update的值等于3就删除
if(Update.Equals("3"))
{
varOrderForGoodsDetailList=(fromtbinRK.PWOrderForGoodsDetailListwheretb.OrderForGoodsDetailID==OrderForGoodsDetailID
selecttb).Single<Models.PWOrderForGoodsDetailList>();
RK.DeleteObject(OrderForGoodsDetailList);
}
inti=RK.SaveChanges();
if(i>0)
{
returni;
}
else
{
return0;
}
}


JavaScript代码:
//绑定要修改的行
varOrderForTransportationID=0;
functionUpdata(){
//点击一条明细进行修改,如果已经审核就不能修改
varROW=$("#tbOrderForTransportationList").datagrid('getSelected');
if(ROW.CheckEmploy2!="未复核"){
alert("单号"+$.trim(ROW.OrderForGoodsNumber)+"已提交复核或已复核,不能再修改!");
}else{
//打开修改的界面
$('#WinInsert').reveal($(this).data());
//隐藏新增按钮,显示修改按钮
//通过用document.getElementById来找到那个ID,然后就对他进行操作
document.getElementById("InsertButton").style.display="none";
document.getElementById("updateButton").style.display="block";
//获取主键id
OrderForTransportationID=ROW.OrderForTransportationID;
//对文本进行赋值
$("#txtOrderForGoodsNumber").val(ROW.OrderForGoodsNumber);
//对于下拉框用setValue的方法获取那个ID,不是文本值
$("#cboVocationalTypeID").combobox('setValue',ROW.VocationalTypeID);
id8=ROW.HeadstreamID;
$("#txtHeadstreamID").val(ROW.HeadstreamName);
id9=ROW.DestinationID;
$("#txtDestinationID").val(ROW.DestinationName);
$("#datTakeDeliveryTime").datebox('setValue',ROW.TakeDeliveryTime2);
$("#datArriveTime").datebox('setValue',ROW.ArriveTime2);
TakeDeliveryID;
if(ROW.TakeDeliveryID2=="取货"){
$("#TakeDeliveryID").attr('checked',true);
}
if(ROW.DeliverGoodsID2=="送货"){
$("#DeliverGoodsID").attr('checked',true);
}
if(ROW.PeturnID2=="运单"){
$("#PeturnID").attr('checked',true);
}
if(ROW.WrittenPermissionID2=="客户单据"){
$("#WrittenPermissionID").attr('checked',true);
}
id1=ROW.ClientID;
$("#txtShipperName").val(ROW.ShipperName);
$("#txtShipperPhoneNumber").val(ROW.ShipperPhoneNumber);
$("#txtShipperUnitsID").combobox('setValue',ROW.ShipperUnitsID);
$("#txtShipperLocation").val(ROW.ShipperLocation);
$("#txtShipperAccount").val(ROW.ShipperAccount);
$("#txtShipperPostcode").val(ROW.ShipperPostcode);
$("#txtClientManager").val(ROW.ClientManager);
$("#txtClientGetingpersonNumber").val(ROW.StorePickupPersonName);
$("#txtClientGetingpersonBelephone").val(ROW.StorePickupPersonPhoneNumber);
$("#txtClientGetingpersonAddress").val(ROW.StorePickupPersonAddress);
$("#cboProjectID").combobox('setValue',ROW.ProjectID);
$("#txtClientReceivingpersonName").val(ROW.ConsigneeName);
$("#txtClientReceivingpersonBelephone").val(ROW.ConsigneePhoneNumber);
$("#txtClientReceivingpersonUnit").val(ROW.ConsigneeUnit);
$("#txtClientReceivingpersonAddress").val(ROW.ConsigneeAddress);
$("#txtClientReceivingpersonNumber").val(ROW.ConsigneeAccount);
$("#txtClientReceivingpersonZipCode").val(ROW.ConsigneePostcode);
$("#txtTransportationExpenses").val(ROW.CarriageFare);
$("#txtIncidentalExpenses").val(ROW.IncidentalExpenses);
$("#txtCostSumUp").val(ROW.CostSumUp);
if(ROW.WhetherOrnotInsureDeclare2=="是"){
$("#Yes").attr('checked',true);
}else{
$("#Fou").attr('checked',true);
}
$("#txtInsurancePremium").val(ROW.InsureExpenses);
if(ROW.SettleAccountsWayID=="42"){
$("#PeiGongLuZhengChe").attr('checked',true);
}elseif(ROW.SettleAccountsWayID=="43"){
$("#PeiGongLuLingDan").attr('checked',true);
}
elseif(ROW.SettleAccountsWayID=="44"){
$("#PeiHuoWuPeiSong").attr('checked',true);
}
elseif(ROW.SettleAccountsWayID=="45"){
$("#PeiTieLu").attr('checked',true);
}
else{
$("#PeiGongYun").attr('checked',true);
}
$("#txtAdvanceReceipts").val(ROW.AdvanceReceipts);
$("#txtPayNumber").val(ROW.PayNumber);
$("#txtRemarks").val(ROW.Remarks);
$("#cboFabricationOrderFormID").combobox('setValue',ROW.FabricationOrderFormID);
$("#datAcceptanceTime").datebox('setValue',ROW.AcceptanceTime2);
$("#cboAcceptanceUnitID").combobox('setValue',ROW.AcceptanceUnitID);
$("#txtAmountInsured").val(ROW.InsuredAmount);
id12=ROW.InsuredAmount;
$("#txtYunJiaFeiHeJi").val(ROW.AllFeiCount);
id5=ROW.ClientAgreementInformationID;
id6=ROW.CarriageFareValue;
id7=ROW.InsuranceCompanyName;
$("#txtZongShuLiang").val(ROW.ZongTiJi);
$("#txtZhongTiCi").val(ROW.ZongShuLiang);
$("#txtZongZhongLiang").val(ROW.ZongZhongLiang);
$.getJSON("/DingDanGuanL/SelectSYSGoodsListTwo?OrderForGoodsTransportinformationID="+OrderForTransportationID,
function(data){
$("#tbGoodsListMingXi").datagrid('loadData',data);
vardt=$("#tbGoodsListMingXi").datagrid('getData');
for(vari=0;i<dt.rows.length;i++){
$("#tbGoodsListMingXi").datagrid('getRows')[i]["text"]=data[i]["UnitName"];//单位
$("#tbGoodsListMingXi").datagrid('getRows')[i]["text1"]=data[i]["QualityName"];//质量
$("#tbGoodsListMingXi").datagrid('beginEdit',i);
$("#tbGoodsListMingXi").datagrid('endEdit',i);
}
});
DeleteList();

}
}

数据相同时删除行
functionDeleteList(){
//对应要查询的方法
$.getJSON("/DingDanGuanL/SelectSYSGoodsList",
function(data){
$("#tbGoodsList").datagrid('loadData',data);
//对应的datagrid加载数据
varROW=$("#tbGoodsListMingXi").datagrid('getData');
varROW1=$("#tbGoodsList").datagrid('getData');
for(vari=0;i<ROW.rows.length;i++){
//通过for循环来遍历所有的行
for(varj=0;j<ROW1.rows.length;j++){
if(ROW.rows[i].GoodsDesignation==ROW1.rows[j].GoodsDesignation){
//如果存在相同就删除
$("#tbGoodsList").datagrid('deleteRow',j);
}
}
}
});
}

确定修改:
varOrderForTransportationID=0;
varrowsCount=0;
functionUpdateShiBei(){
if(confirm("是否修改")){

//endEditing(false);结束编辑

endEditing(false);
varTakeDeliveryID=0;
if(document.getElementById("TakeDeliveryID").checked){
TakeDeliveryID=74;
}else{
}
varDeliverGoodsID=0;
if(document.getElementById("DeliverGoodsID").checked){
DeliverGoodsID=75;
}else{
}
varWrittenPermissionID=0;

if(document.getElementById("WrittenPermissionID").checked){
WrittenPermissionID=76;
}else{
}

varPeturnID=0;
if(document.getElementById("PeturnID").checked){
PeturnID=77;
}else{
}

varWhetherOrnotInsureDeclare=0;
if(document.getElementById('Yes').checked){
WhetherOrnotInsureDeclare=true;
}else{
WhetherOrnotInsureDeclare=false;
}
vartxtSettleAccountsWayID=0;
if(document.getElementById("PeiGongLuZhengChe").checked){
txtSettleAccountsWayID=42;
}elseif(document.getElementById("PeiGongLuLingDan").checked){
txtSettleAccountsWayID=43;
}
elseif(document.getElementById("PeiHuoWuPeiSong").checked){
txtSettleAccountsWayID=44;
}
elseif(document.getElementById("PeiTieLu").checked){
txtSettleAccountsWayID=45;
}else{
txtSettleAccountsWayID=46;
}
//第一次修改
$.getJSON("/DingDanGuanL/UpdateOrderForTransportationList?OrderForTransportationID="+OrderForTransportationID+"&"
+"OrderForGoodsNumber="+$("#txtOrderForGoodsNumber").val()+"&"
//获取combobox的值
+"VocationalTypeID="+$("#cboVocationalTypeID").combobox('getValue')+"&"
+"HeadstreamID="+id8+"&"
+"DestinationID="+id9+"&"
+"TakeDeliveryTime="+$("#datTakeDeliveryTime").datebox('getValue')+"&"
+"ArriveTime="+$("#datArriveTime").datebox('getValue')+"&"
+"TakeDeliveryID="+TakeDeliveryID+"&"
+"DeliverGoodsID="+DeliverGoodsID+"&"
+"WrittenPermissionID="+WrittenPermissionID+"&"
+"PeturnID="+PeturnID+"&"
+"ShipperName="+$("#txtShipperName").val()+"&"
+"ShipperPhoneNumber="+$("#txtShipperPhoneNumber").val()+"&"
+"ShipperUnitsID="+$("#txtShipperUnitsID").combobox('getValue'),
function(data){
//第二次修改
$.getJSON("/DingDanGuanL/UpdateOrderForTransportationList1?OrderForTransportationID="+OrderForTransportationID+"&"
+"ShipperLocation="+$("#txtShipperLocation").val()+"&"
+"ShipperAccount="+$("#txtShipperAccount").val()+"&"
+"ShipperPostcode="+$("#txtShipperPostcode").val()+"&"
+"ClientManager="+$("#txtClientManager").val()+"&"
+"StorePickupPersonName="+$("#txtClientGetingpersonNumber").val()+"&"
+"StorePickupPersonPhoneNumber="+$("#txtClientGetingpersonBelephone").val()+"&"
+"StorePickupPersonAddress="+$("#txtClientGetingpersonAddress").val()+"&"
+"ProjectID="+$("#cboProjectID").combobox('getValue')+"&"
+"ConsigneeName="+$("#txtClientReceivingpersonName").val()+"&"
+"ConsigneePhoneNumber="+$("#txtClientReceivingpersonBelephone").val()+"&"
+"ConsigneeUnit="+$("#txtClientReceivingpersonUnit").val()+"&"
+"ConsigneeAddress="+$("#txtClientReceivingpersonAddress").val()+"&"
+"ConsigneeAccount="+$("#txtClientReceivingpersonNumber").val(),
function(data1){
//第三次修改
$.getJSON("/DingDanGuanL/UpdateOrderForTransportationList2?OrderForTransportationID="+OrderForTransportationID+"&"
+"ConsigneePostcode="+$("#txtClientReceivingpersonZipCode").val()+"&"
+"CarriageFare="+$("#txtTransportationExpenses").val()+"&"
+"IncidentalExpenses="+$("#txtIncidentalExpenses").val()+"&"
+"CostSumUp="+$("#txtCostSumUp").val()+"&"
+"WhetherOrNotInsureDeclare="+WhetherOrnotInsureDeclare+"&"
+"InsureExpenses="+$("#txtInsurancePremium").val()+"&"
+"SettleAccountsWayID="+txtSettleAccountsWayID+"&"
+"AdvanceReceipts="+$("#txtAdvanceReceipts").val()+"&"
+"PayNumber="+$("#txtPayNumber").val()+"&"
+"Remarks="+$("#txtRemarks").val()+"&"
+"FabricationOrderFormID="+$("#cboFabricationOrderFormID").combobox('getValue')+"&"
+"AcceptanceTime="+$("#datAcceptanceTime").datebox('getValue')+"&"
+"AcceptanceUnitID="+$("#cboAcceptanceUnitID").combobox('getValue')+"&"
+"InsuredAmount="+$("#txtAmountInsured").val()+"&"
+"ClientID="+id1+"&"
+"ZongTiJi="+$("#txtZongShuLiang").val()+"&"
+"ZongShuLiang="+$("#txtZhongTiCi").val()+"&"
+"ZongZhongLiang="+$("#txtZongZhongLiang").val()+"&"
+"ClientAgreementInformationID="+id5,
function(data5){
//修改明细信息
varCheLiangBaoXianTiaoMu=$("#tbGoodsListMingXi").datagrid('getData');
intCheLiangBaoXianTiaoMu=data;
vardelRow=$("#tbGoodsListMingXi").datagrid('getChanges','deleted');

//同个getchanges的方法获取删除的行数

rowsCount=delRow.length;
for(vari=0;i<rowsCount;i++){

//for改变多少行就执行多少次方法

$.getJSON("/DingDanGuanL/UpdateOrderForGoodsDetailList?OrderForGoodsDetailID="+delRow[i].OrderForGoodsDetailID+"&"
+"OrderForGoodsTransportinformationID="+intCheLiangBaoXianTiaoMu+"&"
+"GoodsID="+delRow[i].GoodsID+"&"
+"Cubage="+delRow[i].PiCis+"&"
+"Quantity="+delRow[i].Quantity+"&"
+"UnitsID="+delRow[i].UnitID+"&"
+"QualityID="+delRow[i].QualityID+"&"
+"Remarks="+delRow[i].Remarks+"&"
+"ZhongLiang="+delRow[i].ZhongLiang+"&"
+"TiChi="+delRow[i].TiChi+"&"
+"Update="+3,
function(data2){
});

}

varinsRow=$("#tbGoodsListMingXi").datagrid('getChanges','inserted');

//同个getchanges的方法获取新增的行数

rowsCount=insRow.length;
for(varj=0;j<rowsCount;j++){
$.getJSON("/DingDanGuanL/UpdateOrderForGoodsDetailList?OrderForGoodsDetailID="+0+"&"
+"OrderForGoodsTransportinformationID="+intCheLiangBaoXianTiaoMu+"&"
+"GoodsID="+insRow[j].GoodsID+"&"
+"Cubage="+insRow[j].PiCis+"&"
+"Quantity="+insRow[j].Quantity+"&"
+"UnitsID="+insRow[j].UnitID+"&"
+"QualityID="+insRow[j].QualityID+"&"
+"Remarks="+insRow[j].Remarks+"&"
+"ZhongLiang="+insRow[j].ZhongLiang+"&"
+"TiChi="+insRow[j].TiChi+"&"
+"Update="+2,function(data3){
});
}
varUpdatRow=$("#tbGoodsListMingXi").datagrid('getChanges','updated');

//同个getchanges的方法获取修改的行数

rowsCount=UpdatRow.length;

for(vark=0;k<rowsCount;k++){

$.getJSON("/DingDanGuanL/UpdateOrderForGoodsDetailList?OrderForGoodsDetailID="+UpdatRow[k].OrderForGoodsDetailID+"&"
+"OrderForGoodsTransportinformationID="+intCheLiangBaoXianTiaoMu+"&"
+"GoodsID="+UpdatRow[k].GoodsID+"&"
+"Cubage="+UpdatRow[k].PiCis+"&"
+"Quantity="+UpdatRow[k].Quantity+"&"
+"UnitsID="+UpdatRow[k].UnitID+"&"
+"QualityID="+UpdatRow[k].QualityID+"&"
+"Remarks="+UpdatRow[k].Remarks+"&"
+"ZhongLiang="+UpdatRow[k].ZhongLiang+"&"
+"TiChi="+UpdatRow[k].TiChi+"&"
+"Update="+1,function(data4){
});
}
if(data>0){
alert("修改成功!");
window.location.href="/DingDanGuanL/YunShuDingDan";
}else{
alert("修改失败");
}

}
);
});

});
}

}



第三步、视图(views)



2.5.1.3图(18)



2.5.1.3图(19)
对datagrid中有下拉款进行编辑
$(document).ready(function(){
$.extend($.fn.datagrid.defaults.editors,{
combogrid:{

//获取combogrid

//appendTo(container);将combogrid反倒容中

init:function(container,options){
varinput=$('<inputtype="text"class="datagrid-editable-input">').appendTo(container);
input.combogrid(options);
returninput;
},
destroy:function(target){

//破坏combogrid

$(target).combogrid('destroy');
},

//获取combogrid的文本值

getValue:function(target){
return$(target).combogrid('getValue');
},

//设置combogrid的值
<spanstyle="font-size:18px;">
</span>setValue:function(target,value){
$(target).combogrid('setValue',value);
},
getText:function(target){
return$(target).combogrid('getText');
},
//调整combogrid的大小
resize:function(target,width){
$(target).combogrid('resize',width);
}
}
});
$("#cboAcceptanceUnitID").combobox('select',1);

//设置cboAcceptanceUnitID,这个下拉款的开始值

$("#cboFabricationOrderFormID").combobox('select',26);

//cboFabricationOrderFormID,这个下拉款的开始值
});


formatter:

functionmyformatter1(LuYouIDS,row,rowIndex){
//对datagrid中的formatter进行编制
//LuYouIDS对应的ID,row是他的行,rowindex是行索引

//ShanChu是对应表头的ID值

//<imgsrc="../../Content/图/icons/cancel.png"/>是要显示的值

return"<ahref='javascript:ShanChu("+LuYouIDS+","+rowIndex+")'>"+'<imgsrc="../../Content/图/icons/cancel.png"/></a>';
}


编辑器:
vareditIndex=undefined;
//开始是多是undeerfined,用于下面的新增一行,和对下面进行编辑
functionendEditing(flag){
if(editIndex==undefined){returntrue;}
if($('#tbGoodsListMingXi').datagrid('validateRow',editIndex)){

//validateRow确定是哪一行

//通过getEditor来获取那个ID

varedChanPin=$('#tbGoodsListMingXi').datagrid('getEditor',{index:editIndex,field:'UnitID'});
varchanPinBianMa=$(edChanPin.target).combobox('getText');
if(chanPinBianMa!=""||flag){
//判断这个文本框有没有值
$('#tbGoodsListMingXi').datagrid('getRows')[editIndex]['text']=chanPinBianMa;

}
else{

//没有值就提示他

alert("请选择单位!");
returnfalse;
}
varedChanPin1=$('#tbGoodsListMingXi').datagrid('getEditor',{index:editIndex,field:'QualityID'});
varchanPinBianMa1=$(edChanPin1.target).combobox('getText');
if(chanPinBianMa1!=""||flag){
$('#tbGoodsListMingXi').datagrid('getRows')[editIndex]['text1']=chanPinBianMa1;
}
else{
alert("请选择险别名称!");
returnfalse;
}
$('#tbGoodsListMingXi').datagrid('endEdit',editIndex);
editIndex=undefined;
returntrue;
}
else{
returnfalse;
}
}


onclickrow:
//点击datagrid的任意一行是触发事件
functiononClickRowDingDan(index){

//判断行索引与编剧行的状态
if(editIndex!=index){

//先开始编辑,再结束编辑
$("#tbGoodsListMingXi").datagrid('beginEdit',index);
$("#tbGoodsListMingXi").datagrid('endEdit',editIndex);
//setTimeout停顿0.1秒后再触发事件
setTimeout(function(){editIndex=index;},100);
}
}


append(新增行)
functiononKeHuHuoPinBiao(){
varonKuHuHuoPinXinXi=$("#tbGoodsList").datagrid('getSelected');
varonDingDanHuoPin=$("#tbGoodsListMingXi").datagrid('getSelected');
//一次打开界面后,用一个方法绑定多个值
//GoodsID:onKuHuHuoPinXinXi.GoodsID
//GoodsID:是要给别人赋值
//onKuHuHuoPinXinXi.GoodsID:给别人赋值
$('#tbGoodsListMingXi').datagrid('appendRow',{GoodsID:onKuHuHuoPinXinXi.GoodsID,
GoodsDesignation:onKuHuHuoPinXinXi.GoodsDesignation,
ClientName:onKuHuHuoPinXinXi.ClientName,GoodsNumber:onKuHuHuoPinXinXi.GoodsNumber,
Specifications:onKuHuHuoPinXinXi.Specifications,
UnitID:onKuHuHuoPinXinXi.UnitID,UnitName:onKuHuHuoPinXinXi.UnitName,QualityID:
onKuHuHuoPinXinXi.QualityID,QualityName:onKuHuHuoPinXinXi.QualityName
});
//删除列
DeleteList();
}


html代码:
<tableid="tbGoodsListMingXi"title="运输订单明细"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>
<thdata-options="field:'DeleteGoods',width:100,align:'center',formatter:myformatter5">
删除
</th>
<thdata-options="field:'OrderForGoodsDetailID',width:100,align:'center',hidden:true">
货品ID
</th>
<thdata-options="field:'GoodsID',width:100,align:'center',hidden:true">
货品ID
</th>
<thdata-options="field:'GoodsNumber',width:100,align:'center',hidden:true">
货品编码
</th>
<thdata-options="field:'GoodsDesignation',width:100,align:'center'">
货品名称
</th>
<thdata-options="field:'Specifications',width:100,align:'center'">
规格
</th>
<thdata-options="field:'PiCis',width:100,align:'center',editor:'text'">
批次
</th>
<thdata-options="field:'UnitID',width:100,align:'center',formatter:function(value,row){
returnrow.text;
},
editor:{
type:'combobox',
options:{
valueField:'id',
textField:'text',
@*//绑定下拉款用URL的方法来绑定数据*@
url:'/XiaLaKuang/ChaXunShuXingMingXiXinXi?ShuXingJiHeID=68'
}
}
">
单位
</th>
<thdata-options="field:'QualityID',width:100,align:'center',formatter:function(value,row){
returnrow.text1
},
editor:{
type:'combobox',
options:{
valueField:'id1',
textField:'text1',
url:'/XiaLaKuang/SelectQuality'
}
}
">
质量
</th>
<thdata-options="field:'Quantity',width:100,align:'center',editor:'text'">
重量
</th>
<thdata-options="field:'ZhongLiang',width:100,align:'center',editor:'text'">
数量
</th>
<thdata-options="field:'TiChi',width:100,align:'center',editor:'text'">
体积
</th>
<thdata-options="field:'Remarks',width:100,align:'center',editor:'text'">
备注
</th>
</tr>
</thead>
</table>
<center>
<table>
<tr>
<td>
<buttonid="InsertButton"class="btnblue"data-toggle="modal"style="font-family:楷体;"
onclick="InsertShiBei()">
保存</button>
</td>
<td>
<buttonid="updateButton"class="btnblue"data-toggle="modal"style="font-family:楷体;
display:none"onclick="UpdateShiBei()">
保存</button>
</td>
<td>
<buttonid="InsertZhuanYun"class="btnblue"data-toggle="modal"style="font-family:楷体;
display:none"onclick="InsertZhuanYun()">
保存</button>
</td>
<td>
<buttonclass="btnblue"data-toggle="modal"style="font-family:楷体;"onclick="ClosePanel()">
退出</button>
</td>
</tr>
</table>
</center>
</div>
</div>


仅供学习,禁止用于商业用途。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: