|  |  |  | 
|---|
|  |  |  | using System.Data; | 
|---|
|  |  |  | using System.Data.SqlClient; | 
|---|
|  |  |  | using System.Web.Http; | 
|---|
|  |  |  | using WebAPI.DLL; | 
|---|
|  |  |  | using WebAPI.Models; | 
|---|
|  |  |  | using WebAPI.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public DBUtility.ClsPub.Enum_BillStatus BillStatus; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private json objJsonResult = new json(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ///<summary> | 
|---|
|  |  |  | ///封装状态码及返回信息的公用方法。 | 
|---|
|  |  |  | 
|---|
|  |  |  | return GetObjectJson(ds); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 工序计划单 | 
|---|
|  |  |  | List<ClsSc_ProcessPlanSub> DetailColl = new List<ClsSc_ProcessPlanSub>(); | 
|---|
|  |  |  | ClsSc_ProcessPlanMain omodel = new ClsSc_ProcessPlanMain(); | 
|---|
|  |  |  | ClsSc_ProcessPlan oBill = new ClsSc_ProcessPlan(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 工序计划单列表 | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 返回生产工序计划单列表 | 
|---|
|  |  |  | ///参数:string sql。 | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return GetObjectJson(ds); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 返回生产工序派工单列表 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="sWhere"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | #region 工序计划单 保存/编辑 | 
|---|
|  |  |  | //工序计划单  保存/编辑 | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/AddBill")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object AddBill([FromBody] JObject sMainSub) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var _value = sMainSub["sMainSub"].ToString(); | 
|---|
|  |  |  | string msg1 = _value.ToString(); | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  | //保存主表 | 
|---|
|  |  |  | objJsonResult = AddBillMain(msg1); | 
|---|
|  |  |  | if (objJsonResult.code == "0") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = objJsonResult.Message; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "新增单据成功!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public json AddBillMain(string msg1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); | 
|---|
|  |  |  | string msg2 = sArray[0].ToString(); | 
|---|
|  |  |  | string msg3 = sArray[1].ToString(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int hentryid = int.Parse(sArray[2].ToString());//子表的顺序id | 
|---|
|  |  |  | int OperationType = int.Parse(sArray[3].ToString());//数据类型 1添加 3修改 | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | omodel = Newtonsoft.Json.JsonConvert.DeserializeObject<ClsSc_ProcessPlanMain>(msg2); | 
|---|
|  |  |  | string BillType = "3715"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (OperationType == 1)//新增 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //主表 | 
|---|
|  |  |  | oCN.RunProc("Insert Into Sc_ProcessPlanMain   " + | 
|---|
|  |  |  | "(HYear,HPeriod,HBillType,HBillSubType,HInterID" + | 
|---|
|  |  |  | ",HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID" + | 
|---|
|  |  |  | ",HICMOInterID,HICMOBillNo,HMaterID,HMaterNumber,HUnitID" + | 
|---|
|  |  |  | ",HUnitNumber,HPlanQty,HPlanBeginDate,HPlanEndDate,HExplanation" + | 
|---|
|  |  |  | ",HRemark,HInnerBillNo,HMaker,HMakeDate" + | 
|---|
|  |  |  | ") " + | 
|---|
|  |  |  | " values(" + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + BillType + "','" + BillType + "'," + omodel.HInterID.ToString() + | 
|---|
|  |  |  | ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + (omodel.HBillStatus=1) + "," + omodel.HCheckItemNowID.ToString() + "," + omodel.HCheckItemNextID.ToString() + | 
|---|
|  |  |  | "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HMaterID.ToString() + ",'" + omodel.HMaterNumber + "'," + omodel.HUnitID.ToString() + | 
|---|
|  |  |  | ",'" + omodel.HUnitNumber + "'," + omodel.HPlanQty.ToString() + ",'" + omodel.HPlanBeginDate.ToShortDateString() + "','" + omodel.HPlanEndDate.ToShortDateString() + "','" + omodel.HExplanation + "'" + | 
|---|
|  |  |  | ",'" + omodel.HRemark + "','" + omodel.HInnerBillNo + "','" + omodel.HMaker + "',getdate()" + | 
|---|
|  |  |  | ") "); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (OperationType == 3) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //修改 | 
|---|
|  |  |  | oCN.RunProc("UpDate Sc_ProcessPlanMain set  " + | 
|---|
|  |  |  | " HYear=" + omodel.HYear.ToString() + | 
|---|
|  |  |  | ",HPeriod=" + omodel.HPeriod.ToString() + | 
|---|
|  |  |  | //",HInterID=" + omodel.HInterID.ToString() + | 
|---|
|  |  |  | ",HDate='" + omodel.HDate.ToShortDateString() + "'" + | 
|---|
|  |  |  | //",HBillNo='" + omodel.HBillNo + "'" + | 
|---|
|  |  |  | ",HBillStatus=" + omodel.HBillStatus.ToString() + | 
|---|
|  |  |  | ",HCheckItemNowID=" + omodel.HCheckItemNowID.ToString() + | 
|---|
|  |  |  | ",HCheckItemNextID=" + omodel.HCheckItemNextID.ToString() + | 
|---|
|  |  |  | ",HICMOInterID=" + omodel.HICMOInterID.ToString() + | 
|---|
|  |  |  | ",HICMOBillNo='" + omodel.HICMOBillNo + "'" + | 
|---|
|  |  |  | ",HMaterID=" + omodel.HMaterID.ToString() + | 
|---|
|  |  |  | ",HMaterNumber='" + omodel.HMaterNumber + "'" + | 
|---|
|  |  |  | ",HUnitID=" + omodel.HUnitID.ToString() + | 
|---|
|  |  |  | ",HUnitNumber='" + omodel.HUnitNumber + "'" + | 
|---|
|  |  |  | ",HPlanQty=" + omodel.HPlanQty.ToString() + | 
|---|
|  |  |  | ",HPlanBeginDate='" + omodel.HPlanBeginDate.ToShortDateString() + "'" + | 
|---|
|  |  |  | ",HPlanEndDate='" + omodel.HPlanEndDate.ToShortDateString() + "'" + | 
|---|
|  |  |  | ",HExplanation='" + omodel.HExplanation + "'" + | 
|---|
|  |  |  | ",HRemark='" + omodel.HRemark + "'" + | 
|---|
|  |  |  | ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + | 
|---|
|  |  |  | ",HUpDater='" + omodel.HUpDater + "'" + | 
|---|
|  |  |  | ",HUpDateDate=getdate()" + | 
|---|
|  |  |  | " where HInterID=" + omodel.HInterID.ToString()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //删除子表 | 
|---|
|  |  |  | oCN.RunProc("Delete From Sc_ProcessPlanSub where HInterID = " + omodel.HInterID.ToString()+ " and hentryid="+ hentryid); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //保存子表 | 
|---|
|  |  |  | objJsonResult = AddBillSub(msg3, hentryid); | 
|---|
|  |  |  | if (objJsonResult.code == "0") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = objJsonResult.Message; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 = "Exception!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public json AddBillSub(string msg3, int hentryid) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ProcessPlanSub>>(msg3); | 
|---|
|  |  |  | int i = 1; | 
|---|
|  |  |  | //插入子表 | 
|---|
|  |  |  | foreach (Models.ClsSc_ProcessPlanSub oSub in DetailColl) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RunProc("Insert into Sc_ProcessPlanSub " + | 
|---|
|  |  |  | " (HInterID,HEntryID,HBillNo,HProcNo,HProcID,HWorkingQty" + | 
|---|
|  |  |  | ",HProcNumber,HWorkRemark,HCenterID,HDeptID,HDeptNumber" + | 
|---|
|  |  |  | ",HGroupID,HGroupNumber,HWorkerID,HWorkerNumber,HSourceID" + | 
|---|
|  |  |  | ",HQty,HTimeUnit,HPlanWorkTimes,HPlanBeginDate,HPlanEndDate" + | 
|---|
|  |  |  | ",HICMOInterID,HICMOBillNo,HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + | 
|---|
|  |  |  | ",HCloseMan,HCloseType,HRemark,HSourceInterID,HSourceEntryID" + | 
|---|
|  |  |  | ",HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + | 
|---|
|  |  |  | ",HBeginDayQty,HBeginFixQty,HFixWorkDays,HTrunWorkDays,HReadyTimes" + | 
|---|
|  |  |  | ",HReadyTime,HQueueTime,HMoveTime,HBatchNo" + | 
|---|
|  |  |  | ") values(" | 
|---|
|  |  |  | + omodel.HInterID.ToString() + "," +(hentryid==-1?i: hentryid) + ",'" + oSub.HBillNo + "'," + oSub.HProcNo.ToString() + "," + oSub.HProcID.ToString() + "," + oSub.HWorkingQty.ToString() + | 
|---|
|  |  |  | ",'" + oSub.HProcNumber + "','" + oSub.HWorkRemark + "'," + oSub.HCenterID.ToString() + "," + oSub.HDeptID.ToString() + ",'" + oSub.HDeptNumber + "'" + | 
|---|
|  |  |  | "," + oSub.HGroupID.ToString() + ",'" + oSub.HGroupNumber + "'," + oSub.HWorkerID.ToString() + ",'" + oSub.HWorkerNumber + "'," + oSub.HSourceID.ToString() + | 
|---|
|  |  |  | "," + oSub.HQty.ToString() + ",'" + oSub.HTimeUnit + "'," + oSub.HPlanWorkTimes.ToString() + ",'" + oSub.HPlanBeginDate.ToString() + "','" + oSub.HPlanEndDate.ToString() + "'" + | 
|---|
|  |  |  | "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "'," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + | 
|---|
|  |  |  | ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + | 
|---|
|  |  |  | ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + | 
|---|
|  |  |  | "," + oSub.HBeginDayQty.ToString() + "," + oSub.HBeginFixQty.ToString() + "," + oSub.HFixWorkDays.ToString() + "," + oSub.HTrunWorkDays.ToString() + "," + oSub.HReadyTimes.ToString() + | 
|---|
|  |  |  | "," + oSub.HReadyTime.ToString() + "," + oSub.HQueueTime.ToString() + "," + oSub.HMoveTime.ToString() + ",'" + oSub.HBatchNo + "'" + | 
|---|
|  |  |  | ") "); | 
|---|
|  |  |  | i++; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = null; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 工序计划单 审核/反审核 | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/CheckDeOAuditBill")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object CheckDeOAuditBill(int HInterID, int IsAudit, string CurUserName) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //    string ModRightNameCheck = ""; 该模块的审核功能 | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断id是否大于0 | 
|---|
|  |  |  | if (HInterID <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "ID小于0"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //转换id | 
|---|
|  |  |  | Int64 lngBillKey = 0; | 
|---|
|  |  |  | lngBillKey = DBUtility.ClsPub.isLong(HInterID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //查询审核的这条数据 | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from Sc_ProcessPlanMain where HInterID='" + HInterID + "'", "Sc_ProcessPlanMain"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (ds.Tables[0].Rows.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string HCloseMan = ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();//关闭人 | 
|---|
|  |  |  | string HDeleteMan = ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();//作废人 | 
|---|
|  |  |  | string HChecker = ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();//审核人 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (HChecker != "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "当前数据已审核"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //IsAudit==1  反审核 | 
|---|
|  |  |  | if (IsAudit == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 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 == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "反审核成功"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "反审核失败,原因:" + DBUtility.ClsPub.sExeReturnInfo; | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //审核 | 
|---|
|  |  |  | public bool CheckBill(Int64 lngBillKey, ref string sReturn) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string HChecker = DBUtility.ClsPub.CurUserName;//用户名 | 
|---|
|  |  |  | oCN.BeginTran();//打开事务 | 
|---|
|  |  |  | oCN.RunProc("update Sc_ProcessPlanMain set HChecker='" + HChecker + "',HCheckDate='" + DateTime.Now + "',HBillStatus=2 where HInterID='" + lngBillKey + "'"); | 
|---|
|  |  |  | oCN.Commit();//关闭事务 | 
|---|
|  |  |  | sReturn = "审核单据成功!"; | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | sReturn = e.Message; | 
|---|
|  |  |  | throw (e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //反审核 | 
|---|
|  |  |  | public bool AbandonCheck(Int64 lngBillKey, ref string sReturn) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string HChecker = DBUtility.ClsPub.CurUserName;//用户名 | 
|---|
|  |  |  | oCN.BeginTran();//打开事务 | 
|---|
|  |  |  | oCN.RunProc("update Sc_ProcessPlanMain set HChecker='',HCheckDate=null,HBillStatus=1 where HInterID='" + lngBillKey + "'"); | 
|---|
|  |  |  | oCN.Commit();//关闭事务 | 
|---|
|  |  |  | sReturn = "反审核单据成功!"; | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | sReturn = e.Message; | 
|---|
|  |  |  | throw (e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 工序计划单 删除 | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/DeleteProcessBill")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MouldDeleteBill(long HInterID, string User, string ModRightNameDelete) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断权限 | 
|---|
|  |  |  | //if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, false, User)) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    objJsonResult.code = "0"; | 
|---|
|  |  |  | //    objJsonResult.count = 0; | 
|---|
|  |  |  | //    objJsonResult.Message = "没有删除权限"; | 
|---|
|  |  |  | //    objJsonResult.data = null; | 
|---|
|  |  |  | //    return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (oBill.omodel.HChecker != "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "单据当前处于审核状态,不能删除!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "删除成功"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "删除失败"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限删除"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 返回生产工序派工单列表 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="sWhere"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/MES_Sc_ProcessSendWorkMain_Json")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MES_Sc_ProcessSendWorkMain_Json(string sWhere) | 
|---|