diff --git a/MESWebSite/HttpHandlers/Bom_MKHandler.ashx.cs b/MESWebSite/HttpHandlers/Bom_MKHandler.ashx.cs index af0fe98..33e42c5 100644 --- a/MESWebSite/HttpHandlers/Bom_MKHandler.ashx.cs +++ b/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 stationDB = new BasicBLL(); + var stationList = stationDB.Search(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) { diff --git a/MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs b/MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs index f03b245..2ddeb73 100644 --- a/MESWebSite/HttpHandlers/ZP_MK_PlanHandler.ashx.cs +++ b/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 lineDB = new BasicBLL(); + var lineList = lineDB.Search(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 stationDB = new BasicBLL(); + var stationList = stationDB.Search(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 partNo1DB = new BasicBLL(); + var partNo1List = partNo1DB.Search(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, diff --git a/MESWebSite/Manage/Bom_MK.aspx b/MESWebSite/Manage/Bom_MK.aspx index edc2979..6cdda30 100644 --- a/MESWebSite/Manage/Bom_MK.aspx +++ b/MESWebSite/Manage/Bom_MK.aspx @@ -120,6 +120,26 @@ + + +

+ 是否半成品: +

+ + + + + + + +

+ 工位号: +

+ + + * + +

@@ -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(''); } diff --git a/MESWebSite/Manage/ZP_MK_Plan.aspx b/MESWebSite/Manage/ZP_MK_Plan.aspx index 5b41339..087cff8 100644 --- a/MESWebSite/Manage/ZP_MK_Plan.aspx +++ b/MESWebSite/Manage/ZP_MK_Plan.aspx @@ -62,8 +62,8 @@ 装配日期: - - + + 查询 @@ -159,7 +159,7 @@

- + @@ -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'); } //删除方法