|  |  |  | 
|---|
|  |  |  | using Newtonsoft.Json.Linq; | 
|---|
|  |  |  | using Newtonsoft.Json; | 
|---|
|  |  |  | using Newtonsoft.Json.Linq; | 
|---|
|  |  |  | using Pub_Class; | 
|---|
|  |  |  | using System; | 
|---|
|  |  |  | using System.Collections; | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 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 = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "获取信息成功!"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //if (ds.Tables[0].Rows.Count != 0 || ds != null) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "Sucess!"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //else | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //objJsonResult.code = "0"; | 
|---|
|  |  |  | //objJsonResult.count = 0; | 
|---|
|  |  |  | //objJsonResult.Message = "无数据"; | 
|---|
|  |  |  | //objJsonResult.data = null; | 
|---|
|  |  |  | //return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 工序汇报入库 | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 获取工序汇报入库单列表 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="sWhere"></param> | 
|---|
|  |  |  | /// <param name="user"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/Get_ProcessReportOverList")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object Get_ProcessReportOverList(string sWhere, string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有查询权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无查询权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (sWhere == null || sWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc  order by hmainid desc", "h_v_MES_StationOutBillList_LastProc"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_MES_StationOutBillList_LastProc where 1 = 1 "; | 
|---|
|  |  |  | string sql = sql1 + sWhere + "  order by hmainid desc"; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_MES_StationOutBillList_LastProc"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 入库——生产汇报单 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="InterID">工序汇报单主ID</param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/SaveICMOReportBill")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object SaveICMOReportBill(string InterID, string user, string BillNo, string OrganizationID) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //获取生产汇报单最大InterID和单据号 | 
|---|
|  |  |  | Int64 HInterID = DBUtility.ClsPub.CreateBillID("3711", ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | string HBillNo = DBUtility.ClsPub.CreateBillCode("3711", ref DBUtility.ClsPub.sExeReturnInfo, true); | 
|---|
|  |  |  | //获取组织代码 | 
|---|
|  |  |  | string OrganizationNUM = oCN.RunProcReturn("select HNumber from Xt_ORGANIZATIONS where HItemID=" + OrganizationID, "Xt_ORGANIZATIONS").Tables[0].Rows[0]["HNumber"].ToString(); | 
|---|
|  |  |  | //根据工序汇报单主ID获取工序汇报入库单的数据 | 
|---|
|  |  |  | DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc"); | 
|---|
|  |  |  | DataRow dr = ds.Tables[0].Rows[0]; | 
|---|
|  |  |  | //保存 | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  | //生产汇报单主表 | 
|---|
|  |  |  | oCN.RunProc("Insert Into Sc_ICMOReportBillMain   " + | 
|---|
|  |  |  | "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HBillStatus,HChecker,HCheckDate" + | 
|---|
|  |  |  | ",HYear,HPeriod,HRemark,HEmpID,HEmpNumber" + | 
|---|
|  |  |  | ",HGroupID,HDeptID,HDeptNumber" + | 
|---|
|  |  |  | ",HMainSourceBillNo,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillType" + | 
|---|
|  |  |  | ") " + | 
|---|
|  |  |  | " values('3711','3711'," + HInterID.ToString() + ",'" + HBillNo + "',getdate(),'" + user + "',getdate(),2,'" + user + "',getdate()" + | 
|---|
|  |  |  | ",DATENAME(YEAR,GETDATE()),0,'','" + dr["HEmpID"].ToString() + "','" + dr["操作员代码"].ToString() + | 
|---|
|  |  |  | "','" + dr["HGroupID"].ToString() + "',0,''" + | 
|---|
|  |  |  | ",'" + BillNo.ToString() + "'," + InterID.ToString() + ", 0,'3791'" + | 
|---|
|  |  |  | ") "); | 
|---|
|  |  |  | //生产汇报单子表 | 
|---|
|  |  |  | oCN.RunProc("Insert into Sc_ICMOReportBillSub " + | 
|---|
|  |  |  | " (HInterID,HEntryID,HMaterID,HMaterNumber" + | 
|---|
|  |  |  | ",HQty,HUnitID,HUnitNumber,HTimes,HSourceID" + | 
|---|
|  |  |  | ",HQtyMust,HWorkerID,HWorkerNumber,HBadCount,HWasterQty," + | 
|---|
|  |  |  | "HCloseMan,HCloseType,HRemark," + | 
|---|
|  |  |  | "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + | 
|---|
|  |  |  | ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + | 
|---|
|  |  |  | ",HICMOInterID,HICMOBillNo,HBarCode" + | 
|---|
|  |  |  | ") values(" | 
|---|
|  |  |  | + HInterID.ToString() + ",1," + dr["HMaterID"].ToString() + ",'" + dr["产品代码"].ToString() + "'" + | 
|---|
|  |  |  | "," + dr["合格数量"].ToString() + ",0,'',0,0" + | 
|---|
|  |  |  | "," + dr["接收数量"].ToString() + "," + dr["HEmpID"].ToString() + ",'" + dr["操作员代码"].ToString() + "'," + dr["不良数量"].ToString() + "," + dr["报废数量"].ToString() + | 
|---|
|  |  |  | ",'',0,''" + | 
|---|
|  |  |  | "," + InterID.ToString() + ",0,'" + BillNo.ToString() + "','3791',0,0" + | 
|---|
|  |  |  | ",0,0,''" + | 
|---|
|  |  |  | "," + dr["HICMOInterID"].ToString() + ",'" + dr["任务单"].ToString() + "',''" + | 
|---|
|  |  |  | ") "); | 
|---|
|  |  |  | //同步金蝶 | 
|---|
|  |  |  | //访问金蝶 | 
|---|
|  |  |  | var loginRet = InvokeHelper.Login(); | 
|---|
|  |  |  | var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); | 
|---|
|  |  |  | if (isSuccess == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "操作失败,金蝶账号登录异常。" + loginRet; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //根据任务单查找到金蝶的生产订单 | 
|---|
|  |  |  | DataSet ds1 = oCN.RunProcReturn("select * from  h_v_TOERP_StationOutBillList_LastProc where HICMOInterID=" + dr["HICMOInterID"].ToString(), "h_v_TOERP_StationOutBillList_LastProc"); | 
|---|
|  |  |  | DataRow dr1 = ds1.Tables[0].Rows[0]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JObject model = new JObject(); | 
|---|
|  |  |  | model.Add("FBillType", "50fa7c2eda7947b89fab5431bf25d48e"); //单据类型1 | 
|---|
|  |  |  | model.Add("FPrdOrgId", new JObject() { ["Fnumber"] = dr1["FPrdOrgNUMBER"].ToString() }); //生产组织1 | 
|---|
|  |  |  | model.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); //单据日期1 | 
|---|
|  |  |  | JArray Fentity = new JArray(); | 
|---|
|  |  |  | foreach (DataRow item in ds.Tables[0].Rows) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | JObject FentityModel = new JObject(); | 
|---|
|  |  |  | FentityModel.Add("FReportType", "103852");//生产汇报类型 | 
|---|
|  |  |  | FentityModel.Add("FTimeUnitId", "1");//时间单位 | 
|---|
|  |  |  | FentityModel.Add("FWorkshipId", new JObject() { ["Fnumber"] = dr1["FWorkShopNUM"].ToString() }); //  生产车间 | 
|---|
|  |  |  | FentityModel.Add("FStandHourUnitId", "3600"); // 单位标准工时单位 | 
|---|
|  |  |  | FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = dr1["FMaterialNUM"].ToString() }); // 物料编码 | 
|---|
|  |  |  | FentityModel.Add("FMoEntrySeq", dr1["HICMOEntryID"].ToString());//生产订单行号 | 
|---|
|  |  |  | FentityModel.Add("FMoId", dr1["HICMOInterID"].ToString());//生产订单内码 | 
|---|
|  |  |  | FentityModel.Add("FFinishQty", item["接收数量"].ToString());//完成数量1 | 
|---|
|  |  |  | FentityModel.Add("FQuaQty", item["合格数量"].ToString());//合格数量1 | 
|---|
|  |  |  | FentityModel.Add("FStockInOrgId ", OrganizationNUM);// 入库组织 | 
|---|
|  |  |  | FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = dr1["FStockNUM"].ToString() }); // 仓库 | 
|---|
|  |  |  | FentityModel.Add("FSrcBillType", "PRD_MO");//  源单类型 | 
|---|
|  |  |  | FentityModel.Add("FSrcBillNo", item["任务单"].ToString());//  源单编号 | 
|---|
|  |  |  | FentityModel.Add("FSrcInterId", dr1["HICMOInterID"].ToString());//  源单内码 | 
|---|
|  |  |  | FentityModel.Add("FSrcEntryId", dr1["HICMOEntryID"].ToString());//  源单分录内码 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //JArray Fentity2 = new JArray(); | 
|---|
|  |  |  | //JObject FentityModel2 = new JObject(); | 
|---|
|  |  |  | //FentityModel2.Add("FDetailEntity_Link_FRULEID", "PUR_PurchaseOrder-PUR_ReceiveBill"); | 
|---|
|  |  |  | //FentityModel2.Add("FDetailEntity_Link_FSTableName", "t_PUR_POOrderEntry"); | 
|---|
|  |  |  | //FentityModel2.Add("FDetailEntity_Link_FSBillId", item["FID"].ToString()); | 
|---|
|  |  |  | //FentityModel2.Add("FDetailEntity_Link_FSId", item["FEntryID"].ToString()); | 
|---|
|  |  |  | //Fentity2.Add(FentityModel2); | 
|---|
|  |  |  | //FentityModel.Add("FDetailEntity_Link", Fentity2); | 
|---|
|  |  |  | //Fentity.Add(FentityModel); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | model.Add("FDetailEntity", Fentity); //明细信息 | 
|---|
|  |  |  | JObject jsonRoot = new JObject() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ["Creator"] = "", | 
|---|
|  |  |  | ["NeedUpDateFields"] = new JArray(), | 
|---|
|  |  |  | ["NeedReturnFields"] = new JArray(), | 
|---|
|  |  |  | ["IsDeleteEntry"] = "false", | 
|---|
|  |  |  | ["SubSystemId"] = "", | 
|---|
|  |  |  | ["IsVerifyBaseDataField"] = "false", | 
|---|
|  |  |  | //["IsAutoSubmitAndAudit"] = true,//自动调用提交和审核功能 | 
|---|
|  |  |  | ["Model"] = model | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | string result = InvokeHelper.Submit("PRD_MORPT", JsonConvert.SerializeObject(jsonRoot)); | 
|---|
|  |  |  | //判断审核是否成功 | 
|---|
|  |  |  | if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = $"工序汇报入库单同步金蝶云失败!单号:{dr["单据号"].ToString()}" + result; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "保存成功!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "Exception!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 返回生产汇报单列表 | 
|---|
|  |  |  | ///参数:string sql。 | 
|---|
|  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (sWhere == null || sWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_Sc_ProcessReportList ", "h_v_Sc_ProcessReportList"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_Sc_ProcessReportList order by hmainid desc", "h_v_Sc_ProcessReportList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_Sc_ProcessReportList where 1 = 1 "; | 
|---|
|  |  |  | string sql = sql1 + sWhere; | 
|---|
|  |  |  | string sql = sql1 + sWhere+ " order by hmainid desc"; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessReportList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //if (!DBUtility.ClsPub.Security_Log("Sc_ProcessPlan_Query", 1, false, user)) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    objJsonResult.code = "0"; | 
|---|
|  |  |  | //    objJsonResult.count = 0; | 
|---|
|  |  |  | //    objJsonResult.Message = "无权限查询!"; | 
|---|
|  |  |  | //    objJsonResult.data = null; | 
|---|
|  |  |  | //    return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("Sc_ProcessPlan_Query", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限查询!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (sWhere == null || sWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_Sc_ProcessPlanList ", "h_v_Sc_ProcessPlanList"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_Sc_ProcessPlanList order by hmainid desc ", "h_v_Sc_ProcessPlanList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_Sc_ProcessPlanList where 1 = 1 "; | 
|---|
|  |  |  | string sql = sql1 + sWhere; | 
|---|
|  |  |  | string sql = sql1 + sWhere+ " order by hmainid desc "; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessPlanList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (sWhere == null || sWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_Sc_ProcessSendWorkList ", "h_v_Sc_ProcessSendWorkList"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_Sc_ProcessSendWorkList order by hmainid desc ", "h_v_Sc_ProcessSendWorkList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_Sc_ProcessSendWorkList where 1 = 1 "; | 
|---|
|  |  |  | string sql = sql1 + sWhere; | 
|---|
|  |  |  | string sql = sql1 + sWhere+ " order by hmainid desc "; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessSendWorkList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/MES_QC_NoPassProdCheckBill_Json")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MES_QC_NoPassProdCheckBill_Json(string sWhere) | 
|---|
|  |  |  | public object MES_QC_NoPassProdCheckBill_Json(string sWhere,string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //查看权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdCheckBillQuery", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无查看权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (sWhere == null || sWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_QC_NoPassProdCheckBillList ", "h_v_QC_NoPassProdCheckBillList"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_QC_NoPassProdCheckBillList order by hmainid desc ", "h_v_QC_NoPassProdCheckBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_QC_NoPassProdCheckBillList where 1 = 1 "; | 
|---|
|  |  |  | string sql = sql1 + sWhere; | 
|---|
|  |  |  | string sql = sql1 + sWhere+ " order by hmainid desc "; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_QC_NoPassProdCheckBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return GetObjectJson(ds); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 不合格评审  删除 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="HInterID"></param> | 
|---|
|  |  |  | /// <param name="user"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/ProcessMangementDeleteBill")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object ProcessMangementDeleteBill(string HInterID, string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdCheckBill_Drop", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限删除"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from h_v_QC_NoPassProdCheckBillList where hmainid =" + HInterID + " ", "h_v_QC_NoPassProdCheckBillList"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (ds.Tables[0].Rows[0]["审核人"].ToString() != "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据已审核,不能删除!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  | oCN.RunProc("Delete from QC_NoPassProdCheckBillMain where HInterID=" + HInterID); | 
|---|
|  |  |  | oCN.RunProc("Delete from QC_NoPassProdCheckBillSub where HInterID=" + HInterID); | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 不合格评审 审核/反审核 | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/AuditProcessMangement")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object AuditProcessMangement(int HInterID, int IsAudit, string CurUserName) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string ModRightNameCheck = "QC_NoPassProdCheckBill_Check"; //该模块的审核功能 | 
|---|
|  |  |  | DBUtility.ClsPub.CurUserName = CurUserName;//存储用户名 | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ////判断是否有审核权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "审核失败!无权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (HInterID <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "ID小于0"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Int64 lngBillKey = 0; | 
|---|
|  |  |  | lngBillKey = DBUtility.ClsPub.isLong(HInterID);//数据转换 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //查询审核的数据 | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from QC_NoPassProdCheckBillMain where HInterID='" + HInterID + "'", "QC_NoPassProdCheckBillMain"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (ds.Tables[0].Rows.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var hcloseman = ds.Tables[0].Rows[0]["HCloseMan"].ToString();//关闭人 | 
|---|
|  |  |  | var hdeleteman = ds.Tables[0].Rows[0]["HDeleteMan"].ToString();//作废人 | 
|---|
|  |  |  | var hchecker = ds.Tables[0].Rows[0]["HChecker"].ToString();//审核人 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (hcloseman != "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "当前单据已关闭,无法审核!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (hdeleteman != "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "当前单据已作废,无法审核!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //IsAudit==0 审核 | 
|---|
|  |  |  | if (IsAudit == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (hchecker != "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "当前单据已审核,无法再次审核!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //IsAudit==1 反审核 | 
|---|
|  |  |  | if (IsAudit == 2) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (hchecker == "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "当前单据未审核,无法反审核!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据不存在;原因:" + DBUtility.ClsPub.sExeReturnInfo; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //审核提交 | 
|---|
|  |  |  | if (IsAudit == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RunProc(" Update QC_NoPassProdCheckBillMain set HChecker='" + CurUserName + "',HCheckDate='" + DateTime.Now + "',HBillStatus=2 Where HBillType='7509' and HInterID=" + HInterID); | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "审核成功!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //反审核提交 | 
|---|
|  |  |  | if (IsAudit == 2) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RunProc(" Update QC_NoPassProdCheckBillMain set HChecker='',HCheckDate=null,HBillStatus=0 Where HBillType='7509' and HInterID=" + HInterID); | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "反审核成功!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "审核失败或反审核失败" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// PDA工序汇报单保存 | 
|---|
|  |  |  | 
|---|
|  |  |  | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); | 
|---|
|  |  |  | string msg2 = sArray[0].ToString(); | 
|---|
|  |  |  | string msg3 = sArray[1].ToString(); | 
|---|
|  |  |  | string user = sArray[2].ToString(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string UserName=""; | 
|---|
|  |  |  | ListModels oListModels = new ListModels(); | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("QC_NoPassProdCheckBill_Edit", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无保存权限"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DLL.ClsQC_NoPassProdCheckBill oBill = new DLL.ClsQC_NoPassProdCheckBill(); | 
|---|
|  |  |  | List<Model.ClsQC_NoPassProdCheckBillMain> lsmain = new List<Model.ClsQC_NoPassProdCheckBillMain>(); | 
|---|
|  |  |  | msg2 = msg2.Replace("\\", ""); | 
|---|
|  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (sqlWhere == null || sqlWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_WW_EntrustProcSendWorkBillList ", "h_v_WW_EntrustProcSendWorkBillList"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_WW_EntrustProcSendWorkBillList order by hmainid desc ", "h_v_WW_EntrustProcSendWorkBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_WW_EntrustProcSendWorkBillList where 1 = 1 "; | 
|---|
|  |  |  | string sql = sql1 + sqlWhere; | 
|---|
|  |  |  | string sql = sql1 + sqlWhere+ " order by hmainid desc "; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_WW_EntrustProcSendWorkBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (sqlWhere == null || sqlWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_WW_EntrustProcessSendOutBillList ", "h_v_WW_EntrustProcessSendOutBillList"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select top 500 * from h_v_WW_EntrustProcessSendOutBillList order by hmainid desc ", "h_v_WW_EntrustProcessSendOutBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_WW_EntrustProcessSendOutBillList where 1 = 1 "; | 
|---|
|  |  |  | string sql = sql1 + sqlWhere; | 
|---|
|  |  |  | string sql = sql1 + sqlWhere+ " order by hmainid desc "; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_WW_EntrustProcessSendOutBillList"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|