大型商贸系统(进货管理)技术解析(四)自营无订单进仓单
功能介绍:
自营无订单进仓单为进货店的客户进行开单,是根据合同来进仓。对于自营无订单进仓单,该系统提供了2种方式:(1)实现一次性全部将需求的商品信息进行进货。实现一次进货需要选择相应的合同,录入到相应的进仓单,根据需要进行修改后经过审核来实现一次性进货。(2)实现分批进货。在选择相应合同后,新增相应的进仓单,根据需要进行相应修改,然后审核,在审核中可以改变每种商品的入库件数来进行分批入库,在改变件数时入库件数与还缺入库数的比较,待分批进货到还缺入库数为”0“时,才把无订单进仓单的审核否改为”true“,从而实现了商品的分批进货。
界面效果图:
图1.1
此界面所用到的控件有:
控件名称 | 说明
|
下拉框(easyui-combobox) | 设置该控件的ID,设置其大小,若不设置也用默认值,可以在data-options进行数据操作:设置该控件的一些属性和事件。 |
日期时间控件 (easyui-datetimebox) | 日期时间输入框允许用户选择日期和指定的时间并按照指定的输出格式显示。相比日期输入框,它在下拉面板中添加了一个时间微调器。可以在data-options进行数据操作:设置该控件的一些属性和事件 |
文本框(text) | 在Input中可以设置其一些属性和事件 |
功能实现:
1. 自营无订单进仓单所涉及到数据库中表与表之间的关系图
表1:进仓单表(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 |
| 有效否 |
表2:进仓明细表(Repertory_enter_detail)
用于记录进仓明细单信息
列名 | 数据类型 | 主键/外键 | 说明 |
Repertory_enter_detail_id | int | 主键 | 进仓明细id |
Repertory_enter_detail_Farid | int | 外键 | 进仓明细farid |
Repertory_enter_id | int | 外键 | 进仓id |
Goods_id | int | 外键 | 商品id |
Repertory_enter_packages | decimal(18,0) |
| 入库件数 |
Repertory_enter_quantity | decimal(18,0) |
| 入库细数 |
Giveaway_quantity | decimal(18,0) |
| 物扣数量 |
Review_deny | bit |
| 审核否 |
Auditor_id | int | 外键 | 审核人id |
Review_time | datetime |
| 审核时间 |
ChongHong_deny | Bit |
| 冲红否 |
表4:仓库地点表(Repertory_place)
用于记录仓库地点信息
列名 | 数据类型 | 主键/外键 | 说明 |
Repertory_place_id | int | 主键 | 仓库地点id |
Responsible_person_id | int | 外键 | 负责人id |
Department_id | int | 主键 | 部门id |
Repertory_place_name | nchar(10) |
| 仓库地点名称 |
Contact_way | nchar(10) |
| 联系方式 |
Address | nchar(10) |
| 地址 |
Effective_deny | nchar(10) |
| 有效否 |
Remarks | nchar(10) |
| 备注 |
Repertory_place_identifier | nchar(10) |
| 仓库地点编号 |
表5:员工表(Eemployee)
用于记录员工信息
列名 | 数据类型 | 主键/外键 | 说明 |
Employee_id | int | 主键 | 员工id |
Employee_number | nchar(12) |
| 员工编号 |
Employee_name | nchar(10) |
| 员工名称 |
Department_id | int | 外键 | 部门id |
Duties_id | int | 外键 | 职务id |
Sex | int | 外键 | 性别pubid |
表6:部门表(Department)
用于记录部门信息
列名 | 数据类型 | 主键/外键 | 说明 |
Department_id | int | 主键 | 部门id |
Department_Farid | int | 外键 | 部门父id |
Department_code | nchar(10) |
| 部门编号 |
Department_name | nchar(10) |
| 部门名称 |
表7:合同表(Agreement)
列名 | 数据类型 | 主键/外键 | 说明 |
Agreement_id | int | 主键 | 合同id |
Supply_units_id | int | 外键 | 供应单位id |
Purchase_unit_id | int | 外键 | 采购部门id |
Manage_place_id | int | 外键 | 经营地点id |
Adjust_accounts_way_pubid | int | 外键 | 核算方式Pub_id |
Settlement_pubid | int | 外键 | 结算方式Pub_id |
Status_pubid | int | 外键 | 状态Pub_id |
Details_content_id | int | 外键 | 详细内容id |
Common_settlement_id | int | 外键 | 一般结算扣款id |
Special_settlement_id | int | 外键 | 特殊结算扣款id |
Purchasing_agent_id | int | 外键 | 采购员id |
Common_settlement_deny | Bit |
| 一般结算扣款否 |
Agreement_begin_time | Datetime |
| 合同开始时间 |
Agreement_end_time | Datetime |
| 合同结束时间 |
Agreement_code | nchar(10) |
| 合同代码 |
Handwork_agreement_howl | nchar(10) |
| 手工合同 |
Agreement_member | nchar(10) |
| 合同员 |
Conclude_and_sign_time | Datetime |
| 签订时间 |
Conclude_and_sign_place | nchar(10) |
| 签订地点 |
Settlement_pay_fatalism | nchar(10) |
| 账期付款天数 |
Trial_sale_fatalism | nchar(10) |
| 试销期天数 |
Repertory_entry_date | Date |
| 进仓日期 |
Repertory_Remove_date | date |
| 退仓日期 |
Ticket_issue_fatalism | nchar(10) |
| 票期天数 |
Settlement_issue_fatalism | nchar(10) |
| 账期天数 |
Manager_id | int | 外键 | 经理id |
Senior_Manager_id | int | 外键 | 高级经理id |
General_manager_id | int | 外键 | 总经理id |
Registrant_id | int | 外键 | 登记人_id |
Register_time | datetime |
| 登记时间 |
Auditor_id | int | 外键 | 审核人id |
Review_time | datetime |
| 审核时间 |
Cancel_person_id | int | 外键 | 注销人 |
Cancel_time | datetime |
| 注销时间 |
Credit_card_procedures_share_ratio | nchar(10) |
| 信用卡手续分摊比例 |
Take_effect_tab_deny | Bit |
| 生效标记否 |
Contract_number | nchar(10) |
| 合同号 |
表8:企业名称表(Enterprise_name)
列名 | 数据类型 | 主键/外键 | 说明 |
Enterprise_name_id | int | 主键 | 企业名称id |
Chinese | nchar(50) |
| 中文 |
English | nchar(50) |
| 英文 |
Abbreviation | nchar(10) |
| 简称 |
功能实现:
1.1 自营无订单进仓单界面效果图
图1.1
1.2 自营无订单进仓单实现的界面代码
<div><pre name="code" class="csharp"><!DOCTYPE html>
<html>
<head>
<meta content="text/javascript;charset=utf-8" />
<title>无订单进货处理</title>
<link href="../../Content/jquery-easyui-1.3.3/themes/icon.css" rel="stylesheet" />
<link href="../../Content/jquery-easyui-1.3.3/demo/demo.css" rel="stylesheet" />
<link href="../../Content/jquery-easyui-1.3.3/themes/default/easyui.css" rel="stylesheet" />
<link href="../../Content/MyCSS/PublicCSS.css" rel="stylesheet" />
<script src="../../Content/jquery-easyui-1.3.3/jquery.min.js"></script>
<script src="../../Content/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
<script src="../../Content/jquery-easyui-1.3.3/easyloader.js"></script>
<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: 28px; font-size: 20px; margin: 1px 3px 1px 3px; }
div > button { margin: 15px 4px auto 15px; }
#weibu tr td { height: 30px; }
.myimg:hover { margin-top: 3px; margin-left: 3px; }
</style>
</head>
<body style="text-align: center">
<div style="display: none">
<div class="easyui-window" title="" id="wWDingDanJinHuoChuLi" 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;">
@*<span style="float: right">
<img οnclick="parent.jinCang();" id="dimg" src="../../Content/image/delete.png" /></span>*@无订单进货处理
</div>
<table id="tbWDingDanJinHuoChuLi" style="width: 780px; height: 20px; padding: 0; border: none;">
<tr>
<td style="vertical-align: middle">
<input type="button" value="记录编号:" οnclick="OpenZiYingJinCangDanChaZhao()" style="width: 100px;" /><input type="text" οnclick=" SelectWuDingDanJinCangRecord_number()" id="txtWuDingDanJiLuBianMa" style="width: 120px; color: red; margin-left: 5px;" /></td>
<td style="vertical-align: middle">
<input type="button" value="进货部门:" style="width: 100px;" /><input type="text" id="bumendaima" style="width: 40px; text-align: center; margin-left: 5px" /></td>
<td style="vertical-align: middle">
<div style="border-bottom: #000 1px solid; width: 180px;">
<input id="txtBuMenMC" readonly="readonly" style="width: 240px; margin-left: 5px; border: none; color: #0000FF; font-size: 15px;" />
</div>
</td>
</tr>
</table>
<table style="width: 780px; height: 150px; padding: 0; border: none;">
<tr>
<td style="width: 180px; text-align: center; font-size: 15px;">合同号:</td>
<td>
<div style="border-bottom: #000 1px solid; width: 100px;">
<input id="AgreementCode" readonly="readonly" style="width: 100px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
<td style="text-align: center; font-size: 15px;">库存地点:</td>
<td>
<input class="easyui-combobox" id="RepertoryPlaceIdentifier" data-options="onSelect:getRepertory_place_name,panelHeight:100" style="width: 145px; text-align: center" /></td>
<td>
<div style="border-bottom: #000 1px solid; width: 180px;">
<input readonly="readonly" id="kucunMC" style="width: 180px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
</tr>
<tr>
<td style="width: 110px; text-align: center; font-size: 15px;">结算方式:</td>
<td>
<div style="border-bottom: #000 1px solid; width: 100px;">
<input readonly="readonly" id="jiesuanfangshi" style="width: 100px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
<td style="text-align: right; font-size: 15px;">附件<input type="text" id="txtFuJianZhangShu" style="width: 40px" />张数</td>
<td style="text-align: right; font-size: 15px;" colspan="2">同<input type="text" id="txtTongJinCang" style="width: 80px;" />进仓单</td>
</tr>
<tr>
<td style="width: 110px; text-align: center; font-size: 15px;">买手:</td>
<td>
<div style="border-bottom: #000 1px solid; width: 80px;">
<input readonly="readonly" id="maijia" style="width: 80px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
<td style="text-align: center; font-size: 15px;">收货人:</td>
<td>
<input class="easyui-combobox" id="shouhuorenbianhao" data-options="onSelect:getReceiver_nam,panelHeight:100" style="width: 145px; text-align: center" /></td>
<td>
<div style="border-bottom: #000 1px solid; width: 180px;">
<input readonly="readonly" id="ReceiverName" style="width: 180px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
</tr>
<tr>
<td style="width: 120px; text-align: center; font-size: 15px;">往来单位:</td>
<td style="width: 160px;" colspan="2">
<div style="border-bottom: #000 1px solid; width: 300px;">
<input readonly="readonly" id="SupplyUnits" style="width: 300px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
<td style="vertical-align: middle">
<input type="button" value="批量选商品" οnclick="OpenPiLiangXuanShangPin()" style="width: 100px; text-align: right; font-size: 17px;" />
</td>
<td>
<button οnclick="openSelectWDJinCang()">
<img src="../../Content/image/2012092109942.png" />查询</button>
</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,onClickRow:onClickRowMingXi,@*onAfterEdit:onAfterEdit,*@
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:'Repertory_enter_detail_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:'Quality_content',width:80,align:'center'">包装含量</th>
<th data-options="field:'NumberOfUnits',editor:'numberbox',width:80,align:'center'">入库件数</th>
<th data-options="field:'Shipments_quantity',width:80,editor:'numberbox',align:'center'">入库细数</th>
<th data-options="field:'WuGouShuLiang',editor:'numberbox',width:80,align:'center'">物扣数量</th>
<th data-options="field:'ZongYaoRuKuShu',width:80,align:'center'">总要入库数</th>
<th data-options="field:'YiRuKuShu',width:80,align:'center'">已入库数</th>
<th data-options="field:'HaiYaoRuKuShu',width:80,align:'center',styler:cellStyler">还缺入库数</th>
<th data-options="field:'Tax_inclusive_price',width:80,align:'center'">含税进价</th>
<th data-options="field:'Input_ratio',width:80,align:'center'">进项税率</th>
<th data-options="field:'Purchase_bid',width:80,align:'center'">采购进价</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:'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:'Goods_name',width:80,align:'center'">商品标记</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:'Manufacturer_name',width:80,align:'center'">生产厂家</th>
<th data-options="field:'Producing_area_name',width:80,align:'center'">产地</th>
<th data-options="field:'JiLiangDanWei',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:'Goods_rademark_name',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:'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:'Permit_decimal_deny',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:'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 id="weibu" style="width: 715px; height: 35px">
<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="dengjiren" data-options="url:'/ShangPinJinChuangDan/SelectEmployee',valueField:'ID',textField:'MC'" style="width: 180px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
<td style="font-size: 15px">登记时间</td>
<td style="width: 250px">
<div style="border-bottom: #000 1px solid; width: 180px;">
<input class="easyui-datetimebox" data-options="formatter:myformatter" id="datdengjishijian" 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="Auditor" data-options="url:'/ShangPinJinChuangDan/SelectEmployee',valueField:'ID',textField:'MC'" 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="datshenheshijian" style="width: 180px; border: none; color: #0000FF; font-size: 17px;" />
</div>
</td>
</tr>
</table>
<table style="width: 790px;">
<tr>
<td>
<div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
<button οnclick="OpenwHeTongAllXinXi(); " id="TianJia">
<img src="../../Content/image/add.png" />添加</button>
</div>
</td>
<td>
<div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
<button οnclick="UpdateWDJinCang();">
<img src="../../Content/image/table_edit.png" />修改</button>
</div>
</td>
<td>
<div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
<button οnclick="DeleteWDJinCangDan();" id="ShanChu">
<img src="../../Content/image/delete.png" />删除</button>
</div>
</td>
<td>
<div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
<button id="BaoCun" οnclick="BaoCunWuDingDanJinCangDan();">
<img src="../../Content/image/disk.png" />保存</button>
</div>
</td>
<td>
<div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
<button οnclick="qingKong();" id="FanQi">
<img src="../../Content/image/01.png" />放弃</button>
</div>
</td>
<td>
<div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
<button οnclick="ShenHe();" id="ShenHe">
<img src="../../Content/image/ok.gif" />审核</button>
</div>
</td>
<td>
<div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
<button id="DaYin">
<img src="../../Content/image/2012081511202.png" />打印</button>
</div>
</td>
<td>
<div style="width: 85px; height: 25px; text-align: center; vertical-align: middle">
<button id="TuiChu" οnclick=" parent.jinCang()">
<img src="../../Content/image/2012080412301.png" />退出</button>
</div>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
2.1 实现一打开“无订单进仓单处理”界面,便会自动获取到无订单进仓单的记录编号功能
效果图:
图2.1
实现该功能的界面代码:
实现该功能的JavaScript代码:
$(document).ready(function (){
$('#wWDingDanJinHuoChuLi').show(700);
$('#DaYin').attr("disabled", true);
SelectWuDingDanJinCangRecord_number();//调用方法
$("#bumendaima").attr("disabled", true);
});
//对无订单进仓单记录编号的操作
functionSelectWuDingDanJinCangRecord_number() {
$.getJSON("/ZiYingWuDingDanJinCang/SelectWuDingDanJinCangRecord_number", function(value) {
$("#txtWuDingDanJiLuBianMa").val(value);
});
}
实现该功能的控制器代码:
#region 生成配货单据
public ActionResult SelectWuDingDanJinCangRecord_number()
{
DataTable dt = _myWuDingDanJinCang.GetOddNumbers(7);//声明对像dt接收方法GetOddNumbers中数据
DataTable dt2 = _myWuDingDanJinCang.GetDayMaxQuantity(16);//声明对像dt2接收方法GetDayMaxQuantity中数据
string patchNumber = dt.Rows[0]["Prefixs"].ToString().Trim();//获取Prefixs所对应单元格中的值
string patchCount = dt2.Rows[0][0].ToString();//获取最大数
//最大数i与获取Suffix_number所对应列 单元格数据比较
for (int i = patchCount.Length; i < Convert.ToInt32(dt.Rows[0]["Suffix_number"].ToString().Trim()); i++)
{
patchCount = "0" + patchCount;
}
string recordNumber = patchNumber + patchCount;//对记录编号的拼接
return Json(recordNumber, JsonRequestBehavior.AllowGet);
}
#endregion
实现该功能的逻辑层代码:
#region 获取记录编号前缀
public 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 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
实现该功能的存储过程代码:
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)
点击<img src="https://img-blog.csdn.net/20150626142006125?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd3lpbmc4OA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />按钮出现界面的效果图</span><p></p><div style="text-align: center;"><img src="https://img-blog.csdn.net/20150626142102722?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd3lpbmc4OA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="font-size:18px;" alt="" /></div><span style="font-size:18px;"></span><p></p><p><span style="font-size:18px;"></span></p><p style="text-align: center;"> 图3.1</p><div style="text-align: center;"></div><div style="text-align: left;"><span style="font-size:18px;"><strong></strong></span><p>代码实现:</p><p><img src="https://img-blog.csdn.net/20150626142410305?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd3lpbmc4OA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" /></p><p><span style="font-size:18px;"><strong></strong></span></p><p><strong>在</strong><span style="color:blue;"><</span><span style="color:maroon;">body</span> <span style="color:red;">style</span><span style="color:blue;">="</span><span style="color:red;">text-align</span>: <span style="color:blue;">center"></</span><span style="color:maroon;">body</span><span style="color:blue;">></span>里写代码:</p><pre name="code" class="csharp"><div class="easyui-window" id="wHeTongAllXinXi" title="选择自营合同" style="width: 700px; height: 300px;" data-options="resizable:false,minimizable:false,closable:false,
collapsible:false,maximizable:false,closed:true,">
<table style="width: 686px; height: 28px; padding: 0; border-spacing: 0">
<tr>
<td style="vertical-align: middle">请输入要查询合同号:
<input type="text" id="strBlur1" οnkeyup=" MohuiSelecHeTong()" style="width: 150px;" /></td>
<td>
<button οnclick=" $('#wHeTongAllXinXi').window('close')">
<img src="../../Content/image/2012080412301.png" />退出</button>
</td>
</tr>
</table>
<div class="easyui-panel" style="width: 686px; height: 231px;">
<table id="tbHeTongAllXinXi" class="easyui-datagrid" style="width: 686px; height: 236px;" data-options="rownumbers:true,
striped:true,pagination:true,idField:'Goods_id',singleSelect:true,fit:true,fitColumns:false,onClickRow: onClickHeTongDan">
<thead>
<tr>
<th data-options="field:'Agreement_id',width:80,hidden:true, align:'center'">合同ID
</th>
<th data-options="field:'Department_id',width:80,hidden:true, align:'center'">进货部门ID
</th>
<th data-options="field:'Employee_id',width:80,hidden:true, align:'center'">员工ID
</th>
<th data-options="field:'Contract_number',width:80,align:'center'">合同号</th>
<th data-options="field:'Chinese',width:120,align:'center'">往来单位</th>
<th data-options="field:'Department_name',width:80,align:'center'">进货部门</th>
<th data-options="field:'Department_code',width:80,align:'center'">部门代码</th>
<th data-options="field:'JieSuanFangShi',width:80,align:'center'">结算方式</th>
<th data-options="field:'CaiGouYuan',width:80,align:'center'">买手</th>
<th data-options="field:'ZhuangTai',width:80,align:'center'">状态</th>
<th data-options="field:'Sell_place',width:80,align:'center'">销售地点</th>
<th data-options="field:'Agreement_code',width:80,align:'center'">合同代码</th>
<th data-options="field:'Handwork_agreement_howl',width:80,align:'center'">手工合同号</th>
<th data-options="field:'Agreement_member',width:80,align:'center'">合同员</th>
</tr>
</thead>
</table>
</div>
</div>
在JavaScript里代码:
//查询合同所有信息
function OpenwHeTongAllXinXi() {
//对DGV 所要求的列隐藏
$("#tb进窗信息").datagrid('hideColumn', 'ZongYaoRuKuShu');
$("#tb进窗信息").datagrid('hideColumn', 'YiRuKuShu');
$("#tb进窗信息").datagrid('hideColumn', 'HaiYaoRuKuShu');
SelectWuDingDanJinCangRecord_number();//调用方法
//生成无订单进仓记录编号
$('#Auditor').combobox({ disabled: true });
$('#datshenheshijian').datetimebox({ disabled: true });
$('#wHeTongAllXinXi').window('open');//选择自营合同的窗口打开
$.getJSON("/ZiYingWuDingDanJinCang/SelectHeTongAllXinXi", function (data) {
$('#tbHeTongAllXinXi').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;
}
}
3.2正“选择合同”窗口处的查询
界面代码:
实现该功能在javaScript里代码:
//模糊查询自营合同信息
function MohuiSelecHeTong() {
$.getJSON("/ZiYingWuDingDanJinCang/MohuiSelecHeTong?strBlur=" + $("#strBlur1").val(),
function (data) {
$('#tbHeTongAllXinXi').datagrid('loadData', data);
});
}
实现该功能控制器中操作代码:
#region 模糊查询合同所有信息
public ActionResult MohuiSelecHeTong(string strBlur)
{
DataTable dt = _myWuDingDanJinCang.MoHiuSelectHeTongXinXiAll(strBlur);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
实现该功能逻辑层代码:
#region 模糊查询合同所有信息
public DataTable MoHiuSelectHeTongXinXiAll(string strBlur)
{
SqlParameter[] sqlcmDpas =
{
new SqlParameter("@NB",SqlDbType.Char),
new SqlParameter("@strBur",SqlDbType.Char),
};
sqlcmDpas[0].Value = "MoHiuSelectHeTongXinXiAll";
sqlcmDpas[1].Value = strBlur;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sqlcmDpas);
return dt;
}
#endregion
实现该功能存储过程:
<pre name="code" class="csharp">--模糊查询合同信息
if(@NB='MoHiuSelectHeTongXinXiAll')
begin
SELECT Agreement.Agreement_id, Department.Department_id, Agreement.Supply_units_id, Enterprise_name.Chinese, Department.Department_name, Department.Department_code,
Attribute_gather_detail.Attribute_gather_detail_name AS JieSuanFangShi, Eemployee.Employee_name AS CaiGouYuan, Attribute_gather_detail_1.Attribute_gather_detail_name AS ZhuangTai,
Manage_place.Sell_place, Agreement.Agreement_code, Agreement.Handwork_agreement_howl, Agreement.Agreement_member, Agreement.Contract_number
FROM Agreement INNER JOIN
Department ON Agreement.Purchase_unit_id = Department.Department_id INNER JOIN
Supply_units ON Agreement.Supply_units_id = Supply_units.Supply_units_id INNER JOIN
Enterprise_name ON Supply_units.Enterprise_name_id = Enterprise_name.Enterprise_name_id INNER JOIN
Attribute_gather_detail ON Agreement.Settlement_pubid = Attribute_gather_detail.Attribute_gather_detail_id INNER JOIN
Eemployee ON Agreement.Purchasing_agent_id = Eemployee.Employee_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_1 ON Agreement.Status_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
Manage_place ON Agreement.Manage_place_id = Manage_place.Manage_place_id
where Agreement.Contract_number like '%'+ rtrim(ltrim(@strBur)) +'%'
end
所得到的结果:
3.3 双击“选择合同“中DGV所在行数句绑定到”无订单进仓单“中,效果图:
图3.3
实现此功能的界面代码:
//双击无订单进仓单(绑定无订单进仓,明细)
var repertoryEnterid = 0;
var repertoryPlaceid = 0;
var agreementid = 0;
var receiverid = 0;
//方法
function onWDJinCangDan(rowIndex, rowData) {
$('#wSelectWDJCformations').window('close');//关闭该窗口
//把信息绑定到无订单对应的位置
$('#txtWuDingDanJiLuBianMa').val(rowData.Record_number);
$('#bumendaima').val(rowData.Department_code);
$('#txtBuMenMC').val(rowData.Department_name);
$('#AgreementCode').val(rowData.Contract_number);
$('#RepertoryPlaceIdentifier').combobox('setValue', rowData.Repertory_place_identifier);
$('#kucunMC').val(rowData.Repertory_place_name);
$('#jiesuanfangshi').val(rowData.jiesuanfangshi);
$('#txtFuJianZhangShu').val(rowData.Affix_count);
$('#txtTongJinCang').val(rowData.Original_number);
$('#maijia').val(rowData.maijia);
$('#shouhuorenbianhao').combobox('setValue', rowData.Receivecoad);
$('#ReceiverName').val(rowData.ReceiverName);
$('#SupplyUnits').val(rowData.Chinese);
$('#dengjiren').combobox('setValue', rowData.Registrant_id);
$('#datdengjishijian').datetimebox('setValue', rowData.Register_time);
repertoryPlaceid = rowData.Repertory_place_id;
repertoryEnterid = rowData.Repertory_enter_id;
receiverid = rowData.receiverId;
agreementid = rowData.Agreement_id;
BingDingWDJCMingXi(rowData.Repertory_enter_id);
}
4.1 库存地点是根据进货部门id绑定的,而收货人是有库存地点id绑定,进货部门名称并接的显示功能实现
4.2实现该功能的界面代码:
4.3 实现该功能的JavaScript里界面代码:
//单击合同单
//对全局变量的声明
var deparmentid = 0;
var agreementid1 = 0;
//方法
function onClickHeTongDan(rowIndex, rowData) {
$('#wHeTongAllXinXi').window('close');//双击后关闭“选择合同的窗口”
//对界面控件值得获取
$('#bumendaima').val(rowData.Department_code);
$('#BuMenMC').val(rowData.Department_name);
$('#AgreementCode').val(rowData.Contract_number);
$('#jiesuanfangshi').val(rowData.JieSuanFangShi);
$('#maijia').val(rowData.CaiGouYuan);
$('#SupplyUnits').val(rowData.Chinese);
//获取所需的id值
agreementid1 = rowData.Agreement_id;
deparmentid = rowData.Department_id;
//根据绑定中的部门id来绑定库存地点下拉框
$.getJSON("/ZiYingWuDingDanJinCang/SelectRepertoryPlaceBydeparmentid?deparmentid=" + deparmentid, function (data) {
$('#RepertoryPlaceIdentifier').combobox({
data: data, valueField: 'Repertory_place_id',//绑定下拉框的值与存储过程的一致
textField: 'Repertory_place_identifier'
});
});
//根据绑定中的部门id来绑定收货人(获取收货人编号)下拉框
$.getJSON("/ZiYingWuDingDanJinCang/SelectShouHuoRenBianHao?deparmentid=" + deparmentid, function (data) {
$('#shouhuorenbianhao').combobox({
data: data, valueField: 'Employee_id',
textField: 'Employee_number'
});
});
//获取部门父id根据绑定部门id
$.getJSON("/ZiYingWuDingDanJinCang/SelectDepartmentFarIdAndInformactions?deparmentid=" + deparmentid, function (data) { //根据获取的Id查询部门数据(id,farId,名称)
var str = []; //创建数组
checkFar_Id(data[0].Department_Farid, data[0].Department_name, data[0].Department_code, str); //执行另一个方法判断是否有父级,获取父的名称
});
}
function checkFar_Id(intDepartmentFarId, strDepartmentName, strDepartmentCode, str) {
if (intDepartmentFarId > 0) {
$.getJSON("/ZiYingWuDingDanJinCang/GetAllJinCangDepartmentByDepartmentFarId?intDepartmentFarId=" + intDepartmentFarId, function (data) { //当部门有父级的时候,以父级id作为部门id查询,并获取部门名称
str.unshift(data[0].Department_name); //将部门名称累加到数组上
if (data[0].Department_Farid >= 0) { //当查出来的部门还有父id>0的时候,重新调用本方法,直到父id=0;
checkFar_Id(data[0].Department_Farid, strDepartmentName, strDepartmentCode, str);
}
});
} else {
var str2 = ""; //声明另一个变量,
for (var i = 0; i < str.length; i++) {
str2 += str[i].trim() + "→"; //for循环获取部门名称并拼接一个"→"
}
$('#txtBuMenMC').val(str2 + strDepartmentName.trim() + "(" + strDepartmentCode.trim() + ")"); //str2(累加起来的部门)+点中的那个部门的,名称
}
}
//获取库存地点名称根据库存地点id
function getRepertory_place_name() {
//获取库存地点id
var repertoryPlaceid = $('#RepertoryPlaceIdentifier').combobox('getValue');
//根据库存地点id查询所对应得库存地点名称
$.getJSON("/ZiYingWuDingDanJinCang/SelectRepertoryPlaceNameByrepertoryPlaceid?repertoryPlaceid=" + repertoryPlaceid, function (data) {
$('#kucunMC').val(data[0].Repertory_place_name);
});
}
//获取收货人名称根据员工id
function getReceiver_nam() {
var employeeId = $('#shouhuorenbianhao').combobox('getValue');
$.getJSON("/ZiYingWuDingDanJinCang/SelectReceiver_namByemployeeId?employeeId=" + employeeId, function (data) {
$('#ReceiverName').val(data[0].Receiver);
});
}
4.4 实现该功能的控制器代码
#region 根据绑定中的部门id来绑定库存地点下拉框
public ActionResult SelectRepertoryPlaceBydeparmentid(int deparmentid)
{
DataTable dt = _myWuDingDanJinCang.SelectRepertoryPlaceBydeparmentid(deparmentid);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 根据绑定中的部门id来绑定收货人下拉框
public ActionResult SelectShouHuoRenBianHao(int deparmentid)
{
DataTable dt = _myWuDingDanJinCang.SelectShouHuoRenBianHao(deparmentid);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 获取部门父id及其信息根据绑定部门id
public ActionResult SelectDepartmentFarIdAndInformactions(int deparmentid)
{
DataTable dt = _myWuDingDanJinCang.SelectDepartmentFarIdAndInformactions(deparmentid);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 以父级id查询部门id,并获取部门名称
public ActionResult GetAllJinCangDepartmentByDepartmentFarId(int intDepartmentFarId)
{
DataTable dt = _myWuDingDanJinCang.GetAllJinCangDepartmentByDepartmentFarId(intDepartmentFarId);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 获取库存地点名称根据库存地点id
public ActionResult SelectRepertoryPlaceNameByrepertoryPlaceid(int repertoryPlaceid)
{
DataTable dt = _myWuDingDanJinCang.SelectRepertoryPlaceNameByrepertoryPlaceid(repertoryPlaceid);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
#region 获取收货人名称根据员工id
public ActionResult SelectReceiver_namByemployeeId(int employeeId)
{
DataTable dt = _myWuDingDanJinCang.SelectReceiver_namByemployeeId(employeeId);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
4.5 实现该功能逻辑层代码
#region 根据绑定中的部门id来绑定库存地点下拉框
public DataTable SelectRepertoryPlaceBydeparmentid(int departmentId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Department_id", SqlDbType.Int),
};
sql[0].Value = "SelectRepertoryPlaceBydeparmentid";
sql[1].Value = departmentId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
#region 根据绑定中的部门id来绑定收货人下拉框
public DataTable SelectShouHuoRenBianHao(int departmentId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Department_id", SqlDbType.Int),
};
sql[0].Value = "SelectShouHuoRenBianHao";
sql[1].Value = departmentId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
#region 获取部门父id及其信息根据绑定部门id
public DataTable SelectDepartmentFarIdAndInformactions(int departmentId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Department_id", SqlDbType.Int),
};
sql[0].Value = "SelectDepartmentFarIdAndInformactions";
sql[1].Value = departmentId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
#region 以父级id查询部门id,并获取部门名称
public DataTable GetAllJinCangDepartmentByDepartmentFarId(int departmentFarid)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Department_Farid", SqlDbType.Int),
};
sql[0].Value = "GetAllJinCangDepartmentByDepartmentFarId";
sql[1].Value = departmentFarid;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
#region 获取库存地点名称根据库存地点id
public DataTable SelectRepertoryPlaceNameByrepertoryPlaceid(int repertoryPlaceId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_place_id", SqlDbType.Int),
};
sql[0].Value = "SelectRepertoryPlaceNameByrepertoryPlaceid";
sql[1].Value = repertoryPlaceId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
#region 获取收货人名称根据员工id
public DataTable SelectReceiver_namByemployeeId(int employeeId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Employee_id", SqlDbType.Int),
};
sql[0].Value = "SelectReceiver_namByemployeeId";
sql[1].Value = employeeId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
4.6 实现该功能的存储过程
--根据绑定中的部门id来绑定库存地点下拉框
if(@NB='SelectRepertoryPlaceBydeparmentid')
begin
SELECT Repertory_place_id, Repertory_place_name, Repertory_place_identifier
FROM Repertory_place
where Department_id=@Department_id
end
--以父级id查询部门id,并获取部门名称
if(@NB='GetAllJinCangDepartmentByDepartmentFarId')
begin
SELECT Department_id, Department_code, Department_name, Department_Farid
FROM Department
where Department_id=@Department_Farid
end
--获取部门父id及其信息根据绑定部门id
if(@NB='SelectDepartmentFarIdAndInformactions')
begin
SELECT Department_Farid, Department_code, Department_name
FROM Department
where Department_id=@Department_id
end
--获取库存地点名称根据库存地点id
if(@NB='SelectRepertoryPlaceNameByrepertoryPlaceid')
begin
SELECT Repertory_place_name, Repertory_place_id
FROM Repertory_place
where Repertory_place_id=@Repertory_place_id
end
--以父级id查询部门id,并获取部门名称
if(@NB='GetAllJinCangDepartmentByDepartmentFarId')
begin
SELECT Department_id, Department_code, Department_name, Department_Farid
FROM Department
where Department_id=@Department_Farid
end
--获取收货人名称根据员工id
if(@NB='SelectReceiver_namByemployeeId')
begin
SELECT Employee_id, Employee_name AS Receiver
FROM Eemployee
where Employee_id=@Employee_id
end
5.1 点击“批量选商品“按钮
效果图:
图5.1
5.2 实现该功能的界面代码:onclick="OpenPiLiangXuanShangPin()"事件的触发
<td style="vertical-align: middle">
<input type="button" value="批量选商品" οnclick="OpenPiLiangXuanShangPin()"
style="width: 100px; text-align: right; font-size: 17px;" />
</td>
实现商品信息窗口的代码
<div class="easyui-window" id="wPiLiangXuanShangPin" title="商品信息" style="width: 700px; height: 300px;" data-options="resizable:false,minimizable:false,
collapsible:false,maximizable:false,closed:true">
<table style="width: 686px; height: 28px; padding: 0; border-spacing: 0">
<tr>
<td style="vertical-align: middle">请输入要查询商品名称:
<input type="text" id="strBlur" οnkeyup=" MohuiSelecGoods()" style="width: 150px;" /></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: 231px;">
<table id="tbPiLiangXuanShangPin" class="easyui-datagrid" style="width: 3360px;" data-options="rownumbers:true,
striped:true,pagination:true,idField:'Goods_id',singleSelect:true,fit:true,fitColumns:false,singleSelect:true,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:'Repertory_enter_id',hidden:true,width:80,align:'center'">进仓ID</th>
<th data-options="field:'Agreement_id',hidden:true,width:80,align:'center'">合同ID</th>
<th data-options="field:'Goods_code',width:80,align:'center'">商品代码</th>
<th data-options="field:'Goods_bar_code',width:80,align:'center'">商品条码</th>
<th data-options="field:'Goods_name',width:80,align:'center'">商品名称</th>
<th data-options="field:'Art_No',width:80,align:'center'">货号</th>
<th data-options="field:'Contract_number',width:80,align:'center'">合同号</th>
<th data-options="field:'Format_model',width:80,align:'center'">规格型号</th>
<th data-options="field:'JiLiangDanWei',width:80,align:'center'">计量单位</th>
<th data-options="field:'Quality_content',width:80,align:'center'">包装含量</th>
<th data-options="field:'NumberOfUnits',hidden:true,editor:'numberbox',width:80,align:'center'">入库件数</th>
<th data-options="field:'Shipments_quantity',width:80,hidden:true,align:'center'">入库细数</th>
<th data-options="field:'WuGouShuLiang',hidden:true,editor:'numberbox',width:80,align:'center'">物扣数量</th>
<th data-options="field:'Tax_inclusive_price',hidden:true,width:80,align:'center'">含税进价</th>
<th data-options="field:'Purchase_bid',width:80,align:'center'">采购进价</th>
<th data-options="field:'Input_ratio',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:'ShangPinBiaoJi',width:80,align:'center'">商品标记</th>
<th data-options="field:'Copy_record_deny',width:80,align:'center'">复制记录否</th>
<th data-options="field:'Manufacturer_name',width:80,align:'center'">生产厂家</th>
<th data-options="field:'Producing_area_name',width:80,align:'center'">产地</th>
<th data-options="field:'Art_No',width:80,align:'center'">货号</th>
<th data-options="field:'JiLiangDanWei',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:'Goods_rademark_name',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:'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:'Permit_decimal_deny',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:'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>
5.3实现该功能的JavaScript里的代码:
//打开批量选商品窗口
function OpenPiLiangXuanShangPin() {
$('#wPiLiangXuanShangPin').window('open');
//查询批量选商品(根据合同id)
var values = $('#tb进窗信息').datagrid('getRows');
var str = [];
for (var j = 0; j < values.length; j++) {
str.push(values[j].Goods_id);//方法push(),可以将一个或多个新的元素附加到数组的尾部,然后返回到数组的新长度。
}
$.getJSON("/ZiYingWuDingDanJinCang/SelectShangPinXinXiAll?agreementid=" + agreementid1 + "&strarry=" + str, function (data) {
$('#tbPiLiangXuanShangPin').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;
}
}
5.4 实现该功能控制器代码
#region 查询商品信息(根据合同id)
public ActionResult SelectShangPinXinXiAll(int agreementid, string strarry)
{
DataTable dt = _myWuDingDanJinCang.SelectShangPinXinXi(agreementid);
string[] str = strarry.Split(',');//实例化数组【】用“,”分隔开
foreach (string t in str)
{
//fou循环遍历
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 根据商品MC查询商品信息
public ActionResult SelectShangPinXinXiBygoodsName(string strBlur)
{
DataTable dt = _myWuDingDanJinCang.SelectShangPinXinXiBygoodsName(strBlur);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
5.5 实现该功能逻辑层代码
#region 查询商品信息(根据合同id)
public DataTable SelectShangPinXinXi(int agreementId)
{
SqlParameter[] sqlcmDpas =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Agreement_id", SqlDbType.Int),
};
sqlcmDpas[0].Value = "SelectShangPinXinXi";
sqlcmDpas[1].Value = agreementId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sqlcmDpas);
return dt;
}
#endregion
#region 根据商品MC查询商品信息
public DataTable SelectShangPinXinXiBygoodsName(string strBur)
{
SqlParameter[] sqlcmDpas =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@strBur", SqlDbType.Char),
};
sqlcmDpas[0].Value = "SelectShangPinXinXiBygoodsName";
sqlcmDpas[1].Value = strBur;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sqlcmDpas);
return dt;
}
#endregion
5.5 实现该功能的存储过程
--查询商品信息根据合同id
if(@NB='SelectShangPinXinXi')
begin
SELECT Goods.Goods_id, Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Art_No, Goods.Format_model, Attribute_gather_detail.Attribute_gather_detail_name AS JiLiangDanWei,
Goods.Goods_abbreviation, Goods.Plncode_PLN, Goods.Agreement_id, Attribute_gather_detail_1.Attribute_gather_detail_name AS ShiYongDuiXiang, Goods.Goods_colours, Goods.Input_ratio, Goods.Output_ratio,
Goods.Count_scale, Goods.Quality_content, Attribute_gather_detail_2.Attribute_gather_detail_name AS ZhiLiangDengJi, Manage_season.Manage_season_name AS JiYingJiJie, Goods.Permit_decimal_deny, Goods.Copy_record_deny,
Goods.Vender_bar_code_deny, Attribute_gather_detail_3.Attribute_gather_detail_name AS ShangPinBiaoJi, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name, Attribute_gather_detail_4.Attribute_gather_detail_name AS ChanPinZhuangTai,
Eemployee_1.Employee_number AS DengJiRen, CONVERT(varchar(20), Goods.Register_time, 120) AS Register_time, Eemployee.Employee_number AS ShenHeRen, CONVERT(varchar(20), Goods.Review_time, 120) AS Review_time, CONVERT(varchar(20), Goods.Update_Time, 120) AS Update_Time,Eemployee_2.Employee_number AS GengXinRen,
Goods.Retail_unit_price, Goods.Purchase_bid, Goods.Self_fix_goods_deny, Goods.Mini_fix_goods_deny, Attribute_gather_detail_5.Attribute_gather_detail_name AS ShangPinFenLei, Agreement.Contract_number,
Goods_rademark.Goods_rademark_name, Attribute_gather_detail_6.Attribute_gather_detail_name AS BaoZhiQi,
Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5)) / 100 + 1) AS Tax_inclusive_price, Goods.Purchase_bid AS Tax_inclusive_price
FROM Goods 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.Use_target_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods.Quality_grade_pubid = Attribute_gather_detail_2.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_3 ON Goods.Goods_tab_pubid = Attribute_gather_detail_3.Attribute_gather_detail_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_4 ON Goods.Product_status_pubid = Attribute_gather_detail_4.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
Attribute_gather_detail AS Attribute_gather_detail_5 ON Goods.Goods_classify_pubid = Attribute_gather_detail_5.Attribute_gather_detail_id INNER JOIN
Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN
Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_6 ON Goods.Quality_guarantee_period_pubid = Attribute_gather_detail_6.Attribute_gather_detail_id
where Goods.Agreement_id=@Agreement_id
end
--模糊查询商品信息根据商品名称
if(@NB='SelectShangPinXinXiBygoodsName')
begin
SELECT Goods.Goods_id, Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Art_No, Goods.Format_model, Attribute_gather_detail.Attribute_gather_detail_name AS JiLiangDanWei,
Goods.Goods_abbreviation, Goods.Plncode_PLN, Goods.Agreement_id, Attribute_gather_detail_1.Attribute_gather_detail_name AS ShiYongDuiXiang, Goods.Goods_colours, Goods.Input_ratio, Goods.Output_ratio,
Goods.Count_scale, Goods.Quality_content, Attribute_gather_detail_2.Attribute_gather_detail_name AS ZhiLiangDengJi, Manage_season.Manage_season_name AS JiYingJiJie, Goods.Permit_decimal_deny, Goods.Copy_record_deny,
Goods.Vender_bar_code_deny, Attribute_gather_detail_3.Attribute_gather_detail_name AS ShangPinBiaoJi, Manufacturer.Manufacturer_name, Goods_producing_area.Producing_area_name, Attribute_gather_detail_4.Attribute_gather_detail_name AS ChanPinZhuangTai,
Eemployee_1.Employee_number AS DengJiRen, CONVERT(varchar(20), Goods.Register_time, 120) AS Register_time, Eemployee.Employee_number AS ShenHeRen, CONVERT(varchar(20), Goods.Review_time, 120) AS Review_time, CONVERT(varchar(20), Goods.Update_Time, 120) AS Update_Time,Eemployee_2.Employee_number AS GengXinRen,
Goods.Retail_unit_price, Goods.Purchase_bid, Goods.Self_fix_goods_deny, Goods.Mini_fix_goods_deny, Attribute_gather_detail_5.Attribute_gather_detail_name AS ShangPinFenLei, Agreement.Contract_number,
Goods_rademark.Goods_rademark_name, Attribute_gather_detail_6.Attribute_gather_detail_name AS BaoZhiQi
FROM Goods 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.Use_target_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods.Quality_grade_pubid = Attribute_gather_detail_2.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_3 ON Goods.Goods_tab_pubid = Attribute_gather_detail_3.Attribute_gather_detail_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_4 ON Goods.Product_status_pubid = Attribute_gather_detail_4.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
Attribute_gather_detail AS Attribute_gather_detail_5 ON Goods.Goods_classify_pubid = Attribute_gather_detail_5.Attribute_gather_detail_id INNER JOIN
Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN
Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_6 ON Goods.Quality_guarantee_period_pubid = Attribute_gather_detail_6.Attribute_gather_detail_id
where Goods.Goods_name like '%'+ rtrim(ltrim(@strBur)) +'%'
end
6.1“把商品信息“窗口中的信息绑定到”无订单进仓“窗口的DGV中作为无订单进仓明细信息
效果图:
6.2实现此功能的界面代码</span></strong></p><p><pre name="code" class="csharp">//绑定无订单明细(多选获取商品)
function GetChangPin() {
var rows = $('#tbPiLiangXuanShangPin').datagrid('getRows');
for (var i = 0; i < rows.length; i++) {
if (document.getElementsByName("check")[i].checked) {
$.getJSON("/ZiYingWuDingDanJinCang/BangWuDingDanMingXi?goodsId=" + rows[i].Goods_id, function (result) {
$.each(result, function (j, data) {
$('#tb进窗信息').datagrid('appendRow', {
Goods_id: data['Goods_id'],
Goods_code: data['Goods_code'],
Goods_bar_code: data['Goods_bar_code'],
Goods_name: data['Goods_name'],
Art_No: data['Art_No'],
Format_model: data['Format_model'],
JiLiangDanWei: data['JiLiangDanWei'],
Quality_content: data['Quality_content'],
RuKuShuLiang: data['RuKuShuLiang'],
AAA: data['AAA'],
Tax_inclusive_price: data['Tax_inclusive_price'],
Purchase_bid: data['Purchase_bid'],
Retail_unit_price: data['Retail_unit_price'],
MaiJia: data['MaiJia'],
Vender_bar_code_deny: data['Vender_bar_code_deny'],
WuGouShuLiang: data['WuGouShuLiang'],
Goods_abbreviation: data['Goods_abbreviation'],
Plncode_PLN: data['Plncode_PLN'],
Copy_record_deny: data['Copy_record_deny'],
Contract_number: data['Contract_number'],
Manufacturer_name: data['Manufacturer_name'],
Producing_area_name: data['Producing_area_name'],
ShiYongDuiXiang: data['ShiYongDuiXiang'],
Goods_colours: data['Goods_colours'],
Goods_rademark_name: data['Goods_rademark_name'],
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'],
Permit_decimal_deny: data['Permit_decimal_deny'],
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'],
Self_fix_goods_deny: data['Self_fix_goods_deny'],
Mini_fix_goods_deny: data['Mini_fix_goods_deny']
});
});
});
}
$("#wPiLiangXuanShangPin").window('close');
}
}
6.3 实现此功能控制器代码
#region 根据商品id绑定无订单明细
public ActionResult BangWuDingDanMingXi(int goodsId)
{
DataTable dt = _myWuDingDanJinCang.BangWuDingDanMingXi(goodsId);
List<Dictionary<string, object>> listReturn = ConvertHelper.DtToList(dt);
return Json(listReturn, JsonRequestBehavior.AllowGet);
}
#endregion
6.4 实现此功能逻辑层代码
#region 根据商品id绑定无订单明细
public DataTable BangWuDingDanMingXi(int goodsId)
{
SqlParameter[] sqlcmDpas =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Goods_id", SqlDbType.Int),
};
sqlcmDpas[0].Value = "BangWuDingDanMingXi";
sqlcmDpas[1].Value = goodsId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sqlcmDpas);
return dt;
}
#endregion
6.4 实现此功能存储过程
--根据商品id绑定无订单明细
if(@NB='BangWuDingDanMingXi')
begin
SELECT Goods.Goods_id, Goods.Goods_code, Goods.Goods_bar_code, Goods.Goods_name, Goods.Art_No, Goods.Format_model, Attribute_gather_detail.Attribute_gather_detail_name AS JiLiangDanWei,
Goods.Goods_abbreviation, Goods.Plncode_PLN, Goods.Agreement_id, Goods.Input_ratio, Goods.Count_scale, Goods.Quality_content, Manage_season.Manage_season_name AS JiYingJiJie,
Goods.Permit_decimal_deny, Goods.Copy_record_deny, Goods.Vender_bar_code_deny, Attribute_gather_detail_3.Attribute_gather_detail_name AS ShangPinBiaoJi, CONVERT(varchar(20),
Goods.Register_time, 120) AS Register_time, CONVERT(varchar(20), Goods.Review_time, 120) AS Review_time, CONVERT(varchar(20), Goods.Update_Time, 120) AS Update_Time,
Goods.Retail_unit_price, Goods.Purchase_bid, Goods.Self_fix_goods_deny, Goods.Mini_fix_goods_deny, Agreement.Contract_number,
Attribute_gather_detail_6.Attribute_gather_detail_name AS BaoZhiQi, Manufacturer.Manufacturer_name, Attribute_gather_detail_4.Attribute_gather_detail_name AS ChanPinZhuangTai,
Goods_producing_area.Producing_area_name, Attribute_gather_detail_5.Attribute_gather_detail_name AS ShangPinFenLei,
Attribute_gather_detail_2.Attribute_gather_detail_name AS ZhiLiangDengJi, Goods_rademark.Goods_rademark_name, Goods.Goods_colours, Eemployee.Employee_name AS DengJiRen,
Eemployee_1.Employee_name AS ShenHeRen, Eemployee_2.Employee_name AS GengXinRen, Goods.Output_ratio, Goods.Purchase_bid * (CAST(Goods.Input_ratio AS decimal(18, 5)) / 100 + 1)
AS Tax_inclusive_price, Goods.Purchase_bid, Attribute_gather_detail_1.Attribute_gather_detail_name AS ShiYongDuiXiang
FROM Goods 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.Use_target_pubid = Attribute_gather_detail_1.Attribute_gather_detail_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_2 ON Goods.Quality_grade_pubid = Attribute_gather_detail_2.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_3 ON Goods.Goods_tab_pubid = Attribute_gather_detail_3.Attribute_gather_detail_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_4 ON Goods.Product_status_pubid = Attribute_gather_detail_4.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
Attribute_gather_detail AS Attribute_gather_detail_5 ON Goods.Goods_classify_pubid = Attribute_gather_detail_5.Attribute_gather_detail_id INNER JOIN
Agreement ON Goods.Agreement_id = Agreement.Agreement_id INNER JOIN
Goods_rademark ON Goods.Goods_rademark_id = Goods_rademark.Goods_rademark_id INNER JOIN
Attribute_gather_detail AS Attribute_gather_detail_6 ON Goods.Quality_guarantee_period_pubid = Attribute_gather_detail_6.Attribute_gather_detail_id
where Goods.Goods_id=@Goods_id
end
7.1 对于DGV中的计算方法,在JavaScript中代码
//开始编辑
var editIndex = undefined;
function onClickRowMingXi(index) {
if (editIndex != index) {
$('#tb进窗信息').datagrid('beginEdit', index);
$('#tb进窗信息').datagrid('endEdit', editIndex);
compute(index);
editIndex = index;
} else {
$('#tb进窗信息').datagrid('endEdit', index);
$('#tb进窗信息').datagrid('beginEdit', index);
compute(index);
}
}
//计算细数
function compute(index) {
var numberOfUnit = $("#tb进窗信息").datagrid("getEditor", { index: index, field: 'NumberOfUnits' });
var shipmentsQuantity = $("#tb进窗信息").datagrid("getEditor", { index: index, field: 'Shipments_quantity' });
var rows = $("#tb进窗信息").datagrid("getRows");
var qualityContent = rows[index].Quality_content;
numberOfUnit.target.bind('change', function () {
if (numberOfUnit.target.val() != '') {
$(shipmentsQuantity.target).numberbox("setValue", '');
count();
}
});
shipmentsQuantity.target.bind('change', function () {
count1();
});
function count1() {
$(numberOfUnit.target).numberbox("setValue", (shipmentsQuantity.target.val() / qualityContent));
}
function count() {
$(shipmentsQuantity.target).numberbox("setValue", qualityContent * (numberOfUnit.target.val()));
}
}
8.1 对“保存“此按钮的操作,JavaScript里的代码
//保存操作:(新增无订单进仓单)
function BaoCunWuDingDanJinCangDan() {
//检漏控件值,做出提示
if ($('#RepertoryPlaceIdentifier').combobox('getValue') == "" || $('#shouhuorenbianhao').combobox('getValue') == "") {
ui.error("数据不完整,新增失败!", 1000, false);
return false;
}
//获取所在编辑中单元格值
$("#tb进窗信息").datagrid("endEdit", $('#tb进窗信息').datagrid('getRowIndex', $('#tb进窗信息').datagrid('getSelected')));
$.getJSON("/ZiYingWuDingDanJinCang/Insert_WuDingDanJinCan?receiverid=" + $('#shouhuorenbianhao').combobox('getValue') + "&" +
"recordNumber=" + $('#txtWuDingDanJiLuBianMa').val() + "&" +
"registrantId=" + $('#dengjiren').combobox('getValue') + "&" +
"registerTime=" + $('#datdengjishijian').datetimebox('getValue') + "&" +
"repertoryPlaceId=" + $('#RepertoryPlaceIdentifier').combobox('getValue') + "&" +
"affixCount=" + $('#txtFuJianZhangShu').val() + "&" +
"originalNumber=" + $('#txtTongJinCang').val() + "&" +
"agreementId=" + agreementid1,
function (data) {
if (data > 0) {
var repertoryEnterId = data;
var wdJingCangMingXi = $('#tb进窗信息').datagrid('getRows');
//新增明细
for (var i = 0; i < wdJingCangMingXi.length; i++) {
$.getJSON("/ZiYingWuDingDanJinCang/Insert_WuDingDanJinCanDetail?repertoryEnterId=" + repertoryEnterId + "&" +
"goodsId=" + wdJingCangMingXi[i].Goods_id + "&" +
"repertoryEnterPackages=" + wdJingCangMingXi[i].NumberOfUnits + "&" +
"repertoryEnterQuantity=" + wdJingCangMingXi[i].Shipments_quantity + "&" +
"giveawayQuantity=" + wdJingCangMingXi[i].WuGouShuLiang,
function (data1) {
});
}
ui.alert("新增成功!", 1000, false);
} else {
ui.error("新增失败!", 1000, false);
}
qingKong();//调用方法
SelectWuDingDanJinCangRecord_number();
});
}
8.2 对“保存“此按钮的操作,控制器代码
#region 新增无订单进仓单
public int Insert_WuDingDanJinCan(string receiverid, string recordNumber,
string registrantId, string registerTime, string repertoryPlaceId,
string affixCount, string originalNumber, string agreementId)
{
DataTable dt = _myWuDingDanJinCang.Insert_WuDingDanJinCan(
Convert.ToInt32(receiverid),
recordNumber,
Convert.ToInt32(registrantId),
Convert.ToDateTime(registerTime),
Convert.ToInt32(repertoryPlaceId),
affixCount,
originalNumber,
Convert.ToInt32(agreementId));
return Convert.ToInt32(dt.Rows[0][0].ToString());
}
#endregion
#region 新增无订单进仓明细
public void Insert_WuDingDanJinCanDetail(string repertoryEnterId, string goodsId,
string repertoryEnterPackages, string repertoryEnterQuantity,
string giveawayQuantity)
{
_myWuDingDanJinCang.Insert_WuDingDanJinCanDetail(
Convert.ToInt32(repertoryEnterId),
Convert.ToInt32(goodsId),
Convert.ToDecimal(repertoryEnterPackages),
Convert.ToDecimal(repertoryEnterQuantity),
Convert.ToDecimal(giveawayQuantity));
}
#endregion
8.2 对“保存“此按钮的操作,逻辑层代码
#region 新增无订单进仓单
public DataTable Insert_WuDingDanJinCan(int receiverId, string recordNumber,
int registrantId, DateTime registerTime, int repertoryPlaceId,
string affixCount, string originalNumber, int agreementId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Receiver_id", SqlDbType.Int),
new SqlParameter("@Record_number", SqlDbType.Char),
new SqlParameter("@Registrant_id", SqlDbType.Int),
new SqlParameter("@Register_time", SqlDbType.DateTime),
new SqlParameter("@Repertory_place_id", SqlDbType.Int),
new SqlParameter("@Affix_count", SqlDbType.Char),
new SqlParameter("@Original_number", SqlDbType.Char),
new SqlParameter("@Agreement_id", SqlDbType.Int),
};
sql[0].Value = "Insert_WuDingDanJinCan";
sql[1].Value = receiverId;
sql[2].Value = recordNumber;
sql[3].Value = registrantId;
sql[4].Value = registerTime;
sql[5].Value = repertoryPlaceId;
sql[6].Value = affixCount;
sql[7].Value = originalNumber;
sql[8].Value = agreementId;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
#region 新增无订单进仓明细
public int Insert_WuDingDanJinCanDetail(int repertoryEnterId, int goodsId,
decimal repertoryEnterPackages, decimal repertoryEnterQuantity,
decimal giveawayQuantity)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_enter_id", SqlDbType.Int),
new SqlParameter("@Goods_id", SqlDbType.Int),
new SqlParameter("@Repertory_enter_packages", SqlDbType.Decimal),
new SqlParameter("@Repertory_enter_quantity", SqlDbType.Decimal),
new SqlParameter("@Giveaway_quantity", SqlDbType.Decimal),
};
sql[0].Value = "Insert_WuDingDanJinCanDetail";
sql[1].Value = repertoryEnterId;
sql[2].Value = goodsId;
sql[3].Value = repertoryEnterPackages;
sql[4].Value = repertoryEnterQuantity;
sql[5].Value = giveawayQuantity;
return _myDalMethod.DAL_OPTableDB_Par("WuDingDanShangPinJinCang", sql);
}
#endregion
9.1对“修改“按钮的操作,界面JavaScript中代码
//修改无订单进仓
var tips = "";
function UpdateWDJinCang() {
if (repertoryEnterid > 0) {
ui.confirm('是否修改???', function (k) {
if (k) {
//声明变量获取某一行的值id
var delrow = $('#tb进窗信息').datagrid('getChanges', 'deleted');
var insertrow = $('#tb进窗信息').datagrid('getChanges', 'inserted');
var updaterow = $('#tb进窗信息').datagrid('getChanges', 'updated');
var count = 0;
//DGV 中的行
if (delrow.length > 0) {
for (var i = 0; i < delrow.length; i++) {
$.getJSON("/ZiYingWuDingDanJinCang/DeleteWdjcDetailid?repertoryEnterDetailid=" + delrow[i].Repertory_enter_detail_id, function (data) {
count += data;
});
}
}
//新增DGV中的行
if (insertrow.length > 0) {
for (var j = 0; j < insertrow.length; j++) {
$.getJSON("/ZiYingWuDingDanJinCang/Insert_WDDJCDetail?goodsId=" + insertrow[j].Goods_id + "&" +
"repertoryEnterPackages=" + insertrow[j].NumberOfUnits + "&" +
"repertoryEnterQuantity=" + insertrow[j].Shipments_quantity + "&" +
"giveawayQuantity=" + insertrow[j].WuGouShuLiang + "&" +
"repertoryEnterId=" + repertoryEnterid,
function (data1) {
count += data1;
});
}
}
//修改DGV中的行
if (updaterow.length > 0) {
for (var h = 0; h < updaterow.length; h++) {
$.getJSON("/ZiYingWuDingDanJinCang/Update_WDDJCDetail?" +
"repertoryEnterPackages=" + updaterow[h].NumberOfUnits + "&" +
"repertoryEnterQuantity=" + updaterow[h].Shipments_quantity + "&" +
"giveawayQuantity=" + updaterow[h].WuGouShuLiang + "&" +
"repertoryEnterDetailId=" + updaterow[h].Repertory_enter_detail_id, function (data2) {
count += data2;
});
}
}
//修改进仓单
var success = false;
$.getJSON("/ZiYingWuDingDanJinCang/Update_WDJinCangDan?receiverid=" + receiverid + "&" +
"recordNumber=" + $('#txtWuDingDanJiLuBianMa').val() + "&" +
"registrantId=" + $('#dengjiren').combobox('getValue') + "&" +
"registerTime=" + $('#datdengjishijian').datetimebox('getValue') + "&" +
"repertoryPlaceId=" + repertoryPlaceid + "&" +
"affixCount=" + $('#txtFuJianZhangShu').val() + "&" +
"originalNumber=" + $('#txtTongJinCang').val() + "&" +
"agreementId=" + agreementid + "&" +
"repertoryEnterid=" + repertoryEnterid,
function (data) {
if (data > 0) {
success = true;
qingKong();
}
});
//判断所并接起的方法是否为true
if (count == (delrow.length + insertrow.length + updaterow.length && success == true)) {
ui.alert('修改成功!!!', 1000, false);
} else {
ui.error('修改失败!!!', 1000, false);
}
}
});
}
}
9.2 对“修改“按钮的操作,控制器代码
#region 修改无订单进仓单
public int Update_WDJinCangDan(string receiverid, string recordNumber,
string registrantId, string registerTime, string repertoryPlaceId,
string affixCount, string originalNumber, string agreementId,
string repertoryEnterid)
{
int dt = _myWuDingDanJinCang.Update_WDJinCangDan(ConvertHelper.ConverToInt(receiverid),
recordNumber,
ConvertHelper.ConverToInt(registrantId),
Convert.ToDateTime(registerTime),
ConvertHelper.ConverToInt(repertoryPlaceId),
affixCount,
originalNumber,
Convert.ToInt32(agreementId),
Convert.ToInt32(repertoryEnterid));
return dt;
}
#endregion
#region 修改无订单进仓明细信息
//(1)删除无订单进仓明细
public int DeleteWdjcDetailid(int repertoryEnterDetailid)
{
return _myWuDingDanJinCang.DeleteWdjcDetailid(repertoryEnterDetailid);
}
//(2)新增无订单进仓明细
public int Insert_WDDJCDetail(string goodsId,
string repertoryEnterPackages, string repertoryEnterQuantity,
string giveawayQuantity, string repertoryEnterId)
{
int dt = _myWuDingDanJinCang.Insert_WDDJCDetail(
Convert.ToInt32(goodsId),
Convert.ToDecimal(repertoryEnterPackages),
Convert.ToDecimal(repertoryEnterQuantity),
Convert.ToDecimal(giveawayQuantity),
Convert.ToInt32(repertoryEnterId));
return dt;
}
//(3)修改无订单进仓明细
public int Update_WDDJCDetail(
string repertoryEnterPackages, string repertoryEnterQuantity,
string giveawayQuantity, string repertoryEnterDetailId)
{
int dt = _myWuDingDanJinCang.Update_WDDJCDetail(
Convert.ToDecimal(repertoryEnterPackages),
Convert.ToDecimal(repertoryEnterQuantity),
Convert.ToDecimal(giveawayQuantity),
Convert.ToInt32(repertoryEnterDetailId));
return dt;
}
#endregion
9.3对“修改“按钮的操作,逻辑层代码
#region 修改无订单进仓单
public int Update_WDJinCangDan(int receiverId, string recordNumber,
int registrantId, DateTime registerTime, int repertoryPlaceId,
string affixCount, string originalNumber, int agreementId,
int repertoryEnterId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Receiver_id", SqlDbType.Int),
new SqlParameter("@Record_number", SqlDbType.Char),
new SqlParameter("@Registrant_id", SqlDbType.Int),
new SqlParameter("@Register_time", SqlDbType.DateTime),
new SqlParameter("@Repertory_place_id", SqlDbType.Int),
new SqlParameter("@Affix_count", SqlDbType.Char),
new SqlParameter("@Original_number", SqlDbType.Char),
new SqlParameter("@Agreement_id", SqlDbType.Int),
new SqlParameter("@Repertory_enter_id",SqlDbType.Int),
};
sql[0].Value = "Update_WDJinCangDan";
sql[1].Value = receiverId;
sql[2].Value = recordNumber;
sql[3].Value = registrantId;
sql[4].Value = registerTime;
sql[5].Value = repertoryPlaceId;
sql[6].Value = affixCount;
sql[7].Value = originalNumber;
sql[8].Value = agreementId;
sql[9].Value = repertoryEnterId;
return _myDalMethod.DAL_OPTableDB_Par("WuDingDanShangPinJinCang", sql);
}
#endregion
#region 修改无订单进仓明细信息
//(1)删除无订单进仓明细
public int DeleteWdjcDetailid(int repertoryEnterDetailId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_enter_detail_id", SqlDbType.Int),
};
sql[0].Value = "DeleteWdjcDetailid";
sql[1].Value = repertoryEnterDetailId;
return _myDalMethod.DAL_OPTableDB_Par("WuDingDanShangPinJinCang", sql);
}
//(2)新增无订单进仓明细
public int Insert_WDDJCDetail(int goodsId,
decimal repertoryEnterPackages, decimal repertoryEnterQuantity,
decimal giveawayQuantity, int repertoryEnterId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Goods_id", SqlDbType.Int),
new SqlParameter("@Repertory_enter_packages", SqlDbType.Decimal),
new SqlParameter("@Repertory_enter_quantity", SqlDbType.Decimal),
new SqlParameter("@Giveaway_quantity", SqlDbType.Decimal),
new SqlParameter("@Repertory_enter_id", SqlDbType.Int),
};
sql[0].Value = "Insert_WDDJCDetail";
sql[1].Value = goodsId;
sql[2].Value = repertoryEnterPackages;
sql[3].Value = repertoryEnterQuantity;
sql[4].Value = giveawayQuantity;
sql[5].Value = repertoryEnterId;
return _myDalMethod.DAL_OPTableDB_Par("WuDingDanShangPinJinCang", sql);
}
//(3)修改无订单进仓明细
public int Update_WDDJCDetail(decimal repertoryEnterPackages,
decimal repertoryEnterQuantity, decimal giveawayQuantity, int repertoryEnterDetailId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_enter_packages", SqlDbType.Decimal),
new SqlParameter("@Repertory_enter_quantity", SqlDbType.Decimal),
new SqlParameter("@Giveaway_quantity", SqlDbType.Decimal),
new SqlParameter("@Repertory_enter_detail_id", SqlDbType.Int),
};
sql[0].Value = "Update_WDDJCDetail";
sql[1].Value = repertoryEnterPackages;
sql[2].Value = repertoryEnterQuantity;
sql[3].Value = giveawayQuantity;
sql[4].Value = repertoryEnterDetailId;
return _myDalMethod.DAL_OPTableDB_Par("WuDingDanShangPinJinCang", sql);
}
#endregion
9.4对“修改“按钮的操作,存储过程
--修改无订单进仓单
if(@NB='Update_WDJinCangDan')
begin
UPDATE Repertory_enter
SET Hava_indent_deny ='false', Receiver_id =@Receiver_id,
Record_number =@Record_number, Registrant_id =@Registrant_id,
Register_time =@Register_time, Repertory_place_id =@Repertory_place_id,
Affix_count =@Affix_count, Original_number =@Original_number,
Type_of_operation_pubid ='110', Agreement_id =@Agreement_id,
Review_deny ='false'
where Repertory_enter.Hava_indent_deny='false'and Repertory_enter.Review_deny='false'
and Repertory_enter.Repertory_enter_id=@Repertory_enter_id
end
--修改无订单进仓明细信息
--(1)删除无订单进仓明细
if(@NB='DeleteWdjcDetailid')
begin
DELETE FROM Repertory_enter_detail
where Repertory_enter_detail_id=@Repertory_enter_detail_id
end
--(2)新增无订单进仓明细
if(@NB='Insert_WDDJCDetail')
begin
INSERT INTO Repertory_enter_detail
(Repertory_enter_id, Goods_id, Repertory_enter_packages, Repertory_enter_quantity, Giveaway_quantity, Review_deny,Repertory_enter_detail_Farid)
VALUES (@Repertory_enter_id,@Goods_id,@Repertory_enter_packages,@Repertory_enter_quantity,@Giveaway_quantity,'false','0')
end
--(3)修改无订单进仓明细
if(@NB='Update_WDDJCDetail')
begin
UPDATE Repertory_enter_detail
SET
Repertory_enter_packages =@Repertory_enter_packages,
Repertory_enter_quantity =@Repertory_enter_quantity,
Giveaway_quantity =@Giveaway_quantity, Review_deny ='false',
Repertory_enter_detail_Farid ='0'
where Repertory_enter_detail_id=@Repertory_enter_detail_id
end
10.1对“审核“按钮的操作,JavaScript中界面代码
//审核
function ShenHe() {
var rowi = $("#tb进窗信息").datagrid("getRows");
var m = true;
for (var j = 0; j < rowi.length; j++) {
if (rowi[j].YiRuKuShu > 0 || rowi[j].YiRuKuShu != "") {
m = false;
}
}
var jinCangMingXi = $('#tb进窗信息').datagrid('getRows');
var strs = "";
var auditor = $('#Auditor').combobox('getValue');
var reviewTime = $('#datshenheshijian').datetimebox('getValue');
var wuDingDanJiLuBianMa = $('#txtWuDingDanJiLuBianMa').val();
parent.document.getElementById("labTips").innerHTML = "";
if (m) {
ui.confirm('是否分批进货???', function (k) {
if (k) {
//对DGV中所需列的显示
$("#tb进窗信息").datagrid('showColumn', 'YiRuKuShu');
$("#tb进窗信息").datagrid('showColumn', 'HaiYaoRuKuShu');
var dtJinChuanXinxi = $("#tb进窗信息").datagrid("getData");
for (var idt = 0; idt < $("#tb进窗信息").datagrid("getData").rows.length; idt++) {
dtJinChuanXinxi.rows[idt]["YiRuKuShu"] = Number(dtJinChuanXinxi.rows[idt]["WuGouShuLiang"]) + Number(dtJinChuanXinxi.rows[idt]["Shipments_quantity"]);
$("#tb进窗信息").datagrid("refreshRow", idt);
}
for (var i = 0; i < jinCangMingXi.length; i++) {
strs += jinCangMingXi[i].Repertory_enter_detail_id + ',';
strs += jinCangMingXi[i].Shipments_quantity + ',';
strs += jinCangMingXi[i].NumberOfUnits + ',';
strs += jinCangMingXi[i].WuGouShuLiang + ',';
strs += jinCangMingXi[i].ZongYaoRuKuShu + ',';
strs += jinCangMingXi[i].Goods_name + '.';
}
$.getJSON("/ZiYingWuDingDanJinCang/ShenHe?strs=" + strs + "&" +
"repertoryEnterid=" + repertoryEnterid + "&" +
"auditor=" + auditor + "&" +
"reviewTime=" + reviewTime + "&" +
"wuDingDanJiLuBianMa=" + wuDingDanJiLuBianMa, function (data) {
var tip = "";
if (data == "审核成功!") {
ui.alert('审核成功!!!', 1000, false);
} else {
var strs1 = data.split('+');
for (var n = 0; n < strs1.length - 1; n++) {
tip += "<li style='font-size:15px;margin-left:1px;'>" + strs1[n] + "</li>";
}
}
if (tip != "") {
parent.document.getElementById("labTips").innerHTML = "<ol >" + tip + "</ol>";
}
});
} else { //不分批入库的审核
if (repertoryEnterid > 0) {
$.getJSON("/ZiYingWuDingDanJinCang/ShenHeNoFenPiRuKu?repertoryEnterid=" + repertoryEnterid + "&" +
"repertoryPlaceid=" + repertoryPlaceid + "&" +
"auditor=" + $('#Auditor').combobox('getValue') + "&" +
"reviewTime=" + $('#datshenheshijian').datetimebox('getValue'), function (data) {
var tip = "";
if (data == "审核成功!") {
ui.alert('审核成功!!!', 1000, false);
} else {
var strs1 = data.split('+');
for (var g = 0; g < strs1.length - 1; g++) {
tip += "<li style='font-size:15px;margin-left:1px;'>" + strs1[g] + "</li>";
}
}
if (tip != "") {
parent.document.getElementById("labTips").innerHTML = "<ol >" + tip + "</ol>";
}
});
}
}
});
} else {
for (var h = 0; h < jinCangMingXi.length; h++) {
strs += jinCangMingXi[h].Repertory_enter_detail_id + ',';
strs += jinCangMingXi[h].Shipments_quantity + ',';
strs += jinCangMingXi[h].NumberOfUnits + ',';
strs += jinCangMingXi[h].WuGouShuLiang + ',';
strs += jinCangMingXi[h].ZongYaoRuKuShu + ',';
strs += jinCangMingXi[h].Goods_name + '.';
}
$.getJSON("/ZiYingWuDingDanJinCang/ShenHe?strs=" + strs + "&" +
"repertoryEnterid=" + repertoryEnterid + "&" +
"auditor=" + auditor + "&" +
"reviewTime=" + reviewTime + "&" +
"wuDingDanJiLuBianMa=" + wuDingDanJiLuBianMa, function (data) {
var tip = "";
if (data == "审核成功!") {
ui.alert('审核成功!!!', 1000, false);
} else {
var strs1 = data.split('+');
for (var y = 0; y < strs1.length - 1; y++) {
tip += "<li style='font-size:15px;margin-left:1px;'>" + strs1[y] + "</li>";
}
} if (tip != "") {
parent.document.getElementById("labTips").innerHTML = "<ol >" + tip + "</ol>";
}
});
}
}
10.2对“审核“按钮的操作,控制器代码
#region 审核(分批入库)
public ActionResult ShenHe(string strs, int repertoryEnterid, int auditor, string reviewTime,
string wuDingDanJiLuBianMa)
{
string[] str2 = strs.Split('.');
string msg = "";
var shijishus = new List<int>();
var repertoryEnterEetailids = new List<int>();
var numberOfUnitss = new List<decimal>();
var yaorukushus = new List<int>();
var wuGouShuLiangs = new List<int>();
var bufuhe = new List<bool>();
for (int i = 0; i < str2.Length - 1; i++)
{
string[] str1 = str2[i].Split(',');
var repertoryEnterEetailid = Convert.ToInt32(str1[0].Trim());
var yaorukushu = Convert.ToInt32(str1[1].Trim());
var numberOfUnits = Convert.ToDecimal(str1[2].Trim());
var wuGouShuLiang = Convert.ToInt32(str1[3].Trim());
var zongYaoRuKuShu = Convert.ToInt32(str1[4].Trim());
var goodsName = str1[5].Trim();
//var zongYaoRuKuShu = yaorukushu + wuGouShuLiang;
DataTable dt = _myWuDingDanJinCang.ShenheSelectStockQuary(repertoryEnterEetailid);
if (dt.Rows.Count > 0)
{
var stockToplimit = Convert.ToInt32(dt.Rows[0]["Stock_toplimit"]);
if (zongYaoRuKuShu <= stockToplimit)
{
DataTable dt2 = _myWuDingDanJinCang.ShenHeSelectChildJinCangMingXi(repertoryEnterEetailid);
var yiRuKuShu = Convert.ToInt32(dt2.Rows[0][0]);
var shiJiRuKuShu = yaorukushu + yiRuKuShu + wuGouShuLiang;
if (zongYaoRuKuShu >= shiJiRuKuShu)
{
var shijiru = yaorukushu + wuGouShuLiang;
shijishus.Add(shijiru);
repertoryEnterEetailids.Add(repertoryEnterEetailid);
numberOfUnitss.Add(numberOfUnits);
yaorukushus.Add(yaorukushu);
wuGouShuLiangs.Add(wuGouShuLiang);
bool aa = (zongYaoRuKuShu == shiJiRuKuShu);//bufuhe.Add(zongYaoRuKuShu == shiJiRuKuShu)
bufuhe.Add(aa);
}
else
{
msg += goodsName + "实际入库数大于总入库数!+";
}
}
else
{
msg += goodsName + "总要入库数大于库存上限!+";
}
}
else
{
_myWuDingDanJinCang.ShenheInsertStock(0, repertoryEnterEetailid);
DataTable dt4 = _myWuDingDanJinCang.ShenheSelectStockQuary(repertoryEnterEetailid);
var stockToplimit = Convert.ToInt32(dt4.Rows[0]["Stock_toplimit"]);
if (zongYaoRuKuShu <= stockToplimit)
{
DataTable dt2 = _myWuDingDanJinCang.ShenHeSelectChildJinCangMingXi(repertoryEnterEetailid);
var yiRuKuShu = Convert.ToInt32(dt2.Rows[0][0]);
var shiJiRuKuShu = yaorukushu + yiRuKuShu + wuGouShuLiang;
if (zongYaoRuKuShu >= shiJiRuKuShu)
{
var shijiru = yaorukushu + wuGouShuLiang;
shijishus.Add(shijiru);
repertoryEnterEetailids.Add(repertoryEnterEetailid);
numberOfUnitss.Add(numberOfUnits);
yaorukushus.Add(yaorukushu);
wuGouShuLiangs.Add(wuGouShuLiang);
bool aa = (zongYaoRuKuShu == shiJiRuKuShu);//bufuhe.Add(zongYaoRuKuShu == shiJiRuKuShu)
bufuhe.Add(aa);
}
else
{
msg += goodsName + "实际入库数大于总入库数!+";
}
}
else
{
msg += goodsName + "总要入库数大于库存上限!+";
}
}
}
if (msg != "")
{
msg = "【<font style='font-size:15px;color:red'>" + wuDingDanJiLuBianMa + "</font>】审核失败,原因如下:+" + msg;
}
else
{
if (shijishus.Count > 0)
{
for (int i = 0; i < shijishus.Count; i++)
{
_myWuDingDanJinCang.AddWdJingCangMingXiChild(repertoryEnterEetailids[i], numberOfUnitss[i], yaorukushus[i], wuGouShuLiangs[i], auditor, Convert.ToDateTime(reviewTime));
_myWuDingDanJinCang.ShenHeUpdataStockShu(shijishus[i], repertoryEnterEetailids[i]);
if (bufuhe[i])
{
_myWuDingDanJinCang.ShenHe_Update_JinCangMingXiDanShenHeFou(repertoryEnterEetailids[i]);
}
}
}
DataTable dt3 = _myWuDingDanJinCang.NoShenHeJinCangMingXi(repertoryEnterid);
if (dt3.Rows.Count == 0)
{
_myWuDingDanJinCang.ShenHe_Update_JinCangDanShenHeFou1(repertoryEnterid);
_myWuDingDanJinCang.ShenHeInsertAuditorAndReviewTime(auditor, Convert.ToDateTime(reviewTime), repertoryEnterid);
}
msg = "审核成功!";
}
return Json(msg, JsonRequestBehavior.AllowGet);
}
#endregion
#region 审核(不分批入库)
public ActionResult ShenHeNoFenPiRuKu(int repertoryEnterid, int repertoryPlaceid, int auditor, string reviewTime)
{
DataTable dt = _myWuDingDanJinCang.ShenHeSelectWdjcDetail(repertoryEnterid);
string msg = "";
var arrstockId = new List<int>();
var zongRuKuShuTim = new List<int>();
for (int i = 0; i < dt.Rows.Count; i++)
{
var shipmentsQuantity = Convert.ToInt32(dt.Rows[i]["Repertory_enter_quantity"]);
var wuGouShuLiang = Convert.ToInt32(dt.Rows[i]["Giveaway_quantity"]);
var goodsid = Convert.ToInt32(dt.Rows[i]["Goods_id"]);
var repertoryEnterEetailid = Convert.ToInt32(dt.Rows[i]["Repertory_enter_detail_id"]);
DataTable dt1 = _myWuDingDanJinCang.SelectStock_quantityBygooodsIdAndRepertoryPlaceId(goodsid, repertoryPlaceid);
var goodName = "";
var zongRuKuShu = shipmentsQuantity + wuGouShuLiang;
if (dt1.Rows.Count > 0)
{
if (Convert.ToInt32(dt1.Rows[0]["Stock_quantity"]) > 0)
{
goodName = dt1.Rows[0]["Goods_name"].ToString();
var stockQuantity = Convert.ToInt32(dt1.Rows[0]["Stock_quantity"]);
var stockId = Convert.ToInt32(dt1.Rows[0]["Stock_id"]);
var stockToplimit = Convert.ToInt32(dt1.Rows[0]["Stock_toplimit"]);
if (zongRuKuShu <= stockToplimit)
{
arrstockId.Add(stockId);
zongRuKuShuTim.Add(zongRuKuShu);
}
else
{
msg += goodName + "库存数为<font style='font-size:15px;'>" + stockQuantity +
"</font><br/>超库存上限为<font style='font-size:15px;color:red'>" + (zongRuKuShu - stockToplimit) +
"</font>+";
}
}
else
{
_myWuDingDanJinCang.ShenheInsertStock(0, repertoryEnterEetailid);
}
}
}
if (msg != "")
{
msg = "审核失败,原因如下:+" + msg;
}
else
{
for (int i = 0; i < zongRuKuShuTim.Count; i++)
{
_myWuDingDanJinCang.UpdateStockQuantity(arrstockId[i], zongRuKuShuTim[i]);
}
_myWuDingDanJinCang.Update_WDJCDOfReview_deny(repertoryEnterid);
_myWuDingDanJinCang.ShenHeInsertAuditorAndReviewTime(auditor, Convert.ToDateTime(reviewTime), repertoryEnterid);
msg = "审核成功!";
}
return Json(msg, JsonRequestBehavior.AllowGet);
}
#endregion
10.3对“审核“按钮的操作,逻辑层代码
#region 审核修改入库数
public void ShenHeUpdataStockShu(int yaorukushu, int repertoryEnterEetailid)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@yaorukushu", SqlDbType.Decimal),
new SqlParameter("@Repertory_enter_detail_id", SqlDbType.Int),
};
sql[0].Value = "ShenHeUpdataStockShu";
sql[1].Value = yaorukushu;
sql[2].Value = repertoryEnterEetailid;
_myDalMethod.DAL_OPTableDB_Par("WuDingDanShangPinJinCang", sql);
}
#endregion
#region 审核修改进仓明细审核否
public void ShenHe_Update_JinCangMingXiDanShenHeFou(int repertoryEnterDetailId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB",SqlDbType.Char),
new SqlParameter("@Repertory_enter_detail_id",SqlDbType.Int),
};
sql[0].Value = "ShenHe_Update_JinCangMingXiDanShenHeFou";
sql[1].Value = repertoryEnterDetailId;
_myDalMethod.DAL_OPTableDB_Par("WuDingDanShangPinJinCang", sql);
}
#endregion
#region 查询未审核进仓所有明细
public DataTable NoShenHeJinCangMingXi(int repertoryEnterid)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_enter_id", SqlDbType.Int),
};
sql[0].Value = "NoShenHeJinCangMingXi";
sql[1].Value = repertoryEnterid;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
#region 查询审核修改进仓单审核否
public void ShenHe_Update_JinCangDanShenHeFou1(int intJinCangId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_enter_id", SqlDbType.Int),
};
sql[0].Value = "ShenHe_Update_JinCangDanShenHeFou1";
sql[1].Value = intJinCangId;
_myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
}
#endregion
#region 审核修改审核人和审核时间
public void ShenHeInsertAuditorAndReviewTime(int auditorId, DateTime reviewTime, int repertoryEnterid)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Auditor_id", SqlDbType.Int),
new SqlParameter("@Review_time", SqlDbType.DateTime),
new SqlParameter("@Repertory_enter_id",SqlDbType.Int),
};
sql[0].Value = "ShenHeInsertAuditorAndReviewTime";
sql[1].Value = auditorId;
sql[2].Value = reviewTime;
sql[3].Value = repertoryEnterid;
_myDalMethod.DAL_OPTableDB_Par("WuDingDanShangPinJinCang", sql);
}
#endregion
#region 查询已入库数
public DataTable SelectYiRuKuShu(int rpdetailid)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_enter_detail_Farid", SqlDbType.Int),
};
sql[0].Value = "SelectYiRuKuShu";
sql[1].Value = rpdetailid;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
#region 审核(不分批入库)
public DataTable ShenHeSelectWdjcDetail(int repertoryEnterid)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_enter_id", SqlDbType.Int),
};
sql[0].Value = "ShenHeSelectWdjcDetail";
sql[1].Value = repertoryEnterid;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
#region 查询库存数量根据商品id,库存地点
public DataTable SelectStock_quantityBygooodsIdAndRepertoryPlaceId(int goodsid, int repertoryPlaceid)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Goods_id", SqlDbType.Int),
new SqlParameter("@Repertory_place_id", SqlDbType.Int),
};
sql[0].Value = "SelectStock_quantityBygooodsIdAndRepertoryPlaceId";
sql[1].Value = goodsid;
sql[2].Value = repertoryPlaceid;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
#region 审核修改库存数
public DataTable UpdateStockQuantity(int stockId, int stockQuantity)
{
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 = stockId;
sql[2].Value = stockQuantity;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
#region 审核修改无订单进仓单审核否
public void Update_WDJCDOfReview_deny(int repertoryEnterid)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_enter_id", SqlDbType.Int),
};
sql[0].Value = "Update_WDJCDOfReview_deny";
sql[1].Value = repertoryEnterid;
DataTable dt = _myDalMethod.DAL_SelectDB_Par("WuDingDanShangPinJinCang", sql);
}
#endregion
10.4对“审核“按钮的操作,存储过程
--审核修改入库数
if(@NB='ShenHeUpdataStockShu')
begin
UPDATE Stock
SET Stock_quantity=Stock_quantity+@yaorukushu
where Repertory_enter_detail_id=@Repertory_enter_detail_id
end
--审核修改进仓明细审核否
if(@NB='ShenHe_Update_JinCangMingXiDanShenHeFou')
begin
UPDATE Repertory_enter_detail
SET Review_deny ='true'
where Repertory_enter_detail_id=@Repertory_enter_detail_id
end
--查询未审核进仓所有明细
if(@NB='NoShenHeJinCangMingXi')
begin
SELECT Repertory_enter_detail_id
FROM Repertory_enter_detail
where Repertory_enter_id=@Repertory_enter_id and Review_deny='false'
end
--查询审核修改进仓单审核否
if(@NB='ShenHe_Update_JinCangDanShenHeFou1')
begin
UPDATE Repertory_enter
SET Review_deny ='true'
where Repertory_enter_id=@Repertory_enter_id
end
---审核修改审核人和审核时间
if(@NB='ShenHeInsertAuditorAndReviewTime')
begin
UPDATE Repertory_enter
SET Auditor_id =@Auditor_id, Review_time =@Review_time, Review_deny ='true'
where Repertory_enter_id=@Repertory_enter_id
end
if(@NB='SelectYiRuKuShu')
begin
SELECT ISNULL(sum(Giveaway_quantity+Repertory_enter_quantity),0) as yirukushu
FROM Repertory_enter_detail
where Repertory_enter_detail_Farid=@Repertory_enter_detail_Farid
end
--审核(不分批入库)
if(@NB='ShenHeSelectWdjcDetail')
begin
SELECT Repertory_enter_detail_id, Goods_id, Repertory_enter_quantity, Giveaway_quantity
FROM Repertory_enter_detail
where Repertory_enter_id=@Repertory_enter_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_WDJCDOfReview_deny')
begin
UPDATE Repertory_enter
SET Review_deny ='true'
where Repertory_enter_id=@Repertory_enter_id
end
11.1对“删除“按钮的操作,JavaScript里界面代码
//修改无订单进仓,明细
function DeleteWDJinCangDan() {
ui.confirm('是否删除???', function (k) {
if (k) {
$.getJSON("/ZiYingWuDingDanJinCang/DeleteWdjcDetail?repertoryEnterid=" + repertoryEnterid,
function (data) {
$.getJSON("/ZiYingWuDingDanJinCang/DeleteWuDingJinCang?repertoryEnterid=" + repertoryEnterid,
function (data1) {
if (data1 > 0) {
ui.alert('删除成功!!!', 1000, false);
qingKong();
} else {
ui.error('删除失败!!!', 1000, false);
}
});
});
}
});
}
11.2对“删除“按钮的操作,控制器操作代码
#region 删除无订单进仓明细
public int DeleteWdjcDetail(int repertoryEnterid)
{
return _myWuDingDanJinCang.DeleteWdjcDetail(repertoryEnterid);
}
#endregion
#region 删除无订单进仓单
public int DeleteWuDingJinCang(int repertoryEnterid)
{
return _myWuDingDanJinCang.DeleteWuDingJinCang(repertoryEnterid);
}
#endregion
11.3对“删除“按钮的操作,逻辑层
#region 删除无订单进仓明细
public int DeleteWdjcDetail(int repertoryEnterId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_enter_id", SqlDbType.Int),
};
sql[0].Value = "DeleteWdjcDetail";
sql[1].Value = repertoryEnterId;
int dt = _myDalMethod.DAL_OPTableDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
#region 删除无订单进仓单
public int DeleteWuDingJinCang(int repertoryEnterId)
{
SqlParameter[] sql =
{
new SqlParameter("@NB", SqlDbType.Char),
new SqlParameter("@Repertory_enter_id", SqlDbType.Int),
};
sql[0].Value = "DeleteWuDingJinCang";
sql[1].Value = repertoryEnterId;
int dt = _myDalMethod.DAL_OPTableDB_Par("WuDingDanShangPinJinCang", sql);
return dt;
}
#endregion
11.3对“删除“按钮的操作,存储过程
end
--删除无订单进仓明细
if(@NB='DeleteWdjcDetail')
begin
DELETE FROM Repertory_enter_detail
where Repertory_enter_id=@Repertory_enter_id
end
--删除无订单进仓单
if(@NB='DeleteWuDingJinCang')
begin
DELETE FROM Repertory_enter
where Repertory_enter_id=@Repertory_enter_id
end
仅供初学者使用,禁止商业用途。
宝剑锋从磨砺出,梅花香自苦寒来。
笔落惊风雨,诗成泣鬼神。