New file |
| | |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Web; |
| | | using System.Web.Http; |
| | | using WebAPI.Models; |
| | | using Newtonsoft.Json; |
| | | using Model; |
| | | using DBUtility; |
| | | |
| | | namespace WebAPI.Controllers.MJGL |
| | | { |
| | | public class Sc_MouldBatchWorkCheckBillController : ApiController |
| | | { |
| | | private json objJsonResult = new json(); |
| | | public DataSet ds = new DataSet(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill(); |
| | | |
| | | |
| | | #region 模å
·æäº§éªæ¶å ä¿ååãä¿ååæ§å¶ |
| | | |
| | | //ä¿ååæ§å¶ |
| | | public json BeforeSave_MouldBatchWorkCheckBill(Int64 HInterID, string HBillNo, Int64 OperationType) |
| | | { |
| | | DataSet BeforeSave = oCN.RunProcReturn("Exec h_p_Sc_MouldBatchWorkCheckBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldBatchWorkCheckBill_BeforeSaveCtrl"); |
| | | if (BeforeSave == null || BeforeSave.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿ååå¤æå¤±è´¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(BeforeSave.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; //å¤±è´¥ï¼ |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(BeforeSave.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; //æåï¼ |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(BeforeSave.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | //ä¿ååæ§å¶ |
| | | public json AfterSave_MouldBatchWorkCheckBill(Int64 HInterID, string HBillNo, Int64 OperationType) |
| | | { |
| | | DataSet AfterSave = oCN.RunProcReturn("Exec h_p_Sc_MouldBatchWorkCheckBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldBatchWorkCheckBill_AfterSaveCtrl"); |
| | | if (AfterSave == null || AfterSave.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿ååå¤æå¤±è´¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(AfterSave.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; //å¤±è´¥ï¼ |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(AfterSave.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; //æåï¼ |
| | | objJsonResult.Message = DBUtility.ClsPub.isStrNull(AfterSave.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 模å
·æäº§éªæ¶å å表æ¥è¯¢ |
| | | [Route("Sc_MouldBatchWorkCheckBill/Sc_MouldBatchWorkCheckBillList")] |
| | | [HttpGet] |
| | | public object Sc_MouldBatchWorkCheckBillList(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | //æ¥çæé |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldBatchWorkCheckBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æ¥çæéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_MouldBatchWorkCheckBillList where 1=1" + sWhere + "order by HInterID desc ", "h_v_Sc_MouldBatchWorkCheckBillList"); |
| | | |
| | | //æ·»å åå |
| | | 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.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 模å
·æäº§éªæ¶å æ°å¢ |
| | | /// <summary> |
| | | /// æ°å¢åæ®-ä¿åæé® |
| | | ///åæ°ï¼string sqlã |
| | | ///è¿åå¼ï¼objectã |
| | | /// </summary> |
| | | [Route("Sc_MouldBatchWorkCheckBill/AddSc_MouldBatchWorkCheckBill")] |
| | | [HttpPost] |
| | | public object AddSc_MouldBatchWorkCheckBill([FromBody] JObject sMainSub) |
| | | { |
| | | var _value = sMainSub["sMainSub"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | oCN.BeginTran(); |
| | | //ä¿å主表 |
| | | objJsonResult = AddBillMain(msg1); |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "æ°å¢åæ®æåï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | public json AddBillMain(string msg1) |
| | | { |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); |
| | | int OperationType = int.Parse(sArray[2].ToString());//æ°æ®ç±»å 1æ·»å 3ä¿®æ¹ 2 å¤å¶ |
| | | string user = sArray[3].ToString();//ç¨æ·å |
| | | try |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldBatchWorkCheckBill_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æéç¼è¾!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | msg2 = "[" + msg2.ToString() + "]"; |
| | | List<ClsSc_MouldBatchWorkCheckBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldBatchWorkCheckBillMain>>(msg2); |
| | | string HBillType = "3848"; |
| | | long HInterID = mainList[0].HInterID;//éå
¥typeå¾å°çåæ®ID |
| | | string HBillNo = mainList[0].HBillNo;//éå
¥typeå¾å°çåæ®å· |
| | | DateTime HDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));//æ¥æ |
| | | int HYear = DateTime.Now.Year; |
| | | double HPeriod = DateTime.Now.Month; |
| | | string HRemark = mainList[0].HRemark;//夿³¨ |
| | | string HMaker = mainList[0].HMaker;//å¶å人 |
| | | int HOrgID = mainList[0].HOrgID; //ç»ç» |
| | | Int64 HDeptID = mainList[0].HDeptID; |
| | | Int64 HEmpID = mainList[0].HEmpID; |
| | | Int64 HMangerID = mainList[0].HMangerID; |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_MouldBatchWorkCheckBillList where HInterID=" + HInterID + " and åæ®å·='" + HBillNo + "'", "h_v_Sc_MouldBatchWorkCheckBillList"); |
| | | |
| | | if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//æ°å¢ |
| | | { |
| | | //ä¿ååæ§å¶ |
| | | objJsonResult = BeforeSave_MouldBatchWorkCheckBill(HInterID, HBillNo, 1); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //主表 |
| | | oCN.RunProc(@"Insert Into Sc_MouldBatchWorkCheckBillMain |
| | | (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate |
| | | , HYear, HPeriod, HRemark, HMaker, HMakeDate, HOrgID |
| | | , HDeptID, HEmpID, HMangerID)" + |
| | | " values('" + HBillType + "','1','" + HBillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" + |
| | | "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()," + HOrgID + |
| | | "," + HDeptID + "," + HEmpID + "," + HMangerID + ") "); |
| | | |
| | | } |
| | | else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | //ä¿ååæ§å¶ |
| | | objJsonResult = BeforeSave_MouldBatchWorkCheckBill(HInterID, HBillNo, 2); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //ä¿®æ¹ |
| | | oCN.RunProc("update Sc_MouldBatchWorkCheckBillMain set " + |
| | | "HDate='" + HDate + |
| | | "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker + |
| | | "',hupdatedate=getdate(),HDeptID=" + HDeptID + ",HEmpID=" + HEmpID + ",HMangerID=" + HMangerID + " where HInterID='" + HInterID + "'"); |
| | | |
| | | //å é¤å表 |
| | | oCN.RunProc("delete from Sc_MouldBatchWorkCheckBillSub where HInterID='" + HInterID + "'"); |
| | | } |
| | | //ä¿åå表 |
| | | objJsonResult = AddBillSub(msg3, HInterID, HBillNo, OperationType); |
| | | if (objJsonResult.code == "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | public json AddBillSub(string msg3, long HInterID, string HBillNo, Int64 OperationType) |
| | | { |
| | | List<ClsSc_MouldBatchWorkCheckBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldBatchWorkCheckBillSub>>(msg3); |
| | | int i = 0; |
| | | foreach (ClsSc_MouldBatchWorkCheckBillSub oSub in DetailColl) |
| | | { |
| | | i++; |
| | | |
| | | oCN.RunProc(@"Insert Into Sc_MouldBatchWorkCheckBillSub |
| | | (HInterID, HBillNo_bak, HEntryID, HMaterID_Prod, HMaterID |
| | | , HMouldID, HMouldNum) |
| | | values(" |
| | | + HInterID + ",'" + HBillNo + "'," + i + ",'" + oSub.HMaterID_Prod.ToString() + "','" + oSub.HMaterID |
| | | + "','" + oSub.HMouldID.ToString() + "','" + oSub.HMouldNum.ToString() + "') "); |
| | | } |
| | | |
| | | if (OperationType == 1)//æ°å¢ |
| | | { |
| | | //ä¿ååæ§å¶ |
| | | objJsonResult = AfterSave_MouldBatchWorkCheckBill(HInterID, HBillNo, 1); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //ä¿ååæ§å¶ |
| | | objJsonResult = AfterSave_MouldBatchWorkCheckBill(HInterID, HBillNo, 2); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = objJsonResult.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 模å
·æäº§éªæ¶å ç¼è¾æ¥è¯¢ |
| | | [Route("Sc_MouldBatchWorkCheckBill/Sc_MouldBatchWorkCheckBill_Edit")] |
| | | [HttpGet] |
| | | public object Sc_MouldBatchWorkCheckBill_Edit(string linterid, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | //æ¥çæé |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldBatchWorkCheckBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æ¥çæéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_MouldBatchWorkCheckBillEdit where 1=1 and HInterID=" + linterid + "order by HInterID desc ", "h_v_Sc_MouldBatchWorkCheckBillEdit"); |
| | | |
| | | //æ·»å åå |
| | | 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.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 模å
·æäº§éªæ¶åå é¤åè½ |
| | | [Route("Sc_MouldBatchWorkCheckBill/DeltetSc_MouldBatchWorkCheckBill")] |
| | | [HttpGet] |
| | | public object DeltetSc_MouldBatchWorkCheckBill(string HInterID,string user) |
| | | { |
| | | |
| | | //å 餿é |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldBatchWorkCheckBill_Delete", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ å 餿éï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | |
| | | ds = oCN.RunProcReturn(@"select HMaker,HBillNo,HBillStatus,HChecker from Sc_MouldBatchWorkCheckBillMain a |
| | | inner join Sc_MouldBatchWorkCheckBillSub b on a.HInterID = b.HInterID |
| | | where a.HInterID = " + HInterID, "Sc_MouldBatchWorkCheckBillMain"); |
| | | |
| | | if (ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | |
| | | string sReturn = ""; |
| | | if (oSystemParameter.ShowBill(ref sReturn)) |
| | | { |
| | | if (oSystemParameter.omodel.Sc_ProcessExchangeBill_DeleterAndMakerMustSame == "Y") |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HMaker"].ToString() != user && (user != "admin" && user != "Admin")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®å·:" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "åªè½å 餿¬äººçåæ®ï¼"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®å·:" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "åæ®å½åå¤äºä¸è½å é¤ç¶æ,ä¸è½å é¤ï¼"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®å·:" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "忮已ç»å®¡æ ¸,ä¸è½å é¤ï¼"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.RunProc("delete from Sc_MouldBatchWorkCheckBillMain where HInterID=" + HInterID); |
| | | oCN.RunProc("delete from Sc_MouldBatchWorkCheckBillSub where HInterID=" + HInterID) ; |
| | | |
| | | oCN.Commit(); |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®æªæ¾å°"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å 餿å!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | |
| | | #region 模å
·æäº§éªæ¶åå®¡æ ¸/åå®¡æ ¸åè½ |
| | | [Route("Sc_MouldBatchWorkCheckBill/CheckSc_MouldBatchWorkCheckBill")] |
| | | [HttpGet] |
| | | public object CheckSc_MouldBatchWorkCheckBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //夿æ¯å¦æå 餿é |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldBatchWorkCheckBill_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; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Sc_MouldBatchWorkCheckBillMain"; |
| | | 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; |
| | | } |
| | | |
| | | //å®¡æ ¸åæ® |
| | | if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®ä¸åå¨!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | } |
| | | 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; |
| | | } |
| | | |
| | | //åå®¡æ ¸åæ® |
| | | if (BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®ä¸åå¨!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | 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("Sc_MouldBatchWorkCheckBill/CloseSc_MouldBatchWorkCheckBill")] |
| | | [HttpGet] |
| | | public object CloseSc_MouldBatchWorkCheckBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //夿æ¯å¦æå 餿é |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldBatchWorkCheckBill_Close", 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; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Sc_MouldBatchWorkCheckBillMain"; |
| | | 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 == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®ä¸åå¨ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已ä½åº!ä¸è½è¿è¡å
³é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已å
³é!ä¸è½å次å
³é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //å
³éåæ® |
| | | if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å
³é失败!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | 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]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已ä½åº!ä¸è½è¿è¡å
³é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®æªå
³é!ä¸éè¦ååå
³é!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //åå
³éåæ® |
| | | if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "åå
³é失败!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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("Sc_MouldBatchWorkCheckBill/DropSc_MouldBatchWorkCheckBill")] |
| | | [HttpGet] |
| | | public object DropSc_MouldBatchWorkCheckBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //夿æ¯å¦æä½åºæé |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldBatchWorkCheckBill_Drop", 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; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Sc_MouldBatchWorkCheckBillMain"; |
| | | 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 == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®ä¸åå¨ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | 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; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已ä½åº!ä¸éè¦åä½åº!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //ä½åºåæ® |
| | | if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ä½åºå¤±è´¥!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | 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; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®æªä½åº!ä¸éè¦ååä½åº!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //åä½åºåæ® |
| | | if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "åä½åºå¤±è´¥!åå :" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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 |
| | | |
| | | |
| | | } |
| | | } |