大型商贸系统(进货管理)技术解析(十)查询返厂单
功能介绍:
查询返厂单是为客户提供了对返厂单录入的查询,可以通过条件查询,如:记录编号,合同号,退货原因,审核否等功能的操作,从而能够根据需要快速查询的实现功能
界面效果图:
3. 该界面中所用到的表与表之间的关系图
表1:返厂表(Return_factory)
用于存放返厂表的信息
列名 | 数据类型 | 主键/外键 | 说明 |
Return_factory_id | int | 主键 | 返厂id |
Contract_id | int | 外键 | 合同id |
Repertory_place_id | int | 外键 | 仓库地点 |
Goods_return_reasonpubid | int | 外键 | 退货原因 |
Solution | nchar(100) |
| 解决方法 |
Consignee_id | int | 外键 | 收货人(经收人) |
Record_number | nchar(20) |
| 记录编号 |
Registrant_id | int | 外键 | 登记者 |
Register_time | datetime |
| 登记时间 |
Auditor_id | int | 外键 | 审核人 |
Review_time | datetime |
| 审核时间 |
Return_factory_Number | Nchar(20) |
| 返仓号 |
Review_deny | Bit |
| 审核否 |
表2:返厂明细表(Return_factory_detail)
用于存放返厂明细信息
列名 | 数据类型 | 主键/外键 | 说明 |
Return_factory_detail_id | int | 主键 | 返厂明细id |
Return_factory_id | int | 外键 | 返厂id |
Goods_id | int | 外键 | 商品id |
Goods_quantity_recede | int |
| 退货数量 |
Repertory_place_recede_id | int |
| 退货仓库地点 |
表3:返厂批次表(Return_Pacth)
用于存放返厂批次表信息
列名 | 数据类型 | 主键/外键 | 说明 |
ReturnPacthid | int | 主键 | 返厂批次id |
Return_factory_detail_id | int | 外键 | 返厂明细id |
StockPacthNumber | Nchar(20) |
| 库存批次数 |
Goods_id | int | 外键 | 商品id |
RuternQuary | int |
| 返厂数量 |
Stock_id | int | 外键 | 库存id |
功能实现:
1. 实现“查询返厂单”操作的界面效果图
2. 实现该界面效果的代码
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>查询返厂单</title>
<script src="../../Content/jquery-easyui-1.3.3/jquery.min.js"></script>
<script src="../../Content/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
<script src="../../Content/jquery-easyui-1.3.3/easyloader.js"></script>
<link href="../../Content/jquery-easyui-1.3.3/themes/icon.css" rel="stylesheet" />
<link href="../../Content/jquery-easyui-1.3.3/demo/demo.css" rel="stylesheet" />
<link href="../../Content/jquery-easyui-1.3.3/themes/default/easyui.css" rel="stylesheet" />
<link href="../../Content/MyYanShi.css" rel="stylesheet" />
<link href="../../Content/MyCSS/PublicCSS.css" rel="stylesheet" />
<link href="../../Content/yxsss/js_css/yu.css" rel="stylesheet" />
<script src="../../Content/yxsss/js_css/yu.js"></script>
<style type="text/css">
body { text-align: center; font-size: 20px; }
input { margin-top: 1px; margin-left: 5px; margin-right: 5px; font-size: 15px; }
button { height: 24px; font-size: 20px; margin: 1px 3px 1px 3px; }
.table_cell { padding: 2px 4px; border-top: 2px #c0c0c0; border-left: 3px #c0c0c0; border-right: 1px rgb(220, 252, 252); border-bottom: 1px rgb(198, 250, 250); border-style: solid solid ridge solid; margin: 1px 2px; }
</style>
<body>
<div class="easyui-window" title="" id="wTuiHuoDan" style="display: none; text-align: center; border-spacing: 0; padding: 0; border: 0 solid white; height: 600px;"
data-options="fit:true,collapsible:false,minimizable:false,maximizable:false,closable:false,draggable:false,resizable:false,shadow:false,modal:true,center:true">
<div data-options="resizable:false,minimizable:false,collapsible:false,maximizable:false,fit:true" style="background: #e0ffff; color: #000000; font-size: 18px; text-align: center; padding: 5px">
<span style="float: right">
<img οnclick="parent.fanChang();" id="dimg" src="../../Content/image/delete.png" /></span>
查询返厂单
</div>
<fieldset style="padding: 5px; border: 1px solid #ccc; width: 250px; height: 260px; float: left; margin-bottom: 0;">
<legend>查询条件</legend>
<table>
<tr>
<td>
<button type="button" style=" font-size: 15px; height: 20px; border-style: inset; border-width: 2px;">记录编号</button></td>
<td>
<input id="txtRecord_number" style="border-width: 1px; width: 150px; font-size: 20px; height: 20px" /></td>
</tr>
<tr>
<td>
<button type="button" style=" font-size: 15px; height: 20px; border-style: inset; border-width: 2px;">合同号</button></td>
<td>
<input id="txtContractNumber" style="border-width: 1px; width: 150px; font-size: 20px; height: 20px" /></td>
</tr>
<tr>
<td>退货原因:</td>
<td>
<input class="easyui-combobox" id="cboReturnGoos" style="width: 150px; font-size: 35px;" data-options="url:'/ShangPinFanChang/SelectTuiHuoYuanYin',valueField:'TuiHuoYuanYinid',textField:'TuiHuoYuanYin', panelHeight:100" /></td>
</tr>
<tr>
<td>审核否:<input id="Review_deny" type="checkbox" style="width: 50px; line-height: 40px; color: #0000FF; font-size: 17px;" /></td>
</tr>
<tr>
<td></td>
<td>
<button οnclick="SelectAllReturnFactory();" id="Select" style="margin-left: 160px">
<img src="../../Content/image/2012092109942.png" />查询</button></td>
</tr>
</table>
</fieldset>
<div id="WReturnFactory" style="border: 1px solid #cccccc; height: 270px; margin-left: 200px">
<table title="返厂单信息" id="tbReturnFactory" class="easyui-datagrid" data-options="rownumbers:true,pagination:true,striped:true,singleSelect:true,fit:true,onClickRow:onClickReturnFactory">
<thead>
<tr>
<th data-options="field:'Return_factory_id',hidden:true,width:80,align:'center'">返厂id</th>
<th data-options="field:'Agreement_id',hidden:true,width:80,align:'center'">合同ID</th>
<th data-options="field:'Review_deny',width:80,align:'center'"><span class="table_cell">审核否</span></th>
<th data-options="field:'ShenHeRen',width:80,align:'center'"><span class="table_cell">审核人</span></th>
<th data-options="field:'Review_time',width:120,align:'center'"><span class="table_cell">审核时间</span></th>
<th data-options="field:'Record_number',width:120,align:'center'"><span class="table_cell">记录编号</span></th>
<th data-options="field:'Chinese',width:80,align:'center'"><span class="table_cell">供应单位</span></th>
<th data-options="field:'ReturnDeparment',width:80,align:'center'"><span class="table_cell">退货部门</span></th>
<th data-options="field:'Contract_number',width:80,align:'center'"><span class="table_cell">合同号</span></th>
<th data-options="field:'Repertory_place_name',width:80,align:'center'"><span class="table_cell">库存地点</span></th>
<th data-options="field:'heSuanFangShi',width:80,align:'center'"><span class="table_cell">核算方式</span></th>
<th data-options="field:'TuiHuoYuanYin',width:80,align:'center'"><span class="table_cell">退货原因</span></th>
<th data-options="field:'Solution',hidden:true,width:80,align:'center'"><span class="table_cell">解决方案</span></th>
<th data-options="field:'dengjiren',width:80,align:'center'"><span class="table_cell">登记人</span></th>
<th data-options="field:'Register_time',width:120,align:'center'"><span class="table_cell">登记时间</span></th>
<th data-options="field:'Number',width:80,align:'center'"><span class="table_cell">附件张数</span></th>
<th data-options="field:'Return_factory_Number',width:80,align:'center'"><span class="table_cell">同返仓单</span></th>
</tr>
</thead>
</table>
</div>
<div style="text-align: left; height: 240px; margin: 0;" data-options="fit:true">
<div style="width: 50%; height: 290px; float: left; clear: left;">
<table id="tbGoodsBatchInformation" title="商品批次信息" class="easyui-datagrid" style="height: 256px; border: 1px solid #dc143c">
<thead>
<tr>
<th data-options=" field:'Stock_id',hidden:true,width:15,align:'center'">库存id</th>
<th data-options=" field:'ReturnPacthid',hidden:true,width:15,align:'center'">返厂批次id</th>
<th data-options="field:'pacth',width:80,align:'center'"><span class="table_cell">库存批次号</span></th>
<th data-options="field:'NoTax_inclusive_price',width:80,align:'center'"><span class="table_cell">不含税进价</span></th>
<th data-options="field:'Tax_inclusive_price',width:80,align:'center'"><span class="table_cell">含税进价</span></th>
<th data-options="field:'Returnquary1',width:80,align:'center'"><span class="table_cell">退货数量</span></th>
<th data-options="field:'jieCunShu1',width:80,align:'center'"><span class="table_cell">结存数</span></th>
<th data-options="field:'TuiHuoJinE1',width:80,align:'center'"><span class="table_cell">退货金额</span></th>
<th data-options="field:'Stock_quantity',width:80,align:'center'"><span class="table_cell">库存数量</span></th>
</tr>
</thead>
</table>
</div>
<div style="margin-left: 50%; height: 290px; border:1px solid #000000">
<table id="tbReturnFactoryDetailInformation" title="返厂明细信息" class="easyui-datagrid" style="height: 256px;">
<thead>
<tr>
<th data-options=" field:'Return_factory_detail_id',hidden:true,width:15,align:'center',@*formatter:JianTou*@"></th>
<th data-options="field:'Goods_code',width:80,align:'center'"><span class="table_cell">商品代码</span></th>
<th data-options="field:'Goods_bar_code',width:80,align:'center'"><span class="table_cell">条形码</span></th>
<th data-options="field:'Goods_name',width:80,align:'center'"><span class="table_cell">商品名称</span></th>
<th data-options="field:'Goods_quantity_recede',width:80,align:'center'"><span class="table_cell">退货细数</span></th>
<th data-options="field:'Stock_quantity',width:80,align:'center'"><span class="table_cell">库存数量</span></th>
<th data-options="field:'Return_factory_detail_id',hidden:true,"></th>
<th data-options="field:'noHaiShuiJinE',hidden:true,"></th>
<th data-options="field:'shuijin',hidden:true,"></th>
<th data-options="field:'JiaShuiHeJi',hidden:true,"></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</body>
</html>
3. 对“退货原因”下拉框功能的实现
效果图:
3.1实现该功能的界面层操作
3.2实现该功能的控制器中代码
#region 绑定退货原因下拉框<pre name="code" class="sql">--绑定退货原因下拉框
if(@NB='SelectTuiHuoYuanYin')
begin
SELECT Attribute_gather_detail_id as TuiHuoYuanYinid, Attribute_gather_detail_name as TuiHuoYuanYin
FROM Attribute_gather_detail
where Attribute_gather_id=32
end
public ActionResult SelectTuiHuoYuanYin() { DataTable dt = _myReturnFactory.SelectTuiHuoYuanYin(); List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt); return Json(listReturn, JsonRequestBehavior.AllowGet); } #endregion
3.4 实现该功能的逻辑层代码
#region 绑定退货原因下拉框
public DataTable SelectTuiHuoYuanYin()
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
};
sql[0].Value = "SelectTuiHuoYuanYin";
DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
return dt;
}
#endregion
3.5实现该功能的存储过程
--绑定退货原因下拉框
if(@NB='SelectTuiHuoYuanYin')
begin
SELECT Attribute_gather_detail_id as TuiHuoYuanYinid, Attribute_gather_detail_name as TuiHuoYuanYin
FROM Attribute_gather_detail
where Attribute_gather_id=32
end
4.对DGV中列隐藏的情况的表现
效果图:
4.1实现此功能的JavaScript代码
function SelectAllReturnFactory() {
//对审核否复选框的获取
var reviewDeny = document.getElementById("Review_deny").checked;
if (!reviewDeny) {
//列的隐藏
$("#tbReturnFactory").datagrid('hideColumn', 'ShenHeRen');
$("#tbReturnFactory").datagrid('hideColumn', 'Review_time');
} else {
//列的显示
$("#tbReturnFactory").datagrid('showColumn', 'ShenHeRen');
$("#tbReturnFactory").datagrid('showColumn', 'Review_time');
}
5.对查询返厂单的功能操作代码
5.1实现此功能的在JavaScript里的代码
<script type="text/javascript">
$(document).ready(function () {
$("#wTuiHuoDan").show(1000);
});
function SelectAllReturnFactory() {
//对审核否复选框的获取
var reviewDeny = document.getElementById("Review_deny").checked;
if (!reviewDeny) {
//列的隐藏
$("#tbReturnFactory").datagrid('hideColumn', 'ShenHeRen');
$("#tbReturnFactory").datagrid('hideColumn', 'Review_time');
} else {
//列的显示
$("#tbReturnFactory").datagrid('showColumn', 'ShenHeRen');
$("#tbReturnFactory").datagrid('showColumn', 'Review_time');
}
var jiLuBianHao = $('#txtRecord_number').val();
var heTongHao = $('#txtContractNumber').val();
var tuiHuoYuanYin = $('#cboReturnGoos').combobox('getValue');
$.getJSON("/SelectAllReturnFactory/SelectReturnFactoryInformationsByTerm?" +
"recordNumber=" + jiLuBianHao + "&" +
"contractNumber=" + heTongHao + "&" +
"tuiHuoYuanYin=" + tuiHuoYuanYin + "&" +
"reviewDeny=" + reviewDeny, function (data) {
if (data != "") {
$('#tbReturnFactory').datagrid({ loadFilter: pagerFilter }).datagrid("loadData", data);
} else {
$("#tbReturnFactory").datagrid('loadData', { total: 0, rows: [] });
$("#tbReturnFactoryDetailInformation").datagrid('loadData', { toal: 0, rows: [] });
$("#tbGoodsBatchInformation").datagrid('loadData', { toal: 0, rows: [] });
$('#txtRecord_number').val("");
$('#txtContractNumber').val("");
$('#cboReturnGoos').combobox(clear);
}
});
function pagerFilter(data) {
if (typeof data.length == 'number' && typeof data.splice == 'function') { // is array
data = {
total: data.length,
rows: data
}
}
var dg = $(this);
var opts = dg.datagrid('options');
var pager = dg.datagrid('getPager');
pager.pagination({
onSelectPage: function (pageNum, pageSize) {
opts.pageNumber = pageNum;
opts.pageSize = pageSize;
pager.pagination('refresh', {
pageNumber: pageNum,
pageSize: pageSize
});
dg.datagrid('loadData', data);
}
});
if (!data.originalRows) {
data.originalRows = (data.rows);
}
var start = (opts.pageNumber - 1) * parseInt(opts.pageSize);
var end = start + parseInt(opts.pageSize);
data.rows = (data.originalRows.slice(start, end));
return data;
}
}
//绑定返厂明细,商品批次信息
var returnFactoryId = 0;
function onClickReturnFactory(rowIndex, rowData) {
returnFactoryId = rowData.Return_factory_id;
$.getJSON("/SelectAllReturnFactory/BingDingReturnFactoryDeatil?returnFactoryId=" + returnFactoryId,
function (data) {
$('#tbReturnFactoryDetailInformation').datagrid('loadData', data);
var returnFactoryDetailId = data[0].Return_factory_detail_id;
$.getJSON("/SelectAllReturnFactory/BingDingPacthInformactions?returnFactoryDetailId=" + returnFactoryDetailId, function (data1) {
$('#tbGoodsBatchInformation').datagrid('loadData', data1);
});
});
}
</script>
5.2实现此功能的控制器代码
using System.Collections.Generic;
using System.Web.Mvc;
using System.Data;
using BLL商品进仓单;
namespace 大型商贸系统.Controllers
{
public class SelectAllReturnFactoryController : Controller
{
//
// GET: /SelectAllReturnFactory/
readonly SelectReturnFactory _myReturnFactory = new SelectReturnFactory();
public ActionResult SelectAllReturnFactoryDan()
{
return View();
}
#region 不定条件查询返厂单
public ActionResult SelectReturnFactoryInformationsByTerm(string recordNumber, string contractNumber, string tuiHuoYuanYin, bool reviewDeny)
{
DataTable dt = _myReturnFactory.SelectReturnFactoryInformationsByTerm(
recordNumber,
contractNumber,
ConvertHelper.ConverToInt(tuiHuoYuanYin),
reviewDeny);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 绑定返厂明细
public ActionResult BingDingReturnFactoryDeatil(int returnFactoryId)
{
DataTable dt = _myReturnFactory.BingDingReturnFactoryDeatil(returnFactoryId);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 绑定批次信息
public ActionResult BingDingPacthInformactions(int returnFactoryDetailId)
{
DataTable dt = _myReturnFactory.BingDingPacthInformactions(returnFactoryDetailId);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
}
}
5.3实现此功能的逻辑层代码
using DALPublic;
using System.Data;
using System.Data.SqlClient;
namespace BLL商品进仓单
{
public class SelectReturnFactory
{
readonly DALMethod _myDalMethod = new DALMethod();
#region 不定条件查询返厂单
public DataTable SelectReturnFactoryInformationsByTerm(string recordNumber,
string contractNumber, int goodsReturnReasonpubid, bool reviewDeny)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Record_number", SqlDbType.Char),
new SqlParameter("@Contract_number", SqlDbType.Char),
new SqlParameter("@Goods_return_reasonpubid", SqlDbType.Int),
new SqlParameter("@reviewDeny", SqlDbType.Bit),
};
sql[0].Value = "SelectReturnFactoryInformationsByTerm";
sql[1].Value = recordNumber;
sql[2].Value = contractNumber;
sql[3].Value = goodsReturnReasonpubid;
sql[4].Value = reviewDeny;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("SelectAllReturnFactory", sql);
return dt;
}
#endregion
#region 绑定返厂明细
public DataTable BingDingReturnFactoryDeatil(int returnFactoryId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Return_factory_id", SqlDbType.Int),
};
sql[0].Value = "BingDingReturnFactoryDeatil";
sql[1].Value = returnFactoryId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("SelectAllReturnFactory", sql);
return dt;
}
#endregion
#region 绑定批次信息
public DataTable BingDingPacthInformactions(int returnFactoryDetailId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Return_factory_detail_id", SqlDbType.Int),
};
sql[0].Value = "BingDingPacthInformactions";
sql[1].Value = returnFactoryDetailId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("SelectAllReturnFactory", sql);
return dt;
}
#endregion
}
}
5.4实现此功能的存储过程
USE [大型商贸系统]
GO
/****** Object: StoredProcedure [dbo].[SelectAllReturnFactory] Script Date: 07/02/2015 10:46:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[SelectAllReturnFactory]
@NB char(200)='',@Record_number char(20)='',@Contract_number nchar(20)='',@Goods_return_reasonpubid int=0,
@reviewDeny bit=false,@Return_factory_id int=0,@Return_factory_detail_id int=0
AS
BEGIN
--不定条件查询
if(@NB='SelectReturnFactoryInformationsByTerm')
begin
declare @sql nvarchar(max)
if @reviewDeny = 'true'
begin
set @sql='SELECT Return_factory.Return_factory_id, Return_factory.Contract_id, Return_factory.Review_deny, Return_factory.Repertory_place_id, Repertory_place.Repertory_place_name,
Agreement.Contract_number, Attribute_gather_detail.Attribute_gather_detail_name AS TuiHuoYuanYin, Return_factory.Solution, Return_factory.Consignee_id, Return_factory.Record_number,
Eemployee.Employee_name AS dengjiren,CONVERT(varchar(20), Return_factory.Register_time, 120) AS Register_time, Eemployee_1.Employee_name AS ShenHeRen, CONVERT(varchar(20), Return_factory.Review_time, 120) AS Review_time, Return_factory.Return_factory_Number,
Return_factory.Number, Return_factory.Goods_return_reasonpubid, Enterprise_name.Chinese, Attribute_gather_detail_1.Attribute_gather_detail_name AS heSuanFangShi,
Department.Department_name AS ReturnDeparment
FROM Return_factory INNER JOIN
Repertory_place ON Return_factory.Repertory_place_id = Repertory_place.Repertory_place_id INNER JOIN
Agreement ON Return_factory.Contract_id = Agreement.Agreement_id INNER JOIN
Attribute_gather_detail ON Return_factory.Goods_return_reasonpubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
Eemployee ON Return_factory.Registrant_id = Eemployee.Employee_id INNER JOIN
Eemployee AS Eemployee_1 ON Return_factory.Auditor_id = Eemployee_1.Employee_id INNER JOIN
Supply_units ON Agreement.Supply_units_id = Supply_units.Supply_units_id INNER JOIN
Enterprise_name ON Supply_units.Enterprise_name_id = Enterprise_name.Enterprise_name_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_1 ON Agreement.Adjust_accounts_way_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
Department ON Agreement.Purchase_unit_id = Department.Department_id
where Return_factory.Review_deny=''true'''
if(@Record_number!='') set @sql=@sql+'and Record_number like''%'+RTRIM(@Record_number)+'%'''
if(@Contract_number!='')set @sql=@sql+'and Agreement.Contract_number like''%'+RTRIM(@Contract_number)+'%'''
if (@Goods_return_reasonpubid!='') set @sql=@sql+' and Goods_return_reasonpubid like''%'+RTRIM(CAST(@Goods_return_reasonpubid as int))+''''
exec(@sql)
end
else
begin
set @sql='SELECT Return_factory.Return_factory_id, Return_factory.Contract_id, Return_factory.Review_deny, Return_factory.Repertory_place_id, Repertory_place.Repertory_place_name,
Agreement.Contract_number, Attribute_gather_detail.Attribute_gather_detail_name AS TuiHuoYuanYin, Return_factory.Solution, Return_factory.Consignee_id, Return_factory.Record_number,
Eemployee.Employee_name AS dengjiren, CONVERT(varchar(20), Return_factory.Register_time,120) AS Register_time,Return_factory.Return_factory_Number, Return_factory.Number, Return_factory.Goods_return_reasonpubid,
Enterprise_name.Chinese, Attribute_gather_detail_1.Attribute_gather_detail_name AS heSuanFangShi, Department.Department_name AS ReturnDeparment
FROM Return_factory INNER JOIN
Repertory_place ON Return_factory.Repertory_place_id = Repertory_place.Repertory_place_id INNER JOIN
Agreement ON Return_factory.Contract_id = Agreement.Agreement_id INNER JOIN
Attribute_gather_detail ON Return_factory.Goods_return_reasonpubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
Eemployee ON Return_factory.Registrant_id = Eemployee.Employee_id INNER JOIN
Supply_units ON Agreement.Supply_units_id = Supply_units.Supply_units_id INNER JOIN
Enterprise_name ON Supply_units.Enterprise_name_id = Enterprise_name.Enterprise_name_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_1 ON Agreement.Adjust_accounts_way_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
Department ON Agreement.Purchase_unit_id = Department.Department_id
where Return_factory.Review_deny=''false'''
if(@Record_number!='') set @sql=@sql+'and Record_number like''%'+RTRIM(@Record_number)+'%'''
if(@Contract_number!='')set @sql=@sql+'and Agreement.Contract_number like''%'+RTRIM(@Contract_number)+'%'''
if (@Goods_return_reasonpubid!='') set @sql=@sql+' and Goods_return_reasonpubid like''%'+RTRIM(CAST(@Goods_return_reasonpubid as int))+''''
exec(@sql)
end
end
--绑定返厂明细
if(@NB='BingDingReturnFactoryDeatil')
begin
SELECT Return_factory_detail.Return_factory_id, Return_factory_detail.Goods_quantity_recede, Return_factory_detail.Repertory_place_recede_id, Return_factory_detail.Review_deny, Goods.Goods_code,
Goods.Goods_bar_code, Goods.Goods_name, Goods.Input_ratio, Goods.Purchase_bid AS NoTax_inclusive_price, Goods.Quality_content, SUM(Stock.Stock_quantity) AS Stock_quantity,
Return_factory_detail.Return_factory_detail_id, Goods.Purchase_bid * Return_factory_detail.Goods_quantity_recede AS noHaiShuiJinE,
Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5)) / 100) * Return_factory_detail.Goods_quantity_recede AS shuijin, Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5))
/ 100 + 1) * Return_factory_detail.Goods_quantity_recede AS JiaShuiHeJi, Goods.Goods_id, Goods.Agreement_id
FROM Stock INNER JOIN
Goods ON Stock.Goods_id = Goods.Goods_id INNER JOIN
Return_factory_detail ON Goods.Goods_id = Return_factory_detail.Goods_id
WHERE (Return_factory_detail.Return_factory_id = @Return_factory_id)
GROUP BY Return_factory_detail.Return_factory_id, Return_factory_detail.Goods_quantity_recede, Return_factory_detail.Repertory_place_recede_id, Return_factory_detail.Review_deny,
Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Input_ratio, Goods.Purchase_bid, Goods.Quality_content, Return_factory_detail.Return_factory_detail_id,
Goods.Goods_id, Goods.Agreement_id
end
--绑定批次信息
if(@NB='BingDingPacthInformactions')
begin
SELECT Return_Pacth.ReturnPacthid, Return_Pacth.Return_factory_detail_id, Return_Pacth.StockPacthNumber AS pacth, Return_Pacth.Goods_id, Goods.Input_ratio,
Goods.Purchase_bid AS NoTax_inclusive_price, Return_Pacth.RuternQuary AS Returnquary1, Return_Pacth.Stock_id, Stock.Stock_quantity,
Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5)) / 100 + 1) AS Tax_inclusive_price,
(Stock.Stock_quantity-Return_Pacth.RuternQuary )AS jieCunShu1,(Return_Pacth.RuternQuary*Goods.Purchase_bid)AS TuiHuoJinE1
FROM Return_Pacth INNER JOIN
Goods ON Return_Pacth.Goods_id = Goods.Goods_id INNER JOIN
Stock ON Return_Pacth.Stock_id = Stock.Stock_id
where Return_Pacth.Return_factory_detail_id=@Return_factory_detail_id
end
END
仅供初学者使用,禁止商业用途。
有的人一生默默无闻,有的人一生轰轰烈烈,甚至千古流芳,为什么会这样?因为默默无闻的人只是满足于现状,而不去想怎么轰轰烈烈过一生,不要求自己,去做,去行动,怎么能够成功?