From 711d7d357f595956e38bba3a5488651fc7682ee6 Mon Sep 17 00:00:00 2001 From: zzr99 <1940172413@qq.com> Date: 星期四, 09 十二月 2021 17:35:09 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/生产管理/报工台工序/Sc_MaterToSourceStepBillController.cs | 770 ++++++++++++++++++++++++++++ WebAPI/Controllers/博日自动扫码线/ScanlineAPIController.cs | 100 +++ WebAPI/Models/jsonScanline.cs | 18 WebAPI/Models/ScanLineCode.cs | 18 WebAPI/WebAPI.csproj | 5 WebAPI/Controllers/生产管理/报工台工序/Sc_QualityReportStepBillController.cs | 690 +++++++++++++++++++++++++ 6 files changed, 1,601 insertions(+), 0 deletions(-) diff --git "a/WebAPI/Controllers/\345\215\232\346\227\245\350\207\252\345\212\250\346\211\253\347\240\201\347\272\277/ScanlineAPIController.cs" "b/WebAPI/Controllers/\345\215\232\346\227\245\350\207\252\345\212\250\346\211\253\347\240\201\347\272\277/ScanlineAPIController.cs" new file mode 100644 index 0000000..9a93a8d --- /dev/null +++ "b/WebAPI/Controllers/\345\215\232\346\227\245\350\207\252\345\212\250\346\211\253\347\240\201\347\272\277/ScanlineAPIController.cs" @@ -0,0 +1,100 @@ +锘縰sing DBUtility; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Web.Http; +using System.Web.Script.Serialization; +using WebAPI.Models; + +namespace WebAPI.Controllers.鍗氭棩鑷姩鎵爜绾� +{ + public class ScanlineAPIController : ApiController + { + private jsonScanline objJsonResult = new jsonScanline(); + public DataSet ds = new DataSet(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + #region 鐢熸垚绠辩爜鎺ュ彛 + [Route("packagebarcode/create")] + [HttpGet] + public object create(int num) + { + try + { + objJsonResult.data = new List<barcode>(); + for (int i = 0; i < num; i++) + { + barcode jsn = new barcode(); + //string prefix = "ZM"; + //string date = DateTime.Now.ToString("yyMMddhh"); + //string custom = "12"; + //int nm = i; + //string result = prefix + date + custom + nm.ToString().PadLeft(4, '0'); + + //鏉$爜鍓嶇紑 = 绠辩爜鍓嶇紑 + 骞� + 鏈� + 鏃� + string sDate = DateTime.Now.ToString("yyyy-MM-dd"); + string sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2); + string sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString(); + sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); + string sDay = "0" + ClsPub.isDate(sDate).Day.ToString(); + sDay = sDay.Substring(sDay.Length - 2, 2); + string sTMNumber ="ZX"+ sYear + sPeriod + sDay; + ds = oCN.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿 + int LSH = ClsPub.isInt(ds.Tables[0].Rows[0][0])+1; //娴佹按鍙峰姞1 + string TM = sTMNumber + LSH; + jsn.packagebarcode = TM; + oCN.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); + objJsonResult.data.Add(jsn); + } + objJsonResult.status = 0; + objJsonResult.msg = "鏌ヨ鏁版嵁鎴愬姛锛�"; + objJsonResult.data =objJsonResult.data; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.status =-1; + objJsonResult.msg = "鐢熸垚绠辨潯鐮佸け璐ワ紒"; + objJsonResult.data =null; + return objJsonResult; + } + } + #endregion + + + #region 鎶ュ伐骞冲彴寮�宸ュ崟淇濆瓨/缂栬緫 + /// <summary> + /// 寮�宸ュ崟 + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("packagebarcode/pack")] + [HttpPost] + public object pack([FromBody] JObject msg) + { + try + { + JavaScriptSerializer js = new JavaScriptSerializer(); //瀹炰緥鍖栦竴涓兘澶熷簭鍒楀寲鏁版嵁鐨勭被 + ScanLineCode list = js.Deserialize<ScanLineCode>(msg.ToString()); //灏唈son鏁版嵁杞寲涓哄璞$被鍨嬪苟璧嬪�肩粰list + + objJsonResult.status = 0; + objJsonResult.msg = "success"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.status =-1; + objJsonResult.msg = "success"; + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + } +} \ No newline at end of file diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MaterToSourceStepBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MaterToSourceStepBillController.cs" new file mode 100644 index 0000000..ef6f03f --- /dev/null +++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_MaterToSourceStepBillController.cs" @@ -0,0 +1,770 @@ +锘縰sing Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Data.SqlClient; +using System.Web.Http; +using WebAPI.Models; + +namespace WebAPI.Controllers +{ + //鐢熶骇涓婃枡鍗旵ontroller + public class Sc_MaterToSourceStepBill : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + + private json objJsonResult = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + DataSet ds; + //鑾峰彇绯荤粺鍙傛暟 + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + + public DAL.ClsSc_MESMaterToSourceBill BillNew = new DAL.ClsSc_MESMaterToSourceBill(); //瀵瑰簲鍗曟嵁绫� + public DAL.ClsSc_MESMaterToSourceBill BillOld = new DAL.ClsSc_MESMaterToSourceBill(); //瀵瑰簲鍗曟嵁绫� + + + #region 涓婃枡鏀鹃敊鍗昗eb鍒楄〃鏌ヨ + /// <summary> + /// 杩斿洖鐢熶骇涓婃枡鍗曞垪琛� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Sc_MaterToSourceStepBill/list")] + [HttpGet] + public object list(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_Sc_MaterToSourceBillMain " + sWhere, "h_v_Sc_MaterToSourceBillMain"); + } + else + { + string sql1 = "select * from h_v_Sc_MaterToSourceBillMain where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MaterToSourceBillMain"); + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + else + { + 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("Sc_MaterToSourceStepBill/Sc_MaterToSourceBillListCheckDetai")] + [HttpGet] + public ApiResult<DataSet> Sc_MaterToSourceBillListCheckDetai(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_MaterToSourceBillMain where hmainid= " + HID + " ", "h_v_Sc_MaterToSourceBillMain"); + 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_MaterToSourceStepBill/Sc_MaterToSourceBillListProjectDetai")] + [HttpGet] + public object Sc_MaterToSourceBillListProjectDetai(string HInterID) + { + + DataSet ds, ds1; + List<object> list = new List<object>(); + string Swhere = ""; + try + { + if (HInterID != "" || HInterID != null) + { + Swhere = " and hmainid='" + HInterID + "'"; + } + else + { + Swhere = HInterID; + } + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + //鑾峰彇閰嶆枡璁板綍缂栬緫鏁版嵁 + string sql = "select 鏉″舰鐮� HBarCode,HMaterID,鐗╂枡浠g爜 HNumber,鐗╂枡鍚嶇О HName,瑙勬牸鍨嬪彿 HModel,HUnitID,璁¢噺鍗曚綅鍚嶇О HUnitName,鏁伴噺 HQty from h_v_Sc_MaterToSourceBillSub where 1 = 1 " + Swhere + ""; + ds = oCN.RunProcReturn(sql, "h_v_Sc_MaterToSourceBillSub"); + //鑾峰彇娌诲叿璁板綍缂栬緫鏁版嵁 + //string sql1 = "select HMaterID, 閰嶄欢浠g爜 HMaterNumber,閰嶄欢鍚嶇О HMaterName,瑙勬牸鍨嬪彿 HMaterSpec,HUnitID,鍗曚綅浠g爜 HUnitNumber,鍗曚綅鍚嶇О HUnitName,瀹為檯鐢ㄩ噺 HQty,鏍囧噯鐢ㄩ噺 HQtyMust,HManagerID,璐熻矗浜轰唬鐮� HManagerNumber,璐熻矗浜� HManagerName,琛ㄤ綋澶囨敞 HRemark from h_v_Sc_MouldMaintainBillList where 1 = 1 " + Swhere + ""; + //ds1 = oCN.RunProcReturn(sql1, "h_v_Sc_MouldMaintainBillList"); + list.Add(ds.Tables[0]); + //list.Add(ds1.Tables[0]); + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; + objJsonResult.list = list; + } + 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_MaterToSourceStepBill/DeltetMaterToSourceBill")] + [HttpGet] + public object DeltetMaterToSourceBill(string HInterID, string UserName) + { + DBUtility.ClsPub.CurUserName = UserName; + //缂栬緫鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("MES_MaterToSourceBill_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_MESMaterToSourceBill oBill = new DAL.ClsSc_MESMaterToSourceBill(); + 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_MaterToSourceStepBill/GetMESMaterToSourceFrom")] + [HttpGet] + public object GetMESMaterToSourceFrom(string HSourceInterID, string HSourceEntryID, string HSourceBillNo, string HSourceBillType) + { + try + { + //鏍规嵁閫夋嫨璧勬簮ID鑾峰彇褰撳墠鐢熶骇宸ュ崟銆佽矗浠讳汉 + ds = oCN.RunProcReturn("exec h_p_JIT_GetInfoByICMOStatusInterID @HSourceInterID=" + HSourceInterID + ",@HSourceEntryID=" + HSourceEntryID + ",@HSourceBillNo='" + HSourceBillNo + "',@HSourceBillType='" + HSourceBillType + "'", "h_p_JIT_GetInfoByICMOStatusInterID"); + if (ds.Tables[0].Rows.Count > 0) + { + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇璧勬簮缁戝畾鏁版嵁鎴愬姛锛�"; + objJsonResult.data = ds; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏆傛棤璧勬簮缁戝畾锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = e.Message.ToString(); + objJsonResult.data = null; + + } + return objJsonResult; + } + #endregion + + #region 鎶ュ伐骞冲彴涓婃枡闃查敊涓�閿壂鐮佹柟娉� + [Route("Sc_MaterToSourceStepBill/get_CheckTypeByBarCode_Json")] + [HttpGet] + public object get_CheckTypeByBarCode_Json(string HBarCode,string HSourceID,string HICMOInterID,string HICMOEntryID) + { + + //鏍规嵁閫掑叆鐨勬潯鐮佸墠涓変綅锛屽垽鏂潯鐮佺被鍨嬶紙鐢熶骇璧勬簮銆佺墿鏂欐潯鐮侊級 + ds = oCN.RunProcReturn(" select HSourceName,BarCodeType from Xt_BarCodeType where HSourceNumber= '" + HBarCode.Substring(0, 3) + "'", "Xt_BarCodeType"); + + //鏃犺繑鍥炴暟鎹垯涓虹墿鏂欐潯鐮� + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + //1.鏌ヨ鏉″舰鐮佸湪鏉$爜妗f琛ㄤ腑鏄惁瀛樺湪 + DataSet ds0 = oCN.RunProcReturn(" select HMaterID from Gy_BarCodeBill where HBarCode= '" + HBarCode + "'", "Gy_BarCodeBill"); + if (ds0 == null || ds0.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏉$爜妗f涓笉瀛樺湪姝ょ墿鏂欐潯鐮侊紝鏉$爜鏃犳晥锛�"; + return objJsonResult; + } + else + { + //2.鍖归厤鐢ㄦ枡娓呭崟鐨勭墿鏂欑紪鐮佹槸鍚︿竴鑷� + string sql = @"select '{0}' HBarCode,b.HMaterID,m.HNumber,m.HName,m.HModel,a.HQty HMQty, b.HQty,b.HUnitID,u.HName HUnitName from sc_PPbomBillMain a + inner join Sc_PPBomBillSub b on a.HInterID = b.HInterID + left join Gy_Material m on b.HMaterID = m.HItemID + left join Gy_Unit u on b.HUnitID = u.HItemID + where a.HICMOInterID = '{1}' and a.HICMOEntryID = '{2}'"; + sql = string.Format(sql,HBarCode, HICMOInterID, HICMOEntryID); + + + ds = oCN.RunProcReturn(sql, "Sc_PPBomBillSub"); + if (ds.Tables[0].Rows.Count > 0) //鏈夌敤鏂欐竻鍗曡褰� + { + //var dt0 = ds.Tables[0].AsEnumerable().Where<DataRow>(C => C["HMaterID"].ToString() == "133927").CopyToDataTable(); + DataTable dt = ds.Tables[0].AsEnumerable().Where<DataRow>(W => W["HMaterID"].ToString() == ds0.Tables[0].Rows[0]["HMaterID"].ToString()).CopyToDataTable(); //鍒ゆ柇褰撳墠鏁版嵁(涓�鏉℃垨澶氭潯)涓渶缁堝垽瀹氭槸鍚︽湁鍚堟牸 + if (dt == null || dt.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.Verify = "鐢ㄦ枡娓呭崟鐗╂枡鏉$爜"; + objJsonResult.data = dt; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "褰撳墠鐢熶骇璁㈠崟鏃犵敤鏂欐竻鍗曡褰曪紒"; + return objJsonResult; + } + } + } + else + { + string sBarBillName = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HSourceName"]); + string sBarBillType = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0]["BarCodeType"]); + + //鍒ゆ柇鏉$爜绫诲瀷涓� 鍩虹璧勬枡鏉$爜 鎴� 婧愬崟鏉$爜 + if (sBarBillType == "鍩虹璧勬枡鏉$爜") + { + + //閮ㄩ棬鏉$爜 + if (sBarBillName == "鐢熶骇璧勬簮") + { + //DAL.ClsGy_Source_View dal = new DAL.ClsGy_Source_View(); + + //灏嗛�掑叆鐨勬潯鐮佸幓鎺夊墠涓変綅鍚庤浆鍖栨垚鏁村舰 + int ID; + if (int.TryParse(HBarCode.Remove(0, 3), out ID)) + { + if (int.Parse(HSourceID)!= ID) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鐢熶骇璧勬簮鏉$爜涓庣敓浜ц鍗曠粦瀹氳祫婧愪笉鍖归厤锛�"; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn("Select * from Gy_Source Where HItemID='" + ID + "'", "Gy_Source"); + if(ds.Tables[0].Rows.Count>0) //if (dal.GetInfoByID(ID)) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇璧勬簮缁戝畾鏁版嵁鎴愬姛锛�"; + objJsonResult.Verify = "璧勬簮鏉$爜"; + objJsonResult.data = ds; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳晥璧勬簮鏉$爜锛�"; + return objJsonResult; + } + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "閿欒鐨勮祫婧愭潯鐮侊紒"; + return objJsonResult; + } + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳晥鍩虹璧勬枡鏉$爜锛�"; + return objJsonResult; + } + } + //婧愬崟鏉$爜 + else if (sBarBillType == "婧愬崟鏉$爜") + { + + + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳晥鏉$爜绫诲瀷锛�"; + return objJsonResult; + } + } + return objJsonResult; + } + #endregion + + #region 鎶ュ伐鍙颁笂鏂欓槻閿欎繚瀛� + /// <summary> + /// 淇濆瓨妯″叿缁翠慨鍗� + /// </summary> + /// <param name="msg"></param> + /// <returns></returns> + [Route("Sc_MaterToSourceStepBill/SaveGetMaterToSourceFrom")] + [HttpPost] + public object SaveGetMaterToSourceFrom([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(); + + //淇濆瓨鏉冮檺 + //if (!DBUtility.ClsPub.Security_Log("MES_MaterToSourceBill_Edit", 1, true, DBUtility.ClsPub.CurUserName)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(DateTime.Now, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s; + objJsonResult.data = null; + return objJsonResult; + } + + string UserName = ""; + ListModels oListModels = new ListModels(); + try + { + //琛ㄥご鏁版嵁瀹炰緥鍖� + DAL.ClsSc_MESMaterToSourceBill oBill = new DAL.ClsSc_MESMaterToSourceBill(); + List<Model.ClsSc_MaterToSourceBillMain> lsmain = new List<Model.ClsSc_MaterToSourceBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sc_MaterToSourceBillMain(msg2); + + //閰嶆枡璁板綍琛ㄤ綋鏁版嵁瀹炰緥鍖� + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + msg3 = msg3.Substring(1, msg3.Length - 2); + msg3 = msg3.Replace("\\", ""); + msg3 = msg3.Replace("\n", ""); //\n + //msg2 = msg2.Replace("'", "鈥�"); + List<Model.ClsSc_MaterToSourceBillSub> ls = new List<Model.ClsSc_MaterToSourceBillSub>(); + ls = oListModels.getObjectByJson_Sc_MaterToSourceBillSub(msg3); + + //閰嶄欢椤硅〃浣撴暟鎹疄渚嬪寲 + + foreach (Model.ClsSc_MaterToSourceBillMain 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; + } + } + + UserName = oItem.HMaker; //鍒跺崟浜� + DBUtility.ClsPub.CurUserName = UserName; + oItem.HBillType = "3786"; + oItem.HBillSubType = "3786"; + + oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); + oItem.HProcExchBillNo = ""; //娴佽浆鍗″彿 + oItem.HProcExchInterID = 0; //娴佽浆鍗′富鍐呯爜 + oItem.HProcExchEntryID = 0; //娴佽浆鍗″瓙鍐呯爜 + oItem.HProcID = 0; //宸ュ簭ID + oItem.HMainSourceBillNo =oItem.HSourceBillNo; + oItem.HMainSourceBillType = oItem.HSourceBillType; + oItem.HMainSourceInterID = oItem.HSourceInterID; + oItem.HMainSourceEntryID = oItem.HSourceEntryID; + + + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + + //寰幆閰嶆枡淇℃伅瀛愯〃 + int i = 0; + foreach (Model.ClsSc_MaterToSourceBillSub 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.HScanDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));// --鎵爜鏃堕棿 + oItemSub.HSourceBillNo = oItem.HSourceBillNo; + oItemSub.HSourceBillType = oItem.HSourceBillType; + oItemSub.HSourceInterID = oItem.HSourceInterID; + oItemSub.HSourceEntryID = oItem.HSourceEntryID; + oBill.DetailColl.Add(oItemSub); + + } + oBill.omodel = oItem; + } + + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (oBill.omodel.HInterID == 0) + { + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + if (bResult) + { + objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //杩斿洖涓籌D + //绯荤粺鍙傛暟 鑷姩瀹℃牳 + string sReturn = ""; + if (oSystemParameter.ShowBill(ref sReturn) == true) + { + if (oSystemParameter.omodel.Sc_MaterToSourceBill_AutoCheck == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳 + { + objJsonResult.Verify = "Y"; + } + else + { + objJsonResult.Verify = "N"; + } + } + } + } + else + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //杩斿洖涓籌D + objJsonResult.Verify = "N"; + } + 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> + /// <param name="HInterID">鍗曟嵁ID</param> + /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param> + /// <param name="CurUserName">瀹℃牳浜�</param> + /// <returns></returns> + [Route("Sc_MaterToSourceStepBill/AuditProcessReportList")] + [HttpGet] + public object AuditProcessReportList(int HInterID, int IsAudit, string CurUserName) + { + string ModRightNameCheck = "MES_MaterToSourceBill_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.ClsSc_MESMaterToSourceBill oBill = new DAL.ClsSc_MESMaterToSourceBill(); + //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 + 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 = "0"; + objJsonResult.count = 0; + 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 = "0"; + objJsonResult.count = 0; + 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 + } +} \ No newline at end of file diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_QualityReportStepBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_QualityReportStepBillController.cs" new file mode 100644 index 0000000..5748e4a --- /dev/null +++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\346\212\245\345\267\245\345\217\260\345\267\245\345\272\217/Sc_QualityReportStepBillController.cs" @@ -0,0 +1,690 @@ +锘縰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 + //鏁版嵁搴撲富琛⊿c_QualityReportBillMain + //鏁版嵁搴撳瓙琛⊿c_QualityReportBillSub + public class Sc_QualityReportStepBillController : ApiController + { + public DBUtility.ClsPub.Enum_BillStatus BillStatus; + private json objJsonResult = new json(); + private json objJsonResultReturn = new json(); + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + DataSet ds; + + #region 杩斿洖鐢熶骇璐ㄩ噺姹囨姤鍗曞垪琛� + [Route("Sc_QualityReportStepBill/list")] + [HttpGet] + public object list(string sWhere) + { + try + { + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_Sc_QualityReportBillListDetail " + sWhere, "h_v_Sc_QualityReportBillListDetail"); + } + else + { + string sql1 = "select * from h_v_Sc_QualityReportBillListDetail where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_Sc_QualityReportBillListDetail"); + } + 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 璐ㄩ噺姹囨姤鍗曟牴鎹簮鍗曠被鍨嬭幏鍙栦俊鎭�-婧愬崟涓虹敓浜х姸鎬佷复鏃惰〃锛�3722锛� + [Route("Sc_QualityReportStepBill/get_ICMOBillStatus_Tmp")] + [HttpGet] + public object get_ICMOBillStatus_Tmp(int HInterID, int HEntryID, string HBillType) + { + try + { + if (HInterID == 0 || HBillType.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙傛暟涓嶅叏锛岃幏鍙栨簮鍗曚俊鎭け璐ワ紒HInterID锛�" + HInterID + "锛汬EntryID锛�" + HEntryID + "锛汬BillType锛�" + HBillType + "锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn + ("select a.HInterID,a.HBillType,a.HICMOBillNo,a.HICMOInterID,a.HMaterID" + + ",m.HNumber HMaterNumber,m.HName HMaterName,m.HModel HMaterModel,a.HICMOEntryID " + + " from Sc_ICMOBillStatus_Tmp a " + + " left join Gy_Material m on a.HMaterID=m.HItemID " + + " Where a.HInterID=" + HInterID + " and a.HBillType="+ HBillType, "Sc_ICMOBillStatus_Tmp"); + } + 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; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ鏁版嵁寮傚父锛岃涓庣鐞嗗憳鑱旂郴锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璐ㄩ噺姹囨姤鍗曟壂涓嶈壇鏉$爜淇濆瓨淇℃伅 + [Route("Sc_QualityReportStepBill/set_SaveBarCode")] + [HttpPost] + public object set_SaveBarCode([FromBody] JObject oMain) + { + var msg1 = oMain["oMain"].ToString(); + //淇濆瓨鍗曟嵁 + return objJsonResult = AddBillTmp(msg1); + } + + public json AddBillTmp(string msg1) + { + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg = sArray[0].ToString(); + string OperationType = sArray[1].ToString().Trim(); + bool bResult = false; + try + { + msg = "[" + msg.ToString() + "]"; + List<Sc_ICMOBillQualityStatus_Tmp> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Sc_ICMOBillQualityStatus_Tmp>>(msg); + //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞� + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = mainList[0].HMakeDate; + 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; + } + //淇濆瓨瀹屾瘯鍚庡鐞� + if (OperationType.Equals("1") || OperationType.Equals("2")) + { + //鏄惁淇濆瓨 + bResult = AddBillTmpSQL(mainList, ref ClsPub.sExeReturnInfo); + } + else if (OperationType.Equals("3")) + { + //bResult = BillNew.ModifyBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo); + } + else + { + ClsPub.sExeReturnInfo = "鏃犳晥鐨勬搷浣滅被鍨嬶紒"; + bResult = false; + } + //鏄惁淇濆瓨 + if (bResult == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵爜淇濆瓨鎴愬姛锛�"; + 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; + } + } + //鏂板鍗曟嵁 + public bool AddBillTmpSQL(List<Sc_ICMOBillQualityStatus_Tmp> mainList, ref string sReturn) + { + try + { + Sc_ICMOBillQualityStatus_Tmp BillNew = new Sc_ICMOBillQualityStatus_Tmp(); + //鍥哄畾璧嬪��================================= + BillNew.HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D + BillNew.HBillNo = mainList[0].HBillNo; + BillNew.HBillType = mainList[0].HBillType; + BillNew.HDate = mainList[0].HDate; + BillNew.HICMOBillNo = mainList[0].HICMOBillNo; + BillNew.HICMOInterID = mainList[0].HICMOInterID; + BillNew.HICMOEntryID = mainList[0].HICMOEntryID; + BillNew.HProcExchBillNo = mainList[0].HProcExchBillNo; + BillNew.HProcExchInterID = mainList[0].HProcExchInterID; + BillNew.HProcExchEntryID = mainList[0].HProcExchEntryID; + BillNew.HProcID = mainList[0].HProcID; + BillNew.HMaterID = mainList[0].HMaterID; + BillNew.HSourceID = mainList[0].HSourceID; + BillNew.HGroupID = mainList[0].HGroupID; + BillNew.HCheckManID = mainList[0].HCheckManID; + BillNew.HBadReasonID = mainList[0].HBadReasonID; + BillNew.HBarCode = mainList[0].HBarCode; + BillNew.HMaker = mainList[0].HMaker; + BillNew.HMakeDate = mainList[0].HMakeDate; + BillNew.HReportType = mainList[0].HReportType; + BillNew.HSourceBillNo = mainList[0].HICMOBillNo; + BillNew.HSourceInterID = mainList[0].HICMOInterID; + BillNew.HSourceBillType = mainList[0].HSourceBillType; + oCN.BeginTran(); + //涓存椂琛� + oCN.RunProc("Insert Into Sc_ICMOBillQualityStatus_Tmp " + + " (HInterID,HBillNo,HDate,HICMOBillNo,HICMOInterID" + + ",HProcExchBillNo,HProcExchInterID,HProcExchEntryID,HProcID,HMaterID" + + ",HSourceID,HGroupID,HCheckManID,HBadReasonID,HBarCode" + + ",HMaker,HMakeDate,HBillType,HReportType,HSourceBillNo" + + ",HSourceInterID,HSourceBillType,HICMOEntryID,HSourceEntryID" + + ") " + + " values(" + BillNew.HInterID + ",'" + BillNew.HBillNo + "','" + BillNew.HDate + "','" + BillNew.HICMOBillNo + "'," + BillNew.HICMOInterID + + ",'" + BillNew.HProcExchBillNo + "'," + BillNew.HProcExchInterID + "," + BillNew.HProcExchEntryID + "," + BillNew.HProcID + "," + BillNew.HMaterID + + "," + BillNew.HSourceID + "," + BillNew.HGroupID + "," + BillNew.HCheckManID + "," + BillNew.HBadReasonID + ",'" + BillNew.HBarCode + "'" + + ",'" + BillNew.HMaker + "','" + BillNew.HMakeDate + "','" + BillNew.HBillType + "','" + +BillNew.HReportType + "','" +BillNew.HSourceBillNo + "'" + + "," + BillNew.HSourceInterID + ",'" + BillNew.HSourceBillType + "'," + BillNew.HICMOEntryID + "," + BillNew.HICMOEntryID + + ") "); + sReturn = "鎵爜鎴愬姛锛�"; + oCN.Commit(); + return true; + } + catch (Exception e) + { + sReturn = e.Message; + oCN.RollBack(); + throw (e); + } + } + #endregion + + #region 璐ㄩ噺姹囨姤鍗曞垪琛ㄥ垹闄ゆ寜閽� + [Route("Sc_QualityReportStepBill/DeltetSc_QualityReportBill")] + [HttpGet] + public object DeltetSc_QualityReportBill(long HItemID) + { + DataSet ds; + DataSet ds1; + 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 (HItemID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HItemID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran();//寮�濮嬩簨鍔� + ds = oCN.RunProcReturn("select * from Sc_QualityReportBillMain where hmainid=" + HItemID, "Sc_QualityReportBillMain"); + ds1 = oCN.RunProcReturn("select * from Sc_QualityReportBillSub where hmainid=" + HItemID, "Sc_QualityReportBillSub"); + 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; + //} + //ds1 = oCN.RunProcReturn("Select HItemID from Sc_QualityReportBill Where HParentID='" + HItemID + "'", "Sc_QualityReportBill"); + //if (ds1.Tables[0].Rows.Count != 0) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "姝ら」鐩瓨鍦ㄥ瓙椤圭洰锛屼笉鑳藉垹闄わ紒"; + // objJsonResult.data = null; + // return objJsonResult; + //} + string HUseFlag = Convert.ToString(ds.Tables[0].Rows[0]["HUseFlag"]); + if (HUseFlag == "宸蹭娇鐢�") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ら」鐩凡浣跨敤锛屼笉鑳藉垹闄わ紒"; + objJsonResult.data = null; + return objJsonResult; + } + + oCN.RunProc("delete from Sc_QualityReportBillMain where hmainid=" + HItemID); + oCN.RunProc("delete from Sc_QualityReportBillSub where hmainid=" + 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 + + #region 璐ㄩ噺姹囨姤鍗曟壂涓嶈壇鏉$爜鑾峰彇涓嶈壇鍘熷洜id + [Route("Sc_QualityReportStepBill/get_HBadReasonID")] + [HttpGet] + public object get_HBadReasonID(string HBadReasonNumber) + { + try + { + ds = oCN.RunProcReturn("Select HItemID,HNumber from Gy_BadReason where HStopflag=0 and HNumber='" + HBadReasonNumber + "'", "Gy_BadReason"); + 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; + } + } + #endregion + + #region 瀹℃牳 + public object set_CheckBill(long HInterID,string HChecker, ref string sReturn) + { + SQLHelper.ClsCN oCN1 = new SQLHelper.ClsCN(); + try + { + oCN1.BeginTran(); + //瀹℃牳鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_QualityReportBill_Check", 1, true, HChecker)) + { + oCN1.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎮ㄦ病鏈夋潈闄�,璇蜂笌绠$悊鍛樿仈绯伙紒"; + objJsonResult.data = null; + return objJsonResult; + } + // + if (HInterID == 0) + { + oCN1.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁ID涓�0锛�"; + objJsonResult.data = null; + return objJsonResult; + } + DAL.ClsSc_QualityReportBill oBill = new DAL.ClsSc_QualityReportBill(); + //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 + if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) + { + if (oBill.omodel.HChecker.Trim() != "") + { + oCN1.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍革紒涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HCloseMan.Trim() != "") + { + oCN1.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂紒涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (oBill.omodel.HDeleteMan.Trim() != "") + { + oCN1.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴燂紒涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + oCN1.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + //瀹℃牳 + if (CheckBill(HInterID, HChecker, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + oCN1.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + oCN1.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佸師鍥�:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + catch (Exception e) + { + oCN1.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触锛佸師鍥�:" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + + //瀹℃牳SQL + public bool CheckBill(Int64 HInterID,string HChecker, ref string sReturn) + { + + try + { + oCN.RunProc(" Update Sc_QualityReportBillMain set HChecker='" + HChecker + "',HCheckDate=GETDATE() Where HInterID=" + HInterID.ToString()); + sReturn = ""; + return true; + } + catch (Exception e) + { + sReturn = e.Message; + throw (e); + } + } + #endregion + + #region 鑾峰彇鎵爜鎵弿璁板綍 + [Route("Sc_QualityReportStepBill/get_BarCodeDetail")] + [HttpGet] + public object get_BarCodeDetail(long HInterID) + { + try + { + ds = oCN.RunProcReturn( + "Select a.HItemID,a.HInterID,b.HNumber HBadReasonNumber,b.HName HBadReasonHName" + + ",c.HName HCheckMan,d.HName HGroupName,e.HName HSourceName " + + " from Sc_ICMOBillQualityStatus_Tmp a " + + " left join Gy_BadReason b on a.HBadReasonID = b.HItemID " + + " left join Gy_Employee c on a.HCheckManID = c.HItemID " + + " left join Gy_Group d on a.HGroupID = d.HItemID " + + " left join Gy_Source e on a.HSourceID = e.HItemID " + + " where HInterID=" + HInterID, "Sc_ICMOBillQualityStatus_Tmp" + ); + 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("Sc_QualityReportStepBill/get_BarCodeDetailSum")] + [HttpGet] + public object get_BarCodeDetailSum(long HInterID) + { + try + { + ds = oCN.RunProcReturn( + "Select count(*) HQty,a.HInterID,b.HNumber HBadReasonNumber,b.HName HBadReasonHName,c.HName HCheckMan" + + ",d.HName HGroupName,e.HName HSourceName " + + " from Sc_ICMOBillQualityStatus_Tmp a " + + " left join Gy_BadReason b on a.HBadReasonID = b.HItemID " + + " left join Gy_Employee c on a.HCheckManID = c.HItemID " + + " left join Gy_Group d on a.HGroupID = d.HItemID " + + " left join Gy_Source e on a.HSourceID = e.HItemID " + + " where a.HInterID=" + HInterID + + " group by a.HInterID,a.HBadReasonID,a.HCheckManID,a.HGroupID,a.HSourceID" + + " ,b.HNumber,b.HName,c.HName,d.HName,e.HName", "Sc_ICMOBillQualityStatus_Tmp" + ); + 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("Sc_QualityReportStepBill/del_BarCodeDetail")] + [HttpGet] + public object del_BarCodeDetail(long HItemID) + { + try + { + oCN.RunProc("delete from Sc_ICMOBillQualityStatus_Tmp where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo); + 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 鎻愪氦淇濆瓨锛屽瓨涓诲瓙琛ㄥ強鏄庣粏琛� + [Route("Sc_QualityReportStepBill/set_SaveBill")] + [HttpGet] + public object set_SaveBill(long HInterID,string HChecker) + { + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + bool bResult2 = false; + oCN.BeginTran(); + //淇濆瓨 + oCN.RunProc("exec h_p_save_Sc_QualityReportBill " + HInterID); + //鍒ゆ柇鏄惁鍏佽淇濆瓨锛屼笉鍏佽鍒欏洖婊� + ds = oCN.RunProcReturn("exec h_p_JIT_ICMOBillQualityStatus_SaveCtrl", "h_p_JIT_ICMOBillQualityStatus_SaveCtrl"); + if (ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2") + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + oCN.Commit(); + //鑾峰彇鑷姩瀹℃牳鍙傛暟 + string sReturn = ""; + if (oSystemParameter.ShowBill(ref sReturn) == true) + { + if (oSystemParameter.omodel.Sc_ICMOBillQualityStatus_AutoCheck == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳 + { + //瀹℃牳 + objJsonResultReturn = (json)set_CheckBill(HInterID, HChecker, ref ClsPub.sExeReturnInfo); + if (objJsonResultReturn.code == "1") + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍗曟嵁瀛樼洏瀹屾瘯锛佸鏍告垚鍔燂紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍗曟嵁瀛樼洏瀹屾瘯锛佽嚜鍔ㄥ鏍稿け璐ワ紝鍘熷洜锛�" + objJsonResultReturn.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍗曟嵁瀛樼洏瀹屾瘯锛�"; + objJsonResult.data = null; + return objJsonResult; + } + } + 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.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + } +} \ No newline at end of file diff --git a/WebAPI/Models/ScanLineCode.cs b/WebAPI/Models/ScanLineCode.cs new file mode 100644 index 0000000..623f710 --- /dev/null +++ b/WebAPI/Models/ScanLineCode.cs @@ -0,0 +1,18 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class ScanLineCode + { + public string billno { get; set; } + public string packagebarcode { get; set; } + public List<CartItem> barcodes { get; set; } + } + public class CartItem + { + public string barcode { get; set; } + } +} \ No newline at end of file diff --git a/WebAPI/Models/jsonScanline.cs b/WebAPI/Models/jsonScanline.cs new file mode 100644 index 0000000..dd99872 --- /dev/null +++ b/WebAPI/Models/jsonScanline.cs @@ -0,0 +1,18 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace WebAPI.Models +{ + public class jsonScanline + { + public int status { get; set; } + public string msg { get; set; } + public List<barcode> data { get; set; } + } + public class barcode + { + public string packagebarcode { get; set; } + } +} \ No newline at end of file diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj index 2418e11..b741b9c 100644 --- a/WebAPI/WebAPI.csproj +++ b/WebAPI/WebAPI.csproj @@ -348,6 +348,7 @@ <Compile Include="Controllers\MoveStockBillController.cs" /> <Compile Include="Controllers\Open_PrintTemController.cs" /> <Compile Include="Controllers\ReportStepPlatFormController.cs" /> + <Compile Include="Controllers\鍗氭棩鑷姩鎵爜绾縗ScanlineAPIController.cs" /> <Compile Include="Controllers\宸ヨ祫绠$悊\Pay_OtherBalBillController.cs" /> <Compile Include="Controllers\宸ヨ祫绠$悊\Pay_GroupBalBillController.cs" /> <Compile Include="Controllers\PurchaseOrderController.cs" /> @@ -404,11 +405,13 @@ <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_RepairBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_RepairCheckBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\宸ヨ祫鍩虹璧勬枡\Gy_ProcPriceController.cs" /> + <Compile Include="Controllers\鐢熶骇绠$悊\鎶ュ伐鍙板伐搴廫Sc_MaterToSourceStepBillController.cs" /> <Compile Include="Controllers\鐢熶骇绠$悊\鎶ュ伐鍙板伐搴廫Sc_MESBeginStepWorkBillController.cs" /> <Compile Include="Controllers\鐢熶骇绠$悊\鎶ュ伐鍙板伐搴廫Sc_MESEndStepWorkBillController.cs" /> <Compile Include="Controllers\鐢熶骇绠$悊\鎶ュ伐鍙板伐搴廫Sc_MESProductReportStepBillController.cs" /> <Compile Include="Controllers\鐢熶骇绠$悊\鎶ュ伐鍙板伐搴廫Sc_MESReturnStepWorkBillController.cs" /> <Compile Include="Controllers\鐢熶骇绠$悊\鎶ュ伐鍙板伐搴廫Sc_MESStopStepWorkBillController.cs" /> + <Compile Include="Controllers\鐢熶骇绠$悊\鎶ュ伐鍙板伐搴廫Sc_QualityReportStepBillController.cs" /> <Compile Include="Controllers\鐢熶骇绠$悊\鐢熶骇浠诲姟鍗昞Sc_ICMOBillController.cs" /> <Compile Include="Controllers\鐢熶骇绠$悊\璐ㄩ噺姹囨姤鍗昞Sc_QualityReportBillController.cs" /> <Compile Include="Dapper\SqlHelper.cs" /> @@ -448,6 +451,8 @@ <Compile Include="DLL\ClsSc_MouldMoveStockStepOutBill.cs" /> <Compile Include="DLL\宸ヨ祫绠$悊\ClsPay_GroupBalBill.cs" /> <Compile Include="DLL\宸ヨ祫绠$悊\ClsPay_WorkTimesBill.cs" /> + <Compile Include="Models\jsonScanline.cs" /> + <Compile Include="Models\ScanLineCode.cs" /> <Compile Include="Models\宸ヨ祫绠$悊\ClsPay_GroupBalBillEmp.cs" /> <Compile Include="Models\宸ヨ祫绠$悊\ClsPay_GroupBalBillMain.cs" /> <Compile Include="Models\宸ヨ祫绠$悊\ClsPay_GroupBalBillSub.cs" /> -- Gitblit v1.9.1