| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 试样记录 查询列表 |
| | | [Route("MES_SampleRecordBill_PDA/SampleRecordList")] |
| | | [HttpGet] |
| | | public object SampleRecordList(string sWhere,string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("QC_TestSampleCheckBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查询权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sql = "select * from h_v_QC_TestSampleCheckBillList where 1=1 " + sWhere + " order by 日期 "; |
| | | |
| | | ds = oCN.RunProcReturn(sql, "h_v_QC_TestSampleCheckBillList"); |
| | | |
| | | DataTable dt = ds.Tables[0]; |
| | | |
| | | //获取列名 |
| | | List<object> columnNameList = new List<object>(); |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.list = columnNameList; |
| | | objJsonResult.data = dt; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 试样记录新增保存 |
| | | [Route("MES_SampleRecordBill_PDA/SampleRecordAddBill")] |
| | | [HttpPost] |
| | | public object ColorRecordAddBill([FromBody] JObject oMain) |
| | | public object SampleRecordAddBill([FromBody] JObject oMain) |
| | | { |
| | | var _value = oMain["oMain"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 试样记录 审核/反审核功能 |
| | | [Route("MES_SampleRecordBill_PDA/CheckSampleRecordBill")] |
| | | [HttpGet] |
| | | public object CheckSampleRecordBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("QC_TestSampleCheckBill_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | BillOld.MvarItemKey = "QC_TestSampleCheckBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经审核 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不需要再审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //审核单据 |
| | | oCN.RunProc(" Update " + BillOld.MvarItemKey + " set HChecker='" + user + "',HCheckDate=getdate(),HBillStatus=2 Where HInterID=" + HInterID.ToString()); |
| | | |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反审核 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已反审核!不需要再反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //反审核单据 |
| | | oCN.RunProc(" Update " + BillOld.MvarItemKey + " set HChecker='',HCheckDate=null,HBillStatus=1 Where HInterID=" + HInterID.ToString()); |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | 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; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 试样记录 删除功能 |
| | | [Route("MES_SampleRecordBill_PDA/DelSampleRecordBill")] |
| | | [HttpGet] |
| | | public object DelSampleRecordBill(Int64 lngBillKey, string user) |
| | | { |
| | | DataSet ds; |
| | | string ModRightNameCheck = "QC_TestSampleCheckBill_Detete"; |
| | | try |
| | | { |
| | | //删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (lngBillKey == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据id为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | oCN.BeginTran();//开始事务 |
| | | ds = oCN.RunProcReturn("select * from QC_TestSampleCheckBillMain where HInterID=" + lngBillKey, "QC_TestSampleCheckBillMain"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有数据,无法删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | string HChecker = Convert.ToString(ds.Tables[0].Rows[0]["HChecker"]); |
| | | if (HChecker != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已经审核,不能删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.RunProc("delete from QC_TestSampleCheckBillMain where HInterID=" + lngBillKey); |
| | | |
| | | oCN.Commit();//提交事务 |
| | | objJsonResult.code = "0"; |
| | | 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; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 对色记录 查询列表 |
| | | [Route("ColorRecord/ColorRecordList")] |
| | | [HttpGet] |
| | | public object ColorRecordList(string sWhere,string user) |
| | | { |
| | | try |
| | | { |
| | | |
| | | //判断是否有编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("QC_FirstPieceCheckBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查询权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sql = "select * from h_v_QC_FirstPieceCheckBillMainList where 1=1 " + sWhere + " order by 日期 "; |
| | | |
| | | ds = oCN.RunProcReturn(sql, "h_v_QC_FirstPieceCheckBillMainList"); |
| | | |
| | | DataTable dt = ds.Tables[0]; |
| | | |
| | | //获取列名 |
| | | List<object> columnNameList = new List<object>(); |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.list = columnNameList; |
| | | objJsonResult.data = dt; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 对色记录新增保存 |
| | | [Route("MES_SampleRecordBill_PDA/ColorRecordAddBill")] |
| | | [HttpPost] |
| | | public object SampleRecordAddBill([FromBody] JObject oMain) |
| | | public object ColorRecordAddBill([FromBody] JObject oMain) |
| | | { |
| | | var _value = oMain["oMain"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | |
| | | string msg2 = "[" + sArray[0].ToString() + "]"; |
| | | string user = sArray[1].ToString();//用户名 |
| | | string OperationType = sArray[2].ToString();//类型 |
| | | string msg_entry = sArray[3].ToString(); //明细行信息 |
| | | |
| | | //判断是否有编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("QC_FirstPieceCheckBill_Edit", 1, false, user)) |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | DAL.ClsQC_FirstPieceCheckBill BillNew = new DAL.ClsQC_FirstPieceCheckBill(); |
| | | |
| | | List<Model.ClsQC_FirstPieceCheckBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_FirstPieceCheckBillMain>>(msg2); |
| | | string BillType = "7505"; |
| | |
| | | double HPeriod = DateTime.Now.Month; |
| | | long HSourceID = list[0].HSourceID;//生产资源 |
| | | long HICMOInterID = list[0].HICMOInterID;//任务单ID |
| | | long HICMOEntryID = list[0].HICMOEntryID;//任务单子ID |
| | | string HICMOBillNo = list[0].HICMOBillNo;//任务单 |
| | | string HProcExchBillNo = list[0].HProcExchBillNo;//指引卡 |
| | | long HMaterID = list[0].HMaterID;//产品ID |
| | |
| | | long HProcID = list[0].HProcID;//工序ID |
| | | long HPRDORGID = list[0].HPRDORGID;//组织ID |
| | | bool HLastResult = list[0].HLastResult;//试样结论 |
| | | |
| | | //表体数据 |
| | | List<Model.ClsQC_FirstPieceCheckBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_FirstPieceCheckBillSub>>(msg_entry); |
| | | for (int i = 0; i < subList.ToArray().Length; i++) |
| | | { |
| | | if (subList.ToArray().Length >= 0) |
| | | { |
| | | Model.ClsQC_FirstPieceCheckBillSub oSub = new Model.ClsQC_FirstPieceCheckBillSub(); |
| | | oSub.HEntryID = i + 1; |
| | | oSub.HRemark = ClsPub.isStrNull(subList[i].HRemark); |
| | | oSub.HSourceInterID = ClsPub.isLong(subList[i].HSourceInterID); |
| | | oSub.HSourceEntryID = ClsPub.isLong(subList[i].HSourceEntryID); |
| | | oSub.HSourceBillType = ClsPub.isStrNull(subList[i].HSourceBillType); |
| | | oSub.HSourceBillNo = ClsPub.isStrNull(subList[i].HSourceBillNo); |
| | | oSub.HRelationQty = DBUtility.ClsPub.isDoule(subList[i].HRelationQty); |
| | | oSub.HRelationMoney = DBUtility.ClsPub.isDoule(subList[i].HRelationMoney); |
| | | oSub.HCloseMan = DBUtility.ClsPub.isStrNull(subList[i].HCloseMan); |
| | | oSub.HCloseType = DBUtility.ClsPub.isBool(subList[i].HCloseType); |
| | | oSub.HQCCheckItemID = DBUtility.ClsPub.isLong(subList[i].HQCCheckItemID); |
| | | oSub.HQCStd = DBUtility.ClsPub.isStrNull(subList[i].HQCStd); |
| | | oSub.HResult = DBUtility.ClsPub.isStrNull(subList[i].HResult); |
| | | //oSub.HProcCheckTime = HDate; |
| | | //oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(mainList[0].HBillNo); |
| | | //oSub.HProcCheckEmp = ClsPub.isLong(mainList[0].HFirstCheckEmp); |
| | | oSub.HSampleSchemeID = DBUtility.ClsPub.isLong(subList[i].HSampleSchemeID); |
| | | oSub.HSampleQty = DBUtility.ClsPub.isLong(subList[i].HSampleQty); |
| | | oSub.HSampleDamageQty = DBUtility.ClsPub.isDoule(subList[i].HSampleDamageQty); |
| | | oSub.HAcceptQty = DBUtility.ClsPub.isLong(subList[i].HAcceptQty); |
| | | oSub.HRejectQty = DBUtility.ClsPub.isLong(subList[i].HRejectQty); |
| | | oSub.HSampleUnRightQty = DBUtility.ClsPub.isDoule(subList[i].HSampleUnRightQty); |
| | | oSub.HStatus = DBUtility.ClsPub.isStrNull(subList[i].HStatus); |
| | | oSub.HUnitID = DBUtility.ClsPub.isLong(subList[i].HUnitID); |
| | | oSub.HInspectVal = DBUtility.ClsPub.isStrNull(subList[i].HInspectVal); |
| | | oSub.HTargetVal = DBUtility.ClsPub.isStrNull(subList[i].HTargetVal); |
| | | oSub.HUpLimit = DBUtility.ClsPub.isStrNull(subList[i].HUpLimit); |
| | | oSub.HDownLimit = DBUtility.ClsPub.isStrNull(subList[i].HDownLimit); |
| | | oSub.HUpOffSet = DBUtility.ClsPub.isStrNull(subList[i].HUpOffSet); |
| | | oSub.HDownOffSet = DBUtility.ClsPub.isStrNull(subList[i].HDownOffSet); |
| | | oSub.HAnalysisMethod = DBUtility.ClsPub.isStrNull(subList[i].HAnalysisMethod); |
| | | oSub.HKeyInspect = DBUtility.ClsPub.isLong(subList[i].HKeyInspect); |
| | | oSub.HInspectInstruMentID = DBUtility.ClsPub.isLong(subList[i].HInspectInstruMentID); |
| | | oSub.HInspectResult = DBUtility.ClsPub.isStrNull(subList[i].HResult == "true" ? 1 : 0); |
| | | |
| | | BillNew.DetailColl.Add(oSub); |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无明细行信息!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | //单据完整性判断 |
| | | if (HProcExchBillNo == "") |
| | |
| | | } |
| | | oCN.RunProc("Insert Into QC_FirstPieceCheckBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + |
| | | ",HYear,HPeriod,HMaterID,HSourceID,HICMOInterID,HICMOBillNo,HProcExchBillNo" + |
| | | ",HYear,HPeriod,HMaterID,HSourceID,HICMOInterID,HICMOEntryID,HICMOBillNo,HProcExchBillNo" + |
| | | ",HPRDORGID,HLastResult)" + |
| | | " values('" + BillType + "','" + HBillSubType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" + |
| | | "," + HYear + "," + HPeriod + ",'" + HMaterID + "','" + HSourceID + "'," + HICMOInterID + ",'" + HICMOBillNo + "','" + HProcExchBillNo + "'" + |
| | | "," + HYear + "," + HPeriod + ",'" + HMaterID + "','" + HSourceID + "'," + HICMOInterID + "," + HICMOEntryID + ",'" + HICMOBillNo + "','" + HProcExchBillNo + "'" + |
| | | "," + HPRDORGID + ",'" + HLastResult + "') "); |
| | | |
| | | //插入子表 |
| | | foreach (Model.ClsQC_FirstPieceCheckBillSub oSub in BillNew.DetailColl) |
| | | { |
| | | oCN.RunProc("Insert into QC_FirstPieceCheckBillSub " + |
| | | " (HInterID,HBillNo_bak,HEntryID" + |
| | | ",HRemark,HSourceInterID" + |
| | | ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + |
| | | ",HQCCheckItemID,HQCStd,HResult" + |
| | | ",HStatus,HUnitID,HKeyInspect,HAnalysisMethod,HInspectInstruMentID,HInspectResult" + |
| | | ") values(" |
| | | + HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'," + HICMOInterID.ToString() + |
| | | "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + |
| | | "," + oSub.HQCCheckItemID.ToString() + ",'" + oSub.HQCStd + "','" + oSub.HResult + "'" + |
| | | ",'" + oSub.HStatus + |
| | | "'," + oSub.HUnitID + "," + oSub.HKeyInspect + ",'" + oSub.HAnalysisMethod + "'," + oSub.HInspectInstruMentID + ",'" + oSub.HInspectResult + "'" + |
| | | ") "); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 对色记录 审核/反审核功能 |
| | | [Route("ColorRecord/CheckColorRecordBill")] |
| | | [HttpGet] |
| | | public object CheckColorRecordBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("QC_FirstPieceCheckBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | BillOld.MvarItemKey = "QC_FirstPieceCheckBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经审核 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不需要再审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //审核单据 |
| | | oCN.RunProc(" Update " + BillOld.MvarItemKey + " set HChecker='" + user + "',HCheckDate=getdate(),HBillStatus=2 Where HInterID=" + HInterID.ToString()); |
| | | |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反审核 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已反审核!不需要再反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //反审核单据 |
| | | oCN.RunProc(" Update " + BillOld.MvarItemKey + " set HChecker='',HCheckDate=null,HBillStatus=1 Where HInterID=" + HInterID.ToString()); |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | 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; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 对色记录 删除功能 |
| | | [Route("ColorRecord/DelColorRecordBill")] |
| | | [HttpGet] |
| | | public object DelColorRecordBill(Int64 lngBillKey, string user) |
| | | { |
| | | DataSet ds; |
| | | string ModRightNameCheck = "QC_FirstPieceCheckBill_Delete"; |
| | | try |
| | | { |
| | | //删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (lngBillKey == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据id为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | oCN.BeginTran();//开始事务 |
| | | ds = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillMain where HInterID=" + lngBillKey, "QC_FirstPieceCheckBillMain"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有数据,无法删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | string HChecker = Convert.ToString(ds.Tables[0].Rows[0]["HChecker"]); |
| | | if (HChecker != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已经审核,不能删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.RunProc("delete from QC_FirstPieceCheckBillMain where HInterID=" + lngBillKey); |
| | | |
| | | oCN.Commit();//提交事务 |
| | | objJsonResult.code = "0"; |
| | | 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; |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 指引卡变更单 新增保存 |
| | | [Route("MES_Sc_ProcessExchangeBillMain_Note_PDA/ProcessExchangeBillMain_NoteAddBill")] |
| | | [HttpPost] |
| | | public object ProcessExchangeBillMain_NoteAddBill([FromBody] JObject oMain) |
| | | { |
| | | var _value = oMain["oMain"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | try |
| | | { |
| | | //反序列化 |
| | | string msg2 = "[" + sArray[0].ToString() + "]"; |
| | | string user = sArray[1].ToString();//用户名 |
| | | string OperationType = sArray[2].ToString();//类型 |
| | | |
| | | //判断是否有编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Change", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无变更权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | List<Model.Sc_ProcessExchangeBillMain_Note> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.Sc_ProcessExchangeBillMain_Note>>(msg2); |
| | | |
| | | long HSouceID_Original = list[0].HSouceID_Original; |
| | | long HSouceID_Now = list[0].HSouceID_Now; |
| | | long HOrgID = list[0].HOrgID;//组织ID |
| | | String HICMOBillNo = list[0].HICMOBillNo;//任务单 |
| | | long HICMOInterID = list[0].HICMOInterID;//任务单ID |
| | | long HProcExchInterID = list[0].HProcExchInterID; |
| | | long HProcExchEntryID = list[0].HProcExchEntryID; |
| | | String HProcExchBillNo = list[0].HProcExchBillNo; |
| | | String HBillNo_Note = list[0].HBillNo_Note;//指引卡 |
| | | long HMaterID = list[0].HMaterID;//产品ID |
| | | long HUnitID = list[0].HUnitID;//计量单位 |
| | | long HProcID = list[0].HProcID;//工序ID |
| | | string HMaker = user;//制单人 |
| | | string HMakeDate = list[0].HMakeDate;//制单日期 |
| | | |
| | | //单据完整性判断 |
| | | if (HProcExchBillNo == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "流转卡没有选择!请扫描条形码或输入条形码后回车"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | if (OperationType == "1") |
| | | { |
| | | oCN.RunProc("Insert Into Sc_ProcessExchangeBillMain_Note " + |
| | | "(HBillNo_Note,HSouceID_Original,HSouceID_Now,HOrgID,HICMOInterID,HICMOBillNo,HProcExchBillNo,HProcExchInterID" + |
| | | ",HProcExchEntryID,HMaterID,HUnitID,HProcID,HMaker,HMakeDate)" + |
| | | " values('" + HBillNo_Note + "','" + HSouceID_Original + "'," + HSouceID_Now + ",'" + HOrgID + "'," + HICMOInterID + ",'"+ HICMOBillNo + "','" + HProcExchBillNo + "' ," + HProcExchInterID + |
| | | "," + HProcExchEntryID + ",'" + HMaterID + "','" + HUnitID + "'," + HProcID + ",'" + HMaker + "','" + HMakeDate + "')" ); |
| | | |
| | | oCN.RunProc("update Sc_ProcessExchangeBillSub set HSourceID=" + HSouceID_Now + " where HInterID=" + HProcExchInterID + " and HEntryID=" + HProcExchEntryID); |
| | | } |
| | | else |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "操作类型无效!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "新增单据成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 出站汇报单显示表体明细 |
| | | [Route("Cj_StationEntrustInBill/DisBillEntryList")] |