大型商贸系统(进货管理)技术解析(九)返厂单处理

大型商贸系统(进货管理)技术解析(九)返厂单处理

功能介绍:

        商品返厂是对进货的商品货物的损坏,合同终止,供应商违约等原因,而导致要退货。通过添加选择进仓单信息,对退货单的录入,在解决方案中同时记录了经手人,批量选商品选择相应进仓单的商品信息及其批次信息,进行保存,修改,经过审核后其库存数减少从而实现了商品返厂的功能。

界面效果图:


                                                                                            

图1

1.    该界面所涉及到的表与表之间的关系图


表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:员工表(Eemployee)

用于记录员工信息

列名

数据类型

主键/外键

说明

Employee_id

int

主键

员工id

Employee_number

nchar(12)

 

员工编号

Employee_name

nchar(10)

 

员工名称

Department_id

int

外键

部门id

Duties_id

int

外键

职务id

Sex

int

外键

性别pubid

 

表4:仓库地点表(Repertory_place)

用于记录仓库地点信息

列名

数据类型

主键/外键

说明

Repertory_place_id

int

主键

仓库地点id

Responsible_person_id

int

外键

负责人id

Department_id

int

主键

部门id

Repertory_place_name

nchar(10)

 

仓库地点名称

Contact_way

nchar(10)

 

联系方式

Address

nchar(10)

 

地址

Effective_deny

nchar(10)

 

有效否

Remarks

nchar(10)

 

备注

Repertory_place_identifier

nchar(10)

 

仓库地点编号

 

