DAL/DAL.csproj
@@ -626,6 +626,7 @@ <Compile Include="ç产管ç\æ¨¡å ·ç®¡ç\ClsSc_MouldStatusChangeBill.cs" /> <Compile Include="ç产管ç\设å¤ç®¡ç\ClsGy_EquipFileMain.cs" /> <Compile Include="ç产管ç\设å¤ç®¡ç\ClsGy_EquipTypeBill.cs" /> <Compile Include="ç产管ç\设å¤ç®¡ç\ClsGy_FixCardBill.cs" /> <Compile Include="ç产管ç\设å¤ç®¡ç\ClsSb_EquipWorkBeforeCheckBill.cs" /> <Compile Include="ç产管ç\设å¤ç®¡ç\ClsSb_EquipStockInCheckBill.cs" /> <Compile Include="ç产管ç\设å¤ç®¡ç\ClsSb_EquipSparepartsBill.cs" /> DAL/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsGy_FixCardBill.cs
New file @@ -0,0 +1,239 @@ using System; using System.Collections.Generic; using System.Text; using System.Data; namespace DAL { public class ClsGy_FixCardBill : DBUtility.ClsXt_BaseBill { public Model.ClsGy_FixCardBillMain omodel = new Model.ClsGy_FixCardBillMain(); public List<Model.ClsGy_FixCardBillSub_Emp> DetailColl = new List<Model.ClsGy_FixCardBillSub_Emp>(); public ClsGy_FixCardBill() { base.MvarItemKeySub = "Gy_FixCardBillSub_Emp"; base.MvarItemKeySub2 = ""; base.MvarItemKeySub3 = ""; base.MvarItemKeySub4 = ""; base.MvarItemKey= "Gy_FixCardBillMain"; base.MvarReportTitle="åºå®èµäº§å¡ç"; base.BillType = "3335"; base.HBillSubType = "3335"; } #region åºå®ä»£ç ~ClsGy_FixCardBill() { DetailColl = null; } #endregion èªå®ä¹æ¹æ³ //ä¿®æ¹åæ® public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) { try { // oCn.BeginTran(); //æ´æ°ä¸»è¡¨ oCn.RunProc("UpDate Gy_FixCardBillMain set " + " HBillNo='" + omodel.HBillNo + "'" + //åºå®èµå¼=============== ",HRemark='" + omodel.HRemark + "'" + ",HUpDater='" + omodel.HMaker + "'" + ",HUpDateDate=getdate()" + //======================================== ",HCardNumber='" + omodel.HCardNumber + "'" + ",HCardName='" + omodel.HCardName + "'" + ",HCardModel ='" + omodel.HCardModel + "'" + ",HMaterID='" + omodel.HMaterID + "'" + ",HUnitID='" + omodel.HUnitID + "'" + ",HCardQty='" + omodel.HCardQty + "'" + ",HCardForm='" + omodel.HCardForm + "'" + ",HCard='" + omodel.HCard + "'" + ",HOutComDate='" + omodel.HOutComDate + "'" + ",HOutComNo='" + omodel.HOutComNo + "'" + ",HBeginUseDate='" + omodel.HBeginUseDate + "'" + ",HCardTypeID='" + omodel.HCardTypeID + "'" + ",HCardStatusID='" + omodel.HCardStatusID + "'" + ",HCardChangeTypeID='" + omodel.HCardChangeTypeID + "'" + ",HBarCode='" + omodel.HBarCode + "'" + ",HWorkArea='" + omodel.HWorkArea + "'" + ",HLogo='" + omodel.HLogo + "'" + ",HSellSupID='" + omodel.HSellSupID + "'" + ",HMakeSupID='" + omodel.HMakeSupID + "'" + ",HOrgID='" + omodel.HOrgID + "'" + ",HOwnerID='" + omodel.HOwnerID + "'" + " where HInterID=" + lngBillKey.ToString()); //å é¤å ³è DeleteRelation(ref sReturn, lngBillKey); //å é¤å表 DeleteBillSub(lngBillKey); //æå ¥å表 omodel.HInterID = lngBillKey; foreach (Model.ClsGy_FixCardBillSub_Emp oSub in DetailColl) { oCn.RunProc("Insert into Gy_FixCardBillSub_Emp " + " (HInterID,HBillNo_bak ,HEntryID,HRemark," + "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," + "HDeptID,HUseEmpID,HRepairEmpID,HCardAddr,HAddress,HSetupDate,HAvgRate,HProjectMoneyID," + "HBeginDate,HEndDate" + ") values(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'" + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + "," + oSub.HDeptID + "," + oSub.HUseEmpID + "," + oSub.HRepairEmpID + ",'" + oSub.HCardAddr + "','" + oSub.HAddress + "','" + oSub.HSetupDate + "'," + oSub.HAvgRate + "," + oSub.HProjectMoneyID + ",'" + oSub.HBeginDate + "','" + oSub.HEndDate + "'" + ") "); } sReturn = "ä¿®æ¹åæ®æåï¼"; oCn.Commit(); return true; } catch (Exception e) { sReturn = e.Message; oCn.RollBack(); throw (e); } } //æ°å¢åæ® public override bool AddBill(ref string sReturn) { try { //å¾å°mainid omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); //è¥MAINDIéå¤åéæ°è·å oCn.BeginTran(); //主表 oCn.RunProc("Insert Into Gy_FixCardBillMain" + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HYear,HPeriod,HRemark,HBillStatus," + "HMainSourceBillType,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo," + "HCardNumber,HCardName,HCardModel,HMaterID,HUnitID,HCardQty,HCardForm,HCard,HOutComDate,HOutComNo,HBeginUseDate," + "HCardTypeID,HCardStatusID,HCardChangeTypeID,HBarCode,HWorkArea,HLogo,HSellSupID,HMakeSupID,HOrgID,HOwnerID" + ") "+ " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()" + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'," + omodel.HBillStatus + ",'" + omodel.HMainSourceBillType + "','" +omodel.HMainSourceInterID + "'," + omodel.HMainSourceEntryID + ",'" + omodel.HMainSourceBillNo + "','" + omodel.HCardNumber + "','" + omodel.HCardName + "','" + omodel.HCardModel + "'," + omodel.HMaterID + "," + omodel.HUnitID + "," + omodel.HCardQty + ",'" + omodel.HCardForm + "','" + omodel.HCard + "','" + omodel.HOutComDate + "','" + omodel.HOutComNo + "','" + omodel.HBeginUseDate + "'," + omodel.HCardTypeID + "," + omodel.HCardStatusID + "," + omodel.HCardChangeTypeID + ",'" + omodel.HBarCode + "','" + omodel.HWorkArea + "','" + omodel.HLogo + "'," + omodel.HSellSupID + "," + omodel.HMakeSupID + "," + omodel.HOrgID + "," + omodel.HOwnerID + ") "); //æå ¥å表 foreach (Model.ClsGy_FixCardBillSub_Emp oSub in DetailColl) { oCn.RunProc("Insert into Gy_FixCardBillSub_Emp " + " (HInterID,HBillNo_bak ,HEntryID,HRemark," + "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," + "HDeptID,HUseEmpID,HRepairEmpID,HCardAddr,HAddress,HSetupDate,HAvgRate,HProjectMoneyID," + "HBeginDate,HEndDate" + ") values(" + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HRemark + "'" + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + "," + oSub.HDeptID + "," + oSub.HUseEmpID + "," + oSub.HRepairEmpID + ",'" + oSub.HCardAddr + "','" + oSub.HAddress + "','" + oSub.HSetupDate + "'," + oSub.HAvgRate + "," + oSub.HProjectMoneyID + ",'" + oSub.HBeginDate + "','" + oSub.HEndDate + "'" + ") "); } sReturn = "æ°å¢åæ®æåï¼"; oCn.Commit(); return true; } catch (Exception e) { sReturn = e.Message; oCn.RollBack(); throw (e); } } //æ¾ç¤ºåæ® public override bool ShowBill(Int64 lngBillKey, ref string sReturn) { try { //æ¥è¯¢ä¸»è¡¨ DataSet Ds ; Ds = oCn.RunProcReturn("Select * from Gy_FixCardBillMain Where HInterID=" + lngBillKey.ToString(), "Gy_FixCardBillMain"); if(Ds.Tables[0].Rows.Count==0) { sReturn = "åæ®æªæ¾å°ï¼"; return false; } //åºå®èµå¼=========================================== omodel.HInterID =DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); omodel.HDate =DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]); omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]); omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]); omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim(); omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim(); omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim(); omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim(); omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim(); omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim(); omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim(); omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim(); omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim(); omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); //======================================================== //== // //å¾ªç¯ DataSet DsSub ; DsSub = oCn.RunProcReturn("Select * from Gy_FixCardBillSub_Emp Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Gy_FixCardBillSub_Emp"); DetailColl.Clear();//æ¸ ç©º for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) { Model.ClsGy_FixCardBillSub_Emp oSub = new Model.ClsGy_FixCardBillSub_Emp(); // åºå®èµå¼=============================================== oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]); oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]); oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim(); oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim(); oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]); oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]); oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]); oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]); oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]); oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim(); //=================================================== DetailColl.Add(oSub); } sReturn = "æ¾ç¤ºåæ®æåï¼"; return true; } catch (Exception e) { sReturn = e.Message; throw (e); } } } } Model/Model.csproj
@@ -300,6 +300,10 @@ <Compile Include="ä¿¡æ¯å¹³å°\ClsOA_MeetNotifyBillSub.cs" /> <Compile Include="ä¿¡æ¯å¹³å°\ClsOA_NewMain.cs" /> <Compile Include="ä¿¡æ¯å¹³å°\ClsOA_NewSub.cs" /> <Compile Include="å¨å ·ç®¡ç\ClsSc_MouldLowerBillMain.cs" /> <Compile Include="å¨å ·ç®¡ç\ClsSc_MouldLowerBillSub.cs" /> <Compile Include="å¨å ·ç®¡ç\ClsSc_MouldUpperBillSub.cs" /> <Compile Include="å¨å ·ç®¡ç\ClsSc_MouldUpperBillMain.cs" /> <Compile Include="åºç¡èµæ\K3åºç¡èµæ\ClsK3_Customer_Model.cs" /> <Compile Include="åºç¡èµæ\K3åºç¡èµæ\ClsK3_Department_Model.cs" /> <Compile Include="åºç¡èµæ\K3åºç¡èµæ\ClsK3_Employee_Model.cs" /> @@ -614,6 +618,8 @@ <Compile Include="ç产管ç\设å¤ç®¡ç\ClsGy_EquipTypeBill.cs" /> <Compile Include="ç产管ç\设å¤ç®¡ç\ClsSb_EquipConkBookBillMain.cs" /> <Compile Include="ç产管ç\设å¤ç®¡ç\ClsSb_EquipConkBookBillSub.cs" /> <Compile Include="ç产管ç\设å¤ç®¡ç\ClsGy_FixCardBillMain.cs" /> <Compile Include="ç产管ç\设å¤ç®¡ç\ClsGy_FixCardBillSub_Emp.cs" /> <Compile Include="ç³»ç»å ¬ç¨\ClsXt_SystemParameter_Model.cs" /> <Compile Include="计å管ç\ClsGy_MaterialTechParamBillSub.cs" /> <Compile Include="计å管ç\ClsGy_MaterialTechParamBillMain.cs" /> Model/Æ÷¾ß¹ÜÀí/ClsSc_MouldLowerBillMain.cs
New file @@ -0,0 +1,16 @@ using System; using System.Collections.Generic; using System.Text; namespace Model { public class ClsSc_MouldLowerBillMain : DBUtility.ClsXt_BaseBillMain { public Int64 HDeptID;// int --é¨é¨ID public Int64 HEmpID;// int --æä½å public Int64 HMangerID;// int --è´è´£äºº public int HOrgID;// int --ç»ç» } } Model/Æ÷¾ß¹ÜÀí/ClsSc_MouldLowerBillSub.cs
New file @@ -0,0 +1,26 @@ using System; using System.Collections.Generic; using System.Text; namespace Model { public class ClsSc_MouldLowerBillSub : DBUtility.ClsXt_BaseBillMain { public Int64 HMouldID; public Int64 HUnitID; public Int64 HQty; public Int64 HSourceID; public Int64 HEquipID; public Int64 HICMOInterID; public Int64 HICMOEntryID; public string HICMOBillNo; public Int64 HProcExchInterID; public Int64 HProcExchEntryID; public string HProcExchBillNo; public string HScanDate; public string HBarCode; public string HMouldNumber; } } Model/Æ÷¾ß¹ÜÀí/ClsSc_MouldUpperBillMain.cs
New file @@ -0,0 +1,16 @@ using System; using System.Collections.Generic; using System.Text; namespace Model { public class ClsSc_MouldUpperBillMain : DBUtility.ClsXt_BaseBillMain { public Int64 HDeptID;// int --é¨é¨ID public Int64 HEmpID;// int --æä½å public Int64 HMangerID;// int --è´è´£äºº public int HOrgID;// int --ç»ç» } } Model/Æ÷¾ß¹ÜÀí/ClsSc_MouldUpperBillSub.cs
New file @@ -0,0 +1,26 @@ using System; using System.Collections.Generic; using System.Text; namespace Model { public class ClsSc_MouldUpperBillSub : DBUtility.ClsXt_BaseBillMain { public Int64 HMouldID; public Int64 HUnitID; public Int64 HQty; public Int64 HSourceID; public Int64 HEquipID; public Int64 HICMOInterID; public Int64 HICMOEntryID; public string HICMOBillNo; public Int64 HProcExchInterID; public Int64 HProcExchEntryID; public string HProcExchBillNo; public string HScanDate; public string HBarCode; public string HMouldNumber; } } Model/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsGy_FixCardBillMain.cs
New file @@ -0,0 +1,32 @@ using System; using System.Collections.Generic; using System.Text; namespace Model { public class ClsGy_FixCardBillMain : DBUtility.ClsXt_BaseBillMain { public string HCardNumber; //å¡çç¼ç public string HCardName; //èµäº§åç§° public string HCardModel; //èµäº§è§æ ¼ public Int64 HMaterID; //对åºç©æ public Int64 HUnitID; //计éåä½ public Int64 HCardQty;//èµäº§æ°é public string HCardForm;//å¡çæ¥æº (æå·¥å»ºå¡) public string HCard;//èµäº§æ§è´¨ ï¼èªæèµäº§ï¼ public DateTime HOutComDate; //åºåæ¥æ public string HOutComNo; //åºåç¼å· public DateTime HBeginUseDate; //å¼å§ä½¿ç¨æ¥æ public Int64 HCardTypeID; //èµäº§ç±»å«(Gy_CardType) public Int64 HCardStatusID; //èµäº§ç¶æï¼Gy_CardStatusï¼ public Int64 HCardChangeTypeID; //å卿¹å¼(Gy_CardChangeType) public string HBarCode; //æ¡å½¢ç public string HWorkArea; //äº§å° public string HLogo;//åç public Int64 HSellSupID; //ä¾åºå(Gy_Supplier) public Int64 HMakeSupID; //å¶é å (Gy_Supplier) public Int64 HOrgID; //èµäº§ç»ç» public Int64 HOwnerID; //货主 } } Model/Éú²ú¹ÜÀí/É豸¹ÜÀí/ClsGy_FixCardBillSub_Emp.cs
New file @@ -0,0 +1,22 @@ using System; using System.Collections.Generic; using System.Text; namespace Model { public class ClsGy_FixCardBillSub_Emp : DBUtility.ClsXt_BaseBillSub { public Int64 HDeptID; //使ç¨é¨é¨ï¼gy_Departme ntï¼ public Int64 HUseEmpID; //使ç¨äººï¼gy_Employeeï¼ public Int64 HRepairEmpID; //ç»´æ¤è´è´£äººï¼gy_Employeeï¼ public Int64 HCardAddr; //èµäº§ä½ç½®ï¼Gy_CardAddressï¼ public string HAddress; //æ¾ç½®å°ç¹ public DateTime HSetupDate; //å®è£ æ¥æ public decimal HAvgRate;// åé æ¯ä¾ public Int64 HProjectMoneyID; //è´¹ç¨é¡¹ç®ï¼Gy_ProjectMoneyï¼ public DateTime HBeginDate; //å¼å§æ¥æ public DateTime HEndDate; //ç»ææ¥æ } } WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs
New file @@ -0,0 +1,1231 @@ 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 } } WebAPI/Controllers/SBGL/Gy_FixCardBillController.cs
New file @@ -0,0 +1,542 @@ using DBUtility; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using WebAPI.Models; namespace WebAPI.Controllers.SBGL { public class Gy_FixCardBillController : ApiController { //è·åç³»ç»åæ° Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); public DBUtility.ClsPub.Enum_BillStatus BillStatus; private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; public DAL.ClsGy_FixCardBill BillOld = new DAL.ClsGy_FixCardBill(); #region åºå®èµäº§å¡çå表æ¥è¯¢ [Route("Gy_FixCardBill/list")] [HttpGet] public object list(string sWhere, string user) { try { List<object> columnNameList = new List<object>(); //ç¼è¾æé if (!DBUtility.ClsPub.Security_Log_second("Gy_FixCardBill_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ æ¥çæéï¼"; objJsonResult.data = null; return objJsonResult; } string sql1 = string.Format(@"select * from h_v_Gy_FixCardBillList where 1 = 1"); if (sWhere == null || sWhere.Equals("")) { ds = oCN.RunProcReturn(sql1 + sWhere , "h_v_Gy_FixCardBillList"); } else { string sql = sql1 + sWhere; ds = oCN.RunProcReturn(sql, "h_v_Gy_FixCardBillList"); } //æ·»å åå 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("Gy_FixCardBill/SaveFixCardBillList")] [HttpPost] public object SaveFixCardBillList([FromBody] JObject msg) { var _value = msg["msg"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string msg2 = sArray[0].ToString(); //è¡¨å¤´ä¿¡æ¯ string msg3 = sArray[1].ToString(); //表ä½ä¿¡æ¯ string msg4 = sArray[2].ToString(); //ç¨æ· string OperationType = sArray[3].ToString(); //æä½ç±»å string UserName = ""; ListModels oListModels = new ListModels(); try { if (!DBUtility.ClsPub.Security_Log("Gy_FixCardBill_Edit", 1, false, msg4)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ ä¿åæéï¼"; objJsonResult.data = null; return objJsonResult; } DAL.ClsGy_FixCardBill oBill = new DAL.ClsGy_FixCardBill(); List<Model.ClsGy_FixCardBillMain> lsmain = new List<Model.ClsGy_FixCardBillMain>(); msg2 = msg2.Replace("\\", ""); msg2 = msg2.Replace("\n", ""); //\n lsmain = oListModels.getObjectByJson_Gy_FixCardBillMain(msg2); foreach (Model.ClsGy_FixCardBillMain oItem in lsmain) { //oItem.HMaker = ""; UserName = oItem.HMaker; //å¶å人 oItem.HBillType = "3335"; oItem.HBillSubType = "3335"; oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --æ¥æ oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); oItem.HBillStatus = 1; if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "ä¿åå¤±è´¥ï¼æ²¡æåæ®æ¥æï¼æ æ³ä¿åï¼"; objJsonResult.data = 1; return objJsonResult; } oBill.omodel = oItem; } //è¡¨ä½æ°æ® //æ },{æ¥æåæ°ç» //廿ãåã msg3 = msg3.Substring(1, msg3.Length - 2); msg3 = msg3.Replace("\\", ""); msg3 = msg3.Replace("\n", ""); //\n //msg2 = msg2.Replace("'", "â"); List<Model.ClsGy_FixCardBillSub_Emp> ls = new List<Model.ClsGy_FixCardBillSub_Emp>(); ls = oListModels.getObjectByJson_Gy_FixCardBillSub_Emp(msg3); int i = 0; foreach (Model.ClsGy_FixCardBillSub_Emp oItemSub in ls) { i++; oItemSub.HEntryID = i; oBill.DetailColl.Add(oItemSub); } //ä¿å //ä¿å宿¯åå¤ç bool bResult; if (OperationType == "1") { bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "ä¿åæåï¼"; objJsonResult.data = 1; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "ä¿å失败ï¼" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = 1; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "ä¿å失败ï¼" + e.ToString(); objJsonResult.data = 1; return objJsonResult; } } #endregion //#region åºå®èµäº§å¡ç å é¤ [Route("Gy_FixCardBill/DelFixCardBill")] [HttpGet] public object DelFixCardBill(string HInterID, string user) { Int64 lngBillKey = 0; lngBillKey = DBUtility.ClsPub.isLong(HInterID); if (lngBillKey == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "åæ®ID为空ï¼"; objJsonResult.data = null; return objJsonResult; } DAL.ClsGy_FixCardBill oBill = new DAL.ClsGy_FixCardBill(); if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) { ds = oCN.RunProcReturn("select * from Gy_FixCardBillMain where HInterID=" + lngBillKey, "Gy_FixCardBillMain"); if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "åæ®å½åå¤äºä¸è½å é¤ç¶æ,ä¸è½å é¤ï¼"; objJsonResult.data = null; return objJsonResult; } if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "忮已ç»å®¡æ ¸,ä¸è½å é¤ï¼"; objJsonResult.data = null; return objJsonResult; } //å é¤åæ§å¶========================================= string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); string sql1 = "exec h_p_Gy_FixCardBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'"; ds = oCN.RunProcReturn(sql1, "h_p_Gy_FixCardBill_BeforeDelCtrl"); 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; } if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "å é¤å¤±è´¥!åå :" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; objJsonResult.data = null; return objJsonResult; } //================================================================================== bool IsDete = oBill.DeleteBill(lngBillKey, HBillNo, "h_p_Gy_FixCardBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "åæ®æªæ¾å°"; objJsonResult.data = null; return objJsonResult; } } //#endregion #region åºå®èµäº§å¡ç å®¡æ ¸/åå®¡æ ¸åè½ [Route("Gy_FixCardBill/CheckGy_FixCardBill")] [HttpGet] public object CheckGy_FixCardBill(string HInterID, int Type, string user) { try { //夿æ¯å¦æå 餿é if (!DBUtility.ClsPub.Security_Log("Gy_FixCardBill_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 = "Gy_FixCardBillMain"; 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; } } //å®¡æ ¸åæ§å¶ string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); sql = "exec h_p_Gy_FixCardBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'"; ds = oCN.RunProcReturn(sql, "h_p_Gy_FixCardBill_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 (!BillOld.CheckBill(Int64.Parse(HInterID), HBillNo, "h_p_Gy_FixCardBill_AfterCheckCtrl", user, 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; } } //åå®¡æ ¸åæ§å¶ string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); sql = "exec h_p_Gy_FixCardBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'"; ds = oCN.RunProcReturn(sql, "h_p_Gy_FixCardBill_BeforeUnCheckCtrl"); 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 (BillOld.AbandonCheck(Int64.Parse(HInterID), HBillNo, "h_p_Gy_FixCardBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) { } else { 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("Gy_FixCardBill/CloseGy_FixCardBill")] [HttpGet] public object CloseGy_FixCardBill(string HInterID, int Type, string user) { try { //夿æ¯å¦æå 餿é if (!DBUtility.ClsPub.Security_Log("Gy_FixCardBill_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 = "Gy_FixCardBillMain"; 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]["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]["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 } } WebAPI/Controllers/XSGL/Xs_OutDoorCheckBillController.cs
@@ -590,7 +590,45 @@ #endregion //---------------------------------------------------------------PDA模åè°ç¨ #region åºé¨ç¡®è®¤åå表 /// <summary> /// è·ååºé¨ç¡®è®¤ååè¡¨ä¿¡æ¯ /// </summary> /// <returns></returns> [Route("Xs_OutDoorCheckBillController/GetXs_OutDoorCheckBillList_PDA_Json")] [HttpGet] public object GetXs_OutDoorCheckBillList_PDA_Json(string sWhere) { try { //è¿ååè¡¨ä¿¡æ¯ ds = oCn.RunProcReturn("exec h_p_Xs_OutDoorCheckBillList_PDA '" + sWhere + "'", "h_p_Xs_OutDoorCheckBillList_PDA"); 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 = "0"; objJsonResult.count = 1; objJsonResult.Message = "æåï¼"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ¥è¯¢å表信æ¯å¤±è´¥ï¼" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion } } WebAPI/DLL/ClsSc_ICMOReportBill.cs
@@ -105,8 +105,8 @@ //ååäº§éæ±æ¥åï¼è´¨éæ±æ¥åå ³èåæ®µ,ç产订åå ³èæ°é Ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_ReverseWriteQty " + omodel.HInterID + "," + oSub.HEntryID + ",'" + omodel.HBillNo + "'," + DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + "," + DetailColl[0].HICMOBillNo + ",'" + DetailColl[0].HSourceID + "','" + "Edit" + "'," + HBackQty DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + ",'" + DetailColl[0].HICMOBillNo + "','" + DetailColl[0].HSourceID + "','" + "Edit" + "'," + HBackQty + "," + DetailColl[0].HICMOTempID , "h_p_Sc_ICMOReportBill_ReverseWriteQty"); if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBack"]) == "1") { @@ -262,7 +262,7 @@ //ååäº§éæ±æ¥åï¼è´¨éæ±æ¥åå ³èåæ®µ,ç产订åå ³èæ°é ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_ReverseWriteQty " + omodel.HInterID + "," + oSub.HEntryID + ",'" + omodel.HBillNo + "'," + DetailColl[0].HICMOInterID + "," + DetailColl[0].HICMOEntryID + ",'" + DetailColl[0].HICMOBillNo + "','" + DetailColl[0].HSourceID + "','" + "Add" + "'," + 0+","+ DetailColl[0].HICMOTempID "Add" + "'," + 0 + "," + DetailColl[0].HICMOTempID , "h_p_Sc_ICMOReportBill_ReverseWriteQty"); if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "1") { WebAPI/ListModels.cs
@@ -3201,6 +3201,31 @@ return list; } /// <summary> /// åºå®èµäº§å¡ç 主表 /// </summary> /// <param name="jsonString"></param> /// <returns></returns> // ClsGy_FixCardBillMain public List<Model.ClsGy_FixCardBillMain> getObjectByJson_Gy_FixCardBillMain(string jsonString) { jsonString = "[" + jsonString.ToString() + "]"; List<Model.ClsGy_FixCardBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_FixCardBillMain>>(jsonString); return list; } /// <summary> /// åºå®èµäº§å¡ç å表 /// </summary> /// <param name="jsonString"></param> /// <returns></returns> // ClsGy_FixCardBillSub_Emp public List<Model.ClsGy_FixCardBillSub_Emp> getObjectByJson_Gy_FixCardBillSub_Emp(string jsonString) { jsonString = "[" + jsonString.ToString() + "]"; List<Model.ClsGy_FixCardBillSub_Emp> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_FixCardBillSub_Emp>>(jsonString); return list; } #region 客è¯å¤çå /// <summary> /// 客è¯å¤çå主表json WebAPI/WebAPI.csproj
@@ -415,7 +415,9 @@ <Compile Include="Controllers\MJGL\Sc_MouldLifeUseBillController.cs" /> <Compile Include="Controllers\MJGL\Sc_MouldScrapRequestBillController.cs" /> <Compile Include="Controllers\MJGL\Sc_MouldStatusChangeBillController.cs" /> <Compile Include="Controllers\MJGL\Sc_MouldUpperBillController.cs" /> <Compile Include="Controllers\Pay_ReportController.cs" /> <Compile Include="Controllers\SBGL\Gy_FixCardBillController.cs" /> <Compile Include="Controllers\SBGL\Sb_EquipConkBookBillController.cs" /> <Compile Include="Controllers\SBGL\Sb_EquipSparepartsBillController.cs" /> <Compile Include="Controllers\SBGL\Sb_EquipSparepartsChangeBillController.cs" /> @@ -1079,6 +1081,7 @@ <Folder Include="Views\Sc_MouldRepairSendWorkBill\" /> <Folder Include="Views\Sc_MouldScrapRequestBill\" /> <Folder Include="Views\Sc_MouldStatusChangeBill\" /> <Folder Include="Views\Sc_MouldUpperBill\" /> <Folder Include="Views\Sc_ProcessExchangeIssueBill\" /> <Folder Include="Views\Sc_ProcessSendWork\" /> <Folder Include="Views\Sc_ProcExchRecordBackBill\" />