一、仓储管理
1.1库存冻结
界面
1.1图1
用户选择【仓储管理】-》【库存冻结】-》【库存冻结表】系统会显示当前被冻结的货品列表,其中包括增删查改等基本功能
数据库表关系图
表1.冻结表(SYS_FreezeTable)
列名 |
数据类型 |
主键/外键 |
说明 |
FreezeID |
int |
主键 |
冻结ID |
FreezeCoding |
nchar(20) |
|
冻结编码 |
FreezeTypeID |
int |
外键 |
冻结类型ID |
FreezeExecuteTime |
datetime |
|
冻结执行时间 |
Batch |
nchar(10) |
|
批次 |
GoodsID |
int |
外键 |
货品ID |
FreezeNo |
bit |
|
冻结否 |
FreezeStateID |
int |
外键 |
冻结状态ID |
表2.货品表(SYS_GoodsTable)
列名 |
数据类型 |
主键/外键 |
说明 |
GoodsID |
int |
主键 |
货品ID |
GoodsCoding |
nchar(30) |
|
货品编码 |
GoodsName |
nchar(30) |
|
货品名称 |
Standard |
nchar(30) |
|
规格 |
Weight |
decimal(18, 2) |
|
重量 |
UnitID |
int |
外键 |
单位ID |
ClientID |
int |
外键 |
客户ID |
ClientGoodsCoding |
nchar(30) |
|
客户货品编码 |
BarCode |
nchar(30) |
|
条形码 |
SpellCode |
nchar(30) |
|
拼音码 |
GoodsCategoryID |
int |
外键 |
货品类别ID |
Model |
nchar(30) |
|
型号 |
Manufacturer |
nchar(30) |
|
生产厂家 |
GoodsTypeID |
int |
外键 |
货品类型ID |
GoodsSonTypeID |
int |
外键 |
货品子类型ID |
Length |
decimal(18, 2) |
|
长度 |
Width |
decimal(18, 2) |
|
宽度 |
Height |
decimal(18, 2) |
|
高度 |
SizeUnitID |
int |
外键 |
尺寸单位ID |
SKUPackingUnitID |
int |
外键 |
SKU包装单位ID |
ShelfLife |
nchar(30) |
|
保质期 |
HighSize |
nchar(10) |
|
码高 |
BearWeight |
decimal(18, 2) |
|
承重 |
QualityID |
int |
外键 |
质量ID |
WeightUnitID |
int |
外键 |
重量单位ID |
UnitPrice |
decimal(18, 2) |
|
单价 |
StorageEnvironmentID |
int |
外键 |
存储环境ID |
GoodsPropertyID |
int |
外键 |
货品属性ID |
PollutePropertyID |
int |
外键 |
污染属性ID |
PreventPollutePropertyID |
int |
外键 |
防止污染属性ID |
StateID |
int |
外键 |
状态ID |
Note |
nchar(100) |
|
备注 |
MonitoringNo |
bit |
|
监控否 |
控制器代码
#region 查询全部
public ActionResult ChaXunAllKuCun()
{
var dtKuCunDongJie = from tbKuCunDongJie in myEF.SYS_FreezeTable
join tbHuoPin in myEF.SYS_GoodsTable on tbKuCunDongJie.GoodsID equals tbHuoPin.GoodsID
join tbHuoPinLeiXing in myEF.SYS_AttributeDetailedTable on tbHuoPin.GoodsTypeID equals tbHuoPinLeiXing.AttributeDetailedID
join tbHuoPinZiLeiXing in myEF.SYS_AttributeDetailedTable on tbHuoPin.GoodsSonTypeID equals tbHuoPinZiLeiXing.AttributeDetailedID
join tbDongJieLeiXing in myEF.SYS_AttributeDetailedTable on tbKuCunDongJie.FreezeTypeID equals tbDongJieLeiXing.AttributeDetailedID
select new
{
冻结ID = tbKuCunDongJie.FreezeID,
冻结编码 = tbKuCunDongJie.FreezeCoding,
冻结执行时间 = tbKuCunDongJie.FreezeExecuteTime,
批次 = tbKuCunDongJie.Batch,
冻结否 = tbKuCunDongJie.FreezeNo,
货品ID = tbHuoPin.GoodsID,
货品编码 = tbHuoPin.GoodsCoding,
//货品名称 = tbHuoPin.GoodsName,
货品类型ID = tbHuoPin.GoodsTypeID,
货品类型 = tbHuoPinLeiXing.AttributeDetailedName,
货品子类型ID = tbHuoPin.GoodsSonTypeID,
货品子类型 = tbHuoPinZiLeiXing.AttributeDetailedName,
冻结类型ID = tbKuCunDongJie.FreezeTypeID,
冻结类型 = tbDongJieLeiXing.AttributeDetailedName,
};
List<Dictionary<string, object>> ListReturn = new List<Dictionary<string, object>>();
foreach (var item in dtKuCunDongJie)
{
Dictionary<string, object> itemKuCunDongJie = new Dictionary<string, object>();
//遍历反射方式获取属性名和属性值
foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties())
{
itemKuCunDongJie.Add(p.Name, p.GetValue(item, null));
}
string shijian = item.冻结执行时间.ToString();
itemKuCunDongJie.Add("冻结执行时间1", shijian);
ListReturn.Add(itemKuCunDongJie);
}
return Json(ListReturn, JsonRequestBehavior.AllowGet);
}
#endregion
</pre></p><p></p><pre class="csharp" name="code"><pre class="javascript" name="code">Jquery代码
<script type="text/javascript">
var BangDing = 0;
$(document).ready(function () {
$.getJSON("/KuCunDongJie/ChaXunAllKuCun",
function (data) {
$('#tb库存冻结').datagrid("loadData", data);
BangDing++;
});
});
</script>
<span style="font-family:宋体;font-size:14px;">
</span><p style="margin: 0cm 0cm 10pt;"><span lang="EN-US" style="font-family: 宋体; font-size: 14pt; mso-ascii-theme-font: major-fareast; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-fareast;">Html</span><span style="font-family: 宋体; font-size: 14pt; mso-ascii-theme-font: major-fareast; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-fareast;">代码段</span></p><span style="font-family:宋体;font-size:14px;">
</span><pre class="html" name="code"> <table class="easyui-datagrid" id="tb库存冻结" style="width:auto; height:auto;">
<thead>
<tr>
<th data-options="field:'ck',checkbox:true"></th>
<th data-options="field:'冻结ID',width:100,hidden:true">冻结ID</th>
<th data-options="field:'冻结编码',width:100,align:'center'">冻结编码</th>
<th data-options="field:'冻结类型',width:100,align:'center'">冻结类型</th>
<th data-options="field:'冻结执行时间1',width:100,align:'center'">冻结执行时间</th>
<th data-options="field:'批次',width:100,align:'center'">批次</th>
<th data-options="field:'冻结否',width:100,align:'center'">冻结否</th>
<th data-options="field:'货品编码',width:100,align:'center'">货品编码</th>
<th data-options="field:'货品类型',width:100,align:'center'">货品类型</th>
<th data-options="field:'货品子类型',width:100,align:'center'">货品子类型</th>
</tr>
</thead>
</table>
1.2库存解冻
界面视图
【操作】是对未解冻的库存进行解冻,通过查询把根据冻结编码查出的数据进行解冻
解冻界面
修改冻结状态和冻结否,点击确定进行保存,解冻完成。
控制器代码
#region 库存解冻
public ActionResult KuCunJieDong(int DongJie1ID)
{
Session["DongJieID1"] = Convert.ToInt32(DongJie1ID);
return View();
}
//绑定冻结表数据
public ActionResult ChaXunById1(int DongJie1ID)
{
var dtKuCunJieDong = from tbKuCunJieDong in myEF.SYS_FreezeTable
join tbHuoPin in myEF.SYS_GoodsTable on tbKuCunJieDong.GoodsID equals tbHuoPin.GoodsID
join tbHuoPinLeiXing in myEF.SYS_AttributeDetailedTable on tbHuoPin.GoodsTypeID equals tbHuoPinLeiXing.AttributeDetailedID
join tbHuoPinZiLeiXing in myEF.SYS_AttributeDetailedTable on tbHuoPin.GoodsSonTypeID equals tbHuoPinZiLeiXing.AttributeDetailedID
join tbDongJieLeiXing in myEF.SYS_AttributeDetailedTable on tbKuCunJieDong.FreezeTypeID equals tbDongJieLeiXing.AttributeDetailedID
join tbDongJieZhuangTai in myEF.SYS_AttributeDetailedTable on tbKuCunJieDong.FreezeStateID equals tbDongJieZhuangTai.AttributeDetailedID
join tbKeHu in myEF.SYS_ClientTable on tbHuoPin.ClientID equals tbKeHu.ClientID
where tbKuCunJieDong.FreezeID == DongJie1ID
select new
{
冻结ID = tbKuCunJieDong.FreezeID,
冻结编码 = tbKuCunJieDong.FreezeCoding,
冻结类型ID = tbKuCunJieDong.FreezeTypeID,
冻结类型 = tbDongJieLeiXing.AttributeDetailedName,
冻结状态ID = tbKuCunJieDong.FreezeStateID,
冻结状态 = tbDongJieZhuangTai.AttributeDetailedName,
客户ID = tbKeHu.ClientID,
客户码 = tbKeHu.ClientCode,
货品ID = tbHuoPin.GoodsID,
货品编码 = tbHuoPin.GoodsCoding,
货品类型ID = tbHuoPin.GoodsTypeID,
货品类型 = tbHuoPinLeiXing.AttributeDetailedName,
货品子类型ID = tbHuoPin.GoodsSonTypeID,
货品子类型 = tbHuoPinZiLeiXing.AttributeDetailedName,
冻结否 = tbKuCunJieDong.FreezeNo,
};
List<Dictionary<string, object>> ListReturn = new List<Dictionary<string, object>>();
foreach (var item in dtKuCunJieDong)
{
Dictionary<string, object> itemKuCunJieDong = new Dictionary<string, object>();
//遍历反射方式获取属性名和属性值
foreach (System.Reflection.PropertyInfo p in item.GetType().GetProperties())
{
itemKuCunJieDong.Add(p.Name, p.GetValue(item, null));
}
if (item.冻结否 == true)
{
itemKuCunJieDong.Add("DongJieFou", "true");
}
else
{
itemKuCunJieDong.Add("DongJieFou", "false");
}
ListReturn.Add(itemKuCunJieDong);
}
return Json(ListReturn, JsonRequestBehavior.AllowGet);
}
//对未解冻的货品进行解冻
public ActionResult JieDongKuDong(string DongJieZhuangTaiID,string DongJieFou)
{
int intWuLiaoID = Convert.ToInt32(Session["DongJieID1"]);
var mySYS_FreezeTable = (from tb in myEF.SYS_FreezeTable where tb.FreezeID == intWuLiaoID select tb).Single<Models.SYS_FreezeTable>();
mySYS_FreezeTable.FreezeStateID = Convert.ToInt32(DongJieZhuangTaiID);
mySYS_FreezeTable.FreezeNo = Convert.ToBoolean(DongJieFou);
int i = myEF.SaveChanges();
if (i > 0)
{
return Json("false", JsonRequestBehavior.AllowGet);
}
else
{
return Json("true", JsonRequestBehavior.AllowGet);
}
}
#endregion
</pre></p><p></p><span style="font-family:宋体;font-size:14px;"></span><p style="margin: 0cm 0cm 10pt;"><span lang="EN-US" style="font-family: 宋体; font-size: 14pt; mso-ascii-theme-font: major-fareast; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-fareast;">Jquery</span><span style="font-family: 宋体; font-size: 14pt; mso-ascii-theme-font: major-fareast; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-fareast;">代码</span></p><span style="font-family:宋体;font-size:14px;"></span><pre class="javascript" name="code"> //绑定冻结表数据
function BangDingKuCun() {
$.getJSON("/KuCunDongJie/ChaXunById1?DongJie1ID="+@Session["DongJieID1"],
function(data){
$('#txtDongJieBianMa').attr('value',data[0].冻结编码);
$('#cboDongJieLeiXing').combobox('setValue',data[0].冻结类型ID);
$('#cboDongJieZhuangTai').combobox('setValue',data[0].冻结状态ID);
KuHuID=data[0].客户ID;
$('#txtKeHuMa').attr('value',data[0].客户码);
HuoPinID=data[0].货品ID;
$('#txtHuoPinBianMa').attr('value',data[0].货品编码);
$('#txtHuoPinLeiXing').attr('value',data[0].货品类型);
$('#txtHuoPinZiLeiXing').attr('value',data[0].货品子类型);
$('#cboDongJieFou').combobox('setValue',data[0].DongJieFou);
} );
}
//对未解冻的货品进行解冻
function JieDong(){
if(confirm('是否解冻?')){
$.getJSON("/KuCunDongJie/JieDongKuDong?DongJieZhuangTaiID="+$('#cboDongJieZhuangTai').combobox('getValue')+"&"
+"DongJieFou="+$('#cboDongJieFou').combobox('getValue')+"&",
function(data){
if(data="false"){
alert("解冻成功");
window.location.href="/KuCunDongJie/KuCunDongJie";
}
else{
alert("已解冻");
}
} );
}
Html代码段
<div title="库存解冻" style="padding:10px; width:auto; height:300px; border-style:none;">
<table>
<tr>
<td align="right"><strong style="font-size: medium" >冻结编码:</strong><input type="text" id="txtDongJieBianMa" style="width:300px; height:30px;border-width: thin; border-style: none none outset none" /></td>
<td align="right"><strong style="font-size: medium" >冻结类型:</strong><input class="easyui-combobox" id="cboDongJieLeiXing" style="width:300px; height:30px;border-width: thin; border-style: none none outset none" /></td>
</tr>
<tr>
<td align="right"><strong style="font-size: medium" >冻结状态:</strong><input class="easyui-combobox" id="cboDongJieZhuangTai" style="width:300px; height:30px;border-width: thin; border-style: none none outset none" /></td>
<td align="right"><strong style="font-size: medium" >客户码:</strong><input type="text" id="txtKeHuMa" onclick="getKeHu()" style="width:300px; height:30px;border-width: thin; border-style: none none outset none" /></td>
</tr>
<tr>
<td align="right"><strong style="font-size: medium" >货品类型:</strong><input type="text" onclick="getHuoPin()" id="txtHuoPinLeiXing" style="width:300px; height:30px;border-width: thin; border-style: none none outset none" /></td>
<td align="right"><strong style="font-size: medium" >货品子类型:</strong><input type="text" onclick="getHuoPin()" id="txtHuoPinZiLeiXing" style="width:300px; height:30px;border-width: thin; border-style: none none outset none" /></td>
</tr>
<tr>
<td align="right"><strong style="font-size: medium" >货品编码:</strong><input id="txtHuoPinBianMa" onclick="getHuoPin()" style="width:300px; height:30px;border-width: thin; border-style: none none outset none" /></td>
<td align="right"><strong style="font-size:medium" >冻结否:</strong><select class="easyui-combobox" id="cboDongJieFou" style="width:300px; height:30px;border-width: thin; border-style: none none outset none;">
<option value="true">true</option>
<option value="false">false</option>
</select></td>
</tr>
<tr>
<td style="height:50px" colspan=4 align="center">
<a id="btnJieDong" onclick="JieDong()" class="easyui-linkbutton" data-options="iconCls:'icon-解冻'">确定</a>
<a onclick="TianJiaGuanBi()" class="easyui-linkbutton" data-options="iconCls:'icon-back'">退出</a>
</td>
</tr>
</table>
</div>
</pre><p><span style="font-family:宋体;font-size:14px;"></span></p><span lang="EN-US" style="font-family:宋体;font-size: 14pt;"><span lang="EN-US" style="font-family:新宋体;color:green;font-size: 12pt;"></span></span><p style="margin: 0cm 0cm 10pt;"></p><pre class="javascript" name="code">