| | |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using Pub_Class; |
| | | using SyntacticSugar.constant; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill(); |
| | | //自定义34进制数组 |
| | | private static char[] lNCode = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }; |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 返回进站扫描列表|工序进站接收单列表 |
| | | ///参数:string sql。 |
| | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillList_Query where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeBillList_Query"); |
| | | ds = oCN.RunProcReturn("select top 3000 * from h_v_Sc_ProcessExchangeBillList_Query where 1 = 1 " + sWhere + " order by 单据号 desc ", "h_v_Sc_ProcessExchangeBillList_Query"); |
| | | |
| | | |
| | | //添加列名 |
| | |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | 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> |
| | | /// 返回工序流转卡维护列表主表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("LEMS/Sc_ProcessExchangeBillList_Query_byPage")] |
| | | [HttpGet] |
| | | public object Sc_ProcessExchangeBillList_Query_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_ProcessExchangeBillList_Query " + page + "," + size + ",'" + Organization + "'," + "''", "h_p_Sc_ProcessExchangeBillList_Query"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBillList_Query " + page + "," + size + ",'" + Organization + "','" + 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> |
| | | /// 返回工序流转卡维护列表主表 |
| | | ///参数: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]; |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn(@"select * from Sc_ICMOBillStatus_Tmp where HSourceInterID='"+ HInterID + "' and HSourceEntryID='"+ HEntryID + "'", "Sc_ICMOBillStatus_Tmp"); |
| | | if (ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "该工序已派单,不允许重复排单!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=" + HSourceID + " where HInterID=" + HInterID + " and HEntryID=" + HEntryID); |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | 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) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-045]没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | |
| | | #region 工艺路线 |
| | | |
| | | #region 工艺路线分页列表 |
| | | [Route("Gy_RoutingBill/page")] |
| | | [HttpGet] |
| | | public object Gy_RoutingBillPage(string sWhere, string user, int page, int size) |
| | | { |
| | | DataSet ds; |
| | | json res = new json(); |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //编辑权限 |
| | | //if (!DBUtility.ClsPub.Security_Log_second("Gy_RoutingBill_Query", 1, false, user)) |
| | | //{ |
| | | // res.code = "0"; |
| | | // res.count = 0; |
| | | // res.Message = "无查看权限!"; |
| | | // res.data = null; |
| | | // return res; |
| | | //} |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Gy_RoutingBillList " + page + "," + size + ",''", "h_p_Gy_RoutingBillList"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Gy_RoutingBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Gy_RoutingBillList"); |
| | | } |
| | | |
| | | //添加列名 |
| | | 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列对象的列名 |
| | | } |
| | | |
| | | res.code = CodeConstant.SUCCEED; |
| | | res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | res.Message = "Sucess!"; |
| | | res.list = columnNameList; |
| | | res.data = ds.Tables[0]; |
| | | return res; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | res.code = CodeConstant.FAIL; |
| | | res.count = CountConstant.FAIL; |
| | | res.Message = "Exception!" + e.ToString(); |
| | | res.data = null; |
| | | return res; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 工艺路线列表 |
| | | /// <summary> |
| | | /// 返回工艺路线列表 |
| | |
| | | DataSet ds; |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | if (HBillSubType == "SUB") |
| | | { |
| | | //判断是否有查询权限 |
| | |
| | | { |
| | | string sql1 = "select * from h_v_Gy_RoutingBillList where 1 = 1 "; |
| | | //客户自定义 |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "瑞与祺" || oSystemParameter.omodel.WMS_CampanyName == "凯贝奈特") |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "瑞与祺" || oSystemParameter.omodel.WMS_CampanyName == "凯贝奈特" ) |
| | | { |
| | | sql1 = "select top 1000 * from h_v_Gy_RoutingBillList where 1 = 1 "; |
| | | } |
| | | string sql = sql1 + sWhere + " order by hmainid desc,cast(工序号 as int)"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_RoutingBillList"); |
| | | } //添加列名 |
| | | 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 = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | DataSet ds; |
| | | try |
| | | { |
| | | //List<object> columnNameList = new List<object>(); //定义声明变量 ,把通过 new List<object>()创建的 实例,赋值给变量 |
| | | //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Query", 1, false, user)) |
| | | { |
| | |
| | | string sql = sql1 + sWhere + " order by hmainid desc,cast(工序号 as int)"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_RoutingBillList_His"); |
| | | } |
| | | //foreach (DataColumn col in ds.Tables[0].Columns)//遍历ds中第一个表(Tables[0])的所有列(Columns)每次循环中,col变量会持有当前列的引用 |
| | | //{ |
| | | // Type dataType = col.DataType; //获取当前数据类型传入 自定义变量datadataType |
| | | // string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //字符串拼接 // 将列名和数据类型信息拼接成一个JSON格式的字符串 |
| | | // columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | //} |
| | | //objJsonResult.code = "1"; |
| | | //objJsonResult.count = 1; |
| | | //objJsonResult.Message = "Sucess!"; |
| | | //objJsonResult.data = ds.Tables[0];//代码将第一个DataTable(索引为0)赋值给objJsonResult的data属性 |
| | | //objJsonResult.list = columnNameList;//将columnNameList赋值给objJsonResult的list属性 |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | if (oSystemParameter.ShowBill(ref Ret)) |
| | | { |
| | | //判断客户为龙山汽配 |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "龙山汽配") |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "龙山汽配" || oSystemParameter.omodel.WMS_CampanyName == "添康科技") |
| | | { |
| | | //判断是否有查询工价权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_CheckProcPrice", 1, false, UserName)) |
| | |
| | | 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; |
| | | } |
| | | DataSet dss; |
| | | //判断工艺路线是否被引用 |
| | | dss = oCN.RunProcReturn("select COUNT(*) as number from Sc_ProcessExchangeBillMain where HRoutingBillID = " + lngBillKey, "Gy_RoutingBillMain"); |
| | | //判断是否可编辑 |
| | | if (dss.Tables[0].Rows[0]["number"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据已经被引用,不允许删除!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | var HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | //if (hdeleteman != "") |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Gy_RoutingBill_BeforeDelCtrl " + lngBillKey + ",'" + HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Gy_RoutingBill_BeforeDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | |
| | | |
| | | oCN.RunProc("delete from Gy_RoutingBillmain where HInterID=" + lngBillKey); |
| | | oCN.RunProc("delete from Gy_RoutingBillSub where HInterID=" + lngBillKey); |
| | | |
| | | LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",删除工艺路线单据:" + ds.Tables[0].Rows[0]["HBillNo"].ToString()); |
| | | oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "删除工艺路线单据:" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','LMES-工艺路线模块','" + DBUtility.ClsPub.IPAddress + "','删除单据'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //删除后控制================================================================================== |
| | | string sql2 = "exec h_p_Gy_RoutingBill_AfterDelCtrl " + lngBillKey + ",'" + HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql2, "h_p_Gy_RoutingBill_AfterDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:删除后判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //============================================================================================== |
| | | |
| | | |
| | | |
| | | |
| | | LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",删除工艺路线单据:" + HBillNo); |
| | | oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "删除工艺路线单据:" + HBillNo + "','LMES-工艺路线模块','" + DBUtility.ClsPub.IPAddress + "','删除单据'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | oCN.Commit();//提交事务 |
| | | objJsonResult.code = "0"; |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 工艺路线批改小时产能 |
| | | [Route("Gy_RoutingBill/BulkWorkQty")] |
| | | [HttpGet] |
| | | public object BulkWorkQty(string HMaterNumber1, string HMaterNumber2,string HProcID, string HWorkQty) |
| | | { |
| | | try |
| | | { |
| | | oCN.BeginTran(); |
| | | |
| | | string sql = $"update b set b.HWorkQty = {HWorkQty} from Gy_RoutingBillMain a left join Gy_RoutingBillSub b on a.HInterID = b.HInterID left join Gy_Material m on a.HMaterID = m.HItemID where m.HNumber between '{HMaterNumber1}' and '{HMaterNumber2}' and b.HProcID = {HProcID} and a.HCloseMan = ''"; |
| | | |
| | | //执行更新上班工时语句 |
| | | oCN.RunProc(sql); |
| | | |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "批改成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | |
| | | DataSet ds; |
| | | try |
| | | { |
| | | //判断是否有查询权限 |
| | | List<object> columnNameList = new List<object>() |
| | | ; //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBillQuery", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where 1 = 1 " + sWhere + " order by 制单日期 desc,单据号 desc", "h_v_IF_ICMOBillList"); |
| | | //添加列名 |
| | | 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列对象的列名 |
| | | } |
| | | |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | //objJsonResult.code = "1"; |
| | | //objJsonResult.count = 1; |
| | | //objJsonResult.Message = "Sucess!"; |
| | | //objJsonResult.data = ds.Tables[0]; |
| | | //objJsonResult.list = a; |
| | | //return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | } |
| | | return GetObjectJson(ds); |
| | | } |
| | | |
| | | |
| | | #region 生产订单列表-分页 |
| | | [Route("LEMS/MES_IF_ICMOBillList_Json_byPage")] |
| | | [HttpGet] |
| | | public object MES_IF_ICMOBillList_Json_byPage(string sWhere, string user, string Organization, int page, int size) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>() |
| | | ; //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_ICMOBillQuery", 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; |
| | | } |
| | | } |
| | | |
| | | sWhere = sWhere.Replace("'", "''"); |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_IF_ICMOBillList " + page + "," + size + ",'" + Organization + "'," + "''", "h_p_IF_ICMOBillList"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_IF_ICMOBillList " + page + "," + size + ",'" + Organization + "','" + sWhere + "'", "h_p_IF_ICMOBillList"); |
| | | } |
| | | |
| | | //添加列名 |
| | | 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; |
| | | } |
| | | return GetObjectJson(ds); |
| | | } |
| | | #endregion |
| | | |
| | | #region 工序流转卡下推生产质量汇报单 |
| | | [Route("LEMS/MES_IF_ProcessBillList_Json")] |
| | | [HttpGet] |
| | | public object MES_IF_ProcessBillList_Json(string hinterid, string HEntryID, string user) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillQuerySub where hmainid ='" + hinterid+ "' and HEntryID='"+ HEntryID + "'", "h_v_Sc_ProcessExchangeBillQuerySub"); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | return GetObjectJson(ds); |
| | | } |
| | | #endregion |
| | | |
| | | #region 工序流转卡下推设备点检参数表 |
| | | [Route("LEMS/MES_IF_EquipICMOTechParamList_Json")] |
| | | [HttpGet] |
| | | public object MES_IF_EquipICMOTechParamList_Json(string hinterid, string HEntryID, string user) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn(" exec h_p_Sc_ProcessExchangeBillQuery_TechParam '" + hinterid + "' , '" + HEntryID + "'", "h_p_Sc_ProcessExchangeBillQuery_TechParam"); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | return GetObjectJson(ds); |
| | | } |
| | | #endregion |
| | | |
| | | #region 生产订单 下查 |
| | | /// <summary> |
| | |
| | | { |
| | | ds = oCN.RunProcReturn("exec [h_p_Sc_ProductionAnalysisReportList] '" + DateYear + "','" + HType + "'", "[h_p_Sc_ProductionAnalysisReportList]"); |
| | | } |
| | | |
| | | //添加列名 |
| | | 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 = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 螺母检验CCD合格率 |
| | | [Route("LEMS/Sc_NutInspectionCCDPassRate")] |
| | | [HttpGet] |
| | | public object Sc_NutInspectionCCDPassRate(string HBatchNo, string user) |
| | | { |
| | | try |
| | | { |
| | | DataSet ds; |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_NutInspectionCCDPassRate '" + HBatchNo + "'", "h_p_Sc_NutInspectionCCDPassRate"); |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 生产订单流转卡 履历条件查询 |
| | | [Route("LEMS/GetProcessBillOrICMOBillResumeList")] |
| | | [HttpGet] |
| | | public object GetProcessBillOrICMOBillResumeList(string HInterID,string HEntryID,string sWhere,int type, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | DataSet ds; |
| | | //1表示生产订单 |
| | | if(type == 3710) |
| | | { |
| | | ds = oCN.RunProcReturn($@"select * from |
| | | (select a.HInterID,a.HDate '日期',a.HBillType,x.HName 单据类型,a.HBillNo as '单据号', |
| | | CASE WHEN a.HBillStatus <= 1 THEN '创建' WHEN a.HBillStatus = 2 THEN '已审核' WHEN a.HBillStatus = 3 AND |
| | | a.HCloseType = 0 THEN '自动关闭' WHEN a.HBillStatus = 3 AND |
| | | a.HCloseType = 1 THEN '手动关闭' WHEN a.HBillStatus = 4 THEN '已作废' ELSE '其它状态' END AS 单据状态, |
| | | a.HMaker AS 制单人, a.HMakeDate AS 制单日期,a.HChecker AS 审核人, a.HCheckDate AS 审核日期, a.HUpDater AS 修改人, a.HUpDateDate AS 修改日期, |
| | | a.HCloseMan AS 关闭人, a.HCloseDate AS 关闭日期, a.HDeleteMan AS 作废人, a.HDeleteDate AS 作废日期 |
| | | from ( |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sc_ICMOBillMain where HInterID = {HInterID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sc_MESBeginWorkBillMain where HICMOInterID = {HInterID} and HICMOEntryID = {HEntryID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from QC_FirstPieceCheckBillMain where HICMOInterID = {HInterID} and HICMOEntryID = {HEntryID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from QC_PatrolProcCheckBillMain where HICMOInterID = {HInterID} and HICMOEntryID = {HEntryID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from QC_PatrolProcCheckOtherBillMain where HICMOInterID = {HInterID} and HICMOEntryID = {HEntryID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sc_StationInBillMain where HICMOInterID = {HInterID} and HICMOEntryID = {HEntryID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sc_StationOutBillMain where HICMOInterID = {HInterID} and HICMOEntryID = {HEntryID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from SB_EquipICMOTechParamBillMain where HICMOInterID = {HInterID} and HICMOEntryID = {HEntryID} UNION ALL |
| | | select m.HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,m.HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,m.HCloseType from Sc_MouldUpperBillMain as m,Sc_MouldUpperBillSub as s |
| | | where HICMOInterID = {HInterID} and HICMOEntryID = {HEntryID} and m.HInterID = s.HInterID UNION ALL |
| | | select m.HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,m.HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,m.HCloseType from Sc_MouldLowerBillMain as m,Sc_MouldLowerBillSub as s |
| | | where HICMOInterID = {HInterID} and HICMOEntryID = {HEntryID} and m.HInterID = s.HInterID |
| | | )as a,Xt_BillType as x |
| | | where a.HBillType = x.HNumber ) AS a where 1=1 " + sWhere + |
| | | @" ORDER BY 日期 ASC;", "Sc_ICMOBillResume"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn($@"select * from |
| | | (select a.HInterID,a.HDate '日期',a.HBillType,x.HName 单据类型,a.HBillNo as '单据号', |
| | | CASE WHEN a.HBillStatus <= 1 THEN '创建' WHEN a.HBillStatus = 2 THEN '已审核' WHEN a.HBillStatus = 3 AND |
| | | a.HCloseType = 0 THEN '自动关闭' WHEN a.HBillStatus = 3 AND |
| | | a.HCloseType = 1 THEN '手动关闭' WHEN a.HBillStatus = 4 THEN '已作废' ELSE '其它状态' END AS 单据状态, |
| | | a.HMaker AS 制单人, a.HMakeDate AS 制单日期,a.HChecker AS 审核人, a.HCheckDate AS 审核日期, a.HUpDater AS 修改人, a.HUpDateDate AS 修改日期, |
| | | a.HCloseMan AS 关闭人, a.HCloseDate AS 关闭日期, a.HDeleteMan AS 作废人, a.HDeleteDate AS 作废日期 |
| | | from ( |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sc_ProcessExchangeBillMain where HInterID = {HInterID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sc_MESBeginWorkBillMain where HProcExchInterID = {HInterID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from QC_FirstPieceCheckBillMain where HProcExchInterID = {HInterID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from QC_PatrolProcCheckBillMain where HProcExchInterID = {HInterID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from QC_PatrolProcCheckOtherBillMain where HProcExchInterID = {HInterID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sc_StationInBillMain where HProcExchInterID = {HInterID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from Sc_StationOutBillMain where HProcExchInterID = {HInterID} UNION ALL |
| | | select HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,HCloseType from SB_EquipICMOTechParamBillMain where HProcExchInterID = {HInterID} UNION ALL |
| | | select m.HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,m.HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,m.HCloseType from Sc_MouldUpperBillMain as m,Sc_MouldUpperBillSub as s |
| | | where s.HProcExchInterID = {HInterID} and m.HInterID = s.HInterID UNION ALL |
| | | select m.HInterID,HDate,HBillType,HBillNo,HBillStatus,HMaker,HMakeDate,HChecker,HCheckDate,HUpDater,HUpDateDate,m.HCloseMan,HCloseDate,HDeleteMan,HDeleteDate,m.HCloseType from Sc_MouldLowerBillMain as m,Sc_MouldLowerBillSub as s |
| | | where s.HProcExchInterID = {HInterID} and m.HInterID = s.HInterID |
| | | )as a,Xt_BillType as x |
| | | where a.HBillType = x.HNumber ) AS a where 1=1 " + sWhere + |
| | | @" ORDER BY 日期 ASC;", "Sc_ProcessExchangeBillResume"); |
| | | } |
| | | //添加动态列信息 |
| | | 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 = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 返回工序委外接收单列表 |
| | | ///参数:string sql。 |
| | |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | //添加列名 |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.list = columnNameList; |
| | | objJsonResult.Message = "[0000-1-037]Sucess!"; |
| | | |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.Message = "[0000-1-010]没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!"; |
| | | objJsonResult.Message = "[0000-1-045]没有返回任何记录!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.Message = "[0000-1-050]获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | |
| | | return CustomCorrect(ds); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 扫流转卡号方法(产线包装单、产线组装追溯单)--根据流转卡号保存到temp表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | #region 产线包装组托单 |
| | | |
| | | |
| | | #region 转换34进制 |
| | | public string GetNewCodeByNum(Int64 lastNum, Int64 codeNum, Int64 codeLength) |
| | | { |
| | | List<string> codeList = new List<string>(); |
| | | var maxNum = lastNum + codeNum; |
| | | var lNLength = lNCode.Length; |
| | | for (Int64 i = lastNum; i < maxNum; i++) |
| | | { |
| | | char[] bgCode = GetNewCodeArray(codeLength); |
| | | var sNum = i;//整数倍初始赋值 |
| | | for (int a = bgCode.Length - 1; a >= 0; a--) |
| | | { |
| | | var yNum = sNum % lNLength;//计算余数 |
| | | bgCode[a] = lNCode[yNum];//通过余数定位数组位置 |
| | | sNum = (int)(sNum / lNLength);//计算剩余整数 |
| | | if (sNum == 0)//整数倍为0,则跳出循环 |
| | | break; |
| | | } |
| | | //Console.WriteLine($"生成码{i}:{new string(bgCode)}");//打印生成的序列码(测试用,正式环境请删除或者注释) |
| | | codeList.Add(new string(bgCode)); |
| | | } |
| | | return codeList[0]; |
| | | } |
| | | |
| | | //序列码初始化 |
| | | private char[] GetNewCodeArray(Int64 codeLength) |
| | | { |
| | | char[] bgCode = new char[codeLength]; |
| | | for (Int64 i = 0; i < codeLength; i++) |
| | | { |
| | | bgCode[i] = '0'; |
| | | } |
| | | return bgCode; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 墨西哥白标生成查询 |
| | | |
| | | //墨西哥白标查询 |
| | | [Route("MES/MES_BarcodeWhiteLabelReport")] |
| | | [HttpGet] |
| | | public object MES_BarcodeWhiteLabelReport(string sWhere) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | ds = oCN.RunProcReturn("SELECT top 1000 * FROM h_v_MES_BarcodeWhiteLabelReport where 1=1 " + sWhere, "h_v_MES_BarcodeWhiteLabelReport"); |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | ds = null; |
| | | } |
| | | return CustomCorrect(ds); |
| | | //return ds.Tables[0].Rows; |
| | | } |
| | | |
| | | //墨西哥白标生成 |
| | | [Route("LEMS/SaveCirculationCard_Json_MXG")] |
| | | [HttpGet] |
| | | public object SaveCirculationCard_Json_MXG(string HBillNo, string HInterID, string HBillNo2, string HBarCode,string HNumber, string HName, string HModel) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (HBarCode == null || HBarCode.Equals("")) |
| | | { |
| | | HBarCode = " "; |
| | | } |
| | | ds = oCN.RunProcReturn("exec Save_Sc_ProcessExchangeBillMainToTmp_MXG '" + HBillNo + "','" + HInterID + "','" + HBillNo2 + "','" + HBarCode + "','" + HNumber + "','" + HName + "','" + HModel + "'", "Save_Sc_ProcessExchangeBillMainToTmp_MXG"); |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | ds = null; |
| | | } |
| | | return CustomCorrect(ds); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 扫流转卡号方法(产线包装单、产线组装追溯单)--根据流转卡号保存到temp表 |
| | | [Route("LEMS/SaveCirculationCard_Json")] |
| | | [HttpGet] |
| | | public object SaveCirculationCard_Json(string HBillNo, string HInterID, string HBillNo2, string HBarCode, |
| | | string HNumber, string HName, string HModel) |
| | | public object SaveCirculationCard_Json(string HBillNo, string HInterID, string HBillNo2, string HBarCode, string HNumber, string HName, string HModel) |
| | | { |
| | | DataSet ds; |
| | | try |
| | |
| | | ds = null; |
| | | } |
| | | return CustomCorrect(ds); |
| | | //return ds.Tables[0].Rows; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 扫子件条码方法(产线包装单、产线组装追溯单)--根据子件条码保存到temp表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | #endregion |
| | | |
| | | #region 扫子件条码方法(产线包装单、产线组装追溯单)--根据子件条码保存到temp表 |
| | | |
| | | [Route("LEMS/SaveSubBarcode_Json")] |
| | | [HttpGet] |
| | | public object SaveSubBarcode_Json(string HBillNo, string SubBarcode, string HInterID, string HBillNo2, |
| | | string HBillType, string sMaker, string HBarCode, string HNumber, string HName, string HModel) |
| | | public object SaveSubBarcode_Json(string HBillNo, string SubBarcode, string HInterID, string HBillNo2, string HBillType, string sMaker, string HBarCode, string HNumber, string HName, string HModel ,string HOrgID) |
| | | { |
| | | DataSet ds1; |
| | | DataSet ds; |
| | |
| | | ds1 = oCN.RunProcReturn("select * from KF_PonderationBillMain_Temp where HSourceBillNo = '" + SubBarcode + "' and HBillType = '" + HBillType + "'", "KF_PonderationBillMain_Temp"); |
| | | if (ds1.Tables[0].Rows.Count > 0) |
| | | { |
| | | return CustomError("该子件条码已存在"); |
| | | return CustomError("[0000-2-039]该子件条码已存在"); |
| | | } |
| | | if (HBarCode == null || HBarCode.Equals("")) |
| | | { |
| | | HBarCode = " "; |
| | | } |
| | | ds = oCN.RunProcReturn("exec h_p_Save_SubBarcodeToTmp '" + HBillNo + "','" + SubBarcode + "','" + HInterID + "','" + HBillNo2 + "','" + HBillType + "','" + sMaker + "','" + HBarCode + "','" + HNumber + "','" + HName + "','" + HModel + "'", "h_p_Save_SubBarcodeToTmp"); |
| | | ds = oCN.RunProcReturn("exec h_p_Save_SubBarcodeToTmp '" + HBillNo + "','" + SubBarcode + "','" + HInterID + "','" + HBillNo2 + "','" + HBillType + "','" + sMaker + "','" + HBarCode + "','" + HNumber + "','" + HName + "','" + HModel + "','"+ HOrgID + "'", "h_p_Save_SubBarcodeToTmp"); |
| | | LogService.Write("ID:" + HInterID + ",流转卡号:" + HBillNo + ",单据号:" + HBillNo2 + ",条码:" + SubBarcode + ",托条码:" + HBarCode); |
| | | } |
| | | |
| | | } |
| | |
| | | ds = null; |
| | | } |
| | | return CustomCorrect(ds); |
| | | //return ds.Tables[0].Rows; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查询条码档案表里的镭雕条码的合计数量方法(产线包装单) |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("LEMS/SaveSubBarcode_Json_MXG")] |
| | | [HttpGet] |
| | | public object SaveSubBarcode_Json_MXG(string HBillNo, string SubBarcode, string HInterID, string HBillNo2, string HBillType, string sMaker, string HBarCode, string HNumber, string HName, string HModel,string HOrgID) |
| | | { |
| | | DataSet ds1; |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | ds1 = oCN.RunProcReturn("select * from KF_PonderationBillMain_Temp where HSourceBillNo = '" + SubBarcode + "' and HBillType = '" + HBillType + "'", "KF_PonderationBillMain_Temp"); |
| | | if (ds1.Tables[0].Rows.Count > 0) |
| | | { |
| | | return CustomError("该子件条码已存在"); |
| | | } |
| | | if (HBarCode == null || HBarCode.Equals("")) |
| | | { |
| | | HBarCode = " "; |
| | | } |
| | | ds = oCN.RunProcReturn("exec h_p_Save_SubBarcodeToTmp '" + HBillNo + "','" + SubBarcode + "','" + HInterID + "','" + HBillNo2 + "','" + HBillType + "','" + sMaker + "','" + HBarCode + "','" + HNumber + "','" + HName + "','" + HModel + "','"+ HOrgID + "'", "h_p_Save_SubBarcodeToTmp"); |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | ds = null; |
| | | } |
| | | return CustomCorrect(ds); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 查询条码档案表里的镭雕条码的合计数量方法(产线包装单) |
| | | |
| | | [Route("LEMS/Select_Gy_BarCodeBill_HQty")] |
| | | [HttpGet] |
| | | public object Select_Gy_BarCodeBill_HQty(string HBarCode) |
| | |
| | | //return ds.Tables[0].Rows; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新条码档案表里的镭雕条码的合计数量方法(产线包装单) |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | #endregion |
| | | |
| | | #region 更新条码档案表里的镭雕条码的合计数量方法(产线包装单) |
| | | |
| | | [Route("LEMS/Update_Gy_BarCodeBill_HQty")] |
| | | [HttpGet] |
| | | public object Update_Gy_BarCodeBill_HQty(string HBarCode, string HQty) |
| | |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Update_Gy_BarCodeBill_HQty " + HBarCode + "," + HQty + "", "Gy_BarCodeBill"); |
| | | ds = oCN.RunProcReturn("exec h_p_Update_Gy_BarCodeBill_HQty " + HBarCode + "," + HQty + "", "h_p_Update_Gy_BarCodeBill_HQty"); |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | ds = null; |
| | | } |
| | | return CustomCorrect(ds); |
| | | //return ds.Tables[0].Rows; |
| | | return CustomCorrect(ds);; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新扫码记录列表方法(产线包装单、产线组装追溯单) |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | #endregion |
| | | |
| | | #region 更新扫码记录列表方法(产线包装单、产线组装追溯单) |
| | | |
| | | [Route("LEMS/Update_HBillNo_SubBarcodeList_Json")] |
| | | [HttpGet] |
| | | public object Update_HBillNo_SubBarcodeList_Json(string HBillNo) |
| | |
| | | //return ds.Tables[0].Rows; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 提交-主表方法(产线包装单)--根据流传卡号从temp表保存到主表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | |
| | | #endregion |
| | | |
| | | #region 提交-主表方法(产线包装单)--根据流传卡号从temp表保存到主表 |
| | | |
| | | [Route("LEMS/SaveToSc_PackUnionBillMain")] |
| | | [HttpGet] |
| | | public object SaveToSc_PackUnionBillMain(string HBillNo, string HRemark) |
| | | public object SaveToSc_PackUnionBillMain(string HBillNo, string HRemark, string HProjectNum, string zxQty, string BBM, string LDM, string HMaterNumber,string HOrgID) |
| | | { |
| | | DataSet ds; |
| | | DataSet dsHSNum; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | string HBarCode_White = ""; |
| | | if (LDM != "其他" && BBM != "其他") |
| | | { |
| | | ds = oCN.RunProcReturn($"exec h_p_MES_HBarCode_White_SMR {zxQty},'{BBM}','{HMaterNumber}','{HBillNo}'", "h_p_MES_HBarCode_White_SMR"); |
| | | HBarCode_White = ds.Tables[0].Rows[0]["HBarCode_White"].ToString(); |
| | | } |
| | | |
| | | //项目号获取流水号 |
| | | dsHSNum = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HProjectNum + "'", "h_p_WMS_GetMaxNo"); |
| | | oCN.RunProc("exec h_p_WMS_SetMaxNo '" + HProjectNum + "'"); |
| | | int HSNum = ClsPub.isInt(dsHSNum.Tables[0].Rows[0][0]) + 1; |
| | | //调用进制转换方法把流水号转换成流水号2 |
| | | string HSNum2 = GetNewCodeByNum(HSNum, 1, 2); |
| | | if (HBillNo == null || HBillNo.Equals("")) |
| | | { |
| | | return CustomError("[0000-1-057]流转卡号不能为空!"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Save_KF_PonderationBillMain_TempToSc_PackUnionBillMain '" + HBillNo + "','" + HRemark + "'," + HSNum + ",'" + HSNum2 + "','" + HBarCode_White + "','"+ HOrgID + "'", "h_p_Save_KF_PonderationBillMain_TempToSc_PackUnionBillMain"); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-051]异常!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | return CustomCorrect(ds); |
| | | } |
| | | |
| | | |
| | | [Route("LEMS/SaveToSc_PackUnionBillMain_MXG")] |
| | | [HttpGet] |
| | | public object SaveToSc_PackUnionBillMain(string HBillNo, string HRemark, string HProjectNum, string zxQty, string BBM, string LDM, string HMaterNumber, string HBarCode_White,string HOrgID) |
| | | { |
| | | DataSet ds; |
| | | DataSet dsHSNum; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (HBarCode_White!="") |
| | | { |
| | | if (LDM != "其他" && BBM != "其他") |
| | | { |
| | | ds = oCN.RunProcReturn($"exec h_p_MES_HBarCode_White_SMR_MXG {zxQty},'{BBM}','{HMaterNumber}','{HBillNo}'", "h_p_MES_HBarCode_White_SMR_MXG"); |
| | | HBarCode_White = ds.Tables[0].Rows[0]["HBarCode_White"].ToString(); |
| | | } |
| | | } |
| | | //项目号获取流水号 |
| | | dsHSNum = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HProjectNum + "'", "h_p_WMS_GetMaxNo"); |
| | | oCN.RunProc("exec h_p_WMS_SetMaxNo '" + HProjectNum + "'"); |
| | | int HSNum = ClsPub.isInt(dsHSNum.Tables[0].Rows[0][0]) + 1; |
| | | //调用进制转换方法把流水号转换成流水号2 |
| | | string HSNum2 = GetNewCodeByNum(HSNum, 1, 2); |
| | | if (HBillNo == null || HBillNo.Equals("")) |
| | | { |
| | | return CustomError("流转卡号不能为空!"); |
| | | } |
| | | else |
| | | { |
| | | if (HRemark == null || HRemark.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Save_KF_PonderationBillMain_TempToSc_PackUnionBillMain '" + HBillNo + "',''", "h_p_Save_KF_PonderationBillMain_TempToSc_PackUnionBillMain"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Save_KF_PonderationBillMain_TempToSc_PackUnionBillMain '" + HBillNo + "','" + HRemark + "'", "h_p_Save_KF_PonderationBillMain_TempToSc_PackUnionBillMain"); |
| | | } |
| | | ds = oCN.RunProcReturn("exec h_p_Save_KF_PonderationBillMain_TempToSc_PackUnionBillMain_MXG '" + HBillNo + "','" + HRemark + "'," + HSNum + ",'" + HSNum2 + "','" + HBarCode_White + "','"+ HOrgID + "'", "h_p_Save_KF_PonderationBillMain_TempToSc_PackUnionBillMain_MXG"); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | ds = null; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "异常!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | return CustomCorrect(ds); |
| | | //return ds.Tables[0].Rows; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 提交-子表方法(产线包装单)--根据子件条码从temp表保存到子表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | #endregion |
| | | |
| | | #region 提交-子表方法(产线包装单)--根据子件条码从temp表保存到子表 |
| | | |
| | | [Route("LEMS/SaveToSc_PackUnionBillSub")] |
| | | [HttpGet] |
| | | public object SaveToSc_PackUnionBillSub(string HitemID, string HRemark) |
| | |
| | | ds = null; |
| | | } |
| | | return CustomCorrect(ds); |
| | | //return ds.Tables[0].Rows; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新temp表的标记字段方法(产线包装单) |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | //更新没有反写的数据 |
| | | [Route("LEMS/SaveToSc_PackUnionBillSub_Back")] |
| | | [HttpGet] |
| | | public object SaveToSc_PackUnionBillSub_Back(string HInterID, string HRemark) |
| | | { |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (HInterID == null || HInterID.Equals("")) |
| | | { |
| | | return CustomError("[0000-2-058]更新失败HitemID为空!"); |
| | | } |
| | | else |
| | | { |
| | | oCN.RunProc("exec h_p_Save_KF_PonderationBillMain_TempToSc_PackUnionBillSub_Back '" + HInterID + "','" + HRemark + "'"); |
| | | } |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "[0000-2-059]更新成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-2-058]" + e.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 更新temp表的标记字段方法(产线包装单) |
| | | |
| | | [Route("LEMS/Update_Flag_HRelationInterID")] |
| | | [HttpGet] |
| | | public object Update_Flag_HRelationInterID(string HitemID) |
| | |
| | | //return ds.Tables[0].Rows; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 提交-主表方法(产线组装追溯单)--根据流传卡号从temp表保存到主表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | #endregion |
| | | |
| | | #region 提交-主表方法(产线组装追溯单)--根据流传卡号从temp表保存到主表 |
| | | |
| | | [Route("LEMS/SaveToSc_AssemblyBillMain")] |
| | | [HttpGet] |
| | | public object SaveToSc_AssemblyBillMain(string HBillNo) |
| | |
| | | //return ds.Tables[0].Rows; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 提交-子表方法(产线组装追溯单)--根据子件条码从temp表保存到子表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | #endregion |
| | | |
| | | #region 提交-子表方法(产线组装追溯单)--根据子件条码从temp表保存到子表 |
| | | |
| | | [Route("LEMS/SaveToSc_AssemblyBillSub")] |
| | | [HttpGet] |
| | | public object SaveToSc_AssemblyBillSub(string HitemID) |
| | |
| | | //return ds.Tables[0].Rows; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 生成唯一条码方法(产线包装单)--保存时生成唯一条码 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | #endregion |
| | | |
| | | #region 生成唯一条码方法(产线包装单)--保存时生成唯一条码 |
| | | |
| | | [Route("LEMS/SaveBarCode_json")] |
| | | [HttpGet] |
| | | public object SaveBarCode_json(string sHMaterID, string sHUnitID, string sHBarcodeNo, string sHMaterName) |
| | | public object SaveBarCode_json(string sHMaterID, string sHUnitID, string sHBarcodeNo, string sHMaterName,string HOrgID) |
| | | { |
| | | DataSet ds; |
| | | string sTMNumber = ""; |
| | |
| | | string HEndDate = sDate; |
| | | string HWorkLineName = ""; |
| | | string HBarCodeDate = sDate; |
| | | string HSTOCKORGID = "0"; |
| | | string HSTOCKORGID = HOrgID; |
| | | string HOWNERID = "0"; |
| | | string HSeOrderBillNo = ""; |
| | | string HMaterName = sHMaterName; |
| | |
| | | + " HSourceBillType,HEndQty,HBarcodeQtys,HBarcodeNo,HDeptID," |
| | | + " HWhID,HSPID,HRemark,HCusID,HCusType," |
| | | + " HEndDate,HWorkLineName,HBarCodeDate,HSTOCKORGID,HOWNERID," |
| | | + "HSeOrderBillNo,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo " |
| | | + "HSeOrderBillNo,HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo" |
| | | + ") values ('" + HBarCode + "','" + HBarCodeType + "','" + sHMaterID + "','" + sHUnitID + "','" + HQty + "','" |
| | | + HBatchNo + "','" + HSupID + "','" + HGroupID + "','" + HMaker + "',getdate(),'" |
| | | + HPrintQty + "','" + HinitQty + "','" + HSourceInterID + "','" + HSourceEntryID + "','" + HSourceBillNo + "','" |
| | |
| | | + HEndDate + "','" + HWorkLineName + "','" + HBarCodeDate + "','" + HSTOCKORGID + "'," + HOWNERID + ",'" |
| | | + HSeOrderBillNo + "','" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "','" + HAuxPropID + "','" + HMTONo + "')" |
| | | ); |
| | | ds = oCn.RunProcReturn("select HBarCode from Gy_BarCodeBill where HSourceBillNo = '" + sHBarcodeNo + "' order by HMakeDate desc", "Gy_BarCodeBill"); |
| | | ds = oCn.RunProcReturn("select top 10 HBarCode from Gy_BarCodeBill where HSourceBillNo = '" + sHBarcodeNo + "' order by HMakeDate desc", "Gy_BarCodeBill"); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | return CustomCorrect(ds); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回产线包装单列表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | #endregion |
| | | |
| | | |
| | | #region 产线包装单列表查询 |
| | | |
| | | [Route("LEMS/MES_ProductionLinePackagingList_Json")] |
| | | [HttpGet] |
| | | public object MES_ProductionLinePackagingList_Json(string sWhere) |
| | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_ProductionLinePackagingList order by 唯一条码 desc", "h_v_ProductionLinePackagingList"); |
| | | ds = oCN.RunProcReturn("select top 1000 * from h_v_ProductionLinePackagingList order by 扫码日期 desc, 唯一条码 desc", "h_v_ProductionLinePackagingList"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_ProductionLinePackagingList where 1 = 1 "; |
| | | string sql1 = "select top 1000 * from h_v_ProductionLinePackagingList where 1 = 1 "; |
| | | string sql = sql1 + sWhere; |
| | | string sql2 = " order by 唯一条码 desc"; |
| | | string sql2 = " order by 扫码日期 desc, 唯一条码 desc"; |
| | | sql = sql + sql2; |
| | | ds = oCN.RunProcReturn(sql, "h_v_ProductionLinePackagingList"); |
| | | } |
| | |
| | | return GetObjectJson(ds); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 扫批次条码方法(产线组装追溯单)--根据批次条码到条码档案表中获取数据保存到temp表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | #endregion |
| | | |
| | | #region 删除对应的包装单 |
| | | |
| | | [Route("LEMS/DelMES_ProductionLinePackagingList")] |
| | | [HttpGet] |
| | | public object DelMES_ProductionLinePackagingList(string HInterID) |
| | | { |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | oCN.RunProc("Delete from Sc_PackUnionBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("Delete from Sc_PackUnionBillSub where HInterID = " + HInterID); |
| | | oCN.RunProc("Delete from KF_PonderationBillMain_Temp where HInterID = " + HInterID); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "[0000-1-008]删除成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-007]删除失败!"; |
| | | objJsonResult.data = e.ToString(); |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 扫批次条码方法(产线组装追溯单)--根据批次条码到条码档案表中获取数据保存到temp表 |
| | | |
| | | [Route("LEMS/Save_Gy_BarCodeBillToTmp_Json")] |
| | | [HttpGet] |
| | | public object Save_Gy_BarCodeBillToTmp_Json(string HInterID, string HBillNo2, string HBarCode) |
| | |
| | | ds = null; |
| | | } |
| | | return CustomCorrect(ds); |
| | | //return ds.Tables[0].Rows; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回产线组装追溯单列表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | #endregion |
| | | |
| | | #region 产线组装追溯单列表查询 |
| | | |
| | | [Route("LEMS/MES_AssemblyTraceabilityList_Json")] |
| | | [HttpGet] |
| | | public object MES_AssemblyTraceabilityList_Json(string sWhere) |
| | |
| | | return GetObjectJson(ds); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回产线组装追溯单列表--过滤条件为镭雕条码的专用方法 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | #endregion |
| | | |
| | | #region 返回产线组装追溯单列表--过滤条件为镭雕条码的专用方法 |
| | | |
| | | [Route("LEMS/MES_AssemblyTraceabilityList_E_Json")] |
| | | [HttpGet] |
| | | public object MES_AssemblyTraceabilityList_E_Json(string HICMOBillNo) |
| | |
| | | } |
| | | return GetObjectJson(ds); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 根据ID删除缓存表中扫码记录-产线包装单 |
| | | |
| | | [Route("LEMS/DelProductionLinePackagingTable")] |
| | | [HttpGet] |
| | | public object DelProductionLinePackagingTable(long sHInterID, string HSourceBillNo) |
| | | { |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | oCn.RunProc("Delete TOP(1) from KF_PonderationBillMain_Temp where HInterID = " + sHInterID + " and HSourceBillNo = '" + HSourceBillNo + "'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "[0000-1-008]删除成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-007]删除失败!"; |
| | | objJsonResult.data = e.ToString(); |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 条码是否是不良的状态 |
| | | [Route("LEMS/HbadStaus")] |
| | | [HttpGet] |
| | | public object HbadStaus(string SubBarcode) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | ds = oCN.RunProcReturn(@"select HBillNo,HReasult from tiaom where HBillNo='" + SubBarcode + @"' |
| | | union |
| | | select HBarCode HBillNo,HStatus HReasult from Gy_BarCodeBill |
| | | where HBarCode='" + SubBarcode + "'", "Gy_BarCodeBill"); |
| | | if (ClsPub.isInt(ds.Tables[0].Rows.Count) == 0) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ok!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (ds.Tables[0].Rows[0]["HReasult"].ToString() == "不良") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-2-037]当前条码的状态为:" + ds.Tables[0].Rows[0]["HReasult"].ToString() + "!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-010]异常!"; |
| | | objJsonResult.data = e.ToString(); |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 判断条码之前的工序是否出站 |
| | | |
| | | [Route("LEMS/SNBarcodeProcCtrl")] |
| | | [HttpGet] |
| | | public object SNBarcodeProcCtrl(string SubBarcode, string HProcExchBillNo, string HMixedBox, string HBillNo) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | ds = oCN.RunProcReturn(@"exec h_p_Sc_SNBarcodeProcCtrl '" + SubBarcode + "'", "h_p_Sc_SNBarcodeProcCtrl"); |
| | | if (ClsPub.isInt(ds.Tables[0].Rows.Count) == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-045]查无数据!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "2") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-051]" + ds.Tables[0].Rows[0]["HBackRemark"].ToString() + "!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn(@"exec h_p_Sc_SNBarcodeMixedBox '" + SubBarcode + "','" + HProcExchBillNo + "','" + HMixedBox + "','" + HBillNo + "'", "h_p_Sc_SNBarcodeMixedBox"); |
| | | |
| | | if (ClsPub.isInt(ds.Tables[0].Rows.Count) == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-045]查无数据!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "2") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-051]" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-010]异常!"; |
| | | objJsonResult.data = e.ToString(); |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 09项目判断配件条码 模具穴号是否匹配 |
| | | |
| | | [Route("LEMS/h_p_CJ_SNBarCodeBillMouldBathSelect")] |
| | | [HttpGet] |
| | | public object h_p_CJ_SNBarCodeBillMouldBathSelect(string SubBarcode, string HProcExchBillNo, string HBillType) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | ds = oCN.RunProcReturn(@"exec h_p_CJ_SNBarCodeBillMouldBathSelect '" + SubBarcode + "','" + HProcExchBillNo + "','" + HBillType + "'", "h_p_Sc_SNBarcodeMixedBox"); |
| | | |
| | | if (ClsPub.isInt(ds.Tables[0].Rows.Count) == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-045]查无数据!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (ds.Tables[0].Rows[0]["HBack"].ToString() == "2") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-051]" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-010]异常!"; |
| | | objJsonResult.data = e.ToString(); |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 判断总的包装数量是否超过流转卡数量 |
| | | |
| | | [Route("LEMS/h_p_Sc_ProductionLinePackaging_Checkqty")] |
| | | [HttpGet] |
| | | public object h_p_Sc_ProductionLinePackaging_Checkqty(long HInterID) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_ProductionLinePackaging_Checkqty " + HInterID, "h_p_Sc_ProductionLinePackaging_Checkqty"); |
| | | if (ClsPub.isInt(ds.Tables[0].Rows[0][0]) == 0) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!";//返回剩余数量 |
| | | objJsonResult.data = Pub_Class.ClsPub.isInt(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-051]" + Convert.ToString(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-010]异常!"; |
| | | objJsonResult.data = e.ToString(); |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 缓存表包装单列表 |
| | | |
| | | [Route("LEMS/PackUnionCacheList")] |
| | | [HttpGet] |
| | | public object PackUnionCacheList(string sWhere) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select top 1000 * from h_v_PackUnionBillCacheList order by 扫码时间 desc", "h_v_PackUnionBillCacheList"); |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select * from h_v_PackUnionBillCacheList where 1 = 1 "; |
| | | string sql = sql1 + sWhere; |
| | | string sql2 = " order by 扫码时间 desc"; |
| | | sql += sql2; |
| | | ds = oCN.RunProcReturn(sql, "h_v_PackUnionBillCacheList"); |
| | | } |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无数据!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | 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 |
| | | |
| | | #region 工序流转卡的末道工序 |
| | | |
| | | [Route("LEMS/TxtHBarCode_KeyDown_Last")] |
| | | [HttpGet] |
| | | public object TxtHBarCode_KeyDown_Last(string sBillBarCode) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sBillBarCode == null || sBillBarCode.Equals("")) |
| | | { |
| | | return CustomError("未输入条形码!"); |
| | | } |
| | | else |
| | | { |
| | | //拆分条形码 |
| | | string[] NewBarCode; |
| | | if (sBillBarCode.CompareTo("#") > 0) |
| | | { |
| | | NewBarCode = sBillBarCode.Split(Convert.ToChar("#")); |
| | | sBillBarCode = NewBarCode[0]; |
| | | } |
| | | string sBillNo = sBillBarCode; |
| | | ds = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList where 单据号= '" + sBillNo + "' and 末道工序='是' ", "h_v_Sc_ProcessExchangeBillList"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | return CustomError("不存在此流转卡号!"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | ds = null; |
| | | } |
| | | return CustomCorrect(ds); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 返回墙咔工资统计报表 |
| | |
| | | |
| | | } |
| | | |
| | | #region 工艺路线列表 启用默认_权限判断 |
| | | [Route("Gy_RoutingBill/set_defaultRoute_CheckRight")] |
| | | [HttpGet] |
| | | public object set_defaultRoute_CheckRight(string user, string HBillSubType) |
| | | { |
| | | try |
| | | { |
| | | if (HBillSubType == "SUB") |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Sub_SetDefaultRoute", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "子工艺路线无权限启用默认工艺路线!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_SetDefaultRoute", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "工艺路线无权限启用默认!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | 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 工艺路线列表 启用默认 |
| | | [Route("Gy_RoutingBill/set_defaultRoute")] |
| | | [HttpGet] |
| | | public object set_defaultRoute(string HInterID, string user, string HBillSubType) |
| | | { |
| | | try |
| | | { |
| | | if (HBillSubType == "SUB") |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Sub_SetDefaultRoute", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "子工艺路线无权限启用默认工艺路线!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_SetDefaultRoute", 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();//开始事务 |
| | | |
| | | //判断单据是否已经审核 |
| | | 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]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核!不可以被启用为该物料的默认工艺路线!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在,检查该单据是否已经被删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //刷新默认工艺路线 |
| | | oCN.RunProc("exec h_p_Gy_RoutingBillSetDefault " + HInterID+",'" + user + "'"); |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 工艺路线审核/反审核功能 |
| | | [Route("Gy_RoutingBill/CheckGy_RoutingBill")] |
| | | [HttpGet] |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | //获取系统参数判断工艺路线是否启用多级审批禁用普通审批 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | string sReturn = ""; |
| | | if (oSystemParameter.ShowBill(ref sReturn) == true) |
| | | { |
| | | if (oSystemParameter.omodel.Gy_RoutingBill_EnableMultiLevel.ToUpper() == "Y") //系统参数 启用自动审核 |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "工艺路线已启用多级审批普通审核禁用"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //审核单据 |
| | | if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Gy_RoutingBill_BeforeCheckCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Gy_RoutingBill_BeforeCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | //审核工艺路线 |
| | | oCN.RunProc(" Update Gy_RoutingBillMain set HChecker='" + user + "',HCheckDate=getdate(),HBillStatus=2 Where HInterID=" + HInterID.ToString()); |
| | | |
| | | |
| | | //审核后控制========================================= |
| | | string sql2 = "exec h_p_Gy_RoutingBill_AfterCheckCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Gy_RoutingBill_AfterCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | //获取系统参数 |
| | | string Ret = ""; |
| | | if (oSystemParameter.ShowBill(ref Ret)) |
| | | { |
| | | //判断客户 |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "添康科技") //系统参数 |
| | | { |
| | | //刷新默认工艺路线 |
| | | oCN.RunProc("exec h_p_Gy_RoutingBillCheck " + HInterID + ",'" + user + "'"); |
| | | } |
| | | } |
| | | |
| | | ////审核单据 |
| | | //if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 1; |
| | | // objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | } |
| | | else |
| | | { |
| | | //反审核前控制========================================= |
| | | DataSet ds = oCN.RunProcReturn("Exec h_p_Gy_Routing_BeforeUnCheckCtrl " + HInterID + ",'" + 0 + "','" + user + "'", "h_p_Gy_Routing_BeforeUnCheckCtrl"); |
| | | if (ds == null) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "反审核失败!原因:" + "反审核前判断失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //========================================================= |
| | | //判断单据是否已经反审核 |
| | | 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 (BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | if (BillOld.AbandonCheck(Int64.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Gy_RoutingBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl"); |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | |
| | | 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.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 |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已反关闭!不需要再反关闭!"; |
| | | 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.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 = '9999-12-31',HBeginDate = CONVERT(date, GETDATE()) where HInterID = " + HInterID); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region 报表查看权限控制 |
| | | /// <summary> |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "[0000-1-010]Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #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; |