From 758114a0d5fbfa310cd3a0add79fe2edcc7f2e9c Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期二, 07 九月 2021 17:38:28 +0800
Subject: [PATCH] 设备保养计划列表和编辑

---
 WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs |  209 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 209 insertions(+), 0 deletions(-)

diff --git a/WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs b/WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs
new file mode 100644
index 0000000..be96551
--- /dev/null
+++ b/WebAPI/Controllers/SCGL/Sc_MaterToSourceBillController.cs
@@ -0,0 +1,209 @@
+锘縰sing Newtonsoft.Json.Linq;
+using Pub_Class;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Web.Http;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers
+{
+    //鐢熶骇涓婃枡鍗旵ontroller
+    public class Sc_MaterToSourceBillController : ApiController
+    {
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        DataSet ds;
+        //鑾峰彇绯荤粺鍙傛暟
+        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+
+
+        /// <summary>
+        /// 杩斿洖鐢熶骇涓婃枡鍗曞垪琛�
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("Sc_MaterToSourceBill/list")]
+        [HttpGet]
+        public object list(string sWhere)
+        {
+            try
+            {
+                if (sWhere == null || sWhere.Equals(""))
+                {
+                    ds = oCN.RunProcReturn("select * from h_v_Sc_MaterToSourceBillList " + sWhere, "h_v_Sc_MaterToSourceBillList");
+                }
+                else
+                {
+                    string sql1 = "select * from h_v_Sc_MaterToSourceBillList where 1 = 1 ";
+                    string sql = sql1 + sWhere;
+                    ds = oCN.RunProcReturn(sql, "h_v_Sc_MaterToSourceBillList");
+                }
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds.Tables[0];
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
+        //
+
+        #region  鎶ュ伐骞冲彴涓婃枡闃查敊鍗曞脊绐楁煡鎵炬暟鎹�
+        [Route("Sc_MaterToSourceBill/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_MaterToSourceBill/get_CheckTypeByBarCode_Json")]
+        [HttpGet]
+        public object get_CheckTypeByBarCode_Json(string HBarCode,string HSourceID)
+        {
+            
+            //鏍规嵁閫掑叆鐨勬潯鐮佸墠涓変綅锛屽垽鏂潯鐮佺被鍨嬶紙鐢熶骇璧勬簮銆佺墿鏂欐潯鐮侊級
+            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琛ㄤ腑鏄惁瀛樺湪
+                 //2.鍖归厤鐢ㄦ枡娓呭崟鐨勭墿鏂欑紪鐮佹槸鍚︿竴鑷�
+
+            }
+            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
+                            {
+                                if (dal.GetInfoByID(ID))
+                                {
+                                    objJsonResult.code = "1";
+                                    objJsonResult.count = 1;
+                                    objJsonResult.Message = "鑾峰彇璧勬簮缁戝畾鏁版嵁鎴愬姛锛�";
+                                    objJsonResult.Verify = "璧勬簮鏉$爜";
+                                    objJsonResult.data = dal;
+                                    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
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1