表5:返厂批次表(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.    实现配货单录入的界面效果图


                                                 图1

2.    实现该配货单录入的界面代码

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>返厂单处理</title>
    <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/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>
    <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: 28px; 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 style="display: none">
        <div class="easyui-window" id="wSelectTuiHuoDanformations" title="查询未审退货单" style="width: 404px; height: 246px; top: 60px; left: 90px;" data-options="resizable:false,minimizable:false,collapsible:false,maximizable:false,closed:true">
            <table style="width: 390px; border: none; padding: 0; border-spacing: 0;">
                <tr>
                    <td style="vertical-align: middle">请输入要查询的记录编号:
                        <input type="text" id="strBlur1" οnkeyup="mohuiSelecTuiHuoDan()" style="width: 150px;" /></td>

                </tr>
            </table>
            <div class="easyui-panel" style="width: 390px; height: 180px; border: none">
                <table class="easyui-datagrid" id="tbSelectTuiHuoDanformations" style="width: 340px; border: none; border-spacing: 0;" data-options="fit:true,fitColumns:true,idField:'Return_factory_id',
            onClickRow:onTuiHuoDan,singleSelect:true,rownumbers:true,striped:true">
                    <thead>
                        <tr>
                            <th data-options="field:'Return_factory_id',hidden:true,width:90,align:'center'">退货单id</th>
                            <th data-options="field:'Repertory_place_id',width:80,hidden:true,align:'center'">仓库地点</th>
                            <th data-options="field:'Record_number',width:120,align:'center'">记录编号</th>
                            <th data-options="field:'ReturnDepartmentName',width:100,align:'center'">退货部门</th>
                            <th data-options="field:'Contract_number',width:80,align:'center'">合同号</th>
                            <th data-options="field:'Review_deny',width:80,align:'center'">审核否</th>

                        </tr>
                    </thead>
                </table>
            </div>
        </div>
        <div class="easyui-window" id="wconsigner" title="员工信息" style="width: 383px; height: 200px; top: 200px; left: 60px;" data-options="modal:true,closed:true,resizable:false,minimizable:false,
        collapsible:false,maximizable:false">
            <table class="easyui-datagrid" id="tbconsigner" data-options="idField:'Employee_id',fit:true,singleSelect:true,onClickRow:onClicktbconsigner">
                <thead>
                    <tr>
                        <th data-options="field:'Employee_number',width:80,align:'center'">编号</th>
                        <th data-options="field:'Employee_name',width:80,align:'center'">姓名</th>
                        <th data-options="field:'Sex',width:40,align:'center'">性别</th>
                        <th data-options="field:'Department_name',width:80,align:'center'">所属部门</th>
                        <th data-options="field:'Duties_name',width:80,align:'center'">所任职务</th>
                    </tr>
                </thead>
            </table>
        </div>
        <div class="easyui-window" id="wRepertoryEnterr" title="进仓单信息" style="width: 383px; height: 200px; top: 60px; left: 420px;" data-options="resizable:false,minimizable:false,
        collapsible:false,maximizable:false,closed:true,">
            <table style="height: 25px; padding: 0; border-spacing: 0">
                <tr>
                    <td style="vertical-align: middle; font-size: 15px;">请输入合同号查找:</td>
                    <td style="vertical-align: middle; text-align: left;">
                        <input type="text" id="strBlur" οnkeyup="mohuiSelec()" style="width: 80px; height: 15px;" /></td>
                </tr>
            </table>
            <table class="easyui-datagrid" id="tbRepertoryEnterr" data-options="idField:'Employee_id',fit:true,singleSelect:true,onClickRow:onClickRepertoryEnterr">
                <thead>
                    <tr>
                        <th data-options="field:'Agreement_id',hidden:true,width:80,align:'center'">合同ID</th>
                        <th data-options="field:'Supply_units_id',hidden:true,width:80,align:'center'">供应单位id</th>
                        <th data-options="field:'Purchase_unit_id',hidden:true,width:100,align:'center'">采购部门id</th>
                        <th data-options="field:'Contract_number',width:80,align:'center'">合同号</th>
                        <th data-options="field:'ReturnDepartmentName',width:80,align:'center'">退货部门</th>
                        <th data-options="field:'ReturnDepartmentCode',width:80,align:'center'">退货部门号</th>
                        <th data-options="field:'Chinese',width:120,align:'center'">供应商</th>
                        <th data-options="field:'AdjustAccountsWay',width:80,align:'center'">核算方式</th>
                    </tr>
                </thead>
            </table>
        </div>
        <div class="easyui-window" id="WChooseReturnGoodsDepartmentAndContactUnit" title="选择退货部门及往来单位" data-options="resizable:false,minimizable:false,collapsible:false,maximizable:false,closed:true" style="width: 580px; height: 260px; font-size: 15px;">
            供货商:<input id="txtSupplyOfMaterial" style="border-style: none none solid none; width: 390px; font-size: 15px; height: 25px; border-width: 1px; color: #0000ff" /><br />
            <div style="margin: 10px 0"></div>
            <button type="button" οnclick="OpenwRepertoryEnterr()" style="font-size: 15px; height: 20px; border-style: inset; border-width: 2px;">合同号</button><input id="txtContractNumber" style="border-style: none none solid none; border-width: 1px; width: 100px; font-size: 15px; height: 15px; color: #0000ff" />
            <div style="margin: 10px 0"></div>

            核算方式:<input type="text" id="txtAdjustAccountsWay" @*data-options="url:'/ShangPinFanChang/SelectAdjustAccountsWay',valueField:'AdjustAccountsWayid',textField:'AdjustAccountsWayName', panelHeight:100"*@ style="width: 60px; font-size: 15px;" /><br />
            <div style="margin: 10px 0"></div>

            退货部门:<input class="easyui-combotree" id="cboReturnGoosDepartment" style="width: 120px" data-options="onChange:ChooseReceiveGoodsDepartment,required:true,url:'/ShangPinPeiHuoDan/SelectDepartmentTreeAll'" /><input id="txtReturnGoosDepartmentName" style="border-style: none none solid none; border-width: 1px; font-size: 15px; height: 25px; width: 320px" /><br />
            <div style="margin: 10px 0"></div>

            库存地点:<input class="easyui-combobox" id="cboRepertoryPlace1" style="width: 120px" data-options="onSelect:getRepertory_place_name,required:true, panelHeight:100" /><input id="txtRepertoryPlaceName" style="border-style: none none solid none; border-width: 1px; font-size: 15px; height: 25px; width: 320px" /><br />
            <div style="text-align: center; margin-top: 15px">
                <button οnclick="Affirm();" id="Affirm">
                    <img src="../../Content/image/ok.gif" style="width: 20px;" />确认</button>
                <button οnclick="Cancel();" id="Cancel">
                    <img src="../../Content/image/delete.png" />取消</button>
            </div>
        </div>
        <div class="easyui-window" id="wPiLiangInsertGoods" title="进货商品信息" style="width: 700px; height: 300px;" data-options="resizable:false,minimizable:false,collapsible:false,maximizable:false,closed:true">
            <table style="width: 686px; height: 28px; padding: 0; border-spacing: 0">
                <tr>
                    <td style="vertical-align: middle; font-size: 15px;">请输入商品名称/代码/条码查找:</td>

                    <td style="vertical-align: middle;">
                        <input class="easyui-searchbox" id="moHiuChaXun" data-options="prompt:'Please Input Value',searcher:MoHuSelectPiLiangInsertGoodsInformation" style="width: 180px; height: 23px;" /></td>

                    <td>
                        <button id="TuiChu1" οnclick=" $('#wPiLiangInsertGoods').window('close')">
                            <img src="../../Content/image/2012080412301.png" />退出</button>
                    </td>
                </tr>
            </table>
            <div class="easyui-panel" style="width: 686px; height: 236px;">
                <table id="tbPiLiangInsertGoods" class="easyui-datagrid" style="width: 3360px;" data-options="rownumbers:true,
                striped:true,pagination:true,idField:'Goods_id',singleSelect:true,fit:true,fitColumns:false,onClickRow: getPiLiangInsertGoods">
                    <thead>
                        <tr>
                            <th data-options="field:'Repertory_enter_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:'Goods_code',width:80,align:'center'">商品代码</th>
                            <th data-options="field:'Goods_bar_code',width:80,align:'center'">商品条码</th>
                            <th data-options="field:'Goods_name',width:80,align:'center'">商品名称</th>
                            <th data-options="field:'Art_No',width:80,align:'center'">货号</th>
                            <th data-options="field:'Contract_number',width:80,align:'center'">合同号</th>
                            <th data-options="field:'Format_model',width:80,align:'center'">规格型号</th>
                            <th data-options="field:'JiLiangDanWei',width:80,align:'center'">计量单位</th>
                            <th data-options="field:'Quality_content',width:80,align:'center'">包装含量</th>
                            <th data-options="field:'Tax_inclusive_price',hidden:true,width:80,align:'center'">含税进价</th>
                            <th data-options="field:'Retail_unit_price',width:80,align:'center'">零售单价</th>
                            <th data-options="field:'MaiJia',width:80,hidden:true,align:'center'">买手</th>
                            <th data-options="field:'Vender_bar_code_deny',width:80,align:'center'">厂家条码否</th>
                            <th data-options="field:'Goods_abbreviation',width:80,align:'center'">商品简称</th>
                            <th data-options="field:'Plncode_PLN',width:80,align:'center'">PLN码</th>
                            <th data-options="field:'ShengChanChangJiaMC',width:80,align:'center'">生产厂家</th>
                            <th data-options="field:'ChanDiMC',width:80,align:'center'">产地</th>
                            <th data-options="field:'Art_No',width:80,align:'center'">货号</th>
                            <th data-options="field:'ShiYongDuiXiang',width:80,align:'center'">使用对象</th>
                            <th data-options="field:'Goods_colours',width:80,align:'center'">商品花色</th>
                            <th data-options="field:'rademark',width:80,align:'center'">商品商标</th>
                            <th data-options="field:'Permit_decimal_deny',width:80,align:'center'">允许小数否</th>
                            <th data-options="field:'ShangPinFenLei',width:80,align:'center'">商品分类</th>
                            <th data-options="field:'BaoZhiQi',width:80,align:'center'">保质期</th>
                            <th data-options="field:'Input_ratio',width:80,align:'center'">进项税率</th>
                            <th data-options="field:'Output_ratio',width:80,align:'center'">销项税率</th>
                            <th data-options="field:'Count_scale',width:80,align:'center'">统计比例</th>
                            <th data-options="field:'ZhiLiangDengJi',width:80,align:'center'">质量等级</th>
                            <th data-options="field:'JiYingJiJie',width:80,align:'center'">经营季节</th>
                            <th data-options="field:'ChanPinZhuangTai',width:80,align:'center'">产品状态</th>
                            <th data-options="field:'DengJiRen',width:80,align:'center'">登记人</th>
                            <th data-options="field:'Register_time',width:80,align:'center'">登记时间</th>
                            <th data-options="field:'ShenHeRen',width:80,align:'center'">审核人</th>
                            <th data-options="field:'Review_time',width:80,align:'center'">审核时间</th>
                            <th data-options="field:'GengXinRen',width:80,align:'center'">更新人</th>
                            <th data-options="field:'Update_Time',width:80,align:'center'">更新时间</th>
                            <th data-options="field:'Purchase_bid',width:80,align:'center'">采购进价</th>
                            <th data-options="field:'Self_fix_goods_deny',width:80,align:'center'">自订货否</th>
                            <th data-options="field:'Mini_fix_goods_deny',width:80,align:'center'">最小订货数</th>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>

        <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 style="background: #48d1cc; color: #000000; font-size: 25px; text-align: center; padding: 3px">退货单录入</div>
            <table style="margin-left: 1px; border-collapse: collapse; width: 845px">
                <tr>
                    <td>
                        <input type="button" style="font-size: 15px;" value="记录编号:" /></td>
                    <td>
                        <input type="text" style="background-color: #FFFFFF; color: red;" οnclick="SelectReturnRecord_number()" id="txtRecord_number" /></td>
                    <td style="font-size: 15px; color: #FF0000; width: 70px; text-align: left;">仓库返仓</td>
                    <td style="font-size: 15px; text-align: left; width: 70px">供货单位</td>
                    <td>
                        <div style="border-bottom: #000 1px solid; width: 280px">
                            <input id="txtgonghuodanwei" style="border: none; width: 280px; color: #0000ff" />
                        </div>
                    </td>
                </tr>
                <tr>
                    <td style="font-size: 15px; text-align: center">合同号</td>
                    <td>
                        <input type="text" id="hetonghao" style="width: 80px; color: #0000ff" /></td>
                    <td></td>
                    <td style="font-size: 15px; text-align: left;">退货部门</td>
                    <td colspan="3">
                        <div style="border-bottom: #000 1px solid; width: 250px">
                            <input id="txtReturnGoosDepartment1" style="border: none; width: 280px; color: #0000ff" />
                        </div>
                    </td>
                </tr>
                <tr>
                    <td style="font-size: 15px; text-align: center;">库存地点</td>
                    <td>

                        <input class="easyui-combobox" id="cboRepertoryPlace" data-options=" panelHeight:100,url:'/ShangPinFanChang/GetAllRepertory',valueField:'Repertory_place_id',textField:'Repertory_place_identifier'" style="width: 80px; color: #0000ff" />
                        <input id="txtRepertoryPlace" style="width: 80px; margin-bottom: 1px; color: #0000ff" />
                    </td>
                    <td></td>


                    <td style="font-size: 15px; text-align: left">核算方式</td>
                    <td>
                        <div style="border-bottom: #000 1px solid; width: 80px; color: #0000ff">
                            <input id="txthe" style="border: none; width: 80px; color: #0000ff" />
                        </div>
                    </td>


                </tr>
                <tr>
                    <td style="font-size: 15px; text-align: center;">退货原因</td>

                    <td>
                        <input class="easyui-combobox" id="cboTuiHuoYuanYin" data-options="url:'/ShangPinFanChang/SelectTuiHuoYuanYin',valueField:'TuiHuoYuanYinid',textField:'TuiHuoYuanYin', panelHeight:100" /></td>
                    <td>
                        <input type="text" id="txtJieJueFangFa" style="background-color: #c0c0c0; width: 0; height: 0; margin-left: 100px; border: none" readonly="readonly" /></td>
                    <td style="font-size: 15px; text-align: left">解决方法</td>
                    <td>
                        <div style="border-bottom: #000 1px solid; width: 280px">
                            <input id="txtSolution" style="border: none; width: 280px" />
                        </div>

                    </td>

                </tr>
                <tr>
                    <td>
                        <input type="button" οnclick="Openconsigner()" id="jinshouren" style="font-size: 15px;" value="经手人" /></td>
                    <td>
                        <input type="button" style="font-size: 15px;" οnclick="OpenPiLiangInsertGoods();" value="批量增加商品" /></td>
                    <td style="font-size: 15px;">附件<input type="text" id="fujianzhangshu" style="width: 30px" />张</td>
                    <td style="font-size: 15px;" colspan="2">同<input type="text" id="tongfancang" style="width: 100px" />返仓单</td>

                </tr>
            </table>


            <div class="easyui-layout" style="height: 300px">
                <div data-options="region:'east',split:true" style="width: 400px">
                    <table id="tbGoodsInformation" class="easyui-datagrid" style="width: 400px; height: 200px;" border="1" data-options="rownumbers:true,idField:'Goods_id',singleSelect:true,onSelect:onClickRowMingXi2,onAfterEdit:compute,@*onBeforeEdit:compute,*@
               fit:true">
                        <thead>
                            <tr>
                                <th data-options=" field:'ShanChu',width:25,align:'center',formatter: deleteSelect"></th>
                                <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',editor:{type:'numberbox',options:{value:0}},styler:cellStyler"><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 data-options="region:'center'" style="padding: 0px;">
                    <table id="tbStockBatchInformation" class="easyui-datagrid" style="width: 500px; height: 200px;" border="1" data-options="@*rownumbers:true,*@
                    idField:'Goods_id',
                    singleSelect:true,
                    onSelect:onClickRowMingXi,
                   onAfterEdit:onAfterEdit,
               fit:true@*,frozenColumns:[[
                     {field:'ShanChu',width:15,align:'center',styler:cellStyler}
                     ]]*@">

                        <thead>
                            <tr>
                                <th data-options=" field:'jianTou',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',editor:{type:'numberbox',options:{value:0}},styler:cellStyler"><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 data-options="region:'south',border:false" style="text-align: right; padding: 5px 0 0;">
                <table style="height: 30px">
                    <tr>
                        <td style="font-size: 15px; width: 95px; text-align: left">不含税金额</td>
                        <td style="width: 50px">
                            <div style="border-bottom: #000 1px solid; width: 120px; color: red">
                                <input id="txtnoHaiShuiJinE" readonly="readonly" style="width: 120px; border: none; color: red" />
                            </div>
                        </td>
                        <td style="font-size: 15px; width: 80px;">税金</td>
                        <td style="width: 150px">
                            <div style="border-bottom: #000 1px solid; width: 150px; color: red">
                                <input id="txtShuiJin" readonly="readonly" style="width: 150px; border: none; color: red" />
                            </div>
                        </td>
                        <td style="width: 50px"></td>
                        <td style="font-size: 15px;">价税合计</td>
                        <td>
                            <div style="border-bottom: #000 1px solid; width: 120px; color: red">
                                <input id="txtJiaShuiHeJi" readonly="readonly" style="width: 120px; border: none; color: red" />
                            </div>
                        </td>

                    </tr>
                </table>
                <table style="height: 15px">
                    <tr>
                        <td style="font-size: 15px; width: 80px; text-align: left">登记人</td>
                        <td style="width: 60px">
                            <div style="border-bottom: #000 1px solid; width: 100px;">
                                <input class="easyui-combobox" id="dengjiren" data-options="url:'/ShangPinJinChuangDan/SelectEmployee',valueField:'ID',textField:'MC'" style="width: 100px; border: none; color: #0000FF; font-size: 17px;" />
                            </div>
                        </td>

                        <td style="font-size: 15px; text-align: left; width: 90px; text-align: center">登记时间</td>
                        <td style="width: 50px">
                            <div style="border-bottom: #000 1px solid; width: 145px;">
                                <input class="easyui-datetimebox" data-options="formatter:myformatter" id="datdengjishijian" style="width: 145px; border: none; color: #0000FF; font-size: 17px;" />
                            </div>
                        </td>
                        <td style="font-size: 15px; width: 60px">审核人</td>
                        <td style="width: 50px">
                            <div style="border-bottom: #000 1px solid; width: 100px;">
                                <input class="easyui-combobox" id="Auditor" data-options="url:'/ShangPinJinChuangDan/SelectEmployee',valueField:'ID',textField:'MC'" style="width: 100px; border: none; color: #0000FF; font-size: 17px;" />
                            </div>
                        </td>
                        <td style="font-size: 15px; width: 80px">审核时间</td>
                        <td>
                            <div style="border-bottom: #000 1px solid; width: 145px;">
                                <input class="easyui-datetimebox" data-options="formatter:myformatter" id="datshenheshijian" style="width: 145px; border: none; color: #0000FF; font-size: 17px;" />
                            </div>
                        </td>
                    </tr>

                </table>
                <div style="text-align: center">
                    <button id="Select" οnclick="openSelectTuiHuoDan()">
                        <img src="../../Content/image/2012092109942.png" />查询</button>
                    <button οnclick="OpenwChooseReturnGoodsDepartmentAndContactUnit();" id="TianJia">
                        <img src="../../Content/image/add.png" />添加</button>
                    <button id="XiuGai" οnclick="UpdataTuiHuoDan();">
                        <img src="../../Content/image/table_edit.png" />修改</button>
                    <button οnclick="DeleteReturnFactory();" id="ShanChu">
                        <img src="../../Content/image/delete.png" />删除</button>
                    <button id="BaoCun" οnclick="BaoCunTuiHuoDan();">
                        <img src="../../Content/image/disk.png" />保存</button>
                    <button οnclick="qingKong();" id="FanQi">
                        <img src="../../Content/image/01.png" />放弃</button>
                    <button οnclick="ShenHe();" id="ShenHe">
                        <img src="../../Content/image/ok.gif" />审核</button>
                    <button id="TuiChu" οnclick="parent.fanChang();">
                        <img src="../../Content/image/2012080412301.png" />退出</button>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

2.        实现DGV中单元格的操作

2.1效果图:


2.2实现此功能的界面代码


2.3    实现该功能在JavaScript中的代码

//对单元格操作的方法
        function cellStyler(value) {
            if (value != "") {
                return 'background-color:#FFEBCD;color:red';
            }

        }

3.        MVC中的DGV与WCF的不同,WCF中的DGV在被选中行时自带会有个小图标“三角形”的,而MVC中的DGV没有自带,现在实现MVC中的DGV被选中行的前列有个小图标“三角形”的功能

3.1 该功能的效果图


3.2 为了实现此功能的界面代码


3.4          为了实现此功能在JavaScript中的代码

//开始编辑
        var editIndex = undefined;//声明变量
        //对DGV操作的方法
        function onClickRowMingXi(rowIndex, rowData) {
            //判断
            if (editIndex != undefined && editIndex != rowIndex) {
                $("#tbStockBatchInformation").datagrid('endEdit', editIndex);//找到编辑中的单元格
                //改变行索引的状态,插入“小箭头”的图标,然后结束编辑
                $("#tbStockBatchInformation").datagrid("updateRow", { index: rowIndex, row: { jianTou: "<img src='../../Content/WuYinCSS/list.png'/>" } }).datagrid('beginEdit', rowIndex);
                $("#tbStockBatchInformation").datagrid('endEdit', editIndex).datagrid("updateRow", { index: editIndex, row: { jianTou: "" } });
                $("#tbStockBatchInformation").datagrid("refreshRow", editIndex);//刷新行索引
                editIndex = rowIndex;
            } else if (editIndex == undefined) {
                $("#tbStockBatchInformation").datagrid("updateRow", { index: rowIndex, row: { jianTou: "<img src='../../Content/WuYinCSS/list.png'/>" } }).datagrid('beginEdit', rowIndex);

                editIndex = rowIndex;
            } else {
                $("#tbStockBatchInformation").datagrid('endEdit', editIndex);//结束编辑
                $("#tbStockBatchInformation").datagrid("refreshRow", editIndex);//刷新
                $("#tbStockBatchInformation").datagrid('beginEdit', rowIndex);//开始编辑
            }
        }

4. 实现DGV中计算和累加到返厂单录入的最终的结果

4.1    实现此功能的效果图

 4.2 实现此功能在JavaScript中的代码

function onAfterEdit(rowIndex, rowData) {
            var goodsid = rowData.Goods_id;
            if (zhuangTai == 2) {
                if (repertoryPlace > 0) {
                    $('#tbGoodsInformation').datagrid('loadData', { total: 0, rows: [] });
                    $.getJSON("/ShangPinFanChang/SelectPacth?goodsid=" + goodsid + "&" + "repertoryPlace=" + repertoryPlace, function (data) {
                        $('#tbGoodsInformation').datagrid('loadData', data);
                    });
                }
                var shangpinMingXi = $('#tbStockBatchInformation').datagrid('getSelected');
                var id = shangpinMingXi.Goods_id;
                if (!isNaN(parseInt(shangpinMingXi.Goods_quantity_recede))) {
                    tuiHuoXiShu = parseInt(shangpinMingXi.Goods_quantity_recede);
                    kunCunShu = parseInt(shangpinMingXi.Stock_quantity);
                    if (tuiHuoXiShu > kunCunShu) {
                        shangpinMingXi.Goods_quantity_recede = "";
                        $('#txtnoHaiShuiJinE').val('0.00');
                        $('#txtShuiJin').val('0.00');
                        $('#txtJiaShuiHeJi').val('0.00');
                    } else {
                        //单击商品信息(退货明细)计算
                        $.getJSON("/ShangPinFanChang/Jisuan?id=" + id + "&repertoryPlace=" + repertoryPlace + "&tuiHuoXiShu=" + tuiHuoXiShu, function (data) {
                            var aa = data.split(',');
                            $('#txtnoHaiShuiJinE').val(aa[0]);
                            $('#txtShuiJin').val(aa[1]);
                            $('#txtJiaShuiHeJi').val(aa[2]);
                        });
                    }
                } else {
                    $('#txtnoHaiShuiJinE').val('0.00');
                    $('#txtShuiJin').val('0.00');
                    $('#txtJiaShuiHeJi').val('0.00');
                }

4.3    为了实现此功能对控制器的操作代码

#region 计算
        //方法,界面传来的参数
        public ActionResult Jisuan(int id, int repertoryPlace, string tuiHuoXiShu)
        {
            //根据id和库存地点来查询新增的商品
            DataTable dt = _myReturnFactory.SelectInsertGoodsByGoods_IDandRepertory_place_id(id, repertoryPlace);
            string msg = "";
            //判断是否有数据
            if (dt.Rows.Count > 0)
            {
                //判断成立,则获取单元格中的值
                var caiGouJinJia = Convert.ToInt32(dt.Rows[0]["Purchase_bid"]);
                var jinXiangShuiLv = Convert.ToInt32(dt.Rows[0]["Input_ratio"]);
                var haiShuiJinJia = Convert.ToInt32(dt.Rows[0]["Tax_inclusive_price"]);
                var nohaiShuiJinE = caiGouJinJia * Convert.ToInt32(tuiHuoXiShu);
                var shuiJin = caiGouJinJia * jinXiangShuiLv * Convert.ToInt32(tuiHuoXiShu);
                var jiaShuiHeJi = haiShuiJinJia * Convert.ToInt32(tuiHuoXiShu);
                msg += "¥" + nohaiShuiJinE + "," + "¥" + shuiJin + "," + "¥" + jiaShuiHeJi;
            }
            return Json(msg, JsonRequestBehavior.AllowGet);

        }

        #endregion

4.4    为了实现此功能对逻辑层的操作代码

#region 根据商品id查询批量增加商品信息(把数据绑定到退货单上)

        public DataTable SelectInsertGoodsByGoods_IDandRepertory_place_id(int goodsId, int repertoryPlaceId)
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
			  new SqlParameter("@Goods_id",SqlDbType.Int), 
			  new SqlParameter("@Repertory_place_id", SqlDbType.Int),
		  };
            sql[0].Value = "SelectInsertGoodsByGoods_IDandRepertory_place_id";
            sql[1].Value = goodsId;
            sql[2].Value = repertoryPlaceId;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        #endregion

   5 实现界面上查询,新增,修改,删除,保存,审核等功能的实现

5.1对JavaScript中的操作代码

<script type="text/javascript">
        $(document).ready(function () {
            $("#wTuiHuoDan").show(700);
            $('#txtgonghuodanwei').attr("disabled", true);
            $('#hetonghao').attr("disabled", true);
            $('#txthe').attr("disabled", true);
            $('#txtReturnGoosDepartment1').attr("disabled", true);
            $('#cboRepertoryPlace').attr("disabled", true);
            $('#txtRepertoryPlace').attr("disabled", true);
            $('#txtnoHaiShuiJinE').attr("disabled", true);
            $('#txtShuiJin').attr("disabled", true);
            $('#txtJiaShuiHeJi').attr("disabled", true);
            $('#txtSupplyOfMaterial').attr("disabled", true);
            $('#txtAdjustAccountsWay').attr("disabled", true);
            $('#cboReturnGoosDepartment').attr("disabled", true);
            $('#txtReturnGoosDepartmentName').attr("disabled", true);
            $('#txtContractNumber').attr("disabled", true);
            $('#DaYin').attr("disabled", true);
            //查询绑定退货部门
            $.getJSON("/ShangPinPeiHuoDan/SelectDepartmentTreeAll", function (data) {
                $('#cboReturnGoosDepartment').combotree('loadData', data);
            });
            $.getJSON("/ShangPinFanChang/SelectReturnRecordNumber", function (value) {
                $("#txtRecord_number").val(value);
            });
        });

        //绑定部门(退货部门)
        function ChooseReceiveGoodsDepartment(id) {
            $.getJSON("/ShangPinPeiHuoDan/GetAllSentGoodsDepartmentByDepartmentId?intDepartmentFarId=" + id, function (data) { //根据获取的Id查询部门数据(id,farId,名称)
                var str = []; //创建数组
                checkFar_Id(data[0].Department_Farid, data[0].Department_name, data[0].Department_code, str, 2); //执行另一个方法判断是否有父级,获取父的名称

            });
            //根据退货部门和合同号绑定库存地点
            $.getJSON("/ShangPinFanChang/BinDingRepertory_placeByreturnDepartmentId?returnDepartmentId=" + id, function (data) {
                $('#cboRepertoryPlace1').combobox({
                    data: data,
                    valueField: 'Repertory_place_id',
                    textField: 'Repertory_place_identifier'
                });
            });

        }

        //获取库存地点名称(根据库存地点id)
        var repertoryPlaceId = 0;

        function getRepertory_place_name() {
            var repertoryPlaceId = $('#cboRepertoryPlace1').combobox('getValue');
            $.getJSON("/ShangPinFanChang/SelectRepertoryPlaceIdByRepertoryPlaceId?repertoryPlaceId=" + repertoryPlaceId, function (data) {
                $('#txtRepertoryPlaceName').val(data[0].Repertory_place_name);
            });

        }

        function checkFar_Id(intDepartmentFarId, strDepartmentName, strDepartmentCode, str) {
            if (intDepartmentFarId > 0) {
                $.getJSON("/ShangPinPeiHuoDan/GetAllSentGoodsDepartmentByDepartmentId?intDepartmentFarId=" + intDepartmentFarId, function (data) { //当部门有父级的时候,以父级id查询部门id,并获取部门名称
                    str.unshift(data[0].Department_name); //将部门名称累加到数组上
                    if (data[0].Department_Farid >= 0) { //当查出来的部门还有父id>0的时候,重新调用本方法,直到父id=0;
                        checkFar_Id(data[0].Department_Farid, strDepartmentName, strDepartmentCode, str);
                    }
                });
            } else {
                var str2 = ""; //声明另一个变量,
                for (var i = 0; i < str.length; i++) {
                    str2 += str[i].trim() + "→"; //for循环获取部门名称并拼接一个"→"
                }

                $('#txtReturnGoosDepartmentName').val(str2 + strDepartmentName.trim() + "(" + strDepartmentCode.trim() + ")"); //str2(累加起来的部门)+点中的那个部门的,名称

            }
        }

        //打开选择退货部门及往来单位窗口
        function OpenwChooseReturnGoodsDepartmentAndContactUnit() {
            zhuangTai = 2;
            $('#Auditor').combobox({ disabled: true });
            $('#datshenheshijian').datetimebox({ disabled: true });
            $('#WChooseReturnGoodsDepartmentAndContactUnit').window('open');

        }

        var returnGoosDepartment = 0;
        var repertoryPlace = 0;


        //点击确认将其信息绑定到退货单上
        function Affirm() {
            $('#txtgonghuodanwei').val($('#txtSupplyOfMaterial').val());
            $('#hetonghao').val($('#txtContractNumber').val());
            $('#txthe').val($('#txtAdjustAccountsWay').val());
            $('#txtReturnGoosDepartment1').val($('#txtReturnGoosDepartmentName').val());
            $('#cboRepertoryPlace').combobox('setValue', $('#cboRepertoryPlace1').combobox('getValue'));
            $('#txtRepertoryPlace').val($('#txtRepertoryPlaceName').val());
            returnGoosDepartment = $('#cboReturnGoosDepartment').combobox('getValue');
            repertoryPlace = $('#cboRepertoryPlace1').combobox('getValue');
            $('#WChooseReturnGoodsDepartmentAndContactUnit').window('close');
            returnfactoryid = 0;
        }

        //点击取消按钮刷新
        function Cancel() {
            $('#txtSupplyOfMaterial').val('');
            $('#txtContractNumber').val('');
        }

        //生成退货记录编号
        function SelectReturnRecord_number() {
            $.getJSON("/ShangPinFanChang/SelectReturnRecordNumber", function (value) {
                $("#txtRecord_number").val(value);
            });
        }

        //打开批量增加商品窗口
        function OpenPiLiangInsertGoods() {
            $('#wPiLiangInsertGoods').window('open');
            var values = $('#tbStockBatchInformation').datagrid('getRows');
            var str = [];
            for (var j = 0; j < values.length; j++) {
                str.push(values[j].Goods_id); //方法push(),可以将一个或多个新的元素附加到数组的尾部,然后返回到数组的新长度。
            }

            $.getJSON("/ShangPinFanChang/SelectPiLiangInsertGoodsInformation?returnGoosDepartment=" + returnGoosDepartment + "&repertoryPlace=" + $("#cboRepertoryPlace").combobox("getValue") + "&strarry=" + str, function (data) {
                $('#tbPiLiangInsertGoods').datagrid({ loadFilter: pagerFilter }).datagrid('loadData', data);
            });

            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;
            }

        }

        //模糊查询批量增加商品信息
        function MoHuSelectPiLiangInsertGoodsInformation(value) {
            var id = repertoryPlace;
            $('#tbPiLiangInsertGoods').datagrid({ url: "/ShangPinFanChang/MoHuSelectPiLiangInsertGoodsInformation?strBur=" + value + "&id=" + id });
        }

        function returnCheckBox() {
            return "<input type='checkbox' name='check'/>";
        }

        //单击数据绑定到退货单上 
        function getPiLiangInsertGoods() {
            var rows = $('#tbPiLiangInsertGoods').datagrid('getRows');
            var id = 0;
            for (var i = 0; i < rows.length; i++) {
                id = rows[i].Goods_id;
            }
            $.getJSON("/ShangPinFanChang/SelectInsertGoodsByGoods_IDandRepertory_place_id?id=" + id + "&repertoryPlace=" + $("#cboRepertoryPlace").combobox('getValue'), function (data) {
                $('#tbStockBatchInformation').datagrid('loadData', data);
            });
            $('#wPiLiangInsertGoods').window('close');
        }

        //根据商品id查询批次
        function DblSelectPacth() {

        }

        //开始编辑
        var editIndex = undefined;//声明变量
        //对DGV操作的方法
        function onClickRowMingXi(rowIndex, rowData) {
            //判断
            if (editIndex != undefined && editIndex != rowIndex) {
                $("#tbStockBatchInformation").datagrid('endEdit', editIndex);//找到编辑中的单元格
                //改变行索引的状态,插入“小箭头”的图标,然后结束编辑
                $("#tbStockBatchInformation").datagrid("updateRow", { index: rowIndex, row: { jianTou: "<img src='../../Content/WuYinCSS/list.png'/>" } }).datagrid('beginEdit', rowIndex);
                $("#tbStockBatchInformation").datagrid('endEdit', editIndex).datagrid("updateRow", { index: editIndex, row: { jianTou: "" } });
                $("#tbStockBatchInformation").datagrid("refreshRow", editIndex);//刷新行索引
                editIndex = rowIndex;
            } else if (editIndex == undefined) {
                $("#tbStockBatchInformation").datagrid("updateRow", { index: rowIndex, row: { jianTou: "<img src='../../Content/WuYinCSS/list.png'/>" } }).datagrid('beginEdit', rowIndex);

                editIndex = rowIndex;
            } else {
                $("#tbStockBatchInformation").datagrid('endEdit', editIndex);//结束编辑
                $("#tbStockBatchInformation").datagrid("refreshRow", editIndex);//刷新
                $("#tbStockBatchInformation").datagrid('beginEdit', rowIndex);//开始编辑
            }
        }
        var editIndex2 = undefined;
        function onClickRowMingXi2(rowIndex) {
            if (editIndex2 != undefined && editIndex2 != rowIndex) {
                $("#tbGoodsInformation").datagrid('endEdit', editIndex2).datagrid("updateRow", { index: editIndex2, row: { jianTou1: "" } });
                $("#tbGoodsInformation").datagrid("updateRow", { index: rowIndex, row: { jianTou1: "<img src='../../Content/WuYinCSS/list.png'/>" } }).datagrid('beginEdit', rowIndex);
                editIndex2 = rowIndex;

            } else if (editIndex2 == rowIndex) {
                $("#tbGoodsInformation").datagrid('endEdit', editIndex2);
                $("#tbGoodsInformation").datagrid('beginEdit', rowIndex);

            } else {
                $("#tbGoodsInformation").datagrid("updateRow", { index: rowIndex, row: { jianTou1: "<img src=''../../Content/WuYinCSS/list.png'/>" } }).datagrid('beginEdit', rowIndex);
                editIndex2 = rowIndex;
            }
        }
        var kunCunShu = 0;
        var tuiHuoXiShu = 0;
        var zhuangTai = 0;
        function onAfterEdit(rowIndex, rowData) {
            var goodsid = rowData.Goods_id;
            if (zhuangTai == 2) {
                if (repertoryPlace > 0) {
                    $('#tbGoodsInformation').datagrid('loadData', { total: 0, rows: [] });
                    $.getJSON("/ShangPinFanChang/SelectPacth?goodsid=" + goodsid + "&" + "repertoryPlace=" + repertoryPlace, function (data) {
                        $('#tbGoodsInformation').datagrid('loadData', data);
                    });
                }
                var shangpinMingXi = $('#tbStockBatchInformation').datagrid('getSelected');
                var id = shangpinMingXi.Goods_id;
                if (!isNaN(parseInt(shangpinMingXi.Goods_quantity_recede))) {
                    tuiHuoXiShu = parseInt(shangpinMingXi.Goods_quantity_recede);
                    kunCunShu = parseInt(shangpinMingXi.Stock_quantity);
                    if (tuiHuoXiShu > kunCunShu) {
                        shangpinMingXi.Goods_quantity_recede = "";
                        $('#txtnoHaiShuiJinE').val('0.00');
                        $('#txtShuiJin').val('0.00');
                        $('#txtJiaShuiHeJi').val('0.00');
                    } else {
                        //单击商品信息(退货明细)计算
                        $.getJSON("/ShangPinFanChang/Jisuan?id=" + id + "&repertoryPlace=" + repertoryPlace + "&tuiHuoXiShu=" + tuiHuoXiShu, function (data) {
                            var aa = data.split(',');
                            $('#txtnoHaiShuiJinE').val(aa[0]);
                            $('#txtShuiJin').val(aa[1]);
                            $('#txtJiaShuiHeJi').val(aa[2]);
                        });
                    }
                } else {
                    $('#txtnoHaiShuiJinE').val('0.00');
                    $('#txtShuiJin').val('0.00');
                    $('#txtJiaShuiHeJi').val('0.00');
                }
                //单击退货商品信息(根据商品id和库存地点id查询批次)
            } else if (zhuangTai == 1) {
                $('#Auditor').combobox({ disabled: false });
                $('#datshenheshijian').datetimebox({ disabled: false });
                var returnFactoryDetailid = rowData.Return_factory_detail_id;
                var repertoryPlaceId = $("#cboRepertoryPlace").combobox("getValue");
                tuiHuoXiShu = parseInt(rowData.Goods_quantity_recede);
                $.getJSON("/ShangPinFanChang/SelectPacthInformations?returnFactoryDetailid=" + returnFactoryDetailid + "&" +
                    "goodsid=" + goodsid + "&" + "repertoryPlace=" + repertoryPlaceId, function (data) {
                        $('#tbGoodsInformation').datagrid('loadData', data);
                        $("#tbGoodsInformation").datagrid("acceptChanges");

                    });
                if (rowData.Goods_quantity_recede != "") {
                    $('#txtnoHaiShuiJinE').val("¥" + rowData.noHaiShuiJinE);
                    $('#txtShuiJin').val("¥" + rowData.shuijin);
                    $('#txtJiaShuiHeJi').val("¥" + rowData.JiaShuiHeJi);
                } else {
                    $('#txtnoHaiShuiJinE').val('0.00');
                    $('#txtShuiJin').val('0.00');
                    $('#txtJiaShuiHeJi').val('0.00');
                }
            }
        }

        //打开进仓信息窗口
        function OpenwRepertoryEnterr() {
            $('#wRepertoryEnterr').window('open');
            $.getJSON("/ShangPinFanChang/SelectRepertoryEnterrInformations", function (data) {
                $('#tbRepertoryEnterr').datagrid('loadData', data);
            });

        }

        //模糊查询进仓信息
        function mohuiSelec() {
            $.getJSON("/ShangPinFanChang/MohuiSelectRepertoryEnterrInformations?strBulr=" + $('#strBlur').val(), function (data) {
                $('#tbRepertoryEnterr').datagrid('loadData', data);
            });

        }

        //单击进仓信息
        var purchaseUnitId = 0;
        var contractNumber = 0;
        var heTongid = 0;

        function onClickRepertoryEnterr(rowIndex, rowData) {
            contractNumber = rowData.Contract_number;
            var chinese = rowData.Chinese;
            var adjustAccountsWay = rowData.AdjustAccountsWay;
            $('#txtSupplyOfMaterial').val(chinese);
            $('#txtContractNumber').val(contractNumber);
            $('#txtAdjustAccountsWay').val(adjustAccountsWay);
            purchaseUnitId = rowData.Purchase_unit_id;
            $('#cboReturnGoosDepartment').combotree('setValue', purchaseUnitId);
            $('#wRepertoryEnterr').window('close');
            heTongid = rowData.Agreement_id;

        }

        //日期格式
        function myformatter(date) {
            var y = date.getFullYear();
            var m = date.getMonth() + 1;
            var d = date.getDate();
            var h = date.getHours();
            var min = date.getMinutes();
            var s = date.getSeconds();
            return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d) + " " + h + ":" + min + ":" + s;
        }
        //对单元格操作的方法
        function cellStyler(value) {
            if (value != "") {
                return 'background-color:#FFEBCD;color:red';
            }

        }

        //打开查询退货单信息
        function openSelectTuiHuoDan() {
            $('#Auditor').combobox({ disabled: false });
            $('#datshenheshijian').datetimebox({ disabled: false });
            zhuangTai = 1;
            $('#wSelectTuiHuoDanformations').window('open');
            $.getJSON("/ShangPinFanChang/SelectTuiHuoDan", function (data) {
                $('#tbSelectTuiHuoDanformations').datagrid('loadData', data);
            });
        }

        //模糊查询退货单信息
        function mohuiSelecTuiHuoDan() {
            $.getJSON("/ShangPinFanChang/MohuiSelectTuiHUoDan?strBulr=" + $('#strBlur1').val(), function (data) {
                $('#tbSelectTuiHuoDanformations').datagrid('loadData', data);
            });
        }

        //单击退货单(绑退货单,退货单明细)
        var returnFactoryid2 = 0;
        var jinshouren = 0;
        var dengjiren = 0;
        function onTuiHuoDan(rowIndex, rowData) {
            $('#wSelectTuiHuoDanformations').window('close');
            $('#txtRecord_number').val(rowData.Record_number);
            $('#txtgonghuodanwei').val(rowData.Chinese);
            $('#hetonghao').val(rowData.Contract_number);
            $('#txtReturnGoosDepartment1').val(rowData.ReturnDepartmentName);
            $('#cboRepertoryPlace').combobox('setValue', rowData.Repertory_place_id);
            $('#txtRepertoryPlace').val(rowData.Repertory_place_name);
            $('#txthe').val(rowData.hesuanfangshi);
            $('#cboTuiHuoYuanYin').combobox('setValue', rowData.Goods_return_reasonpubid);
            $('#txtSolution').val(rowData.Solution);
            $('#fujianzhangshu').val(rowData.Number);
            $('#tongfancang').val(rowData.Return_factory_Number);
            $('#dengjiren').combobox('setValue', rowData.dengjiren);
            $('#datdengjishijian').datetimebox('setValue', rowData.Register_time);
            BingDingTuiHuoMingXi(rowData.Return_factory_id);
            returnFactoryid2 = rowData.Return_factory_id;
            jinshouren = rowData.Consignee_id;
            dengjiren = rowData.Registrant_id;

        }

        //绑定退货明细根据退货单id
        var returnFactoryDetailid2 = 0;
        var contractid2 = 0;
        function BingDingTuiHuoMingXi(returnfactoryid1) {
            $.getJSON("/ShangPinFanChang/BingDingTuiHuoMingXi?returnfactoryid=" + returnfactoryid1, function (data) {
                $('#tbStockBatchInformation').datagrid('loadData', data);
                returnFactoryDetailid2 = data[0].Return_factory_detail_id;
                contractid2 = data[0].Agreement_id;
                $('#txtnoHaiShuiJinE').val("¥" + data[0].noHaiShuiJinE);
                $('#txtShuiJin').val("¥" + data[0].shuijin);
                $('#txtJiaShuiHeJi').val("¥" + data[0].JiaShuiHeJi);

            });
        }

        //保存退货单
        var returnfactoryid = 0;
        var returnFactoryDetailid = 0;
        function BaoCunTuiHuoDan() {
            if (returnfactoryid == 0) {
                if ($('#dengjiren').combobox('getValue') == "" || $('#cboTuiHuoYuanYin').datetimebox('getValue') == "" ||
                        $('#datdengjishijian').datetimebox('getValue') == "") {
                    ui.error("数据不完整,新增失败!", 1000, false);
                    return false;
                }
                $.getJSON("/ShangPinFanChang/Insert_TuiHuo?contractid=" + heTongid + "&" +
                    "repertoryPlace=" + repertoryPlace + "&" +
                    "tuiHuoYuanYin=" + $('#cboTuiHuoYuanYin').combobox('getValue') + "&" +
                    "solution=" + $('#txtSolution').val() + "&" +
                    "consigneid=" + yuangongid + "&" +
                    "recordNumber=" + $('#txtRecord_number').val() + "&" +
                    "registrantid=" + $('#dengjiren').combobox('getValue') + "&" +
                    "datdengjishijian=" + $('#datdengjishijian').datetimebox('getValue') + "&" +
                    "returnFactoryNumber=" + $('#tongfancang').val() + "&" +
                    "number=" + $('#fujianzhangshu').val(),
                    function (data) {
                        if (data > 0) {
                            var shangPinMingXi = $('#tbStockBatchInformation').datagrid('getSelected');
                            returnfactoryid = data;
                            $.getJSON("/ShangPinFanChang/Insert_TuiHuoMingXi?returnfactoryid=" + returnfactoryid + "&" +
                                "goodsid=" + shangPinMingXi.Goods_id + "&" +
                                "tuiHuoShu=" + shangPinMingXi.Goods_quantity_recede + "&" +
                                "repertoryPlaceId=" + repertoryPlace,
                                function (data1) {
                                    if (data1 > 0) {
                                        returnFactoryDetailid = data1;
                                        var pacthMingXi = $('#tbGoodsInformation').datagrid('getRows');
                                        for (var j = 0; j < pacthMingXi.length; j++) {
                                            if (parseInt(pacthMingXi[j].Returnquary1) > 0) {
                                                $.getJSON("/ShangPinFanChang/Insert_ReturnPacth?returnFactoryDetailid=" + returnFactoryDetailid + "&" +
                                                    "returnfactoryid=" + returnfactoryid + "&" +
                                                    "stockPacthNumber=" + pacthMingXi[j].pacth + "&" +
                                                    "goodsid=" + pacthMingXi[j].Goods_id + "&" +
                                                    "ruternQuary=" + pacthMingXi[j].Returnquary1 + "&" +
                                                    "stockId=" + pacthMingXi[j].Stock_id,
                                                    function (data2) {
                                                    });
                                            }
                                        }
                                        ui.alert('新增成功!!!', 1000, false);

                                    } else {
                                        ui.error('新增失败!!!', 1000, false);
                                    }

                                });
                        }

                    });
            } else {
                var shangPinMingXi1 = $('#tbStockBatchInformation').datagrid('getSelected');
                $.getJSON("/ShangPinFanChang/Insert_TuiHuoMingXi?returnfactoryid=" + returnfactoryid + "&" +
                    "goodsid=" + shangPinMingXi1.Goods_id + "&" +
                    "tuiHuoShu=" + shangPinMingXi1.Goods_quantity_recede + "&" +
                    "repertoryPlaceId=" + repertoryPlace,
                    function (data1) {
                        if (data1 > 0) {
                            returnFactoryDetailid = data1;
                            var pacthMingXi = $('#tbGoodsInformation').datagrid('getRows');
                            for (var j = 0; j < pacthMingXi.length; j++) {
                                if (parseInt(pacthMingXi[j].Returnquary1) > 0) {
                                    $.getJSON("/ShangPinFanChang/Insert_ReturnPacth?returnFactoryDetailid=" + returnFactoryDetailid + "&" +
                                        "returnfactoryid=" + returnfactoryid + "&" +
                                        "stockPacthNumber=" + pacthMingXi[j].Stock_quantity + "&" +
                                        "goodsid=" + pacthMingXi[j].Goods_id + "&" +
                                        "ruternQuary=" + pacthMingXi[j].Returnquary1 + "&" +
                                        "stockId=" + pacthMingXi[j].Stock_id,
                                        function (data2) {
                                        });
                                }
                            }
                            ui.alert('新增成功!!!', 1000, false);

                        } else {
                            ui.error('新增失败!!!', 1000, false);
                        }

                    });
            }
        }

        //计算
        var zongTuiHuoShu = 0;
        function compute(index) {
            zongTuiHuoShu = tuiHuoXiShu;
            var data = $("#tbGoodsInformation").datagrid("getData");
            var value = data.rows[index];
            value.jieCunShu1 = parseFloat(data.rows[index].Stock_quantity) - parseFloat(data.rows[index].Returnquary1);
            value.TuiHuoJinE1 = parseFloat(data.rows[index].NoTax_inclusive_price) * parseFloat(parseFloat(data.rows[index].Returnquary1));
            $("#tbGoodsInformation").datagrid("refreshRow", index);
            var tuiHuoShuSum = 0;
            for (var i = 0; i < data.rows.length; i++) {
                tuiHuoShuSum += parseInt(data.rows[i].Returnquary1);
            }
            if (tuiHuoShuSum > zongTuiHuoShu) {
                ui.alert('退货数量已超出总退货数,请正确输入!!!', 1000, false);
            } else if (tuiHuoShuSum < zongTuiHuoShu) {
                ui.alert('退货数量小于总退货数,请正确输入!!!', 1000, false);
            }

        }
        //单击经收人按钮
        function Openconsigner() {
            $('#wconsigner').window('open');
            $.getJSON("/ShangPinFanChang/GetEemployeeInformation", function (data) {
                $('#tbconsigner').datagrid('loadData', data);
            });
        }

        var yuangongid = 0;
        function onClicktbconsigner(index, data) {
            yuangongid = data.Employee_id;
            $('#txtSolution').val(data.Employee_name);
            $('#wconsigner').window('close');
        }
        //修改退货单
        var tips = "";
        function UpdataTuiHuoDan() {
            if (returnFactoryid2 > 0) {
                ui.confirm('是否修改???', function (k) {
                    if (k) {
                        var delrow = $('#tbGoodsInformation').datagrid('getChanges', 'deleted'); //删除批次
                        for (var i = 0; i < delrow.length; i++) {

                            $.getJSON("/ShangPinFanChang/DeletePacthInformations?returnPacthid=" + delrow[i].ReturnPacthid, function (data) {
                            });
                        }
                        var updaterow2 = $('#tbGoodsInformation').datagrid('getChanges', 'updated'); //修改批次
                        var updaterow = $('#tbStockBatchInformation').datagrid('getChanges', 'updated'); //修改返厂明细
                        if (updaterow.length > 0) {
                            if (updaterow[0].Goods_quantity_recede > updaterow[0].Stock_quantity) {
                                ui.success("输入退货数大于库存数,请输入正确数!!!");
                            } else {
                                $.getJSON("/ShangPinFanChang/Update_ReturnDetail?returnFactoryDetailid=" + updaterow[0].Return_factory_detail_id +
                                    "&" + "goodsQuantityRecede=" + updaterow[0].Goods_quantity_recede, function (data) {

                                    });
                            }
                        }
                        for (var j = 0; j < updaterow2.length; j++) {
                            if (updaterow2[j].ReturnPacthid > 0) {
                                if (updaterow2[j].Returnquary1 > 0) {
                                    //修改批次信息
                                    $.getJSON("/ShangPinFanChang/UpdatePacthInformations?returnPacthid=" + updaterow2[j].ReturnPacthid + "&" +
                                        "stockQuantity=" + updaterow2[j].Returnquary1, function (data) {
                                        });
                                } else {
                                    //删除批次信息
                                    $.getJSON("/ShangPinFanChang/DeletePacthInformations?returnPacthid=" + updaterow2[j].ReturnPacthid, function (dsta) {

                                    });
                                }
                            } else {
                                if (updaterow2[j].Returnquary1 > 0) {
                                    //新增批次信息
                                    var id = $('#tbStockBatchInformation').datagrid("getSelected").Return_factory_detail_id;
                                    $.getJSON("/ShangPinFanChang/InsertPacthInformactions?returnFactoryDetailid=" + id + "&" +
                                        "stockPacthNumber=" + updaterow2[j].pacth + "&" +
                                        "goodsid=" + updaterow2[j].Goods_id + "&" +
                                        "ruternQuary=" + updaterow2[j].Returnquary1 + "&" +
                                        "stockId=" + updaterow2[j].Stock_id,
                                        function (data) {
                                        });
                                }
                            }
                        }
                    }
                    //修改退货单
                    $.getJSON("/ShangPinFanChang/Update_TuiHuoDan?returnFactoryid2=" + returnFactoryid2 + "&" +
                        "contractid=" + contractid2 + "&" +
                        "repertoryPlace=" + $("#cboRepertoryPlace").combobox("getValue") + "&" +
                        "tuiHuoYuanYin=" + $('#cboTuiHuoYuanYin').combobox("getValue") + "&" +
                        "solution=" + $('#txtSolution').val() + "&" +
                        "consigneid=" + jinshouren + "&" +
                        "recordNumber=" + $('#txtRecord_number').val() + "&" +
                        "registrantid=" + dengjiren + "&" +
                        "datdengjishijian=" + $('#datdengjishijian').datetimebox('getValue') + "&" +
                        "returnFactoryNumber=" + $('#tongfancang').val() + "&" +
                        "number=" + $('#fujianzhangshu').val(),
                        function (data1) {
                            if (data1 > 0) {
                                ui.alert("修改成功!!!", false);
                            } else {
                                ui.error("修改失败!!!", false);
                            }
                        });
                });
            }
        }
        //生成删除列,删除列
        function deleteSelect() {
            return "<img  οnclick='javascript:deletess()' src='../../Content/image/delete.png' />";
        }
        //移除datagrid的行
        function deletess() {
            if (editIndex2 == undefined) {
                return;
            }
            $('#tbGoodsInformation').datagrid('cancelEdit', editIndex).datagrid('deleteRow', editIndex2);
            editIndex2 = undefined;
        }
        //清空方法
        function qingKong() {
            $('#txtgonghuodanwei').val('');
            $('#hetonghao').val('');
            $('#txthe').val('');
            $('#txtReturnGoosDepartment1').val('');
            $('#cboRepertoryPlace').combobox('clear');
            $('#txtRepertoryPlace').val('');
            $('#txtnoHaiShuiJinE').val('');
            $('#txtShuiJin').val('');
            $('#txtJiaShuiHeJi').val('');
            $('#txtSupplyOfMaterial').val('');
            $('#txtAdjustAccountsWay').val('');
            $('#cboReturnGoosDepartment').combobox('clear');
            $('#txtReturnGoosDepartmentName').val('');
            $('#txtContractNumber').val('');
            $('#fujianzhangshu').val('');
            $('#tongfancang').val('');
            $('#dengjiren').combobox('clear');
            $('#datdengjishijian').datetimebox('clear');
            $('#cboTuiHuoYuanYin').combobox('clear');
            $('#txtJieJueFangFa').val('');
            $('#txtRecord_number').val('');
            $('#tbStockBatchInformation').datagrid('loadData', { total: 0, rows: [] });
            $('#tbGoodsInformation').datagrid('loadData', { total: 0, rows: [] });
            $('#txtSolution').val('');
        }

        function DeleteReturnFactory() {
            ui.confirm('是否删除???', function (k) {
                if (k) {
                    $.getJSON("/ShangPinFanChang/DeletePacth?returnFactoryid2=" + returnFactoryid2,
                        function (data) {
                            $.getJSON("/ShangPinFanChang/DeleteReturnFactoryDetailid?returnFactoryid2=" + returnFactoryid2,
                                function (data1) {
                                    $.getJSON("/ShangPinFanChang/DeleteReturnFactory?returnFactoryid2=" + returnFactoryid2,
                                        function (data2) {
                                            if (data2 > 0) {
                                                ui.alert('删除成功!!!', 1000, false);
                                                qingKong();
                                            } else {
                                                ui.error('删除失败!!!', 1000, false);
                                            }

                                        });
                                });
                        });
                }
            });
        }

        function ShenHe() {
            if ($('#Auditor').combobox('getValue') == "" || $('#datshenheshijian').datetimebox('getValue') == "" ||
                        $('#datdengjishijian').datetimebox('getValue') == "") {
                ui.error("数据不完整,审核失败!", 1000, false);
                return false;
            }
            var shenHenRen = $('#Auditor').combobox('getValue');
            var shenHeShiJian = $('#datshenheshijian').datetimebox('getValue');
            if (returnFactoryid2 > 0) {
                $.getJSON("/ShangPinFanChang/ShenHe?returnFactoryid2=" + returnFactoryid2 + "&shenHenRen=" + shenHenRen + "&shenHeShiJian=" + shenHeShiJian,
                    function (data) {
                        if (data == true) {
                            ui.alert('审核成功!!!', 1000, false);
                        } else {
                            ui.error('审核失败!!!', 1000, false);
                        }
                    });
            };
        }


</script>

5.1 对控制器的操作代码

using System;
using System.Collections.Generic;
using System.Web.Mvc;
using System.Data;
using BLL商品进仓单;

namespace 大型商贸系统.Controllers
{
    public class ShangPinFanChangController : Controller
    {
        //
        // GET: /ShangPinFanChang/
        readonly ReturnFactory _myReturnFactory = new ReturnFactory();
        public ActionResult TuiHuoDan()
        {
            return View();
        }

        #region 查询所有库存地点
        public ActionResult GetAllRepertory()
        {
            DataTable dt = _myReturnFactory.GetAllRepertory();
            List<Dictionary<string, object>> list = ConvertHelper.DtToList(dt);
            return Json(list, JsonRequestBehavior.AllowGet);
        }
        #endregion

        #region 查询进仓单信息(合同号,供应单位,部门,核算方式)

        public ActionResult SelectRepertoryEnterrInformations()
        {
            DataTable dt = _myReturnFactory.SelectRepertoryEnterrInformations();
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 模糊查询进仓单信息(合同号,供应单位,部门,核算方式)
        public ActionResult MohuiSelectRepertoryEnterrInformations(string strBulr)
        {
            DataTable dt = _myReturnFactory.MohuiSelectRepertoryEnterrInformations(strBulr);
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }
        #endregion

        #region 根据退货部门和合同号绑定库存地点

        public ActionResult BinDingRepertory_placeByreturnDepartmentId(int returnDepartmentId)
        {
            DataTable dt =
                _myReturnFactory.BinDingRepertory_placeByreturnDepartmentId(returnDepartmentId);
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 获取库存地点名称根据库存地点id

        public ActionResult SelectRepertoryPlaceIdByRepertoryPlaceId(int repertoryPlaceId)
        {
            DataTable dt = _myReturnFactory.SelectRepertoryPlaceIdByRepertoryPlaceId(repertoryPlaceId);
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 绑定核算方式下拉框

        public ActionResult SelectAdjustAccountsWay()
        {
            DataTable dt = _myReturnFactory.SelectAdjustAccountsWay();
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 生成配货单据

        public ActionResult SelectReturnRecordNumber()
        {
            DataTable dt = _myReturnFactory.GetOddNumbers(3);
            DataTable dt2 = _myReturnFactory.GetDayMaxQuantity(1);
            string patchNumber = dt.Rows[0]["Prefixs"].ToString().Trim();
            string patchCount = dt2.Rows[0][0].ToString();
            for (int i = patchCount.Length; i < Convert.ToInt32(dt.Rows[0]["Suffix_number"].ToString().Trim()); i++)
            {
                patchCount = "0" + patchCount;
            }
            string recordNumber = patchNumber + patchCount;
            return Json(recordNumber, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 绑定退货原因下拉框
        public ActionResult SelectTuiHuoYuanYin()
        {
            DataTable dt = _myReturnFactory.SelectTuiHuoYuanYin();
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 查询批量增加商品信息
        public ActionResult SelectPiLiangInsertGoodsInformation(int returnGoosDepartment, int repertoryPlace, string strarry)
        {
            DataTable dt = _myReturnFactory.SelectPiLiangInsertGoodsInformation(returnGoosDepartment, repertoryPlace);
            string[] str = strarry.Split(',');
            foreach (string t in str)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (t == dt.Rows[i]["Goods_id"].ToString())
                    {
                        dt.Rows.Remove(dt.Rows[i]);
                    }
                }
            }
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }
        #endregion
        #region 模糊查询批量增加商品信息

        public ActionResult MoHuSelectPiLiangInsertGoodsInformation(string strBur, string id)
        {
            DataTable dt = _myReturnFactory.MoHuSelectPiLiangInsertGoodsInformation(strBur,
                Convert.ToInt32(id));
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 根据商品id查询批量增加商品信息(把数据绑定到退货单上)

        public ActionResult SelectInsertGoodsByGoods_IDandRepertory_place_id(int id, int repertoryPlace)
        {
            DataTable dt = _myReturnFactory.SelectInsertGoodsByGoods_IDandRepertory_place_id(id, repertoryPlace);
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 根据商品id和库存地点id查询退货批次

        public ActionResult SelectPacth(int goodsid, int repertoryPlace)
        {
            DataTable dt = _myReturnFactory.SelectPacth(goodsid, repertoryPlace);
            dt.Columns.Add("Returnquary1", typeof(int));
            dt.Columns.Add("jieCunShu1", typeof(int));
            dt.Columns.Add("TuiHuoJinE1", typeof(decimal));
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["Returnquary1"] = 0;
                dt.Rows[i]["jieCunShu1"] = 0;
                dt.Rows[i]["TuiHuoJinE1"] = 0.00;
            }
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 计算
        //方法,界面传来的参数
        public ActionResult Jisuan(int id, int repertoryPlace, string tuiHuoXiShu)
        {
            //根据id和库存地点来查询新增的商品
            DataTable dt = _myReturnFactory.SelectInsertGoodsByGoods_IDandRepertory_place_id(id, repertoryPlace);
            string msg = "";
            //判断是否有数据
            if (dt.Rows.Count > 0)
            {
                //判断成立,则获取单元格中的值
                var caiGouJinJia = Convert.ToInt32(dt.Rows[0]["Purchase_bid"]);
                var jinXiangShuiLv = Convert.ToInt32(dt.Rows[0]["Input_ratio"]);
                var haiShuiJinJia = Convert.ToInt32(dt.Rows[0]["Tax_inclusive_price"]);
                var nohaiShuiJinE = caiGouJinJia * Convert.ToInt32(tuiHuoXiShu);
                var shuiJin = caiGouJinJia * jinXiangShuiLv * Convert.ToInt32(tuiHuoXiShu);
                var jiaShuiHeJi = haiShuiJinJia * Convert.ToInt32(tuiHuoXiShu);
                msg += "¥" + nohaiShuiJinE + "," + "¥" + shuiJin + "," + "¥" + jiaShuiHeJi;
            }
            return Json(msg, JsonRequestBehavior.AllowGet);

        }

        #endregion
        #region 获取员工信息(经手人)

        public ActionResult GetEemployeeInformation()
        {
            DataTable dt = _myReturnFactory.GetEemployeeInformation();
            List<Dictionary<string, Object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 查询退货单

        public ActionResult SelectTuiHuoDan()
        {
            DataTable dt = _myReturnFactory.SelectTuiHuoDan();
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 模糊查询退货单信息

        public ActionResult MohuiSelectTuiHUoDan(string strBulr)
        {
            DataTable dt = _myReturnFactory.MohuiSelectTuiHUoDan(strBulr);
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }
        #endregion
        #region 绑定退货明细(根据退货单id)

        public ActionResult BingDingTuiHuoMingXi(int returnfactoryid)
        {
            DataTable dt = _myReturnFactory.BingDingTuiHuoMingXi(returnfactoryid);
            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 根据退货明细id查询批次信息

        public ActionResult SelectPacthInformations(int returnFactoryDetailid, int goodsid, int repertoryPlace)
        {
            DataTable dt = _myReturnFactory.SelectPacthInformations(returnFactoryDetailid);
            DataTable dt2 = _myReturnFactory.SelectPacth(goodsid, repertoryPlace);
            int k = dt.Rows.Count;
            for (int j = 0; j < k; j++)
            {
                var kuCunDiDianid = Convert.ToInt32(dt.Rows[j]["Stock_id"]);
                for (int i = 0; i < dt2.Rows.Count; i++)
                {
                    var kuCunDiDianid2 = Convert.ToInt32(dt2.Rows[i]["Stock_id"]);
                    if (kuCunDiDianid == kuCunDiDianid2)
                    {
                        dt2.Rows.Remove(dt2.Rows[i]);
                    }
                }
            }
            for (int i = 0; i < dt2.Rows.Count; i++)
            {
                dt.ImportRow(dt2.Rows[i]);
            }

            List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
            return Json(listReturn, JsonRequestBehavior.AllowGet);
        }

        #endregion
        #region 新增退货单

        public ActionResult Insert_TuiHuo(string contractid, string repertoryPlace,
            string tuiHuoYuanYin, string solution, string consigneid,
            string recordNumber, string registrantid, string datdengjishijian,
            string returnFactoryNumber, string number)
        {
            DataTable dt = _myReturnFactory.Insert_TuiHuo(Convert.ToInt32(contractid),
                Convert.ToInt32(repertoryPlace),
                Convert.ToInt32(tuiHuoYuanYin),
                solution,
                Convert.ToInt32(consigneid),
                recordNumber,
                Convert.ToInt32(registrantid),
                Convert.ToDateTime(datdengjishijian),
                returnFactoryNumber,
                number);
            return Content((dt.Rows[0][0].ToString()));
        }

        #endregion
        #region 新增退货明细单

        public ActionResult Insert_TuiHuoMingXi(string returnfactoryid, string goodsid,
            string tuiHuoShu, string repertoryPlaceId)
        {
            DataTable dt = _myReturnFactory.Insert_TuiHuoMingXi(Convert.ToInt32(returnfactoryid),
                Convert.ToInt32(goodsid),
                Convert.ToInt32(tuiHuoShu),
                Convert.ToInt32(repertoryPlaceId));
            return Content((dt.Rows[0][0].ToString()));
        }

        #endregion
        #region 新增退货批次

        public void Insert_ReturnPacth(string returnFactoryDetailid,
            string returnfactoryid, string stockPacthNumber, string goodsid,
            string ruternQuary, string stockId)
        {
            _myReturnFactory.Insert_ReturnPacth(Convert.ToInt32(returnFactoryDetailid),
                Convert.ToInt32(returnfactoryid),
                stockPacthNumber,
                Convert.ToInt32(goodsid),
                Convert.ToInt32(ruternQuary),
                Convert.ToInt32(stockId));
        }
        #endregion
        #region 修改退货单
        public int Update_TuiHuoDan(string returnFactoryid2, string contractid,
            string repertoryPlace, string tuiHuoYuanYin, string solution, string consigneid,
            string recordNumber, string registrantid, string datdengjishijian, string returnFactoryNumber,
            string number)
        {
            int dt = _myReturnFactory.Update_TuiHuoDan(Convert.ToInt32(returnFactoryid2),
                Convert.ToInt32(contractid),
                Convert.ToInt32(repertoryPlace),
                Convert.ToInt32(tuiHuoYuanYin),
                solution,
                Convert.ToInt32(consigneid),
                recordNumber,
                Convert.ToInt32(registrantid),
                Convert.ToDateTime(datdengjishijian),
                returnFactoryNumber,
                number);
            return dt;
        }
        #endregion
		#region 修改退货单明细

		//修改返厂明细
		public ActionResult Update_ReturnDetail(int returnFactoryDetailid, string goodsQuantityRecede)
		{
			int k = _myReturnFactory.Update_ReturnDetail(returnFactoryDetailid, ConvertHelper.ConverToInt(goodsQuantityRecede));
			return Json(k, JsonRequestBehavior.AllowGet);
		}
		//修改批次信息
		public int UpdatePacthInformations(int returnPacthid, int stockQuantity)
		{
			return _myReturnFactory.UpdatePacthInformations(returnPacthid, stockQuantity);
		}
		//删除批次信息
		public int DeletePacthInformations(int returnPacthid)
		{
			return _myReturnFactory.DeletePacthInformations(returnPacthid);
		}
		//新增批次
		public int InsertPacthInformactions(string returnFactoryDetailid, 
			string stockPacthNumber, string goodsid, string ruternQuary, string stockId)
		{
			int dt = _myReturnFactory.InsertPacthInformaction(
				Convert.ToInt32(returnFactoryDetailid),
				stockPacthNumber,
				Convert.ToInt32(goodsid),
				Convert.ToInt32(ruternQuary),
				Convert.ToInt32(stockId));
			return dt;
		}

		#endregion
        #region 删除
        //(1)删除批次
        public int DeletePacth(int returnFactoryid2)
        {
            return _myReturnFactory.DeletePacth(returnFactoryid2);
        }

        //(2)删除返厂明细
        public int DeleteReturnFactoryDetailid(int returnFactoryid2)
        {
            return _myReturnFactory.DeleteReturnFactoryDetailid(returnFactoryid2);
        }

        //(3)删除返厂单
        public int DeleteReturnFactory(int returnFactoryid2)
        {
            return _myReturnFactory.DeleteReturnFactory(returnFactoryid2);
        }

        #endregion
        #region 审核
        public ActionResult ShenHe(int returnFactoryid2, int shenHenRen, string shenHeShiJian)
        {
            DataTable dt = _myReturnFactory.ShenHeSelectMingXi(returnFactoryid2);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                var mingXiid = Convert.ToInt32(dt.Rows[i]["Return_factory_detail_id"].ToString());
                int dt2 = _myReturnFactory.ShenHeUpdateMingXi(mingXiid);

            }
            int dt3 = _myReturnFactory.ShenHeUpdateTuiHuoDan(returnFactoryid2, shenHenRen, Convert.ToDateTime(shenHeShiJian));
            //int dt4 = _myReturnFactory.ShenHeInsert(shenHenRen, Convert.ToDateTime(shenHeShiJian));
            return Json(true, JsonRequestBehavior.AllowGet);

        }
        #endregion
    }
}

5.2 对逻辑层操作代码

using System;
using System.Data;
using System.Data.SqlClient;
using DALPublic;
namespace BLL商品进仓单
{
    public class ReturnFactory
    {
        readonly DALMethod _myDalMethod = new DALMethod();
        #region 查询进仓单信息(合同号,供应单位,部门,核算方式)
        public DataTable SelectRepertoryEnterrInformations()
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
		  };
            sql[0].Value = "SelectRepertoryEnterrInformations";
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }
        #endregion
        #region 模糊查询进仓单信息(合同号,供应单位,部门,核算方式)

        public DataTable MohuiSelectRepertoryEnterrInformations(string strBur)
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
			  new SqlParameter("@strBur", SqlDbType.Char),
		  };
            sql[0].Value = "MohuiSelectRepertoryEnterrInformations";
            sql[1].Value = strBur;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;

        }

        #endregion
        #region 根据退货部门和合同号绑定库存地点

        public DataTable BinDingRepertory_placeByreturnDepartmentId(int departmentId)
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
			  new SqlParameter("@Department_id", SqlDbType.Int),
		  };
            sql[0].Value = "BinDingRepertory_placeByreturnDepartmentId";
            sql[1].Value = departmentId;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        #endregion
        #region 获取库存地点名称根据库存地点id

        public DataTable SelectRepertoryPlaceIdByRepertoryPlaceId(int repertoryPlaceId)
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
			  new SqlParameter("@Repertory_place_id", SqlDbType.Int),
		  };
            sql[0].Value = "SelectRepertoryPlaceIdByRepertoryPlaceId";
            sql[1].Value = repertoryPlaceId;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        #endregion
        #region 绑定核算方式下拉框

        public DataTable SelectAdjustAccountsWay()
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
		  };
            sql[0].Value = "SelectAdjustAccountsWay";
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        #endregion
        #region 获取当前日最大单据

        public DataTable GetDayMaxQuantity(int dayMaxQuantityId)
        {
            SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Day_max_quantity_id",SqlDbType.Int), 
			};
            sql[0].Value = "GetDayMaxQuantity";
            sql[1].Value = dayMaxQuantityId;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("Update_Day_Max_Count", sql);
            return dt;
        }
        #endregion
        #region 获取记录编号前缀

        public DataTable GetOddNumbers(int intOddNumbersId)
        {
            SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Odd_numbers_id",SqlDbType.Int), 
			};
            sql[0].Value = "GetOddNumbers";
            sql[1].Value = intOddNumbersId;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("Update_Day_Max_Count", sql);
            return dt;
        }

