| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回生产汇报单主表详情信息 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Sc_ProcessMangement/MES_DetailSc_ProcessReportList_Json")] |
| | | [HttpGet] |
| | | public object MES_DetailSc_ProcessReportList_Json(int HInterID) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (HInterID<=0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!" ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | |
| | | string sql1 = @"select s1.HInterID,s1.HBillNo,s1.HDeptID,s2.HName,s1.HDate,s1.HPlanQty,s1.HICMOBillNo,s1.HRemark,s2.HNumber |
| | | ,s1.HMaker,s1.HMakeDate,s1.HChecker,s1.HCheckDate,s1.HUpDater,s1.HUpDateDate,s1.HCloseMan,s1.HCloseDate |
| | | from Sc_ProcessReportMain s1 |
| | | inner join Gy_Department s2 on s1.HDeptID=s2.HItemID and s1.HInterID=" + HInterID; |
| | | |
| | | ds = oCN.RunProcReturn(sql1, "Sc_ProcessReportMain"); |
| | | |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | return GetObjectJson(ds); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回生产派工单关联详情信息 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Sc_ProcessMangement/MES_h_v_Sc_ProcessSendWorkList_Json")] |
| | | [HttpGet] |
| | | public object MES_h_v_Sc_ProcessSendWorkList_Json(int HInterID) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | |
| | | string sql1 =@"select [hmainid], [日期], [单据号], [HDeptID], [部门代码], [部门], [HMaterID], [物料代码], [物料名称], [规格型号], [HUnitID], [计量单位代码], [计量单位], [HprocID], |
| | | [工序代码], [工序], [HGroupID], [班组代码], [班组名称], [HSourceID], [资源代码], [生产资源], [HWorkerID], [职员代码], [职员], [hsubid], [数量], [计划开工日期], |
| | | [计划完工日期], [计划工时], [表体备注], [HICMOInterID], [生产任务单号], [HSeOrderInterID], [销售订单号], [表头备注], [制单人], [制单日期], [审核人], [审核日期], [修改人], |
| | | [修改日期], [关闭人], [关闭日期], [作废人], [作废日期], [源单主内码], [源单子内码], [源单单号], [源单类型], [行关闭人], [HBillType], [HQtyDecimal], [HPriceDecimal] |
| | | from h_v_Sc_ProcessSendWorkList |
| | | where hmainid=(select HSourceID from Sc_ProcessReportSub where HInterID="+HInterID+")"; |
| | | |
| | | ds = oCN.RunProcReturn(sql1, "h_v_Sc_ProcessSendWorkList"); |
| | | |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | return GetObjectJson(ds); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回生产工序计划单列表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); |
| | | |
| | | string UserName; |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | |
| | | lsmain = oListModels.getObjectByJson_Reportlist(msg2); |
| | | foreach (Model.ClsSc_ProcessReportMain oItem in lsmain) |
| | | { |
| | | //oItem.HMaker = ""; |
| | | //UserName = oItem.HMaker; |
| | | UserName = oItem.HMaker; |
| | | oItem.HMaker = UserName; |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); |
| | |
| | | reportSub.HEntryID = i; |
| | | reportSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | reportSub.HRemark = ""; |
| | | reportSub.HCloseMan = ""; |
| | | reportSub.HCloseMan = ReportModel.omodel.HCloseMan; |
| | | reportSub.HCloseType = false; |
| | | reportSub.HEmpID =0; |
| | | reportSub.HICMOBillNo =""; |
| | | reportSub.HICMOInterID = (long)ItemView.HICMOInterID; |
| | | reportSub.HEntryID = i; |
| | | reportSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | reportSub.HRemark = ""; |
| | | reportSub.HCloseMan = ""; |
| | | reportSub.HCloseType = false; |
| | | reportSub.HSourceBillType = "3712"; |
| | | reportSub.HQty = (double)ItemView.数量; |
| | | reportSub.HProcID = (long)ItemView.HprocID; |
| | | reportSub.HProcNumber = ItemView.工序代码; |
| | | reportSub.HOutPrice = 0; |
| | | reportSub.HOutMoney = 0; |
| | | reportSub.HSourceID = (long)ItemView.HSourceID; |
| | | reportSub.HSourceID = (long)ItemView.hmainid; |
| | | reportSub.HEmpNumber = ""; |
| | | reportSub.HRelBeginDate = DateTime.Now; |
| | | reportSub.HRelEndDate = DateTime.Now; |
| | |
| | | reportSub.HSeOrderBillNo = ""; |
| | | reportSub.HProcPlanInterID = 0; |
| | | reportSub.HProcPlanBillNo = ""; |
| | | reportSub.HSourceInterID = 0; |
| | | reportSub.HSourceBillNo = ""; |
| | | reportSub.HSourceInterID = (long)ItemView.hmainid; |
| | | reportSub.HSourceBillNo = ItemView.单据号; |
| | | reportSub.HRelationQty = 0; |
| | | reportSub.HRelationMoney = 0; |
| | | reportSub.HMaterID = (long)ItemView.HMaterID; |
| | |
| | | reportSub.HProcPlanEntryID = 0; |
| | | reportSub.HProcPlanBillNo = ""; |
| | | reportSub.HSourceEntryID = 0; |
| | | reportSub.HSourceBillType = ""; |
| | | reportSub.HSourceBillType = "3712"; |
| | | reportSub.HRelationQty = 0; |
| | | reportSub.HRelationMoney = 0; |
| | | reportSub.HBadPrirce = 0; |
| | |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | DAL.ClsQC_NoPassProdCheckBill oBill = new DAL.ClsQC_NoPassProdCheckBill(); |
| | | DLL.ClsQC_NoPassProdCheckBill oBill = new DLL.ClsQC_NoPassProdCheckBill(); |
| | | List<Model.ClsQC_NoPassProdCheckBillMain> lsmain = new List<Model.ClsQC_NoPassProdCheckBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | |
| | | UserName=oItem.HMaker; |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | //oItem.HCurID = 1; |
| | | //oItem.HExRate = 1; |
| | | oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | oItem.HBillType = "7509"; |
| | | oItem.HBillSubType = "7509"; |
| | | oItem.HBillStatus = 1; |
| | | oItem.HPeriod = 0; |
| | | oItem.HGroupName =""; |
| | | oItem.HSourceID = 0; |
| | | oItem.HICMOInterID = 0; |
| | | oItem.HICMOBillNo = ""; |
| | | oItem.HInStockQty = 0; |
| | | oItem.HCheckQty = 0; |
| | | oItem.HRightQty = 0; |
| | | oItem.HBadPNL = 0; |
| | | oItem.HPlanPNL = 0; |
| | | oItem.HFirstCheckEmp = 0; |
| | | oItem.HCheckerResult = ""; |
| | | oItem.HWorkCenterID = 0; |
| | | oItem.HProcExchInterID = 0; |
| | | oItem.HProcExchEntryID = 0; |
| | | oItem.HProcExchBillNo = ""; |
| | | oItem.HOrderProcNo = ""; |
| | | oItem.HProcExchQty = 0; |
| | | oItem.HMainSourceInterID = oItem.HInterID; |
| | | oItem.HInterID = 0; |
| | | //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!没有danju日期,无法保存!"; |
| | | objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | |
| | | foreach (Model.ClsQC_NoPassProdCheckBillSub oItemSub in ls) |
| | | { |
| | | i++; |
| | | if (string.IsNullOrWhiteSpace(oItemSub.HWasterReasonName)) |
| | | { |
| | | break; |
| | | } |
| | | //将前台临时存放的值传过来的值赋给对应的不良数量字段 |
| | | oItemSub.HBadQty = Convert.ToDecimal( oItemSub.HMRBChecker); |
| | | if (oItemSub.HBadQty<=0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oItemSub.HSourceEntryID = oBill.omodel.HMainSourceEntryID; |
| | | oItemSub.HSourceInterID = oBill.omodel.HMainSourceInterID; |
| | | oItemSub.HEntryID = i; |
| | | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HRemark = ""; |
| | | oItemSub.HCloseMan = ""; |
| | | oItemSub.HCloseType = false; |
| | | oItemSub.HBillNo_bak = oBill.omodel.HBillNo; |
| | | oItemSub.HMRBChecker = ""; |
| | | oItemSub.HSourceBillNo = oBill.omodel.HMainSourceBillNo; |
| | | oItemSub.HSourceBillType = "3715"; |
| | | oItemSub.HRelationQty = 0; |
| | | oItemSub.HRelationMoney = 0; |
| | | oItemSub.HMaterID = oBill.omodel.HMaterID; |
| | | oItemSub.HUnitID = 0; |
| | | oItemSub.HMustQty = 0; |
| | | oItemSub.HDisposeNote = ""; |
| | | oItemSub.HPunishmentBillNo = ""; |
| | | oItemSub.HBadPCSQty = 0; |
| | | oItemSub.HQCResultID = 0; |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 汇报单编辑关闭功能 |
| | | /// </summary> |
| | | /// <param name="HInterID"></param> |
| | | /// <param name="IsClose"></param> |
| | | /// <param name="CurUserName"></param> |
| | | /// <returns></returns> |
| | | [Route("CloseProcessReportList")] |
| | | [HttpGet] |
| | | public object CloseProcessReportList(int HInterID,int IsClose,string CurUserName) |
| | | { |
| | | DataSet ds; |
| | | string ModRightNameCheck = "Sc_ProcessReport_check"; |
| | | try |
| | | { |
| | | //审核权限 |
| | | if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from Sc_ProcessReportMain where HInterID=" + HInterID, "Sc_ProcessReportMain"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有这个单据,无法关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | var HChecker = ds.Tables[0].Rows[0]["HChecker"].ToString(); |
| | | var HCloseMan = ds.Tables[0].Rows[0]["HCloseMan"].ToString(); |
| | | |
| | | if (IsClose == 0) |
| | | { |
| | | if (HCloseMan.Trim() != "" || HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核、已关闭、已作废状态下不允许关闭!!!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | oCN.RunProc("update Sc_ProcessReportMain set HCloseMan='" + CurUserName + "' ,HCloseDate=GETDATE() where HInterID=" + HInterID); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "* 单据关闭成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | else if(IsClose==1) |
| | | { |
| | | if (HCloseMan.Trim() == "" || HChecker.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核、未关闭、已作废状态下不允许撤销关闭!!!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.RunProc("update Sc_ProcessReportMain set HCloseMan='' ,HCloseDate=null where HInterID=" + HInterID); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "* 单据反关闭成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 汇报单编辑审核反审核功能 |
| | | /// </summary> |
| | | /// <param name="HInterID"></param> |
| | | /// <param name="IsAudit"></param> |
| | | /// <param name="CurUserName"></param> |
| | | /// <returns></returns> |
| | | [Route("AuditProcessReportList")] |
| | | [HttpGet] |
| | | public object AuditProcessReportList(int HInterID, int IsAudit, string CurUserName) |
| | | { |
| | | DataSet ds; |
| | | string ModRightNameCheck = "Sc_ProcessReport_check"; |
| | | var a = DBUtility.ClsPub.CurUserName; |
| | | try |
| | | { |
| | | //审核权限 |
| | | if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (HInterID <= 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID小于0!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | ds = oCN.RunProcReturn("select * from Sc_ProcessReportMain where HInterID=" + HInterID, "Sc_ProcessReportMain"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有这个单据,无法审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | var HChecker = ds.Tables[0].Rows[0]["HChecker"].ToString();//取审核人 |
| | | var HMaker=ds.Tables[0].Rows[0]["HMaker"].ToString();//取制单人 |
| | | var HCloseMan=ds.Tables[0].Rows[0]["HCloseMan"].ToString();//取关闭人 |
| | | if (IsAudit == 0) |
| | | { |
| | | if (HChecker.Trim() != "" || HChecker.Trim() == HMaker || HCloseMan != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核、已关闭、已作废状态不允许审核!!!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.RunProc("update Sc_ProcessReportMain set HChecker='" + CurUserName + "' ,HCheckDate=GETDATE() where HInterID=" + HInterID); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "* 单据审核成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (IsAudit == 1) |
| | | { |
| | | if (HChecker.Trim() == "" || HChecker.Trim() == CurUserName || HCloseMan != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未审核、已关闭、已作废状态下不允许反审核!!!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.RunProc("update Sc_ProcessReportMain set HChecker='' ,HCheckDate=null where HInterID=" + HInterID); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "* 单据反审核成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |