Browse Source

优化门槛bom和装配计划

master
周红军 3 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 MESWebSite.CommonClass;
using System;
using System.Collections.Generic;
using System.Linq;
@ -78,14 +80,42 @@ namespace MESWebSite.HttpHandlers
string PartNo1 = Request.Params["PartNo1"];
string PartNo2 = Request.Params["PartNo2"];
string IsChecked = Request.Params["IsChecked"];
string IsPartAssemble = Request.Params["IsPartAssemble"];
string StationNo = Request.Params["StationNo"];
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();
tb_Bom_MK md = new tb_Bom_MK();
md.PartNo1 = PartNo1;
md.PartNo2 = PartNo2;
md.PlaceName = PlaceName;
md.StationNo = StationNo;
if(IsPartAssemble == "1")
{
md.IsPartAssemble = 1;
}
else
{
md.IsPartAssemble = 0;
}
if (IsChecked == "1")
{
md.IsChecked = true;
@ -100,14 +130,14 @@ namespace MESWebSite.HttpHandlers
if (BomID == "0")
{
//新增
md.BomID = Guid.NewGuid().ToString();
Response.Write(bll.AddInfo(md) == true ? "true" : "false");
//md.BomID = Guid.NewGuid().ToString();
Response.Write(bll.AddInfo(md) == true ? ResponseResult.Success() : ResponseResult.Fail("添加失败"));
}
else
{
//修改
md.BomID = BomID;
Response.Write(bll.UpdateInfo(md) == true ? "true" : "false");
md.BomID = int.Parse(BomID);
Response.Write(bll.UpdateInfo(md) == true ? ResponseResult.Success() : ResponseResult.Fail("更新失败"));
}
Response.End();
}
@ -117,7 +147,7 @@ namespace MESWebSite.HttpHandlers
Bom_MKBLL bll = new Bom_MKBLL();
tb_Bom_MK md = new tb_Bom_MK();
md.BomID = BomID;
md.BomID = int.Parse(BomID);
var info = Request.Cookies.Get("LoginUserInfo");
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.Model;
using MESWebSite.CommonClass;
using MESWebSite.Export;
using MESWebSite.Manage;
using MESWebSite.Tool;
using NPOI.XSSF.UserModel;
using System;
@ -29,7 +31,7 @@ namespace MESWebSite.HttpHandlers
{
string ID = GetParam("ID");
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();
}
@ -60,16 +62,62 @@ namespace MESWebSite.HttpHandlers
DateTime orderDate;
if (!DateTime.TryParse(GetParam("OrderDate"), out orderDate))
{
Response.Write("false");
Response.Write(ResponseResult.Fail("装配日期错误!"));
Response.End();
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();
tb_ZP_MK_Plan zpp = new tb_ZP_MK_Plan
{
ID = id,
//StationID = stationID,
PartNo = partNo,
OrderDate = orderDate,
OrderCount = orderCount,

63
MESWebSite/Manage/Bom_MK.aspx

@ -120,6 +120,26 @@
</td>
</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>
<td class="title" style="width: 110px;">
<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 },
]],
@ -257,12 +288,19 @@
var PartNo1 = $('#fl_id_1').combo('getValue');
var PartNo2 = $('#fl_id_2').combo('getValue');
var PlaceName = $('#PlaceName').val();
var StationNo = $('#StationNo').val();
var IsChecked = 0;
if ($('#IsChecked').is(':checked')) {
IsChecked = 1;
}
var IsPartAssemble = 0;
if ($('#IsPartAssemble').is(':checked')) {
IsPartAssemble = 1;
}
if (PartNo1 == "") {
$.messager.alert('提示', '注塑件不能为空,请重新输入', 'warning');
return;
@ -271,16 +309,23 @@
$.messager.alert('提示', '塑料粒子不能为空,请重新输入', 'warning');
return;
}
if (StationNo == "") {
$.messager.alert('提示', '工位号不能为空,请重新输入', 'warning');
return;
}
if (PlaceName == "") {
$.messager.alert('提示', '地点不能为空,请重新输入', 'warning');
return;
}
var model = {
BomID: BomID,
PartNo1: PartNo1,
PartNo2: PartNo2,
IsChecked: IsChecked,
IsPartAssemble: IsPartAssemble,
StationNo: StationNo,
PlaceName: PlaceName,
method: 'SaveInfo'
};
@ -292,14 +337,15 @@
async: false,
url: "/HttpHandlers/Bom_MKHandler.ashx",
data: model,
success: function (data) {
if (data == 'true') {
dataType: 'json',
success: function (res) {
if (res.IsSuccess) {
$.messager.alert('提示', '已保存', 'info');
dg.datagrid('reload');
$('#w').window('close');
}
else {
$.messager.alert('提示', '保存失败,请查看是否编号重复', 'warning');
$.messager.alert('错误', res.Message, 'warning');
}
},
@ -348,7 +394,14 @@
$('#IsChecked').prop("checked", "checked")
}
if (row.IsPartAssemble == 0) {
$('#IsPartAssemble').removeAttr("checked")
} else {
$('#IsPartAssemble').prop("checked", "checked")
}
$('#PlaceName').val(row.PlaceName);
$('#StationNo').val(row.StationNo);
$('#w').window('open');
}
@ -396,8 +449,10 @@
$('#fl_id_1').combo('clear');
$('#fl_id_2').combo('clear');
$('#IsChecked').removeAttr("checked")
$('#IsChecked').removeAttr("checked");
$('#IsPartAssemble').removeAttr("checked");
$('#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;"/>
</td>
<td style="width: 380px;"> 装配日期:
<input id="start_time" class="easyui-datebox" style="width: 130px; height: 30px;" data-options="required:false" />
<input id="end_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-datetimebox" style="width: 130px; height: 30px;" data-options="onShowPanel:function(){ $(this).datetimebox('spinner').timespinner('setValue','23:59:59');}" />
</td>
<td style="width: 80px;"><a class="topsearchBtn">查询</a></td>
@ -159,7 +159,7 @@
</p>
</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>
</tr>
</table>
@ -278,13 +278,14 @@
{ field: 'OrderCount', 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) {
var pa = /.*\((.*)\)/;
var unixtime = date.match(pa)[1].substring(0, 10);
return getTime(unixtime).substring(0, 10);
return getTime(unixtime).substring(0, 19);
}
}
},
]],
pagination: true,//表示在datagrid设置分页
@ -323,6 +324,22 @@
if (OrderName == "") {
$.messager.alert('提示', '计划名称不能为空,请重新输入', 'warning');
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 = {
@ -400,7 +417,7 @@
$('#Station').val(row.Station);
var pa = /.*\((.*)\)/;
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');
}
//删除方法

Loading…
Cancel
Save