        #endregion
        #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
        #region 查询批量增加商品信息

        public DataTable SelectPiLiangInsertGoodsInformation(int returnGoosDepartment, int repertoryPlace)
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
			  new SqlParameter("@Department_id", SqlDbType.Int),
			  new SqlParameter("@Repertory_place_id",SqlDbType.Int), 
		  };
            sql[0].Value = "SelectPiLiangInsertGoodsInformation";
            sql[1].Value = returnGoosDepartment;
            sql[2].Value = repertoryPlace;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        #endregion
        #region 模糊查询批量增加商品信息

        public DataTable MoHuSelectPiLiangInsertGoodsInformation(string strBur, int repertoryPlace)
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
			  new SqlParameter("@strBur", SqlDbType.Char),
			  new SqlParameter("@Repertory_place_id",SqlDbType.Int), 
		  };
            sql[0].Value = "MoHuSelectPiLiangInsertGoodsInformation";
            sql[1].Value = strBur;
            sql[2].Value = repertoryPlace;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        #endregion
        #region 根据商品id查询批量增加商品信息(把数据绑定到退货单上)

        public DataTable SelectInsertGoodsByGoods_IDandRepertory_place_id(int goodsId, int repertoryPlaceId)
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
			  new SqlParameter("@Goods_id",SqlDbType.Int), 
			  new SqlParameter("@Repertory_place_id", SqlDbType.Int),
		  };
            sql[0].Value = "SelectInsertGoodsByGoods_IDandRepertory_place_id";
            sql[1].Value = goodsId;
            sql[2].Value = repertoryPlaceId;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        #endregion
        #region 根据商品id和库存地点id查询退货批次

        public DataTable SelectPacth(int goodsId, int repertoryPlaceId)
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
			  new SqlParameter("@Goods_id", SqlDbType.Int),
			  new SqlParameter("@Repertory_place_id", SqlDbType.Int),
		  };
            sql[0].Value = "SelectPacth";
            sql[1].Value = goodsId;
            sql[2].Value = repertoryPlaceId;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        #endregion
        #region 获取员工信息(经手人)

        public DataTable GetEemployeeInformation()
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
		  };
            sql[0].Value = "GetEemployeeInformation";
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        #endregion
        #region 查询退货单

        public DataTable SelectTuiHuoDan()
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
		  };
            sql[0].Value = "SelectTuiHuoDan";
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        #endregion
        #region 模糊查询退货单信息
        public DataTable MohuiSelectTuiHUoDan(string strBur)
        {
            SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@strBur", SqlDbType.Char),
			};
            sql[0].Value = "mohuiSelectTuiHUoDan";
            sql[1].Value = strBur;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        #endregion
        #region 绑定退货明细(根据退货单id)

        public DataTable BingDingTuiHuoMingXi(int returnFactoryId)
        {
            SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Return_factory_id", SqlDbType.Int),
			};
            sql[0].Value = "BingDingTuiHuoMingXi";
            sql[1].Value = returnFactoryId;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        #endregion
        #region 根据退货明细id查询批次信息

        public DataTable SelectPacthInformations(int returnFactoryDetailId)
        {
            SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Return_factory_detail_id", SqlDbType.Int),
			};
            sql[0].Value = "SelectPacthInformations";
            sql[1].Value = returnFactoryDetailId;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        #endregion
        #region 新增退货单 Contract_id, Repertory_place_id, Goods_return_reasonpubid, Solution, Consignee_id, Record_number, Registrant_id, Register_time

        public DataTable Insert_TuiHuo(int contractId, int repertoryPlaceId,
            int goodsReturnReasonpubid, string solution, int consigneeId,
            string recordNumber, int registrantId, DateTime registerTime,
            string returnFactoryNumber, string number)
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
			  new SqlParameter("@Contract_id", SqlDbType.Int),
			  new SqlParameter("@Repertory_place_id", SqlDbType.Int),
			  new SqlParameter("@Goods_return_reasonpubid", SqlDbType.Int),
			  new SqlParameter("@Solution", SqlDbType.Char),
			  new SqlParameter("Consignee_id", SqlDbType.Int),
			  new SqlParameter("Record_number", SqlDbType.Char),
			  new SqlParameter("@Registrant_id", SqlDbType.Int),
			  new SqlParameter("@Register_time", SqlDbType.DateTime),
			  new SqlParameter("@Return_factory_Number",SqlDbType.Char),
 			  new SqlParameter("@Number",SqlDbType.Char), 
		  };
            sql[0].Value = "Insert_TuiHuo";
            sql[1].Value = contractId;
            sql[2].Value = repertoryPlaceId;
            sql[3].Value = goodsReturnReasonpubid;
            sql[4].Value = solution;
            sql[5].Value = consigneeId;
            sql[6].Value = recordNumber;
            sql[7].Value = registrantId;
            sql[8].Value = registerTime;
            sql[9].Value = returnFactoryNumber;
            sql[10].Value = number;
            return _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);

        }

        #endregion
        #region 新增退货明细单 Return_factory_id, Goods_id, Goods_quantity_recede, Repertory_place_recede_id

        public DataTable Insert_TuiHuoMingXi(int returnFactoryId, int goodsId, int goodsQuantityRecede,
            int repertoryPlaceRecedeId)
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
			  new SqlParameter("@Return_factory_id", SqlDbType.Int),
			  new SqlParameter("@Goods_id", SqlDbType.Int),
			  new SqlParameter("@Goods_quantity_recede", SqlDbType.Int),
			  new SqlParameter("@Repertory_place_recede_id", SqlDbType.Int),
		  };
            sql[0].Value = "Insert_TuiHuoMingXi";
            sql[1].Value = returnFactoryId;
            sql[2].Value = goodsId;
            sql[3].Value = goodsQuantityRecede;
            sql[4].Value = repertoryPlaceRecedeId;
            return _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
        }

        #endregion
        #region 新增退货批次 Repertory_enter_detail_id, Return_factory_id, StockPacthNumber, Goods_id, RuternQuary, Stock_id

        public int Insert_ReturnPacth(int returnFactoryDetailId, int returnFactoryId, string stockPacthNumber, int goodsId,
            int ruternQuary, int stockId)
        {
            SqlParameter[] sql =
		  {
			  new SqlParameter("@NB", SqlDbType.Char),
			  new SqlParameter("@Return_factory_detail_id", SqlDbType.Int),
			  new SqlParameter("@Return_factory_id", SqlDbType.Int),
			  new SqlParameter("@StockPacthNumber", SqlDbType.Char),
			  new SqlParameter("@Goods_id", SqlDbType.Int),
			  new SqlParameter("@RuternQuary", SqlDbType.Int),
			  new SqlParameter("@Stock_id", SqlDbType.Int),

		  };
            sql[0].Value = "Insert_ReturnPacth";
            sql[1].Value = returnFactoryDetailId;
            sql[2].Value = returnFactoryId;
            sql[3].Value = stockPacthNumber;
            sql[4].Value = goodsId;
            sql[5].Value = ruternQuary;
            sql[6].Value = stockId;
            return _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);
        }

        #endregion
        #region 查询所有库存地点
        public DataTable GetAllRepertory()
        {
            SqlParameter[] sql =
			{
				new SqlParameter("@NB",SqlDbType.Char), 
			};
            sql[0].Value = "GetAllRepertory";
            return _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
        }
        #endregion
        #region 修改退货单

        public int Update_TuiHuoDan(int returnFactoryId, int contractId,
            int repertoryPlaceId, int goodsReturnReasonpubid, string solution,
            int consigneeId, string recordNumber, int registrantId,
            DateTime registerTime, string returnFactoryNumber, string number)
        {
            SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Return_factory_id", SqlDbType.Int),
				new SqlParameter("@Contract_id", SqlDbType.Int),
				new SqlParameter("@Repertory_place_id", SqlDbType.Int),
				new SqlParameter("@Goods_return_reasonpubid", SqlDbType.Int),
				new SqlParameter("@Solution", SqlDbType.Char),
				new SqlParameter("@Consignee_id", SqlDbType.Int),
				new SqlParameter("@Record_number", SqlDbType.Char),
				new SqlParameter("@Registrant_id", SqlDbType.Int),
				new SqlParameter("@Register_time", SqlDbType.DateTime),
				new SqlParameter("@Return_factory_Number", SqlDbType.Char),
				new SqlParameter("@Number", SqlDbType.Char),
			};
            sql[0].Value = "Update_TuiHuoDan";
            sql[1].Value = returnFactoryId;
            sql[2].Value = contractId;
            sql[3].Value = repertoryPlaceId;
            sql[4].Value = goodsReturnReasonpubid;
            sql[5].Value = solution;
            sql[6].Value = consigneeId;
            sql[7].Value = recordNumber;
            sql[8].Value = registrantId;
            sql[9].Value = registerTime;
            sql[10].Value = returnFactoryNumber;
            sql[11].Value = number;
            return _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);

        }

        #endregion
		#region 修改退货单明细
		//删除批次明细
		public int DeletePacthInformations(int returnPacthid)
		{
			SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@ReturnPacthid", SqlDbType.Int),
			};
			sql[0].Value = "DeletePacthInformations";
			sql[1].Value = returnPacthid;
			return _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);
		}
		//修改批次信息
		public int UpdatePacthInformations(int returnPacthid, int ruternQuary)
		{
			SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@ReturnPacthid", SqlDbType.Int),
				new SqlParameter("@RuternQuary", SqlDbType.Int),
			};
			sql[0].Value = "UpdatePacthInformations";
			sql[1].Value = returnPacthid;
			sql[2].Value = ruternQuary;
			return _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);
		}
		//新增批次
		public int InsertPacthInformaction(int returnFactoryDetailId,
			string stockPacthNumber, int goodsId, int ruternQuary, int stockId)
		{
			SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Return_factory_detail_id", SqlDbType.Int),
				new SqlParameter("@StockPacthNumber", SqlDbType.Char),
				new SqlParameter("@Goods_id", SqlDbType.Int),
				new SqlParameter("@RuternQuary", SqlDbType.Int),
				new SqlParameter("@Stock_id", SqlDbType.Int),
			};
			sql[0].Value = "InsertPacthInformactions";
			sql[1].Value = returnFactoryDetailId;
			sql[2].Value = stockPacthNumber;
			sql[3].Value = goodsId;
			sql[4].Value = ruternQuary;
			sql[5].Value = stockId;
			return _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);
		}
		//(1)删除商品信息批次明细
		public int DeleteShangPinPacthByreturnFactoryDetailid(int returnFactoryDetailId)
		{
			SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Return_factory_detail_id", SqlDbType.Int),
			};
			sql[0].Value = "DeleteShangPinPacthByreturnFactoryDetailid";
			sql[1].Value = returnFactoryDetailId;
			return _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);
		}

		public int DeleteShangPinPacthMingXi(int returnFactoryDetailId)
		{
			SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Int),
				new SqlParameter("@Return_factory_detail_id", SqlDbType.Int),
			};
			sql[0].Value = "DeleteShangPinPacthMingXi";
			sql[1].Value = returnFactoryDetailId;
			return _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);
		}


		//(3)新增退货明细(商品信息)
		public int InsertReturnFactoryDetail(int returnFactoryId, int goodsId,
			int goodsQuantityRecede, int repertoryPlaceRecedeId)
		{
			SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Return_factory_id", SqlDbType.Int),
				new SqlParameter("@Goods_id", SqlDbType.Int),
				new SqlParameter("@Goods_quantity_recede", SqlDbType.Int),
				new SqlParameter("@Repertory_place_recede_id", SqlDbType.Int),
			};
			sql[0].Value = "InsertReturnFactoryDetail";
			sql[1].Value = returnFactoryId;
			sql[2].Value = goodsId;
			sql[3].Value = goodsQuantityRecede;
			sql[4].Value = repertoryPlaceRecedeId;
			return _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);
		}

		#endregion

        #region 删除
        //(1)删除批次
        public int DeletePacth(int returnFactoryId)
        {
            SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Return_factory_id", SqlDbType.Int),
			};
            sql[0].Value = "DeletePacth";
            sql[1].Value = returnFactoryId;
            return _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);
        }

        //(2)删除返厂明细
        public int DeleteReturnFactoryDetailid(int returnFactoryId)
        {
            SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Return_factory_id", SqlDbType.Int),
			};
            sql[0].Value = "DeleteReturnFactoryDetailid";
            sql[1].Value = returnFactoryId;
            return _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);
        }

        //(3)删除返厂单
        public int DeleteReturnFactory(int returnFactoryId)
        {
            SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Return_factory_id", SqlDbType.Int),
			};
            sql[0].Value = "DeleteReturnFactory";
            sql[1].Value = returnFactoryId;
            return _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);

        }
        #endregion
        #region 审核
        public DataTable ShenHeSelectMingXi(int returnFactoryid2)
        {
            SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Return_factory_id", SqlDbType.Int),
			};
            sql[0].Value = "ShenHeSelectMingXi";
            sql[1].Value = returnFactoryid2;
            DataTable dt = _myDalMethod.DAL_SelectDB_Par("ReturnFactory", sql);
            return dt;
        }

        public int ShenHeUpdateMingXi(int mingXiid)
        {
            SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Return_factory_detail_id", SqlDbType.Int),
			};
            sql[0].Value = "ShenHeUpdateMingXi";
            sql[1].Value = mingXiid;
            int dt = _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);
            return dt;
        }

        public int ShenHeUpdateTuiHuoDan(int returnFactoryid2, int shenHenRen, DateTime shenHeShiJian)
        {
            SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Return_factory_id", SqlDbType.Int),
				new SqlParameter("@Auditor_id", SqlDbType.Int),
				new SqlParameter("@Review_time", SqlDbType.DateTime),
			};
            sql[0].Value = "ShenHeUpdateTuiHuoDan";
            sql[1].Value = returnFactoryid2;
            sql[2].Value = shenHenRen;
            sql[3].Value = shenHeShiJian;
            int dt = _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);
            return dt;
        }
        #endregion
		//修改返厂明细
		public int Update_ReturnDetail(int returnDetailId,int quantity)
		{
			SqlParameter[] sql =
			{
				new SqlParameter("@NB", SqlDbType.Char),
				new SqlParameter("@Return_factory_detail_id", SqlDbType.Int),
				new SqlParameter("@Goods_quantity_recede", SqlDbType.Int),
			};
			sql[0].Value = "Update_ReturnDetail";
			sql[1].Value = returnDetailId;
			sql[2].Value = quantity;
			int dt = _myDalMethod.DAL_OPTableDB_Par("ReturnFactory", sql);
			return dt;
		}
    }
}

