| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | //审核,带编辑功能 |
| | | [Route("Cj_StationEntrustOutBill/setOtherProperty")] |
| | | [HttpPost] |
| | | public object setOtherProperty([FromBody] JObject oMain) |
| | | { |
| | | try |
| | | { |
| | | var _value = oMain["oMain"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = "[" + sArray[0].ToString() + "]"; |
| | | string user = sArray[1].ToString(); |
| | | ////判断是否有编辑权限 |
| | | if (!DBUtility.ClsPub.Security_Log("MES_StationEntrustOutBill_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无编辑权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //审核权限 |
| | | if (!DBUtility.ClsPub.Security_Log("MES_StationEntrustOutBill_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核失败!无权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | List<StationBill> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg2); |
| | | long HInterID = list1[0].HInterID; |
| | | double HQty= list1[0].HQty; |
| | | double HBadCount = list1[0].HBadCount; |
| | | double HWasterQty = list1[0].HWasterQty; |
| | | long HSourceID = list1[0].HSourceID; |
| | | string HSourceName = list1[0].HSourceName; |
| | | long HCenterID = list1[0].HCenterID; |
| | | long HGroupID = list1[0].HGroupID; |
| | | long HEmpID = list1[0].HEmpID; |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | DataSet ds = oCN.RunProcReturn("select * from Sc_StationOutBillMain where HInterID="+ HInterID, "Sc_StationOutBillMain"); |
| | | |
| | | if(ds.Tables.Count>0 && ds.Tables[0].Rows[0]["HChecker"].ToString()=="") |
| | | { |
| | | string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | //审核前控制================================================================================ |
| | | string sql = "exec h_p_StationEntrustOutBill_WW_BeforeCheckCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_StationEntrustOutBill_WW_BeforeCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================ |
| | | |
| | | if (HQty>0) |
| | | { |
| | | |
| | | oCN.RunProc($"update Sc_StationOutBillMain set HBillStatus = 2,HQty={HQty},HBadCount='{HBadCount}',HWasterQty='{HWasterQty}',HSourceID='{HSourceID}',HCenterID='{HCenterID}',HGroupID={HGroupID},HEmpID={HEmpID},HChecker='{user}',HCheckDate=getdate() where HInterID={HInterID} "); |
| | | |
| | | } |
| | | |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核修改成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | | oCN.Commit(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在或已审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | } |