You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

561 lines
21 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HW_production.aspx.cs" Inherits="TradeManageNew.Huowu.HW_production" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>货物信息</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
<link rel="stylesheet" type="text/css" href="../themes/DataGrid.css" />
<script src="../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../Scripts/jquery.min.js" type="text/javascript"></script>
<script src="../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../Scripts/DataGrid.js" type="text/javascript"></script>
<script src="../Scripts/DataPager.js" type="text/javascript"></script>
<script src="../Scripts/jquery.bgiframe.min.js" type="text/javascript"></script>
<script src="../Scripts2/Global.js" type="text/javascript"></script>
<script src="../Scripts/jquery.url.js" type="text/javascript"></script>
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
<script src="../Scripts/jquery.cookies.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox/jquery.fancybox-1.3.4.css"
media="screen" />
<script type="text/javascript" src="../Scripts/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="../Scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="../Scripts/LodopFuncs.js" type="text/javascript"></script>
<script src="../Scripts/MaskedTextBox.js" type="text/javascript"></script>
<script src="../Scripts/JSLINQ.js" type="text/javascript"></script>
<script type="text/javascript">
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
var datagrid2 = new nblf.ui.DataGrid("DataGrid2");
var WindowLoadModel = new WindowLoad();
var did = 0;
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
CreateDataGrid2();
GetWeek();
GetWeek2()
CreateDataGrid();
ReadData();
$("#cmdAdd").click(function () {
Model = new Object();
Model.id = 0;
// ClearControlValue("MainTable"); //清空内容
//var CurrentDate = new Date();
//$("#txtInDate").val(CurrentDate.localeFormat("yyyy-MM-dd"));
$("#txtnum").val();
ShowFancybox("test");
});
$("span[gid]").live("click", function () {
var id = $(this).attr("gid");
var wname = $(this).attr("wname");
var sku = $(this).attr("sku");
did = id;
GetModel(id, wname, sku);
GetModelData(id);
ShowFancybox("test");
});
$("#btn_sch").bind("click", function () {
GetWeek2();
CreateDataGrid();
ReadData();
});
});
//#region 读取数据
function GetModel(id,wname,sku) {
var param = new Object();
param.id = id;
param.weekname = wname;
$("#txt_sku").val(sku);
$("#select_week").val(wname);
$("#txtnum").val("");
$.ajax({
url: "../HuoWuServiceNew.asmx/GetModel_ProductionDetail",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
if (data.d != null) {
$("#txtnum").val(data.d.weeknum);
}
}
});
}
//#endregion
//#region 读取数据
function GetModelData(mid) {
var param = new Object();
param.mid = mid;
$.ajax({
url: "../HuoWuServiceNew.asmx/GetListProductionPlanDetail2",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
datagrid2.DataBind(data.d);
}
});
}
//#endregion
function GetWeek() {
$("#select_week").append("<option value='0'>-选择-</option>");
$.ajax({
url: "../HuoWuServiceNew.asmx/GetHW_WeekNameList",
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
$(data.d).each(function () {
if(this.IsNow==1)
$("#select_sweek").append("<option value='" + this.WeekName + "' stime='" + this.SDate.localeFormat("yyyy-MM-dd") + "' etime='" + this.EDate.localeFormat("yyyy-MM-dd") + "' selected='selected'>" + this.WeekName + "</option>");
else
$("#select_sweek").append("<option value='" + this.WeekName + "' stime='" + this.SDate.localeFormat("yyyy-MM-dd") + "' etime='" + this.EDate.localeFormat("yyyy-MM-dd") + "'>" + this.WeekName + "</option>");
if (this.IsNow == 2)
$("#select_eweek").append("<option value='" + this.WeekName + "' stime='" + this.SDate.localeFormat("yyyy-MM-dd") + "' etime='" + this.EDate.localeFormat("yyyy-MM-dd") + "' selected='selected'>" + this.WeekName + "</option>");
else
$("#select_eweek").append("<option value='" + this.WeekName + "' stime='" + this.SDate.localeFormat("yyyy-MM-dd") + "' etime='" + this.EDate.localeFormat("yyyy-MM-dd") + "'>" + this.WeekName + "</option>");
$("#select_week").append("<option value='" + this.WeekName + "' stime='" + this.SDate.localeFormat("yyyy-MM-dd") + "' etime='" + this.EDate.localeFormat("yyyy-MM-dd") + "'>" + this.WeekName + "</option>");
});
}
}
});
}
function GetWeek2() {
var param = new Object();
param.SDate = $("#select_sweek").find("option:selected").attr("stime");
param.EDate = $("#select_eweek").find("option:selected").attr("stime");
$.ajax({
url: "../HuoWuServiceNew.asmx/GetHW_WeekNameList2",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
wlist = data.d;
}
});
}
function fopen() {
$.fancybox({
'width': '40%',
'height': '40%',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#test',
'onComplete': function () {
}
});
}
//#endregion
var wlist = null;
//#region 初始化DataGrid
function CreateDataGrid() {
Array.clear(datagrid1.Columns);
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "图片";
col.CellTemplate = "<a CommandName='cmdImg' class='linka'><img src='{Bind imgurl}' alt='' width='50px' height='50px'/></a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "编号sku";
col.CellTemplate = "<span>{Bind goodscode}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "E仓库存";
col.CellTemplate = "<a>{Bind EastNum}</a>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "W仓库存";
col.CellTemplate = "<span>{Bind WestNum}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "单位体积";
col.CellTemplate = "<span>{Bind Solid}</span>";
Array.add(datagrid1.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "生产中数量";
col.CellTemplate = "<span>{Bind tnum1}</span>";
Array.add(datagrid1.Columns, col);
$(wlist).each(function () {
col = new nblf.ui.DataGridColumn();
col.HeaderText = this.WeekName2;
col.CellTemplate = "<span gid='{Bind id}' wname='" + this.WeekName + "' style='cursor:pointer;color:blue' sku='{Bind goodscode}'>0</span>";
Array.add(datagrid1.Columns, col);
});
// col = new nblf.ui.DataGridColumn();
// col.HeaderText = "操作";
// col.Width = "100px";
// col.CellTemplate = "<span onclick='DelCol(this)' style='color: #0000FF;cursor:pointer;text-decoration: underline;'>删除</span>";
// Array.add(datagrid1.Columns, col);
datagrid1.SetPageSize(20);
datagrid1.SetPageIndex(1);
datagrid1.IsFixHeader = false;
datagrid1.ShowIndexColumn = false;
datagrid1.AllowPaging = true;
datagrid1.Width = "100%";
datagrid1.SelectMode = nblf.ui.SelectMode.None;
datagrid1.Init();
datagrid1.add_PageIndexChanged(function () { ReadData(); });
}
function CreateDataGrid2() {
var col = new nblf.ui.DataGridColumn();
col.HeaderText = "周次";
col.CellTemplate = "<span>{Bind weekname}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "生产中数量";
col.CellTemplate = "<span>{Bind weeknum}</span>";
Array.add(datagrid2.Columns, col);
col = new nblf.ui.DataGridColumn();
col.HeaderText = "操作";
col.Width = "100px";
col.CellTemplate = "<span onclick='DelCol2(this)' style='color: #0000FF;cursor:pointer;text-decoration: underline;'>删除</span>";
Array.add(datagrid2.Columns, col);
datagrid2.SetPageSize(20);
datagrid2.SetPageIndex(1);
datagrid2.IsFixHeader = false;
datagrid2.ShowIndexColumn = false;
datagrid2.AllowPaging = false;
datagrid2.Width = "100%";
datagrid2.SelectMode = nblf.ui.SelectMode.None;
datagrid2.Init();
// datagrid2.add_PageIndexChanged(function () { ReadData(); });
}
//#endregion
//#region 读取数据
function ReadData() {
var param = new Object();
//param.SortId = SortId;
CreateWhere("SelectHtml", param); //读取查询条件
param.cs = Base64.encode(param.cs);
param.PageSize = datagrid1.Get_PageSize();
param.PageIndex = datagrid1.Get_PageIndex();
WindowLoadModel.Show();
$.ajax({
url: "../HuoWuServiceNew.asmx/GetListProductionPlan",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
datagrid1.Set_RowCount(data.d.RowCount);
datagrid1.DataBind(data.d.DataSource);
if (data.d.DataSource != null && data.d.DataSource.length > 0)
ReadData2(data.d.DataSource[0].mids);
}
});
}
//#endregion
//#region 读取数据
function ReadData2(mids) {
var param = new Object();
param.mids = mids;
$.ajax({
url: "../HuoWuServiceNew.asmx/GetListProductionPlanDetail",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
if (data.d != null) {
$(data.d).each(function () {
if(this.weeknum!=null)
$("span[gid='" + this.mid + "'][wname='" + this.weekname + "']").html(this.weeknum);
});
}
}
});
}
//#endregion
//#region 删除
function DelCol(obj) {
if (window.confirm('确定要删除吗?') == false) return;
var rowindex = $(obj).parent().parent().attr("index");
var param = new Object();
var model = datagrid1.Get_Model(rowindex);
param.id = model.id;
$.ajax({
url: "../HuoWuServiceNew.asmx/Delete_Production",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
alert("删除成功");
ReadData();
}
});
}
function DelCol2(obj) {
if (window.confirm('确定要删除吗?') == false) return;
var rowindex = $(obj).parent().parent().attr("index");
var param = new Object();
var model = datagrid2.Get_Model(rowindex);
param.id = model.id;
$.ajax({
url: "../HuoWuServiceNew.asmx/Delete_ProductionDetail",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
alert("删除成功");
datagrid2.Del_Row(rowindex);
}
});
}
//#region 导出
function ExportData() {
// if ($("#txt_postion").val() == "" && $("#txt_goodsname").val()=="") {
// alert("请至少输入一个查询条件");
// return;
// }
var param = new Object();
//param.SortId = SortId;
param.PostionCode = $("#txt_postion").val();
param.GoodsName = $("#txt_goodsname").val();
param.StoreId = $("#select_ck").val();
var dd = new Date();
var fname = "盘库数据(" + dd.getFullYear() + "." + (dd.getMonth() + 1) + "." + dd.getDate() + ").xls";
$.ajax({
url: "../HuoWuServiceNew.asmx/GetList_GoodsLeftExcel",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
async: false,
success: function (data) {
params = { FilePath: data.d, FileName: fname };
window.location = "../GlobalAshx/DownFile.ashx?" + jQuery.param(params);
}
});
}
//#endregion
//#region 显示弹出窗体
function ShowFancybox(id) {
$.fancybox({
'scrolling': 'no',
'autoScale': false,
'transitionIn': 'elastic',
'transitionOut': 'elastic',
'href': '#' + id,
'onClosed': function () {
}
}, 0);
}
//#endregion
var Model = null;
//#region 保存
function Save() {
if ($("#txt_sku").val() == "") {
alert("sku不能为空");
return;
}
if ($("#txtnum").val() == "") {
alert("生产中数量不能为空");
return;
}
if (Model == null)
Model = new Object();
var param = new Object();
Model.detailid = did;
Model.goodscode = $("#txt_sku").val();
var glist = new Array();
var gmd = new Object();
gmd.sdate = $("#select_week").find("option:selected").attr("stime");
gmd.edate = $("#select_week").find("option:selected").attr("etime");
gmd.weekname = $("#select_week").find("option:selected").text();
gmd.weeknum = $("#txtnum").val();
Array.add(glist, gmd);
Model.ListModel = glist;
param.Model = Model;
WindowLoadModel.Show();
$.ajax({
url: "../HuoWuServiceNew.asmx/Save_Production",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
success: function (data) {
WindowLoadModel.Hide();
if (data.d == 0) {
alert("货物sku不存在请确定输入是否正确");
return;
}
ReadData();
alert("保存成功");
$.fancybox.close();
}
});
}
//#endregion
</script>
</head>
<body class="headbody">
<div class="title_ico">
货物生产计划信息
</div>
<div style="display: none">
<div id="test" title="货物图片" style="width: 500px; height: 500px;">
<table class="tableAll" style="width: 100%;">
<colgroup>
<col style="width: 80px;" />
<col />
</colgroup>
<tr>
<td class="f1" >编号sku</td>
<td><input id='txt_sku' type='text' style='width: 99%' /></td>
</tr>
<tr>
<td class="f1" >周次</td>
<td><select id="select_week" style="height:30px">
</select></td>
</tr>
<tr>
<td class="f1" >生产中数量</td>
<td><input id='txtnum' type='text' style='width: 99%' /></td>
</tr>
<tr>
<td colspan="2" align="center">
<input id="cmdSave" type="button" value="保存" onclick="Save();" class="btnClass btnClassSave"/>
</td>
</tr>
<tr>
<td colspan="2"> <div id="DataGrid2" class="DataGridStyle" style="overflow:auto;height:300px"></div></td>
</tr>
</table>
</div>
</div>
<table id="SelectHtml" class="tableAll" style="width: 100%;">
<tr>
<td style="width: 10%;">
编号:</td>
<td width="15%">
<input id="txt_goodsname" class="editTextbox" style="width: 120px;" type="text" where="(b.sku1 like '%@value%' or c.GoodsCode like '%@value%')" /></td>
<td style="width: 10%;">
生产中数量:</td>
<td width="15%">大于
<input id="txt_num" class="editTextbox" style="width: 120px;" type="text" where="b.GoodsInNum>='@value'" value='0'/></td>
<td>
<input id="btn_sch" class="btnClass btnClassFind" type="button" value="查询" /></td>
</tr>
<tr>
<td style="width: 10%;">
显示周次:</td>
<td colspan="4"><select id="select_sweek" style="height:30px">
</select>----<select id="select_eweek" style="height:30px">
</select>
</td>
</tr>
<tr style='display:none'>
<td colspan="5">
<input id="cmdAdd" type="button" value="新增" class="btnClass btnClassAdd"/>
</td>
</tr>
<tr>
<td valign="top" colspan="5">
<div id="DataGrid1" class="DataGridStyle"></div>
</td>
</tr>
</table>
</body>
</html>