|  |  |  | 
|---|
|  |  |  | using Newtonsoft.Json.Linq; | 
|---|
|  |  |  | using Newtonsoft.Json; | 
|---|
|  |  |  | using Newtonsoft.Json.Linq; | 
|---|
|  |  |  | using Pub_Class; | 
|---|
|  |  |  | using System; | 
|---|
|  |  |  | using System.Collections; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有返回任何记录!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "获取信息成功!"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //if (ds.Tables[0].Rows.Count != 0 || ds != null) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "Sucess!"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //else | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //objJsonResult.code = "0"; | 
|---|
|  |  |  | //objJsonResult.count = 0; | 
|---|
|  |  |  | //objJsonResult.Message = "无数据"; | 
|---|
|  |  |  | //objJsonResult.data = null; | 
|---|
|  |  |  | //return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 工序汇报入库 | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 获取工序汇报入库单列表 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="sWhere"></param> | 
|---|
|  |  |  | /// <param name="user"></param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/Get_ProcessReportOverList")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object Get_ProcessReportOverList(string sWhere, string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有查询权限 | 
|---|
|  |  |  | if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "无查询权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (sWhere == null || sWhere.Equals("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc  order by hmainid desc", "h_v_MES_StationOutBillList_LastProc"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string sql1 = "select * from h_v_MES_StationOutBillList_LastProc where 1 = 1 "; | 
|---|
|  |  |  | string sql = sql1 + sWhere + "  order by hmainid desc"; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_v_MES_StationOutBillList_LastProc"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "Sucess!"; | 
|---|
|  |  |  | objJsonResult.data = ds.Tables[0]; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "Exception!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 入库——生产汇报单 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | /// <param name="InterID">工序汇报单主ID</param> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/SaveICMOReportBill")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object SaveICMOReportBill(string InterID, string user, string BillNo, string OrganizationID) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //获取生产汇报单最大InterID和单据号 | 
|---|
|  |  |  | Int64 HInterID = DBUtility.ClsPub.CreateBillID("3711", ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | string HBillNo = DBUtility.ClsPub.CreateBillCode("3711", ref DBUtility.ClsPub.sExeReturnInfo, true); | 
|---|
|  |  |  | //获取组织代码 | 
|---|
|  |  |  | string OrganizationNUM = oCN.RunProcReturn("select HNumber from Xt_ORGANIZATIONS where HItemID=" + OrganizationID, "Xt_ORGANIZATIONS").Tables[0].Rows[0]["HNumber"].ToString(); | 
|---|
|  |  |  | //根据工序汇报单主ID获取工序汇报入库单的数据 | 
|---|
|  |  |  | DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc"); | 
|---|
|  |  |  | DataRow dr = ds.Tables[0].Rows[0]; | 
|---|
|  |  |  | //保存 | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  | //生产汇报单主表 | 
|---|
|  |  |  | oCN.RunProc("Insert Into Sc_ICMOReportBillMain   " + | 
|---|
|  |  |  | "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HBillStatus,HChecker,HCheckDate" + | 
|---|
|  |  |  | ",HYear,HPeriod,HRemark,HEmpID,HEmpNumber" + | 
|---|
|  |  |  | ",HGroupID,HDeptID,HDeptNumber" + | 
|---|
|  |  |  | ",HMainSourceBillNo,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillType" + | 
|---|
|  |  |  | ") " + | 
|---|
|  |  |  | " values('3711','3711'," + HInterID.ToString() + ",'" + HBillNo + "',getdate(),'" + user + "',getdate(),2,'" + user + "',getdate()" + | 
|---|
|  |  |  | ",DATENAME(YEAR,GETDATE()),0,'','" + dr["HEmpID"].ToString() + "','" + dr["操作员代码"].ToString() + | 
|---|
|  |  |  | "','" + dr["HGroupID"].ToString() + "',0,''" + | 
|---|
|  |  |  | ",'" + BillNo.ToString() + "'," + InterID.ToString() + ", 0,'3791'" + | 
|---|
|  |  |  | ") "); | 
|---|
|  |  |  | //生产汇报单子表 | 
|---|
|  |  |  | oCN.RunProc("Insert into Sc_ICMOReportBillSub " + | 
|---|
|  |  |  | " (HInterID,HEntryID,HMaterID,HMaterNumber" + | 
|---|
|  |  |  | ",HQty,HUnitID,HUnitNumber,HTimes,HSourceID" + | 
|---|
|  |  |  | ",HQtyMust,HWorkerID,HWorkerNumber,HBadCount,HWasterQty," + | 
|---|
|  |  |  | "HCloseMan,HCloseType,HRemark," + | 
|---|
|  |  |  | "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + | 
|---|
|  |  |  | ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + | 
|---|
|  |  |  | ",HICMOInterID,HICMOBillNo,HBarCode" + | 
|---|
|  |  |  | ") values(" | 
|---|
|  |  |  | + HInterID.ToString() + ",1," + dr["HMaterID"].ToString() + ",'" + dr["产品代码"].ToString() + "'" + | 
|---|
|  |  |  | "," + dr["合格数量"].ToString() + ",0,'',0,0" + | 
|---|
|  |  |  | "," + dr["接收数量"].ToString() + "," + dr["HEmpID"].ToString() + ",'" + dr["操作员代码"].ToString() + "'," + dr["不良数量"].ToString() + "," + dr["报废数量"].ToString() + | 
|---|
|  |  |  | ",'',0,''" + | 
|---|
|  |  |  | "," + InterID.ToString() + ",0,'" + BillNo.ToString() + "','3791',0,0" + | 
|---|
|  |  |  | ",0,0,''" + | 
|---|
|  |  |  | "," + dr["HICMOInterID"].ToString() + ",'" + dr["任务单"].ToString() + "',''" + | 
|---|
|  |  |  | ") "); | 
|---|
|  |  |  | //同步金蝶 | 
|---|
|  |  |  | //访问金蝶 | 
|---|
|  |  |  | var loginRet = InvokeHelper.Login(); | 
|---|
|  |  |  | var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); | 
|---|
|  |  |  | if (isSuccess == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "操作失败,金蝶账号登录异常。" + loginRet; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //根据任务单查找到金蝶的生产订单 | 
|---|
|  |  |  | DataSet ds1 = oCN.RunProcReturn("select * from  h_v_TOERP_StationOutBillList_LastProc where HICMOEntryID=" + dr["HICMOEntryID"].ToString(), "h_v_TOERP_StationOutBillList_LastProc"); | 
|---|
|  |  |  | DataRow dr1 = ds1.Tables[0].Rows[0]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JObject model = new JObject(); | 
|---|
|  |  |  | model.Add("FBillType", new JObject() { ["Fnumber"] = "SCHBD01_SYS" }); //单据类型生产汇报“SCHBD02_SYS” 入库汇报SCHBD01_SYS | 
|---|
|  |  |  | model.Add("FPrdOrgId", new JObject() { ["Fnumber"] = dr1["FPrdOrgNUMBER"].ToString() }); //生产组织1 | 
|---|
|  |  |  | model.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); //单据日期1 | 
|---|
|  |  |  | model.Add("FHZYMESFLAG", "是");//  是否为MES同步 | 
|---|
|  |  |  | model.Add("FBillNo", HBillNo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JArray Fentity = new JArray(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | foreach (DataRow item in ds.Tables[0].Rows) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | JObject FentityModel = new JObject(); | 
|---|
|  |  |  | FentityModel.Add("FIsNew", false);//  源单类型 | 
|---|
|  |  |  | FentityModel.Add("FReportType", new JObject() { ["Fnumber"] = dr1["FREPORTTYPENUMBER"].ToString() });//生产汇报类型 | 
|---|
|  |  |  | FentityModel.Add("FSrcBillType", "PRD_MO");//  源单类型 | 
|---|
|  |  |  | FentityModel.Add("FProductType", "1");//  产品类型 | 
|---|
|  |  |  | FentityModel.Add("FSrcBillNo", item["任务单"].ToString());//  源单编号 | 
|---|
|  |  |  | FentityModel.Add("FSrcInterId", dr1["FMOID"].ToString());//  源单内码 | 
|---|
|  |  |  | FentityModel.Add("FSrcEntryId", dr1["FMOENTRYID"].ToString());//  源单分录内码、 | 
|---|
|  |  |  | FentityModel.Add("FSRCENTRYSEQ", dr1["FMOENTRYSEQ"].ToString());//  源单分录行号 | 
|---|
|  |  |  | FentityModel.Add("FUNITID", new JObject() { ["Fnumber"] = dr1["FUNITNUMBER"].ToString() });//单位 | 
|---|
|  |  |  | FentityModel.Add("FTimeUnitId", "1");//时间单位 | 
|---|
|  |  |  | FentityModel.Add("FWorkshipId", new JObject() { ["Fnumber"] = dr1["FWorkShopNUM"].ToString() }); //  生产车间 | 
|---|
|  |  |  | FentityModel.Add("FStandHourUnitId", "3600"); // 单位标准工时单位 | 
|---|
|  |  |  | FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = dr1["FMaterialNUM"].ToString() }); // 物料编码 | 
|---|
|  |  |  | FentityModel.Add("FMoEntrySeq", dr1["FMOENTRYSEQ"].ToString());//生产订单行号 | 
|---|
|  |  |  | FentityModel.Add("FMoId", dr1["HICMOInterID"].ToString());//生产订单内码 | 
|---|
|  |  |  | FentityModel.Add("FFinishQty", item["接收数量"].ToString());//完成数量1 | 
|---|
|  |  |  | FentityModel.Add("FQuaQty", item["合格数量"].ToString());//合格数量1FFailQty | 
|---|
|  |  |  | FentityModel.Add("FFailQty", item["不良数量"].ToString());//不合格数量 | 
|---|
|  |  |  | FentityModel.Add("FStockInOrgId ", new JObject() { ["Fnumber"] = OrganizationNUM });// 入库组织 | 
|---|
|  |  |  | FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = dr1["FStockNUM"].ToString() }); // 仓库 | 
|---|
|  |  |  | FentityModel.Add("FMOID", dr1["FMOID"].ToString());// | 
|---|
|  |  |  | FentityModel.Add("FMOBILLNO", dr1["FMOBILLNO"].ToString());// | 
|---|
|  |  |  | FentityModel.Add("FMOENTRYID", dr1["FMOENTRYID"].ToString());// | 
|---|
|  |  |  | FentityModel.Add("FMOENTRYSEQ", dr1["FMOENTRYSEQ"].ToString());// | 
|---|
|  |  |  | FentityModel.Add("FOwnerTypeId", dr1["FOWNERTYPEID"].ToString()); //货主类型:FOwnerTypeId(必填项) | 
|---|
|  |  |  | FentityModel.Add("FOwnerId", new JObject() { ["Fnumber"] = dr1["FOwnerNumber"].ToString() }); //货主:FOwnerId(必填项) | 
|---|
|  |  |  | FentityModel.Add("FBomId", new JObject() { ["Fnumber"] = dr1["FBOMNUM"].ToString() }); //BOM版本:FBomId(必填项) | 
|---|
|  |  |  | FentityModel.Add("FCostRate", dr1["FCostRate"].ToString());// 成本权重 | 
|---|
|  |  |  | FentityModel.Add("FISBACKFLUSH", dr1["FISBACKFLUSH"].ToString() == "1" ? true : false);// 倒冲领料 | 
|---|
|  |  |  | FentityModel.Add("F_bsv_Base1", new JObject() { ["Fnumber"] = dr1["FPREBDONENUMBER"].ToString() }); //包装标识 | 
|---|
|  |  |  | FentityModel.Add("FLot", new JObject() { ["FNumber"] = dr1["FBATCHNO"].ToString() }); //批号 | 
|---|
|  |  |  | //批号 | 
|---|
|  |  |  | //FFLOWID FFLOWLINEID FRULEID FSTABLENAME | 
|---|
|  |  |  | //f6e6eec3 - 5267 - 4f02 - 8593 - b633da508a72    3   PRD_MO2MORPT T_PRD_MOENTRY | 
|---|
|  |  |  | //业务流程图:FEntity_Link_FFlowId | 
|---|
|  |  |  | //推进路线:FEntity_Link_FFlowLineId | 
|---|
|  |  |  | //转换规则:FEntity_Link_FRuleId | 
|---|
|  |  |  | //源单表内码:FEntity_Link_FSTableId | 
|---|
|  |  |  | //源单表:FEntity_Link_FSTableName | 
|---|
|  |  |  | //源单内码:FEntity_Link_FSBillId | 
|---|
|  |  |  | //源单分录内码:FEntity_Link_FSId | 
|---|
|  |  |  | //原始携带量:FEntity_Link_FBaseQuaQtyOld | 
|---|
|  |  |  | //修改携带量:FEntity_Link_FBaseQuaQty | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JArray Fentity2 = new JArray(); | 
|---|
|  |  |  | JObject FentityModel2 = new JObject(); | 
|---|
|  |  |  | FentityModel2.Add("FEntity_Link_FFlowId", "f6e6eec3-5267-4f02-8593-b633da508a72"); | 
|---|
|  |  |  | FentityModel2.Add("FEntity_Link_FFlowLineId", "PRD_MO2MORPT"); | 
|---|
|  |  |  | FentityModel2.Add("FEntity_Link_FRuleId", "3"); | 
|---|
|  |  |  | FentityModel2.Add("FEntity_Link_FSTableId", "0"); | 
|---|
|  |  |  | FentityModel2.Add("FEntity_Link_FSTableName", "T_PRD_MOENTRY"); | 
|---|
|  |  |  | FentityModel2.Add("FEntity_Link_FSBillId", dr1["FMOID"].ToString()); | 
|---|
|  |  |  | FentityModel2.Add("FEntity_Link_FSId", dr1["FMOENTRYID"].ToString()); | 
|---|
|  |  |  | FentityModel2.Add("FEntity_Link_FBaseQuaQtyOld", item["合格数量"].ToString()); | 
|---|
|  |  |  | FentityModel2.Add("FEntity_Link_FBaseQuaQty", item["合格数量"].ToString()); | 
|---|
|  |  |  | Fentity2.Add(FentityModel2); | 
|---|
|  |  |  | FentityModel.Add("FEntity_Link", Fentity2); | 
|---|
|  |  |  | FentityModel.Add("FBFLowId", new JObject() { ["FID"] = "f6e6eec3-5267-4f02-8593-b633da508a72" }); // | 
|---|
|  |  |  | Fentity.Add(FentityModel); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | model.Add("FEntity", Fentity); //明细信息 | 
|---|
|  |  |  | JObject jsonRoot = new JObject() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ["Creator"] = "", | 
|---|
|  |  |  | ["NeedUpDateFields"] = new JArray(), | 
|---|
|  |  |  | ["NeedReturnFields"] = new JArray(), | 
|---|
|  |  |  | ["IsDeleteEntry"] = "false", | 
|---|
|  |  |  | ["SubSystemId"] = "", | 
|---|
|  |  |  | ["IsVerifyBaseDataField"] = "false", | 
|---|
|  |  |  | //["IsAutoSubmitAndAudit"] = true,//自动调用提交和审核功能 | 
|---|
|  |  |  | ["Model"] = model | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string result = InvokeHelper.Save("PRD_MORPT", JsonConvert.SerializeObject(jsonRoot));//保存 | 
|---|
|  |  |  | //判断保存是否成功 | 
|---|
|  |  |  | if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | LogService.Write("工序汇报单入库错误jsonRoot:" + jsonRoot); | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = $"工序汇报入库单同步金蝶云失败!单号:{dr["单据号"].ToString()}" + result; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //提交审核 | 
|---|
|  |  |  | string result1 = string.Empty; | 
|---|
|  |  |  | string result2 = string.Empty; | 
|---|
|  |  |  | var fID = JObject.Parse(result)["Result"]["Id"].ToString(); | 
|---|
|  |  |  | var fBillNo = JObject.Parse(result)["Result"]["Number"].ToString(); | 
|---|
|  |  |  | var json = new | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Ids = fID, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | result1 = InvokeHelper.Submit("PRD_MORPT", JsonConvert.SerializeObject(json));//提交 | 
|---|
|  |  |  | result2 = InvokeHelper.Audit("PRD_MORPT", JsonConvert.SerializeObject(json));//提交 | 
|---|
|  |  |  | if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = $"生产汇报单单号:{fBillNo},提交失败" + result; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "保存成功!"; | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "Exception!" + e.ToString(); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 返回生产汇报单列表 | 
|---|
|  |  |  | ///参数:string sql。 | 
|---|
|  |  |  | 
|---|
|  |  |  | /// </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"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (HInterID<=0) | 
|---|
|  |  |  | if (HInterID <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "HInterID小于0!" ; | 
|---|
|  |  |  | objJsonResult.Message = "HInterID小于0!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | inner join Gy_Department s2 on s1.HDeptID=s2.HItemID and s1.HInterID=" + HInterID; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql1, "Sc_ProcessReportMain"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string sql1 =@"select [hmainid], [日期], [单据号], [HDeptID], [部门代码], [部门], [HMaterID], [物料代码], [物料名称], [规格型号], [HUnitID], [计量单位代码], [计量单位], [HprocID], | 
|---|
|  |  |  | string sql1 = @"select [hmainid], [日期], [单据号], [HDeptID], [部门代码], [部门], [HMaterID], [物料代码], [物料名称], [规格型号], [HUnitID], [计量单位代码], [计量单位], [HprocID], | 
|---|
|  |  |  | [工序代码], [工序], [HGroupID], [班组代码], [班组名称], [HSourceID], [资源代码], [生产资源], [HWorkerID], [职员代码], [职员], [hsubid], [数量], [计划开工日期], | 
|---|
|  |  |  | [计划完工日期], [计划工时], [表体备注], [HICMOInterID], [生产任务单号], [HSeOrderInterID], [销售订单号], [表头备注], [制单人], [制单日期], [审核人], [审核日期], [修改人], | 
|---|
|  |  |  | [修改日期], [关闭人], [关闭日期], [作废人], [作废日期], [源单主内码], [源单子内码], [源单单号], [源单类型], [行关闭人], [HBillType], [HQtyDecimal], [HPriceDecimal] | 
|---|
|  |  |  | from h_v_Sc_ProcessSendWorkList | 
|---|
|  |  |  | where hmainid=(select HSourceID from Sc_ProcessReportSub where HInterID="+HInterID+")"; | 
|---|
|  |  |  | where hmainid=(select HSourceID from Sc_ProcessReportSub where HInterID=" + HInterID + ")"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql1, "h_v_Sc_ProcessSendWorkList"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 工序计划单 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #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"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 保存/编辑 | 
|---|
|  |  |  | #region 工序计划单 保存/编辑 | 
|---|
|  |  |  | //工序计划单  保存/编辑 | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/AddBill")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | ",HRemark,HInnerBillNo,HMaker,HMakeDate" + | 
|---|
|  |  |  | ") " + | 
|---|
|  |  |  | " values(" + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + BillType + "','" + BillType + "'," + omodel.HInterID.ToString() + | 
|---|
|  |  |  | ",'" + omodel.HDate.ToShortDateString() + "','" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + "," + omodel.HCheckItemNowID.ToString() + "," + omodel.HCheckItemNextID.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()" + | 
|---|
|  |  |  | 
|---|
|  |  |  | " where HInterID=" + omodel.HInterID.ToString()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //删除子表 | 
|---|
|  |  |  | oCN.RunProc("Delete From Sc_ProcessPlanSub where HInterID = " + omodel.HInterID.ToString()+ " and hentryid="+ hentryid); | 
|---|
|  |  |  | oCN.RunProc("Delete From Sc_ProcessPlanSub where HInterID = " + omodel.HInterID.ToString() + " and hentryid=" + hentryid); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //保存子表 | 
|---|
|  |  |  | objJsonResult = AddBillSub(msg3, hentryid); | 
|---|
|  |  |  | 
|---|
|  |  |  | ",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() + | 
|---|
|  |  |  | + 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() + "'" + | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #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> | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <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"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("SaveProcessSendWork")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object SaveProcessSendWork([FromBody]JObject msg) | 
|---|
|  |  |  | public object SaveProcessSendWork([FromBody] JObject msg) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var _value = msg["msg"].ToString(); | 
|---|
|  |  |  | string msg1 = _value.ToString(); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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("\\", ""); | 
|---|
|  |  |  | msg2 = msg2.Replace("\n", ""); | 
|---|
|  |  |  | lsmain = oListModels.getObjectByJson_SendWorkMain(msg2); | 
|---|
|  |  |  | foreach ( Model.ClsSc_ProcessSendWorkMain  oItem in lsmain) | 
|---|
|  |  |  | foreach (Model.ClsSc_ProcessSendWorkMain oItem in lsmain) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | UserName = oItem.HMaker; | 
|---|
|  |  |  | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Convert.ToInt32( sendworksub.HQty) > Convert.ToInt32( oItemSub.计划数量)) | 
|---|
|  |  |  | if (Convert.ToInt32(sendworksub.HQty) > Convert.ToInt32(oItemSub.计划数量)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | sendworksub.HCloseType = false; | 
|---|
|  |  |  | sendworksub.HSourceBillType = oItemSub.HBillType; | 
|---|
|  |  |  | lss.Add(sendworksub);//先把数据存放到派工单子表集合里 | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (lss.Count > 0) | 
|---|
|  |  |  | 
|---|
|  |  |  | 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("\\", ""); | 
|---|
|  |  |  | 
|---|
|  |  |  | sendworksub.HWorkerNumber = ""; //--操作工代码 | 
|---|
|  |  |  | sendworksub.HWorkerID = 0; //--操作工ID | 
|---|
|  |  |  | sendworksub.HGroupNumber = ""; //班组代码 | 
|---|
|  |  |  | sendworksub.HGroupID =0;  //--班组ID | 
|---|
|  |  |  | sendworksub.HGroupID = 0;  //--班组ID | 
|---|
|  |  |  | sendworksub.HSourceNumber = ""; //--生产资源代码 | 
|---|
|  |  |  | //--生产资源ID | 
|---|
|  |  |  | sendworksub.HProcNumber = ""; //--工序代码 | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <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> | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("SaveProcessReport")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object SaveProcessReport([FromBody] JObject msg) | 
|---|
|  |  |  | public object SaveProcessReport([FromBody] JObject msg) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var _value = msg["msg"].ToString(); | 
|---|
|  |  |  | string msg1 = _value.ToString(); | 
|---|
|  |  |  | 
|---|
|  |  |  | List<WebAPI.Models.Sc_ProcessReportViewModel> ls = new List<WebAPI.Models.Sc_ProcessReportViewModel>(); | 
|---|
|  |  |  | ls = oListModels.getObjectByJson_Report(msg1); | 
|---|
|  |  |  | int i = 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | foreach (Models.Sc_ProcessReportViewModel ItemView in ls) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | i++; | 
|---|
|  |  |  | 
|---|
|  |  |  | //工序汇报单主表保存 | 
|---|
|  |  |  | ReportMain.HBillType = "3714"; | 
|---|
|  |  |  | ReportMain.HBillNo = ItemView.HBillNo; | 
|---|
|  |  |  | ReportMain.HMakeDate=DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); | 
|---|
|  |  |  | ReportMain.HYear=DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
|---|
|  |  |  | 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 = ItemView.HEmp; | 
|---|
|  |  |  | ReportMain.HCloseType = false; | 
|---|
|  |  |  | ReportMain.HPlanQty = (double)ItemView.HQty; | 
|---|
|  |  |  | ReportMain.HMainSourceInterID = ItemView.HInterID; | 
|---|
|  |  |  | ReportMain.HInterID =0; | 
|---|
|  |  |  | ReportMain.HInterID = 0; | 
|---|
|  |  |  | ReportMain.HPeriod = 1; | 
|---|
|  |  |  | ReportMain.HBillSubType = "3714"; | 
|---|
|  |  |  | ReportMain.HBillStatus = 0; | 
|---|
|  |  |  | ReportMain.HCheckItemNowID = 0; | 
|---|
|  |  |  | ReportMain.HCheckItemNextID = 0; | 
|---|
|  |  |  | ReportMain.HICMOInterID= (long)ItemView.HICMOInterID; | 
|---|
|  |  |  | ReportMain.HICMOBillNo=ItemView.HICMOBillNo; | 
|---|
|  |  |  | ReportMain.HICMOInterID = (long)ItemView.HICMOInterID; | 
|---|
|  |  |  | ReportMain.HICMOBillNo = ItemView.HICMOBillNo; | 
|---|
|  |  |  | ReportMain.HDeptID = (long)ItemView.HDeptID; | 
|---|
|  |  |  | ReportMain.HDeptNumber =ItemView.HDeptNumber; | 
|---|
|  |  |  | ReportMain.HDeptNumber = ItemView.HDeptNumber; | 
|---|
|  |  |  | ReportMain.HGroupID = (long)ItemView.HGroupID; | 
|---|
|  |  |  | ReportMain.HGroupNumber = ItemView.HGroupNumber; | 
|---|
|  |  |  | ReportMain.HMaterID = (long)ItemView.HMaterID; | 
|---|
|  |  |  | 
|---|
|  |  |  | ReportMain.HExplanation = ""; | 
|---|
|  |  |  | ReportMain.HInnerBillNo = ""; | 
|---|
|  |  |  | ReportMain.HSupID = 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存到汇报单主表 | 
|---|
|  |  |  | 
|---|
|  |  |  | ReportSub.HQty = (double)ItemView.HQty; | 
|---|
|  |  |  | ReportSub.HProcID = ItemView.HProcID; | 
|---|
|  |  |  | ReportSub.HProcNumber = ItemView.HProcNumber; | 
|---|
|  |  |  | ReportSub.HOutPrice =0; | 
|---|
|  |  |  | ReportSub.HOutPrice = 0; | 
|---|
|  |  |  | ReportSub.HOutMoney = 0; | 
|---|
|  |  |  | ReportSub.HSourceID = (long)ItemView.HSourceID; | 
|---|
|  |  |  | ReportSub.HEmpNumber = ""; | 
|---|
|  |  |  | ReportSub.HRelBeginDate = DateTime.Now; | 
|---|
|  |  |  | ReportSub.HRelEndDate = DateTime.Now; | 
|---|
|  |  |  | ReportSub.HTimes =3; | 
|---|
|  |  |  | ReportSub.HTimes = 3; | 
|---|
|  |  |  | ReportSub.HSeOrderInterID = 0; | 
|---|
|  |  |  | ReportSub.HSeOrderEntryID =0; | 
|---|
|  |  |  | ReportSub.HSeOrderEntryID = 0; | 
|---|
|  |  |  | ReportSub.HSeOrderBillNo = ""; | 
|---|
|  |  |  | ReportSub.HProcPlanInterID = 0; | 
|---|
|  |  |  | ReportSub.HProcPlanBillNo = ""; | 
|---|
|  |  |  | 
|---|
|  |  |  | ReportSub.HRelationMoney = 0; | 
|---|
|  |  |  | ReportSub.HMaterID = (long)ItemView.HMaterID; | 
|---|
|  |  |  | ReportSub.HMaterNumber = ItemView.HMaterNumber; | 
|---|
|  |  |  | 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.HSecUnitQty1 =0; | 
|---|
|  |  |  | ReportSub.HSecUnitRate1=0; | 
|---|
|  |  |  | ReportSub.HSecUnitQty2=0; | 
|---|
|  |  |  | ReportSub.HSecUnitRate2=0; | 
|---|
|  |  |  | ReportSub.HUsingQty=0; | 
|---|
|  |  |  | ReportSub.HSelfBadCount=0; | 
|---|
|  |  |  | ReportSub.HPreBadCount=0; | 
|---|
|  |  |  | ReportSub.HPayMentQty=0; | 
|---|
|  |  |  | ReportSub.HOtherDeduct=0; | 
|---|
|  |  |  | ReportSub.HRelPay=0; | 
|---|
|  |  |  | ReportSub.HOtherItem1=""; | 
|---|
|  |  |  | ReportSub.HOtherItem2=""; | 
|---|
|  |  |  | ReportSub.HOtherItem3=""; | 
|---|
|  |  |  | ReportSub.HOtherItem4=""; | 
|---|
|  |  |  | ReportSub.HOtherItem5=""; | 
|---|
|  |  |  | ReportSub.HPackType=""; | 
|---|
|  |  |  | ReportSub.HCheckEmpID=0; | 
|---|
|  |  |  | ReportSub.HWeight=0; | 
|---|
|  |  |  | ReportSub.HBatchNo=""; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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.HSecUnitQty1 = 0; | 
|---|
|  |  |  | ReportSub.HSecUnitRate1 = 0; | 
|---|
|  |  |  | ReportSub.HSecUnitQty2 = 0; | 
|---|
|  |  |  | ReportSub.HSecUnitRate2 = 0; | 
|---|
|  |  |  | ReportSub.HUsingQty = 0; | 
|---|
|  |  |  | ReportSub.HSelfBadCount = 0; | 
|---|
|  |  |  | ReportSub.HPreBadCount = 0; | 
|---|
|  |  |  | ReportSub.HPayMentQty = 0; | 
|---|
|  |  |  | ReportSub.HOtherDeduct = 0; | 
|---|
|  |  |  | ReportSub.HRelPay = 0; | 
|---|
|  |  |  | ReportSub.HOtherItem1 = ""; | 
|---|
|  |  |  | ReportSub.HOtherItem2 = ""; | 
|---|
|  |  |  | ReportSub.HOtherItem3 = ""; | 
|---|
|  |  |  | ReportSub.HOtherItem4 = ""; | 
|---|
|  |  |  | ReportSub.HOtherItem5 = ""; | 
|---|
|  |  |  | ReportSub.HPackType = ""; | 
|---|
|  |  |  | ReportSub.HCheckEmpID = 0; | 
|---|
|  |  |  | ReportSub.HWeight = 0; | 
|---|
|  |  |  | ReportSub.HBatchNo = ""; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存到汇报单子表 | 
|---|
|  |  |  | ReportModel.DetailColl.Add(ReportSub); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("SaveProcessReportList")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object SaveProcessReportList([FromBody] JObject msg) | 
|---|
|  |  |  | public object SaveProcessReportList([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[2].ToString();//用户名 | 
|---|
|  |  |  | string UserName; | 
|---|
|  |  |  | ListModels oListModels = new ListModels(); | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断是否有编辑权限 | 
|---|
|  |  |  | 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("\\", ""); | 
|---|
|  |  |  | 
|---|
|  |  |  | List<Model.ClsSc_ProcessReportSub> lsReportSub = new List<Model.ClsSc_ProcessReportSub>(); | 
|---|
|  |  |  | foreach (WebAPI.Models.Sc_ProcessSendWorkViewModel ItemView in ls) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | i++; | 
|---|
|  |  |  | Model.ClsSc_ProcessReportSub reportSub = new Model.ClsSc_ProcessReportSub(); | 
|---|
|  |  |  | if (ItemView.数量 <= 0) | 
|---|
|  |  |  | 
|---|
|  |  |  | reportSub.HRemark = ""; | 
|---|
|  |  |  | reportSub.HCloseMan = ReportModel.omodel.HCloseMan; | 
|---|
|  |  |  | reportSub.HCloseType = false; | 
|---|
|  |  |  | reportSub.HEmpID =0; | 
|---|
|  |  |  | reportSub.HICMOBillNo =""; | 
|---|
|  |  |  | reportSub.HEmpID = 0; | 
|---|
|  |  |  | reportSub.HICMOBillNo = ""; | 
|---|
|  |  |  | reportSub.HICMOInterID = (long)ItemView.HICMOInterID; | 
|---|
|  |  |  | reportSub.HRemark = ""; | 
|---|
|  |  |  | reportSub.HSourceBillType = "3712"; | 
|---|
|  |  |  | 
|---|
|  |  |  | lsReportSub.Add(reportSub); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (lsReportSub.Count>0) | 
|---|
|  |  |  | if (lsReportSub.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //然后在循环保存到汇报但子表 | 
|---|
|  |  |  | foreach (Model.ClsSc_ProcessReportSub item in lsReportSub) | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("SaveBadReasonList")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object SaveBadReasonList([FromBody] JObject msg) | 
|---|
|  |  |  | public object SaveBadReasonList([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[2].ToString(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string UserName=""; | 
|---|
|  |  |  | 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("\\", ""); | 
|---|
|  |  |  | 
|---|
|  |  |  | foreach (Model.ClsQC_NoPassProdCheckBillMain oItem in lsmain) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //oItem.HMaker = ""; | 
|---|
|  |  |  | UserName=oItem.HMaker; | 
|---|
|  |  |  | UserName = oItem.HMaker; | 
|---|
|  |  |  | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); | 
|---|
|  |  |  | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); | 
|---|
|  |  |  | oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); | 
|---|
|  |  |  | 
|---|
|  |  |  | oItem.HBillSubType = "7509"; | 
|---|
|  |  |  | oItem.HBillStatus = 1; | 
|---|
|  |  |  | oItem.HPeriod = 0; | 
|---|
|  |  |  | oItem.HGroupName =""; | 
|---|
|  |  |  | oItem.HGroupName = ""; | 
|---|
|  |  |  | oItem.HSourceID = 0; | 
|---|
|  |  |  | oItem.HICMOInterID = 0; | 
|---|
|  |  |  | oItem.HICMOBillNo = ""; | 
|---|
|  |  |  | 
|---|
|  |  |  | oItem.HMainSourceInterID = oItem.HInterID; | 
|---|
|  |  |  | oItem.HInterID = 0; | 
|---|
|  |  |  | //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); | 
|---|
|  |  |  | if (DBUtility.ClsPub.isStrNull(oItem.HDate)=="") | 
|---|
|  |  |  | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oBill.omodel = oItem; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //表体数据 | 
|---|
|  |  |  | //按 },{来拆分数组 //去掉【和】 | 
|---|
|  |  |  | msg3 = msg3.Substring(1, msg3.Length - 2); | 
|---|
|  |  |  | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //将前台临时存放的值传过来的值赋给对应的不良数量字段 | 
|---|
|  |  |  | oItemSub.HBadQty = Convert.ToDecimal( oItemSub.HMRBChecker); | 
|---|
|  |  |  | if (oItemSub.HBadQty<=0) | 
|---|
|  |  |  | oItemSub.HBadQty = Convert.ToDecimal(oItemSub.HMRBChecker); | 
|---|
|  |  |  | if (oItemSub.HBadQty <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if ((double)oItemSub.HBadQty >oBill.omodel.HPlanQty ) | 
|---|
|  |  |  | if ((double)oItemSub.HBadQty > oBill.omodel.HPlanQty) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (DBUtility.ClsPub.isStrNull(oItemSub.HWasterReasonName)=="") | 
|---|
|  |  |  | if (DBUtility.ClsPub.isStrNull(oItemSub.HWasterReasonName) == "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | oItemSub.HBadPCSQty = 0; | 
|---|
|  |  |  | oItemSub.HQCResultID = 0; | 
|---|
|  |  |  | oBill.DetailColl.Add(oItemSub); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //保存前判断(单据号重复,笔录项目) | 
|---|
|  |  |  | //保存 | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("CloseProcessReportList")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object CloseProcessReportList(int HInterID,int IsClose,string CurUserName) | 
|---|
|  |  |  | public object CloseProcessReportList(int HInterID, int IsClose, string CurUserName) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | string ModRightNameCheck = "Sc_ProcessReport_check"; | 
|---|
|  |  |  | string ModRightNameCheck = "Sc_ProcessReport_check"; | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var HChecker = ds.Tables[0].Rows[0]["HChecker"].ToString(); | 
|---|
|  |  |  | var HCloseMan = ds.Tables[0].Rows[0]["HCloseMan"].ToString(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (IsClose == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (HCloseMan.Trim() != "" || HChecker.Trim() == "") | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.Message = "* 单据关闭成功!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if(IsClose==1) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (IsClose == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (HCloseMan.Trim() == "" || HChecker.Trim() == "") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | objJsonResult.Message = "审核失败!无权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (HInterID <= 0) | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有这个单据,无法审核!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var HChecker = ds.Tables[0].Rows[0]["HChecker"].ToString();//取审核人 | 
|---|
|  |  |  | var HMaker=ds.Tables[0].Rows[0]["HMaker"].ToString();//取制单人 | 
|---|
|  |  |  | var HCloseMan=ds.Tables[0].Rows[0]["HCloseMan"].ToString();//取关闭人 | 
|---|
|  |  |  | var HMaker = ds.Tables[0].Rows[0]["HMaker"].ToString();//取制单人 | 
|---|
|  |  |  | var HCloseMan = ds.Tables[0].Rows[0]["HCloseMan"].ToString();//取关闭人 | 
|---|
|  |  |  | if (IsAudit == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (HChecker.Trim() != "" || HChecker.Trim() == HMaker || HCloseMan != "") | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "* 单据审核成功!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (IsAudit == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "* 单据反审核成功!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据无法审核!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <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("")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("Sc_ProcessMangement/MES_WW_EntrustProcessSendOutBillList_Json")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object MES_WW_EntrustProcessSendOutBillList_Json(string sqlWhere) | 
|---|
|  |  |  | 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("\\", ""); | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.data = 1; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | sendworksub.HEntryID = i; | 
|---|
|  |  |  | sendworksub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); | 
|---|
|  |  |  | 
|---|
|  |  |  | ReportMain.HCloseType = false; | 
|---|
|  |  |  | ReportMain.HPrintQty = 0; | 
|---|
|  |  |  | ReportMain.HMainSourceBillType = "3740"; | 
|---|
|  |  |  | ReportMain.HMainSourceInterID =0; | 
|---|
|  |  |  | ReportMain.HMainSourceInterID = 0; | 
|---|
|  |  |  | ReportMain.HMainSourceBillNo = ItemView.HWW_BillNo; | 
|---|
|  |  |  | ReportMain.HInterID = 0; | 
|---|
|  |  |  | ReportMain.HPeriod = 1; | 
|---|
|  |  |  | 
|---|
|  |  |  | ReportMain.HDeptID = Convert.ToInt32(ItemView.HDeptID); | 
|---|
|  |  |  | ReportMain.HExplanation = ""; | 
|---|
|  |  |  | ReportMain.HInnerBillNo = ""; | 
|---|
|  |  |  | ReportMain.HSupID =Convert.ToInt32( ItemView.HSupID); | 
|---|
|  |  |  | ReportMain.HSupID = Convert.ToInt32(ItemView.HSupID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //保存到汇报单主表 | 
|---|
|  |  |  | 
|---|
|  |  |  | ReportSub.HCloseType = false; | 
|---|
|  |  |  | ReportSub.HSourceBillType = "3740"; | 
|---|
|  |  |  | ReportSub.HQty = Convert.ToDecimal(ItemView.HQty); | 
|---|
|  |  |  | ReportSub.HProcID =Convert.ToInt32( ItemView.HProcID); | 
|---|
|  |  |  | ReportSub.HProcID = Convert.ToInt32(ItemView.HProcID); | 
|---|
|  |  |  | ReportSub.HTimes = 0; | 
|---|
|  |  |  | ReportSub.HSeOrderInterID = 0; | 
|---|
|  |  |  | ReportSub.HSeOrderEntryID = 0; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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("\\", ""); | 
|---|
|  |  |  | 
|---|
|  |  |  | WorkOrdersub.HSourceInterID = oItemSub.hmainid.Value; //--源单id | 
|---|
|  |  |  | WorkOrdersub.HSourceEntryID = oItemSub.hsubid.Value; //--源单子ID | 
|---|
|  |  |  | WorkOrdersub.HSourceBillNo = oItemSub.单据号; //--源单单号 | 
|---|
|  |  |  | WorkOrdersub.HSourceBillType= oItemSub.HBillType; //--源单类型 | 
|---|
|  |  |  | WorkOrdersub.HSourceBillType = oItemSub.HBillType; //--源单类型 | 
|---|
|  |  |  | WorkOrdersub.HRelationQty = 0;  //--关联数量 | 
|---|
|  |  |  | WorkOrdersub.HRelationMoney = 0; //--关联金额 | 
|---|
|  |  |  | WorkOrdersub.HOrderBillNo = ""; //--销售订单号 | 
|---|
|  |  |  | 
|---|
|  |  |  | WorkOrdersub.HQty = (double)oItemSub.计划数量; //--订单数量 | 
|---|
|  |  |  | WorkOrdersub.HEntrustType = "3739"; //--委外类型 | 
|---|
|  |  |  | WorkOrdersub.HNextProcName = ""; //--下道工序 | 
|---|
|  |  |  | WorkOrdersub.HPrice =0; //加工费 | 
|---|
|  |  |  | WorkOrdersub.HPrice = 0; //加工费 | 
|---|
|  |  |  | WorkOrdersub.HOutQty = 0;  //--关联发出数量 | 
|---|
|  |  |  | WorkOrdersub.HInQty =0; //--关联接收数量 | 
|---|
|  |  |  | WorkOrdersub.HInQty = 0; //--关联接收数量 | 
|---|
|  |  |  | WorkOrdersub.HBackSupDate = DateTime.Now; //--实际交货日期 | 
|---|
|  |  |  | WorkOrdersub.HInDate = DateTime.Now; //--交货日期 | 
|---|
|  |  |  | WorkOrdersub.HWorkProcFlow = ""; //--工艺流 | 
|---|