5.4          对存储过程操作代码

USE [大型商贸系统]
GO
/****** Object:  StoredProcedure [dbo].[ReturnFactory]    Script Date: 07/02/2015 09:01:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[ReturnFactory]
@NB char(200)='',@Contract_number char(20)='',@Department_id int=0,
@Repertory_place_id int=0,@Repertory_enter_id int=0,@strBur char(20)='',
@Goods_id int=0,@Agreement_id int=0,@Contract_id int=0,@Goods_return_reasonpubid int=0,
@Solution char(100)='',@Consignee_id int=0,@Record_number char(20)='',@Registrant_id int=0,
@Register_time datetime='',@Return_repertory_id int=0,@Return_factory_id int=0,@Goods_quantity_recede int=0,
@Repertory_place_recede_id int=0,@Repertory_enter_detail_id int=0,@StockPacthNumber char(20)='',@RuternQuary int=0,
@Stock_id int=0,@Return_factory_Number char(20)='',@Number char(10)='',@Return_factory_detail_id int=0,
@ReturnPacthid int=0,@Review_time datetime='',@Auditor_id int=0

AS
BEGIN
--查询进仓单信息(合同号,供应单位,部门,核算方式)
if(@NB='SelectRepertoryEnterrInformations')
begin
SELECT     Repertory_enter.Review_deny, Agreement.Contract_number, Department.Department_name AS ReturnDepartmentName, Department.Department_code AS ReturnDepartmentCode, 
                      Supply_units.Supply_units_id, Attribute_gather_detail.Attribute_gather_detail_name AS AdjustAccountsWay, Enterprise_name.Chinese, Goods_indent.Agreement_id, Agreement.Purchase_unit_id, 
                      Repertory_enter.YouXiaoFou, Repertory_enter.ChongHongFou
FROM         Supply_units INNER JOIN
                      Agreement ON Supply_units.Supply_units_id = Agreement.Supply_units_id INNER JOIN
                      Enterprise_name ON Supply_units.Enterprise_name_id = Enterprise_name.Enterprise_name_id INNER JOIN
                      Attribute_gather_detail ON Agreement.Adjust_accounts_way_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
                      Department ON Agreement.Purchase_unit_id = Department.Department_id INNER JOIN
                      Goods_indent ON Agreement.Agreement_id = Goods_indent.Agreement_id INNER JOIN
                      Repertory_enter ON Goods_indent.Indent_id = Repertory_enter.Indent_id
WHERE     (Repertory_enter.Review_deny = 'true'and Repertory_enter.YouXiaoFou='true'and Repertory_enter.ChongHongFou='false')
GROUP BY Repertory_enter.Review_deny,Repertory_enter.YouXiaoFou,Repertory_enter.ChongHongFou, Agreement.Contract_number, Department.Department_name, Department.Department_code, Supply_units.Supply_units_id, 
                      Attribute_gather_detail.Attribute_gather_detail_name, Enterprise_name.Chinese, Goods_indent.Agreement_id, Agreement.Purchase_unit_id
end
--模糊查询进仓单信息(合同号,供应单位,部门,核算方式)
if(@NB='MohuiSelectRepertoryEnterrInformations')
begin
SELECT     Repertory_enter.Review_deny, Agreement.Contract_number, Department.Department_name AS ReturnDepartmentName, Department.Department_code AS ReturnDepartmentCode, 
                      Supply_units.Supply_units_id, Department.Department_id, Attribute_gather_detail.Attribute_gather_detail_name AS AdjustAccountsWay, Enterprise_name.Chinese, 
                      Goods_indent.Agreement_id
FROM         Supply_units INNER JOIN
                      Agreement ON Supply_units.Supply_units_id = Agreement.Supply_units_id INNER JOIN
                      Enterprise_name ON Supply_units.Enterprise_name_id = Enterprise_name.Enterprise_name_id INNER JOIN
                      Attribute_gather_detail ON Agreement.Adjust_accounts_way_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
                      Department ON Agreement.Purchase_unit_id = Department.Department_id INNER JOIN
                      Goods_indent ON Agreement.Agreement_id = Goods_indent.Agreement_id INNER JOIN
                      Repertory_enter ON Goods_indent.Indent_id = Repertory_enter.Indent_id
WHERE     (Repertory_enter.Review_deny = 'true')
GROUP BY Repertory_enter.Review_deny, Agreement.Contract_number, Department.Department_name, Department.Department_code, Supply_units.Supply_units_id, Department.Department_id, 
                      Attribute_gather_detail.Attribute_gather_detail_name, Enterprise_name.Chinese, Goods_indent.Agreement_id
Having Agreement.Contract_number like '%'+ rtrim(ltrim(@strBur)) +'%' 
end
----根据退货部门和合同号绑定库存地点
if(@NB='BinDingRepertory_placeByreturnDepartmentId')
begin
SELECT     Repertory_place_id, Repertory_place_identifier
FROM         Repertory_place
WHERE     (Department_id = @Department_id)
end
--获取库存地点名称根据库存地点id
if(@NB='SelectRepertoryPlaceIdByRepertoryPlaceId')
begin
SELECT     Repertory_place_id, Repertory_place_name
FROM         Repertory_place
where Repertory_place_id=@Repertory_place_id
end
--绑定核算方式下拉框
if(@NB='SelectAdjustAccountsWay')
begin
SELECT     Attribute_gather_detail_id AS AdjustAccountsWayid, Attribute_gather_detail_name AS AdjustAccountsWayName
FROM         Attribute_gather_detail
where Attribute_gather_id=3
end
--绑定退货原因下拉框
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
--查询批量增加商品信息
if(@NB='SelectPiLiangInsertGoodsInformation')
begin
SELECT     Goods.Goods_id,Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Art_No, Goods.Format_model, Agreement.Contract_number, Goods.Agreement_id, 
                      Attribute_gather_detail.Attribute_gather_detail_name AS JiLiangDanWei, Goods.Quality_content, Goods.Input_ratio, Goods.Output_ratio, Goods.Goods_colours, 
                      Attribute_gather_detail_1.Attribute_gather_detail_name AS BaoZhiQi, Attribute_gather_detail_2.Attribute_gather_detail_name AS ShangPinFenLei, Goods.Plncode_PLN, Goods.Goods_abbreviation, 
                      Attribute_gather_detail_3.Attribute_gather_detail_name AS ShiYongDuiXiang,  Goods.Count_scale, 
                      Attribute_gather_detail_4.Attribute_gather_detail_name AS ZhiLiangDengJi, Manage_season.Manage_season_name AS JiYingJiJie, 
                      Attribute_gather_detail_5.Attribute_gather_detail_name AS ChanPinZhuangTai, CONVERT(varchar(20), Goods.Register_time, 120) AS Register_time, CONVERT(varchar(20), Goods.Review_time, 120) 
                      AS Review_time, Eemployee_1.Employee_name AS DengJiRen, Goods.Registrant_id, Goods.Auditor_id, Eemployee.Employee_name AS ShenHeRen, CONVERT(varchar(20), Goods.Update_Time, 
                      120) AS Update_Time, Goods.Update_person_id, Eemployee_2.Employee_name AS GengXinRen, Goods.Retail_unit_price, Goods.Purchase_bid, 
                      Goods.Mini_fix_goods_deny,Goods_rademark.Goods_rademark_name AS rademark, Manufacturer.Manufacturer_name AS ShengChanChangJiaMC, 
                      Goods_producing_area.Producing_area_name AS ChanDiMC, Stock.Repertory_place_id, SUM(Stock.Stock_quantity) AS Expr1,Goods.Vender_bar_code_deny, Goods.Copy_record_deny, Goods.Self_fix_goods_deny, Goods.Permit_decimal_deny
FROM         Stock INNER JOIN
                      Goods INNER JOIN
                      Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN
                      Attribute_gather_detail ON Goods.Unit_of_measurement_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_1 ON Goods.Quality_guarantee_period_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods.Goods_classify_pubid = Attribute_gather_detail_2.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_3 ON Goods.Use_target_pubid = Attribute_gather_detail_3.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_4 ON Goods.Quality_grade_pubid = Attribute_gather_detail_4.Attribute_gather_detail_id INNER JOIN
                      Manage_season ON Goods.Manage_season_id = Manage_season.Manage_season_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_5 ON Goods.Product_status_pubid = Attribute_gather_detail_5.Attribute_gather_detail_id INNER JOIN
                      Eemployee AS Eemployee_1 ON Goods.Registrant_id = Eemployee_1.Employee_id INNER JOIN
                      Eemployee ON Goods.Auditor_id = Eemployee.Employee_id INNER JOIN
                      Eemployee AS Eemployee_2 ON Goods.Update_person_id = Eemployee_2.Employee_id INNER JOIN
                      Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id INNER JOIN
                      Manufacturer ON Goods.Manufacturer_id = Manufacturer.Manufacturer_id INNER JOIN
                      Goods_producing_area ON Goods.Producing_area_id = Goods_producing_area.Producing_area_id ON Stock.Goods_id = Goods.Goods_id
where      (Stock.Repertory_place_id = @Repertory_place_id)
GROUP BY Goods.Goods_id,Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Art_No, Goods.Format_model, Agreement.Contract_number, Goods.Agreement_id, 
                      Attribute_gather_detail.Attribute_gather_detail_name, Goods.Quality_content, Goods.Input_ratio, Goods.Output_ratio, Goods.Goods_colours, Attribute_gather_detail_1.Attribute_gather_detail_name, 
                      Attribute_gather_detail_2.Attribute_gather_detail_name, Goods.Plncode_PLN, Goods.Goods_abbreviation, Attribute_gather_detail_3.Attribute_gather_detail_name, Goods.Count_scale, 
                      Attribute_gather_detail_4.Attribute_gather_detail_name, Manage_season.Manage_season_name, Attribute_gather_detail_5.Attribute_gather_detail_name, CONVERT(varchar(20), 
                      Goods.Register_time, 120), CONVERT(varchar(20), Goods.Review_time, 120), Eemployee_1.Employee_name, Goods.Registrant_id, Goods.Auditor_id, Eemployee.Employee_name, 
                      CONVERT(varchar(20), Goods.Update_Time, 120), Goods.Update_person_id, Eemployee_2.Employee_name, Goods.Retail_unit_price, Goods.Purchase_bid, Goods.Mini_fix_goods_deny, 
                      Goods_rademark.Goods_rademark_name, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name, Stock.Repertory_place_id
,Goods.Vender_bar_code_deny, Goods.Copy_record_deny, Goods.Self_fix_goods_deny, Goods.Permit_decimal_deny

end
 --模糊查询批量增加商品信息
 if(@NB='MoHuSelectPiLiangInsertGoodsInformation')
 begin
 SELECT     Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Art_No, Goods.Format_model, Agreement.Contract_number, Goods.Agreement_id, 
                      Attribute_gather_detail.Attribute_gather_detail_name AS JiLiangDanWei, Goods.Quality_content, Goods.Input_ratio, Goods.Output_ratio, Goods.Goods_colours, 
                      Attribute_gather_detail_1.Attribute_gather_detail_name AS BaoZhiQi, Attribute_gather_detail_2.Attribute_gather_detail_name AS ShangPinFenLei, Goods.Plncode_PLN, Goods.Goods_abbreviation, 
                      Attribute_gather_detail_3.Attribute_gather_detail_name AS ShiYongDuiXiang, Goods.Copy_record_deny, Goods.Vender_bar_code_deny, Goods.Count_scale, 
                      Attribute_gather_detail_4.Attribute_gather_detail_name AS ZhiLiangDengJi, Manage_season.Manage_season_name AS JiYingJiJie, 
                      Attribute_gather_detail_5.Attribute_gather_detail_name AS ChanPinZhuangTai, CONVERT(varchar(20), Goods.Register_time, 120) AS Register_time, CONVERT(varchar(20), Goods.Review_time, 120) 
                      AS Review_time, Eemployee_1.Employee_name AS DengJiRen, Goods.Registrant_id, Goods.Auditor_id, Eemployee.Employee_name AS ShenHeRen, CONVERT(varchar(20), Goods.Update_Time, 
                      120) AS Update_Time, Goods.Update_person_id, Eemployee_2.Employee_name AS GengXinRen, Goods.Retail_unit_price, Goods.Purchase_bid, Goods.Self_fix_goods_deny, 
                      Goods.Mini_fix_goods_deny, Goods.Permit_decimal_deny, Goods_rademark.Goods_rademark_name AS rademark, Manufacturer.Manufacturer_name AS ShengChanChangJiaMC, 
                      Goods_producing_area.Producing_area_name AS ChanDiMC, Department.Department_name, Repertory_enter_detail.Goods_id, Repertory_enter_detail.Repertory_enter_detail_Farid, 
                      Stock.Repertory_place_id, SUM(Stock.Stock_quantity) AS Expr1
FROM         Department INNER JOIN
                      Repertory_place INNER JOIN
                      Stock ON Repertory_place.Repertory_place_id = Stock.Repertory_place_id ON Department.Department_id = Repertory_place.Department_id INNER JOIN
                      Repertory_enter_detail ON Stock.Repertory_enter_detail_id = Repertory_enter_detail.Repertory_enter_detail_id INNER JOIN
                      Goods INNER JOIN
                      Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN
                      Attribute_gather_detail ON Goods.Unit_of_measurement_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_1 ON Goods.Quality_guarantee_period_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods.Goods_classify_pubid = Attribute_gather_detail_2.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_3 ON Goods.Use_target_pubid = Attribute_gather_detail_3.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_4 ON Goods.Quality_grade_pubid = Attribute_gather_detail_4.Attribute_gather_detail_id INNER JOIN
                      Manage_season ON Goods.Manage_season_id = Manage_season.Manage_season_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_5 ON Goods.Product_status_pubid = Attribute_gather_detail_5.Attribute_gather_detail_id INNER JOIN
                      Eemployee AS Eemployee_1 ON Goods.Registrant_id = Eemployee_1.Employee_id INNER JOIN
                      Eemployee ON Goods.Auditor_id = Eemployee.Employee_id INNER JOIN
                      Eemployee AS Eemployee_2 ON Goods.Update_person_id = Eemployee_2.Employee_id INNER JOIN
                      Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id INNER JOIN
                      Manufacturer ON Goods.Manufacturer_id = Manufacturer.Manufacturer_id INNER JOIN
                      Goods_producing_area ON Goods.Producing_area_id = Goods_producing_area.Producing_area_id ON Repertory_enter_detail.Goods_id = Goods.Goods_id
 where Repertory_place.Repertory_place_id=@Repertory_place_id
GROUP BY Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Art_No, Goods.Format_model, Agreement.Contract_number, Goods.Agreement_id, 
                      Attribute_gather_detail.Attribute_gather_detail_name, Goods.Quality_content, Goods.Input_ratio, Goods.Output_ratio, Goods.Goods_colours, Attribute_gather_detail_1.Attribute_gather_detail_name, 
                      Attribute_gather_detail_2.Attribute_gather_detail_name, Goods.Plncode_PLN, Goods.Goods_abbreviation, Attribute_gather_detail_3.Attribute_gather_detail_name, Goods.Copy_record_deny, 
                      Goods.Vender_bar_code_deny, Goods.Count_scale, Attribute_gather_detail_4.Attribute_gather_detail_name, Manage_season.Manage_season_name, 
                      Attribute_gather_detail_5.Attribute_gather_detail_name, Goods.Register_time, Goods.Review_time, Eemployee_1.Employee_name, Goods.Registrant_id, Goods.Auditor_id, 
                      Eemployee.Employee_name, Goods.Update_Time, Goods.Update_person_id, Eemployee_2.Employee_name, Goods.Retail_unit_price, Goods.Purchase_bid, Goods.Self_fix_goods_deny, 
                      Goods.Mini_fix_goods_deny, Goods.Permit_decimal_deny, Goods_rademark.Goods_rademark_name, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name, 
                      Department.Department_name, Repertory_enter_detail.Goods_id, Repertory_enter_detail.Repertory_enter_detail_Farid, Stock.Repertory_place_id 
 having  (Goods.Goods_name LIKE '%' + RTRIM(LTRIM(@strBur)) + '%' OR
                      (Goods.Goods_code LIKE '%' + RTRIM(LTRIM(@strBur)) + '%') OR
                      (Goods.Goods_bar_code LIKE '%' + RTRIM(LTRIM(@strBur)) + '%'))
 
 end
 --根据商品id查询批量增加商品信息(把数据绑定到退货单上)
 if(@NB='SelectInsertGoodsByGoods_IDandRepertory_place_id')
 begin
SELECT     Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Art_No, Goods.Format_model, Agreement.Contract_number, Goods.Agreement_id, 
                      Attribute_gather_detail.Attribute_gather_detail_name AS JiLiangDanWei, Goods.Quality_content, Goods.Input_ratio, Goods.Output_ratio, Goods.Goods_colours, 
                      Attribute_gather_detail_1.Attribute_gather_detail_name AS BaoZhiQi, Attribute_gather_detail_2.Attribute_gather_detail_name AS ShangPinFenLei, Goods.Plncode_PLN, Goods.Goods_abbreviation, 
                      Attribute_gather_detail_3.Attribute_gather_detail_name AS ShiYongDuiXiang, Goods.Copy_record_deny, Goods.Count_scale, 
                      Attribute_gather_detail_4.Attribute_gather_detail_name AS ZhiLiangDengJi, Manage_season.Manage_season_name AS JiYingJiJie, 
                      Attribute_gather_detail_5.Attribute_gather_detail_name AS ChanPinZhuangTai, CONVERT(varchar(20), Goods.Register_time, 120) AS Register_time, CONVERT(varchar(20), Goods.Review_time, 120) 
                      AS Review_time, Eemployee_1.Employee_name AS DengJiRen, Goods.Registrant_id, Goods.Auditor_id, Eemployee.Employee_name AS ShenHeRen, CONVERT(varchar(20), Goods.Update_Time, 
                      120) AS Update_Time, Goods.Update_person_id, Eemployee_2.Employee_name AS GengXinRen, Goods.Retail_unit_price, Goods.Purchase_bid AS NoTax_inclusive_price, 
                      Goods.Self_fix_goods_deny, Goods.Mini_fix_goods_deny, Goods.Permit_decimal_deny, Goods_rademark.Goods_rademark_name AS rademark, 
                      Manufacturer.Manufacturer_name AS ShengChanChangJiaMC, Goods_producing_area.Producing_area_name AS ChanDiMC, Department.Department_name, Stock.Repertory_place_id, 
                      SUM(Stock.Stock_quantity) AS Stock_quantity, Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5)) / 100 + 1) AS Tax_inclusive_price, Goods.Purchase_bid, Goods.Goods_id
FROM         Department INNER JOIN
                      Repertory_place INNER JOIN
                      Stock ON Repertory_place.Repertory_place_id = Stock.Repertory_place_id ON Department.Department_id = Repertory_place.Department_id INNER JOIN
                      Goods INNER JOIN
                      Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN
                      Attribute_gather_detail ON Goods.Unit_of_measurement_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_1 ON Goods.Quality_guarantee_period_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods.Goods_classify_pubid = Attribute_gather_detail_2.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_3 ON Goods.Use_target_pubid = Attribute_gather_detail_3.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_4 ON Goods.Quality_grade_pubid = Attribute_gather_detail_4.Attribute_gather_detail_id INNER JOIN
                      Manage_season ON Goods.Manage_season_id = Manage_season.Manage_season_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_5 ON Goods.Product_status_pubid = Attribute_gather_detail_5.Attribute_gather_detail_id INNER JOIN
                      Eemployee AS Eemployee_1 ON Goods.Registrant_id = Eemployee_1.Employee_id INNER JOIN
                      Eemployee ON Goods.Auditor_id = Eemployee.Employee_id INNER JOIN
                      Eemployee AS Eemployee_2 ON Goods.Update_person_id = Eemployee_2.Employee_id INNER JOIN
                      Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id INNER JOIN
                      Manufacturer ON Goods.Manufacturer_id = Manufacturer.Manufacturer_id INNER JOIN
                      Goods_producing_area ON Goods.Producing_area_id = Goods_producing_area.Producing_area_id ON Stock.Goods_id = Goods.Goods_id
WHERE     (Stock.Repertory_place_id = @Repertory_place_id)
GROUP BY Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Art_No, Goods.Format_model, Agreement.Contract_number, Goods.Agreement_id, 
                      Attribute_gather_detail.Attribute_gather_detail_name, Goods.Quality_content, Goods.Input_ratio, Goods.Output_ratio, Goods.Goods_colours, Attribute_gather_detail_1.Attribute_gather_detail_name, 
                      Attribute_gather_detail_2.Attribute_gather_detail_name, Goods.Plncode_PLN, Goods.Goods_abbreviation, Attribute_gather_detail_3.Attribute_gather_detail_name, Goods.Copy_record_deny, 
                      Goods.Vender_bar_code_deny, Goods.Count_scale, Attribute_gather_detail_4.Attribute_gather_detail_name, Manage_season.Manage_season_name, 
                      Attribute_gather_detail_5.Attribute_gather_detail_name, Goods.Register_time, Goods.Review_time, Eemployee_1.Employee_name, Goods.Registrant_id, Goods.Auditor_id, 
                      Eemployee.Employee_name, Goods.Update_Time, Goods.Update_person_id, Eemployee_2.Employee_name, Goods.Retail_unit_price, Goods.Purchase_bid, Goods.Self_fix_goods_deny, 
                      Goods.Mini_fix_goods_deny, Goods.Permit_decimal_deny, Goods_rademark.Goods_rademark_name, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name, 
                      Department.Department_name, Stock.Repertory_place_id, Goods.Goods_id 
having  Goods.Goods_id=@Goods_id 
 end
 --查询退货批次根据商品id
 if(@NB='SelectPacth')
 begin
SELECT     Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Art_No, Goods.Format_model, Agreement.Contract_number, Goods.Agreement_id, 
                      Attribute_gather_detail.Attribute_gather_detail_name AS JiLiangDanWei, Goods.Quality_content, Goods.Input_ratio, Goods.Output_ratio, Goods.Goods_colours, 
                      Attribute_gather_detail_1.Attribute_gather_detail_name AS BaoZhiQi, Attribute_gather_detail_2.Attribute_gather_detail_name AS ShangPinFenLei, Goods.Goods_abbreviation, 
                      Attribute_gather_detail_3.Attribute_gather_detail_name AS ShiYongDuiXiang, Goods.Copy_record_deny, Goods.Vender_bar_code_deny, Goods.Count_scale, 
                      Attribute_gather_detail_4.Attribute_gather_detail_name AS ZhiLiangDengJi, Manage_season.Manage_season_name AS JiYingJiJie, 
                      Attribute_gather_detail_5.Attribute_gather_detail_name AS ChanPinZhuangTai, CONVERT(varchar(20), Goods.Register_time, 120) AS Register_time, CONVERT(varchar(20), Goods.Review_time, 120) 
                      AS Review_time, Eemployee_1.Employee_name AS DengJiRen, Goods.Registrant_id, Goods.Auditor_id, Eemployee.Employee_name AS ShenHeRen, CONVERT(varchar(20), Goods.Update_Time, 
                      120) AS Update_Time, Goods.Update_person_id, Eemployee_2.Employee_name AS GengXinRen, Goods.Retail_unit_price, Goods.Self_fix_goods_deny, Goods.Mini_fix_goods_deny, 
                      Goods.Permit_decimal_deny, Goods_rademark.Goods_rademark_name AS rademark, Manufacturer.Manufacturer_name AS ShengChanChangJiaMC, 
                      Goods_producing_area.Producing_area_name AS ChanDiMC, Department.Department_name, Repertory_enter_detail.Goods_id, Repertory_enter_detail.Repertory_enter_detail_Farid, 
                      Stock.Repertory_place_id, Stock.Stock_quantity, Repertory_enter_detail.Repertory_enter_id, Repertory_enter.Record_number AS pacth, 
                      Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5)) / 100 + 1) AS Tax_inclusive_price, Goods.Purchase_bid AS NoTax_inclusive_price, Stock.Stock_id
FROM         Department INNER JOIN
                      Repertory_place INNER JOIN
                      Stock ON Repertory_place.Repertory_place_id = Stock.Repertory_place_id ON Department.Department_id = Repertory_place.Department_id INNER JOIN
                      Repertory_enter_detail ON Stock.Repertory_enter_detail_id = Repertory_enter_detail.Repertory_enter_detail_id INNER JOIN
                      Goods INNER JOIN
                      Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN
                      Attribute_gather_detail ON Goods.Unit_of_measurement_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_1 ON Goods.Quality_guarantee_period_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods.Goods_classify_pubid = Attribute_gather_detail_2.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_3 ON Goods.Use_target_pubid = Attribute_gather_detail_3.Attribute_gather_detail_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_4 ON Goods.Quality_grade_pubid = Attribute_gather_detail_4.Attribute_gather_detail_id INNER JOIN
                      Manage_season ON Goods.Manage_season_id = Manage_season.Manage_season_id INNER JOIN
                      Attribute_gather_detail AS Attribute_gather_detail_5 ON Goods.Product_status_pubid = Attribute_gather_detail_5.Attribute_gather_detail_id INNER JOIN
                      Eemployee AS Eemployee_1 ON Goods.Registrant_id = Eemployee_1.Employee_id INNER JOIN
                      Eemployee ON Goods.Auditor_id = Eemployee.Employee_id INNER JOIN
                      Eemployee AS Eemployee_2 ON Goods.Update_person_id = Eemployee_2.Employee_id INNER JOIN
                      Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id INNER JOIN
                      Manufacturer ON Goods.Manufacturer_id = Manufacturer.Manufacturer_id INNER JOIN
                      Goods_producing_area ON Goods.Producing_area_id = Goods_producing_area.Producing_area_id ON Repertory_enter_detail.Goods_id = Goods.Goods_id INNER JOIN
                      Repertory_enter ON Repertory_enter_detail.Repertory_enter_id = Repertory_enter.Repertory_enter_id
WHERE     (Repertory_place.Repertory_place_id = @Repertory_place_id) AND (Repertory_enter_detail.Goods_id = @Goods_id) end
 --新增退货单
 if(@NB='Insert_TuiHuo')
 begin
 INSERT INTO Return_factory
                      (Contract_id, Repertory_place_id, Goods_return_reasonpubid, Solution, Consignee_id, Record_number, Registrant_id, Register_time,Review_deny,Return_factory_Number,Number)
VALUES     (@Contract_id,@Repertory_place_id,@Goods_return_reasonpubid,@Solution,@Consignee_id,@Record_number,@Registrant_id,@Register_time,'false',@Return_factory_Number,@Number)
select @@IDENTITY
SELECT      Day_max_count 
FROM         Day_max_quantity
where Odd_numbers_id=9
UPDATE    Day_max_quantity
SET               Day_max_count = Day_max_count+1
where Odd_numbers_id=9
commit tran
 end
 --新增退货明细单
 if(@NB='Insert_TuiHuoMingXi')
 begin
     INSERT INTO Return_factory_detail
                      (Return_factory_id, Goods_id, Goods_quantity_recede, Repertory_place_recede_id,Review_deny)
VALUES     (@Return_factory_id,@Goods_id,@Goods_quantity_recede,@Repertory_place_recede_id,'false')
select @@IDENTITY
 end
 --新增退货批次
 if(@NB='Insert_ReturnPacth')
 begin
 INSERT INTO Return_Pacth
                      (Return_factory_detail_id, StockPacthNumber, Goods_id, RuternQuary, Stock_id)
VALUES     (@Return_factory_detail_id,@StockPacthNumber,@Goods_id,@RuternQuary,@Stock_id)
 end
 --获取员工信息(经手人)
 if(@NB='GetEemployeeInformation')
 begin
SELECT     Eemployee.Employee_id, Eemployee.Employee_number, Eemployee.Employee_name, Department.Department_name, Duties.Duties_name, Eemployee.Sex
FROM         Eemployee INNER JOIN
                      Department ON Eemployee.Department_id = Department.Department_id INNER JOIN
                      Duties ON Eemployee.Duties_id = Duties.Duties_id end
--查询退货单
if(@NB='SelectTuiHuoDan')
begin
SELECT     Return_factory.Return_factory_id, Return_factory.Contract_id, Agreement.Contract_number, Return_factory.Repertory_place_id, Return_factory.Solution, Eemployee.Employee_name AS jinshouren, 
                      Return_factory.Record_number, Eemployee_1.Employee_name AS dengjiren, Return_factory.Return_factory_Number, Return_factory.Review_deny, Agreement.Purchase_unit_id, 
                      Return_factory.Number, Enterprise_name.Chinese, Repertory_place.Repertory_place_identifier, Repertory_place.Repertory_place_name, 
                      Attribute_gather_detail.Attribute_gather_detail_name AS tuiHuoYuanYin, Attribute_gather_detail_1.Attribute_gather_detail_name AS hesuanfangshi, 
                      Department.Department_name AS ReturnDepartmentName, Return_factory.Consignee_id, Return_factory.Registrant_id, Return_factory.Goods_return_reasonpubid, 
                      CONVERT(varchar(20), Return_factory.Register_time,120) AS Register_time
FROM         Return_factory INNER JOIN
                      Agreement ON Return_factory.Contract_id = Agreement.Agreement_id INNER JOIN
                      Repertory_place ON Return_factory.Repertory_place_id = Repertory_place.Repertory_place_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.Consignee_id = Eemployee.Employee_id INNER JOIN
                      Eemployee AS Eemployee_1 ON Return_factory.Registrant_id = Eemployee_1.Employee_id INNER JOIN
                      Department ON Agreement.Purchase_unit_id = Department.Department_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 
 where   Return_factory.Review_deny='false'                  
end
--模糊查询退货单信息
if(@NB='mohuiSelectTuiHUoDan')
BEGIN
SELECT     Return_factory.Return_factory_id, Return_factory.Contract_id, Agreement.Contract_number, Return_factory.Repertory_place_id, Return_factory.Solution, Eemployee.Employee_name AS jinshouren, 
                      Return_factory.Record_number, Eemployee_1.Employee_name AS dengjiren, Return_factory.Return_factory_Number, Return_factory.Review_deny, Agreement.Purchase_unit_id, 
                      Return_factory.Number, Enterprise_name.Chinese, Repertory_place.Repertory_place_identifier, Repertory_place.Repertory_place_name, 
                      Attribute_gather_detail.Attribute_gather_detail_name AS tuiHuoYuanYin, Attribute_gather_detail_1.Attribute_gather_detail_name AS hesuanfangshi, 
                      Department.Department_name AS ReturnDepartmentName, Return_factory.Consignee_id, Return_factory.Registrant_id, Return_factory.Goods_return_reasonpubid, 
                      CONVERT(varchar(20), Return_factory.Register_time,120) AS Register_time
FROM         Return_factory INNER JOIN
                      Agreement ON Return_factory.Contract_id = Agreement.Agreement_id INNER JOIN
                      Repertory_place ON Return_factory.Repertory_place_id = Repertory_place.Repertory_place_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.Consignee_id = Eemployee.Employee_id INNER JOIN
                      Eemployee AS Eemployee_1 ON Return_factory.Registrant_id = Eemployee_1.Employee_id INNER JOIN
                      Department ON Agreement.Purchase_unit_id = Department.Department_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 
WHERE Return_factory.Record_number like '%'+ rtrim(ltrim(@strBur)) +'%' 
END
--绑定退货明细(根据退货单id)
if(@NB='BingDingTuiHuoMingXi')
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
--根据退货明细id查询批次信息
if(@NB='SelectPacthInformations')
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
--查询所有库存地点
if(@NB='GetAllRepertory')		
begin
SELECT     Repertory_place_id, Repertory_place_identifier, Repertory_place_name
FROM         Repertory_place
end
--修改退货单
if(@NB='Update_TuiHuoDan')
begin
UPDATE    Return_factory
SET              Contract_id =@Contract_id,
                 Repertory_place_id =@Repertory_place_id, 
                 Goods_return_reasonpubid =@Goods_return_reasonpubid,
                 Solution =@Solution, Consignee_id =@Consignee_id, 
                 Registrant_id =@Registrant_id, Register_time =@Register_time, 
                 Record_number =@Record_number, Return_factory_Number =@Return_factory_Number,
                 Number =@Number, 
                      Review_deny ='false'
 where Return_factory_id=@Return_factory_id
end
--修改退货明细
--修改返厂明细
if(@NB='Update_ReturnDetail')
begin
UPDATE    Return_factory_detail
SET              Goods_quantity_recede = @Goods_quantity_recede
where Return_factory_detail_id=@Return_factory_detail_id
end
--新增批次信息
if(@NB='InsertPacthInformactions')
begin
INSERT INTO Return_Pacth
                      (Return_factory_detail_id, StockPacthNumber, Goods_id, RuternQuary, Stock_id)
VALUES     (@Return_factory_detail_id,@StockPacthNumber,@Goods_id,@RuternQuary,@Stock_id)end
--修改批次信息
if(@NB='UpdatePacthInformations')
begin
UPDATE    Return_Pacth
SET              RuternQuary = @RuternQuary
WHERE     (ReturnPacthid = @ReturnPacthid)
end
--删除批次信息
if(@NB='DeletePacthInformations')
begin
DELETE FROM Return_Pacth
where ReturnPacthid=@ReturnPacthid
end
--(1)删除商品批次明细
if(@NB='DeleteShangPinPacthByreturnFactoryDetailid')
begin
DELETE FROM Return_factory_detail
where Return_factory_detail_id=@Return_factory_detail_id
end
if(@NB='DeleteShangPinPacthMingXi')
begin
DELETE FROM Return_Pacth
where Return_factory_detail_id=@Return_factory_detail_id
end

--(3)新增退货明细
if(@NB='InsertReturnFactoryDetail')
begin
INSERT INTO Return_factory_detail
                      ( Return_factory_id, Goods_id, Goods_quantity_recede, Repertory_place_recede_id, Review_deny)
VALUES     (@Return_factory_id,@Goods_id,@Goods_quantity_recede,@Repertory_place_recede_id,'false')
end


--(6)修改批次明细
--begin
--DELETE FROM Return_Pacth
--where ReturnPacthid=@ReturnPacthid
--end


--删除
--(1)删除批次
if(@NB='DeletePacth')
begin
DELETE FROM Return_Pacth
where Return_factory_detail_id=@Return_factory_detail_id
end
--(2)删除返厂明细
if(@NB='DeleteReturnFactoryDetailid')
begin
DELETE FROM Return_factory_detail
where Return_factory_id=@Return_factory_id
end
--(3)删除返厂单
if(@NB='DeleteReturnFactory')
begin
DELETE FROM Return_factory
where Return_factory_id=@Return_factory_id
end 
--审核
--(1)审核查询明细
if(@NB='ShenHeSelectMingXi')
begin
SELECT     Return_factory_id, Return_factory_detail_id
FROM         Return_factory_detail
where Return_factory_id=@Return_factory_id
end
--(2)审核修改明细
if(@NB='ShenHeUpdateMingXi')
begin
UPDATE    Return_factory_detail
SET              Review_deny ='true'
where Return_factory_detail_id=@Return_factory_detail_id
end
--(3)审核修改退货单
if(@NB='ShenHeUpdateTuiHuoDan')
begin
UPDATE    Return_factory
SET              Review_deny = 'true', Auditor_id =@Auditor_id, Review_time =@Review_time
where Return_factory_id=@Return_factory_id
end

END
                                             

 仅供初学者使用,禁止商业用途。

                                                                      面对问题,我们不能退缩,因为退缩并不能解决问题。只有努力寻求解决之道,才是上策。

                                                                     疑问是打开知识大门的钥匙。错误是正确的先导。提出了正确的问题,往往等于解决了问题的大半。





















  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值