From 7fa21cf063b662834a5bb641939510ee3a61b144 Mon Sep 17 00:00:00 2001 From: ch <37327@LLOOCCY> Date: 星期五, 02 七月 2021 08:50:20 +0800 Subject: [PATCH] nothing --- WebAPI/Properties/PublishProfiles/JFAPI.pubxml.user | 14 WebAPI/DLL/ClsSb_EquipDotCheckBill.cs | 274 WebAPI/Models/ClsSb_EquipRepairWorkBillMain.cs | 28 WebAPI/WebAPI.csproj.user | 6 WebAPI/Models/ClsSb_EquipDotCheckBillMain.cs | 18 WebAPI/Controllers/SBGL/Sb_EquipDotCheckBillController.cs | 512 + WebAPI/Models/ClsSb_EquipMaintainBillMain.cs | 18 WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs | 324 WebAPI/Models/CheckItem.cs | 30 WebAPI/DLL/ClsSc_MESBeginWorkBill.cs | 452 + WebAPI/Controllers/Sc_GroupOrderBillController.cs | 79 WebAPI/Controllers/MJJY/Mj_PDA_MoudlCheckController.cs | 397 WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs | 266 WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs | 276 WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs | 4 WebAPI/Models/ClsSc_MouldStockBillSub.cs | 53 WebAPI/DLL/ClsSb_EquipRepairCheckBill.cs | 219 WebAPI/Properties/PublishProfiles/FolderProfile.pubxml | 7 WebAPI/Models/基础资料/Warehouse.cs | 33 WebAPI/Controllers/Sc_MouldController.cs | 559 + WebAPI/Models/ClsSc_MouldMaintainBillSub.cs | 23 WebAPI/Controllers/BaseSet/Gy_WorkCenterController.cs | 333 WebAPI/Controllers/SBGL/Sb_EquipDotCheckPlanBillController.cs | 323 WebAPI/Models/ClsSc_MouldDotCheckBillMain.cs | 18 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs | 486 + WebAPI/Models/ClsSc_MouldDotCheckBillSub.cs | 16 WebAPI/DLL/ClsSc_MESStopWorkBill.cs | 456 + WebAPI/Models/ClsSc_MouldMaintainBillMain.cs | 19 WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs | 303 WebAPI/Controllers/WebAPIController.cs | 798 + WebAPI/DLL/ClsGy_BadReason_Ctl.cs | 102 WebAPI/DLL/DAL.dll | 0 WebAPI/DLL/ClsSc_MouldLifeChangeBill.cs | 262 WebAPI/DLL/Model.zip | 0 WebAPI/Models/MaintenanceAcceptItem.cs | 26 WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs | 230 WebAPI/Controllers/MJGL/Sc_MouldOtherOutBillController.cs | 325 WebAPI/Models/Gy_Group.cs | 27 WebAPI/ListModels.cs | 726 + WebAPI/Controllers/BaseSet/Gy_MaintenanceModeController.cs | 476 + WebAPI/Controllers/Sc_CheckToolsRepairWorkBillController.cs | 3820 ++++++++ WebAPI/DLL/ClsSc_MESEndWorkBill.cs | 519 + WebAPI/Controllers/SCGL/Sc_QualityReportBillController.cs | 506 + WebAPI/WebAPI.csproj | 64 WebAPI/DLL/调用工程文件/Model.dll | 0 WebAPI/Models/ClsSb_EquipDotCheckBillSub.cs | 30 WebAPI/Controllers/BaseSet/Gy_MaintenanceItemController.cs | 437 + WebAPI/Models/StationBill.cs | 5 WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user | 326 WebAPI/Models/ClsSb_EquipRepairWorkBillSub.cs | 20 WebAPI/Models/MaintenanceMode.cs | 26 WebAPI/DLL/DAL20210625.zip | 0 WebAPI/Controllers/BaseSet/Gy_StockPlaceController.cs | 2 WebAPI/Service/LuBaoSevice.cs | 102 WebAPI/Controllers/BaseSet/Gy_SourceController.cs | 281 WebAPI/DLL/ClsSc_MouldRepairCheckBill.cs | 296 WebAPI/DLL/ClsSc_MouldDotCheckBill.cs | 295 WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs | 1203 ++ WebAPI/DLL/ClsSc_MouldScrapOutBill.cs | 419 WebAPI/Controllers/SCGL/Sc_MESStopWorkBillController.cs | 262 WebAPI/Models/ClsSb_EquipMaintainBillSub.cs | 35 WebAPI/Web.config | 3 WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs | 323 WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs | 211 WebAPI/DLL/ClsSb_EquipConkBookBill.cs | 219 WebAPI/Controllers/BaseSet/Gy_CurrencyController.cs | 282 WebAPI/DLL/ClsSc_MouldMaintainBill.cs | 324 WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs | 75 WebAPI/Controllers/BaseSet/Gy_UnitController.cs | 282 WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs | 513 + WebAPI/Controllers/BaseSet/Gy_GroupController.cs | 354 WebAPI/DLL/ClsSb_EquipMaintainBill.cs | 287 WebAPI/Controllers/CJGL/Cj_StationInBillController.cs | 372 WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs | 266 WebAPI/DLL/ClsSc_MouldProdBackBill.cs | 315 WebAPI/DLL/Model.dll | 0 WebAPI/Models/ClsSc_MouldStockBillMain.cs | 26 WebAPI/Controllers/BaseSet/Gy_CheckItemController.cs | 440 + WebAPI/Controllers/PublicPageMethodController.cs | 1845 ++++ WebAPI/Controllers/BaseSet/Gy_QCCheckClassController.cs | 425 /dev/null | 17 WebAPI/DLL/ClsSc_MouldProdOutBill.cs | 390 WebAPI/DLL/ClsSc_MouldScrapInBill.cs | 413 WebAPI/Models/Gy_WorkCenter.cs | 29 WebAPI/Controllers/BaseSet/Gy_MaintenanceAcceptItemController.cs | 471 + WebAPI/Properties/PublishProfiles/API.pubxml.user | 136 WebAPI/DLL/ClsSc_ICMOReportBill.cs | 673 + WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs | 195 88 files changed, 25,780 insertions(+), 272 deletions(-) diff --git a/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs b/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs index c8fe01b..aeba8ab 100644 --- a/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs @@ -31,11 +31,11 @@ { if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_IF_BadReasonList " + sWhere, "h_v_IF_BadReasonList"); + ds = oCN.RunProcReturn("select * from h_v_IF_BadReasonList where 绂佺敤鏍囪='' " + sWhere, "h_v_IF_BadReasonList"); } else { - string sql1 = "select * from h_v_IF_BadReasonList where 1 = 1 "; + string sql1 = "select * from h_v_IF_BadReasonList where 绂佺敤鏍囪='' "; string sql = sql1 + sWhere; ds = oCN.RunProcReturn(sql, "h_v_IF_BadReasonList"); } diff --git a/WebAPI/Controllers/BaseSet/Gy_CheckItemController.cs b/WebAPI/Controllers/BaseSet/Gy_CheckItemController.cs new file mode 100644 index 0000000..d8d44cf --- /dev/null +++ b/WebAPI/Controllers/BaseSet/Gy_CheckItemController.cs @@ -0,0 +1,440 @@ +锘縰sing DBUtility; +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.BaseSet +{ + public class Gy_CheckItemController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region 妫�楠岄」鐩垪琛ㄦ暟鎹� + /// <summary> + /// 杩斿洖妫�楠岄」鐩垪琛� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_CheckItem/list")] + [HttpGet] + public object list(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_IF_QCCheckItemList " + sWhere, "h_v_IF_QCCheckItemList"); + } + else + { + string sql1 = "select * from h_v_IF_QCCheckItemList where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_QCCheckItemList"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 妫�楠岄」鐩牴鎹爲鍨婭D鏌ヨ鎵�鏈夊眰绾у垪琛ㄦ暟鎹� + /// <summary> + /// 鏍规嵁鏍戝瀷ID 鏌ユ壘璁板綍 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_CheckItem/cx")] + [HttpGet] + public object cx(long HInterID) + { + try + { + + //ds = oCN.RunProcReturn("select * from h_v_IF_RepairCheckList where HitemID=" + HInterID, "h_v_IF_RepairCheckList"); + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.h_v_IF_QCCheckItemList WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.h_v_IF_QCCheckItemList AS s,a WHERE s.parentid=a.HitemID) SELECT * FROM a"), "h_v_IF_QCCheckItemList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鍒犻櫎妫�楠岄」鐩� + /// <summary> + /// 妫�楠岄」鐩垪琛ㄥ垹闄ゆ寜閽� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_CheckItem/Delete_Json")] + [HttpGet] + public object Delete_Json(long HItemID, string User, string ModRightNameDelete) + { + DAL.ClsGy_QCCheckItem_Ctl oDept = new DAL.ClsGy_QCCheckItem_Ctl(); + DAL.ClsGy_QCCheckItem_View oDeptHlp = new DAL.ClsGy_QCCheckItem_View(); + try + { + //if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, User)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "娌℃湁鍒犻櫎鏉冮檺"; + // objJsonResult.data = null; + // return objJsonResult; + //} + if (oDeptHlp.GetInfoByID(HItemID)) + { + if (oDept.HavChildCodes(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩瓨鍦ㄥ瓙椤圭洰,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒犻櫎鍓嶅垽鏂槸鍚� 宸蹭娇鐢� 20141020 + if (oDeptHlp.omodel.HUseFlag != "鏈娇鐢�") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩凡浣跨敤鎴栬�呮湭妫�娴嬶紝涓嶈兘鍒犻櫎锛佽閲嶆柊妫�娴嬪啀鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + // + if (oDept.DeleteByID(HItemID)) + { + //鍐欏叆鏃ュ織 + ClsPub.Add_Log("", "鍒犻櫎椤圭洰锛屼唬鐮侊細" + oDeptHlp.omodel.HNumber + ",鍚嶇О锛�" + oDeptHlp.omodel.HName, ClsPub.CurUserName); + //鏇存柊涓婄骇涓� 鏈骇 + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触"; + objJsonResult.data = null; + return objJsonResult; + } + } + //ds = oCN.RunProcReturn("delete from Gy_Department where HItemID = " + HItemID, "Gy_Department"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 妫�楠岄」鐩柊澧炰繚瀛� + /// <summary> + /// 妫�楠岄」鐩�-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_CheckItem/AddBill")] + [HttpPost] + public object AddBill([FromBody] JObject oMain) + { + try + { + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + //鍙嶅簭鍒楀寲 + msg1 = "[" + msg1.ToString() + "]"; + + DAL.ClsGy_QCCheckItem_Ctl oDept = new DAL.ClsGy_QCCheckItem_Ctl(); + DAL.ClsGy_QCCheckItem_View oDeptHlp = new DAL.ClsGy_QCCheckItem_View(); + + + + List<CheckItem> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<CheckItem>>(msg1); + + long HItemID = list[0].HItemID.ToString() == "" ? 0 : list[0].HItemID; + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HNumber; + long HParentID = list[0].HParentID; + long HLevel= list[0].HLevel; + string HHelpCode = list[0].HHelpCode; + string HRemark = list[0].HRemark; + bool HStopflag = list[0].HStopflag; + bool HUseFlag = list[0].HUseFlag; + long HQCCheckClassID = list[0].HQCCheckClassID; + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + + + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Insert Into Gy_QCCheckItem " + + "(HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HLevel,HEndFlag,HStopflag,HRemark,HUseFlag,HQCCheckClassID) " + + " values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "','" + HItemID + "'" + + ",'"+ HLevel + "','0','" + Convert.ToString(HStopflag ? 1 : 0) + "','" + HRemark + "','鏈娇鐢�','"+ HQCCheckClassID + "')"); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + if (list[0].HItemID.ToString() != "") + { + oCN.RunProc("Update Gy_QCCheckItem set HEndflag=0 where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + } + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏂板鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 妫�楠岄」鐩慨鏀逛繚瀛� + /// <summary> + /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_CheckItem/EditBill")] + [HttpPost] + public object EditBill([FromBody] JObject oMain) + { + + try + { + DAL.ClsGy_QCCheckItem_Ctl oDept = new DAL.ClsGy_QCCheckItem_Ctl(); + DAL.ClsGy_QCCheckItem_View oDeptHlp = new DAL.ClsGy_QCCheckItem_View(); + + var _value = oMain["oMain"].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 msg5 = sArray[3].ToString(); + + //鍙嶅簭鍒楀寲 + msg2 = "[" + msg2.ToString() + "]"; + List<CheckItem> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<CheckItem>>(msg2); + + long HItemID = int.Parse(msg3); + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HNumber; + long HParentID = list[0].HParentID.ToString() == "" ? 0 : list[0].HParentID; + string HHelpCode = list[0].HHelpCode; + long HQCCheckClassID = list[0].HQCCheckClassID; + string HRemark = list[0].HRemark; + bool HStopflag = list[0].HStopflag; + bool HUseFlag = list[0].HUseFlag; + + + //鍒ゆ柇鏉冮檺 + //if (!ClsPub.Security_Log(msg5, 1, true, msg4)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (oDept.HavSameNumber(HItemID, HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜閲嶅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Update Gy_QCCheckItem set " + + " HNumber='" + HNumber + "'" + + ",HName='" + HName + "'" + + ",HShortNumber='" + HShortNumber + "'" + + ",HHelpCode='" + HHelpCode + "'" + + ",HParentID=" + HParentID + + ",HStopflag='" + HStopflag + "'" + + ",HQCCheckClassID='" + HQCCheckClassID + "'" + + ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); + //灏嗕笂绾� 涓洪潪鏈骇 + oCN.RunProc("Update Gy_QCCheckItem set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + // + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇敼鍗曟嵁鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 妫�楠岄」鐩慨鏀硅幏鍙栫粦瀹氭暟鎹� + /// <summary> + /// 缁翠慨鍒楄〃淇敼鎸夐挳鏂规硶 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_CheckItem/xg")] + [HttpGet] + public object xg(long HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from Gy_QCCheckItem where HItemID=" + HInterID, "Gy_QCCheckItem"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ""; + 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 妫�楠岄」鐩幏鍙栨爲鍨嬪垪琛ㄦ暟鎹� + [Route("Gy_CheckItem/LoadTree")] + [HttpGet] + public object LoadTree_Json(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("select * from h_v_Gy_QCCheckItemLoadTree", "h_v_Gy_QCCheckItemLoadTree"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + } +} diff --git a/WebAPI/Controllers/BaseSet/Gy_CurrencyController.cs b/WebAPI/Controllers/BaseSet/Gy_CurrencyController.cs index d7aafd4..275bca6 100644 --- a/WebAPI/Controllers/BaseSet/Gy_CurrencyController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_CurrencyController.cs @@ -7,6 +7,8 @@ using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; +using WebAPI.Service; + namespace WebAPI.Controllers { public class Gy_CurrencyController : ApiController @@ -31,11 +33,11 @@ { if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_Gy_CurrencyList " + sWhere, "h_v_Gy_CurrencyList"); + ds = oCN.RunProcReturn("select * from h_v_Gy_CurrencyList where 绂佺敤鏍囪=''" + sWhere, "h_v_Gy_CurrencyList"); } else { - string sql1 = "select * from h_v_Gy_CurrencyList where 1 = 1 "; + string sql1 = "select * from h_v_Gy_CurrencyList where 绂佺敤鏍囪='' "; string sql = sql1 + sWhere; ds = oCN.RunProcReturn(sql, "h_v_Gy_CurrencyList"); } @@ -93,8 +95,282 @@ } + /// <summary> + /// 淇濆瓨璐у竵璁剧疆 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_CurrencyList")] + [HttpPost] + public object SaveGy_CurrencyList([FromBody] JObject msg) + { + DataSet ds; + 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(); + Int64 HItemID = 0; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //鑾峰彇鏈�澶D鍊艰祴鍊� + DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_Currency ", "Gy_Currency"); + if (Maxds != null || Maxds.Tables[0].Rows.Count > 0) + { + //HItemID= Maxds.Tables[0].Rows[0]["HItemID"] + var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]); + maxid += 1; + HItemID = maxid; + } + ListModels oListModels = new ListModels(); + try + { + DAL.ClsGy_Currency_Ctl oBill = new DAL.ClsGy_Currency_Ctl(); + List<Model.ClsGy_Currency_Model> lsmain = new List<Model.ClsGy_Currency_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_Currency(msg1); + foreach (Model.ClsGy_Currency_Model oItem in lsmain) + { + if (oItem.HNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (oItem.HName.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim())) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮� + + ds = oCN.RunProcReturn("select * from Gy_Currency where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Currency"); + if (oItem.HNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鏂板鏃跺垽鏂� + if (oItem.HItemID == 0) + { + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + else//缂栬緫鏃跺垽鏂� + { + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + //寰楀埌鐭唬鐮� + string sShortNumber; + sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); + if (sShortNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oItem.HShortNumber = sShortNumber;//鐭唬鐮� + oItem.HEndFlag = true;//鏈骇鏍囧織 + oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇 + oItem.HScale= DBUtility.ClsPub.isLong(oItem.HScale);//灏忔暟浣� + oItem.HExchangeRate = DBUtility.ClsPub.isDoule(oItem.HExchangeRate);//姹囩巼 + oBill.oModel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.oModel.HItemID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddNew(); + } + else + { + bResult = oBill.ModifyByID(oBill.oModel.HItemID); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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; + } + } + + /// <summary> + /// 璐у竵璁剧疆鑾峰彇淇℃伅 + /// </summary> + /// <returns></returns> + [Route("GetGy_CurrencyDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_CurrencyDetail(string HID) + { + var model = LuBaoSevice.GetGy_CurrencyBillDetail(HID); + return model; + } + + /// <summary> + ///璐у竵璁剧疆鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_Currency")] + [HttpGet] + public object DeltetGy_Currency(string HItemID) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran();//寮�濮嬩簨鍔� + ds = oCN.RunProcReturn("select * from Gy_Currency where HItemID=" + HItemID, "Gy_Currency"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); + if (HStopflag) + { + oCN.RollBack();//鍥炴粴浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏁版嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.RunProc("update Gy_Currency set HStopflag=1 where HItemID=" + HItemID); + 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; + } + } - // } } \ No newline at end of file diff --git a/WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs b/WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs index c281276..fe244d6 100644 --- a/WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_EmployeeController.cs @@ -7,6 +7,8 @@ using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; +using WebAPI.Service; + namespace WebAPI.Controllers { public class Gy_EmployeeController : ApiController @@ -31,11 +33,11 @@ { if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_IF_EmployeeList " + sWhere, "h_v_IF_EmployeeList"); + ds = oCN.RunProcReturn("select * from h_v_IF_EmployeeList where 绂佺敤鏍囪='' ", "h_v_IF_EmployeeList"); } else { - string sql1 = "select * from h_v_IF_EmployeeList where 1 = 1 "; + string sql1 = "select * from h_v_IF_EmployeeList where 绂佺敤鏍囪='' "; string sql = sql1 + sWhere; ds = oCN.RunProcReturn(sql, "h_v_IF_EmployeeList"); } @@ -66,8 +68,324 @@ } } + /// <summary> + /// 淇濆瓨鑱屽憳 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_EmployeeList")] + [HttpPost] + public object SaveGy_EmployeeList([FromBody] JObject msg) + { + DataSet ds; + 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(); + Int64 HItemID = 0; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //鑾峰彇鏈�澶D鍊艰祴鍊� + DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_Employee ", "Gy_Employee"); + if (Maxds != null || Maxds.Tables[0].Rows.Count > 0) + { + //HItemID= Maxds.Tables[0].Rows[0]["HItemID"] + var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]); + maxid += 1; + HItemID = maxid; + } + ListModels oListModels = new ListModels(); + try + { + DAL.ClsGy_Employee_Ctl oBill = new DAL.ClsGy_Employee_Ctl(); + List<Model.ClsGy_Employee_Model> lsmain = new List<Model.ClsGy_Employee_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_Employee(msg1); + foreach (Model.ClsGy_Employee_Model oItem in lsmain) + { + if (oItem.HNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (oItem.HName.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //txtHInsuranceDate + if (oItem.HInsuranceDate.Trim() != "") + { + if (DBUtility.ClsPub.isStrNull(DBUtility.ClsPub.isDate(oItem.HInsuranceDate.Trim())) == "1900-01-01 0:00:00") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佸弬淇濇棩鏈熸牸寮忎笉瀵癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + } + //txtHDimissionDate + if (oItem.HDimissionDate.Trim() != "") + { + if (DBUtility.ClsPub.isStrNull(DBUtility.ClsPub.isDate(oItem.HDimissionDate.Trim())) == "1900-01-01 0:00:00") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佺鑱屾棩鏈熸牸寮忎笉瀵�!锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + //txtHStayCardEDate + if (oItem.HStayCardEDate.Trim() != "") + { + if (DBUtility.ClsPub.isStrNull(DBUtility.ClsPub.isDate(oItem.HStayCardEDate.Trim())) == "1900-01-01 0:00:00") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹殏浣忚瘉鍒版湡鏃ユ牸寮忎笉瀵�!锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + + if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim())) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = 1; + return objJsonResult; + } + + //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮� + ds = oCN.RunProcReturn("select * from Gy_Employee where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Employee"); + if (oItem.HNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鏂板鏃跺垽鏂� + if (oItem.HItemID == 0) + { + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + else//缂栬緫鏃跺垽鏂� + { + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + //寰楀埌鐭唬鐮� + string sShortNumber; + sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); + if (sShortNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + if (DBUtility.ClsPub.isDate(oBill.oModel.HDimissionDate) < Convert.ToDateTime("1950-01-01")) + { + oBill.oModel.HDimissionDate = "2050-01-01"; + } + oItem.HShortNumber = sShortNumber;//鐭唬鐮� + oItem.HEndFlag = true;//鏈骇鏍囧織 + oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇 + oBill.oModel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.oModel.HItemID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddNew(); + } + else + { + bResult = oBill.ModifyByID(oBill.oModel.HItemID); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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; + } + } - // + + /// <summary> + /// 鑱屽憳璁剧疆鑾峰彇淇℃伅 + /// </summary> + /// <returns></returns> + [Route("GetGy_EmployeeDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_EmployeeDetail(string HID) + { + var model = LuBaoSevice.GetGy_EmployeeBillDetail(HID); + return model; + } + + /// <summary> + /// 鑱屽憳璁剧疆鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_Employee")] + [HttpGet] + public object DeltetGy_Employee(string HItemID) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran();//寮�濮嬩簨鍔� + ds = oCN.RunProcReturn("select * from Gy_Employee where HItemID=" + HItemID, "Gy_Employee"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); + if (HStopflag) + { + oCN.RollBack();//鍥炴粴浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏁版嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.RunProc("update Gy_Employee set HStopflag=1 where HItemID=" + HItemID); + 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; + } + } + + + } } \ No newline at end of file diff --git a/WebAPI/Controllers/BaseSet/Gy_GroupController.cs b/WebAPI/Controllers/BaseSet/Gy_GroupController.cs index bb916f3..197e03e 100644 --- a/WebAPI/Controllers/BaseSet/Gy_GroupController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_GroupController.cs @@ -20,7 +20,7 @@ /// <summary> - /// 杩斿洖鐝粍鍒楄〃 + /// 杩斿洖宸ヤ綔涓績鍒楄〃 ///鍙傛暟锛歴tring sql銆� ///杩斿洖鍊硷細object銆� /// </summary> @@ -32,13 +32,13 @@ { if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + ds = oCN.RunProcReturn("select * from h_v_GroupList " + sWhere, "h_v_GroupList"); } else { - string sql1 = "select * from h_v_IF_GroupList where 1 = 1 "; + string sql1 = "select * from h_v_GroupList where 1 = 1 "; string sql = sql1 + sWhere; - ds = oCN.RunProcReturn(sql, "h_v_IF_GroupList"); + ds = oCN.RunProcReturn(sql, "h_v_GroupList"); } if (ds == null || ds.Tables[0].Rows.Count == 0) { @@ -67,8 +67,352 @@ } } + /// <summary> + /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_Group/cx")] + [HttpGet] + public object cx(long HInterID) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_GroupList where HitemID=" + HInterID, "h_v_GroupList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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; + } + } + + [Route("Gy_Group/LoadTree")] + [HttpGet] + public object LoadTree_Json(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + ds = oCN.RunProcReturn("select * from h_v_GroupLoadTree", "h_v_GroupLoadTree"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } - // + /// <summary> + /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_Group/AddBill")] + [HttpPost] + public object AddBill([FromBody] JObject oMain) + { + try + { + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + //鍙嶅簭鍒楀寲 + msg1 = "[" + msg1.ToString() + "]"; + DAL.ClsGy_Group_Ctl oDept = new DAL.ClsGy_Group_Ctl(); + List<Gy_Group> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_Group>>(msg1); + long HItemID = list[0].HItemID.ToString() == "" ? 0 : list[0].HItemID; + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HShortNumber; + long HParentID = list[0].HParentID; + string HHelpCode = list[0].HHelpCode; + string HRemark = list[0].HRemark; + string HStopflag = list[0].HStopflag == "True" ? "1" : "0"; + string HUseFlag = list[0].HUseFlag; + var HEmpQty = list[0].HEmpQty; + var HBarCodeForBase = list[0].HBarCodeForBase; + var HDeptID = list[0].HDeptID; + var HDeptNumber = ""; + var HEndFlag = 0; + var HLevel = ""; + var HProcID = ""; + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + string sql = "Insert into Gy_Group " + + " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HDeptNumber,HEmpQty" + + ",HLevel,HEndFlag,HStopflag,HRemark,HDeptID,HBarCodeForBase" + + ",HProcID) " + + " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HItemID.ToString() + + ",'" + HDeptNumber + "'," + HEmpQty + + ",'" + HLevel.ToString() + "'," + HEndFlag + "," + HStopflag + + ",'" + HRemark + "'," + HDeptID + ",'" + HBarCodeForBase + "','" + HProcID + "')"; + oCN.RunProc(sql, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + if (list[0].HItemID.ToString() != "") + { + oCN.RunProc("Update Gy_Group set HEndflag=0 where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + } + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏂板鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + /// <summary> + /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_Group/EditBill")] + [HttpPost] + public object EditBill([FromBody] JObject oMain) + { + try + { + DAL.ClsGy_Group_Ctl oDept = new DAL.ClsGy_Group_Ctl(); + var _value = oMain["oMain"].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 msg5 = sArray[3].ToString(); + //鍙嶅簭鍒楀寲 + msg2 = "[" + msg2.ToString() + "]"; + List<Gy_Group> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_Group>>(msg2); + long HItemID = int.Parse(msg3); + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HNumber; + long HParentID = list[0].HParentID.ToString() == "" ? 0 : list[0].HParentID; + string HHelpCode = list[0].HHelpCode; + string HRemark = list[0].HRemark; + string HStopflag = list[0].HStopflag; + string HUseFlag = list[0].HUseFlag; + var HEmpQty = list[0].HEmpQty; + var HBarCodeForBase = list[0].HBarCodeForBase; + var HDeptID = list[0].HDeptID; + var HProcID = list[0].HProcID; + + //鍒ゆ柇鏉冮檺 + if (!ClsPub.Security_Log(msg5, 1, true, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (oDept.HavSameNumber(HItemID, HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜閲嶅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Update Gy_Group set " + + " HNumber='" + HNumber + "'" + + ",HName='" + HName + "'" + + ",HShortNumber='" + HShortNumber + "'" + + ",HHelpCode='" + HHelpCode + "'" + + ",HParentID=" + HParentID + + ",HStopflag='" + HStopflag + "'" + + ",HRemark= '" + HRemark + "'" + + ",HDeptID=" + HDeptID + + ",HEmpQty=" + HEmpQty + + ",HBarCodeForBase='" + HBarCodeForBase + "' " + + ", HProcID = '" + HProcID + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Group,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); + //灏嗕笂绾� 涓洪潪鏈骇 + oCN.RunProc("Update Gy_Group set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + // + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇敼鍗曟嵁鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + /// <summary> + /// 缁翠慨鍒楄〃淇敼鎸夐挳鏂规硶 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_Group/xg")] + [HttpGet] + public object xg(long HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from Gy_Group where HItemID=" + HInterID, "Gy_Group"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ""; + 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> + /// 缁翠慨鏂瑰紡鍒楄〃鍒犻櫎鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_Group/Delete_Json")] + [HttpGet] + public object Delete_Json(long HItemID, string User, string ModRightNameDelete) + { + DAL.ClsGy_Group_Ctl oDept = new DAL.ClsGy_Group_Ctl(); + DAL.ClsGy_Group_View oDeptHlp = new DAL.ClsGy_Group_View(); + try + { + if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, User)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鍒犻櫎鏉冮檺"; + objJsonResult.data = null; + return objJsonResult; + } + if (oDeptHlp.GetInfoByID(HItemID)) + { + if (oDept.HavChildCodes(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩瓨鍦ㄥ瓙椤圭洰,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒犻櫎鍓嶅垽鏂槸鍚� 宸蹭娇鐢� 20141020 + if (oDeptHlp.omodel.HUseFlag != "鏈娇鐢�") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩凡浣跨敤鎴栬�呮湭妫�娴嬶紝涓嶈兘鍒犻櫎锛佽閲嶆柊妫�娴嬪啀鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + // + if (oDept.DeleteByID(HItemID)) + { + //鍐欏叆鏃ュ織 + ClsPub.Add_Log("", "鍒犻櫎椤圭洰锛屼唬鐮侊細" + oDeptHlp.omodel.HNumber + ",鍚嶇О锛�" + oDeptHlp.omodel.HName, ClsPub.CurUserName); + //鏇存柊涓婄骇涓� 鏈骇 + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触"; + objJsonResult.data = null; + return objJsonResult; + } + } + //ds = oCN.RunProcReturn("delete from Gy_Department where HItemID = " + HItemID, "Gy_Department"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } } } \ No newline at end of file diff --git a/WebAPI/Controllers/BaseSet/Gy_MaintenanceAcceptItemController.cs b/WebAPI/Controllers/BaseSet/Gy_MaintenanceAcceptItemController.cs new file mode 100644 index 0000000..3cbd624 --- /dev/null +++ b/WebAPI/Controllers/BaseSet/Gy_MaintenanceAcceptItemController.cs @@ -0,0 +1,471 @@ +锘縰sing DBUtility; +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.BaseSet +{ + public class Gy_MaintenanceAcceptItemController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + + /// <summary> + /// 杩斿洖缁翠慨鏂瑰紡鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceAcceptItem/list")] + [HttpGet] + public object list(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_IF_RepairCheckList " + sWhere, "h_v_IF_RepairCheckList"); + } + else + { + string sql1 = "select * from h_v_IF_RepairCheckList where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_RepairCheckList"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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> + /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceAcceptItem/cx")] + [HttpGet] + public object cx(long HInterID) + { + try + { + + //ds = oCN.RunProcReturn("select * from h_v_IF_RepairCheckList where HitemID=" + HInterID, "h_v_IF_RepairCheckList"); + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.h_v_IF_RepairCheckList WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.h_v_IF_RepairCheckList AS s,a WHERE s.parentid=a.HitemID) SELECT * FROM a"), "h_v_IF_RepairCheckList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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> + /// 缁翠慨鏂瑰紡鍒楄〃鍒犻櫎鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceAcceptItem/Delete_Json")] + [HttpGet] + public object Delete_Json(long HItemID, string User, string ModRightNameDelete) + { + DAL.ClsGy_RepairCheck_Ctl oDept = new DAL.ClsGy_RepairCheck_Ctl(); + DAL.ClsGy_RepairCheck_View oDeptHlp = new DAL.ClsGy_RepairCheck_View(); + try + { + if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, User)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鍒犻櫎鏉冮檺"; + objJsonResult.data = null; + return objJsonResult; + } + if (oDeptHlp.GetInfoByID(HItemID)) + { + if (oDept.HavChildCodes(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩瓨鍦ㄥ瓙椤圭洰,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒犻櫎鍓嶅垽鏂槸鍚� 宸蹭娇鐢� 20141020 + if (oDeptHlp.omodel.HUseFlag != "鏈娇鐢�") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩凡浣跨敤鎴栬�呮湭妫�娴嬶紝涓嶈兘鍒犻櫎锛佽閲嶆柊妫�娴嬪啀鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + // + if (oDept.DeleteByID(HItemID)) + { + //鍐欏叆鏃ュ織 + ClsPub.Add_Log("", "鍒犻櫎椤圭洰锛屼唬鐮侊細" + oDeptHlp.omodel.HNumber + ",鍚嶇О锛�" + oDeptHlp.omodel.HName, ClsPub.CurUserName); + //鏇存柊涓婄骇涓� 鏈骇 + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触"; + objJsonResult.data = null; + return objJsonResult; + } + } + //ds = oCN.RunProcReturn("delete from Gy_Department where HItemID = " + HItemID, "Gy_Department"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + //[Route("Gy_Department/LoadTree")] + //[HttpGet] + //public object LoadTree_Json() + //{ + // DBUtility.Gy_BaseFun.LoadTree(tv, imageList1, this.Text, BillName); + //} + + + + + /// <summary> + /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceAcceptItem/AddBill")] + [HttpPost] + public object AddBill([FromBody] JObject oMain) + { + try + { + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + //鍙嶅簭鍒楀寲 + msg1 = "[" + msg1.ToString() + "]"; + + DAL.ClsGy_RepairCheck_Ctl oDept = new DAL.ClsGy_RepairCheck_Ctl(); + DAL.ClsGy_RepairCheck_View oDeptHlp = new DAL.ClsGy_RepairCheck_View(); + + + + List<MaintenanceAcceptItem> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MaintenanceAcceptItem>>(msg1); + + long HItemID = list[0].HItemID.ToString()==""?0: list[0].HItemID; + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HNumber; + long HParentID = list[0].HParentID; + string HHelpCode = list[0].HHelpCode; + string HRemark = list[0].HRemark; + string HStopflag = list[0].HStopflag; + string HUseFlag = list[0].HUseFlag; + + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + + + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Insert Into Gy_RepairCheck " + + "(HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HLevel,HEndFlag,HStopflag,HRemark) " + + " values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "','"+ HItemID + "'" + + ",'1',0,'" + HStopflag + "','" + HRemark + "')"); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + if (list[0].HItemID.ToString() != "") + { + oCN.RunProc("Update Gy_RepairCheck set HEndflag=0 where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + } + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏂板鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + + /// <summary> + /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceAcceptItem/EditBill")] + [HttpPost] + public object EditBill([FromBody] JObject oMain) + { + + try + { + DAL.ClsGy_RepairCheck_Ctl oDept = new DAL.ClsGy_RepairCheck_Ctl(); + DAL.ClsGy_RepairCheck_View oDeptHlp = new DAL.ClsGy_RepairCheck_View(); + + var _value = oMain["oMain"].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 msg5 = sArray[3].ToString(); + + //鍙嶅簭鍒楀寲 + msg2 = "[" + msg2.ToString() + "]"; + List<MaintenanceAcceptItem> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MaintenanceAcceptItem>>(msg2); + + long HItemID = int.Parse(msg3); + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HNumber; + long HParentID =list[0].HParentID.ToString() == "" ? 0 : list[0].HParentID; + string HHelpCode = list[0].HHelpCode; + string HRemark = list[0].HRemark; + string HStopflag = list[0].HStopflag; + string HUseFlag = list[0].HUseFlag; + + + //鍒ゆ柇鏉冮檺 + if (!ClsPub.Security_Log(msg5, 1, true, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒"; + objJsonResult.data = null; + return objJsonResult; + } + + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (oDept.HavSameNumber(HItemID, HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜閲嶅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Update Gy_RepairCheck set " + + " HNumber='" + HNumber + "'" + + ",HName='" + HName + "'" + + ",HShortNumber='" + HShortNumber + "'" + + ",HHelpCode='" + HHelpCode + "'" + + ",HParentID=" + HParentID + + ",HStopflag='" + HStopflag + "'" + + ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); + //灏嗕笂绾� 涓洪潪鏈骇 + oCN.RunProc("Update Gy_RepairCheck set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + // + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇敼鍗曟嵁鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + + /// <summary> + /// 鑾峰彇鏈�澶у熀纭�璧勬枡ID + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceAcceptItem/GetMAXBillID")] + [HttpGet] + public object GetMAXBillID() + { + try + { + ds = oCN.RunProcReturn("select max(hitemid)+1 hitemid from Gy_RepairCheck", "Gy_RepairCheck"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ""; + 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> + /// 缁翠慨鍒楄〃淇敼鎸夐挳鏂规硶 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceAcceptItem/xg")] + [HttpGet] + public object xg(long HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from Gy_RepairCheck where HItemID=" + HInterID, "Gy_RepairCheck"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ""; + 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; + } + } + + + + [Route("Gy_MaintenanceAcceptItem/LoadTree")] + [HttpGet] + public object LoadTree_Json(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("select * from h_v_RepairCheckLoadTree", "h_v_RepairCheckLoadTree"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + + + } +} diff --git a/WebAPI/Controllers/BaseSet/Gy_MaintenanceItemController.cs b/WebAPI/Controllers/BaseSet/Gy_MaintenanceItemController.cs new file mode 100644 index 0000000..b6c240b --- /dev/null +++ b/WebAPI/Controllers/BaseSet/Gy_MaintenanceItemController.cs @@ -0,0 +1,437 @@ +锘縰sing DBUtility; +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.BaseSet +{ + public class Gy_MaintenanceItemController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + /// <summary> + /// 杩斿洖缁翠慨鏂瑰紡鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceItem/list")] + [HttpGet] + public object list(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select HParentID ParentID, * from Gy_Repair" + sWhere, "Gy_Repair"); + } + else + { + string sql1 = "select HParentID ParentID,* from Gy_Repair where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_Repair"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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> + /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceItem/cx")] + [HttpGet] + public object cx(long HInterID) + { + try + { + + ds = oCN.RunProcReturn("select * from Gy_Repair where HitemID=" + HInterID, "Gy_Repair"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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> + /// 缁翠慨鏂瑰紡鍒楄〃鍒犻櫎鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceItem/Delete_Json")] + [HttpGet] + public object Delete_Json(long HItemID, string User, string ModRightNameDelete) + { + DAL.ClsGy_Repair_Ctl oDept = new DAL.ClsGy_Repair_Ctl(); + DAL.ClsGy_Repair_View oDeptHlp = new DAL.ClsGy_Repair_View(); + + try + { + if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, User)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鍒犻櫎鏉冮檺"; + objJsonResult.data = null; + return objJsonResult; + } + if (oDeptHlp.GetInfoByID(HItemID)) + { + if (oDept.HavChildCodes(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩瓨鍦ㄥ瓙椤圭洰,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒犻櫎鍓嶅垽鏂槸鍚� 宸蹭娇鐢� 20141020 + if (oDeptHlp.omodel.HUseFlag != "鏈娇鐢�") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩凡浣跨敤鎴栬�呮湭妫�娴嬶紝涓嶈兘鍒犻櫎锛佽閲嶆柊妫�娴嬪啀鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + // + if (oDept.DeleteByID(HItemID)) + { + //鍐欏叆鏃ュ織 + ClsPub.Add_Log("", "鍒犻櫎椤圭洰锛屼唬鐮侊細" + oDeptHlp.omodel.HNumber + ",鍚嶇О锛�" + oDeptHlp.omodel.HName, ClsPub.CurUserName); + //鏇存柊涓婄骇涓� 鏈骇 + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触"; + objJsonResult.data = null; + return objJsonResult; + } + } + //ds = oCN.RunProcReturn("delete from Gy_Department where HItemID = " + HItemID, "Gy_Department"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + /// <summary> + /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceItem/AddBill")] + [HttpPost] + public object AddBill([FromBody] JObject oMain) + { + try + { + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + //鍙嶅簭鍒楀寲 + msg1 = "[" + msg1.ToString() + "]"; + + DAL.ClsGy_Repair_Ctl oDept = new DAL.ClsGy_Repair_Ctl(); + DAL.ClsGy_Repair_View oDeptHlp = new DAL.ClsGy_Repair_View(); + List<MaintenanceMode> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MaintenanceMode>>(msg1); + long HItemID = list[0].HItemID.ToString() == "" ? 0 : list[0].HItemID; + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HNumber; + long HParentID = list[0].HParentID; + string HHelpCode = list[0].HHelpCode; + string HRemark = list[0].HRemark; + string HStopflag = list[0].HStopflag; + string HUseFlag = list[0].HUseFlag; + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + + + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Insert Into Gy_Repair " + + "(HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HLevel,HEndFlag,HStopflag,HRemark) " + + " values('" + HNumber + "','"+ HName + "','"+ HHelpCode + "','" + HShortNumber + "','"+ HItemID + "'" + + ",'1',0,'" + HStopflag + "','"+ HRemark + "')"); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + if (list[0].HItemID.ToString() != "") + { + oCN.RunProc("Update Gy_Repair set HEndflag=0 where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + } + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏂板鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + /// <summary> + /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceItem/EditBill")] + [HttpPost] + public object EditBill([FromBody] JObject oMain) + { + + try + { + DAL.ClsGy_Repair_Ctl oDept = new DAL.ClsGy_Repair_Ctl(); + DAL.ClsGy_Repair_View oDeptHlp = new DAL.ClsGy_Repair_View(); + + var _value = oMain["oMain"].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 msg5 = sArray[3].ToString(); + //鍙嶅簭鍒楀寲 + msg2 = "[" + msg2.ToString() + "]"; + List<MaintenanceMode> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MaintenanceMode>>(msg2); + + long HItemID = int.Parse(msg3); + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HNumber; + long HParentID = list[0].HParentID.ToString() == "" ? 0 : list[0].HParentID; + string HHelpCode = list[0].HHelpCode; + string HRemark = list[0].HRemark; + string HStopflag = list[0].HStopflag; + string HUseFlag = list[0].HUseFlag; + + + //鍒ゆ柇鏉冮檺 + if (!ClsPub.Security_Log(msg5, 1, true, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒"; + objJsonResult.data = null; + return objJsonResult; + } + + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (oDept.HavSameNumber(HItemID, HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜閲嶅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Update Gy_Repair set " + + " HNumber='" + HNumber + "'" + + ",HName='" + HName + "'" + + ",HShortNumber='" + HShortNumber + "'" + + ",HParentID=" + HParentID + + ",HStopflag='" + HStopflag + "'" + + ",HRemark= '" + HRemark + "'" + + ",HHelpCode= '" + HHelpCode + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Department,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); + //灏嗕笂绾� 涓洪潪鏈骇 + oCN.RunProc("Update Gy_Repair set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + // + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇敼鍗曟嵁鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + /// <summary> + /// 鑾峰彇鏈�澶у熀纭�璧勬枡ID + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceItem/GetMAXBillID")] + [HttpGet] + public object GetMAXBillID() + { + try + { + ds = oCN.RunProcReturn("select max(hitemid)+1 hitemid from Gy_Repair", "Gy_Repair"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ""; + 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> + /// 缁翠慨鍒楄〃淇敼鎸夐挳鏂规硶 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceItem/xg")] + [HttpGet] + public object xg(long HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from Gy_Repair where HItemID=" + HInterID, "Gy_Repair"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ""; + 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; + } + } + [Route("Gy_MaintenanceItem/LoadTree")] + [HttpGet] + public object LoadTree_Json(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("select * from h_v_RepairLoadTree", "h_v_RepairLoadTree"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + } +} diff --git a/WebAPI/Controllers/BaseSet/Gy_MaintenanceModeController.cs b/WebAPI/Controllers/BaseSet/Gy_MaintenanceModeController.cs new file mode 100644 index 0000000..6c2baa4 --- /dev/null +++ b/WebAPI/Controllers/BaseSet/Gy_MaintenanceModeController.cs @@ -0,0 +1,476 @@ +锘縰sing DBUtility; +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.BaseSet +{ + public class Gy_MaintenanceModeController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + + #region 缁翠慨鏂瑰紡 + + #region 缁翠慨鏂瑰紡鍔犺浇鍒楄〃 + /// <summary> + /// 杩斿洖缁翠慨鏂瑰紡鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceMode/list")] + [HttpGet] + public object list(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_IF_RepairTypeList " + sWhere, "h_v_IF_RepairTypeList"); + } + else + { + string sql1 = "select * from h_v_IF_RepairTypeList where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_RepairTypeList"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 缁翠慨鏂瑰紡鏍规嵁鏍戝瀷id鏌ヨ鍒楄〃 + /// <summary> + /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceMode/cx")] + [HttpGet] + public object cx(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.h_v_IF_RepairTypeList WHERE HitemID="+ HInterID + " UNION ALL SELECT s.* FROM dbo.h_v_IF_RepairTypeList AS s,a WHERE s.parentid=a.HitemID) SELECT * FROM a"), "h_v_IF_RepairTypeList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 缁翠慨鏂瑰紡鍒犻櫎 + /// <summary> + /// 缁翠慨鏂瑰紡鍒楄〃鍒犻櫎鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceMode/Delete_Json")] + [HttpGet] + public object Delete_Json(long HItemID, string User, string ModRightNameDelete) + { + DAL.ClsGy_RepairType_Ctl oDept = new DAL.ClsGy_RepairType_Ctl(); + DAL.ClsGy_RepairType_View oDeptHlp = new DAL.ClsGy_RepairType_View(); + try + { + if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, User)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鍒犻櫎鏉冮檺"; + objJsonResult.data = null; + return objJsonResult; + } + if (oDeptHlp.GetInfoByID(HItemID)) + { + if (oDept.HavChildCodes(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩瓨鍦ㄥ瓙椤圭洰,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒犻櫎鍓嶅垽鏂槸鍚� 宸蹭娇鐢� 20141020 + if (oDeptHlp.omodel.HUseFlag != "鏈娇鐢�") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩凡浣跨敤鎴栬�呮湭妫�娴嬶紝涓嶈兘鍒犻櫎锛佽閲嶆柊妫�娴嬪啀鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + // + if (oDept.DeleteByID(HItemID)) + { + //鍐欏叆鏃ュ織 + ClsPub.Add_Log("", "鍒犻櫎椤圭洰锛屼唬鐮侊細" + oDeptHlp.omodel.HNumber + ",鍚嶇О锛�" + oDeptHlp.omodel.HName, ClsPub.CurUserName); + //鏇存柊涓婄骇涓� 鏈骇 + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触"; + objJsonResult.data = null; + return objJsonResult; + } + } + //ds = oCN.RunProcReturn("delete from Gy_Department where HItemID = " + HItemID, "Gy_Department"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 缁翠慨鏂瑰紡鏂板淇濆瓨 + /// <summary> + /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceMode/AddBill")] + [HttpPost] + public object AddBill([FromBody] JObject oMain) + { + try + { + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + //鍙嶅簭鍒楀寲 + msg1 = "[" + msg1.ToString() + "]"; + + DAL.ClsGy_Department_Ctl oDept = new DAL.ClsGy_Department_Ctl(); + DAL.ClsGy_Department_View oDeptHlp = new DAL.ClsGy_Department_View(); + + + + List<MaintenanceMode> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MaintenanceMode>>(msg1); + + long HItemID = list[0].HItemID.ToString() == "" ? 0 : list[0].HItemID; + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HNumber; + long HParentID = list[0].HParentID; + string HHelpCode = list[0].HHelpCode; + string HRemark = list[0].HRemark; + string HStopflag = list[0].HStopflag; + string HUseFlag = list[0].HUseFlag; + + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + + + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Insert Into Gy_RepairType " + + "(HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HLevel,HEndFlag,HStopflag,HRemark) " + + " values('" + HNumber + "','"+ HName + "','"+ HHelpCode + "','" + HShortNumber + "','" + HItemID + "'" + + ",'1',0,'" + HStopflag + "','"+ HRemark + "')"); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + if (list[0].HItemID.ToString() != "") + { + oCN.RunProc("Update Gy_RepairType set HEndflag=0 where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + } + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏂板鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 缁翠慨鏂瑰紡淇敼淇濆瓨 + /// <summary> + /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceMode/EditBill")] + [HttpPost] + public object EditBill([FromBody] JObject oMain) + { + + try + { + DAL.ClsGy_RepairType_Ctl oDept = new DAL.ClsGy_RepairType_Ctl(); + DAL.ClsGy_RepairType_View oDeptHlp = new DAL.ClsGy_RepairType_View(); + + var _value = oMain["oMain"].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 msg5 = sArray[3].ToString(); + //鍙嶅簭鍒楀寲 + msg2 = "[" + msg2.ToString() + "]"; + List<MaintenanceMode> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MaintenanceMode>>(msg2); + + long HItemID = int.Parse(msg3); + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HNumber; + long HParentID = list[0].HParentID.ToString() == "" ? 0 : list[0].HParentID; + string HHelpCode = list[0].HHelpCode; + string HRemark = list[0].HRemark; + string HStopflag = list[0].HStopflag; + string HUseFlag = list[0].HUseFlag; + + + //鍒ゆ柇鏉冮檺 + if (!ClsPub.Security_Log(msg5, 1, true, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒"; + objJsonResult.data = null; + return objJsonResult; + } + + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (oDept.HavSameNumber(HItemID, HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜閲嶅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Update Gy_RepairType set " + + " HNumber='" + HNumber + "'" + + ",HName='" + HName + "'" + + ",HShortNumber='" + HShortNumber + "'" + + ",HParentID=" + HParentID + + ",HStopflag='" + HStopflag + "'" + + ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairType,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); + //灏嗕笂绾� 涓洪潪鏈骇 + oCN.RunProc("Update Gy_RepairType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + // + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇敼鍗曟嵁鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + + /// <summary> + /// 鑾峰彇鏈�澶у熀纭�璧勬枡ID + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceMode/GetMAXBillID")] + [HttpGet] + public object GetMAXBillID() + { + try + { + ds = oCN.RunProcReturn("select max(hitemid)+1 hitemid from Gy_RepairType", "Gy_RepairType"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ""; + 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; + } + } + + + #region 缁翠慨鏂瑰紡淇敼鑾峰彇閫変腑鏁版嵁 + + /// <summary> + /// 缁翠慨鍒楄〃淇敼鎸夐挳鏂规硶 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_MaintenanceMode/xg")] + [HttpGet] + public object xg(long HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from Gy_RepairType where HItemID=" + HInterID, "Gy_RepairType"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ""; + 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 缁翠慨鏂瑰紡鑾峰彇鏍戝瀷鏁版嵁 + + [Route("Gy_MaintenanceMode/LoadTree")] + [HttpGet] + public object LoadTree_Json(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("select * from h_v_RepairTypeLoadTree", "h_v_RepairTypeLoadTree"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + + // + } +} diff --git a/WebAPI/Controllers/BaseSet/Gy_QCCheckClassController.cs b/WebAPI/Controllers/BaseSet/Gy_QCCheckClassController.cs new file mode 100644 index 0000000..16dc3b3 --- /dev/null +++ b/WebAPI/Controllers/BaseSet/Gy_QCCheckClassController.cs @@ -0,0 +1,425 @@ +锘縰sing DBUtility; +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.BaseSet +{ + public class Gy_QCCheckClassController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region 妫�楠岄」鐩垪琛ㄦ暟鎹� + /// <summary> + /// 杩斿洖妫�楠岄」鐩垪琛� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_QCCheckClass/list")] + [HttpGet] + public object list(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_IF_QCCheckClassList " + sWhere, "h_v_IF_QCCheckClassList"); + } + else + { + string sql1 = "select * from h_v_IF_QCCheckClassList where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_QCCheckClassList"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 妫�楠岄」鐩牴鎹爲鍨婭D鏌ヨ鎵�鏈夊眰绾у垪琛ㄦ暟鎹� + /// <summary> + /// 鏍规嵁鏍戝瀷ID 鏌ユ壘璁板綍 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_QCCheckClass/cx")] + [HttpGet] + public object cx(long HInterID) + { + try + { + + //ds = oCN.RunProcReturn("select * from h_v_IF_RepairCheckList where HitemID=" + HInterID, "h_v_IF_RepairCheckList"); + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.h_v_IF_QCCheckClassList WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.h_v_IF_QCCheckClassList AS s,a WHERE s.parentid=a.HitemID) SELECT * FROM a"), "h_v_IF_QCCheckClassList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鍒犻櫎妫�楠岄」鐩� + /// <summary> + /// 妫�楠岄」鐩垪琛ㄥ垹闄ゆ寜閽� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_QCCheckClass/Delete_Json")] + [HttpGet] + public object Delete_Json(long HItemID, string User, string ModRightNameDelete) + { + DAL.ClsGy_QCCheckClass_Ctl oDept = new DAL.ClsGy_QCCheckClass_Ctl(); + DAL.ClsGy_QCCheckClass_View oDeptHlp = new DAL.ClsGy_QCCheckClass_View(); + try + { + if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, User)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鍒犻櫎鏉冮檺"; + objJsonResult.data = null; + return objJsonResult; + } + if (oDeptHlp.GetInfoByID(HItemID)) + { + if (oDept.HavChildCodes(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩瓨鍦ㄥ瓙椤圭洰,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒犻櫎鍓嶅垽鏂槸鍚� 宸蹭娇鐢� 20141020 + if (oDeptHlp.omodel.HUseFlag != "鏈娇鐢�") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩凡浣跨敤鎴栬�呮湭妫�娴嬶紝涓嶈兘鍒犻櫎锛佽閲嶆柊妫�娴嬪啀鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + // + if (oDept.DeleteByID(HItemID)) + { + //鍐欏叆鏃ュ織 + ClsPub.Add_Log("", "鍒犻櫎椤圭洰锛屼唬鐮侊細" + oDeptHlp.omodel.HNumber + ",鍚嶇О锛�" + oDeptHlp.omodel.HName, ClsPub.CurUserName); + //鏇存柊涓婄骇涓� 鏈骇 + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触"; + objJsonResult.data = null; + return objJsonResult; + } + } + //ds = oCN.RunProcReturn("delete from Gy_Department where HItemID = " + HItemID, "Gy_Department"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 妫�楠岄」鐩柊澧炰繚瀛� + /// <summary> + /// 妫�楠岄」鐩�-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_QCCheckClass/AddBill")] + [HttpPost] + public object AddBill([FromBody] JObject oMain) + { + try + { + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + //鍙嶅簭鍒楀寲 + msg1 = "[" + msg1.ToString() + "]"; + + DAL.ClsGy_QCCheckClass_Ctl oDept = new DAL.ClsGy_QCCheckClass_Ctl(); + DAL.ClsGy_QCCheckClass_View oDeptHlp = new DAL.ClsGy_QCCheckClass_View(); + + + + List<CheckItem> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<CheckItem>>(msg1); + + long HItemID = list[0].HItemID.ToString() == "" ? 0 : list[0].HItemID; + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HNumber; + long HParentID = list[0].HParentID; + string HHelpCode = list[0].HHelpCode; + string HRemark = list[0].HRemark; + bool HStopflag = list[0].HStopflag; + bool HUseFlag = list[0].HUseFlag; + long HQCCheckClassID = list[0].HQCCheckClassID; + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Insert Into Gy_QCCheckClass " + + "(HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HLevel,HEndFlag,HStopflag,HRemark,HUseFlag) " + + " values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "','" + HItemID + "'" + + ",'1',0,'" + Convert.ToString(HStopflag ? 1 : 0) + "','" + HRemark + "','0')"); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + if (list[0].HItemID.ToString() != "") + { + oCN.RunProc("Update Gy_QCCheckClass set HEndflag=0 where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + } + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏂板鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 妫�楠岄」鐩慨鏀逛繚瀛� + /// <summary> + /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_QCCheckClass/EditBill")] + [HttpPost] + public object EditBill([FromBody] JObject oMain) + { + + try + { + DAL.ClsGy_QCCheckClass_Ctl oDept = new DAL.ClsGy_QCCheckClass_Ctl(); + DAL.ClsGy_QCCheckClass_View oDeptHlp = new DAL.ClsGy_QCCheckClass_View(); + + var _value = oMain["oMain"].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 msg5 = sArray[3].ToString(); + + //鍙嶅簭鍒楀寲 + msg2 = "[" + msg2.ToString() + "]"; + List<MaintenanceAcceptItem> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MaintenanceAcceptItem>>(msg2); + + long HItemID = int.Parse(msg3); + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HNumber; + long HParentID = list[0].HParentID.ToString() == "" ? 0 : list[0].HParentID; + string HHelpCode = list[0].HHelpCode; + string HRemark = list[0].HRemark; + string HStopflag = list[0].HStopflag; + string HUseFlag = list[0].HUseFlag; + + + //鍒ゆ柇鏉冮檺 + if (!ClsPub.Security_Log(msg5, 1, true, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒"; + objJsonResult.data = null; + return objJsonResult; + } + + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (oDept.HavSameNumber(HItemID, HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜閲嶅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Update Gy_QCCheckClass set " + + " HNumber='" + HNumber + "'" + + ",HName='" + HName + "'" + + ",HShortNumber='" + HShortNumber + "'" + + ",HHelpCode='" + HHelpCode + "'" + + ",HParentID=" + HParentID + + ",HStopflag='" + HStopflag + "'" + + ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); + //灏嗕笂绾� 涓洪潪鏈骇 + oCN.RunProc("Update Gy_QCCheckClass set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + // + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇敼鍗曟嵁鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 妫�楠岄」鐩慨鏀硅幏鍙栫粦瀹氭暟鎹� + /// <summary> + /// 缁翠慨鍒楄〃淇敼鎸夐挳鏂规硶 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_QCCheckClass/xg")] + [HttpGet] + public object xg(long HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from Gy_QCCheckClass where HItemID=" + HInterID, "Gy_QCCheckClass"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ""; + 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 妫�楠岄」鐩幏鍙栨爲鍨嬪垪琛ㄦ暟鎹� + [Route("Gy_QCCheckClass/LoadTree")] + [HttpGet] + public object LoadTree_Json(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("select * from h_v_Gy_QCCheckClassLoadTree", "h_v_Gy_QCCheckClassLoadTree"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + #endregion + } +} diff --git a/WebAPI/Controllers/BaseSet/Gy_SourceController.cs b/WebAPI/Controllers/BaseSet/Gy_SourceController.cs index 9dfb4b9..c61d537 100644 --- a/WebAPI/Controllers/BaseSet/Gy_SourceController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_SourceController.cs @@ -7,6 +7,8 @@ using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; +using WebAPI.Service; + namespace WebAPI.Controllers { //鐢熶骇璧勬簮Controller @@ -32,11 +34,11 @@ { if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_IF_SourceList " + sWhere, "h_v_IF_SourceList"); + ds = oCN.RunProcReturn("select * from h_v_IF_SourceList where 绂佺敤鏍囪='' ", "h_v_IF_SourceList"); } else { - string sql1 = "select * from h_v_IF_SourceList where 1 = 1 "; + string sql1 = "select * from h_v_IF_SourceList where 绂佺敤鏍囪='' "; string sql = sql1 + sWhere; ds = oCN.RunProcReturn(sql, "h_v_IF_SourceList"); } @@ -67,8 +69,281 @@ } } + /// <summary> + /// 淇濆瓨鐢熶骇璧勬簮 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_SourceList")] + [HttpPost] + public object SaveGy_SourceList([FromBody] JObject msg) + { + DataSet ds; + 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(); + Int64 HItemID = 0; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //鑾峰彇鏈�澶D鍊艰祴鍊� + DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_Source ", "Gy_Unit"); + if (Maxds != null || Maxds.Tables[0].Rows.Count > 0) + { + //HItemID= Maxds.Tables[0].Rows[0]["HItemID"] + var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]); + maxid += 1; + HItemID = maxid; + } + ListModels oListModels = new ListModels(); + try + { + DAL.ClsGy_Source_Ctl oBill = new DAL.ClsGy_Source_Ctl(); + List<Model.ClsGy_Source_Model> lsmain = new List<Model.ClsGy_Source_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_Source(msg1); + foreach (Model.ClsGy_Source_Model oItem in lsmain) + { + if (oItem.HNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (oItem.HName.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim())) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮� + ds = oCN.RunProcReturn("select * from Gy_Source where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Source"); + if (oItem.HNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鏂板鏃跺垽鏂� + if (oItem.HItemID == 0) + { + if (ds == null || ds.Tables[0].Rows.Count == 0) + { - // + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + else//缂栬緫鏃跺垽鏂� + { + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + //寰楀埌鐭唬鐮� + string sShortNumber; + sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); + if (sShortNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oItem.HShortNumber = sShortNumber;//鐭唬鐮� + oItem.HEndFlag = true;//鏈骇鏍囧織 + oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇 + oItem.HEquipFileID_K3 = 0;//瀵瑰簲K3璁惧 + oItem.HGroupK3ID = 0;//榛樿K3鐢熶骇鐝粍 + oBill.oModel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.oModel.HItemID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddNew(); + } + else + { + bResult = oBill.ModifyByID(oBill.oModel.HItemID); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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; + } + } + + /// <summary> + /// 鐢熶骇璧勬簮鑾峰彇淇℃伅 + /// </summary> + /// <returns></returns> + [Route("GetGy_SourceDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_SourceDetail(string HID) + { + var model = LuBaoSevice.GetGy_SourceBillDetail(HID); + return model; + } + + /// <summary> + /// 鐢熶骇璧勬簮鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_Source")] + [HttpGet] + public object DeltetGy_Source(string HItemID) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran();//寮�濮嬩簨鍔� + ds = oCN.RunProcReturn("select * from Gy_Source where HItemID=" + HItemID, "Gy_Source"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); + if (HStopflag) + { + oCN.RollBack();//鍥炴粴浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏁版嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.RunProc("update Gy_Source set HStopflag=1 where HItemID=" + HItemID); + 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; + } + } + } } \ No newline at end of file diff --git a/WebAPI/Controllers/BaseSet/Gy_StockPlaceController.cs b/WebAPI/Controllers/BaseSet/Gy_StockPlaceController.cs index 465de7c..770ff1e 100644 --- a/WebAPI/Controllers/BaseSet/Gy_StockPlaceController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_StockPlaceController.cs @@ -9,7 +9,7 @@ using WebAPI.Models; namespace WebAPI.Controllers { - public class Gy_DepartmentController : ApiController + public class Gy_StockPlaceController : ApiController { public DBUtility.ClsPub.Enum_BillStatus BillStatus; diff --git a/WebAPI/Controllers/BaseSet/Gy_UnitController.cs b/WebAPI/Controllers/BaseSet/Gy_UnitController.cs index 5bf2cfd..a4c4166 100644 --- a/WebAPI/Controllers/BaseSet/Gy_UnitController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_UnitController.cs @@ -7,6 +7,8 @@ using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; +using WebAPI.Service; + namespace WebAPI.Controllers { public class Gy_UnitController : ApiController @@ -31,11 +33,11 @@ { if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_Gy_UnitList " + sWhere, "h_v_Gy_UnitList"); + ds = oCN.RunProcReturn("select * from h_v_Gy_UnitList where 绂佺敤鏍囪='' ", "h_v_Gy_UnitList"); } else { - string sql1 = "select * from h_v_Gy_UnitList where 1 = 1 "; + string sql1 = "select * from h_v_Gy_UnitList where 绂佺敤鏍囪='' "; string sql = sql1 + sWhere; ds = oCN.RunProcReturn(sql, "h_v_Gy_UnitList"); } @@ -93,8 +95,282 @@ } + /// <summary> + /// 淇濆瓨璁¢噺鍗曚綅 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_UnitList")] + [HttpPost] + public object SaveGy_UnitList([FromBody] JObject msg) + { + DataSet ds; + 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(); + Int64 HItemID = 0; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //鑾峰彇鏈�澶D鍊艰祴鍊� + DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_Unit ", "Gy_Unit"); + if (Maxds != null || Maxds.Tables[0].Rows.Count > 0) + { + //HItemID= Maxds.Tables[0].Rows[0]["HItemID"] + var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]); + maxid += 1; + HItemID = maxid; + } + ListModels oListModels = new ListModels(); + try + { + DAL.ClsGy_Unit_Ctl oBill = new DAL.ClsGy_Unit_Ctl(); + List<Model.ClsGy_Unit_Model> lsmain = new List<Model.ClsGy_Unit_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_Unit(msg1); + foreach (Model.ClsGy_Unit_Model oItem in lsmain) + { + if (oItem.HNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (oItem.HName.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim())) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮� + + ds = oCN.RunProcReturn("select * from Gy_Unit where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_Unit"); + if (oItem.HNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鏂板鏃跺垽鏂� + if (oItem.HItemID == 0) + { + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + else//缂栬緫鏃跺垽鏂� + { + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + //寰楀埌鐭唬鐮� + string sShortNumber; + sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); + if (sShortNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oItem.HShortNumber = sShortNumber;//鐭唬鐮� + oItem.HEndFlag = true;//鏈骇鏍囧織 + oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇 + oItem.HRate= DBUtility.ClsPub.GetLevel(oItem.HRate.ToString().Trim());//鎹㈢畻姣斾緥 + oBill.oModel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.oModel.HItemID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddNew(); + } + else + { + bResult = oBill.ModifyByID(oBill.oModel.HItemID); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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; + } + } + + /// <summary> + /// 璁¢噺鍗曚綅鑾峰彇淇℃伅 + /// </summary> + /// <returns></returns> + [Route("GetGy_UnitDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_UnitDetail(string HID) + { + var model = LuBaoSevice.GetGy_UnitBillDetail(HID); + return model; + } + + /// <summary> + /// 璁¢噺鍗曚綅鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_Unit")] + [HttpGet] + public object DeltetGy_Unit(string HItemID) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran();//寮�濮嬩簨鍔� + ds = oCN.RunProcReturn("select * from Gy_Unit where HItemID=" + HItemID, "Gy_Unit"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); + if (HStopflag) + { + oCN.RollBack();//鍥炴粴浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏁版嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.RunProc("update Gy_Unit set HStopflag=1 where HItemID=" + HItemID); + 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; + } + } - // + } } \ No newline at end of file diff --git a/WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs b/WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs index e31af79..11a8ed9 100644 --- a/WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs @@ -142,5 +142,200 @@ } // + + /// <summary> + /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_Warehouse/AddNew")] + [HttpPost] + public object AddNew([FromBody] JObject oMain) + { + try + { + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + //鍙嶅簭鍒楀寲 + msg1 = "[" + msg1.ToString() + "]"; + + DAL.ClsGy_Warehouse_Ctl oDept = new DAL.ClsGy_Warehouse_Ctl(); + DAL.ClsGy_Warehouse_View oDeptHlp = new DAL.ClsGy_Warehouse_View(); + List<Warehouse> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Warehouse>>(msg1); + + long HItemID = list[0].HItemID; + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HHelpCode = list[0].HHelpCode; + string HShortNumber = list[0].HShortNumber; + long HParentID = list[0].HParentID; + long HLevel = list[0].HLevel; + bool HEndFlag = list[0].HEndFlag; + bool HStopflag = list[0].HStopflag; + string HRemark = list[0].HRemark; + string HBarCode = list[0].HBarCode; + long HEmpID = list[0].HEmpID; + string HAddress = list[0].HAddress; + string HPhone = list[0].HPhone; + long HUSEORGID = list[0].HUSEORGID; + string HMaker = list[0].HMaker; + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Insert Into Gy_Warehouse " + + "(HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HLevel,HEndFlag,HStopFlag,HRemark,HBarCode" + + ",HEmpID,HAddress,HPhone,HUSEORGID,HMaker" + + ") " + + " values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID.ToString() + + "," + HLevel.ToString() + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "','" + HBarCode + "'" + + "," + HEmpID.ToString() + ",'" + HAddress + "','" + HPhone + "'," + HUSEORGID.ToString() + ",'" + HMaker + "'" + + ") "); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + oCN.RunProc("Update Gy_Warehouse set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + + /// <summary> + /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_Warehouse/ModifyByID")] + [HttpPost] + public object ModifyByID([FromBody] JObject oMain) + { + try + { + DAL.ClsGy_Warehouse_Ctl oDept = new DAL.ClsGy_Warehouse_Ctl(); + DAL.ClsGy_Warehouse_View oDeptHlp = new DAL.ClsGy_Warehouse_View(); + + var _value = oMain["oMain"].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 msg5 = sArray[3].ToString(); + //鍙嶅簭鍒楀寲 + msg2 = "[" + msg2.ToString() + "]"; + List<Warehouse> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Warehouse>>(msg2); + + long HItemID = list[0].HItemID; + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HHelpCode = list[0].HHelpCode; + string HShortNumber = list[0].HShortNumber; + long HParentID = list[0].HParentID; + long HLevel = list[0].HLevel; + bool HEndFlag = list[0].HEndFlag; + bool HStopflag = list[0].HStopflag; + string HRemark = list[0].HRemark; + string HBarCode = list[0].HBarCode; + long HEmpID = list[0].HEmpID; + string HAddress = list[0].HAddress; + string HPhone = list[0].HPhone; + long HUSEORGID = list[0].HUSEORGID; + string HUpDater = list[0].HUpDater; + + //鍒ゆ柇鏉冮檺 + if (!ClsPub.Security_Log(msg5, 1, true, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (oDept.HavSameNumber(HItemID, HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜閲嶅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Update Gy_Warehouse set " + + " HNumber='" + HNumber + "'" + + ",HName='" + HName + "'" + + ",HShortNumber='" + HShortNumber + "'" + + ",HHelpCode='" + HHelpCode + "'" + + ",HLevel=" + HLevel.ToString() + + ",HParentID=" + HParentID.ToString() + + ",HEndflag=" + Convert.ToString(HEndFlag ? 1 : 0) + + ",HStopflag=" + Convert.ToString(HStopflag ? 1 : 0) + + ",HEmpID=" + HEmpID.ToString() + + ",HAddress='" + HAddress + "'" + + ",HPhone='" + HPhone + "'" + + ",HUpdater='" + HUpDater + "'" + + ",HUpdateDate= getdate()" + + ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Warehouse,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); + //灏嗕笂绾� 涓洪潪鏈骇 + oCN.RunProc("Update Gy_Warehouse set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + // + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇敼鍗曟嵁鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + + + + + } } \ No newline at end of file diff --git a/WebAPI/Controllers/BaseSet/Gy_WorkCenterController.cs b/WebAPI/Controllers/BaseSet/Gy_WorkCenterController.cs index 10ab692..67d491b 100644 --- a/WebAPI/Controllers/BaseSet/Gy_WorkCenterController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_WorkCenterController.cs @@ -1,4 +1,5 @@ -锘縰sing Newtonsoft.Json.Linq; +锘縰sing Model; +using Newtonsoft.Json.Linq; using Pub_Class; using System; using System.Collections; @@ -23,7 +24,7 @@ ///鍙傛暟锛歴tring sql銆� ///杩斿洖鍊硷細object銆� /// </summary> - [Route("Gy_WorkCenter/list1")] + [Route("Gy_WorkCenter/list")] [HttpGet] public object list(string sWhere) { @@ -31,13 +32,13 @@ { if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_Gy_WorkCenterList " + sWhere, "h_v_Gy_WorkCenterList"); + ds = oCN.RunProcReturn("select * from h_v_WorkCenterList " + sWhere, "h_v_WorkCenterList"); } else { - string sql1 = "select * from h_v_Gy_WorkCenterList where 1 = 1 "; + string sql1 = "select * from h_v_WorkCenterList where 1 = 1 "; string sql = sql1 + sWhere; - ds = oCN.RunProcReturn(sql, "h_v_Gy_WorkCenterList"); + ds = oCN.RunProcReturn(sql, "h_v_WorkCenterList"); } if (ds == null || ds.Tables[0].Rows.Count == 0) { @@ -66,6 +67,45 @@ } } + /// <summary> + /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_WorkCenter/cx")] + [HttpGet] + public object cx(long HInterID) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_WorkCenterList where HitemID=" + HInterID, "h_v_WorkCenterList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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; + } + } [Route("Gy_WorkCenter/LoadTree")] [HttpGet] @@ -93,8 +133,289 @@ } + /// <summary> + /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_WorkCenter/AddBill")] + [HttpPost] + public object AddBill([FromBody] JObject oMain) + { + try + { + var _value = oMain["oMain"].ToString(); + string msg1 = _value.ToString(); + //鍙嶅簭鍒楀寲 + msg1 = "[" + msg1.ToString() + "]"; + DAL.ClsGy_WorkCenter_Ctl oDept = new DAL.ClsGy_WorkCenter_Ctl(); + List<Gy_WorkCenter> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_WorkCenter>>(msg1); + long HItemID = list[0].HItemID.ToString() == "" ? 0 : list[0].HItemID; + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HShortNumber; + long HParentID = list[0].HParentID; + string HHelpCode = list[0].HHelpCode; + string HRemark = list[0].HRemark; + string HStopflag = list[0].HStopflag=="True"?"1":"0"; + string HUseFlag = list[0].HUseFlag; + var HWorkTimes = list[0].HWorkTimes; + var HQty = list[0].HQty; + var HBarCodeForBase = list[0].HBarCodeForBase; + var HDayMoney = list[0].HDayMoney; + var HDeptID = list[0].HDeptID; + var HDeptNumber = ""; + var HEndFlag = 0; + var HLevel = ""; + var HProcID = ""; + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + string sql = "Insert into Gy_WorkCenter " + + " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HDeptNumber,HWorkTimes,HQty" + + ",HLevel,HEndFlag,HStopflag,HRemark,HDeptID,HBarCodeForBase" + + ",HProcID,HDayMoney) " + + " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HItemID.ToString() + + ",'" + HDeptNumber + "'," + HWorkTimes + "," + HQty + + ",'" + HLevel.ToString() + "'," + HEndFlag + "," + HStopflag + + ",'" + HRemark + "'," + HDeptID + ",'" + HBarCodeForBase + "','" + HProcID + "'," + HDayMoney + ")"; + oCN.RunProc(sql, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + if (list[0].HItemID.ToString() != "") + { + oCN.RunProc("Update Gy_WorkCenter set HEndflag=0 where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + } + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏂板鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + /// <summary> + /// 淇敼鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_WorkCenter/EditBill")] + [HttpPost] + public object EditBill([FromBody] JObject oMain) + { + try + { + DAL.ClsGy_WorkCenter_Ctl oDept = new DAL.ClsGy_WorkCenter_Ctl(); + var _value = oMain["oMain"].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 msg5 = sArray[3].ToString(); + //鍙嶅簭鍒楀寲 + msg2 = "[" + msg2.ToString() + "]"; + List<Gy_WorkCenter> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_WorkCenter>>(msg2); + long HItemID = int.Parse(msg3); + string HNumber = list[0].HNumber; + string HName = list[0].HName; + string HShortNumber = list[0].HNumber; + long HParentID = list[0].HParentID.ToString() == "" ? 0 : list[0].HParentID; + string HHelpCode = list[0].HHelpCode; + string HRemark = list[0].HRemark; + string HStopflag = list[0].HStopflag; + string HUseFlag = list[0].HUseFlag; + var HQty = list[0].HQty; + var HBarCodeForBase = list[0].HBarCodeForBase; + var HDayMoney = list[0].HDayMoney; + var HDeptID = list[0].HDeptID; + var HWorkTimes = list[0].HWorkTimes; + //鍒ゆ柇鏉冮檺 + if (!ClsPub.Security_Log(msg5, 1, true, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (!DBUtility.ClsPub.AllowNumber(HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (oDept.HavSameNumber(HItemID, HNumber)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浠g爜閲嶅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCN.BeginTran(); + //涓昏〃 + oCN.RunProc("Update Gy_WorkCenter set " + + " HNumber='" + HNumber + "'" + + ",HName='" + HName + "'" + + ",HShortNumber='" + HShortNumber + "'" + + ",HHelpCode='" + HHelpCode + "'" + + ",HParentID=" + HParentID + + ",HStopflag='" + HStopflag + "'" + + ",HRemark= '" + HRemark + "'"+ + ",HDeptID=" + HDeptID + + ",HQty=" + HQty + + ",HWorkTimes=" + HWorkTimes + + ",HBarCodeForBase='" + HBarCodeForBase + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_WorkCenter,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); + //灏嗕笂绾� 涓洪潪鏈骇 + oCN.RunProc("Update Gy_WorkCenter set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + // + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "淇敼鍗曟嵁鎴愬姛锛�"; + //objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + /// <summary> + /// 缁翠慨鍒楄〃淇敼鎸夐挳鏂规硶 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_WorkCenter/xg")] + [HttpGet] + public object xg(long HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from Gy_WorkCenter where HItemID=" + HInterID, "Gy_WorkCenter"); - // + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ""; + 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> + /// 缁翠慨鏂瑰紡鍒楄〃鍒犻櫎鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Gy_WorkCenter/Delete_Json")] + [HttpGet] + public object Delete_Json(long HItemID, string User, string ModRightNameDelete) + { + DAL.ClsGy_WorkCenter_Ctl oDept = new DAL.ClsGy_WorkCenter_Ctl(); + DAL.ClsGy_WorkCenter_View oDeptHlp = new DAL.ClsGy_WorkCenter_View(); + try + { + if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, User)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鍒犻櫎鏉冮檺"; + objJsonResult.data = null; + return objJsonResult; + } + if (oDeptHlp.GetInfoByID(HItemID)) + { + if (oDept.HavChildCodes(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩瓨鍦ㄥ瓙椤圭洰,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //鍒犻櫎鍓嶅垽鏂槸鍚� 宸蹭娇鐢� 20141020 + if (oDeptHlp.omodel.HUseFlag != "鏈娇鐢�") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩凡浣跨敤鎴栬�呮湭妫�娴嬶紝涓嶈兘鍒犻櫎锛佽閲嶆柊妫�娴嬪啀鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + // + if (oDept.DeleteByID(HItemID)) + { + //鍐欏叆鏃ュ織 + ClsPub.Add_Log("", "鍒犻櫎椤圭洰锛屼唬鐮侊細" + oDeptHlp.omodel.HNumber + ",鍚嶇О锛�" + oDeptHlp.omodel.HName, ClsPub.CurUserName); + //鏇存柊涓婄骇涓� 鏈骇 + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触"; + objJsonResult.data = null; + return objJsonResult; + } + } + //ds = oCN.RunProcReturn("delete from Gy_Department where HItemID = " + HItemID, "Gy_Department"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } } } \ No newline at end of file diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs index b3e79bb..5caf37a 100644 --- a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs +++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs @@ -139,7 +139,7 @@ //濮斿宸ュ簭鍙戝嚭鍙嶅簭鍒楀寲 msg1 = "[" + msg1.ToString() + "]"; List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg1); - + string eventType = list[0].eventType; long HInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D int HYear = 2021; double HPeriod = list[0].HPeriod;//鍗曚环 @@ -148,8 +148,8 @@ string HInnerBillNo = list[0].HInnerBillNo;//閫佽揣鍗曞彿 string HICMOBillNo = list[0].HICMOBillNo;//鐢熶骇璁㈠崟鍙� long HICMOInterID = list[0].HICMOInterID;//鐢熶骇璁㈠崟鍙稩D - int HProcExchInterID = 0; - int HProcExchEntryID = 0; + long HProcExchInterID = list[0].lngBillKey; + long HProcExchEntryID = list[0].lngBillSubKey; string HProcExchBillNo = list[0].HProcExchBillNo;//娴佽浆鍗� long HProcID = list[0].HProcID;//褰撳墠宸ュ簭 long HMaterID = list[0].HMaterID;//浜у搧ID @@ -167,7 +167,7 @@ double HMoney = list[0].HMoney;//閲戦 string HRemark = list[0].HRemark;//澶囨敞 double HTaxRate = list[0].HTaxRate;//绋庣巼 - string HProcNo = list[0].HProcNo;//娴佹按鍙� + long HProcNo = list[0].HProcNo;//娴佹按鍙� string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙� int HWWWorkOrderInterID = 0;//濮斿宸ュ崟鍙峰瓙鍐呯爜 int HWWWorkOrderEntryID = 0;//濮斿宸ュ崟鍙蜂富鍐呭悧 @@ -180,27 +180,137 @@ string HBarCode = list[0].HBarCode;//鏉″舰鐮� string HAddr = ""; string HBarCodeMaker = ""; - + if (HProcExchInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佽浆鍗℃病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcExchEntryID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佹按鍙�2娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcNo <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佹按鍙锋病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcExchBillNo == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佽浆鍗″彿娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HMaterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浜у搧娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HSupID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "渚涘簲鍟嗘病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "褰撳墠宸ュ簭娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HQty <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙戝嚭鏁伴噺涓嶈兘涓�0锛�"; + objJsonResult.data = null; + return objJsonResult; + } //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� oCN.BeginTran(); - //涓昏〃 - oCN.RunProc("Insert Into Sc_StationInBillMain " + - "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + - ",HYear,HPeriod,HRemark,HInnerBillNo" + - ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + - ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationInTime,HSourceID" + - ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + - ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPieceQty" + - ",HProcNo,HOrderProcNO,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID" + - ") " + - " values('3792','3792'," + HInterID.ToString() + ",'" + HBillNo + "','" + HBillStatus.ToString() + "',getdate(),'" + HMaker + "',getdate()" + - ",'" + HYear.ToString() + "','" + HPeriod.ToString() + "','" + HRemark + "','" + HInnerBillNo + "'" + - "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + - ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID + - "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + - "," + HSupID + "," + HTaxRate + "," + HQty + "," + HPrice + "," + HMoney + "," + HPieceQty + - ",'" + HProcNo + "','" + HOrderProcNO + "'" + ",'" + HWWWorkOrderBillNo + "'" + "," + HWWWorkOrderInterID + "" + "," + HWWWorkOrderEntryID + "" + - ") "); + if ("Add".Equals(eventType)) + { + if (!AllowbillNo(HBillNo)) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒"; + objJsonResult.data = null; + return objJsonResult; + } + //涓昏〃 + oCN.RunProc("Insert Into Sc_StationInBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark,HInnerBillNo" + + ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + + ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationInTime,HSourceID" + + ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + + ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPieceQty" + + ",HProcNo,HOrderProcNO,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID" + + ") " + + " values('3792','3792'," + HInterID.ToString() + ",'" + HBillNo + "','" + HBillStatus.ToString() + "',getdate(),'" + HMaker + "',getdate()" + + ",'" + HYear.ToString() + "','" + HPeriod.ToString() + "','" + HRemark + "','" + HInnerBillNo + "'" + + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + + ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID + + "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + + "," + HSupID + "," + HTaxRate + "," + HQty + "," + HPrice + "," + HMoney + "," + HPieceQty + + ",'" + HProcNo + "','" + HOrderProcNO + "'" + ",'" + HWWWorkOrderBillNo + "'" + "," + HWWWorkOrderInterID + "" + "," + HWWWorkOrderEntryID + "" + + ") "); + } + else if ("Modify".Equals(eventType)) + { + + //鍒犻櫎鍏宠仈 + oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_In " + HInterID + ",-1"); + oCN.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_In " + HInterID + ",-1"); + + //鏇存柊涓昏〃 + oCN.RunProc("UpDate Sc_StationInBillMain set " + + "HBillNo='" + HBillNo + "'" + + ",HRemark='" + HRemark + "'" + + ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + + ",HUpDateDate=getdate()" + + ",HInnerBillNo='" + HInnerBillNo + "'" + + ",HSupID=" + HSupID + + ",HQty=" + HQty + + ",HPieceQty=" + HPieceQty + + ",HPrice=" + HPrice + + ",HMoney=" + HMoney + + ",HTaxRate=" + HTaxRate + + ",HMaterID=" + HMaterID + + ",HProcID=" + HProcID + + ",HProcNo=" + HProcNo + + ",HOrderProcNO='" + HOrderProcNO + "'" + + " where HInterID=" + HInterID); + } + else + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎿嶄綔绫诲瀷鏃犳晥锛�"; + objJsonResult.data = null; + return objJsonResult; + } ds = oCN.RunProcReturn("exec h_p_MES_StationInBill_QtyCtrl " + HInterID + "", "h_p_MES_StationInBill_QtyCtrl"); if (ds == null) { @@ -240,7 +350,6 @@ } catch (Exception e) { - oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception锛�" + e.Message; @@ -248,5 +357,59 @@ return objJsonResult; } } + + private bool AllowbillNo(string HBillNo) + { + ds = oCN.RunProcReturn("select HBillNo from Sc_StationInBillMain where HBillNo = '" + HBillNo + "'", "Sc_StationInBillMain"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + return true; + } + return false; + } + + /// <summary> + /// 缂栬緫椤甸潰鏍规嵁id鑾峰彇濮斿宸ュ簭鎺ユ敹鍗曚俊鎭� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Cj_StationEntrustInBill/GetStationEntrustInBill")] + [HttpGet] + public object GetStationEntrustInBill(int HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from h_v_GetStationInBill where HInterID = " + HInterID, "h_v_GetStationOutBill"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "濮斿宸ュ簭鎺ユ敹鍗曚俊鎭幏鍙栧け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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; + } + } + + + + + // } } \ No newline at end of file diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs index 7274261..5c82b3c 100644 --- a/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs +++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustOutBillController.cs @@ -84,7 +84,7 @@ //閮ㄩ棬鍩虹璧勬枡鍙嶅簭鍒楀寲 msg1 = "[" + msg1.ToString() + "]"; List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg1); - + string eventType = list[0].eventType; long HInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D int HYear = 2021; double HPeriod = list[0].HPeriod;//鍗曚环 @@ -93,8 +93,8 @@ string HInnerBillNo = list[0].HInnerBillNo;//閫佽揣鍗曞彿 string HICMOBillNo = list[0].HICMOBillNo;//鐢熶骇璁㈠崟鍙� long HICMOInterID = list[0].HICMOInterID;//鐢熶骇璁㈠崟鍙稩D - int HProcExchInterID = 0; - int HProcExchEntryID = 0; + long HProcExchInterID = list[0].lngBillKey; + long HProcExchEntryID = list[0].lngBillSubKey; string HProcExchBillNo = list[0].HProcExchBillNo;//娴佽浆鍗� long HProcID = list[0].HProcID;//褰撳墠宸ュ簭 long HMaterID = list[0].HMaterID;//浜у搧ID @@ -111,7 +111,7 @@ double HMoney = list[0].HMoney;//閲戦 string HRemark = list[0].HRemark;//澶囨敞 double HTaxRate = list[0].HTaxRate;//绋庣巼 - string HProcNo = list[0].HProcNo;//娴佹按鍙� + long HProcNo = list[0].HProcNo;//娴佹按鍙� string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙� int HWWWorkOrderInterID = 0;//濮斿宸ュ崟鍙峰瓙鍐呯爜 int HWWWorkOrderEntryID = 0;//濮斿宸ュ崟鍙蜂富鍐呭悧 @@ -136,27 +136,162 @@ double HMainSourceInterID = 0; string HMainSourceBillNo = ""; string HMainSourceBillType = "3792"; - + if (HProcExchInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佽浆鍗℃病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcExchEntryID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佹按鍙�2娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcNo <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佹按鍙锋病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcExchBillNo == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佽浆鍗″彿娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HInnerBillNo == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙戣揣鍙锋病鏈夎緭鍏ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "褰撳墠宸ュ簭娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HMaterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浜у搧娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HSupID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "渚涘簲鍟嗘病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HQty <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎺ユ敹涓暟涓嶈兘灏忎簬绛変簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HWasterQty < 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "涓嶅悎鏍兼暟涓嶈兘灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HTaxRate < 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绋庣巼涓嶈兘涓鸿礋锛�"; + objJsonResult.data = null; + return objJsonResult; + } //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� oCN.BeginTran(); - //涓昏〃 - oCN.RunProc("Insert Into Sc_StationOutBillMain " + - "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + - ",HYear,HPeriod,HRemark,HInnerBillNo,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" + - ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + - ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID" + - ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + - ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPrice_BHS,HMoney_BHS,HBadCount" + - ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HProcNo,HOrderProcNO,HLastSubProc,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID" + - ") " + - " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" + - "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HInnerBillNo + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + - "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + - ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID + - "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + - "," + HSupID + "," + HTaxRate + "," + HQty + "," + HPrice + "," + HMoney + "," + HPrice_BHS + "," + HMoney_BHS + "," + HBadCount + - "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + HProcNo + ",'" + HOrderProcNO + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + ",'" + HWWWorkOrderBillNo + "'," + HWWWorkOrderInterID + "," + HWWWorkOrderEntryID + - ") "); + if ("Add".Equals(eventType)) + { + if (!AllowbillNo(HBillNo)) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒"; + objJsonResult.data = null; + return objJsonResult; + } + //涓昏〃 + oCN.RunProc("Insert Into Sc_StationOutBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark,HInnerBillNo,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" + + ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + + ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID" + + ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + + ",HSupID,HTaxRate,HQty,HPrice,HMoney,HPrice_BHS,HMoney_BHS,HBadCount" + + ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HProcNo,HOrderProcNO,HLastSubProc,HWWWorkOrderBillNo,HWWWorkOrderInterID,HWWWorkOrderEntryID" + + ") " + + " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" + + "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HInnerBillNo + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + + ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID + + "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + + "," + HSupID + "," + HTaxRate + "," + HQty + "," + HPrice + "," + HMoney + "," + HPrice_BHS + "," + HMoney_BHS + "," + HBadCount + + "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + HProcNo + ",'" + HOrderProcNO + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + ",'" + HWWWorkOrderBillNo + "'," + HWWWorkOrderInterID + "," + HWWWorkOrderEntryID + + ") "); + } + else if ("Modify".Equals(eventType)) + { + oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID + ",-1"); + oCN.RunProc("exec h_p_WW_EntrustWorkOrderRelationQty_Out " + HInterID + ",-1"); + //鏇存柊涓昏〃 + oCN.RunProc("UpDate Sc_StationOutBillMain set " + + " HBillNo='" + HBillNo + "'" + + ",HRemark='" + HRemark + "'" + + ",HUpDater='" + HMaker + "'" + + ",HUpDateDate=getdate()" + + ",HInnerBillNo='" + HInnerBillNo + "'" + + ",HSupID=" + HSupID + + ",HQty=" + HQty + + ",HPieceQty=" + HPieceQty + + ",HPrice=" + HPrice + + ",HMoney=" + HMoney + + ",HProcNo=" + HProcNo + + ",HPrice_BHS=" + HPrice_BHS + + ",HMoney_BHS=" + HMoney_BHS + + ",HTaxRate=" + HTaxRate + + ",HOrderProcNO='" + HOrderProcNO + "'" + + ",HMaterID=" + HMaterID + + ",HProcID=" + HProcID + + ",HBadPNL=" + HBadPNL + + ",HWasterQty=" + HWasterQty + + " where HInterID=" + HInterID); + } + else + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎿嶄綔绫诲瀷鏃犳晥锛�"; + objJsonResult.data = null; + return objJsonResult; + } ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_QtyCtrl " + HInterID + "", "h_p_MES_StationOutBill_QtyCtrl"); if (ds == null) { @@ -196,7 +331,6 @@ } catch (Exception e) { - oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception锛�" + e.ToString(); @@ -204,7 +338,53 @@ return objJsonResult; } } - + private bool AllowbillNo(string HBillNo) + { + ds = oCN.RunProcReturn("select HBillNo from Sc_StationOutBillMain where HBillNo = '" + HBillNo + "'", "Sc_StationOutBillMain"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + return true; + } + return false; + } + /// <summary> + /// 缂栬緫椤甸潰鏍规嵁id鑾峰彇濮斿宸ュ簭鎺ユ敹鍗曚俊鎭� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Cj_StationEntrustOutBill/GetStationEntrustOutBill")] + [HttpGet] + public object GetStationEntrustOutBill(int HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from h_v_GetStationOutBill where HInterID = " + HInterID, "h_v_GetStationOutBill"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "濮斿宸ュ簭鎺ユ敹鍗曚俊鎭幏鍙栧け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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; + } + } // } diff --git a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs index 761dd47..c461134 100644 --- a/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs +++ b/WebAPI/Controllers/CJGL/Cj_StationInBillController.cs @@ -21,6 +21,130 @@ DataSet ds1; + ///// <summary> + ///// test + /////鍙傛暟锛歴tring sql銆� + /////杩斿洖鍊硷細object銆� + ///// </summary> + //[Route("Cj_StationInBill/AddBill")] + //[HttpPost] + //public object AddBill([FromBody] JObject oMain) + //{ + // var _value = oMain["oMain"].ToString(); + // string msg1 = _value.ToString(); + // try + // { + // //濮斿宸ュ簭鍙戝嚭鍙嶅簭鍒楀寲 + // msg1 = "[" + msg1.ToString() + "]"; + // List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg1); + // string BillType = "3790"; + // long HInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D + // string HBillNo = list[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿 + // int HBillStatus = 0; + // string HMaker = list[0].HMaker;//鍒跺崟浜� + // int HYear = 2021; + // long HPeriod = 1; + // string HRemark = list[0].HRemark;//澶囨敞 + // long HICMOInterID = list[0].HICMOInterID;//浠诲姟鍗旾D + // string HICMOBillNo = list[0].HICMOBillNo;//浠诲姟鍗� + // int HProcPlanInterID = 0; + // int HProcPlanEntryID = 0; + // string HProcPlanBillNo = ""; + // int HProcExchInterID = 0; + // int HProcExchEntryID = 0; + // string HProcExchBillNo = list[0].HProcExchBillNo;//娴佽浆鍗� + // long HMaterID = list[0].HMaterID;//浜у搧ID + // long HProcID = list[0].HProcID;//褰撳墠宸ュ簭 + // double HICMOQty = list[0].HICMOQty;//浠诲姟鍗曟暟閲� + // double HPlanQty = list[0].HPlanQty;//娴佽浆鍗℃暟閲� + // long HSourceID = list[0].HSourceID;//鐢熶骇璧勬簮ID + // long HGroupID = list[0].HGroupID;//鐝粍ID + // long HDeptID = 0; + // long HEmpID = list[0].HEmpID;//鎺ユ敹浜篒D + // string HBarCode = list[0].HBarCode;//鏉″舰鐮� + // string HAddr = ""; + // string HBarCodeMaker = ""; + // long HSupID = 0; + // double HQty = list[0].HQty;//鎺ユ敹鏁伴噺 + // double HPrice = 0; + // double HMoney = 0; + // double HPieceQty = list[0].HPieceQty;//鎺ユ敹浠舵暟 + // string HSourceName = list[0].HSourceName;//鐢熶骇璧勬簮鍚嶇О + // long HCenterID = list[0].HCenterID;//宸ヤ綔涓績ID + // long HProcNo = list[0].HProcNo;//娴佹按鍙� + // string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙� + + // ListModels oListModels = new ListModels(); + + // DAL.ClsSc_StationInBill BillNew = new DAL.ClsSc_StationInBill(); + + // BillNew.omodel.HInterID = HInterID; + // BillNew.omodel.HYear = HYear; + // BillNew.omodel.HPeriod = HPeriod; + // BillNew.omodel.HBillNo = HBillNo; + // BillNew.omodel.HICMOBillNo = HICMOBillNo; + // BillNew.omodel.HICMOInterID = HICMOInterID; + // BillNew.omodel.HProcExchInterID = HProcExchInterID; + // BillNew.omodel.HProcExchEntryID = HProcExchEntryID; + // BillNew.omodel.HProcExchBillNo = HProcExchBillNo; + // BillNew.omodel.HProcID = HProcID; + // BillNew.omodel.HMaterID = HMaterID; + // BillNew.omodel.HStationInTime = DateTime.Now; + // BillNew.omodel.HEmpID = HEmpID; + // BillNew.omodel.HSourceID = HSourceID; + // BillNew.omodel.HGroupID = HGroupID; + // BillNew.omodel.HICMOQty = HICMOQty; + // BillNew.omodel.HPlanQty = HPlanQty; + // BillNew.omodel.HQty = HQty; + // BillNew.omodel.HPieceQty = HPieceQty; + // BillNew.omodel.HSourceName = HSourceName; + // BillNew.omodel.HCenterID = HCenterID; + // BillNew.omodel.HBillStatus = HBillStatus; + // BillNew.omodel.HMaker = HMaker; + // BillNew.omodel.HRemark = HRemark; + // BillNew.omodel.HProcPlanInterID = HProcPlanInterID; + // BillNew.omodel.HProcPlanEntryID = HProcPlanEntryID; + // BillNew.omodel.HProcPlanBillNo = HProcPlanBillNo; + // BillNew.omodel.HDeptID = HDeptID; + // BillNew.omodel.HBarCode = HBarCode; + // BillNew.omodel.HAddr = HAddr; + // BillNew.omodel.HBarCodeMaker = HBarCodeMaker; + // BillNew.omodel.HSupID = HSupID; + // BillNew.omodel.HPrice = HPrice; + // BillNew.omodel.HMoney = HMoney; + + // BillNew.omodel.HProcNo = HProcNo; + // BillNew.omodel.HOrderProcNO = HOrderProcNO; + // bool bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo); + + // //鎻愮ず + // if (bResult == true) + // { + // objJsonResult.code = "1"; + // objJsonResult.count = 1; + // objJsonResult.Message = "鍗曟嵁瀛樼洏瀹屾瘯!鍗曟嵁鍙�:" + HBillNo.Trim(); + // objJsonResult.data = null; + // return objJsonResult; + // } + // else + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + // objJsonResult.data = null; + // return objJsonResult; + // } + // } + // catch (Exception e) + // { + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "Exception锛�" + e.ToString(); + // objJsonResult.data = null; + // return objJsonResult; + // } + //} + /// <summary> /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 @@ -38,6 +162,43 @@ //濮斿宸ュ簭鍙戝嚭鍙嶅簭鍒楀寲 msg1 = "[" + msg1.ToString() + "]"; List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg1); + long HProcExchInterID = list[0].lngBillKey;//娴佽浆鍗′富鍐呯爜 + if (HProcExchInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "閿欒鐨勬祦杞崱鍐呯爜锛�"; + objJsonResult.data = null; + return objJsonResult; + } + long HProcExchEntryID = list[0].lngBillSubKey;//娴佽浆鍗″瓙鍐呯爜 + if (HProcExchEntryID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佹按鍙锋病鏈夐�夋嫨锛佽杈撳叆娴佹按鍙峰悗鍥炶溅锛�"; + objJsonResult.data = null; + return objJsonResult; + } + long HProcNo = list[0].HProcNo;//娴佹按鍙� + if (HProcNo <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佹按鍙锋病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + string HProcExchBillNo = list[0].HProcExchBillNo;//娴佽浆鍗� + if (HProcExchBillNo == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佽浆鍗″彿娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + string eventType = list[0].eventType; string BillType = "3790"; long HInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D string HBillNo = list[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿 @@ -48,12 +209,9 @@ string HRemark = list[0].HRemark;//澶囨敞 long HICMOInterID = list[0].HICMOInterID;//浠诲姟鍗旾D string HICMOBillNo = list[0].HICMOBillNo;//浠诲姟鍗� - int HProcPlanInterID = 0; - int HProcPlanEntryID = 0; + long HProcPlanInterID = 0; + long HProcPlanEntryID = 0; string HProcPlanBillNo = ""; - int HProcExchInterID = 0; - int HProcExchEntryID = 0; - string HProcExchBillNo = list[0].HProcExchBillNo;//娴佽浆鍗� long HMaterID = list[0].HMaterID;//浜у搧ID long HProcID = list[0].HProcID;//褰撳墠宸ュ簭 double HICMOQty = list[0].HICMOQty;//浠诲姟鍗曟暟閲� @@ -72,28 +230,140 @@ double HPieceQty = list[0].HPieceQty;//鎺ユ敹浠舵暟 string HSourceName = list[0].HSourceName;//鐢熶骇璧勬簮鍚嶇О long HCenterID = list[0].HCenterID;//宸ヤ綔涓績ID - string HProcNo = list[0].HProcNo;//娴佹按鍙� string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙� + //鍗曟嵁瀹屾暣鎬у垽鏂� + if (HMaterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浜у搧娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HSourceID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "宸ヤ綔涓績娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "褰撳墠宸ュ簭娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HQty <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎺ユ敹涓暟涓嶈兘涓�0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + ds = oCN.RunProcReturn("select HInterID from Sc_ProcessExchangeBillSub Where hinterid=" + HProcExchInterID + " and hprocno<" + HProcNo + " order by hprocno", "Sc_ProcessExchangeBillSub"); + if (ds == null) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒ゆ柇棣栭亾宸ュ簭澶辫触锛屼笉鍏佽淇濆瓨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� oCN.BeginTran(); - //涓昏〃 - oCN.RunProc("Insert Into Sc_StationInBillMain " + - "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + - ",HYear,HPeriod,HRemark" + - ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + - ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationInTime,HSourceID" + - ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + - ",HSupID,HQty,HPrice,HMoney,HPieceQty,HSourceName,HCenterID" + - ",HProcNo,HOrderProcNO" + - ") " + - " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" + - "," + HYear + "," + HPeriod + ",'" + HRemark + "'" + - "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + - ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID + - "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + - "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HPieceQty + ",'" + HSourceName + "'," + HCenterID + - ",'" + HProcNo + "','" + HOrderProcNO + "'" + - ") "); + + if ("Add".Equals(eventType)) + { + if (!AllowbillNo(HBillNo)) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒"; + objJsonResult.data = null; + return objJsonResult; + } + //鎻掑叆涓昏〃 + oCN.RunProc("Insert Into Sc_StationInBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark" + + ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + + ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationInTime,HSourceID" + + ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + + ",HSupID,HQty,HPrice,HMoney,HPieceQty,HSourceName,HCenterID" + + ",HProcNo,HOrderProcNO" + + ") " + + " values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate()" + + "," + HYear + "," + HPeriod + ",'" + HRemark + "'" + + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + + ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID + + "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + + "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HPieceQty + ",'" + HSourceName + "'," + HCenterID + + ",'" + HProcNo + "','" + HOrderProcNO + "'" + + ") "); + } + else if ("Modify".Equals(eventType)) + { + oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_In " + HProcExchInterID + ",-1"); + //鏇存柊涓昏〃 + oCN.RunProc("UpDate Sc_StationInBillMain set " + + " HBillNo='" + HBillNo + "'" + + ",HYear='" + HYear + "'" + + ",HPeriod='" + HPeriod + "'" + + ",HBillStatus='" + HBillStatus + "'" + + ",HRemark='" + HRemark + "'" + + ",HUpDater='" + HMaker + "'" + + ",HUpDateDate=getdate()" + + ",HSupID=" + HSupID + + ",HQty=" + HQty + + ",HPieceQty=" + HPieceQty + + ",HSourceName='" + HSourceName + "'" + + ",HICMOInterID=" + HICMOInterID + + ",HICMOBillNo='" + HICMOBillNo + "'" + + ",HProcPlanInterID=" + HProcPlanInterID + + ",HProcPlanEntryID=" + HProcPlanEntryID + + ",HProcPlanBillNo='" + HProcPlanBillNo + "'" + + ",HProcExchInterID=" + HProcExchInterID + + ",HProcExchEntryID=" + HProcExchEntryID + + ",HProcExchBillNo='" + HProcExchBillNo + "'" + + ",HMaterID=" + HMaterID + + ",HProcID=" + HProcID + + ",HICMOQty=" + HICMOQty + + ",HPlanQty=" + HPlanQty + + ",HStationInTime=getdate()" + + ",HSourceID=" + HSourceID + + ",HGroupID=" + HGroupID + + ",HDeptID=" + HDeptID + + ",HEmpID=" + HEmpID + + ",HBarCode='" + HBarCode + "'" + + ",HSaveBillFlag=0 " + + ",HAddr='" + HAddr + "'" + + ",HBarCodeMaker='" + HBarCodeMaker + "'" + + ",HProcNo='" + HProcNo + "'" + + ",HOrderProcNO='" + HOrderProcNO + "'" + + " where HInterID=" + HInterID); + } + else + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎿嶄綔绫诲瀷鏃犳晥锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + + + + ds = oCN.RunProcReturn("exec h_p_MES_StationInBill_QtyCtrl " + HInterID + "", "h_p_MES_StationInBill_QtyCtrl"); if (ds == null) { @@ -129,10 +399,10 @@ " Where a.HInterID=" + HProcExchInterID + " and b.HEntryID=" + HProcExchEntryID + " ", "Sc_ProcessExchangeBillMain"); if (ds1 == null || ds1.Tables[0].Rows.Count == 0) { - + } else if (ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "鏄�") - { + { } oCN.Commit(); @@ -151,6 +421,15 @@ objJsonResult.data = null; return objJsonResult; } + } + private bool AllowbillNo(string HBillNo) + { + ds = oCN.RunProcReturn("select HBillNo from Sc_StationInBillMain where HBillNo = '" + HBillNo + "'", "Sc_StationInBillMain"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + return true; + } + return false; } /// <summary> @@ -249,6 +528,47 @@ } } + /// <summary> + /// 缂栬緫椤甸潰鏍规嵁id鑾峰彇宸ュ簭杩涚珯鎺ユ敹鍗曚俊鎭� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Cj_StationInBill/GetStationInBill")] + [HttpGet] + public object GetStationOutBill(int HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from h_v_GetStationInBill where HInterID = " + HInterID, "h_v_GetStationInBill"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "宸ュ簭杩涚珯鎺ユ敹鍗曚俊鎭幏鍙栧け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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; + } + } + + + // } diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs index 0b119b7..a8f4959 100644 --- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs +++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs @@ -5,6 +5,8 @@ using System.Collections.Generic; using System.Data; using System.Data.SqlClient; +using System.IO; +using System.Web; using System.Web.Http; using WebAPI.Models; @@ -19,8 +21,7 @@ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; DataSet ds1; - - + string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"]; /// <summary> /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 @@ -38,7 +39,7 @@ //鍙嶅簭鍒楀寲 msg1 = "[" + msg1.ToString() + "]"; List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg1); - + string eventType = list[0].eventType; string BillType = "3791"; string HBillSubType = "3791"; long HInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D @@ -85,7 +86,7 @@ double HMoney = 0; double HBadCount = list[0].HBadCount;//涓嶈壇鏁伴噺 long HCenterID = list[0].HCenterID;//宸ヤ綔涓績ID - string HProcNo = list[0].HProcNo;//娴佹按鍙� + long HProcNo = list[0].HProcNo;//娴佹按鍙� string HOrderProcNO = list[0].HOrderProcNO;//璁㈠崟璺熻釜鍙� string HSourceNameList = list[0].HSourceNameList;//璁惧娓呭崟 long HMainSourceInterID = list[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D @@ -101,29 +102,219 @@ double HPriceRate = list[0].HPriceRate;//绯绘暟 double HWorkTimes = list[0].HWorkTimes;//宸ユ椂 long HQCCheckID = list[0].HQCCheckID;//妫�楠屽憳ID + //鍗曟嵁瀹屾暣鎬у垽鏂� + if (HProcExchInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佽浆鍗℃病鏈夐�夋嫨锛佽鎵弿鏉″舰鐮佹垨杈撳叆鏉″舰鐮佸悗鍥炶溅"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcExchEntryID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佹按鍙锋病鏈夐�夋嫨锛佽杈撳叆娴佹按鍙峰悗鍥炶溅"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcNo <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佹按鍙锋病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcExchBillNo == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佽浆鍗″彿娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HMaterID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浜у搧娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HGroupID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鐢熶骇鐝粍娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "褰撳墠宸ュ簭娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HEmpID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎿嶄綔鍛樻病鏈夐�夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HQCCheckID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "妫�楠屽憳娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HSourceID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鐢熶骇璧勬簮娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HCenterID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "宸ヤ綔涓績娌℃湁閫夋嫨锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HQty + HWasterQty <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍚堟牸鏁伴噺鍔犳姤搴熸暟閲忎笉鑳戒负0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HWorkTimes <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "宸ユ椂蹇呴』澶т簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //if (HEmpID2 == 0 ) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鎿嶄綔鍛�2娌℃湁閫夋嫨锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //if (HEmpID3 == 0 ) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鎿嶄綔鍛�3娌℃湁閫夋嫨锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //if (HEmpID4 == 0 ) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鎿嶄綔鍛�4娌℃湁閫夋嫨锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + //if (HEmpID5 == 0 ) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鎿嶄綔鍛�5娌℃湁閫夋嫨锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� oCN.BeginTran(); + if ("Add".Equals(eventType)) + { + if (!AllowbillNo(HBillNo)) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.RunProc("Insert Into Sc_StationOutBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate,HMouldNum" + + ",HYear,HPeriod,HRemark,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" + + ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + + ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID,HPayProcID" + + ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate,HSourceID2,HSourceID3,HSourceID4,HSourceID5" + + ",HSupID,HQty,HPrice,HMoney,HBadCount,HCenterID,HProcNo,HOrderProcNO,HSourceNameList" + + ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" + + ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID" + + ") " + + " values('" + BillType + "','" + HBillSubType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate(),'" + HMouldNum + "'" + + "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + + ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",'" + HStationOutTime + "'," + HSourceID + "," + HPayProcID + + "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + "," + HSourceID2 + "," + HSourceID3 + "," + HSourceID4 + "," + HSourceID5 + + "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HBadCount + "," + HCenterID + "," + HProcNo + ",'" + HOrderProcNO + "'" + ",'" + HSourceNameList + "'" + + "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + + "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + + ") "); + } + else if ("Modify".Equals(eventType)) + { + oCN.RunProc("UpDate Sc_StationOutBillMain set " + + "HUpDater='" + HMaker + "'" + + ",HUpDateDate=getdate()" + + ",HSourceName='" + HSourceName + "'" + + ",HRemark='" + HRemark + "'" + + ",HQCCheckID=" + HQCCheckID + + ",HEmpID=" + HEmpID + + ",HEmpID2=" + HEmpID2 + + ",HEmpID3=" + HEmpID3 + + ",HEmpID4=" + HEmpID4 + + ",HEmpID5=" + HEmpID5 + + ",HSourceID=" + HSourceID + + ",HSourceID2=" + HSourceID2 + + ",HSourceID3=" + HSourceID3 + + ",HSourceID4=" + HSourceID4 + + ",HSourceID5=" + HSourceID5 + + ",HPayProcID=" + HPayProcID + + ",HWorkTimes=" + HWorkTimes + + ",HSaveBillFlag=0 " + + ",HPieceQty=" + HPieceQty + + ",HQty=" + HQty + + ",HDSQty=" + HDSQty + + ",HChongQty=" + HChongQty + + ",HMouldNum='" + HMouldNum + "'" + + ",HSourceNameList='" + HSourceNameList + "'" + + ",HWasterQty=" + HWasterQty + + ",HLastSubProc=" + Convert.ToString(HLastSubProc ? 1 : 0) + + " where HInterID=" + HInterID); + } + else + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎿嶄綔绫诲瀷鏃犳晥锛�"; + objJsonResult.data = null; + return objJsonResult; + } //涓昏〃 - oCN.RunProc("Insert Into Sc_StationOutBillMain " + - "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate,HMouldNum" + - ",HYear,HPeriod,HRemark,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" + - ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + - ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID,HPayProcID" + - ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate,HSourceID2,HSourceID3,HSourceID4,HSourceID5" + - ",HSupID,HQty,HPrice,HMoney,HBadCount,HCenterID,HProcNo,HOrderProcNO,HSourceNameList" + - ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" + - ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID" + - ") " + - " values('" + BillType + "','" + HBillSubType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate(),'" + HMouldNum + "'" + - "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + - "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + - ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",'" + HStationOutTime + "'," + HSourceID + "," + HPayProcID + - "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + "," + HSourceID2 + "," + HSourceID3 + "," + HSourceID4 + "," + HSourceID5 + - "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HBadCount + "," + HCenterID + "," + HProcNo + ",'" + HOrderProcNO + "'" + ",'" + HSourceNameList + "'" + - "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + - "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + - ") "); + ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_QtyCtrl " + HInterID + "", "h_p_MES_StationOutBill_QtyCtrl"); if (ds == null) { @@ -161,10 +352,10 @@ " Where a.HInterID=" + HProcExchInterID + " and b.HEntryID=" + HProcExchEntryID + " ", "Sc_ProcessExchangeBillMain"); if (ds1 == null || ds1.Tables[0].Rows.Count == 0 || HLastSubProc == false) { - + } else if (ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HLastProc"]) == "鏄�") - { + { } oCN.Commit(); @@ -176,7 +367,6 @@ } catch (Exception e) { - oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception锛�" + e.ToString(); @@ -185,6 +375,15 @@ } } + private bool AllowbillNo(string HBillNo) + { + ds = oCN.RunProcReturn("select HBillNo from Sc_StationOutBillMain where HBillNo = '" + HBillNo + "'", "Sc_StationOutBillMain"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + return true; + } + return false; + } /// <summary> /// 杩斿洖宸ュ簭鍑虹珯姹囨姤鍗曞垪琛� @@ -234,7 +433,240 @@ } } + /// <summary> + /// 缂栬緫椤甸潰鏍规嵁id鑾峰彇宸ュ簭鍑虹珯姹囨姤鍗曚俊鎭� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Cj_StationOutBill/GetStationOutBill")] + [HttpGet] + public object GetStationOutBill(int HInterID) + { + try + { + ds = oCN.RunProcReturn("select * from h_v_GetStationOutBill where HInterID = " + HInterID, "h_v_GetStationOutBill"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "宸ュ簭鍑虹珯姹囨姤鍗曚俊鎭幏鍙栧け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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; + } + } - // + + #region 宸ュ簭鍑虹珯姹囨姤鍗曟枃浠朵笂浼犲鐞� + + [Route("Cj_StationOutBill/UploadFile1")] + [HttpPost] + public object UploadFile1() + { + + string HBillNo = HttpContext.Current.Request.Params["HBillNo"]; //鍗曟嵁鍙� + string HRemark = HttpContext.Current.Request.Params["HRemark"]; //澶囨敞 + string HUserName = HttpContext.Current.Request.Params["HUserName"]; //鍒涘缓浜� + HttpPostedFile files = HttpContext.Current.Request.Files["file"]; + string path = HttpContext.Current.Server.MapPath("~/../Files/" + HBillNo); + //string path = @"D:\\Files\\"+ HBillNo; + dynamic dyResult = UpLoadFile(files, path, HBillNo, HRemark, HUserName); + if (dyResult != null && dyResult.result == 1) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "涓婁紶鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "涓婁紶澶辫触锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + } + + public dynamic UpLoadFile(HttpPostedFile files, string path, string HBillNo, string HRemark, string HUserName) + { + dynamic Result_Ob = new { result = 1, returnval = "涓婁紶鎴愬姛锛�" }; + string filePath = Path.GetFullPath(files.FileName);//鏂囦欢涓婁紶璺緞 + string fileExtension = Path.GetExtension(files.FileName);// 鏂囦欢鎵╁睍鍚� + string filename = files.FileName;//鏂囦欢鍚� + string fileSavePath = path;// 涓婁紶淇濆瓨璺緞 + int filesize = files.ContentLength;//鑾峰彇涓婁紶鏂囦欢鐨勫ぇ灏忓崟浣嶄负瀛楄妭byte + int Maxsize = 40000 * 1024;//瀹氫箟涓婁紶鏂囦欢鐨勬渶澶х┖闂村ぇ灏忎负40M + try + { + if (files == null || files.ContentLength <= 0) + { + Result_Ob = new { result = 0, returnval = "鏂囦欢涓嶈兘涓虹┖!" }; + return Result_Ob; + } + if (filesize >= Maxsize) + { + Result_Ob = new { result = 0, returnval = "涓婁紶鏂囦欢瓒呰繃40M锛屼笉鑳戒笂浼狅紒" }; + return Result_Ob; + } + + string fileurl = Path.Combine(fileSavePath, filename); + if (Directory.Exists(fileurl) == true) //濡傛灉瀛樺湪閲嶅悕鏂囦欢灏辨彁绀� + { + Result_Ob = new { result = 0, returnval = "瀛樺湪鍚屽悕鏂囦欢锛�" }; + return Result_Ob; + } + //鍒犻櫎鏁版嵁琛ㄦ暟鎹� + ds = oCN.RunProcReturn("delete from MES_AccessoriesList where HSourceBillNo ='" + HBillNo + "' and HFileName='"+ filename + "'", "MES_AccessoriesList"); + if (Directory.Exists(path)) + { + File.Delete(fileurl); //鍒犻櫎鎸囧畾鏂囦欢 + files.SaveAs(fileurl); + string StrPath = "/files/"+ HBillNo+"/"+ filename; + if (File.Exists(fileurl)) + { + //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱 + //鍐欏叆鏁版嵁琛� + oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + + ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + + ",HFileClsID,HSourceBillNo" + + ") values('" + + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + + ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + + "','" + 0 + "','" + HBillNo + + "') "); + } + else + { + Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" }; + } + } + else + { + Directory.CreateDirectory(fileSavePath); //娣诲姞鏂囦欢澶� + files.SaveAs(fileurl); + string StrPath = "/files/" + HBillNo + "/" + filename; + if (File.Exists(fileurl)) + { + //杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱 + //鍐欏叆鏁版嵁琛� + oCN.RunProc("Insert into MES_AccessoriesList (HFileName,HFilePath,HFilePath_Cus,HFileType" + + ",HLoadMan,HLoadDate,HRemark,HVerNum,HFileSize" + + ",HFileClsID,HSourceBillNo" + + ") values('" + + filename.ToString() + "','" + StrPath.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + + ",'" + HUserName + "',getdate(),'" + HRemark + "','V1','" + filesize + + "','" + 0 + "','" + HBillNo + + "') "); + } + else + { + Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" }; + } + } + + } + catch(Exception e) + { + Result_Ob = new { result = 0, returnval = e.Message }; + } + return Result_Ob; + } + + /// <summary> + /// 杈撳嚭json缁撴灉 杩斿洖2涓�� result (杈撳嚭succes鐨勫��) returnval (杈撳嚭str鐨勫��) + /// </summary> + /// <param name="context"></param> + /// <param name="success">鏄惁鎿嶄綔鎴愬姛,0琛ㄧず澶辫触;1琛ㄧず鎴愬姛</param> + /// <param name="str">杈撳嚭瀛楃涓�</param> + protected void JsonResult(HttpContext context, int success, string str) + { + context.Response.Write("{\"result\" :\"" + success.ToString() + "\",\"returnval\" :\"" + str + "\"}"); + context.Response.End(); + } + + + /// <summary> + /// 鏍规嵁鍗曟嵁鍙锋煡鎵句笂浼犳枃浠跺垪琛� + /// </summary> + /// <param name="sWhere"></param> + /// <returns></returns> + [Route("Cj_StationOutBill/Filelist")] + [HttpGet] + public object Filelist(string HBillNo) + { + var url = fileip + "/files/" + HBillNo+"/"; + //@"C:\\files\\" + try + { + ds = oCN.RunProcReturn("select *,'" + url + "'+CAST(HFileName as varchar(200))as url from MES_AccessoriesList where HSourceBillNo='" + HBillNo+"'", "MES_AccessoriesList"); + 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> + /// 鏍规嵁ID,鍗曟嵁鍙�,鏂囦欢鍚� 鍒犻櫎鏂囦欢 + /// </summary> + /// <param name="sWhere"></param> + /// <returns></returns> + [Route("Cj_StationOutBill/DeleteFilelist")] + [HttpGet] + public object DeleteFilelist(string HItemID, string HSourceBillNo,string HFileName) + { + try + { + + oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID); + string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/" + HSourceBillNo), HFileName); + File.Delete(fileurl); //鍒犻櫎鎸囧畾鏂囦欢 + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + } } \ No newline at end of file diff --git a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs new file mode 100644 index 0000000..9e68093 --- /dev/null +++ b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs @@ -0,0 +1,303 @@ +锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Web.Http; +using WebAPI.Models; + +namespace WebAPI.Controllers +{ + //宸ュ簭娴佽浆鍗ontroller + public class Sc_ProcessExchangeBillController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + /// <summary> + /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Sc_ProcessExchangeBill/AddBill")] + [HttpPost] + public object AddBill([FromBody] JObject sMainSub) + { + var _value = sMainSub["sMainSub"].ToString(); + string msg1 = _value.ToString(); + //淇濆瓨鍗曟嵁 + return objJsonResult = AddBillMain(msg1); + } + + public json AddBillMain(string msg1) + { + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string msg3 = sArray[1].ToString(); + bool bResult; + try + { + msg2 = "[" + msg2.ToString() + "]"; + List<Model.ClsSc_ProcessExchangeBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_ProcessExchangeBillMain>>(msg2); + DAL.ClsSc_ProcessExchangeBill BillNew = new DAL.ClsSc_ProcessExchangeBill(); + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = mainList[0].HDate;//鏃ユ湡 + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + BillNew.omodel.HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D + BillNew.omodel.HYear = sYear; + BillNew.omodel.HPeriod = sPeriod; + BillNew.omodel.HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿 + BillNew.omodel.HDate = HDate; + BillNew.omodel.HRemark = mainList[0].HRemark;//澶囨敞 + BillNew.omodel.HMaker = mainList[0].HMaker; + BillNew.omodel.HWWOrderInterID = ClsPub.isLong(mainList[0].HWWOrderInterID); + BillNew.omodel.HWWOrderEntryID = ClsPub.isLong(mainList[0].HWWOrderEntryID); + BillNew.omodel.HWWOrderBillNo = ClsPub.isStrNull(mainList[0].HWWOrderBillNo); + BillNew.omodel.HICMOInterID = ClsPub.isLong(mainList[0].HICMOInterID); + BillNew.omodel.HICMOEntryID = ClsPub.isLong(mainList[0].HICMOEntryID); + BillNew.omodel.HICMOBillNo = ClsPub.isStrNull(mainList[0].HICMOBillNo); + BillNew.omodel.HMaterID2 = ClsPub.isLong(mainList[0].HMaterID2); + BillNew.omodel.HMaterID = ClsPub.isLong(mainList[0].HMaterID); + BillNew.omodel.HMaterNumber = ClsPub.isStrNull(mainList[0].HMaterNumber); + BillNew.omodel.HBatchNo = ClsPub.isStrNull(mainList[0].HBatchNo); + BillNew.omodel.HUnitID = ClsPub.isLong(mainList[0].HUnitID); + BillNew.omodel.HUnitNumber = ClsPub.isStrNull(mainList[0].HUnitNumber); + BillNew.omodel.HPlanQty = ClsPub.isDoule(mainList[0].HPlanQty); + BillNew.omodel.HQty = ClsPub.isDoule(mainList[0].HQty); + BillNew.omodel.HPlanBeginDate = ClsPub.isDate(mainList[0].HPlanBeginDate); + BillNew.omodel.HPlanEndDate = ClsPub.isDate(mainList[0].HPlanEndDate); + BillNew.omodel.HExplanation = ClsPub.isStrNull(mainList[0].HExplanation); + BillNew.omodel.HInnerBillNo = ClsPub.isStrNull(mainList[0].HInnerBillNo); + BillNew.omodel.HWorkShopID = ClsPub.isLong(mainList[0].HWorkShopID); + BillNew.omodel.HSupID = ClsPub.isLong(mainList[0].HSupID); + BillNew.omodel.HBLFlag = mainList[0].HBLFlag; + BillNew.omodel.HMainMaterID = ClsPub.isLong(mainList[0].HMainMaterID); + BillNew.omodel.HKeyMaterID = ClsPub.isLong(mainList[0].HKeyMaterID); + BillNew.omodel.HOrderProcNO = ClsPub.isStrNull(mainList[0].HOrderProcNO); + BillNew.omodel.HEquipMentID = ClsPub.isLong(mainList[0].HEquipMentID); + BillNew.omodel.HMateOutBatchNo = ClsPub.isStrNull(mainList[0].HMateOutBatchNo); + BillNew.omodel.HProjectNum = ClsPub.isStrNull(mainList[0].HProjectNum); + BillNew.omodel.HProdMaterCode = ClsPub.isStrNull(mainList[0].HProdMaterCode); + BillNew.omodel.HSeOrderBillNo = ClsPub.isStrNull(mainList[0].HSeOrderBillNo); + BillNew.omodel.HCusShortName = ClsPub.isStrNull(mainList[0].HCusShortName); + BillNew.omodel.HCusNeedMaterial = ClsPub.isStrNull(mainList[0].HCusNeedMaterial); + BillNew.omodel.HPlanSendGoodsDate = ClsPub.isStrNull(mainList[0].HPlanSendGoodsDate); + BillNew.omodel.HProdMaterName = ClsPub.isStrNull(mainList[0].HProdMaterName); + BillNew.omodel.HCusName = ClsPub.isStrNull(mainList[0].HCusName); + BillNew.omodel.HWorkRemark = ClsPub.isStrNull(mainList[0].HWorkRemark); + BillNew.omodel.HImportNote = ClsPub.isStrNull(mainList[0].HImportNote); + BillNew.omodel.HMaterNumber_A = ClsPub.isStrNull(mainList[0].HMaterNumber_A); + BillNew.omodel.HMaterNumber_B = ClsPub.isStrNull(mainList[0].HMaterNumber_B); + BillNew.omodel.HMaterNumber_C = ClsPub.isStrNull(mainList[0].HMaterNumber_C); + BillNew.omodel.HMaterNumber_D = ClsPub.isStrNull(mainList[0].HMaterNumber_D); + BillNew.omodel.HProdType = ClsPub.isStrNull(mainList[0].HProdType); + BillNew.omodel.HMaterShortName = ClsPub.isStrNull(mainList[0].HMaterShortName); + BillNew.omodel.HMaterIDA = ClsPub.isStrNull(mainList[0].HMaterIDA); + BillNew.omodel.HMaterIDB = ClsPub.isStrNull(mainList[0].HMaterIDB); + BillNew.omodel.HMaterIDC = ClsPub.isStrNull(mainList[0].HMaterIDC); + BillNew.omodel.HMaterIDD = ClsPub.isStrNull(mainList[0].HMaterIDD); + List<Model.ClsSc_ProcessExchangeBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_ProcessExchangeBillSub>>(msg3); + BillNew.DetailColl = new List<Model.ClsSc_ProcessExchangeBillSub>(); + for (int i = 0; i < subList.ToArray().Length; i++) + { + if (DBUtility.ClsPub.isInt(subList[i].HProcID) != 0)//HQty + { + Model.ClsSc_ProcessExchangeBillSub oSub = new Model.ClsSc_ProcessExchangeBillSub(); + oSub.HEntryID = i; + oSub.HRemark = DBUtility.ClsPub.isStrNull(subList[i].HRemark); + oSub.HSourceInterID = ClsPub.isLong(mainList[0].HICMOInterID); + oSub.HSourceEntryID = ClsPub.isLong(mainList[0].HICMOEntryID); + oSub.HSourceBillType = "85"; + oSub.HSourceBillNo = ClsPub.isStrNull(mainList[0].HICMOBillNo); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(subList[i].HRelationQty); + //oSub.HRelationQty_In = DBUtility.ClsPub.isDoule(subList[i].HRelationQty_In); + //oSub.HRelationQty_Out = DBUtility.ClsPub.isDoule(subList[i].HRelationQty_Out); + //oSub.HRelationQty_WWOrder = DBUtility.ClsPub.isDoule(subList[i].HRelationQty_WWOrder); + //oSub.HRelationQty_Bad = DBUtility.ClsPub.isDoule(subList[i].HRelationQty_Bad); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(subList[i].HRelationMoney); + oSub.HCloseMan = DBUtility.ClsPub.isStrNull(subList[i].HCloseMan); + oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(subList[i].HEntryCloseDate); + oSub.HCloseType = DBUtility.ClsPub.isBool(subList[i].HCloseType); + oSub.HQty = DBUtility.ClsPub.isDoule(subList[i].HQty); + if (oSub.HQty <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绗�" + ClsPub.isStrNull(i + 1) + "琛岋紝娴佽浆鍗℃暟閲忎笉鑳戒负0鎴栬�呭皬浜�0"; + objJsonResult.data = null; + return objJsonResult; + } + oSub.HProcNo = DBUtility.ClsPub.isLong(subList[i].HProcNo); + if (oSub.HProcNo <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绗�" + ClsPub.isStrNull(i + 1) + "琛岋紝娴佹按鍙蜂笉鑳戒负0鎴栬�呭皬浜�0"; + objJsonResult.data = null; + return objJsonResult; + } + oSub.HProcID = DBUtility.ClsPub.isLong(subList[i].HProcID); + oSub.HProcNumber = DBUtility.ClsPub.isStrNull(subList[i].HProcNumber); + oSub.HWorkRemark = DBUtility.ClsPub.isStrNull(subList[i].HWorkRemark); + oSub.HCenterID = DBUtility.ClsPub.isLong(subList[i].HCenterID); + oSub.HDeptID = DBUtility.ClsPub.isLong(subList[i].HDeptID); + oSub.HDeptNumber = DBUtility.ClsPub.isStrNull(subList[i].HDeptNumber); + ////oSub.HGroupID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HGroupIDCol].Value); + oSub.HGroupNumber = DBUtility.ClsPub.isStrNull(subList[i].HGroupNumber); + oSub.HWorkerID = DBUtility.ClsPub.isLong(subList[i].HWorkerID); + oSub.HWorkerNumber = DBUtility.ClsPub.isStrNull(subList[i].HWorkerNumber); + oSub.HSourceID = DBUtility.ClsPub.isLong(subList[i].HSourceID); + oSub.HTimeUnit = DBUtility.ClsPub.isStrNull(subList[i].HTimeUnit); + oSub.HPlanWorkTimes = DBUtility.ClsPub.isSingle(subList[i].HPlanWorkTimes); + oSub.HPlanBeginDate = DBUtility.ClsPub.isDate(subList[i].HPlanBeginDate); + oSub.HPlanEndDate = DBUtility.ClsPub.isDate(subList[i].HPlanEndDate); + oSub.HRelBeginDate = DBUtility.ClsPub.isDate(subList[i].HRelBeginDate); + oSub.HRelEndDate = DBUtility.ClsPub.isDate(subList[i].HRelEndDate); + oSub.HReadyTime = 0; + oSub.HQueueTime = 0; + oSub.HMoveTime = 0; + oSub.HBeginDayQty = DBUtility.ClsPub.isSingle(subList[i].HBeginDayQty); + oSub.HBeginFixQty = DBUtility.ClsPub.isSingle(subList[i].HBeginFixQty); + oSub.HFixWorkDays = DBUtility.ClsPub.isSingle(subList[i].HFixWorkDays); + oSub.HTrunWorkDays = DBUtility.ClsPub.isSingle(subList[i].HTrunWorkDays); + oSub.HReadyTimes = DBUtility.ClsPub.isSingle(subList[i].HReadyTimes); + oSub.HMyWorkDays = DBUtility.ClsPub.isSingle(subList[i].HMyWorkDays); + oSub.HOutPrice = DBUtility.ClsPub.isSingle(subList[i].HOutPrice); + oSub.HOutMoney = DBUtility.ClsPub.isSingle(subList[i].HOutMoney); + oSub.HLastProc = "鍚�"; + oSub.HFstProc = "鍚�"; + oSub.HKeyProc = DBUtility.ClsPub.isStrNull(subList[i].HKeyProc); + oSub.HSupID = DBUtility.ClsPub.isLong(subList[i].HSupID); + oSub.HSupFlag = DBUtility.ClsPub.isBool(subList[i].HSupFlag); + oSub.HBackProc = DBUtility.ClsPub.isBool(subList[i].HBackProc); + oSub.HEdit = DBUtility.ClsPub.isBool(subList[i].HEdit); + if (oSub.HCenterID == 0 && oSub.HSupFlag == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "绗�" + ClsPub.isStrNull(i + 1) + "琛岋紝宸ヤ綔涓績鎴栧澶栨爣璁颁笉鑳藉悓鏃朵负绌�"; + objJsonResult.data = null; + return objJsonResult; + } + oSub.HICMOBillNo = DBUtility.ClsPub.isStrNull(subList[i].HICMOBillNo); + oSub.HICMOInterID = DBUtility.ClsPub.isLong(subList[i].HICMOInterID); + oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(subList[i].HSeOrderInterID); + oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(subList[i].HSeOrderEntryID); + oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(subList[i].HSeOrderBillNo); + oSub.HWWOrderInterID = DBUtility.ClsPub.isLong(subList[i].HWWOrderInterID); + oSub.HWWOrderEntryID = DBUtility.ClsPub.isLong(subList[i].HWWOrderEntryID); + oSub.HWWOrderBillNo = DBUtility.ClsPub.isStrNull(subList[i].HWWOrderBillNo); + oSub.HSumPassRate = DBUtility.ClsPub.isSingle(subList[i].HSumPassRate); + oSub.HPassRate = DBUtility.ClsPub.isSingle(subList[i].HPassRate); + oSub.HOverRate = DBUtility.ClsPub.isDoule(subList[i].HOverRate); + oSub.HMaxQty = DBUtility.ClsPub.isDoule(subList[i].HMaxQty); + oSub.HTechnologyParameter = DBUtility.ClsPub.isStrNull(subList[i].HTechnologyParameter); + oSub.HPicNum = DBUtility.ClsPub.isStrNull(subList[i].HPicNum); + oSub.HProcCheckNote = DBUtility.ClsPub.isStrNull(subList[i].HProcCheckNote); + BillNew.DetailColl.Add(oSub); + } + } + //淇濆瓨瀹屾瘯鍚庡鐞� + //if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew) + //{ + // bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo); + //} + //else + //{ + // bResult = BillNew.ModifyBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo); + //} + bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo); + //鎻愮ず + if (bResult == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + //objJsonResult.Message = "鍗曟嵁瀛樼洏瀹屾瘯!鍗曟嵁鍙�:" + mainList[0].HBillNo.Trim(); + objJsonResult.Message = ClsPub.sExeReturnInfo+"鍗曟嵁鍙�:" + mainList[0].HBillNo.Trim(); + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + 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="hmainid">鐢熶骇浠诲姟鍗旾D</param> + /// <returns>object</returns> + [Route("Sc_ProcessExchangeBill/GetICMOBillDetail")] + [HttpGet] + public object GetICMOBillDetail(int hmainid,int OrganizationID) + { + try + { + if (hmainid == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鐢熶骇浠诲姟鍗旾D涓�0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + ds = oCN.RunProcReturn("select * from h_v_Sc_ICMOBillListDetail where hmainid=" + hmainid + " and HSTOCKINORGID="+ OrganizationID, "h_v_Sc_ICMOBillListDetail"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ょ敓浜т换鍔″崟鏃犳槑缁嗚锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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; + } + } + + + // + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/MJGL/Sc_MouldOtherOutBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldOtherOutBillController.cs new file mode 100644 index 0000000..55338e2 --- /dev/null +++ b/WebAPI/Controllers/MJGL/Sc_MouldOtherOutBillController.cs @@ -0,0 +1,325 @@ +锘縰sing Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Web.Http; +using WebAPI.Models; +namespace WebAPI.Controllers +{ + public class Sc_MouldOtherOutBillController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + + #region 妯℃不鍏峰叾浠栧嚭搴撳崟 + + /// <summary> + /// 妯℃不鍏峰叾浠栧嚭搴撳崟鍒楄〃 list鍒楄〃鏁版嵁鍔犺浇 + /// </summary> + /// <returns></returns> + [Route("Sc_MouldOtherOutBill/GetMouldOtherOutBillList")] + [HttpGet] + public object GetMouldOtherOutBillList(string sWhere) + { + try + { + ds = Sc_MouldOtherOutBillList_s(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + #region sql璇彞 + + + public static DataSet Sc_MouldOtherOutBillList_s(string sWhere) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldOtherOutBillList ", "h_v_Sc_MouldOtherOutBillList"); + } + #endregion + + #region 妯℃不鍏峰叾浠栧嚭搴撳崟 淇濆瓨/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldOtherOutBill/SaveMouldOtherOutBillList")] + [HttpPost] + public object SaveMouldOtherOutBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DAL.ClsSc_MouldOtherOutBill oBill = new DAL.ClsSc_MouldOtherOutBill(); + List<Model.ClsSc_MouldStockBillMain> lsmain = new List<Model.ClsSc_MouldStockBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sc_MouldStockBillMain(msg2); + foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3828"; + oItem.HBillSubType = "3828"; + + //oItem.HInterID =0; + //oItem.HBillNo = ""; + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + //oItem.HMakeDate = ""; + //oItem.HYear = ""; + //oItem.HPeriod = ""; + //oItem.HRemark = ""; + //oItem.HCycleUnit = ""; + //oItem.HCheckCycle = ""; + //oItem.HBeginDate = ""; + //oItem.HEndDate = ""; + //oItem.HInnerBillNo = ""; + //oItem.HExplanation = ""; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSc_MouldStockBillSub> ls = new List<Model.ClsSc_MouldStockBillSub>(); + ls = oListModels.getObjectByJson_Sc_MouldStockBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //HMaterID = "";//閰嶄欢浠g爜 + //HUnitID = "";//鍗曚綅浠g爜 + //HQty = "";//瀹為檯鐢ㄩ噺 + //HQtyMust = "";//鍗曚綅鐢ㄩ噺 + //HRemark = "";//澶囨敞 + + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 [妯℃不鍏峰叾浠栧嚭搴撳崟鍒犻櫎鍔熻兘] + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_MouldOtherOutBill/DeltetMouldOtherOutBillList")] + [HttpGet] + public object DeltetMouldOtherOutBillList(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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.ClsSc_MouldOtherOutBill oBill = new DAL.ClsSc_MouldOtherOutBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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("Sc_MouldOtherOutBill/Sc_MouldOtherOutBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MouldOtherOutBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldOtherOutBillList where hmainid= " + HID + " ", "h_v_Sc_MouldOtherOutBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄨ澶囦繚鍏昏褰曡〃" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + #region[妯℃不鍏峰叾浠栧嚭搴撳崟缂栬緫鏃惰幏鍙栬〃棰樻暟鎹甝 + [Route("Sc_MouldOtherOutBill/Sc_MouldOtherOutBillListProjectDetai")] + [HttpGet] + public object Sc_MouldOtherOutBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn(@"select 妯″叿浠g爜 HMaterID,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec ,鎵规 HBatchNo,璁捐瀵垮懡 HDesignLife,鍓╀綑瀵垮懡 HLeaveLife,绱Н浣跨敤瀵垮懡 HUseLife,瀹炲彂鏁伴噺 HQty,鍗曚环 HPrice,閲戦 HMoney,妯″叿浠撳簱浠g爜 HWHID,鍙戣揣浠撳簱 HWHName,琛ㄤ綋澶囨敞 HRemark +from h_v_Sc_MouldOtherOutBillList", "h_v_Sc_MouldOtherOutBillList_Edit"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + string sql1 = @"select 妯″叿浠g爜 HMaterID,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec ,鎵规 HBatchNo,璁捐瀵垮懡 HDesignLife,鍓╀綑瀵垮懡 HLeaveLife,绱Н浣跨敤瀵垮懡 HUseLife,瀹炲彂鏁伴噺 HQty,鍗曚环 HPrice,閲戦 HMoney,妯″叿浠撳簱浠g爜 HWHID,鍙戣揣浠撳簱 HWHName,琛ㄤ綋澶囨敞 HRemark +from h_v_Sc_MouldOtherOutBillList where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldOtherOutBillList"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁″垝锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + + + + + #endregion + + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/MJJY/Mj_PDA_MoudlCheckController.cs b/WebAPI/Controllers/MJJY/Mj_PDA_MoudlCheckController.cs new file mode 100644 index 0000000..1c11eba --- /dev/null +++ b/WebAPI/Controllers/MJJY/Mj_PDA_MoudlCheckController.cs @@ -0,0 +1,397 @@ +锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; +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.MJJY +{ + public class Mj_PDA_MoudlCheckController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛� + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + public DAL.ClsSc_MouldDotCheckBill BillNew = new DAL.ClsSc_MouldDotCheckBill(); //瀵瑰簲鍗曟嵁绫� + public DAL.ClsSc_MouldDotCheckBill BillOld = new DAL.ClsSc_MouldDotCheckBill(); //瀵瑰簲鍗曟嵁绫� + + public DAL.ClsSc_MouldMaintainBill BillNew1 = new DAL.ClsSc_MouldMaintainBill(); //瀵瑰簲鍗曟嵁绫� + public DAL.ClsSc_MouldMaintainBill BillOld1 = new DAL.ClsSc_MouldMaintainBill(); //瀵瑰簲鍗曟嵁绫� + + #region 妯℃不鍏风偣妫�璁板綍鍗� + + #region 鏍规嵁妯℃不鍏锋潯鐮佹煡鎵炬ā鍏锋。妗堜俊鎭� + [Route("Mj_PDA_MoudlCheckBill/txtHBarCode_KeyDown")] + [HttpGet] + public object txtHBarCode_KeyDown(string HBarCode) + { + try + { + if (HBarCode == null || HBarCode.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏉″舰鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = null; + return objJsonResult; + } + //寰楀埌淇℃伅 + ds = oCN.RunProcReturn("select top 1 * from h_v_IF_Mould where HNumber= '" + HBarCode + "'", "h_v_IF_Mould"); + //鍐欏叆淇℃伅 + if (ds == null || 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 妯℃不鍏风偣妫�璁板綍鎻愪氦 + + [Route("Mj_PDA_MoudlCheckBill/SaveGetMoudlCheckBillList")] + [HttpPost] + public object SaveGetMoudlCheckBillList([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 UserName = ""; + + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSc_MouldDotCheckBill oBill = new DLL.ClsSc_MouldDotCheckBill(); + List<Models.ClsSc_MouldDotCheckBillMain> lsmain = new List<Models.ClsSc_MouldDotCheckBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MoudlCheckBillMain(msg2); + foreach (Models.ClsSc_MouldDotCheckBillMain oItem in lsmain) + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = 1; + return objJsonResult; + } + + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3821"; + oItem.HBillSubType = "3821"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + //瀛愯〃浣撴暟鎹� + + List<Models.ClsSc_MouldDotCheckBillSub> ls = new List<Models.ClsSc_MouldDotCheckBillSub>(); + ls = oListModels.getObjectByJson_Gy_MouldDotCheckBillSub(msg2); + int i = 0; + foreach (Models.ClsSc_MouldDotCheckBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 + + #endregion + + + #region 妯℃不鍏蜂繚鍏昏褰曞崟 + + #region 鏍规嵁妯℃不鍏锋潯鐮佹煡鎵炬ā鍏锋。妗堜俊鎭� + [Route("Mj_PDA_MouldMaintainBill/txtHBarCodeMaintain_KeyDown")] + [HttpGet] + public object txtHBarCodeMaintain_KeyDown(string HBarCode) + { + try + { + if (HBarCode == null || HBarCode.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏉″舰鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = null; + return objJsonResult; + } + //寰楀埌淇℃伅 + ds = oCN.RunProcReturn("select top 1 * from h_v_IF_Mould where HNumber= '" + HBarCode + "'", "h_v_IF_Mould"); + //鍐欏叆淇℃伅 + if (ds == null || 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 妯℃不鍏蜂繚鍏昏褰曟彁浜� + + [Route("Mj_PDA_MouldMaintainBill/SaveGetMouldMaintainBillList")] + [HttpPost] + public object SaveGetMouldMaintainBillList([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 UserName = ""; + + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSc_MouldMaintainBill oBill = new DLL.ClsSc_MouldMaintainBill(); + List<Models.ClsSc_MouldMaintainBillMain> lsmain = new List<Models.ClsSc_MouldMaintainBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MouldMaintainBillMain(msg2); + foreach (Models.ClsSc_MouldMaintainBillMain oItem in lsmain) + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew1.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld1.omodel.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = 1; + return objJsonResult; + } + + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3901"; + oItem.HBillSubType = "3901"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + //瀛愯〃浣撴暟鎹� + + List<Models.ClsSc_MouldMaintainBillSub> ls = new List<Models.ClsSc_MouldMaintainBillSub>(); + ls = oListModels.getObjectByJson_Gy_MouldMaintainBillSub(msg2); + int i = 0; + foreach (Models.ClsSc_MouldMaintainBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 + + #endregion + + } +} + diff --git a/WebAPI/Controllers/PublicPageMethodController.cs b/WebAPI/Controllers/PublicPageMethodController.cs new file mode 100644 index 0000000..b57dcde --- /dev/null +++ b/WebAPI/Controllers/PublicPageMethodController.cs @@ -0,0 +1,1845 @@ +锘縰sing 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 +{ + public class PublicPageMethodController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region 閫夋嫨寰�鏉ュ崟浣嶅熀纭�璧勬枡 + + #region 鏉′欢鏌ヨ寰�鏉ュ崟浣嶅垪琛� + [Route("PublicPageMethod/CustomerList")] + [HttpGet] + public object CustomerList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from h_v_IF_Customer where HStopflag=0 Order by HItemID ", "h_v_IF_Customer"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from h_v_IF_Customer where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_Emp"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘寰�鏉ュ崟浣嶅垪琛� + [Route("Gy_MaintenanceMode/CustomerCX")] + [HttpGet] + public object CustomerCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.h_v_IF_Customer WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.h_v_IF_Customer AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "h_v_IF_Customer"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃寰�鏉ュ崟浣嶅垪琛ㄦ暟鎹� + [Route("Gy_MaintenanceMode/CustomerLoadTree")] + [HttpGet] + public object CustomerLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from h_v_IF_Customer", "h_v_IF_Customer"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨鐢ㄦ埛鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ鐢ㄦ埛鍒楄〃 + [Route("PublicPageMethod/UserList")] + [HttpGet] + public object UserList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from h_v_IF_Emp where HStopflag=0 Order by HItemID ", "h_v_IF_Emp"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from h_v_IF_Emp where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_Emp"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘鐢ㄦ埛鍒楄〃 + [Route("Gy_MaintenanceMode/UserCX")] + [HttpGet] + public object UserCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.h_v_IF_Emp WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.h_v_IF_Emp AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "h_v_IF_Emp"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃鐢ㄦ埛鍒楄〃鏁版嵁 + [Route("Gy_MaintenanceMode/UserLoadTree")] + [HttpGet] + public object UserLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from h_v_IF_Emp", "h_v_IF_Emp"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨浠撳簱鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ浠撳簱鍒楄〃 + [Route("PublicPageMethod/WareHouseList")] + [HttpGet] + public object WareHouseList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from h_v_IF_Warehouse where HStopflag=0 Order by HItemID ", "h_v_IF_Warehouse"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from h_v_IF_Warehouse where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_Warehouse"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘浠撳簱鍒楄〃 + [Route("Gy_MaintenanceMode/WareHouseCX")] + [HttpGet] + public object WareHouseCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.h_v_IF_Warehouse WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.h_v_IF_Warehouse AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "h_v_IF_Warehouse"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃浠撳簱鍒楄〃鏁版嵁 + [Route("Gy_MaintenanceMode/WareHouseLoadTree")] + [HttpGet] + public object WareHouseLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from h_v_IF_Warehouse", "h_v_IF_Warehouse"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨浠撲綅鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ浠撲綅鍒楄〃 + [Route("PublicPageMethod/WareLocationList")] + [HttpGet] + public object WareLocationList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_StockPlace where HStopflag=0 Order by HItemID ", "Gy_StockPlace"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from Gy_StockPlace where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_StockPlace"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘浠撲綅鍒楄〃 + [Route("Gy_MaintenanceMode/WareLocationCX")] + [HttpGet] + public object WareLocationCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.Gy_StockPlace WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.Gy_StockPlace AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "Gy_StockPlace"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃浠撲綅鍒楄〃鏁版嵁 + [Route("Gy_MaintenanceMode/WareLocationLoadTree")] + [HttpGet] + public object WareLocationLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from Gy_StockPlace", "Gy_StockPlace"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨閮ㄩ棬鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ閮ㄩ棬鍒楄〃 + [Route("PublicPageMethod/DeptList")] + [HttpGet] + public object DeptList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from h_v_IF_Department where HStopflag=0 Order by HItemID ", "h_v_IF_Department"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from h_v_IF_Department where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_Department"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘閮ㄩ棬鍒楄〃 + [Route("Gy_MaintenanceMode/DeptCX")] + [HttpGet] + public object DeptCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.h_v_IF_Department WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.h_v_IF_Department AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "h_v_IF_Department"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃閮ㄩ棬鍒楄〃鏁版嵁 + [Route("Gy_MaintenanceMode/DeptLoadTree")] + [HttpGet] + public object DeptLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from h_v_IF_Department", "h_v_IF_Department"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨鎴愬搧妯″叿鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ鎴愬搧妯″叿鍒楄〃 + [Route("PublicPageMethod/MouldList")] + [HttpGet] + public object MouldList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName,HModel from h_v_Gy_Mould Order by HNumber", "h_v_Gy_Mould"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName,HModel from h_v_Gy_Mould where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_Gy_Mould"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘鎴愬搧妯″叿鍒楄〃 + [Route("Gy_MaintenanceMode/MouldCX")] + [HttpGet] + public object MouldCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.h_v_Gy_Mould WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.h_v_Gy_Mould AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "h_v_Gy_Mould"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃鎴愬搧妯″叿鍒楄〃鏁版嵁 + [Route("Gy_MaintenanceMode/MouldLoadTree")] + [HttpGet] + public object MouldLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID from h_v_Gy_Mould", "h_v_Gy_Mould"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨缁翠慨椤圭洰鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ缁翠慨椤圭洰鍒楄〃 + [Route("PublicPageMethod/RepairItemList")] + [HttpGet] + public object RepairItemList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_Repair where HStopflag=0 Order by HItemID", "Gy_Repair"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from Gy_Repair where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_Repair"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘缁翠慨椤圭洰鍒楄〃 + [Route("Gy_MaintenanceMode/RepairItemCX")] + [HttpGet] + public object RepairItemCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.Gy_Repair WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.Gy_Repair AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "Gy_Repair"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃缁翠慨椤圭洰鍒楄〃鏁版嵁 + [Route("Gy_MaintenanceMode/RepairItemLoadTree")] + [HttpGet] + public object RepairItemLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from Gy_Repair", "Gy_Repair"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨渚涘簲鍟嗗熀纭�璧勬枡 + + #region 鏉′欢鏌ヨ渚涘簲鍟嗗垪琛� + [Route("PublicPageMethod/SupplierList")] + [HttpGet] + public object SupplierList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_Supplier where HStopflag=0 Order by HItemID", "Gy_Supplier"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from Gy_Supplier where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_Supplier"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘渚涘簲鍟嗗垪琛� + [Route("Gy_MaintenanceMode/SupplierCX")] + [HttpGet] + public object SupplierCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.Gy_Supplier WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.Gy_Supplier AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "Gy_Supplier"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃渚涘簲鍟嗗垪琛ㄦ暟鎹� + [Route("Gy_MaintenanceMode/SupplierLoadTree")] + [HttpGet] + public object SupplierLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from Gy_Supplier", "Gy_Supplier"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨鏁呴殰绫诲瀷鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ鏁呴殰绫诲瀷鍒楄〃 + [Route("PublicPageMethod/FaultTypeList")] + [HttpGet] + public object FaultTypeList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_ConkType where HStopflag=0 Order by HItemID", "Gy_ConkType"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from Gy_ConkType where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_ConkType"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘鏁呴殰绫诲瀷鍒楄〃 + [Route("Gy_MaintenanceMode/FaultTypeCX")] + [HttpGet] + public object FaultTypeCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.Gy_ConkType WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.Gy_ConkType AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "Gy_ConkType"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃鏁呴殰绫诲瀷鍒楄〃鏁版嵁 + [Route("Gy_MaintenanceMode/FaultTypeLoadTree")] + [HttpGet] + public object FaultTypeLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from Gy_ConkType", "Gy_ConkType"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨璁惧鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ璁惧鍒楄〃 + [Route("PublicPageMethod/EqpList")] + [HttpGet] + public object EqpList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_EquipMent where HStopflag=0 Order by HItemID", "Gy_EquipMent"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from Gy_EquipMent where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_EquipMent"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘璁惧鍒楄〃 + [Route("Gy_MaintenanceMode/EqpCX")] + [HttpGet] + public object EqpCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.Gy_EquipMent WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.Gy_EquipMent AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "Gy_EquipMent"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃璁惧鍒楄〃鏁版嵁 + [Route("Gy_MaintenanceMode/EqpLoadTree")] + [HttpGet] + public object EqpLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from Gy_EquipMent", "Gy_EquipMent"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨妫�楠岄」鐩被鍒熀纭�璧勬枡 + + #region 鏉′欢鏌ヨ璁惧鍒楄〃 + [Route("PublicPageMethod/CheckItemTypeList")] + [HttpGet] + public object CheckItemTypeList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_QCCheckClass where HStopflag=0 Order by HItemID", "Gy_QCCheckClass"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from Gy_QCCheckClass where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_QCCheckClass"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘璁惧鍒楄〃 + [Route("Gy_MaintenanceMode/CheckItemTypeCX")] + [HttpGet] + public object CheckItemTypeCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.Gy_QCCheckClass WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.Gy_QCCheckClass AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "Gy_QCCheckClass"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃璁惧鍒楄〃鏁版嵁 + [Route("Gy_MaintenanceMode/CheckItemTypeLoadTree")] + [HttpGet] + public object CheckItemTypeLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from Gy_QCCheckClass", "Gy_QCCheckClass"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨鐝粍鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ鐝粍鍒楄〃 + [Route("PublicPageMethod/GroupList")] + [HttpGet] + public object GroupList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from h_v_IF_Group where HStopflag=0 Order by HItemID", "h_v_IF_Group"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from h_v_IF_Group where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_Group"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘鐝粍鍒楄〃 + [Route("Gy_MaintenanceMode/GroupCX")] + [HttpGet] + public object GroupCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.h_v_IF_Group WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.h_v_IF_Group AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "h_v_IF_Group"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃鐝粍鍒楄〃鏁版嵁 + [Route("Gy_MaintenanceMode/GroupLoadTree")] + [HttpGet] + public object GroupLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from h_v_IF_Group", "h_v_IF_Group"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨璧勬簮鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ璧勬簮鍒楄〃 + [Route("PublicPageMethod/SourceList")] + [HttpGet] + public object SourceList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_Source where HStopflag=0 Order by HItemID", "Gy_Source"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from Gy_Source where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_Source"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘璧勬簮鍒楄〃 + [Route("Gy_MaintenanceMode/SourceCX")] + [HttpGet] + public object SourceCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.Gy_Source WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.Gy_Source AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "Gy_Source"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃璧勬簮鍒楄〃鏁版嵁 + [Route("Gy_MaintenanceMode/SourceLoadTree")] + [HttpGet] + public object SourceLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from Gy_Source", "Gy_Source"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨鐗╂枡鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ鐗╂枡鍒楄〃 + [Route("PublicPageMethod/PartList")] + [HttpGet] + public object PartList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName,HModel from h_v_IF_Material where HStopflag=0 Order by HItemID", "h_v_IF_Material"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName,HModel from h_v_IF_Material where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_Material"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘鐗╂枡鍒楄〃 + [Route("Gy_MaintenanceMode/PartCX")] + [HttpGet] + public object PartCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.h_v_IF_Material WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.h_v_IF_Material AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "h_v_IF_Material"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃鐗╂枡鍒楄〃鏁版嵁 + [Route("Gy_MaintenanceMode/PartLoadTree")] + [HttpGet] + public object PartLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from h_v_IF_Material", "h_v_IF_Material"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨鍗曚綅鍩虹璧勬枡 + + #region 鏉′欢鏌ヨ鍗曚綅鍒楄〃 + [Route("PublicPageMethod/UnitList")] + [HttpGet] + public object UnitList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from h_v_IF_Unit where HStopflag=0 Order by HItemID", "h_v_IF_Unit"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from h_v_IF_Unit where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_Unit"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘鍗曚綅鍒楄〃 + [Route("Gy_MaintenanceMode/UnitCX")] + [HttpGet] + public object UnitCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.h_v_IF_Unit WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.h_v_IF_Unit AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "h_v_IF_Unit"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃鍗曚綅鍒楄〃鏁版嵁 + [Route("Gy_MaintenanceMode/UnitLoadTree")] + [HttpGet] + public object UnitLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from h_v_IF_Unit", "h_v_IF_Unit"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + #region 閫夋嫨杈呭姪灞炴�у熀纭�璧勬枡 + + #region 鏉′欢鏌ヨ杈呭姪灞炴�у垪琛� + [Route("PublicPageMethod/PropertyList")] + [HttpGet] + public object PropertyList(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HParentID,HNumber,HName from Gy_Property where HStopflag=0 Order by HItemID", "Gy_Property"); + } + else + { + string sql1 = "Select HItemID,HParentID,HNumber,HName from Gy_Property where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_Property"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍规嵁鏍戝瀷id鏌ユ壘杈呭姪灞炴�у垪琛� + [Route("Gy_MaintenanceMode/PropertyCX")] + [HttpGet] + public object PropertyCX(long HInterID) + { + try + { + + ds = oCN.RunProcReturn(string.Format(@"WITH a AS (SELECT * FROM dbo.Gy_Property WHERE HitemID=" + HInterID + " UNION ALL SELECT s.* FROM dbo.Gy_Property AS s,a WHERE s.hparentid=a.HitemID) SELECT * FROM a"), "Gy_Property"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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 鏍戝瀷鍒楄〃杈呭姪灞炴�у垪琛ㄦ暟鎹� + [Route("Gy_MaintenanceMode/PropertyLoadTree")] + [HttpGet] + public object PropertyLoadTree(string sWhere) + { + SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); + //ds = oCN.RunProcReturn("select * from h_v_IF_GroupList " + sWhere, "h_v_IF_GroupList"); + + ds = oCN.RunProcReturn("Select HItemID id,HNumber,(CAST(HNumber as varchar(100))+'-'+CAST(HName as varchar(100))) as title,HParentID ParentID,HLevel from Gy_Property", "Gy_Property"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "false锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + #endregion + + #endregion + + } +} diff --git a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckBillController.cs new file mode 100644 index 0000000..eeed367 --- /dev/null +++ b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckBillController.cs @@ -0,0 +1,512 @@ +锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections.Generic; +using System.Data; +using System.Web.Http; +using WebAPI.Models; +namespace WebAPI.Controllers +{ + public class Sb_EquipDotCheckBillController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛� + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + public DAL.ClsSb_EquipDotCheckBill BillNew = new DAL.ClsSb_EquipDotCheckBill(); //瀵瑰簲鍗曟嵁绫� + public DAL.ClsSb_EquipDotCheckBill BillOld = new DAL.ClsSb_EquipDotCheckBill(); //瀵瑰簲鍗曟嵁绫� + + #region 璁惧鐐规璁板綍琛� + + /// <summary> + /// 璁惧鐐规璁板綍琛ㄥ垪琛� list鍒楄〃鏁版嵁鍔犺浇 + /// </summary> + /// <returns></returns> + [Route("Sb_EquipDotCheckBill/GetEquipDotCheckBillList")] + [HttpGet] + public object GetEquipDotCheckBillList(string sWhere) + { + try + { + ds = Sb_EquipDotCheckBillList_s(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + #region sql璇彞 + + + public static DataSet Sb_EquipDotCheckBillList_s(string sWhere) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipDotCheckBillList ", "h_v_Sb_EquipDotCheckBillList"); + } + #endregion + + #region 璁惧鐐规璁板綍琛� 淇濆瓨/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sb_EquipDotCheckBill/SaveEquipDotCheckBillList")] + [HttpPost] + public object SaveEquipDotCheckBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DAL.ClsSb_EquipDotCheckBill oBill = new DAL.ClsSb_EquipDotCheckBill(); + List<Model.ClsSb_EquipDotCheckBillMain> lsmain = new List<Model.ClsSb_EquipDotCheckBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sb_EquipDotCheckBillMain(msg2); + foreach (Model.ClsSb_EquipDotCheckBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3903"; + oItem.HBillSubType = "3903"; + + //oItem.HInterID =0; + //oItem.HBillNo = ""; + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + //oItem.HMakeDate = ""; + //oItem.HYear = ""; + //oItem.HPeriod = ""; + //oItem.HRemark = ""; + //oItem.HCycleUnit = ""; + //oItem.HCheckCycle = ""; + //oItem.HBeginDate = ""; + //oItem.HEndDate = ""; + //oItem.HInnerBillNo = ""; + //oItem.HExplanation = ""; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSb_EquipDotCheckBillSub> ls = new List<Model.ClsSb_EquipDotCheckBillSub>(); + ls = oListModels.getObjectByJson_Sb_EquipDotCheckBillSub(msg3); + int i = 0; + foreach (Model.ClsSb_EquipDotCheckBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //HMaterID = "";//閰嶄欢浠g爜 + //HUnitID = "";//鍗曚綅浠g爜 + //HQty = "";//瀹為檯鐢ㄩ噺 + //HQtyMust = "";//鍗曚綅鐢ㄩ噺 + //HRemark = "";//澶囨敞 + + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 [璁惧鐐规璁板綍琛ㄥ垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sb_EquipDotCheckBill/DeltetEquipDotCheckBillList")] + [HttpGet] + public object DeltetEquipDotCheckBillList(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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.ClsSb_EquipDotCheckBill oBill = new DAL.ClsSb_EquipDotCheckBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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("Sb_EquipDotCheckBill/Sb_EquipDotCheckBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sb_EquipDotCheckBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipDotCheckBillList where hmainid= " + HID + " ", "h_v_Sb_EquipDotCheckBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ偣妫�璁板綍琛�" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + #region[璁惧鐐规璁板綍琛ㄧ紪杈戞椂鑾峰彇琛ㄩ鏁版嵁] + [Route("Sb_EquipDotCheckBill/Sb_EquipDotCheckBillListProjectDetai")] + [HttpGet] + public object Sb_EquipDotCheckBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn("select 鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart ,鍏蜂綋瑕佹眰 HClaim,琛ㄤ綋澶囨敞 HRemark,HManagerID from h_v_Sb_EquipDotCheckBillList", "h_v_Sb_EquipDotCheckBillList"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + string sql1 = "select 鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,琛ㄤ綋澶囨敞 HRemark,HManagerID from h_v_Sb_EquipDotCheckBillList where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckBillList"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁″垝锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + + + + + #endregion + + + #region 璁惧鐐规璁板綍鍗昉DA + + #region 鏍规嵁璁惧鏉$爜鏌ユ壘璁惧妗f淇℃伅PDA + [Route("Sb_PDA_EquipDotCheckBill/txtHBarCode_KeyDown")] + [HttpGet] + public object txtHBarCode_KeyDown(string HBarCode) + { + try + { + if (HBarCode == null || HBarCode.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏉″舰鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = null; + return objJsonResult; + } + //寰楀埌淇℃伅 + ds = oCN.RunProcReturn("select top 1 * from Gy_EquipMent where HNumber= '" + HBarCode + "'", "Gy_EquipMent"); + //鍐欏叆淇℃伅 + if (ds == null || 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 + + [Route("Sb_PDA_EquipDotCheckBill/SaveGetEquipDotCheckBillList")] + [HttpPost] + public object SaveGetEquipDotCheckBillList([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 UserName = ""; + + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSb_EquipDotCheckBill oBill = new DLL.ClsSb_EquipDotCheckBill(); + List<Models.ClsSb_EquipDotCheckBillMain> lsmain = new List<Models.ClsSb_EquipDotCheckBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sb_EquipDotCheckBillMainPDA(msg2); + foreach (Models.ClsSb_EquipDotCheckBillMain oItem in lsmain) + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = 1; + return objJsonResult; + } + + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3903"; + oItem.HBillSubType = "3903"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + //瀛愯〃浣撴暟鎹� + + List<Models.ClsSb_EquipDotCheckBillSub> ls = new List<Models.ClsSb_EquipDotCheckBillSub>(); + ls = oListModels.getObjectByJson_Sb_EquipDotCheckBillSubPDA(msg2); + int i = 0; + foreach (Models.ClsSb_EquipDotCheckBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 + + #endregion + + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckPlanBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckPlanBillController.cs new file mode 100644 index 0000000..1733451 --- /dev/null +++ b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckPlanBillController.cs @@ -0,0 +1,323 @@ +锘縰sing Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Web.Http; +using WebAPI.Models; +namespace WebAPI.Controllers +{ + public class Sb_EquipDotCheckPlanBillController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + + #region 璁惧鐐规璁″垝琛� + + /// <summary> + /// 璁惧鐐规璁″垝琛ㄥ垪琛� list鍒楄〃鏁版嵁鍔犺浇 + /// </summary> + /// <returns></returns> + [Route("Sb_EquipDotCheckPlanBill/GetEquipDotCheckPlanBillList")] + [HttpGet] + public object GetEquipDotCheckPlanBillList(string sWhere) + { + try + { + ds = Sb_EquipDotCheckPlanBillList_s(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + #region sql璇彞 + + + public static DataSet Sb_EquipDotCheckPlanBillList_s(string sWhere) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipDotCheckPlanBillList ", "h_v_Sb_EquipDotCheckPlanBillList"); + } + #endregion + + #region 璁惧鐐规璁″垝琛� 淇濆瓨/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sb_EquipDotCheckPlanBill/SaveEquipDotCheckPlanBillList")] + [HttpPost] + public object SaveEquipDotCheckPlanBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DAL.ClsSb_EquipDotCheckPlanBill oBill = new DAL.ClsSb_EquipDotCheckPlanBill(); + List<Model.ClsSb_EquipDotCheckPlanBillMain> lsmain = new List<Model.ClsSb_EquipDotCheckPlanBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sb_EquipDotCheckPlanBillMain(msg2); + foreach (Model.ClsSb_EquipDotCheckPlanBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3904"; + oItem.HBillSubType = "3904"; + + //oItem.HInterID =0; + //oItem.HBillNo = ""; + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + //oItem.HMakeDate = ""; + //oItem.HYear = ""; + //oItem.HPeriod = ""; + //oItem.HRemark = ""; + //oItem.HCycleUnit = ""; + //oItem.HCheckCycle = ""; + //oItem.HBeginDate = ""; + //oItem.HEndDate = ""; + //oItem.HInnerBillNo = ""; + //oItem.HExplanation = ""; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSb_EquipDotCheckPlanBillSub> ls = new List<Model.ClsSb_EquipDotCheckPlanBillSub>(); + ls = oListModels.getObjectByJson_Sb_EquipDotCheckPlanBillSub(msg3); + int i = 0; + foreach (Model.ClsSb_EquipDotCheckPlanBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //HMaterID = "";//閰嶄欢浠g爜 + //HUnitID = "";//鍗曚綅浠g爜 + //HQty = "";//瀹為檯鐢ㄩ噺 + //HQtyMust = "";//鍗曚綅鐢ㄩ噺 + //HRemark = "";//澶囨敞 + + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 [璁惧鐐规璁″垝琛ㄥ垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sb_EquipDotCheckPlanBill/DeltetEquipDotCheckPlanBillList")] + [HttpGet] + public object DeltetEquipDotCheckPlanBillList(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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.ClsSb_EquipDotCheckPlanBill oBill = new DAL.ClsSb_EquipDotCheckPlanBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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("Sb_EquipDotCheckPlanBill/Sb_EquipDotCheckPlanBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sb_EquipDotCheckPlanBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipDotCheckPlanBillList where hmainid= " + HID + " ", "h_v_Sb_EquipDotCheckPlanBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ偣妫�璁″垝琛�" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + #region[璁惧鐐规璁″垝琛ㄧ紪杈戞椂鑾峰彇琛ㄩ鏁版嵁] + [Route("Sb_EquipDotCheckPlanBill/Sb_EquipDotCheckPlanBillListProjectDetai")] + [HttpGet] + public object Sb_EquipDotCheckPlanBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn("select 鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart ,鍏蜂綋瑕佹眰 HClaim,琛ㄤ綋澶囨敞 HRemark,HManagerID from h_v_Sb_EquipDotCheckPlanBillList_Edit", "h_v_Sb_EquipDotCheckPlanBillList_Edit"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + string sql1 = "select 鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,琛ㄤ綋澶囨敞 HRemark,HManagerID from h_v_Sb_EquipDotCheckPlanBillList_Edit where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckPlanBillList_Edit"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁″垝锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + + + + + #endregion + + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs new file mode 100644 index 0000000..1b48c2b --- /dev/null +++ b/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs @@ -0,0 +1,513 @@ +锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections.Generic; +using System.Data; +using System.Web.Http; +using WebAPI.Models; +namespace WebAPI.Controllers +{ + public class Sb_EquipMaintainBillController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + + public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛� + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + public DAL.ClsSb_EquipDotCheckBill BillNew = new DAL.ClsSb_EquipDotCheckBill(); //瀵瑰簲鍗曟嵁绫� + public DAL.ClsSb_EquipDotCheckBill BillOld = new DAL.ClsSb_EquipDotCheckBill(); //瀵瑰簲鍗曟嵁绫� + + #region 璁惧淇濆吇璁″垝琛� + + /// <summary> + /// 璁惧淇濆吇璁″垝琛ㄥ垪琛� list鍒楄〃鏁版嵁鍔犺浇 + /// </summary> + /// <returns></returns> + [Route("Sb_EquipMaintainBill/GetEquipMaintainBillList")] + [HttpGet] + public object GetEquipMaintainBillList(string sWhere) + { + try + { + ds = Sb_EquipMaintainBillList_s(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + #region sql璇彞 + + + public static DataSet Sb_EquipMaintainBillList_s(string sWhere) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipMaintainBillList ", "h_v_Sb_EquipMaintainBillList"); + } + #endregion + + #region 璁惧淇濆吇璁″垝琛� 淇濆瓨/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sb_EquipMaintainBill/SaveEquipMaintainBillList")] + [HttpPost] + public object SaveEquipMaintainBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DAL.ClsSb_EquipMaintainBill oBill = new DAL.ClsSb_EquipMaintainBill(); + List<Model.ClsSb_EquipMaintainBillMain> lsmain = new List<Model.ClsSb_EquipMaintainBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sb_EquipMaintainBillMain(msg2); + foreach (Model.ClsSb_EquipMaintainBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3901"; + oItem.HBillSubType = "3901"; + + //oItem.HInterID =0; + //oItem.HBillNo = ""; + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + //oItem.HMakeDate = ""; + //oItem.HYear = ""; + //oItem.HPeriod = ""; + //oItem.HRemark = ""; + //oItem.HCycleUnit = ""; + //oItem.HCheckCycle = ""; + //oItem.HBeginDate = ""; + //oItem.HEndDate = ""; + //oItem.HInnerBillNo = ""; + //oItem.HExplanation = ""; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSb_EquipMaintainBillSub> ls = new List<Model.ClsSb_EquipMaintainBillSub>(); + ls = oListModels.getObjectByJson_Sb_EquipMaintainBillSub(msg3); + int i = 0; + foreach (Model.ClsSb_EquipMaintainBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //HMaterID = "";//閰嶄欢浠g爜 + //HUnitID = "";//鍗曚綅浠g爜 + //HQty = "";//瀹為檯鐢ㄩ噺 + //HQtyMust = "";//鍗曚綅鐢ㄩ噺 + //HRemark = "";//澶囨敞 + + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 [璁惧淇濆吇璁″垝琛ㄥ垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sb_EquipMaintainBill/DeltetEquipMaintainBillList")] + [HttpGet] + public object DeltetEquipMaintainBillList(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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.ClsSb_EquipMaintainBill oBill = new DAL.ClsSb_EquipMaintainBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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("Sb_EquipMaintainBill/Sb_EquipMaintainBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sb_EquipMaintainBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipMaintainBillList where hmainid= " + HID + " ", "h_v_Sb_EquipMaintainBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄨ澶囦繚鍏昏褰曡〃" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + #region[璁惧淇濆吇璁″垝琛ㄧ紪杈戞椂鑾峰彇琛ㄩ鏁版嵁] + [Route("Sb_EquipMaintainBill/Sb_EquipMaintainBillListProjectDetai")] + [HttpGet] + public object Sb_EquipMaintainBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn("select 瀹為檯鐢ㄩ噺 HQty,HMaterID, HUnitID ,琛ㄤ綋澶囨敞 HRemark,HManagerID from h_v_Sb_EquipMaintainBillList", "h_v_Sb_EquipMaintainBillList_Edit"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + string sql1 = "select 瀹為檯鐢ㄩ噺 HQty,HMaterID, HUnitID ,琛ㄤ綋澶囨敞 HRemark,HManagerID from h_v_Sb_EquipMaintainBillList where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainBillList"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁″垝锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + + + + + #endregion + + + + #region 璁惧淇濆吇璁板綍鍗昉DA + + #region 鏍规嵁璁惧鏉$爜鏌ユ壘璁惧妗f淇℃伅PDA + [Route("Sb_PDA_EquipMaintainBill/txtHBarCode_KeyDown")] + [HttpGet] + public object txtHBarCode_KeyDown(string HBarCode) + { + try + { + if (HBarCode == null || HBarCode.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏉″舰鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = null; + return objJsonResult; + } + //寰楀埌淇℃伅 + ds = oCN.RunProcReturn("select top 1 * from Gy_EquipMent where HNumber= '" + HBarCode + "'", "Gy_EquipMent"); + //鍐欏叆淇℃伅 + if (ds == null || 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 + + [Route("Sb_PDA_EquipMaintainBill/SaveGetEquipMaintainBillList")] + [HttpPost] + public object SaveGetEquipMaintainBillList([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 UserName = ""; + + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSb_EquipMaintainBill oBill = new DLL.ClsSb_EquipMaintainBill(); + List<Models.ClsSb_EquipMaintainBillMain > lsmain = new List<Models.ClsSb_EquipMaintainBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sb_EquipMaintainBillMainPDA(msg2); + foreach (Models.ClsSb_EquipMaintainBillMain oItem in lsmain) + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = 1; + return objJsonResult; + } + + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3901"; + oItem.HBillSubType = "3901"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + //瀛愯〃浣撴暟鎹� + + List<Models.ClsSb_EquipMaintainBillSub> ls = new List<Models.ClsSb_EquipMaintainBillSub>(); + ls = oListModels.getObjectByJson_Sb_EquipMaintainBillSubPDA(msg2); + int i = 0; + foreach (Models.ClsSb_EquipMaintainBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 + + #endregion + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs new file mode 100644 index 0000000..7c415bd --- /dev/null +++ b/WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs @@ -0,0 +1,323 @@ +锘縰sing Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Web.Http; +using WebAPI.Models; +namespace WebAPI.Controllers +{ + public class Sb_EquipMaintainPlanBillController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + + #region 璁惧淇濆吇璁″垝琛� + + /// <summary> + /// 璁惧淇濆吇璁″垝琛ㄥ垪琛� list鍒楄〃鏁版嵁鍔犺浇 + /// </summary> + /// <returns></returns> + [Route("Sb_EquipMaintainPlanBill/GetEquipMaintainPlanBillList")] + [HttpGet] + public object GetEquipMaintainPlanBillList(string sWhere) + { + try + { + ds = Sb_EquipMaintainPlanBillList_s(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + #region sql璇彞 + + + public static DataSet Sb_EquipMaintainPlanBillList_s(string sWhere) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipMaintainPlanBillList ", "h_v_Sb_EquipMaintainPlanBillList"); + } + #endregion + + #region 璁惧淇濆吇璁″垝琛� 淇濆瓨/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sb_EquipMaintainPlanBill/SaveEquipMaintainPlanBillList")] + [HttpPost] + public object SaveEquipMaintainPlanBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DAL.ClsSb_EquipMaintainPlanBill oBill = new DAL.ClsSb_EquipMaintainPlanBill(); + List<Model.ClsSb_EquipMaintainPlanBillMain> lsmain = new List<Model.ClsSb_EquipMaintainPlanBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sb_EquipMaintainPlanBillMain(msg2); + foreach (Model.ClsSb_EquipMaintainPlanBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3902"; + oItem.HBillSubType = "3902"; + + //oItem.HInterID =0; + //oItem.HBillNo = ""; + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + //oItem.HMakeDate = ""; + //oItem.HYear = ""; + //oItem.HPeriod = ""; + //oItem.HRemark = ""; + //oItem.HCycleUnit = ""; + //oItem.HCheckCycle = ""; + //oItem.HBeginDate = ""; + //oItem.HEndDate = ""; + //oItem.HInnerBillNo = ""; + //oItem.HExplanation = ""; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSb_EquipMaintainPlanBillSub> ls = new List<Model.ClsSb_EquipMaintainPlanBillSub>(); + ls = oListModels.getObjectByJson_Sb_EquipMaintainPlanBillSub(msg3); + int i = 0; + foreach (Model.ClsSb_EquipMaintainPlanBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //HMaterID = "";//閰嶄欢浠g爜 + //HUnitID = "";//鍗曚綅浠g爜 + //HQty = "";//瀹為檯鐢ㄩ噺 + //HQtyMust = "";//鍗曚綅鐢ㄩ噺 + //HRemark = "";//澶囨敞 + + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 [璁惧淇濆吇璁″垝琛ㄥ垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sb_EquipMaintainPlanBill/DeltetEquipMaintainPlanBillList")] + [HttpGet] + public object DeltetEquipMaintainPlanBillList(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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.ClsSb_EquipMaintainPlanBill oBill = new DAL.ClsSb_EquipMaintainPlanBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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("Sb_EquipMaintainPlanBill/Sb_EquipMaintainPlanBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sb_EquipMaintainPlanBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipMaintainPlanBillList where hmainid= " + HID + " ", "h_v_Sb_EquipMaintainPlanBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ偣妫�璁″垝琛�" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + #region[璁惧淇濆吇璁″垝琛ㄧ紪杈戞椂鑾峰彇琛ㄩ鏁版嵁] + [Route("Sb_EquipMaintainPlanBill/Sb_EquipMaintainPlanBillListProjectDetai")] + [HttpGet] + public object Sb_EquipMaintainPlanBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn("select 鐢ㄩ噺 HQty,HMaterID, HUnitID ,琛ㄤ綋澶囨敞 HRemark from h_v_Sb_EquipMaintainPlanBillList", "h_v_Sb_EquipMaintainPlanBillList_Edit"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + string sql1 = "select 鐢ㄩ噺 HQty,HMaterID, HUnitID ,琛ㄤ綋澶囨敞 HRemark from h_v_Sb_EquipMaintainPlanBillList where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMaintainPlanBillList"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁″垝锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + + + + + #endregion + + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs new file mode 100644 index 0000000..de78d43 --- /dev/null +++ b/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs @@ -0,0 +1,266 @@ +锘縰sing 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.SCGL +{ + public class Sc_MESBeginWorkBillController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + public WebServer webserver = new WebServer(); + + #region 寮�宸ュ崟 + + #region 寮�宸ュ崟鍒楄〃 + + [Route("Sc_MESBeginWorkBill/GetMESBeginWorkBill")] + [HttpGet] + public object GetMESBeginWorkBill(string sWhere) + { + try + { + + ds = Sc_GetMESBeginWorkBill(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public static DataSet Sc_GetMESBeginWorkBill(string sWhere) + { + if (sWhere == null || sWhere.Equals("")) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MESBeginWorkBillList_NEW ", "h_v_Sc_MESBeginWorkBillList_NEW"); + } + else + { + string sql1 = "select * from h_v_Sc_MESBeginWorkBillList_NEW where 1 = 1 "; + string sql = sql1 + sWhere; + return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MESBeginWorkBillList_NEW"); + } + + } + + #endregion + + #region[寮�宸ュ崟缂栬緫鏃惰幏鍙栬〃澶存暟鎹甝 + [Route("Sc_MESBeginWorkBill/Sc_MESBeginWorkBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MESBeginWorkBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MESBeginWorkBillList_NEW where hmainid= " + HID + " ", "h_v_Sc_MESBeginWorkBillList_NEW"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄥ紑宸ュ崟鍙�" }; + + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region 寮�宸ュ崟淇濆瓨/缂栬緫 + /// <summary> + /// 寮�宸ュ崟 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MESBeginWorkBill/SaveGetMESBeginWorkBillList")] + [HttpPost] + public object SaveGetMESBeginWorkBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSc_MESBeginWorkBill oBill = new DLL.ClsSc_MESBeginWorkBill(); + List<Model.ClsSc_MESBeginWorkBillMain> lsmain = new List<Model.ClsSc_MESBeginWorkBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MESBeginWorkBillMain(msg2); + foreach (Model.ClsSc_MESBeginWorkBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3787"; + oItem.HBillSubType = "3787"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + oItem.HBarCodeMakeDate = Convert.ToDateTime(DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"))); //鎵弿鏃ユ湡锛堝勾-鏈�-鏃�-鏃�-鍒�-绉掞級 + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 [寮�宸ュ崟鍒犻櫎鍔熻兘] + /// <summary> + /// 寮�宸ュ崟鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("Sc_MESBeginWorkBill/DeltetMESBeginWorkBill")] + [HttpGet] + public object DeltetMESBeginWorkBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sc_MESBeginWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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; + } + DLL.ClsSc_MESBeginWorkBill oBill = new DLL.ClsSc_MESBeginWorkBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 + + #endregion + } +} diff --git a/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs new file mode 100644 index 0000000..37528b1 --- /dev/null +++ b/WebAPI/Controllers/SCGL/Sc_MESEndWorkBillController.cs @@ -0,0 +1,266 @@ +锘縰sing 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.SCGL +{ + public class Sc_MESEndWorkBillController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + public WebServer webserver = new WebServer(); + + #region 瀹屽伐鍗� + + #region 瀹屽伐鍗曞垪琛� + + [Route("Sc_MESEndWorkBill/GetMESEndWorkBill")] + [HttpGet] + public object GetMESEndWorkBill(string sWhere) + { + try + { + + ds = Sc_GetMESEndWorkBill(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public static DataSet Sc_GetMESEndWorkBill(string sWhere) + { + if (sWhere == null || sWhere.Equals("")) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MESEndWorkBillList_NEW ", "h_v_Sc_MESEndWorkBillList_NEW"); + } + else + { + string sql1 = "select * from h_v_Sc_MESEndWorkBillList_NEW where 1 = 1 "; + string sql = sql1 + sWhere; + return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MESEndWorkBillList_NEW"); + } + + } + + #endregion + + #region[瀹屽伐鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁] + [Route("Sc_MESEndWorkBill/Sc_MESEndWorkBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MESEndWorkBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MESEndWorkBillList_NEW where hmainid= " + HID + " ", "h_v_Sc_MESEndWorkBillList_NEW"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄥ畬宸ュ崟鍙�" }; + + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region 瀹屽伐鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 瀹屽伐鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MESEndWorkBill/SaveGetMESEndWorkBillList")] + [HttpPost] + public object SaveGetMESEndWorkBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSc_MESEndWorkBill oBill = new DLL.ClsSc_MESEndWorkBill(); + List<Model.ClsSc_MESEndWorkBillMain> lsmain = new List<Model.ClsSc_MESEndWorkBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MESEndWorkBillMain(msg2); + foreach (Model.ClsSc_MESEndWorkBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3788"; + oItem.HBillSubType = "3788"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + oItem.HBarCodeMakeDate = Convert.ToDateTime(DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"))); //鎵弿鏃ユ湡锛堝勾-鏈�-鏃�-鏃�-鍒�-绉掞級 + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 [瀹屽伐鍗曞垹闄ゅ姛鑳絔 + /// <summary> + /// 瀹屽伐鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_MESEndWorkBill/DeltetMESEndWorkBill")] + [HttpGet] + public object DeltetMESEndWorkBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sc_MESEndWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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; + } + DLL.ClsSc_MESEndWorkBill oBill = new DLL.ClsSc_MESEndWorkBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 + + #endregion + } +} diff --git a/WebAPI/Controllers/SCGL/Sc_MESStopWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESStopWorkBillController.cs new file mode 100644 index 0000000..d896931 --- /dev/null +++ b/WebAPI/Controllers/SCGL/Sc_MESStopWorkBillController.cs @@ -0,0 +1,262 @@ +锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Web.Http; +using WebAPI.Models; + +namespace WebAPI.Controllers +{ + //鐢熶骇鍋滃伐鍗旵ontroller + public class Sc_MESStopWorkBillController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + #region 鍋滃伐鍗� + + #region 鍋滃伐鍗曞垪琛� + [Route("Sc_MESStopWorkBill/list")] + [HttpGet] + public object list(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_Sc_MESStopWorkBillList_NEW " + sWhere, "h_v_Sc_MESStopWorkBillList_NEW"); + } + else + { + string sql1 = "select * from h_v_Sc_MESStopWorkBillList_NEW where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MESStopWorkBillList_NEW"); + } + 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[鍋滃伐鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁] + [Route("Sc_MESStopWorkBill/Sc_MESStopWorkBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MESStopWorkBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MESStopWorkBillList_NEW where hmainid= " + HID + " ", "h_v_Sc_MESStopWorkBillList_NEW"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄥ仠宸ュ崟鍙�" }; + + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region 鍋滃伐鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 瀹屽伐鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MESStopWorkBill/SaveGetMESStopWorkBillList")] + [HttpPost] + public object SaveGetMESStopWorkBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSc_MESStopWorkBill oBill = new DLL.ClsSc_MESStopWorkBill(); + List<Model.ClsSc_MESStopWorkBillMain> lsmain = new List<Model.ClsSc_MESStopWorkBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MESStopWorkBillMain(msg2); + foreach (Model.ClsSc_MESStopWorkBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3789"; + oItem.HBillSubType = "3789"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + oItem.HBarCodeMakeDate = Convert.ToDateTime(DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"))); //鎵弿鏃ユ湡锛堝勾-鏈�-鏃�-鏃�-鍒�-绉掞級 + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 [鍋滃伐鍗曞垹闄ゅ姛鑳絔 + /// <summary> + /// 瀹屽伐鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_MESStopWorkBill/DeltetMESStopWorkBill")] + [HttpGet] + public object DeltetMESStopWorkBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sc_MESStopWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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; + } + DLL.ClsSc_MESStopWorkBill oBill = new DLL.ClsSc_MESStopWorkBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 + + #endregion + // + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs b/WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs new file mode 100644 index 0000000..c6c0132 --- /dev/null +++ b/WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs @@ -0,0 +1,75 @@ +锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Web.Http; +using WebAPI.Models; + +namespace WebAPI.Controllers +{ + //鐢熶骇涓婃枡鍗旵ontroller + public class Sc_MaterToSourceBillController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + + + /// <summary> + /// 杩斿洖鐢熶骇涓婃枡鍗曞垪琛� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Sc_MaterToSourceBill/list")] + [HttpGet] + public object list(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_Sc_MaterToSourceBillList " + sWhere, "h_v_Sc_MaterToSourceBillList"); + } + else + { + string sql1 = "select * from h_v_Sc_MaterToSourceBillList where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MaterToSourceBillList"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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; + } + } + + + + // + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/SCGL/Sc_QualityReportBillController.cs b/WebAPI/Controllers/SCGL/Sc_QualityReportBillController.cs index e33b355..7dbf923 100644 --- a/WebAPI/Controllers/SCGL/Sc_QualityReportBillController.cs +++ b/WebAPI/Controllers/SCGL/Sc_QualityReportBillController.cs @@ -13,13 +13,17 @@ //鐢熶骇姹囨姤Controller public class Sc_ICMOReportBillController : ApiController { - public DBUtility.ClsPub.Enum_BillStatus BillStatus; + public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛� private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; + public DAL.ClsSc_ICMOReportBill BillNew = new DAL.ClsSc_ICMOReportBill(); //瀵瑰簲鍗曟嵁绫� + public DAL.ClsSc_ICMOReportBill BillOld = new DAL.ClsSc_ICMOReportBill(); //瀵瑰簲鍗曟嵁绫� + #region 鐢熶骇姹囨姤鍗� + #region 鐢熶骇姹囨姤鍗曞垪琛� /// <summary> /// 杩斿洖鐢熶骇姹囨姤鍗曞垪琛� ///鍙傛暟锛歴tring sql銆� @@ -33,30 +37,21 @@ { if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_IF_ICMOReportBillList " + sWhere, "h_v_IF_ICMOReportBillList"); + ds = oCN.RunProcReturn("select * from h_v_IF_ICMOReportBillList_Edit " + sWhere, "h_v_IF_ICMOReportBillList_Edit"); } else { - string sql1 = "select * from h_v_IF_ICMOReportBillList where 1 = 1 "; + string sql1 = "select * from h_v_IF_ICMOReportBillList_Edit where 1 = 1 "; string sql = sql1 + sWhere; - ds = oCN.RunProcReturn(sql, "h_v_IF_ICMOReportBillList"); + ds = oCN.RunProcReturn(sql, "h_v_IF_ICMOReportBillList_Edit"); } - if (ds == null || ds.Tables[0].Rows.Count == 0) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "false锛�"; - objJsonResult.data = null; - return objJsonResult; - } - else - { + objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess锛�"; objJsonResult.data = ds.Tables[0]; return objJsonResult; - } + } catch (Exception e) { @@ -67,6 +62,487 @@ return objJsonResult; } } + #endregion + + #region 鐢熶骇姹囨姤鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁 + [Route("Sc_ICMOReportBill/Sc_GetICMOReportBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_GetICMOReportBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_IF_ICMOReportBillList_Edit where hmainid= " + HID + " ", "h_v_IF_ICMOReportBillList_Edit"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ敓浜ф眹鎶ュ崟鍙�" }; + + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region 鐢熶骇姹囨姤鍗曠紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁 + [Route("Sc_ICMOReportBill/Sc_ICMOReportBillListProjectDetai")] + [HttpGet] + public object Sc_ICMOReportBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,鐗╂枡浠g爜 HMaterCode,鐗╂枡鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec, + HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅 HUnitName,HSourceID,鐢熶骇璧勬簮浠g爜 HSourceCode,鐢熶骇璧勬簮 HSourceName, + HWorkerid,鎿嶄綔鍛樹唬鐮� HWorkerCode,鎿嶄綔鍛� HWorkerName,鐢熶骇鏁伴噺 HQty,琛ㄤ綋澶囨敞 HRemark + FROM h_v_IF_ICMOReportBillList_Edit"), "h_v_IF_ICMOReportBillList_Edit"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + + //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; + string sql1 = string.Format(@"SELECT HMaterID,鐗╂枡浠g爜 HMaterCode,鐗╂枡鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec, + HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅 HUnitName,HSourceID,鐢熶骇璧勬簮浠g爜 HSourceCode,鐢熶骇璧勬簮 HSourceName, + HWorkerid,鎿嶄綔鍛樹唬鐮� HWorkerCode,鎿嶄綔鍛� HWorkerName,鐢熶骇鏁伴噺 HQty,琛ㄤ綋澶囨敞 HRemark + FROM h_v_IF_ICMOReportBillList_Edit where 1 = 1 "); + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_ICMOReportBillList_Edit"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region 鐢熶骇姹囨姤鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿棰嗙敤鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_ICMOReportBill/SaveGetICMOReportBillList")] + [HttpPost] + public object SaveGetICMOReportBillList([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 refSav = sArray[2].ToString(); + + string UserName = ""; + string s = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSc_ICMOReportBill oBill = new DLL.ClsSc_ICMOReportBill(); + List<Model.ClsSc_ICMOReportBillMain> lsmain = new List<Model.ClsSc_ICMOReportBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_ICMOReportBillMain(msg2); + + foreach (Model.ClsSc_ICMOReportBillMain oItem in lsmain) + { + if (refSav == "Add") + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = 1; + return objJsonResult; + } + } + if (refSav == "Update") + { + if (BillOld.ShowBill(oItem.HInterID, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙紪杈� + if (BillOld.omodel.HChecker != ""&& BillOld.omodel.HChecker != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + if (BillOld.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; + objJsonResult.data = 1; + return objJsonResult; + } + } + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3711"; + oItem.HBillSubType = "3711"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSc_ICMOReportBillSub> ls = new List<Model.ClsSc_ICMOReportBillSub>(); + ls = oListModels.getObjectByJson_Gy_ICMOReportBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_ICMOReportBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 鐢熶骇姹囨姤鍗曞垹闄ゅ姛鑳� + /// <summary> + /// 妯″叿澶勭悊棰嗙敤鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_ICMOReportBill/DeltetICMOReportBill")] + [HttpGet] + public object DeltetMouldLifeChangeBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sc_ICMOReportBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + string s = ""; + 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; + } + DLL.ClsSc_ICMOReportBill oBill = new DLL.ClsSc_ICMOReportBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (BillOld.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowDeleteBill(BillOld, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽鍒犻櫎"; + objJsonResult.data = null; + return objJsonResult; + } + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 [鐢熶骇姹囨姤鍗曞鏍搞�佸弽瀹℃牳] + /// <summary> + /// + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param> + /// <param name="CurUserName">瀹℃牳浜�</param> + /// <returns></returns> + [Route("Sc_ICMOReportBill/AuditProcessReportList")] + [HttpGet] + public object AuditProcessReportList(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "Sc_ICMOReportBill_Check"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); + DLL.ClsSc_ICMOReportBill oBill = new DLL.ClsSc_ICMOReportBill(); + //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //瀹℃牳鎻愪氦 + { + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍告彁浜� + { + //鍙嶅鏍告彁浜bandonCheck + if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍告垚鍔�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #endregion + /// <summary> /// 杩斿洖鐢熶骇璐ㄩ噺姹囨姤鍗曞垪琛� diff --git a/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs b/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs new file mode 100644 index 0000000..1bcf03f --- /dev/null +++ b/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs @@ -0,0 +1,1203 @@ +锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; +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 +{ + public class Sb_CheckEqpRepairWorkBillController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + public WebServer webserver = new WebServer(); + + + public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛� + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + public DAL.ClsSb_EquipDotCheckBill BillNew = new DAL.ClsSb_EquipDotCheckBill(); //瀵瑰簲鍗曟嵁绫� + public DAL.ClsSb_EquipDotCheckBill BillOld = new DAL.ClsSb_EquipDotCheckBill(); //瀵瑰簲鍗曟嵁绫� + + + #region 璁惧缁翠慨宸ュ崟鍒楄〃 + /// <summary> + /// 璁惧缁翠慨宸ュ崟琛ㄥ垪琛� + /// </summary> + /// <returns></returns> + [Route("Sb_EqpRepairWorkBill/GetEqpRepairWorkBillList")] + [HttpGet] + public object GetEqpRepairWorkBillList(string sWhere) + { + try + { + + ds = Sb_EquipRepairWorkBill_s(sWhere); + + + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璁惧缁翠慨宸ュ崟鍒楄〃sql璇彞 + public static DataSet Sb_EquipRepairWorkBill_s(string sWhere) + { + if (sWhere == null || sWhere.Equals("")) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipRepairWorkBillList "+sWhere, "h_v_Sb_EquipRepairWorkBillList"); + } + else + { + string sql1 = "select * from h_v_Sb_EquipRepairWorkBillList where 1 = 1 "; + string sql = sql1 + sWhere; + return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sb_EquipRepairWorkBillList"); + } + + } + #endregion + + + + #region 璁惧缁翠慨楠屾敹鍗曞垪琛� + /// <summary> + /// 璁惧缁翠慨楠屾敹鍗曞垪琛� + /// </summary> + /// <returns></returns> + [Route("Sb_EqpRepairWorkBill/GetEqpRepairCheckWorkBillList")] + [HttpGet] + public object GetEqpRepairCheckWorkBillList(string sWhere) + { + try + { + + ds = Sb_EquipRepairCheckWorkBill_s(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璁惧缁翠慨楠屾敹鍗曞垪琛╯ql璇彞 + public static DataSet Sb_EquipRepairCheckWorkBill_s(string sWhere) + { + if (sWhere == null || sWhere.Equals("")) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipRepairCheckBillList" + sWhere, "h_v_Sb_EquipRepairCheckBillList"); + } + else + { + string sql1 = "select * from h_v_Sb_EquipRepairCheckBillList where 1 = 1 "; + string sql = sql1 + sWhere; + return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sb_EquipRepairCheckBillList"); + } + + } + #endregion + + + + #region 璁惧鏁呴殰鐧昏鍗曞垪琛� + /// <summary> + /// 璁惧鏁呴殰鐧昏鍗曞垪琛� + /// </summary> + /// <returns></returns> + [Route("Sb_EqpRepairWorkBill/GetEqpConkBookBillList")] + [HttpGet] + public object GetEqpConkBookBillList(string sWhere) + { + try + { + + ds = Sb_EqpConkBookBillList_s(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璁惧鏁呴殰鐧昏鍗曞垪琛╯ql璇彞 + public static DataSet Sb_EqpConkBookBillList_s(string sWhere) + { + if (sWhere == null || sWhere.Equals("")) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sb_EquipConkBookBillList" + sWhere, "h_v_Sb_EquipConkBookBillList"); + } + else + { + string sql1 = "select * from h_v_Sb_EquipConkBookBillList where 1 = 1 "; + string sql = sql1 + sWhere; + return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sb_EquipConkBookBillList"); + } + } + #endregion + + + + + + #region 璁惧缁翠慨鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 淇濆瓨璁惧缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sb_EqpRepairWorkBill/SaveGetEqpRepairWorkBillList")] + [HttpPost] + public object SaveGetMouldRepairWorkBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSb_EquipRepairWorkBill oBill = new DLL.ClsSb_EquipRepairWorkBill(); + List<Models.ClsSb_EquipRepairWorkBillMain> lsmain = new List<Models.ClsSb_EquipRepairWorkBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_EquipRepairWorkBillMain(msg2); + foreach (Models.ClsSb_EquipRepairWorkBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + //UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3910"; + oItem.HBillSubType = "3910"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HRepairBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨寮�濮嬫棩鏈� + //oItem.HRepairEndDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --缁翠慨缁撴潫鏃ユ湡 + //oItem.HRepairContent = ""; //缁翠慨鍐呭 + //oItem.HCycleUnit = ""; //鏃堕棿鍗曚綅(灏忔椂锛屽ぉ) + //oItem.HPlanTimes = 0; //璁″垝缁翠慨宸ユ椂 + //oItem.HTimes = 0; //瀹為檯缁翠慨宸ユ椂 + //oItem.HEmpID = 0; //缁翠慨浜�(Gy_Employee) + //oItem.HManagerID = 0; //涓荤(Gy_Employee) + //oItem.HDeptID = 0; //缁翠慨閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //--缁翠慨瑕佹眰 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + //oItem.HMouldID = 0; //鎴愬搧妯″叿ID + //oItem.HSupID = 0; //--渚涘簲鍟嗭紙Gy_Supplier锛� + //oItem.HRepairType = ""; //--缁翠慨绫诲瀷锛堝唴閮ㄧ淮淇紝濮斿缁翠慨锛� addnew + //oItem.HNewModel = ""; //缁翠慨鍚庢柊瑙勬牸 + //oItem.HNewDesignLife = 0; //鏂拌璁″鍛� + //oItem.HRepairID = 0; //缁翠慨椤圭洰(Gy_Repair) + //oItem.HRemark = ""; //澶囨敞 + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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<Models.ClsSb_EquipRepairWorkBillSub> ls = new List<Models.ClsSb_EquipRepairWorkBillSub>(); + ls = oListModels.getObjectByJson_Gy_EquipRepairWorkBillSub(msg3); + int i = 0; + foreach (Models.ClsSb_EquipRepairWorkBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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("Sb_EqpRepairWorkBill/Sb_EqpRepairWorkBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sb_EqpRepairWorkBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipRepairWorkBillList where hmainid= " + HID + " ", "h_v_Sb_EquipRepairWorkBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ淮淇崟鍙�" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region[璁惧缁翠慨鍒楄〃缂栬緫鏃惰幏鍙栬〃浣撴暟鎹甝 + [Route("Sb_EqpRepairWorkBill/Sb_EqpRepairWorkBillListProjectDetai")] + [HttpGet] + public object Sb_EqpRepairWorkBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + //ds = oCN.RunProcReturn("select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub", "Sc_MouldRepairWorkBillSub"); + ds = oCN.RunProcReturn("select HManagerID1,琛ㄤ綋璐熻矗浜轰唬鐮� HManagerCode,琛ㄤ綋璐熻矗浜� HManagerName,HRepairID1, 琛ㄤ綋缁翠慨椤圭洰浠g爜 HRepairCode,琛ㄤ綋缁翠慨椤圭洰 HRepairName,琛ㄤ綋缁翠慨瑕佹眰 HRepairExplanation,琛ㄤ綋澶囨敞 HRemark from h_v_Sc_EquipRepairWorkBillList_Edit", "h_v_Sc_EquipRepairWorkBillList_Edit"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + //string sql1 = "select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub where 1 = 1 "; + string sql1 = "select HManagerID1,琛ㄤ綋璐熻矗浜轰唬鐮� HManagerCode,琛ㄤ綋璐熻矗浜� HManagerName,HRepairID1, 琛ㄤ綋缁翠慨椤圭洰浠g爜 HRepairCode,琛ㄤ綋缁翠慨椤圭洰 HRepairName,琛ㄤ綋缁翠慨瑕佹眰 HRepairExplanation,琛ㄤ綋澶囨敞 HRemark from h_v_Sc_EquipRepairWorkBillList_Edit where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_EquipRepairWorkBillList_Edit"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region [璁惧缁翠慨鍗曞垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sb_EqpRepairWorkBill/DeltetEqpRepairWorkBill")] + [HttpGet] + public object DeltetEqpRepairWorkBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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; + } + DLL.ClsSb_EquipRepairWorkBill oBill = new DLL.ClsSb_EquipRepairWorkBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 璁惧缁翠慨楠屾敹鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 淇濆瓨璁惧缁翠慨楠屾敹鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sb_EqpRepairWorkBill/SaveGetEqpRepairCheckBillList")] + [HttpPost] + public object SaveGetEqpRepairCheckBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSb_EquipRepairCheckBill oBill = new DLL.ClsSb_EquipRepairCheckBill(); + List<Model.ClsSb_EquipRepairCheckBillMain> lsmain = new List<Model.ClsSb_EquipRepairCheckBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_EquipRepairCheckBillMain(msg2); + foreach (Model.ClsSb_EquipRepairCheckBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + //UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3911"; + oItem.HBillSubType = "3911"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HRepairBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨寮�濮嬫棩鏈� + //oItem.HRepairEndDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --缁翠慨缁撴潫鏃ユ湡 + //oItem.HRepairContent = ""; //缁翠慨鍐呭 + //oItem.HCycleUnit = ""; //鏃堕棿鍗曚綅(灏忔椂锛屽ぉ) + //oItem.HPlanTimes = 0; //璁″垝缁翠慨宸ユ椂 + //oItem.HTimes = 0; //瀹為檯缁翠慨宸ユ椂 + //oItem.HEmpID = 0; //缁翠慨浜�(Gy_Employee) + //oItem.HManagerID = 0; //涓荤(Gy_Employee) + //oItem.HDeptID = 0; //缁翠慨閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //--缁翠慨瑕佹眰 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + //oItem.HMouldID = 0; //鎴愬搧妯″叿ID + //oItem.HSupID = 0; //--渚涘簲鍟嗭紙Gy_Supplier锛� + //oItem.HRepairType = ""; //--缁翠慨绫诲瀷锛堝唴閮ㄧ淮淇紝濮斿缁翠慨锛� addnew + //oItem.HNewModel = ""; //缁翠慨鍚庢柊瑙勬牸 + //oItem.HNewDesignLife = 0; //鏂拌璁″鍛� + //oItem.HRepairID = 0; //缁翠慨椤圭洰(Gy_Repair) + //oItem.HRemark = ""; //澶囨敞 + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSb_EquipRepairCheckBillSub> ls = new List<Model.ClsSb_EquipRepairCheckBillSub>(); + ls = oListModels.getObjectByJson_Gy_EquipRepairCheckBillSub(msg3); + int i = 0; + foreach (Model.ClsSb_EquipRepairCheckBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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("Sb_EqpRepairWorkBill/Sb_EqpRepairCheckBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sb_EqpRepairCheckBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipRepairCheckBillList_Edit where hmainid= " + HID + " ", "h_v_Sb_EquipRepairCheckBillList_Edit"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ淮淇崟鍙�" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region[璁惧缁翠慨鍒楄〃缂栬緫鏃惰幏鍙栬〃浣撴暟鎹甝 + [Route("Sb_EqpRepairWorkBill/Sb_EqpRepairCheckBillListProjectDetai")] + [HttpGet] + public object Sb_EqpRepairCheckBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + //ds = oCN.RunProcReturn("select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub", "Sc_MouldRepairWorkBillSub"); + ds = oCN.RunProcReturn("select HRepairCheckID1 HRepairCheckID,楠屾敹椤圭洰浠g爜 HRepairCheckCode,楠屾敹椤圭洰 HRepairCheckName, 楠屾敹鍐呭 HRepairCheckContent,HManagerID1 HManagerID,琛ㄤ綋璐熻矗浜轰唬鐮� HManagerCode,琛ㄤ綋璐熻矗浜� HManagerName,琛ㄤ綋澶囨敞 HRemark from h_v_Sb_EquipRepairCheckBillList_Edit", "h_v_Sb_EquipRepairCheckBillList_Edit"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + //string sql1 = "select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub where 1 = 1 "; + string sql1 = "select HRepairCheckID1 HRepairCheckID,楠屾敹椤圭洰浠g爜 HRepairCheckCode,楠屾敹椤圭洰 HRepairCheckName, 楠屾敹鍐呭 HRepairCheckContent,HManagerID1 HManagerID,琛ㄤ綋璐熻矗浜轰唬鐮� HManagerCode,琛ㄤ綋璐熻矗浜� HManagerName,琛ㄤ綋澶囨敞 HRemark from h_v_Sb_EquipRepairCheckBillList_Edit where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipRepairCheckBillList_Edit"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region [璁惧缁翠慨鍗曞垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sb_EqpRepairWorkBill/DeltetEqpRepairCheckBill")] + [HttpGet] + public object DeltetEqpRepairCheckBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sb_EquipRepairCheckBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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.ClsSb_EquipRepairCheckBill oBill = new DAL.ClsSb_EquipRepairCheckBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 璁惧鏁呴殰鐧昏鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 淇濆瓨璁惧鏁呴殰鐧昏鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sb_EqpRepairWorkBill/SaveGetEqpConkBookBillList")] + [HttpPost] + public object SaveGetEqpConkBookBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSb_EquipConkBookBill oBill = new DLL.ClsSb_EquipConkBookBill(); + List<Model.ClsSb_EquipConkBookBillMain> lsmain = new List<Model.ClsSb_EquipConkBookBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_EquipConkBookBillMain(msg2); + foreach (Model.ClsSb_EquipConkBookBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + //UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3097"; + oItem.HBillSubType = "3097"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HRepairBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨寮�濮嬫棩鏈� + //oItem.HRepairEndDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --缁翠慨缁撴潫鏃ユ湡 + //oItem.HRepairContent = ""; //缁翠慨鍐呭 + //oItem.HCycleUnit = ""; //鏃堕棿鍗曚綅(灏忔椂锛屽ぉ) + //oItem.HPlanTimes = 0; //璁″垝缁翠慨宸ユ椂 + //oItem.HTimes = 0; //瀹為檯缁翠慨宸ユ椂 + //oItem.HEmpID = 0; //缁翠慨浜�(Gy_Employee) + //oItem.HManagerID = 0; //涓荤(Gy_Employee) + //oItem.HDeptID = 0; //缁翠慨閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //--缁翠慨瑕佹眰 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + //oItem.HMouldID = 0; //鎴愬搧妯″叿ID + //oItem.HSupID = 0; //--渚涘簲鍟嗭紙Gy_Supplier锛� + //oItem.HRepairType = ""; //--缁翠慨绫诲瀷锛堝唴閮ㄧ淮淇紝濮斿缁翠慨锛� addnew + //oItem.HNewModel = ""; //缁翠慨鍚庢柊瑙勬牸 + //oItem.HNewDesignLife = 0; //鏂拌璁″鍛� + //oItem.HRepairID = 0; //缁翠慨椤圭洰(Gy_Repair) + //oItem.HRemark = ""; //澶囨敞 + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSb_EquipConkBookBillSub> ls = new List<Model.ClsSb_EquipConkBookBillSub>(); + ls = oListModels.getObjectByJson_Gy_EquipConkBookBillSub(msg3); + int i = 0; + foreach (Model.ClsSb_EquipConkBookBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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("Sb_EqpRepairWorkBill/Sb_EqpConkBookBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sb_EqpConkBookBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sb_EquipConkBookBillList_Edit where hmainid= " + HID + " ", "h_v_Sb_EquipConkBookBillList_Edit"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ淮淇崟鍙�" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region[璁惧缁翠慨鍒楄〃缂栬緫鏃惰幏鍙栬〃浣撴暟鎹甝 + [Route("Sb_EqpRepairWorkBill/Sb_EqpConkBookBillListProjectDetai")] + [HttpGet] + public object Sb_EqpConkBookBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + //ds = oCN.RunProcReturn("select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub", "Sc_MouldRepairWorkBillSub"); + ds = oCN.RunProcReturn("select HConkReasonID,鏁呴殰鍘熷洜浠g爜 HConkReasonCode,鏁呴殰鍘熷洜鍚嶇О HConkReasonName,鏁呴殰鍘熷洜鎻忚堪 HConkExplanation,HManagerID1 HManagerID,琛ㄤ綋璐熻矗浜轰唬鐮� HManagerCode,琛ㄤ綋璐熻矗浜� HManagerName,琛ㄤ綋澶囨敞 HRemark from h_v_Sb_EquipConkBookBillList_Edit", "h_v_Sb_EquipConkBookBillList_Edit"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + //string sql1 = "select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub where 1 = 1 "; + string sql1 = "select HConkReasonID,鏁呴殰鍘熷洜浠g爜 HConkReasonCode,鏁呴殰鍘熷洜鍚嶇О HConkReasonName,鏁呴殰鍘熷洜鎻忚堪 HConkExplanation,HManagerID1 HManagerID,琛ㄤ綋璐熻矗浜轰唬鐮� HManagerCode,琛ㄤ綋璐熻矗浜� HManagerName,琛ㄤ綋澶囨敞 HRemark from h_v_Sb_EquipConkBookBillList_Edit where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipConkBookBillList_Edit"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region [璁惧缁翠慨鍗曞垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sb_EqpRepairWorkBill/DeltetEqpConkBookBill")] + [HttpGet] + public object DeltetEqpConkBookBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sb_EquipConkBookBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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; + } + DLL.ClsSb_EquipConkBookBill oBill = new DLL.ClsSb_EquipConkBookBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 璁惧缁翠慨鍗昉DA + + #region 鏍规嵁璁惧鏉$爜鏌ユ壘璁惧妗f淇℃伅PDA + [Route("Sb_PDA_EqpRepairWorkBill/txtHBarCode_KeyDown")] + [HttpGet] + public object txtHBarCode_KeyDown(string HBarCode) + { + try + { + if (HBarCode == null || HBarCode.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏉″舰鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = null; + return objJsonResult; + } + //寰楀埌淇℃伅 + ds = oCN.RunProcReturn("select top 1 * from Gy_EquipMent where HNumber= '" + HBarCode + "'", "Gy_EquipMent"); + //鍐欏叆淇℃伅 + if (ds == null || 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 + + [Route("Sb_PDA_EqpRepairWorkBill/SaveGetEqpRepairWorkBillList")] + [HttpPost] + public object SaveGetEqpRepairWorkBillList([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 UserName = ""; + + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSb_EquipRepairWorkBill oBill = new DLL.ClsSb_EquipRepairWorkBill(); + List<Models.ClsSb_EquipRepairWorkBillMain> lsmain = new List<Models.ClsSb_EquipRepairWorkBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sb_EqpRepairWorkBillMainPDA(msg2); + foreach (Models.ClsSb_EquipRepairWorkBillMain oItem in lsmain) + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = 1; + return objJsonResult; + } + + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3910"; + oItem.HBillSubType = "3910"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + //瀛愯〃浣撴暟鎹� + + List<Models.ClsSb_EquipRepairWorkBillSub> ls = new List<Models.ClsSb_EquipRepairWorkBillSub>(); + ls = oListModels.getObjectByJson_Sb_EquipRepairWorkBillSubPDA(msg2); + int i = 0; + foreach (Models.ClsSb_EquipRepairWorkBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 + + #endregion + } +} diff --git a/WebAPI/Controllers/Sc_CheckToolsRepairWorkBillController.cs b/WebAPI/Controllers/Sc_CheckToolsRepairWorkBillController.cs index 18d1120..1f9f379 100644 --- a/WebAPI/Controllers/Sc_CheckToolsRepairWorkBillController.cs +++ b/WebAPI/Controllers/Sc_CheckToolsRepairWorkBillController.cs @@ -1,4 +1,5 @@ 锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; using System; using System.Collections.Generic; using System.Data; @@ -11,9 +12,15 @@ */ public class Sc_CheckToolsRepairWorkBillController : ApiController { + public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛� + private json objJsonResult = new json(); public DataSet ds = new DataSet(); public WebServer webserver = new WebServer(); + + public DAL.ClsSc_MouldScrapInBill BillNew0 = new DAL.ClsSc_MouldScrapInBill(); //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫� + public DAL.ClsSc_MouldScrapInBill BillOld0 = new DAL.ClsSc_MouldScrapInBill(); //妯″叿鎶ュ簾鍏ュ簱瀵瑰簲鍗曟嵁绫� + /// <summary> /// 鏍规嵁鍖呰鍗� 杩斿洖姝ゅ寘瑁呭崟鍐呯殑鐩稿叧淇℃伅 @@ -464,7 +471,7 @@ /// <summary> - /// 妯″叿鏁呴殰鐧昏琛ㄥ垪琛� + /// 妯″叿缁翠慨楠屾敹鍗曞垪琛� /// </summary> /// <returns></returns> [Route("Sc_MouldRepairCheckBill/GetMouldRepairCheckBillList")] @@ -475,22 +482,12 @@ { ds = Sc_MouldRepairCheckBillList_s(sWhere); - if (ds == null || ds.Tables[0].Rows.Count <= 0) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; - objJsonResult.data = null; - return objJsonResult; - } - else - { - objJsonResult.code = "1"; - objJsonResult.count = 1; - objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; - objJsonResult.data = ds.Tables[0]; - return objJsonResult; - } + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } catch (Exception ex) { @@ -1337,14 +1334,14 @@ if (string.IsNullOrEmpty(HID)) return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); - var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldRepairWorkBillList where hmainid= " + HID + " ", "h_v_Sc_MouldRepairWorkBillList"); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldRepairWorkBillList_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldRepairWorkBillList_Edit"); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ淮淇崟鍙�" }; return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; } #endregion - #region[妯″叿缁翠慨鍒楄〃缂栬緫鏃惰幏鍙栬〃棰樻暟鎹甝 + #region[妯″叿缁翠慨鍒楄〃缂栬緫鏃惰幏鍙栬〃浣撴暟鎹甝 [Route("Sb_MouldRepairWorkBill/Sb_MouldRepairWorkBillListProjectDetai")] [HttpGet] public object Sb_MouldRepairWorkBillListProjectDetai(string sqlWhere) @@ -1355,7 +1352,8 @@ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { - ds = oCN.RunProcReturn("select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub", "Sc_MouldRepairWorkBillSub"); + //ds = oCN.RunProcReturn("select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub", "Sc_MouldRepairWorkBillSub"); + ds = oCN.RunProcReturn("select HRepairSonID HRepairID, 瀛愮淮淇」鐩唬鐮� HRepairCode,瀛愮淮淇」鐩� HRepairName,瀛愮淮淇姹� HRepairExplanation,HManagerSonID HManagerID,瀛愯礋璐d汉浠g爜 HManagerCode,瀛愯礋璐d汉 HManagerName,缁翠慨璐圭敤 HMoney,琛ㄤ綋澶囨敞 HRemark from h_v_Sc_MouldRepairWorkBillList_Edit", "h_v_Sc_MouldRepairWorkBillList_Edit"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; @@ -1363,9 +1361,10 @@ } else { - string sql1 = "select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub where 1 = 1 "; + //string sql1 = "select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub where 1 = 1 "; + string sql1 = "select HRepairSonID HRepairID, 瀛愮淮淇」鐩唬鐮� HRepairCode,瀛愮淮淇」鐩� HRepairName,瀛愮淮淇姹� HRepairExplanation,HManagerSonID HManagerID,瀛愯礋璐d汉浠g爜 HManagerCode,瀛愯礋璐d汉 HManagerName,缁翠慨璐圭敤 HMoney,琛ㄤ綋澶囨敞 HRemark from h_v_Sc_MouldRepairWorkBillList_Edit where 1 = 1 "; string sql = sql1 + sqlWhere; - ds = oCN.RunProcReturn(sql, "Sc_MouldRepairWorkBillSub"); + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairWorkBillList_Edit"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; @@ -1434,7 +1433,7 @@ } bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); - if(IsDete) + if (IsDete) { objJsonResult.code = "0"; objJsonResult.count = 1; @@ -1463,5 +1462,3780 @@ } #endregion + #region [妯″叿缁翠慨鍗曞鏍搞�佸弽瀹℃牳] + /// <summary> + /// + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param> + /// <param name="CurUserName">瀹℃牳浜�</param> + /// <returns></returns> + [Route("Sb_MouldRepairWorkBill/AuditProcessReportList")] + [HttpGet] + public object AuditProcessReportList(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "Sb_MouldRepairWorkBill_Check"; + DBUtility.ClsPub.CurUserName=CurUserName; + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); + DAL.ClsSb_MouldRepairWorkBill oBill = new DAL.ClsSb_MouldRepairWorkBill(); + //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //瀹℃牳鎻愪氦 + { + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍告彁浜� + { + //鍙嶅鏍告彁浜bandonCheck + if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍告垚鍔�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + + + #region 妯″叿缁翠慨楠屾敹鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldRepairCheckBill/SaveGetMouldRepairCheckBillList")] + [HttpPost] + public object SaveGetMouldRepairCheckBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSc_MouldRepairCheckBill oBill = new DLL.ClsSc_MouldRepairCheckBill(); + List<Model.ClsSc_MouldRepairCheckBillMain> lsmain = new List<Model.ClsSc_MouldRepairCheckBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MouldRepairCheckBillMain(msg2); + foreach (Model.ClsSc_MouldRepairCheckBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3817"; + oItem.HBillSubType = "3817"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSc_MouldRepairCheckBillSub> ls = new List<Model.ClsSc_MouldRepairCheckBillSub>(); + ls = oListModels.getObjectByJson_Gy_MouldRepairCheckBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_MouldRepairCheckBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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("Sc_MouldRepairCheckBill/Sb_MouldRepairCheckBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sb_MouldRepairCheckBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldRepairCheckBillList_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldRepairCheckBillList_Edit"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ淮淇崟鍙�" }; + + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region[妯″叿缁翠慨楠屾敹鍗曠紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁] + [Route("Sc_MouldRepairCheckBill/Sb_MouldRepairCheckBillListProjectDetai")] + [HttpGet] + public object Sb_MouldRepairCheckBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + + //ds = oCN.RunProcReturn("select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub", "Sc_MouldRepairCheckBillSub"); + ds = oCN.RunProcReturn("select HRepairCheckID,楠屾敹椤圭洰浠g爜 HRepairCheckCode,楠屾敹椤圭洰 HRepairCheckName,楠屾敹鍐呭 HRepairCheckContent,HManagerSonID HManagerID,瀛愯礋璐d汉浠g爜 HManagerCode,瀛愯礋璐d汉 HManagerName,澶囨敞 HRemark from h_v_Sc_MouldRepairCheckBillList_Edit", "h_v_Sc_MouldRepairCheckBillList_Edit"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + + //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; + string sql1 = "select HRepairCheckID,楠屾敹椤圭洰浠g爜 HRepairCheckCode,楠屾敹椤圭洰 HRepairCheckName,楠屾敹鍐呭 HRepairCheckContent,HManagerSonID HManagerID,瀛愯礋璐d汉浠g爜 HManagerCode,瀛愯礋璐d汉 HManagerName,澶囨敞 HRemark from h_v_Sc_MouldRepairCheckBillList_Edit where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairCheckBillList_Edit"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region [妯″叿缁翠慨楠屾敹鍗曞垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_MouldRepairCheckBill/DeltetMouldRepairCheckBill")] + [HttpGet] + public object DeltetMouldRepairCheckBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sc_MouldRepairCheckBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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.ClsSc_MouldRepairCheckBill oBill = new DAL.ClsSc_MouldRepairCheckBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 妯″叿鏁呴殰鐧昏琛� + + #region 妯″叿鏁呴殰鐧昏琛ㄤ繚瀛�/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldConkBookBill/SaveGetMouldConkBookBillList")] + [HttpPost] + public object SaveGetMouldConkBookBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DAL.ClsSc_MouldConkBookBill oBill = new DAL.ClsSc_MouldConkBookBill(); + List<Model.ClsSc_MouldConkBookBillMain> lsmain = new List<Model.ClsSc_MouldConkBookBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MouldConkBookBillMain(msg2); + foreach (Model.ClsSc_MouldConkBookBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3815"; + oItem.HBillSubType = "3815"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSc_MouldConkBookBillSub> ls = new List<Model.ClsSc_MouldConkBookBillSub>(); + ls = oListModels.getObjectByJson_Gy_MouldConkBookBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_MouldConkBookBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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("Sc_MouldConkBookBill/Sb_MouldConkBookBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sb_MouldConkBookBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldConkBookBillList_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldConkBookBillList_Edit"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ淮淇崟鍙�" }; + + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region[妯″叿鏁呴殰鐧昏琛ㄧ紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁] + [Route("Sc_MouldConkBookBill/Sb_MouldConkBookBillListProjectDetai")] + [HttpGet] + public object Sb_MouldConkBookBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + + //ds = oCN.RunProcReturn("select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub", "Sc_MouldRepairCheckBillSub"); + ds = oCN.RunProcReturn("select HConkReasonID,鏁呴殰鍘熷洜浠g爜 HConkReasonCode,鏁呴殰鍘熷洜 HHConkReasonName,鏁呴殰鍘熷洜鎻忚堪 HConkExplanation,HManagerSonID HManagerID,瀛愯礋璐d汉浠g爜 HManagerCode,瀛愯礋璐d汉 HManagerName,澶囨敞 HRemark from h_v_Sc_MouldConkBookBillList_Edit", "h_v_Sc_MouldConkBookBillList_Edit"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + + //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; + string sql1 = "select HConkReasonID,鏁呴殰鍘熷洜浠g爜 HConkReasonCode,鏁呴殰鍘熷洜 HHConkReasonName,鏁呴殰鍘熷洜鎻忚堪 HConkExplanation,HManagerSonID HManagerID,瀛愯礋璐d汉浠g爜 HManagerCode,瀛愯礋璐d汉 HManagerName,澶囨敞 HRemark from h_v_Sc_MouldConkBookBillList_Edit where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldConkBookBillList_Edit"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region [妯″叿鏁呴殰鐧昏琛ㄥ垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_MouldConkBookBill/DeltetMouldConkBookBill")] + [HttpGet] + public object DeltetMouldConkBookBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sc_MouldConkBookBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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.ClsSc_MouldConkBookBill oBill = new DAL.ClsSc_MouldConkBookBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 + #endregion + + + #region 妯″叿淇濆吇璁″垝鍗� + + #region 妯″叿淇濆吇璁″垝鍗� 淇濆瓨/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿淇濆吇璁″垝鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldMaintainPlanBill/SaveGetMouldMaintainPlanBillList")] + [HttpPost] + public object SaveGetMouldMaintainPlanBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DAL.ClsSc_MouldMaintainPlanBill oBill = new DAL.ClsSc_MouldMaintainPlanBill(); + List<Model.ClsSc_MouldMaintainPlanBillMain> lsmain = new List<Model.ClsSc_MouldMaintainPlanBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MouldMaintainPlanBillMain(msg2); + foreach (Model.ClsSc_MouldMaintainPlanBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3818"; + oItem.HBillSubType = "3818"; + + //oItem.HInterID =0; + //oItem.HBillNo = ""; + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + //oItem.HMakeDate = ""; + //oItem.HYear = ""; + //oItem.HPeriod = ""; + //oItem.HRemark = ""; + //oItem.HCycleUnit = ""; + //oItem.HCheckCycle = ""; + //oItem.HBeginDate = ""; + //oItem.HEndDate = ""; + //oItem.HInnerBillNo = ""; + //oItem.HExplanation = ""; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSc_MouldMaintainPlanBillSub> ls = new List<Model.ClsSc_MouldMaintainPlanBillSub>(); + ls = oListModels.getObjectByJson_Gy_MouldMaintainPlanBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_MouldMaintainPlanBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //HMaterID = "";//閰嶄欢浠g爜 + //HUnitID = "";//鍗曚綅浠g爜 + //HQty = "";//瀹為檯鐢ㄩ噺 + //HQtyMust = "";//鍗曚綅鐢ㄩ噺 + //HRemark = "";//澶囨敞 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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("Sc_MouldMaintainPlanBill/Sc_MouldMaintainPlanBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MouldMaintainPlanBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldMaintainPlanBillList where hmainid= " + HID + " ", "h_v_Sc_MouldMaintainPlanBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄤ繚鍏昏鍒掑崟" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + #region[妯″叿淇濆吇璁″垝鍗曠紪杈戞椂鑾峰彇琛ㄩ鏁版嵁] + [Route("Sc_MouldMaintainPlanBill/Sc_MouldMaintainPlanBillListProjectDetai")] + [HttpGet] + public object Sc_MouldMaintainPlanBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn("select HMaterID,HUnitID,HQty,HQtyMust,HRemark from Sc_MouldMaintainPlanBillSub", "Sc_MouldMaintainPlanBillSub"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + string sql1 = "select HMaterID,HUnitID,HQty,HQtyMust,HRemark from Sc_MouldMaintainPlanBillSub where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "Sc_MouldMaintainPlanBillSub"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + #region [妯″叿淇濆吇璁″垝鍗曞垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_MouldMaintainPlanBill/DeltetMouldMaintainPlanBill")] + [HttpGet] + public object DeltetMouldMaintainPlanBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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.ClsSc_MouldMaintainPlanBill oBill = new DAL.ClsSc_MouldMaintainPlanBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 + + #endregion + #region 妯″叿淇濆吇璁板綍琛� + + #region 妯″叿淇濆吇璁板綍琛� 淇濆瓨/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldMaintainBill/SaveGetMouldMaintainBillList")] + [HttpPost] + public object SaveGetMouldMaintainBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DAL.ClsSc_MouldMaintainBill oBill = new DAL.ClsSc_MouldMaintainBill(); + List<Model.ClsSc_MouldMaintainBillMain> lsmain = new List<Model.ClsSc_MouldMaintainBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sc_MouldMaintainBillMain(msg2); + foreach (Model.ClsSc_MouldMaintainBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3818"; + oItem.HBillSubType = "3818"; + + //oItem.HInterID =0; + //oItem.HBillNo = ""; + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + //oItem.HMakeDate = ""; + //oItem.HYear = ""; + //oItem.HPeriod = ""; + //oItem.HRemark = ""; + //oItem.HCycleUnit = ""; + //oItem.HCheckCycle = ""; + //oItem.HBeginDate = ""; + //oItem.HEndDate = ""; + //oItem.HInnerBillNo = ""; + //oItem.HExplanation = ""; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSc_MouldMaintainBillSub> ls = new List<Model.ClsSc_MouldMaintainBillSub>(); + ls = oListModels.getObjectByJson_Sc_MouldMaintainBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_MouldMaintainBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //HMaterID = "";//閰嶄欢浠g爜 + //HUnitID = "";//鍗曚綅浠g爜 + //HQty = "";//瀹為檯鐢ㄩ噺 + //HQtyMust = "";//鍗曚綅鐢ㄩ噺 + //HRemark = "";//澶囨敞 + + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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("Sc_MouldMaintainBill/Sc_MouldMaintainBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MouldMaintainBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldMaintainBillList where hmainid= " + HID + " ", "h_v_Sc_MouldMaintainBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄤ繚鍏昏褰曡〃" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + #region[妯″叿淇濆吇璁板綍琛ㄧ紪杈戞椂鑾峰彇琛ㄩ鏁版嵁] + [Route("Sc_MouldMaintainBill/Sc_MouldMaintainBillListProjectDetai")] + [HttpGet] + public object Sc_MouldMaintainBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn("select HMaterID,HUnitID,HQty,HQtyMust,HRemark,HManagerID from Sc_MouldMaintainBillSub", "Sc_MouldMaintainBillSub"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + string sql1 = "select HMaterID,HUnitID,HQty,HQtyMust,HRemark,HManagerID from Sc_MouldMaintainBillSub where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "Sc_MouldMaintainBillSub"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + + #region [妯″叿淇濆吇璁板綍琛ㄥ垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_MouldMaintainBill/DeltetSc_MouldMaintainBill")] + [HttpGet] + public object DeltetSc_MouldMaintainBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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.ClsSc_MouldMaintainBill oBill = new DAL.ClsSc_MouldMaintainBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 + + + #endregion + #region 妯″叿鐐规璁板綍琛� + + #region 妯″叿鐐规璁板綍琛� 淇濆瓨/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldDotCheckBill/SaveGetMouldDotCheckBillList")] + [HttpPost] + public object SaveGetMouldDotCheckBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DAL.ClsSc_MouldDotCheckBill oBill = new DAL.ClsSc_MouldDotCheckBill(); + List<Model.ClsSc_MouldDotCheckBillMain> lsmain = new List<Model.ClsSc_MouldDotCheckBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sc_MouldDotCheckBillMain(msg2); + foreach (Model.ClsSc_MouldDotCheckBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3821"; + oItem.HBillSubType = "3821"; + + //oItem.HInterID =0; + //oItem.HBillNo = ""; + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + //oItem.HMakeDate = ""; + //oItem.HYear = ""; + //oItem.HPeriod = ""; + //oItem.HRemark = ""; + //oItem.HCycleUnit = ""; + //oItem.HCheckCycle = ""; + //oItem.HBeginDate = ""; + //oItem.HEndDate = ""; + //oItem.HInnerBillNo = ""; + //oItem.HExplanation = ""; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSc_MouldDotCheckBillSub> ls = new List<Model.ClsSc_MouldDotCheckBillSub>(); + ls = oListModels.getObjectByJson_Sc_MouldDotCheckBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_MouldDotCheckBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //HMaterID = "";//閰嶄欢浠g爜 + //HUnitID = "";//鍗曚綅浠g爜 + //HQty = "";//瀹為檯鐢ㄩ噺 + //HQtyMust = "";//鍗曚綅鐢ㄩ噺 + //HRemark = "";//澶囨敞 + + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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("Sc_MouldDotCheckBill/Sc_MouldDotCheckBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MouldDotCheckBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldDotCheckBillList where hmainid= " + HID + " ", "h_v_Sc_MouldDotCheckBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ偣妫�璁板綍琛�" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + #region[妯″叿鐐规璁板綍琛ㄧ紪杈戞椂鑾峰彇琛ㄩ鏁版嵁] + [Route("Sc_MouldDotCheckBill/Sc_MouldDotCheckBillListProjectDetai")] + [HttpGet] + public object Sc_MouldDotCheckBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn("select HDotCheckItem,HDotCheckPart,HClaim,HRemark,HManagerID from Sc_MouldDotCheckBillSub", "Sc_MouldMaintainBillSub"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + string sql1 = "select HDotCheckItem,HDotCheckPart,HClaim,HRemark,HManagerID from Sc_MouldDotCheckBillSub where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "Sc_MouldDotCheckBillSub"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + + #region [妯″叿鐐规璁板綍琛ㄥ垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_MouldDotCheckBill/DeltetSc_MouldDotCheckBill")] + [HttpGet] + public object DeltetSc_MouldDotCheckBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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.ClsSc_MouldDotCheckBill oBill = new DAL.ClsSc_MouldDotCheckBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 + + + #endregion + #region 妯″叿鐐规璁″垝琛� + + #region 妯″叿鐐规璁″垝琛� 淇濆瓨/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldDotCheckPlanBill/SaveGetMouldDotCheckPlanBillList")] + [HttpPost] + public object SaveGetMouldDotCheckPlanBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DAL.ClsSc_MouldDotCheckPlanBill oBill = new DAL.ClsSc_MouldDotCheckPlanBill(); + List<Model.ClsSc_MouldDotCheckPlanBillMain> lsmain = new List<Model.ClsSc_MouldDotCheckPlanBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sc_MouldDotCheckPlanBillMain(msg2); + foreach (Model.ClsSc_MouldDotCheckPlanBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3821"; + oItem.HBillSubType = "3821"; + + //oItem.HInterID =0; + //oItem.HBillNo = ""; + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + //oItem.HMakeDate = ""; + //oItem.HYear = ""; + //oItem.HPeriod = ""; + //oItem.HRemark = ""; + //oItem.HCycleUnit = ""; + //oItem.HCheckCycle = ""; + //oItem.HBeginDate = ""; + //oItem.HEndDate = ""; + //oItem.HInnerBillNo = ""; + //oItem.HExplanation = ""; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSc_MouldDotCheckPlanBillSub> ls = new List<Model.ClsSc_MouldDotCheckPlanBillSub>(); + ls = oListModels.getObjectByJson_Sc_MouldDotCheckPlanBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_MouldDotCheckPlanBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //HMaterID = "";//閰嶄欢浠g爜 + //HUnitID = "";//鍗曚綅浠g爜 + //HQty = "";//瀹為檯鐢ㄩ噺 + //HQtyMust = "";//鍗曚綅鐢ㄩ噺 + //HRemark = "";//澶囨敞 + + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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("Sc_MouldDotCheckPlanBill/Sc_MouldDotCheckPlanBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MouldDotCheckPlanBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldDotCheckPlanBillList where hmainid= " + HID + " ", "h_v_Sc_MouldDotCheckPlanBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ偣妫�璁″垝琛�" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + #region[妯″叿鐐规璁″垝琛ㄧ紪杈戞椂鑾峰彇琛ㄩ鏁版嵁] + [Route("Sc_MouldDotCheckPlanBill/Sc_MouldDotCheckPlanBillListProjectDetai")] + [HttpGet] + public object Sc_MouldDotCheckPlanBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn("select HDotCheckItem,HDotCheckPart,HClaim,HRemark,HManagerID from Sc_MouldDotCheckPlanBillSub", "Sc_MouldDotCheckPlanBillSub"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + string sql1 = "select HDotCheckItem,HDotCheckPart,HClaim,HRemark,HManagerID from Sc_MouldDotCheckPlanBillSub where 1 = 1 "; + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "Sc_MouldDotCheckPlanBillSub"); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁″垝锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + + #region [妯″叿鐐规璁″垝琛ㄥ垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿缁翠慨鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_MouldDotCheckPlanBill/DeltetSc_MouldDotCheckPlanBillBill")] + [HttpGet] + public object DeltetSc_MouldDotCheckPlanBillBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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.ClsSc_MouldDotCheckPlanBill oBill = new DAL.ClsSc_MouldDotCheckPlanBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 + + + #endregion + + + + #region 妯″叿鎶ュ簾鍏ュ簱鍗� + + + #region 妯″叿鎶ュ簾鍏ュ簱鍗曞垪琛� + + [Route("Sc_MouldScrapInHouseBill/GetMouldScrapInHouseBill")] + [HttpGet] + public object GetMouldScrapInHouseBill(string sWhere) + { + try + { + + ds = Sc_GetMouldScrapInHouseBill(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public static DataSet Sc_GetMouldScrapInHouseBill(string sWhere) + { + if (sWhere == null || sWhere.Equals("")) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldScrapInHouseBillList " + sWhere, "h_v_Sc_MouldScrapInHouseBillList"); + } + else + { + string sql1 = "select * from h_v_Sc_MouldScrapInHouseBillList where 1 = 1 "; + string sql = sql1 + sWhere; + return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldScrapInHouseBillList"); + } + + } + + #endregion + + #region[妯″叿鎶ュ簾鍏ュ簱鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁] + [Route("Sc_MouldScrapInHouseBill/Sc_MouldScrapInHouseBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MouldScrapInHouseBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldScrapInHouseBillList where hmainid= " + HID + " ", "h_v_Sc_MouldScrapInHouseBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ淮淇崟鍙�" }; + + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region[妯″叿鎶ュ簾鍏ュ簱鍗曠紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁] + [Route("Sc_MouldScrapInHouseBill/Sc_MouldScrapInHouseBillListProjectDetai")] + [HttpGet] + public object Sc_MouldScrapInHouseBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HPropertyID,杈呭姪灞炴�т唬鐮� HPropertyCode,杈呭姪灞炴�у悕绉� HPropertyName, + HSecUnitID, 杈呭姪璁¢噺鍗曚綅浠g爜 HSecUnitCode, 杈呭姪璁¢噺鍗曚綅鍚嶇О HSecUnitName, HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅鍚嶇О HUnitName, 鎵规 HBatchNo, + 璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 浣跨敤瀵垮懡 HUseLife, 瀹炴敹鏁伴噺 HQty, 鍗曚环 HPrice, 閲戦 HMoney, HWHID, 鏀舵枡浠撳簱浠g爜 HWHCode, 鏀舵枡浠撳簱鍚嶇О HWHName, + HSPID, 浠撲綅浠g爜 HSPCode, 浠撲綅鍚嶇О HSPName, 澶囨敞 HRemark + FROM h_v_Sc_MouldScrapInHouseBillList"), "h_v_Sc_MouldScrapInHouseBillList"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + + //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; + string sql1 = string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HPropertyID,杈呭姪灞炴�т唬鐮� HPropertyCode,杈呭姪灞炴�у悕绉� HPropertyName, + HSecUnitID, 杈呭姪璁¢噺鍗曚綅浠g爜 HSecUnitCode, 杈呭姪璁¢噺鍗曚綅鍚嶇О HSecUnitName, HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅鍚嶇О HUnitName, 鎵规 HBatchNo, + 璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 浣跨敤瀵垮懡 HUseLife, 瀹炴敹鏁伴噺 HQty, 鍗曚环 HPrice, 閲戦 HMoney, HWHID, 鏀舵枡浠撳簱浠g爜 HWHCode, 鏀舵枡浠撳簱鍚嶇О HWHName, + HSPID, 浠撲綅浠g爜 HSPCode, 浠撲綅鍚嶇О HSPName, 澶囨敞 HRemark + FROM h_v_Sc_MouldScrapInHouseBillList where 1 = 1 "); + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldScrapInHouseBillList"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region 妯″叿鎶ュ簾鍏ュ簱鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿鎶ュ簾鍏ュ簱鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldScrapInHouseBill/SaveGetMouldScrapInHouseBillList")] + [HttpPost] + public object SaveGetMouldScrapInHouseBillList([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 refSav = sArray[2].ToString(); + + string UserName = ""; + string s = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSc_MouldScrapInBill oBill = new DLL.ClsSc_MouldScrapInBill(); + List<Models.ClsSc_MouldStockBillMain> lsmain = new List<Models.ClsSc_MouldStockBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillMain(msg2); + foreach (Models.ClsSc_MouldStockBillMain oItem in lsmain) + { + if (refSav == "Add") + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld0.omodel.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = 1; + return objJsonResult; + } + } + if (refSav == "Update") + { + if (BillOld0.ShowBill(oItem.HInterID, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙紪杈� + if (BillOld0.omodel.HChecker != "" && BillOld0.omodel.HChecker != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + if (BillOld0.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld0, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; + objJsonResult.data = 1; + return objJsonResult; + } + } + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3831"; + oItem.HBillSubType = "3831"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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<Models.ClsSc_MouldStockBillSub> ls = new List<Models.ClsSc_MouldStockBillSub>(); + ls = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillSub(msg3); + int i = 0; + foreach (Models.ClsSc_MouldStockBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 [妯″叿鎶ュ簾鍏ュ簱鍗曞垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿鎶ュ簾鍏ュ簱鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_MouldScrapInHouseBill/DeltetMouldScrapInHouseBill")] + [HttpGet] + public object DeltetMouldScrapInHouseBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapInBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + string s = ""; + 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.ClsSc_MouldScrapInBill oBill = new DAL.ClsSc_MouldScrapInBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowDeleteBill(BillOld0, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽鍒犻櫎"; + objJsonResult.data = null; + return objJsonResult; + } + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 [妯″叿鎶ュ簾鍏ュ簱鍗曞鏍搞�佸弽瀹℃牳] + /// <summary> + /// + /// </summary> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param> + /// <param name="CurUserName">瀹℃牳浜�</param> + /// <returns></returns> + [Route("Sc_MouldScrapInHouseBill/MouldScrapInHouseAudit")] + [HttpGet] + public object MouldScrapInHouseAudit(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "Sc_MouldScrapInBill_Check"; + DBUtility.ClsPub.CurUserName = CurUserName; + try + { + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + string s = ""; + if (!DBUtility.Xt_BaseBillFun.Fun_AllowCheckBill(BillOld0, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽瀹℃牳"; + objJsonResult.data = null; + return objJsonResult; + } + if (HInterID <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID灏忎簬0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); + DLL.ClsSc_MouldScrapInBill oBill = new DLL.ClsSc_MouldScrapInBill(); + //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HCloseMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HDeleteMan.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //瀹℃牳鍒ゆ柇 + { + if (oBill.omodel.HChecker.Trim() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍稿垽鏂� + { + if (oBill.omodel.HChecker.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + if (IsAudit == 0) //瀹℃牳鎻愪氦 + { + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (IsAudit == 1) //鍙嶅鏍告彁浜� + { + //鍙嶅鏍告彁浜bandonCheck + if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍告垚鍔�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + + #region 妯″叿鎶ュ簾鍏ュ簱鍗曚繚瀛� + + [Route("Sc_MouldScrapInHouseBill/SaveGetMouldScrapInHouseBillList_PDA")] + [HttpPost] + public object SaveGetMouldScrapInHouseBillList_PDA([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 UserName = ""; + + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSc_MouldScrapInBill oBill = new DLL.ClsSc_MouldScrapInBill(); + List<Models.ClsSc_MouldStockBillMain> lsmain = new List<Models.ClsSc_MouldStockBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillMain(msg2); + foreach (Models.ClsSc_MouldStockBillMain oItem in lsmain) + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld0.omodel.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = 1; + return objJsonResult; + } + + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3831"; + oItem.HBillSubType = "3831"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + //瀛愯〃浣撴暟鎹� + + List<Models.ClsSc_MouldStockBillSub> ls = new List<Models.ClsSc_MouldStockBillSub>(); + ls = oListModels.getObjectByJson_Gy_MouldScrapInHouseBillSub(msg2); + int i = 0; + foreach (Models.ClsSc_MouldStockBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 + + #endregion + + #region 妯″叿澶勭悊鍑哄簱鍗� + + #region 妯″叿澶勭悊鍑哄簱鍗曞垪琛� + + [Route("Sc_MouldScrapOutHouseBill/GetMouldScrapOutHouseBill")] + [HttpGet] + public object GetMouldScrapOutHouseBill(string sWhere) + { + try + { + + ds = Sc_GetMouldScrapOutHouseBill(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public static DataSet Sc_GetMouldScrapOutHouseBill(string sWhere) + { + if (sWhere == null || sWhere.Equals("")) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldScrapOutHouseBillList ", "h_v_Sc_MouldScrapOutHouseBillList"); + } + else + { + string sql1 = "select * from h_v_Sc_MouldScrapOutHouseBillList where 1 = 1 "; + string sql = sql1 + sWhere; + return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldScrapOutHouseBillList"); + } + } + + #endregion + + #region[妯″叿澶勭悊鍑哄簱鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁] + [Route("Sc_MouldScrapOutHouseBill/Sc_MouldScrapOutHouseBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MouldScrapOutHouseBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldScrapOutHouseBillList where hmainid= " + HID + " ", "h_v_Sc_MouldScrapOutHouseBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ淮淇崟鍙�" }; + + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region[妯″叿澶勭悊鍑哄簱鍗曠紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁] + [Route("Sc_MouldScrapOutHouseBill/Sc_MouldScrapOutHouseBillListProjectDetai")] + [HttpGet] + public object Sc_MouldScrapOutHouseBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HPropertyID,杈呭姪灞炴�т唬鐮� HPropertyCode,杈呭姪灞炴�у悕绉� HPropertyName, + HSecUnitID, 杈呭姪璁¢噺鍗曚綅浠g爜 HSecUnitCode, 杈呭姪璁¢噺鍗曚綅鍚嶇О HSecUnitName, 鎹㈢畻鐜� HSecUnitRate, HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅鍚嶇О HUnitName, 鎵规 HBatchNo, + 璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 浣跨敤瀵垮懡 HUseLife, 瀹炲彂鏁伴噺 HQty, 鍗曚环 HPrice, 閲戦 HMoney, HWHID, 鍙戣揣浠撳簱浠g爜 HWHCode, 鍙戣揣浠撳簱鍚嶇О HWHName, + HSPID, 浠撲綅浠g爜 HSPCode, 浠撲綅鍚嶇О HSPName, 澶囨敞 HRemark FROM h_v_Sc_MouldScrapOutHouseBillList"), "h_v_Sc_MouldScrapOutHouseBillList"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + + //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; + string sql1 = string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HPropertyID,杈呭姪灞炴�т唬鐮� HPropertyCode,杈呭姪灞炴�у悕绉� HPropertyName, + HSecUnitID, 杈呭姪璁¢噺鍗曚綅浠g爜 HSecUnitCode, 杈呭姪璁¢噺鍗曚綅鍚嶇О HSecUnitName, 鎹㈢畻鐜� HSecUnitRate, HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅鍚嶇О HUnitName, 鎵规 HBatchNo, + 璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 浣跨敤瀵垮懡 HUseLife, 瀹炲彂鏁伴噺 HQty, 鍗曚环 HPrice, 閲戦 HMoney, HWHID, 鍙戣揣浠撳簱浠g爜 HWHCode, 鍙戣揣浠撳簱鍚嶇О HWHName, + HSPID, 浠撲綅浠g爜 HSPCode, 浠撲綅鍚嶇О HSPName, 澶囨敞 HRemark FROM h_v_Sc_MouldScrapOutHouseBillList where 1 = 1 "); + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldScrapOutHouseBillList"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region 妯″叿澶勭悊鍑哄簱鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿澶勭悊鍑哄簱鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldScrapOutHouseBill/SaveGetMouldScrapOutHouseBillList")] + [HttpPost] + public object SaveGetMouldScrapOutHouseBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSc_MouldScrapOutBill oBill = new DLL.ClsSc_MouldScrapOutBill(); + List<Model.ClsSc_MouldStockBillMain> lsmain = new List<Model.ClsSc_MouldStockBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillMain(msg2); + foreach (Model.ClsSc_MouldStockBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3832"; + oItem.HBillSubType = "3832"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSc_MouldStockBillSub> ls = new List<Model.ClsSc_MouldStockBillSub>(); + ls = oListModels.getObjectByJson_Gy_MouldScrapOutHouseBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 [妯″叿澶勭悊鍑哄簱鍗曞垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿澶勭悊鍑哄簱搴撳崟鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("Sc_MouldScrapOutHouseBill/DeltetMouldScrapOutHouseBill")] + [HttpGet] + public object DeltetMouldScrapOutHouseBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sc_MouldScrapOutBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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.ClsSc_MouldScrapInBill oBill = new DAL.ClsSc_MouldScrapInBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 + + #endregion + + #region 妯″叿閫�搴撳崟 + + #region 妯″叿閫�搴撳崟鍒楄〃 + + [Route("Sc_MouldProdBackBill/GetMouldProdBackBill")] + [HttpGet] + public object GetMouldProdBackBill(string sWhere) + { + try + { + + ds = Sc_GetMouldProdBackBill(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public static DataSet Sc_GetMouldProdBackBill(string sWhere) + { + if (sWhere == null || sWhere.Equals("")) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldProdBackBillList_Edit ", "h_v_Sc_MouldProdBackBillList_Edit"); + } + else + { + string sql1 = "select * from h_v_Sc_MouldProdBackBillList_Edit where 1 = 1 "; + string sql = sql1 + sWhere; + return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldProdBackBillList_Edit"); + } + + } + + #endregion + + #region[妯″叿閫�搴撳崟缂栬緫鏃惰幏鍙栬〃澶存暟鎹甝 + [Route("Sc_MouldProdBackBill/Sc_MouldProdBackBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MouldProdBackBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldProdBackBillList_Edit where hmainid= " + HID + " ", "h_v_Sc_MouldProdBackBillList_Edit"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄩ��搴撳崟鍙�" }; + + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region[妯″叿閫�搴撳崟缂栬緫鏃惰幏鍙栬〃浣撴暟鎹甝 + [Route("Sc_MouldProdBackBill/Sc_MouldProdBackBillListProjectDetai")] + [HttpGet] + public object Sc_MouldProdBackBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HSecUnitID, 杈呭姪璁¢噺鍗曚綅浠g爜 HSecUnitCode, 杈呭姪璁¢噺鍗曚綅鍚嶇О HSecUnitName, + HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅鍚嶇О HUnitName, 鎵规 HBatchNo, + 璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 绱Н浣跨敤瀵垮懡 HUseLife,搴旀敹鏁伴噺 HQtyMust, 瀹炴敹鏁伴噺 HQty, 鍗曚环 HPrice, 閲戦 HMoney, HWHID1 HWHID, 鏀舵枡浠撳簱浠g爜 HWHCode, 鏀舵枡浠撳簱鍚嶇О HWHName, + HSPID, 浠撲綅浠g爜 HSPCode, 浠撲綅鍚嶇О HSPName,妯″叿鏂拌鏍� HNewModel,澹佸帤 HWallThickness,纭害 HHardness,鏈�鍚庣敓浜т骇鍝� HLastProdModel, 鐩村緞 HDiameter,閫�搴撶被鍨� HBackFlag, + 琛ㄤ綋澶囨敞 HRemark FROM h_v_Sc_MouldProdBackBillList_Edit"), "h_v_Sc_MouldProdBackBillList_Edit"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + + //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; + string sql1 = string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HSecUnitID, 杈呭姪璁¢噺鍗曚綅浠g爜 HSecUnitCode, 杈呭姪璁¢噺鍗曚綅鍚嶇О HSecUnitName, + HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅鍚嶇О HUnitName, 鎵规 HBatchNo, + 璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 绱Н浣跨敤瀵垮懡 HUseLife,搴旀敹鏁伴噺 HQtyMust, 瀹炴敹鏁伴噺 HQty, 鍗曚环 HPrice, 閲戦 HMoney, HWHID1 HWHID, 鏀舵枡浠撳簱浠g爜 HWHCode, 鏀舵枡浠撳簱鍚嶇О HWHName, + HSPID, 浠撲綅浠g爜 HSPCode, 浠撲綅鍚嶇О HSPName,妯″叿鏂拌鏍� HNewModel,澹佸帤 HWallThickness,纭害 HHardness,鏈�鍚庣敓浜т骇鍝� HLastProdModel, 鐩村緞 HDiameter,閫�搴撶被鍨� HBackFlag, + 琛ㄤ綋澶囨敞 HRemark FROM h_v_Sc_MouldProdBackBillList_Edit where 1 = 1 "); + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldProdBackBillList_Edit"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region 妯″叿閫�搴撳崟淇濆瓨/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿閫�搴撳崟 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldProdBackBill/SaveGetMouldProdBackBillList")] + [HttpPost] + public object SaveGetMouldProdBackBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSc_MouldProdBackBill oBill = new DLL.ClsSc_MouldProdBackBill(); + List<Model.ClsSc_MouldProdBackBillMain> lsmain = new List<Model.ClsSc_MouldProdBackBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MouldProdBackBillMain(msg2); + foreach (Model.ClsSc_MouldProdBackBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3803"; + oItem.HBillSubType = "3803"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSc_MouldProdBackBillSub> ls = new List<Model.ClsSc_MouldProdBackBillSub>(); + ls = oListModels.getObjectByJson_Gy_MouldProdBackBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_MouldProdBackBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 [妯″叿澶勭悊閫�搴撳崟鍒犻櫎鍔熻兘] + /// <summary> + /// 妯″叿澶勭悊閫�搴撳崟鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("Sc_MouldProdBackBill/DeltetMouldProdBackBill")] + [HttpGet] + public object DeltetMouldProdBackBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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; + } + DLL.ClsSc_MouldProdBackBill oBill = new DLL.ClsSc_MouldProdBackBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 + + #endregion + + #region 妯″叿棰嗙敤鍗� + + #region 妯″叿棰嗙敤鍗曞垪琛� + + [Route("Sc_MouldProdOutBill/GetMouldProdOutBill")] + [HttpGet] + public object GetMouldProdOutBill(string sWhere) + { + try + { + + ds = Sc_GetMouldProdOutBill(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public static DataSet Sc_GetMouldProdOutBill(string sWhere) + { + if (sWhere == null || sWhere.Equals("")) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldProdOutHouseBillList ", "h_v_Sc_MouldProdOutHouseBillList"); + } + else + { + string sql1 = "select * from h_v_Sc_MouldProdOutHouseBillList where 1 = 1 "; + string sql = sql1 + sWhere; + return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldProdOutHouseBillList"); + } + + } + + #endregion + + #region[妯″叿棰嗙敤鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁] + [Route("Sc_MouldProdOutBill/Sc_MouldProdOutBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MouldProdOutBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldProdOutHouseBillList where hmainid= " + HID + " ", "h_v_Sc_MouldProdOutHouseBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄩ��搴撳崟鍙�" }; + + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region[妯″叿棰嗙敤鍗曠紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁] + [Route("Sc_MouldProdOutBill/Sc_MouldProdOutBillListProjectDetai")] + [HttpGet] + public object Sc_MouldProdOutBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,鎵规 HBatchNo, + 璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 绱Н浣跨敤瀵垮懡 HUseLife, 搴斿彂鏁伴噺 HQtyMust, 瀹炲彂鏁伴噺 HQty, + 鍗曚环 HPrice, 閲戦 HMoney,HWHSonID HWHID, 鍙戞枡浠撳簱浠g爜 HWHCode, 鍙戞枡浠撳簱 HWHName,HSPID, + 浠撲綅浠g爜 HSPCode, 浠撲綅 HSPName,琛ㄤ綋澶囨敞 HRemark FROM h_v_Sc_MouldProdOutHouseBillList"), "h_v_Sc_MouldProdOutHouseBillList"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + + //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; + string sql1 = string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,鎵规 HBatchNo, + 璁捐瀵垮懡 HDesignLife, 鍓╀綑瀵垮懡 HLeaveLife, 绱Н浣跨敤瀵垮懡 HUseLife, 搴斿彂鏁伴噺 HQtyMust, 瀹炲彂鏁伴噺 HQty, + 鍗曚环 HPrice, 閲戦 HMoney,HWHSonID HWHID, 鍙戞枡浠撳簱浠g爜 HWHCode, 鍙戞枡浠撳簱 HWHName,HSPID, + 浠撲綅浠g爜 HSPCode, 浠撲綅 HSPName,琛ㄤ綋澶囨敞 HRemark FROM h_v_Sc_MouldProdOutHouseBillList where 1 = 1 "); + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldProdOutHouseBillList"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region 妯″叿棰嗙敤鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿棰嗙敤鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldProdOutBill/SaveGetMouldProdOutBillList")] + [HttpPost] + public object SaveGetMouldProdOutBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill(); + List<Model.ClsSc_MouldProdOutBillMain> lsmain = new List<Model.ClsSc_MouldProdOutBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MouldProdOutBillMain(msg2); + foreach (Model.ClsSc_MouldProdOutBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3802"; + oItem.HBillSubType = "3802"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSc_MouldStockBillSub> ls = new List<Model.ClsSc_MouldStockBillSub>(); + ls = oListModels.getObjectByJson_Gy_MouldStockBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_MouldStockBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 [妯″叿澶勭悊棰嗙敤鍗曞垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿澶勭悊棰嗙敤鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_MouldProdOutBill/DeltetMouldProdOutBill")] + [HttpGet] + public object DeltetMouldProdOutBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sc_MouldProdBackBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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; + } + DLL.ClsSc_MouldProdOutBill oBill = new DLL.ClsSc_MouldProdOutBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 + + #endregion + + #region 妯″叿瀵垮懡璋冩暣鍗� + + #region 妯″叿瀵垮懡璋冩暣琛� + + [Route("Sc_MouldLifeChangeBill/GetMouldLifeChangeBill")] + [HttpGet] + public object GetMouldLifeChangeBill(string sWhere) + { + try + { + + ds = Sc_GetMouldLifeChangeBill(sWhere); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + public static DataSet Sc_GetMouldLifeChangeBill(string sWhere) + { + if (sWhere == null || sWhere.Equals("")) + { + return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_Sc_MouldLifeChangeBillList ", "h_v_Sc_MouldLifeChangeBillList"); + } + else + { + string sql1 = "select * from h_v_Sc_MouldLifeChangeBillList where 1 = 1 "; + string sql = sql1 + sWhere; + return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldLifeChangeBillList"); + } + + } + + #endregion + + #region[妯″叿瀵垮懡璋冩暣鍗曠紪杈戞椂鑾峰彇琛ㄥご鏁版嵁] + [Route("Sc_MouldLifeChangeBill/Sc_GetMouldLifeChangeBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_Sc_GetMouldLifeChangeBillListCheckDetai(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_MouldLifeChangeBillList where hmainid= " + HID + " ", "h_v_Sc_MouldLifeChangeBillList"); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄩ��搴撳崟鍙�" }; + + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + #endregion + + #region[妯″叿瀵垮懡璋冩暣鍗曠紪杈戞椂鑾峰彇琛ㄤ綋鏁版嵁] + [Route("Sc_MouldLifeChangeBill/Sc_MouldLifeChangeBillListProjectDetai")] + [HttpGet] + public object Sc_MouldLifeChangeBillListProjectDetai(string sqlWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sqlWhere == null || sqlWhere.Equals("")) + { + ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿 HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HPropertyID,杈呭姪灞炴�т唬鐮� HPropertyCode,杈呭姪灞炴�� HPropertyName, + HSecUnitID, 杈呭姪璁¢噺鍗曚綅浠g爜 HSecUnitCode, 杈呭姪璁¢噺鍗曚綅 HSecUnitName,鎹㈢畻鐜� HSecUnitRate, + HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅 HUnitName, + 璁捐瀵垮懡 HDesignLife, 鍘熷墿浣欏鍛� HLeaveLife, 鏂板墿浣欏鍛� HNewLife,琛ㄤ綋澶囨敞 HRemark + FROM h_v_Sc_MouldLifeChangeBillList_Edit"), "h_v_Sc_MouldLifeChangeBillList_Edit"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + else + { + + //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark from Sc_MouldRepairCheckBillSub where 1 = 1 "; + string sql1 = string.Format(@"SELECT HMaterID,妯″叿浠g爜 HMaterCode,妯″叿 HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HPropertyID,杈呭姪灞炴�т唬鐮� HPropertyCode,杈呭姪灞炴�� HPropertyName, + HSecUnitID, 杈呭姪璁¢噺鍗曚綅浠g爜 HSecUnitCode, 杈呭姪璁¢噺鍗曚綅 HSecUnitName,鎹㈢畻鐜� HSecUnitRate, + HUnitID, 璁¢噺鍗曚綅浠g爜 HUnitCode, 璁¢噺鍗曚綅 HUnitName, + 璁捐瀵垮懡 HDesignLife, 鍘熷墿浣欏鍛� HLeaveLife, 鏂板墿浣欏鍛� HNewLife,琛ㄤ綋澶囨敞 HRemark + FROM h_v_Sc_MouldLifeChangeBillList_Edit where 1 = 1 "); + string sql = sql1 + sqlWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldLifeChangeBillList_Edit"); + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); + objJsonResult.data = null; + } + return objJsonResult; + } + #endregion + + #region 妯″叿瀵垮懡璋冩暣鍗曚繚瀛�/缂栬緫 + /// <summary> + /// 淇濆瓨妯″叿棰嗙敤鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MouldLifeChangeBill/SaveGetMouldLifeChangeBillList")] + [HttpPost] + public object SaveGetMouldLifeChangeBillList([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 UserName = ""; + ListModels oListModels = new ListModels(); + try + { + DLL.ClsSc_MouldLifeChangeBill oBill = new DLL.ClsSc_MouldLifeChangeBill(); + List<Model.ClsSc_MouldLifeChangeBillMain> lsmain = new List<Model.ClsSc_MouldLifeChangeBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_MouldLifeChangeBillMain(msg2); + foreach (Model.ClsSc_MouldLifeChangeBillMain oItem in lsmain) + { + //oItem.HMaker = ""; + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3824"; + oItem.HBillSubType = "3824"; + //oItem.HBillNo = ""; //鍗曟嵁鍙� + //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + //oItem.HInnerBillNo = ""; // --鍐呴儴鍗曟嵁鍙� + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + //oItem.HEquipID = 0; //璁惧ID(Gy_EquipMent) + //oItem.HPeriod = 0; + //oItem.HCheckBeginDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); // --缁翠慨鏃ユ湡 + //oItem.HCheckResult = ""; //楠屾敹缁撹--(姝e父锛屽紓甯�) + //oItem.HEmpID = 0; //楠屾敹浜�(Gy_Employee) + //oItem.HManagerID = 0; //璐熻矗浜�(Gy_Employee) + //oItem.HDeptID = 0; //楠屾敹閮ㄩ棬(Gy_Department) + //oItem.HExplanation = ""; //鎽樿(鏁呴殰鎻忚堪) + //oItem.HRemark = ""; //澶囨敞 + + //oItem.HMainSourceInterID = oItem.HInterID; + + //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); + 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.ClsSc_MouldLifeChangeBillSub> ls = new List<Model.ClsSc_MouldLifeChangeBillSub>(); + ls = oListModels.getObjectByJson_Gy_MouldLifeChangeBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_MouldLifeChangeBillSub oItemSub in ls) + { + + i++; + oItemSub.HEntryID = i; + + //oItemSub.HRepairCheckID = 0; //楠屾敹椤圭洰ID + //oItemSub.HRepairCheckContent = ""; //楠屾敹鍐呭 + //oItemSub.HManagerID = 0; //璐熻矗浜篒D + //oItemSub.HCloseMan = ""; //琛屽叧闂� + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + //oItemSub.HRemark = ""; //澶囨敞 + oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 + //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 + //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 + //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 + //oItemSub.HRepairID = 0; //缁翠慨椤圭洰 + //oItemSub.HRepairExplanation =""; //缁翠慨瑕佹眰 + //oItemSub.HMoney = 0; //缁翠慨璐圭敤 + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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 [妯″叿瀵垮懡璋冩暣鍗曞垹闄ゅ姛鑳絔 + /// <summary> + /// 妯″叿澶勭悊棰嗙敤鍗曞垹闄ゅ姛鑳� + /// </summary> + /// <returns></returns> + [Route("Sc_MouldLifeChangeBill/DeltetMouldLifeChangeBill")] + [HttpGet] + public object DeltetMouldLifeChangeBill(string HInterID) + { + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("Sc_MouldLifeChangeBill_Delete", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + + 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; + } + DLL.ClsSc_MouldLifeChangeBill oBill = new DLL.ClsSc_MouldLifeChangeBill(); + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HChecker != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + if (IsDete) + { + objJsonResult.code = "0"; + 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 + + #endregion } } \ No newline at end of file diff --git a/WebAPI/Controllers/Sc_GroupOrderBillController.cs b/WebAPI/Controllers/Sc_GroupOrderBillController.cs new file mode 100644 index 0000000..09e4d6e --- /dev/null +++ b/WebAPI/Controllers/Sc_GroupOrderBillController.cs @@ -0,0 +1,79 @@ +锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Web.Http; +using WebAPI.Models; + +namespace WebAPI.Controllers +{ + //缁勬墭鍗旵ontroller + public class Sc_GroupOrderBillController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + string HBillType = "2601"; + + /// <summary> + /// 杩斿洖鍒楄〃 + /// </summary> + /// <param name="sWhere">鎷兼帴鐨凷QL</param> + /// <returns>object</returns> + [Route("GroupOrderBill/List")] + [HttpGet] + public object List(string sWhere) + { + DataSet ds; + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_GroupOrderBillList order by 鍒跺崟鏃堕棿 desc", "h_v_GroupOrderBillList"); + } + else + { + string sql1 = "select * from h_v_GroupOrderBillList where 1 = 1 "; + string sql = sql1 + sWhere; + string sql2 = " order by 鍒跺崟鏃堕棿 desc"; + sql += sql2; + ds = oCN.RunProcReturn(sql, "h_v_GroupOrderBillList"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳暟鎹紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + 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; + } + } + + + // + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/Sc_MouldController.cs b/WebAPI/Controllers/Sc_MouldController.cs new file mode 100644 index 0000000..6a9be79 --- /dev/null +++ b/WebAPI/Controllers/Sc_MouldController.cs @@ -0,0 +1,559 @@ +锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections.Generic; +using System.Data; +using System.Web.Http; +using WebAPI.Models; +namespace WebAPI.Controllers +{ + public class Sc_MouldController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛� + + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + public WebServer webserver = new WebServer(); + + + #region 妯″叿鍏朵粬鍏ュ簱鍗� + + #region 妯″叿鍏朵粬鍏ュ簱鍗曚繚瀛� + + [Route("Sc_MouldOtherInBill/MouldOtherInBill_Save")] + [HttpPost] + public object AddBill([FromBody] JObject sMainSub) + { + var _value = sMainSub["sMainSub"].ToString(); + string msg1 = _value.ToString(); + //淇濆瓨鍗曟嵁 + return objJsonResult = MouldOtherInAddBill(msg1); + } + + public json MouldOtherInAddBill(string msg1) + { + //string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + //string msg2 = sArray[0].ToString(); + //string msg3 = sArray[0].ToString(); + bool bResult; + try + { + //msg2 = "[" + msg2.ToString() + "]"; + msg1 = "[" + msg1.ToString() + "]"; + DAL.ClsSc_MouldOtherInBill BillNew = new DAL.ClsSc_MouldOtherInBill(); + List<Model.ClsSc_MouldOtherInBillMain> mainList = Newtonsoft + .Json + .JsonConvert + .DeserializeObject<List<Model.ClsSc_MouldOtherInBillMain>>(msg1); + List<Model.ClsSc_MouldStockBillSub> subList = Newtonsoft + .Json + .JsonConvert + .DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(msg1); + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = mainList[0].HDate;//鏃ユ湡 + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + BillNew.omodel.HYear = sYear; + BillNew.omodel.HPeriod = sPeriod; + BillNew.omodel.HBillNo = mainList[0].HBillNo.Trim(); + BillNew.omodel.HMaker = mainList[0].HMaker; + BillNew.omodel.HDate = HDate; + BillNew.omodel.HWHID = mainList[0].HWHID; + BillNew.omodel.HSupID = 0; + BillNew.omodel.HSCWHID = 0; + BillNew.omodel.HEmpID = 0; + BillNew.omodel.HManagerID = mainList[0].HManagerID; + BillNew.omodel.HSecManagerID = mainList[0].HSecManagerID; + BillNew.omodel.HKeeperID = mainList[0].HSecManagerID; + BillNew.omodel.HDeptID = mainList[0].HSecManagerID; + BillNew.omodel.HExplanation = mainList[0].HExplanation; + BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo; + BillNew.omodel.HRedBlueFlag = mainList[0].HRedBlueFlag; + BillNew.DetailColl = new List<Model.ClsSc_MouldStockBillSub>(); + Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub(); + + oSub.HEntryID = 1; + oSub.HRemark = DBUtility.ClsPub.isStrNull(subList[0].HRemark); + oSub.HSourceInterID = DBUtility.ClsPub.isLong(subList[0].HSourceInterID); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(subList[0].HSourceEntryID); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillType); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillNo); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(subList[0].HRelationQty); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(subList[0].HRelationMoney); + oSub.HCloseMan = DBUtility.ClsPub.isStrNull(subList[0].HCloseMan); + oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(subList[0].HEntryCloseDate); + oSub.HCloseType = DBUtility.ClsPub.isBool(subList[0].HCloseType); + oSub.HMaterID = DBUtility.ClsPub.isLong(subList[0].HMaterID); + oSub.HPropertyID = DBUtility.ClsPub.isLong(subList[0].HPropertyID); + oSub.HSecUnitID = DBUtility.ClsPub.isLong(subList[0].HSecUnitID); + oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(subList[0].HSecUnitRate); + oSub.HUnitID = DBUtility.ClsPub.isLong(subList[0].HUnitID); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(subList[0].HQtyMust); + oSub.HQty = DBUtility.ClsPub.isDoule(subList[0].HQty); + oSub.HBarCode = DBUtility.ClsPub.isStrNull(subList[0].HBarCode); + if (oSub.HQty <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佽浆鍗℃暟閲忎笉鑳戒负0鎴栬�呭皬浜�0"; + objJsonResult.data = null; + return objJsonResult; + } + oSub.HDesignLife = DBUtility.ClsPub.isLong(subList[0].HDesignLife); + if (oSub.HDesignLife < 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璁捐瀵垮懡涓嶈兘涓�0鎴栬�呭皬浜�0"; + objJsonResult.data = null; + return objJsonResult; + } + oSub.HLeaveLife = DBUtility.ClsPub.isLong(subList[0].HLeaveLife); + oSub.HPrice = DBUtility.ClsPub.isDoule(subList[0].HPrice); + oSub.HWHID = DBUtility.ClsPub.isLong(subList[0].HWHID); + oSub.HSPID = DBUtility.ClsPub.isLong(subList[0].HSPID); + oSub.HSCWHID = 0; + oSub.HSCSPID = 0; + oSub.HSPGroupID = DBUtility.ClsPub.isLong(subList[0].HSPGroupID); + oSub.HBatchNo = DBUtility.ClsPub.isStrNull(subList[0].HBatchNo); + oSub.HNewModel = DBUtility.ClsPub.isStrNull(subList[0].HNewModel); + oSub.HWallThickness = DBUtility.ClsPub.isStrNull(subList[0].HWallThickness); + oSub.HHardness = DBUtility.ClsPub.isStrNull(subList[0].HHardness); + oSub.HLastProdModel = DBUtility.ClsPub.isStrNull(subList[0].HLastProdModel); + oSub.HDiameter = DBUtility.ClsPub.isStrNull(subList[0].HDiameter); + oSub.HBackFlag = DBUtility.ClsPub.isStrNull(subList[0].HBackFlag); + BillNew.DetailColl.Add(oSub); + bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo); + //鎻愮ず + if (bResult == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ClsPub.sExeReturnInfo + "鍗曟嵁鍙�:" + mainList[0].HBillNo.Trim(); + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + + #endregion + + #region 妯″叿鍏朵粬鍑哄簱鍗� + + #region 妯″叿鍏朵粬鍑哄簱鍗曚繚瀛� + + [Route("Sc_MouldOtherOutBill/MouldOtherOutBill_Save")] + [HttpPost] + public object MouldOtherOutBill_Save([FromBody] JObject sMainSub) + { + var _value = sMainSub["sMainSub"].ToString(); + string msg1 = _value.ToString(); + //淇濆瓨鍗曟嵁 + return objJsonResult = MouldOtherOutAddBill(msg1); + } + + public json MouldOtherOutAddBill(string msg1) + { + //string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + //string msg2 = sArray[0].ToString(); + //string msg3 = sArray[0].ToString(); + bool bResult; + try + { + //msg2 = "[" + msg2.ToString() + "]"; + msg1 = "[" + msg1.ToString() + "]"; + DAL.ClsSc_MouldOtherOutBill BillNew = new DAL.ClsSc_MouldOtherOutBill(); + List<Model.ClsSc_MouldOtherOutBillMain> mainList = Newtonsoft + .Json + .JsonConvert + .DeserializeObject<List<Model.ClsSc_MouldOtherOutBillMain>>(msg1); + List<Model.ClsSc_MouldStockBillSub> subList = Newtonsoft + .Json + .JsonConvert + .DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(msg1); + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = mainList[0].HDate;//鏃ユ湡 + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + BillNew.omodel.HYear = sYear; + BillNew.omodel.HPeriod = sPeriod; + BillNew.omodel.HBillNo = mainList[0].HBillNo.Trim(); + BillNew.omodel.HMaker = mainList[0].HMaker; + BillNew.omodel.HDate = HDate; + BillNew.omodel.HWHID = mainList[0].HWHID; + BillNew.omodel.HSupID = 0; + BillNew.omodel.HSCWHID = 0; + BillNew.omodel.HEmpID = 0; + BillNew.omodel.HManagerID = mainList[0].HManagerID; + BillNew.omodel.HSecManagerID = mainList[0].HSecManagerID; + BillNew.omodel.HKeeperID = mainList[0].HSecManagerID; + BillNew.omodel.HDeptID = mainList[0].HSecManagerID; + BillNew.omodel.HExplanation = mainList[0].HExplanation; + BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo; + BillNew.omodel.HRedBlueFlag = mainList[0].HRedBlueFlag; + BillNew.DetailColl = new List<Model.ClsSc_MouldStockBillSub>(); + Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub(); + + oSub.HEntryID = 1; + oSub.HRemark = DBUtility.ClsPub.isStrNull(subList[0].HRemark); + oSub.HSourceInterID = DBUtility.ClsPub.isLong(subList[0].HSourceInterID); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(subList[0].HSourceEntryID); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillType); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillNo); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(subList[0].HRelationQty); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(subList[0].HRelationMoney); + oSub.HCloseMan = DBUtility.ClsPub.isStrNull(subList[0].HCloseMan); + oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(subList[0].HEntryCloseDate); + oSub.HCloseType = DBUtility.ClsPub.isBool(subList[0].HCloseType); + oSub.HMaterID = DBUtility.ClsPub.isLong(subList[0].HMaterID); + oSub.HPropertyID = DBUtility.ClsPub.isLong(subList[0].HPropertyID); + oSub.HSecUnitID = DBUtility.ClsPub.isLong(subList[0].HSecUnitID); + oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(subList[0].HSecUnitRate); + oSub.HUnitID = DBUtility.ClsPub.isLong(subList[0].HUnitID); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(subList[0].HQtyMust); + oSub.HQty = DBUtility.ClsPub.isDoule(subList[0].HQty); + oSub.HBarCode = DBUtility.ClsPub.isStrNull(subList[0].HBarCode); + if (oSub.HQty <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娴佽浆鍗℃暟閲忎笉鑳戒负0鎴栬�呭皬浜�0"; + objJsonResult.data = null; + return objJsonResult; + } + oSub.HDesignLife = DBUtility.ClsPub.isLong(subList[0].HDesignLife); + if (oSub.HDesignLife < 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璁捐瀵垮懡涓嶈兘涓�0鎴栬�呭皬浜�0"; + objJsonResult.data = null; + return objJsonResult; + } + oSub.HLeaveLife = DBUtility.ClsPub.isLong(subList[0].HLeaveLife); + oSub.HPrice = DBUtility.ClsPub.isDoule(subList[0].HPrice); + oSub.HWHID = DBUtility.ClsPub.isLong(subList[0].HWHID); + oSub.HSPID = DBUtility.ClsPub.isLong(subList[0].HSPID); + oSub.HSCWHID = 0; + oSub.HSCSPID = 0; + oSub.HSPGroupID = DBUtility.ClsPub.isLong(subList[0].HSPGroupID); + oSub.HBatchNo = DBUtility.ClsPub.isStrNull(subList[0].HBatchNo); + oSub.HNewModel = DBUtility.ClsPub.isStrNull(subList[0].HNewModel); + oSub.HWallThickness = DBUtility.ClsPub.isStrNull(subList[0].HWallThickness); + oSub.HHardness = DBUtility.ClsPub.isStrNull(subList[0].HHardness); + oSub.HLastProdModel = DBUtility.ClsPub.isStrNull(subList[0].HLastProdModel); + oSub.HDiameter = DBUtility.ClsPub.isStrNull(subList[0].HDiameter); + oSub.HBackFlag = DBUtility.ClsPub.isStrNull(subList[0].HBackFlag); + BillNew.DetailColl.Add(oSub); + bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo); + //鎻愮ず + if (bResult == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ClsPub.sExeReturnInfo + "鍗曟嵁鍙�:" + mainList[0].HBillNo.Trim(); + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + + #endregion + + #region 妯″叿缁翠慨璁板綍鍗� + + #region 妯″叿缁翠慨璁板綍鍗曚繚瀛� + + [Route("Sc_MouldRepairWorkBill/MouldRepairWorkBill_Save")] + [HttpPost] + public object MouldRepairWorkBill_Save([FromBody] JObject sMainSub) + { + var _value = sMainSub["sMainSub"].ToString(); + string msg1 = _value.ToString(); + return objJsonResult = MouldRepairWorkAddBill(msg1); + } + + public json MouldRepairWorkAddBill(string msg1) + { + bool bResult; + try + { + msg1 = "[" + msg1.ToString() + "]"; + DAL.ClsSb_MouldRepairWorkBill BillNew = new DAL.ClsSb_MouldRepairWorkBill(); + List<Model.ClsSb_MouldRepairWorkBillMain> mainList = Newtonsoft + .Json + .JsonConvert + .DeserializeObject<List<Model.ClsSb_MouldRepairWorkBillMain>>(msg1); + List<Model.ClsSb_MouldRepairWorkBillSub> subList = Newtonsoft + .Json + .JsonConvert + .DeserializeObject<List<Model.ClsSb_MouldRepairWorkBillSub>>(msg1); + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = mainList[0].HDate; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + BillNew.omodel.HYear = sYear; + BillNew.omodel.HPeriod = sPeriod; + BillNew.omodel.HBillNo = mainList[0].HBillNo.Trim(); + BillNew.omodel.HMaker = mainList[0].HMaker; + BillNew.omodel.HDate = HDate; + BillNew.omodel.HMouldID = mainList[0].HMouldID; + BillNew.omodel.HDeptID = mainList[0].HDeptID; + BillNew.omodel.HEmpID = mainList[0].HEmpID; + BillNew.omodel.HRepairID = mainList[0].HRepairID; + BillNew.omodel.HManagerID = mainList[0].HManagerID; + BillNew.omodel.HRepairBeginDate = mainList[0].HRepairBeginDate; + BillNew.omodel.HRepairEndDate = mainList[0].HRepairEndDate; + BillNew.omodel.HRepairContent = mainList[0].HRepairContent; + BillNew.omodel.HCycleUnit = mainList[0].HCycleUnit; + BillNew.omodel.HPlanTimes = mainList[0].HPlanTimes; + BillNew.omodel.HTimes = mainList[0].HTimes; + BillNew.omodel.HExplanation = mainList[0].HExplanation; + BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo; + BillNew.omodel.HMouldID = mainList[0].HMouldID; + BillNew.omodel.HSupID = mainList[0].HSupID; + BillNew.omodel.HRepairType = mainList[0].HRepairType; + BillNew.omodel.HNewModel = mainList[0].HNewModel; + BillNew.omodel.HNewDesignLife = mainList[0].HNewDesignLife; + BillNew.omodel.HEquipID = mainList[0].HEquipID; + BillNew.DetailColl = new List<Model.ClsSb_MouldRepairWorkBillSub>(); + Model.ClsSb_MouldRepairWorkBillSub oSub = new Model.ClsSb_MouldRepairWorkBillSub(); + oSub.HEntryID = 1; + oSub.HRemark = DBUtility.ClsPub.isStrNull(subList[0].HRemark); + oSub.HSourceInterID = DBUtility.ClsPub.isLong(subList[0].HSourceInterID); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(subList[0].HSourceEntryID); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillType); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillNo); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(subList[0].HRelationQty); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(subList[0].HRelationMoney); + oSub.HCloseMan = DBUtility.ClsPub.isStrNull(subList[0].HCloseMan); + oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(subList[0].HEntryCloseDate); + oSub.HCloseType = DBUtility.ClsPub.isBool(subList[0].HCloseType); + oSub.HRepairID = DBUtility.ClsPub.isLong(subList[0].HRepairID); + oSub.HManagerID = DBUtility.ClsPub.isLong(subList[0].HManagerID); + oSub.HMoney = DBUtility.ClsPub.isDoule(subList[0].HMoney); + oSub.HRepairExplanation = DBUtility.ClsPub.isStrNull(subList[0].HRepairExplanation); + BillNew.DetailColl.Add(oSub); + bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo); + if (bResult == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ClsPub.sExeReturnInfo + "鍗曟嵁鍙�:" + mainList[0].HBillNo.Trim(); + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + + #endregion + + #region 妯″叿瀵垮懡璋冩暣鍗� + + #region 妯″叿瀵垮懡璋冩暣鍗曚繚瀛� + + [Route("Sc_MouldLifeChangeBill/MouldLifeChangeBill_Save")] + [HttpPost] + public object MouldLifeChangeBill_Save([FromBody] JObject sMainSub) + { + var _value = sMainSub["sMainSub"].ToString(); + string msg1 = _value.ToString(); + return objJsonResult = MouldLifeChangeAddBill(msg1); + } + + public json MouldLifeChangeAddBill(string msg1) + { + bool bResult; + try + { + msg1 = "[" + msg1.ToString() + "]"; + DAL.ClsSc_MouldLifeChangeBill BillNew = new DAL.ClsSc_MouldLifeChangeBill(); + List<Model.ClsSc_MouldLifeChangeBillMain> mainList = Newtonsoft + .Json + .JsonConvert + .DeserializeObject<List<Model.ClsSc_MouldLifeChangeBillMain>>(msg1); + List<Model.ClsSc_MouldLifeChangeBillSub> subList = Newtonsoft + .Json + .JsonConvert + .DeserializeObject<List<Model.ClsSc_MouldLifeChangeBillSub>>(msg1); + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = mainList[0].HDate; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + BillNew.omodel.HYear = sYear; + BillNew.omodel.HPeriod = sPeriod; + BillNew.omodel.HBillNo = mainList[0].HBillNo.Trim(); + BillNew.omodel.HMaker = mainList[0].HMaker; + BillNew.omodel.HDate = HDate; + BillNew.omodel.HRemark = mainList[0].HRemark; + BillNew.omodel.HMangerID = mainList[0].HMangerID; + BillNew.omodel.HEmpID = mainList[0].HEmpID; + BillNew.omodel.HDeptID = mainList[0].HDeptID; + BillNew.omodel.HReason = mainList[0].HReason; + BillNew.omodel.HExplanation = mainList[0].HExplanation; + BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo; + BillNew.DetailColl = new List<Model.ClsSc_MouldLifeChangeBillSub>(); + Model.ClsSc_MouldLifeChangeBillSub oSub = new Model.ClsSc_MouldLifeChangeBillSub(); + oSub.HEntryID = 1; + oSub.HRemark = DBUtility.ClsPub.isStrNull(subList[0].HRemark); + oSub.HSourceInterID = DBUtility.ClsPub.isLong(subList[0].HSourceInterID); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(subList[0].HSourceEntryID); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillType); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillNo); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(subList[0].HRelationQty); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(subList[0].HRelationMoney); + oSub.HCloseMan = DBUtility.ClsPub.isStrNull(subList[0].HCloseMan); + oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(subList[0].HEntryCloseDate); + oSub.HCloseType = DBUtility.ClsPub.isBool(subList[0].HCloseType); + oSub.HMaterID = DBUtility.ClsPub.isLong(subList[0].HMaterID); + oSub.HPropertyID = DBUtility.ClsPub.isLong(subList[0].HPropertyID); + oSub.HSecUnitID = DBUtility.ClsPub.isLong(subList[0].HSecUnitID); + oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(subList[0].HSecUnitRate); + oSub.HLeaveLife = DBUtility.ClsPub.isSingle(subList[0].HLeaveLife); + oSub.HDesignLife = DBUtility.ClsPub.isSingle(subList[0].HDesignLife); + oSub.HNewLeaveLife = DBUtility.ClsPub.isSingle(subList[0].HNewLeaveLife); + if (oSub.HDesignLife < 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璁捐瀵垮懡涓嶈兘涓�0鎴栬�呭皬浜�0"; + objJsonResult.data = null; + return objJsonResult; + } + if (oSub.HLeaveLife < 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍓╀綑瀵垮懡涓嶈兘涓�0鎴栬�呭皬浜�0"; + objJsonResult.data = null; + return objJsonResult; + } + oSub.HSourceInterID = DBUtility.ClsPub.isLong(subList[0].HSourceInterID); + oSub.HSourceEntryID = DBUtility.ClsPub.isLong(subList[0].HSourceEntryID); + oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillNo); + oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(subList[0].HSourceBillType); + oSub.HRelationQty = DBUtility.ClsPub.isDoule(subList[0].HRelationQty); + oSub.HRelationMoney = DBUtility.ClsPub.isDoule(subList[0].HRelationMoney); + BillNew.DetailColl.Add(oSub); + bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo); + if (bResult == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ClsPub.sExeReturnInfo + "鍗曟嵁鍙�:" + mainList[0].HBillNo.Trim(); + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + + #endregion + + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs index 0ed6fa9..c1d9ee8 100644 --- a/WebAPI/Controllers/WebAPIController.cs +++ b/WebAPI/Controllers/WebAPIController.cs @@ -12,6 +12,7 @@ using System.Web.Http; using WebAPI; using WebAPI.Models; +using WebAPI.Service; namespace WebAPI.Controllers { @@ -22,7 +23,7 @@ public DataSet ds = new DataSet(); private json objjson = new json(); private json objJsonResult = new json(); - // private POInStockBillServices oclscg_poinstockbillmain = new POInStockBillServices(); + // private POInStockBillServices oclscg_poinstockbillmain = new POInStockBillServices(); /// <summary> /// 閫佽揣鍗曡〃澶翠俊鎭� /// </summary> @@ -934,6 +935,7 @@ } } + #region 涓嶈壇鍘熷洜璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶 /// <summary> /// 鑾峰彇涓嶈壇鍘熷洜鍒楄〃 /// </summary> @@ -994,6 +996,343 @@ } } + + /// <summary> + /// 淇濆瓨涓嶈壇鍘熷洜 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("SaveGy_BadReasonList")] + [HttpPost] + public object SaveGy_BadReasonList([FromBody] JObject msg) + { + DataSet ds; + 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(); + Int64 HItemID = 0; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //鑾峰彇鏈�澶D鍊艰祴鍊� + DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_BadReason ", "Gy_BadReason"); + if (Maxds != null || Maxds.Tables[0].Rows.Count > 0) + { + //HItemID= Maxds.Tables[0].Rows[0]["HItemID"] + var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]); + maxid += 1; + HItemID = maxid; + } + ListModels oListModels = new ListModels(); + try + { + WebAPI.DLL.ClsGy_BadReason_Ctl oBill = new WebAPI.DLL.ClsGy_BadReason_Ctl(); + List<Model.ClsGy_BadReason_Model> lsmain = new List<Model.ClsGy_BadReason_Model>(); + msg1 = msg1.Replace("\\", ""); + msg1 = msg1.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_BadReason(msg1); + foreach (Model.ClsGy_BadReason_Model oItem in lsmain) + { + if (oItem.HNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (oItem.HName.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim())) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮� + + ds = oCN.RunProcReturn("select * from Gy_BadReason where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_BadReason"); + if (oItem.HNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鏂板鏃跺垽鏂� + if (oItem.HItemID == 0) + { + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + else//缂栬緫鏃跺垽鏂� + { + //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦� + string sParent; + sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); + if (sParent.Trim() == "") + { + oBill.oModel.HParentID = 0; + } + else + { + if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID)) + { + oBill.oModel.HParentID = oBill.oModel.HItemID; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + } + } + //寰楀埌鐭唬鐮� + string sShortNumber; + sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); + if (sShortNumber.Trim() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oItem.HShortNumber = sShortNumber;//鐭唬鐮� + oItem.HEndFlag = true;//鏈骇鏍囧織 + oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇 + + oBill.oModel = oItem; + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.oModel.HItemID == 0) + { + // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + bResult = oBill.AddNew(); + } + else + { + bResult = oBill.ModifyByID(oBill.oModel.HItemID); + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�"); + 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; + } + } + + /// <summary> + /// 涓嶈壇鍘熷洜鑾峰彇淇℃伅 + /// </summary> + /// <returns></returns> + [Route("GetGy_BadReasonDetail")] + [HttpGet] + public ApiResult<DataSet> GetGy_BadReasonDetail(string HID) + { + var model = LuBaoSevice.GetGy_BadReasonBillDetail(HID); + return model; + } + + /// <summary> + /// 涓嶈壇鍘熷洜鍒犻櫎鍔熻兘 + /// </summary> + /// <returns></returns> + [Route("DeltetGy_BadReason")] + [HttpGet] + public object DeltetGy_BadReason(string HItemID) + { + DataSet ds; + //string ModRightNameCheck = "Sc_ProcessReport_check"; + try + { + //鍒犻櫎鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (string.IsNullOrWhiteSpace(HItemID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran();//寮�濮嬩簨鍔� + ds = oCN.RunProcReturn("select * from Gy_BadReason where HItemID=" + HItemID, "Gy_BadReason"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; ; + } + var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); + if (HStopflag) + { + oCN.RollBack();//鍥炴粴浜嬪姟 + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏁版嵁宸插垹闄ゆ棤娉曞啀娆″垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.RunProc("update Gy_BadReason set HStopflag=1 where HItemID=" + HItemID); + 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 + + /// <summary> + /// 鎶ュ簾鍘熷洜 + /// </summary> + /// <returns></returns> + [Route("Web/GetScrapReasonList_Json")] + [HttpGet] + public object GetScrapReasonList_Json(string BadReason) + { + //sWhere = " Where HStopFlag=0 and HEndFlag=1"; + //sWhere = " Where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString(); + if (BadReason != ""&& BadReason != null) + { + sWhere = sWhere + " and ( HNumber like '%" + BadReason + "%' or HName like '%" + BadReason + "%' ) "; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sWhere == null || sWhere.Equals("")) + + { + ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName from Gy_ScrapReason where HStopflag=0 Order by HItemID ", "Gy_ScrapReason"); + } + else + { + string sql1 = "Select HItemID,HNumber ,HName from Gy_ScrapReason where HStopflag=0 and HEndFlag=1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_ScrapReason"); + } + + //ds = webserver.GetUnitList(sWhere, ref DBUtility.ClsPub.sErrInfo); + + + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo; + objjson.data = null; + return objjson; + } + else + { + objjson.code = "0"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛!"; + objjson.data = ds.Tables[0]; + return objjson; + } + } + catch (Exception ex) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + ex.ToString(); + objjson.data = null; + return objjson; + } + } /// <summary> /// 鑾峰彇宸ュ簭璁″垝鍗曞垪琛� @@ -1089,6 +1428,463 @@ #endregion + + /// <summary> + /// 鑾峰彇鑱屽姟鍒楄〃 + /// </summary> + /// <returns></returns> + [Route("Web/GetDutyList_Json")] + [HttpGet] + public object GetDutyList_Json(string Duty) + { + //sWhere = " Where HStopFlag=0 and HEndFlag=1"; + //sWhere = " Where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString(); + if (Duty != "") + { + sWhere = sWhere + " and ( HNumber like '%" + Duty + "%' or HName like '%" + Duty + "%' ) "; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName from Gy_Duty where HStopflag=0 Order by HItemID ", "Gy_Duty"); + } + else + { + string sql1 = "Select HItemID,HNumber ,HName from Gy_Duty where HStopflag=0 and HEndFlag=1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_Duty"); + } + + //ds = webserver.GetUnitList(sWhere, ref DBUtility.ClsPub.sErrInfo); + + + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo; + objjson.data = null; + return objjson; + } + else + { + objjson.code = "0"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛!"; + objjson.data = ds.Tables[0]; + return objjson; + } + } + catch (Exception ex) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + ex.ToString(); + objjson.data = null; + return objjson; + } + } + + + + /// <summary> + /// 鑾峰彇瀹胯垗鍒楄〃 + /// </summary> + /// <returns></returns> + [Route("Web/GetDormList_Json")] + [HttpGet] + public object GetDormList_Json(string Dorm) + { + //sWhere = " Where HStopFlag=0 and HEndFlag=1"; + //sWhere = " Where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString(); + if (Dorm != "") + { + sWhere = sWhere + " and ( HNumber like '%" + Dorm + "%' or HName like '%" + Dorm + "%' ) "; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName from Gy_Dorm where HStopflag=0 Order by HItemID ", "Gy_Dorm"); + } + else + { + string sql1 = "Select HItemID,HNumber ,HName from Gy_Dorm where HStopflag=0 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_Dorm"); + } + + //ds = webserver.GetUnitList(sWhere, ref DBUtility.ClsPub.sErrInfo); + + + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo; + objjson.data = null; + return objjson; + } + else + { + objjson.code = "0"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛!"; + objjson.data = ds.Tables[0]; + return objjson; + } + } + catch (Exception ex) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + ex.ToString(); + objjson.data = null; + return objjson; + } + } + + /// <summary> + /// 鑾峰彇宸ョ鍒楄〃 + /// </summary> + /// <returns></returns> + [Route("Web/GetWorkTypeList_Json")] + [HttpGet] + public object GetWorkTypeList_Json(string WorkType) + { + //sWhere = " Where HStopFlag=0 and HEndFlag=1"; + //sWhere = " Where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString(); + if (WorkType != "") + { + sWhere = sWhere + " and ( HNumber like '%" + WorkType + "%' or HName like '%" + WorkType + "%' ) "; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName from Gy_WorkType where HStopflag=0 Order by HItemID ", "Gy_WorkType"); + } + else + { + string sql1 = "Select HItemID,HNumber ,HName from Gy_WorkType where HStopflag=0 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_WorkType"); + } + + //ds = webserver.GetUnitList(sWhere, ref DBUtility.ClsPub.sErrInfo); + + + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo; + objjson.data = null; + return objjson; + } + else + { + objjson.code = "0"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛!"; + objjson.data = ds.Tables[0]; + return objjson; + } + } + catch (Exception ex) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + ex.ToString(); + objjson.data = null; + return objjson; + } + } + + /// <summary> + /// 鑾峰彇鏍哥畻鏂瑰紡鍒楄〃 + /// </summary> + /// <returns></returns> + [Route("Web/GetClassTimePrjGroupList_Json")] + [HttpGet] + public object GetClassTimePrjGroupList_Json(string ClassTimePrjGroup) + { + //sWhere = " Where HStopFlag=0 and HEndFlag=1"; + //sWhere = " Where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString(); + if (ClassTimePrjGroup != "") + { + sWhere = sWhere + " and ( HNumber like '%" + ClassTimePrjGroup + "%' or HName like '%" + ClassTimePrjGroup + "%' ) "; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName from Gy_ClassTimePrjGroup where HStopflag=0 Order by HItemID ", "Gy_ClassTimePrjGroup"); + } + else + { + string sql1 = "Select HItemID,HNumber ,HName from Gy_ClassTimePrjGroup where HStopflag=0 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_ClassTimePrjGroup"); + } + + //ds = webserver.GetUnitList(sWhere, ref DBUtility.ClsPub.sErrInfo); + + + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo; + objjson.data = null; + return objjson; + } + else + { + objjson.code = "0"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛!"; + objjson.data = ds.Tables[0]; + return objjson; + } + } + catch (Exception ex) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + ex.ToString(); + objjson.data = null; + return objjson; + } + } + + /// <summary> + /// 鑾峰彇宀椾綅鍒楄〃 + /// </summary> + /// <returns></returns> + [Route("Web/GetGy_PostList_Json")] + [HttpGet] + public object GetGy_PostList_Json(string ParamPost) + { + //sWhere = " Where HStopFlag=0 and HEndFlag=1"; + //sWhere = " Where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString(); + if (ParamPost != "") + { + sWhere = sWhere + " and ( HNumber like '%" + ParamPost + "%' or HName like '%" + ParamPost + "%' ) "; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName from Gy_Post where HStopflag=0 Order by HItemID ", "Gy_Post"); + } + else + { + string sql1 = "Select HItemID,HNumber ,HName from Gy_Post where HStopflag=0 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_Post"); + } + + //ds = webserver.GetUnitList(sWhere, ref DBUtility.ClsPub.sErrInfo); + + + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo; + objjson.data = null; + return objjson; + } + else + { + objjson.code = "0"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛!"; + objjson.data = ds.Tables[0]; + return objjson; + } + } + catch (Exception ex) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + ex.ToString(); + objjson.data = null; + return objjson; + } + } + + /// <summary> + /// 鑾峰彇鐐规椤圭洰鍒楄〃 + /// </summary> + /// <returns></returns> + [Route("Web/GetCheckItemList_Json")] + [HttpGet] + public object GetCheckItemList_Json(string CheckItem) + { + DataSet ds; + try + { + sWhere = " Where HStopFlag=0 and HEndFlag=1"; + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //sWhere = " Where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString(); + if (CheckItem != ""&& CheckItem!=null) + { + sWhere = sWhere + " and ( HNumber like '%" + CheckItem + "%' or HName like '%" + CheckItem + "%' ) "; + ds = oCN.RunProcReturn("Select HItemID,HNumber,HName from Gy_DotCheck " + sWhere + " Order by HItemID ", "Gy_DotCheck"); + } + else + { + ds = oCN.RunProcReturn("Select HItemID,HNumber,HName from Gy_DotCheck " + sWhere + " Order by HItemID ", "Gy_DotCheck"); + } + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo; + objjson.data = null; + return objjson; + } + else + { + objjson.code = "0"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛!"; + objjson.data = ds.Tables[0]; + return objjson; + } + } + catch (Exception ex) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + ex.ToString(); + objjson.data = null; + return objjson; + } + + + + } + /// <summary> + /// 鑾峰彇鐢熶骇浠诲姟鍗曞垪琛� + /// </summary> + /// <returns></returns> + [Route("Web/GetSc_ICMOBillListView")] + [HttpGet] + public object GetSc_ICMOBillListView(string ICMOBill,int OrganizationID) + { + if (ICMOBill != "") + { + sWhere = "where 1=1 and 鐢熶骇璁㈠崟鍙� like '%" + ICMOBill + "%' and HSTOCKINORGID=" + OrganizationID; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_S_Sc_ICMOBillList where HSTOCKINORGID=" + OrganizationID, "h_v_S_Sc_ICMOBillList"); + } + else + { + string sql1 = "select * from h_v_S_Sc_ICMOBillList "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_S_Sc_ICMOBillList"); + } + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo; + objjson.data = null; + return objjson; + } + else + { + objjson.code = "0"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛!"; + objjson.data = ds.Tables[0]; + return objjson; + } + } + catch (Exception ex) + { + + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + ex.ToString(); + objjson.data = null; + return objjson; + } + } + + /// <summary> + /// 鑾峰彇缁翠慨椤圭洰鍒楄〃 + /// </summary> + /// <returns></returns> + [Route("Web/GetRepairList_Json")] + [HttpGet] + public object GetRepairList_Json(string Repair) + { + if (Repair != "") + { + sWhere = " and ( HNumber like '%" + Repair + "%' or HName like '%" + Repair + "%' ) "; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName from Gy_Repair where HStopflag=0 Order by HItemID ", "Gy_Repair"); + } + else + { + string sql1 = "Select HItemID,HNumber ,HName from Gy_Repair where HStopflag=0 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_Repair"); + } + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo; + objjson.data = null; + return objjson; + } + else + { + objjson.code = "0"; + objjson.count = 1; + objjson.Message = "鑾峰彇鎴愬姛!"; + objjson.data = ds.Tables[0]; + return objjson; + } + } + catch (Exception ex) + { + objjson.code = "0"; + objjson.count = 0; + objjson.Message = "鑾峰彇澶辫触" + ex.ToString(); + objjson.data = null; + return objjson; + } + } + + } } diff --git a/WebAPI/DLL/ClsGy_BadReason_Ctl.cs b/WebAPI/DLL/ClsGy_BadReason_Ctl.cs new file mode 100644 index 0000000..13d9431 --- /dev/null +++ b/WebAPI/DLL/ClsGy_BadReason_Ctl.cs @@ -0,0 +1,102 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsGy_BadReason_Ctl : DBUtility.ClsGy_Base_Ctl + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + //鍘熶唬鐮� 鐢ㄤ簬 鏇挎崲瀛愰」鐩� + public string HOldNumber; + public Model.ClsGy_BadReason_Model oModel = new Model.ClsGy_BadReason_Model(); + //鏂板 + public override bool AddNew() + { + + try + { + oCn.BeginTran(); + oCn.RunProc("Insert into " + MvarItemKey + " " + + " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + + ",HDeptID,HProcID" + + ",HLevel,HEndFlag,HStopflag,HRemark) " + + " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() + + "," + oModel.HDeptID.ToString() + "," + oModel.HProcID.ToString() + + "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "')", ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼涓婄骇涓洪潪鏈骇浠g爜 + oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + oCn.Commit(); + return true; + } + catch (Exception e) + { + oCn.RollBack(); + throw (e); + } + } + + //淇敼 + public override bool ModifyByID(Int64 sItemID) + { + try + { + oCn.BeginTran(); + oCn.RunProc("Update " + MvarItemKey + " set " + + " HNumber='" + oModel.HNumber + "'" + + ",HName='" + oModel.HName + "'" + + ",HShortNumber='" + oModel.HShortNumber + "'" + + ",HHelpCode='" + oModel.HHelpCode + "'" + + ",HLevel=" + oModel.HLevel.ToString() + + ",HDeptID=" + oModel.HDeptID.ToString() + + ",HProcID=" + oModel.HProcID.ToString() + + ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) + + ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) + + ",HRemark= '" + oModel.HRemark + "' Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo); + //淇敼瀛愰」鐩唬鐮� + oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo); + //灏嗕笂绾� 涓洪潪鏈骇 + oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); + // + oCn.Commit(); + return true; + } + catch (Exception e) + { + oCn.RollBack(); + throw (e); + } + } + //鏍规嵁浠g爜鍒ゆ柇淇℃伅 + public override bool HavParentCode(string sCode, Int64 sItemID) + { + DataSet DS; + try + { + DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HStopflag=0 and HNumber='" + sCode + "' and HItemID<>" + sItemID, MvarItemKey, ref Pub_Class.ClsPub.sExeReturnInfo); + if (DS.Tables[0].Rows.Count == 0) + return false; + else + { + oModel.HItemID = Convert.ToInt64(DS.Tables[0].Rows[0]["HItemID"]); + return true; + } + } + catch (Exception e) + { + throw (e); + } + } + //鏋勯�犲嚱鏁� + public ClsGy_BadReason_Ctl() + { + MvarItemKey = "Gy_BadReason"; + MvarReportTitle = "涓嶈壇鍘熷洜璁剧疆"; + oModel = new Model.ClsGy_BadReason_Model(); + } + + + + } +} diff --git a/WebAPI/DLL/ClsSb_EquipConkBookBill.cs b/WebAPI/DLL/ClsSb_EquipConkBookBill.cs new file mode 100644 index 0000000..25880c7 --- /dev/null +++ b/WebAPI/DLL/ClsSb_EquipConkBookBill.cs @@ -0,0 +1,219 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSb_EquipConkBookBill : DBUtility.ClsXt_BaseBill + { + public Model.ClsSb_EquipConkBookBillMain omodel = new Model.ClsSb_EquipConkBookBillMain(); + public List<Model.ClsSb_EquipConkBookBillSub> DetailColl = new List<Model.ClsSb_EquipConkBookBillSub>(); + + public ClsSb_EquipConkBookBill() + { + base.MvarItemKeySub = "Sb_EquipConkBookBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey = "Sb_EquipConkBookBillMain"; + base.MvarReportTitle = "璁惧浜嬫晠鐧昏琛�"; + base.BillType = "3907"; + } + + #region 鍥哄畾浠g爜 + + ~ClsSb_EquipConkBookBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sb_EquipConkBookBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //========================================= + ",HEquipID=" + omodel.HEquipID.ToString() + + ",HConkTypeID=" + omodel.HConkTypeID.ToString() + + ",HConkBeginDate='" + omodel.HConkBeginDate + "'" + + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HManagerID=" + omodel.HManagerID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + //DeleteRelation(ref sReturn, lngBillKey); + ////鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + ////鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsSb_EquipConkBookBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sb_EquipConkBookBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HConkReasonID,HConkExplanation,HManagerID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + oSub.HEntryCloseDate.ToShortDateString() + "," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HConkReasonID.ToString() + ",'" + oSub.HConkExplanation + "'," + oSub.HManagerID.ToString() + + ") "); + } + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sb_EquipConkBookBillMain" + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + + ",HEquipID,HExplanation,HInnerBillNo,HConkTypeID,HEmpID" + + ",HManagerID,HDeptID,HConkBeginDate" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" + + ", " + omodel.HEquipID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + omodel.HConkTypeID.ToString() + "," + omodel.HEmpID.ToString() + + "," + omodel.HManagerID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HConkBeginDate + "'" + + ") "); + ////鎻掑叆瀛愯〃 + foreach (Model.ClsSb_EquipConkBookBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sb_EquipConkBookBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HConkReasonID,HManagerID,HConkExplanation" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + oSub.HEntryCloseDate.ToShortDateString() + "," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HConkReasonID.ToString() + "," + oSub.HManagerID.ToString() + ",'" + oSub.HConkExplanation + "'" + + ") "); + } + 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 Sb_EquipConkBookBillMain Where HInterID=" + lngBillKey.ToString(), "Sb_EquipConkBookBillMain"); + if (Ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + //璧嬪�� + omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); + omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); + omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); + omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); + omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); + omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); + omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); + omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); + 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.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.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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); + omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); + omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); + omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); + omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); + //======================================= + omodel.HEquipID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEquipID"]); + omodel.HConkTypeID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HConkTypeID"]); + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]); + omodel.HConkBeginDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HConkBeginDate"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HExplanation = Ds.Tables[0].Rows[0]["HExplanation"].ToString().Trim(); + omodel.HInnerBillNo = Ds.Tables[0].Rows[0]["HInnerBillNo"].ToString().Trim(); + //寰幆 + DataSet DsSub; + DsSub = oCn.RunProcReturn("Select * from Sb_EquipConkBookBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sb_EquipConkBookBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSb_EquipConkBookBillSub oSub = new Model.ClsSb_EquipConkBookBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=========================================== + oSub.HConkReasonID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HConkReasonID"]); + oSub.HConkExplanation = DsSub.Tables[0].Rows[i]["HConkExplanation"].ToString().Trim(); + oSub.HManagerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HManagerID"]); + + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + + } +} \ No newline at end of file diff --git a/WebAPI/DLL/ClsSb_EquipDotCheckBill.cs b/WebAPI/DLL/ClsSb_EquipDotCheckBill.cs new file mode 100644 index 0000000..5afb8c8 --- /dev/null +++ b/WebAPI/DLL/ClsSb_EquipDotCheckBill.cs @@ -0,0 +1,274 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSb_EquipDotCheckBill:DBUtility.ClsXt_BaseBill + { + public Models.ClsSb_EquipDotCheckBillMain omodel = new Models.ClsSb_EquipDotCheckBillMain(); + public List<Models.ClsSb_EquipDotCheckBillSub> DetailColl = new List<Models.ClsSb_EquipDotCheckBillSub>(); + + public ClsSb_EquipDotCheckBill() + { + base.MvarItemKeySub = "Sb_EquipDotCheckBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sb_EquipDotCheckBillMain"; + base.MvarReportTitle="璁惧鐐规璁板綍"; + base.BillType = "3903"; + base.HBillSubType = "3903"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSb_EquipDotCheckBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sb_EquipDotCheckBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HEquipID=" + omodel.HEquipID.ToString() + + ",HBeginDate='" + omodel.HBeginDate + "'" + + ",HEndDate='" + omodel.HEndDate+"'" + + ",HPlanNo='" + omodel.HPlanNo + "'" + + ",HExplanation='" + omodel.HExplanation+"'" + + ",HInnerBillNo='" + omodel.HInnerBillNo+"'" + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Models.ClsSb_EquipDotCheckBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sb_EquipDotCheckBillSub " + + " (HInterID,HEntryID," + + "HCloseMan,HEntryCloseDate,HCloseType,HRemark," + + "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," + + "HDotCheckItem,HDotCheckPart,HClaim," + + "HManagerID,HManagerNumber" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + + ",'" + oSub.HCloseMan + "','"+oSub.HEntryCloseDate+"'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + ",'" + oSub.HDotCheckItem + "','"+oSub.HDotCheckPart+"','" + oSub.HClaim + + "'," + oSub.HManagerID.ToString()+",'" +oSub.HManagerNumber+"'"+ + ") "); + } + // + //foreach (Model.ClsSb_EquipDotCheckBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sb_EquipDotCheckBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sb_EquipDotCheckBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark,HEquipID" + + ",HBeginDate,HEndDate,HPlanNo,HExplanation,HInnerBillNo" + + ",HDeptID" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'," + omodel.HEquipID.ToString() + + ",'" + omodel.HBeginDate + "','" + omodel.HEndDate + "','" + omodel.HPlanNo + "','" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'" + + ",'" + omodel.HDeptID + "'" + + ") "); + //鎻掑叆瀛愯〃 + foreach (Models.ClsSb_EquipDotCheckBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sb_EquipDotCheckBillSub " + + " (HInterID,HEntryID," + + "HCloseMan,HEntryCloseDate,HCloseType,HRemark," + + "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," + + "HDotCheckItem,HDotCheckPart,HClaim," + + "HManagerID,HManagerNumber" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + + "'," + oSub.HManagerID.ToString() + ",'" + oSub.HManagerNumber + "'" + + ") "); + } + // + //foreach (Model.ClsSb_EquipDotCheckBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sb_EquipDotCheckBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + 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 Sb_EquipDotCheckBillMain Where HInterID=" + lngBillKey.ToString(), "Sb_EquipDotCheckBillMain"); + 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(); + //======================================================== + //== + omodel.HEquipID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEquipID"]); + omodel.HBeginDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HBeginDate"]); + omodel.HEndDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HEndDate"]); + omodel.HPlanNo = Ds.Tables[0].Rows[0]["HPlanNo"].ToString().Trim(); + omodel.HExplanation = Ds.Tables[0].Rows[0]["HExplanation"].ToString().Trim(); + omodel.HInnerBillNo = Ds.Tables[0].Rows[0]["HInnerBillNo"].ToString().Trim(); + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sb_EquipDotCheckBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sb_EquipDotCheckBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Models.ClsSb_EquipDotCheckBillSub oSub = new Models.ClsSb_EquipDotCheckBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=================================================== + //oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]); + //oSub.HWorkerNumber = DsSub.Tables[0].Rows[i]["HWorkerNumber"].ToString().Trim(); + //oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]); + //oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + //oSub.HMaterNumber = DsSub.Tables[0].Rows[i]["HMaterNumber"].ToString().Trim(); + //oSub.HMaterName = DsSub.Tables[0].Rows[i]["HMaterName"].ToString().Trim(); + //oSub.HMaterModel = DsSub.Tables[0].Rows[i]["HMaterModel"].ToString().Trim(); + oSub.HDotCheckItem = DsSub.Tables[0].Rows[i]["HDotCheckItem"].ToString().Trim(); + oSub.HDotCheckPart = DsSub.Tables[0].Rows[i]["HDotCheckPart"].ToString().Trim(); + //oSub.HBeginDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HBeginDate"]); + //oSub.HEndDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEndDate"]); + //oSub.HTimes = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HTimes"]); + oSub.HClaim = DsSub.Tables[0].Rows[i]["HClaim"].ToString().Trim(); + //oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + //oSub.HBadCount = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HBadCount"]); + //oSub.HWasterQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWasterQty"]); + //oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + //oSub.HUnitNumber = DsSub.Tables[0].Rows[i]["HUnitNumber"].ToString().Trim(); + //oSub.HUnitName = DsSub.Tables[0].Rows[i]["HUnitName"].ToString().Trim(); + //oSub.HSeOrderBillNo = DsSub.Tables[0].Rows[i]["HSeOrderBillNo"].ToString().Trim(); + oSub.HManagerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HManagerID"]); + oSub.HManagerNumber = DsSub.Tables[0].Rows[i]["HManagerNumber"].ToString().Trim(); + //oSub.HManagerName = DsSub.Tables[0].Rows[i]["HManagerName"].ToString().Trim(); + //oSub.HICMOBillNo = DsSub.Tables[0].Rows[i]["HICMOBillNo"].ToString().Trim(); + + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + + } + +} diff --git a/WebAPI/DLL/ClsSb_EquipMaintainBill.cs b/WebAPI/DLL/ClsSb_EquipMaintainBill.cs new file mode 100644 index 0000000..0257b33 --- /dev/null +++ b/WebAPI/DLL/ClsSb_EquipMaintainBill.cs @@ -0,0 +1,287 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSb_EquipMaintainBill:DBUtility.ClsXt_BaseBill + { + public Models.ClsSb_EquipMaintainBillMain omodel = new Models.ClsSb_EquipMaintainBillMain(); + public List<Models.ClsSb_EquipMaintainBillSub> DetailColl = new List<Models.ClsSb_EquipMaintainBillSub>(); + + public ClsSb_EquipMaintainBill() + { + base.MvarItemKeySub = "Sb_EquipMaintainBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sb_EquipMaintainBillMain"; + base.MvarReportTitle="璁惧淇濆吇璁板綍"; + base.BillType = "3901"; + base.HBillSubType = "3901"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSb_EquipMaintainBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sb_EquipMaintainBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HEquipID=" + omodel.HEquipID.ToString() + + ",HBeginDate='" + omodel.HBeginDate + "'" + + ",HEndDate='" + omodel.HEndDate+"'" + + ",HPlanNo='" + omodel.HPlanNo + "'" + + ",HExplanation='" + omodel.HExplanation+"'" + + ",HInnerBillNo='" + omodel.HInnerBillNo+"'" + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Models.ClsSb_EquipMaintainBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sb_EquipMaintainBillSub " + + " (HInterID,HEntryID," + + "HCloseMan,HEntryCloseDate,HCloseType,HRemark," + + "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," + + "HQty,HMaterID,HMaterNumber,HUnitID,HUnitNumber,HQtyMust," + + "HManagerID,HManagerNumber" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + + ",'" + oSub.HCloseMan + "','"+oSub.HEntryCloseDate+"'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HQty.ToString() + "," + oSub.HMaterID.ToString() + ",'" + oSub.HMaterNumber + "'," + oSub.HUnitID.ToString() + ",'" + oSub.HUnitNumber + "'," + oSub.HQtyMust.ToString() + + "," + oSub.HManagerID.ToString()+",'" +oSub.HManagerNumber+"'"+ + ") "); + } + // + //foreach (Model.ClsSb_EquipMaintainBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sb_EquipMaintainBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sb_EquipMaintainBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark,HEquipID" + + ",HBeginDate,HEndDate,HPlanNo,HExplanation,HInnerBillNo" + + ") "+ + " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'," + omodel.HEquipID.ToString() + + ",'" + omodel.HBeginDate + "','" + omodel.HEndDate + "','" + omodel.HPlanNo + "','" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'" + + ") "); + //鎻掑叆瀛愯〃 + //foreach (Models.ClsSb_EquipMaintainBillSub oSub in DetailColl) + //{ + // oCn.RunProc("Insert into Sb_EquipMaintainBillSub " + + // " (HInterID,HEntryID," + + // "HCloseMan,HEntryCloseDate,HCloseType,HRemark," + + // "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," + + // "HQty,HMaterID,HMaterNumber,HUnitID,HUnitNumber,HQtyMust," + + // "HManagerID,HManagerNumber" + + // ") values(" + // + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + + // ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + // "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + // "," + oSub.HQty.ToString() + "," + oSub.HMaterID.ToString() + ",'" + oSub.HMaterNumber + "'," + oSub.HUnitID.ToString() + ",'" + oSub.HUnitNumber + "'," + oSub.HQtyMust.ToString() + + // "," + oSub.HManagerID.ToString() + ",'" + oSub.HManagerNumber + "'" + + // ") "); + //} + foreach (Models.ClsSb_EquipMaintainBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sb_EquipMaintainBillSub_Item " + + " (HInterID,HEntryID," + + "HCloseMan,HEntryCloseDate,HCloseType,HRemark," + + "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney," + + "HMaintainItemID,HMaintainItem,HMaintainPart,HClaim," + + "HManagerID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HMaintainItemID.ToString() + ",'" + oSub.HMaintainItem + "','" + oSub.HMaintainPart.ToString() + "','" + oSub.HClaim.ToString() + + "'," + oSub.HManagerID.ToString() + "" + + ") "); + } + // + //foreach (Model.ClsSb_EquipMaintainBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sb_EquipMaintainBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + 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 Sb_EquipMaintainBillMain Where HInterID=" + lngBillKey.ToString(), "Sb_EquipMaintainBillMain"); + 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(); + //======================================================== + //== + omodel.HEquipID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEquipID"]); + omodel.HBeginDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HBeginDate"]); + omodel.HEndDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HEndDate"]); + omodel.HPlanNo = Ds.Tables[0].Rows[0]["HPlanNo"].ToString().Trim(); + omodel.HExplanation = Ds.Tables[0].Rows[0]["HExplanation"].ToString().Trim(); + omodel.HInnerBillNo = Ds.Tables[0].Rows[0]["HInnerBillNo"].ToString().Trim(); + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sb_EquipMaintainBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sb_EquipMaintainBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Models.ClsSb_EquipMaintainBillSub oSub = new Models.ClsSb_EquipMaintainBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=================================================== + //oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]); + //oSub.HWorkerNumber = DsSub.Tables[0].Rows[i]["HWorkerNumber"].ToString().Trim(); + //oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]); + oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + oSub.HMaterNumber = DsSub.Tables[0].Rows[i]["HMaterNumber"].ToString().Trim(); + //oSub.HMaterName = DsSub.Tables[0].Rows[i]["HMaterName"].ToString().Trim(); + //oSub.HMaterModel = DsSub.Tables[0].Rows[i]["HMaterModel"].ToString().Trim(); + oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]); + //oSub.HBeginDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HBeginDate"]); + //oSub.HEndDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEndDate"]); + //oSub.HTimes = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HTimes"]); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + //oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + //oSub.HBadCount = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HBadCount"]); + //oSub.HWasterQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWasterQty"]); + oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + oSub.HUnitNumber = DsSub.Tables[0].Rows[i]["HUnitNumber"].ToString().Trim(); + //oSub.HUnitName = DsSub.Tables[0].Rows[i]["HUnitName"].ToString().Trim(); + //oSub.HSeOrderBillNo = DsSub.Tables[0].Rows[i]["HSeOrderBillNo"].ToString().Trim(); + oSub.HManagerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HManagerID"]); + oSub.HManagerNumber = DsSub.Tables[0].Rows[i]["HManagerNumber"].ToString().Trim(); + //oSub.HManagerName = DsSub.Tables[0].Rows[i]["HManagerName"].ToString().Trim(); + //oSub.HICMOBillNo = DsSub.Tables[0].Rows[i]["HICMOBillNo"].ToString().Trim(); + + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + + } + +} diff --git a/WebAPI/DLL/ClsSb_EquipRepairCheckBill.cs b/WebAPI/DLL/ClsSb_EquipRepairCheckBill.cs new file mode 100644 index 0000000..97d6272 --- /dev/null +++ b/WebAPI/DLL/ClsSb_EquipRepairCheckBill.cs @@ -0,0 +1,219 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSb_EquipRepairCheckBill : DBUtility.ClsXt_BaseBill + { + public Model.ClsSb_EquipRepairCheckBillMain omodel = new Model.ClsSb_EquipRepairCheckBillMain(); + public List<Model.ClsSb_EquipRepairCheckBillSub> DetailColl = new List<Model.ClsSb_EquipRepairCheckBillSub>(); + + public ClsSb_EquipRepairCheckBill() + { + base.MvarItemKeySub = "Sb_EquipRepairCheckBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey = "Sb_EquipRepairCheckBillMain"; + base.MvarReportTitle = "璁惧缁翠慨楠屾敹鍗�"; + base.BillType = "3911"; + } + + #region 鍥哄畾浠g爜 + + ~ClsSb_EquipRepairCheckBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sb_EquipRepairCheckBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //========================================= + ",HEquipID=" + omodel.HEquipID.ToString() + + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HManagerID=" + omodel.HManagerID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HCheckBeginDate='" + omodel.HCheckBeginDate + "'" + + ",HCheckResult='" + omodel.HCheckResult + "'" + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + //DeleteRelation(ref sReturn, lngBillKey); + ////鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + ////鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsSb_EquipRepairCheckBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sb_EquipRepairCheckBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HRepairCheckID,HManagerID,HRepairCheckContent" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + oSub.HEntryCloseDate.ToShortDateString() + "," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HRepairCheckID.ToString() + "," + oSub.HManagerID.ToString() + ",'" + oSub.HRepairCheckContent + "'" + + ") "); + } + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sb_EquipRepairCheckBillMain" + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + + ",HEquipID,HExplanation,HInnerBillNo,HEmpID" + + ",HManagerID,HDeptID,HCheckResult,HCheckBeginDate" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker+ "',getdate()" + + ", " + omodel.HEquipID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + omodel.HEmpID.ToString() + + "," + omodel.HManagerID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HCheckResult + "','" + omodel.HCheckBeginDate + "'" + + ") "); + ////鎻掑叆瀛愯〃 + foreach (Model.ClsSb_EquipRepairCheckBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sb_EquipRepairCheckBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HRepairCheckID,HManagerID,HRepairCheckContent" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'," + oSub.HEntryCloseDate.ToShortDateString() + "," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HRepairCheckID.ToString() + "," + oSub.HManagerID.ToString() + ",'" + oSub.HRepairCheckContent + "'" + + ") "); + } + 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 Sb_EquipRepairCheckBillMain Where HInterID=" + lngBillKey.ToString(), "Sb_EquipRepairCheckBillMain"); + if (Ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + //璧嬪�� + omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); + omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); + omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); + omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); + omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); + omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); + omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); + omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); + 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.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.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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); + omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); + omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); + omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); + omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); + //======================================= + omodel.HEquipID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEquipID"]); + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]); + omodel.HCheckBeginDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HCheckBeginDate"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HCheckResult = Ds.Tables[0].Rows[0]["HCheckResult"].ToString().Trim(); + omodel.HExplanation = Ds.Tables[0].Rows[0]["HExplanation"].ToString().Trim(); + omodel.HInnerBillNo = Ds.Tables[0].Rows[0]["HInnerBillNo"].ToString().Trim(); + //寰幆 + DataSet DsSub; + DsSub = oCn.RunProcReturn("Select * from Sb_EquipRepairCheckBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sb_EquipRepairCheckBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSb_EquipRepairCheckBillSub oSub = new Model.ClsSb_EquipRepairCheckBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=========================================== + oSub.HRepairCheckID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HRepairCheckID"]); + oSub.HRepairCheckContent = DsSub.Tables[0].Rows[i]["HRepairCheckContent"].ToString().Trim(); + oSub.HManagerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HManagerID"]); + + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + + } +} \ No newline at end of file diff --git a/WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs b/WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs new file mode 100644 index 0000000..30edd5d --- /dev/null +++ b/WebAPI/DLL/ClsSb_EquipRepairWorkBill.cs @@ -0,0 +1,276 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSb_EquipRepairWorkBill:DBUtility.ClsXt_BaseBill + { + public Models.ClsSb_EquipRepairWorkBillMain omodel = new Models.ClsSb_EquipRepairWorkBillMain(); + public List<Models.ClsSb_EquipRepairWorkBillSub> DetailColl = new List<Models.ClsSb_EquipRepairWorkBillSub>(); + + public ClsSb_EquipRepairWorkBill() + { + base.MvarItemKeySub = "Sb_EquipRepairWorkBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sb_EquipRepairWorkBillMain"; + base.MvarReportTitle = "璁惧缁翠慨鍗�"; + base.BillType="3910"; + base.HBillSubType = "3910"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSb_EquipRepairWorkBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sb_EquipRepairWorkBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HEquipID=" + omodel.HEquipID.ToString() + + ",HRepairID=" + omodel.HRepairID.ToString() + + ",HRepairBeginDate='" + omodel.HRepairBeginDate + "'" + + ",HRepairEndDate='" + omodel.HRepairEndDate + "'" + + + ",HManagerID=" + omodel.HManagerID.ToString() + + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HTimes=" + omodel.HTimes.ToString() + + ",HPlanTimes=" + omodel.HPlanTimes.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + ",HRepairContent='" + omodel.HRepairContent + "'" + + ",HCycleUnit='" + omodel.HCycleUnit + "'" + + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Models.ClsSb_EquipRepairWorkBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sb_EquipRepairWorkBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HRepairID,HManagerID,HRepairExplanation,HEmpID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HRepairID1.ToString() + ",'"+ oSub.HManagerID1.ToString() + "','" + oSub.HRepairExplanation + "'," + oSub.HEmpID.ToString() + + ") "); + } + // + //foreach (Model.ClsSb_EquipRepairWorkBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sb_EquipRepairWorkBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + + //涓昏〃 + oCn.RunProc("Insert Into Sb_EquipRepairWorkBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + + ",HEquipID,HRepairID,HPlanTimes,HEmpID,HManagerID,HTimes" + + ",HDeptID,HExplanation,HInnerBillNo,HRepairBeginDate,HRepairEndDate,HRepairContent,HCycleUnit" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" + + ", " + omodel.HEquipID.ToString() + "," + omodel.HRepairID.ToString() + "," + omodel.HPlanTimes.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HTimes.ToString() + + ", " + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "','" + omodel.HRepairBeginDate.ToShortDateString() + "','" + omodel.HRepairEndDate.ToShortDateString() + "','" + omodel.HRepairContent + "','" + omodel.HCycleUnit + "'" + + ") "); + //鎻掑叆瀛愯〃 + foreach (Models.ClsSb_EquipRepairWorkBillSub oSub in DetailColl) + { + string sql1 = string.Format(@"Insert into Sb_EquipRepairWorkBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HRepairID,HManagerID,HRepairExplanation,HEmpID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HRepairID1.ToString() + ",'" + oSub.HManagerID1.ToString() + "','" + oSub.HRepairExplanation + "'," + oSub.HEmpID.ToString() + + ")"); + oCn.RunProc("Insert into Sb_EquipRepairWorkBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HRepairID,HManagerID,HRepairExplanation,HEmpID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HRepairID1.ToString() + ",'"+ oSub.HManagerID1.ToString() + "','" + oSub.HRepairExplanation + "'," + oSub.HEmpID.ToString() + + ") "); + } + // + //foreach (Model.ClsSb_EquipRepairWorkBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sb_EquipRepairWorkBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + 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 Sb_EquipRepairWorkBillMain Where HInterID=" + lngBillKey.ToString(), "Sb_EquipRepairWorkBillMain"); + if(Ds.Tables[0].Rows.Count==0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + //鍥哄畾璧嬪��=========================================== + omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); + omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); + omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); + omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); + omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); + omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); + omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); + omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); + 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.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.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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); + omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); + omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); + omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); + omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); + //======================================================== + omodel.HEquipID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEquipID"]); + omodel.HRepairID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HRepairID"]); + omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]); + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HRepairBeginDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HRepairBeginDate"]); + omodel.HRepairEndDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HRepairEndDate"]); + omodel.HRepairContent = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRepairContent"]); + omodel.HCycleUnit = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCycleUnit"]); + omodel.HPlanTimes = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HPlanTimes"]); + omodel.HTimes = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HTimes"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]); + omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]); + + + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sb_EquipRepairWorkBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sb_EquipRepairWorkBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Models.ClsSb_EquipRepairWorkBillSub oSub = new Models.ClsSb_EquipRepairWorkBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=================================================== + + oSub.HRepairExplanation = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HRepairExplanation"]); + oSub.HRepairID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HRepairID"]); + oSub.HEmpID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEmpID"]); + + + + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + + } + +} diff --git a/WebAPI/DLL/ClsSc_ICMOReportBill.cs b/WebAPI/DLL/ClsSc_ICMOReportBill.cs new file mode 100644 index 0000000..57ff176 --- /dev/null +++ b/WebAPI/DLL/ClsSc_ICMOReportBill.cs @@ -0,0 +1,673 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; +using DBUtility; + +namespace WebAPI.DLL +{ + public class ClsSc_ICMOReportBill:DBUtility.ClsXt_BaseBill + { + public Model.ClsSc_ICMOReportBillMain omodel = new Model.ClsSc_ICMOReportBillMain(); + public Model.ClsSc_ICMOReportBillSub oSub = new Model.ClsSc_ICMOReportBillSub(); + public List<Model.ClsSc_ICMOReportBillSub> DetailColl = new List<Model.ClsSc_ICMOReportBillSub>(); + + public ClsSc_ICMOReportBill() + { + base.MvarItemKeySub = "Sc_ICMOReportBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sc_ICMOReportBillMain"; + base.MvarReportTitle="鐢熶骇姹囨姤鍗�"; + base.BillType="3711"; + base.HBillSubType = "3711"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSc_ICMOReportBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + DataSet Ds; + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sc_ICMOReportBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HDeptNumber='" + omodel.HDeptNumber +"'"+ + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HEmpNumber='" + omodel.HEmpNumber +"'"+ + ",HGroupID=" + omodel.HGroupID.ToString() + + ",HCheckType='" + omodel.HCheckType + "'" + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsSc_ICMOReportBillSub oSub in DetailColl) + { + 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(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + ",'" + oSub.HMaterNumber +"'"+ + "," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HUnitNumber + "'," + oSub.HTimes.ToString() + "," + oSub.HSourceID.ToString() + + "," + oSub.HQtyMust.ToString() + "," + oSub.HWorkerID.ToString() + ",'" + oSub.HWorkerNumber + "'," + oSub.HBadCount.ToString() + "," + oSub.HWasterQty.ToString() + + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "','" + oSub.HBarCode + "'" + + ") "); + } + if (omodel.HCheckType == "鍚堟牸") + { + oCn.RunProc("update b set b.hbarcodestatus='姹囨姤',b.HQty = case when HReadyQty=0 then a.HQty else a.HQty+b.HQty end ,HReadyQty = a.HQty " + + "from Sc_ICMOReportBillSub a inner join Gy_BarCodeBill b on a.HBarCode=b.HBarCode " + + "Where a.HInterID=" + lngBillKey.ToString() + " "); + } + //瀹℃牳鍗曟嵁 + Ds = oCn.RunProcReturn("EXEC h_p_Sc_ICMOReportBill_Check " + omodel.HInterID.ToString() + ",'" + omodel.HMaker+ "'", "h_p_Sc_ICMOReportBill_Check"); + if (Ds == null) + { + sReturn = "鍒ゆ柇鏉$爜姹囨姤鏁伴噺鍑洪敊锛�"; + oCn.RollBack(); + return false; + } + if (Ds.Tables[0].Rows.Count == 0) + { + //sReturn ="鍒ゆ柇鏉$爜姹囨姤鏁伴噺鍑洪敊锛�"; + //oCn.RollBack(); + //return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) >= 2) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]); + oCn.RollBack(); + return false; + } + } + // + //foreach (Model.ClsSc_ICMOReportBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_ICMOReportBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark,HEmpID,HEmpNumber" + + ",HGroupID,HDeptID,HDeptNumber" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker+ "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HEmpID.ToString() + "','" + omodel.HEmpNumber + + "','" + omodel.HGroupID.ToString() + "'," + omodel.HDeptID.ToString() + ",'" + omodel.HDeptNumber + "'"+ + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsSc_ICMOReportBillSub oSub in DetailColl) + { + 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(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + ",'" + oSub.HMaterNumber + "'" + + "," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HUnitNumber + "'," + oSub.HTimes.ToString() + "," + oSub.HSourceID.ToString() + + "," + oSub.HQtyMust.ToString() + "," + oSub.HWorkerID.ToString() + ",'" + oSub.HWorkerNumber + "'," + oSub.HBadCount.ToString() + "," + oSub.HWasterQty.ToString() + + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "','" + oSub.HBarCode + "'" + + ") "); + } + // + //foreach (Model.ClsSc_ICMOReportBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + 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 Sc_ICMOReportBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_ICMOReportBillMain"); + 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(); + //======================================================== + //== + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HDeptNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeptNumber"]); + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HEmpNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HEmpNumber"]); + omodel.HGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HGroupID"]); + omodel.HCheckType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCheckType"]); + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sc_ICMOReportBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_ICMOReportBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSc_ICMOReportBillSub oSub = new Model.ClsSc_ICMOReportBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=================================================== + oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]); + oSub.HWorkerNumber = DsSub.Tables[0].Rows[i]["HWorkerNumber"].ToString().Trim(); + oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]); + oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + oSub.HMaterNumber = DsSub.Tables[0].Rows[i]["HMaterNumber"].ToString().Trim(); + oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + oSub.HUnitNumber = DsSub.Tables[0].Rows[i]["HUnitNumber"].ToString().Trim(); + oSub.HTimes = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HTimes"]); + oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + oSub.HBadCount = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HBadCount"]); + oSub.HWasterQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWasterQty"]); + oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]); + oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]); + oSub.HSeOrderBillNo = DsSub.Tables[0].Rows[i]["HSeOrderBillNo"].ToString().Trim(); + oSub.HICMOInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HICMOInterID"]); + oSub.HICMOBillNo = DsSub.Tables[0].Rows[i]["HICMOBillNo"].ToString().Trim(); + oSub.HBarCode = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBarCode"]); + + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + //鎵爜鐢熸垚浜ч噺姹囨姤鍗曪紙鏃犳潯鐮佸嚭鍏ュ簱璁板綍锛� + public bool AddBill_PDA2(ref string sReturn) + { + try + { + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(omodel.HDate, ref sYear, ref sPeriod, ref s) == false) + { + sReturn = s; + return false; + } + omodel.HYear = sYear; + omodel.HPeriod = sPeriod; + + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_ICMOReportBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark,HEmpID,HEmpNumber" + + ",HGroupID,HDeptID" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',getdate(),'" + omodel.HMaker + "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + "鎵弿鐢熸垚" + "'," + omodel.HEmpID.ToString() + ",'" + omodel.HEmpNumber + "'" + + "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsSc_ICMOReportBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_ICMOReportBillSub " + + " (HInterID,HEntryID,HMaterID" + + ",HQty,HUnitID,HTimes,HSourceID" + + ",HQtyMust,HWorkerID,HBadQty,HBadCount,HWasterQty" + + ",HCloseMan,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HICMOInterID,HICMOBillNo,HSplitNO,HBarCode" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + + "," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HTimes.ToString() + "," + oSub.HSourceID.ToString() + + "," + oSub.HQtyMust.ToString() + "," + oSub.HWorkerID.ToString() + "," + oSub.HBadQty.ToString() + "," + oSub.HBadCount.ToString() + "," + oSub.HWasterQty.ToString() + + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "','" + oSub.HSplitNO + "','" + oSub.HBarCode + "'" + + ") "); + } + //瀹℃牳鍗曟嵁 + oCn.RunProc("Update Sc_ICMOReportBillMain Set HChecker='" + omodel.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120),HBillStatus=2 where HInterID= " + omodel.HInterID.ToString()); + // + sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + //鏍规嵁浠诲姟鍗� 杩斿洖 璇ヤ换鍔″崟涓婁竴娆′骇閲忔眹鎶ヤ俊鎭� + public DataSet GetInfoByHICMOInterID_chanliang(long HSourceInterID, string sWhere) + { + DataSet DS; + try + { + DS = oCn.RunProcReturn("Select top 1 * from h_v_IF_ICMOReportBillList Where HICMOInterID=" + HSourceInterID.ToString() + sWhere + "order by hmainid desc", "h_v_IF_ICMOReportBillList", ref DBUtility.ClsPub.sExeReturnInfo); + if (DS.Tables[0].Rows.Count == 0) + return null; + else + { + return DS; + } + } + catch (Exception e) + { + throw (e); + } + } + + // 鍗曠姹囨姤 + public bool AddBill_PDA(ref string sReturn) + { + try + { + DataSet Ds; + //寰楀埌mainid + omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_ICMOReportBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark,HEmpID" + + ",HGroupID,HDeptID,HCheckType" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',getdate(),'" + omodel.HMaker + "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'," + omodel.HEmpID.ToString() + + "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HCheckType + "'" + + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsSc_ICMOReportBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_ICMOReportBillSub " + + " (HInterID,HEntryID,HMaterID" + + ",HQty,HUnitID,HTimes,HSourceID" + + ",HQtyMust,HWorkerID,HBadQty,HBadCount,HWasterQty" + + ",HCloseMan,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HICMOInterID,HICMOBillNo,HSplitNO,HBarCode" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + + "," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HTimes.ToString() + "," + oSub.HSourceID.ToString() + + "," + oSub.HQtyMust.ToString() + "," + oSub.HWorkerID.ToString() + "," + oSub.HBadQty.ToString() + "," + oSub.HBadCount.ToString() + "," + oSub.HWasterQty.ToString() + + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + "灏剧鎵弿鐢熸垚" + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + "," + oSub.HICMOInterID.ToString() + ",'" + oSub.HICMOBillNo + "','" + oSub.HSplitNO + "','" + oSub.HBarCode + "'" + + ") "); + } + if (omodel.HCheckType == "鍚堟牸") + { + oCn.RunProc("update b set b.hbarcodestatus='姹囨姤',b.HQty = case when HReadyQty=0 then a.HQty else a.HQty+b.HQty end ,HReadyQty = a.HQty " + + "from Sc_ICMOReportBillSub a inner join Gy_BarCodeBill b on a.HBarCode=b.HBarCode " + + "Where a.HInterID=" + omodel.HInterID.ToString() + " "); + } + + //foreach (Model.ClsSc_ICMOReportBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_ICMOReportBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + //瀹℃牳鍗曟嵁 + Ds = oCn.RunProcReturn("EXEC h_p_Sc_ICMOReportBill_Check " + omodel.HInterID.ToString() + ",'" + omodel.HMaker + "'", "h_p_Sc_ICMOReportBill_Check"); + if (Ds == null) + { + sReturn = "鍒ゆ柇鏉$爜姹囨姤鏁伴噺鍑洪敊锛�"; + oCn.RollBack(); + return false; + } + if (Ds.Tables[0].Rows.Count == 0) + { + //sReturn ="鍒ゆ柇鏉$爜姹囨姤鏁伴噺鍑洪敊锛�"; + //oCn.RollBack(); + //return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) >= 2) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]); + oCn.RollBack(); + return false; + } + } + sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + //鏉$爜鎵弿璁板綍,鎵归噺鏂板鍒颁骇鍝佹眹鎶� // 澶氱姹囨姤 + public bool AddBillMul_PDA(Int64 HSource,ref string sReturn) + { + try + { + DataSet Ds; + oCn.BeginTran(); + //鍒犻櫎涓昏〃 + //鎻掑叆瀛愯〃 + oCn.RunProc("EXEC h_p_Sc_ICMOReportBillSub_Insert " + omodel.HInterID.ToString() + "," + HSource.ToString() + ",'" + omodel.HBillNo + "'"); + //鎻掑叆涓昏〃 + oCn.RunProc("Insert Into Sc_ICMOReportBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark,HEmpID" + + ",HGroupID,HDeptID,HCheckType,HWorkShift" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',getdate(),'" + omodel.HMaker + "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'," + omodel.HEmpID.ToString() + + "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HCheckType + "','" + omodel.HWorkShift + "'" + + ") "); + + if (omodel.HCheckType == "鍚堟牸") + { + oCn.RunProc("update b set b.hbarcodestatus='姹囨姤',b.HQty = case when HReadyQty=0 then a.HQty else a.HQty+b.HQty end ,HReadyQty = a.HQty " + + "from (select HInterID,HBarCode,SUM(HQty) HQty from Sc_ICMOReportBillSub Group by HInterID,HBarCode)as a inner join Gy_BarCodeBill b on a.HBarCode=b.HBarCode " + + "Where a.HInterID=" + omodel.HInterID.ToString() + " "); + } + + //鏇存柊 鍏宠仈鏁伴噺 + //oCn.RunProc("EXEC h_p_K3_UpdateBillRelateData_ProdIn_New " + omodel.HInterID.ToString()); + //鏇存柊鍗曟嵁NEWid + //oCn.RunProc("UPDATE ICStockBill SET FUUID=NEWID() WHERE FInterID=" + omodel.HInterID.ToString()); + //瀹℃牳鍗曟嵁 + Ds = oCn.RunProcReturn("EXEC h_p_Sc_ICMOReportBill_Check " + omodel.HInterID.ToString() + ",'" + omodel.HMaker + "'", "h_p_Sc_ICMOReportBill_Check"); + if (Ds == null) + { + sReturn = "鍒ゆ柇鏉$爜姹囨姤鏁伴噺鍑洪敊锛�"; + oCn.RollBack(); + return false; + } + if (Ds.Tables[0].Rows.Count == 0) + { + //sReturn ="鍒ゆ柇鏉$爜姹囨姤鏁伴噺鍑洪敊锛�"; + //oCn.RollBack(); + //return false; + } + else + { + if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) >= 2) + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]); + oCn.RollBack(); + return false; + } + } + sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + public string GetNewBillNo() + { + return ClsPub.CreateBillCode(BillType, ref ClsPub.sExeReturnInfo, true); + } + + public DataSet GetInfo(string lngBillKey, ref string sReturn) + { + try + { + //鏌ヨ涓昏〃 + DataSet Ds; + Ds = oCn.RunProcReturn("exec h_p_Sc_CheckICMOReportBill '" + lngBillKey + "'", "h_p_Sc_CheckICMOReportBill"); + if (Ds.Tables[0].Rows.Count == 0) + { + return Ds; + } + else + { + if (DBUtility.ClsPub.isInt(Ds.Tables[1].Rows[0][0]) != 0) + { + sReturn = Ds.Tables[1].Rows[0][1].ToString(); + return Ds; + } + else + { + return Ds; + } + + } + + } + catch (Exception e) + { + sReturn = e.Message; + return null; + } + + } + //鏂板鍗曟嵁 // 鎷嗙姹囨姤 + public bool AddBill_Cai_PDA(Int64 HSoureInterID, string sHBarCode, Int64 sHQty, Int64 sHQty1, ref string sReturn) + { + try + { + for (int i = 0; i < 2; i++) + { + long HQty = 0; + string Type = ""; + if (i == 0) + { + HQty = sHQty; + Type = "鍚堟牸"; + } + else + { + HQty = sHQty1; + Type = "涓嶅悎鏍�"; + } + long HInterID = 0; + string HBillNo = ""; + //寰楀埌mainid + HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); + HBillNo = ClsPub.CreateBillCode(BillType, ref ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙� + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + DataSet Ds; + Ds = oCn.RunProcReturn("exec h_p_Sc_CaiICMOReportBill '" + sHBarCode + "'," + HInterID.ToString() + "," + HQty.ToString() + ", '" + Type + "','" + HBillNo + "'," + HSoureInterID.ToString(), "h_p_Sc_CaiICMOReportBill"); + if (i == 1) + { + oCn.RunProc(" UpDate a set " + + " a.HDeleteMan='admin' " + + " ,a.HDeleteDate=getdate() " + + " from Sc_ICMOReportBillMain a inner join Sc_ICMOReportBillSub b on a.HInterID=b.HInterID " + + " where a.HInterID = " + HSoureInterID.ToString()); + oCn.RunProc("update Gy_BarCodeBill set hbarcodestatus='姹囨姤',HQty =case when HReadyQty=0 then " + sHQty.ToString() + " else HQty + " + sHQty.ToString() + " end ,HReadyQty= " + sHQty.ToString() + " where HBarCode = '" + sHBarCode + "'"); + } + oCn.Commit(); + } + sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + + //鏍规嵁浠诲姟鍗� 杩斿洖 璇ヤ换鍔″崟涓婁竴娆℃眹鎶ョ殑鏈哄彴鍜屾搷浣滃伐 + public DataSet GetInfoByHICMOInterID(long HSourceInterID, string sWhere) + { + DataSet DS; + try + { + DS = oCn.RunProcReturn("Select top 1 * from h_v_Sc_ICMOReportBillList Where 婧愬崟涓诲唴鐮�=" + HSourceInterID.ToString() + sWhere + "order by hmainid desc", "h_v_Sc_ICMOReportBillList", ref DBUtility.ClsPub.sExeReturnInfo); + if (DS.Tables[0].Rows.Count == 0) + return null; + else + { + return DS; + } + } + catch (Exception e) + { + throw (e); + } + } + + //鍒犻櫎鍏宠仈 + public void DeleteRelation(Int64 lngBillKey) + { + oCn.RunProc("update b set b.HBarCodeStatus = case when b.HQty - a.HQty > 0 then '姹囨姤' else '' end " + + ",b.HQty = case when b.HQty - a.HQty > 0 then b.HQty-a.HQty else b.HinitQty end " + + ",b.HReadyQty = case when b.HQty - a.HQty > 0 then a.HQty else 0 end " + + "from (select HInterID,HBarCode,SUM(HQty) HQty from Sc_ICMOReportBillSub Group by HInterID,HBarCode)as a inner join Gy_BarCodeBill b on a.HBarCode=b.HBarCode " + + "Where a.HInterID=" + lngBillKey.ToString()); + } + + + + + } + +} diff --git a/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs b/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs new file mode 100644 index 0000000..d01c8f2 --- /dev/null +++ b/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs @@ -0,0 +1,452 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSc_MESBeginWorkBill:DBUtility.ClsXt_BaseBill + { + public Model.ClsSc_MESBeginWorkBillMain omodel = new Model.ClsSc_MESBeginWorkBillMain(); + public List<Model.ClsSc_MESBeginWorkBillSub> DetailColl = new List<Model.ClsSc_MESBeginWorkBillSub>(); + //public List<Model.ClsSc_MESBeginWorkBillSub_Item> DetailColl1 = new List<Model.ClsSc_MESBeginWorkBillSub_Item>(); + public ClsSc_MESBeginWorkBill() + { + base.MvarItemKeySub = "Sc_MESBeginWorkBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sc_MESBeginWorkBillMain"; + base.MvarReportTitle="寮�宸ュ崟"; + base.BillType="3787"; + base.HBillSubType = "3787"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSc_MESBeginWorkBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sc_MESBeginWorkBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HBillStatus='" + omodel.HBillStatus + "'" + + ",HRemark='" + omodel.HRemark + "'" + + //",HBacker='"+omodel.HBacker+"'"+ + //",HBackDate='" + omodel.HBackDate + "'" + + //",HBackRemark='"+omodel.HBackRemark+"'"+ + //",HChecker='" + omodel.HChecker + "'" + + //",HCheckDate='" + omodel.HCheckDate + "'" + + //",HMaker='" + omodel.HMaker + "'" + + //",HMakeDate='" + omodel.HMakeDate + "'" + + ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + + ",HUpDateDate=getdate()" + + //",HCloseMan='" + omodel.HCloseMan + "'" + + //",HCloseDate='" + omodel.HCloseDate + "'" + + //",HCloseType="+omodel.HCloseType.ToString()+ + //",HDeleteMan='" + omodel.HDeleteMan + "'" + + //",HDeleteDate='" + omodel.HDeleteDate + "'" + + ",HPrintQty="+omodel.HPrintQty.ToString()+ + //======================================== + //",HSupID=" + omodel.HSupID.ToString() + + //",HEmpID=" + omodel.HEmpID.ToString() + + ",HICMOInterID=" + omodel.HICMOInterID.ToString() + + ",HICMOBillNo='" + omodel.HICMOBillNo + "'" + + ",HProcPlanInterID=" + omodel.HProcPlanInterID.ToString() + + ",HProcPlanEntryID=" + omodel.HProcPlanEntryID.ToString() + + ",HProcPlanBillNo='" + omodel.HProcPlanBillNo + "'" + + ",HProcExchInterID=" + omodel.HProcExchInterID.ToString() + + ",HProcExchEntryID=" + omodel.HProcExchEntryID.ToString() + + ",HProcExchBillNo='" + omodel.HProcExchBillNo + "'" + + ",HMaterID=" + omodel.HMaterID.ToString() + + ",HProcID=" + omodel.HProcID.ToString() + + ",HICMOQty=" + omodel.HICMOQty.ToString() + + ",HPlanQty=" + omodel.HPlanQty.ToString() + + ",HBeginWorkTime='" + omodel.HBeginWorkTime + "'" + + ",HSourceID=" + omodel.HSourceID.ToString() + + ",HGroupID=" + omodel.HGroupID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HReportType='" + omodel.HReportType + "'" + + ",HBarCode='" + omodel.HBarCode + "'" + + ",HAddr='" + omodel.HAddr + "'" + + ",HBarCodeMaker='" + omodel.HBarCodeMaker + "'" + + ",HBarCodeMakeDate='" + omodel.HBarCodeMakeDate + "'" + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsSc_MESBeginWorkBillSub oSub in DetailColl) + { + //oCn.RunProc("Insert into Sc_MESBeginWorkBillSub " + + // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + + // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + + // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID" + + + // ") values(" + // + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'" + + // ",getdate()," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'," + oSub.HSourceInterID.ToString() + + // "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + // "," + oSub.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() + + // ") "); + } + //foreach (Model.ClsSc_MESBeginWorkBillSub_Item oSub2 in DetailColl1) + //{ + // oCn.RunProc("Insert into Sc_MESBeginWorkBillSub_Item " + + // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + + // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + + // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" + + + // ") values(" + // + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" + + // ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() + + // "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() + + // "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() + + // ") "); + //} + // + //foreach (Model.ClsSc_MESBeginWorkBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MESBeginWorkBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_MESBeginWorkBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark" + + ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + + ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HBeginWorkTime,HSourceID" + + ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + DBUtility.ClsPub.CurUserName + "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" + + "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() + + ",'" + omodel.HProcExchBillNo + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HICMOQty.ToString() + "," + omodel.HPlanQty.ToString() + ",getdate()," + omodel.HSourceID.ToString() + + "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate()" + + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsSc_MESBeginWorkBillSub oSub in DetailColl) + { + //oCn.RunProc("Insert into Sc_MESBeginWorkBillSub " + + // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + + // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + + // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID" + + + // ") values(" + // + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'" + + // ",getdate()," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'," + oSub.HSourceInterID.ToString() + + // "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + // "," + oSub.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() + + // ") "); + } + //foreach (Model.ClsSc_MESBeginWorkBillSub_Item oSub2 in DetailColl1) + //{ + // oCn.RunProc("Insert into Sc_MESBeginWorkBillSub_Item " + + // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + + // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + + // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" + + + // ") values(" + // + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" + + // ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() + + // "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() + + // "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() + + // ") "); + //} + // + //foreach (Model.ClsSc_MESBeginWorkBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MESBeginWorkBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + 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 Sc_MESBeginWorkBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_MESBeginWorkBillMain"); + 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(); + //======================================================== + ////== + //omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]); + //omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]); + //omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]); + //omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + //omodel.HMangerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMangerID"]); + omodel.HICMOInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOInterID"]); + omodel.HICMOBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HICMOBillNo"]); + omodel.HProcPlanInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcPlanInterID"]); + omodel.HProcPlanEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcPlanEntryID"]); + omodel.HProcPlanBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcPlanBillNo"]); + omodel.HProcExchInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcExchInterID"]); + omodel.HProcExchEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcExchEntryID"]); + omodel.HProcExchBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcExchBillNo"]); + omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]); + omodel.HProcID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcID"]); + omodel.HICMOQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOQty"]); + omodel.HPlanQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPlanQty"]); + omodel.HBeginWorkTime = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HBeginWorkTime"]); + omodel.HSourceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceID"]); + omodel.HGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HGroupID"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HReportType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReportType"]); + omodel.HBarCode = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCode"]); + omodel.HAddr = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAddr"]); + omodel.HBarCodeMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCodeMaker"]); + omodel.HBarCodeMakeDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HBarCodeMakeDate"]); + //omodel.HRedBlueFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HRedBlueFlag"]); + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sc_MESBeginWorkBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MESBeginWorkBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSc_MESBeginWorkBillSub oSub = new Model.ClsSc_MESBeginWorkBillSub(); + // 鍥哄畾璧嬪��=============================================== + //oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); + //oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); + //oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBillNo_bak"]); + ////oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); + //oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]); + //oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]); + //oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]); + //oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim(); + //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.HDotCheckItemID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HDotCheckItemID"]); + //oSub.HDotCheckItem = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDotCheckItem"]); + //oSub.HDotCheckPart = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDotCheckPart"]); + //oSub.HClaim = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HClaim"]); + //oSub.HManagerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HManagerID"]); + //oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]); + //oSub.HWorkerNumber = DsSub.Tables[0].Rows[i]["HWorkerNumber"].ToString().Trim(); + //oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]); + //oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + //oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]); + //oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]); + //oSub.HSecUnitRate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSecUnitRate"]); + //oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + //oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]); + //oSub.HQtyMust = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQtyMust"]); + //oSub.HQty = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQty"]); + //oSub.HPrice = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPrice"]); + //oSub.HMoney = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMoney"]); + //oSub.HDesignLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDesignLife"]); + //oSub.HLeaveLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HLeaveLife"]); + //oSub.HUseLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUseLife"]); + //oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]); + //oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]); + //oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]); + //oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]); + //oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]); + + //oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + //oSub.HBadCount = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HBadCount"]); + //oSub.HWasterQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWasterQty"]); + //oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]); + //oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]); + //oSub.HSeOrderBillNo = DsSub.Tables[0].Rows[i]["HSeOrderBillNo"].ToString().Trim(); + + DetailColl.Add(oSub); + } + //DataSet DsSub2; + //DsSub2 = oCn.RunProcReturn("Select * from Sc_MESBeginWorkBillSub_Item Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MESBeginWorkBillSub_Item"); + //DetailColl1.Clear();//娓呯┖ + //for (int i = 0; i < DsSub2.Tables[0].Rows.Count; i++) + //{ + // Model.ClsSc_MESBeginWorkBillSub_Item oSub2 = new Model.ClsSc_MESBeginWorkBillSub_Item(); + // // 鍥哄畾璧嬪��=============================================== + // oSub2.HInterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HInterID"]); + // oSub2.HEntryID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HEntryID"]); + // oSub2.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HBillNo_bak"]); + // oSub2.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HCloseMan"]); + // oSub2.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub2.Tables[0].Rows[i]["HEntryCloseDate"]); + // oSub2.HCloseType = DBUtility.ClsPub.isBool(DsSub2.Tables[0].Rows[i]["HCloseType"]); + // oSub2.HRemark = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HRemark"]); + // oSub2.HSourceInterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HSourceInterID"]); + // oSub2.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HSourceEntryID"]); + // oSub2.HSourceBillType = DsSub2.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim(); + // oSub2.HSourceBillNo = DsSub2.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim(); + // oSub2.HRelationQty = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[i]["HRelationQty"]); + // oSub2.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[i]["HRelationMoney"]); + // //=================================================== + // //oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]); + // //oSub.HWorkerNumber = DsSub.Tables[0].Rows[i]["HWorkerNumber"].ToString().Trim(); + // //oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]); + // //oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + // //oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]); + // //oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]); + // //oSub.HSecUnitRate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSecUnitRate"]); + // //oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + // //oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]); + // //oSub.HQtyMust = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQtyMust"]); + // //oSub.HQty = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQty"]); + // //oSub.HPrice = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPrice"]); + // //oSub.HMoney = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMoney"]); + // //oSub.HDesignLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDesignLife"]); + // //oSub.HLeaveLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HLeaveLife"]); + // //oSub.HUseLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUseLife"]); + // //oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]); + // //oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]); + // //oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]); + // //oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]); + // //oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]); + // oSub2.HMaintainItemID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HMaintainItemID"]); + // oSub2.HMaintainItem = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HMaintainItem"]); + // oSub2.HMaintainPart = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HMaintainPart"]); + // oSub2.HClaim = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HClaim"]); + // oSub2.HManagerID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HManagerID"]); + // //oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + // //oSub.HBadCount = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HBadCount"]); + // //oSub.HWasterQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWasterQty"]); + // //oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]); + // //oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]); + // //oSub.HSeOrderBillNo = DsSub.Tables[0].Rows[i]["HSeOrderBillNo"].ToString().Trim(); + + // DetailColl1.Add(oSub2); + //} + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + //瀹℃牳 + public bool CheckBill(Int64 lngBillKey, ref string sReturn) + { + + try + { + string HChecker = DBUtility.ClsPub.CurUserName; + string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); + oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); + //鐢熸垚璋冩嫧鍗� + //寰楀埌璋冩嫧鍗� mainid 鍗曟嵁鍙� + //long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo); + //string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙� + //oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'"); + // + sReturn = ""; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + + + + + } +} diff --git a/WebAPI/DLL/ClsSc_MESEndWorkBill.cs b/WebAPI/DLL/ClsSc_MESEndWorkBill.cs new file mode 100644 index 0000000..ae7b46c --- /dev/null +++ b/WebAPI/DLL/ClsSc_MESEndWorkBill.cs @@ -0,0 +1,519 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSc_MESEndWorkBill:DBUtility.ClsXt_BaseBill + { + public Model.ClsSc_MESEndWorkBillMain omodel = new Model.ClsSc_MESEndWorkBillMain(); + public List<Model.ClsSc_MESEndWorkBillSub> DetailColl = new List<Model.ClsSc_MESEndWorkBillSub>(); + //public List<Model.ClsSc_MESEndWorkBillSub_Item> DetailColl1 = new List<Model.ClsSc_MESEndWorkBillSub_Item>(); + public ClsSc_MESEndWorkBill() + { + base.MvarItemKeySub = "Sc_MESEndWorkBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sc_MESEndWorkBillMain"; + base.MvarReportTitle="瀹屽伐鍗�"; + base.BillType="3788"; + base.HBillSubType = "3788"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSc_MESEndWorkBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + string sql = string.Format(@"UpDate Sc_MESEndWorkBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HBillStatus='" + omodel.HBillStatus + "'" + + ",HRemark='" + omodel.HRemark + "'" + + //",HBacker='"+omodel.HBacker+"'"+ + //",HBackDate='" + omodel.HBackDate + "'" + + //",HBackRemark='"+omodel.HBackRemark+"'"+ + //",HChecker='" + omodel.HChecker + "'" + + //",HCheckDate='" + omodel.HCheckDate + "'" + + //",HMaker='" + omodel.HMaker + "'" + + //",HMakeDate='" + omodel.HMakeDate + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //",HCloseMan='" + omodel.HCloseMan + "'" + + //",HCloseDate='" + omodel.HCloseDate + "'" + + //",HCloseType="+omodel.HCloseType.ToString()+ + //",HDeleteMan='" + omodel.HDeleteMan + "'" + + //",HDeleteDate='" + omodel.HDeleteDate + "'" + + ",HPrintQty=" + omodel.HPrintQty.ToString() + + //======================================== + //",HSupID=" + omodel.HSupID.ToString() + + //",HEmpID=" + omodel.HEmpID.ToString() + + ",HICMOInterID=" + omodel.HICMOInterID.ToString() + + ",HICMOBillNo='" + omodel.HICMOBillNo + "'" + + ",HProcPlanInterID=" + omodel.HProcPlanInterID.ToString() + + ",HProcPlanEntryID=" + omodel.HProcPlanEntryID.ToString() + + ",HProcPlanBillNo='" + omodel.HProcPlanBillNo + "'" + + ",HProcExchInterID=" + omodel.HProcExchInterID.ToString() + + ",HProcExchEntryID=" + omodel.HProcExchEntryID.ToString() + + ",HProcExchBillNo='" + omodel.HProcExchBillNo + "'" + + ",HMaterID=" + omodel.HMaterID.ToString() + + ",HProcID=" + omodel.HProcID.ToString() + + ",HICMOQty=" + omodel.HICMOQty.ToString() + + ",HPlanQty=" + omodel.HPlanQty.ToString() + + ",HEndWorkTime='" + omodel.HEndWorkTime + "'" + + ",HSourceID=" + omodel.HSourceID.ToString() + + ",HGroupID=" + omodel.HGroupID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HQty=" + omodel.HQty.ToString() + + ",HBadCount=" + omodel.HBadCount.ToString() + + ",HWasterQty=" + omodel.HWasterQty.ToString() + + ",HWasterQty2=" + omodel.HWasterQty2.ToString() + + ",HSelfBadCount=" + omodel.HSelfBadCount.ToString() + + ",HPieceQty=" + omodel.HPieceQty.ToString() + + ",HReportType='" + omodel.HReportType + "'" + + ",HBarCode='" + omodel.HBarCode + "'" + + ",HAddr='" + omodel.HAddr + "'" + + ",HBarCodeMaker='" + omodel.HBarCodeMaker + "'" + + ",HBarCodeMakeDate='" + omodel.HBarCodeMakeDate + "' where HInterID=" + lngBillKey.ToString()+""); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sc_MESEndWorkBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HBillStatus='" + omodel.HBillStatus + "'" + + ",HRemark='" + omodel.HRemark + "'" + + //",HBacker='"+omodel.HBacker+"'"+ + //",HBackDate='" + omodel.HBackDate + "'" + + //",HBackRemark='"+omodel.HBackRemark+"'"+ + //",HChecker='" + omodel.HChecker + "'" + + //",HCheckDate='" + omodel.HCheckDate + "'" + + //",HMaker='" + omodel.HMaker + "'" + + //",HMakeDate='" + omodel.HMakeDate + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //",HCloseMan='" + omodel.HCloseMan + "'" + + //",HCloseDate='" + omodel.HCloseDate + "'" + + //",HCloseType="+omodel.HCloseType.ToString()+ + //",HDeleteMan='" + omodel.HDeleteMan + "'" + + //",HDeleteDate='" + omodel.HDeleteDate + "'" + + ",HPrintQty="+omodel.HPrintQty.ToString()+ + //======================================== + //",HSupID=" + omodel.HSupID.ToString() + + //",HEmpID=" + omodel.HEmpID.ToString() + + ",HICMOInterID=" + omodel.HICMOInterID.ToString() + + ",HICMOBillNo='" + omodel.HICMOBillNo + "'" + + ",HProcPlanInterID=" + omodel.HProcPlanInterID.ToString() + + ",HProcPlanEntryID=" + omodel.HProcPlanEntryID.ToString() + + ",HProcPlanBillNo='" + omodel.HProcPlanBillNo + "'" + + ",HProcExchInterID=" + omodel.HProcExchInterID.ToString() + + ",HProcExchEntryID=" + omodel.HProcExchEntryID.ToString() + + ",HProcExchBillNo='" + omodel.HProcExchBillNo + "'" + + ",HMaterID=" + omodel.HMaterID.ToString() + + ",HProcID=" + omodel.HProcID.ToString() + + ",HICMOQty=" + omodel.HICMOQty.ToString() + + ",HPlanQty=" + omodel.HPlanQty.ToString() + + ",HEndWorkTime='" + omodel.HEndWorkTime + "'" + + ",HSourceID=" + omodel.HSourceID.ToString() + + ",HGroupID=" + omodel.HGroupID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HQty="+omodel.HQty.ToString()+ + ",HBadCount=" + omodel.HBadCount.ToString() + + ",HWasterQty=" + omodel.HWasterQty.ToString() + + ",HWasterQty2=" + omodel.HWasterQty2.ToString() + + ",HSelfBadCount=" + omodel.HSelfBadCount.ToString() + + ",HPieceQty=" + omodel.HPieceQty.ToString() + + ",HReportType='" + omodel.HReportType + "'" + + ",HBarCode='" + omodel.HBarCode + "'" + + ",HAddr='" + omodel.HAddr + "'" + + ",HBarCodeMaker='" + omodel.HBarCodeMaker + "'" + + ",HBarCodeMakeDate='" + omodel.HBarCodeMakeDate + "'" + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsSc_MESEndWorkBillSub oSub in DetailColl) + { + //oCn.RunProc("Insert into Sc_MESEndWorkBillSub " + + // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + + // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + + // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID" + + + // ") values(" + // + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'" + + // ",getdate()," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'," + oSub.HSourceInterID.ToString() + + // "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + // "," + oSub.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() + + // ") "); + } + //foreach (Model.ClsSc_MESEndWorkBillSub_Item oSub2 in DetailColl1) + //{ + // oCn.RunProc("Insert into Sc_MESEndWorkBillSub_Item " + + // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + + // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + + // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" + + + // ") values(" + // + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" + + // ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() + + // "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() + + // "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() + + // ") "); + //} + // + //foreach (Model.ClsSc_MESEndWorkBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MESEndWorkBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_MESEndWorkBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark" + + ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + + ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HEndWorkTime,HSourceID" + + ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + + ",HQty,HBadCount,HWasterQty,HWasterQty2,HSelfBadCount,HPieceQty"+ + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + omodel.HMaker + "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" + + "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() + + ",'" + omodel.HProcExchBillNo + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HICMOQty.ToString() + "," + omodel.HPlanQty.ToString() + ",getdate()," + omodel.HSourceID.ToString() + + "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate()" + + "," + omodel.HQty.ToString() + "," + omodel.HBadCount.ToString() + "," + omodel.HWasterQty.ToString() + "," + omodel.HWasterQty2.ToString() + "," + omodel.HSelfBadCount.ToString() + "," + omodel.HPieceQty.ToString() + + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsSc_MESEndWorkBillSub oSub in DetailColl) + { + //oCn.RunProc("Insert into Sc_MESEndWorkBillSub " + + // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + + // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + + // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID" + + + // ") values(" + // + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'" + + // ",getdate()," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'," + oSub.HSourceInterID.ToString() + + // "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + // "," + oSub.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() + + // ") "); + } + //foreach (Model.ClsSc_MESEndWorkBillSub_Item oSub2 in DetailColl1) + //{ + // oCn.RunProc("Insert into Sc_MESEndWorkBillSub_Item " + + // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + + // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + + // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" + + + // ") values(" + // + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" + + // ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() + + // "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() + + // "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() + + // ") "); + //} + // + //foreach (Model.ClsSc_MESEndWorkBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MESEndWorkBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + 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 Sc_MESEndWorkBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_MESEndWorkBillMain"); + 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(); + //======================================================== + ////== + //omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]); + //omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]); + //omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]); + //omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + //omodel.HMangerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMangerID"]); + omodel.HICMOInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOInterID"]); + omodel.HICMOBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HICMOBillNo"]); + omodel.HProcPlanInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcPlanInterID"]); + omodel.HProcPlanEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcPlanEntryID"]); + omodel.HProcPlanBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcPlanBillNo"]); + omodel.HProcExchInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcExchInterID"]); + omodel.HProcExchEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcExchEntryID"]); + omodel.HProcExchBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcExchBillNo"]); + omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]); + omodel.HProcID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcID"]); + omodel.HICMOQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOQty"]); + omodel.HPlanQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPlanQty"]); + omodel.HEndWorkTime = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HEndWorkTime"]); + omodel.HSourceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceID"]); + omodel.HGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HGroupID"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HQty"]); + omodel.HBadCount = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBadCount"]); + omodel.HWasterQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWasterQty"]); + omodel.HWasterQty2 = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWasterQty2"]); + omodel.HSelfBadCount = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSelfBadCount"]); + omodel.HPieceQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPieceQty"]); + omodel.HReportType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReportType"]); + omodel.HBarCode = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCode"]); + omodel.HAddr = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAddr"]); + omodel.HBarCodeMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCodeMaker"]); + omodel.HBarCodeMakeDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HBarCodeMakeDate"]); + //omodel.HRedBlueFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HRedBlueFlag"]); + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sc_MESEndWorkBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MESEndWorkBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSc_MESEndWorkBillSub oSub = new Model.ClsSc_MESEndWorkBillSub(); + // 鍥哄畾璧嬪��=============================================== + //oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); + //oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); + //oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBillNo_bak"]); + ////oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); + //oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]); + //oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]); + //oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]); + //oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim(); + //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.HDotCheckItemID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HDotCheckItemID"]); + //oSub.HDotCheckItem = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDotCheckItem"]); + //oSub.HDotCheckPart = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDotCheckPart"]); + //oSub.HClaim = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HClaim"]); + //oSub.HManagerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HManagerID"]); + //oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]); + //oSub.HWorkerNumber = DsSub.Tables[0].Rows[i]["HWorkerNumber"].ToString().Trim(); + //oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]); + //oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + //oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]); + //oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]); + //oSub.HSecUnitRate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSecUnitRate"]); + //oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + //oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]); + //oSub.HQtyMust = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQtyMust"]); + //oSub.HQty = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQty"]); + //oSub.HPrice = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPrice"]); + //oSub.HMoney = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMoney"]); + //oSub.HDesignLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDesignLife"]); + //oSub.HLeaveLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HLeaveLife"]); + //oSub.HUseLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUseLife"]); + //oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]); + //oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]); + //oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]); + //oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]); + //oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]); + + //oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + //oSub.HBadCount = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HBadCount"]); + //oSub.HWasterQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWasterQty"]); + //oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]); + //oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]); + //oSub.HSeOrderBillNo = DsSub.Tables[0].Rows[i]["HSeOrderBillNo"].ToString().Trim(); + + DetailColl.Add(oSub); + } + //DataSet DsSub2; + //DsSub2 = oCn.RunProcReturn("Select * from Sc_MESEndWorkBillSub_Item Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MESEndWorkBillSub_Item"); + //DetailColl1.Clear();//娓呯┖ + //for (int i = 0; i < DsSub2.Tables[0].Rows.Count; i++) + //{ + // Model.ClsSc_MESEndWorkBillSub_Item oSub2 = new Model.ClsSc_MESEndWorkBillSub_Item(); + // // 鍥哄畾璧嬪��=============================================== + // oSub2.HInterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HInterID"]); + // oSub2.HEntryID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HEntryID"]); + // oSub2.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HBillNo_bak"]); + // oSub2.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HCloseMan"]); + // oSub2.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub2.Tables[0].Rows[i]["HEntryCloseDate"]); + // oSub2.HCloseType = DBUtility.ClsPub.isBool(DsSub2.Tables[0].Rows[i]["HCloseType"]); + // oSub2.HRemark = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HRemark"]); + // oSub2.HSourceInterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HSourceInterID"]); + // oSub2.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HSourceEntryID"]); + // oSub2.HSourceBillType = DsSub2.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim(); + // oSub2.HSourceBillNo = DsSub2.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim(); + // oSub2.HRelationQty = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[i]["HRelationQty"]); + // oSub2.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[i]["HRelationMoney"]); + // //=================================================== + // //oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]); + // //oSub.HWorkerNumber = DsSub.Tables[0].Rows[i]["HWorkerNumber"].ToString().Trim(); + // //oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]); + // //oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + // //oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]); + // //oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]); + // //oSub.HSecUnitRate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSecUnitRate"]); + // //oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + // //oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]); + // //oSub.HQtyMust = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQtyMust"]); + // //oSub.HQty = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQty"]); + // //oSub.HPrice = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPrice"]); + // //oSub.HMoney = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMoney"]); + // //oSub.HDesignLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDesignLife"]); + // //oSub.HLeaveLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HLeaveLife"]); + // //oSub.HUseLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUseLife"]); + // //oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]); + // //oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]); + // //oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]); + // //oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]); + // //oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]); + // oSub2.HMaintainItemID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HMaintainItemID"]); + // oSub2.HMaintainItem = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HMaintainItem"]); + // oSub2.HMaintainPart = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HMaintainPart"]); + // oSub2.HClaim = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HClaim"]); + // oSub2.HManagerID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HManagerID"]); + // //oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + // //oSub.HBadCount = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HBadCount"]); + // //oSub.HWasterQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWasterQty"]); + // //oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]); + // //oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]); + // //oSub.HSeOrderBillNo = DsSub.Tables[0].Rows[i]["HSeOrderBillNo"].ToString().Trim(); + + // DetailColl1.Add(oSub2); + //} + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + //瀹℃牳 + public bool CheckBill(Int64 lngBillKey, ref string sReturn) + { + + try + { + string HChecker = DBUtility.ClsPub.CurUserName; + string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); + oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); + //鐢熸垚璋冩嫧鍗� + //寰楀埌璋冩嫧鍗� mainid 鍗曟嵁鍙� + //long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo); + //string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙� + //oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'"); + // + sReturn = ""; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + + + + + } +} diff --git a/WebAPI/DLL/ClsSc_MESStopWorkBill.cs b/WebAPI/DLL/ClsSc_MESStopWorkBill.cs new file mode 100644 index 0000000..68ea31e --- /dev/null +++ b/WebAPI/DLL/ClsSc_MESStopWorkBill.cs @@ -0,0 +1,456 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSc_MESStopWorkBill:DBUtility.ClsXt_BaseBill + { + public Model.ClsSc_MESStopWorkBillMain omodel = new Model.ClsSc_MESStopWorkBillMain(); + public List<Model.ClsSc_MESStopWorkBillSub> DetailColl = new List<Model.ClsSc_MESStopWorkBillSub>(); + //public List<Model.ClsSc_MESStopWorkBillSub_Item> DetailColl1 = new List<Model.ClsSc_MESStopWorkBillSub_Item>(); + public ClsSc_MESStopWorkBill() + { + base.MvarItemKeySub = "Sc_MESStopWorkBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sc_MESStopWorkBillMain"; + base.MvarReportTitle="鍋滃伐鍗�"; + base.BillType="3789"; + base.HBillSubType = "3789"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSc_MESStopWorkBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sc_MESStopWorkBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HBillStatus='" + omodel.HBillStatus + "'" + + ",HRemark='" + omodel.HRemark + "'" + + //",HBacker='"+omodel.HBacker+"'"+ + //",HBackDate='" + omodel.HBackDate + "'" + + //",HBackRemark='"+omodel.HBackRemark+"'"+ + //",HChecker='" + omodel.HChecker + "'" + + //",HCheckDate='" + omodel.HCheckDate + "'" + + //",HMaker='" + omodel.HMaker + "'" + + //",HMakeDate='" + omodel.HMakeDate + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //",HCloseMan='" + omodel.HCloseMan + "'" + + //",HCloseDate='" + omodel.HCloseDate + "'" + + //",HCloseType="+omodel.HCloseType.ToString()+ + //",HDeleteMan='" + omodel.HDeleteMan + "'" + + //",HDeleteDate='" + omodel.HDeleteDate + "'" + + ",HPrintQty="+omodel.HPrintQty.ToString()+ + //======================================== + //",HSupID=" + omodel.HSupID.ToString() + + //",HEmpID=" + omodel.HEmpID.ToString() + + ",HICMOInterID=" + omodel.HICMOInterID.ToString() + + ",HICMOBillNo='" + omodel.HICMOBillNo + "'" + + ",HProcPlanInterID=" + omodel.HProcPlanInterID.ToString() + + ",HProcPlanEntryID=" + omodel.HProcPlanEntryID.ToString() + + ",HProcPlanBillNo='" + omodel.HProcPlanBillNo + "'" + + ",HProcExchInterID=" + omodel.HProcExchInterID.ToString() + + ",HProcExchEntryID=" + omodel.HProcExchEntryID.ToString() + + ",HProcExchBillNo='" + omodel.HProcExchBillNo + "'" + + ",HMaterID=" + omodel.HMaterID.ToString() + + ",HProcID=" + omodel.HProcID.ToString() + + ",HICMOQty=" + omodel.HICMOQty.ToString() + + ",HPlanQty=" + omodel.HPlanQty.ToString() + + ",HStopBeginWorkTime='" + omodel.HStopBeginWorkTime + "'" + + ",HStopEndWorkTime='" + omodel.HStopEndWorkTime + "'" + + ",HSourceID=" + omodel.HSourceID.ToString() + + ",HGroupID=" + omodel.HGroupID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HStopReason='" + omodel.HStopReason + "'" + + ",HReportType='" + omodel.HReportType + "'" + + ",HBarCode='" + omodel.HBarCode + "'" + + ",HAddr='" + omodel.HAddr + "'" + + ",HBarCodeMaker='" + omodel.HBarCodeMaker + "'" + + ",HBarCodeMakeDate='" + omodel.HBarCodeMakeDate + "'" + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsSc_MESStopWorkBillSub oSub in DetailColl) + { + //oCn.RunProc("Insert into Sc_MESStopWorkBillSub " + + // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + + // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + + // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID" + + + // ") values(" + // + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'" + + // ",getdate()," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'," + oSub.HSourceInterID.ToString() + + // "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + // "," + oSub.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() + + // ") "); + } + //foreach (Model.ClsSc_MESStopWorkBillSub_Item oSub2 in DetailColl1) + //{ + // oCn.RunProc("Insert into Sc_MESStopWorkBillSub_Item " + + // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + + // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + + // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" + + + // ") values(" + // + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" + + // ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() + + // "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() + + // "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() + + // ") "); + //} + // + //foreach (Model.ClsSc_MESStopWorkBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MESStopWorkBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_MESStopWorkBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark" + + ",HICMOInterID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + + ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStopBeginWorkTime,HStopEndWorkTime,HSourceID" + + ",HGroupID,HDeptID,HEmpID,HStopReason,HReportType,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + omodel.HMaker + "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" + + "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() + + ",'" + omodel.HProcExchBillNo + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HICMOQty.ToString() + "," + omodel.HPlanQty.ToString() + ",getdate(),'" + omodel.HStopEndWorkTime.ToShortDateString() + "'," + omodel.HSourceID.ToString() + + "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HStopReason + "','" + omodel.HReportType + "','" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate()" + + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsSc_MESStopWorkBillSub oSub in DetailColl) + { + //oCn.RunProc("Insert into Sc_MESStopWorkBillSub " + + // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + + // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + + // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ",HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim,HManagerID" + + + // ") values(" + // + omodel.HInterID.ToString() + ",'" + oSub.HBillNo_bak + "'," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "'" + + // ",getdate()," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'," + oSub.HSourceInterID.ToString() + + // "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + // "," + oSub.HDotCheckItemID.ToString() + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'," + oSub.HManagerID.ToString() + + // ") "); + } + //foreach (Model.ClsSc_MESStopWorkBillSub_Item oSub2 in DetailColl1) + //{ + // oCn.RunProc("Insert into Sc_MESStopWorkBillSub_Item " + + // " (HInterID,HBillNo_bak,HEntryID,HCloseMan" + + // ",HEntryCloseDate,HCloseType,HRemark,HSourceInterID" + + // ",HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ",HMaintainItemID,HMaintainItem,HMaintainPart,HClaim,HManagerID" + + + // ") values(" + // + omodel.HInterID.ToString() + ",'" + oSub2.HBillNo_bak + "'," + oSub2.HEntryID.ToString() + ",'" + oSub2.HCloseMan + "'" + + // ",getdate()," + Convert.ToString(oSub2.HCloseType ? 1 : 0) + ",'" + oSub2.HRemark + "'," + oSub2.HSourceInterID.ToString() + + // "," + oSub2.HSourceEntryID.ToString() + ",'" + oSub2.HSourceBillNo + "','" + oSub2.HSourceBillType + "'," + oSub2.HRelationQty.ToString() + "," + oSub2.HRelationMoney.ToString() + + // "," + oSub2.HMaintainItemID.ToString() + ",'" + oSub2.HMaintainItem + "','" + oSub2.HMaintainPart + "','" + oSub2.HClaim + "'," + oSub2.HManagerID.ToString() + + // ") "); + //} + // + //foreach (Model.ClsSc_MESStopWorkBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MESStopWorkBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + 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 Sc_MESStopWorkBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_MESStopWorkBillMain"); + 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(); + //======================================================== + ////== + //omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]); + //omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]); + //omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]); + //omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + //omodel.HMangerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMangerID"]); + omodel.HICMOInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOInterID"]); + omodel.HICMOBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HICMOBillNo"]); + omodel.HProcPlanInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcPlanInterID"]); + omodel.HProcPlanEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcPlanEntryID"]); + omodel.HProcPlanBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcPlanBillNo"]); + omodel.HProcExchInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcExchInterID"]); + omodel.HProcExchEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcExchEntryID"]); + omodel.HProcExchBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcExchBillNo"]); + omodel.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]); + omodel.HProcID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HProcID"]); + omodel.HICMOQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HICMOQty"]); + omodel.HPlanQty = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPlanQty"]); + omodel.HStopBeginWorkTime = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HStopBeginWorkTime"]); + omodel.HStopEndWorkTime = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HStopEndWorkTime"]); + omodel.HSourceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceID"]); + omodel.HGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HGroupID"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HStopReason = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HStopReason"]); + omodel.HReportType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReportType"]); + omodel.HBarCode = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCode"]); + omodel.HAddr = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HAddr"]); + omodel.HBarCodeMaker = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCodeMaker"]); + omodel.HBarCodeMakeDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HBarCodeMakeDate"]); + //omodel.HRedBlueFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HRedBlueFlag"]); + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sc_MESStopWorkBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MESStopWorkBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSc_MESStopWorkBillSub oSub = new Model.ClsSc_MESStopWorkBillSub(); + // 鍥哄畾璧嬪��=============================================== + //oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); + //oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); + //oSub.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBillNo_bak"]); + ////oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); + //oSub.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]); + //oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]); + //oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]); + //oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim(); + //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.HDotCheckItemID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HDotCheckItemID"]); + //oSub.HDotCheckItem = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDotCheckItem"]); + //oSub.HDotCheckPart = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDotCheckPart"]); + //oSub.HClaim = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HClaim"]); + //oSub.HManagerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HManagerID"]); + //oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]); + //oSub.HWorkerNumber = DsSub.Tables[0].Rows[i]["HWorkerNumber"].ToString().Trim(); + //oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]); + //oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + //oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]); + //oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]); + //oSub.HSecUnitRate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSecUnitRate"]); + //oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + //oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]); + //oSub.HQtyMust = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQtyMust"]); + //oSub.HQty = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQty"]); + //oSub.HPrice = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPrice"]); + //oSub.HMoney = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMoney"]); + //oSub.HDesignLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDesignLife"]); + //oSub.HLeaveLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HLeaveLife"]); + //oSub.HUseLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUseLife"]); + //oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]); + //oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]); + //oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]); + //oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]); + //oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]); + + //oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + //oSub.HBadCount = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HBadCount"]); + //oSub.HWasterQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWasterQty"]); + //oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]); + //oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]); + //oSub.HSeOrderBillNo = DsSub.Tables[0].Rows[i]["HSeOrderBillNo"].ToString().Trim(); + + DetailColl.Add(oSub); + } + //DataSet DsSub2; + //DsSub2 = oCn.RunProcReturn("Select * from Sc_MESStopWorkBillSub_Item Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MESStopWorkBillSub_Item"); + //DetailColl1.Clear();//娓呯┖ + //for (int i = 0; i < DsSub2.Tables[0].Rows.Count; i++) + //{ + // Model.ClsSc_MESStopWorkBillSub_Item oSub2 = new Model.ClsSc_MESStopWorkBillSub_Item(); + // // 鍥哄畾璧嬪��=============================================== + // oSub2.HInterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HInterID"]); + // oSub2.HEntryID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HEntryID"]); + // oSub2.HBillNo_bak = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HBillNo_bak"]); + // oSub2.HCloseMan = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HCloseMan"]); + // oSub2.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub2.Tables[0].Rows[i]["HEntryCloseDate"]); + // oSub2.HCloseType = DBUtility.ClsPub.isBool(DsSub2.Tables[0].Rows[i]["HCloseType"]); + // oSub2.HRemark = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HRemark"]); + // oSub2.HSourceInterID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HSourceInterID"]); + // oSub2.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HSourceEntryID"]); + // oSub2.HSourceBillType = DsSub2.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim(); + // oSub2.HSourceBillNo = DsSub2.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim(); + // oSub2.HRelationQty = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[i]["HRelationQty"]); + // oSub2.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub2.Tables[0].Rows[i]["HRelationMoney"]); + // //=================================================== + // //oSub.HWorkerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWorkerID"]); + // //oSub.HWorkerNumber = DsSub.Tables[0].Rows[i]["HWorkerNumber"].ToString().Trim(); + // //oSub.HSourceID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceID"]); + // //oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + // //oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]); + // //oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]); + // //oSub.HSecUnitRate = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSecUnitRate"]); + // //oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + // //oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]); + // //oSub.HQtyMust = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQtyMust"]); + // //oSub.HQty = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HQty"]); + // //oSub.HPrice = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPrice"]); + // //oSub.HMoney = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMoney"]); + // //oSub.HDesignLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDesignLife"]); + // //oSub.HLeaveLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HLeaveLife"]); + // //oSub.HUseLife = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HUseLife"]); + // //oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]); + // //oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]); + // //oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]); + // //oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]); + // //oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]); + // oSub2.HMaintainItemID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HMaintainItemID"]); + // oSub2.HMaintainItem = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HMaintainItem"]); + // oSub2.HMaintainPart = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HMaintainPart"]); + // oSub2.HClaim = DBUtility.ClsPub.isStrNull(DsSub2.Tables[0].Rows[i]["HClaim"]); + // oSub2.HManagerID = DBUtility.ClsPub.isLong(DsSub2.Tables[0].Rows[i]["HManagerID"]); + // //oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + // //oSub.HBadCount = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HBadCount"]); + // //oSub.HWasterQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HWasterQty"]); + // //oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]); + // //oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]); + // //oSub.HSeOrderBillNo = DsSub.Tables[0].Rows[i]["HSeOrderBillNo"].ToString().Trim(); + + // DetailColl1.Add(oSub2); + //} + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + //瀹℃牳 + public bool CheckBill(Int64 lngBillKey, ref string sReturn) + { + + try + { + string HChecker = DBUtility.ClsPub.CurUserName; + string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); + oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); + //鐢熸垚璋冩嫧鍗� + //寰楀埌璋冩嫧鍗� mainid 鍗曟嵁鍙� + //long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo); + //string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙� + //oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'"); + // + sReturn = ""; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + + + + + } +} diff --git a/WebAPI/DLL/ClsSc_MouldDotCheckBill.cs b/WebAPI/DLL/ClsSc_MouldDotCheckBill.cs new file mode 100644 index 0000000..5acb90e --- /dev/null +++ b/WebAPI/DLL/ClsSc_MouldDotCheckBill.cs @@ -0,0 +1,295 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSc_MouldDotCheckBill:DBUtility.ClsXt_BaseBill + { + public Models.ClsSc_MouldDotCheckBillMain omodel = new Models.ClsSc_MouldDotCheckBillMain(); + public List<Models.ClsSc_MouldDotCheckBillSub> DetailColl = new List<Models.ClsSc_MouldDotCheckBillSub>(); + + public ClsSc_MouldDotCheckBill() + { + base.MvarItemKeySub = "Sc_MouldDotCheckBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sc_MouldDotCheckBillMain"; + base.MvarReportTitle="妯″叿鐐规璁板綍琛ㄨ〃"; + base.BillType="3821"; + base.HBillSubType = "3821"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSc_MouldDotCheckBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sc_MouldDotCheckBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + //",HStockType='" + omodel.HStockType + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HPlanNo='" + omodel.HPlanNo + "'" + + ",HPlanInterID=" + omodel.HPlanInterID.ToString() + + + + ",HMouldID=" + omodel.HMouldID.ToString() + + ",HBeginDate='" + omodel.HBeginDate + "'" + + ",HEndDate='" + omodel.HEndDate + "'" + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Models.ClsSc_MouldDotCheckBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_MouldDotCheckBillSub " + + " (HInterID,HEntryID" + + ",HManagerID"+ + ",HDotCheckItem,HDotCheckPart,HClaim"+ + ",HCloseMan,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + + "," + oSub.HManagerID.ToString() + + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'" + + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'"+ + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + ") "); + } + // + //foreach (Model.ClsSc_MouldDotCheckBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldDotCheckBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_MouldDotCheckBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark" + + ",HMouldID,HBeginDate"+ + ",HEndDate,HPlanNo,HPlanInterID" + + ",HInnerBillNo,HExplanation" + + ",HDeptID" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'"+ + "," + omodel.HMouldID.ToString() + ",'" + omodel.HBeginDate + "'" + + ",'" + omodel.HEndDate + "','" + omodel.HPlanNo + "'," + omodel.HPlanInterID.ToString() + + ",'" + omodel.HInnerBillNo + "','" + omodel.HExplanation + "'" + + ",'" + omodel.HDeptID + "'"+ + ") "); + //鎻掑叆瀛愯〃 + foreach (Models.ClsSc_MouldDotCheckBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_MouldDotCheckBillSub " + + " (HInterID,HEntryID" + + ",HManagerID" + + ",HDotCheckItem,HDotCheckPart,HClaim" + + ",HCloseMan,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + + "," + oSub.HManagerID.ToString() + + ",'" + oSub.HDotCheckItem + "','" + oSub.HDotCheckPart + "','" + oSub.HClaim + "'" + + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + ") "); + } + // + //foreach (Model.ClsSc_MouldDotCheckBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldDotCheckBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + 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 Sc_MouldDotCheckBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_MouldDotCheckBillMain"); + 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(); + //======================================================== + //== + + omodel.HPlanNo = Ds.Tables[0].Rows[0]["HPlanNo"].ToString().Trim(); + omodel.HPlanInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPlanInterID"]); + omodel.HMouldID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMouldID"]); + omodel.HBeginDate = Ds.Tables[0].Rows[0]["HBeginDate"].ToString().Trim(); + omodel.HEndDate = Ds.Tables[0].Rows[0]["HEndDate"].ToString().Trim(); + + omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]); + omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]); + //omodel.HStockType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HStockType"]); + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sc_MouldDotCheckBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MouldDotCheckBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Models.ClsSc_MouldDotCheckBillSub oSub = new Models.ClsSc_MouldDotCheckBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=================================================== + oSub.HDotCheckItem = DsSub.Tables[0].Rows[i]["HDotCheckItem"].ToString().Trim(); + oSub.HDotCheckPart = DsSub.Tables[0].Rows[i]["HDotCheckPart"].ToString().Trim(); + oSub.HClaim = DsSub.Tables[0].Rows[i]["HClaim"].ToString().Trim(); + oSub.HManagerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HManagerID"]); + + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + //瀹℃牳 + //public bool CheckBill(Int64 lngBillKey, ref string sReturn) + //{ + + // try + // { + // string HChecker = DBUtility.ClsPub.CurUserName; + // string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); + // oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); + // //鐢熸垚璋冩嫧鍗� + // //寰楀埌璋冩嫧鍗� mainid 鍗曟嵁鍙� + // long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo); + // string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙� + // oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'"); + // // + // sReturn = ""; + // return true; + // } + // catch (Exception e) + // { + // sReturn = e.Message; + // throw (e); + // } + //} + + + + + + } +} diff --git a/WebAPI/DLL/ClsSc_MouldLifeChangeBill.cs b/WebAPI/DLL/ClsSc_MouldLifeChangeBill.cs new file mode 100644 index 0000000..5ffd1b2 --- /dev/null +++ b/WebAPI/DLL/ClsSc_MouldLifeChangeBill.cs @@ -0,0 +1,262 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSc_MouldLifeChangeBill:DBUtility.ClsXt_BaseBill + { + public Model.ClsSc_MouldLifeChangeBillMain omodel = new Model.ClsSc_MouldLifeChangeBillMain(); + public List<Model.ClsSc_MouldLifeChangeBillSub> DetailColl = new List<Model.ClsSc_MouldLifeChangeBillSub>(); + + public ClsSc_MouldLifeChangeBill() + { + base.MvarItemKeySub = "Sc_MouldLifeChangeBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sc_MouldLifeChangeBillMain"; + base.MvarReportTitle = "妯″叿瀵垮懡璋冩暣鍗�"; + base.BillType = "3824"; + base.HBillSubType = "3824"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSc_MouldLifeChangeBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sc_MouldLifeChangeBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HMangerID=" + omodel.HMangerID.ToString() + + //",HWHID=" + omodel.HWHID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HReason='" + omodel.HReason + "'" + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + + //",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsSc_MouldLifeChangeBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_MouldLifeChangeBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate" + + ",HUnitID" + + ",HDesignLife,HLeaveLife,HNewLeaveLife" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + + "," + oSub.HUnitID.ToString() + + "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HNewLeaveLife.ToString() + + ") "); + } + // + //foreach (Model.ClsSc_MouldLifeChangeBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldLifeChangeBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_MouldLifeChangeBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + + ",HEmpID,HMangerID,HDeptID" + + ",HReason,HExplanation,HInnerBillNo" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" + + ", " + omodel.HEmpID.ToString() + ", " + omodel.HMangerID.ToString() + ", " + omodel.HDeptID.ToString() + + ",'" + omodel.HReason + "','" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'" + + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsSc_MouldLifeChangeBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_MouldLifeChangeBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate" + + ",HUnitID" + + ",HDesignLife,HLeaveLife,HNewLeaveLife" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + + "," + oSub.HUnitID.ToString() + + "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HNewLeaveLife.ToString() + + ") "); + } + // + //foreach (Model.ClsSc_MouldLifeChangeBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldLifeChangeBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + 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 Sc_MouldLifeChangeBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_MouldLifeChangeBillMain"); + if(Ds.Tables[0].Rows.Count==0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + //鍥哄畾璧嬪��=========================================== + omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); + omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); + omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); + omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); + omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); + omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); + omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); + omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); + 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.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.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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); + omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); + omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); + omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); + omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); + //======================================================== + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HMangerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMangerID"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HReason = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HReason"]); + omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]); + omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]); + + + + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sc_MouldLifeChangeBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MouldLifeChangeBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSc_MouldLifeChangeBillSub oSub = new Model.ClsSc_MouldLifeChangeBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=================================================== + oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]); + oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]); + oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSecUnitRate"]); + oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + oSub.HDesignLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HDesignLife"]); + oSub.HLeaveLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HLeaveLife"]); + + oSub.HNewLeaveLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HNewLeaveLife"]); + + + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + + } + +} diff --git a/WebAPI/DLL/ClsSc_MouldMaintainBill.cs b/WebAPI/DLL/ClsSc_MouldMaintainBill.cs new file mode 100644 index 0000000..b41c296 --- /dev/null +++ b/WebAPI/DLL/ClsSc_MouldMaintainBill.cs @@ -0,0 +1,324 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSc_MouldMaintainBill:DBUtility.ClsXt_BaseBill + { + public Models.ClsSc_MouldMaintainBillMain omodel = new Models.ClsSc_MouldMaintainBillMain(); + public List<Models.ClsSc_MouldMaintainBillSub> DetailColl = new List<Models.ClsSc_MouldMaintainBillSub>(); + + public ClsSc_MouldMaintainBill() + { + base.MvarItemKeySub = "Sc_MouldMaintainBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sc_MouldMaintainBillMain"; + base.MvarReportTitle="妯″叿淇濆吇璁板綍琛�"; + base.BillType="3819"; + base.HBillSubType = "3819"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSc_MouldMaintainBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sc_MouldMaintainBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + //",HStockType='" + omodel.HStockType + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HPlanNo='" + omodel.HPlanNo + "'" + + ",HPlanInterID=" + omodel.HPlanInterID.ToString() + + ",HMouldID=" + omodel.HMouldID.ToString() + + ",HBeginDate='" + omodel.HBeginDate + "'" + + ",HEndDate='" + omodel.HEndDate + "'" + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + + //",HDeptID=" + omodel.HDeptID.ToString() + + //",HDeptNumber='" + omodel.HDeptNumber +"'"+ + //",HEmpID=" + omodel.HEmpID.ToString() + + //",HEmpNumber='" + omodel.HEmpNumber +"'"+ + //",HGroupID=" + omodel.HGroupID.ToString() + + //",HWHID=" + omodel.HWHID.ToString() + + //",HSCWHID=" + omodel.HSCWHID.ToString() + + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Models.ClsSc_MouldMaintainBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_MouldMaintainBillSub " + + " (HInterID,HEntryID,HMaterID" + + ",HQty,HUnitID" + + ",HQtyMust,HManagerID"+ + ",HCloseMan,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + + "," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + + "," + oSub.HQtyMust.ToString() + "," + oSub.HManagerID.ToString() + + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'"+ + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + ") "); + } + // + //foreach (Model.ClsSc_MouldMaintainBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldMaintainBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_MouldMaintainBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark" + + ",HPlanNo,HPlanInterID,HMouldID,HBeginDate"+ + ",HEndDate"+ + ",HInnerBillNo,HExplanation" + + ",HDeptID" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker+ "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'"+ + ",'" + omodel.HPlanNo + "'," + omodel.HPlanInterID.ToString() + "," + omodel.HMouldID.ToString() + ",'" + omodel.HBeginDate + "'" + + ",'" + omodel.HEndDate + "'"+ + ",'" + omodel.HInnerBillNo + "','" + omodel.HExplanation + "'" + + ",'" + omodel.HDeptID + "'" + + ") "); + //鎻掑叆瀛愯〃 + //foreach (Models.ClsSc_MouldMaintainBillSub oSub in DetailColl) + //{ + // oCn.RunProc("Insert into Sc_MouldMaintainBillSub " + + // " (HInterID,HEntryID,HMaterID" + + // ",HQty,HUnitID" + + // ",HQtyMust,HManagerID,HClaim" + + // ",HCloseMan,HCloseType,HRemark" + + // ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + // ") values(" + // + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + + // "," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + + // "," + oSub.HQtyMust.ToString() + "," + oSub.HManagerID.ToString() + ",'" + oSub.HClaim + "'" + + // ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + // "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + // ") "); + //} + foreach (Models.ClsSc_MouldMaintainBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_MouldMaintainBillSub_Item " + + " (HInterID,HEntryID,HMaintainItemID" + + ",HMaintainItem,HMaintainPart" + + ",HManagerID,HClaim" + + ",HCloseMan,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaintainItemID.ToString() + + ",'" + oSub.HMaintainItem.ToString() + "','" + oSub.HMaintainPart.ToString() + + "'," + oSub.HManagerID.ToString() + ",'" + oSub.HClaim + "'" + + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + ") "); + } + // + //foreach (Model.ClsSc_MouldMaintainBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldMaintainBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + 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 Sc_MouldMaintainBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_MouldMaintainBillMain"); + 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(); + //======================================================== + //== + //omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + //omodel.HDeptNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HDeptNumber"]); + //omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + //omodel.HEmpNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HEmpNumber"]); + //omodel.HGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HGroupID"]); + //omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]); + //omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]); + + omodel.HPlanNo = Ds.Tables[0].Rows[0]["HPlanNo"].ToString().Trim(); + omodel.HPlanInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPlanInterID"]); + omodel.HMouldID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMouldID"]); + omodel.HBeginDate = Ds.Tables[0].Rows[0]["HBeginDate"].ToString().Trim(); + omodel.HEndDate = Ds.Tables[0].Rows[0]["HEndDate"].ToString().Trim(); + + omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]); + omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]); + //omodel.HStockType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HStockType"]); + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sc_MouldMaintainBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MouldMaintainBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Models.ClsSc_MouldMaintainBillSub oSub = new Models.ClsSc_MouldMaintainBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=================================================== + oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + oSub.HManagerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HManagerID"]); + + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + //瀹℃牳 + //public bool CheckBill(Int64 lngBillKey, ref string sReturn) + //{ + + // try + // { + // string HChecker = DBUtility.ClsPub.CurUserName; + // string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); + // oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); + // //鐢熸垚璋冩嫧鍗� + // //寰楀埌璋冩嫧鍗� mainid 鍗曟嵁鍙� + // long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo); + // string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙� + // oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'"); + // // + // sReturn = ""; + // return true; + // } + // catch (Exception e) + // { + // sReturn = e.Message; + // throw (e); + // } + //} + + + + + + } +} diff --git a/WebAPI/DLL/ClsSc_MouldProdBackBill.cs b/WebAPI/DLL/ClsSc_MouldProdBackBill.cs new file mode 100644 index 0000000..d79bd49 --- /dev/null +++ b/WebAPI/DLL/ClsSc_MouldProdBackBill.cs @@ -0,0 +1,315 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSc_MouldProdBackBill:DBUtility.ClsXt_BaseBill + { + public Model.ClsSc_MouldProdBackBillMain omodel = new Model.ClsSc_MouldProdBackBillMain(); + public List<Model.ClsSc_MouldProdBackBillSub> DetailColl = new List<Model.ClsSc_MouldProdBackBillSub>(); + + public ClsSc_MouldProdBackBill() + { + base.MvarItemKeySub = "Sc_MouldStockBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sc_MouldStockBillMain"; + base.MvarReportTitle = "妯″叿閫�搴撳崟"; + base.BillType = "3803"; + base.HBillSubType = "3803"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSc_MouldProdBackBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sc_MouldStockBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker+ "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HSupID=" + omodel.HSupID.ToString() + + ",HWHID=" + omodel.HWHID.ToString() + + ",HSCWHID=" + omodel.HSCWHID.ToString() + + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HManagerID=" + omodel.HManagerID.ToString() + + ",HSecManagerID=" + omodel.HSecManagerID.ToString() + + ",HKeeperID=" + omodel.HKeeperID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsSc_MouldProdBackBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_MouldStockBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + + ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + + ",HDesignLife,HLeaveLife,HUseLife" + + ",HSCSPID,HSPGroupID,HBatchNo" + + //",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" + + //",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HNewModel,HWallThickness,HHardness,HLastProdModel,HDiameter,HBackFlag" + + ",HQtyRel" + + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() + + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() + + "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'" + + //"," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" + + //"," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + ",'" + oSub.HNewModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "','" + oSub.HLastProdModel + "','" + oSub.HDiameter + "','" + oSub.HBackFlag + "'" + + "," + 0 + + ") "); + } + // + //foreach (Model.ClsSc_MouldProdBackBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldProdBackBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_MouldStockBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + + ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + + ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker+ "',getdate()" + + ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() + + ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsSc_MouldProdBackBillSub oSub in DetailColl) + { + + oCn.RunProc("Insert into Sc_MouldStockBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + + ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + + ",HDesignLife,HLeaveLife,HUseLife" + + ",HSCSPID,HSPGroupID,HBatchNo"+ + //",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" + + //",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ",HNewModel,HWallThickness,HHardness,HLastProdModel,HDiameter,HBackFlag" + + ",HQtyRel"+ + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() + + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() + + "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'"+ + //"," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" + + //"," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + ",'" + oSub.HNewModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "','" + oSub.HLastProdModel + "','" + oSub.HDiameter + "','" + oSub.HBackFlag + "'" + + ","+0+ + ") "); + } + // + //foreach (Model.ClsSc_MouldProdBackBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldProdBackBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + 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 Sc_MouldStockBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_MouldStockBillMain"); + if(Ds.Tables[0].Rows.Count==0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + //鍥哄畾璧嬪��=========================================== + omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); + omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); + omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); + omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); + omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); + omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); + omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); + omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); + 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.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.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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); + omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); + omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); + omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); + omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); + //======================================================== + omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]); + omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]); + omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]); + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]); + omodel.HSecManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSecManagerID"]); + omodel.HKeeperID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HKeeperID"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]); + omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]); + omodel.HRedBlueFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HRedBlueFlag"]); + + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sc_MouldStockBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MouldStockBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSc_MouldProdBackBillSub oSub = new Model.ClsSc_MouldProdBackBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=================================================== + oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]); + oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]); + oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSecUnitRate"]); + oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]); + oSub.HPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPrice"]); + oSub.HMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HMoney"]); + oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]); + oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]); + oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]); + oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]); + oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]); + oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]); + oSub.HDesignLife = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HDesignLife"]); + oSub.HLeaveLife = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HLeaveLife"]); + oSub.HUseLife = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HUseLife"]); + //oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPOOrderInterID"]); + //oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPOOrderEntryID"]); + //oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPOOrderBillNo"]); + //oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]); + //oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]); + //oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSeOrderBillNo"]); + + oSub.HNewModel = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HNewModel"]); + oSub.HWallThickness = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HWallThickness"]); + oSub.HHardness = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HHardness"]); + oSub.HLastProdModel = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HLastProdModel"]); + oSub.HDiameter = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDiameter"]); + oSub.HBackFlag = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBackFlag"]); + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + + } + +} diff --git a/WebAPI/DLL/ClsSc_MouldProdOutBill.cs b/WebAPI/DLL/ClsSc_MouldProdOutBill.cs new file mode 100644 index 0000000..a930d93 --- /dev/null +++ b/WebAPI/DLL/ClsSc_MouldProdOutBill.cs @@ -0,0 +1,390 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSc_MouldProdOutBill:DBUtility.ClsXt_BaseBill + { + public Model.ClsSc_MouldProdOutBillMain omodel = new Model.ClsSc_MouldProdOutBillMain(); + public List<Model.ClsSc_MouldStockBillSub> DetailColl = new List<Model.ClsSc_MouldStockBillSub>(); + + public ClsSc_MouldProdOutBill() + { + base.MvarItemKeySub = "Sc_MouldStockBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sc_MouldStockBillMain"; + base.MvarReportTitle = "妯″叿棰嗙敤鍗�"; + base.BillType= "3802"; + base.HBillSubType = "3802"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSc_MouldProdOutBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sc_MouldStockBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker+ "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HSupID=" + omodel.HSupID.ToString() + + ",HWHID=" + omodel.HWHID.ToString() + + ",HSCWHID=" + omodel.HSCWHID.ToString() + + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HManagerID=" + omodel.HManagerID.ToString() + + ",HSecManagerID=" + omodel.HSecManagerID.ToString() + + ",HKeeperID=" + omodel.HKeeperID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_MouldStockBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + + ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + + ",HDesignLife,HLeaveLife,HUseLife" + + ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" + + ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() + + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() + + "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" + + "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + ") "); + } + // + //foreach (Model.ClsSc_MouldProdOutBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldProdOutBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_MouldStockBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + + ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + + ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + + ",HProcID"+ + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" + + ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() + + ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + "," + '0' + + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_MouldStockBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + + ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + + ",HDesignLife,HLeaveLife,HUseLife" + + ",HSCSPID,HSPGroupID,HBatchNo,HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" + + ",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() + + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() + + "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" + + "," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + ") "); + } + // + //foreach (Model.ClsSc_MouldProdOutBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldProdOutBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + 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 Sc_MouldStockBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_MouldStockBillMain"); + if(Ds.Tables[0].Rows.Count==0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + //鍥哄畾璧嬪��=========================================== + omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); + omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); + omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); + omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); + omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); + omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); + omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); + omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); + 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.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.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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); + omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); + omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); + omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); + omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); + //======================================================== + omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]); + omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]); + omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]); + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]); + omodel.HSecManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSecManagerID"]); + omodel.HKeeperID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HKeeperID"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]); + omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]); + omodel.HRedBlueFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HRedBlueFlag"]); + + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sc_MouldStockBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MouldStockBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=================================================== + oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]); + oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]); + oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSecUnitRate"]); + oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]); + oSub.HPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPrice"]); + oSub.HMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HMoney"]); + oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]); + oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]); + oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]); + oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]); + oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]); + oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]); + oSub.HDesignLife = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HDesignLife"]); + oSub.HLeaveLife = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HLeaveLife"]); + oSub.HUseLife = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HUseLife"]); + oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPOOrderInterID"]); + oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPOOrderEntryID"]); + oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPOOrderBillNo"]); + oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]); + oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]); + oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSeOrderBillNo"]); + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + //浣跨敤瀵垮懡绱 + public Int64 Add1(Int64 HMould) + { + try + { + DataSet ds; + ds = oCn.RunProcReturn("Select sum(HUseLIfe) as sHUseLife from Sc_MouldStockBillSub Where HMaterID=" + HMould.ToString(), "Sc_MouldStockBillSub"); + if (ds.Tables[0].Rows.Count == 0) + { + + return 0; + } + else + { + + return DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["sHUseLife"]); + } + //return true; + } + catch (Exception e) + { + return -1; + //throw (e); + } + } + + + //鏉$爜鎵弿璁板綍,鏂板鍒颁骇鍝佸叆搴� + public bool AddBill_PDA(ref string sReturn) + { + try + { + DataSet Ds; + oCn.BeginTran(); + //鍒犻櫎涓昏〃 + oCn.RunProc("Delete From Sc_MouldStockBillMain where HInterID=" + omodel.HInterID.ToString()); + //鎻掑叆瀛愯〃 + oCn.RunProc("EXEC h_p_Sc_MouldProdOutBillSub_Insert " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'"); + //鎻掑叆涓昏〃 + oCn.RunProc("INSERT INTO Sc_MouldStockBillMain " + + "(FInterID,FBillNo,FBrNo,FTranType,FCancellation " + + ",FStatus,FUpStockWhenSave,FROB,FHookStatus,Fdate " + + ",FDeptID,FCheckDate " + + ",FFManagerID,FSManagerID,FBillerID " + + ",FMultiCheckDate1,FMultiCheckDate2,FMultiCheckDate3 " + + ",FMultiCheckDate4,FMultiCheckDate5,FMultiCheckDate6 " + + ",FVchInterID,FSelTranType,FManageType,FPrintCount " + + ") VALUES (" + + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','0','" + this.BillType + "',0" + + ",0,0,1,0,convert(varchar(10),getdate(),120)" + + "," + omodel.HDeptID.ToString() + ",Null " + + "," + omodel.HKeeperID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HBillerID.ToString() + + ",null,null,null" + + ",null,null,null" + + ",0,85,0,0" + + ")"); + sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + + //鏍规嵁鏉$爜妗f鑾峰彇淇℃伅 + public Model.ClsSc_MouldProdOutBillSub get_MouldProdOutInfoByBarCode(string sBarCode) + { + try + { + Model.ClsSc_MouldProdOutBillSub oSub = new Model.ClsSc_MouldProdOutBillSub(); + DataSet Ds; + Ds = oCn.RunProcReturn("exec h_p_Sc_MouldProdOutInfoByBarCode '" + sBarCode + "'", "xt_xtgnb", ref DBUtility.ClsPub.sExeReturnInfo); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + return null; + } + oSub.HMoney = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HAmount"]); + oSub.HPrice = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HPrice"]); + oSub.HQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HQty"]); + oSub.HBarCode = sBarCode; + oSub.HBatchNo = Ds.Tables[0].Rows[0]["HBatchNo"].ToString(); + oSub.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]); + return oSub; + } + catch (Exception e) + { + DBUtility.ClsPub.sExeReturnInfo += "鏍规嵁鏉$爜鑾峰彇鐩稿簲淇℃伅澶辫触锛�" + e.Message; + return null; + } + } + + + + } + +} diff --git a/WebAPI/DLL/ClsSc_MouldRepairCheckBill.cs b/WebAPI/DLL/ClsSc_MouldRepairCheckBill.cs new file mode 100644 index 0000000..0744322 --- /dev/null +++ b/WebAPI/DLL/ClsSc_MouldRepairCheckBill.cs @@ -0,0 +1,296 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSc_MouldRepairCheckBill:DBUtility.ClsXt_BaseBill + { + public Model.ClsSc_MouldRepairCheckBillMain omodel = new Model.ClsSc_MouldRepairCheckBillMain(); + public List<Model.ClsSc_MouldRepairCheckBillSub> DetailColl = new List<Model.ClsSc_MouldRepairCheckBillSub>(); + + public ClsSc_MouldRepairCheckBill() + { + base.MvarItemKeySub = "Sc_MouldRepairCheckBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sc_MouldRepairCheckBillMain"; + base.MvarReportTitle="妯″叿缁翠慨楠屾敹鍗�"; + base.BillType="3817"; + base.HBillSubType = "3817"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSc_MouldRepairCheckBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sc_MouldRepairCheckBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + //",HStockType='" + omodel.HStockType + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker+ "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HMouldID=" + omodel.HMouldID.ToString() + + ",HCheckBeginDate='" + omodel.HCheckBeginDate + "'" + + ",HCheckResult='" + omodel.HCheckResult + "'" + + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HManagerID=" + omodel.HManagerID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + + //",HDeptID=" + omodel.HDeptID.ToString() + + //",HDeptNumber='" + omodel.HDeptNumber +"'"+ + //",HEmpID=" + omodel.HEmpID.ToString() + + //",HEmpNumber='" + omodel.HEmpNumber +"'"+ + //",HGroupID=" + omodel.HGroupID.ToString() + + //",HWHID=" + omodel.HWHID.ToString() + + //",HSCWHID=" + omodel.HSCWHID.ToString() + + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsSc_MouldRepairCheckBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_MouldRepairCheckBillSub " + + " (HInterID,HEntryID" + + ",HManagerID,HRepairCheckID,HRepairCheckContent" + + ",HCloseMan,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + + "," + oSub.HManagerID.ToString() + "," + oSub.HRepairCheckID.ToString() + ",'" + oSub.HRepairCheckContent + "'" + + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'"+ + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + ") "); + } + // + //foreach (Model.ClsSc_MouldRepairCheckBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldRepairCheckBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_MouldRepairCheckBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" + + ",HYear,HPeriod,HRemark" + + ",HMouldID,HCheckBeginDate,HCheckResult" + + ",HEmpID,HManagerID,HDeptID"+ + ",HInnerBillNo,HExplanation" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()" + + "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'"+ + "," + omodel.HMouldID.ToString() + ",'" + omodel.HCheckBeginDate + "','" + omodel.HCheckResult + "'" + + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HDeptID.ToString() + + ",'" + omodel.HInnerBillNo + "','" + omodel.HExplanation + "'" + + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsSc_MouldRepairCheckBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_MouldRepairCheckBillSub " + + " (HInterID,HEntryID" + + ",HManagerID,HRepairCheckID,HRepairCheckContent" + + ",HCloseMan,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + + "," + oSub.HManagerID.ToString() + "," + oSub.HRepairCheckID.ToString() + ",'" + oSub.HRepairCheckContent + "'" + + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + ") "); + } + // + //foreach (Model.ClsSc_MouldRepairCheckBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldRepairCheckBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + 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 Sc_MouldRepairCheckBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_MouldRepairCheckBillMain"); + 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(); + //======================================================== + //== + + omodel.HMouldID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMouldID"]); + omodel.HCheckBeginDate = Ds.Tables[0].Rows[0]["HCheckBeginDate"].ToString().Trim(); + omodel.HCheckResult = Ds.Tables[0].Rows[0]["HCheckResult"].ToString().Trim(); + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + + omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]); + omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]); + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sc_MouldRepairCheckBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MouldRepairCheckBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSc_MouldRepairCheckBillSub oSub = new Model.ClsSc_MouldRepairCheckBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=================================================== + oSub.HRepairCheckID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HRepairCheckID"]); + oSub.HRepairCheckContent = DsSub.Tables[0].Rows[i]["HRepairCheckContent"].ToString().Trim(); + oSub.HManagerID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HManagerID"]); + + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + //瀹℃牳 + //public bool CheckBill(Int64 lngBillKey, ref string sReturn) + //{ + + // try + // { + // string HChecker = DBUtility.ClsPub.CurUserName; + // string HCheckDate = DBUtility.ClsPub.GetServerDate(-1); + // oCn.RunProc(" Update " + MvarItemKey + " set HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); + // //鐢熸垚璋冩嫧鍗� + // //寰楀埌璋冩嫧鍗� mainid 鍗曟嵁鍙� + // long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo); + // string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙� + // oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'"); + // // + // sReturn = ""; + // return true; + // } + // catch (Exception e) + // { + // sReturn = e.Message; + // throw (e); + // } + //} + + + + + + } +} diff --git a/WebAPI/DLL/ClsSc_MouldScrapInBill.cs b/WebAPI/DLL/ClsSc_MouldScrapInBill.cs new file mode 100644 index 0000000..db8622e --- /dev/null +++ b/WebAPI/DLL/ClsSc_MouldScrapInBill.cs @@ -0,0 +1,413 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSc_MouldScrapInBill:DBUtility.ClsXt_BaseBill + { + public Models.ClsSc_MouldStockBillMain omodel = new Models.ClsSc_MouldStockBillMain(); + public List<Models.ClsSc_MouldStockBillSub> DetailColl = new List<Models.ClsSc_MouldStockBillSub>(); + + public ClsSc_MouldScrapInBill() + { + base.MvarItemKeySub = "Sc_MouldStockBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sc_MouldStockBillMain"; + base.MvarReportTitle = "妯″叿鎶ュ簾鍏ュ簱鍗�"; + base.BillType = "3831"; + base.HBillSubType = "3831"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSc_MouldScrapInBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sc_MouldStockBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HSupID=" + omodel.HSupID.ToString() + + ",HWHID=" + omodel.HWHID.ToString() + + ",HSCWHID=" + omodel.HSCWHID.ToString() + + ",HEmpID=" + omodel.HEmpID.ToString() + + ",HManagerID=" + omodel.HManagerID.ToString() + + ",HSecManagerID=" + omodel.HSecManagerID.ToString() + + ",HKeeperID=" + omodel.HKeeperID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Models.ClsSc_MouldStockBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_MouldStockBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + + ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + + ",HDesignLife,HLeaveLife,HUseLife" + + ",HSCSPID,HSPGroupID,HBatchNo" + + //",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" + + //",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + //",HNewModel,HWallThickness,HHardness,HLastProdModel,HDiameter,HBackFlag" + + //",HQtyRel,HNewLifeQty,HNowModel,HNowLife" + + //",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() + + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() + + "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'" + + //"," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" + + //"," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + //",'" + oSub.HNewModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "','" + oSub.HLastProdModel + "','" + oSub.HDiameter + "','" + oSub.HBackFlag + "'" + + //"," + 0 + "," + oSub.HNewLifeQty.ToString() + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + + //"," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + + ") "); + //if (oSub.HBackFlag == "鎶ュ簾鍏ュ簱") + //{ + // oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鎶ュ簾'"); + //} + //else + //{ + // oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鍦ㄥ簱'"); + //} + } + // + //oCn.RunProcReturn("exec h_p_Sc_MouldFileChangeStatus " + omodel.HInterID.ToString() + ",'鍦ㄥ簱'", "gy_czygl"); + //foreach (Model.ClsSc_MouldScrapInBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldScrapInBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + DataSet Ds; + foreach (Models.ClsSc_MouldStockBillSub oSub in DetailColl) + { + Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", 1", "gy_czygl"); + if (Ds.Tables[0].Rows.Count == 0) + { + oCn.RollBack(); + return false; + } + if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; + oCn.RollBack(); + return false; + } + } + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_MouldStockBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + + ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + + ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" + + ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() + + ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + + ") "); + //鎻掑叆瀛愯〃 + foreach (Models.ClsSc_MouldStockBillSub oSub in DetailColl) + { + + oCn.RunProc("Insert into Sc_MouldStockBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + + ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + + ",HDesignLife,HLeaveLife,HUseLife" + + ",HSCSPID,HSPGroupID,HBatchNo" + + //",HPOOrderInterID,HPOOrderEntryID,HPOOrderBillNo" + + //",HSeOrderInterID,HSeOrderEntryID,HSeOrderBillNo" + + //",HNewModel,HWallThickness,HHardness,HLastProdModel,HDiameter,HBackFlag" + + //",HQtyRel,HNewLifeQty,HNowModel,HNowLife" + + //",HMouldType,HInitModel,HInitDesignLife,HLifeUnitID" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() + + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() + + "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + "," + oSub.HUseLife.ToString() + + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'" + + //"," + oSub.HPOOrderInterID.ToString() + "," + oSub.HPOOrderEntryID.ToString() + ",'" + oSub.HPOOrderBillNo + "'" + + //"," + oSub.HSeOrderInterID.ToString() + "," + oSub.HSeOrderEntryID.ToString() + ",'" + oSub.HSeOrderBillNo + "'" + + //",'" + oSub.HNewModel + "','" + oSub.HWallThickness + "','" + oSub.HHardness + "','" + oSub.HLastProdModel + "','" + oSub.HDiameter + "','" + oSub.HBackFlag + "'" + + //"," + 0 + "," + oSub.HNewLifeQty.ToString() + ",'" + oSub.HNowModel + "'," + oSub.HNowLife.ToString() + + //"," + oSub.HMouldType.ToString() + ",'" + oSub.HInitModel + "'," + oSub.HInitDesignLife.ToString() + "," + oSub.HLifeUnitID.ToString() + + ") "); + // + //if (oSub.HBackFlag == "鎶ュ簾鍏ュ簱") + //{ + // oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鎶ュ簾'"); + //} + //else + //{ + // oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNewModel.ToString() + "'," + oSub.HNewLifeQty.ToString() + ",'鍦ㄥ簱'"); + //} + } + // + //foreach (Model.ClsSc_MouldScrapInBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldScrapInBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + // + DataSet Ds; + foreach (Models.ClsSc_MouldStockBillSub oSub in DetailColl) + { + Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", 1", "gy_czygl"); + if (Ds.Tables[0].Rows.Count == 0) + { + oCn.RollBack(); + return false; + } + if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; + oCn.RollBack(); + return false; + } + } + 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 Sc_MouldStockBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_MouldStockBillMain"); + if(Ds.Tables[0].Rows.Count==0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + //鍥哄畾璧嬪��=========================================== + omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); + omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); + omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); + omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); + omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); + omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); + omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); + omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); + 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.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.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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); + omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); + omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); + omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); + omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); + //======================================================== + omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]); + omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]); + omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]); + omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]); + omodel.HSecManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSecManagerID"]); + omodel.HKeeperID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HKeeperID"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]); + omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]); + omodel.HRedBlueFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HRedBlueFlag"]); + + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sc_MouldStockBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MouldStockBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Models.ClsSc_MouldStockBillSub oSub = new Models.ClsSc_MouldStockBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=================================================== + oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]); + oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]); + oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSecUnitRate"]); + oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]); + oSub.HPrice = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HPrice"]); + oSub.HMoney = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HMoney"]); + oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]); + oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]); + oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]); + oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]); + oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]); + oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]); + oSub.HDesignLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HDesignLife"]); + oSub.HLeaveLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HLeaveLife"]); + oSub.HUseLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HUseLife"]); + oSub.HUseLifeQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HUseLifeQty"]); + //oSub.HNewLifeQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HNewLifeQty"]); + //oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPOOrderInterID"]); + //oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPOOrderEntryID"]); + //oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HPOOrderBillNo"]); + //oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderInterID"]); + //oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSeOrderEntryID"]); + //oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HSeOrderBillNo"]); + + //oSub.HNewModel = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HNewModel"]); + //oSub.HWallThickness = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HWallThickness"]); + //oSub.HHardness = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HHardness"]); + //oSub.HLastProdModel = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HLastProdModel"]); + //oSub.HDiameter = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HDiameter"]); + //oSub.HBackFlag = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBackFlag"]); + //oSub.HNowModel = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HNowModel"]); + //oSub.HNowLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HNowLife"]); + + //oSub.HMouldType = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMouldType"]); + //oSub.HInitModel = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HInitModel"]); + //oSub.HInitDesignLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HInitDesignLife"]); + //oSub.HLifeUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HLifeUnitID"]); + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + + //鏉$爜鎵弿璁板綍,鏂板鍒颁骇鍝佸叆搴� + public bool AddBill_PDA(ref string sReturn) + { + try + { + DataSet Ds; + oCn.BeginTran(); + //鍒犻櫎涓昏〃 + oCn.RunProc("Delete From Sc_MouldStockBillMain where HInterID=" + omodel.HInterID.ToString()); + //鎻掑叆瀛愯〃 + oCn.RunProc("EXEC h_p_Sc_MouldScrapInBillSub_Insert " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'"); + //鎻掑叆涓昏〃 + oCn.RunProc("Insert Into Sc_MouldStockBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + + ",HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID" + + ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',getdate()" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" + + ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSecManagerID.ToString() + + ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + ") "); + sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + + + + } +} diff --git a/WebAPI/DLL/ClsSc_MouldScrapOutBill.cs b/WebAPI/DLL/ClsSc_MouldScrapOutBill.cs new file mode 100644 index 0000000..6886dbb --- /dev/null +++ b/WebAPI/DLL/ClsSc_MouldScrapOutBill.cs @@ -0,0 +1,419 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Data; + +namespace WebAPI.DLL +{ + public class ClsSc_MouldScrapOutBill:DBUtility.ClsXt_BaseBill + { + public Model.ClsSc_MouldStockBillMain omodel = new Model.ClsSc_MouldStockBillMain(); + public List<Model.ClsSc_MouldStockBillSub> DetailColl = new List<Model.ClsSc_MouldStockBillSub>(); + + public ClsSc_MouldScrapOutBill() + { + base.MvarItemKeySub = "Sc_MouldStockBillSub"; + base.MvarItemKeySub2 = ""; + base.MvarItemKeySub3 = ""; + base.MvarItemKeySub4 = ""; + base.MvarItemKey="Sc_MouldStockBillMain"; + base.MvarReportTitle = "妯″叿澶勭悊鍑哄簱鍗�"; + base.BillType="3832"; + base.HBillSubType = "3832"; + + } + + #region 鍥哄畾浠g爜 + + ~ClsSc_MouldScrapOutBill() + { + DetailColl = null; + } + + #endregion 鑷畾涔夋柟娉� + //淇敼鍗曟嵁 + public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) + { + try + { + // + oCn.BeginTran(); + //鏇存柊涓昏〃 + oCn.RunProc("UpDate Sc_MouldStockBillMain set " + + " HBillNo='" + omodel.HBillNo + "'" + //鍥哄畾璧嬪��=============== + ",HDate='" + omodel.HDate + "'" + + ",HYear='" + omodel.HYear.ToString() + "'" + + ",HPeriod='" + omodel.HPeriod.ToString() + "'" + + ",HRemark='" + omodel.HRemark + "'" + + ",HUpDater='" + omodel.HMaker + "'" + + ",HUpDateDate=getdate()" + + //======================================== + ",HSupID=" + omodel.HSupID.ToString() + + ",HWHID=" + omodel.HWHID.ToString() + + //",HSCWHID=" + omodel.HSCWHID.ToString() + + //",HEmpID=" + omodel.HEmpID.ToString() + + ",HManagerID=" + omodel.HManagerID.ToString() + + //",HSecManagerID=" + omodel.HSecManagerID.ToString() + + ",HKeeperID=" + omodel.HKeeperID.ToString() + + ",HDeptID=" + omodel.HDeptID.ToString() + + ",HExplanation='" + omodel.HExplanation + "'" + + ",HInnerBillNo='" + omodel.HInnerBillNo + "'" + + ",HRedBlueFlag=" + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + " where HInterID=" + lngBillKey.ToString()); + //鍒犻櫎鍏宠仈 + DeleteRelation(ref sReturn, lngBillKey); + //鍒犻櫎瀛愯〃 + DeleteBillSub(lngBillKey); + //鎻掑叆瀛愯〃 + omodel.HInterID = lngBillKey; + foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) + { + + oCn.RunProc("Insert into Sc_MouldStockBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + + ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + + ",HDesignLife,HLeaveLife" + + ",HSCSPID,HSPGroupID,HBatchNo,HUseLife" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() + + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() + + "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HUseLife.ToString() + + + ") "); + + //oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNowModel.ToString() + "'," + oSub.HNowLife.ToString() + ",'鐢熶骇涓�'"); + } + // + //oCn.RunProcReturn("exec h_p_Sc_MouldFileChangeStatus " + omodel.HInterID.ToString() + ",'鐢熶骇涓�'", "gy_czygl"); + //foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldScrapOutBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + DataSet Ds; + foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) + { + Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", -1", "gy_czygl"); + if (Ds.Tables[0].Rows.Count == 0) + { + oCn.RollBack(); + return false; + } + if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; + oCn.RollBack(); + return false; + } + } + 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); + //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙� + oCn.BeginTran(); + //涓昏〃 + oCn.RunProc("Insert Into Sc_MouldStockBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + + ",HSupID,HWHID,HManagerID,HSCWHID,HEmpID,HSecManagerID" + + ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + + ""+ + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" + + ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HManagerID.ToString() + "," + omodel.HSCWHID.ToString() + "," + omodel.HEmpID.ToString() + "," + omodel.HSecManagerID.ToString() + + ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + ") "); + //鎻掑叆瀛愯〃 + foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) + { + oCn.RunProc("Insert into Sc_MouldStockBillSub " + + " (HInterID,HEntryID,HCloseMan,HEntryCloseDate,HCloseType,HRemark" + + ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + + ",HMaterID,HPropertyID,HSecUnitID,HSecUnitRate,HUnitID,HQtyMust" + + ",HQty,HPrice,HMoney,HWHID,HSCWHID,HSPID" + + ",HDesignLife,HLeaveLife" + + ",HSCSPID,HSPGroupID,HBatchNo,HUseLife" + + ") values(" + + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + ",'" + oSub.HCloseMan + "','" + oSub.HEntryCloseDate.ToShortDateString() + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + + "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + + "," + oSub.HMaterID.ToString() + "," + oSub.HPropertyID.ToString() + "," + oSub.HSecUnitID.ToString() + "," + oSub.HSecUnitRate.ToString() + "," + oSub.HUnitID.ToString() + "," + oSub.HQtyMust.ToString() + + "," + oSub.HQty.ToString() + "," + oSub.HPrice.ToString() + "," + oSub.HMoney.ToString() + "," + oSub.HWHID.ToString() + "," + oSub.HSCWHID.ToString() + "," + oSub.HSPID.ToString() + + "," + oSub.HDesignLife.ToString() + "," + oSub.HLeaveLife.ToString() + + "," + oSub.HSCSPID.ToString() + "," + oSub.HSPGroupID.ToString() + ",'" + oSub.HBatchNo + "'," + oSub.HUseLife.ToString() + + + ") "); + + //oCn.RunProc("exec h_p_Sc_MouldFileChangeStatus " + oSub.HMaterID.ToString() + ",'" + oSub.HNowModel.ToString() + "'," + oSub.HNowLife.ToString() + ",'鐢熶骇涓�'"); + } + // + //foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) + //{ + // Ds = oCn.RunProcReturn("exec h_p_Sc_MouldScrapOutBill_Qty " + oSub.HICMOInterID, ""); + // if (Ds.Tables[0].Rows.Count == 0) + // return; + // if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBool"]) == "Y") + // { + // sReturn = "姹囨姤鏁伴噺瓒呰繃璁″垝鏁伴噺锛佷笉鍏佽淇濆瓨"; + // return false; + // } + //} + DataSet Ds; + foreach (Model.ClsSc_MouldStockBillSub oSub in DetailColl) + { + Ds = oCn.RunProcReturn("exec h_p_Kf_ICStockBill_CheckKF " + omodel.HInterID + "," + oSub.HMaterID + "," + oSub.HWHID + "," + oSub.HSPID + ", -1", "gy_czygl"); + if (Ds.Tables[0].Rows.Count == 0) + { + oCn.RollBack(); + return false; + } + if (DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][0]) == "N") + { + sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]) + ", 涓嶅厑璁镐繚瀛橈紒"; + oCn.RollBack(); + return false; + } + } + // + 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 Sc_MouldStockBillMain Where HInterID=" + lngBillKey.ToString(), "Sc_MouldStockBillMain"); + if(Ds.Tables[0].Rows.Count==0) + { + sReturn = "鍗曟嵁鏈壘鍒帮紒"; + return false; + } + //鍥哄畾璧嬪��=========================================== + omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); + omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); + omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); + omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); + omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); + omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); + omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); + omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); + 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.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.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.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); + omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); + omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); + omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); + omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); + //======================================================== + omodel.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"]); + omodel.HWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HWHID"]); + //omodel.HSCWHID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSCWHID"]); + //omodel.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"]); + omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]); + //omodel.HSecManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSecManagerID"]); + omodel.HKeeperID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HKeeperID"]); + omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); + omodel.HExplanation = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HExplanation"]); + omodel.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"]); + omodel.HRedBlueFlag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HRedBlueFlag"]); + + // + + //寰幆 + DataSet DsSub ; + DsSub = oCn.RunProcReturn("Select * from Sc_MouldStockBillSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Sc_MouldStockBillSub"); + DetailColl.Clear();//娓呯┖ + for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) + { + Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub(); + // 鍥哄畾璧嬪��=============================================== + 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(); + //=================================================== + oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"]); + oSub.HPropertyID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HPropertyID"]); + oSub.HSecUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSecUnitID"]); + oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HSecUnitRate"]); + oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"]); + oSub.HQtyMust = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQtyMust"]); + oSub.HQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HQty"]); + oSub.HPrice = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HPrice"]); + oSub.HMoney = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HMoney"]); + oSub.HWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HWHID"]); + oSub.HSCWHID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCWHID"]); + oSub.HSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPID"]); + oSub.HSCSPID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSCSPID"]); + oSub.HSPGroupID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSPGroupID"]); + oSub.HBatchNo = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HBatchNo"]); + oSub.HDesignLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HDesignLife"]); + oSub.HLeaveLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HLeaveLife"]); + //oSub.HUseLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HUseLife"]); + //oSub.HMouldType = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMouldType"]); + //oSub.HInitModel = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HInitModel"]); + //oSub.HInitDesignLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HInitDesignLife"]); + //oSub.HLifeUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HLifeUnitID"]); + //oSub.HNowModel = DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HNowModel"]); + //oSub.HNowLife = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HNowLife"]); + DetailColl.Add(oSub); + } + sReturn = "鏄剧ず鍗曟嵁鎴愬姛锛�"; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + //浣跨敤瀵垮懡绱 + public Int64 Add1(Int64 HMould) + { + try + { + DataSet ds; + ds = oCn.RunProcReturn("Select sum(HUseLIfe) as sHUseLife from Sc_MouldStockBillSub Where HMaterID=" + HMould.ToString(), "Sc_MouldStockBillSub"); + if (ds.Tables[0].Rows.Count == 0) + { + + return 0; + } + else + { + + return DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["sHUseLife"]); + } + //return true; + } + catch (Exception e) + { + return -1; + //throw (e); + } + } + + + //鏉$爜鎵弿璁板綍,鏂板鍒颁骇鍝佸叆搴� + public bool AddBill_PDA(ref string sReturn) + { + try + { + DataSet Ds; + oCn.BeginTran(); + //鍒犻櫎涓昏〃 + oCn.RunProc("Delete From Sc_MouldStockBillMain where HInterID=" + omodel.HInterID.ToString()); + //鎻掑叆瀛愯〃 + oCn.RunProc("EXEC h_p_Sc_MouldScrapOutBillSub_Insert " + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'"); + //鎻掑叆涓昏〃 + oCn.RunProc("Insert Into Sc_MouldStockBillMain " + + "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + + ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + + ",HSupID,HWHID,HManagerID" + + ",HKeeperID,HDeptID,HExplanation,HInnerBillNo,HRedBlueFlag" + + ") " + + " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "',getdate()" + + ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HMaker + "',getdate()" + + ", " + omodel.HSupID.ToString() + "," + omodel.HWHID.ToString() + "," + omodel.HManagerID.ToString() + + ", " + omodel.HKeeperID.ToString() + "," + omodel.HDeptID.ToString() + ",'" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "'," + DBUtility.ClsPub.BoolToString(omodel.HRedBlueFlag) + + ") "); + sReturn = "鏂板鍗曟嵁鎴愬姛锛�"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCn.RollBack(); + throw (e); + } + } + + + //鏍规嵁鏉$爜妗f鑾峰彇淇℃伅 + public Model.ClsSc_MouldStockBillSub get_MouldProdOutInfoByBarCode(string sBarCode) + { + try + { + Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub(); + DataSet Ds; + Ds = oCn.RunProcReturn("exec h_p_Sc_MouldProdOutInfoByBarCode '" + sBarCode + "'", "xt_xtgnb", ref DBUtility.ClsPub.sExeReturnInfo); + if (Ds == null || Ds.Tables[0].Rows.Count == 0) + { + return null; + } + oSub.HMoney = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HAmount"]); + oSub.HPrice = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HPrice"]); + oSub.HQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HQty"]); + oSub.HBarCode = sBarCode; + oSub.HBatchNo = Ds.Tables[0].Rows[0]["HBatchNo"].ToString(); + oSub.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"]); + return oSub; + } + catch (Exception e) + { + DBUtility.ClsPub.sExeReturnInfo += "鏍规嵁鏉$爜鑾峰彇鐩稿簲淇℃伅澶辫触锛�" + e.Message; + return null; + } + } + + + + } + +} diff --git a/WebAPI/DLL/DAL.dll b/WebAPI/DLL/DAL.dll index 959f5e6..a22039b 100644 --- a/WebAPI/DLL/DAL.dll +++ b/WebAPI/DLL/DAL.dll Binary files differ diff --git a/WebAPI/DLL/DAL20210625.zip b/WebAPI/DLL/DAL20210625.zip new file mode 100644 index 0000000..d496341 --- /dev/null +++ b/WebAPI/DLL/DAL20210625.zip Binary files differ diff --git a/WebAPI/DLL/Model.dll b/WebAPI/DLL/Model.dll index 67c6846..4caf8d8 100644 --- a/WebAPI/DLL/Model.dll +++ b/WebAPI/DLL/Model.dll Binary files differ diff --git a/WebAPI/DLL/Model.zip b/WebAPI/DLL/Model.zip new file mode 100644 index 0000000..a03c930 --- /dev/null +++ b/WebAPI/DLL/Model.zip Binary files differ diff --git a/WebAPI/DLL/Model20200818.zip b/WebAPI/DLL/Model20200818.zip deleted file mode 100644 index b243991..0000000 --- a/WebAPI/DLL/Model20200818.zip +++ /dev/null Binary files differ diff --git "a/WebAPI/DLL/\350\260\203\347\224\250\345\267\245\347\250\213\346\226\207\344\273\266/Model.dll" "b/WebAPI/DLL/\350\260\203\347\224\250\345\267\245\347\250\213\346\226\207\344\273\266/Model.dll" index d302ff5..4caf8d8 100644 --- "a/WebAPI/DLL/\350\260\203\347\224\250\345\267\245\347\250\213\346\226\207\344\273\266/Model.dll" +++ "b/WebAPI/DLL/\350\260\203\347\224\250\345\267\245\347\250\213\346\226\207\344\273\266/Model.dll" Binary files differ diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs index 7c8ab38..2e50628 100644 --- a/WebAPI/ListModels.cs +++ b/WebAPI/ListModels.cs @@ -345,7 +345,7 @@ return list; } - + /// <summary> /// 澶勭悊鏂板妫�楠屾柟妗堝瓙琛ㄧ殑json /// </summary> @@ -457,6 +457,728 @@ return list; } + /// <summary> + /// 澶勭悊鏂板妯″叿缁翠慨楠屾敹鍗曚富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldRepairCheckBillMain> getObjectByJson_Gy_MouldRepairCheckBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldRepairCheckBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldRepairCheckBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板妯″叿缁翠慨楠屾敹鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldRepairCheckBillSub> getObjectByJson_Gy_MouldRepairCheckBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldRepairCheckBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldRepairCheckBillSub>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板妯″叿鏁呴殰鐧昏鍗曚富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldConkBookBillMain> getObjectByJson_Gy_MouldConkBookBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldConkBookBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldConkBookBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板妯″叿鏁呴殰鐧昏鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldConkBookBillSub> getObjectByJson_Gy_MouldConkBookBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldConkBookBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldConkBookBillSub>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板妯″叿淇濆吇璁″垝鍗曚富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldMaintainPlanBillMain> getObjectByJson_Gy_MouldMaintainPlanBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldMaintainPlanBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldMaintainPlanBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板妯″叿淇濆吇璁″垝鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldMaintainPlanBillSub> getObjectByJson_Gy_MouldMaintainPlanBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldMaintainPlanBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldMaintainPlanBillSub>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板涓嶈壇鍘熷洜琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_BadReason_Model> getObjectByJson_Gy_BadReason(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_BadReason_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_BadReason_Model>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板妯″叿淇濆吇璁板綍琛ㄤ富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldMaintainBillMain> getObjectByJson_Sc_MouldMaintainBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldMaintainBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldMaintainBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板妯″叿淇濆吇璁板綍琛ㄥ瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldMaintainBillSub> getObjectByJson_Sc_MouldMaintainBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldMaintainBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldMaintainBillSub>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板璐у竵璁剧疆琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_Currency_Model> getObjectByJson_Gy_Currency(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_Currency_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_Currency_Model>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板鐢熶骇璧勬簮琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_Source_Model> getObjectByJson_Gy_Source(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_Source_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_Source_Model>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板璁¢噺鍗曚綅琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_Unit_Model> getObjectByJson_Gy_Unit(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_Unit_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_Unit_Model>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板妯″叿鐐规璁板綍琛ㄤ富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldDotCheckBillMain> getObjectByJson_Sc_MouldDotCheckBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldDotCheckBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldDotCheckBillMain>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板妯″叿鐐规璁板綍琛ㄥ瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldDotCheckBillSub> getObjectByJson_Sc_MouldDotCheckBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldDotCheckBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldDotCheckBillSub>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板妯″叿鐐规璁″垝琛ㄤ富琛ㄧ殑json + /// ClsSc_MouldDotCheckPlanBillMain + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldDotCheckPlanBillMain> getObjectByJson_Sc_MouldDotCheckPlanBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldDotCheckPlanBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldDotCheckPlanBillMain>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板妯″叿鐐规璁″垝琛ㄥ瓙琛ㄧ殑json + /// ClsSc_MouldDotCheckPlanBillSub + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldDotCheckPlanBillSub> getObjectByJson_Sc_MouldDotCheckPlanBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldDotCheckPlanBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldDotCheckPlanBillSub>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板鑱屽憳琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsGy_Employee_Model> getObjectByJson_Gy_Employee(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsGy_Employee_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_Employee_Model>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板璁惧缁翠慨涓昏〃鐨刯son + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSb_EquipRepairWorkBillMain> getObjectByJson_Gy_EquipRepairWorkBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSb_EquipRepairWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSb_EquipRepairWorkBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板璁惧缁翠慨瀛愯〃鐨刯son + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSb_EquipRepairWorkBillSub> getObjectByJson_Gy_EquipRepairWorkBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSb_EquipRepairWorkBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSb_EquipRepairWorkBillSub>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板璁惧缁翠慨楠屾敹鍗曚富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSb_EquipRepairCheckBillMain> getObjectByJson_Gy_EquipRepairCheckBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSb_EquipRepairCheckBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipRepairCheckBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板璁惧缁翠慨楠屾敹鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSb_EquipRepairCheckBillSub> getObjectByJson_Gy_EquipRepairCheckBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSb_EquipRepairCheckBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipRepairCheckBillSub>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板璁惧鏁呴殰鐧昏鍗曚富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSb_EquipConkBookBillMain> getObjectByJson_Gy_EquipConkBookBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSb_EquipConkBookBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipConkBookBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板璁惧鏁呴殰鐧昏鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSb_EquipConkBookBillSub> getObjectByJson_Gy_EquipConkBookBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSb_EquipConkBookBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipConkBookBillSub>>(jsonString); + return list; + } + + /// <summary> + /// 璁惧鐐规璁″垝 涓昏〃 + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + // ClsSb_EquipDotCheckPlanBillMain + public List<Model.ClsSb_EquipDotCheckPlanBillMain> getObjectByJson_Sb_EquipDotCheckPlanBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSb_EquipDotCheckPlanBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipDotCheckPlanBillMain>>(jsonString); + return list; + } + /// <summary> + /// 璁惧鐐规璁″垝 瀛愯〃 + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + // ClsSb_EquipDotCheckPlanBillSub + public List<Model.ClsSb_EquipDotCheckPlanBillSub> getObjectByJson_Sb_EquipDotCheckPlanBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSb_EquipDotCheckPlanBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipDotCheckPlanBillSub>>(jsonString); + return list; + } + + + + /// <summary> + /// 澶勭悊鏂板妯″叿鎶ュ簾鍏ュ簱鍗曚富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSc_MouldStockBillMain> getObjectByJson_Gy_MouldScrapInHouseBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSc_MouldStockBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSc_MouldStockBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板妯″叿鎶ュ簾鍏ュ簱鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSc_MouldStockBillSub> getObjectByJson_Gy_MouldScrapInHouseBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSc_MouldStockBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSc_MouldStockBillSub>>(jsonString); + return list; + } + + ///璁惧鐐规璁板綍琛� 涓昏〃 + ///ClsSb_EquipDotCheckBillMain + public List<Model.ClsSb_EquipDotCheckBillMain> getObjectByJson_Sb_EquipDotCheckBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSb_EquipDotCheckBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipDotCheckBillMain>>(jsonString); + return list; + } + ///璁惧鐐规璁板綍琛� 瀛愯〃 + ///ClsSb_EquipDotCheckBillSub + public List<Model.ClsSb_EquipDotCheckBillSub> getObjectByJson_Sb_EquipDotCheckBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSb_EquipDotCheckBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipDotCheckBillSub>>(jsonString); + return list; + } + + /// <summary> + /// 璁惧淇濆吇璁″垝 涓昏〃 + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSb_EquipMaintainPlanBillMain> getObjectByJson_Sb_EquipMaintainPlanBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSb_EquipMaintainPlanBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipMaintainPlanBillMain>>(jsonString); + return list; + } + + /// <summary> + /// 璁惧淇濆吇璁″垝 瀛愯〃 + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSb_EquipMaintainPlanBillSub> getObjectByJson_Sb_EquipMaintainPlanBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSb_EquipMaintainPlanBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipMaintainPlanBillSub>>(jsonString); + return list; + } + + /// <summary> + /// 璁惧淇濆吇璁板綍 涓昏〃 + /// ClsSb_EquipMaintainBillMain + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSb_EquipMaintainBillMain> getObjectByJson_Sb_EquipMaintainBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSb_EquipMaintainBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipMaintainBillMain>>(jsonString); + return list; + } + + /// <summary> + /// 璁惧淇濆吇璁板綍 瀛愯〃 + /// ClsSb_EquipMaintainBillSub + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSb_EquipMaintainBillSub> getObjectByJson_Sb_EquipMaintainBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSb_EquipMaintainBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSb_EquipMaintainBillSub>>(jsonString); + return list; + } + + + /// <summary> + /// 妯℃不鍏峰叾浠栧嚭搴撳崟 涓昏〃 + /// ClsSb_EquipMaintainBillMain + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldStockBillMain> getObjectByJson_Sc_MouldStockBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldStockBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillMain>>(jsonString); + return list; + } + + /// <summary> + /// 妯℃不鍏峰叾浠栧嚭搴撳崟 瀛愯〃 + /// ClsSb_EquipMaintainBillSub + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldStockBillSub> getObjectByJson_Sc_MouldStockBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldStockBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板妯″叿澶勭悊鍑哄簱鍗曚富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldStockBillMain> getObjectByJson_Gy_MouldScrapOutHouseBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldStockBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板妯″叿澶勭悊鍑哄簱鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldStockBillSub> getObjectByJson_Gy_MouldScrapOutHouseBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldStockBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板妯″叿閫�搴撳崟涓昏〃鐨刯son + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldProdBackBillMain> getObjectByJson_Gy_MouldProdBackBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldProdBackBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldProdBackBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板妯″叿閫�搴撳崟瀛愯〃鐨刯son + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldProdBackBillSub> getObjectByJson_Gy_MouldProdBackBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldProdBackBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldProdBackBillSub>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板妯″叿棰嗙敤鍗曚富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldProdOutBillMain> getObjectByJson_Gy_MouldProdOutBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldProdOutBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldProdOutBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板妯″叿棰嗙敤鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldStockBillSub> getObjectByJson_Gy_MouldStockBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldStockBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldStockBillSub>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板妯″叿瀵垮懡璋冩暣鍗曚富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldLifeChangeBillMain> getObjectByJson_Gy_MouldLifeChangeBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldLifeChangeBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldLifeChangeBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板妯″叿瀵垮懡璋冩暣鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MouldLifeChangeBillSub> getObjectByJson_Gy_MouldLifeChangeBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MouldLifeChangeBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldLifeChangeBillSub>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板鐢熶骇姹囨姤鍗曞崟涓昏〃鐨刯son + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_ICMOReportBillMain> getObjectByJson_Gy_ICMOReportBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_ICMOReportBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_ICMOReportBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板鐢熶骇姹囨姤鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_ICMOReportBillSub> getObjectByJson_Gy_ICMOReportBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_ICMOReportBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_ICMOReportBillSub>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板鐢熶骇寮�宸ュ崟鐨刯son + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MESBeginWorkBillMain> getObjectByJson_Gy_MESBeginWorkBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MESBeginWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MESBeginWorkBillMain>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板鐢熶骇瀹屽伐鍗曠殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MESEndWorkBillMain> getObjectByJson_Gy_MESEndWorkBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MESEndWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MESEndWorkBillMain>>(jsonString); + return list; + } + + /// <summary> + /// 澶勭悊鏂板鐢熶骇鍋滃伐鍗曠殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Model.ClsSc_MESStopWorkBillMain> getObjectByJson_Gy_MESStopWorkBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Model.ClsSc_MESStopWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MESStopWorkBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板鐐规璁板綍琛ㄥ崟琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSc_MouldDotCheckBillMain> getObjectByJson_Gy_MoudlCheckBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSc_MouldDotCheckBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSc_MouldDotCheckBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板鐐规璁板綍鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSc_MouldDotCheckBillSub> getObjectByJson_Gy_MouldDotCheckBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSc_MouldDotCheckBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSc_MouldDotCheckBillSub>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板淇濆吇璁板綍琛ㄥ崟琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSc_MouldMaintainBillMain> getObjectByJson_Gy_MouldMaintainBillMain(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSc_MouldMaintainBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSc_MouldMaintainBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// 澶勭悊鏂板淇濆吇璁板綍鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSc_MouldMaintainBillSub> getObjectByJson_Gy_MouldMaintainBillSub(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSc_MouldMaintainBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSc_MouldMaintainBillSub>>(jsonString); + return list; + } + + /// <summary> + /// PDA澶勭悊鏂板璁惧鐐规璁板綍鍗曚富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSb_EquipDotCheckBillMain> getObjectByJson_Sb_EquipDotCheckBillMainPDA(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSb_EquipDotCheckBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSb_EquipDotCheckBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// PDA澶勭悊鏂板璁惧鐐规璁板綍鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSb_EquipDotCheckBillSub> getObjectByJson_Sb_EquipDotCheckBillSubPDA(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSb_EquipDotCheckBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSb_EquipDotCheckBillSub>>(jsonString); + return list; + } + + /// <summary> + /// PDA澶勭悊鏂板璁惧淇濆吇璁板綍鍗曚富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSb_EquipMaintainBillMain> getObjectByJson_Sb_EquipMaintainBillMainPDA(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSb_EquipMaintainBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSb_EquipMaintainBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// PDA澶勭悊鏂板璁惧淇濆吇璁板綍鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSb_EquipMaintainBillSub> getObjectByJson_Sb_EquipMaintainBillSubPDA(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSb_EquipMaintainBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSb_EquipMaintainBillSub>>(jsonString); + return list; + } + + /// <summary> + /// PDA澶勭悊鏂板璁惧缁翠慨鍗曚富琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSb_EquipRepairWorkBillMain> getObjectByJson_Sb_EqpRepairWorkBillMainPDA(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSb_EquipRepairWorkBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSb_EquipRepairWorkBillMain>>(jsonString); + return list; + } + + + /// <summary> + /// PDA澶勭悊鏂板璁惧缁翠慨鍗曞瓙琛ㄧ殑json + /// </summary> + /// <param name="jsonString"></param> + /// <returns></returns> + public List<Models.ClsSb_EquipRepairWorkBillSub> getObjectByJson_Sb_EquipRepairWorkBillSubPDA(string jsonString) + { + jsonString = "[" + jsonString.ToString() + "]"; + List<Models.ClsSb_EquipRepairWorkBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsSb_EquipRepairWorkBillSub>>(jsonString); + return list; + } /// <summary> /// 澶勭悊鏂板妯″叿鍏ュ簱鍗曚富琛ㄧ殑json @@ -484,4 +1206,4 @@ } } -} \ No newline at end of file +} \ No newline at end of file diff --git a/WebAPI/Models/CheckItem.cs b/WebAPI/Models/CheckItem.cs new file mode 100644 index 0000000..afb9aaf --- /dev/null +++ b/WebAPI/Models/CheckItem.cs @@ -0,0 +1,30 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class CheckItem + { + public long HItemID { get; set; } //ID + public string HNumber { get; set; } //浠g爜 + public string HName { get; set; } //鍚嶇О + public string HShortNumber { get; set; } //鐭唬鐮� + public long HParentID { get; set; } //鐖剁骇ID + public long HLevel { get; set; } //灞傜骇 + public long HEndFlag { get; set; } // + + public string HHelpCode { get; set; } // 鍔╄鐮� + + public string HRemark { get; set; } //澶囨敞 + + public bool HStopflag { get; set; } //绂佺敤鏍囧織 + + public bool HUseFlag { get; set; } //浣跨敤鐘舵�� + + public long HQCCheckClassID { get; set; } //妫�楠岄」鐩被鍒獻D + + public string HQCCheckClassName { get; set; }//妫�楠岄」鐩被鍒� + } +} \ No newline at end of file diff --git a/WebAPI/Models/ClsSb_EquipDotCheckBillMain.cs b/WebAPI/Models/ClsSb_EquipDotCheckBillMain.cs new file mode 100644 index 0000000..5ea2dc6 --- /dev/null +++ b/WebAPI/Models/ClsSb_EquipDotCheckBillMain.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebAPI.Models +{ + public class ClsSb_EquipDotCheckBillMain:DBUtility.ClsXt_BaseBillMain + { + public Int64 HEquipID; + public DateTime HBeginDate; + public DateTime HEndDate; + public string HPlanNo; + public string HExplanation; + public string HInnerBillNo; + public long HDeptID;// int --部门ID + + } +} diff --git a/WebAPI/Models/ClsSb_EquipDotCheckBillSub.cs b/WebAPI/Models/ClsSb_EquipDotCheckBillSub.cs new file mode 100644 index 0000000..0fa8434 --- /dev/null +++ b/WebAPI/Models/ClsSb_EquipDotCheckBillSub.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebAPI.Models +{ + public class ClsSb_EquipDotCheckBillSub:DBUtility.ClsXt_BaseBillSub + { + + public string HRemark; + public string HCloseMan; + public DateTime HEntryCloseDate; + public bool HCloseType; + // + public Int64 HMaterID; + public string HMaterNumber; + public string HMaterName; + public string HMaterModel; + public string HDotCheckItem; + public string HDotCheckPart; + public string HClaim; + public Int64 HUnitID; + public string HUnitNumber; + public string HUnitName; + public Int64 HManagerID; + public string HManagerNumber; + public string HManagerName; + + } +} diff --git a/WebAPI/Models/ClsSb_EquipMaintainBillMain.cs b/WebAPI/Models/ClsSb_EquipMaintainBillMain.cs new file mode 100644 index 0000000..e501744 --- /dev/null +++ b/WebAPI/Models/ClsSb_EquipMaintainBillMain.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebAPI.Models +{ + public class ClsSb_EquipMaintainBillMain:DBUtility.ClsXt_BaseBillMain + { + public Int64 HEquipID; + public DateTime HBeginDate; + public DateTime HEndDate; + public string HPlanNo; + public string HExplanation; + public string HInnerBillNo; + public long HDeptID;// int --部门ID + + } +} diff --git a/WebAPI/Models/ClsSb_EquipMaintainBillSub.cs b/WebAPI/Models/ClsSb_EquipMaintainBillSub.cs new file mode 100644 index 0000000..c551f41 --- /dev/null +++ b/WebAPI/Models/ClsSb_EquipMaintainBillSub.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebAPI.Models +{ + public class ClsSb_EquipMaintainBillSub:DBUtility.ClsXt_BaseBillSub + { + + public string HRemark; + public string HCloseMan; + public DateTime HEntryCloseDate; + public bool HCloseType; + + public long HMaintainItemID; // --保养项目ID + public string HMaintainItem; //--保养项目 + public string HMaintainPart; // --保养部位 + public string HClaim; //要求 + + // + public Int64 HMaterID; + public string HMaterNumber; + public string HMaterName; + public string HMaterModel; + public double HQty; + public double HQtyMust; + public Int64 HUnitID; + public string HUnitNumber; + public string HUnitName; + public Int64 HManagerID; + public string HManagerNumber; + public string HManagerName; + + } +} diff --git a/WebAPI/Models/ClsSb_EquipRepairWorkBillMain.cs b/WebAPI/Models/ClsSb_EquipRepairWorkBillMain.cs new file mode 100644 index 0000000..9e4fc2f --- /dev/null +++ b/WebAPI/Models/ClsSb_EquipRepairWorkBillMain.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebAPI.Models +{ + public class ClsSb_EquipRepairWorkBillMain : DBUtility.ClsXt_BaseBillMain + { + + public Int64 HEmpID;// int --维修人 + public Int64 HManagerID;// int --负责人 + public Int64 HSecManagerID;// int --验收 + public Int64 HDeptID;// int --维修部门 + public string HExplanation;// varchar(200) --维修要求 + public string HInnerBillNo;// varchar(50) --内部单据号 + public string HRemark; //加工要求 + + public Int64 HEquipID;// int --设备ID(Gy_EquipMent) + public Int64 HRepairID;//int --维修项目(Gy_Repair) + public DateTime HRepairBeginDate;// datetime --维修开始日期 + public DateTime HRepairEndDate;//datetime --维修结束日期 + public string HRepairContent;//varchar(500) --维修内容 + public string HCycleUnit;//varchar(10) --时间单位(小时,天) + public Single HPlanTimes;// money --计划维修工时 + public Single HTimes;// money --实际维修工时 + + } +} diff --git a/WebAPI/Models/ClsSb_EquipRepairWorkBillSub.cs b/WebAPI/Models/ClsSb_EquipRepairWorkBillSub.cs new file mode 100644 index 0000000..cc4855e --- /dev/null +++ b/WebAPI/Models/ClsSb_EquipRepairWorkBillSub.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebAPI.Models +{ + public class ClsSb_EquipRepairWorkBillSub : DBUtility.ClsXt_BaseBillSub + { + public DateTime HEntryCloseDate;// datetime --行关闭 (默认为'') new + public string HRemark;// varchar(200) --备注 + + + public Int64 HRepairID; // int --维修项目 + public Int64 HEmpID; // int --负责人 + public string HRepairExplanation; // varchar(500)维修要求 + + public Int64 HManagerID1; // int --表体负责人ID + public Int64 HRepairID1; // int --表体维修项目ID + } +} diff --git a/WebAPI/Models/ClsSc_MouldDotCheckBillMain.cs b/WebAPI/Models/ClsSc_MouldDotCheckBillMain.cs new file mode 100644 index 0000000..e148916 --- /dev/null +++ b/WebAPI/Models/ClsSc_MouldDotCheckBillMain.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebAPI.Models +{ + public class ClsSc_MouldDotCheckBillMain:DBUtility.ClsXt_BaseBillMain + { + public long HMouldID;// int --产品模具 + public string HPlanNo;// varchar(50) --点检计划编号 + public long HPlanInterID;// int --点检计划内码 + public string HBeginDate;// datetime --点检开始日期 + public string HEndDate;// datetime --点检结束日期 + public string HExplanation;// varchar(500) --摘要 + public string HInnerBillNo;// varchar(50) --内部单据号 + public long HDeptID;// int --部门ID + } +} diff --git a/WebAPI/Models/ClsSc_MouldDotCheckBillSub.cs b/WebAPI/Models/ClsSc_MouldDotCheckBillSub.cs new file mode 100644 index 0000000..67c8964 --- /dev/null +++ b/WebAPI/Models/ClsSc_MouldDotCheckBillSub.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebAPI.Models +{ + public class ClsSc_MouldDotCheckBillSub:DBUtility.ClsXt_BaseBillSub + { + //============ + public string HDotCheckItem;// varchar(100) --点检项目 + public string HDotCheckPart;// varchar(100) --点检部位 + public string HClaim;// varchar(100) --具体要求 + public long HManagerID;// int --负责人id(h_v_IF_Employee) + + } +} diff --git a/WebAPI/Models/ClsSc_MouldMaintainBillMain.cs b/WebAPI/Models/ClsSc_MouldMaintainBillMain.cs new file mode 100644 index 0000000..bff3ec6 --- /dev/null +++ b/WebAPI/Models/ClsSc_MouldMaintainBillMain.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebAPI.Models +{ + public class ClsSc_MouldMaintainBillMain:DBUtility.ClsXt_BaseBillMain + { + + public string HPlanNo;// varchar(50) --保养计划编号 + public long HPlanInterID;// int --保养计划内码 + public long HMouldID;// int --产品模具 + public string HBeginDate;// --保养开始日期 + public string HEndDate;// --保养结束日期 + public string HExplanation;// --摘要 + public string HInnerBillNo;// --内部单据号 + public long HDeptID;// int --部门ID + } +} diff --git a/WebAPI/Models/ClsSc_MouldMaintainBillSub.cs b/WebAPI/Models/ClsSc_MouldMaintainBillSub.cs new file mode 100644 index 0000000..35cdfba --- /dev/null +++ b/WebAPI/Models/ClsSc_MouldMaintainBillSub.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebAPI.Models +{ + public class ClsSc_MouldMaintainBillSub:DBUtility.ClsXt_BaseBillSub + { + //============ + + public long HMaterID;// --配件ID + public long HUnitID;// --计量单位 + public double HQty;// --实际用量 + public double HQtyMust;// --标准用量(暂时隐藏) + + public long HMaintainItemID; // --保养项目ID + public string HMaintainItem; //--保养项目 + public string HMaintainPart; // --保养部位 + + public long HManagerID;// int --负责人id(h_v_IF_Employee) + public string HClaim;// varchar(100) --具体要求 + } +} diff --git a/WebAPI/Models/ClsSc_MouldStockBillMain.cs b/WebAPI/Models/ClsSc_MouldStockBillMain.cs new file mode 100644 index 0000000..876cc28 --- /dev/null +++ b/WebAPI/Models/ClsSc_MouldStockBillMain.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebAPI.Models +{ + public class ClsSc_MouldStockBillMain:DBUtility.ClsXt_BaseBillMain + { + public long HSCWHID;// int --调出仓库ID 界面上不需要显示,存0进去 + public long HSupID;// int --往来单位 界面上不需要显示,存0进去 + public long HEmpID;// int --业务员 界面上不需要显示,存0进去 + public long HManagerID;// int --负责人 界面上不需要显示,存0进去 + public long HWHID;// int --仓库 + public long HSecManagerID;// int --验收员 + public long HKeeperID;// int --保管员 + public long HDeptID;// int --部门 + public string HExplanation;// varchar(500) --摘要 + public string HInnerBillNo;// varchar(50) --内部单据号 + public bool HRedBlueFlag;// bit --红蓝单 + public string HRepairType; + public long HScrapReasonID;//报废原因 + + + + } +} diff --git a/WebAPI/Models/ClsSc_MouldStockBillSub.cs b/WebAPI/Models/ClsSc_MouldStockBillSub.cs new file mode 100644 index 0000000..667c583 --- /dev/null +++ b/WebAPI/Models/ClsSc_MouldStockBillSub.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WebAPI.Models +{ + public class ClsSc_MouldStockBillSub:DBUtility.ClsXt_BaseBillSub + { + //============ + + public long HMaterID;// int --物料ID + public long HPropertyID;// int --辅助属性 + public long HSecUnitID;// int --辅助计量单位 + public Single HSecUnitRate;// money --换算率 + public long HUnitID;// int --计量单位 + public string HBatchNo;// varchar(50) --批次 + public double HQtyMust;// --账存数量 + public double HQtyRel;// --实存数量 + public double HQty;// --盈亏数量 + public double HPrice;// --单价 + public double HMoney;// --盈亏金额 + public double HDesignLife;// money --设计寿命 + public double HLeaveLife;// money --剩余寿命 + public double HUseLife;// money --使用寿命 + public long HWHID;// int --收料仓库 + public long HSCWHID;// int --调出仓库ID 界面上不需要显示,存0进去 + public long HSPID;// int --仓位ID + public long HSCSPID;// int --调出仓位ID 界面上不需要显示,存0进去 + public long HSPGroupID;// int --仓位组ID 界面上不需要显示,存0进去 + public string HBarCode; + public double HUseLifeQty; + public string HNowModel; + public double HNowLife; + public Int64 HMouldType; + public string HInitModel; + public Single HInitDesignLife; + public Int64 HLifeUnitID; + public string HNewModel; + public string HWallThickness; + public string HHardness; + public string HLastProdModel; + public string HDiameter; + public string HBackFlag; + public double HNewLifeQty; + + public Int64 HPOOrderInterID;// int --采购订单主内码 + public Int64 HPOOrderEntryID;// int --采购订单子内码 + public string HPOOrderBillNo;// varchar(50) --采购订单号 + public Int64 HSeOrderInterID;// int --销售订单主内码 + public Int64 HSeOrderEntryID;// int --销售订单子内码 + public string HSeOrderBillNo;// varchar(50) --销售订单号 + } +} diff --git a/WebAPI/Models/Gy_Group.cs b/WebAPI/Models/Gy_Group.cs new file mode 100644 index 0000000..7f3f1ea --- /dev/null +++ b/WebAPI/Models/Gy_Group.cs @@ -0,0 +1,27 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class Gy_Group + { + public long HItemID { get; set; } + public string HNumber { get; set; } // 浠g爜 + public string HName { get; set; } // + public string HHelpCode { get; set; } //鍔╄鐮� + public string HShortNumber { get; set; } //鐭唬鐮� + public string HEndFlag { get; set; } //鏈骇鏍囧織 + public string HStopflag { get; set; } //绂佺敤鏍囧織 + public string HRemark { get; set; } //澶囨敞 + public string HUseFlag { get; set; } //浣跨敤鏍囧織 + public long HParentID { get; set; } //鐖剁骇ID + public long HDeptID { get; set; } + public long HEmpQty { get; set; } + public long HProcID { get; set; } + + public string HBarCodeForBase { get; set; } + + } +} \ No newline at end of file diff --git a/WebAPI/Models/Gy_WorkCenter.cs b/WebAPI/Models/Gy_WorkCenter.cs new file mode 100644 index 0000000..37731a1 --- /dev/null +++ b/WebAPI/Models/Gy_WorkCenter.cs @@ -0,0 +1,29 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class Gy_WorkCenter + { + public long HItemID { get; set; } + public string HNumber { get; set; } // 浠g爜 + public string HName { get; set; } // + public string HHelpCode { get; set; } //鍔╄鐮� + public string HShortNumber { get; set; } //鐭唬鐮� + public string HEndFlag { get; set; } //鏈骇鏍囧織 + public string HStopflag { get; set; } //绂佺敤鏍囧織 + public string HRemark { get; set; } //澶囨敞 + public string HUseFlag { get; set; } //浣跨敤鏍囧織 + public long HParentID { get; set; } //鐖剁骇ID + public long HDeptID { get; set; } + public long HWorkTimes { get; set; } + public long HQty { get; set; } + public long HProcID { get; set; } + public long HDayMoney { get; set; } + + public string HBarCodeForBase { get; set; } + + } +} \ No newline at end of file diff --git a/WebAPI/Models/MaintenanceAcceptItem.cs b/WebAPI/Models/MaintenanceAcceptItem.cs new file mode 100644 index 0000000..f66834b --- /dev/null +++ b/WebAPI/Models/MaintenanceAcceptItem.cs @@ -0,0 +1,26 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class MaintenanceAcceptItem + { + public long HItemID { get; set; } + public string HNumber { get; set; } //缁翠慨楠屾敹椤圭洰浠g爜 + public string HName { get; set; } //缁翠慨楠屾敹椤圭洰 + public string HHelpCode { get; set; } //鍔╄鐮� + public string HShortNumber { get; set; } //鐭唬鐮� + public string HEndFlag { get; set; } //鏈骇鏍囧織 + public string HStopflag { get; set; } //绂佺敤鏍囧織 + public string HRemark { get; set; } //澶囨敞 + public string HUseFlag { get; set; } //浣跨敤鏍囧織 + public long HParentID { get; set; } //鐖剁骇ID + + + + + + } +} \ No newline at end of file diff --git a/WebAPI/Models/MaintenanceMode.cs b/WebAPI/Models/MaintenanceMode.cs new file mode 100644 index 0000000..2f64bad --- /dev/null +++ b/WebAPI/Models/MaintenanceMode.cs @@ -0,0 +1,26 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class MaintenanceMode + { + public long HItemID { get; set; } + public string HNumber { get; set; } + public string HName { get; set; } + public string HShortNumber { get; set; } + public long HParentID { get; set; } + + public string HHelpCode { get; set; } + + public string HRemark { get; set; } + + public string HStopflag { get; set; } + + public string HUseFlag { get; set; } + + + } +} \ No newline at end of file diff --git a/WebAPI/Models/StationBill.cs b/WebAPI/Models/StationBill.cs index cb61e50..ca50c72 100644 --- a/WebAPI/Models/StationBill.cs +++ b/WebAPI/Models/StationBill.cs @@ -33,7 +33,7 @@ public double HMoney { get; set; } public string HRemark { get; set; } public double HTaxRate { get; set; } - public string HProcNo { get; set; } + public long HProcNo { get; set; } public string HOrderProcNO { get; set; } public long HWWWorkOrderInterID { get; set; } public long HWWWorkOrderEntryID { get; set; } @@ -68,7 +68,10 @@ public double HPriceRate { get; set; } public double HWorkTimes { get; set; } public long HQCCheckID { get; set; } + public long HProcPlanInterID { get; set; } + public long HProcPlanEntryID { get; set; } + public string eventType { get; set; } } } \ No newline at end of file diff --git "a/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Warehouse.cs" "b/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Warehouse.cs" new file mode 100644 index 0000000..813b237 --- /dev/null +++ "b/WebAPI/Models/\345\237\272\347\241\200\350\265\204\346\226\231/Warehouse.cs" @@ -0,0 +1,33 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class Warehouse + { + public bool HEndFlag { get; set; } + public string HHelpCode { get; set; } + public long HItemID { get; set; } + public long HLevel { get; set; } + public string HName { get; set; } + public string HNumber { get; set; } + public long HParentID { get; set; } + public string HRemark { get; set; } + public string HShortNumber { get; set; } + public bool HStopflag { get; set; } + public string HUseFlag { get; set; } + public Int64 HEmpID { get; set; } + public string HAddress { get; set; } + public string HPhone { get; set; } + public bool HIsStockMgr { get; set; } + public Int64 HSPGroupID { get; set; } + public string HBarCode { get; set; } + public Int64 HUSEORGID { get; set; } + public string HMaker { get; set; } + public string HUpDater { get; set; } + + + } +} \ No newline at end of file diff --git a/WebAPI/Properties/PublishProfiles/API.pubxml b/WebAPI/Properties/PublishProfiles/API.pubxml deleted file mode 100644 index 515a6ab..0000000 --- a/WebAPI/Properties/PublishProfiles/API.pubxml +++ /dev/null @@ -1,17 +0,0 @@ -锘�<?xml version="1.0" encoding="utf-8"?> -<!-- -鎮� Web 椤圭洰鐨勫彂甯�/鎵撳寘杩涚▼灏嗕娇鐢ㄦ鏂囦欢銆傛偍鍙互閫氳繃缂栬緫姝� MSBuild 鏂囦欢 -鏉ヨ嚜瀹氫箟璇ヨ繘绋嬬殑琛屼负銆傝嫢瑕佷簡瑙d笌姝ょ浉鍏崇殑璇︾粏淇℃伅锛岃璁块棶 http://go.microsoft.com/fwlink/?LinkID=208121銆� ---> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <WebPublishMethod>FileSystem</WebPublishMethod> - <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration> - <LastUsedPlatform>x86</LastUsedPlatform> - <SiteUrlToLaunchAfterPublish /> - <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> - <ExcludeApp_Data>False</ExcludeApp_Data> - <publishUrl>D:\缃戠珯鍙戝竷\鏅轰簯MESWMS\API</publishUrl> - <DeleteExistingFiles>True</DeleteExistingFiles> - </PropertyGroup> -</Project> \ No newline at end of file diff --git a/WebAPI/Properties/PublishProfiles/API.pubxml.user b/WebAPI/Properties/PublishProfiles/API.pubxml.user index adb13e9..f1ac8a5 100644 --- a/WebAPI/Properties/PublishProfiles/API.pubxml.user +++ b/WebAPI/Properties/PublishProfiles/API.pubxml.user @@ -7,12 +7,12 @@ <PropertyGroup> <TimeStampOfAssociatedLegacyPublishXmlFile /> <_PublishTargetUrl>D:\缃戠珯鍙戝竷\鏅轰簯MESWMS\API</_PublishTargetUrl> - <History>True|2021-05-23T15:05:37.3855541Z;True|2021-05-22T05:45:13.7439233+08:00;True|2021-05-22T05:42:35.4852011+08:00;True|2021-05-22T05:25:16.8821260+08:00;True|2021-05-21T15:58:20.5625475+08:00;True|2021-05-21T15:55:21.1943961+08:00;True|2021-05-21T15:53:35.6852027+08:00;True|2021-05-21T15:46:56.7370418+08:00;True|2021-05-21T15:32:49.2494690+08:00;True|2021-05-21T15:19:19.8145510+08:00;True|2021-05-21T10:16:44.9563480+08:00;True|2021-05-20T19:21:19.8572280+08:00;True|2021-05-20T19:15:57.2506092+08:00;True|2021-05-20T15:58:09.0123323+08:00;True|2021-05-20T15:54:54.6251445+08:00;True|2021-05-20T15:32:04.9783034+08:00;True|2021-05-20T15:31:58.9418248+08:00;True|2021-05-20T15:31:53.2904235+08:00;True|2021-05-20T15:31:48.5385850+08:00;True|2021-05-20T13:31:35.5777988+08:00;True|2021-05-20T10:46:01.6559203+08:00;True|2021-05-20T10:40:53.2131788+08:00;True|2021-05-20T08:58:49.3511837+08:00;True|2021-05-19T16:15:22.7730518+08:00;True|2021-05-19T16:13:03.2756422+08:00;True|2021-05-19T16:11:16.3163692+08:00;True|2021-05-19T15:31:19.7575868+08:00;True|2021-05-19T14:49:47.6104541+08:00;True|2021-05-19T10:46:17.6515193+08:00;True|2021-05-19T10:45:23.6466498+08:00;True|2021-05-18T17:19:36.9591198+08:00;True|2021-05-18T17:16:38.1513255+08:00;True|2021-05-18T10:31:35.2246444+08:00;True|2021-05-17T16:36:00.1226059+08:00;True|2021-05-17T16:31:05.1414358+08:00;True|2021-05-17T16:22:57.4215158+08:00;True|2021-05-17T16:22:52.6941933+08:00;True|2021-05-17T16:22:49.0033372+08:00;True|2021-05-17T16:18:03.8629751+08:00;True|2021-05-17T15:50:27.6196340+08:00;True|2021-05-17T13:22:15.7308548+08:00;True|2021-05-12T09:19:36.0666124+08:00;True|2021-05-12T09:17:40.0887602+08:00;True|2021-05-12T09:06:24.5508601+08:00;True|2021-05-12T08:39:56.6657894+08:00;True|2021-05-11T17:42:28.6508833+08:00;True|2021-05-11T15:22:03.4937062+08:00;True|2021-05-10T16:45:56.1282466+08:00;True|2021-05-08T19:04:07.1084339+08:00;True|2021-05-08T18:04:40.2166839+08:00;True|2021-05-08T18:04:32.5635574+08:00;True|2021-05-08T18:01:24.5206432+08:00;True|2021-05-08T17:38:05.5582200+08:00;True|2021-05-08T15:26:55.2861241+08:00;True|2021-05-08T14:52:13.1682476+08:00;True|2021-05-08T14:50:30.5356438+08:00;True|2021-05-08T14:38:40.3445313+08:00;True|2021-05-08T14:38:37.9504757+08:00;True|2021-05-08T14:30:31.9762236+08:00;True|2021-05-08T14:21:37.4496495+08:00;True|2021-05-07T20:47:46.1401919+08:00;True|2021-05-07T20:31:45.7777162+08:00;True|2021-05-07T20:31:35.2882424+08:00;True|2021-05-07T20:31:21.5616729+08:00;False|2021-05-07T20:29:33.8855457+08:00;False|2021-05-07T20:28:43.1845420+08:00;False|2021-05-07T20:28:13.1335411+08:00;True|2021-05-07T20:10:01.7346568+08:00;True|2021-05-07T20:03:17.0005596+08:00;True|2021-05-07T09:05:04.3102029+08:00;True|2021-05-06T18:11:36.9078607+08:00;True|2021-05-06T18:08:40.5403791+08:00;True|2021-05-06T18:07:04.1929681+08:00;True|2021-05-06T18:06:54.5987264+08:00;True|2021-05-06T18:05:46.1791578+08:00;True|2021-05-06T17:18:58.8131464+08:00;True|2021-05-06T17:18:37.9969968+08:00;True|2021-05-06T14:47:33.5704679+08:00;True|2021-05-06T10:03:28.7226576+08:00;True|2021-04-28T10:18:54.1336497+08:00;True|2021-04-27T16:34:19.0789205+08:00;True|2021-04-27T14:48:28.8138232+08:00;True|2021-04-27T10:34:03.6370089+08:00;True|2021-04-26T16:18:32.0260755+08:00;True|2021-04-26T15:00:58.6773071+08:00;True|2021-04-26T13:23:50.3968646+08:00;True|2021-04-16T08:50:41.5499248+08:00;True|2021-04-16T08:32:59.1701708+08:00;True|2021-04-16T08:27:36.9176335+08:00;True|2021-04-15T15:56:26.8485667+08:00;True|2021-04-15T15:21:23.2875671+08:00;True|2021-04-15T14:41:16.9980034+08:00;True|2021-04-15T14:36:34.8570017+08:00;True|2021-04-13T16:15:00.7668503+08:00;</History> + <History>True|2021-06-07T06:44:12.1915959Z;True|2021-06-04T15:58:32.1394491+08:00;True|2021-06-03T14:45:45.5738204+08:00;True|2021-06-01T21:40:14.5889898+08:00;True|2021-06-01T10:45:03.3856917+08:00;True|2021-05-31T19:02:46.8042092+08:00;True|2021-05-31T18:47:52.0278748+08:00;True|2021-05-31T18:42:39.2743903+08:00;True|2021-05-31T17:42:32.1696215+08:00;True|2021-05-31T17:34:46.2817423+08:00;True|2021-05-31T17:24:43.0246592+08:00;True|2021-05-31T16:46:12.3040179+08:00;True|2021-05-31T14:53:09.9410043+08:00;True|2021-05-31T13:02:37.5818554+08:00;True|2021-05-31T12:50:26.7987391+08:00;True|2021-05-28T13:57:14.1993693+08:00;True|2021-05-28T09:42:13.2716745+08:00;True|2021-05-28T09:21:21.7815722+08:00;True|2021-05-28T09:17:59.1409780+08:00;True|2021-05-27T17:47:56.2640274+08:00;True|2021-05-27T14:41:19.9808548+08:00;True|2021-05-27T14:11:40.1924193+08:00;True|2021-05-27T13:37:42.5025517+08:00;True|2021-05-26T16:52:34.3234026+08:00;True|2021-05-26T15:14:15.9395791+08:00;True|2021-05-26T15:04:11.7364402+08:00;True|2021-05-26T14:26:20.5541211+08:00;True|2021-05-26T14:01:41.5357885+08:00;True|2021-05-25T17:51:07.3024087+08:00;True|2021-05-25T17:35:35.9642868+08:00;True|2021-05-25T17:06:01.1192559+08:00;True|2021-05-25T16:52:15.2304370+08:00;True|2021-05-25T16:12:13.5664530+08:00;True|2021-05-25T16:08:27.7007589+08:00;True|2021-05-25T15:58:36.5187538+08:00;True|2021-05-25T15:58:01.0527811+08:00;True|2021-05-25T15:54:45.0576223+08:00;True|2021-05-25T14:18:51.3134586+08:00;True|2021-05-25T11:28:15.6460627+08:00;True|2021-05-25T11:27:17.4884199+08:00;True|2021-05-25T11:26:04.5332872+08:00;True|2021-05-25T09:39:11.8882456+08:00;True|2021-05-23T23:05:37.3855541+08:00;True|2021-05-22T05:45:13.7439233+08:00;True|2021-05-22T05:42:35.4852011+08:00;True|2021-05-22T05:25:16.8821260+08:00;True|2021-05-21T15:58:20.5625475+08:00;True|2021-05-21T15:55:21.1943961+08:00;True|2021-05-21T15:53:35.6852027+08:00;True|2021-05-21T15:46:56.7370418+08:00;True|2021-05-21T15:32:49.2494690+08:00;True|2021-05-21T15:19:19.8145510+08:00;True|2021-05-21T10:16:44.9563480+08:00;True|2021-05-20T19:21:19.8572280+08:00;True|2021-05-20T19:15:57.2506092+08:00;True|2021-05-20T15:58:09.0123323+08:00;True|2021-05-20T15:54:54.6251445+08:00;True|2021-05-20T15:32:04.9783034+08:00;True|2021-05-20T15:31:58.9418248+08:00;True|2021-05-20T15:31:53.2904235+08:00;True|2021-05-20T15:31:48.5385850+08:00;True|2021-05-20T13:31:35.5777988+08:00;True|2021-05-20T10:46:01.6559203+08:00;True|2021-05-20T10:40:53.2131788+08:00;True|2021-05-20T08:58:49.3511837+08:00;True|2021-05-19T16:15:22.7730518+08:00;True|2021-05-19T16:13:03.2756422+08:00;True|2021-05-19T16:11:16.3163692+08:00;True|2021-05-19T15:31:19.7575868+08:00;True|2021-05-19T14:49:47.6104541+08:00;True|2021-05-19T10:46:17.6515193+08:00;True|2021-05-19T10:45:23.6466498+08:00;True|2021-05-18T17:19:36.9591198+08:00;True|2021-05-18T17:16:38.1513255+08:00;True|2021-05-18T10:31:35.2246444+08:00;True|2021-05-17T16:36:00.1226059+08:00;True|2021-05-17T16:31:05.1414358+08:00;True|2021-05-17T16:22:57.4215158+08:00;True|2021-05-17T16:22:52.6941933+08:00;True|2021-05-17T16:22:49.0033372+08:00;True|2021-05-17T16:18:03.8629751+08:00;True|2021-05-17T15:50:27.6196340+08:00;True|2021-05-17T13:22:15.7308548+08:00;True|2021-05-12T09:19:36.0666124+08:00;True|2021-05-12T09:17:40.0887602+08:00;True|2021-05-12T09:06:24.5508601+08:00;True|2021-05-12T08:39:56.6657894+08:00;True|2021-05-11T17:42:28.6508833+08:00;True|2021-05-11T15:22:03.4937062+08:00;True|2021-05-10T16:45:56.1282466+08:00;True|2021-05-08T19:04:07.1084339+08:00;True|2021-05-08T18:04:40.2166839+08:00;True|2021-05-08T18:04:32.5635574+08:00;True|2021-05-08T18:01:24.5206432+08:00;True|2021-05-08T17:38:05.5582200+08:00;True|2021-05-08T15:26:55.2861241+08:00;True|2021-05-08T14:52:13.1682476+08:00;True|2021-05-08T14:50:30.5356438+08:00;True|2021-05-08T14:38:40.3445313+08:00;True|2021-05-08T14:38:37.9504757+08:00;True|2021-05-08T14:30:31.9762236+08:00;True|2021-05-08T14:21:37.4496495+08:00;True|2021-05-07T20:47:46.1401919+08:00;True|2021-05-07T20:31:45.7777162+08:00;True|2021-05-07T20:31:35.2882424+08:00;True|2021-05-07T20:31:21.5616729+08:00;False|2021-05-07T20:29:33.8855457+08:00;False|2021-05-07T20:28:43.1845420+08:00;False|2021-05-07T20:28:13.1335411+08:00;True|2021-05-07T20:10:01.7346568+08:00;True|2021-05-07T20:03:17.0005596+08:00;True|2021-05-07T09:05:04.3102029+08:00;True|2021-05-06T18:11:36.9078607+08:00;True|2021-05-06T18:08:40.5403791+08:00;True|2021-05-06T18:07:04.1929681+08:00;True|2021-05-06T18:06:54.5987264+08:00;True|2021-05-06T18:05:46.1791578+08:00;True|2021-05-06T17:18:58.8131464+08:00;True|2021-05-06T17:18:37.9969968+08:00;True|2021-05-06T14:47:33.5704679+08:00;True|2021-05-06T10:03:28.7226576+08:00;True|2021-04-28T10:18:54.1336497+08:00;True|2021-04-27T16:34:19.0789205+08:00;True|2021-04-27T14:48:28.8138232+08:00;True|2021-04-27T10:34:03.6370089+08:00;True|2021-04-26T16:18:32.0260755+08:00;True|2021-04-26T15:00:58.6773071+08:00;True|2021-04-26T13:23:50.3968646+08:00;True|2021-04-16T08:50:41.5499248+08:00;True|2021-04-16T08:32:59.1701708+08:00;True|2021-04-16T08:27:36.9176335+08:00;True|2021-04-15T15:56:26.8485667+08:00;True|2021-04-15T15:21:23.2875671+08:00;True|2021-04-15T14:41:16.9980034+08:00;True|2021-04-15T14:36:34.8570017+08:00;True|2021-04-13T16:15:00.7668503+08:00;</History> </PropertyGroup> <ItemGroup> <File Include="apiapp.json"> <publishTime>04/12/2021 11:33:15</publishTime> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="bin/Antlr3.Runtime.dll"> <publishTime>02/22/2013 08:43:40</publishTime> @@ -27,25 +27,25 @@ <publishTime>05/07/2021 20:31:20</publishTime> </File> <File Include="bin/BLL.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="bin/DAL.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="bin/Dapper.dll"> <publishTime>07/22/2016 14:52:40</publishTime> </File> <File Include="bin/DBUtility.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="bin/Kingdee.BOS.WebApi.Client.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="bin/Kingdee.BOS.WebApi.FormService.dll"> - <publishTime>09/20/2018 19:23:20</publishTime> + <publishTime>04/26/2020 09:57:16</publishTime> </File> <File Include="bin/Kingdee.BOS.WebApi.ServicesStub.dll"> - <publishTime>09/20/2018 19:28:34</publishTime> + <publishTime>04/26/2020 09:57:16</publishTime> </File> <File Include="bin/Microsoft.Azure.AppService.ApiApps.Service.dll"> <publishTime>03/18/2015 17:02:50</publishTime> @@ -57,7 +57,7 @@ <publishTime>07/25/2012 11:48:56</publishTime> </File> <File Include="bin/Model.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>06/02/2021 13:19:20</publishTime> </File> <File Include="bin/Newtonsoft.Json.dll"> <publishTime>08/03/2014 20:33:56</publishTime> @@ -66,13 +66,13 @@ <publishTime>01/04/2011 13:48:18</publishTime> </File> <File Include="bin/Pub_Class.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="bin/Pub_Control.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="bin/SQLHelper.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="bin/Swashbuckle.Core.dll"> <publishTime>02/15/2015 17:57:08</publishTime> @@ -138,7 +138,7 @@ <publishTime>11/28/2018 13:01:00</publishTime> </File> <File Include="bin/System.Web.Http.WebHost.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="bin/System.Web.Mvc.dll"> <publishTime>01/28/2015 04:02:18</publishTime> @@ -171,10 +171,10 @@ <publishTime>11/24/2014 11:18:48</publishTime> </File> <File Include="bin/WebAPI.dll"> - <publishTime>06/09/2021 17:28:29</publishTime> + <publishTime>06/02/2021 20:00:43</publishTime> </File> <File Include="bin/WebAPI.pdb"> - <publishTime>06/09/2021 17:28:29</publishTime> + <publishTime>06/02/2021 20:00:43</publishTime> </File> <File Include="bin/WebAPI.XmlSerializers.dll"> <publishTime>02/04/2021 21:35:21</publishTime> @@ -192,166 +192,166 @@ <publishTime>03/26/2019 14:23:20</publishTime> </File> <File Include="Content/bootstrap.css"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="Content/bootstrap.min.css"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="Content/Site.css"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="DLL/BLL.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="DLL/DAL.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="DLL/DBUtility.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="DLL/Kingdee.BOS.WebApi.Client.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="DLL/Model.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>06/02/2021 13:19:20</publishTime> </File> <File Include="DLL/Newtonsoft.Json.Net35.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="DLL/Pub_Class.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="DLL/Pub_Control.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="DLL/SQLHelper.dll"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="fonts/glyphicons-halflings-regular.eot"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="fonts/glyphicons-halflings-regular.svg"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="fonts/glyphicons-halflings-regular.ttf"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="fonts/glyphicons-halflings-regular.woff"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Global.asax"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="Index.html"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="Metadata/deploymentTemplates/apiappconfig.azureresource.json"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:15</publishTime> </File> <File Include="packages.config"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="PrecompiledApp.config"> <publishTime>05/07/2021 20:31:19</publishTime> </File> <File Include="Views/Scripts/bootstrap.js"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Views/Scripts/bootstrap.min.js"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Views/Scripts/jquery-1.10.2.js"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Views/Scripts/jquery-1.10.2.min.js"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Views/Scripts/jquery-1.10.2.min.map"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Views/Scripts/jquery.validate.js"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Views/Scripts/jquery.validate.min.js"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Views/Scripts/jquery.validate.unobtrusive.js"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Views/Scripts/jquery.validate.unobtrusive.min.js"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Views/Scripts/modernizr-2.6.2.js"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Views/Shared/Error.cshtml"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Views/Shared/_Layout.cshtml"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Views/web.config"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Views/_ViewStart.cshtml"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsCLD_Customer_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsCLD_Department_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsCLD_Employee_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsCLD_StockPlace_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsCLD_Supplier_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsCLD_Warehouse_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsGy_BadReason_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsGy_BarCodeBill_WMS_Model_View.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsGy_Customer_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsGy_Department_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsGy_Employee_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsGy_Group_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsGy_Item30JiTai_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsGy_Source_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsGy_StockPlace_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsGy_Supplier_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsGy_Warehouse_Model.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web References/WebS/ClsKf_ICStockBill_WMS.datasource"> - <publishTime>05/10/2021 09:27:02</publishTime> + <publishTime>05/25/2021 14:18:16</publishTime> </File> <File Include="Web.config"> - <publishTime>06/09/2021 17:28:34</publishTime> + <publishTime>06/02/2021 20:00:48</publishTime> </File> </ItemGroup> </Project> \ No newline at end of file diff --git a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml index d16ec41..9250916 100644 --- a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml +++ b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml @@ -4,13 +4,14 @@ --> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> - <DeleteExistingFiles>False</DeleteExistingFiles> + <DeleteExistingFiles>True</DeleteExistingFiles> <ExcludeApp_Data>False</ExcludeApp_Data> <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> - <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> - <LastUsedPlatform>Any CPU</LastUsedPlatform> + <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration> + <LastUsedPlatform>x86</LastUsedPlatform> <PublishProvider>FileSystem</PublishProvider> <PublishUrl>D:\缃戠珯鍙戝竷\鏅轰簯MESWMS\API</PublishUrl> <WebPublishMethod>FileSystem</WebPublishMethod> + <SiteUrlToLaunchAfterPublish /> </PropertyGroup> </Project> \ No newline at end of file diff --git a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user index a32fee2..9151e30 100644 --- a/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -3,4 +3,328 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> -</Project> + <PropertyGroup> + <_PublishTargetUrl>D:\缃戠珯鍙戝竷\鏅轰簯MESWMS\API</_PublishTargetUrl> + <History>True|2021-06-29T05:55:01.6864637Z;True|2021-06-29T10:38:52.2206472+08:00;True|2021-06-29T10:10:13.1540749+08:00;True|2021-06-28T14:37:56.3853273+08:00;False|2021-06-28T14:36:57.5726124+08:00;True|2021-06-25T14:17:57.5196108+08:00;True|2021-06-25T13:56:38.9522535+08:00;True|2021-06-24T19:38:32.8766933+08:00;True|2021-06-24T18:26:35.6118833+08:00;True|2021-06-24T18:02:52.8136877+08:00;True|2021-06-24T17:48:49.5851948+08:00;True|2021-06-24T17:45:46.7527572+08:00;True|2021-06-24T15:05:20.1592723+08:00;True|2021-06-23T16:18:15.6814625+08:00;True|2021-06-23T16:05:24.6112343+08:00;True|2021-06-23T15:14:08.2489658+08:00;True|2021-06-23T13:52:58.6029788+08:00;True|2021-06-22T16:11:20.4726923+08:00;True|2021-06-22T16:04:53.7231389+08:00;True|2021-06-22T15:50:59.2583262+08:00;True|2021-06-22T15:38:15.3016140+08:00;True|2021-06-22T15:34:42.9185543+08:00;True|2021-06-22T15:21:55.1419108+08:00;True|2021-06-22T15:07:21.5357494+08:00;True|2021-06-22T15:03:35.0535733+08:00;True|2021-06-22T14:54:47.8802969+08:00;True|2021-06-22T11:19:38.7303011+08:00;True|2021-06-22T08:53:49.2882695+08:00;True|2021-06-22T08:47:54.8286530+08:00;True|2021-06-21T16:27:19.3017700+08:00;True|2021-06-21T15:32:28.7237952+08:00;True|2021-06-21T12:34:02.6329555+08:00;True|2021-06-21T12:24:17.5427495+08:00;True|2021-06-21T10:47:30.6423502+08:00;True|2021-06-21T08:43:20.3026558+08:00;True|2021-06-19T15:10:06.8335499+08:00;True|2021-06-18T15:37:29.5009930+08:00;True|2021-06-18T13:46:35.6283432+08:00;True|2021-06-18T10:00:37.1474954+08:00;True|2021-06-18T09:55:21.8551780+08:00;True|2021-06-18T09:22:27.8432927+08:00;True|2021-06-17T11:17:43.2166430+08:00;True|2021-06-17T09:24:09.8350403+08:00;True|2021-06-16T16:10:47.8564888+08:00;True|2021-06-16T16:04:09.8286582+08:00;True|2021-06-16T15:12:29.9427169+08:00;True|2021-06-16T14:58:45.6801892+08:00;True|2021-06-16T14:46:01.6873221+08:00;True|2021-06-16T11:02:06.1272477+08:00;True|2021-06-16T09:33:56.0223915+08:00;True|2021-06-16T08:50:07.6995413+08:00;True|2021-06-16T08:28:38.7692635+08:00;True|2021-06-16T01:04:19.6282474+08:00;True|2021-06-16T01:03:50.5058323+08:00;False|2021-06-16T01:02:15.3819672+08:00;False|2021-06-16T01:01:38.6171098+08:00;True|2021-06-16T00:34:54.9902044+08:00;True|2021-06-15T23:55:36.2003828+08:00;True|2021-06-15T22:47:17.2192750+08:00;True|2021-06-15T22:42:41.1512585+08:00;True|2021-06-15T22:38:01.7390462+08:00;True|2021-06-15T22:14:11.2060782+08:00;True|2021-06-15T22:12:27.0615357+08:00;True|2021-06-15T22:07:59.9280871+08:00;True|2021-06-15T22:04:21.5051427+08:00;True|2021-06-15T21:25:55.0099814+08:00;True|2021-06-15T19:13:51.3494172+08:00;True|2021-06-15T19:02:17.6844742+08:00;True|2021-06-15T18:47:37.1629411+08:00;False|2021-06-15T18:47:11.0828111+08:00;True|2021-06-15T18:38:26.6620668+08:00;True|2021-06-15T18:33:45.2069831+08:00;True|2021-06-15T18:24:52.0550838+08:00;True|2021-06-15T18:19:43.6999796+08:00;True|2021-06-15T18:08:17.2464506+08:00;True|2021-06-15T18:03:51.3952624+08:00;True|2021-06-15T18:01:20.6141766+08:00;True|2021-06-15T17:59:04.4479416+08:00;True|2021-06-15T17:41:44.6389379+08:00;True|2021-06-15T17:39:03.1565124+08:00;True|2021-06-15T17:34:41.0634638+08:00;True|2021-06-15T17:33:50.4853178+08:00;True|2021-06-15T17:25:38.5914037+08:00;True|2021-06-15T17:22:21.3611360+08:00;True|2021-06-15T17:16:49.4970813+08:00;True|2021-06-15T17:05:28.9389484+08:00;True|2021-06-15T16:52:54.6372199+08:00;True|2021-06-15T16:51:23.9081030+08:00;True|2021-06-15T16:45:40.6017997+08:00;True|2021-06-15T16:41:05.0218887+08:00;True|2021-06-15T16:38:02.8541862+08:00;True|2021-06-15T16:22:10.3118721+08:00;True|2021-06-15T16:12:11.1552506+08:00;True|2021-06-15T15:33:42.0100494+08:00;True|2021-06-15T15:28:39.7145659+08:00;True|2021-06-15T15:15:02.7939125+08:00;True|2021-06-15T14:49:14.2300396+08:00;True|2021-06-15T14:42:28.1198064+08:00;True|2021-06-15T13:30:12.7997686+08:00;True|2021-06-15T13:25:37.7284670+08:00;True|2021-06-15T13:23:43.6207813+08:00;False|2021-06-15T13:23:19.4190232+08:00;True|2021-06-15T13:16:38.5062674+08:00;True|2021-06-15T13:03:31.2055635+08:00;True|2021-06-15T12:58:43.1653215+08:00;True|2021-06-15T12:39:22.8442109+08:00;True|2021-06-15T12:35:09.1288556+08:00;False|2021-06-15T12:33:50.0723143+08:00;True|2021-06-15T11:28:01.9733727+08:00;True|2021-06-15T11:26:26.6569392+08:00;True|2021-06-15T11:22:43.0366435+08:00;True|2021-06-15T11:07:50.1610580+08:00;True|2021-06-15T10:32:59.1925931+08:00;True|2021-06-10T17:16:57.9552310+08:00;True|2021-06-10T16:44:42.2731836+08:00;True|2021-06-10T14:39:27.6745737+08:00;True|2021-06-10T12:15:05.1524413+08:00;True|2021-06-09T18:19:24.1005606+08:00;True|2021-06-09T17:56:09.5646288+08:00;True|2021-06-09T13:34:06.1882292+08:00;True|2021-06-09T13:29:54.5924933+08:00;True|2021-06-09T13:25:55.7520662+08:00;True|2021-06-09T13:07:47.6686811+08:00;True|2021-06-09T12:59:41.2595048+08:00;True|2021-06-09T12:45:27.1305548+08:00;True|2021-06-09T12:29:52.1418191+08:00;True|2021-06-09T12:24:12.7610588+08:00;True|2021-06-09T11:31:25.3409568+08:00;True|2021-06-09T09:57:44.4387175+08:00;True|2021-06-09T09:54:26.5161307+08:00;True|2021-06-09T09:14:14.7288045+08:00;True|2021-06-09T09:10:25.1812139+08:00;True|2021-06-09T08:46:21.6585123+08:00;True|2021-06-08T19:56:55.7192062+08:00;True|2021-06-08T19:52:59.0326821+08:00;True|2021-06-08T19:49:13.6274217+08:00;True|2021-06-08T19:09:22.1038939+08:00;True|2021-06-08T15:28:41.3716247+08:00;True|2021-06-08T15:26:47.2621178+08:00;True|2021-06-08T13:49:45.8936617+08:00;True|2021-06-08T13:43:18.8115502+08:00;True|2021-06-08T10:04:06.2200731+08:00;True|2021-06-08T09:17:10.0470792+08:00;True|2021-06-08T08:44:37.4395849+08:00;True|2021-06-08T00:01:09.3745613+08:00;True|2021-06-07T23:49:31.5196888+08:00;True|2021-06-07T23:41:00.8017855+08:00;True|2021-06-07T23:21:53.1371134+08:00;True|2021-06-07T23:01:27.5712153+08:00;True|2021-06-07T22:36:12.9274014+08:00;True|2021-06-07T22:23:00.6545134+08:00;True|2021-06-07T17:44:47.5686346+08:00;True|2021-06-07T17:17:01.3431233+08:00;True|2021-06-07T16:53:28.9989587+08:00;True|2021-06-07T16:41:10.4975607+08:00;True|2021-06-07T14:21:06.8176477+08:00;True|2021-06-07T14:10:39.0355659+08:00;True|2021-06-07T12:34:31.4562732+08:00;True|2021-06-07T12:28:44.9629488+08:00;True|2021-06-07T10:30:26.9387988+08:00;True|2021-06-07T09:12:14.7658099+08:00;True|2021-06-07T08:37:19.6353792+08:00;True|2021-06-07T08:35:25.2031954+08:00;True|2021-06-05T07:07:32.0541266+08:00;True|2021-06-05T06:44:35.9475270+08:00;True|2021-06-05T06:37:27.4595197+08:00;True|2021-06-05T06:26:59.7663998+08:00;True|2021-06-05T05:43:12.8699318+08:00;True|2021-06-04T17:00:41.2426007+08:00;True|2021-06-04T16:08:03.8078072+08:00;True|2021-06-04T15:47:21.6412616+08:00;True|2021-06-04T15:21:02.4239800+08:00;True|2021-06-04T15:20:37.8641854+08:00;True|2021-06-04T13:38:51.5088395+08:00;True|2021-06-04T10:20:01.7784282+08:00;True|2021-06-04T10:13:50.3548857+08:00;True|2021-06-04T10:11:25.5017821+08:00;True|2021-06-04T10:09:51.6792228+08:00;True|2021-06-04T10:02:39.5851057+08:00;True|2021-06-04T09:30:40.4495494+08:00;True|2021-06-03T13:16:36.0317546+08:00;True|2021-06-03T13:12:47.0402047+08:00;True|2021-06-02T14:37:08.9683351+08:00;True|2021-06-02T14:10:15.7439829+08:00;True|2021-06-02T13:59:46.5841931+08:00;True|2021-06-02T13:25:18.7962660+08:00;True|2021-06-02T13:23:16.2261980+08:00;True|2021-06-01T15:37:32.2495085+08:00;True|2021-06-01T15:21:01.2856122+08:00;True|2021-06-01T15:13:36.7262365+08:00;True|2021-06-01T15:10:26.8905629+08:00;True|2021-06-01T14:56:17.5231551+08:00;True|2021-06-01T14:38:39.7895927+08:00;True|2021-06-01T14:23:12.3265287+08:00;True|2021-03-01T09:11:31.3226422+08:00;True|2021-05-26T14:54:56.9426462+08:00;True|2021-05-26T13:57:33.7780451+08:00;True|2021-05-26T13:39:02.8043358+08:00;True|2021-02-25T16:01:40.2917200+08:00;True|2021-02-25T15:49:46.6681205+08:00;True|2021-02-25T15:16:30.9372640+08:00;True|2021-05-25T13:10:21.7831921+08:00;True|2021-05-25T11:21:38.5224475+08:00;True|2021-05-25T11:12:52.0637175+08:00;True|2021-05-25T11:02:18.4164663+08:00;True|2021-05-25T10:52:06.8998521+08:00;True|2021-05-25T10:50:45.0929606+08:00;True|2021-05-25T10:45:54.1498313+08:00;True|2021-05-25T10:39:27.8602249+08:00;True|2021-05-25T10:34:49.5771162+08:00;True|2021-05-25T10:17:30.3009163+08:00;True|2021-05-25T10:14:03.8512581+08:00;True|2021-05-25T10:05:33.4343836+08:00;True|2021-05-24T17:01:23.3221168+08:00;True|2021-05-24T10:11:24.0197347+08:00;False|2021-05-24T10:11:07.6338995+08:00;</History> + </PropertyGroup> + <ItemGroup> + <File Include="apiapp.json"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="bin/Antlr3.Runtime.dll"> + <publishTime>02/22/2013 08:43:40</publishTime> + </File> + <File Include="bin/Antlr3.Runtime.pdb"> + <publishTime>02/22/2013 08:43:40</publishTime> + </File> + <File Include="bin/BLL.dll"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="bin/DAL.dll"> + <publishTime>06/30/2021 16:33:18</publishTime> + </File> + <File Include="bin/Dapper.dll"> + <publishTime>07/22/2016 14:52:40</publishTime> + </File> + <File Include="bin/DBUtility.dll"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="bin/Kingdee.BOS.WebApi.Client.dll"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="bin/Microsoft.Azure.AppService.ApiApps.Service.dll"> + <publishTime>03/18/2015 17:02:50</publishTime> + </File> + <File Include="bin/Microsoft.CSharp.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/Microsoft.Web.Infrastructure.dll"> + <publishTime>07/25/2012 11:48:56</publishTime> + </File> + <File Include="bin/Model.dll"> + <publishTime>06/17/2021 23:18:55</publishTime> + </File> + <File Include="bin/Newtonsoft.Json.dll"> + <publishTime>08/03/2014 20:33:56</publishTime> + </File> + <File Include="bin/Pub_Class.dll"> + <publishTime>05/21/2020 10:51:50</publishTime> + </File> + <File Include="bin/Pub_Control.dll"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="bin/SQLHelper.dll"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="bin/Swashbuckle.Core.dll"> + <publishTime>02/15/2015 17:57:08</publishTime> + </File> + <File Include="bin/System.ComponentModel.DataAnnotations.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.Configuration.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.Data.DataSetExtensions.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.Data.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.Drawing.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.EnterpriseServices.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.IdentityModel.Tokens.Jwt.dll"> + <publishTime>08/19/2014 10:03:34</publishTime> + </File> + <File Include="bin/System.Net.Http.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.Net.Http.Formatting.dll"> + <publishTime>11/28/2018 13:00:36</publishTime> + </File> + <File Include="bin/System.Runtime.Serialization.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.Web.ApplicationServices.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.Web.Cors.dll"> + <publishTime>11/28/2018 12:58:44</publishTime> + </File> + <File Include="bin/System.Web.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.Web.DynamicData.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.Web.Entity.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.Web.Extensions.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.Web.Helpers.dll"> + <publishTime>01/28/2015 04:04:30</publishTime> + </File> + <File Include="bin/System.Web.Http.Cors.dll"> + <publishTime>11/28/2018 13:01:26</publishTime> + </File> + <File Include="bin/System.Web.Http.dll"> + <publishTime>11/28/2018 13:01:00</publishTime> + </File> + <File Include="bin/System.Web.Http.WebHost.dll"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="bin/System.Web.Mvc.dll"> + <publishTime>01/28/2015 04:02:18</publishTime> + </File> + <File Include="bin/System.Web.Optimization.dll"> + <publishTime>02/11/2014 15:26:04</publishTime> + </File> + <File Include="bin/System.Web.Razor.dll"> + <publishTime>01/28/2015 04:02:32</publishTime> + </File> + <File Include="bin/System.Web.Services.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.Web.WebPages.Deployment.dll"> + <publishTime>01/28/2015 04:04:30</publishTime> + </File> + <File Include="bin/System.Web.WebPages.dll"> + <publishTime>01/28/2015 04:04:30</publishTime> + </File> + <File Include="bin/System.Web.WebPages.Razor.dll"> + <publishTime>01/28/2015 04:04:30</publishTime> + </File> + <File Include="bin/System.Xml.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/System.Xml.Linq.dll"> + <publishTime>09/26/2012 03:16:08</publishTime> + </File> + <File Include="bin/WebActivatorEx.dll"> + <publishTime>11/24/2014 11:18:48</publishTime> + </File> + <File Include="bin/WebAPI.dll"> + <publishTime>06/30/2021 16:44:16</publishTime> + </File> + <File Include="bin/WebAPI.pdb"> + <publishTime>06/30/2021 16:44:16</publishTime> + </File> + <File Include="bin/WebGrease.dll"> + <publishTime>07/17/2013 17:03:52</publishTime> + </File> + <File Include="bin/zh-Hans/System.Net.Http.Formatting.resources.dll"> + <publishTime>11/29/2018 13:26:02</publishTime> + </File> + <File Include="bin/zh-Hans/System.Web.Http.resources.dll"> + <publishTime>11/29/2018 13:26:30</publishTime> + </File> + <File Include="Content/bootstrap.css"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Content/bootstrap.min.css"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Content/Site.css"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="DLL/BLL.dll"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="DLL/DAL.dll"> + <publishTime>06/30/2021 16:33:18</publishTime> + </File> + <File Include="DLL/DBUtility.dll"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="DLL/Kingdee.BOS.WebApi.Client.dll"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="DLL/Model.dll"> + <publishTime>06/17/2021 23:18:55</publishTime> + </File> + <File Include="DLL/Newtonsoft.Json.Net35.dll"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="DLL/Pub_Class.dll"> + <publishTime>05/21/2020 10:51:50</publishTime> + </File> + <File Include="DLL/Pub_Control.dll"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="DLL/SQLHelper.dll"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="fonts/glyphicons-halflings-regular.eot"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="fonts/glyphicons-halflings-regular.svg"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="fonts/glyphicons-halflings-regular.ttf"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="fonts/glyphicons-halflings-regular.woff"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Global.asax"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Index.html"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Metadata/deploymentTemplates/apiappconfig.azureresource.json"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="packages.config"> + <publishTime>01/21/2021 13:19:40</publishTime> + </File> + <File Include="Views/Scripts/bootstrap.js"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Views/Scripts/bootstrap.min.js"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Views/Scripts/jquery-1.10.2.js"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Views/Scripts/jquery-1.10.2.min.js"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Views/Scripts/jquery-1.10.2.min.map"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Views/Scripts/jquery.validate.js"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Views/Scripts/jquery.validate.min.js"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Views/Scripts/jquery.validate.unobtrusive.js"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Views/Scripts/jquery.validate.unobtrusive.min.js"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Views/Scripts/modernizr-2.6.2.js"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Views/Shared/Error.cshtml"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Views/Shared/_Layout.cshtml"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Views/web.config"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Views/_ViewStart.cshtml"> + <publishTime>01/13/2021 21:47:30</publishTime> + </File> + <File Include="Web References/WebS/ClsCLD_Customer_Model.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web References/WebS/ClsCLD_Department_Model.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web References/WebS/ClsCLD_Employee_Model.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web References/WebS/ClsCLD_StockPlace_Model.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web References/WebS/ClsCLD_Supplier_Model.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web References/WebS/ClsCLD_Warehouse_Model.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web References/WebS/ClsGy_BadReason_Model.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web References/WebS/ClsGy_BarCodeBill_WMS_Model_View.datasource"> + <publishTime>02/22/2021 09:25:21</publishTime> + </File> + <File Include="Web References/WebS/ClsGy_Customer_Model.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web References/WebS/ClsGy_Department_Model.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web References/WebS/ClsGy_Employee_Model.datasource"> + <publishTime>02/22/2021 09:25:21</publishTime> + </File> + <File Include="Web References/WebS/ClsGy_Group_Model.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web References/WebS/ClsGy_Item30JiTai_Model.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web References/WebS/ClsGy_Source_Model.datasource"> + <publishTime>02/22/2021 09:25:21</publishTime> + </File> + <File Include="Web References/WebS/ClsGy_StockPlace_Model.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web References/WebS/ClsGy_Supplier_Model.datasource"> + <publishTime>02/22/2021 09:25:21</publishTime> + </File> + <File Include="Web References/WebS/ClsGy_Warehouse_Model.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web References/WebS/ClsKf_ICStockBill_WMS.datasource"> + <publishTime>02/22/2021 09:25:20</publishTime> + </File> + <File Include="Web.config"> + <publishTime>06/30/2021 16:44:26</publishTime> + </File> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/WebAPI/Properties/PublishProfiles/JFAPI.pubxml.user b/WebAPI/Properties/PublishProfiles/JFAPI.pubxml.user index a8f921d..2c90d52 100644 --- a/WebAPI/Properties/PublishProfiles/JFAPI.pubxml.user +++ b/WebAPI/Properties/PublishProfiles/JFAPI.pubxml.user @@ -20,7 +20,7 @@ <publishTime>01/13/2021 21:47:30</publishTime> </File> <File Include="bin/DAL.dll"> - <publishTime>01/13/2021 21:47:30</publishTime> + <publishTime>06/25/2021 16:26:52</publishTime> </File> <File Include="bin/Dapper.dll"> <publishTime>07/22/2016 14:52:40</publishTime> @@ -41,7 +41,7 @@ <publishTime>07/25/2012 11:48:56</publishTime> </File> <File Include="bin/Model.dll"> - <publishTime>01/13/2021 21:47:30</publishTime> + <publishTime>06/17/2021 23:18:55</publishTime> </File> <File Include="bin/Newtonsoft.Json.dll"> <publishTime>08/03/2014 20:33:56</publishTime> @@ -152,10 +152,10 @@ <publishTime>11/24/2014 11:18:48</publishTime> </File> <File Include="bin/WebAPI.dll"> - <publishTime>03/29/2021 10:23:41</publishTime> + <publishTime>06/28/2021 10:34:31</publishTime> </File> <File Include="bin/WebAPI.pdb"> - <publishTime>03/29/2021 10:23:41</publishTime> + <publishTime>06/28/2021 10:34:31</publishTime> </File> <File Include="bin/WebGrease.dll"> <publishTime>07/17/2013 17:03:52</publishTime> @@ -179,7 +179,7 @@ <publishTime>01/13/2021 21:47:30</publishTime> </File> <File Include="DLL/DAL.dll"> - <publishTime>01/13/2021 21:47:30</publishTime> + <publishTime>06/25/2021 16:26:52</publishTime> </File> <File Include="DLL/DBUtility.dll"> <publishTime>01/13/2021 21:47:30</publishTime> @@ -188,7 +188,7 @@ <publishTime>01/13/2021 21:47:30</publishTime> </File> <File Include="DLL/Model.dll"> - <publishTime>01/13/2021 21:47:30</publishTime> + <publishTime>06/17/2021 23:18:55</publishTime> </File> <File Include="DLL/Newtonsoft.Json.Net35.dll"> <publishTime>01/13/2021 21:47:30</publishTime> @@ -323,7 +323,7 @@ <publishTime>02/22/2021 09:25:20</publishTime> </File> <File Include="Web.config"> - <publishTime>03/29/2021 10:23:47</publishTime> + <publishTime>06/28/2021 10:34:52</publishTime> </File> </ItemGroup> </Project> \ No newline at end of file diff --git a/WebAPI/Service/LuBaoSevice.cs b/WebAPI/Service/LuBaoSevice.cs index 2be8d64..0a1eea8 100644 --- a/WebAPI/Service/LuBaoSevice.cs +++ b/WebAPI/Service/LuBaoSevice.cs @@ -175,5 +175,107 @@ return dataSet; } + + /// <summary> + /// 涓嶈壇鍘熷洜鏍规嵁id鑾峰彇淇℃伅 + /// </summary> + public static ApiResult<DataSet> GetGy_BadReasonBillDetail(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + var dataSet = GetGy_BadReasonDb(HID); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄤ笉鑹師鍥犳暟鎹�" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + + public static DataSet GetGy_BadReasonDb(string HID) + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_IF_Edit_BadReasonList where HItemID= " + HID + " ", "h_v_IF_Edit_BadReasonList"); + return dataSet; + } + + + /// <summary> + /// 璁¢噺鍗曚綅鏍规嵁id鑾峰彇淇℃伅 + /// </summary> + public static ApiResult<DataSet> GetGy_UnitBillDetail(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + var dataSet = GetGy_UnitDb(HID); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄨ閲忓崟浣嶆暟鎹�" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + + public static DataSet GetGy_UnitDb(string HID) + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_Gy_UnitList where HItemID= " + HID + " ", "h_v_Edit_Gy_UnitList"); + return dataSet; + } + + /// <summary> + /// 璐у竵璁剧疆鏍规嵁id鑾峰彇淇℃伅 + /// </summary> + public static ApiResult<DataSet> GetGy_CurrencyBillDetail(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + var dataSet = GetGy_CurrencyDb(HID); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄨ揣甯佽缃暟鎹�" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + + public static DataSet GetGy_CurrencyDb(string HID) + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_Gy_CurrencyList where HItemID= " + HID + " ", "h_v_Edit_Gy_CurrencyList"); + return dataSet; + } + + /// <summary> + /// 鐢熶骇璧勬簮鏍规嵁id鑾峰彇淇℃伅 + /// </summary> + public static ApiResult<DataSet> GetGy_SourceBillDetail(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + var dataSet = GetGy_SourceDb(HID); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄧ敓浜ц祫婧愭暟鎹�" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + + public static DataSet GetGy_SourceDb(string HID) + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_IF_SourceList where HItemID= " + HID + " ", "h_v_Edit_IF_SourceList"); + return dataSet; + } + + /// <summary> + /// 鑱屽憳璁剧疆鏍规嵁id鑾峰彇淇℃伅 + /// </summary> + public static ApiResult<DataSet> GetGy_EmployeeBillDetail(string HID) + { + if (string.IsNullOrEmpty(HID)) + return new ApiResult<DataSet> { code = -1, msg = "ID涓嶈兘涓虹┖" }; + var dataSet = GetGy_EmployeeDb(HID); + if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) + return new ApiResult<DataSet> { code = -1, msg = "涓嶅瓨鍦ㄨ亴鍛樿缃暟鎹�" }; + return new ApiResult<DataSet> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet }; + } + + public static DataSet GetGy_EmployeeDb(string HID) + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_IF_EmployeeList where HItemID= " + HID + " ", "h_v_Edit_IF_EmployeeList"); + return dataSet; + } + } } \ No newline at end of file diff --git a/WebAPI/Web.config b/WebAPI/Web.config index d0e3879..4be5306 100644 --- a/WebAPI/Web.config +++ b/WebAPI/Web.config @@ -16,6 +16,9 @@ </connectionStrings> <appSettings> + <!--鏈嶅姟鍣ㄦ枃浠禝P鍦板潃--> + <!--<add key="FileIP" value="http://localhost:8082/LuBaoAPI"/>--> + <add key="FileIP" value="http://localhost:8085/"/> <add key="webpages:Version" value="3.0.0.0" /> <add key="webpages:Enabled" value="false" /> <add key="ClientValidationEnabled" value="true" /> diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj index 92148fa..3c7f96b 100644 --- a/WebAPI/WebAPI.csproj +++ b/WebAPI/WebAPI.csproj @@ -82,9 +82,9 @@ <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath> <Private>True</Private> </Reference> - <Reference Include="Model, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <Reference Include="Model, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>DLL\Model.dll</HintPath> + <HintPath>DLL\璋冪敤宸ョ▼鏂囦欢\Model.dll</HintPath> </Reference> <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath> @@ -232,7 +232,6 @@ <Content Include="Index.html" /> <Content Include="Views\Scripts\bootstrap.js" /> <Content Include="Views\Scripts\bootstrap.min.js" /> - <None Include="Properties\PublishProfiles\API.pubxml" /> <None Include="Properties\Settings.settings"> <Generator>SettingsSingleFileGenerator</Generator> <LastGenOutput>Settings.Designer.cs</LastGenOutput> @@ -315,6 +314,12 @@ <Compile Include="App_Start\RouteConfig.cs" /> <Compile Include="App_Start\SwaggerConfig.cs" /> <Compile Include="App_Start\WebApiConfig.cs" /> + <Compile Include="Controllers\BaseSet\Gy_QCCheckClassController.cs" /> + <Compile Include="Controllers\BaseSet\Gy_CheckItemController.cs" /> + <Compile Include="Controllers\BaseSet\Gy_MaintenanceAcceptItemController.cs" /> + <Compile Include="Controllers\BaseSet\Gy_MaintenanceItemController.cs" /> + <Compile Include="Controllers\BaseSet\Gy_MaintenanceModeController.cs" /> + <Compile Include="Controllers\BaseSet\Gy_StockPlaceController.cs" /> <Compile Include="Controllers\BaseSet\Gy_EquipMentController.cs" /> <Compile Include="Controllers\BaseSet\Gy_WorkCenterController.cs" /> <Compile Include="Controllers\BaseSet\Gy_CurrencyController.cs" /> @@ -343,14 +348,30 @@ <Compile Include="Controllers\CGGL\Cg_POInStockBillController.cs" /> <Compile Include="Controllers\CGGL\Cg_POInStockBackBillController.cs" /> <Compile Include="Controllers\CJGL\Cj_NoPassProcController.cs" /> + <Compile Include="Controllers\CJGL\Sc_ProcessExchangeBillController.cs" /> <Compile Include="Controllers\CJGL\Cj_StationOutBillController.cs" /> <Compile Include="Controllers\CJGL\Cj_StationInBillController.cs" /> <Compile Include="Controllers\CJGL\Cj_StationEntrustOutBillController.cs" /> <Compile Include="Controllers\JHGL\Gy_RoutingBillController.cs" /> + <Compile Include="Controllers\MJGL\Sc_MouldOtherOutBillController.cs" /> + <Compile Include="Controllers\MJJY\Mj_PDA_MoudlCheckController.cs" /> + <Compile Include="Controllers\PublicPageMethodController.cs" /> + <Compile Include="Controllers\Sc_MouldController.cs" /> + <Compile Include="Controllers\Sc_GroupOrderBillController.cs" /> <Compile Include="Controllers\QC_ManagementController.cs" /> + <Compile Include="Controllers\SBGL\Sb_EquipDotCheckBillController.cs" /> + <Compile Include="Controllers\SBGL\Sb_EquipMaintainBillController.cs" /> + <Compile Include="Controllers\SBGL\Sb_EquipMaintainPlanBillController.cs" /> + <Compile Include="Controllers\SBGL\Sb_EquipDotCheckPlanBillController.cs" /> + <Compile Include="Controllers\Sb_CheckEqpRepairWorkBillController.cs" /> + <Compile Include="Controllers\SCGL\Sc_MaterToSourceBillController.cs" /> + <Compile Include="Controllers\SCGL\Sc_MESEndWorkBillController.cs" /> + <Compile Include="Controllers\SCGL\Sc_MESStopWorkBillController.cs" /> + <Compile Include="Controllers\SCGL\Sc_MESBeginWorkBillController.cs" /> <Compile Include="Controllers\SCGL\QC_LastPieceCheckBillController.cs" /> <Compile Include="Controllers\SCGL\QC_OutCompCheckBillController.cs" /> <Compile Include="Controllers\SCGL\QC_ProcessCheckBillController.cs" /> + <Compile Include="Controllers\SCGL\Sc_QualityReportBillController.cs" /> <Compile Include="Controllers\Sc_MouldOtherInBillController.cs" /> <Compile Include="Controllers\Sc_ProcessMangementController.cs" /> <Compile Include="Controllers\CJGL\Cj_StationEntrustInBillController.cs" /> @@ -366,8 +387,26 @@ <Compile Include="Dapper\SqlHelper.cs" /> <Compile Include="Dapper\SqlPools.cs" /> <Compile Include="DbUntil\DataFormatUntil.cs" /> + <Compile Include="DLL\ClsGy_BadReason_Ctl.cs" /> <Compile Include="DLL\ClsQC_NoPassProdCheckBill.cs" /> <Compile Include="DLL\ClsQC_PatrolProcCheckBill.cs" /> + <Compile Include="DLL\ClsSb_EquipConkBookBill.cs" /> + <Compile Include="DLL\ClsSb_EquipDotCheckBill.cs" /> + <Compile Include="DLL\ClsSb_EquipMaintainBill.cs" /> + <Compile Include="DLL\ClsSb_EquipRepairCheckBill.cs" /> + <Compile Include="DLL\ClsSb_EquipRepairWorkBill.cs" /> + <Compile Include="DLL\ClsSc_ICMOReportBill.cs" /> + <Compile Include="DLL\ClsSc_MESBeginWorkBill.cs" /> + <Compile Include="DLL\ClsSc_MESEndWorkBill.cs" /> + <Compile Include="DLL\ClsSc_MESStopWorkBill.cs" /> + <Compile Include="DLL\ClsSc_MouldDotCheckBill.cs" /> + <Compile Include="DLL\ClsSc_MouldLifeChangeBill.cs" /> + <Compile Include="DLL\ClsSc_MouldMaintainBill.cs" /> + <Compile Include="DLL\ClsSc_MouldProdBackBill.cs" /> + <Compile Include="DLL\ClsSc_MouldProdOutBill.cs" /> + <Compile Include="DLL\ClsSc_MouldRepairCheckBill.cs" /> + <Compile Include="DLL\ClsSc_MouldScrapInBill.cs" /> + <Compile Include="DLL\ClsSc_MouldScrapOutBill.cs" /> <Compile Include="DLL\ClsSc_ProcessReport.cs" /> <Compile Include="DLL\ClsSc_ProcessSendWork.cs" /> <Compile Include="DLL\ClsWW_EntrustProcessReportBill.cs" /> @@ -375,6 +414,19 @@ <Compile Include="DLL\ClsWW_EntrustWorkOrderBill.cs" /> <Compile Include="Models\ApiConfig.cs" /> <Compile Include="Models\ApiResult.cs" /> + <Compile Include="Models\CheckItem.cs" /> + <Compile Include="Models\ClsSb_EquipDotCheckBillMain.cs" /> + <Compile Include="Models\ClsSb_EquipDotCheckBillSub.cs" /> + <Compile Include="Models\ClsSb_EquipMaintainBillMain.cs" /> + <Compile Include="Models\ClsSb_EquipMaintainBillSub.cs" /> + <Compile Include="Models\ClsSb_EquipRepairWorkBillMain.cs" /> + <Compile Include="Models\ClsSb_EquipRepairWorkBillSub.cs" /> + <Compile Include="Models\ClsSc_MouldDotCheckBillMain.cs" /> + <Compile Include="Models\ClsSc_MouldDotCheckBillSub.cs" /> + <Compile Include="Models\ClsSc_MouldMaintainBillMain.cs" /> + <Compile Include="Models\ClsSc_MouldMaintainBillSub.cs" /> + <Compile Include="Models\ClsSc_MouldStockBillMain.cs" /> + <Compile Include="Models\ClsSc_MouldStockBillSub.cs" /> <Compile Include="Models\EquipMent.cs" /> <Compile Include="Models\Gy_Mould.cs" /> <Compile Include="Models\Gy_MouldSub.cs" /> @@ -396,6 +448,10 @@ <Compile Include="Models\QC_OutCompCheckBillSub.cs" /> <Compile Include="Models\Supplier.cs" /> <Compile Include="Models\DocumentsView.cs" /> + <Compile Include="Models\Gy_Group.cs" /> + <Compile Include="Models\Gy_WorkCenter.cs" /> + <Compile Include="Models\MaintenanceAcceptItem.cs" /> + <Compile Include="Models\MaintenanceMode.cs" /> <Compile Include="Models\QC_LastPieceCheckBillSub.cs" /> <Compile Include="Models\QC_LastPieceCheckBillMain.cs" /> <Compile Include="Models\QC_ProcessCheckBillSub.cs" /> @@ -417,6 +473,7 @@ <Compile Include="Models\WWSendOutBillViewModel.cs" /> <Compile Include="Models\WW_EntrustProcSendWorkViewModel.cs" /> <Compile Include="Models\WW_EntrustWorkOrderViewModel.cs" /> + <Compile Include="Models\鍩虹璧勬枡\Warehouse.cs" /> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> @@ -494,6 +551,7 @@ </ItemGroup> <ItemGroup> <Folder Include="App_Data\" /> + <Folder Include="Controllers\PZGL\" /> <Folder Include="Views\MoveStockBill\" /> <Folder Include="Views\QC_Management\" /> </ItemGroup> diff --git a/WebAPI/WebAPI.csproj.user b/WebAPI/WebAPI.csproj.user index 6192eed..c934955 100644 --- a/WebAPI/WebAPI.csproj.user +++ b/WebAPI/WebAPI.csproj.user @@ -7,7 +7,7 @@ <WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected> <WebStackScaffolding_LayoutPageFile /> <WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected> - <NameOfLastUsedPublishProfile>API</NameOfLastUsedPublishProfile> + <NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile> <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig> <UseIISExpress>false</UseIISExpress> <Use64BitIISExpress /> @@ -17,8 +17,8 @@ <IISExpressUseClassicPipelineMode /> <UseGlobalApplicationHostFile /> <ProjectView>ShowAllFiles</ProjectView> - <Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID> - <Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath> + <Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID> + <Controller_SelectedScaffolderCategoryPath>root/Common/Web API</Controller_SelectedScaffolderCategoryPath> </PropertyGroup> <ProjectExtensions> <VisualStudio> -- Gitblit v1.9.1