|  |  |  | 
|---|
|  |  |  | #region 工艺路线分页列表 | 
|---|
|  |  |  | [Route("Gy_RoutingBill/page")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public json Gy_RoutingBillPage(string sWhere, string user, int page, int size) | 
|---|
|  |  |  | public object Gy_RoutingBillPage(string sWhere, string user, int page, int size) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | json res = new json(); | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 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 (!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"); | 
|---|
|  |  |  | 
|---|
|  |  |  | res.count = CountConstant.FAIL; | 
|---|
|  |  |  | res.Message = "Exception!" + e.ToString(); | 
|---|
|  |  |  | res.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | return res; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_Gy_RoutingBillList where 1 = 1 "; | 
|---|
|  |  |  | //客户自定义 | 
|---|
|  |  |  | if (oSystemParameter.omodel.WMS_CampanyName == "瑞与祺" || 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 "; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | 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.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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //if (hdeleteman != "") | 
|---|
|  |  |  | 
|---|
|  |  |  | 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)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //审核工艺路线 | 
|---|
|  |  |  | oCN.RunProc(" Update Gy_RoutingBillMain set HChecker='" + user + "',HCheckDate=getdate(),HBillStatus=2 Where HInterID=" + HInterID.ToString()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ////刷新默认工艺路线 | 
|---|
|  |  |  | //oCN.RunProc("exec h_p_Gy_RoutingBillCheck " + HInterID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //获取系统参数 | 
|---|
|  |  |  | 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)) | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | 
|---|
|  |  |  | 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)) | 
|---|
|  |  |  | { | 
|---|