From 2509d3e53cad2baad47cb3046a58075b9745f526 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期五, 03 三月 2023 14:29:33 +0800
Subject: [PATCH] 生产资源打印 工序工价完善 物料分类单据及列表

---
 Model/基础资料/基础资料/ClsGy_MaterType_Model.cs                   |   11 
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs     |    2 
 WebAPI/Controllers/基础资料/基础资料/Gy_MaterTypeBillController.cs |  360 ++++++++++++++++++++++++++++++
 WebAPI/Controllers/Sc_ProcessMangementController.cs        |   14 
 WebAPI/Controllers/基础资料/工资基础资料/Gy_ProcPriceController.cs   |  264 +++++++++++++++++----
 WebAPI/WebAPI.csproj                                       |    2 
 WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs     |    3 
 DAL/基础资料/公用基础资料/ClsGy_MaterType_Ctl.cs                     |   10 
 8 files changed, 600 insertions(+), 66 deletions(-)

diff --git "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MaterType_Ctl.cs" "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MaterType_Ctl.cs"
index 18c2abe..bad0eca 100644
--- "a/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MaterType_Ctl.cs"
+++ "b/DAL/\345\237\272\347\241\200\350\265\204\346\226\231/\345\205\254\347\224\250\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MaterType_Ctl.cs"
@@ -20,9 +20,9 @@
                 oCn.BeginTran();
                 oCn.RunProc("Insert into " + MvarItemKey + " " +
                     " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
-                    ",HLevel,HEndFlag,HStopflag,HRemark) " +
+                    ",HLevel,HEndFlag,HStopflag,HRemark,HMakeEmp,HMakeTime,HStopEmp,HStopTime,HUSEORGID,HCREATEORGID,HUseFlag) " +
                     " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() +
-                    "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "')", ref DBUtility.ClsPub.sExeReturnInfo);
+                    "," + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "','"+ oModel.HMakeEmp.ToString() + "',getdate(),'" + (oModel.HStopflag==true? oModel.HMakeEmp.ToString():"") + "','"+ (oModel.HStopflag == true ? DateTime.Now.ToString() : "") + "',"+ oModel.HUSEORGID + "," + oModel.HCREATEORGID + ",'"+ oModel.HUseFlag + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼涓婄骇涓洪潪鏈骇浠g爜
                 oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                 oCn.Commit();
@@ -49,6 +49,12 @@
                     ",HLevel=" + oModel.HLevel.ToString() +
                     ",HParentID=" + oModel.HParentID.ToString() +
                     ",HEndflag=" + Convert.ToString(oModel.HEndFlag ? 1 : 0) +
+                    ",HModifyEmp='" + oModel.HMakeEmp.ToString() + "'" +
+                    ",HModifyTime= getdate()" +
+                    ",HStopEmp='" + (oModel.HStopflag == true ? oModel.HMakeEmp : "") + "'" +
+                    ",HStopTime='" + (oModel.HStopflag == true ? DateTime.Now.ToString() : "") + "'" +
+                    ",HUSEORGID=" + oModel.HUSEORGID +
+                    ",HUseFlag='" + oModel.HUseFlag + "'" +
                     ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
                     ",HRemark= '" + oModel.HRemark + "' Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼瀛愰」鐩唬鐮�
diff --git "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MaterType_Model.cs" "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MaterType_Model.cs"
index 86a992f..9e2bb93 100644
--- "a/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MaterType_Model.cs"
+++ "b/Model/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/ClsGy_MaterType_Model.cs"
@@ -7,6 +7,15 @@
 {
     public class ClsGy_MaterType_Model : DBUtility.ClsGy_Base_Model
     {
-
+        public long HUSEORGID { get; set; }
+        public long HCREATEORGID { get; set; }
+        public string HMakeEmp { get; set; }
+        public DateTime HMakeTime { get; set; }
+        public string HCheckEmp { get; set; }
+        public DateTime HCheckTime { get; set; }
+        public string HModifyEmp { get; set; }
+        public DateTime HModifyTime { get; set; }
+        public string HStopEmp { get; set; }
+        public DateTime HStopTime { get; set; }
     }
 }
diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index d4ad9f0..9412611 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -1246,7 +1246,7 @@
                     num++;
                 }
 
-                if (num > 0)
+                if (num == 2)
                 {
                     if (!oBill.DeleteBill(long.Parse(HInterID), 0, 0, ref DBUtility.ClsPub.sExeReturnInfo))
                     {
diff --git a/WebAPI/Controllers/Sc_ProcessMangementController.cs b/WebAPI/Controllers/Sc_ProcessMangementController.cs
index d68b954..b5da1e3 100644
--- a/WebAPI/Controllers/Sc_ProcessMangementController.cs
+++ b/WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -276,7 +276,6 @@
         //        model.Add("FBillType", new JObject() { ["Fnumber"] = "SCHBD01_SYS" }); //鍗曟嵁绫诲瀷鐢熶骇姹囨姤鈥淪CHBD02_SYS鈥� 鍏ュ簱姹囨姤SCHBD01_SYS
         //        model.Add("FPrdOrgId", new JObject() { ["Fnumber"] = dr1["FPrdOrgNUMBER"].ToString() }); //鐢熶骇缁勭粐1
         //        model.Add("FDate", DateTime.Now.ToString("yyyy-MM-dd")); //鍗曟嵁鏃ユ湡1
-        //        model.Add("FHZYMESFLAG", "鏄�");//  鏄惁涓篗ES鍚屾
         //        model.Add("FBillNo", BillNo);
 
         //        JArray Fentity = new JArray();
@@ -304,19 +303,15 @@
         //            FentityModel.Add("FFailQty", item["涓嶈壇鏁伴噺"].ToString());//涓嶅悎鏍兼暟閲�
         //            FentityModel.Add("FStockInOrgId ", new JObject() { ["Fnumber"] = OrganizationNUM });// 鍏ュ簱缁勭粐 
         //            FentityModel.Add("FStockId", new JObject() { ["Fnumber"] = dr1["FStockNUM"].ToString() }); // 浠撳簱 
-        //            FentityModel.Add("FMOID", dr1["FMOID"].ToString());//  
         //            FentityModel.Add("FMOBILLNO", dr1["FMOBILLNO"].ToString());//  
         //            FentityModel.Add("FMOENTRYID", dr1["FMOENTRYID"].ToString());//  
-        //            FentityModel.Add("FMOENTRYSEQ", dr1["FMOENTRYSEQ"].ToString());//  
         //            FentityModel.Add("FOwnerTypeId", dr1["FOWNERTYPEID"].ToString()); //璐т富绫诲瀷锛欶OwnerTypeId(蹇呭~椤�)
         //            FentityModel.Add("FOwnerId", new JObject() { ["Fnumber"] = dr1["FOwnerNumber"].ToString() }); //璐т富锛欶OwnerId(蹇呭~椤�)
-        //            FentityModel.Add("FBomId", new JObject() { ["Fnumber"] = dr1["FBOMNUM"].ToString() }); //BOM鐗堟湰锛欶BomId(蹇呭~椤�)
+        //            FentityModel.Add("FBomId", new JObject() { ["F    number"] = dr1["FBOMNUM"].ToString() }); //BOM鐗堟湰锛欶BomId(蹇呭~椤�)
         //            FentityModel.Add("FCostRate", dr1["FCostRate"].ToString());// 鎴愭湰鏉冮噸
         //            FentityModel.Add("FISBACKFLUSH", dr1["FISBACKFLUSH"].ToString() == "1" ? true : false);// 鍊掑啿棰嗘枡
         //            FentityModel.Add("FMOMAINENTRYID", dr1["FMOENTRYID"].ToString());//
-        //            FentityModel.Add("F_bsv_Base1", new JObject() { ["Fnumber"] = dr1["FPREBDONENUMBER"].ToString() }); //鍖呰鏍囪瘑
         //            FentityModel.Add("FLot", new JObject() { ["FNumber"] = dr1["FBATCHNO"].ToString() }); //鎵瑰彿
-        //            FentityModel.Add("F_bsv_Text", dr1["宸ュ簭娴佽浆鍗″彿"].ToString()); //娴佽浆鍗″彿
         //            JArray Fentity2 = new JArray();
         //            JObject FentityModel2 = new JObject();
         //            FentityModel2.Add("FEntity_Link_FFlowId", "f6e6eec3-5267-4f02-8593-b633da508a72");
@@ -329,9 +324,6 @@
         //            FentityModel2.Add("FEntity_Link_FBaseQuaQtyOld", item["鍚堟牸鏁伴噺"].ToString());
         //            FentityModel2.Add("FEntity_Link_FBaseQuaQty", item["鍚堟牸鏁伴噺"].ToString());
         //            Fentity2.Add(FentityModel2);
-        //            FentityModel.Add("FEntity_Link", Fentity2);
-        //            FentityModel.Add("FBFLowId", new JObject() { ["FID"] = "f6e6eec3-5267-4f02-8593-b633da508a72" }); //
-        //            Fentity.Add(FentityModel);
         //        }
         //        model.Add("FEntity", Fentity); //鏄庣粏淇℃伅                       
         //        JObject jsonRoot = new JObject()
@@ -631,7 +623,7 @@
                 if (double.Parse(DTable.Rows[0]["HQty"].ToString()) == 0)
                 {
                     objJsonResult.code = "1";
-                    objJsonResult.count = 1;
+                    objJsonResult.count = 2;
                     objJsonResult.Message = "鍚堟牸鏁伴噺涓�0,涓嶉渶瑕佸叆搴擄紒";
                     objJsonResult.data = null;
                     return objJsonResult;
@@ -905,7 +897,7 @@
                 if (double.Parse(DTable.Rows[0]["HWasterQty"].ToString()) == 0)
                 {
                     objJsonResult.code = "1";
-                    objJsonResult.count = 1;
+                    objJsonResult.count = 2;
                     objJsonResult.Message = "鎶ュ簾鏁伴噺涓�0,涓嶉渶瑕佸叆搴擄紒";
                     objJsonResult.data = null;
                     return objJsonResult;
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MaterTypeBillController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MaterTypeBillController.cs"
new file mode 100644
index 0000000..1cca132
--- /dev/null
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MaterTypeBillController.cs"
@@ -0,0 +1,360 @@
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using System.Web.Http;
+using WebAPI.Models;
+
+namespace WebAPI.Controllers.鍩虹璧勬枡.鍩虹璧勬枡
+{
+    public class Gy_MaterTypeBillController : ApiController
+    {
+        private json objJsonResult = new json();
+        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+        DataSet ds;
+
+        #region 鐗╂枡鍒嗙被鍒楄〃
+        [Route("Gy_MaterType/Gy_MaterTypeList")]
+        [HttpGet]
+        public object Gy_MaterTypeList(string sWhere, string user, string Organization)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //缂栬緫鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_MaterType_Query", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                string sql1 = string.Format(@"select * from h_v_IF_MaterType where 浣跨敤缁勭粐='" + Organization + "'");
+
+                ds = oCN.RunProcReturn(sql1 + sWhere + " order by HItemID ", "h_v_IF_MaterType");
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.list = columnNameList;
+                objJsonResult.data = ds.Tables[0];
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐗╂枡鍒嗙被 淇濆瓨/缂栬緫
+        [Route("Gy_MaterType/SaveGy_MaterType")]
+        [HttpPost]
+        public object SaveGy_MaterType([FromBody] JObject msg)
+        {
+            DataSet ds;
+            var _value = msg["msg"].ToString();
+            string msg3 = _value.ToString();
+            string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+            string msg1 = sArray[0].ToString();//鏁版嵁
+            string msg2 = sArray[1].ToString();//鐢ㄦ埛
+            string msg_HUSEORGID = sArray[2].ToString();//缁勭粐
+            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+            //缂栬緫鏉冮檺
+            if (!DBUtility.ClsPub.Security_Log_second("Gy_MaterType_Edit", 1, false, msg2))
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+
+            try
+            {
+                DAL.ClsGy_MaterType_Ctl oBill = new DAL.ClsGy_MaterType_Ctl();
+                List<Model.ClsGy_MaterType_Model> lsmain = new List<Model.ClsGy_MaterType_Model>();
+                msg1 = msg1.Replace("\\", "");
+                msg1 = msg1.Replace("\n", "");  //\n
+                msg1 = "[" + msg1 + "]";
+                lsmain = JsonConvert.DeserializeObject<List<Model.ClsGy_MaterType_Model>>(msg1);
+                foreach (Model.ClsGy_MaterType_Model oItem in lsmain)
+                {
+                    if (oItem.HNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (oItem.HName.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim()))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+                    ds = oCN.RunProcReturn("select * from  Gy_MaterType where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_MaterType");
+
+                    if (ds.Tables[0].Rows.Count > 0)
+                    {
+                        if (oItem.HItemID == 0 || (ds.Tables[0].Rows[0]["HItemID"].ToString() != oItem.HItemID.ToString() && oItem.HItemID != 0))
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+                            objJsonResult.data = 1;
+                            return objJsonResult;
+                        }
+                    }
+                   
+
+                    //寰楀埌鐭唬鐮�
+                    string sShortNumber;
+                    sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
+                    if (sShortNumber.Trim() == "")
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
+                        objJsonResult.data = 1;
+                        return objJsonResult;
+                    }
+                    oItem.HCREATEORGID = Convert.ToInt32(msg_HUSEORGID); //缁勭粐id
+                    oItem.HShortNumber = sShortNumber;//鐭唬鐮�
+                    oItem.HMakeEmp = msg2;
+                    oItem.HEndFlag = true;//鏈骇鏍囧織
+                    oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇
+                    oBill.oModel = oItem;
+                }
+                //淇濆瓨
+                //淇濆瓨瀹屾瘯鍚庡鐞�
+                bool bResult;
+                if (oBill.oModel.HItemID == 0)
+                {
+                    bResult = oBill.AddNew();
+                }
+                else
+                {
+                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
+                }
+                if (bResult)
+                {
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = 1;
+                    return objJsonResult;
+                }
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+                objJsonResult.data = 1;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
+        #region 鐗╂枡鍒嗙被  鍒犻櫎
+        [Route("Gy_MaterType/DeleteMaterType")]
+        [HttpGet]
+        public object DeleteMaterType(string HItemID, string user)
+        {
+            DataSet ds;
+            try
+            {
+                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log("Gy_MaterType_Drop", 1, false, user))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犲垹闄ゆ潈闄�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                if (string.IsNullOrWhiteSpace(HItemID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HItemID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+                ds = oCN.RunProcReturn("select * from Gy_MaterType where HItemID=" + HItemID, "Gy_MaterType");
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult; ;
+                }
+                var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]);
+                if (HStopflag)
+                {
+                    oCN.RollBack();//鍥炴粴浜嬪姟
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏁版嵁宸茬鐢ㄦ棤娉曞啀娆″垹闄わ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.RunProc("delete from Gy_MaterType where HItemID=" + HItemID);
+                oCN.Commit();//鎻愪氦浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "* 鏁版嵁鍒犻櫎鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鍒犻櫎澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 鐗╂枡鍒嗙被瀹℃牳銆佸弽瀹℃牳
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Gy_MaterType/AuditGy_MaterType")]
+        [HttpGet]
+        public object AuditGy_MaterType(int HInterID, int IsAudit, string CurUserName)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_MaterType_Check", 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                var ds = oCN.RunProcReturn("select * from Gy_MaterType where HItemID=" + HInterID, "Gy_MaterType");
+                if (ds.Tables[0].Rows.Count>0)
+                {
+                    if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                    {
+                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                    {
+                        if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                oCN.BeginTran();
+
+                if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                {
+                    oCN.RunProc("update Gy_MaterType set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "瀹℃牳鎴愬姛";
+                    objJsonResult.data = null;
+                }
+                if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                {
+                    oCN.RunProc("update Gy_MaterType set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
+
+                    objJsonResult.code = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+                    objJsonResult.data = null;
+                }
+                oCN.Commit();
+
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();
+                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/\345\237\272\347\241\200\350\265\204\346\226\231/\345\267\245\350\265\204\345\237\272\347\241\200\350\265\204\346\226\231/Gy_ProcPriceController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\267\245\350\265\204\345\237\272\347\241\200\350\265\204\346\226\231/Gy_ProcPriceController.cs"
index a07c887..70d50bf 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\267\245\350\265\204\345\237\272\347\241\200\350\265\204\346\226\231/Gy_ProcPriceController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\267\245\350\265\204\345\237\272\347\241\200\350\265\204\346\226\231/Gy_ProcPriceController.cs"
@@ -189,59 +189,23 @@
             try
             {
                 List<object> columnNameList = new List<object>();
-                //ds = oCN.RunProcReturn("select " +
-                //    "a.HItemID,ltrim(a.HMaterID)+'-'+ltrim(a.HProcID) 宸ュ簭宸ヤ环璧勬枡浠g爜,a.HDeptID,b.HName HDeptName" +
-                //    ",a.HMaterID HMaterIDCol,c.HNumber HMaterNumberCol,c.HName HMaterNameCol,c.HModel HMaterModelCol" +
-                //    ",a.HProcID HProcIDCol,d.HNumber HProcNumberCol,d.HName HProcNameCol" +
-                //    ",a.HSourceID HSourceIDCol,e.HNumber HSourceNumberCol,e.HName HSourceNameCol" +
-                //    ",a.HPrice HPriceCol,a.HBeginDate HBeginDateCol,a.HEndDate HEndDateCol" +
-                //    ",case when a.HCostFlag<>0 then 'true'else 'false'end HCostFlagCol" +
-                //    ",case when a.HFlowFlag<>0 then 'true'else 'false'end HFlowFlagCol" +
-                //    ",case when a.HPayFlag<>0 then 'true'else 'false'end HPayFlagCol,a.HRemark HRemarkCol " +
-                //    " from Gy_ProcPrice a " +
-                //    " left join Gy_Department b on a.HDeptID = b.HItemID " +
-                //    " left join Gy_Material c on a.HMaterID = c.HItemID " +
-                //    " left join Gy_Process d on a.HProcID = d.HItemID " +
-                //    " left join Gy_Source e on a.HSourceID = e.HItemID where a.HItemID = " + HItemID, "Gy_ProcPrice");
-                ds = oCN.RunProcReturn("select " +
-                   "a.HItemID,ltrim(a.HMaterID)+'-'+ltrim(a.HProcID) 宸ュ簭宸ヤ环璧勬枡浠g爜,a.HDeptID,b.HName 閮ㄩ棬" +
-                   ",a.HMaterID HMaterIDCol,c.HNumber 鐗╂枡浠g爜,c.HName 鐗╂枡鍚嶇О,c.HModel 瑙勬牸鍨嬪彿" +
-                   ",a.HProcID HProcIDCol,d.HNumber 宸ュ簭浠g爜,d.HName 宸ュ簭鍚嶇О" +
-                   ",a.HSourceID HSourceIDCol,e.HNumber 璧勬簮浠g爜,e.HName 璧勬簮鍚嶇О" +
-                   ",a.HPrice 鍗曚环,a.HBeginDate 寮�濮嬫棩鏈�,a.HEndDate 缁撴潫鏃ユ湡" +
-                   ",case when a.HCostFlag<>0 then 'true'else 'false'end 鎴愭湰蹇呴��" +
-                   ",case when a.HFlowFlag<>0 then 'true'else 'false'end 娴佽浆榛樿" +
-                   ",case when a.HPayFlag<>0 then 'true'else 'false'end 宸ヨ祫榛樿,a.HRemark 澶囨敞 " +
-                   " from Gy_ProcPrice a " +
-                   " left join Gy_Department b on a.HDeptID = b.HItemID " +
-                   " left join Gy_Material c on a.HMaterID = c.HItemID " +
-                   " left join Gy_Process d on a.HProcID = d.HItemID " +
-                   " left join Gy_Source e on a.HSourceID = e.HItemID where a.HItemID = " + HItemID, "Gy_ProcPrice");
-                if (ds == null || ds.Tables[0].Rows.Count == 0)
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犲垪琛ㄤ俊鎭紒";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    //娣诲姞鍒楀悕
-                    foreach (DataColumn col in ds.Tables[0].Columns)
-                    {
-                        Type dataType = col.DataType;
-                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
-                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
-                    }
 
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "Sucess锛�";
-                    objJsonResult.data = ds.Tables[0];
-                    objJsonResult.list = columnNameList;
-                    return objJsonResult;
+                ds = oCN.RunProcReturn("select * from h_v_Gy_ProcPriceList where HItemID = " + HItemID, "h_v_Gy_ProcPriceList");
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
                 }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
             }
             catch (Exception e)
             {
@@ -253,5 +217,203 @@
             }
         }
         #endregion
+
+        #region 宸ュ簭宸ヤ环 鍒犻櫎
+        [Route("Gy_ProcPrice/DelProcPrice")]
+        [HttpGet]
+        public object DelProcPrice(int HInterID, string User)
+        {
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_ProcPriceList_Delete", 1, false, User))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳潈闄愬垹闄わ紒";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                DAL.ClsGy_ProcPrice_Ctl BillNew = new DAL.ClsGy_ProcPrice_Ctl();
+                var sReturn = "";
+                if (BillNew.ShowBill(HInterID, ref sReturn))
+                {
+                    foreach (Model.ClsGy_ProcPrice_Model oSub in BillNew.DetailColl)
+                    {
+                        if (oSub.HChecker.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+
+
+                    bool flag = false;
+                    oCN.BeginTran();//寮�鍚簨鍔�
+
+                    flag= BillNew.DeleteByID(HInterID);
+
+                    oCN.Commit();//缁撴潫浜嬪姟
+
+                    if (flag)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍒犻櫎澶辫触锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                }
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "褰撳墠鍗曟嵁涓嶅瓨鍦�,鏃犳硶鍒犻櫎锛�";
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                oCN.RollBack();//鍥炴粴浜嬪姟
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region [宸ュ簭宸ヤ环瀹℃牳銆佸弽瀹℃牳]
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Gy_ProcPrice/AuditGy_ProcPrice")]
+        [HttpGet]
+        public object AuditGy_ProcPrice(int HInterID, int IsAudit, string CurUserName)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_ProcPriceList_Check", 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                DBUtility.ClsPub.CurUserName = CurUserName;
+                DAL.ClsGy_ProcPrice_Ctl BillNew = new DAL.ClsGy_ProcPrice_Ctl();
+                var sReturn = "";
+                if (BillNew.ShowBill(HInterID, ref sReturn))
+                {
+                    foreach (Model.ClsGy_ProcPrice_Model oSub in BillNew.DetailColl)
+                    {
+                        if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                        {
+                            if (oSub.HChecker.Trim() != "")
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
+                        if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                        {
+                            if (oSub.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;
+                }
+
+                foreach (Model.ClsGy_ProcPrice_Model oSub in BillNew.DetailColl)
+                {
+                    if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                    {
+                        //瀹℃牳鎻愪氦
+                        if (BillNew.CheckBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                        {
+                            objJsonResult.code = "1";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳鎴愬姛";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "1";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                    {
+                        //鍙嶅鏍告彁浜bandonCheck
+                        if (BillNew.AbandonCheck(HInterID, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                        {
+                            objJsonResult.code = "1";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "1";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
     }
 }
\ No newline at end of file
diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
index 9c0b28c..3ac7d95 100644
--- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs"
@@ -143,6 +143,9 @@
                     return objJsonResult;
                 }
 
+                //淇敼瀛楁 HSTOCKINORGID
+                oCN.RunProc("update Sc_ICMOBillSub set HSTOCKINORGID=" + HPRDORGID + " where HInterID=" + HInterID);
+
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;
                 objJsonResult.Message = null;
diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj
index 65e571c..e57ce48 100644
--- a/WebAPI/WebAPI.csproj
+++ b/WebAPI/WebAPI.csproj
@@ -470,6 +470,7 @@
     <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_DutyBillController.cs" />
     <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_EquipStatusController.cs" />
     <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_MatePriceSupController.cs" />
+    <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_MaterTypeBillController.cs" />
     <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_MouldStatusController.cs" />
     <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_OperatorController.cs" />
     <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_PaymentConditionListBillController.cs" />
@@ -927,6 +928,7 @@
     <Folder Include="Views\Gy_ICBomBill\" />
     <Folder Include="Views\Gy_MateMould\" />
     <Folder Include="Views\Gy_MatePriceSup\" />
+    <Folder Include="Views\Gy_MaterTypeBill\" />
     <Folder Include="Views\Gy_MouldStatus\" />
     <Folder Include="Views\Gy_Operator\" />
     <Folder Include="Views\Gy_PackType\" />

--
Gitblit v1.9.1