|  |  |  | 
|---|
|  |  |  | using System.Data; | 
|---|
|  |  |  | using System.Data.SqlClient; | 
|---|
|  |  |  | using System.Web.Http; | 
|---|
|  |  |  | using WebAPI.DLL; | 
|---|
|  |  |  | using WebAPI.Models; | 
|---|
|  |  |  | using WebAPI.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private json objJsonResult = new json(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ///<summary> | 
|---|
|  |  |  | ///封装状态码及返回信息的公用方法。 | 
|---|
|  |  |  | ///参数:DataSet。 | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/MES_Sc_ProcessReportList_Json")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MES_Sc_ProcessReportList_Json(string sWhere) | 
|---|
|  |  |  | public object MES_Sc_ProcessReportList_Json(string sWhere,string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有查询权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("Sc_ICMOReportBillQuery", 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_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"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | 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。 | 
|---|
|  |  |  | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/MES_Sc_ProcessPlanMain_Json")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MES_Sc_ProcessPlanMain_Json(string sWhere) | 
|---|
|  |  |  | public object MES_Sc_ProcessPlanMain_Json(string sWhere,string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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修改 | 
|---|
|  |  |  | string user = sArray[4].ToString();//用户名 | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有编辑权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("Sc_ProcessPlan_Edit", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限编辑!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 = "Sc_ProcessPlan_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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //判断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) | 
|---|
|  |  |  | public object MES_Sc_ProcessSendWorkMain_Json(string sWhere,string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有查询权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("Sc_ProcessSendWork_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_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"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | 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("Sc_ProcessSendWork_Edit", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限编辑!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DAL.ClsSc_ProcessSendWork Sendwork = new DAL.ClsSc_ProcessSendWork(); | 
|---|
|  |  |  | List<Model.ClsSc_ProcessSendWorkMain> lsmain = new List<Model.ClsSc_ProcessSendWorkMain>(); | 
|---|
|  |  |  | msg2 = msg2.Replace("\\", ""); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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("WW_EntrustProcSendWorkBill_Edit", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限编辑!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WebAPI.DLL.ClsSc_ProcessSendWork Sendwork = new WebAPI.DLL.ClsSc_ProcessSendWork(); | 
|---|
|  |  |  | List<WebAPI.Models.ClsSc_ProcessSendWorkMain> lsmain = new List<WebAPI.Models.ClsSc_ProcessSendWorkMain>(); | 
|---|
|  |  |  | msg2 = msg2.Replace("\\", ""); | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <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"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <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工序汇报单保存 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="msg"></param> | 
|---|
|  |  |  | 
|---|
|  |  |  | ListModels oListModels = new ListModels(); | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | WebAPI.DLL.ClsSc_ProcessReport ReportModel = new WebAPI.DLL.ClsSc_ProcessReport(); | 
|---|
|  |  |  | DAL.ClsSc_ProcessReport ReportModel = new DAL.ClsSc_ProcessReport(); | 
|---|
|  |  |  | List<WebAPI.Models.Sc_ProcessReportViewModel> ls = new List<WebAPI.Models.Sc_ProcessReportViewModel>(); | 
|---|
|  |  |  | ls = oListModels.getObjectByJson_Report(msg1); | 
|---|
|  |  |  | int i = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | WebAPI.DLL.ClsSc_ProcessReport ReportModel = new WebAPI.DLL.ClsSc_ProcessReport(); | 
|---|
|  |  |  | //判断是否有编辑权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("Sc_ICMOReportBill_Edit", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限编辑!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | DAL.ClsSc_ProcessReport ReportModel = new DAL.ClsSc_ProcessReport(); | 
|---|
|  |  |  | List<Model.ClsSc_ProcessReportMain> lsmain = new List<Model.ClsSc_ProcessReportMain>(); | 
|---|
|  |  |  | msg2 = msg2.Replace("\\", ""); | 
|---|
|  |  |  | msg2 = msg2.Replace("\n", "");  //\n | 
|---|
|  |  |  | 
|---|
|  |  |  | 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("\\", ""); | 
|---|
|  |  |  | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //审核权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //审核权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/MES_WW_EntrustProcSendWorkBill_Json")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MES_WW_EntrustProcSendWorkBill_Json(string sqlWhere) | 
|---|
|  |  |  | public object MES_WW_EntrustProcSendWorkBill_Json(string sqlWhere,string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有查询权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("WW_EntrustProcSendWorkBill_Query", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限查询!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/MES_WW_EntrustProcessReportBill_Json")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MES_WW_EntrustProcessReportBill_Json(string sqlWhere) | 
|---|
|  |  |  | public object MES_WW_EntrustProcessReportBill_Json(string sqlWhere,string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有查询权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("WW_EntrustProcessReportBill_Query", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限查询!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (sqlWhere == null || sqlWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <param name="sqlWhere"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/MES_WW_EntrustProcessSendOutBillList_Json")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MES_WW_EntrustProcessSendOutBillList_Json(string sqlWhere) | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MES_WW_EntrustProcessSendOutBillList_Json(string sqlWhere,string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有查询权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("WW_EntrustProcessSendOutBill_Query", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限查询!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | 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("WW_EntrustProcessReportBill_Edit", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限编辑!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WebAPI.DLL.ClsWW_EntrustProcessReportBill Sendwork = new WebAPI.DLL.ClsWW_EntrustProcessReportBill(); | 
|---|
|  |  |  | List<WebAPI.Models.ClsWW_EntrustProcessReportBillMain> lsmain = new List<WebAPI.Models.ClsWW_EntrustProcessReportBillMain>(); | 
|---|
|  |  |  | msg2 = msg2.Replace("\\", ""); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 委外派工单号获取信息 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/WWgetHbarCodeDetail")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public ApiResult<DataSet> WWGetHbarCodeDetail(string sBillBarCode) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var model = LuBaoSevice.WWGetHbarCodeDetail(sBillBarCode); | 
|---|
|  |  |  | return model; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | ///委外工序号获得信息 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/WWgetProcDetail")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public ApiResult<DataSet> WWGetProcDetail(string sBillNo, string sProcNo) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var model = LuBaoSevice.WWGetProcDetail(sBillNo, sProcNo); | 
|---|
|  |  |  | return model; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// PDA委外工序汇报单保存 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="msg"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("SaveWWReport")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object SaveWWReport([FromBody] JObject msg) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var _value = msg["msg"].ToString(); | 
|---|
|  |  |  | string msg1 = _value.ToString(); | 
|---|
|  |  |  | ListModels oListModels = new ListModels(); | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | WebAPI.DLL.ClsWW_EntrustProcessReportBill ReportModel = new WebAPI.DLL.ClsWW_EntrustProcessReportBill(); | 
|---|
|  |  |  | List<WebAPI.Models.WWReportViewModel> ls = new List<WebAPI.Models.WWReportViewModel>(); | 
|---|
|  |  |  | ls = oListModels.getObjectByJson_WWReport(msg1); | 
|---|
|  |  |  | int i = 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | foreach (Models.WWReportViewModel ItemView in ls) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | i++; | 
|---|
|  |  |  | Models.ClsWW_EntrustProcessReportBillMain ReportMain = new Models.ClsWW_EntrustProcessReportBillMain(); | 
|---|
|  |  |  | Models.ClsWW_EntrustProcessReportBillSub ReportSub = new Models.ClsWW_EntrustProcessReportBillSub(); | 
|---|
|  |  |  | //工序汇报单主表保存 | 
|---|
|  |  |  | ReportMain.HBillType = "3742"; | 
|---|
|  |  |  | ReportMain.HBillNo = ItemView.HBillNo; | 
|---|
|  |  |  | ReportMain.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); | 
|---|
|  |  |  | ReportMain.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
|---|
|  |  |  | ReportMain.HDate = DateTime.Now; | 
|---|
|  |  |  | ReportMain.HMaker = ""; | 
|---|
|  |  |  | ReportMain.HCloseType = false; | 
|---|
|  |  |  | ReportMain.HPrintQty = 0; | 
|---|
|  |  |  | ReportMain.HMainSourceBillType = "3740"; | 
|---|
|  |  |  | ReportMain.HMainSourceInterID =0; | 
|---|
|  |  |  | ReportMain.HMainSourceBillNo = ItemView.HWW_BillNo; | 
|---|
|  |  |  | ReportMain.HInterID = 0; | 
|---|
|  |  |  | ReportMain.HPeriod = 1; | 
|---|
|  |  |  | ReportMain.HBillSubType = "3742"; | 
|---|
|  |  |  | ReportMain.HBillStatus = 0; | 
|---|
|  |  |  | ReportMain.HCheckItemNowID = 0; | 
|---|
|  |  |  | ReportMain.HCheckItemNextID = 0; | 
|---|
|  |  |  | ReportMain.HDeptID = Convert.ToInt32(ItemView.HDeptID); | 
|---|
|  |  |  | ReportMain.HExplanation = ""; | 
|---|
|  |  |  | ReportMain.HInnerBillNo = ""; | 
|---|
|  |  |  | ReportMain.HSupID =Convert.ToInt32( ItemView.HSupID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存到汇报单主表 | 
|---|
|  |  |  | ReportModel.omodel = ReportMain; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ReportSub.HMaterID = Convert.ToInt32(ItemView.HMaterID); | 
|---|
|  |  |  | ReportSub.HICMOBillNo = ""; | 
|---|
|  |  |  | ReportSub.HICMOInterID = 0; | 
|---|
|  |  |  | ReportSub.HEntryID = i; | 
|---|
|  |  |  | ReportSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | ReportSub.HRemark = ""; | 
|---|
|  |  |  | ReportSub.HCloseMan = ""; | 
|---|
|  |  |  | ReportSub.HCloseType = false; | 
|---|
|  |  |  | ReportSub.HSourceBillType = "3740"; | 
|---|
|  |  |  | ReportSub.HQty = Convert.ToDecimal(ItemView.HQty); | 
|---|
|  |  |  | ReportSub.HProcID =Convert.ToInt32( ItemView.HProcID); | 
|---|
|  |  |  | ReportSub.HTimes = 0; | 
|---|
|  |  |  | ReportSub.HSeOrderInterID = 0; | 
|---|
|  |  |  | ReportSub.HSeOrderEntryID = 0; | 
|---|
|  |  |  | ReportSub.HSeOrderBillNo = ""; | 
|---|
|  |  |  | ReportSub.HProcPlanInterID = 0; | 
|---|
|  |  |  | ReportSub.HProcPlanBillNo = ""; | 
|---|
|  |  |  | ReportSub.HSourceInterID = 0; | 
|---|
|  |  |  | ReportSub.HSourceBillNo = ""; | 
|---|
|  |  |  | ReportSub.HRelationQty = 0; | 
|---|
|  |  |  | ReportSub.HRelationMoney = 0; | 
|---|
|  |  |  | ReportSub.HCheckQty = 0; | 
|---|
|  |  |  | ReportSub.HBadCount = 0; | 
|---|
|  |  |  | ReportSub.HWasterQty = 0; | 
|---|
|  |  |  | ReportSub.HWasterQty2 = 0; | 
|---|
|  |  |  | ReportSub.HPrice = 0; | 
|---|
|  |  |  | ReportSub.HMoney = 0; | 
|---|
|  |  |  | ReportSub.HProcPlanInterID = 0; | 
|---|
|  |  |  | ReportSub.HProcPlanEntryID = 0; | 
|---|
|  |  |  | ReportSub.HProcPlanBillNo = ""; | 
|---|
|  |  |  | ReportSub.HSourceEntryID = 0; | 
|---|
|  |  |  | ReportSub.HSourceBillType = ""; | 
|---|
|  |  |  | ReportSub.HRelationQty = 0; | 
|---|
|  |  |  | ReportSub.HRelationMoney = 0; | 
|---|
|  |  |  | ReportSub.HBadPrirce = 0; | 
|---|
|  |  |  | ReportSub.HBadMoney = 0; | 
|---|
|  |  |  | ReportSub.HWasterPrice = 0; | 
|---|
|  |  |  | ReportSub.HWasterMoney = 0; | 
|---|
|  |  |  | ReportSub.HQualityRate = 0; | 
|---|
|  |  |  | ReportSub.HUsingQty = 0; | 
|---|
|  |  |  | ReportSub.HSelfBadCount = 0; | 
|---|
|  |  |  | ReportSub.HPreBadCount = 0; | 
|---|
|  |  |  | ReportSub.HPayMentQty = 0; | 
|---|
|  |  |  | ReportSub.HPackType = ""; | 
|---|
|  |  |  | ReportSub.HCheckEmpID = 0; | 
|---|
|  |  |  | ReportSub.HWeight = 0; | 
|---|
|  |  |  | ReportSub.HBatchNo = ""; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存到委外汇报单子表 | 
|---|
|  |  |  | ReportModel.DetailColl.Add(ReportSub); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //保存 | 
|---|
|  |  |  | //保存完毕后处理 | 
|---|
|  |  |  | bool bResult; | 
|---|
|  |  |  | bResult = ReportModel.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | if (bResult) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "保存成功!"; | 
|---|
|  |  |  | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 保存委外转出单信息 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="msg"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("SaveWW_EntrustProcessSendOutBill")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object SaveWW_EntrustProcessSendOutBill([FromBody] JObject msg) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var _value = msg["msg"].ToString(); | 
|---|
|  |  |  | string msg1 = _value.ToString(); | 
|---|
|  |  |  | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); | 
|---|
|  |  |  | string msg2 = sArray[0].ToString(); | 
|---|
|  |  |  | string msg3 = sArray[1].ToString(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string user = sArray[1].ToString();//用户名 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string UserName = ""; | 
|---|
|  |  |  | ListModels oListModels = new ListModels(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有编辑权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("WW_EntrustProcessSendOutBill_Edit", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无权限编辑!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WebAPI.DLL.ClsWW_EntrustProcessSendOutBill Sendwork = new WebAPI.DLL.ClsWW_EntrustProcessSendOutBill(); | 
|---|
|  |  |  | List<WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain> lsmain = new List<WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain>(); | 
|---|
|  |  |  | msg2 = msg2.Replace("\\", ""); | 
|---|
|  |  |  | msg2 = msg2.Replace("\n", ""); | 
|---|
|  |  |  | lsmain = oListModels.getObjectByJson_WW_EntrustProcessSendOutBillMain(msg2); | 
|---|
|  |  |  | foreach (WebAPI.Models.ClsWW_EntrustProcessSendOutBillMain oItem in lsmain) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | UserName = oItem.HMaker; | 
|---|
|  |  |  | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); | 
|---|
|  |  |  | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
|---|
|  |  |  | oItem.HDate = DateTime.Now; | 
|---|
|  |  |  | oItem.HMainSourceInterID = oItem.HInterID; | 
|---|
|  |  |  | oItem.HInterID = 0; | 
|---|
|  |  |  | Sendwork.omodel = oItem; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //表体数据 | 
|---|
|  |  |  | //按 },{来拆分数组 //去掉【和】 | 
|---|
|  |  |  | msg3 = msg3.Substring(1, msg3.Length - 2); | 
|---|
|  |  |  | msg3 = msg3.Replace("\\", ""); | 
|---|
|  |  |  | msg3 = msg3.Replace("\n", "");  //\n | 
|---|
|  |  |  | List<WebAPI.Models.WW_EntrustProcSendWorkViewModel> ls = new List<WebAPI.Models.WW_EntrustProcSendWorkViewModel>(); | 
|---|
|  |  |  | ls = oListModels.getObjectByJson_WW_EntrustProcSendWork(msg3); | 
|---|
|  |  |  | int i = 0; | 
|---|
|  |  |  | List<Models.ClsWW_EntrustProcessSendOutBillSub> lss = new List<Models.ClsWW_EntrustProcessSendOutBillSub>(); | 
|---|
|  |  |  | foreach (WebAPI.Models.WW_EntrustProcSendWorkViewModel oItemSub in ls) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | i++; | 
|---|
|  |  |  | Models.ClsWW_EntrustProcessSendOutBillSub sendworksub = new Models.ClsWW_EntrustProcessSendOutBillSub(); | 
|---|
|  |  |  | sendworksub.HProcID = 0;//--工序ID | 
|---|
|  |  |  | sendworksub.HSourceInterID = (long)oItemSub.hmainid;//源单id | 
|---|
|  |  |  | sendworksub.HSourceEntryID = (long)oItemSub.hsubid; //--源单子ID | 
|---|
|  |  |  | sendworksub.HSourceBillNo = oItemSub.单据号; //--源单单号 | 
|---|
|  |  |  | sendworksub.HSourceBillType = oItemSub.HBillType; //--源单类型 | 
|---|
|  |  |  | sendworksub.HQty = (decimal)oItemSub.数量; //--数量 | 
|---|
|  |  |  | sendworksub.HICMOBillNo = "";  //--任务单号 | 
|---|
|  |  |  | sendworksub.HSeOrderBillNo = ""; //--销售订单号 | 
|---|
|  |  |  | sendworksub.HSeOrderEntryID = 0; //--销售子ID | 
|---|
|  |  |  | sendworksub.HSeOrderInterID = 0; //--销售订单主ID | 
|---|
|  |  |  | if (oItemSub.数量 <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!第" + i.ToString() + "行数量不大于0无法保存!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Convert.ToInt32(sendworksub.HQty) > Convert.ToInt32(oItemSub.数量)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!第" + i.ToString() + "行委外汇报数量不能大于委外派工单数量!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | sendworksub.HEntryID = i; | 
|---|
|  |  |  | sendworksub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | sendworksub.HRemark = ""; | 
|---|
|  |  |  | sendworksub.HCloseMan = ""; | 
|---|
|  |  |  | sendworksub.HCloseType = false; | 
|---|
|  |  |  | lss.Add(sendworksub);//先把数据存放到派工单子表集合里 | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (lss.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //然后再循环保存到派工单子表的集合里 | 
|---|
|  |  |  | foreach (Models.ClsWW_EntrustProcessSendOutBillSub Itemsendwork in lss) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Sendwork.DetailColl.Add(Itemsendwork); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!lss集合小于0"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //保存 | 
|---|
|  |  |  | //保存完毕后处理 | 
|---|
|  |  |  | bool bResult; | 
|---|
|  |  |  | if (Sendwork.omodel.HInterID == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | bResult = Sendwork.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bResult = Sendwork.ModifyBill(Sendwork.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (bResult) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "保存成功!"; | 
|---|
|  |  |  | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// PDA委外工序转出单保存 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="msg"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("SaveWWSendOutBill")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object SaveWWSendOutBill([FromBody] JObject msg) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var _value = msg["msg"].ToString(); | 
|---|
|  |  |  | string msg1 = _value.ToString(); | 
|---|
|  |  |  | ListModels oListModels = new ListModels(); | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | WebAPI.DLL.ClsWW_EntrustProcessSendOutBill ReportModel = new WebAPI.DLL.ClsWW_EntrustProcessSendOutBill(); | 
|---|
|  |  |  | List<WebAPI.Models.WWSendOutBillViewModel> ls = new List<WebAPI.Models.WWSendOutBillViewModel>(); | 
|---|
|  |  |  | ls = oListModels.getObjectByJson_WWSendOutBill(msg1); | 
|---|
|  |  |  | int i = 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | foreach (Models.WWSendOutBillViewModel ItemView in ls) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | i++; | 
|---|
|  |  |  | Models.ClsWW_EntrustProcessSendOutBillMain ReportMain = new Models.ClsWW_EntrustProcessSendOutBillMain(); | 
|---|
|  |  |  | Models.ClsWW_EntrustProcessSendOutBillSub ReportSub = new Models.ClsWW_EntrustProcessSendOutBillSub(); | 
|---|
|  |  |  | //工序转出单主表保存 | 
|---|
|  |  |  | ReportMain.HBillType = "3741"; | 
|---|
|  |  |  | ReportMain.HBillNo = ItemView.HBillNo; | 
|---|
|  |  |  | ReportMain.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); | 
|---|
|  |  |  | ReportMain.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
|---|
|  |  |  | ReportMain.HDate = DateTime.Now; | 
|---|
|  |  |  | ReportMain.HMaker = ""; | 
|---|
|  |  |  | ReportMain.HCloseType = false; | 
|---|
|  |  |  | ReportMain.HPrintQty = 0; | 
|---|
|  |  |  | ReportMain.HMainSourceBillType = "3740"; | 
|---|
|  |  |  | ReportMain.HMainSourceInterID = 0; | 
|---|
|  |  |  | ReportMain.HMainSourceBillNo = ItemView.HWW_BillNo; | 
|---|
|  |  |  | ReportMain.HInterID = 0; | 
|---|
|  |  |  | ReportMain.HPeriod = 1; | 
|---|
|  |  |  | ReportMain.HBillSubType = "3741"; | 
|---|
|  |  |  | ReportMain.HBillStatus = 0; | 
|---|
|  |  |  | ReportMain.HCheckItemNowID = 0; | 
|---|
|  |  |  | ReportMain.HCheckItemNextID = 0; | 
|---|
|  |  |  | ReportMain.HDeptID = Convert.ToInt32(ItemView.HDeptID); | 
|---|
|  |  |  | ReportMain.HExplanation = ""; | 
|---|
|  |  |  | ReportMain.HInnerBillNo = ""; | 
|---|
|  |  |  | ReportMain.HSupID = Convert.ToInt32(ItemView.HSupID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存到转出单主表 | 
|---|
|  |  |  | ReportModel.omodel = ReportMain; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ReportSub.HMaterID = Convert.ToInt32(ItemView.HMaterID); | 
|---|
|  |  |  | ReportSub.HICMOBillNo = ""; | 
|---|
|  |  |  | ReportSub.HICMOInterID = 0; | 
|---|
|  |  |  | ReportSub.HEntryID = i; | 
|---|
|  |  |  | ReportSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | ReportSub.HRemark = ""; | 
|---|
|  |  |  | ReportSub.HCloseMan = ""; | 
|---|
|  |  |  | ReportSub.HCloseType = false; | 
|---|
|  |  |  | ReportSub.HSourceBillType = "3740"; | 
|---|
|  |  |  | ReportSub.HQty = Convert.ToDecimal(ItemView.HQty); | 
|---|
|  |  |  | ReportSub.HProcID = Convert.ToInt32(ItemView.HProcID); | 
|---|
|  |  |  | ReportSub.HSeOrderInterID = 0; | 
|---|
|  |  |  | ReportSub.HSeOrderEntryID = 0; | 
|---|
|  |  |  | ReportSub.HSeOrderBillNo = ""; | 
|---|
|  |  |  | ReportSub.HProcPlanInterID = 0; | 
|---|
|  |  |  | ReportSub.HProcPlanBillNo = ""; | 
|---|
|  |  |  | ReportSub.HSourceInterID = 0; | 
|---|
|  |  |  | ReportSub.HSourceBillNo = ""; | 
|---|
|  |  |  | ReportSub.HRelationQty = 0; | 
|---|
|  |  |  | ReportSub.HRelationMoney = 0; | 
|---|
|  |  |  | ReportSub.HPrice = 0; | 
|---|
|  |  |  | ReportSub.HMoney = 0; | 
|---|
|  |  |  | ReportSub.HProcPlanInterID = 0; | 
|---|
|  |  |  | ReportSub.HProcPlanEntryID = 0; | 
|---|
|  |  |  | ReportSub.HProcPlanBillNo = ""; | 
|---|
|  |  |  | ReportSub.HSourceEntryID = 0; | 
|---|
|  |  |  | ReportSub.HSourceBillType = ""; | 
|---|
|  |  |  | ReportSub.HRelationQty = 0; | 
|---|
|  |  |  | ReportSub.HRelationMoney = 0; | 
|---|
|  |  |  | ReportSub.HPackType = ""; | 
|---|
|  |  |  | ReportSub.HBatchNo = ""; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存到委外转出单子表 | 
|---|
|  |  |  | ReportModel.DetailColl.Add(ReportSub); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //保存 | 
|---|
|  |  |  | //保存完毕后处理 | 
|---|
|  |  |  | bool bResult; | 
|---|
|  |  |  | bResult = ReportModel.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | if (bResult) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "保存成功!"; | 
|---|
|  |  |  | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 保存委外工单信息 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="msg"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("SaveWWWorkOrder")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object SaveWWWorkOrder([FromBody] JObject msg) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var _value = msg["msg"].ToString(); | 
|---|
|  |  |  | string msg1 = _value.ToString(); | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | WebAPI.DLL.ClsWW_EntrustWorkOrderBill WorkOrder = new WebAPI.DLL.ClsWW_EntrustWorkOrderBill(); | 
|---|
|  |  |  | List<Models.ClsWW_EntrustWorkOrderBillMain> lsmain = new List<Models.ClsWW_EntrustWorkOrderBillMain>(); | 
|---|
|  |  |  | msg2 = msg2.Replace("\\", ""); | 
|---|
|  |  |  | msg2 = msg2.Replace("\n", ""); | 
|---|
|  |  |  | lsmain = oListModels.getObjectByJson_WorkOrderMain(msg2); | 
|---|
|  |  |  | foreach (Models.ClsWW_EntrustWorkOrderBillMain oItem in lsmain) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | UserName = oItem.HMaker; | 
|---|
|  |  |  | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); | 
|---|
|  |  |  | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
|---|
|  |  |  | oItem.HDate = DateTime.Now; | 
|---|
|  |  |  | oItem.HMainSourceInterID = oItem.HInterID; | 
|---|
|  |  |  | oItem.HInterID = 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WorkOrder.omodel = oItem; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //表体数据 | 
|---|
|  |  |  | //按 },{来拆分数组 //去掉【和】 | 
|---|
|  |  |  | msg3 = msg3.Substring(1, msg3.Length - 2); | 
|---|
|  |  |  | msg3 = msg3.Replace("\\", ""); | 
|---|
|  |  |  | msg3 = msg3.Replace("\n", "");  //\n | 
|---|
|  |  |  | List<WebAPI.Models.Sc_ProcessPlanViewModel> ls = new List<WebAPI.Models.Sc_ProcessPlanViewModel>(); | 
|---|
|  |  |  | ls = oListModels.getObjectByJson_SendWorkSub(msg3); | 
|---|
|  |  |  | int i = 0; | 
|---|
|  |  |  | List<Models.ClsWW_EntrustWorkOrderBillSub> lss = new List<Models.ClsWW_EntrustWorkOrderBillSub>(); | 
|---|
|  |  |  | foreach (WebAPI.Models.Sc_ProcessPlanViewModel oItemSub in ls) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | i++; | 
|---|
|  |  |  | Models.ClsWW_EntrustWorkOrderBillSub WorkOrdersub = new Models.ClsWW_EntrustWorkOrderBillSub(); | 
|---|
|  |  |  | WorkOrdersub.HProcID = oItemSub.hprocid.Value;//--工序ID | 
|---|
|  |  |  | WorkOrdersub.HSourceInterID = oItemSub.hmainid.Value; //--源单id | 
|---|
|  |  |  | WorkOrdersub.HSourceEntryID = oItemSub.hsubid.Value; //--源单子ID | 
|---|
|  |  |  | WorkOrdersub.HSourceBillNo = oItemSub.单据号; //--源单单号 | 
|---|
|  |  |  | WorkOrdersub.HSourceBillType= oItemSub.HBillType; //--源单类型 | 
|---|
|  |  |  | WorkOrdersub.HRelationQty = 0;  //--关联数量 | 
|---|
|  |  |  | WorkOrdersub.HRelationMoney = 0; //--关联金额 | 
|---|
|  |  |  | WorkOrdersub.HOrderBillNo = ""; //--销售订单号 | 
|---|
|  |  |  | WorkOrdersub.HMaterLenModel = ""; //--材质 | 
|---|
|  |  |  | WorkOrdersub.HMaterQty = 0; //--材质数量 | 
|---|
|  |  |  | WorkOrdersub.HMaterID = oItemSub.HMaterID.Value; //--物料 | 
|---|
|  |  |  | WorkOrdersub.HQty = (double)oItemSub.计划数量; //--订单数量 | 
|---|
|  |  |  | WorkOrdersub.HEntrustType = "3739"; //--委外类型 | 
|---|
|  |  |  | WorkOrdersub.HNextProcName = ""; //--下道工序 | 
|---|
|  |  |  | WorkOrdersub.HPrice =0; //加工费 | 
|---|
|  |  |  | WorkOrdersub.HOutQty = 0;  //--关联发出数量 | 
|---|
|  |  |  | WorkOrdersub.HInQty =0; //--关联接收数量 | 
|---|
|  |  |  | WorkOrdersub.HBackSupDate = DateTime.Now; //--实际交货日期 | 
|---|
|  |  |  | WorkOrdersub.HInDate = DateTime.Now; //--交货日期 | 
|---|
|  |  |  | WorkOrdersub.HWorkProcFlow = ""; //--工艺流 | 
|---|
|  |  |  | WorkOrdersub.HLeftMater = ""; //--余料情况 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (oItemSub.计划数量 <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!第" + i.ToString() + "行数量不大于0无法保存!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Convert.ToInt32(WorkOrdersub.HQty) > Convert.ToInt32(oItemSub.计划数量)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!第" + i.ToString() + "行派工数量不能大于计划单数量!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | WorkOrdersub.HEntryID = i; | 
|---|
|  |  |  | WorkOrdersub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | WorkOrdersub.HRemark = ""; | 
|---|
|  |  |  | WorkOrdersub.HCloseMan = ""; | 
|---|
|  |  |  | WorkOrdersub.HCloseType = false; | 
|---|
|  |  |  | WorkOrdersub.HSourceBillType = oItemSub.HBillType; | 
|---|
|  |  |  | lss.Add(WorkOrdersub);//先把数据存放到委外工单子表集合里 | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (lss.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //然后再循环保存到委外工单子表的集合里 | 
|---|
|  |  |  | foreach (Models.ClsWW_EntrustWorkOrderBillSub Itemsendwork in lss) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | WorkOrder.DetailColl.Add(Itemsendwork); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!lss集合小于0"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //保存 | 
|---|
|  |  |  | //保存完毕后处理 | 
|---|
|  |  |  | bool bResult; | 
|---|
|  |  |  | if (WorkOrder.omodel.HInterID == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | bResult = WorkOrder.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bResult = WorkOrder.ModifyBill(WorkOrder.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (bResult) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "保存成功!"; | 
|---|
|  |  |  | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "保存失败!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|