diff --git a/APPQ5/QMAPP.FJC.BLL/QMAPP.FJC.BLL.csproj b/APPQ5/QMAPP.FJC.BLL/QMAPP.FJC.BLL.csproj index 67d9f36..e5da0f1 100644 --- a/APPQ5/QMAPP.FJC.BLL/QMAPP.FJC.BLL.csproj +++ b/APPQ5/QMAPP.FJC.BLL/QMAPP.FJC.BLL.csproj @@ -190,6 +190,7 @@ + diff --git a/APPQ5/QMAPP.FJC.BLL/TianJin/TJWorkOrderBLL.cs b/APPQ5/QMAPP.FJC.BLL/TianJin/TJWorkOrderBLL.cs new file mode 100644 index 0000000..5d369fd --- /dev/null +++ b/APPQ5/QMAPP.FJC.BLL/TianJin/TJWorkOrderBLL.cs @@ -0,0 +1,667 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using QMAPP.BLL; +using QMAPP.FJC.Entity.ProductionPlan; +using QMAPP.FJC.DAL.ProductionPlan; +using QMFrameWork.Data; +using QMAPP.Entity; +using System.Data; +using QMAPP.FJC.Entity.Operation; +using QMAPP.FJC.Entity.FIS; +using QMAPP.FJC.DAL.TianJin; +using QMAPP.FJC.Entity.TianJin; + +namespace QMAPP.FJC.BLL.TianJin +{ + /// + /// 模块名称:派工单 + /// 作 者:张鹏 + /// 编写日期:2017年10月24日 + /// + public class TJWorkOrderBLL : BaseBLL + { + + #region 获取信息 + /// + /// 获取信息 + /// + /// 条件 + /// 信息 + public WorkOrder Get(WorkOrder info) + { + try + { + return new TWorkOrderDAL().Get(info); + } + catch (Exception ex) + { + throw ex; + } + } + #endregion + + #region 获取列表 + /// + /// 获取列表 + /// + /// 条件 + /// 数据页 + /// 数据页 + public DataPage GetList(WorkOrder condition, DataPage page) + { + try + { + return new TWorkOrderDAL().GetList(condition, page); + } + catch (Exception ex) + { + throw ex; + } + } + /// + /// 获取指定工序的生产计划清单 + /// + /// 工序编码 + /// 过滤选项:0全部;1隐藏挂起;2只看挂起 + /// + public List GetOrderInCell(string workcellcode,int filter, DataPage dataPage) + { + try + { + return new TWorkOrderDAL().GetOrderInCell(workcellcode,filter,dataPage.PageSize); + } + catch (Exception ex) + { + throw ex; + } + } + + + /// + /// + /// + /// + /// + public List GetOrderInfo(string orderplanno) + { + try + { + return new TWorkOrderDAL().GetWorkOrderInfo(orderplanno); + } + catch (Exception ex) + { + throw ex; + } + } + + public List GetOrderUnPrinted(string RouteCode, int filter, DataPage dataPage,string Direction) + { + try + { + return new TWorkOrderDAL().GetOrderUnPrinted(RouteCode, Direction, filter, dataPage.PageSize); + } + catch (Exception ex) + { + throw ex; + } + } + + public int SetOrderPrinted(string orderpid) + { + try + { + return new TWorkOrderDAL().SetOrderPrinted(orderpid); + } + catch (Exception ex) + { + throw ex; + } + } + + /// + /// 获取指定工序下待完成计划数量 + /// + /// 工序编码 + /// 班次 + /// 日期 + /// + public int GetOrderCountInCell(string workcellcode, string shift) + { + try + { + var date = DateTime.Now; + return new TWorkOrderDAL().GetOrderCountInCell(workcellcode, shift, date); + } + catch (Exception ex) + { + throw ex; + } + } + + /// + /// 获取工作中心当日的总计划数量 + /// + /// 工作中心 + /// + public int GetDayPlanCount(string workcentercode) + { + try + { + var date = DateTime.Now; + return new TWorkOrderDAL().GetDayPlanCount(workcentercode, date); + } + catch (Exception ex) + { + throw ex; + } + } + + /// + /// 获取计划标签数据 + /// + /// + /// + public Entity.View.PlanLabel GetPlanLabel(string workorderid) + { + Entity.View.PlanLabel labeldata = new Entity.View.PlanLabel(); + TWorkOrderDAL dal = new TWorkOrderDAL(); + var order = dal.Get(new WorkOrder { PID = workorderid }); + if (order == null) + { + throw new Exception("获取工单信息失败!"); + } + + labeldata.BOM = order.PBOM_CODE; + labeldata.PN = order.MATERIAL_CODE; + labeldata.SEQ = order.SEQ; + labeldata.PlanDate = order.PLAN_DATE.ToString("yyyy-MM-dd HH:mm:ss"); + switch (order.ORDER_TYPE) + { + case "0": + { + labeldata.PlanType = "FIS"; + break; + } + case "1": + { + labeldata.PlanType = "STOCK"; + break; + } + case "2": + { + labeldata.PlanType = "INSERT"; + break; + } + } + var plandal = new DAL.FIS.OrderPlanDAL(); + var plan = plandal.Get(new Entity.FIS.OrderPlan { PID = order.ORDERPLANID }); + if (plan == null) + { + throw new Exception("获取计划信息异常!"); + } + labeldata.PlanNo = plan.PLAN_NO; + + + if (order.ORDER_TYPE == "0") + { + var fisdal = new DAL.FIS.FISOrderDAL(); + var fis = fisdal.GetByPlan(plan.PLAN_NO, plan.MATERIAL_CODE); + if (fis == null) + { + throw new Exception("获取FIS信息异常!"); + } + labeldata.VIN = fis.VIN; + labeldata.KIN = fis.KIN; + } + else + { + labeldata.VIN = "N/A"; + labeldata.KIN = "N/A"; + } + var materialdal = new MD.DAL.MaterialDAL(); + var material = materialdal.Get(new MD.Entity.Material { MATERIAL_CODE = order.MATERIAL_CODE }); + if (material == null) + { + throw new Exception("获取物料信息异常!"); + } + labeldata.HBType = material.HBTYPE; + labeldata.ProjectCode = material.PROJECTCODE; + labeldata.Color = material.COLOR; + labeldata.ProdName = material.MATERIAL_NAME; + return labeldata; + } + + /// + /// 获取计划标签数据 + /// + /// + /// + public Entity.View.PlanLabel GetPlanLabelBindProdut(Product Product) + { + Entity.View.PlanLabel labeldata = new Entity.View.PlanLabel(); + + var plandal = new DAL.FIS.OrderPlanDAL(); + var plan = plandal.Get(new Entity.FIS.OrderPlan { PID = Product.PLAN_ID }); + if (plan == null) + { + throw new Exception("获取计划信息异常!"); + } + labeldata.BOM = plan.PBOM_CODE; + labeldata.PN = plan.MATERIAL_CODE; + + labeldata.PlanDate = plan.PLAN_DATE.ToString("yyyy-MM-dd HH:mm:ss"); + + TWorkOrderDAL dal = new TWorkOrderDAL(); + var order = dal.GetOneByProduct(Product.PRODUCTCODE); + if (order != null) + { + labeldata.SEQ = order.SEQ; + } + else + { + labeldata.SEQ = "N/A"; + } + switch (plan.PLANSOURCE) + { + case "0": + { + labeldata.PlanType = "FIS"; + break; + } + case "1": + { + labeldata.PlanType = "STOCK"; + break; + } + case "2": + { + labeldata.PlanType = "INSERT"; + break; + } + } + + labeldata.PlanNo = plan.PLAN_NO; + + + if (plan.PLANSOURCE == "0") + { + var fisdal = new DAL.FIS.FISOrderDAL(); + var fis = fisdal.GetByPlan(plan.PLAN_NO, plan.MATERIAL_CODE); + if (fis == null) + { + throw new Exception("获取FIS信息异常!"); + } + labeldata.VIN = fis.VIN; + labeldata.KIN = fis.KIN; + } + else + { + labeldata.VIN = "N/A"; + labeldata.KIN = "N/A"; + } + var materialdal = new MD.DAL.MaterialDAL(); + var material = materialdal.Get(new MD.Entity.Material { MATERIAL_CODE = plan.MATERIAL_CODE }); + if (material == null) + { + throw new Exception("获取物料信息异常!"); + } + labeldata.HBType = material.HBTYPE; + labeldata.ProjectCode = material.PROJECTCODE; + labeldata.Color = material.COLOR; + labeldata.ProdName = material.MATERIAL_NAME; + return labeldata; + } + + #endregion + + #region 信息是否重复 + /// + /// 判断名称是否存在 + /// + /// 信息 + /// true:已存在;fasel:不存在。 + public bool Exists(WorkOrder info) + { + try + { + return new TWorkOrderDAL().Exists(info); + } + catch (Exception ex) + { + throw ex; + } + } + + #endregion + + #region 插入信息 + /// + /// 插入信息(单表) + /// + /// 信息 + /// 插入行数 + public DataResult Insert(WorkOrder info) + { + DataResult result = new DataResult(); + try + { + if (string.IsNullOrWhiteSpace(info.PID)) + { + info.PID = Guid.NewGuid().ToString(); + } + TWorkOrderDAL cmdDAL = new TWorkOrderDAL(); + result.Result = new TWorkOrderDAL().Insert(info); + result.IsSuccess = true; + return result; + } + catch (Exception ex) + { + throw ex; + } + } + #endregion + + #region 更新信息 + /// + /// 更新信息 + /// + /// 信息 + /// 更新行数 + public DataResult Update(WorkOrder info) + { + DataResult result = new DataResult(); + try + { + result.Result = new TWorkOrderDAL().Update(info); + result.IsSuccess = true; + return result; + } + catch (Exception ex) + { + throw ex; + } + } + /// + /// 挂起工单 + /// + /// + public int SuspendOrder(List orderid) + { + var orders = GetListByID(orderid.ToArray()); + foreach (var order in orders) + { + if (int.Equals(order.STATE, 2)) + { + throw new Exception("不可将状态为执行中的工单挂起!"); + } + order.STATE = 4; + } + var dal = new TWorkOrderDAL(); + return dal.Update(orders); + } + /// + /// 取消挂起 + /// + /// + /// + public int CancelSuspend(List orderid) + { + var orders = GetListByID(orderid.ToArray()); + foreach (var order in orders) + { + if (!int.Equals(order.STATE, 4)) + { + throw new Exception("只可取消状态为挂起状态的工单!"); + } + order.STATE = 1; + } + var dal = new TWorkOrderDAL(); + return dal.Update(orders); + } + /// + /// 回收工单 + /// + /// + /// + public int TakeBack(List orderid) + { + var orders = GetListByID(orderid.ToArray()); + foreach (var order in orders) + { + if (!int.Equals(order.STATE, 4)) + { + throw new Exception("只可回收状态为挂起状态的工单!"); + } + //order.ORDER_TYPE = "1"; + order.PRI = 1; + order.STATE = 0; + } + var dal = new TWorkOrderDAL(); + return dal.Update(orders); + } + /// + /// 重置工单 + /// + /// + /// + public int ResetOrder(List orderid) + { + var orders = GetListByID(orderid.ToArray()); + var first = orders.FirstOrDefault(); + if (first != null) + { + QMAPP.MD.DAL.WorkCellDAL workCelldal = new QMAPP.MD.DAL.WorkCellDAL(); + string pbomcode = first.PBOM_CODE; + QMAPP.MD.Entity.ProcessRouteWorkCellSeq workcell = workCelldal.GetFirstWorkCell(pbomcode).FirstOrDefault(); + foreach (var order in orders) + { + if (!int.Equals(order.STATE, 4)) + { + throw new Exception("只可重置状态为挂起状态的工单!"); + } + //order.ORDER_TYPE = "1"; + order.WORKCELL_CODE = workcell.WORKCELL_CODE; + order.PRI = 1; + order.STATE = 0; + } + var dal = new TWorkOrderDAL(); + return dal.Update(orders); + } + return 0; + } + + /// + /// 忽略FIS断号 + /// + /// + /// + public int IgnoreFISBreak(List orderid) + { + var orders = GetListByID(orderid.ToArray()); + var first = orders.FirstOrDefault(); + var plans = new List(); + var plandal = new DAL.FIS.OrderPlanDAL(); + foreach (var order in orders) + { + if (!int.Equals(order.ORDER_TYPE, "0")) + { + throw new Exception("只可对FIS工单进行忽略断号操作!"); + } + var plan = plandal.Get(new OrderPlan { PID = order.ORDERPLANID }); + if (plan != null) + { + plan.IGNORE_FISBREAK = "1"; + plandal.Update(plan); + plans.Add(plan); + } + } + return plans.Count; + + } + /// + /// 删除工单 + /// + /// + /// + public int DeleteOrder(List orderid) + { + var orders = GetListByID(orderid.ToArray()); + foreach (var order in orders) + { + if (!int.Equals(order.STATE, 4)) + { + throw new Exception("只可删除状态为挂起状态的工单!"); + } + //order.STATE = 1; + } + var dal = new TWorkOrderDAL(); + return dal.Delete(orders); + } + + + /// + /// 根据主键获取列表 + /// + /// + /// + private List GetListByID(params string[] orderid) + { + var dal = new TWorkOrderDAL(); + return dal.GetListByID(orderid); + } + + #endregion + + #region 删除 + /// + /// 删除信息 + /// + /// 主键串 + /// 删除个数 + public DataResult DeleteArray(string strs) + { + int count = 0; + DataResult result = new DataResult(); + string[] list = strs.Split(":".ToCharArray()); + try + { + foreach (string str in list) + { + count += this.Delete(new WorkOrder { PID = str }); + } + result.Result = count; + result.IsSuccess = true; + return result; + } + catch (Exception ex) + { + throw ex; + } + } + + /// + /// 删除信息 + /// + /// 信息 + /// 删除个数 + public int Delete(WorkOrder info) + { + try + { + return new TWorkOrderDAL().Delete(info); + } + catch (Exception ex) + { + throw ex; + } + } + #endregion + + #region 导出数据 + /// + /// 获取导出的数据 + /// + /// 查询条件 + /// 数据 + public DataTable GetExportData(WorkOrder info) + { + try + { + return new TWorkOrderDAL().GetExportData(info); + } + catch (Exception ex) + { + throw ex; + } + } + #endregion + + #region 导入数据 + /// + /// 导入数据 + /// + /// 数据 + /// 导入结果 + public DataResult ImportData(List list) + { + DataResult result = new DataResult(); + TWorkOrderDAL cmDal = new TWorkOrderDAL(); + List List = new List(); + int index = 0; + try + { + result.Result = new ImportMessage(); + result.Result.Errors = new List(); + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + //状态判断 + foreach (WorkOrder ma in list) + { + index++; + if (!string.IsNullOrEmpty(ma.InfoError)) + { + ma.PID = null; + result.Result.failureNum += 1; + continue; + } + //修改改时根据主键等信息获取详细内容信息 + WorkOrder oldInfo = cmDal.Get(ma); + if (oldInfo != null) + { + //更新 + ma.PID = oldInfo.PID; + ma.IsNewInfo = false; + result.Result.updateNum += 1; + } + else + { + //新增 + oldInfo = new WorkOrder(); + if (string.IsNullOrWhiteSpace(ma.PID)) + { + ma.PID = Guid.NewGuid().ToString(); + } + ma.IsNewInfo = true; + result.Result.insertNum += 1; + } + List.Add(ma); + } + } + //导入 + cmDal.GetImportData(List); + result.Msg = "导入成功"; + result.IsSuccess = true; + return result; + } + catch (Exception ex) + { + result.IsSuccess = false; + result.Ex = ex; + return result; + } + } + #endregion + } +} diff --git a/APPQ5/QMAPP.FJC.DAL/QMAPP.FJC.DAL.csproj b/APPQ5/QMAPP.FJC.DAL/QMAPP.FJC.DAL.csproj index e8ca8d5..5cf245c 100644 --- a/APPQ5/QMAPP.FJC.DAL/QMAPP.FJC.DAL.csproj +++ b/APPQ5/QMAPP.FJC.DAL/QMAPP.FJC.DAL.csproj @@ -180,6 +180,7 @@ + diff --git a/APPQ5/QMAPP.FJC.DAL/TianJin/TJWorkOrderDAL.cs b/APPQ5/QMAPP.FJC.DAL/TianJin/TJWorkOrderDAL.cs index 48331ac..09ea74c 100644 --- a/APPQ5/QMAPP.FJC.DAL/TianJin/TJWorkOrderDAL.cs +++ b/APPQ5/QMAPP.FJC.DAL/TianJin/TJWorkOrderDAL.cs @@ -332,7 +332,7 @@ namespace QMAPP.FJC.DAL.TianJin /// 数量 /// 过滤选项:0全部;1隐藏挂起;2只看挂起 /// - public List GetOrderUnPrinted(string routecode, int filter = 0, int count = 20) + public List GetOrderUnPrinted(string routecode, string Direction, int filter = 0, int count = 20) { try { @@ -371,6 +371,10 @@ namespace QMAPP.FJC.DAL.TianJin sql.AppendFormat(" ON W.[MATERIAL_CODE]=M.[MATERIAL_CODE] "); sql.AppendFormat(" WHERE P.[ROUTE_CODE]=@routecode "); sql.AppendFormat(" AND W.[PRINTED]='0' "); + if (!string.IsNullOrEmpty(Direction)) + { + sql.AppendFormat($" AND M.[MATERIAL_NAME] like '%{Direction}%' "); + } switch (filter) { case 1: diff --git a/APPQ5/QMAPP.FJC.DAL/TianJin/TWorkOrderDAL.cs b/APPQ5/QMAPP.FJC.DAL/TianJin/TWorkOrderDAL.cs new file mode 100644 index 0000000..7f40761 --- /dev/null +++ b/APPQ5/QMAPP.FJC.DAL/TianJin/TWorkOrderDAL.cs @@ -0,0 +1,1116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using QMFrameWork.Data; +using QMAPP.FJC.Entity.ProductionPlan; +using System.Data; +using QMAPP.Entity; +using QMAPP.DAL; +using QMFrameWork.Log; +using QMAPP.FJC.Entity.FIS; + +namespace QMAPP.FJC.DAL.TianJin +{ + /// + /// 模块名称:派工单 + /// 作 者:张鹏 + /// 编写日期:2017年10月24日 + /// + public class TWorkOrderDAL : BaseDAL + { + + #region 获取信息 + /// + /// 获取信息 + /// + /// 条件 + /// *信息 + public WorkOrder Get(WorkOrder info) + { + try + { + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + //获取信息 + info = session.Get(info); + } + return info; + } + catch (Exception ex) + { + throw ex; + } + } + public WorkOrder GetOne(string ORDERPLANID) + { + string sql = "SELECT * FROM [T_PP_WORKORDER] WITH(NOLOCK) where [ORDERPLANID]='" + ORDERPLANID + "'"; + List parameters = new List(); + try + { + if (BaseSession != null) + { + return BaseSession.GetList(sql, parameters.ToArray()).FirstOrDefault(); + } + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + return session.GetList(sql, parameters.ToArray()).FirstOrDefault(); + } + } + catch (Exception ex) + { + throw ex; + } + } + + public WorkOrder GetOneByID(string id) + { + string sql = "SELECT * FROM [T_PP_WORKORDER] WITH(NOLOCK) where [PID]='" + id + "'"; + List parameters = new List(); + try + { + if (BaseSession != null) + { + return BaseSession.GetList(sql, parameters.ToArray()).FirstOrDefault(); + } + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + return session.GetList(sql, parameters.ToArray()).FirstOrDefault(); + } + } + catch (Exception ex) + { + throw ex; + } + } + + public WorkOrder GetOneByOrderNO(string ORDERPLANNO) + { + string sql = "SELECT * FROM [T_PP_WORKORDER] WITH(NOLOCK) where [ORDERPLAN_NO]='" + ORDERPLANNO + "'"; + List parameters = new List(); + try + { + if (BaseSession != null) + { + return BaseSession.GetList(sql, parameters.ToArray()).FirstOrDefault(); + } + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + return session.GetList(sql, parameters.ToArray()).FirstOrDefault(); + } + } + catch (Exception ex) + { + throw ex; + } + } + + public WorkOrder GetOneByProduct(string productCode) + { + string sql = "SELECT * FROM [T_PP_WORKORDER] WITH(NOLOCK) where [REMARK]='" + productCode + "'"; + List parameters = new List(); + try + { + if (BaseSession != null) + { + return BaseSession.GetList(sql, parameters.ToArray()).FirstOrDefault(); + } + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + return session.GetList(sql, parameters.ToArray()).FirstOrDefault(); + } + } + catch (Exception ex) + { + throw ex; + } + } + + + /// + /// 获取计划单号下所有派工单信息 + /// + /// + /// + public int GetAllWorkOrder(string ORDERPLANID) + { + int count = 0; + string sql = "SELECT COUNT(1) FROM [T_PP_WORKORDER] WITH(NOLOCK) where [ORDERPLANID]='" + ORDERPLANID + "' AND STATE<>0"; + List parameters = new List(); + try + { + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + count =Convert.ToInt32(session.ExecuteSqlScalar(sql, parameters.ToArray())); + } + } + catch (Exception ex) + { + throw ex; + } + return count; + } + #endregion + + #region 获取列表 + /// + /// 获取列表 + /// + /// 条件 + /// 数据页 + /// 数据页 + public DataPage GetList(WorkOrder condition, DataPage page) + { + string sql = null; + List parameters = new List(); + try + { + sql = this.GetQuerySql(condition, ref parameters); + //分页关键字段及排序 + page.KeyName = "PID"; + if (string.IsNullOrEmpty(page.SortExpression)) + page.SortExpression = "UPDATEDATE DESC"; + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + page = session.GetDataPage(sql, parameters.ToArray(), page); + } + return page; + } + catch (Exception ex) + { + throw ex; + } + } + + public List GetList(WorkOrder condition) + { + List workOrderList = new List(); + string sql = "select * from T_PP_WORKORDER WITH(NOLOCK) where 1=1 "; + if (string.IsNullOrEmpty(condition.ORDERPLANID) == false) + { + sql += string.Format(" and ORDERPLANID='{0}'",condition.ORDERPLANID); + } + + + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + workOrderList = session.GetList(sql, new List().ToArray()).ToList(); + } + + return workOrderList; + } + + + public List GetWorkOrderInfo(string planno) + { + try + { + StringBuilder sql = new StringBuilder(); + sql.AppendFormat("SELECT W.[PID]"); + sql.AppendFormat(" ,W.[ORDERPLANID] "); + sql.AppendFormat(" ,W.[ORDERPLAN_NO] "); + sql.AppendFormat(" ,W.[ORDER_TYPE] "); + sql.AppendFormat(" ,W.[SEQ] "); + sql.AppendFormat(" ,W.[MATERIAL_CODE] "); + sql.AppendFormat(" ,M.[MATERIAL_NAME] "); + sql.AppendFormat(" ,W.[PBOM_CODE] "); + sql.AppendFormat(" ,W.[QTY] "); + sql.AppendFormat(" ,W.[COMPLETE_QTY] "); + sql.AppendFormat(" ,W.[PLAN_DATE] "); + sql.AppendFormat(" ,W.[SHIFT_CODE] "); + sql.AppendFormat(" ,W.[WORKCENTER_CODE] "); + sql.AppendFormat(" ,W.[WORKCENTER_NAME] "); + sql.AppendFormat(" ,W.[WORKCELL_CODE] "); + sql.AppendFormat(" ,W.[WORKCELL_NAME] "); + sql.AppendFormat(" ,W.[WORKLOC_CODE] "); + sql.AppendFormat(" ,W.[REMARK] "); + sql.AppendFormat(" ,W.[EQPT_NAME] "); + sql.AppendFormat(" ,W.[EQPT_CODE] "); + sql.AppendFormat(" ,W.[STATE] "); + sql.AppendFormat(" ,W.[MOULD_CODE] "); + sql.AppendFormat(" ,W.[PRI] "); + sql.AppendFormat(" ,W.[UPDATEDATE] "); + sql.AppendFormat(" ,W.[PRINTED] "); + sql.AppendFormat(" ,P.[IGNORE_FISBREAK] "); + sql.AppendFormat(" ,P.[FIS_ASMSETCODE] "); + sql.AppendFormat(" FROM [T_PP_WORKORDER] AS W WITH(NOLOCK) "); + sql.AppendFormat(" LEFT JOIN [T_PP_ORDERPLAN] AS P WITH(NOLOCK) "); + sql.AppendFormat(" ON P.[PID]=W.[ORDERPLANID] "); + sql.AppendFormat(" LEFT JOIN [T_MD_MATERIAL] AS M WITH(NOLOCK) "); + sql.AppendFormat(" ON W.[MATERIAL_CODE]=M.[MATERIAL_CODE] "); + sql.AppendFormat(" WHERE P.[PLAN_NO]=@planno "); + sql.AppendFormat(" ORDER BY W.[UPDATEDATE],W.[PRI],W.[PLAN_DATE],P.PLAN_SEQ,W.[SEQ],W.[MATERIAL_CODE] "); + List parameters = new List(); + parameters.Add(new DataParameter("planno", planno)); + using (var session = AppDataFactory.CreateMainSession()) + { + return session.GetList(sql.ToString(), parameters.ToArray()).ToList(); + } + } + catch (Exception ex) + { + throw ex; + } + } + + /// + /// 获取指定工序的生产计划清单 + /// + /// 工序编码 + /// 数量 + /// 过滤选项:0全部;1隐藏挂起;2只看挂起 + /// + public List GetOrderInCell(string workcellcode,int filter=0, int count = 20) + { + try + { + StringBuilder sql = new StringBuilder(); + sql.AppendFormat("SELECT TOP {0} W.[PID]\r\n", count); + sql.AppendFormat(" ,W.[ORDERPLANID] "); + sql.AppendFormat(" ,W.[ORDERPLAN_NO] "); + sql.AppendFormat(" ,W.[ORDER_TYPE] "); + sql.AppendFormat(" ,W.[SEQ] "); + sql.AppendFormat(" ,W.[MATERIAL_CODE] "); + sql.AppendFormat(" ,M.[MATERIAL_NAME] "); + sql.AppendFormat(" ,W.[PBOM_CODE] "); + sql.AppendFormat(" ,W.[QTY] "); + sql.AppendFormat(" ,W.[COMPLETE_QTY] "); + sql.AppendFormat(" ,W.[PLAN_DATE] "); + sql.AppendFormat(" ,W.[SHIFT_CODE] "); + sql.AppendFormat(" ,W.[WORKCENTER_CODE] "); + sql.AppendFormat(" ,W.[WORKCENTER_NAME] "); + sql.AppendFormat(" ,W.[WORKCELL_CODE] "); + sql.AppendFormat(" ,W.[WORKCELL_NAME] "); + sql.AppendFormat(" ,W.[WORKLOC_CODE] "); + sql.AppendFormat(" ,W.[REMARK] "); + sql.AppendFormat(" ,W.[EQPT_NAME] "); + sql.AppendFormat(" ,W.[EQPT_CODE] "); + sql.AppendFormat(" ,W.[STATE] "); + sql.AppendFormat(" ,W.[MOULD_CODE] "); + sql.AppendFormat(" ,W.[PRI] "); + sql.AppendFormat(" ,W.[UPDATEDATE] "); + sql.AppendFormat(" ,P.[IGNORE_FISBREAK] "); + sql.AppendFormat(" ,P.[FIS_ASMSETCODE] "); + sql.AppendFormat(" FROM [T_PP_WORKORDER] AS W WITH(NOLOCK) "); + sql.AppendFormat(" LEFT JOIN [T_PP_ORDERPLAN] AS P WITH(NOLOCK) "); + sql.AppendFormat(" ON P.[PID]=W.[ORDERPLANID] "); + sql.AppendFormat(" LEFT JOIN [T_MD_MATERIAL] AS M WITH(NOLOCK)"); + sql.AppendFormat(" ON W.[MATERIAL_CODE]=M.[MATERIAL_CODE] "); + sql.AppendFormat(" WHERE W.[WORKCELL_CODE]=@workcellcode "); + switch (filter) + { + case 1: + { + sql.AppendFormat(" AND W.[STATE]<>4 "); + break; + } + case 2: + { + sql.AppendFormat(" AND W.[STATE]=4 "); + break; + } + } + sql.AppendFormat(" ORDER BY W.[UPDATEDATE],W.[PRI],W.[PLAN_DATE],P.PLAN_SEQ,W.[SEQ],W.[MATERIAL_CODE] "); + List parameters = new List(); + parameters.Add(new DataParameter("workcellcode", workcellcode)); + using (var session = AppDataFactory.CreateMainSession()) + { + return session.GetList(sql.ToString(), parameters.ToArray()).ToList(); + } + } + catch(Exception ex) + { + throw ex; + } + } + + /// + /// 获取指定工序的生产计划清单 + /// + /// 工序编码 + /// 数量 + /// 过滤选项:0全部;1隐藏挂起;2只看挂起 + /// + public List GetOrderUnPrinted(string routecode, string Direction, int filter = 0, int count = 20) + { + try + { + StringBuilder sql = new StringBuilder(); + sql.AppendFormat("SELECT TOP {0} W.[PID]\r\n", count); + sql.AppendFormat(" ,W.[ORDERPLANID] "); + sql.AppendFormat(" ,W.[ORDERPLAN_NO] "); + sql.AppendFormat(" ,W.[ORDER_TYPE] "); + sql.AppendFormat(" ,W.[SEQ] "); + sql.AppendFormat(" ,W.[MATERIAL_CODE] "); + sql.AppendFormat(" ,M.[MATERIAL_NAME] "); + sql.AppendFormat(" ,W.[PBOM_CODE] "); + sql.AppendFormat(" ,W.[QTY] "); + sql.AppendFormat(" ,W.[COMPLETE_QTY] "); + sql.AppendFormat(" ,W.[PLAN_DATE] "); + sql.AppendFormat(" ,W.[SHIFT_CODE] "); + sql.AppendFormat(" ,W.[WORKCENTER_CODE] "); + sql.AppendFormat(" ,W.[WORKCENTER_NAME] "); + sql.AppendFormat(" ,W.[WORKCELL_CODE] "); + sql.AppendFormat(" ,W.[WORKCELL_NAME] "); + sql.AppendFormat(" ,W.[WORKLOC_CODE] "); + sql.AppendFormat(" ,W.[REMARK] "); + sql.AppendFormat(" ,W.[EQPT_NAME] "); + sql.AppendFormat(" ,W.[EQPT_CODE] "); + sql.AppendFormat(" ,W.[STATE] "); + sql.AppendFormat(" ,W.[MOULD_CODE] "); + sql.AppendFormat(" ,W.[PRI] "); + sql.AppendFormat(" ,W.[UPDATEDATE] "); + sql.AppendFormat(" ,W.[PRINTED] "); + sql.AppendFormat(" ,P.[IGNORE_FISBREAK] "); + sql.AppendFormat(" ,P.[FIS_ASMSETCODE] "); + sql.AppendFormat(" FROM [T_PP_WORKORDER] AS W WITH(NOLOCK) "); + sql.AppendFormat(" LEFT JOIN [T_PP_ORDERPLAN] AS P WITH(NOLOCK) "); + sql.AppendFormat(" ON P.[PID]=W.[ORDERPLANID] "); + sql.AppendFormat(" LEFT JOIN [T_MD_MATERIAL] AS M WITH(NOLOCK) "); + sql.AppendFormat(" ON W.[MATERIAL_CODE]=M.[MATERIAL_CODE] "); + sql.AppendFormat(" WHERE P.[ROUTE_CODE]=@routecode "); + sql.AppendFormat(" AND W.[PRINTED]='0' "); + + if (!string.IsNullOrEmpty(Direction)) + { + sql.AppendFormat($" AND M.[MATERIAL_NAME] LIKE '%{Direction}%' "); + } + + switch (filter) + { + case 1: + { + sql.AppendFormat(" AND W.[STATE]<>4 "); + break; + } + case 2: + { + sql.AppendFormat(" AND W.[STATE]=4 "); + break; + } + } + sql.AppendFormat(" ORDER BY W.[UPDATEDATE],W.[PRI],W.[PLAN_DATE],P.PLAN_SEQ,W.[SEQ],W.[MATERIAL_CODE] "); + List parameters = new List(); + parameters.Add(new DataParameter("routecode", routecode)); + using (var session = AppDataFactory.CreateMainSession()) + { + return session.GetList(sql.ToString(), parameters.ToArray()).ToList(); + } + } + catch (Exception ex) + { + throw ex; + } + } + + /// + /// 获取指定工序的待完成计划数量 + /// + /// 工序编码 + /// 不指定班次则查询全部计划 + /// 不指定班次则无需输入日期 + /// + public int GetOrderCountInCell(string workcellcode,string shift,DateTime date) + { + try + { + List parameters = new List(); + StringBuilder sql = new StringBuilder(); + sql.AppendFormat("SELECT COUNT(*) "); + sql.AppendFormat(" FROM [T_PP_WORKORDER] WITH(NOLOCK) "); + sql.AppendFormat(" WHERE [WORKCELL_CODE]=@workcellcode "); + sql.AppendFormat(" AND [STATE]<>4"); + if (!string.IsNullOrWhiteSpace(shift)) + { + sql.AppendFormat(" AND [SHIFT_CODE]=@shift"); + parameters.Add(new DataParameter("shift", shift)); + //sql.AppendFormat(" AND DATEDIFF(DAY,[PLAN_DATE],@date)=0"); + //parameters.Add(new DataParameter("date", date)); + sql.AppendFormat(" AND [PLAN_DATE] BETWEEN @date1 AND @date2"); + parameters.Add(new DataParameter("date1", date.Date)); + parameters.Add(new DataParameter("date2", date.Date.AddDays(1))); + } + parameters.Add(new DataParameter("workcellcode", workcellcode)); + + + using (var session = AppDataFactory.CreateMainSession()) + { + return (int)session.ExecuteSqlScalar(sql.ToString(), parameters.ToArray()); + } + } + catch (Exception ex) + { + throw ex; + } + } + #endregion + + #region 获取查询语句 + /// + /// 获取查询语句 + /// + /// 查询条件 + /// 参数 + /// 查询语句 + private string GetQuerySql(WorkOrder condition, ref List parameters) + { + StringBuilder sqlBuilder = new StringBuilder(); + StringBuilder whereBuilder = new StringBuilder(); + try + { + //构成查询语句 + sqlBuilder.Append("SELECT PID,ORDERPLANID,ORDERPLAN_NO,ORDER_TYPE,SEQ,MATERIAL_CODE,PBOM_CODE,QTY,COMPLETE_QTY,PLAN_DATE,SHIFT_CODE,WORKCENTER_CODE,WORKCENTER_NAME,WORKCELL_CODE,WORKCELL_NAME,WORKLOC_CODE,REMARK,EQPT_NAME,EQPT_CODE,STATE "); + sqlBuilder.Append("FROM T_PP_WORKORDER WITH(NOLOCK) "); + whereBuilder.Append(" AND FLGDEL<> '1' "); + //查询条件 + if (whereBuilder.Length > 0) + { + sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4)); + } + return sqlBuilder.ToString(); + } + catch (Exception ex) + { + throw ex; + } + } + #endregion + + #region 获取导出的数据 + /// + /// 获取导出的数据 + /// + /// 查询条件 + /// 数据 + public DataTable GetExportData(WorkOrder info) + { + DataTable dt = null; + string sql = null; + List parameters = new List(); + try + { + //构成查询语句 + sql = this.GetQuerySql(info, ref parameters); + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + dt = session.GetTable(sql, parameters.ToArray()); + dt.TableName = "WorkOrder"; + } + return dt; + } + catch (Exception ex) + { + throw ex; + } + } + #endregion + + #region 信息是否重复 + /// + /// 判断名称是否存在 + /// + /// + /// true:已存在;fasel:不存在。 + public bool Exists(WorkOrder info) + { + StringBuilder sqlBuilder = new StringBuilder(); + StringBuilder whereBuilder = new StringBuilder(); + List parameters = new List(); + int count = 0; + try + { + sqlBuilder.Append("SELECT COUNT(0) FROM T_PP_WORKORDER WITH(NOLOCK) "); + if (info.PID == null) + { + info.PID = ""; + } + whereBuilder.Append(" AND PID <> @PID "); + parameters.Add(new DataParameter { ParameterName = "PID", DataType = DbType.String, Value = info.PID }); + + //添加进行无重复字段判断代码 + + if (whereBuilder.Length > 0) + { + sqlBuilder.Append(" WHERE " + whereBuilder.ToString().Substring(4)); + } + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + count = Convert.ToInt32(session.ExecuteSqlScalar(sqlBuilder.ToString(), parameters.ToArray())); + } + return count > 0; + } + catch (Exception ex) + { + throw ex; + } + } + #endregion + + #region 插入信息 + /// + /// 插入信息(单表) + /// + /// 信息 + /// 插入行数 + public int Insert(WorkOrder info) + { + try + { + if (BaseSession != null) + { + return BaseSession.Insert(info); + } + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + //插入基本信息 + return session.Insert(info); + } + } + catch (Exception ex) + { + throw ex; + } + } + #endregion + + #region 更新信息 + /// + /// 更新信息 + /// + /// + /// 更新行数 + public int Update(WorkOrder info) + { + int count = 0; + try + { + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + //更新基本信息 + count = session.Update(info); + } + return count; + } + catch (Exception ex) + { + throw ex; + } + } + #endregion + + #region 逻辑删除 + /// + /// 逻辑删除信息 + /// + /// + /// 删除个数 + public int Delete(WorkOrder info) + { + StringBuilder sqlBuilder = new StringBuilder(); + List parameters = new List(); + int count = 0; + try + { + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + //删除基本信息 + sqlBuilder.Append("UPDATE T_PP_WORKORDER "); + sqlBuilder.Append("SET FLGDEL = '1' "); + sqlBuilder.Append("WHERE PID = @PID "); + parameters.Add(new DataParameter { ParameterName = "PID", DataType = DbType.String, Value = info.PID }); + count = session.ExecuteSql(sqlBuilder.ToString(), parameters.ToArray()); + } + return count; + } + catch (Exception ex) + { + throw ex; + } + } + + #endregion + + /// + /// 删除派工单 + /// + /// + public void BatchDeleteByOrderPlan(WorkOrder entity) + { + try + { + string deleteSql = string.Format("delete from T_PP_WORKORDER where ORDERPLANID='{0}' ", entity.ORDERPLANID); + this.BaseSession.ExecuteSql(deleteSql, new List().ToArray()); + } + catch (Exception ex) + { + + throw ex; + } + + } + + #region 导入 + public ImportMessage GetImportData(List list) + { + ImportMessage em = new ImportMessage(); + List parameters = new List(); + try + { + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + //设置祖先对象数据会话 + session.OpenTs(); + foreach (WorkOrder info in list) + { + if (info.IsNewInfo) + { + //插入信息 + int count = session.Insert(info); + em.insertNum++; + } + else + { + //更新信息 + int count = session.Update(info); + em.updateNum++; + } + } + session.CommitTs(); + } + } + catch (Exception ex) + { + throw ex; + } + return em; + } + #endregion + + /// + /// 获取指定工位正在执行的派工单 + /// + /// + /// + public WorkOrder GetWorkingOrderInLoc(string workloccode,string mouldcode) + { + try + { + List parameters = new List(); + StringBuilder sql = new StringBuilder(); + sql.AppendLine("SELECT O.* "); + sql.AppendLine(" ,P.[IGNORE_FISBREAK] "); + sql.AppendLine(" ,P.[FIS_ASMSETCODE] "); + sql.AppendLine(" FROM [T_PP_WORKORDER] AS O WITH(NOLOCK) "); + sql.AppendLine(" LEFT JOIN [T_PP_ORDERPLAN] AS P WITH(NOLOCK) "); + sql.AppendLine(" ON P.[PID]=O.[ORDERPLANID] "); + sql.AppendLine(" WHERE O.[WORKLOC_CODE]=@workloccode "); + sql.AppendLine(" AND O.[MOULD_CODE]=@mouldcode "); + sql.AppendLine(" AND O.[STATE]='2' "); //工单状态为执行中 + parameters.Add(new DataParameter("workloccode", workloccode)); + parameters.Add(new DataParameter("mouldcode", mouldcode)); + using (var session = AppDataFactory.CreateMainSession()) + { + return session.Get(sql.ToString(), parameters.ToArray()); + } + } + catch (Exception ex) + { + throw ex; + } + } + + /// + /// 获取第一条匹配的派工单 + /// + /// 工序 + /// 产品物料号 + /// + public WorkOrder GetFirstMatchOrder(string workcellcode, string productmaterial,string planpid="") + { + List parameters = new List(); + StringBuilder sql = new StringBuilder(); + sql.AppendLine("SELECT TOP 1 O.* "); + sql.AppendLine(" ,P.[IGNORE_FISBREAK] "); + sql.AppendLine(" ,P.[FIS_ASMSETCODE] "); + sql.AppendLine(" FROM [T_PP_WORKORDER] AS O WITH(NOLOCK) "); + sql.AppendLine(" LEFT JOIN [T_PP_ORDERPLAN] AS P WITH(NOLOCK) "); + sql.AppendLine(" ON P.[PID]=O.[ORDERPLANID] "); + sql.AppendLine(" WHERE O.[WORKCELL_CODE]=@workcellcode "); + if (!string.IsNullOrWhiteSpace(planpid)) + { + sql.AppendLine(" AND O.[ORDERPLANID]=@planpid"); + parameters.Add(new DataParameter("planpid", planpid)); + } + sql.AppendLine(" AND (EXISTS (SELECT 1 "); + sql.AppendLine(" FROM T_MD_PBOM_ITEM AS I "); + sql.AppendLine(" WHERE O.PBOM_CODE = I.PBOM_CODE "); + sql.AppendLine(" AND I.FLGDEL = '0' "); + sql.AppendLine(" AND I.MATERIAL_CODE = @materialcode) "); + sql.AppendLine(" OR O.[MATERIAL_CODE]=@materialcode) "); + sql.AppendLine(" AND (O.[STATE]='0' OR O.[STATE]='1') "); + sql.AppendLine(" ORDER BY O.UPDATEDATE,O.PRI,O.PLAN_DATE,P.PLAN_SEQ,SEQ "); //排序为 FIS优先、日期正序、顺序号正序 + parameters.Add(new DataParameter("workcellcode", workcellcode)); + parameters.Add(new DataParameter("materialcode", productmaterial)); + using (var session = AppDataFactory.CreateMainSession()) + { + return session.Get(sql.ToString(), parameters.ToArray()); + } + } + + /// + /// 获取工序下匹配的派工单 + /// + /// 工序 + /// + public List GetMatchOrders(string workcellcode,string planpid="") + { + List parameters = new List(); + StringBuilder sql = new StringBuilder(); + + sql.AppendLine("SELECT W.* "); + sql.AppendLine(" ,P.[IGNORE_FISBREAK] "); + sql.AppendLine(" ,P.[FIS_ASMSETCODE] "); + sql.AppendLine(" FROM [T_PP_WORKORDER] AS W WITH(NOLOCK) "); + sql.AppendLine(" LEFT JOIN [T_PP_ORDERPLAN] AS P WITH(NOLOCK) "); + sql.AppendLine(" ON P.[PID]=W.[ORDERPLANID] "); + sql.AppendLine(" WHERE W.SEQ = (SELECT TOP 1 SEQ "); + sql.AppendLine(" FROM [T_PP_WORKORDER] AS O WITH(NOLOCK) "); + sql.AppendLine(" LEFT JOIN [T_PP_ORDERPLAN] AS P1 WITH(NOLOCK) "); + sql.AppendLine(" ON P1.[PID]=O.[ORDERPLANID] "); + sql.AppendLine(" WHERE O.[WORKCELL_CODE]=@workcellcode "); + sql.AppendLine(" AND (O.[STATE]='0' OR O.[STATE]='1') "); + if (!string.IsNullOrWhiteSpace(planpid)) + { + sql.AppendLine(" AND O.[ORDERPLANID]=@planpid"); + } + sql.AppendLine(" ORDER BY O.UPDATEDATE,O.PRI,O.PLAN_DATE,P1.PLAN_SEQ,SEQ) ");//排序为 FIS优先、日期正序、计划顺序号、工单顺序号正序 + sql.AppendLine(" AND W.[WORKCELL_CODE]=@workcellcode "); + sql.AppendLine(" AND (W.[STATE]='0' OR W.[STATE]='1') "); + if (!string.IsNullOrWhiteSpace(planpid)) + { + sql.AppendLine(" AND W.[ORDERPLANID]=@planpid"); + parameters.Add(new DataParameter("planpid", planpid)); + } + + parameters.Add(new DataParameter("workcellcode", workcellcode)); + using (var session = AppDataFactory.CreateMainSession()) + { + return session.GetList(sql.ToString(), parameters.ToArray()).ToList(); + } + } + + + #region 改变派工单 + /// + /// 改变派工单 + /// + /// + public void ChangeByOrderPlan(WorkOrder entity) + { + if (this.BaseSession != null) + { + + this.BaseSession.Update(entity); + } + else + { + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + + session.Update(entity); + } + } + + } + #endregion + /// + /// 获取派工单 + /// + /// + /// + public WorkOrder GetworkOrderInfo(WorkOrder model) + { + string sql = null; + List parameters = new List(); + try + { + sql = "SELECT TOP 1 * FROM T_PP_WORKORDER WITH(NOLOCK) WHERE STATE=0 "; + + if (string.IsNullOrEmpty(model.ORDERPLANID) == false) + { + sql += " AND ORDERPLANID = @ORDERPLANID"; + parameters.Add(new DataParameter("ORDERPLANID", model.ORDERPLANID)); + } + if (BaseSession != null) + { + //获取信息 + model = BaseSession.Get(sql, parameters.ToArray()); + } + else + { + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + //获取信息 + model = session.Get(sql, parameters.ToArray()); + } + } + return model; + } + catch (Exception ex) + { + LogManager.LogHelper.Error(new LogInfo() + { + ErrorInfo = ex, + Tag = ex.StackTrace, + Info = "信息数据层-获取信息" + }); + throw; + } + } + + /// + /// 获取指定日期前的FIS计划顺序号 + /// + /// + /// + /// + public string GetLastFISSEQ(DateTime plandate, string workcentercode) + { + StringBuilder sql = new StringBuilder() ; + List parameters = new List(); + try + { + sql.AppendLine("SELECT TOP 1 [PLAN_SEQ] "); + sql.AppendLine(" FROM [T_PP_ORDERPLAN] WITH(NOLOCK) "); + sql.AppendLine(" WHERE [PLANSOURCE]='0' "); + sql.AppendLine(" AND [PLAN_DATE]<@plandate "); + sql.AppendLine(" AND [WORKCENTER_CODE]=@workcentercode "); + sql.AppendLine(" ORDER BY [PLAN_DATE] DESC "); + + parameters.Add(new DataParameter("plandate", plandate)); + parameters.Add(new DataParameter("workcentercode", workcentercode)); + + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + //获取信息 + var ret= session.ExecuteSqlScalar(sql.ToString(), parameters.ToArray()); + if (ret != null) + { + return ret.ToString(); + } + else + { + return ""; + } + } + + } + catch (Exception ex) + { + LogManager.LogHelper.Error(new LogInfo() + { + ErrorInfo = ex, + Tag = ex.StackTrace, + Info = "信息数据层-获取信息" + }); + throw; + } + } + /// + /// 根据模架搜索工单 + /// + /// + /// + public WorkOrder SearchByMould(string mouldcode, string workcellcode) + { + + try + { + StringBuilder sql = new StringBuilder(); + List parameters = new List(); + + sql.AppendLine("SELECT TOP 1 W.* "); + sql.AppendLine(" FROM T_PP_WORKORDER AS W WITH(NOLOCK) "); + sql.AppendLine(" LEFT JOIN [T_PP_ORDERPLAN] AS P WITH(NOLOCK) "); + sql.AppendLine(" ON P.[PID]=W.[ORDERPLANID] "); + sql.AppendLine(" LEFT JOIN T_MD_MATERIAL AS M WITH(NOLOCK) "); + sql.AppendLine(" ON M.MATERIAL_CODE=W.MATERIAL_CODE "); + sql.AppendLine(" LEFT JOIN T_QT_MATERIAL_BINDING AS MB WITH(NOLOCK) "); + sql.AppendLine(" ON MB.MATERIAL_CODE=M.MATERIAL_TYPE_CODE "); + sql.AppendLine(" AND MB.BINDING_TYPE='ASSY' "); + sql.AppendLine(" WHERE MB.TARGET_CODE=@mouldcode "); + sql.AppendLine(" AND W.WORKCELL_CODE=@workcellcode "); + sql.AppendLine(" AND (W.STATE='1' OR W.STATE='0') "); + sql.AppendLine(" ORDER BY W.UPDATEDATE,W.PRI,w.PLAN_DATE,P.PLAN_SEQ,W.SEQ "); + + parameters.Add(new DataParameter("mouldcode", mouldcode)); + parameters.Add(new DataParameter("workcellcode", workcellcode)); + + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + //获取信息 + return session.Get(sql.ToString(), parameters.ToArray()); + } + } + catch (Exception ex) + { + LogManager.LogHelper.Error(new LogInfo() + { + ErrorInfo = ex, + Tag = ex.StackTrace, + Info = "信息数据层-获取信息" + }); + throw; + } + } + + + + public List GetListByID(string[] orderid) + { + try + { + StringBuilder sql = new StringBuilder(); + List parameters = new List(); + + string ids = string.Join("','", orderid); + + sql.AppendFormat("SELECT * FROM T_PP_WORKORDER WITH(NOLOCK) WHERE PID IN ('{0}')", ids); + + + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + //获取信息 + return session.GetList(sql.ToString(), parameters.ToArray()).ToList(); + } + } + catch (Exception ex) + { + LogManager.LogHelper.Error(new LogInfo() + { + ErrorInfo = ex, + Tag = ex.StackTrace, + Info = "信息数据层-获取信息GetListByID" + }); + throw; + } + } + /// + /// 批量更新 + /// + /// + /// + public int Update(List orders) + { + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + //获取信息 + return session.Update(orders); + } + } + /// + /// 批量删除 + /// + /// + /// + public int Delete(List orders) + { + using (IDataSession session = AppDataFactory.CreateMainSession()) + { + //获取信息 + return session.Delete(orders); + } + } + + public WorkOrder GetWorkingOrderWithProduct(string workcellcode, string productcode, string planpid = "") + { + List parameters = new List(); + StringBuilder sql = new StringBuilder(); + sql.AppendLine("SELECT TOP 1 O.* "); + sql.AppendLine(" ,P.[IGNORE_FISBREAK] "); + sql.AppendLine(" ,P.[FIS_ASMSETCODE] "); + sql.AppendLine(" FROM [T_PP_WORKORDER] AS O WITH(NOLOCK) "); + sql.AppendLine(" LEFT JOIN [T_PP_ORDERPLAN] AS P WITH(NOLOCK) "); + sql.AppendLine(" ON P.[PID]=O.[ORDERPLANID] "); + sql.AppendLine(" WHERE O.[WORKCELL_CODE]=@workcellcode "); + if (!string.IsNullOrWhiteSpace(planpid)) + { + sql.AppendLine(" AND O.[ORDERPLANID]=@planpid"); + parameters.Add(new DataParameter("planpid", planpid)); + } + sql.AppendLine(" AND O.[REMARK]=@productcode"); + sql.AppendLine(" AND (O.[STATE]='0' OR O.[STATE]='1') "); + sql.AppendLine(" ORDER BY O.UPDATEDATE,O.PRI,O.PLAN_DATE,P.PLAN_SEQ,SEQ "); //排序为 FIS优先、日期正序、顺序号正序 + parameters.Add(new DataParameter("workcellcode", workcellcode)); + parameters.Add(new DataParameter("productcode", productcode)); + using (var session = AppDataFactory.CreateMainSession()) + { + return session.Get(sql.ToString(), parameters.ToArray()); + } + } + + public int GetDayPlanCount(string workcentercode, DateTime date) + { + try + { + List parameters = new List(); + StringBuilder sql = new StringBuilder(); + sql.AppendLine("SELECT ISNULL(SUM(QTY),0) "); + sql.AppendLine(" FROM T_PP_ORDERPLAN WITH(NOLOCK) "); + sql.AppendLine(" WHERE WORKCENTER_CODE=@workcentercode "); + //sql.AppendLine(" AND DATEDIFF(DAY,PLAN_DATE,@date)=0 "); + sql.AppendFormat(" AND [PLAN_DATE] BETWEEN @date1 AND @date2"); + parameters.Add(new DataParameter("date1", date.Date)); + parameters.Add(new DataParameter("date2", date.Date.AddDays(1))); + + parameters.Add(new DataParameter("workcentercode", workcentercode)); + //parameters.Add(new DataParameter("date", date)); + + using (var session = AppDataFactory.CreateMainSession()) + { + return (int)session.ExecuteSqlScalar(sql.ToString(), parameters.ToArray()); + } + } + catch (Exception ex) + { + throw ex; + } + } + + public int SetOrderPrinted(string orderpid) + { + List parameters = new List(); + StringBuilder sql = new StringBuilder(); + sql.AppendLine("UPDATE T_PP_WORKORDER SET PRINTED='1' WHERE PID=@orderpid"); + parameters.Add(new DataParameter("orderpid", orderpid)); + + using (var session = AppDataFactory.CreateMainSession()) + { + return session.ExecuteSql(sql.ToString(), parameters.ToArray()); + } + } + + public List GetLastFISPlan(string workcellcode, string routecode) + { + List parameters = new List(); + StringBuilder sql = new StringBuilder(); + sql.AppendLine("SELECT TOP 2 P.* "); + sql.AppendLine(" FROM T_PP_ORDERPLAN AS P WITH(NOLOCK) "); + sql.AppendLine(" LEFT JOIN T_PP_WORKORDER AS W WITH(NOLOCK) "); + sql.AppendLine(" ON W.ORDERPLAN_NO=P.PLAN_NO "); + sql.AppendLine(" WHERE P.PLANSOURCE='0' "); + sql.AppendLine(" AND P.ROUTE_CODE=@routecode "); + sql.AppendLine(" AND ((W.WORKCELL_CODE=@workcellcode "); + sql.AppendLine(" AND W.STATE='4') "); + sql.AppendLine(" OR W.WORKCELL_CODE<>@workcellcode) "); + sql.AppendLine(" ORDER BY P.PLAN_DATE DESC,P.PLAN_SEQ DESC,P.PLAN_NO DESC"); + parameters.Add(new DataParameter("workcellcode", workcellcode)); + parameters.Add(new DataParameter("routecode", routecode)); + + using (var session = AppDataFactory.CreateMainSession()) + { + return session.GetList(sql.ToString(), parameters.ToArray()).ToList(); + } + } + } +} diff --git a/APPQ5/QMAPP.FJC.Entity/TianJin/TJWorkOrder.cs b/APPQ5/QMAPP.FJC.Entity/TianJin/TJWorkOrder.cs index 6d6ec89..7755ae5 100644 --- a/APPQ5/QMAPP.FJC.Entity/TianJin/TJWorkOrder.cs +++ b/APPQ5/QMAPP.FJC.Entity/TianJin/TJWorkOrder.cs @@ -93,6 +93,10 @@ namespace QMAPP.FJC.Entity.TianJin [DBColumn(ColumnName = "UPDATEDATE", DataType = DbType.DateTime)] public DateTime UPDATEDATE { get; set; } + public int PRI { get; set; } + public string PBOM_CODE { get; set; } + public string WORKCELL_CODE { get; set; } + public string ORDER_TYPE { get; set; } } } diff --git a/APPQ5/QMAPP.WinForm/App.config b/APPQ5/QMAPP.WinForm/App.config index 2e74d92..f59e43a 100644 --- a/APPQ5/QMAPP.WinForm/App.config +++ b/APPQ5/QMAPP.WinForm/App.config @@ -185,10 +185,10 @@ - + + --> - + diff --git a/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm.cs b/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm.cs index e71886a..ed4213f 100644 --- a/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm.cs +++ b/APPQ5/QMAPP.WinForm/Forms/Operation/OperationForm.cs @@ -125,7 +125,7 @@ namespace QMAPP.WinForm.Forms.Operation if (str__cfgAutoInputLocs.Split(';').Length > 0) _cfgAutoInputLocs = str__cfgAutoInputLocs.Split(';'); _cfgAutoInputSwitch = GetAppConfigValue("AutoInputSwitch"); //查找所有 需要自动填充的工位 - _bentiBarCodeRegex = GetAppConfigValue("AutoInput条码正则表达式"); + _bentiBarCodeRegex = GetAppConfigValue("AutoInput"); _052printWorkloc = System.Configuration.ConfigurationManager.AppSettings["052打印工位"]; _371BiaoPiBarCodeRegex = System.Configuration.ConfigurationManager.AppSettings["052打印条码规则371"]; @@ -907,10 +907,10 @@ namespace QMAPP.WinForm.Forms.Operation if (!string.IsNullOrEmpty(result.MATERIAL_CODE)) { var bomCodes = GetPBOMCODEValue(result.MATERIAL_CODE); - List filterList = list.Where(p => bomCodes.Contains(p.PBOM_CODE)).ToList(); - if (filterList.Count > 0) + //List filterList = list.Where(p => bomCodes.Contains(p.PBOM_CODE)).ToList(); + if (bomCodes.Count > 0) { - string PBOM_CODE = filterList[0].PBOM_CODE; + string PBOM_CODE = bomCodes[0]; //List autoInputBarCodes = LocSwitchHelper.GetAutoInputBarCode(bomCode, _operationServiceParam.machineInfo.WORKLOC_CODE); diff --git a/APPQ5/QMAPP.WinForm/Forms/TianJin/TJFrmItemList.cs b/APPQ5/QMAPP.WinForm/Forms/TianJin/TJFrmItemList.cs index ad4c2c3..76ac5fe 100644 --- a/APPQ5/QMAPP.WinForm/Forms/TianJin/TJFrmItemList.cs +++ b/APPQ5/QMAPP.WinForm/Forms/TianJin/TJFrmItemList.cs @@ -10,6 +10,7 @@ using CarSystem.Account.FileUtil; using System.Configuration; using DCS.Place; using Model; +using QMAPP.ServicesAgent; namespace QMAPP.WinForm.Forms.TianJin { @@ -18,12 +19,17 @@ namespace QMAPP.WinForm.Forms.TianJin /// public partial class TJFrmItemList : Form { + + private string _TJFYPrintName = string.Empty; //打印机名称 + /// /// /// public TJFrmItemList() { InitializeComponent(); + + _TJFYPrintName = GetAppConfigValue("FYPrintName"); //查找所有 需要自动填充的工位 } @@ -364,16 +370,35 @@ namespace QMAPP.WinForm.Forms.TianJin dt.Rows.Add(ncsdr); index++; } - prin.Print(dt); - //MessageBox.Show("打印成功!"); + //prin.Print(dt); + if (!string.IsNullOrEmpty(_TJFYPrintName)) + { + System.Drawing.Printing.PrintDocument doc = new System.Drawing.Printing.PrintDocument(); + doc.PrinterSettings.PrinterName = _TJFYPrintName; + prin.Print(dt, _TJFYPrintName); + } + else + { + prin.Print(dt); + } } + /// + /// 查找配置表 + /// + /// + public string GetAppConfigValue(string pConfigCode) + { + QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent(); + var AppConfig = agent.InvokeServiceFunction(B9IPCService.AppConfigBLL_Get.ToString(), pConfigCode); - - - - + if (AppConfig != null) + return AppConfig.Value; + else + return null; + } + } } diff --git a/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPastCard.rpt b/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPastCard.rpt index a0bab9d..01f395c 100644 Binary files a/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPastCard.rpt and b/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPastCard.rpt differ diff --git a/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.Designer.cs b/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.Designer.cs index 0df743c..7bcd5f7 100644 --- a/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.Designer.cs +++ b/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.Designer.cs @@ -29,16 +29,16 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TJPrintPlanLabel)); this.dgvPlan = new System.Windows.Forms.DataGridView(); this.dgcOrderNo = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -87,14 +87,14 @@ | System.Windows.Forms.AnchorStyles.Right))); this.dgvPlan.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; this.dgvPlan.BackgroundColor = System.Drawing.SystemColors.ButtonFace; - dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dgvPlan.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dgvPlan.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; this.dgvPlan.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvPlan.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dgcOrderNo, @@ -111,16 +111,16 @@ this.dgvPlan.Location = new System.Drawing.Point(6, 6); this.dgvPlan.Name = "dgvPlan"; this.dgvPlan.ReadOnly = true; - dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle19.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle19.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle19.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle19.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle19.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dgvPlan.RowHeadersDefaultCellStyle = dataGridViewCellStyle19; - dataGridViewCellStyle20.Padding = new System.Windows.Forms.Padding(0, 0, 8, 0); - this.dgvPlan.RowsDefaultCellStyle = dataGridViewCellStyle20; + dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dgvPlan.RowHeadersDefaultCellStyle = dataGridViewCellStyle9; + dataGridViewCellStyle10.Padding = new System.Windows.Forms.Padding(0, 0, 8, 0); + this.dgvPlan.RowsDefaultCellStyle = dataGridViewCellStyle10; this.dgvPlan.RowTemplate.Height = 23; this.dgvPlan.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgvPlan.Size = new System.Drawing.Size(1350, 183); @@ -131,8 +131,8 @@ // dgcOrderNo // this.dgcOrderNo.DataPropertyName = "ORDERPLAN_NO"; - dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.dgcOrderNo.DefaultCellStyle = dataGridViewCellStyle12; + dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.dgcOrderNo.DefaultCellStyle = dataGridViewCellStyle2; this.dgcOrderNo.HeaderText = "订单号"; this.dgcOrderNo.Name = "dgcOrderNo"; this.dgcOrderNo.ReadOnly = true; @@ -141,8 +141,8 @@ // dgcSeq // this.dgcSeq.DataPropertyName = "SEQ"; - dataGridViewCellStyle13.Font = new System.Drawing.Font("宋体", 15.75F); - this.dgcSeq.DefaultCellStyle = dataGridViewCellStyle13; + dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 15.75F); + this.dgcSeq.DefaultCellStyle = dataGridViewCellStyle3; this.dgcSeq.HeaderText = "顺序号"; this.dgcSeq.Name = "dgcSeq"; this.dgcSeq.ReadOnly = true; @@ -151,8 +151,8 @@ // dgcMaterialCode // this.dgcMaterialCode.DataPropertyName = "MATERIAL_CODE"; - dataGridViewCellStyle14.Font = new System.Drawing.Font("宋体", 15.75F); - this.dgcMaterialCode.DefaultCellStyle = dataGridViewCellStyle14; + dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 15.75F); + this.dgcMaterialCode.DefaultCellStyle = dataGridViewCellStyle4; this.dgcMaterialCode.HeaderText = "零件号"; this.dgcMaterialCode.Name = "dgcMaterialCode"; this.dgcMaterialCode.ReadOnly = true; @@ -161,8 +161,8 @@ // dgcMaterialName // this.dgcMaterialName.DataPropertyName = "MATERIAL_NAME"; - dataGridViewCellStyle15.Font = new System.Drawing.Font("宋体", 15.75F); - this.dgcMaterialName.DefaultCellStyle = dataGridViewCellStyle15; + dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 15.75F); + this.dgcMaterialName.DefaultCellStyle = dataGridViewCellStyle5; this.dgcMaterialName.HeaderText = "零件描述"; this.dgcMaterialName.Name = "dgcMaterialName"; this.dgcMaterialName.ReadOnly = true; @@ -170,8 +170,8 @@ // // dgcState // - dataGridViewCellStyle16.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.dgcState.DefaultCellStyle = dataGridViewCellStyle16; + dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.dgcState.DefaultCellStyle = dataGridViewCellStyle6; this.dgcState.HeaderText = "工单状态"; this.dgcState.MinimumWidth = 80; this.dgcState.Name = "dgcState"; @@ -181,8 +181,8 @@ // dgcPlanDate // this.dgcPlanDate.DataPropertyName = "PLAN_DATE"; - dataGridViewCellStyle17.Font = new System.Drawing.Font("宋体", 15.75F); - this.dgcPlanDate.DefaultCellStyle = dataGridViewCellStyle17; + dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 15.75F); + this.dgcPlanDate.DefaultCellStyle = dataGridViewCellStyle7; this.dgcPlanDate.HeaderText = "计划日期"; this.dgcPlanDate.Name = "dgcPlanDate"; this.dgcPlanDate.ReadOnly = true; @@ -191,8 +191,8 @@ // dgcShift // this.dgcShift.DataPropertyName = "SHIFT_CODE"; - dataGridViewCellStyle18.Font = new System.Drawing.Font("宋体", 15.75F); - this.dgcShift.DefaultCellStyle = dataGridViewCellStyle18; + dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 15.75F); + this.dgcShift.DefaultCellStyle = dataGridViewCellStyle8; this.dgcShift.HeaderText = "计划类型"; this.dgcShift.Name = "dgcShift"; this.dgcShift.ReadOnly = true; @@ -453,14 +453,11 @@ this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox1.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.comboBox1.FormattingEnabled = true; - this.comboBox1.Items.AddRange(new object[] { - "显示全部工单", - "隐藏挂起工单", - "只看挂起工单"}); this.comboBox1.Location = new System.Drawing.Point(595, 64); this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(175, 33); this.comboBox1.TabIndex = 17; + this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); // // label2 // diff --git a/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.cs b/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.cs index 036dbf2..e0e7463 100644 --- a/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.cs +++ b/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.cs @@ -44,6 +44,13 @@ namespace QMAPP.WinForm.Forms.TianJin cbRoutes.DisplayMember = "ROUTE_NAME"; cbRoutes.ValueMember = "ROUTE_CODE"; cbRoutes.DataSource = cbsource; + + var listDir = new List(); + listDir.Add(new Direction { Code = "左", Name = "左侧" }); + listDir.Add(new Direction { Code = "右", Name = "右侧" }); + comboBox1.DisplayMember = "Name"; + comboBox1.ValueMember = "Code"; + comboBox1.DataSource = listDir; } #region 加载列表显示设置 @@ -69,6 +76,7 @@ namespace QMAPP.WinForm.Forms.TianJin cbListRowcount.SelectedIndexChanged += new EventHandler(cbListRowcount_SelectedIndexChanged); cbRefreshRate.SelectedIndexChanged += new EventHandler(cbRefreshRate_SelectedIndexChanged); cbPlanFilter.TextChanged += new EventHandler(cbPlanFilter_SelectedIndexChanged); + comboBox1.TextChanged += new EventHandler(cbPlanFilter_SelectedIndexChanged); #endregion } @@ -96,7 +104,7 @@ namespace QMAPP.WinForm.Forms.TianJin dataPage.PageIndex = 1; dataPage.SortExpression = " ROWVALUE ASC"; #region 服务查询 - var orderlist = _agent.InvokeServiceFunction>("WorkOrderBLL_GetOrderUnPrinted", cbRoutes.SelectedValue.ToString(), cbPlanFilter.SelectedIndex, dataPage); + var orderlist = _agent.InvokeServiceFunction>("TJWorkOrderBLL_GetOrderUnPrinted", cbRoutes.SelectedValue.ToString(), cbPlanFilter.SelectedIndex, dataPage, comboBox1.SelectedValue.ToString()); #endregion this.dgvPlan.DataSource = orderlist; } @@ -488,6 +496,16 @@ namespace QMAPP.WinForm.Forms.TianJin else return null; } + + private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) + { + SaveSetting(); + BindPlanView(); + } + } + class Direction { + public string Code { get; set; } + public string Name { get; set; } } class LabelData { diff --git a/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.resx b/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.resx index f09aad3..e069562 100644 --- a/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.resx +++ b/APPQ5/QMAPP.WinForm/Forms/TianJin/TJPrintPlanLabel.resx @@ -153,9 +153,6 @@ 17, 17 - - 17, 17 - diff --git a/APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs b/APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs index 19eb21a..d27e626 100644 --- a/APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs +++ b/APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2022.03.28.02")] -[assembly: AssemblyFileVersion("2022.03.28.02")] +[assembly: AssemblyVersion("2022.03.29.01")] +[assembly: AssemblyFileVersion("2022.03.29.01")] diff --git a/ServicesCenter/WCF/QMFrameWork.WebServiceHost/App_Data/FJCServiceList.xml b/ServicesCenter/WCF/QMFrameWork.WebServiceHost/App_Data/FJCServiceList.xml index 733bfd5..ae81a8e 100644 --- a/ServicesCenter/WCF/QMFrameWork.WebServiceHost/App_Data/FJCServiceList.xml +++ b/ServicesCenter/WCF/QMFrameWork.WebServiceHost/App_Data/FJCServiceList.xml @@ -974,4 +974,11 @@ QMAPP.FJC.BLL.DLL + + TJWorkOrderBLL + 派工单 + QMAPP.FJC.BLL.TianJin.TJWorkOrderBLL + QMAPP.FJC.BLL.dll + + \ No newline at end of file