WebAPI/Controllers/博日自动扫码线/ScanlineAPIController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/生产管理/报工台工序/Sc_MaterToSourceStepBillController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Controllers/生产管理/报工台工序/Sc_QualityReportStepBillController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Models/ScanLineCode.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/Models/jsonScanline.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
WebAPI/WebAPI.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
WebAPI/Controllers/²©ÈÕ×Ô¶¯É¨ÂëÏß/ScanlineAPIController.cs
New file @@ -0,0 +1,100 @@ using DBUtility; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using 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()); //å°jsonæ°æ®è½¬å为对象类åå¹¶èµå¼ç»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 } } WebAPI/Controllers/Éú²ú¹ÜÀí/±¨¹¤Ì¨¹¤Ðò/Sc_MaterToSourceStepBillController.cs
New file @@ -0,0 +1,770 @@ using 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 { //çäº§ä¸æåController 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 䏿æ¾éåWebå表æ¥è¯¢ /// <summary> /// è¿åçäº§ä¸æåå表 ///åæ°ï¼string 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,ç©æä»£ç 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, é 件代ç HMaterNumber,é ä»¶åç§° HMaterName,è§æ ¼åå· HMaterSpec,HUnitID,åä½ä»£ç 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.æ¥è¯¢æ¡å½¢ç 卿¡ç æ¡£æ¡è¡¨ä¸æ¯å¦åå¨ 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 = "æ¡ç æ¡£æ¡ä¸ä¸å卿¤ç©ææ¡ç ï¼æ¡ç æ æï¼"; 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; //è¿å主ID //ç³»ç»åæ° èªå¨å®¡æ ¸ 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; //è¿å主ID 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) //åå®¡æ ¸æäº¤ { //åå®¡æ ¸æäº¤AbandonCheck 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 } } WebAPI/Controllers/Éú²ú¹ÜÀí/±¨¹¤Ì¨¹¤Ðò/Sc_QualityReportStepBillController.cs
New file @@ -0,0 +1,690 @@ using 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 { //è´¨éæ±æ¥åController //æ°æ®åºä¸»è¡¨Sc_QualityReportBillMain //æ°æ®åºå表Sc_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 + "ï¼HEntryIDï¼" + HEntryID + "ï¼HBillTypeï¼" + 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å¾å°çåæ®ID 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 } } WebAPI/Models/ScanLineCode.cs
New file @@ -0,0 +1,18 @@ using 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; } } } WebAPI/Models/jsonScanline.cs
New file @@ -0,0 +1,18 @@ using 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; } } } 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" />