WebAPI/Config/kdapi.config | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/SCGL/日计划管理/Sc_WorkDemandPlanBillController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/Sc_ProcessMangementController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/博日自动扫码线/ScanlineAPIController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/生产管理/报工台工序/Sc_MESBeginStepWorkBillController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/InvokeHelper.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Utility/Util.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/WebAPI.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
WebAPI/Config/kdapi.config
New file @@ -0,0 +1,9 @@ <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="DbId" value="5f9258a311401c"></add> <add key="UserName" value="Administrator"></add> <add key="PassWord" value="qaz!@#123"></add> <add key="KDApiUrl" value="http://localhost/K3Cloud/"></add> </appSettings> </configuration> WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -1149,5 +1149,7 @@ } #endregion } } WebAPI/Controllers/SCGL/Èռƻ®¹ÜÀí/Sc_WorkDemandPlanBillController.cs
@@ -1,4 +1,5 @@ using Newtonsoft.Json.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; @@ -91,7 +92,7 @@ string user = sArray[3].ToString(); try { if (!DBUtility.ClsPub.Security_Log("Cg_PODemandPlanBill_Edit", 1, false, user)) if (!DBUtility.ClsPub.Security_Log("Sc_WorkDemandPlanBill_Edit", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -318,6 +319,52 @@ } } #endregion #region è¦æè®¡åå è¦æè®¡åæ¥è¡¨ public class ReportWorkDemandPlanBill { public int? HORGID; public DateTime HBEGINDATE; public DateTime HENDDATE; public int? HMATERIALID; public int? HDeptID; } [Route("Sc_WorkDemandPlanBill/ReportWorkDemandPlanBillList")] [HttpGet] public object ReportWorkDemandPlanBillList(string sWhere, string user) { try { //æ¥çæé if (!DBUtility.ClsPub.Security_Log("Sc_WorkDemandPlanBill_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ æ¥çæéï¼"; objJsonResult.data = null; return objJsonResult; } ReportWorkDemandPlanBill Report = JsonConvert.DeserializeObject<ReportWorkDemandPlanBill>(sWhere); ds = oCN.RunProcReturn($"exec h_p_JIT_Sc_WorkDemandPlanBill_ReportList {Report.HORGID},'{Report.HBEGINDATE}','{Report.HENDDATE}',{Report.HMATERIALID},{Report.HDeptID} ", "h_p_JIT_Sc_WorkDemandPlanBill_ReportList"); 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 } } WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -1,4 +1,5 @@ using Newtonsoft.Json.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Pub_Class; using System; using System.Collections; @@ -97,6 +98,199 @@ return objJsonResult; } #region å·¥åºæ±æ¥å ¥åº /// <summary> /// è·åå·¥åºæ±æ¥å ¥åºåå表 /// </summary> /// <param name="sWhere"></param> /// <param name="user"></param> /// <returns></returns> [Route("Sc_ProcessMangement/Get_ProcessReportOverList")] [HttpGet] public object Get_ProcessReportOverList(string sWhere, string user) { try { //夿æ¯å¦ææ¥è¯¢æé if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æ æ¥è¯¢æé!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc order by hmainid desc", "h_v_MES_StationOutBillList_LastProc"); } else { string sql1 = "select * from h_v_MES_StationOutBillList_LastProc where 1 = 1 "; string sql = sql1 + sWhere + " order by hmainid desc"; ds = oCN.RunProcReturn(sql, "h_v_MES_StationOutBillList_LastProc"); } 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; } } /// <summary> /// å ¥åºââçäº§æ±æ¥å /// </summary> /// <param name="InterID">å·¥åºæ±æ¥å主ID</param> /// <returns></returns> [Route("Sc_ProcessMangement/SaveICMOReportBill")] [HttpGet] public object SaveICMOReportBill(string InterID, string user, string BillNo, string OrganizationID) { try { //è·åçäº§æ±æ¥åæå¤§InterIDååæ®å· Int64 HInterID = DBUtility.ClsPub.CreateBillID("3711", ref DBUtility.ClsPub.sExeReturnInfo); string HBillNo = DBUtility.ClsPub.CreateBillCode("3711", ref DBUtility.ClsPub.sExeReturnInfo, true); //è·åç»ç»ä»£ç string OrganizationNUM = oCN.RunProcReturn("select HNumber from Xt_ORGANIZATIONS where HItemID=" + OrganizationID, "Xt_ORGANIZATIONS").Tables[0].Rows[0]["HNumber"].ToString(); //æ ¹æ®å·¥åºæ±æ¥å主IDè·åå·¥åºæ±æ¥å ¥åºåçæ°æ® DataSet ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_LastProc where HInterID=" + InterID, "h_v_MES_StationOutBillList_LastProc"); DataRow dr = ds.Tables[0].Rows[0]; //ä¿å oCN.BeginTran(); //çäº§æ±æ¥å主表 oCN.RunProc("Insert Into Sc_ICMOReportBillMain " + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HBillStatus,HChecker,HCheckDate" + ",HYear,HPeriod,HRemark,HEmpID,HEmpNumber" + ",HGroupID,HDeptID,HDeptNumber" + ",HMainSourceBillNo,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillType" + ") " + " values('3711','3711'," + HInterID.ToString() + ",'" + HBillNo + "',getdate(),'" + user + "',getdate(),2,'" + user + "',getdate()" + ",DATENAME(YEAR,GETDATE()),0,'','" + dr["HEmpID"].ToString() + "','" + dr["æä½å代ç "].ToString() + "','" + dr["HGroupID"].ToString() + "',0,''" + ",'" + BillNo.ToString() + "'," + InterID.ToString() + ", 0,'3791'" + ") "); //çäº§æ±æ¥åå表 oCN.RunProc("Insert into Sc_ICMOReportBillSub " + " (HInterID,HEntryID,HMaterID,HMaterNumber" + ",HQty,HUnitID,HUnitNumber,HTimes,HSourceID" + ",HQtyMust,HWorkerID,HWorkerNumber,HBadCount,HWasterQty," + "HCloseMan,HCloseType,HRemark," + "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + ",HICMOInterID,HICMOBillNo,HBarCode" + ") values(" + HInterID.ToString() + ",1," + dr["HMaterID"].ToString() + ",'" + dr["产å代ç "].ToString() + "'" + "," + dr["åæ ¼æ°é"].ToString() + ",0,'',0,0" + "," + dr["æ¥æ¶æ°é"].ToString() + "," + dr["HEmpID"].ToString() + ",'" + dr["æä½å代ç "].ToString() + "'," + dr["ä¸è¯æ°é"].ToString() + "," + dr["æ¥åºæ°é"].ToString() + ",'',0,''" + "," + InterID.ToString() + ",0,'" + BillNo.ToString() + "','3791',0,0" + ",0,0,''" + "," + dr["HICMOInterID"].ToString() + ",'" + dr["ä»»å¡å"].ToString() + "',''" + ") "); //忥éè¶ //访é®éè¶ var loginRet = InvokeHelper.Login(); var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); if (isSuccess == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "æä½å¤±è´¥,éè¶è´¦å·ç»å½å¼å¸¸ã" + loginRet; objJsonResult.data = null; return objJsonResult; } //æ ¹æ®ä»»å¡åæ¥æ¾å°éè¶çç产订å DataSet ds1 = oCN.RunProcReturn("select * from h_v_TOERP_StationOutBillList_LastProc where HICMOInterID=" + dr["HICMOInterID"].ToString(), "h_v_TOERP_StationOutBillList_LastProc"); DataRow dr1 = ds1.Tables[0].Rows[0]; JObject model = new JObject(); model.Add("FBillType", "50fa7c2eda7947b89fab5431bf25d48e"); //åæ®ç±»å1 model.Add("FPrdOrgId", new JObject() { ["Fnumber"] = dr1["FPrdOrgNUMBER"].ToString() }); //ç产ç»ç»1 model.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); //åæ®æ¥æ1 JArray Fentity = new JArray(); foreach (DataRow item in ds.Tables[0].Rows) { JObject FentityModel = new JObject(); FentityModel.Add("FReportType", "BD_OwnerOrg");//çäº§æ±æ¥ç±»å FentityModel.Add("FTimeUnitId", "1");//æ¶é´åä½ FentityModel.Add("FWorkshipId", new JObject() { ["Fnumber"] = dr1["FWorkShopNUM"].ToString() }); // çäº§è½¦é´ FentityModel.Add("FStandHourUnitId", "3600"); // å使 åå·¥æ¶åä½ FentityModel.Add("FMaterialId", new JObject() { ["Fnumber"] = dr1["FMaterialNUM"].ToString() }); // ç©æç¼ç FentityModel.Add("FMoEntrySeq", dr1["HICMOEntryID"].ToString());//ç产订åè¡å· FentityModel.Add("FMoId", dr1["HICMOInterID"].ToString());//ç产订åå ç FentityModel.Add("FFinishQty", item["æ¥æ¶æ°é"].ToString());//宿æ°é1 FentityModel.Add("FQuaQty", item["åæ ¼æ°é"].ToString());//åæ ¼æ°é1 FentityModel.Add("FStockInOrgId ", OrganizationNUM);// å ¥åºç»ç» FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = dr1["FStockNUM"].ToString() }); // ä»åº FentityModel.Add("FSrcBillType", "PRD_MO");// æºåç±»å FentityModel.Add("FSrcBillNo", item["ä»»å¡å"].ToString());// æºåç¼å· FentityModel.Add("FSrcInterId", dr1["HICMOInterID"].ToString());// æºåå ç FentityModel.Add("FSrcEntryId", dr1["HICMOEntryID"].ToString());// æºååå½å ç //JArray Fentity2 = new JArray(); //JObject FentityModel2 = new JObject(); //FentityModel2.Add("FDetailEntity_Link_FRULEID", "PUR_PurchaseOrder-PUR_ReceiveBill"); //FentityModel2.Add("FDetailEntity_Link_FSTableName", "t_PUR_POOrderEntry"); //FentityModel2.Add("FDetailEntity_Link_FSBillId", item["FID"].ToString()); //FentityModel2.Add("FDetailEntity_Link_FSId", item["FEntryID"].ToString()); //Fentity2.Add(FentityModel2); //FentityModel.Add("FDetailEntity_Link", Fentity2); //Fentity.Add(FentityModel); } model.Add("FDetailEntity", Fentity); //æç»ä¿¡æ¯ JObject jsonRoot = new JObject() { ["Creator"] = "", ["NeedUpDateFields"] = new JArray(), ["NeedReturnFields"] = new JArray(), ["IsDeleteEntry"] = "false", ["SubSystemId"] = "", ["IsVerifyBaseDataField"] = "false", //["IsAutoSubmitAndAudit"] = true,//èªå¨è°ç¨æäº¤åå®¡æ ¸åè½ ["Model"] = model }; string result = InvokeHelper.Submit("PRD_MORPT", JsonConvert.SerializeObject(jsonRoot)); //å¤æå®¡æ ¸æ¯å¦æå if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = $"å·¥åºæ±æ¥å ¥åºå忥éè¶äºå¤±è´¥ï¼åå·:{dr["åæ®å·"].ToString()}" + result; objJsonResult.data = null; return objJsonResult; } oCN.Commit(); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "ä¿åæåï¼"; objJsonResult.data = 1; return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exceptionï¼" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion /// <summary> /// è¿åçäº§æ±æ¥åå表 ///åæ°ï¼string sqlã WebAPI/Controllers/²©ÈÕ×Ô¶¯É¨ÂëÏß/ScanlineAPIController.cs
@@ -108,9 +108,9 @@ bool IsBarCodePack = oBill.IsBarCodePack(list.packagebarcode); if (IsBarCodePack == false) { LogService.Write("ç®±ç å·²åå¨,ä¸è½éå¤ç»å®ï¼"); LogService.Write($"ç®±ç :{list.packagebarcode}å·²åå¨,ä¸è½éå¤ç»å®ï¼"); objJsonResult.status = -1; objJsonResult.msg = "ç®±ç å·²åå¨,ä¸è½éå¤ç»å®ï¼"; objJsonResult.msg = $"ç®±ç :{list.packagebarcode}å·²åå¨,ä¸è½éå¤ç»å®ï¼"; objJsonResult.data = null; return objJsonResult; } @@ -159,12 +159,13 @@ for (int i = 0; i < list.barcodes.Count; i++) { //夿æ¡ç æ¯å¦åå¨ bool IsBarCode = oBill.IsBarCodePack(list.barcodes[i].barcode); bool IsBarCode = oBill.IsBarCode(list.barcodes[i].barcode); if (IsBarCodePack == false) { LogService.Write("æ¡ç å·²åå¨,ä¸è½éå¤ç»å®ï¼"); DataTable dt = oCN.RunProcReturn("Select HBarCode_Pack from Sc_PackUnionBillSub Where HBarCode='" + list.barcodes[i].barcode + "'", "Sc_PackUnionBillSub").Tables[0]; LogService.Write($"æ¡ç ï¼{list.barcodes[i].barcode}ï¼å·²åå¨ç®±ç ï¼{dt.Rows[0]["HBarCode_Pack"]}ä¸ï¼æ¬æ¬¡ç»å®ç®±ç 为ï¼{list.packagebarcode},ç»å®å¤±è´¥,ä¸è½éå¤ç»å®ï¼"); objJsonResult.status = -1; objJsonResult.msg = "æ¡ç å·²åå¨,ä¸è½éå¤ç»å®ï¼"; objJsonResult.msg = $"æ¡ç ï¼{list.barcodes[i].barcode}ï¼å·²åå¨ç®±ç ï¼{dt.Rows[0]["HBarCode_Pack"]}ä¸ï¼æ¬æ¬¡ç»å®ç®±ç 为ï¼{list.packagebarcode},ç»å®å¤±è´¥,ä¸è½éå¤ç»å®ï¼"; objJsonResult.data = null; return objJsonResult; } WebAPI/Controllers/Éú²ú¹ÜÀí/±¨¹¤Ì¨¹¤Ðò/Sc_MESBeginStepWorkBillController.cs
@@ -1626,8 +1626,8 @@ string result1 = string.Empty; string result2 = string.Empty; //夿å½åç¨çäº§ææ¸ ååç¶æââå·²å建åå æäº¤åå®¡æ ¸ã以æäº¤ååªå®¡æ ¸ if (Ds.Tables[0].Rows[0][2].ToString() == "A") //夿å½åç¨çäº§ææ¸ ååç¶æââå·²å建åå æäº¤åå®¡æ ¸ã以æäº¤ååªå®¡æ ¸--A:å建ï¼B:æäº¤,C:å®¡æ ¸,D:éæ°å®¡æ ¸ if (Ds.Tables[0].Rows[0][2].ToString() == "A"|| Ds.Tables[0].Rows[0][2].ToString() == "D") { result1 = InvokeHelper.Submit("PRD_PPBOM", JsonConvert.SerializeObject(json)); result2 = InvokeHelper.Audit("PRD_PPBOM", JsonConvert.SerializeObject(json)); @@ -1636,6 +1636,7 @@ { result2 = InvokeHelper.Audit("PRD_PPBOM", JsonConvert.SerializeObject(json)); } LogService.Write("result2=" + result2); //å¤æå®¡æ ¸æ¯å¦æå if (JObject.Parse(result2)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") { WebAPI/InvokeHelper.cs
@@ -4,29 +4,28 @@ using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using WebAPI.Utility; namespace WebAPI { public static class InvokeHelper { //private static string CloudUrl = "http://localhost/k3cloud/";//K/3 Cloud ä¸å¡ç«ç¹å°å //private static string CloudUrl = "http://60.190.4.42:9002/k3cloud/";//K/3 Cloud ä¸å¡ç«ç¹å°å private static string CloudUrl = "http://47.96.97.237/k3cloud/";//K/3 Cloud ä¸å¡ç«ç¹å°å //private static string CloudUrl = "http://60.190.4.42:9002/K3CLOUD/";//å¤å® //private static string CloudUrl = "http://124.70.129.242/k3cloud/";//é çªè¯º private static string CloudUrl = Util.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "/Config/kdapi.config", "KDApiUrl");//K/3 Cloud ä¸å¡ç«ç¹å°å /// <summary> /// ç»é /// </summary> public static string Login() { var dbId = Util.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "/Config/kdapi.config", "DbId"); var useName = Util.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "/Config/kdapi.config", "UserName"); var pwd = Util.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "/Config/kdapi.config", "PassWord"); HttpClient httpClient = new HttpClient(); httpClient.Url = string.Concat(CloudUrl, "Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc"); List<object> Parameters = new List<object>(); Parameters.Add("6204a70eba35fc");//è´¦å¥æ 示 Parameters.Add("Administrator");//ç¨æ·å Parameters.Add("qaz!@#123");//å¯ç Parameters.Add(dbId);//è´¦å¥æ 示 Parameters.Add(useName);//ç¨æ·å Parameters.Add(pwd);//å¯ç Parameters.Add(2052);//2052ä»£è¡¨ä¸æ httpClient.Content = JsonConvert.SerializeObject(Parameters); WebAPI/Utility/Util.cs
New file @@ -0,0 +1,124 @@ using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Serialization; namespace WebAPI.Utility { public class Util { public static string GetObjectType(object obj) { var isType = false; isType = obj.GetType() == typeof(string); if (isType) { return "string"; } isType = obj.GetType() == typeof(double); if (isType) { return "double"; } isType = obj.GetType() == typeof(long); if (isType) { return "long"; } isType = obj.GetType() == typeof(DateTime); if (isType) { return "date"; } isType = obj.GetType() == typeof(int); if (isType) { return "int"; } isType = obj.GetType() == typeof(decimal); if (isType) { return "decimal"; } return "string"; } public static JObject JsonVerify(string json) { if (string.IsNullOrEmpty(json)) { throw new Exception("åæ°ä¸è½ä¸ºç©º"); } try { return JObject.Parse(json.ToString().Replace("\r", "").Replace("\n", "").Replace("\t", "")); } catch (Exception) { throw; } } //public static T DeepCopy<T>(T obj) //{ // object retval; // using (MemoryStream ms = new MemoryStream()) // { // XmlSerializer xml = new XmlSerializer(typeof(T)); // xml.Serialize(ms, obj); // ms.Seek(0, SeekOrigin.Begin); // retval = xml.Deserialize(ms); // ms.Close(); // } // return (T)retval; //} public static String GetConfigKey(String configPath, String key) { Configuration ConfigurationInstance = ConfigurationManager.OpenMappedExeConfiguration(new ExeConfigurationFileMap() { ExeConfigFilename = configPath }, ConfigurationUserLevel.None); if (ConfigurationInstance.AppSettings.Settings[key] != null) return ConfigurationInstance.AppSettings.Settings[key].Value; else return string.Empty; } public static bool SetConfigKey(String configPath, String key, String vls) { try { Configuration ConfigurationInstance = ConfigurationManager.OpenMappedExeConfiguration(new ExeConfigurationFileMap() { ExeConfigFilename = configPath }, ConfigurationUserLevel.None); if (ConfigurationInstance.AppSettings.Settings[key] != null) ConfigurationInstance.AppSettings.Settings[key].Value = vls; else ConfigurationInstance.AppSettings.Settings.Add(key, vls); ConfigurationInstance.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection("appSettings"); return true; } catch { return false; } } } } WebAPI/WebAPI.csproj
@@ -233,6 +233,7 @@ <Content Include="Index.html" /> <Content Include="Views\Scripts\bootstrap.js" /> <Content Include="Views\Scripts\bootstrap.min.js" /> <Content Include="Config\kdapi.config" /> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> @@ -752,6 +753,7 @@ <Compile Include="Service\ProcessDal.cs" /> <Compile Include="Service\YqnDal.cs" /> <Compile Include="Service\YqnQbService.cs" /> <Compile Include="Utility\Util.cs" /> <Compile Include="Web References\WebS\Reference.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime>