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_MouldUpperBillController : 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 䏿¨¡å å表æ¥è¯¢ |
| | | [Route("Sc_MouldUpperBill/Sc_MouldUpperBillList")] |
| | | [HttpGet] |
| | | public object Sc_MouldUpperBillList(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | //æ¥çæé |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æ¥çæéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldUpperBillList where 1=1" + sWhere + "order by hmainid desc ", "h_v_Qj_Sc_MouldUpperBillList"); |
| | | |
| | | //æ·»å åå |
| | | 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_MouldUpperBill/AddSc_MouldUpperBill")] |
| | | [HttpPost] |
| | | public object AddSc_MouldUpperBill([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_MouldUpperBill_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æéç¼è¾!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | msg2 = "[" + msg2.ToString() + "]"; |
| | | List<ClsSc_MouldUpperBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillMain>>(msg2); |
| | | string HBillType = "3846"; |
| | | 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_Qj_Sc_MouldUpperBillList where hmainid=" + HInterID + " and åæ®å·='" + HBillNo + "'", "h_v_Qj_Sc_MouldUpperBillList"); |
| | | |
| | | if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//æ°å¢ |
| | | { |
| | | //主表 |
| | | oCN.RunProc(@"Insert Into Sc_MouldUpperBillMain |
| | | (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) |
| | | { //ä¿®æ¹ |
| | | oCN.RunProc("update Sc_MouldUpperBillMain 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_MouldUpperBillSub where HInterID='" + HInterID + "'"); |
| | | } |
| | | //ä¿åå表 |
| | | objJsonResult = AddBillSub(msg3, HInterID, HBillNo); |
| | | 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) |
| | | { |
| | | List<ClsSc_MouldUpperBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillSub>>(msg3); |
| | | int i = 0; |
| | | foreach (ClsSc_MouldUpperBillSub oSub in DetailColl) |
| | | { |
| | | i++; |
| | | |
| | | oCN.RunProc(@"Insert Into Sc_MouldUpperBillSub |
| | | (HInterID, HBillNo_bak, HEntryID, HMouldID, HQty |
| | | , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo) |
| | | values(" |
| | | + HInterID + ",'"+ HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty |
| | | + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString()+",'"+ oSub.HICMOBillNo.ToString() + |
| | | "') "); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 䏿¨¡åå é¤åè½ |
| | | [Route("Sc_MouldUpperBill/DeltetSc_MouldUpperBill")] |
| | | [HttpGet] |
| | | public object DeltetSc_MouldUpperBill(string HInterID, int HPRDORGID, string user) |
| | | { |
| | | |
| | | //ç¼è¾æé |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Delete", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ å 餿éï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string[] HInterIDs = HInterID.Split(','); |
| | | string[] HBillNos = new string[HInterIDs.Length]; |
| | | |
| | | for (int i = 0; i < HInterIDs.Length; i++) |
| | | { |
| | | oCN.BeginTran(); |
| | | string hmainid = HInterIDs[i].Split('_')[0]; |
| | | string hsubid = HInterIDs[i].Split('_')[1]; |
| | | |
| | | ds = oCN.RunProcReturn(@"select HMaker,HBillNo,HBillStatus,HChecker from Sc_MouldUpperBillMain a |
| | | inner join Sc_MouldUpperBillSub b on a.HInterID = b.HInterID |
| | | where a.HInterID = " + hmainid , "Sc_MouldUpperBillMain"); |
| | | |
| | | if (ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | HBillNos[i] = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | 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 = "åæ®å·:" + HBillNos[i] + "åªè½å 餿¬äººçåæ®ï¼"; |
| | | 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 = "åæ®å·:" + HBillNos[i] + "åæ®å½åå¤äºä¸è½å é¤ç¶æ,ä¸è½å é¤ï¼"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®å·:" + HBillNos[i] + "忮已ç»å®¡æ ¸,ä¸è½å é¤ï¼"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows.Count == 1) { |
| | | oCN.RunProc("delete from Sc_MouldUpperBillMain where HInterID=" + hmainid); |
| | | } |
| | | |
| | | oCN.RunProc("delete from Sc_MouldUpperBillSub where HInterID=" + hmainid + " and HEntryID=" + hsubid); |
| | | |
| | | 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_MouldUpperBill/CheckSc_MouldUpperBill")] |
| | | [HttpGet] |
| | | public object CheckSc_MouldUpperBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //夿æ¯å¦æå 餿é |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Sub_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_MouldUpperBillMain"; |
| | | 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_MouldUpperBill/Sc_MouldLowerBillList")] |
| | | [HttpGet] |
| | | public object Sc_MouldLowerBillList(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | //æ¥çæé |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldLowerBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æ¥çæéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldLowerBillList where 1=1" + sWhere + "order by hmainid desc ", "h_v_Qj_Sc_MouldLowerBillList"); |
| | | |
| | | //æ·»å åå |
| | | 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_MouldUpperBill/AddSc_MouldLowerBill")] |
| | | [HttpPost] |
| | | public object AddSc_MouldLowerBill([FromBody] JObject sMainSub) |
| | | { |
| | | var _value = sMainSub["sMainSub"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | oCN.BeginTran(); |
| | | //ä¿å主表 |
| | | objJsonResult = AddMouldLowerBill(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 AddMouldLowerBill(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_MouldLowerBill_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æéç¼è¾!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | msg2 = "[" + msg2.ToString() + "]"; |
| | | List<ClsSc_MouldLowerBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillMain>>(msg2); |
| | | string HBillType = "3847"; |
| | | 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_Qj_Sc_MouldLowerBillList where hmainid=" + HInterID + " and åæ®å·='" + HBillNo + "'", "h_v_Qj_Sc_MouldLowerBillList"); |
| | | |
| | | if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//æ°å¢ |
| | | { |
| | | //主表 |
| | | oCN.RunProc(@"Insert Into Sc_MouldLowerBillMain |
| | | (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) |
| | | { //ä¿®æ¹ |
| | | oCN.RunProc("update Sc_MouldLowerBillMain 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_MouldLowerBillSub where HInterID='" + HInterID + "'"); |
| | | } |
| | | //ä¿åå表 |
| | | objJsonResult = AddMouldLowerBill(msg3, HInterID, HBillNo); |
| | | 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 AddMouldLowerBill(string msg3, long HInterID, string HBillNo) |
| | | { |
| | | List<ClsSc_MouldLowerBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillSub>>(msg3); |
| | | int i = 0; |
| | | foreach (ClsSc_MouldLowerBillSub oSub in DetailColl) |
| | | { |
| | | i++; |
| | | |
| | | oCN.RunProc(@"Insert Into Sc_MouldLowerBillSub |
| | | (HInterID, HBillNo_bak, HEntryID, HMouldID, HQty |
| | | , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo) |
| | | values(" |
| | | + HInterID + ",'" + HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty |
| | | + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString() + |
| | | "') "); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 䏿¨¡åå é¤åè½ |
| | | [Route("Sc_MouldUpperBill/DeltetSc_MouldLowerBill")] |
| | | [HttpGet] |
| | | public object DeltetSc_MouldLowerBill(string HInterID, int HPRDORGID, string user) |
| | | { |
| | | |
| | | //ç¼è¾æé |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldLowerBill_Delete", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ å 餿éï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string[] HInterIDs = HInterID.Split(','); |
| | | string[] HBillNos = new string[HInterIDs.Length]; |
| | | |
| | | for (int i = 0; i < HInterIDs.Length; i++) |
| | | { |
| | | oCN.BeginTran(); |
| | | string hmainid = HInterIDs[i].Split('_')[0]; |
| | | string hsubid = HInterIDs[i].Split('_')[1]; |
| | | |
| | | ds = oCN.RunProcReturn(@"select HMaker,HBillNo,HBillStatus,HChecker from Sc_MouldLowerBillMain a |
| | | inner join Sc_MouldLowerBillSub b on a.HInterID = b.HInterID |
| | | where a.HInterID = " + hmainid, "Sc_MouldLowerBillMain"); |
| | | |
| | | if (ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | HBillNos[i] = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | 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 = "åæ®å·:" + HBillNos[i] + "åªè½å 餿¬äººçåæ®ï¼"; |
| | | 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 = "åæ®å·:" + HBillNos[i] + "åæ®å½åå¤äºä¸è½å é¤ç¶æ,ä¸è½å é¤ï¼"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®å·:" + HBillNos[i] + "忮已ç»å®¡æ ¸,ä¸è½å é¤ï¼"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows.Count == 1) |
| | | { |
| | | oCN.RunProc("delete from Sc_MouldLowerBillMain where HInterID=" + hmainid); |
| | | } |
| | | |
| | | oCN.RunProc("delete from Sc_MouldLowerBillSub where HInterID=" + hmainid + " and HEntryID=" + hsubid); |
| | | |
| | | 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_MouldUpperBill/CheckSc_MouldLowerBill")] |
| | | [HttpGet] |
| | | public object CheckSc_MouldLowerBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //夿æ¯å¦æå 餿é |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Sub_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_MouldLowerBillMain"; |
| | | 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_MouldUpperBill/txtHBarCode_KeyDown")] |
| | | [HttpGet] |
| | | public object txtHBarCode_KeyDown(string HBarCode, string UserID, string HBillType) |
| | | { |
| | | try |
| | | { |
| | | if (HBarCode == null || HBarCode.Equals("")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "空ç½ç ,æ¡å½¢ç ä¸è½ä¸ºç©ºï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //æåæ¡å½¢ç |
| | | string sBillBarCode = HBarCode.Trim(); |
| | | |
| | | |
| | | //æªåæ¡ç ç±»å2 åä¸¤ä½ |
| | | string BillNoType2 = sBillBarCode.Substring(0, Math.Min(2, sBillBarCode.Length)); |
| | | //æªåæ¡ç ç±»å åä¸ä½ |
| | | string BillNoType3 = sBillBarCode.Substring(0, Math.Min(3, sBillBarCode.Length)); |
| | | //æªåæ¡ç ç±»å3 ååä½ |
| | | string BillNoType4 = sBillBarCode.Substring(0, Math.Min(4, sBillBarCode.Length)); |
| | | |
| | | |
| | | switch (BillNoType2) |
| | | { |
| | | //çäº§èµæº |
| | | case "BM": |
| | | case "SS": |
| | | ds = oCN.RunProcReturn("select HItemID,HName,HNumber from Gy_Source where HNumber = '" + HBarCode + "'", "Gy_Source"); |
| | | break; |
| | | case "MO": |
| | | ds = oCN.RunProcReturn("select åæ®å·,hmainid,HEntryID from h_v_IF_ICMOBillList where åæ®å· = '" + HBarCode + "'", "h_v_IF_ICMOBillList"); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | switch (BillNoType3) |
| | | { |
| | | //å¨å
·æ¡£æ¡ |
| | | case "MJD": |
| | | case "PAK": |
| | | ds = oCN.RunProcReturn("select * from h_v_Gy_MouldFileList where åæ®å· = '" + HBarCode + "'", "h_v_Gy_MouldFileList"); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | switch (BillNoType4) |
| | | { |
| | | //æµè½¬å¡ |
| | | case "GXLX": |
| | | ds = oCN.RunProcReturn("select ä»»å¡åå·,hicmointerid,HICMOEntryID,åæ®å·,hmainid,HEntryID from h_v_Sc_ProcessExchangeBillQuerySub where åæ®å· = '" + HBarCode + "'", "h_v_Sc_ProcessExchangeBillQuerySub"); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | if (ds == null || ds .Tables.Count== 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¥æ æ°æ®ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 䏿¨¡å PDAæ°å¢ |
| | | /// <summary> |
| | | /// æ°å¢åæ®-ä¿åæé® |
| | | ///åæ°ï¼string sqlã |
| | | ///è¿åå¼ï¼objectã |
| | | /// </summary> |
| | | [Route("Sc_MouldUpperBill/AddSc_MouldUpperBill_PDA")] |
| | | [HttpPost] |
| | | public object AddSc_MouldUpperBill_PDA([FromBody] JObject oMain) |
| | | { |
| | | var _value = oMain["oMain"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | oCN.BeginTran(); |
| | | //ä¿å主表 |
| | | objJsonResult = AddBillMain_PDA(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_PDA(string msg1) |
| | | { |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string user = sArray[1].ToString();//ç¨æ·å |
| | | int OperationType = int.Parse(sArray[2].ToString());//æ°æ®ç±»å 1æ·»å 3ä¿®æ¹ 2 å¤å¶ |
| | | try |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æéç¼è¾!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | msg2 = "[" + msg2.ToString() + "]"; |
| | | List<ClsSc_MouldUpperBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillMain>>(msg2); |
| | | string HBillType = "3846"; |
| | | long HInterID = mainList[0].HInterID;//éå
¥typeå¾å°çåæ®ID |
| | | string HBillNo = mainList[0].HBillNo;//éå
¥typeå¾å°çåæ®å· |
| | | DateTime HDate = mainList[0].HDate;//æ¥æ |
| | | 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_Qj_Sc_MouldUpperBillList where hmainid=" + HInterID + " and åæ®å·='" + HBillNo + "'", "h_v_Qj_Sc_MouldUpperBillList"); |
| | | |
| | | if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//æ°å¢ |
| | | { |
| | | //主表 |
| | | oCN.RunProc(@"Insert Into Sc_MouldUpperBillMain |
| | | (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) |
| | | { //ä¿®æ¹ |
| | | oCN.RunProc("update Sc_MouldUpperBillMain 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_MouldUpperBillSub where HInterID='" + HInterID + "'"); |
| | | } |
| | | //ä¿åå表 |
| | | objJsonResult = AddBillSub_PDA(msg2, HInterID, HBillNo); |
| | | 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_PDA(string msg2, long HInterID, string HBillNo) |
| | | { |
| | | List<ClsSc_MouldUpperBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillSub>>(msg2); |
| | | int i = 0; |
| | | foreach (ClsSc_MouldUpperBillSub oSub in DetailColl) |
| | | { |
| | | i++; |
| | | |
| | | oCN.RunProc(@"Insert Into Sc_MouldUpperBillSub |
| | | (HInterID, HBillNo_bak, HEntryID, HMouldID, HQty |
| | | , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo |
| | | ,HProcExchBillNo,HProcExchInterID,HProcExchEntryID |
| | | ,HScanDate,HBarCode) |
| | | values(" |
| | | + HInterID + ",'" + HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty |
| | | + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString() |
| | | + "','" + oSub.HProcExchBillNo.ToString() + "'," + oSub.HProcExchInterID.ToString() + "," + oSub.HProcExchEntryID.ToString() |
| | | + ",'" + oSub.HScanDate.ToString() + "','" + oSub.HMouldNumber.ToString() + "') "); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 䏿¨¡å PDAæ°å¢ |
| | | /// <summary> |
| | | /// æ°å¢åæ®-ä¿åæé® |
| | | ///åæ°ï¼string sqlã |
| | | ///è¿åå¼ï¼objectã |
| | | /// </summary> |
| | | [Route("Sc_MouldUpperBill/AddSc_MouldLowerBill_PDA")] |
| | | [HttpPost] |
| | | public object AddSc_MouldLowerBill_PDA([FromBody] JObject oMain) |
| | | { |
| | | var _value = oMain["oMain"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | oCN.BeginTran(); |
| | | //ä¿å主表 |
| | | objJsonResult = AddSc_MouldLowerBillMain_PDA(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 AddSc_MouldLowerBillMain_PDA(string msg1) |
| | | { |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string user = sArray[1].ToString();//ç¨æ·å |
| | | int OperationType = int.Parse(sArray[2].ToString());//æ°æ®ç±»å 1æ·»å 3ä¿®æ¹ 2 å¤å¶ |
| | | try |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldLowerBill_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ æéç¼è¾!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | msg2 = "[" + msg2.ToString() + "]"; |
| | | List<ClsSc_MouldLowerBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillMain>>(msg2); |
| | | string HBillType = "3847"; |
| | | long HInterID = mainList[0].HInterID;//éå
¥typeå¾å°çåæ®ID |
| | | string HBillNo = mainList[0].HBillNo;//éå
¥typeå¾å°çåæ®å· |
| | | DateTime HDate = mainList[0].HDate;//æ¥æ |
| | | 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_Qj_Sc_MouldLowerBillList where hmainid=" + HInterID + " and åæ®å·='" + HBillNo + "'", "h_v_Qj_Sc_MouldLowerBillList"); |
| | | |
| | | if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//æ°å¢ |
| | | { |
| | | //主表 |
| | | oCN.RunProc(@"Insert Into Sc_MouldLowerBillMain |
| | | (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) |
| | | { //ä¿®æ¹ |
| | | oCN.RunProc("update Sc_MouldLowerBillMain 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_MouldLowerBillSub where HInterID='" + HInterID + "'"); |
| | | } |
| | | //ä¿åå表 |
| | | objJsonResult = AddSc_MouldLowerBillSub_PDA(msg2, HInterID, HBillNo); |
| | | 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 AddSc_MouldLowerBillSub_PDA(string msg2, long HInterID, string HBillNo) |
| | | { |
| | | List<ClsSc_MouldLowerBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillSub>>(msg2); |
| | | int i = 0; |
| | | foreach (ClsSc_MouldLowerBillSub oSub in DetailColl) |
| | | { |
| | | i++; |
| | | |
| | | oCN.RunProc(@"Insert Into Sc_MouldLowerBillSub |
| | | (HInterID, HBillNo_bak, HEntryID, HMouldID, HQty |
| | | , HSourceID, HICMOInterID, HICMOEntryID, HICMOBillNo |
| | | ,HProcExchBillNo,HProcExchInterID,HProcExchEntryID |
| | | ,HScanDate,HBarCode) |
| | | values(" |
| | | + HInterID + ",'" + HBillNo + "'," + i + "," + oSub.HMouldID.ToString() + ",'" + oSub.HQty |
| | | + "'," + oSub.HSourceID.ToString() + "," + oSub.HICMOInterID.ToString() + "," + oSub.HICMOEntryID.ToString() + ",'" + oSub.HICMOBillNo.ToString() |
| | | + "','" + oSub.HProcExchBillNo.ToString() + "'," + oSub.HProcExchInterID.ToString() + "," + oSub.HProcExchEntryID.ToString() |
| | | + ",'" + oSub.HScanDate.ToString() + "','" + oSub.HMouldNumber.ToString() + "') "); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = null; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |