45 changed files with 2709 additions and 18 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,281 @@ |
|||
using MESClassLibrary.BLL.Log; |
|||
using MESClassLibrary.EFModel; |
|||
using MESClassLibrary.Model; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Data; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using MESClassLibrary.DAL.BasicInfo; |
|||
|
|||
namespace MESClassLibrary.BLL.BasicInfo |
|||
{ |
|||
public class Bom_MKBLL |
|||
{ |
|||
BasicBLL<tb_Bom_MK> db = new BasicBLL<tb_Bom_MK>(); |
|||
|
|||
/// <summary>
|
|||
/// 新增信息
|
|||
/// </summary>
|
|||
/// <param name="md"></param>
|
|||
/// <returns></returns>
|
|||
public bool AddInfo(tb_Bom_MK md) |
|||
{ |
|||
try |
|||
{ |
|||
var list = db.SearchInfoByKey("PartNo1", md.PartNo1);//判断是否有重复数据
|
|||
if (list != null) |
|||
{ |
|||
//if (list.Where(p => p.BomID != md.BomID).Count() > 0)
|
|||
//{
|
|||
// return false;
|
|||
//}
|
|||
|
|||
} |
|||
|
|||
return db.AddInfo(md); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
/// <summary>
|
|||
/// 修改信息
|
|||
/// </summary>
|
|||
/// <param name="md"></param>
|
|||
/// <returns></returns>
|
|||
public bool UpdateInfo(tb_Bom_MK md) |
|||
{ |
|||
try |
|||
{ |
|||
var list = db.SearchAllInfo().Where(p => p.PartNo1 == md.PartNo1 && p.BomID != md.BomID).ToList();//判断是否有重复数据
|
|||
//if (list.Count > 0)
|
|||
//{
|
|||
// return false;
|
|||
//}
|
|||
|
|||
//初始化要更新的字段
|
|||
string[] proNames = new string[2]; |
|||
proNames[0] = "PartNo1"; |
|||
proNames[1] = "PartNo2"; |
|||
|
|||
//必填字段初始化,如果不需要更新必填字段则设置为空即可,时间类型无需初始化
|
|||
//如果没有初始化必填字段,更新会报错
|
|||
|
|||
|
|||
return db.UpdateInfo(md, proNames); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 删除信息
|
|||
/// </summary>
|
|||
/// <param name="md"></param>
|
|||
/// <param name="flag"></param>
|
|||
/// <returns></returns>
|
|||
public bool DeleteInfo(tb_Bom_MK md) |
|||
{ |
|||
try |
|||
{ |
|||
return db.DelInfo(md); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 查询全部信息分页
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public string SearchInfoAll(string page, string pagesize, string partNo1, string partNo2, string placeName) |
|||
{ |
|||
try |
|||
{ |
|||
|
|||
string jsonStr = "[]"; |
|||
int total = 0;//总行数
|
|||
List<tb_Bom_MK> list = db.SearchAllInfo(); |
|||
|
|||
if (!String.IsNullOrEmpty(partNo1)) |
|||
{ |
|||
list = list.Where(p => p.PartNo1 != null && p.PartNo1.Contains(partNo1)).ToList(); |
|||
} |
|||
|
|||
if (!String.IsNullOrEmpty(partNo2)) |
|||
{ |
|||
list = list.Where(p => p.PartNo2 != null && p.PartNo2.Contains(partNo2) ).ToList(); |
|||
} |
|||
|
|||
if (!String.IsNullOrEmpty(placeName)) |
|||
{ |
|||
list = list.Where(p => p.PlaceName != null && p.PlaceName.Contains(placeName)).ToList(); |
|||
} |
|||
|
|||
if (list.Count > 0) |
|||
{ |
|||
total = list.Count; |
|||
|
|||
int Skipcount = (Convert.ToInt32(page) - 1) * Convert.ToInt32(pagesize); |
|||
list = list.Skip(Skipcount).Take(Convert.ToInt32(pagesize)).ToList(); |
|||
|
|||
List<Bom_MKModel> modelList = new List<Bom_MKModel>(); |
|||
BasicBLL<tb_Product> s_db = new BasicBLL<tb_Product>(); |
|||
var s_list = s_db.SearchAllInfo(); |
|||
|
|||
foreach (var item in list) |
|||
{ |
|||
Bom_MKModel dm = Tool.Mapper<Bom_MKModel, tb_Bom_MK>(item); |
|||
var info = s_list.FirstOrDefault(p => p.PartNo == item.PartNo1); |
|||
if (info != null) |
|||
{ |
|||
dm.ProductName1 = info.ProductName; |
|||
} |
|||
|
|||
var info2 = s_list.FirstOrDefault(p => p.PartNo == item.PartNo2); |
|||
if (info2 != null) |
|||
{ |
|||
dm.ProductName2 = info2.ProductName; |
|||
} |
|||
|
|||
modelList.Add(dm); |
|||
} |
|||
|
|||
|
|||
JsonDataModel<Bom_MKModel> md = new JsonDataModel<Bom_MKModel>(); |
|||
md.total = total.ToString(); |
|||
md.rows = modelList; |
|||
jsonStr = JSONTools.ScriptSerialize<JsonDataModel<Bom_MKModel>>(md); |
|||
} |
|||
return jsonStr; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 查询全部信息
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public List<tb_Bom_MK> SearchAll() |
|||
{ |
|||
try |
|||
{ |
|||
var s_list = db.SearchAllInfo().ToList(); |
|||
return s_list; |
|||
} |
|||
catch (Exception) |
|||
{ |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 根据ID查询信息
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
public tb_Bom_MK SearchInfoByID(string id) |
|||
{ |
|||
try |
|||
{ |
|||
return db.SearchInfoByID(id); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
|
|||
} |
|||
|
|||
public DataTable SearchBom(string PartNo) |
|||
{ |
|||
BomDAL dal = new BomDAL(); |
|||
try |
|||
{ |
|||
return dal.SearchBom(PartNo); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public DataTable Search(string partNo1, string partNo2) |
|||
{ |
|||
BomDAL dal = new BomDAL(); |
|||
try |
|||
{ |
|||
return dal.Search(partNo1, partNo2); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public bool AddInfo(Bom_MKModel md) |
|||
{ |
|||
Bom_MKDAL dal = new Bom_MKDAL(); |
|||
try |
|||
{ |
|||
return dal.AddInfo(md); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public bool updateInfo(Bom_MKModel md) |
|||
{ |
|||
Bom_MKDAL dal = new Bom_MKDAL(); |
|||
try |
|||
{ |
|||
return dal.updateInfo(md); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public bool DelInfo(Bom_MKModel md) |
|||
{ |
|||
Bom_MKDAL dal = new Bom_MKDAL(); |
|||
try |
|||
{ |
|||
return dal.DelInfo(md); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,358 @@ |
|||
using MESClassLibrary.BLL.Log; |
|||
using MESClassLibrary.DAL.ZPPlan; |
|||
using MESClassLibrary.EFModel; |
|||
using MESClassLibrary.Model; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Data; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using System.Text; |
|||
|
|||
namespace MESClassLibrary.BLL.BasicInfo |
|||
{ |
|||
public class ZP_MK_PlanBLL |
|||
{ |
|||
readonly BasicBLL<tb_ZP_MK_Plan> db = new BasicBLL<tb_ZP_MK_Plan>(); |
|||
|
|||
/// <summary>
|
|||
/// 新增信息
|
|||
/// </summary>
|
|||
/// <param name="md"></param>
|
|||
/// <returns></returns>
|
|||
public bool AddInfo(tb_ZP_MK_Plan md) |
|||
{ |
|||
try |
|||
{ |
|||
var now = DateTime.Now; |
|||
//md.ID = Guid.NewGuid().ToString();
|
|||
md.CreateTime = now; |
|||
md.OrderNo = now.ToString("yyyyMMdd"); |
|||
md.State = 0; |
|||
md.OKCount = 0; |
|||
md.BadCount = 0; |
|||
md.Item = GetItem(md.OrderNo); |
|||
var result = db.AddInfo(md); |
|||
return result; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
private int GetItem(string orderNo) |
|||
{ |
|||
var lastItem = db.Search(q => q.OrderNo == orderNo, q => q.CreateTime).LastOrDefault(); |
|||
return lastItem == null ? 1 : (lastItem.Item.Value + 1); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 修改信息
|
|||
/// </summary>
|
|||
/// <param name="md"></param>
|
|||
/// <returns></returns>
|
|||
public bool UpdateInfo(tb_ZP_MK_Plan md, ref string msg) |
|||
{ |
|||
try |
|||
{ |
|||
var data = db.SearchInfoByID(md.ID.ToString()); |
|||
if (data.State == 3) |
|||
{ |
|||
msg = "该计划已经完成"; |
|||
return false; |
|||
} |
|||
if (data.OKCount.GetValueOrDefault(0).CompareTo(md.OrderCount) > 0) |
|||
{ |
|||
msg = "计划数量不能小于完成数量"; |
|||
return false; |
|||
} |
|||
if (data.OKCount.GetValueOrDefault(0) == 0) |
|||
{ |
|||
//data.StationID = md.StationID;
|
|||
data.PartNo = md.PartNo; |
|||
data.OrderDate = md.OrderDate; |
|||
} |
|||
|
|||
//data.IsOneMore = md.IsOneMore;
|
|||
data.OrderCount = md.OrderCount; |
|||
data.OrderName = md.OrderName; |
|||
return db.UpdateInfo(data); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
msg = ex.ToString(); |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 删除信息
|
|||
/// </summary>
|
|||
/// <param name="md"></param>
|
|||
/// <param name="flag"></param>
|
|||
/// <returns></returns>
|
|||
public bool DeleteInfo(tb_ZP_MK_Plan md) |
|||
{ |
|||
try |
|||
{ |
|||
return db.DelInfo(md); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 查询全部信息分页
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public string SearchInfoAll(int page, |
|||
int pagesize, |
|||
string startTime, |
|||
string endTime, |
|||
string partNo) |
|||
{ |
|||
try |
|||
{ |
|||
string jsonStr = "[]"; |
|||
int total = 0;//总行数
|
|||
IEnumerable<tb_ZP_MK_Plan> list = SearchDB(startTime, endTime, partNo); |
|||
if (list.Any()) |
|||
{ |
|||
List<ZP_MK_PlanModel> modelList = new List<ZP_MK_PlanModel>(); |
|||
total = list.Count(); |
|||
int Skipcount = (Convert.ToInt32(page) - 1) * Convert.ToInt32(pagesize); |
|||
list = list.Skip(Skipcount).Take(Convert.ToInt32(pagesize)); |
|||
|
|||
ProductBLL prodBll = new ProductBLL(); |
|||
var prodList = prodBll.SearchAll(); |
|||
//StationBLL stationBll = new StationBLL();
|
|||
//var stationList = stationBll.SearchAll();
|
|||
|
|||
foreach (var item in list) |
|||
{ |
|||
var prodInfo = prodList.Where(q => q.PartNo == item.PartNo).FirstOrDefault(); |
|||
//var stationInfo = stationList.Where(q => q.StationID == item.StationID).FirstOrDefault();
|
|||
|
|||
ZP_MK_PlanModel zpm = Tool.Mapper<ZP_MK_PlanModel, tb_ZP_MK_Plan>(item); |
|||
//zpm.StationNo = stationInfo == null ? "" : stationInfo.StationNo;
|
|||
zpm.ProductName = prodInfo == null ? "" : prodInfo.ProductName; |
|||
|
|||
modelList.Add(zpm); |
|||
} |
|||
|
|||
JsonDataModel<ZP_MK_PlanModel> md = new JsonDataModel<ZP_MK_PlanModel> |
|||
{ |
|||
total = total.ToString(), |
|||
rows = modelList |
|||
}; |
|||
jsonStr = md.ToSerializer(); |
|||
} |
|||
|
|||
return jsonStr; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public List<ZP_MK_PlanModel> SearchByCreateTime(string startTime, string endTime, string partNo) |
|||
{ |
|||
IEnumerable<tb_ZP_MK_Plan> list = SearchDB(startTime, endTime, partNo); |
|||
List<ZP_MK_PlanModel> modelList = new List<ZP_MK_PlanModel>(); |
|||
if (list.Any()) |
|||
{ |
|||
ProductBLL prodBll = new ProductBLL(); |
|||
var prodList = prodBll.SearchAll(); |
|||
StationBLL stationBll = new StationBLL(); |
|||
var stationList = stationBll.SearchAll(); |
|||
|
|||
foreach (var item in list) |
|||
{ |
|||
var prodInfo = prodList.Where(q => q.PartNo == item.PartNo).FirstOrDefault(); |
|||
//var stationInfo = stationList.Where(q => q.StationID == item.StationID).FirstOrDefault();
|
|||
|
|||
ZP_MK_PlanModel zpm = Tool.Mapper<ZP_MK_PlanModel, tb_ZP_MK_Plan>(item); |
|||
//zpm.StationNo = stationInfo == null ? "" : stationInfo.StationNo;
|
|||
zpm.ProductName = prodInfo == null ? "" : prodInfo.ProductName; |
|||
|
|||
modelList.Add(zpm); |
|||
} |
|||
} |
|||
return modelList; |
|||
} |
|||
|
|||
public IEnumerable<tb_ZP_MK_Plan> SearchDB(string startTime, string endTime, string partNo) |
|||
{ |
|||
DateTime st, et; |
|||
if (!DateTime.TryParse(startTime, out st)) st = DateTime.MinValue; |
|||
if (!DateTime.TryParse(endTime, out et)) et = DateTime.MaxValue; |
|||
|
|||
IEnumerable<tb_ZP_MK_Plan> list; |
|||
if (string.IsNullOrEmpty(partNo)) |
|||
{ |
|||
list = db.Search( |
|||
q => (q.OrderDate >= st && |
|||
q.OrderDate <= et) && |
|||
q.State != 3, |
|||
q => q.OrderDate); |
|||
} |
|||
else |
|||
{ |
|||
list = db.Search(q => q.PartNo != null && q.PartNo.Contains(partNo) && q.State == 0, q => q.CreateTime); |
|||
} |
|||
return list; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 查询全部信息
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public List<tb_ZP_MK_Plan> SearchAll() |
|||
{ |
|||
try |
|||
{ |
|||
var s_list = db.SearchAllInfo(); |
|||
return s_list; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 根据ID查询信息
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
public tb_ZP_MK_Plan SearchInfoByID(string id) |
|||
{ |
|||
try |
|||
{ |
|||
return db.SearchInfoByID(id); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
|
|||
} |
|||
|
|||
public DataTable GetProductingPlan(string station) |
|||
{ |
|||
try |
|||
{ |
|||
ZPPlanDAL dal=new ZPPlanDAL(); |
|||
|
|||
return dal.GetProductingPlan(station); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public DataTable GetProductingPlan1(string station,string orderNo) |
|||
{ |
|||
try |
|||
{ |
|||
ZPPlanDAL dal = new ZPPlanDAL(); |
|||
|
|||
return dal.GetProductingPlan1(station,orderNo); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public DataTable GetPlan(string station, int flag, string planTime) |
|||
{ |
|||
try |
|||
{ |
|||
ZPPlanDAL dal = new ZPPlanDAL(); |
|||
|
|||
return dal.GetPlan(station, flag,planTime); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public bool updateQty(ZPPlanModel md) |
|||
{ |
|||
try |
|||
{ |
|||
ZPPlanDAL dal = new ZPPlanDAL(); |
|||
|
|||
return dal.updateQty(md); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public bool updateBad(ZPPlanModel md) |
|||
{ |
|||
try |
|||
{ |
|||
ZPPlanDAL dal = new ZPPlanDAL(); |
|||
|
|||
return dal.updateBad(md); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public DataTable SearchPlanInfo(string planID) |
|||
{ |
|||
try |
|||
{ |
|||
ZPPlanDAL dal = new ZPPlanDAL(); |
|||
|
|||
return dal.SearchPlanInfo(planID); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public DataTable SearchOrderNo(string orderno) |
|||
{ |
|||
try |
|||
{ |
|||
ZPPlanDAL dal = new ZPPlanDAL(); |
|||
|
|||
return dal.SearchOrderNo(orderno); |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,150 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Data; |
|||
using System.Data.SqlClient; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using MESClassLibrary.BLL.Log; |
|||
using MESClassLibrary.Model; |
|||
|
|||
namespace MESClassLibrary.DAL.BasicInfo |
|||
{ |
|||
public class Bom_MKDAL |
|||
{ |
|||
public DataTable SearchBom(string PartNo) |
|||
{ |
|||
try |
|||
{ |
|||
string sql = @"SELECT dbo.tb_Product.ProductName, dbo.tb_ProductType.ProductTypeName, dbo.tb_ProductType.ProductTypeNo,
|
|||
dbo.tb_Product.PartNo, dbo.tb_Bom.PartNo2, dbo.tb_Product.StockNo |
|||
FROM dbo.tb_Bom RIGHT OUTER JOIN |
|||
dbo.tb_Product ON dbo.tb_Bom.PartNo1 = dbo.tb_Product.PartNo LEFT OUTER JOIN |
|||
dbo.tb_ProductType ON dbo.tb_Product.ProductTypeID = dbo.tb_ProductType.ProductTypeID |
|||
WHERE PartNo=@PartNo";
|
|||
|
|||
SqlParameter[] param = new SqlParameter[1]; |
|||
param[0] = new SqlParameter("@PartNo", SqlDbType.VarChar); |
|||
param[0].Value = PartNo; |
|||
|
|||
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; |
|||
|
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public DataTable Search(string partNo1, string partNo2) |
|||
{ |
|||
try |
|||
{ |
|||
string sql = "select * from tb_Bom where PartNo1=@partNo1,PartNo2=@partNo2"; |
|||
|
|||
SqlParameter[] param = new SqlParameter[2]; |
|||
param[0] = new SqlParameter("@@partNo1", SqlDbType.VarChar); |
|||
param[0].Value = partNo1; |
|||
|
|||
param[1] = new SqlParameter("@@partNo2", SqlDbType.VarChar); |
|||
param[1].Value = partNo2; |
|||
|
|||
return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public bool AddInfo(Bom_MKModel md) |
|||
{ |
|||
string sql = ""; |
|||
SqlParameter[] param = null; |
|||
|
|||
try |
|||
{ |
|||
sql = "insert into tb_Bom(ID,,PartNo1,PartNo2) values(@ID,@partNo1,@partNo2)"; |
|||
|
|||
param = new SqlParameter[3]; |
|||
param[0] = new SqlParameter("@ID", SqlDbType.VarChar); |
|||
param[0].Value = md.BomID; |
|||
|
|||
param[1] = new SqlParameter("@partNo1", SqlDbType.VarChar); |
|||
param[1].Value = md.PartNo1; |
|||
|
|||
param[2] = new SqlParameter("@partNo2", SqlDbType.VarChar); |
|||
param[2].Value = md.PartNo2; |
|||
|
|||
SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param); |
|||
|
|||
return true; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public bool updateInfo(Bom_MKModel md) |
|||
{ |
|||
string sql = ""; |
|||
SqlParameter[] param = null; |
|||
|
|||
try |
|||
{ |
|||
sql = "update tb_Bom set PartNo2=@partNo2 where PartNo1=@partNo1"; |
|||
|
|||
param = new SqlParameter[2]; |
|||
|
|||
param[0] = new SqlParameter("@partNo1", SqlDbType.VarChar); |
|||
param[0].Value = md.PartNo1; |
|||
|
|||
param[1] = new SqlParameter("@partNo2", SqlDbType.VarChar); |
|||
param[1].Value = md.PartNo2; |
|||
|
|||
SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param); |
|||
|
|||
return true; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
public bool DelInfo(Bom_MKModel md) |
|||
{ |
|||
string sql = ""; |
|||
SqlParameter[] param = null; |
|||
|
|||
try |
|||
{ |
|||
sql = "delete from tb_Bom where PartNo1=@partNo1 and PartNo2=@partNo2 "; |
|||
|
|||
param = new SqlParameter[2]; |
|||
|
|||
param[0] = new SqlParameter("@partNo1", SqlDbType.VarChar); |
|||
param[0].Value = md.PartNo1; |
|||
|
|||
param[1] = new SqlParameter("@partNo2", SqlDbType.VarChar); |
|||
param[1].Value = md.PartNo2; |
|||
|
|||
SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param); |
|||
|
|||
return true; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
//------------------------------------------------------------------------------
|
|||
// <auto-generated>
|
|||
// 此代码已从模板生成。
|
|||
//
|
|||
// 手动更改此文件可能导致应用程序出现意外的行为。
|
|||
// 如果重新生成代码,将覆盖对此文件的手动更改。
|
|||
// </auto-generated>
|
|||
//------------------------------------------------------------------------------
|
|||
|
|||
namespace MESClassLibrary.EFModel |
|||
{ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
public partial class tb_Bom_MK |
|||
{ |
|||
public int BomID { get; set; } |
|||
public string PartNo1 { get; set; } |
|||
public string PartNo2 { get; set; } |
|||
public string UserID { get; set; } |
|||
public Nullable<bool> IsChecked { get; set; } |
|||
public string PlaceName { get; set; } |
|||
public Nullable<int> IsPartAssemble { get; set; } |
|||
public string StationNo { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,33 @@ |
|||
//------------------------------------------------------------------------------
|
|||
// <auto-generated>
|
|||
// 此代码已从模板生成。
|
|||
//
|
|||
// 手动更改此文件可能导致应用程序出现意外的行为。
|
|||
// 如果重新生成代码,将覆盖对此文件的手动更改。
|
|||
// </auto-generated>
|
|||
//------------------------------------------------------------------------------
|
|||
|
|||
namespace MESClassLibrary.EFModel |
|||
{ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
public partial class tb_ZP_MK_Plan |
|||
{ |
|||
public int ID { get; set; } |
|||
public string OrderNo { get; set; } |
|||
public string OrderName { get; set; } |
|||
public Nullable<System.DateTime> OrderDate { get; set; } |
|||
public Nullable<int> Item { get; set; } |
|||
public string Station { get; set; } |
|||
public string Line { get; set; } |
|||
public string PartNo { get; set; } |
|||
public Nullable<int> OrderCount { get; set; } |
|||
public Nullable<int> OKCount { get; set; } |
|||
public Nullable<int> State { get; set; } |
|||
public Nullable<int> BadCount { get; set; } |
|||
public Nullable<System.DateTime> CreateTime { get; set; } |
|||
public Nullable<System.DateTime> FinishTime { get; set; } |
|||
public Nullable<int> RepairCount { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
using MESClassLibrary.EFModel; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace MESClassLibrary.Model |
|||
{ |
|||
public class Bom_MKModel : tb_Bom_MK |
|||
{ |
|||
public string ProductName1 { get; set; } |
|||
|
|||
public string ProductName2 { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
using MESClassLibrary.EFModel; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
|
|||
namespace MESClassLibrary.Model |
|||
{ |
|||
public class ZP_MK_PlanModel : tb_ZP_MK_Plan |
|||
{ |
|||
/// <summary>
|
|||
/// 工位名称
|
|||
/// </summary>
|
|||
public string StationNo { get; set; } |
|||
/// <summary>
|
|||
/// 零件名称
|
|||
/// </summary>
|
|||
public string ProductName { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,31 @@ |
|||
using MESWebSite.CommonClass; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
|
|||
namespace MESWebSite.Export |
|||
{ |
|||
public class ExportZP_MK_Plan |
|||
{ |
|||
[ExportHeader(HeaderName = "计划编号")] |
|||
public string OrderNo { get; set; } |
|||
|
|||
[ExportHeader(HeaderName = "计划编号")] |
|||
public string OrderName { get; set; } |
|||
|
|||
[ExportHeader(HeaderName = "序号")] |
|||
public Nullable<int> Item { get; set; } |
|||
|
|||
[ExportHeader(HeaderName ="产品名称")] |
|||
public string ProductName { get; set; } |
|||
[ExportHeader(HeaderName = "零件编号")] |
|||
public string PartNo { get; set; } |
|||
[ExportHeader(HeaderName = "计划数量")] |
|||
public Nullable<int> OrderCount { get; set; } |
|||
[ExportHeader(HeaderName = "生产数量")] |
|||
public Nullable<int> ProductCount { get; set; } |
|||
[ExportHeader(HeaderName = "装配日期")] |
|||
public Nullable<System.DateTime> OrderDate { get; set; } |
|||
} |
|||
} |
@ -0,0 +1 @@ |
|||
<%@ WebHandler Language="C#" CodeBehind="Bom_MKHandler.ashx.cs" Class="MESWebSite.HttpHandlers.Bom_MKHandler" %> |
@ -0,0 +1,162 @@ |
|||
using MESClassLibrary.BLL; |
|||
using MESClassLibrary.BLL.BasicInfo; |
|||
using MESClassLibrary.EFModel; |
|||
using MESWebSite.CommonClass; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
|
|||
namespace MESWebSite.HttpHandlers |
|||
{ |
|||
/// <summary>
|
|||
/// Bom_MKHandler 的摘要说明
|
|||
/// </summary>
|
|||
public class Bom_MKHandler : IHttpHandler |
|||
{ |
|||
|
|||
HttpRequest Request = null; |
|||
HttpResponse Response = null; |
|||
|
|||
public void ProcessRequest(HttpContext context) |
|||
{ |
|||
context.Response.ContentType = "text/plain"; |
|||
Request = context.Request; |
|||
Response = context.Response; |
|||
|
|||
string method = Request.Params["method"]; |
|||
switch (method) |
|||
{ |
|||
|
|||
case "QueryList": |
|||
QueryList(); |
|||
break; |
|||
case "SaveInfo": |
|||
SaveInfo(); |
|||
break; |
|||
case "DelInfo": |
|||
DelInfo(); |
|||
break; |
|||
|
|||
default: |
|||
break; |
|||
|
|||
} |
|||
|
|||
} |
|||
public bool IsReusable |
|||
{ |
|||
get |
|||
{ |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
void QueryList() |
|||
{ |
|||
string page = Request.Params["page"]; |
|||
string pagesize = Request.Params["rows"]; |
|||
string partNo1 = Request.Params["PartNo1"]; |
|||
string partNo2 = Request.Params["PartNo2"]; |
|||
string placeName = Request.Params["PlaceName"]; |
|||
|
|||
if (string.IsNullOrEmpty(page)) |
|||
{ |
|||
page = "0"; |
|||
} |
|||
if (string.IsNullOrEmpty(pagesize)) |
|||
{ |
|||
pagesize = "15"; |
|||
} |
|||
Bom_MKBLL bll = new Bom_MKBLL(); |
|||
Response.Write(bll.SearchInfoAll(page, pagesize, partNo1, partNo2, placeName)); |
|||
Response.End(); |
|||
|
|||
|
|||
} |
|||
void SaveInfo() |
|||
{ |
|||
string BomID = Request.Params["BomID"]; |
|||
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; |
|||
} |
|||
|
|||
var info = Request.Cookies.Get("LoginUserInfo"); |
|||
if (info != null) |
|||
{ |
|||
md.UserID = info["UserID"].ToUpper(); |
|||
} |
|||
|
|||
if (BomID == "0") |
|||
{ |
|||
//新增
|
|||
//md.BomID = Guid.NewGuid().ToString();
|
|||
Response.Write(bll.AddInfo(md) == true ? ResponseResult.Success() : ResponseResult.Fail("添加失败")); |
|||
} |
|||
else |
|||
{ |
|||
//修改
|
|||
md.BomID = int.Parse(BomID); |
|||
Response.Write(bll.UpdateInfo(md) == true ? ResponseResult.Success() : ResponseResult.Fail("更新失败")); |
|||
} |
|||
Response.End(); |
|||
} |
|||
void DelInfo() |
|||
{ |
|||
string BomID = Request.Params["BomID"]; |
|||
|
|||
Bom_MKBLL bll = new Bom_MKBLL(); |
|||
tb_Bom_MK md = new tb_Bom_MK(); |
|||
md.BomID = int.Parse(BomID); |
|||
var info = Request.Cookies.Get("LoginUserInfo"); |
|||
if (info != null) |
|||
{ |
|||
md.UserID = info["UserID"].ToUpper(); |
|||
} |
|||
Response.Write(bll.DeleteInfo(md) == true ? "true" : "false"); |
|||
Response.End(); |
|||
|
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1 @@ |
|||
<%@ WebHandler Language="C#" CodeBehind="ZP_MK_PlanHandler.ashx.cs" Class="MESWebSite.HttpHandlers.ZP_MK_PlanHandler" %> |
@ -0,0 +1,172 @@ |
|||
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; |
|||
using System.Collections.Generic; |
|||
using System.Data; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Web; |
|||
|
|||
namespace MESWebSite.HttpHandlers |
|||
{ |
|||
/// <summary>
|
|||
/// ZP_MK_PlanHandler 的摘要说明
|
|||
/// </summary>
|
|||
public class ZP_MK_PlanHandler : BaseHandler |
|||
{ |
|||
|
|||
public ZP_MK_PlanHandler() : base() |
|||
{ |
|||
RegisterAction(ExportExcel); |
|||
} |
|||
|
|||
protected override void DelInfo() |
|||
{ |
|||
string ID = GetParam("ID"); |
|||
ZP_MK_PlanBLL bll = new ZP_MK_PlanBLL(); |
|||
Response.Write(bll.DeleteInfo(new tb_ZP_MK_Plan() { ID = int.Parse(ID) }) ? ResponseResult.Success() : ResponseResult.Fail("删除失败")); |
|||
Response.End(); |
|||
} |
|||
|
|||
protected override void QueryList() |
|||
{ |
|||
string StartTime = GetParam("StartTime"); |
|||
string EndTime = GetParam("EndTime"); |
|||
string PartNo = GetParam("PartNo"); |
|||
int page = Page.To32Int(); |
|||
int pageSize = Rows.To32Int(); |
|||
|
|||
ZP_MK_PlanBLL bll = new ZP_MK_PlanBLL(); |
|||
string reslut = bll.SearchInfoAll(page, pageSize, StartTime, EndTime, PartNo); |
|||
Response.Write(reslut); |
|||
Response.End(); |
|||
} |
|||
|
|||
protected override void SaveInfo() |
|||
{ |
|||
string id = GetParam("ID"); |
|||
//string stationID = GetParam("StationID");
|
|||
string partNo = GetParam("PartNo"); |
|||
int orderCount = GetParam("OrderCount").To32Int(); |
|||
string orderName = GetParam("OrderName"); |
|||
string line = GetParam("Line"); |
|||
string station = GetParam("Station"); |
|||
|
|||
DateTime orderDate; |
|||
if (!DateTime.TryParse(GetParam("OrderDate"), out orderDate)) |
|||
{ |
|||
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 |
|||
{ |
|||
|
|||
PartNo = partNo, |
|||
OrderDate = orderDate, |
|||
OrderCount = orderCount, |
|||
OrderName = orderName, |
|||
Line = line, |
|||
Station = station, |
|||
|
|||
}; |
|||
|
|||
//DataTable dt = bll.SearchOrderNo(DateTime.Now.ToString("yyyMMdd"));
|
|||
//if (dt != null && dt.Rows.Count > 0)
|
|||
//{
|
|||
// string old = dt.Rows[0]["OrderNo"].ToString();
|
|||
// zpp.OrderNo = DateTime.Now.ToString("yyyMMdd") + (Convert.ToInt32(old.Substring(old.Length - 4, 4))+1).ToString().PadLeft(4,'0');
|
|||
//}
|
|||
//else
|
|||
//{
|
|||
// zpp.OrderNo = DateTime.Now.ToString("yyyMMdd") + "0001";
|
|||
//}
|
|||
|
|||
if (id == "0") |
|||
{ |
|||
Response.Write(bll.AddInfo(zpp) ? ResponseResult.Success() : ResponseResult.Fail("添加失败")); |
|||
} |
|||
else |
|||
{ |
|||
string msg = string.Empty; |
|||
Response.Write(bll.UpdateInfo(zpp, ref msg) ? ResponseResult.Success() : ResponseResult.Fail(msg)); |
|||
} |
|||
Response.End(); |
|||
} |
|||
|
|||
public void ExportExcel() |
|||
{ |
|||
|
|||
string StartTime = GetParam("StartTime"); |
|||
string EndTime = GetParam("EndTime"); |
|||
string PartNo = GetParam("PartNo"); |
|||
ZP_MK_PlanBLL bll = new ZP_MK_PlanBLL(); |
|||
List<ZP_MK_PlanModel> result = bll.SearchByCreateTime(StartTime, EndTime, PartNo); |
|||
ExcelTool excelTool = new ExcelTool(); |
|||
XSSFWorkbook book = excelTool.Export(result, typeof(ExportZP_MK_Plan)); |
|||
using (MemoryStream ms = new MemoryStream()) |
|||
{ |
|||
book.Write(ms); |
|||
Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}.xlsx", DateTime.Now.ToString("yyyyMMddHHmmssfff"))); |
|||
Response.BinaryWrite(ms.ToArray()); |
|||
Response.End(); |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,468 @@ |
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Bom_MK.aspx.cs" Inherits="MESWebSite.Manage.Bom_MK" %> |
|||
|
|||
|
|||
<!DOCTYPE html> |
|||
|
|||
<html xmlns="http://www.w3.org/1999/xhtml"> |
|||
<head runat="server"> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|||
<link href="/CSS/Basics.css" rel="stylesheet" /> |
|||
<link href="/Scripts/jquery-easyui-1.4.3/themes/metro/easyui.css" rel="stylesheet" type="text/css" /> |
|||
<link href="/Scripts/jquery-easyui-1.4.3/themes/icon.css" rel="stylesheet" type="text/css" /> |
|||
<link href="/Scripts/jquery-easyui-1.4.3/themes/color.css" rel="stylesheet" type="text/css" /> |
|||
<script src="/Scripts/jquery-easyui-1.4.3/jquery.min.js" type="text/javascript"></script> |
|||
<script src="/Scripts/jquery-easyui-1.4.3/jquery.easyui.min.js" type="text/javascript"></script> |
|||
<script src="/Scripts/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js" type="text/javascript"></script> |
|||
<script src="/Scripts/MyJs.js" type="text/javascript"></script> |
|||
<style> |
|||
#w td { |
|||
padding: 5px 5px; |
|||
text-align: left; |
|||
vertical-align: middle; |
|||
} |
|||
|
|||
#w .title { |
|||
vertical-align: middle; |
|||
text-align: right; |
|||
width: 80px; |
|||
height: 40px; |
|||
} |
|||
|
|||
p { |
|||
padding: 5px; |
|||
font-size: small; |
|||
font-family: 微软雅黑; |
|||
} |
|||
|
|||
.datagrid { |
|||
text-align: center; |
|||
} |
|||
|
|||
.search_first{ |
|||
margin-left: 15% |
|||
} |
|||
|
|||
/* 中等屏幕 桌面显示器 992至1400 */ |
|||
@media screen and (min-width:992px) and (max-width:1400px){ |
|||
.search_first{ |
|||
margin-left: 0.1% |
|||
} |
|||
} |
|||
</style> |
|||
<title>门槛BOM信息</title> |
|||
</head> |
|||
<body> |
|||
<form id="form1" runat="server"> |
|||
<div class="top"> |
|||
<table style="width: 100%"> |
|||
<tr style="display: flex ;flex-direction: row; flex-wrap: wrap;"> |
|||
|
|||
<td><span class="title" style="width: 150px">BOM信息</span> |
|||
</td> |
|||
<td style="width: 50px;"></td> |
|||
<td style="width: 300px;">注塑件零件号: |
|||
<input type="text" id="PartNo1_s" style="width: 140px;" /></td> |
|||
<td style="width: 300px;">塑料粒子零件号: |
|||
<input type="text" id="PartNo2_s" style="width: 140px;" /></td> |
|||
<td style="width: 200px;">地点: |
|||
<input type="text" id="PlaceName_s" style="width: 140px;" /></td> |
|||
<td style="width: 80px" ><a class="topsearchBtn">查询</a></td> |
|||
|
|||
<td style="width: 80px"> |
|||
<a class="topaddBtn">新增</a> |
|||
</td> |
|||
<td style="width: 80px"> |
|||
<a class="toppenBtn">编辑</a> |
|||
</td> |
|||
<td style="width: 80px"> |
|||
<a class="topdelBtn">删除</a> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</div> |
|||
<table id="tb" title="BOM信息" style="width: 99%;"> |
|||
</table> |
|||
<!-- 编辑窗口 --> |
|||
<div id="w" style="padding: 10px; visibility: hidden" title="编辑"> |
|||
<table cellpadding="0" cellspacing="0"> |
|||
<tr> |
|||
<td class="title" style="width: 110px;"> |
|||
<p> |
|||
注塑件(零件号): |
|||
</p> |
|||
</td> |
|||
<td colspan="2"> |
|||
<select id="fl_id_1" class="easyui-combobox" style="width: 234px; height: 36px;" |
|||
data-options="valueField: 'PartNo',textField: 'PartName'"> |
|||
</select><span style="color: red; font-size: 18px; vertical-align: middle;">*</span> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td class="title" style="width: 110px;"> |
|||
<p> |
|||
塑料粒子(零件号): |
|||
</p> |
|||
</td> |
|||
<td colspan="2"> |
|||
<select id="fl_id_2" class="easyui-combobox" style="width: 234px; height: 36px;" |
|||
data-options="valueField: 'PartNo',textField: 'PartName'"> |
|||
</select><span style="color: red; font-size: 18px; vertical-align: middle;">*</span> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td class="title" style="width: 110px;"> |
|||
<p> |
|||
是否检测: |
|||
</p> |
|||
</td> |
|||
<td colspan="2"> |
|||
<input id="IsChecked" type="checkbox"/> |
|||
|
|||
</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> |
|||
地点: |
|||
</p> |
|||
</td> |
|||
<td colspan="2"> |
|||
<input id="PlaceName" type="text" class="text" style="width: 220px; height: 30px;" /><span style="color: red; font-size: 18px; vertical-align: middle;">*</span> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</div> |
|||
<!-- 编辑窗口 - footer --> |
|||
<div id="ft" style="padding: 10px; text-align: center; background-color: #f9f9f9; visibility: hidden"> |
|||
<a class="saveBtn" id="saveBtn">保存</a> |
|||
</div> |
|||
|
|||
<div hidden="hidden"> |
|||
<asp:Label ID="lblMessage" runat="server" Text=""></asp:Label> |
|||
</div> |
|||
<input id="UserID" type="text" hidden="hidden" runat="server" /> |
|||
<script> |
|||
|
|||
/**************** 全局变量 ***************/ |
|||
var PrimaryID; //要编辑的id |
|||
var dg = $('#tb'); //表格 |
|||
var isEdit = false; //是否为编辑状态 |
|||
|
|||
/**************** DOM加载 ***************/ |
|||
$(function () { |
|||
$.ajaxSetup({ |
|||
cache: false //关闭AJAX缓存 |
|||
}); |
|||
|
|||
|
|||
//新增按钮点击 |
|||
$('.topaddBtn').first().click(function () { |
|||
isEdit = false; |
|||
$('#w').window('open'); |
|||
}); |
|||
|
|||
//编辑按钮点击 |
|||
$('.toppenBtn').first().click(function () { |
|||
isEdit = true; |
|||
initEidtWidget(); |
|||
}); |
|||
|
|||
//删除按钮 |
|||
$('.topdelBtn').first().click(function () { |
|||
$.messager.confirm('提示框', '你确定要删除吗?', function (r) { |
|||
if (r) { |
|||
deleteInfos(); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
|
|||
//搜索按钮 |
|||
$('.topsearchBtn').first().click(function () { |
|||
SearchInfo(); |
|||
}); |
|||
|
|||
//保存按钮 |
|||
$('#saveBtn').bind('click', function () { |
|||
SaveInfo(isEdit); |
|||
}); |
|||
|
|||
//编辑窗口加载 |
|||
$('#w').window({ |
|||
modal: true, |
|||
closed: true, |
|||
minimizable: false, |
|||
maximizable: false, |
|||
collapsible: false, |
|||
width: 460, |
|||
height: 520, |
|||
footer: '#ft', |
|||
top: 20, |
|||
onBeforeClose: function () { clearw(); }, |
|||
onBeforeOpen: function () { |
|||
$('#w').css('visibility', 'visible'); $('#ft').css('visibility', 'visible'); |
|||
reloadfl_id(); |
|||
} |
|||
|
|||
}); |
|||
|
|||
dg = $('#tb').datagrid({ |
|||
fitColumns: true, |
|||
nowrap: false, |
|||
striped: true, |
|||
collapsible: false, |
|||
url: "/HttpHandlers/Bom_MKHandler.ashx?method=QueryList", |
|||
//sortName: 'sortNumber', |
|||
//sortOrder: 'asc', |
|||
remoteSort: false, |
|||
columns: [[ |
|||
{ field: 'BomID', title: 'BomID', hidden: true }, |
|||
{ field: 'PartNo1', title: '注塑件(零件号)', sortable: 'true', width: 10 }, |
|||
{ field: 'ProductName1', title: '产品名称', sortable: 'true', width: 10 }, |
|||
{ field: 'PartNo2', title: '塑料粒子(零件号)', sortable: 'true', width: 10 }, |
|||
{ field: 'ProductName2', title: '原料名称', sortable: 'true', width: 10 }, |
|||
{ |
|||
field: 'IsChecked', title: '是否检测', sortable: 'true', width: 10, |
|||
formatter: function (value) { |
|||
if (value == true) { |
|||
return "是"; |
|||
} else { |
|||
return "否"; |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
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 }, |
|||
]], |
|||
|
|||
pagination: true,//表示在datagrid设置分页 |
|||
rownumbers: true, |
|||
singleSelect: true |
|||
}); |
|||
|
|||
dg.datagrid('getPager').pagination({ |
|||
pageSize: 10, |
|||
pageNumber: 1, |
|||
pageList: [10, 20, 30, 40, 50], |
|||
beforePageText: '第',//页数文本框前显示的汉字 |
|||
afterPageText: '页 共 {pages} 页', |
|||
displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录', |
|||
}); |
|||
}); |
|||
|
|||
/**************** 主要业务程序 ***************/ |
|||
//新增 / 编辑 |
|||
function SaveInfo(isEdit) { |
|||
|
|||
var BomID = isEdit == true ? PrimaryID : 0; |
|||
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; |
|||
} |
|||
if (PartNo2 == "") { |
|||
$.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' |
|||
}; |
|||
SaveModel(model); |
|||
} |
|||
function SaveModel(model) { |
|||
$.ajax({ |
|||
type: "POST", |
|||
async: false, |
|||
url: "/HttpHandlers/Bom_MKHandler.ashx", |
|||
data: model, |
|||
dataType: 'json', |
|||
success: function (res) { |
|||
if (res.IsSuccess) { |
|||
$.messager.alert('提示', '已保存', 'info'); |
|||
dg.datagrid('reload'); |
|||
$('#w').window('close'); |
|||
} |
|||
else { |
|||
$.messager.alert('错误', res.Message, 'warning'); |
|||
} |
|||
|
|||
}, |
|||
error: function () { |
|||
} |
|||
}); |
|||
} |
|||
//查询方法 |
|||
function SearchInfo() { |
|||
|
|||
var PartNo1 = $('#PartNo1_s').val(); |
|||
var PartNo2 = $('#PartNo2_s').val(); |
|||
var PlaceName = $('#PlaceName_s').val(); |
|||
|
|||
var queryParams = { |
|||
PartNo1: PartNo1, |
|||
PartNo2: PartNo2, |
|||
PlaceName: PlaceName |
|||
}; |
|||
dg.datagrid({ |
|||
queryParams: queryParams |
|||
}); |
|||
|
|||
dg.datagrid('reload'); |
|||
} |
|||
//编辑时加载窗体数据 |
|||
function initEidtWidget() { |
|||
var selRows = dg.datagrid('getSelections'); |
|||
if (selRows.length > 1) { |
|||
$.messager.alert('提示', '每次只能编辑一条记录,请重新选取', 'warning'); |
|||
return; |
|||
} else if (selRows.length == 0) { |
|||
$.messager.alert('提示', '请选择一条记录进行编辑', 'warning'); |
|||
return; |
|||
} |
|||
|
|||
//窗体数据初始化 |
|||
var row = selRows[0]; |
|||
PrimaryID = row.BomID; |
|||
$('#fl_id_1').combobox('select', row.PartNo1); |
|||
$('#fl_id_2').combobox('select', row.PartNo2); |
|||
if (row.IsChecked == 0) { |
|||
$('#IsChecked').removeAttr("checked") |
|||
} else { |
|||
|
|||
$('#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'); |
|||
|
|||
} |
|||
//删除方法 |
|||
function deleteInfos() { |
|||
var selRows = dg.datagrid('getSelections'); |
|||
if (selRows.length > 1) { |
|||
$.messager.alert('提示', '每次只能删除一条记录,请重新选取', 'warning'); |
|||
return; |
|||
} else if (selRows.length == 0) { |
|||
$.messager.alert('提示', '请选择一条记录进行删除', 'warning'); |
|||
return; |
|||
} |
|||
var row = selRows[0]; |
|||
|
|||
var model = { |
|||
BomID: row.BomID, |
|||
method: 'DelInfo' |
|||
}; |
|||
|
|||
$.ajax({ |
|||
url: "/HttpHandlers/Bom_MKHandler.ashx", |
|||
data: model, |
|||
async: false, |
|||
success: function (data) { |
|||
if (data == 'true') { |
|||
$.messager.alert('提示', '已删除', 'info'); |
|||
dg.datagrid('reload'); |
|||
} |
|||
else { |
|||
$.messager.alert('提示', '由于有关联数据,删除失败', 'warning'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/**************** 辅助业务程序 ***************/ |
|||
/**********************************************/ |
|||
/***************** 窗体程序 *******************/ |
|||
/**********************************************/ |
|||
//编辑窗口关闭清空数据 |
|||
function clearw() { |
|||
|
|||
$('#fl_id_1').combo('clear'); |
|||
$('#fl_id_2').combo('clear'); |
|||
$('#IsChecked').removeAttr("checked"); |
|||
$('#IsPartAssemble').removeAttr("checked"); |
|||
$('#PlaceName').val(''); |
|||
$('#StationNo').val(''); |
|||
|
|||
} |
|||
|
|||
function reloadfl_id() { |
|||
$('#fl_id_1').combobox('reload', '/HttpHandlers/ProductHandler.ashx?method=QueryForCombobox&ProductTypeNo=2000'); |
|||
$('#fl_id_2').combobox('reload', '/HttpHandlers/ProductHandler.ashx?method=QueryForCombobox&ProductTypeNo=1101'); |
|||
} |
|||
|
|||
|
|||
</script> |
|||
</form> |
|||
</body> |
|||
</html> |
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
using System.Web.UI; |
|||
using System.Web.UI.WebControls; |
|||
|
|||
namespace MESWebSite.Manage |
|||
{ |
|||
public partial class Bom_MK : System.Web.UI.Page |
|||
{ |
|||
protected void Page_Load(object sender, EventArgs e) |
|||
{ |
|||
if (Request.Cookies["LoginUserInfo"] == null) |
|||
{ |
|||
Response.Write("<script language=javascript>alert('您的登录信息已过期,请重新登录!');top.location.href='../Login.aspx';</script>"); |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,44 @@ |
|||
//------------------------------------------------------------------------------
|
|||
// <自动生成>
|
|||
// 此代码由工具生成。
|
|||
//
|
|||
// 对此文件的更改可能导致不正确的行为,如果
|
|||
// 重新生成代码,则所做更改将丢失。
|
|||
// </自动生成>
|
|||
//------------------------------------------------------------------------------
|
|||
|
|||
namespace MESWebSite.Manage |
|||
{ |
|||
|
|||
|
|||
public partial class Bom_MK |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// form1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::System.Web.UI.HtmlControls.HtmlForm form1; |
|||
|
|||
/// <summary>
|
|||
/// lblMessage 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::System.Web.UI.WebControls.Label lblMessage; |
|||
|
|||
/// <summary>
|
|||
/// UserID 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::System.Web.UI.HtmlControls.HtmlInputText UserID; |
|||
} |
|||
} |
@ -0,0 +1,513 @@ |
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ZP_MK_Plan.aspx.cs" Inherits="MESWebSite.Manage.ZP_MK_Plan" %> |
|||
|
|||
<!DOCTYPE html> |
|||
|
|||
<html xmlns="http://www.w3.org/1999/xhtml"> |
|||
<head runat="server"> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|||
<link href="/CSS/Basics.css" rel="stylesheet" /> |
|||
<link href="/Scripts/jquery-easyui-1.4.3/themes/metro/easyui.css" rel="stylesheet" type="text/css" /> |
|||
<link href="/Scripts/jquery-easyui-1.4.3/themes/icon.css" rel="stylesheet" type="text/css" /> |
|||
<link href="/Scripts/jquery-easyui-1.4.3/themes/color.css" rel="stylesheet" type="text/css" /> |
|||
<script src="/Scripts/jquery-easyui-1.4.3/jquery.min.js" type="text/javascript"></script> |
|||
<script src="/Scripts/jquery-easyui-1.4.3/jquery.easyui.min.js" type="text/javascript"></script> |
|||
<script src="/Scripts/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js" type="text/javascript"></script> |
|||
<script src="/Scripts/MyJs.js" type="text/javascript"></script> |
|||
<style> |
|||
#w td { |
|||
padding: 5px 5px; |
|||
text-align: left; |
|||
vertical-align: middle; |
|||
} |
|||
|
|||
#w .title { |
|||
vertical-align: middle; |
|||
text-align: right; |
|||
width: 80px; |
|||
height: 40px; |
|||
} |
|||
|
|||
p { |
|||
padding: 5px; |
|||
font-size: small; |
|||
font-family: 微软雅黑; |
|||
} |
|||
|
|||
.datagrid { |
|||
text-align: center; |
|||
} |
|||
|
|||
.search_first{ |
|||
margin-left: 15% |
|||
} |
|||
|
|||
/* 中等屏幕 桌面显示器 992至1400 */ |
|||
@media screen and (min-width:992px) and (max-width:1400px){ |
|||
.search_first{ |
|||
margin-left: 17% |
|||
} |
|||
|
|||
} |
|||
</style> |
|||
<title>门槛装配计划</title> |
|||
</head> |
|||
<body> |
|||
<form id="form1" runat="server"> |
|||
<div class="top"> |
|||
<table style="width: 100%"> |
|||
<tr style="display: flex;flex-direction: row; flex-wrap: wrap;"> |
|||
<td><span class="title" style="width: 120px">门槛装配计划</span></td> |
|||
<td style="width: 100px;"></td> |
|||
<td style="width: 260px;"> 零件号: |
|||
<input type="text" id="part_no_s" style="width: 140px;"/> |
|||
</td> |
|||
<td style="width: 380px;"> 装配日期: |
|||
<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> |
|||
|
|||
<td style="width: 80px;"> |
|||
<a class="topaddBtn">新增</a> |
|||
</td> |
|||
<td style="width: 80px;"> |
|||
<a class="toppenBtn">编辑</a> |
|||
</td> |
|||
<td style="width: 80px;"> |
|||
<a class="topdelBtn">删除</a> |
|||
</td> |
|||
<td style="width: 80px;"> |
|||
<a class="topexcelBtn">导出</a> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</div> |
|||
<table id="tb" title="装配计划" style="width: 99%;"> |
|||
</table> |
|||
<!-- 编辑窗口 --> |
|||
<div id="w" style="padding: 10px; visibility: hidden" title="编辑"> |
|||
<table cellpadding="0" cellspacing="0"> |
|||
<%--<tr> |
|||
<td class="title" style="width: 110px;"> |
|||
<p> |
|||
工位编号: |
|||
</p> |
|||
</td> |
|||
<td colspan="2"> |
|||
<select id="station_no" class="easyui-combobox" style="width: 200px; height: 30px;" |
|||
data-options="valueField: 'StationID',textField: 'StationNo'"> |
|||
</select> |
|||
</td> |
|||
</tr>--%> |
|||
<tr> |
|||
<td class="title" style="width: 110px;"> |
|||
<p> |
|||
产品名称: |
|||
</p> |
|||
</td> |
|||
<td colspan="2"> |
|||
<select id="part_no" class="easyui-combobox" style="width: 200px; height: 30px;" |
|||
data-options="valueField: 'PartNo',textField: 'ProductName'"> |
|||
</select> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td class="title" style="width: 110px;"> |
|||
<p> |
|||
计划名称: |
|||
</p> |
|||
</td> |
|||
<td colspan="2"> |
|||
<input id="OrderName" type="text" class="text" style="width: 230px; height: 30px;" /> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td class="title" style="width: 110px;"> |
|||
<p> |
|||
产线: |
|||
</p> |
|||
</td> |
|||
<td colspan="2"> |
|||
<input id="Line" type="text" class="text" style="width: 230px; height: 30px;" /> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td class="title" style="width: 110px;"> |
|||
<p> |
|||
工位号: |
|||
</p> |
|||
</td> |
|||
<td colspan="2"> |
|||
<input id="Station" type="text" class="text" style="width: 230px; height: 30px;" /> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td class="title" style="width: 110px;"> |
|||
<p> |
|||
计划数量: |
|||
</p> |
|||
</td> |
|||
<td colspan="2"> |
|||
<input id="OrderCount" type="text" class="text" style="width: 230px; height: 30px;" /> |
|||
</td> |
|||
</tr> |
|||
<tr> |
|||
<td class="title" style="width: 110px;"> |
|||
<p> |
|||
装配日期: |
|||
</p> |
|||
</td> |
|||
<td> |
|||
<input id="OrderDate" class="easyui-datetimebox" style="width: 180px; height: 30px;" data-options="required:true" /> |
|||
</td> |
|||
</tr> |
|||
</table> |
|||
</div> |
|||
<!-- 编辑窗口 - footer --> |
|||
<div id="ft" style="padding: 10px; text-align: center; background-color: #f9f9f9; visibility: hidden"> |
|||
<a class="saveBtn" id="saveBtn">保存</a> |
|||
</div> |
|||
|
|||
<div hidden="hidden"> |
|||
<asp:Label ID="lblMessage" runat="server" Text=""></asp:Label> |
|||
</div> |
|||
<input id="UserID" type="text" hidden="hidden" runat="server" /> |
|||
<script> |
|||
|
|||
/**************** 全局变量 ***************/ |
|||
var PrimaryID; //要编辑的id |
|||
var dg = $('#tb'); //表格 |
|||
var isEdit = false; //是否为编辑状态 |
|||
var handlerUrl = "/HttpHandlers/ZP_MK_PlanHandler.ashx"; |
|||
|
|||
/**************** DOM加载 ***************/ |
|||
$(function () { |
|||
$.ajaxSetup({ |
|||
cache: false //关闭AJAX缓存 |
|||
}); |
|||
|
|||
// 下拉框加载 |
|||
//reload_station_no('#station_no'); |
|||
reload_part_no('#part_no'); |
|||
//新增按钮点击 |
|||
$('.topaddBtn').first().click(function () { |
|||
isEdit = false; |
|||
$('#w').window('open'); |
|||
}); |
|||
|
|||
//编辑按钮点击 |
|||
$('.toppenBtn').first().click(function () { |
|||
isEdit = true; |
|||
initEidtWidget(); |
|||
}); |
|||
|
|||
//删除按钮 |
|||
$('.topdelBtn').first().click(function () { |
|||
$.messager.confirm('提示框', '你确定要删除吗?', function (r) { |
|||
if (r) { |
|||
deleteInfos(); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
|
|||
$('.topexcelBtn').first().click(function () { |
|||
var StartTime = $('#start_time').datebox('getValue'); |
|||
var EndTime = $('#end_time').datebox('getValue'); |
|||
|
|||
var queryParams = { |
|||
StartTime, |
|||
EndTime |
|||
}; |
|||
|
|||
post('<%=ResolveUrl("~/HttpHandlers/ZP_MK_PlanHandler.ashx?method=ExportExcel") %>', queryParams); |
|||
}); |
|||
|
|||
//搜索按钮 |
|||
$('.topsearchBtn').first().click(function () { |
|||
SearchInfo(); |
|||
}); |
|||
|
|||
//保存按钮 |
|||
$('#saveBtn').bind('click', function () { |
|||
SaveInfo(isEdit); |
|||
}); |
|||
|
|||
//$('#IsOneMore').change(function() { |
|||
// $('#part_no').combo('clear'); |
|||
// reload_part_no('#part_no'); |
|||
//}) |
|||
|
|||
//编辑窗口加载 |
|||
$('#w').window({ |
|||
modal: true, |
|||
closed: true, |
|||
minimizable: false, |
|||
maximizable: false, |
|||
collapsible: false, |
|||
width: 460, |
|||
height: 520, |
|||
footer: '#ft', |
|||
top: 20, |
|||
onBeforeClose: function () { clearw(); }, |
|||
onBeforeOpen: function () { |
|||
$('#w').css('visibility', 'visible'); $('#ft').css('visibility', 'visible'); |
|||
} |
|||
|
|||
}); |
|||
|
|||
dg = $('#tb').datagrid({ |
|||
fitColumns: true, |
|||
nowrap: false, |
|||
striped: true, |
|||
collapsible: false, |
|||
url: handlerUrl + "?method=QueryList", |
|||
//sortName: 'sortNumber', |
|||
//sortOrder: 'asc', |
|||
remoteSort: false, |
|||
columns: [[ |
|||
{ field: 'ID', title: 'ID', hidden: true }, |
|||
{ field: 'OrderNo', title: '计划编号', sortable: 'true', width: 10 }, |
|||
{ field: 'OrderName', title: '计划名称', sortable: 'true', width: 8 }, |
|||
{ field: 'Line', title: '产线', sortable: 'true', width: 8 }, |
|||
{ field: 'Station', title: '工位号', sortable: 'true', width: 8 }, |
|||
{ field: 'Item', title: '序号', sortable: 'true', width: 10 }, |
|||
{ field: 'PartNo', title: '零件编号', sortable: 'true', width: 10 }, |
|||
{ field: 'ProductName', title: '产品名称', sortable: 'true', width: 10 }, |
|||
{ field: 'OrderCount', title: '计划数量', sortable: 'true', width: 10 }, |
|||
{ field: 'ProductCount', 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, 19); |
|||
} |
|||
}, |
|||
|
|||
]], |
|||
|
|||
pagination: true,//表示在datagrid设置分页 |
|||
rownumbers: true, |
|||
singleSelect: true |
|||
}); |
|||
|
|||
dg.datagrid('getPager').pagination({ |
|||
pageSize: 10, |
|||
pageNumber: 1, |
|||
pageList: [10, 20, 30, 40, 50], |
|||
beforePageText: '第',//页数文本框前显示的汉字 |
|||
afterPageText: '页 共 {pages} 页', |
|||
displayMsg: '当前显示 {from} - {to} 条记录 共 {total} 条记录', |
|||
}); |
|||
}); |
|||
|
|||
/**************** 主要业务程序 ***************/ |
|||
//新增 / 编辑 |
|||
function SaveInfo(isEdit) { |
|||
|
|||
var ID = isEdit == true ? PrimaryID : 0; |
|||
var PartNo = $('#part_no').combo('getValue'); |
|||
//var StationID = $('#station_no').combo('getValue'); |
|||
var OrderDate = $('#OrderDate').datebox('getValue'); |
|||
//var IsOneMore = checkboxValue($('#IsOneMore')); |
|||
var OrderCount = $('#OrderCount').val(); |
|||
var OrderName = $('#OrderName').val(); |
|||
var Line = $('#Line').val(); |
|||
var Station = $('#Station').val(); |
|||
|
|||
if (PartNo == "") { |
|||
$.messager.alert('提示', '零件不能为空,请重新输入', 'warning'); |
|||
return; |
|||
} |
|||
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 = { |
|||
ID, |
|||
PartNo, |
|||
//StationID, |
|||
OrderName, |
|||
OrderDate, |
|||
OrderCount, |
|||
Line, |
|||
Station, |
|||
method: 'SaveInfo' |
|||
}; |
|||
SaveModel(model); |
|||
} |
|||
function SaveModel(model) { |
|||
$.ajax({ |
|||
type: "POST", |
|||
async: false, |
|||
url: handlerUrl, |
|||
data: model, |
|||
dataType: 'json', |
|||
success: function (res) { |
|||
if (res.IsSuccess) { |
|||
$.messager.alert('提示', '已保存', 'info'); |
|||
dg.datagrid('reload'); |
|||
$('#w').window('close'); |
|||
} |
|||
else { |
|||
$.messager.alert('错误', res.Message, 'warning'); |
|||
} |
|||
|
|||
}, |
|||
error: function () { |
|||
} |
|||
}); |
|||
} |
|||
//查询方法 |
|||
function SearchInfo() { |
|||
|
|||
var PartNo = $('#part_no_s').val(); |
|||
var StartTime = $('#start_time').datebox('getValue'); |
|||
var EndTime = $('#end_time').datebox('getValue'); |
|||
|
|||
dg.datagrid({ |
|||
queryParams: { |
|||
PartNo, |
|||
StartTime, |
|||
EndTime |
|||
} |
|||
}); |
|||
|
|||
dg.datagrid('reload'); |
|||
} |
|||
////编辑时加载窗体数据 |
|||
function initEidtWidget() { |
|||
var selRows = dg.datagrid('getSelections'); |
|||
if (selRows.length > 1) { |
|||
$.messager.alert('提示', '每次只能编辑一条记录,请重新选取', 'warning'); |
|||
return; |
|||
} else if (selRows.length == 0) { |
|||
$.messager.alert('提示', '请选择一条记录进行编辑', 'warning'); |
|||
return; |
|||
} |
|||
|
|||
//窗体数据初始化 |
|||
var row = selRows[0]; |
|||
PrimaryID = row.ID; |
|||
$('#part_no').combobox('select', row.PartNo); |
|||
//$('#station_no').combobox('select', row.StationID); |
|||
//toggleChecked('#IsOneMore', row.IsOneMore); |
|||
$('#OrderCount').val(row.OrderCount); |
|||
$('#OrderName').val(row.OrderName); |
|||
$('#Line').val(row.Line); |
|||
$('#Station').val(row.Station); |
|||
var pa = /.*\((.*)\)/; |
|||
var unixtime = row.OrderDate.match(pa)[1].substring(0, 10); |
|||
$('#OrderDate').datetimebox('setValue', getTime(unixtime).substring(0, 19)); |
|||
$('#w').window('open'); |
|||
} |
|||
//删除方法 |
|||
function deleteInfos() { |
|||
var selRows = dg.datagrid('getSelections'); |
|||
if (selRows.length > 1) { |
|||
$.messager.alert('提示', '每次只能删除一条记录,请重新选取', 'warning'); |
|||
return; |
|||
} else if (selRows.length == 0) { |
|||
$.messager.alert('提示', '请选择一条记录进行删除', 'warning'); |
|||
return; |
|||
} |
|||
var row = selRows[0]; |
|||
|
|||
var model = { |
|||
ID: row.ID, |
|||
method: 'DelInfo' |
|||
}; |
|||
|
|||
$.ajax({ |
|||
url: handlerUrl, |
|||
data: model, |
|||
dataType: 'json', |
|||
async: false, |
|||
success: function (res) { |
|||
if (res.IsSuccess) { |
|||
$.messager.alert('提示', '已删除', 'info'); |
|||
dg.datagrid('reload'); |
|||
} |
|||
else { |
|||
$.messager.alert('提示', res.Message, 'warning'); |
|||
} |
|||
}, |
|||
error: function () { |
|||
} |
|||
}); |
|||
} |
|||
|
|||
/**************** 辅助业务程序 ***************/ |
|||
/**********************************************/ |
|||
/***************** 窗体程序 *******************/ |
|||
/**********************************************/ |
|||
//编辑窗口关闭清空数据 |
|||
function clearw() { |
|||
$('#part_no').combo('clear'); |
|||
//$('#station_no').combo('clear'); |
|||
$('#OrderDate').datebox('setValue', ''); |
|||
$('#OrderCount').val(''); |
|||
$('#OrderName').val(''); |
|||
$('#Line').val(''); |
|||
$('#Station').val(''); |
|||
} |
|||
|
|||
function toggleChecked(id, checked) { |
|||
+checked ? $(id).prop("checked", "checked") : $(id).removeAttr("checked"); |
|||
} |
|||
|
|||
function checkboxValue(ctl) { |
|||
return ctl.is(':checked') ? 1 : 0; |
|||
} |
|||
/** |
|||
* 加载产品下拉信息 |
|||
**/ |
|||
function reload_part_no(ctl) { |
|||
base_reload_combobox(ctl, '/HttpHandlers/ProductHandler.ashx?method=GetComboboxProduct4'); |
|||
} |
|||
|
|||
function reload_station_no(ctl) { |
|||
base_reload_combobox(ctl, '/HttpHandlers/StationHandler.ashx?method=QueryForCombobox&StationNo=ZP'); |
|||
} |
|||
|
|||
function base_reload_combobox(ctl, url) { |
|||
$(ctl).combobox('reload', url); |
|||
} |
|||
|
|||
function post(url, PARAMS) { |
|||
var temp_form = document.createElement("form"); |
|||
temp_form.action = url; |
|||
temp_form.target = "_blank"; |
|||
temp_form.method = "post"; |
|||
temp_form.style.display = "none"; for (var x in PARAMS) { |
|||
var opt = document.createElement("textarea"); |
|||
opt.name = x; |
|||
opt.value = PARAMS[x]; |
|||
temp_form.appendChild(opt); |
|||
} |
|||
document.body.appendChild(temp_form); |
|||
temp_form.submit(); |
|||
} |
|||
</script> |
|||
</form> |
|||
</body> |
|||
</html> |
@ -0,0 +1,17 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Web; |
|||
using System.Web.UI; |
|||
using System.Web.UI.WebControls; |
|||
|
|||
namespace MESWebSite.Manage |
|||
{ |
|||
public partial class ZP_MK_Plan : System.Web.UI.Page |
|||
{ |
|||
protected void Page_Load(object sender, EventArgs e) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,44 @@ |
|||
//------------------------------------------------------------------------------
|
|||
// <自动生成>
|
|||
// 此代码由工具生成。
|
|||
//
|
|||
// 对此文件的更改可能导致不正确的行为,如果
|
|||
// 重新生成代码,则所做更改将丢失。
|
|||
// </自动生成>
|
|||
//------------------------------------------------------------------------------
|
|||
|
|||
namespace MESWebSite.Manage |
|||
{ |
|||
|
|||
|
|||
public partial class ZP_MK_Plan |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// form1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::System.Web.UI.HtmlControls.HtmlForm form1; |
|||
|
|||
/// <summary>
|
|||
/// lblMessage 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::System.Web.UI.WebControls.Label lblMessage; |
|||
|
|||
/// <summary>
|
|||
/// UserID 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::System.Web.UI.HtmlControls.HtmlInputText UserID; |
|||
} |
|||
} |
After Width: | Height: | Size: 111 KiB |
Loading…
Reference in new issue