| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 工序流转卡维护-查询-分页 |
| | | /// <summary> |
| | | /// 返回工序流转卡维护列表主表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("LEMS/Sc_ProcessExchangeBillList_QueryCheckRecord_byPage")] |
| | | [HttpGet] |
| | | public object Sc_ProcessExchangeBillList_QueryCheckRecord_byPage(string sWhere, string user, string Organization, int page, int size, string HBillSubType) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | if (HBillSubType == "SUB") |
| | | { |
| | | //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_SubQuery", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "指引卡无查询权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "流转卡无查询权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | //获取系统参数 |
| | | string Ret = ""; |
| | | if (oSystemParameter.ShowBill(ref Ret)) |
| | | { |
| | | //判断客户为龙山汽配 |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "龙山汽配") |
| | | { |
| | | //获取需要拼接的字符串 |
| | | string sql_splice = DBUtility.ClsPub.SpliceSQL(user, "工序派工单列表"); |
| | | |
| | | sWhere += sql_splice; |
| | | } |
| | | } |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | sWhere = sWhere.Replace("'", "''"); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBillCheckRecordListPage " + page + "," + size + "," + "''", "h_p_Sc_ProcessExchangeBillList_Query"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBillCheckRecordListPage " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_ProcessExchangeBillList_Query"); |
| | | } |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.list = columnNameList; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "异常!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 工序流转卡 下查 |
| | | /// <summary> |
| | | /// </summary> |
| | |
| | | public object MES_ProcessExchangeBillList_PG(string sWhere, string user, int OperationType) |
| | | { |
| | | DataSet ds; |
| | | string sql = ""; |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | sql = "select top 1000 * from h_v_Sc_ProcessExchangeArrangementList_PG where 1 = 1 " + sWhere + " order by hmainid desc "; |
| | | |
| | | if (OperationType == 1) |
| | | { |
| | | //获取系统参数 |
| | |
| | | sWhere += " "; |
| | | |
| | | } |
| | | else if (oSystemParameter.omodel.WMS_CampanyName == "凯贝奈特") |
| | | { |
| | | sql = "select top 1000 * from h_v_Sc_ProcessExchangeArrangementList_PG where 1 = 1 " + sWhere; |
| | | } |
| | | else |
| | | { |
| | | sWhere += " "; |
| | |
| | | } |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | ds = oCN.RunProcReturn("select top 1000 * from h_v_Sc_ProcessExchangeArrangementList_PG where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeArrangementList_PG"); |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessExchangeArrangementList_PG"); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | |
| | | } |
| | | else if (oSystemParameter.omodel.WMS_CampanyName == "凯贝奈特") |
| | | { |
| | | sql = "select top 1000 * from h_v_Sc_ProcessExchangeArrangementList_PG where 1 = 1 " + sWhere; |
| | | } |
| | | } |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeArrangementList_PG where 1 = 1 " + sWhere, "h_v_Sc_ProcessExchangeArrangementList_PG"); |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessExchangeArrangementList_PG"); |
| | | } |
| | | |
| | | //添加列名 |
| | |
| | | string sql = "select * from h_v_Sc_ProcessExchangeBillQuerySub where hmainid = "; |
| | | string sql1 = sql + sWhere; |
| | | ds = oCN.RunProcReturn(sql1 + " order by cast(工序号 as int)", "h_v_Sc_ProcessExchangeBillQuerySub"); |
| | | return GetObjectJson(ds); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-045]没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回工序流转卡维护列表从表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("LEMS/MES_Sc_ProcessExchangeBillQueryCheckRecordSub_Json")] |
| | | [HttpGet] |
| | | public object MES_Sc_ProcessExchangeBillQueryCheckRecordSub_Json(string sWhere, int selected) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | string sql = "exec h_p_ProcessExchangeBillCheckRecordList_GetSubBillList " + |
| | | "@sWhere = N'" + sWhere + "'" + |
| | | ", @selected = N'" + selected + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_ProcessExchangeBillCheckRecordList_GetSubBillList"); |
| | | return GetObjectJson(ds); |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 工艺路线单关闭/反关闭功能(设置开始时间结束时间) |
| | | [Route("Gy_RoutingBill/CloseSetDate")] |
| | | [HttpGet] |
| | | public object CloseGy_RoutingBill(string HInterID, int Type, string user, string HBillSubType,DateTime HBeginDate,DateTime HEndDate) |
| | | { |
| | | try |
| | | { |
| | | if (HBillSubType == "SUB") |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Sub_Close", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "子工艺路线无权限关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Close", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "工艺路线无权限关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Gy_RoutingBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 关闭 2 反关闭 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经关闭 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不需要再关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | string HBillStatus = Convert.ToString(ds.Tables[0].Rows[0]["HBillStatus"]); |
| | | //string hdeleteman = Convert.ToString(ds.Tables[0].Rows[0]["hdeleteman"]); |
| | | if (HBillStatus == "6") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据在审核中,不能关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //关闭单据 |
| | | if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //获取系统参数设置失效时间 |
| | | string Ret = ""; |
| | | if (oSystemParameter.ShowBill(ref Ret)) |
| | | { |
| | | //判断客户 |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "添康科技") //系统参数 |
| | | { |
| | | //刷新失效时间 |
| | | oCN.RunProc("update Gy_RoutingBillMain set HEndDate = CONVERT(date, DATEADD(day, -1, GETDATE())) where HInterID = " + HInterID); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反关闭 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未手动关闭!需要先关闭"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | string HBillStatus = Convert.ToString(ds.Tables[0].Rows[0]["HBillStatus"]); |
| | | //string hdeleteman = Convert.ToString(ds.Tables[0].Rows[0]["hdeleteman"]); |
| | | if (HBillStatus == "6") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据在审核中,不能反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //反关闭单据 |
| | | if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //获取系统参数设置失效时间 |
| | | string Ret = ""; |
| | | if (oSystemParameter.ShowBill(ref Ret)) |
| | | { |
| | | //判断客户 |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "添康科技") //系统参数 |
| | | { |
| | | //刷新失效时间 |
| | | oCN.RunProc($"update Gy_RoutingBillMain set HEndDate = '{HEndDate}',HBeginDate = '{HBeginDate}' where HInterID = " + HInterID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 报表查看权限控制 |
| | | /// <summary> |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 更新app |
| | | /// <summary> |
| | | ///参数:string HInterID。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("LMES/AppUpdate")] |
| | | [HttpGet] |
| | | public object AppUpdate(string Type) |
| | | { |
| | | try |
| | | { |
| | | DataSet ds; |
| | | ds = oCN.RunProcReturn("exec h_p_Gy_APPUpdateInformation " + Type , "h_p_Gy_APPUpdateInformation"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |