Browse Source

优化门槛bom和装配计划

master
周红军 5 days ago
parent
commit
0ef0e20848
  1. 42
      MESWebSite/HttpHandlers/Bom_MKHandler.ashx.cs
  2. 58
      MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs
  3. 63
      MESWebSite/Manage/Bom_MK.aspx
  4. 31
      MESWebSite/Manage/ZP_MK_Plan.aspx

42
MESWebSite/HttpHandlers/Bom_MKHandler.ashx.cs

@ -1,5 +1,7 @@
using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.BLL;
using MESClassLibrary.BLL.BasicInfo;
using MESClassLibrary.EFModel; using MESClassLibrary.EFModel;
using MESWebSite.CommonClass;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -78,14 +80,42 @@ namespace MESWebSite.HttpHandlers
string PartNo1 = Request.Params["PartNo1"]; string PartNo1 = Request.Params["PartNo1"];
string PartNo2 = Request.Params["PartNo2"]; string PartNo2 = Request.Params["PartNo2"];
string IsChecked = Request.Params["IsChecked"]; string IsChecked = Request.Params["IsChecked"];
string IsPartAssemble = Request.Params["IsPartAssemble"];
string StationNo = Request.Params["StationNo"];
string PlaceName = Request.Params["PlaceName"]; string PlaceName = Request.Params["PlaceName"];
string stationNo = "";
BasicBLL<tb_Station> stationDB = new BasicBLL<tb_Station>();
var stationList = stationDB.Search<tb_Station>(p => p.StationNo == StationNo);
if (stationList != null && stationList.Count > 0)
{
stationNo = stationList[0].StationNo;
}
if (string.IsNullOrEmpty(stationNo))
{
Response.Write(ResponseResult.Fail("工位号不存在!"));
Response.End();
return;
}
Bom_MKBLL bll = new Bom_MKBLL(); Bom_MKBLL bll = new Bom_MKBLL();
tb_Bom_MK md = new tb_Bom_MK(); tb_Bom_MK md = new tb_Bom_MK();
md.PartNo1 = PartNo1; md.PartNo1 = PartNo1;
md.PartNo2 = PartNo2; md.PartNo2 = PartNo2;
md.PlaceName = PlaceName; md.PlaceName = PlaceName;
md.StationNo = StationNo;
if(IsPartAssemble == "1")
{
md.IsPartAssemble = 1;
}
else
{
md.IsPartAssemble = 0;
}
if (IsChecked == "1") if (IsChecked == "1")
{ {
md.IsChecked = true; md.IsChecked = true;
@ -100,14 +130,14 @@ namespace MESWebSite.HttpHandlers
if (BomID == "0") if (BomID == "0")
{ {
//新增 //新增
md.BomID = Guid.NewGuid().ToString(); //md.BomID = Guid.NewGuid().ToString();
Response.Write(bll.AddInfo(md) == true ? "true" : "false"); Response.Write(bll.AddInfo(md) == true ? ResponseResult.Success() : ResponseResult.Fail("添加失败"));
} }
else else
{ {
//修改 //修改
md.BomID = BomID; md.BomID = int.Parse(BomID);
Response.Write(bll.UpdateInfo(md) == true ? "true" : "false"); Response.Write(bll.UpdateInfo(md) == true ? ResponseResult.Success() : ResponseResult.Fail("更新失败"));
} }
Response.End(); Response.End();
} }
@ -117,7 +147,7 @@ namespace MESWebSite.HttpHandlers
Bom_MKBLL bll = new Bom_MKBLL(); Bom_MKBLL bll = new Bom_MKBLL();
tb_Bom_MK md = new tb_Bom_MK(); tb_Bom_MK md = new tb_Bom_MK();
md.BomID = BomID; md.BomID = int.Parse(BomID);
var info = Request.Cookies.Get("LoginUserInfo"); var info = Request.Cookies.Get("LoginUserInfo");
if (info != null) if (info != null)
{ {

58
MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs

@ -1,8 +1,10 @@
using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.BLL;
using MESClassLibrary.BLL.BasicInfo;
using MESClassLibrary.EFModel; using MESClassLibrary.EFModel;
using MESClassLibrary.Model; using MESClassLibrary.Model;
using MESWebSite.CommonClass; using MESWebSite.CommonClass;
using MESWebSite.Export; using MESWebSite.Export;
using MESWebSite.Manage;
using MESWebSite.Tool; using MESWebSite.Tool;
using NPOI.XSSF.UserModel; using NPOI.XSSF.UserModel;
using System; using System;
@ -29,7 +31,7 @@ namespace MESWebSite.HttpHandlers
{ {
string ID = GetParam("ID"); string ID = GetParam("ID");
ZP_MK_PlanBLL bll = new ZP_MK_PlanBLL(); ZP_MK_PlanBLL bll = new ZP_MK_PlanBLL();
Response.Write(bll.DeleteInfo(new tb_ZP_MK_Plan() { ID = ID }) ? ResponseResult.Success() : ResponseResult.Fail("删除失败")); Response.Write(bll.DeleteInfo(new tb_ZP_MK_Plan() { ID = int.Parse(ID) }) ? ResponseResult.Success() : ResponseResult.Fail("删除失败"));
Response.End(); Response.End();
} }
@ -60,16 +62,62 @@ namespace MESWebSite.HttpHandlers
DateTime orderDate; DateTime orderDate;
if (!DateTime.TryParse(GetParam("OrderDate"), out orderDate)) if (!DateTime.TryParse(GetParam("OrderDate"), out orderDate))
{ {
Response.Write("false"); Response.Write(ResponseResult.Fail("装配日期错误!"));
Response.End(); Response.End();
return; return;
}; };
string lineName = "";
BasicBLL<tb_Line> lineDB = new BasicBLL<tb_Line>();
var lineList = lineDB.Search<tb_Line>(p => p.LineName == line);
if (lineList != null && lineList.Count > 0)
{
lineName = lineList[0].LineName;
}
if (string.IsNullOrEmpty(lineName))
{
Response.Write(ResponseResult.Fail("产线不存在!"));
Response.End();
return;
}
string stationNo = "";
BasicBLL<tb_Station> stationDB = new BasicBLL<tb_Station>();
var stationList = stationDB.Search<tb_Station>(p => p.StationNo == station);
if (stationList != null && stationList.Count > 0)
{
stationNo = stationList[0].StationNo;
}
if (string.IsNullOrEmpty(stationNo))
{
Response.Write(ResponseResult.Fail("工位号不存在!"));
Response.End();
return;
}
string partNo1 = "";
BasicBLL<tb_Bom_MK> partNo1DB = new BasicBLL<tb_Bom_MK>();
var partNo1List = partNo1DB.Search<tb_Bom_MK>(p => p.PartNo1 == partNo);
if (partNo1List != null && partNo1List.Count > 0)
{
partNo1 = partNo1List[0].StationNo;
}
if (string.IsNullOrEmpty(partNo1))
{
Response.Write(ResponseResult.Fail(partNo + " 产品名称未在Bom中配置!"));
Response.End();
return;
}
ZP_MK_PlanBLL bll = new ZP_MK_PlanBLL(); ZP_MK_PlanBLL bll = new ZP_MK_PlanBLL();
tb_ZP_MK_Plan zpp = new tb_ZP_MK_Plan tb_ZP_MK_Plan zpp = new tb_ZP_MK_Plan
{ {
ID = id,
//StationID = stationID,
PartNo = partNo, PartNo = partNo,
OrderDate = orderDate, OrderDate = orderDate,
OrderCount = orderCount, OrderCount = orderCount,

63
MESWebSite/Manage/Bom_MK.aspx

@ -120,6 +120,26 @@
</td> </td>
</tr> </tr>
<tr>
<td class="title" style="width: 110px;">
<p>
是否半成品:
</p>
</td>
<td colspan="2">
<input id="IsPartAssemble" type="checkbox"/>
</td>
</tr>
<tr>
<td class="title" style="width: 110px;">
<p>
工位号:
</p>
</td>
<td colspan="2">
<input id="StationNo" type="text" class="text" style="width: 220px; height: 30px;" /><span style="color: red; font-size: 18px; vertical-align: middle;">*</span>
</td>
</tr>
<tr> <tr>
<td class="title" style="width: 110px;"> <td class="title" style="width: 110px;">
<p> <p>
@ -231,6 +251,17 @@
} }
} }
}, },
{
field: 'IsPartAssemble', title: '是否半成品', sortable: 'true', width: 10,
formatter: function (value) {
if (value == 1) {
return "是";
} else {
return "否";
}
}
},
{ field: 'StationNo', title: '工位号', sortable: 'true', width: 10 },
{ field: 'PlaceName', title: '地点', sortable: 'true', width: 10 }, { field: 'PlaceName', title: '地点', sortable: 'true', width: 10 },
]], ]],
@ -257,12 +288,19 @@
var PartNo1 = $('#fl_id_1').combo('getValue'); var PartNo1 = $('#fl_id_1').combo('getValue');
var PartNo2 = $('#fl_id_2').combo('getValue'); var PartNo2 = $('#fl_id_2').combo('getValue');
var PlaceName = $('#PlaceName').val(); var PlaceName = $('#PlaceName').val();
var StationNo = $('#StationNo').val();
var IsChecked = 0; var IsChecked = 0;
if ($('#IsChecked').is(':checked')) { if ($('#IsChecked').is(':checked')) {
IsChecked = 1; IsChecked = 1;
} }
var IsPartAssemble = 0;
if ($('#IsPartAssemble').is(':checked')) {
IsPartAssemble = 1;
}
if (PartNo1 == "") { if (PartNo1 == "") {
$.messager.alert('提示', '注塑件不能为空,请重新输入', 'warning'); $.messager.alert('提示', '注塑件不能为空,请重新输入', 'warning');
return; return;
@ -271,16 +309,23 @@
$.messager.alert('提示', '塑料粒子不能为空,请重新输入', 'warning'); $.messager.alert('提示', '塑料粒子不能为空,请重新输入', 'warning');
return; return;
} }
if (StationNo == "") {
$.messager.alert('提示', '工位号不能为空,请重新输入', 'warning');
return;
}
if (PlaceName == "") { if (PlaceName == "") {
$.messager.alert('提示', '地点不能为空,请重新输入', 'warning'); $.messager.alert('提示', '地点不能为空,请重新输入', 'warning');
return; return;
} }
var model = { var model = {
BomID: BomID, BomID: BomID,
PartNo1: PartNo1, PartNo1: PartNo1,
PartNo2: PartNo2, PartNo2: PartNo2,
IsChecked: IsChecked, IsChecked: IsChecked,
IsPartAssemble: IsPartAssemble,
StationNo: StationNo,
PlaceName: PlaceName, PlaceName: PlaceName,
method: 'SaveInfo' method: 'SaveInfo'
}; };
@ -292,14 +337,15 @@
async: false, async: false,
url: "/HttpHandlers/Bom_MKHandler.ashx", url: "/HttpHandlers/Bom_MKHandler.ashx",
data: model, data: model,
success: function (data) { dataType: 'json',
if (data == 'true') { success: function (res) {
if (res.IsSuccess) {
$.messager.alert('提示', '已保存', 'info'); $.messager.alert('提示', '已保存', 'info');
dg.datagrid('reload'); dg.datagrid('reload');
$('#w').window('close'); $('#w').window('close');
} }
else { else {
$.messager.alert('提示', '保存失败,请查看是否编号重复', 'warning'); $.messager.alert('错误', res.Message, 'warning');
} }
}, },
@ -348,7 +394,14 @@
$('#IsChecked').prop("checked", "checked") $('#IsChecked').prop("checked", "checked")
} }
if (row.IsPartAssemble == 0) {
$('#IsPartAssemble').removeAttr("checked")
} else {
$('#IsPartAssemble').prop("checked", "checked")
}
$('#PlaceName').val(row.PlaceName); $('#PlaceName').val(row.PlaceName);
$('#StationNo').val(row.StationNo);
$('#w').window('open'); $('#w').window('open');
} }
@ -396,8 +449,10 @@
$('#fl_id_1').combo('clear'); $('#fl_id_1').combo('clear');
$('#fl_id_2').combo('clear'); $('#fl_id_2').combo('clear');
$('#IsChecked').removeAttr("checked") $('#IsChecked').removeAttr("checked");
$('#IsPartAssemble').removeAttr("checked");
$('#PlaceName').val(''); $('#PlaceName').val('');
$('#StationNo').val('');
} }

31
MESWebSite/Manage/ZP_MK_Plan.aspx

@ -62,8 +62,8 @@
<input type="text" id="part_no_s" style="width: 140px;"/> <input type="text" id="part_no_s" style="width: 140px;"/>
</td> </td>
<td style="width: 380px;"> 装配日期: <td style="width: 380px;"> 装配日期:
<input id="start_time" class="easyui-datebox" style="width: 130px; height: 30px;" data-options="required:false" /> <input id="start_time" class="easyui-datetimebox" style="width: 130px; height: 30px;" data-options="onShowPanel:function(){ $(this).datetimebox('spinner').timespinner('setValue','00:00:00');}" />
<input id="end_time" class="easyui-datebox" style="width: 130px; height: 30px;" data-options="required:false" /> <input id="end_time" class="easyui-datetimebox" style="width: 130px; height: 30px;" data-options="onShowPanel:function(){ $(this).datetimebox('spinner').timespinner('setValue','23:59:59');}" />
</td> </td>
<td style="width: 80px;"><a class="topsearchBtn">查询</a></td> <td style="width: 80px;"><a class="topsearchBtn">查询</a></td>
@ -159,7 +159,7 @@
</p> </p>
</td> </td>
<td> <td>
<input id="OrderDate" class="easyui-datebox" style="width: 180px; height: 30px;" data-options="required:true" /> <input id="OrderDate" class="easyui-datetimebox" style="width: 180px; height: 30px;" data-options="required:true" />
</td> </td>
</tr> </tr>
</table> </table>
@ -278,13 +278,14 @@
{ field: 'OrderCount', title: '计划数量', sortable: 'true', width: 10 }, { field: 'OrderCount', title: '计划数量', sortable: 'true', width: 10 },
{ field: 'ProductCount', title: '生产数量', sortable: 'true', width: 10 }, { field: 'ProductCount', title: '生产数量', sortable: 'true', width: 10 },
{ {
field: 'OrderDate', title: '装配日期', sortable: 'true', width: 10, field: 'OrderDate', title: '装配时间', sortable: 'true', width: 10,
formatter: function (date) { formatter: function (date) {
var pa = /.*\((.*)\)/; var pa = /.*\((.*)\)/;
var unixtime = date.match(pa)[1].substring(0, 10); var unixtime = date.match(pa)[1].substring(0, 10);
return getTime(unixtime).substring(0, 10); return getTime(unixtime).substring(0, 19);
} }
} },
]], ]],
pagination: true,//表示在datagrid设置分页 pagination: true,//表示在datagrid设置分页
@ -323,6 +324,22 @@
if (OrderName == "") { if (OrderName == "") {
$.messager.alert('提示', '计划名称不能为空,请重新输入', 'warning'); $.messager.alert('提示', '计划名称不能为空,请重新输入', 'warning');
return; return;
}
if (Line == "") {
$.messager.alert('提示', '线路不能为空,请重新输入', 'warning');
return;
}
if (Station == "") {
$.messager.alert('提示', '工位号不能为空,请重新输入', 'warning');
return;
}
if (OrderCount == "") {
$.messager.alert('提示', '计划数量不能为空,请重新输入', 'warning');
return;
}
if (OrderDate == "") {
$.messager.alert('提示', '装配日期不能为空,请重新输入', 'warning');
return;
} }
var model = { var model = {
@ -400,7 +417,7 @@
$('#Station').val(row.Station); $('#Station').val(row.Station);
var pa = /.*\((.*)\)/; var pa = /.*\((.*)\)/;
var unixtime = row.OrderDate.match(pa)[1].substring(0, 10); var unixtime = row.OrderDate.match(pa)[1].substring(0, 10);
$('#OrderDate').datebox('setValue', getTime(unixtime).substring(0, 10)) $('#OrderDate').datetimebox('setValue', getTime(unixtime).substring(0, 19));
$('#w').window('open'); $('#w').window('open');
} }
//删除方法 //删除方法

Loading…
Cancel
Save