MVC北京络捷斯特第三方物流系统技术解析(五)库内加工
在“加工信息”页面,用户首先要选择库房,之后可以选择加工类型为“包装”、“组合”、“贴签”。用户选择加工类型为“包装”,包装用于将货品大包装变小包装或将货品小包装变大包装的操作,用户选择加工类型为“组合”,组合用于将多种货品组合在一起。
加工管理模块如图所示:
2.5.1.5(图1)
包装和组合:
2.5.1.5(图2)
贴签:
2.5.1.5(图3)
功能实现:
第一步:数据库
1表和表的关系
2.5.1.5(图4)
2.5.1.5(图5)
表1:dbo.PWProcessOrderForGoodsInformationList(加工订单信息表)
列名 | 数据类型 | 主键/外键 | 说明 |
ProcessInformationID | int | 主键 | 加工信息ID |
OrderForGoodstypeID | int | 外键 | 订单类型ID |
EmergencyID | int | 外键 | 客户ID |
OrderForGoodsSourceID | int | 外键 | 订单来源ID |
CarryOutStateID | int | 外键 | 执行状态ID |
StatusID | int | 外键 | 订单类型ID |
PledgeBankID | int | 外键 | 紧急情况ID |
ClientID | int | 外键 | 订单类型ID |
OrderForGoodsNumber | nchar (50) |
| 订单号 |
ClientInstruct | nchar (50) |
| 客户指令号 |
PurchaseOrderForGoodsNumber | nchar (50) |
| 采购订单号 |
Releasetime | datetime |
| 下达时间 |
OrderForGoodsPriority | nchar (50) |
| 订单优先级 |
Remarks | nchar (50) |
| 备注 |
BankName | nchar (100) |
| 银行名称 |
YouYongFou | bit |
| 有效否 |
表2:dbo.PWProcessOrderForGoodsInformationList(加工订单明细信息表)
列名 | 数据类型 | 主键/外键 | 说明 |
ProcessDetailID | int | 主键 | 加工明细ID |
ProcessInformationID | int | 外键 | 加工信息ID |
ProcesstypeID | int | 外键 | 加工类型ID |
KuFangId | int | 外键 | 库房ID |
YouYongFou | bit |
| 有用否 |
表3:客户表(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 |
| 同步否 |
表4:属性明细表(SYSAttributeDetailList)
用于存放集合信息
列名 | 数据类型 | 主键/外键 | 说明 |
AttributeDetailID | int | 主键 | 属性明细ID |
AttributeGatherID | int | 外键 | 属性集合ID |
AttributeDetailName | nchar (10) |
| 属性明细名称 |
YouYongFou | bit | 外键 | 有效否 |
表5:库房表(SYSAttributeDetailList)
用于存放库房信息
列名 | 数据类型 | 主键/外键 | 说明 |
StorehouseID | int | 主键 | 库房ID |
StorehouseGenreID | int | 外键 | 库房类型ID |
LocationDistrictID | int | 外键 | 所在区域ID |
ConditionID | int | 外键 | 状态ID |
StorehouseCode | nchar (50) |
| 库房编码 |
StorehouseName | nchar (50) |
| 库房名称 |
PinyinCoding | nchar (50) |
| 拼音码 |
PhoneNumber | nchar (50) |
| 电话 |
Portraiture | nchar (50) |
| 传真 |
Location | nchar (50) |
| 地址 |
Length | nchar (50) |
| 长度 |
Width | nchar (50) |
| 宽度 |
Height | nchar (50) |
| 高度 |
Area | nchar (50) |
| 面积 |
PassagewayWidth | nchar (50) |
| 通道宽度 |
GyrateRadius | nchar (50) |
| 旋转半径 |
Remarks | nchar (50) |
| 备注 |
YouYongFou | bit |
| 有用否 |
表6:加工订单明细表(PWProcessOrderForGoodsDetailList)
用于存放加工订单明细信息
列名 | 数据类型 | 主键/外键 | 说明 |
ProcessDetailID | int | 主键 | 加工明细ID |
ProcessInformationID | int | 外键 | 加工信息ID |
ProcesstypeID | int | 外键 | 加工类型ID |
KuFangId | int | 外键 | 库房ID |
YouYongFou | bit |
| 有用否 |
表7:加工货品表(SYSProcessGoodsList)
用于存放加工货品信息
列名 | 数据类型 | 主键/外键 | 说明 |
ProcessGoodsID | int | 主键 | 加工货品ID |
GoodsID | int | 外键 | 货品ID |
ProcessDetailID | int | 外键 | 加工明细ID |
EffectOfStorage | nchar (50) |
| 批次 |
SelectQuantity | nchar (50) |
| 选数量 |
ProcessQuantity | nchar (50) |
| 加工数量 |
ShipperUnitsID | int | 外键 | 单位ID |
QualityID | int | 外键 | 质量ID |
ProcessFou | bit |
| 加工否 |
YouYongFou | bit |
| 有用否 |
表8:属性明细表(SYSAttributeDetailList)
用于存放集合信息
列名 | 数据类型 | 主键/外键 | 说明 |
AttributeDetailID | int | 主键 | 属性明细ID |
AttributeGatherID | int | 外键 | 属性集合ID |
AttributeDetailName | nchar (10) |
| 属性明细名称 |
YouYongFou | bit |
| 有效否 |
第二步:控制器;
2.5.1.5(图6)
1.查询库内加工信息
(1)查询库内加工信息
作用的界面是:
2.5.1.5(图7)
(1)查询库内加工信息
#region 查询库内加工信息
public ActionResult SelectProcessOrderForGoodsInformationList()
{
//DiaryList 是 RK.SYSDiaryList 表的已个别名
//通个ID对应将所有的表连关系
var ProcessOrderForGoodsInformationList = from ProcessOrderForGoodsInformation
in RK.PWProcessOrderForGoodsInformationList
join ProcessOrderForGoodsDetailList in RK.PWProcessOrderForGoodsDetailList
on ProcessOrderForGoodsInformation.ProcessInformationID
equals ProcessOrderForGoodsDetailList.ProcessInformationID
join ClientList in RK.SYSClientList on ProcessOrderForGoodsInformation.ClientID equals ClientList.ClientID
join OrderForGoodsTypeList in RK.SYSAttributeDetailList on
ProcessOrderForGoodsInformation.OrderForGoodsTypeID
equals OrderForGoodsTypeList.AttributeDetailID
join EmergencyList in RK.SYSAttributeDetailList on ProcessOrderForGoodsInformation.EmergencyID
equals EmergencyList.AttributeDetailID
join OrderForGoodsSourceList in RK.SYSAttributeDetailList on ProcessOrderForGoodsInformation.OrderForGoodsSourceID
equals OrderForGoodsSourceList.AttributeDetailID
join StatusList in RK.SYSAttributeDetailList on ProcessOrderForGoodsInformation.StatusID
equals StatusList.AttributeDetailID
join CarryOutStateList in RK.SYSAttributeDetailList on ProcessOrderForGoodsInformation.CarryOutStateID
equals CarryOutStateList.AttributeDetailID
join StorehouseList in RK.SYSStorehouseList on ProcessOrderForGoodsDetailList.KuFangId
equals StorehouseList.StorehouseID
// orderby用于排序,新增的在上面
orderby ProcessOrderForGoodsInformation.ProcessInformationID descending
select new
{
// ProcessInformationID(库内加工ID)
ProcessInformationID = ProcessOrderForGoodsInformation.ProcessInformationID,
//。。。。。。对应数据库的参数
OrderForGoodsNumber = ProcessOrderForGoodsInformation.OrderForGoodsNumber,
ClientID = ProcessOrderForGoodsInformation.ClientID,
ClientName = ClientList.ClientEncoded,
ClientInstruct = ProcessOrderForGoodsInformation.ClientInstruct,
PurchaseOrderForGoodsNumber = ProcessOrderForGoodsInformation.PurchaseOrderForGoodsNumber,
OrderForGoodsTypeID = ProcessOrderForGoodsInformation.OrderForGoodsTypeID,
OrderForGoodsTypeName = OrderForGoodsTypeList.AttributeDetailName,
EmergencyID = ProcessOrderForGoodsInformation.EmergencyID,
EmergencyName = EmergencyList.AttributeDetailName,
OrderForGoodsSourceID = ProcessOrderForGoodsInformation.OrderForGoodsSourceID,
OrderForGoodsSourceName = OrderForGoodsSourceList.AttributeDetailName,
Releasetime = ProcessOrderForGoodsInformation.Releasetime,
StatusID = ProcessOrderForGoodsInformation.StatusID,
StatusName = StatusList.AttributeDetailName,
CarryOutStateID = ProcessOrderForGoodsInformation.CarryOutStateID,
CarryOutStateName = CarryOutStateList.AttributeDetailName,
OrderForGoodsPriority = ProcessOrderForGoodsInformation.OrderForGoodsPriority,
PledgeBankID = ProcessOrderForGoodsInformation.PledgeBankID,
Remarks = ProcessOrderForGoodsInformation.Remarks,
BankName = ProcessOrderForGoodsInformation.BankName,
ProcessTypeID = ProcessOrderForGoodsDetailList.ProcessTypeID,
StorehouseID = ProcessOrderForGoodsDetailList.KuFangId,
StorehouseName = StorehouseList.StorehouseName,
ProcessDetailID = ProcessOrderForGoodsDetailList.ProcessDetailID,
};
List<Dictionary<string, object>> kkk = new List<Dictionary<string, object>>();
foreach (var item in ProcessOrderForGoodsInformationList)
{
Dictionary<string, object> itemWuliao = new Dictionary<string, object>();
// Releasetime(时间)
string Releasetime1 = item.Releasetime.ToString();
//将转化的时间装入到数组中
itemWuliao.Add("Releasetime2", Releasetime1);
foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties())
{
// ToString().Trim())(去空格)
itemWuliao.Add(p.Name, p.GetValue(item, null).ToString().Trim());
}
kkk.Add(itemWuliao);
}
//返回json数组中
return Json(kkk, JsonRequestBehavior.AllowGet);
}
#endregion
(2)查询库内加工明细信息
查询界面如下:
2.5.1.5(图7)
选择加工信息
#region 查询库内加工货品信息
public ActionResult SelectProcessOrderForGoodsDetailList(int ProcessInformationID)
{ // PWProcessOrderForGoodsDetailList是 RK. PWProcessOrderForGoodsDetailList表的已个别名
//通个ID对应将所有的表连关系
var ProcessInformationList = from ProcessInformation in RK.PWProcessOrderForGoodsDetailList
join ProcessGoodsList in RK.SYSProcessGoodsList on ProcessInformation.ProcessDetailID equals ProcessGoodsList.ProcessDetailID
join ProcessTypeList in RK.SYSAttributeDetailList on ProcessInformation.ProcessTypeID equals ProcessTypeList.AttributeDetailID
join StorehouseList in RK.SYSStorehouseList on ProcessInformation.KuFangId equals StorehouseList.StorehouseID
join GoodsList in RK.SYSGoodsList on ProcessGoodsList.GoodsID equals GoodsList.GoodsID
join ShipperUnitsList in RK.SYSAttributeDetailList on ProcessGoodsList.ShipperUnitsID equals ShipperUnitsList.AttributeDetailID
join QualityList in RK.SYSAttributeDetailList on ProcessGoodsList.QualityID equals QualityList.AttributeDetailID
orderby ProcessInformation.ProcessDetailID descending
where ProcessInformation.ProcessInformationID == ProcessInformationID
select new
{
//OrderForGoodsInformationID(自己命名的参数)
//DiaryList.OrderForGoodsInformationID(这个表对应的参数)
ProcessDetailID = ProcessInformation.ProcessDetailID,
ProcessInformationID = ProcessInformation.ProcessInformationID,
ProcessTypeID = ProcessInformation.ProcessTypeID,
ProcessTypeName = ProcessTypeList.AttributeDetailName,
StorehouseID = ProcessInformation.KuFangId,
StorehouseName = StorehouseList.StorehouseName,
GoodsID = ProcessGoodsList.GoodsID,
GoodsNumber = GoodsList.GoodsNumber,
GoodsDesignation = GoodsList.GoodsDesignation,
Specifications = GoodsList.Specifications,
ProcessDetailID1 = ProcessGoodsList.ProcessDetailID,
EffectOfStorage = ProcessGoodsList.EffectOfStorage,
SelectQuantity = ProcessGoodsList.SelectQuantity,
ProcessQuantity = ProcessGoodsList.ProcessQuantity,
UnitID = ProcessGoodsList.ShipperUnitsID,
UnitName = ShipperUnitsList.AttributeDetailName,
QualityID = ProcessGoodsList.QualityID,
QualityName = QualityList.AttributeDetailName,
};
List<Dictionary<string, object>> kkk = new List<Dictionary<string, object>>();
foreach (var item in ProcessInformationList)
{
Dictionary<string, object> itemWuliao = new Dictionary<string, object>();
foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties())
{
itemWuliao.Add(p.Name, p.GetValue(item, null).ToString().Trim());
}
kkk.Add(itemWuliao);
}
//返回json格式的数据形式,AllowGet是允许
return Json(kkk, JsonRequestBehavior.AllowGet);
}
#endregion
(3)查询库内加工货品信息
作用界面如下:
2.5.1.5(图8)
#region 查询库内加工货品信息
public ActionResult SelectProcessOrderForGoodsDetailList1(int ProcessInformationID)
{
//通过库内加工信息的主键ID来查询库内加工明细信息
var ProcessInformationList = from ProcessInformation in RK.PWProcessOrderForGoodsDetailList
join ProcessGoodsList in RK.SYSProcessGoodsList on ProcessInformation.ProcessDetailID equals ProcessGoodsList.ProcessDetailID
join ProcessTypeList in RK.SYSAttributeDetailList on ProcessInformation.ProcessTypeID equals ProcessTypeList.AttributeDetailID
join StorehouseList in RK.SYSStorehouseList on ProcessInformation.KuFangId equals StorehouseList.StorehouseID
join GoodsList in RK.SYSGoodsList on ProcessGoodsList.GoodsID equals GoodsList.GoodsID
join ShipperUnitsList in RK.SYSAttributeDetailList on ProcessGoodsList.ShipperUnitsID equals ShipperUnitsList.AttributeDetailID
join QualityList in RK.SYSAttributeDetailList on ProcessGoodsList.QualityID equals QualityList.AttributeDetailID
orderby ProcessInformation.ProcessDetailID descending
where ProcessInformation.ProcessInformationID == ProcessInformationID
where ProcessGoodsList.ProcessFou == true
select new
{
ProcessGoodsID = ProcessGoodsList.ProcessGoodsID,
ProcessDetailID = ProcessInformation.ProcessDetailID,
ProcessInformationID = ProcessInformation.ProcessInformationID,
ProcessTypeID = ProcessInformation.ProcessTypeID,
ProcessTypeName = ProcessTypeList.AttributeDetailName,
StorehouseID = ProcessInformation.KuFangId,
StorehouseName = StorehouseList.StorehouseName,
GoodsID = ProcessGoodsList.GoodsID,
GoodsNumber = GoodsList.GoodsNumber,
GoodsDesignation = GoodsList.GoodsDesignation,
Specifications = GoodsList.Specifications,
ProcessDetailID1 = ProcessGoodsList.ProcessDetailID,
EffectOfStorage = ProcessGoodsList.EffectOfStorage,
SelectQuantity = ProcessGoodsList.SelectQuantity,
ProcessQuantity = ProcessGoodsList.ProcessQuantity,
UnitID = ProcessGoodsList.ShipperUnitsID,
UnitName = ShipperUnitsList.AttributeDetailName,
QualityID = ProcessGoodsList.QualityID,
QualityName = QualityList.AttributeDetailName,
};
List<Dictionary<string, object>> kkk = new List<Dictionary<string, object>>();
foreach (var item in ProcessInformationList)
{
Dictionary<string, object> itemWuliao = new Dictionary<string, object>();
foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties())
{
itemWuliao.Add(p.Name, p.GetValue(item, null).ToString().Trim());
}
kkk.Add(itemWuliao);
}
return Json(kkk, JsonRequestBehavior.AllowGet);
}
#endregion
(3).查询加工货品信息
作用界面如下:
2.5.1.5(图9)
#region 查询库内加工货品信息
public ActionResult SelectProcessOrderForGoodsDetailList2(int ProcessInformationID)
{
//通过库内加工信息的主键ID来查询库内选择加工明细信息
var ProcessInformationList = from ProcessInformation in RK.PWProcessOrderForGoodsDetailList
join ProcessGoodsList in RK.SYSProcessGoodsList on ProcessInformation.ProcessDetailID equals ProcessGoodsList.ProcessDetailID
join GoodsList in RK.SYSGoodsList on ProcessGoodsList.GoodsID equals GoodsList.GoodsID
join ShipperUnitsList in RK.SYSAttributeDetailList on ProcessGoodsList.ShipperUnitsID equals ShipperUnitsList.AttributeDetailID
join QualityList in RK.SYSAttributeDetailList on ProcessGoodsList.QualityID equals QualityList.AttributeDetailID
orderby ProcessInformation.ProcessDetailID descending
where ProcessInformation.ProcessInformationID == ProcessInformationID
// ProcessFou(加工否)表示是选择加工的商品
where ProcessGoodsList.ProcessFou == false
select new
{
ProcessGoodsID = ProcessGoodsList.ProcessGoodsID,
ProcessDetailID = ProcessInformation.ProcessDetailID,
ProcessInformationID = ProcessInformation.ProcessInformationID,
GoodsID = ProcessGoodsList.GoodsID,
GoodsNumber = GoodsList.GoodsNumber,
GoodsDesignation = GoodsList.GoodsDesignation,
Specifications = GoodsList.Specifications,
ProcessDetailID1 = ProcessGoodsList.ProcessDetailID,
EffectOfStorage = ProcessGoodsList.EffectOfStorage,
SelectQuantity = ProcessGoodsList.SelectQuantity,
ProcessQuantity = ProcessGoodsList.ProcessQuantity,
UnitID = ProcessGoodsList.ShipperUnitsID,
UnitName = ShipperUnitsList.AttributeDetailName,
QualityID = ProcessGoodsList.QualityID,
QualityName = QualityList.AttributeDetailName,
};
List<Dictionary<string, object>> kkk = new List<Dictionary<string, object>>();
foreach (var item in ProcessInformationList)
{
Dictionary<string, object> itemWuliao = new Dictionary<string, object>();
foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties())
{
// ToString().Trim())(作用去空格)
itemWuliao.Add(p.Name, p.GetValue(item, null).ToString().Trim());
}
kkk.Add(itemWuliao);
}
//将数据加入到数据字典中
return Json(kkk, JsonRequestBehavior.AllowGet);
}
#endregion
2.新增
(1).新增库内加工订单信息
#region 新增库内加工信息
//InsertOrderForGoodsDispatchingInformationList 方法名 OrderForGoodsNumber、VocationalTypeID。。。。。。。。对应的参数
public int InsertProcessOrderForGoodsInformationList(string OrderForGoodsNumber, int ClientID,
string ClientInstruct, string PurchaseOrderForGoodsNumber, int OrderForGoodsTypeID,
int EmergencyID, int OrderForGoodsSourceID,
DateTime Releasetime, int StatusID, int CarryOutStateID,
string OrderForGoodsPriority, int PledgeBankID, string Remarks, string BankName)
{
//实例化models中的一个表 给一个别名(PWProcessOrderForGoodsInformationList)
Models.PWProcessOrderForGoodsInformationList DingDanBiao = new Models.PWProcessOrderForGoodsInformationList();
DingDanBiao.OrderForGoodsNumber = OrderForGoodsNumber;
DingDanBiao.ClientID = ClientID;
DingDanBiao.ClientInstruct = ClientInstruct;
DingDanBiao.PurchaseOrderForGoodsNumber = PurchaseOrderForGoodsNumber;
DingDanBiao.OrderForGoodsTypeID = OrderForGoodsTypeID;
DingDanBiao.EmergencyID = EmergencyID;
DingDanBiao.OrderForGoodsSourceID = OrderForGoodsSourceID;
DingDanBiao.Releasetime = Releasetime;
DingDanBiao.StatusID = StatusID;
DingDanBiao.CarryOutStateID = CarryOutStateID;
DingDanBiao.OrderForGoodsPriority = OrderForGoodsPriority;
DingDanBiao.PledgeBankID = PledgeBankID;
DingDanBiao.Remarks = Remarks;
DingDanBiao.BankName = BankName;
//AddObject(是新增多一条数据)RK.SYSDiaryList(是对应的表)
RK.PWProcessOrderForGoodsInformationList.AddObject(DingDanBiao);
//将这个表的改变作为一个变量
int i = RK.SaveChanges();
if (i > 0)
{
//如果新增成功,改变的行数就大于零
// BaoXianID对应新增产生的那个主键ID,返回他用于传值到新增明细
var ProcessInformationID = (from ProcessInformationin in RK.PWProcessOrderForGoodsInformationList
select ProcessInformationin.ProcessInformationID).Max();
return ProcessInformationID;
}
else
{
//否则就没有新增数据
return 0;
}
}
#endregion
(2). 新增库内加工订单明细信息
#region 新增库内加工明细信息
//InsertProcessOrderForGoodsDetailList 方法名 OrderForGoodsNumber、VocationalTypeID。。。。。。。。对应的参数
public int InsertProcessOrderForGoodsDetailList(int ProcessInformationID, int ProcessTypeID, int StorehouseID)
{
//实例化models中的一个表 给一个别名(PWProcessOrderForGoodsDetailList)
Models.PWProcessOrderForGoodsDetailList DingDanBiao = new Models.PWProcessOrderForGoodsDetailList();
DingDanBiao.ProcessInformationID = ProcessInformationID;
DingDanBiao.ProcessTypeID = ProcessTypeID;
DingDanBiao.KuFangId = StorehouseID;
//AddObject(是新增多一条数据)RK.SYSDiaryList(是对应的表)
RK.PWProcessOrderForGoodsDetailList.AddObject(DingDanBiao);
int i = RK.SaveChanges();
if (i > 0)
{
//如果新增成功,改变的行数就大于零
// BaoXianID对应新增产生的那个主键ID,返回他用于传值到新增明细
var ProcessDetailID = (from ProcessInformationin in RK.PWProcessOrderForGoodsDetailList select ProcessInformationin.ProcessDetailID).Max();
return ProcessDetailID;
}
else
{
//如果新增成功,改变的行数就大于零
// BaoXianID对应新增产生的那个主键ID,返回他用于传值到新增明细
return 0;
}
}
#endregion
(3). 新增库内加工订单货品信息
#region 新增库内加工货品信息
public int InsertProcessGoodsList(int GoodsID, int ProcessDetailID, string EffectOfStorage, string SelectQuantity, string ProcessQuantity, int ShipperUnitsID, int QualityID, Boolean ProcessFou)
// InsertProcessGoodsList方法名 GoodsID、
VocationalTypeID。。。。。。。。对应的参数
{
Models.SYSProcessGoodsList DingDanBiao = new Models.SYSProcessGoodsList();
DingDanBiao.GoodsID = GoodsID;
DingDanBiao.ProcessDetailID = ProcessDetailID;
DingDanBiao.EffectOfStorage = EffectOfStorage;
DingDanBiao.SelectQuantity = SelectQuantity;
DingDanBiao.ProcessQuantity = ProcessQuantity;
DingDanBiao.ShipperUnitsID = ShipperUnitsID;
DingDanBiao.QualityID = QualityID;
DingDanBiao.ProcessFou = ProcessFou;
RK.SYSProcessGoodsList.AddObject(DingDanBiao);
//如果新增成功,改变的行数就大于零
int i = RK.SaveChanges();
if (i > 0)
{
return i;
}
else
{
return 0;
}
}
#endregion
3.修改
(1)修改库内加工订单信息
#region 修改库内加工信息
public int UpdateProcessOrderForGoodsInformationList(int ProcessInformationID, string OrderForGoodsNumber,
int ClientID, string ClientInstruct, string PurchaseOrderForGoodsNumber, int OrderForGoodsTypeID,
int EmergencyID, int OrderForGoodsSourceID,
DateTime Releasetime, int StatusID, int CarryOutStateID,
string OrderForGoodsPriority, int PledgeBankID, string Remarks, string BankName)
{
//实例化models中的一个表 给一个别名(DiaryList)
//DiaryList.OrderForGoodsNumber (是实例化表中的一个字段)
//OrderForGoodsNumber 是用于从界面传过来的参数
Models.PWProcessOrderForGoodsInformationList DingDanBiao = (from ProcessInformation
in RK.PWProcessOrderForGoodsInformationList
where ProcessInformation.ProcessInformationID == ProcessInformationID
select ProcessInformation).Single<Models.PWProcessOrderForGoodsInformationList>();
DingDanBiao.OrderForGoodsNumber = OrderForGoodsNumber;
DingDanBiao.ClientID = ClientID;
DingDanBiao.ClientInstruct = ClientInstruct;
DingDanBiao.PurchaseOrderForGoodsNumber = PurchaseOrderForGoodsNumber;
DingDanBiao.OrderForGoodsTypeID = OrderForGoodsTypeID;
DingDanBiao.EmergencyID = EmergencyID;
DingDanBiao.OrderForGoodsSourceID = OrderForGoodsSourceID;
DingDanBiao.Releasetime = Releasetime;
DingDanBiao.StatusID = StatusID;
DingDanBiao.CarryOutStateID = CarryOutStateID;
DingDanBiao.OrderForGoodsPriority = OrderForGoodsPriority;
DingDanBiao.PledgeBankID = PledgeBankID;
DingDanBiao.Remarks = Remarks;
DingDanBiao.BankName = BankName;
int i = RK.SaveChanges();
if (i > 0)
{
//将这个表的改变作为一个变量
//如果新增成功,改变的行数就大于零
// BaoXianID对应新增产生的那个主键ID,返回他用于传值到新增明细
return ProcessInformationID;
}
else
{
return 0;
}
}
#endregion
(2)修改库内加工订单明细信息
<span style="font-size:14px;"> </span>#region 修改库内加工明细信息
public int UpdateProcessOrderForGoodsDetailList(int ProcessDetailID, int ProcessInformationID, int ProcessTypeID, int StorehouseID)
{
Models.PWProcessOrderForGoodsDetailList DingDanBiao = (from ProcessInformation in
RK.PWProcessOrderForGoodsDetailList where ProcessInformation.ProcessInformationID == ProcessInformationID
select ProcessInformation).Single<Models.PWProcessOrderForGoodsDetailList>();
DingDanBiao.ProcessInformationID = ProcessInformationID;
DingDanBiao.ProcessTypeID = ProcessTypeID;
DingDanBiao.KuFangId = StorehouseID;
int i = RK.SaveChanges();
if (i > 0)
{
//将这个表的改变作为一个变量
//如果新增成功,改变的行数就大于零
// BaoXianID对应新增产生的那个主键ID,返回他用于传值到新增明细
return ProcessDetailID;
}
else
{
return 0;
}
}
#endregion
3)修改库内加工订单货品信息
#region 修改库内加工货品信息
public int UpdateProcessGoodsList(int ProcessGoodsID, int GoodsID, int ProcessDetailID,
string EffectOfStorage, string SelectQuantity, string ProcessQuantity,
int ShipperUnitsID, int QualityID, string Update, Boolean ProcessFou)
{
if (Update.Equals("1"))
{
//update界面传过来的参数,判断执行了哪一个方法
//如果update的至等于1就修改
Models.SYSProcessGoodsList DingDanBiao = (from ProcessInformation in RK.SYSProcessGoodsList
where ProcessInformation.ProcessGoodsID == ProcessGoodsID
select ProcessInformation).Single<Models.SYSProcessGoodsList>();
DingDanBiao.GoodsID = GoodsID;
DingDanBiao.ProcessDetailID = ProcessDetailID;
DingDanBiao.EffectOfStorage = EffectOfStorage;
DingDanBiao.SelectQuantity = SelectQuantity;
DingDanBiao.ProcessQuantity = ProcessQuantity;
DingDanBiao.ShipperUnitsID = ShipperUnitsID;
DingDanBiao.QualityID = QualityID;
}
//如果update的至等于2就新增
if (Update.Equals("2"))
{
Models.SYSProcessGoodsList DingDanBiao = new Models.SYSProcessGoodsList();
DingDanBiao.GoodsID = GoodsID;
DingDanBiao.ProcessDetailID = ProcessDetailID;
DingDanBiao.EffectOfStorage = EffectOfStorage;
DingDanBiao.SelectQuantity = SelectQuantity;
DingDanBiao.ProcessQuantity = ProcessQuantity;
DingDanBiao.ShipperUnitsID = ShipperUnitsID;
DingDanBiao.QualityID = QualityID;
DingDanBiao.ProcessFou = ProcessFou;
RK.SYSProcessGoodsList.AddObject(DingDanBiao);
}
//如果update的至等于1就删除
if (Update.Equals("3"))
{
var DingDanBiao = (from ProcessInformation in RK.SYSProcessGoodsList where
ProcessInformation.ProcessGoodsID == ProcessGoodsID
select ProcessInformation).Single<Models.SYSProcessGoodsList>();
RK.SYSProcessGoodsList.DeleteObject(DingDanBiao);
}
int i = RK.SaveChanges();
if (i > 0)
{
return i;
}
else
{
return 0;
}
}
#endregion
第三步:视图;
2.5.1.5(图6)
2.5.1.5(图7)
html代码:
1.查询
(1).查询加工订单信息
<div title="订单信息">
<div id="IProcessOrderForGoodsInformationList" class="easyui-panel" style="width: auto;
height: auto; border-radius: 15px 15px 0px 0px;">
<div>
<table>
<tr>
<td style="font-family: 楷体; font-size: 17px;">
订单号查询:
</td>
<td>
<input id="CaiGouDingDanHaoChaXun" style="width: 180px; height: 25px;" />
</td>
<td>
<button οnclick="ChaXunCaiGouDingDan()" class="btn blue" data-toggle="modal" style="font-family: 楷体;"
οnclick="ChaXun()">
查询</button>
</td>
<td>
<button class="btn blue" data-toggle="modal" style="font-family: 楷体;" οnclick="Insert()">
添加</button>
</td>
</tr>
</table>
</div>
<table id="tbProcessOrderForGoodsInformationList" class="easyui-datagrid" style="width: auto;
height: 280px;" data-options="url:'/DingDanGuanL/SelectProcessOrderForGoodsInformationList',rownumbers:true,singleSelect:true,rowStyler:function(index,row){
if (index%2==0){
}
}">
<thead>
<tr>
<th data-options="field:'ok',align:'center',checkbox:true">
</th>
<th data-options="field:'Delete',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:'ProcessInformationID',width:130,align:'center',hidden:true">
订单号ID
</th>
<th data-options="field:'ProcessDetailID',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:'ClientInstruct',width:130,align:'center'">
客户指令号
</th>
<th data-options="field:'PurchaseOrderForGoodsNumber',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:'EmergencyID',width:130,align:'center',hidden:true">
紧急程度ID
</th>
<th data-options="field:'EmergencyName',width:130,align:'center'">
紧急程度
</th>
<th data-options="field:'OrderForGoodsSourceID',width:130,align:'center',hidden:true">
订单来源ID
</th>
<th data-options="field:'OrderForGoodsSourceName',width:130,align:'center'">
订单来源
</th>
<th data-options="field:'Releasetime2',width:130,align:'center'">
下达时间
</th>
<th data-options="field:'StatusID',width:130,align:'center',hidden:true">
状态ID
</th>
<th data-options="field:'StatusName',width:130,align:'center'">
状态
</th>
<th data-options="field:'CarryOutStateID',width:130,align:'center',hidden:true">
执行状态ID
</th>
<th data-options="field:'CarryOutStateName',width:130,align:'center'">
执行状态
</th>
<th data-options="field:'OrderForGoodsPriority',width:130,align:'center'">
订单优先级
</th>
<th data-options="field:'PledgeBankID',width:130,align:'center',hidden:true">
质押银行ID
</th>
<th data-options="field:'BankName',width:130,align:'center'">
质押银行
</th>
<th data-options="field:'Remarks',width:130,align:'center'">
备注
</th>
<th data-options="field:'ProcessTypeID',width:130,align:'center',hidden:true">
加工类型ID
</th>
<th data-options="field:'StorehouseID',width:130,align:'center',hidden:true">
库房ID
</th>
<th data-options="field:'StorehouseName',width:130,align:'center',hidden:true">
库房名称
</th>
</tr>
</thead>
</table>
(2).查询加工明细信息
<table id="tbProcessOrderForGoodsDetailList" class="easyui-datagrid" style=" width:auto; height:200px;"
data-options="rownumbers:true,singleSelect:true,rowStyler:function(index,row){
if (index%2==0){
}
}">
<thead>
<tr>
<th data-options="field:'ok',align:'center',checkbox:true"></th>
<th data-options="field:'ProcessDetailID',width:130,align:'center',hidden:true">加工明细ID</th>
<th data-options="field:'ProcessInformationID',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:'StorehouseID',width:130,align:'center',hidden:true">库房ID</th>
<th data-options="field:'StorehouseName',width:130,align:'center'">库房</th>
<th data-options="field:'ProcessTypeID',width:130,align:'center',hidden:true">加工类型ID</th>
<th data-options="field:'ProcessTypeName',width:130,align:'center'">加工类型</th>
<th data-options="field:'GoodsNumber',width:130,align:'center'">货品编码</th>
<th data-options="field:'GoodsDesignation',width:130,align:'center'">货品名称</th>
<th data-options="field:'Specifications',width:130,align:'center'">规格</th>
<th data-options="field:'EffectOfStorage',width:130,align:'center'">批次</th>
<th data-options="field:'UnitID',align:'center',width:130,hidden:true">单位ID</th>
<th data-options="field:'UnitName',align:'center',width:130">单位</th>
<th data-options="field:'QualityID',align:'center',width:130,hidden:true">质量ID</th>
<th data-options="field:'QualityName',align:'center',width:130">质量</th>
<th data-options="field:'SelectQuantity',width:130,align:'center'">选择数量</th>
<th data-options="field:'ProcessQuantity',width:130,align:'center'">加工数量</th>
</tr>
</thead>
<span style="font-size:18px;"> </span> </table>
2.JavaScript代码:
(1).查询加工订单信息
2.5.1.5(图11)
function SelectJiaGongXinXi() {
///DingDanGuanL/SelectProcessOrderForGoodsInformationList?OrderForGoodsNumber=(DingDanGuanL是哪一个控制器
// SelectProcessOrderForGoodsInformationList(是这个控制器的方法名))
//OrderForGoodsNumber是这个方法的一个参数
$.getJSON("/DingDanGuanL/SelectProcessOrderForGoodsInformationList",
function (data) {
//执行类这个方法就用哪一个方法来加载数据,显示到datagrid中
$("#tbProcessOrderForGoodsInformationList").datagrid('loadData', data);
}
);
}
2.新增库内加工信息
新增修改
2.5.1.5(图8)
包装和组合:
包装”,包装用于将货品大包装变小包装或将货品小包装变大包装的操作,用户选择加工类型为“组合”,组合用于将多种货品组合在一起。
2.5.1.5(图9)
贴签:
2.5.1.5(图10)
Html代码:
(1).新增库内加工信息
<div id="tb新增修改订单信息" class="reveal-modal" style="width:auto;height:auto;left:530px; right:auto; top:120px; background-color:White">
<center>
<div>
<table>
<tr>
<td style="font-family: 楷体; font-size: 16px;" > 订单号:</td>
<td ><input style=" width:150px; height:25px;" type="text" id="txtOrderForGoodsNumber" readonly />
</td>
<td style="font-family: 楷体; font-size: 16px;" > 客户码:</td>
<td ><input style=" width:150px; height:25px;" type="text" id="txtClientName" readonly οnclick="OnKeHuMa()" />
</td>
</tr>
<tr>
<td style="font-family: 楷体; font-size: 16px;" >客户指令号:</td>
<td ><input style=" width:150px; height:25px;" type="text" id="txtClientInstruct" />
</td>
<td style="font-family: 楷体; font-size: 16px;" >采购订单号:</td>
<td ><input style=" width:150px; height:25px;" type="text" id="txtPurchaseOrderForGoodsNumber" readonly />
</td>
</tr>
<tr>
<td style="font-family: 楷体; font-size: 16px;"> 订单类型:</td>
<td ><input style=" width:155px; height:30px;" class="easyui-combobox" id="cboOrderForGoodsTypeID"data-options="url:'/XiaLaKuang/ChaXunShuXingMingXiXinXi?ShuXingJiHeID=22',valueField:'id',textField:'text'" readonly />
</td>
<td style="font-family: 楷体; font-size: 16px;" > 紧急程度:</td>
<td ><input style=" width:155px; height:30px;" class="easyui-combobox" id="cboEmergencyID" data-options="url:'/XiaLaKuang/ChaXunShuXingMingXiXinXi?ShuXingJiHeID=23',valueField:'id',textField:'text'"/>
</td>
</tr>
<tr>
<td style="font-family: 楷体; font-size: 16px;" > 订单来源:</td>
<td ><input style=" width:155px; height:30px;" class="easyui-combobox" id="cboOrderForGoodsSourceID" data-options="url:'/XiaLaKuang/ChaXunShuXingMingXiXinXi?ShuXingJiHeID=24',valueField:'id',textField:'text'" />
</td>
<td style="font-family: 楷体; font-size: 16px;" > 下达时间:</td>
<td ><input style=" width:155px; height:30px;" class="easyui-datebox" id="datReleasetime" readonly />
</td>
</tr>
<tr>
<td style="font-family: 楷体; font-size: 16px;" > 状 态:</td>
<td ><input style=" width:155px; height:30px;" class="easyui-combobox" id="cboStatusID"data-options="url:'/XiaLaKuang/ChaXunShuXingMingXiXinXi?ShuXingJiHeID=4',valueField:'id',textField:'text'" />
</td>
<td style="font-family: 楷体; font-size: 16px;" > 执行状态:</td>
<td ><input style=" width:155px; height:30px;" class="easyui-combobox" id="cboCarryOutStateID" data-options="url:'/XiaLaKuang/ChaXunShuXingMingXiXinXi?ShuXingJiHeID=25',valueField:'id',textField:'text'" />
</td>
</tr>
<tr>
<td style="font-family: 楷体; font-size: 16px;" >订单优先级:</td>
<td ><input style=" width:150px; height:25px;" type="text" id="txtOrderForGoodsPriority" />
</td>
<td style="font-family: 楷体; font-size: 16px;" > 质押银行:</td>
<td ><input style=" width:150px; height:25px;" type="text" id="txtBankName" readonly οnclick="OnZhiYaYinHang()" οnkeyup="OnZhiYaYinHang()" />
</td>
</tr>
</table>
</div>
<div>
<table >
<tr>
<td style="font-family: 楷体; font-size: 16px;" > 备 注:</td>
<td ><input style=" width:415px; height:25px;" type="text" id="txtRemarks" />
</td>
</tr>
</table>
</div>
</center>
<div>
<td><button type="button" class="btn blue" data-toggle="modal" style="font-family: 楷体; " οnclick="ShangYiBu()">上一步</button> </td>
<td > </td> <td> <button type="button" class="btn blue" data-toggle="modal" style="font-family: 楷体; " οnclick="XiaYiBu()">下一步</button> </td>
</div>
</div>
<div id="I加工信息" class="reveal-modal" style="width:980px;height:auto;left:330px; right:auto; top:48px; background-color:White">
<div>
<table>
<tr>
<td style=" font-size: 18px; color: #FF0000" >第一库房:</td>
<td ><input style=" width:185px; height:25px;" type="text" id="txtStorehouseID" />
</td>
<td><button οnclick="btnStorehouseList()" class="btn blue" data-toggle="modal" style="font-family: 楷体; ">选择</button></td>
<td> </td>
<td style=" font-size: 18px; color: #FF0000">加工类型:</td><td><input id="cboProcessTypeID" class="easyui-combobox"data-options="url:'/XiaLaKuang/ChaXunShuXingMingXiXinXi?ShuXingJiHeID=34',valueField:'id',textField:'text',onChange:oncboProcessTypeID" style=" width:190px; height:30px;" /></td>
</tr>
</table>
</div>
(2).新增库内加工信息
<div id="IProcessGoodsList" class="easyui-panel" style=" width:auto; height:auto;border-radius:15px 15px 0px 0px ;">
<table id="tbProcessGoodsList" class="easyui-datagrid" style=" width:auto; height:200px;" data-options="onClickRow:onClickRow,toolbar: '#tb',rownumbers:true,singleSelect:true,rowStyler:function(index,row){
if (index%2==0){
}
}">
<thead>
<tr>
<th data-options="field:'ok',align:'center',checkbox:true"></th>
<th data-options="field:'ProcessGoodsID',width:130,align:'center',hidden:true">加工信息ID</th>
<th data-options="field:'GoodsID',width:130,align:'center',
formatter:function(value,row){
return row.GoodsDesignation;
},
editor:{
type:'combogrid',
options:{
panelWidth: 500,
idField: 'GoodsID',
textField: 'GoodsDesignation',
url: '/CangKuGuanLi/SelectCashStatement2',
columns: [[
{field:'GoodsID',width:80,align:'center',hidden:true,title:'货品ID'},
{field:'GoodsDesignation',width:80,align:'center',title:'货品名称'},
{field:'GoodsNumber',width:80,align:'center',title:'货品编码'},
{field:'Specifications',width:80,align:'center',title:'规格'},
{field:'UnitID',width:80,align:'center',title:'单位ID',hidden:true},
{field:'Unit',width:80,align:'center',title:'单位'},
{field:'QualityID',width:80,align:'center',title:'质量ID',hidden:true},
{field:'Quality',width:80,align:'center',title:'质量'},
{field:'CertifiedProductsQuantity',width:80,align:'center',title:'正品量'},
{field:'SubstandardGoodsQuantity',width:80,align:'center',title:'次品量'},
{field:'ZongShuLiang',width:80,align:'center',title:'总数量'},
]],
fitColumns: true,
onClickRow:onClickRowMingXi,
required:true
}
}">货品名称</th>
<th data-options="field:'GoodsNumber',width:130,align:'center'">货品编码</th>
<th data-options="field:'Specifications',width:130,align:'center'">规格</th>
<th data-options="field:'EffectOfStorage',width:130,align:'center',editor:'text'">批次</th>
<th data-options="field:'UnitID',align:'center',width:130,
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:'QualityID',align:'center',width:130,
formatter:function(value,row){
return row.text1;
},
editor:{
type:'combobox',
options:{
valueField:'id1',
textField:'text1',
url:'/XiaLaKuang/SelectQuality'
}
}
">质量</th>
<th data-options="field:'SelectQuantity',width:130,align:'center',editor:'text'"> 数量</th>
</tr>
</thead>
</table>
<div id="tb" style="height:auto">
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" οnclick="append()">添加货品</a>
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" οnclick="removee()">移除货品</a>
</div>
</div>
<div id="IProcessGoodsList1" class="easyui-panel" style=" width:auto; height:auto;border-radius:15px 15px 0px 0px ;">
<table id="tbProcessGoodsList1" class="easyui-datagrid" style=" width:auto; height:200px;" data-options="onClickRow:onClickRow1,toolbar: '#tb1',rownumbers:true,singleSelect:true,rowStyler:function(index,row){
if (index%2==0){
}
}">
<thead>
<tr>
<th data-options="field:'ok',align:'center',checkbox:true"></th>
<th data-options="field:'ProcessGoodsID',width:130,align:'center',hidden:true">加工信息ID</th>
<th data-options="field:'GoodsID',width:130,align:'center',
formatter:function(value,row){
return row.GoodsDesignation;
},
editor:{
type:'combogrid',
options:{
panelWidth: 800,
idField: 'GoodsID',
textField: 'GoodsDesignation',
url: '/CangKuGuanLi/SelectCashStatement2',
columns: [[
{field:'GoodsID',width:80,align:'center',hidden:true,title:'货品ID'},
{field:'GoodsDesignation',width:80,align:'center',title:'货品名称'},
{field:'GoodsNumber',width:80,align:'center',title:'货品编码'},
{field:'Specifications',width:80,align:'center',title:'规格'},
{field:'UnitID',width:80,align:'center',title:'单位ID',hidden:true},
{field:'Unit',width:80,align:'center',title:'单位'},
{field:'QualityID',width:80,align:'center',title:'质量ID',hidden:true},
{field:'Quality',width:80,align:'center',title:'质量'},
{field:'CertifiedProductsQuantity',width:80,align:'center',title:'正品量'},
{field:'SubstandardGoodsQuantity',width:80,align:'center',title:'次品量'},
{field:'ZongShuLiang',width:80,align:'center',title:'总数量'},
]],
fitColumns: true,
onClickRow:onClickRowMingXi1,
required:true
}
}">货品名称</th>
<th data-options="field:'GoodsNumber',width:130,align:'center'">货品编码</th>
<th data-options="field:'Specifications',width:130,align:'center'">规格</th>
<th data-options="field:'EffectOfStorage',width:130,align:'center',editor:'text'">批次</th>
<th data-options="field:'UnitID',align:'center',width:130,
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:'QualityID',align:'center',width:130,
formatter:function(value,row){
return row.text1;
},
editor:{
type:'combobox',
options:{
valueField:'id1',
textField:'text1',
url:'/XiaLaKuang/SelectQuality'
}
}
">质量</th>
<th data-options="field:'ProcessQuantity',width:130,align:'center',editor:'text'"> 数量</th>
</tr>
</thead>
</table>
<div id="tb1" style="height:auto">
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" οnclick="append1()">添加货品</a>
<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" οnclick="removee1()">移除货品</a>
</div>
JavaScript代码:
(1).打开新增界面
2.5.1.5(图10)
var ProcessTypeID = 0;
function Insert() {
//点击新增按钮(打开新增界面)
document.getElementById("InsertButton").style.display = "block";
document.getElementById("updateButton").style.display = "none";
//block,将新增按钮显示出来
//none将修改按钮隐藏起来
ProcessInformationID1 = 0;
ProcessDetailID = 0;
$("#txtOrderForGoodsNumber").val("");
id1 = 0;
$("#txtClientName").val("");
$("#txtClientInstruct").val("");
$("#txtPurchaseOrderForGoodsNumber").val("");
//将下拉框清空
//将文本款赋值为空
$("#cboOrderForGoodsTypeID").combobox("clear");
$("#cboEmergencyID").combobox("clear");
$("#cboOrderForGoodsSourceID").combobox("clear");
$("#datReleasetime").datebox("clear");
$("#cboStatusID").combobox("clear");
$("#cboCarryOutStateID").combobox("clear");
$("#txtOrderForGoodsPriority").val("");
id2 = 0;
$("#txtRemarks").val("");
$("#txtBankName").val("");
$("#txtStorehouseID").val("");
id3 = 0;
$("#cboProcessTypeID").combobox("clear");
ProcessTypeID=0;
//清空datagrid tatol(全部为空)rows为空
$("#tbProcessGoodsList").datagrid('loadData', { tatol: 0, rows: [] });
$("#tbProcessGoodsList1").datagrid('loadData', { tatol: 0, rows: [] });
$.getJSON("/DingDanGuanL/SelectProcessOrderForGoodsNumber",
function (data) {
var DingDanHao = data[0].DingDan1;
//绑定库内加工单号
$("#txtOrderForGoodsNumber").val(DingDanHao);
});
$.getJSON("/DingDanGuanL/SelectPurchaseOrderForGoodsNumber",
function (data) {
var DingDanHao = data[0].DingDan1;
$("#txtPurchaseOrderForGoodsNumber").val(DingDanHao);
});
$("#tb新增修改订单信息").reveal($(this).data());
$("#cboOrderForGoodsTypeID").combobox("select", 120);
}
(2).保存新增库内加工信息
保存方法点击按钮如图:
2.5.1.5(图10)
function InsertProcessOrderForGoodsInformationList() {
if (confirm("是否新增")) {
//先结束编辑,否则不能新增明细
endEditing(false);
endEditing1(false);
$.getJSON("/DingDanGuanL/InsertProcessOrderForGoodsInformationList?OrderForGoodsNumber="
+ $("#txtOrderForGoodsNumber").val() + "&"
+ "ClientID=" + id1 + "&"
+ "ClientInstruct=" + $("#txtClientInstruct").val() + "&"
+ "PurchaseOrderForGoodsNumber=" + $("#txtPurchaseOrderForGoodsNumber").val() + "&"
+ "OrderForGoodsTypeID=" + $("#cboOrderForGoodsTypeID").combobox('getValue') + "&"
+ "EmergencyID=" + $("#cboEmergencyID").combobox('getValue') + "&"
+ "OrderForGoodsSourceID=" + $("#cboOrderForGoodsSourceID").combobox('getValue') + "&"
+ "Releasetime=" + $("#datReleasetime").datebox('getValue') + "&"
+ "StatusID=" + $("#cboStatusID").combobox('getValue') + "&"
+ "CarryOutStateID=" + $("#cboCarryOutStateID").combobox('getValue') + "&"
+ "OrderForGoodsPriority=" + $("#txtOrderForGoodsPriority").val() + "&"
+ "PledgeBankID=" + id2 + "&"
+ "Remarks=" + $("#txtRemarks").val() + "&"
+ "BankName=" + $("#txtBankName").val(),
function (data) {
$.getJSON("/DingDanGuanL/InsertProcessOrderForGoodsDetailList?ProcessInformationID=" + data + "&"
+ "ProcessTypeID=" + $("#cboProcessTypeID").combobox('getValue') + "&"
+ "StorehouseID=" + id3,
function (data1) {
//data 是controllers 返回的 var BaoXianID = (from bx in RK.PWOrderForTransportationList select bx.OrderForTransportationID).Max();
// 最大ID
var IProcessGoodsList = $("#tbProcessGoodsList").datagrid('getData');
for (var j = 0; j < IProcessGoodsList.rows.length; j++) {
// CheLiangBaoXianTiaoMu.rows.length是datagrid的行数
//CheLiangBaoXianTiaoMu.rows[i].GoodsID 对应的几行的单元格ID
$.getJSON("/DingDanGuanL/InsertProcessGoodsList?GoodsID=" + IProcessGoodsList.rows[j].GoodsID + "&"
+ "ProcessDetailID=" + data1 + "&"
+ "EffectOfStorage=" + IProcessGoodsList.rows[j].EffectOfStorage + "&"
+ "SelectQuantity=" + IProcessGoodsList.rows[j].SelectQuantity + "&"
+ "ProcessQuantity=" + 0 + "&"
+ "ShipperUnitsID=" + IProcessGoodsList.rows[j].UnitID + "&"
+ "QualityID=" + IProcessGoodsList.rows[j].QualityID + "&"
+ "ProcessFou=" + true,
function (data3) {
});
}
if ($("#cboProcessTypeID").combobox('getValue') != 117) {
//因为库内加工分包装,组合,贴签三中情况
//如果加工类型不等于贴签,
var IProcessGoodsList1 = $("#tbProcessGoodsList1").datagrid('getData');
for (var i = 0; i < IProcessGoodsList1.rows.length; i++) {
$.getJSON("/DingDanGuanL/InsertProcessGoodsList?GoodsID=" + IProcessGoodsList1.rows[i].GoodsID + "&"
+ "ProcessDetailID=" + data1 + "&"
+ "EffectOfStorage=" + IProcessGoodsList1.rows[i].EffectOfStorage + "&"
+ "SelectQuantity=" + 0 + "&"
+ "ProcessQuantity=" + IProcessGoodsList1.rows[i].ProcessQuantity + "&"
+ "ShipperUnitsID=" + IProcessGoodsList1.rows[i].UnitID + "&"
+ "QualityID=" + IProcessGoodsList1.rows[i].QualityID + "&"
+ "ProcessFou=" + false,
function (data2) {
});
}
} else {
}
});
if (data > 0) {
alert("新增成功");
setTimeout(function () {
window.location.href = "/DingDanGuanL/KuNeiJiaGong";
}, 1000);
SelectJiaGongXinXi();
} else {
alert("新增失败");
}
});
}
}
(3).修改库内加工信息
点击修改按钮界面如下:
2.5.1.5(图10)
.JavaScript代码:
修改绑定库内加工信息
var ProcessInformationID1 = 0;
var ProcessDetailID = 0;
function Update() {
//点击一条明细进行修改
//隐藏新增按钮,显示修改按钮
//通过用document.getElementById来找到那个ID,然后就对他进行操作
$("#tb新增修改订单信息").reveal($(this).data());
document.getElementById("InsertButton").style.display = "none";
document.getElementById("updateButton").style.display = "block";
var ROW = $("#tbProcessOrderForGoodsInformationList").datagrid('getSelected');
ProcessInformationID1 = ROW.ProcessInformationID;
ProcessDetailID = ROW.ProcessDetailID;
$("#txtOrderForGoodsNumber").val( ROW.OrderForGoodsNumber);
id1 = ROW.ClientID;
$("#txtClientName").val( ROW.ClientName);
$("#txtClientInstruct").val( ROW.ClientInstruct);
$("#txtPurchaseOrderForGoodsNumber").val( ROW.PurchaseOrderForGoodsNumber);
$("#cboOrderForGoodsTypeID").combobox('setValue', ROW.OrderForGoodsTypeID);
$("#cboEmergencyID").combobox('setValue', ROW.EmergencyID);
$("#cboOrderForGoodsSourceID").combobox('setValue', ROW.OrderForGoodsSourceID);
$("#datReleasetime").datebox('setValue', ROW.Releasetime2);
$("#cboStatusID").combobox('setValue', ROW.StatusID);
$("#cboCarryOutStateID").combobox('setValue', ROW.CarryOutStateID);
$("#txtOrderForGoodsPriority").val( ROW.OrderForGoodsPriority);
id2 = ROW.PledgeBankID;
$("#txtRemarks").val( ROW.Remarks);
$("#txtBankName").val( ROW.BankName);
$("#txtStorehouseID").val( ROW.StorehouseName);
id3 = ROW.StorehouseID;
$("#cboProcessTypeID").combobox('setValue', ROW.ProcessTypeID);
var ProcessTypeID = ROW.ProcessTypeID;
if (ProcessTypeID == 117) {
//因为库内加工分包装,组合,贴签三中情况
//如果加工类型等于贴签,就关闭加工货品信息
$("#IProcessGoodsList1").panel('close');
}
$.getJSON("/DingDanGuanL/SelectProcessOrderForGoodsDetailList1?ProcessInformationID=" + ProcessInformationID1,
function (data) {
$("#tbProcessGoodsList").datagrid('loadData', data);
var dt = $("#tbProcessGoodsList").datagrid('getData');
for (var i = 0; i < dt.rows.length; i++) {
//绑定时,因为datagrid有combobox不能显示出来,可用这个方法
$("#tbProcessGoodsList").datagrid('getRows')[i]["text"] = data[i]["UnitName"];
$("#tbProcessGoodsList").datagrid('getRows')[i]["text1"] = data[i]["QualityName"];
$("#tbProcessGoodsList").datagrid('beginEdit', i);
$("#tbProcessGoodsList").datagrid('endEdit', i);
}
}
);
$.getJSON("/DingDanGuanL/SelectProcessOrderForGoodsDetailList2?ProcessInformationID=" + ProcessInformationID1,
function (data) {
$("#tbProcessGoodsList1").datagrid('loadData', data);
var dt = $("#tbProcessGoodsList1").datagrid('getData');
for (var i = 0; i < dt.rows.length; i++) {
//绑定时,因为datagrid有combobox不能显示出来,可用这个方法
//先结束编辑,再开始编辑
$("#tbProcessGoodsList1").datagrid('getRows')[i]["text"] = data[i]["UnitName"];
$("#tbProcessGoodsList1").datagrid('getRows')[i]["text1"] = data[i]["QualityName"];
$("#tbProcessGoodsList1").datagrid('beginEdit', i);
$("#tbProcessGoodsList1").datagrid('endEdit', i);
}
}
);
}
修改保存库内加工信息
保存修改按钮事件的界面如下:
2.5.1.5(图10)
function UpdateProcessOrderForGoodsInformationList() {
if (confirm("是否修改")) {
endEditing(false);
//endEditing(false);结束编辑
endEditing1(false);
//修改加工订单信息$.getJSON("/DingDanGuanL/UpdateProcessOrderForGoodsInformationList?ProcessInformationID=" + ProcessInformationID1 + "&"
+ "OrderForGoodsNumber=" + $("#txtOrderForGoodsNumber").val() + "&"
+ "ClientID=" + id1 + "&"
+ "ClientInstruct=" + $("#txtClientInstruct").val() + "&"
+ "PurchaseOrderForGoodsNumber=" + $("#txtPurchaseOrderForGoodsNumber").val() + "&"
+ "OrderForGoodsTypeID=" + $("#cboOrderForGoodsTypeID").combobox('getValue') + "&"
+ "EmergencyID=" + $("#cboEmergencyID").combobox('getValue') + "&"
+ "OrderForGoodsSourceID=" + $("#cboOrderForGoodsSourceID").combobox('getValue') + "&"
+ "Releasetime=" + $("#datReleasetime").datebox('getValue') + "&"
+ "StatusID=" + $("#cboStatusID").combobox('getValue') + "&"
+ "CarryOutStateID=" + $("#cboCarryOutStateID").combobox('getValue') + "&"
+ "OrderForGoodsPriority=" + $("#txtOrderForGoodsPriority").val() + "&"
+ "PledgeBankID=" + id2 + "&"
+ "Remarks=" + $("#txtRemarks").val() + "&"
+ "BankName=" + $("#txtBankName").val(),
function (data) {
$.getJSON("/DingDanGuanL/UpdateProcessOrderForGoodsDetailList?ProcessDetailID=" + ProcessDetailID + "&"
+ "ProcessInformationID=" + ProcessInformationID1 + "&"
+ "ProcessTypeID=" + $("#cboProcessTypeID").combobox('getValue') + "&"
+ "StorehouseID=" + id3,
function (data1) {
//修改
//'getChanges获取datagrid的改变
var delRow = $("#tbProcessGoodsList1").datagrid('getChanges', 'deleted');
rowsCount = delRow.length;
//改变的行数
for (var a = 0; a < rowsCount; a++) {
$.getJSON("/DingDanGuanL/UpdateProcessGoodsList?ProcessGoodsID=" + delRow[a].ProcessGoodsID + "&"
+ "GoodsID=" + delRow[a].GoodsID + "&"
+ "ProcessDetailID=" + data1 + "&"
+ "EffectOfStorage=" + delRow[a].EffectOfStorage + "&"
+ "SelectQuantity=" + 0 + "&"
+ "ProcessQuantity=" + delRow[a].ProcessQuantity + "&"
+ "ShipperUnitsID=" + delRow[a].UnitID + "&"
+ "QualityID=" + delRow[a].QualityID + "&"
+ "Update=" + 3 + "&"
+ "ProcessFou=" + false,
function (data2) {
}
);
}
//获取新增的改变('getChanges')
//新增的行数(rowsCount)
var insRow = $("#tbProcessGoodsList1").datagrid('getChanges', 'inserted');
rowsCount = insRow.length;
for (var b = 0; b < rowsCount; b++) {
$.getJSON("/DingDanGuanL/UpdateProcessGoodsList?ProcessGoodsID=" + 0 + "&"
+ "GoodsID=" + insRow[b].GoodsID + "&"
+ "ProcessDetailID=" + data1 + "&"
+ "EffectOfStorage=" + insRow[b].EffectOfStorage + "&"
+ "SelectQuantity=" + 0 + "&"
+ "ProcessQuantity=" + insRow[b].ProcessQuantity + "&"
+ "ShipperUnitsID=" + insRow[b].UnitID + "&"
+ "QualityID=" + insRow[b].QualityID + "&"
+ "Update=" + 2 + "&"
+ "ProcessFou=" + false,
function (data3) {
}
);
}
//同个getchanges的方法获取修改的行数
//修改
var UpdatRow = $("#tbProcessGoodsList1").datagrid('getChanges', 'updated');
rowsCount = UpdatRow.length;
for (var c = 0; c < rowsCount; c++) {
$.getJSON("/DingDanGuanL/UpdateProcessGoodsList?ProcessGoodsID=" + UpdatRow[c].ProcessGoodsID + "&"
+ "GoodsID=" + UpdatRow[c].GoodsID + "&"
+ "ProcessDetailID=" + data1 + "&"
+ "EffectOfStorage=" + UpdatRow[c].EffectOfStorage + "&"
+ "SelectQuantity=" + 0 + "&"
+ "ProcessQuantity=" + UpdatRow[c].ProcessQuantity + "&"
+ "ShipperUnitsID=" + UpdatRow[c].UnitID + "&"
+ "QualityID=" + UpdatRow[c].QualityID + "&"
+ "Update=" + 1 + "&"
+ "ProcessFou=" + false,
function (data4) {
}
);
}
//删除
var delRow = $("#tbProcessGoodsList").datagrid('getChanges', 'deleted');
rowsCount = delRow.length;
for (var i = 0; i < rowsCount; i++) {
$.getJSON("/DingDanGuanL/UpdateProcessGoodsList?ProcessGoodsID=" + delRow[i].ProcessGoodsID + "&"
+ "GoodsID=" + delRow[i].GoodsID + "&"
+ "ProcessDetailID=" + data1 + "&"
+ "EffectOfStorage=" + delRow[i].EffectOfStorage + "&"
+ "SelectQuantity=" + delRow[i].SelectQuantity + "&"
+ "ProcessQuantity=" + 0 + "&"
+ "ShipperUnitsID=" + delRow[i].UnitID + "&"
+ "QualityID=" + delRow[i].QualityID + "&"
+ "Update=" + 3 + "&"
+ "ProcessFou=" + true,
function (data5) {
}
);
}
//新增
var insRow = $("#tbProcessGoodsList").datagrid('getChanges', 'inserted');
rowsCount = insRow.length;
for (var j = 0; j < rowsCount; j++) {
$.getJSON("/DingDanGuanL/UpdateProcessGoodsList?ProcessGoodsID=" + 0 + "&"
+ "GoodsID=" + insRow[j].GoodsID + "&"
+ "ProcessDetailID=" + data1 + "&"
+ "EffectOfStorage=" + insRow[j].EffectOfStorage + "&"
+ "SelectQuantity=" + insRow[j].SelectQuantity + "&"
+ "ProcessQuantity=" + 0 + "&"
+ "ShipperUnitsID=" + insRow[j].UnitID + "&"
+ "QualityID=" + insRow[j].QualityID + "&"
+ "Update=" + 2 + "&"
+ "ProcessFou=" + true,
function (data6) {
}
);
}
var UpdatRow = $("#tbProcessGoodsList").datagrid('getChanges', 'updated');
rowsCount = UpdatRow.length;
for (var k = 0; k < rowsCount; k++) {
$.getJSON("/DingDanGuanL/UpdateProcessGoodsList?ProcessGoodsID=" + UpdatRow[k].ProcessGoodsID + "&"
+ "GoodsID=" + UpdatRow[k].GoodsID + "&"
+ "ProcessDetailID=" + data1 + "&"
+ "EffectOfStorage=" + UpdatRow[k].EffectOfStorage + "&"
+ "SelectQuantity=" + UpdatRow[k].SelectQuantity + "&"
+ "ProcessQuantity=" + 0 + "&"
+ "ShipperUnitsID=" + UpdatRow[k].UnitID + "&"
+ "QualityID=" + UpdatRow[k].QualityID + "&"
+ "Update=" + 1 + "&"
+ "ProcessFou=" + true,
function (data7) {
}
);
}
});
if (data > 0) {
alert("修改成功");
setTimeout(function () {
window.location.href = "/DingDanGuanL/KuNeiJiaGong";
}, 1000);
SelectJiaGongXinXi();
} else {
alert("修改失败");
}
});
}
}
4. 删除
删除界面如下
2.5.1.5(图10)
JavaScript代码:
//删除库内加工信息
function Delete() {
var ROW = $("#tbProcessOrderForGoodsInformationList").datagrid('getSelected');
var ProcessInformationID = ROW.ProcessInformationID;
var ProcessDetailID = ROW.ProcessDetailID;
if (confirm("是否删除")) {
//getSelected 是获取你要删除的那一行
//先删除明细,再删除订单
//库内加工货品信息
$.getJSON("/DingDanGuanL/DeleteProcessOrderForGoodsInformationList?ProcessInformationID=" + ProcessInformationID,
function (data) {
//库内加工明细信息
$.getJSON("/DingDanGuanL/DeleteProcessOrderForGoodsDetailList?ProcessInformationID=" + ProcessInformationID,
function (data1) {
//库内加工订单信息
$.getJSON("/DingDanGuanL/DeleteProcessGoodsList?ProcessDetailID=" + ProcessDetailID,
function (data2) {
});
});
if (data > 0) {
alert("删除成功");
SelectJiaGongXinXi();
}
});
}
}
5.设计时间(产生单号)
//设计时间格式
function SheJuDanHao() {
var i = new Date();//新建一个日期
var s = i.getHours();//获取是
var f = i.getMinutes();//获取分
var o = i.getSeconds();//获取秒
var y = i.getFullYear();//获取年
var m = i.getMonth() + 1;//获取月
var d = i.getDate();//获取天
var DanHao = y + "-" + (m < 10 ? ('0' + m) : m) + "-" + (d < 10 ? ('0' + d) : d) + " "
+ (s < 10 ? ('0' + s) : s) + ":" + (f < 10 ? ('0' + f) : f) + ":" + (o < 10 ? ('0' + o) : o);
//用三步运算符计算日期
$("#datReleasetime").datebox('setValue',DanHao)
}
仅供学习,禁止用于商业用途