大型商贸系统(进货管理)技术解析(七)配货单的处理
功能介绍:
配货单的处理为客户提供了对配货单的录入,对配货单的录入,删除,修改未发货的配货单,审核已录录入配货单信息,商品配货批次等功能。新增已经审核的进仓单进行配货单的录入,对其数量可以进行商品配货批次,系统默认按先进先出的原则进行配货,经过配货单的审核可以进行商品配货处理。
1. 界面效果图:
2. 上述界面所涉及到的表与表之间的关系图
表1:配货单(Invoice)
用于存放配货单的信息
列名 | 数据类型 | 主键/外键 | 说明 |
Invoice_id | int | 主键 | 配货单id |
Repertory_enter_id | int | 外键 | 进仓单id |
Receiving_department_id | int | 外键 | 收货部门id |
Receiver_id | int | 外键 | 收货人id |
Delivery_department_id | int | 外键 | 发货部门id |
Shipper_id | int | 外键 | 发货人id |
Record_number | nchar(20) |
| 记录编号 |
Remarks | nchar(10) |
| 备注 |
Make_bills_id | int | 外键 | 制单人id |
Make_bills_time | datetime |
| 制单时间 |
Transactor_id | int | 外键 | 执行人id |
Execute_time | datetime |
| 执行时间 |
Review_deny | Bit |
| 审核否 |
表2:进仓单表(Repertory_enter)
用于存放商品进仓单信息
列名 | 数据类型 | 主键/外键 | 说明 |
Repertory_enter_id | int | 主键 | 进仓单id |
Repertory_place_id | int | 外键 | 仓库地点id |
Indent_id | int | 外键 | 订单id |
Hava_indent_deny | Bit |
| 有无订单否 |
Receiver_id | int | 外键 | 收货人id |
Record_number | nchar(20) |
| 记录编号 |
Registrant_id | int | 外键 | 登记人id |
Register_time | datetime |
| 登记时间 |
Auditor_id | int | 外键 | 审核人id |
Review_time | datetime |
| 审核时间 |
Affix_count | nchar(10) |
| 附件张数 |
Type_of_operation_pubid | int | 外键 | 经营方式pubid |
Original_number | nchar(20) |
| 原始单号 |
Agreement_id | int | 外键 | 合同id |
Review_deny | Bit |
| 审核否 |
YouXiaoFou | Bit |
| 有效否 |
表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:部门表(Department)
用于记录部门信息
列名 | 数据类型 | 主键/外键 | 说明 |
Department_id | int | 主键 | 部门id |
Department_Farid | int | 外键 | 部门父id |
Department_code | nchar(10) |
| 部门编号 |
Department_name | nchar(10) |
| 部门名称 |
功能实现:
1. 实现配货单处理的功能,配货单处理的界面效果图
图1
点击“批量选商品”的按钮所出现的效果图
图2
点击“商品配货批次”按钮所出现的界面效果图
图3
2. 为了实现上述的界面效果代码
<!DOCTYPE html>
<html>
<head>
<meta content="text/javascript;charset=utf-8" />
<title>商品配货单处理</title>
<script src="../../Content/jquery-easyui-1.3.3/jquery.min.js"></script>
<script src="../../Content/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
<script src="../../Content/jquery-easyui-1.3.3/easyloader.js"></script>
<link href="../../Content/jquery-easyui-1.3.3/themes/icon.css" rel="stylesheet" />
<link href="../../Content/jquery-easyui-1.3.3/demo/demo.css" rel="stylesheet" />
<link href="../../Content/jquery-easyui-1.3.3/themes/default/easyui.css" rel="stylesheet" />
<link href="../../Content/MyCSS/PublicCSS.css" rel="stylesheet" />
<link href="../../Content/yxsss/js_css/yu.css" rel="stylesheet" />
<script src="../../Content/yxsss/js_css/yu.js"></script>
<style type="text/css">
body { text-align: center; font-size: 20px; }
input { margin-top: 1px; margin-left: 5px; margin-right: 5px; font-size: 15px; }
button { height: 24px; font-size: 20px; margin: 1px 3px 1px 3px; }
</style>
</head>
<body style="text-align: center">
<div style="display: none">
<input type="hidden" id="check" />
<div class="easyui-window" id="WPatchPeiHuoShuLiang" title="批次配货数量" data-options="resizable:false,minimizable:false,collapsible:false,maximizable:false,closed:true" style="width: 280px; height: 160px; font-size: 15px;">
<br />
每一个批次的配货数量:<input type="text" id="txtPeiHuoShu" style="width: 40px; color: red" /><br />
<div style="text-align: center; margin-top: 15px">
<button οnclick="YiJianShengChengPatch();" id="YiJianShengChengPatch">
<img src="../../Content/jquery-easyui-1.3.3/themes/black/images/slider_handle.png" />
一键生成批次</button>
</div>
</div>
<div class="easyui-window" id="wSelectInvoiceInformations" 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" style="width: 100px;" /></td>
<td style="vertical-align: middle">
<button οnclick="MoHuSelectInvoiceInformations();">
<img src="../../Content/image/2012092109942.png" />模糊查询</button></td>
</tr>
</table>
<div class="easyui-panel" style="width: 390px; height: 180px; border: none">
<table class="easyui-datagrid" id="tbSelectInvoiceInformations" style="width: 340px; border: none; border-spacing: 0;" data-options="modal:true,fit:true,fitColumns:true,idField:'Allot_id',
onDblClickRow:onDblInvoice,singleSelect:true,rownumbers:true,striped:true">
<thead>
<tr>
<th data-options="field:'Invoice_id',hidden:true,width:90,align:'center'">配货单id</th>
<th data-options="field:'Repertory_place_id',width:80,hidden:true,align:'center'">Repertory_place_id</th>
<th data-options="field:'Record_number',width:180,align:'center'">记录编号</th>
<th data-options="field:'Consignment_department',width:80,align:'center'">发货部门</th>
<th data-options="field:'Receiving_department',width:80,align:'center'">收货部门</th>
<th data-options="field:'Review_deny',width:80,align:'center'">审核否</th>
<th data-options="field:'Remarks',width:60,align:'center'">备注</th>
</tr>
</thead>
</table>
</div>
</div>
<div class="easyui-window" id="wShipper" style="width: 383px; height: 200px; top: 60px; left: 420px;" data-options=" resizable:false,minimizable:false,collapsible:false,maximizable:false">
<table class="easyui-datagrid" id="tbShipper" data-options="modal:true,idField:'Employee_id',fit:true,singleSelect:true,onDblClickRow:onDblClicktbShipper">
<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="wXuanZeYiShenHeDanXiAll" title="选择已审核进仓单" style="width: 700px; height: 300px;" data-options="modal:true,resizable:false,minimizable:false,collapsible:false,maximizable:false,closed:true,closable:false">
<table style="width: 686px; height: 28px; padding: 0; border-spacing: 0">
<tr>
<td style="vertical-align: middle; font-size: 15px;">请输入已审核记录编号查找:<input type="text" id="strBlur" style="width: 200px; height: 15px;" /></td>
<td style="text-align: left">有无订单<input type="checkbox" id="XuanZe" style="margin-right: 20px;" />
<button οnclick="MoHiuChaXunXuanZeYiShenHeJinCangDan();">
<img src="../../Content/image/2012092109942.png" />查询</button>
<td>
<span style="float: right">
<img οnclick="$('#wXuanZeYiShenHeDanXiAll').window('close');" id="dimg" src="../../Content/image/delete.png" /></span>
</td>
</tr>
</table>
<div class="easyui-panel" style="width: 686px; height: 236px;">
<table id="tbXuanZeYiShenHeDanXiAll" class="easyui-datagrid" style="width: 3360px;" data-options="rownumbers:true,
striped:true,pagination:true,idField:'Repertory_enter_id',singleSelect:true,fit:true,fitColumns:false,onDblClickRow:DblYiShenHeJinCangDan">
<thead>
<tr>
<th data-options="field:'Repertory_enter_id',hidden:true,width:80,align:'center'">进仓id</th>
<th data-options="field:'Record_number',width:120,align:'center'">记录编号</th>
<th data-options="field:'Department_name',width:80,align:'center'">进货部门</th>
<th data-options="field:'settlement',width:80,align:'center'">结算方式</th>
<th data-options="field:'Contract_number',width:80,align:'center'">合同号</th>
<th data-options="field:'Repertory_place_name',width:80,align:'center'">仓库地点</th>
<th data-options="field:'Auditor',width:80,align:'center'">审核人</th>
<th data-options="field:'Review_time',width:80,align:'center'">审核时间</th>
</tr>
</thead>
</table>
</div>
</div>
<div class="easyui-window" id="wReceiver" style="width: 383px; height: 200px; top: 60px; left: 420px;" data-options="closed:true, resizable:false,minimizable:false,collapsible:false,maximizable:false">
<table class="easyui-datagrid" id="tbReceiver" data-options="idField:'Employee_id',fit:true,singleSelect:true,onDblClickRow:onDblClicktbReceiver">
<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="wPiLiangXuanShangPin" title="商品信息" style="width: 700px; height: 300px;" data-options="resizable:false,minimizable:false,collapsible:false,maximizable:false,closed:true,closable:false">
<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:MoHuSelectGoodsInformations" style="width: 180px; height: 23px;" /></td>
<td>
<button οnclick="getChangPin();">
<img src="../../Content/image/add.png" />添加</button></td>
<td>
<button id="TuiChu1" οnclick=" $('#wPiLiangXuanShangPin').window('close')">
<img src="../../Content/image/2012080412301.png" />退出</button>
</td>
</tr>
</table>
<div class="easyui-panel" style="width: 686px; height: 236px;">
<table id="tbPiLiangChooseGoods" class="easyui-datagrid" style="width: 3360px;" data-options="rownumbers:true,
striped:true,pagination:true,idField:'Goods_id',singleSelect:true,fit:true,fitColumns:false, frozenColumns:[[
{field:'XuanZhe',width:30,title:'选择',align:'center',formatter:returnCheckBox}
]],striped:true">
<thead>
<tr>
<th data-options="field:'Goods_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 id="wShangPinPiHuoPiCi" class="easyui-window" title="调整商品配货批次数据" data-options="resizable:false,minimizable:false,
collapsible:false,maximizable:false,closed:true,"
style="width: 700px; height: 340px; padding: 1px; background-color: #C0C0C0">
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'east',split:true" style="width: 400px">
<table id="tbBatch" class="easyui-datagrid" style="width:550px; height: 400px;" data-options="onClickRow:onClickPacth,singleSelect:true">
<thead>
<tr>
<th data-options="field:'Patch_id',hidden:true,width:180,align:'center'">批次id</th>
<th data-options="field:'Patch',width:180,align:'center'">批次</th>
<th data-options="field:'NoTax_inclusive_price',width:80,align:'center'">不含税进价</th>
<th data-options="field:'Tax_inclusive_price',width:80,align:'center'">含税进价</th>
<th data-options="field:'Shipments_quantity',width:80,align:'center',editor:{type:'numberbox'}">配货数量</th>
<th data-options="field:'JieCunShu',width:80,align:'center'">结存数量</th>
</tr>
</thead>
</table>
</div>
<div data-options="region:'center'" style="padding: 0px;">
<table id="tbBatch1" class="easyui-datagrid" data-options="rownumbers:true,singleSelect:true,onClickRow:ShuanJiRowsSelectPacth" style="width: 300px; height: 400px;" border="1">
<thead>
<tr>
<th data-options="field:'Goods_id',hidden:true,width:80,align:'center'">商品ID</th>
<th data-options="field:'Goods',width:120,align:'center'">商品</th>
<th data-options="field:'Shipments_quantity',width:80,align:'center'">发货细数</th>
<th data-options="field:'Consignment_department_coad',width:80,align:'center'">发货部门</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:'Invoice_detail_id',hidden:true"></th>
<th data-options="field:'Purchase_bid',hidden:true"></th>
<th data-options="field:'Tax_inclusive_price',hidden:true"></th>
</tr>
</thead>
</table>
</div>
<div data-options="region:'south',border:false" style="text-align: right; padding: 5px 0 0;height: 35px;">
<table>
<tr>
<td>
<input type="button" value="自动生成全部商品配货批次" οnclick="openPatchPeiHuoShuLiang()" style="width: 250px" />
</td>
<td style="width: 175px;"></td>
<td>
<button id="OK" οnclick="OK();" style="width: 80px">
<img src="../../Content/image/ok.gif" />确认</button>
</td>
<td>
<button id="cancel" οnclick="cancel();" style="width: 80px">
<img src="../../Content/jquery-easyui-1.3.3/themes/icons/cancel.png" />取消</button>
</td>
<td>
<button id="XiuGai1" οnclick="UpdataPacth();" style="width: 80px">
<img src="../../Content/image/table_edit.png" />修改</button></td>
<td>
<button id="TuiChu2" οnclick=" $('#wShangPinPiHuoPiCi').window('close')" style="width: 80px">
<img src="../../Content/image/2012080412301.png" />退出</button></td>
</tr>
</table>
</div>
</div>
</div>
<div class="easyui-window" title="" id="wShangPinJinCangDan" 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="padding: 5px; background: #e0ffff; color: #4169e1; font-size: 20px; margin: 0 0 auto;">
商品配货单
</div>
<table id="tbShangPinPeiHuoDan" style="width: 780px; height: 20px; padding: 0; border: none;">
<tr>
<td>
<input type="button" value="记录编号" οnclick="openSelectInvoice()" style="width: 100px;" /><input type="text" οnclick=" SelectPeiSongRecord_number()" id="txtRecord_number" style="width: 120px; color: red; margin-left: 5px;" /></td>
<td>
<input type="button" id="btnFuHuoRen" οnclick="openwShipper();" value="实物付货人" style="width: 100px;" /><input type="text" id="txtShiWuFuHuoRen" style="width: 120px; margin-left: 5px;" /></td>
<td>
<input type="button" id="btnShouHuoRen" οnclick="openwReceiver();" value="实物收货人" style="width: 100px;" /><input type="text" id="txtShiWuShouHuoRen" style="width: 120px; margin-left: 5px;" /></td>
</tr>
</table>
<table style="width: 780px; height: 150px; padding: 0; border: none;">
<tr>
<td style="text-align: right; font-size: 15px;">发货部门</td>
<td>
<input class="easyui-combotree" id="cboSentGoodsDepartmentCode" data-options="onChange:ChooseSentGoodsDepartment,url:'/ShangPinPeiHuoDan/SelectDepartmentTreeAll'" style="width: 145px; text-align: left;" /></td>
<td>
<div style="border-bottom: #000 1px solid; width: 400px;">
<input readonly="readonly" id="SentGoodsDepartmentName" style="width: 400px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
</tr>
<tr>
<td style="text-align: right; font-size: 15px;">收货部门</td>
<td>
<input class="easyui-combotree" id="cboReceiveDepartmentcode" data-options="onChange:ChooseReceiveGoodsDepartment,required:true,url:'/ShangPinPeiHuoDan/SelectDepartmentTreeAll'" style="width: 145px; text-align: left" /></td>
<td>
<div style="border-bottom: #000 1px solid; width: 400px;">
<input readonly="readonly" id="ReceiveDepartmentName" style="width: 400px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
</tr>
<tr>
<td>
<input type="button" value="批量选商品" οnclick="OpenPiLiangXuanShangPin();" /></td>
<td>
<input type="button" value="商品配货批次" οnclick="OpenShangPinPeiHouPiCi();" /></td>
<td colspan="2" style="text-align: right; font-size: 15px;">备注<input type="text" id="txtBeiZhu" style="width: 200px" /></td>
</tr>
</table>
<div class="easyui-panel" style="width: 785px; height: 243px;">
<table id="tb进窗信息" class="easyui-datagrid" style="width: 3780px;" data-options="rownumbers:true,idField:'Goods_id',singleSelect:true, fit:true,pagination:true,frozenColumns:[[
{field:'ShanChu',width:40,title:'删除',align:'center',formatter:deleteSelect}
]]">
<thead>
<tr>
<th data-options="field:'Goods_id',hidden:true,width:80,align:'center'">商品ID</th>
<th data-options="field:'Invoice_detail_id',width:80,hidden:true,align:'center'">Invoice_detail_id</th>
<th data-options="field:'Repertory_place_id',width:80,hidden:true,align:'center'">Repertory_place_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:'Repertory_enter_packages',editor:{type:'numberbox'},width:80,align:'center'">发货件数</th>
<th data-options="field:'Shipments_quantity',width:80,editor:{type:'numberbox',options:{disabled:true}},align:'center',styler:cellStyler">发货细数</th>
<th data-options="field:'Repertory_place_send_id',width:80,align:'center',
formatter:function(value,row){
return row.Repertory_place_send;
},
editor:{
type:'combobox',
options:{
panelHeight:100,
valueField:'Repertory_place_send_id',
textField:'Repertory_place_send',
disabled:true
}}">发货库存地点</th>
<th data-options="field:'Repertory_place_harvest_id',width:80,align:'center',
formatter:function(value,row){
return row.Repertory_place_harvest;
},
editor:{
type:'combobox',
options:{
panelHeight:100,
valueField: 'Repertory_place_harvest_id',
textField: 'Repertory_place_harvest',
}}">收货库存地点</th>
<th data-options="field:'Retail_unit_price',width:80,align:'center'">零售单价</th>
<th data-options="field:'Tax_inclusive_price',width:80,align:'center',editor:{type:'numberbox',options:{prefix:'¥',precision:2,disabled:true,}},styler:cellStyler1">含税进价</th>
<th data-options="field:'Art_No',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:'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:'Copy_record_deny',width:80,align:'center'">复制记录否</th>
<th data-options="field:'Contract_number',width:80,align:'center'">合同号</th>
<th data-options="field:'ShengChanChangJiaMC',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:'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:'Quality_content',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>
<table style="width: 715px; height: 30px">
<tr>
<td style="font-size: 15px; width: 60px">制单人</td>
<td style="width: 50px">
<div style="border-bottom: #000 1px solid; width: 180px;">
<input class="easyui-combobox" id="cboMakeBills" data-options="url:'/ShangPinPeiHuoDan/GetMakeBillsEmployee',valueField:'ID',textField:'Name',required:true" style="width: 180px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
<td style="font-size: 15px">制单时间</td>
<td style="width: 50px">
<div style="border-bottom: #000 1px solid; width: 180px;">
<input class="easyui-datetimebox" data-options="formatter:myformatter" id="datZhiDanTime" style="width: 180px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
</tr>
<tr>
<td style="font-size: 15px; width: 60px">执行人</td>
<td style="width: 50px">
<div style="border-bottom: #000 1px solid; width: 180px;">
<input class="easyui-combobox" id="cboTransactor" data-options="url:'/ShangPinPeiHuoDan/GetTransactorEmployee',valueField:'ID',textField:'Name',required:true" style="width: 180px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
<td style="font-size: 15px">执行时间</td>
<td>
<div style="border-bottom: #000 1px solid; width: 180px;">
<input class="easyui-datetimebox" data-options="formatter:myformatter" id="datZhiXingTime" style="width: 180px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
</tr>
</table>
<button οnclick="OpenwXuanZeYiShenHeJinCangDan(); " id="TianJia">
<img src="../../Content/image/add.png" />添加</button>
<button id="XiuGai" οnclick="UpdataJinCangDan();">
<img src="../../Content/image/table_edit.png" />修改</button>
<button οnclick="deleteInvoice();" id="ShanChu">
<img src="../../Content/image/delete.png" />删除</button>
<button id="BaoCun" οnclick="BaoCunPeiHuogDan();">
<img src="../../Content/image/disk.png" />保存</button>
<button οnclick="qingKong();" id="FanQi">
<img src="../../Content/image/01.png" />放弃</button>
<button οnclick="ShenHePeiHuoDan();" id="ShenHe">
<img src="../../Content/image/ok.gif" />审核</button>
<button id="DaYin">
<img src="../../Content/image/2012081511202.png" />打印</button>
<button id="TuiChu" οnclick=" parent.peiHuo();">
<img src="../../Content/image/2012080412301.png" />退出</button>
</div>
</div>
</body>
</html>
3.对配货单处理的“记录编号”的操作,效果图
3.1 实现该功能的界面代码
3.2
实现该功能,在JavaScript中代码操作
//生成配送记录编号
function SelectPeiSongRecord_number() {
$.getJSON("/ShangPinPeiHuoDan/SelectPeiHuoRecordNumber", function (value) {
$("#txtRecord_number").val(value);
});
}
3.3实现该功能,在控制器中操作
#region 生成配货单据
public ActionResult SelectPeiHuoRecordNumber()
{
//实例化DataTable接收对象_myDistributionGoods的方法GetOddNumbers中数据返回的数据
DataTable dt = _myDistributionGoods.GetOddNumbers(6);
DataTable dt2 = _myDistributionGoods.GetDayMaxQuantity(21);//查询获取当前日最大单据数
string patchNumber = dt.Rows[0]["Prefixs"].ToString().Trim();//声明变量接收获取表dt中["Prefixs"]列单元格的值
string patchCount = dt2.Rows[0][0].ToString();//声明变量patchCount,dt2表中的总长度
//for循环并判断总的长度与dt.Rows[0]["Suffix_number"]作比较
for (int i = patchCount.Length; i < Convert.ToInt32(dt.Rows[0]["Suffix_number"].ToString().Trim()); i++)
{
patchCount = "0" + patchCount;//符合条件的要在patchCount前加“0”
}
string recordNumber = patchNumber + patchCount;//对自营无订单进仓冲红单记录编号的并接
return Json(recordNumber, JsonRequestBehavior.AllowGet);
}
#endregion
3.4 实现该功能,在逻辑层中操作
#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
3.5
实现该功能,在存储过程中操作
if(@NB='GetDayMaxCount') --获取日最大单数
begin
SELECT Day_max_count
FROM Day_max_quantity
where Day_max_quantity_id=@Day_max_quantity_id
end
if(@NB='GetOddNumbers') --获取记录编号/批次号前缀
begin
SELECT Odd_numbers_id,Suffix_number,(rtrim(Prefix)+CONVERT(varchar(12),GETDATE(),112))as Prefixs
FROM Odd_numbers
WHERE (Odd_numbers_id = @Odd_numbers_id)
End
4 对下拉数绑定的操作
效果图:
4.1 为了实现此功能,在界面上的操作代码
4.2 为了实现此功能,在JavaScript中的代码
//查询绑定部门
$.getJSON("/ShangPinPeiHuoDan/SelectDepartmentTreeAll", function (data) {
$('#cboSentGoodsDepartmentCode').combotree('loadData', data);
$('#cboReceiveDepartmentcode').combotree('loadData', data);
});
4.3为了实现此功能,在控制器中的操作
#region 获取所有部门
public ActionResult SelectDepartmentTreeAll()
{
DataTable dt = _myDistributionGoods.SelectDepartmentTreeAll();//查询所有的商品信息
string stringtree = GetDataString(dt, "0"); //执行GetDataString方法,递归地生成树形控件要用的Json字符串
stringtree = stringtree.Remove(stringtree.Length - 2, 2); //移除字符串最后两个字符即},
return Content(stringtree); //返回Joson字符串
}
public string GetDataString(DataTable dt, string id)
{
string stringbuilder = "";
DataView dv = new DataView(dt);
dv.RowFilter = "Department_Farid=" + id;
DataTable dtChild = dv.ToTable();
if (dtChild.Rows.Count > 0)
{
stringbuilder += "[";
for (int i = 0; i < dtChild.Rows.Count; i++)
{
string strLeiBieId = dtChild.Rows[i]["Department_id"].ToString().Trim();
string strLeiBieMingCheng = dtChild.Rows[i]["Department_name"].ToString().Trim();
string strLeiBieDaiMa = dtChild.Rows[i]["Department_code"].ToString().Trim();
string strChild = GetDataString(dt, strLeiBieId);
if (strChild.Length > 0)
{
stringbuilder += "{\"id\":" + strLeiBieId + ",\"text\":\"" + strLeiBieDaiMa + strLeiBieMingCheng +
"\",\"state\":\"closed\",\"children\":" + strChild;
}
else
{
stringbuilder += "{\"id\":" + strLeiBieId + ",\"text\":\"" + strLeiBieDaiMa + strLeiBieMingCheng +
"\"},";
}
}
stringbuilder = stringbuilder.Remove(stringbuilder.Length - 1, 1);
stringbuilder += "]},";
}
return stringbuilder;
}
#endregion
4.4 为了实现此功能,在逻辑层的操作代码#region 获取所有部门
public DataTable SelectDepartmentTreeAll()
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
};
sql[0].Value = "SelectDepartmentTreeAll";
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 根据部门id查询部门Farid
public DataTable GetAllSentGoodsDepartmentByDepartmentId(int departmentId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Department_id", SqlDbType.Int),
};
sql[0].Value = "GetAllSentGoodsDepartmentByDepartmentId";
sql[1].Value = departmentId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
4.5 为了实现此功能,存储过程
--获取所以部门信息绑定发货部门tree
if(@NB='SelectDepartmentTreeAll')
begin
SELECT Department.*
FROM Department
end
--根据部门id查询部门Farid
if(@NB='GetAllSentGoodsDepartmentByDepartmentId')
begin
SELECT Department_Farid, Department_code, Department_name
FROM Department
where Department_id=@Department_id
end
5.对DGV中列的设置
效果图:
5.1 实现该功能的代码
5.2 在JavaScript中代码
//计算细数
function endEditing2(rowIndex) {
var editors = $('#tb进窗信息').datagrid('getEditors', rowIndex);
var row = $('#tb进窗信息').datagrid('getRows');
var jianShu = editors[0];
var caiGouJia = parseFloat(row[rowIndex].Purchase_bid);
var jinXiangShuilv = parseFloat(row[rowIndex].Input_ratio);
var netAmount = editors[1];
var hanShuiJia = editors[4];
var baoZhuanHanliang = row[rowIndex].Quality_content;
jianShu.target.bind('change', function () {
jiSuan();
});
function jiSuan() {
$(hanShuiJia.target).numberbox('setValue', ((jinXiangShuilv / 100 + 1) * caiGouJia));
$(netAmount.target).numberbox('setValue', (jianShu.target.val() * baoZhuanHanliang));
}
}
6.对DGV中单元格插入“删除”列
效果图:
6.1为了实现该功能的界面代码
6.2 为了实现该功能的JavaScript代码
//生成删除列,删除列
function deleteSelect() {
return "<img οnclick='javascript:deletess()' src='../../Content/image/delete.png' />";
}
//移除datagrid的行
function deletess() {
if (editIndex == undefined) {
return;
}
$('#tb进窗信息').datagrid('cancelEdit', editIndex).datagrid('deleteRow', editIndex);
editIndex = undefined;
}
7.实现DGV中的单元格嵌套有下拉框的功能
效果图:
7.1为了实现此功能的界面代码
8.实现添加,修改,删除,审核功能的操作,其代码为:
8.1 在JavaScript中的代码
<script type="text/javascript">
$(document).ready(function () {
$("#wShangPinJinCangDan").show(700);
$('#cboSentGoodsDepartmentCode').attr("disabled", true);
$('#DaYin').attr("disabled", true);
SelectPeiSongRecord_number();
//查询绑定部门
$.getJSON("/ShangPinPeiHuoDan/SelectDepartmentTreeAll", function (data) {
$('#cboSentGoodsDepartmentCode').combotree('loadData', data);
$('#cboReceiveDepartmentcode').combotree('loadData', data);
});
$('#tb进窗信息').datagrid({
onClickRow: function (rowIndex) {
if (endEditing(false)) {
if (editIndex != rowIndex) {
$('#tb进窗信息').datagrid('selectRow', rowIndex).datagrid('beginEdit', rowIndex);
$('#tb进窗信息').datagrid('selectRow', rowIndex).datagrid('endEdit', editIndex);
endEditing2(rowIndex);
getRepertory_place_send();
getRepertory_place_harvest();
editIndex = rowIndex;
} else {
$('#tb进窗信息').datagrid('selectRow', rowIndex).datagrid('endEdit', rowIndex);
$('#tb进窗信息').datagrid('selectRow', rowIndex).datagrid('beginEdit', rowIndex);
}
} else {
$('#tb进窗信息').datagrid('endEdit', editIndex);
$('#tb进窗信息').datagrid('selectRow', rowIndex).datagrid('beginEdit', rowIndex);
endEditing2(rowIndex);
getRepertory_place_send();
getRepertory_place_harvest();
editIndex = rowIndex;
}
}
});
$.extend($.fn.datagrid.defaults.editors, {
combogrid: {
init: function (container, options) {
var input = $('<input type="text" class="datagrid-editable-input">').appendTo(container);
input.combogrid(options);
return input;
},
destroy: function (target) {
$(target).combogrid('destroy');
},
getValue: function (target) {
return $(target).combogrid('getValue');
},
setValue: function (target, value) {
$(target).combogrid('setValue', value);
},
getText: function (target) {
return $(target).combogrid('getText');
},
resize: function (target, width) {
$(target).combogrid('resize', width);
}
}
});
});
//生成删除列,删除列
function deleteSelect() {
return "<img οnclick='javascript:deletess()' src='../../Content/image/delete.png' />";
}
//移除datagrid的行
function deletess() {
if (editIndex == undefined) {
return;
}
$('#tb进窗信息').datagrid('cancelEdit', editIndex).datagrid('deleteRow', editIndex);
editIndex = undefined;
}
//打开商品配货批次
function OpenShangPinPeiHouPiCi() {
$('#wShangPinPiHuoPiCi').window('open');
var invoiceId1 = invoiceId;
if (invoiceId1 > 0) {
$('#tbBatch1').datagrid('loadData', { total: 0, rows: [] });
$.getJSON("/ShangPinPeiHuoDan/SelectInvoiceDetailByInvoiceId?invoiceId=" + invoiceId1, function (result) {
$.each(result, function (index, data) {
$('#tbBatch1').datagrid('appendRow', {
Goods_id: data['Goods_id'],
Goods_code: data['Goods_code'],
Goods_name: data['Goods_name'],
Goods_bar_code: data['Goods_bar_code'],
Vender_bar_code_deny: data['Vender_bar_code_deny'],
Art_No: data['Art_No'],
Goods_abbreviation: data['Goods_abbreviation'],
Quality_content: data['Quality_content'],
Retail_unit_price: data['Retail_unit_price'],
Format_model: data['Format_model'],
Plncode_PLN: data['Plncode_PLN'],
ChanPinZhuangTai: data['ChanPinZhuangTai'],
ShangPinFenLei: data['ShangPinFenLei'],
Copy_record_deny: data['Copy_record_deny'],
Contract_number: data['Contract_number'],
ZhiLiangDengJi: data['ZhiLiangDengJi'],
JiYingJiJie: data['JiYingJiJie'],
ShiYongDuiXiang: data['ShiYongDuiXiang'],
ShengChanChangJiaMC: data['ShengChanChangJiaMC'],
ChanDiMC: data['ChanDiMC'],
Unit_of_measurement: data['Unit_of_measurement'],
Use_target: data['Use_target'],
Goods_colours: data['Goods_colours'],
Chinese: data['Chinese'],
rademark: data['rademark'],
BaoZhiQi: data['BaoZhiQi'],
JiLiangDanWei: data['JiLiangDanWei'],
Input_ratio: data['Input_ratio'],
Output_ratio: data['Output_ratio'],
Count_scale: data['Count_scale'],
Quality_grade: data['Quality_grade'],
Manage_season_name: data['Manage_season_name'],
Permit_decimal_deny: data['Permit_decimal_deny'],
Product_status: data['Product_status'],
DengJiRen: data['DengJiRen'],
Register_time: data['Register_time'],
ShenHeRen: data['ShenHeRen'],
Review_time: data['Review_time'],
GengXinRen: data['GengXinRen'],
Update_Time: data['Update_Time'],
Purchase_bid: data['Purchase_bid'],
Self_fix_goods_deny: data['Self_fix_goods_deny'],
Mini_fix_goods_deny: data['Mini_fix_goods_deny'],
Consignment_department: data['Consignment_department'],
Consignment_department_coad: data['Consignment_department_coad'],
Shipments_quantity: data['Shipments_quantity'],
Goods: data['shangPin'],
Invoice_detail_id: data['Invoice_detail_id'],
Tax_inclusive_price: data['Tax_inclusive_price'],
Repertory_place_send_id: Repertory_place_id
});
});
});
$('#wShangPinPiHuoPiCi').window('open');
}
}
//打开批量选择窗口
function OpenPiLiangXuanShangPin() {
$('#wPiLiangXuanShangPin').window('open');
var values = $('#tb进窗信息').datagrid('getRows');
var str = [];
for (var j = 0; j < values.length; j++) {
str.push(values[j].Goods_id); //方法push(),可以将一个或多个新的元素附加到数组的尾部,然后返回到数组的新长度。
}
$.getJSON("/ShangPinPeiHuoDan/SelectPiLiangChooseGoodsInformation?repertoryEnterId=" + Repertory_enter_id + "&strarry=" + str, function (data) {
$('#tbPiLiangChooseGoods').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 MoHuSelectGoodsInformations(value) {
$('#tbPiLiangChooseGoods').datagrid({ url: '/ShangPinPeiHuoDan/MoHuSelectGoodsInformations?strBur=' + value });
}
function returnCheckBox() {
return "<input type='checkbox' name='check'/>";
}
//生成配送记录编号
function SelectPeiSongRecord_number() {
$.getJSON("/ShangPinPeiHuoDan/SelectPeiHuoRecordNumber", function (value) {
$("#txtRecord_number").val(value);
});
}
//绑定部门(发货部门)
function ChooseSentGoodsDepartment(id) { //获取combotree选择的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, 1); //执行另一个方法判断是否有父级,获取父的名称
});
}
//绑定部门(收货部门)
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); //执行另一个方法判断是否有父级,获取父的名称
});
}
function checkFar_Id(intDepartmentFarId, strDepartmentName, strDepartmentCode, str, k) {
if (intDepartmentFarId > 0) {
$.getJSON("/ShangPinPeiHuoDan/GetAllSentGoodsDepartmentByDepartmentId?intDepartmentFarId=" + intDepartmentFarId, function (data) { //当部门有父级的时候,以父级id查询部门id,并获取部门名称
//方法unshift();会将一个或多个元素添加到数组的头部,然后把已有的元素移动到下标较大的位置以腾出空间,它返回的是数组的新长度。
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, k);
}
});
} else {
var str2 = ""; //声明另一个变量,
for (var i = 0; i < str.length; i++) {
str2 += str[i].trim() + "→"; //for循环获取部门名称并拼接一个"→"
}
if (k == 1) {
$('#SentGoodsDepartmentName').val(str2 + strDepartmentName.trim() + "(" + strDepartmentCode.trim() + ")"); //str2(累加起来的部门)+点中的那个部门的代号,名称
} else {
$('#ReceiveDepartmentName').val(str2 + strDepartmentName.trim() + "(" + strDepartmentCode.trim() + ")");
}
}
}
//点击实物付货人
function openwShipper() {
$('#wShipper').window('open');
if ($('#SentGoodsDepartmentName').val()) {
var departmentid = $('#cboSentGoodsDepartmentCode').combotree('getValue');
var titles = $('#SentGoodsDepartmentName').val().trim() + "人员";
$('#tbShipper').datagrid({ url: '/ShangPinPeiHuoDan/GetEemployeebyDepartmentId?departmentid=' + departmentid });
$('#wShipper').window({ title: titles }).window('open');
} else {
return false;
}
}
//点击实物收货人
function openwReceiver() {
$('#wReceiver').window('open');
if ($('#ReceiveDepartmentName').val()) {
var departmentid = $('#cboReceiveDepartmentcode').combotree('getValue');
var titles = $('#ReceiveDepartmentName').val().trim() + "人员";
$('#tbReceiver').datagrid({ url: '/ShangPinPeiHuoDan/GetEemployeebyDepartmentId?departmentid=' + departmentid });
$('#wReceiver').window({ title: titles }).window('open');
} else {
return false;
}
}
//获取商品信息by商品id(绑定到配货单上)
function getChangPin() {
var rows = $('#tbPiLiangChooseGoods').datagrid('getRows');
for (var i = 0; i < rows.length; i++) {
if (document.getElementsByName("check")[i].checked) {
var id = rows[i].Goods_id;
$.ajax({
type: "post",
url: '/ShangPinPeiHuoDan/SelectGoodsInformationsByGoods_ID?id=' + id,
dataType: "json",
success:
function (result) {
$.each(result, function (index, data) {
$('#tb进窗信息').datagrid('appendRow', {
Goods_id: data['Goods_id'],
Goods_code: data['Goods_code'],
Goods_name: data['Goods_name'],
Goods_bar_code: data['Goods_bar_code'],
Vender_bar_code_deny: data['Vender_bar_code_deny'],
Art_No: data['Art_No'],
Goods_abbreviation: data['Goods_abbreviation'],
Quality_content: data['Quality_content'],
Retail_unit_price: data['Retail_unit_price'],
Format_model: data['Format_model'],
Plncode_PLN: data['Plncode_PLN'],
ChanPinZhuangTai: data['ChanPinZhuangTai'],
ShangPinFenLei: data['ShangPinFenLei'],
Copy_record_deny: data['Copy_record_deny'],
Contract_number: data['Contract_number'],
ZhiLiangDengJi: data['ZhiLiangDengJi'],
JiYingJiJie: data['JiYingJiJie'],
ShiYongDuiXiang: data['ShiYongDuiXiang'],
ShengChanChangJiaMC: data['ShengChanChangJiaMC'],
ChanDiMC: data['ChanDiMC'],
Unit_of_measurement: data['Unit_of_measurement'],
Use_target: data['Use_target'],
Goods_colours: data['Goods_colours'],
Chinese: data['Chinese'],
rademark: data['rademark'],
BaoZhiQi: data['BaoZhiQi'],
JiLiangDanWei: data['JiLiangDanWei'],
Input_ratio: data['Input_ratio'],
Output_ratio: data['Output_ratio'],
Count_scale: data['Count_scale'],
Quality_grade: data['Quality_grade'],
Manage_season_name: data['Manage_season_name'],
Permit_decimal_deny: data['Permit_decimal_deny'],
Product_status: data['Product_status'],
DengJiRen: data['DengJiRen'],
Register_time: data['Register_time'],
ShenHeRen: data['ShenHeRen'],
Review_time: data['Review_time'],
GengXinRen: data['GengXinRen'],
Update_Time: data['Update_Time'],
Purchase_bid: data['Purchase_bid'],
Self_fix_goods_deny: data['Self_fix_goods_deny'],
Mini_fix_goods_deny: data['Mini_fix_goods_deny'],
Repertory_place_send_id: Repertory_place_id
});
});
}
});
}
}
$('#wPiLiangXuanShangPin').window('close');
}
//结束编辑方法
var editIndex = undefined; //行索引
function endEditing(flag) {
if (editIndex == undefined) {
return true;
}
if ($('#tb进窗信息').datagrid('validateRow', editIndex)) {
try {
var faHuoKuCunid = $('#tb进窗信息').datagrid('getEditor', { index: editIndex, field: 'Repertory_place_send_id' }).target;
var faHuoKuCunmc = $(faHuoKuCunid).combobox('getText');
$('#tb进窗信息').datagrid('getRows')[editIndex]['Repertory_place_send'] = faHuoKuCunmc;
var shouHuoKuCunid = $('#tb进窗信息').datagrid('getEditor', { index: editIndex, field: 'Repertory_place_harvest_id' }).target;
var shouHuoKuCunmc = $(shouHuoKuCunid).combobox('getText');
$('#tb进窗信息').datagrid('getRows')[editIndex]['Repertory_place_harvest'] = shouHuoKuCunmc;
} catch (e) {
$('#tb进窗信息').datagrid('endEdit', editIndex); //结束编辑
editIndex = undefined;
return true;
}
} else {
return false;
}
}
//计算细数
function endEditing2(rowIndex) {
var editors = $('#tb进窗信息').datagrid('getEditors', rowIndex);
var row = $('#tb进窗信息').datagrid('getRows');
var jianShu = editors[0];
var caiGouJia = parseFloat(row[rowIndex].Purchase_bid);
var jinXiangShuilv = parseFloat(row[rowIndex].Input_ratio);
var netAmount = editors[1];
var hanShuiJia = editors[4];
var baoZhuanHanliang = row[rowIndex].Quality_content;
jianShu.target.bind('change', function () {
jiSuan();
});
function jiSuan() {
$(hanShuiJia.target).numberbox('setValue', ((jinXiangShuilv / 100 + 1) * caiGouJia));
$(netAmount.target).numberbox('setValue', (jianShu.target.val() * baoZhuanHanliang));
}
}
//获取发货地点(根据发货部门绑定datagrid中combobox)
function getRepertory_place_send() {
var row = $('#tb进窗信息').datagrid('getSelected');
var rowIndex = $('#tb进窗信息').datagrid('getRowIndex', row); //获取行号
var target = $('#tb进窗信息').datagrid('getEditor', { 'index': rowIndex, 'field': 'Repertory_place_send_id' }).target;
var url = '/ShangPinPeiHuoDan/getRepertory_place_send?buMeId=' + $('#cboSentGoodsDepartmentCode').combobox('getValue');
target.combobox('reload', url);
}
//获取收货地点(根据收货部门绑定datagrid中combobox)
function getRepertory_place_harvest() {
var row = $('#tb进窗信息').datagrid('getSelected');
var rowIndex = $('#tb进窗信息').datagrid('getRowIndex', row); //获取行号
var target = $('#tb进窗信息').datagrid('getEditor', { 'index': rowIndex, 'field': 'Repertory_place_harvest_id' }).target;
var url = '/ShangPinPeiHuoDan/getRepertory_place_harvest?buMeId=' + $('#cboReceiveDepartmentcode').combobox('getValue');
target.combobox('reload', url);
}
//查询已审核进仓单信息
function OpenwXuanZeYiShenHeJinCangDan() {
$('#wRecord_number').window('close');
if ($('#Record_number').val() != "") {
refreshAfterDelete();
SelectPeiSongRecord_number();
}
$('#txtRecord_number').attr("disabled", true);
$('#wXuanZeYiShenHeDanXiAll').window('open');
$.getJSON("/ShangPinJinChuangDan/SelectYiShenHeJinCangDan?strBlur=", function (data) {
$('#tbXuanZeYiShenHeDanXiAll').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;
}
}
//双击已审核进仓单(获取进货部门为配货单的发货部门)
var Department_id = 0;
var Repertory_enter_id = 0;
var Repertory_place_id = 0;
function DblYiShenHeJinCangDan(rowIndex, rowData) {
Department_id = rowData.Department_id;
Repertory_enter_id = rowData.Repertory_enter_id;
Repertory_place_id = rowData.Repertory_place_id;
$('#cboSentGoodsDepartmentCode').combotree('setValue', Department_id);
$('#wXuanZeYiShenHeDanXiAll').window('close');
}
//删除后的刷新
function refreshAfterDelete() {
var rows = $('#tb进窗信息').datagrid('getRows').length;
if (rows > 0) {
for (var i = rows - 1; i > -1; i--) {
$('#tb进窗信息').datagrid('deleteRow', i);
}
}
}
//双击发货人选择窗体绑定发货人
var Shipper_id = 0;
function onDblClicktbShipper(index, data) {
Shipper_id = data.Employee_id;
$('#txtShiWuFuHuoRen').val(data.Employee_name);
$('#wShipper').window('close');
}
//双击收货人选择窗体绑定收货人
var receiverId = 0;
function onDblClicktbReceiver(index, data) {
receiverId = data.Employee_id;
$('#txtShiWuShouHuoRen').val(data.Employee_name);
$('#wReceiver').window('close');
}
//打开查询未审核配货单信息窗口
function openSelectInvoice() {
parent.document.getElementById("labTips").innerHTML = "";
$('#wSelectInvoiceInformations').window('open');
$.getJSON("/ShangPinPeiHuoDan/SelectInvoiceInformations", function (data) {
$('#tbSelectInvoiceInformations').datagrid('loadData', data);
});
}
//模糊查询未审核配货单
function MoHuSelectInvoiceInformations() {
$.getJSON("/ShangPinPeiHuoDan/MoHuSelectInvoiceInformations?strBur=" + $("#strBlur1").val(), function (data) {
$('#tbSelectInvoiceInformations').datagrid('loadData', data);
});
}
//双击未审核配货单信息(绑定到配货单上)
var invoiceId = 0;
function onDblInvoice(rowIndex, rowData) {
$('#wSelectInvoiceInformations').window('close');
$('#txtRecord_number').val(rowData.Record_number);
$('#txtShiWuFuHuoRen').val(rowData.Shipper);
$('#txtShiWuShouHuoRen').val(rowData.Receiver);
$('#cboSentGoodsDepartmentCode').combotree('setValue', rowData.Delivery_department_id);
$('#SentGoodsDepartmentName').val(rowData.Consignment_department);
$('#cboReceiveDepartmentcode').combotree('setValue', rowData.Receiving_department_id);
$('#ReceiveDepartmentName').val(rowData.Receiving_department);
$('#txtBeiZhu').val(rowData.Remarks);
$('#cboMakeBills').combobox('setValue', rowData.Make_bills_id);
$('#datZhiDanTime').datetimebox('setValue', rowData.Make_bills_time);
$('#cboTransactor').combobox('setValue', rowData.Transactor_id);
$('#datZhiXingTime').datetimebox('setValue', rowData.Execute_time);
Repertory_enter_id = rowData.Repertory_enter_id;
Shipper_id = rowData.Shipper_id;
receiverId = rowData.receiverId;
invoiceId = rowData.Invoice_id;
Repertory_place_id = rowData.Repertory_place_id;
BindingWeiShenHeInvoiceDetail(invoiceId);
}
//根据配货id绑定配货明细
function BindingWeiShenHeInvoiceDetail(invoiceId) {
$('#tb进窗信息').datagrid('loadData', { total: 0, rows: [] }); //对datagrid的清空
$.getJSON("/ShangPinPeiHuoDan/BindingWeiShenHeInvoiceDetail?invoiceId=" + invoiceId, function (result) {
$.each(result, function (index, data) {
$('#tb进窗信息').datagrid('appendRow', {
Repertory_enter_packages: data['Repertory_enter_packages'],
Shipments_quantity: data['Shipments_quantity'],
Goods_id: data['Goods_id'],
Goods_code: data['Goods_code'],
Goods_name: data['Goods_name'],
Goods_bar_code: data['Goods_bar_code'],
Vender_bar_code_deny: data['Vender_bar_code_deny'],
Art_No: data['Art_No'],
Goods_abbreviation: data['Goods_abbreviation'],
Quality_content: data['Quality_content'],
Retail_unit_price: data['Retail_unit_price'],
Format_model: data['Format_model'],
Plncode_PLN: data['Plncode_PLN'],
Goods_tab: data['Goods_tab'],
Copy_record_deny: data['Copy_record_deny'],
Contract_number: data['Contract_number'],
ShengChanChangJiaMC: data['ShengChanChangJiaMC'],
Producing_area_name: data['Producing_area_name'],
JiLiangDanWei: data['JiLiangDanWei'],
ShiYongDuiXiang: data['ShiYongDuiXiang'],
Goods_colours: data['Goods_colours'],
Chinese: data['Chinese'],
ShangPinFenLei: data['ShangPinFenLei'],
BaoZhiQi: data['BaoZhiQi'],
Input_ratio: data['Input_ratio'],
Output_ratio: data['Output_ratio'],
Count_scale: data['Count_scale'],
ZhiLiangDengJi: data['ZhiLiangDengJi'],
JiYingJiJie: data['JiYingJiJie'],
ChanPinZhuangTai: data['ChanPinZhuangTai'],
DengJiRen: data['DengJiRen'],
Register_time: data['Register_time'],
ShenHeRen: data['ShenHeRen'],
Review_time: data['Review_time'],
GengXinRen: data['GengXinRen'],
Update_Time: data['Update_Time'],
Purchase_bid: data['Purchase_bid'],
Self_fix_goods_deny: data['Self_fix_goods_deny'],
Mini_fix_goods_deny: data['Mini_fix_goods_deny'],
Repertory_place_send_id: data['Repertory_place_send_id'],
Repertory_place_harvest_id: data['Repertory_place_harvest_id'],
Repertory_place_harvest: data['Repertory_place_harvest'],
Repertory_place_send: data['Repertory_place_send'],
Allot_detail_id: data['Allot_detail_id'],
Tax_inclusive_price: data['Tax_inclusive_price'],
Invoice_detail_id: data["Invoice_detail_id"],
Repertory_place_id: data["Repertory_place_id"]
});
});
$('#tb进窗信息').datagrid('acceptChanges');
});
}
//点击选择配货单
var tips = "";
function BaoCunPeiHuogDan() {
parent.document.getElementById("labTips").innerHTML = "";
if (invoiceId == 0) {
if ($("#cboSentGoodsDepartmentCode").combotree("getValue") != "" || $("#cboReceiveDepartmentcode").combotree("getValue") != "") {
ui.confirm('是否新增???', function (k) {
if (k) {
if ($('#cboMakeBills').combobox('getValue') == "" || $('#datZhiDanTime').datetimebox('getValue') == "" ||
$('#cboTransactor').combobox('getValue') == "" || $('#datZhiXingTime').datetimebox('getValue') == "") {
ui.error("数据不完整,新增失败!", 1000, false);
return false;
}
$.getJSON("/ShangPinPeiHuoDan/Insert_Invoice?repertoryEnterId=" + Repertory_enter_id + "&"
+ "recordNumber=" + $('#txtRecord_number').val() + "&"
+ "fuHuoRen=" + Shipper_id + "&"
+ "shouHuoRen=" + receiverId + "&"
+ "sentGoodsDepartment=" + $('#cboSentGoodsDepartmentCode').combotree('getValue') + "&"
+ "receiveDepartment=" + $('#cboReceiveDepartmentcode').combotree('getValue') + "&"
+ "beiZhu=" + $('#txtBeiZhu').val() + "&"
+ "makeBills=" + $('#cboMakeBills').combobox('getValue') + "&"
+ "zhiDanTime=" + $('#datZhiDanTime').datetimebox('getValue') + "&"
+ "transactor=" + $('#cboTransactor').combobox('getValue') + "&"
+ "zhiXingTime=" + $('#datZhiXingTime').datetimebox('getValue'),
function (data) {
if (data > 0) {
var dataMingXi = $('#tb进窗信息').datagrid('getRows');
var invoiceId1 = data;
for (var i = 0; i < dataMingXi.length; i++) {
$.getJSON("/ShangPinPeiHuoDan/Insert_Invoice_datetail?invoiceId=" + invoiceId1 + "&"
+ "goodsId=" + dataMingXi[i].Goods_id + "&"
+ "shipmentsQuantity=" + dataMingXi[i].Shipments_quantity + "&"
+ "repertoryPlaceSend=" + dataMingXi[i].Repertory_place_send_id + "&"
+ "repertoryPlaceHarvest=" + dataMingXi[i].Repertory_place_harvest_id);
}
ui.alert('新增成功!!!', 1000, false);
} else {
ui.error('新增失败!!!', 1000, false);
}
});
}
});
} else if (invoiceId > 0) {
ui.confirm('是否修改???', function (k) {
if (k) {
var delrow = $('#tb进窗信息').datagrid('getChanges', 'deleted');
var insertrow = $('#tb进窗信息').datagrid('getChanges', 'inserted');
var updaterow = $('#tb进窗信息').datagrid('getChanges', 'updated');
var count = 0;
if (delrow.length > 0) {
for (var i = 0; i < delrow.length; i++) {
$.getJSON("/ShangPinPeiHuoDan/DeleteInvoiceDatetailByInvoiceDatetailId?intInvoiceDatetailId=" + delrow[i].Invoice_detail_id, function (data) {
count += data;
});
}
}
if (insertrow.length > 0) {
for (var j = 0; j < insertrow.length; j++) {
$.getJSON("/ShangPinPeiHuoDan/InsertInvoiceDatetail?invoiceId=" + invoiceId + "&"
+ "intGoodsId=" + insertrow[j].Goods_id + "&"
+ "strShipmentsQuantity=" + insertrow[j].Shipments_quantity + "&"
+ "intRepertoryPlaceSendId=" + insertrow[j].Repertory_place_send_id + "&"
+ "intRepertoryPlaceHarvestId=" + insertrow[j].Repertory_place_harvest_id + "&", function (data1) {
count += data1;
});
}
}
if (updaterow.length > 0) {
var count1 = 0;
var strs = "";
for (var k = 0; k < updaterow.length; k++) {
strs += updaterow[k].Goods_id + ',';
strs += Repertory_place_id + ',';
strs += updaterow[k].Shipments_quantity + ',';
strs += updaterow[k].Invoice_detail_id + ',';
strs += updaterow[k].Repertory_place_send_id + ',';
strs += updaterow[k].Repertory_place_harvest_id;
$.getJSON("/ShangPinPeiHuoDan/SelectStock_quantityBygooodsIdAndRepertoryPlaceId?strs=" + strs, function (data) {
count1++;
if (data == true) {
tips += "<li style='font-size:15px;margin-left:1px;'>★第" + count1 + "】条明细修改成功";
} else {
tips += "<li style='font-size:15px;margin-left:1px;'>★第" + count1 + "】条明细超库存数,修改失败!";
}
parent.document.getElementById("labTips").innerHTML = "<ol type='1'>" + tips + "</ol>";
});
strs = "";
}
tips = "";
}
var success = false;
$.getJSON("/ShangPinPeiHuoDan/Update_Invoice?repertoryEnterId=" + Repertory_enter_id + "&"
+ "recordNumber=" + $('#txtRecord_number').val() + "&"
+ "fuHuoRen=" + Shipper_id + "&"
+ "shouHuoRen=" + receiverId + "&"
+ "sentGoodsDepartment=" + $('#cboSentGoodsDepartmentCode').combotree('getValue') + "&"
+ "receiveDepartment=" + $('#cboReceiveDepartmentcode').combotree('getValue') + "&"
+ "beiZhu=" + $('#txtBeiZhu').val() + "&"
+ "makeBills=" + $('#cboMakeBills').combobox('getValue') + "&"
+ "zhiDanTime=" + $('#datZhiDanTime').datetimebox('getValue') + "&"
+ "transactor=" + $('#cboTransactor').combobox('getValue') + "&"
+ "zhiXingTime=" + $('#datZhiXingTime').datetimebox('getValue') + "&"
+ "invoiceId=" + invoiceId + "&",
function (data1) {
if (data1 > 0) {
success = true;
refreshAfterUpdate(invoiceId);
}
});
if (count == (delrow.length + insertrow.length + updaterow.length && success == true)) {
ui.alert('修改成功!!!', 1000, false);
} else {
ui.error('修改失败!!!', 1000, false);
}
}
});
}
}
}
function refreshAfterUpdate(invoiceId) {
var rows = $('#tb进窗信息').datagrid('getRows').length;
$('#tb进窗信息').datagrid('loadData', { total: 0, rows: [] });
openSelectInvoice();
SelectAllotDetailByAllotId(intAllotId);
}
//删除配货明细单,配货单
function deleteInvoice() {
ui.confirm('是否删除???', function (k) {
if (k) {
$.getJSON("/ShangPinPeiHuoDan/DeleteInvoiceDetail?invoiceId=" + invoiceId,
function (data) {
$.getJSON("/ShangPinPeiHuoDan/DeleteInvoice?invoiceId=" + invoiceId,
function (data2) {
if (data2 > 0) {
ui.alert('删除成功!!!', 1000, false);
}
});
});
}
});
}
function cellStyler(value, row, index) {
if (value > 0) {
if (index % 2 == 0) {
return 'background-color:#FFEBCD;color:red';
} else {
return 'background-color:#FFEBCD;color:blue';
}
}
}
function cellStyler1(value, row, index) {
if (value != "") {
return 'background-color:#FFEBCD;color:red';
}
}
//审核配货单
function ShenHePeiHuoDan() {
if (invoiceId > 0) {
$.getJSON("/ShangPinPeiHuoDan/ShenHePeiHuoDanSelectAllDeliveryGoodsDetail?invoiceId=" + invoiceId,
function (data) {
var tip = "";
if (data == "审核成功!") {
ui.alert('审核成功!', 1000, false);
} else {
var strs = data.split('+');
for (var i = 0; i < strs.length - 1; i++) {
tip += "<li style='font-size:15px;margin-left:1px;'>" + strs[i] + "</li>";
}
}
if (tip != "") {
parent.document.getElementById("labTips").innerHTML = "<ol >" + tip + "</ol>";
}
});
}
}
//打开批次配货数量
function openPatchPeiHuoShuLiang() {
$('#WPatchPeiHuoShuLiang').window('open');
}
//对一键生成配货批次进行操作
function YiJianShengChengPatch() {
var dataBacthMingXi = $('#tbBatch1').datagrid('getRows');
var strs = "";
for (var i = 0; i < dataBacthMingXi.length; i++) {
strs += dataBacthMingXi[i].Goods_id + '<';
strs += dataBacthMingXi[i].Goods + '<';
strs += dataBacthMingXi[i].Shipments_quantity + '<';
strs += dataBacthMingXi[i].Consignment_department_coad + '<';
strs += dataBacthMingXi[i].Invoice_detail_id + '<';
strs += dataBacthMingXi[i].Purchase_bid + '<';
strs += dataBacthMingXi[i].Tax_inclusive_price + '>';
}
var peiHuoShu = $('#txtPeiHuoShu').val();
var rows = dataBacthMingXi.length;
$.getJSON("/ShangPinPeiHuoDan/ZiDongShengChengPiCi?strs=" + strs + "&peiHuoShu=" + peiHuoShu + "&rows=" + rows + "&repertoryPlaceId=" + Repertory_place_id,
function (data) {
$('#tbBatch').datagrid('loadData', data);
});
}
//双击商品信息批次(绑定到批次2表中)
function ShuanJiRowsSelectPacth(rowIndex, rowData) {
var invoiceDetailId = rowData.Invoice_detail_id;
$.getJSON("/ShangPinPeiHuoDan/SelectPacthInformation?invoiceDetailId=" + invoiceDetailId, function (data) {
$('#tbBatch').datagrid('loadData', data);
$('#tbBatch').datagrid("acceptChanges"); //acceptChanges:提交所有从加载或者上一次调用acceptChanges函数后更改的数据。
});
}
var editIndex = 0;
function onClickPacth(index) {
if (editIndex != index) {
$('#tbBatch').datagrid('beginEdit', index);
$('#tbBatch').datagrid('endEdit', editIndex);
jisuan(index);
editIndex = index;
} else {
$('#tbBatch').datagrid('selectRow', index).datagrid('endEdit', index);
$('#tbBatch').datagrid('selectRow', index).datagrid('beginEdit', index);
}
}
function jisuan(index) {
var pacth1MingXi = $('#tbBatch1').datagrid('getSelected');
var fahuoxishu = pacth1MingXi.Shipments_quantity;
var pacthMingXi1 = $('#tbBatch').datagrid('getRows');
var peihuoshuliang = 0;
for (var i = 0; i < pacthMingXi1.length; i++) {
if (i == index) continue;
peihuoshuliang += parseFloat(pacthMingXi1[i].Shipments_quantity);
}
var yushu = fahuoxishu - peihuoshuliang;
$('#tbBatch').datagrid('updateRow', {
index: index,
row: {
Shipments_quantity: yushu
}
});
}
function UpdataPacth() {
$('#tbBatch').datagrid('beginEdit', 0);
}
function OK() {
var pacthMingXi1 = $('#tbBatch').datagrid('getRows');
for (var i = 0; i < pacthMingXi1.length; i++) {
var pacthid = pacthMingXi1[i].Patch_id;
var peihuoshuliang = pacthMingXi1[i].Shipments_quantity;
$.getJSON("/ShangPinPeiHuoDan/QueRenPacth?pacthid=" + pacthid + "&" + "peihuoshuliang=" + peihuoshuliang, function (data) {
if (data > 0) {
}
});
ui.alert("保存成功!!!", 1000, false);
}
}
//日期格式
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 cancel() {
$('#tbBatch').datagrid("rejectChanges"); //rejectChanges:回滚所有从创建或者上一次调用acceptChanges函数后更改的数据。
}
//查询已审核进仓单(有无订单)
function MoHiuChaXunXuanZeYiShenHeJinCangDan() {
var xuanze = $('#XuanZe').prop('checked');
$.getJSON("/ShangPinPeiHuoDan/SelectAllJinCangDan?xuanze=" + xuanze + "&" +
"strBlur=" + $('#strBlur').val(), function (data) {
$('#tbXuanZeYiShenHeDanXiAll').datagrid('loadData', data);
});
}
</script>
<pre name="code" class="javascript"><strong><span style="font-size:18px;">8.2 为了实现这些功能的控制器操</span></strong>
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web.Mvc;
using BLL商品进仓单;
namespace 大型商贸系统.Controllers
{
public class ShangPinPeiHuoDanController : Controller
{
//
// GET: /ShangPinPeiHuoDan/
readonly DistributionGoods _myDistributionGoods = new DistributionGoods();
public ActionResult PeiHuoDan()
{
return View();
}
#region 查询批量选择商品信息
public ActionResult SelectPiLiangChooseGoodsInformation(int repertoryEnterId, string strarry)
{
DataTable dt = _myDistributionGoods.SelectPiLiangChooseGoodsInformation(repertoryEnterId);
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 MoHuSelectGoodsInformations(string strBur)
{
DataTable dt = _myDistributionGoods.MoHuSelectGoodsInformations(strBur);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 生成配货单据
public ActionResult SelectPeiHuoRecordNumber()
{
//实例化DataTable接收对象_myDistributionGoods的方法GetOddNumbers中数据返回的数据
DataTable dt = _myDistributionGoods.GetOddNumbers(6);
DataTable dt2 = _myDistributionGoods.GetDayMaxQuantity(21);//查询获取当前日最大单据数
string patchNumber = dt.Rows[0]["Prefixs"].ToString().Trim();//声明变量接收获取表dt中["Prefixs"]列单元格的值
string patchCount = dt2.Rows[0][0].ToString();//声明变量patchCount,dt2表中的总长度
//for循环并判断总的长度与dt.Rows[0]["Suffix_number"]作比较
for (int i = patchCount.Length; i < Convert.ToInt32(dt.Rows[0]["Suffix_number"].ToString().Trim()); i++)
{
patchCount = "0" + patchCount;//符合条件的要在patchCount前加“0”
}
string recordNumber = patchNumber + patchCount;//对自营无订单进仓冲红单记录编号的并接
return Json(recordNumber, JsonRequestBehavior.AllowGet);
}
#endregion
#region 获取所有部门
public ActionResult SelectDepartmentTreeAll()
{
DataTable dt = _myDistributionGoods.SelectDepartmentTreeAll();//查询所有的商品信息
string stringtree = GetDataString(dt, "0"); //执行GetDataString方法,递归地生成树形控件要用的Json字符串
stringtree = stringtree.Remove(stringtree.Length - 2, 2); //移除字符串最后两个字符即},
return Content(stringtree); //返回Joson字符串
}
public string GetDataString(DataTable dt, string id)
{
string stringbuilder = "";
DataView dv = new DataView(dt);
dv.RowFilter = "Department_Farid=" + id;
DataTable dtChild = dv.ToTable();
if (dtChild.Rows.Count > 0)
{
stringbuilder += "[";
for (int i = 0; i < dtChild.Rows.Count; i++)
{
string strLeiBieId = dtChild.Rows[i]["Department_id"].ToString().Trim();
string strLeiBieMingCheng = dtChild.Rows[i]["Department_name"].ToString().Trim();
string strLeiBieDaiMa = dtChild.Rows[i]["Department_code"].ToString().Trim();
string strChild = GetDataString(dt, strLeiBieId);
if (strChild.Length > 0)
{
stringbuilder += "{\"id\":" + strLeiBieId + ",\"text\":\"" + strLeiBieDaiMa + strLeiBieMingCheng +
"\",\"state\":\"closed\",\"children\":" + strChild;
}
else
{
stringbuilder += "{\"id\":" + strLeiBieId + ",\"text\":\"" + strLeiBieDaiMa + strLeiBieMingCheng +
"\"},";
}
}
stringbuilder = stringbuilder.Remove(stringbuilder.Length - 1, 1);
stringbuilder += "]},";
}
return stringbuilder;
}
#endregion
#region 根据部门id查询部门Farid
public ActionResult GetAllSentGoodsDepartmentByDepartmentId(int intDepartmentFarId)
{
DataTable dt = _myDistributionGoods.GetAllSentGoodsDepartmentByDepartmentId(intDepartmentFarId);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 根据部门id查询员工(实物付活人,实物收货人)
public ActionResult GetEemployeebyDepartmentId(int departmentid)
{
DataTable dt = _myDistributionGoods.GetEemployeebyDepartmentId(departmentid);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 获取制单人,执行人
public ActionResult GetMakeBillsEmployee()
{
DataTable dt = _myDistributionGoods.GetMakeBillsEmployee();
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
public ActionResult GetTransactorEmployee()
{
DataTable dt = _myDistributionGoods.GetTransactorEmployee();
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 查询商品信息by商品id(绑定到配货单上)
public ActionResult SelectGoodsInformationsByGoods_ID(int id)
{
DataTable dt = _myDistributionGoods.SelectGoodsInformationsByGoods_ID(id);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 获取发货仓库地点
public ActionResult getRepertory_place_send(int buMeId)
{
DataTable dt = _myDistributionGoods.getRepertory_place_send(buMeId);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 获取收货仓库地点
public ActionResult getRepertory_place_harvest(int buMeId)
{
DataTable dt = _myDistributionGoods.getRepertory_place_harvest(buMeId);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 新增配货单
public ContentResult Insert_Invoice(string repertoryEnterId, string recordNumber, string fuHuoRen,
string shouHuoRen, string sentGoodsDepartment, string receiveDepartment,
string beiZhu, string makeBills, string zhiDanTime, string transactor,
string zhiXingTime)
{
DataTable dt = _myDistributionGoods.Insert_Invoice(
Convert.ToInt32(repertoryEnterId),
Convert.ToInt32(receiveDepartment),
Convert.ToInt32(shouHuoRen),
Convert.ToInt32(sentGoodsDepartment),
Convert.ToInt32(fuHuoRen),
recordNumber,
beiZhu,
Convert.ToInt32(makeBills),
Convert.ToDateTime(zhiDanTime),
Convert.ToInt32(transactor),
Convert.ToDateTime(zhiXingTime)
);
return Content((dt.Rows[0][0].ToString()));
}
#endregion
#region 新增配货明细单
public void Insert_Invoice_datetail(string invoiceId, string goodsId, string shipmentsQuantity,
string repertoryPlaceSend, string repertoryPlaceHarvest)
{
_myDistributionGoods.Insert_Invoice_datetail(
Convert.ToInt32(invoiceId),
Convert.ToInt32(goodsId),
Convert.ToInt32(shipmentsQuantity),
Convert.ToInt32(repertoryPlaceSend),
Convert.ToInt32(repertoryPlaceHarvest)
);
}
#endregion
#region 查询未审核配货单
public ActionResult SelectInvoiceInformations()
{
DataTable dt = _myDistributionGoods.SelectInvoiceInformations();
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 模糊查询未审核配货单
public ActionResult MoHuSelectInvoiceInformations(string strBur)
{
DataTable dt = _myDistributionGoods.MoHuSelectInvoiceInformations(strBur);
IList<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 根据配货id绑定配货明细单
public ActionResult BindingWeiShenHeInvoiceDetail(int invoiceId)
{
DataTable dt = _myDistributionGoods.BindingWeiShenHeInvoiceDetail(invoiceId);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 修改配货单
public int Update_Invoice(string repertoryEnterId, string recordNumber, string fuHuoRen,
string shouHuoRen, string sentGoodsDepartment, string receiveDepartment,
string beiZhu, string makeBills, string zhiDanTime, string transactor,
string zhiXingTime, string invoiceId)
{
int dt = _myDistributionGoods.Update_Invoice(
Convert.ToInt32(repertoryEnterId),
Convert.ToInt32(receiveDepartment),
Convert.ToInt32(shouHuoRen),
Convert.ToInt32(sentGoodsDepartment),
Convert.ToInt32(fuHuoRen),
recordNumber,
beiZhu,
Convert.ToInt32(makeBills),
Convert.ToDateTime(zhiDanTime),
Convert.ToInt32(transactor),
Convert.ToDateTime(zhiXingTime),
Convert.ToInt32(invoiceId)
);
return dt;
}
#endregion
#region 修改配货单明细
//(1)删除
public int DeleteInvoiceDatetailByInvoiceDatetailId(int intInvoiceDatetailId)
{
return _myDistributionGoods.DeleteInvoiceDatetailByInvoiceDatetailId(intInvoiceDatetailId);
}
//(2)新增
public void InsertInvoiceDatetail(string invoiceId, string intGoodsId, string strShipmentsQuantity,
string intRepertoryPlaceSendId, string intRepertoryPlaceHarvestId)
{
_myDistributionGoods.InsertInvoiceDatetail(
Convert.ToInt32(invoiceId),
Convert.ToInt32(intGoodsId),
Convert.ToInt32(strShipmentsQuantity),
Convert.ToInt32(intRepertoryPlaceSendId),
Convert.ToInt32(intRepertoryPlaceHarvestId)
);
}
//(3)修改
public int UpdateInvoiceDatetail(string intInvoiceDatetailId,
string strShipmentsQuantity, string intRepertoryPlaceSendId,
string intRepertoryPlaceHarvestId)
{
int dt = _myDistributionGoods.UpdateInvoiceDatetail(
Convert.ToInt32(strShipmentsQuantity),
Convert.ToInt32(intRepertoryPlaceSendId),
Convert.ToInt32(intRepertoryPlaceHarvestId),
Convert.ToInt32(intInvoiceDatetailId)
);
return dt;
}
#endregion
#region 根据商品id和库存地点id查询库存表中的库存数
public ContentResult SelectStock_quantityBygooodsIdAndRepertoryPlaceId(string strs)
{
string[] rowStrings = strs.Split(',');
int goodsId = Convert.ToInt32(rowStrings[0]);
int repertoryPlaceId = Convert.ToInt32(rowStrings[1]);
int shipmentsQuantity = Convert.ToInt32(rowStrings[2]);
int invoiceDetailId = Convert.ToInt32(rowStrings[3]);
int repertoryPlaceSendId = Convert.ToInt32(rowStrings[4]);
int repertoryPlaceHarvestId = Convert.ToInt32(rowStrings[5]);
DataTable dt = _myDistributionGoods.SelectStock_quantityBygooodsIdAndRepertoryPlaceId(goodsId, repertoryPlaceId);
int data = Convert.ToInt32(dt.Rows[0][0].ToString());
if (data >= shipmentsQuantity)
{
_myDistributionGoods.UpdateInvoiceDatetail(shipmentsQuantity, repertoryPlaceSendId, repertoryPlaceHarvestId, invoiceDetailId);
}
return Content((data >= shipmentsQuantity) ? "true" : "false");
}
#endregion
#region 删除配货单明细
public int DeleteInvoiceDetail(int invoiceId)
{
return _myDistributionGoods.DeleteInvoiceDetail(invoiceId);
}
#endregion
#region 删除配货单
public int DeleteInvoice(int invoiceId)
{
return _myDistributionGoods.DeleteInvoice(invoiceId);
}
#endregion
#region 审核查询所有的配货明细
public ActionResult ShenHePeiHuoDanSelectAllDeliveryGoodsDetail(int invoiceId)
{
DataTable dt = _myDistributionGoods.ShenHePeiHuoDanSelectAllDeliveryGoodsDetail(invoiceId);
string msg = "";
var arrstockId = new List<int>();
var shipmentsQuantityTim = new List<int>();
for (int i = 0; i < dt.Rows.Count; i++)
{
var shipmentsQuantity = Convert.ToInt32(dt.Rows[i]["Shipments_quantity"]);
var goodsId = Convert.ToInt32(dt.Rows[i]["Goods_id"]);
var repertoryPlaceSendId = Convert.ToInt32(dt.Rows[i]["Repertory_place_send_id"]);
DataTable dt1 = _myDistributionGoods.SelectStock_quantityBygooodsIdAndRepertoryPlaceId(goodsId,
repertoryPlaceSendId);
var goodName = "";
if (dt1.Rows.Count > 0)
{
goodName = dt1.Rows[0]["Goods_name"].ToString();
var stockQuantity = Convert.ToInt32(dt1.Rows[0][0]);
var stockId = Convert.ToInt32(dt1.Rows[0][1]);
if (shipmentsQuantity < stockQuantity)
{
arrstockId.Add(stockId);
shipmentsQuantityTim.Add(shipmentsQuantity);
}
else
{
msg += goodName + "库为<font style='font-size:15px;'>" + stockQuantity + "</font><br/>欠缺数为<font style='font-size:15px;color:red'>" + (shipmentsQuantity - stockQuantity) + "</font>+";
}
}
else
{
msg += goodName + "没有库存+";
}
}
if (msg != "")
{
msg = "审核失败,原因如下:+" + msg;
}
else
{
for (int i = 0; i < shipmentsQuantityTim.Count; i++)
{
_myDistributionGoods.UpdateStockQuantity(arrstockId[i], shipmentsQuantityTim[i]);
}
_myDistributionGoods.Update_InvoiceOfReview_deny(invoiceId);
msg = "审核成功!";
}
return Json(msg, JsonRequestBehavior.AllowGet);
}
#endregion
#region 查询商品配货配次(根据商品id查询配货明细)
public ActionResult SelectInvoiceDetailByInvoiceId(int invoiceId)
{
DataTable dt = _myDistributionGoods.SelectInvoiceDetailByInvoiceId(invoiceId);
dt.Columns.Add("shangPin", typeof(string));
for (int i = 0; i < dt.Rows.Count; i++)
{
var goodsCode = dt.Rows[i]["Goods_code"].ToString();
var goodsName = dt.Rows[i]["Goods_name"].ToString();
dt.Rows[i]["shangPin"] = goodsCode.Trim() + goodsName.Trim();
}
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 自动生成配货批次
//自动生成批次
public ActionResult ZiDongShengChengPiCi(string strs, int peiHuoShu, int rows, int repertoryPlaceId)
{
string[] str2 = strs.Split('>');
string[] str = str2.Reverse().ToArray();
DataTable dt = new DataTable();
dt.Columns.Add("Patch", typeof(string));
dt.Columns.Add("NoTax_inclusive_price", typeof(string));
dt.Columns.Add("Tax_inclusive_price", typeof(string));
dt.Columns.Add("Shipments_quantity", typeof(string));
dt.Columns.Add("JieCunShu", typeof(string));
string msg = "";
for (int i = 1; i < str.Length; i++)
{
dt.Rows.Clear();
string[] str1 = str[i].Split('<');
var weiFenPei = Convert.ToInt32(str1[2].Trim());
var goodsid = Convert.ToInt32(str1[0].Trim());
var invoiceDetailId = Convert.ToInt32(str1[4].Trim());
DataTable dt2 = _myDistributionGoods.SelectPacthInformation(invoiceDetailId);
if (dt2.Rows.Count > 0)
{
continue;
}
DataTable dt1 = _myDistributionGoods.SelectStock_quantityBygooodsIdAndRepertoryPlaceId(goodsid, repertoryPlaceId);
var kuCunShu = 0;
if (dt1.Rows.Count > 0)
{
kuCunShu = Convert.ToInt32(dt1.Rows[0]["Stock_quantity"]);
}
else
{
msg += "商品" + str1[1].Trim() + "没有库存!" + "<";
}
int j = 0;
while (weiFenPei > 0 && peiHuoShu <= weiFenPei && kuCunShu > 0)
{
dt.Rows.Add(j);
string patchNumber = Picihao(goodsid);
dt.Rows[j]["Patch"] = patchNumber;
dt.Rows[j]["NoTax_inclusive_price"] = str1[5].Trim();
dt.Rows[j]["Tax_inclusive_price"] = str1[6].Trim();
dt.Rows[j]["Shipments_quantity"] = peiHuoShu;
if (kuCunShu == 0)
{
dt.Rows[j]["JieCunShu"] = 0;
}
else
{
dt.Rows[j]["JieCunShu"] = kuCunShu - peiHuoShu;
kuCunShu -= peiHuoShu;
}
weiFenPei -= peiHuoShu;
j++;
_myDistributionGoods.AddPatch(patchNumber, invoiceDetailId, peiHuoShu);
}
if (weiFenPei < peiHuoShu && weiFenPei > 0 && kuCunShu > 0)
{
dt.Rows.Add(j);
string patchNumber = Picihao(goodsid);
dt.Rows[j]["Patch"] = patchNumber;
dt.Rows[j]["NoTax_inclusive_price"] = str1[5].Trim();
dt.Rows[j]["Tax_inclusive_price"] = str1[6].Trim();
dt.Rows[j]["Shipments_quantity"] = weiFenPei;
if (kuCunShu == 0)
{
dt.Rows[j]["JieCunShu"] = 0;
}
else
{
dt.Rows[j]["JieCunShu"] = kuCunShu - peiHuoShu;
}
_myDistributionGoods.AddPatch(patchNumber, invoiceDetailId, weiFenPei);
}
}
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
//生成配货批次号
private string Picihao(int goodid = 0)
{
DataTable dt = _myDistributionGoods.GetOddNumbers(3);
DataTable dt2 = _myDistributionGoods.GetDayMaxQuantityOfPi(goodid);
string patchCount = "0";
if (dt2.Rows.Count == 0)
{
_myDistributionGoods.InsertDayMaxCount(goodid);
}
else
{
patchCount = dt2.Rows[0][0].ToString();
}
string patchNumber = dt.Rows[0]["Prefixs"].ToString().Trim();
for (int i = patchCount.Length; i < Convert.ToInt32(dt.Rows[0]["Suffix_number"].ToString().Trim()); i++)
{
patchCount = "0" + patchCount;
}
string recordNumber = patchNumber + patchCount;
return recordNumber;
}
//查询批次中的批次信息(绑定到批次2中)
public ActionResult SelectPacthInformation(int invoiceDetailId)
{
DataTable dt = _myDistributionGoods.SelectPacthInformation(invoiceDetailId);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 修改保存确认批次
public int QueRenPacth(string pacthid, string peihuoshuliang)
{
int dt = _myDistributionGoods.QueRenPacth(Convert.ToInt32(pacthid),
Convert.ToDecimal(peihuoshuliang));
return dt;
}
#endregion
#region 查询已审核进仓单(有无订单)/模糊查询
public ActionResult SelectAllJinCangDan(bool xuanze, string strBlur)
{
DataTable dt = _myDistributionGoods.SelectYiShenHeJinCangDan(xuanze, strBlur);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
}
}
8.3 为了实现这些功能,逻辑层代码
using System;
using System.Data;
using System.Data.SqlClient;
using DALPublic;
namespace BLL商品进仓单
{
public class DistributionGoods
{
readonly DALMethod _myDalMethod = new DALMethod();
#region 查询批量选择商品信息
public DataTable SelectPiLiangChooseGoodsInformation(int repertoryEnterId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_enter_id",SqlDbType.Int),
};
sql[0].Value = "SelectPiLiangChooseGoodsInformation";
sql[1].Value = repertoryEnterId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 模糊查询批量选择商品信息
public DataTable MoHuSelectGoodsInformations(string strBur)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@strBur", SqlDbType.Char),
};
sql[0].Value = "MoHuSelectGoodsInformations";
sql[1].Value = strBur;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", 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 SelectDepartmentTreeAll()
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
};
sql[0].Value = "SelectDepartmentTreeAll";
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 根据部门id查询部门Farid
public DataTable GetAllSentGoodsDepartmentByDepartmentId(int departmentId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Department_id", SqlDbType.Int),
};
sql[0].Value = "GetAllSentGoodsDepartmentByDepartmentId";
sql[1].Value = departmentId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 根据部门id查询员工(实物付活人,实物收货人)
public DataTable GetEemployeebyDepartmentId(int departmentId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Department_id", SqlDbType.Int),
};
sql[0].Value = "GetEemployeebyDepartmentId";
sql[1].Value = departmentId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 获取制单人,执行人
public DataTable GetMakeBillsEmployee()
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
};
sql[0].Value = "GetMakeBillsEmployee";
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
public DataTable GetTransactorEmployee()
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
};
sql[0].Value = "GetTransactorEmployee";
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 查询商品信息by商品id(绑定到配货单上)
public DataTable SelectGoodsInformationsByGoods_ID(int goodsId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Goods_id", SqlDbType.Int),
};
sql[0].Value = "SelectGoodsInformationsByGoods_ID";
sql[1].Value = goodsId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 获取发货仓库地点
public DataTable getRepertory_place_send(int departmentId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Department_id", SqlDbType.Int),
};
sql[0].Value = "getRepertory_place_send";
sql[1].Value = departmentId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 获取收货仓库地点
public DataTable getRepertory_place_harvest(int departmentId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Department_id", SqlDbType.Int),
};
sql[0].Value = "getRepertory_place_harvest";
sql[1].Value = departmentId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 新增配货单
public DataTable Insert_Invoice(int repertoryEnterId, int receivingDepartmentId, int receiverId,
int deliveryDepartmentId, int shipperId, string recordNumber,
string remarks, int makeBillsId, DateTime makeBillsTime,
int transactorId, DateTime executeTime)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_enter_id",SqlDbType.Int),
new SqlParameter("@Receiving_department_id", SqlDbType.Int),
new SqlParameter("@Receiver_id", SqlDbType.Int),
new SqlParameter("@Delivery_department_id", SqlDbType.Int),
new SqlParameter("@Shipper_id", SqlDbType.Int),
new SqlParameter("@Record_number", SqlDbType.Char),
new SqlParameter("@Remarks", SqlDbType.Char),
new SqlParameter("@Make_bills_id", SqlDbType.Int),
new SqlParameter("@Make_bills_time", SqlDbType.DateTime),
new SqlParameter("@Transactor_id", SqlDbType.Int),
new SqlParameter("@Execute_time", SqlDbType.DateTime)
};
sql[0].Value = "Insert_Invoice";
sql[1].Value = repertoryEnterId;
sql[2].Value = receivingDepartmentId;
sql[3].Value = receiverId;
sql[4].Value = deliveryDepartmentId;
sql[5].Value = shipperId;
sql[6].Value = recordNumber;
sql[7].Value = remarks;
sql[8].Value = makeBillsId;
sql[9].Value = makeBillsTime;
sql[10].Value = transactorId;
sql[11].Value = executeTime;
return _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
}
#endregion
#region 新增配货明细单
public int Insert_Invoice_datetail(int invoiceId, int goodsId,
int shipmentsQuantity, int repertoryPlaceSendId,
int repertoryPlaceHarvestId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Invoice_id", SqlDbType.Int),
new SqlParameter("@Goods_id", SqlDbType.Int),
new SqlParameter("@Shipments_quantity", SqlDbType.Int),
new SqlParameter("@Repertory_place_send_id", SqlDbType.Int),
new SqlParameter("@Repertory_place_harvest_id", SqlDbType.Int)
};
sql[0].Value = "Insert_Invoice_datetail";
sql[1].Value = invoiceId;
sql[2].Value = goodsId;
sql[3].Value = shipmentsQuantity;
sql[4].Value = repertoryPlaceSendId;
sql[5].Value = repertoryPlaceHarvestId;
return _myDalMethod.DAL_OPTableDB_Par("DeliveryGoods", sql);
}
#endregion
#region 查询未审核配货单
public DataTable SelectInvoiceInformations()
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
};
sql[0].Value = "SelectInvoiceInformations";
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 模糊查询未审核配货单
public DataTable MoHuSelectInvoiceInformations(string strBur)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@strBur", SqlDbType.Char),
};
sql[0].Value = "MoHuSelectInvoiceInformations";
sql[1].Value = strBur;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 根据配货id绑定配货明细单
public DataTable BindingWeiShenHeInvoiceDetail(int invoiceId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Invoice_id", SqlDbType.Int),
};
sql[0].Value = "BindingWeiShenHeInvoiceDetail";
sql[1].Value = invoiceId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 修改配货单
public int Update_Invoice(int repertoryEnterId, int receivingDepartmentId, int receiverId,
int deliveryDepartmentId, int shipperId, string recordNumber,
string remarks, int makeBillsId, DateTime makeBillsTime,
int transactorId, DateTime executeTime, int invoiceId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_enter_id",SqlDbType.Int),
new SqlParameter("@Receiving_department_id", SqlDbType.Int),
new SqlParameter("@Receiver_id", SqlDbType.Int),
new SqlParameter("@Delivery_department_id", SqlDbType.Int),
new SqlParameter("@Shipper_id", SqlDbType.Int),
new SqlParameter("@Record_number", SqlDbType.Char),
new SqlParameter("@Remarks", SqlDbType.Char),
new SqlParameter("@Make_bills_id", SqlDbType.Int),
new SqlParameter("@Make_bills_time", SqlDbType.DateTime),
new SqlParameter("@Transactor_id", SqlDbType.Int),
new SqlParameter("@Execute_time", SqlDbType.DateTime),
new SqlParameter("@Invoice_id",SqlDbType.Int),
};
sql[0].Value = "Update_Invoice";
sql[1].Value = repertoryEnterId;
sql[2].Value = receivingDepartmentId;
sql[3].Value = receiverId;
sql[4].Value = deliveryDepartmentId;
sql[5].Value = shipperId;
sql[6].Value = recordNumber;
sql[7].Value = remarks;
sql[8].Value = makeBillsId;
sql[9].Value = makeBillsTime;
sql[10].Value = transactorId;
sql[11].Value = executeTime;
sql[12].Value = invoiceId;
return _myDalMethod.DAL_OPTableDB_Par("DeliveryGoods", sql);
}
#endregion
#region 修改配货单明细
//(1)删除
public int DeleteInvoiceDatetailByInvoiceDatetailId(int invoiceDetailId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Invoice_detail_id", SqlDbType.Int),
};
sql[0].Value = "DeleteInvoiceDatetailByInvoiceDatetailId";
sql[1].Value = invoiceDetailId;
return _myDalMethod.DAL_OPTableDB_Par("DeliveryGoods", sql);
}
//(2)新增
public int InsertInvoiceDatetail(int invoiceId, int goodsId,
int shipmentsQuantity, int repertoryPlaceSendId,
int repertoryPlaceHarvestId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Invoice_id", SqlDbType.Int),
new SqlParameter("@Goods_id", SqlDbType.Int),
new SqlParameter("@Shipments_quantity", SqlDbType.Int),
new SqlParameter("@Repertory_place_send_id", SqlDbType.Int),
new SqlParameter("@Repertory_place_harvest_id", SqlDbType.Int)
};
sql[0].Value = "InsertInvoiceDatetail";
sql[1].Value = invoiceId;
sql[2].Value = goodsId;
sql[3].Value = shipmentsQuantity;
sql[4].Value = repertoryPlaceSendId;
sql[5].Value = repertoryPlaceHarvestId;
return _myDalMethod.DAL_OPTableDB_Par("DeliveryGoods", sql);
}
//(3)修改
public int UpdateInvoiceDatetail(int shipmentsQuantity, int repertoryPlaceSendId,
int repertoryPlaceHarvestId, int invoiceDetailId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Shipments_quantity", SqlDbType.Int),
new SqlParameter("@Repertory_place_send_id", SqlDbType.Int),
new SqlParameter("@Repertory_place_harvest_id", SqlDbType.Int),
new SqlParameter("@Invoice_detail_id", SqlDbType.Int),
};
sql[0].Value = "UpdateInvoiceDatetail";
sql[1].Value = shipmentsQuantity;
sql[2].Value = repertoryPlaceSendId;
sql[3].Value = repertoryPlaceHarvestId;
sql[4].Value = invoiceDetailId;
return _myDalMethod.DAL_OPTableDB_Par("DeliveryGoods", sql);
}
#endregion
#region 根据商品id和库存地点id查询库存表中的库存数
public DataTable SelectStock_quantityBygooodsIdAndRepertoryPlaceId(int goodsId, int repertoryPlaceId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_place_id", SqlDbType.Int),
new SqlParameter("@Goods_id", SqlDbType.Int),
};
sql[0].Value = "SelectStock_quantityBygooodsIdAndRepertoryPlaceId";
sql[1].Value = repertoryPlaceId;
sql[2].Value = goodsId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 删除配货单明细
public int DeleteInvoiceDetail(int invoiceId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Invoice_id", SqlDbType.Int),
};
sql[0].Value = "DeleteInvoiceDetail";
sql[1].Value = invoiceId;
int dt = _myDalMethod.DAL_OPTableDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 删除配货单
public int DeleteInvoice(int invoiceId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Invoice_id", SqlDbType.Int),
};
sql[0].Value = "DeleteInvoice";
sql[1].Value = invoiceId;
int dt = _myDalMethod.DAL_OPTableDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 审核查询所有的配货明细
public DataTable ShenHePeiHuoDanSelectAllDeliveryGoodsDetail(int invoiceId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Invoice_id", SqlDbType.Int)
};
sql[0].Value = "ShenHePeiHuoDanSelectAllDeliveryGoodsDetail";
sql[1].Value = invoiceId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
public void UpdateStockQuantity(int invoiceDetailId, int shipmentsQuantity)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Stock_id", SqlDbType.Int),
new SqlParameter("@Stock_quantity", SqlDbType.Int)
};
sql[0].Value = "updateStockQuantity";
sql[1].Value = invoiceDetailId;
sql[2].Value = shipmentsQuantity;
_myDalMethod.DAL_OPTableDB_Par("DeliveryGoods", sql);
}
public void Update_InvoiceOfReview_deny(int invoiceId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB",SqlDbType.Char),
new SqlParameter("@Invoice_id",SqlDbType.Int),
};
sql[0].Value = "Update_InvoiceOfReview_deny";
sql[1].Value = invoiceId;
_myDalMethod.DAL_OPTableDB_Par("DeliveryGoods", sql);
}
#region 查询商品配货配次(根据商品id查询配货明细)
public DataTable SelectInvoiceDetailByInvoiceId(int invoiceId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Invoice_id", SqlDbType.Int),
};
sql[0].Value = "SelectInvoiceDetailByInvoiceId";
sql[1].Value = invoiceId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 自动生成配货批次
//获取配货批次
public DataTable GetDayMaxQuantityOfPi(int goodid)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Goods_id", SqlDbType.Int),
};
sql[0].Value = "GetDayMaxQuantityOfPi";
sql[1].Value = goodid;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
//新增日最大单数
public DataTable InsertDayMaxCount(int goodid)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Goods_id", SqlDbType.Int),
};
sql[0].Value = "InsertDayMaxCount";
sql[1].Value = goodid;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
//新增批次
public int AddPatch(string patchNumber, int invoiceDetailId, int peiHuoShu)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@PatchNumber",SqlDbType.Char),
new SqlParameter("@Detail_pubid",SqlDbType.Int),
new SqlParameter("@Delivery_quantity",SqlDbType.Decimal),
};
sql[0].Value = "AddPatch";
sql[1].Value = patchNumber;
sql[2].Value = invoiceDetailId;
sql[3].Value = peiHuoShu;
int dt = _myDalMethod.DAL_OPTableDB_Par("DeliveryGoods", sql);
return dt;
}
查询批次中的批次信息(绑定到批次2中)
public DataTable SelectPacthInformation(int invoiceDetailId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Invoice_detail_id", SqlDbType.Int),
};
sql[0].Value = "SelectPacthInformation";
sql[1].Value = invoiceDetailId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
#region 修改保存确认批次
public int QueRenPacth(int patchId, decimal deliveryQuantity)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Patch_id", SqlDbType.Int),
new SqlParameter("@Delivery_quantity", SqlDbType.Decimal),
};
sql[0].Value = "QueRenPacth";
sql[1].Value = patchId;
sql[2].Value = deliveryQuantity;
return _myDalMethod.DAL_OPTableDB_Par("DeliveryGoods", sql);
}
#endregion
#region 查询已审核进仓单(有无订单)/模糊查询
public DataTable SelectYiShenHeJinCangDan(bool havaIndentDeny,string strBlur)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@strBlur", SqlDbType.Char),
};
if (havaIndentDeny)
{
sql[0].Value = "SelectYiShenHeJinCangDan";
sql[1].Value = strBlur;
}
else
{
sql[0].Value = "SelectYiShenHeWDJinCangDan";
sql[1].Value = strBlur;
}
DataTable dt = _myDalMethod.DAL_SelectDB_Par("DeliveryGoods", sql);
return dt;
}
#endregion
}
}
8.4 为了实现这些功能的存储过程
USE [大型商贸系统]
GO
/****** Object: StoredProcedure [dbo].[DeliveryGoods] Script Date: 06/30/2015 23:25:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[DeliveryGoods]
@NB char(200)='',@strBur char(20)='',@Department_id int=0,@Goods_id int=0,
@Receiving_department_id int=0,@Receiver_id int=0,@Delivery_department_id int=0,
@Shipper_id int=0,@Record_number char(20)='',@Remarks char(10)='',@Make_bills_id int=0,
@Make_bills_time datetime='',@Transactor_id int=0,@Execute_time datetime='',@Invoice_id int=0,
@Shipments_quantity int=0,@Repertory_place_send_id int=0,@Repertory_place_harvest_id int=0,
@Repertory_enter_id int=0,@Invoice_detail_id int=0,@Repertory_place_id int=0,
@Stock_quantity int=0,@Stock_id int =0,@PatchNumber char(15)='',
@Detail_pubid int=0,@Delivery_quantity decimal(18, 0)=0,@Patch_id int=0,@strBlur char(20)=''
AS
BEGIN
--查询批量选择商品信息
if(@NB='SelectPiLiangChooseGoodsInformation')
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, Repertory_enter_detail.Goods_id, Repertory_enter.Repertory_enter_id
FROM 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 INNER JOIN
Repertory_enter_detail ON Goods.Goods_id = Repertory_enter_detail.Goods_id INNER JOIN
Repertory_enter ON Repertory_enter_detail.Repertory_enter_id = Repertory_enter.Repertory_enter_id
where Repertory_enter.Repertory_enter_id=@Repertory_enter_id and Repertory_enter_detail.Repertory_enter_detail_Farid=0
end
--模糊查询批量选择商品信息
if(@NB='MoHuSelectGoodsInformations')
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.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
FROM 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
where 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
--获取所以部门信息绑定发货部门tree
if(@NB='SelectDepartmentTreeAll')
begin
SELECT Department.*
FROM Department
end
--根据部门id查询部门Farid
if(@NB='GetAllSentGoodsDepartmentByDepartmentId')
begin
SELECT Department_Farid, Department_code, Department_name
FROM Department
where Department_id=@Department_id
end
--根据部门id查询员工
if(@NB='GetEemployeebyDepartmentId')
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
WHERE (Eemployee.Department_id = @Department_id)
end
--获取制单人
if(@NB='GetMakeBillsEmployee')
begin
SELECT Department_id AS ID, Employee_name AS Name
FROM Eemployee
end
--获取执行人
if(@NB='GetTransactorEmployee')
begin
SELECT Department_id AS ID, Employee_name AS Name
FROM Eemployee
end
--查询商品信息by商品id
if(@NB='SelectGoodsInformationsByGoods_ID'and @Goods_id>0)
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.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
FROM 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
where Goods.Goods_id=@Goods_id;
end
--获取发货仓库地点
if(@NB='getRepertory_place_send')
begin
SELECT Repertory_place_id AS Repertory_place_send_id, Repertory_place_name AS Repertory_place_send
FROM Repertory_place
where Department_id=@Department_id
end
--获取收货仓库地点
if(@NB='getRepertory_place_harvest')
begin
SELECT Repertory_place_id AS Repertory_place_harvest_id, Repertory_place_name AS Repertory_place_harvest
FROM Repertory_place
where Department_id=@Department_id
end
--新增配货单
if(@NB='Insert_Invoice')
begin
begin tran
INSERT INTO Invoice
(Repertory_enter_id,Receiving_department_id, Receiver_id, Delivery_department_id, Shipper_id, Record_number, Remarks, Make_bills_id, Make_bills_time, Transactor_id, Execute_time,Review_deny)
VALUES (@Repertory_enter_id,@Receiving_department_id,@Receiver_id,@Delivery_department_id,@Shipper_id,@Record_number,@Remarks,@Make_bills_id,@Make_bills_time,@Transactor_id,@Execute_time,'false')
select @@IDENTITY
SELECT Day_max_count
FROM Day_max_quantity
where Odd_numbers_id=1
UPDATE Day_max_quantity
SET Day_max_count = Day_max_count+1
where Odd_numbers_id=1
commit tran
end
--新增配货明细单
if(@NB='Insert_Invoice_datetail')
begin
INSERT INTO Invoice_detail
(Invoice_id, Goods_id, Shipments_quantity, Repertory_place_send_id, Repertory_place_harvest_id,Review_deny)
VALUES (@Invoice_id,@Goods_id,@Shipments_quantity,@Repertory_place_send_id,@Repertory_place_harvest_id,'false')
end
--查询未审核配货单
if(@NB='SelectInvoiceInformations')
begin
SELECT Invoice.Invoice_id, Invoice.Repertory_enter_id, Invoice.Receiving_department_id, Department.Department_name AS Consignment_department, Invoice.Receiver_id, Invoice.Delivery_department_id,
Department_1.Department_name AS Receiving_department, Eemployee.Employee_name AS Receiver, Invoice.Shipper_id, Eemployee_1.Employee_name AS Shipper, Invoice.Record_number,
Invoice.Remarks, Eemployee_2.Employee_name AS MakeBills, Invoice.Make_bills_id, Invoice.Make_bills_time, Invoice.Transactor_id, Eemployee_3.Employee_name AS Transactor,
Invoice.Execute_time, Invoice.Review_deny, Department.Department_code AS Receiving_department_code, Department_1.Department_code AS Consignment_department_code,
Repertory_enter.Repertory_place_id
FROM Department INNER JOIN
Invoice ON Department.Department_id = Invoice.Receiving_department_id INNER JOIN
Department AS Department_1 ON Invoice.Delivery_department_id = Department_1.Department_id INNER JOIN
Eemployee ON Invoice.Receiver_id = Eemployee.Employee_id INNER JOIN
Eemployee AS Eemployee_1 ON Invoice.Shipper_id = Eemployee_1.Employee_id INNER JOIN
Eemployee AS Eemployee_2 ON Invoice.Make_bills_id = Eemployee_2.Employee_id INNER JOIN
Eemployee AS Eemployee_3 ON Invoice.Transactor_id = Eemployee_3.Employee_id INNER JOIN
Repertory_enter ON Invoice.Repertory_enter_id = Repertory_enter.Repertory_enter_id
WHERE Invoice.Review_deny='false'
end
--模糊查询未审核配货单
if(@NB='MoHuSelectInvoiceInformations')
begin
SELECT Invoice.Invoice_id, Invoice.Repertory_enter_id, Invoice.Receiving_department_id, Department.Department_name AS Consignment_department, Invoice.Receiver_id, Invoice.Delivery_department_id,
Department_1.Department_name AS Receiving_department, Eemployee.Employee_name AS Receiver, Invoice.Shipper_id, Eemployee_1.Employee_name AS Shipper, Invoice.Record_number,
Invoice.Remarks, Eemployee_2.Employee_name AS MakeBills, Invoice.Make_bills_id, Invoice.Make_bills_time, Invoice.Transactor_id, Eemployee_3.Employee_name AS Transactor,
Invoice.Execute_time, Invoice.Review_deny, Department.Department_code AS Receiving_department_code, Department_1.Department_code AS Consignment_department_code,
Repertory_enter.Repertory_place_id
FROM Department INNER JOIN
Invoice ON Department.Department_id = Invoice.Receiving_department_id INNER JOIN
Department AS Department_1 ON Invoice.Delivery_department_id = Department_1.Department_id INNER JOIN
Eemployee ON Invoice.Receiver_id = Eemployee.Employee_id INNER JOIN
Eemployee AS Eemployee_1 ON Invoice.Shipper_id = Eemployee_1.Employee_id INNER JOIN
Eemployee AS Eemployee_2 ON Invoice.Make_bills_id = Eemployee_2.Employee_id INNER JOIN
Eemployee AS Eemployee_3 ON Invoice.Transactor_id = Eemployee_3.Employee_id INNER JOIN
Repertory_enter ON Invoice.Repertory_enter_id = Repertory_enter.Repertory_enter_id
where Invoice.Record_number like '%'+ rtrim(ltrim(@strBur)) +'%'
end
--根据配货id绑定配货明细单
if(@NB='BindingWeiShenHeInvoiceDetail')
begin
SELECT Invoice_detail.Invoice_detail_id, Invoice_detail.Invoice_id, Invoice_detail.Goods_id, Invoice_detail.Shipments_quantity, Invoice_detail.Repertory_place_send_id,
Invoice_detail.Repertory_place_harvest_id, Goods.Goods_code, Goods.Goods_bar_code, Goods.Vender_bar_code_deny, Goods.Goods_name, Goods.Retail_unit_price, Goods.Art_No,
Goods.Format_model, Attribute_gather_detail.Attribute_gather_detail_name AS JiLiangDanWei, Goods.Goods_abbreviation, Goods.Plncode_PLN, Goods.Copy_record_deny,
Agreement.Contract_number, Goods.Agreement_id, Goods.Manufacturer_id, Manufacturer.Manufacturer_name AS ShengChanChangJiaMC,
Goods_producing_area.Producing_area_name AS ChanDiMC, Attribute_gather_detail_1.Attribute_gather_detail_name AS ShiYongDuiXiang, Goods.Goods_colours,
Attribute_gather_detail_2.Attribute_gather_detail_name AS rademark, Attribute_gather_detail_3.Attribute_gather_detail_name AS ShangPinFenLei,
Attribute_gather_detail_4.Attribute_gather_detail_name AS BaoZhiQi, Goods.Input_ratio, Goods.Output_ratio, Goods.Count_scale, Goods.Quality_content,
Attribute_gather_detail_5.Attribute_gather_detail_name AS ZhiLiangDengJi, Manage_season.Manage_season_name AS JiYingJiJie,
Attribute_gather_detail_6.Attribute_gather_detail_name AS ChanPinZhuangTai, Eemployee.Employee_name AS DengJiRen, 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 ShenHeRen, Eemployee_2.Employee_name AS GengXinRen, CONVERT(varchar(20),
Goods.Update_Time, 120) AS Update_Time, Goods.Purchase_bid, Goods.Self_fix_goods_deny, Goods.Mini_fix_goods_deny, Invoice_detail.Review_deny,
Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5)) / 100 + 1) AS Tax_inclusive_price, Invoice_detail.Shipments_quantity / Goods.Quality_content AS Repertory_enter_packages,
Repertory_place.Repertory_place_name AS Repertory_place_send, Repertory_place_1.Repertory_place_name AS Repertory_place_harvest, Repertory_place.Repertory_place_id
FROM Repertory_place INNER JOIN
Invoice_detail INNER JOIN
Goods ON Invoice_detail.Goods_id = Goods.Goods_id INNER JOIN
Attribute_gather_detail ON Goods.Unit_of_measurement_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
Agreement ON Goods.Agreement_id = Agreement.Agreement_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 INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_1 ON Goods.Use_target_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods.Goods_rademark_id = Attribute_gather_detail_2.Attribute_gather_detail_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_3 ON Goods.Goods_classify_pubid = Attribute_gather_detail_3.Attribute_gather_detail_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_4 ON Goods.Quality_guarantee_period_pubid = Attribute_gather_detail_4.Attribute_gather_detail_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_5 ON Goods.Quality_grade_pubid = Attribute_gather_detail_5.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_6 ON Goods.Product_status_pubid = Attribute_gather_detail_6.Attribute_gather_detail_id INNER JOIN
Eemployee ON Goods.Registrant_id = Eemployee.Employee_id INNER JOIN
Eemployee AS Eemployee_1 ON Goods.Auditor_id = Eemployee_1.Employee_id INNER JOIN
Eemployee AS Eemployee_2 ON Goods.Update_person_id = Eemployee_2.Employee_id ON Repertory_place.Repertory_place_id = Invoice_detail.Repertory_place_send_id INNER JOIN
Repertory_place AS Repertory_place_1 ON Invoice_detail.Repertory_place_harvest_id = Repertory_place_1.Repertory_place_id
where Invoice_detail.Invoice_id=@Invoice_id and Invoice_detail.Review_deny='false'
end
--修改配货单
if(@NB='Update_Invoice')
begin
UPDATE Invoice
SET Repertory_enter_id =@Repertory_enter_id,
Receiving_department_id =@Receiving_department_id,
Receiver_id =@Receiver_id,
Delivery_department_id =@Delivery_department_id,
Shipper_id =@Shipper_id, Record_number =@Record_number,
Remarks =@Remarks, Make_bills_id =@Make_bills_id,
Make_bills_time =@Make_bills_time, Transactor_id =@Transactor_id,
Execute_time =@Execute_time, Review_deny ='false'
where Invoice.Invoice_id=@Invoice_id
end
--修改配货明细
begin
if(@NB='DeleteInvoiceDatetailByInvoiceDatetailId')
begin
DELETE FROM Invoice_detail
where Invoice_detail_id=@Invoice_detail_id
end
if(@NB='InsertInvoiceDatetail')
begin
INSERT INTO Invoice_detail
(Invoice_id, Goods_id, Shipments_quantity, Repertory_place_send_id, Repertory_place_harvest_id, Review_deny)
VALUES (@Invoice_id,@Goods_id,@Shipments_quantity,@Repertory_place_send_id,@Repertory_place_harvest_id,'false')
end
if(@NB='UpdateInvoiceDatetail')
begin
UPDATE Invoice_detail
SET Shipments_quantity =@Shipments_quantity,
Repertory_place_send_id =@Repertory_place_send_id,
Repertory_place_harvest_id =@Repertory_place_harvest_id
where Invoice_detail_id=@Invoice_detail_id
end
end
--根据商品id和库存地点id查询库存表中的库存数
if(@NB='SelectStock_quantityBygooodsIdAndRepertoryPlaceId')
begin
SELECT Stock.Stock_quantity, Stock.Stock_id, Goods.Goods_name
FROM Stock INNER JOIN
Goods ON Stock.Goods_id = Goods.Goods_id
WHERE (Stock.Repertory_place_id = @Repertory_place_id) AND (Stock.Goods_id = @Goods_id)
end
--删除配货单明细
if(@NB='DeleteInvoiceDetail')
begin
DELETE FROM Invoice_detail
where Invoice_id=@Invoice_id
end
--删除配货单
if(@NB='DeleteInvoice')
begin
DELETE FROM Invoice
where Invoice_id=@Invoice_id
end
--审核查询所有的配货明细
if(@NB='ShenHePeiHuoDanSelectAllDeliveryGoodsDetail')
begin
SELECT Invoice_detail_id, Shipments_quantity, Goods_id, Repertory_place_send_id
FROM Invoice_detail
where Invoice_id=@Invoice_id
end
--修改库存数
if(@NB='updateStockQuantity')
begin
UPDATE Stock
SET Stock_quantity =Stock_quantity-@Stock_quantity
where Stock.Stock_id=@Stock_id
end
if(@NB='Update_InvoiceOfReview_deny')
begin
UPDATE Invoice
SET Review_deny ='true'
where Invoice_id=@Invoice_id
end
--查询商品配货配次(根据配货id查询配货明细)
if(@NB='SelectInvoiceDetailByInvoiceId')
begin
SELECT Invoice_detail.Invoice_detail_id, Invoice_detail.Invoice_id, Invoice_detail.Goods_id, Invoice_detail.Shipments_quantity, Invoice_detail.Repertory_place_send_id,
Invoice_detail.Repertory_place_harvest_id, Invoice_detail.Review_deny, Repertory_place.Repertory_place_name AS Repertory_place_send_Name,
Repertory_place_1.Repertory_place_name AS Repertory_place_harvest_Name, Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Retail_unit_price, Goods.Art_No,
Goods.Format_model, Attribute_gather_detail.Attribute_gather_detail_name AS JiLiangDanWei, Goods.Vender_bar_code_deny, Goods.Goods_abbreviation, Goods.Plncode_PLN,
Goods.Copy_record_deny, Agreement.Contract_number, Manufacturer.Manufacturer_name AS ShengChanChangJiaMC, Attribute_gather_detail_1.Attribute_gather_detail_name AS ShiYongDuiXiang,
Goods.Goods_colours, Attribute_gather_detail_2.Attribute_gather_detail_name AS ShangPinFenLei, Attribute_gather_detail_3.Attribute_gather_detail_name AS BaoZhiQi, Goods.Input_ratio,
Goods.Output_ratio, Goods.Count_scale, Goods.Quality_content, 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, Eemployee.Employee_name AS DengJiRen, Eemployee_1.Employee_name AS ShenHeRen, CONVERT(varchar(20),
Goods.Register_time, 120) AS Register_time, CONVERT(varchar(20), Goods.Review_time, 120) AS Review_time, Eemployee_2.Employee_name AS GengXinRen, CONVERT(varchar(20),
Goods.Update_Time, 120) AS Update_Time, Goods.Purchase_bid, Goods.Self_fix_goods_deny, Goods.Mini_fix_goods_deny, Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5))
/ 100 + 1) AS Tax_inclusive_price, Invoice_detail.Shipments_quantity / Goods.Quality_content AS Repertory_enter_packages, Invoice.Delivery_department_id,
Department.Department_name AS Consignment_department, Department.Department_code AS Consignment_department_coad
FROM Invoice_detail INNER JOIN
Repertory_place ON Invoice_detail.Repertory_place_send_id = Repertory_place.Repertory_place_id INNER JOIN
Repertory_place AS Repertory_place_1 ON Invoice_detail.Repertory_place_harvest_id = Repertory_place_1.Repertory_place_id INNER JOIN
Goods ON Invoice_detail.Goods_id = Goods.Goods_id INNER JOIN
Attribute_gather_detail ON Goods.Unit_of_measurement_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN
Manufacturer ON Goods.Manufacturer_id = Manufacturer.Manufacturer_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_1 ON Goods.Use_target_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.Quality_guarantee_period_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 ON Goods.Registrant_id = Eemployee.Employee_id INNER JOIN
Eemployee AS Eemployee_1 ON Goods.Auditor_id = Eemployee_1.Employee_id INNER JOIN
Eemployee AS Eemployee_2 ON Goods.Update_person_id = Eemployee_2.Employee_id INNER JOIN
Invoice ON Invoice_detail.Invoice_id = Invoice.Invoice_id INNER JOIN
Department ON Invoice.Delivery_department_id = Department.Department_id
where Invoice_detail.Invoice_id=@Invoice_id
end
if(@NB='GetDayMaxQuantityOfPi')
begin
begin tran
UPDATE Day_max_quantity
SET Day_max_count = Day_max_count+1
where Odd_numbers_id=3 and Goods_id=@Goods_id
SELECT Day_max_count
FROM Day_max_quantity
where Odd_numbers_id=3 and Goods_id=@Goods_id
commit tran
end
--新增日最大单数
if(@NB='InsertDayMaxCount')
begin
INSERT INTO Day_max_quantity
( Day_max_count, Odd_numbers_id, Goods_id)
VALUES (0,3,@Goods_id)
end
--新增批次
if(@NB='addPatch')
begin
INSERT INTO Patch
(PatchNumber, Detail_pubid, Delivery_quantity)
VALUES (@PatchNumber,@Detail_pubid,@Delivery_quantity)
end
--查询批次中的批次信息(绑定到批次中)
if(@NB='SelectPacthInformation')
begin
SELECT Patch.Patch_id, Patch.PatchNumber as Patch, Patch.Delivery_quantity as Shipments_quantity, Goods.Purchase_bid as NoTax_inclusive_price, Goods.Input_ratio, sum(Stock.Stock_quantity) as JieCunShu,
(CONVERT(decimal(18,3),Input_ratio)/100+1)*Purchase_bid as Tax_inclusive_price
FROM Patch INNER JOIN
Invoice_detail ON Patch.Detail_pubid = Invoice_detail.Invoice_detail_id INNER JOIN
Goods ON Invoice_detail.Goods_id = Goods.Goods_id INNER JOIN
Stock ON Goods.Goods_id = Stock.Goods_id AND Invoice_detail.Repertory_place_send_id = Stock.Repertory_place_id
where Detail_pubid=@Invoice_detail_id
group by Patch.Patch_id, Patch.PatchNumber , Patch.Delivery_quantity , Goods.Purchase_bid , Goods.Input_ratio,
Input_ratio
end
--修改保存确认批次
if(@NB='QueRenPacth')
begin
UPDATE Patch
SET Delivery_quantity =@Delivery_quantity
where Patch_id=@Patch_id
end
--查询进仓单(有定单)
if(@NB='SelectYiShenHeJinCangDan'and @strBlur ='')
begin
SELECT Repertory_enter.Repertory_enter_id, Goods_indent.Indent_number, Department.Department_name, Repertory_place.Repertory_place_name, Repertory_enter.Record_number,
Repertory_enter.Original_number, Eemployee_1.Employee_name AS Receiver, Repertory_enter.Receiver_id, CONVERT(varchar(20), Repertory_enter.Register_time, 120) AS Register_time,
Repertory_enter.Review_deny, Repertory_enter.Auditor_id, Repertory_enter.Review_time, Eemployee_2.Employee_name,
Attribute_gather_detail.Attribute_gather_detail_name AS Indent_type_name, Agreement.Contract_number, Attribute_gather_detail_1.Attribute_gather_detail_name AS settlement,
Goods_indent.Review_time AS Expr1, Attribute_gather_detail_2.Attribute_gather_detail_name AS Auditor, Department.Department_code, Enterprise_name.Chinese,
Eemployee.Employee_name AS Buyer, Goods_indent.Department_id, Goods_indent.Indent_id, Eemployee_1.Employee_number AS Receiver_name, Repertory_place.Repertory_place_identifier,
Repertory_enter.Affix_count, Repertory_enter.Registrant_id, Eemployee_3.Employee_name AS Registrant, Repertory_enter.Register_time AS Expr2, Repertory_place.Repertory_place_id,
Goods_indent.Agreement_id, Repertory_enter.Hava_indent_deny, Repertory_enter.ChongHongFou, Repertory_enter.YouXiaoFou
FROM Repertory_place INNER JOIN
Repertory_enter INNER JOIN
Goods_indent ON Repertory_enter.Indent_id = Goods_indent.Indent_id INNER JOIN
Department ON Goods_indent.Department_id = Department.Department_id ON Repertory_place.Repertory_place_id = Repertory_enter.Repertory_place_id INNER JOIN
Eemployee AS Eemployee_1 ON Repertory_enter.Receiver_id = Eemployee_1.Employee_id INNER JOIN
Eemployee AS Eemployee_2 ON Repertory_enter.Auditor_id = Eemployee_2.Employee_id INNER JOIN
Attribute_gather_detail ON Goods_indent.Indent_type_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_1 ON Goods_indent.Settle_accounts_way_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
Agreement ON Goods_indent.Agreement_id = Agreement.Agreement_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods_indent.Auditor_id = Attribute_gather_detail_2.Attribute_gather_detail_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
Eemployee ON Agreement.Purchasing_agent_id = Eemployee.Employee_id INNER JOIN
Eemployee AS Eemployee_3 ON Repertory_enter.Registrant_id = Eemployee_3.Employee_id
where Repertory_enter.Review_deny='True'and Repertory_enter.ChongHongFou='false'and Repertory_enter.YouXiaoFou='true'
end
--模糊查询已审核自营进仓单(有订单)
else
if(@NB='SelectYiShenHeJinCangDan' and @strBlur <> '')
begin
SELECT Repertory_enter.Repertory_enter_id, Goods_indent.Indent_number, Department.Department_name, Repertory_place.Repertory_place_name, Repertory_enter.Record_number,
Repertory_enter.Original_number, Eemployee_1.Employee_name AS Receiver, Repertory_enter.Receiver_id, CONVERT(varchar(20), Repertory_enter.Register_time, 120) AS Register_time,
Repertory_enter.Review_deny, Repertory_enter.Auditor_id, Repertory_enter.Review_time, Eemployee_2.Employee_name,
Attribute_gather_detail.Attribute_gather_detail_name AS Indent_type_name, Agreement.Contract_number, Attribute_gather_detail_1.Attribute_gather_detail_name AS settlement,
Goods_indent.Review_time AS Expr1, Attribute_gather_detail_2.Attribute_gather_detail_name AS Auditor, Department.Department_code, Enterprise_name.Chinese,
Eemployee.Employee_name AS Buyer, Goods_indent.Department_id, Goods_indent.Indent_id, Eemployee_1.Employee_number AS Receiver_name, Repertory_place.Repertory_place_identifier,
Repertory_enter.Affix_count, Repertory_enter.Registrant_id, Eemployee_3.Employee_name AS Registrant, Repertory_enter.Register_time AS Expr2, Repertory_place.Repertory_place_id
FROM Repertory_place INNER JOIN
Repertory_enter INNER JOIN
Goods_indent ON Repertory_enter.Indent_id = Goods_indent.Indent_id INNER JOIN
Department ON Goods_indent.Department_id = Department.Department_id ON Repertory_place.Repertory_place_id = Repertory_enter.Repertory_place_id INNER JOIN
Eemployee AS Eemployee_1 ON Repertory_enter.Receiver_id = Eemployee_1.Employee_id INNER JOIN
Eemployee AS Eemployee_2 ON Repertory_enter.Auditor_id = Eemployee_2.Employee_id INNER JOIN
Attribute_gather_detail ON Goods_indent.Indent_type_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_1 ON Goods_indent.Settle_accounts_way_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
Agreement ON Goods_indent.Agreement_id = Agreement.Agreement_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods_indent.Auditor_id = Attribute_gather_detail_2.Attribute_gather_detail_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
Eemployee ON Agreement.Purchasing_agent_id = Eemployee.Employee_id INNER JOIN
Eemployee AS Eemployee_3 ON Repertory_enter.Registrant_id = Eemployee_3.Employee_id
where Repertory_enter.Record_number like '%'+RTRIM(@strBlur)+'%'and Repertory_enter.Review_deny='true'
end
--查询进仓单(无定单)
if(@NB='SelectYiShenHeWDJinCangDan'and @strBlur ='')
begin
SELECT Repertory_enter.Repertory_enter_id, Repertory_enter.Hava_indent_deny, Repertory_enter.Record_number, Repertory_enter.Agreement_id, Repertory_enter.Repertory_place_id,
Agreement.Contract_number, Department.Department_name, Repertory_enter.Review_deny, Department.Department_code, Department.Department_id, Repertory_place.Repertory_place_name,
Attribute_gather_detail.Attribute_gather_detail_name AS settlement, Repertory_enter.Affix_count, Repertory_enter.Original_number, Eemployee.Employee_name AS maijia,
Repertory_enter.Receiver_id, Eemployee_1.Employee_number AS Receivecoad, Eemployee_1.Employee_name AS ReceiverName, Enterprise_name.Chinese,
Repertory_place.Repertory_place_identifier, Repertory_enter.Registrant_id, CONVERT(varchar(20), Repertory_enter.Register_time, 120) AS Register_time,
Eemployee_2.Employee_number AS dengjirencoad, Eemployee_2.Employee_name AS dengjiren, Repertory_enter.Auditor_id, CONVERT(varchar(20), Repertory_enter.Review_time, 120)
AS Review_time, Eemployee_3.Employee_name AS Auditor, Attribute_gather_detail_1.Attribute_gather_detail_name AS jiesuanfangshi, Repertory_enter.YouXiaoFou,
Repertory_enter.ChongHongFou
FROM Repertory_enter INNER JOIN
Agreement ON Repertory_enter.Agreement_id = Agreement.Agreement_id INNER JOIN
Department ON Agreement.Purchase_unit_id = Department.Department_id INNER JOIN
Repertory_place ON Repertory_enter.Repertory_place_id = Repertory_place.Repertory_place_id INNER JOIN
Attribute_gather_detail ON Agreement.Settlement_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
Eemployee ON Agreement.Purchasing_agent_id = Eemployee.Employee_id INNER JOIN
Eemployee AS Eemployee_1 ON Repertory_enter.Receiver_id = Eemployee_1.Employee_id INNER JOIN
Supply_units ON Agreement.Supply_units_id = Supply_units.Supply_units_id INNER JOIN
Enterprise_name ON Supply_units.Enterprise_name_id = Enterprise_name.Enterprise_name_id INNER JOIN
Eemployee AS Eemployee_2 ON Repertory_enter.Registrant_id = Eemployee_2.Employee_id INNER JOIN
Eemployee AS Eemployee_3 ON Repertory_enter.Auditor_id = Eemployee_3.Employee_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_1 ON Agreement.Settlement_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id
where Repertory_enter.Review_deny='True'and Repertory_enter.Hava_indent_deny='false' and Repertory_enter.ChongHongFou='false'and Repertory_enter.YouXiaoFou='true'
end
else
--模糊查询已审核无订单进仓单
if(@NB='SelectYiShenHeWDJinCangDan'and @strBlur <> '')
begin
SELECT Repertory_enter.Repertory_enter_id, Repertory_enter.Hava_indent_deny, Repertory_enter.Record_number, Repertory_enter.Agreement_id, Repertory_enter.Repertory_place_id,
Agreement.Contract_number, Department.Department_name, Repertory_enter.Review_deny, Department.Department_code, Department.Department_id, Repertory_place.Repertory_place_name,
Attribute_gather_detail.Attribute_gather_detail_name AS settlement, Repertory_enter.Affix_count, Repertory_enter.Original_number, Eemployee.Employee_name AS maijia,
Repertory_enter.Receiver_id, Eemployee_1.Employee_number AS Receivecoad, Eemployee_1.Employee_name AS ReceiverName, Enterprise_name.Chinese,
Repertory_place.Repertory_place_identifier, Repertory_enter.Registrant_id, CONVERT(varchar(20), Repertory_enter.Register_time, 120) AS Register_time,
Eemployee_2.Employee_number AS dengjirencoad, Eemployee_2.Employee_name AS dengjiren, Repertory_enter.Auditor_id, CONVERT(varchar(20), Repertory_enter.Review_time, 120)
AS Review_time, Eemployee_3.Employee_name AS Auditor, Attribute_gather_detail_1.Attribute_gather_detail_name AS jiesuanfangshi
FROM Repertory_enter INNER JOIN
Agreement ON Repertory_enter.Agreement_id = Agreement.Agreement_id INNER JOIN
Department ON Agreement.Purchase_unit_id = Department.Department_id INNER JOIN
Repertory_place ON Repertory_enter.Repertory_place_id = Repertory_place.Repertory_place_id INNER JOIN
Attribute_gather_detail ON Agreement.Settlement_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
Eemployee ON Agreement.Purchasing_agent_id = Eemployee.Employee_id INNER JOIN
Eemployee AS Eemployee_1 ON Repertory_enter.Receiver_id = Eemployee_1.Employee_id INNER JOIN
Supply_units ON Agreement.Supply_units_id = Supply_units.Supply_units_id INNER JOIN
Enterprise_name ON Supply_units.Enterprise_name_id = Enterprise_name.Enterprise_name_id INNER JOIN
Eemployee AS Eemployee_2 ON Repertory_enter.Registrant_id = Eemployee_2.Employee_id INNER JOIN
Eemployee AS Eemployee_3 ON Repertory_enter.Auditor_id = Eemployee_3.Employee_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_1 ON Agreement.Settlement_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id
where Repertory_enter.Review_deny='True'and Repertory_enter.Hava_indent_deny='false'
and Repertory_enter.Record_number like '%'+RTRIM(@strBlur)+'%'
end
END<span style="font-size:18px;">
</span>