1.页面过滤条件:开始时间和结束时间(根据检验信息中的创建时间进行过滤)、站台(检验信息中的检验工序)、料号(PNL布局信息名称)、批次(lot号)
2.柱状图
3.饼状图
4.根据仓库、物料,维护物料的价格 2.根据表结构增加维护页面、列表页面
3个文件已修改
4个文件已添加
1068 ■■■■■ 已修改文件
DAL/DAL.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/基础资料/其他基础资料/ClsGy_MatePrice_Ctl.cs 201 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/Model.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/基础资料/其他基础资料/ClsGy_MatePrice_Model.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/华远datamapping/Gy_BarCodeReportController.cs 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_MatePriceController.cs 710 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/DAL.csproj
@@ -87,6 +87,7 @@
    <Compile Include="基础资料\公用基础资料\ClsGy_RepairClass_Ctl.cs" />
    <Compile Include="基础资料\公用基础资料\ClsGy_RepairCheckClass_Ctl.cs" />
    <Compile Include="仓库管理\ClsKf_ProductReceiveMaterialBill.cs" />
    <Compile Include="基础资料\其他基础资料\ClsGy_MatePrice_Ctl.cs" />
    <Compile Include="源单\InterFace源单\Cls_S_IF_ICMOBillList_CusBarCodeBill_KaiBei.cs" />
    <Compile Include="源单\InterFace源单\Cls_S_IF_MoveStockRequestBillList.cs" />
    <Compile Include="生产管理\ClsSc_ShiftsBeginInfoBill.cs" />
DAL/»ù´¡×ÊÁÏ/ÆäËû»ù´¡×ÊÁÏ/ClsGy_MatePrice_Ctl.cs
New file
@@ -0,0 +1,201 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DAL
{
    public class ClsGy_MatePrice_Ctl : DBUtility.ClsGy_Base_Ctl
    {
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        //原代码 ç”¨äºŽ æ›¿æ¢å­é¡¹ç›®
        public string HOldNumber;
        public List<Model.ClsGy_MatePrice_Model> DetailColl = new List<Model.ClsGy_MatePrice_Model>();
        public Model.ClsGy_MatePrice_Model oModel = new Model.ClsGy_MatePrice_Model();
        //反审核
        public bool AbandonCheck(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                oCn.RunProc(" Update Gy_MatePriceSup set HChecker='',HCheckDate=null Where HItemID=" + lngBillKey.ToString());
                sReturn = "";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                return false;
            }
        }
        //审核
        public bool CheckBill(Int64 lngBillKey, ref string sReturn)
        {
            try
            {
                oCn.RunProc(" Update Gy_MaterPrice set HUsed=0,HChecker='" + DBUtility.ClsPub.CurUserName + "',HCheckDate='" + DBUtility.ClsPub.GetServerDate(-1) + "' Where HItemID=" + lngBillKey.ToString());
                //将其他 å·¥ä»·è®¾ç½®ä¸º åœç”¨
                //oCn.RunProc(" exec h_p_Gy_MatePriceSupStopflag   " + lngBillKey.ToString());
                //
                sReturn = "";
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                return false;
            }
        }
        //新增
        public override bool AddNew()
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Insert into " + MvarItemKey +
          " (HSupID,HCusID,HMaterID,HWHID,HPrice" +
          ",HStopflag,HRemark,HUseFlag,HMakeEmp,HMakeTime" +
          ",HCheckEmp,HCheckTime,HModifyEmp,HModifyTime,HStopEmp,HStopTime,HUSEORGID,HCREATEORGID) " +
          " values('" + oModel.HSupID + "', '" + oModel.HCusID + "', " + oModel.HMaterID.ToString() + ", " + oModel.HWHID.ToString() + ", " + oModel.HPrice.ToString() +
          ", " + Convert.ToString(oModel.HStopflag ? 1 : 0) + ", '" + oModel.HRemark + "', " + oModel.HUseFlag.ToString() + ", '" + oModel.HMakeEmp.ToString() + "', '" + oModel.HMakeTime.ToString() + "'" +
          ", '" + oModel.HCheckEmp.ToString() + "', '" + oModel.HCheckTime.ToString() + "', '" + oModel.HModifyEmp.ToString() + "', '" + oModel.HModifyTime.ToString() + "', '" + oModel.HStopEmp.ToString() + "', '" + oModel.HStopTime.ToString() + "', '" + oModel.HUSEORGID + "', '" + oModel.HCREATEORGID + "')");
                // ä¿®æ”¹ç»“束
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        ////修改
        public override bool ModifyByID(Int64 sItemID)
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Update " + MvarItemKey + " set " +
    "HSupID=" + oModel.HSupID.ToString() +
    ",HCusID=" + oModel.HCusID.ToString() +
    ",HMaterID=" + oModel.HMaterID.ToString() +
    ",HWHID=" + oModel.HWHID.ToString() +
    ",HPrice=" + oModel.HPrice.ToString() +
    ",HStopflag=" + Convert.ToString(oModel.HStopflag ? 1 : 0) +
    ",HRemark='" + oModel.HRemark + "'" +
    ",HUseFlag='" + oModel.HUseFlag.ToString() + "'" +
    ",HCheckEmp='" + oModel.HCheckEmp.ToString() + "'" +
    ",HCheckTime='" + oModel.HCheckTime + "'" +
    ",HModifyEmp='" + oModel.HModifyEmp + "'" +
    ",HModifyTime=GETDATE()" +
    ",HStopEmp='" + oModel.HStopEmp + "'" +
    ",HStopTime='" + oModel.HStopTime + "'" +
    ",HUSEORGID=" + oModel.HUSEORGID.ToString() +
    ",HCREATEORGID=" + oModel.HCREATEORGID.ToString() +
    " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
        //显示单据
        //public bool ShowBill(Int64 lngBillKey, ref string sReturn)
        //{
        //    try
        //    {
        //        //查询主表
        //        DataSet DsSub = new DataSet();
        //        DsSub = oCn.RunProcReturn("Select * from Gy_MatePriceSup Where HitemID=" + lngBillKey.ToString(), "Gy_MatePriceSup");
        //        DetailColl.Clear();//清空
        //        for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++)
        //        {
        //            Model.ClsGy_MatePriceSup_Model oSub = new Model.ClsGy_MatePriceSup_Model();
        //            oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"].ToString());
        //            oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"].ToString());
        //            oSub.HMaterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HMaterID"].ToString());
        //            oSub.HRelationID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HRelationID"].ToString());
        //            oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim();
        //            oSub.HBeginQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HBeginQty"].ToString());
        //            oSub.HEndQty = DBUtility.ClsPub.isSingle(DsSub.Tables[0].Rows[i]["HEndQty"].ToString());
        //            oSub.HUnitID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HUnitID"].ToString());
        //            oSub.HPrice = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HPrice"].ToString());
        //            oSub.HCurID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HCurID"].ToString());
        //            oSub.HType = DsSub.Tables[0].Rows[i]["HType"].ToString();
        //            oSub.HMaker = DsSub.Tables[0].Rows[i]["HMaker"].ToString();
        //            oSub.HMakeDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HMakeDate"]);
        //            oSub.HBeginDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HBeginDate"]);
        //            oSub.HEndDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEndDate"]);
        //            oSub.HChecker = DsSub.Tables[0].Rows[i]["HChecker"].ToString().Trim();
        //            oSub.HCheckDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HCheckDate"]);
        //            DetailColl.Add(oSub);
        //        }
        //        sReturn = "显示单据成功!";
        //        return true;
        //    }
        //    catch (Exception e)
        //    {
        //        sReturn = e.Message;
        //        return false;
        //    }
        //}
        //批改单据
        public bool BatchModifyBill(Int64 lngBillKey, double sPrice, ref string sReturn)
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc(" Update Gy_MatePriceSup set HPrice=" + sPrice.ToString() + "  Where HItemID=" + lngBillKey.ToString());
                sReturn = "修改单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                sReturn = e.Message;
                oCn.RollBack();
                return false;
            }
        }
        //得到采购价格资料
        public double GetMatePriceBySup(long HMaterID, long HSupID)
        {
            try
            {
                DataSet oDs = new DataSet();
                //
                oDs = oCn.RunProcReturn("exec  h_p_Gy_GetMatePrice_Sup " + HMaterID.ToString() + "," + HSupID.ToString(), "gy_czygl");
                double HPrice = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0]["单价"]);
                //
                return HPrice;
            }
            catch (Exception e)
            {
                return 0;
            }
        }
        //构造函数
        public ClsGy_MatePrice_Ctl()
        {
            MvarItemKey = "dbo.Gy_MaterPrice";
            MvarReportTitle = "样品资料设置";
            oModel = new Model.ClsGy_MatePrice_Model();
        }
    }
}
Model/Model.csproj
@@ -99,6 +99,7 @@
    <Compile Include="ClsGy_PatrolCheckItemMethod_Model.cs" />
    <Compile Include="仓库管理\ClsKf_TrolleyPositionBillMain.cs" />
    <Compile Include="仓库管理\ClsKf_TrolleyPositionBillSub.cs" />
    <Compile Include="基础资料\其他基础资料\ClsGy_MatePrice_Model.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_PatrolCheckItemClass_Model.cs" />
    <Compile Include="仓库管理\ClsKf_WorkShopICStockBillMain.cs" />
    <Compile Include="基础资料\基础资料\ClsGy_MaintainClass_Model.cs" />
Model/»ù´¡×ÊÁÏ/ÆäËû»ù´¡×ÊÁÏ/ClsGy_MatePrice_Model.cs
New file
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Model
{
    public class ClsGy_MatePrice_Model : DBUtility.ClsGy_Base_Model
    {
        public long HSupID;                // ä¾›åº”商ID (default 0)
        public long HCusID;                // å®¢æˆ·ID (default 0)
        public long HMaterID;              // ç‰©æ–™ID (default 0)
        public long HWHID;                 // ä»“库ID (default 0)
        public decimal HPrice;             // å•ä»· (money default 0)
    }
}
WebAPI/Controllers/»ªÔ¶datamapping/Gy_BarCodeReportController.cs
New file
@@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebAPI.Models;
using System.Web;
using System.IO;
using SyntacticSugar.constant;
using Newtonsoft.Json;
namespace WebAPI.Controllers.基础资料.基础资料
{
    public class Gy_BarCodeReportController : ApiController
    {
        //获取系统参数
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        public string sWhere = "";
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"];
        // GET: Gy_BarCodeReport
        [Route("Gy_BarCodeReportController/Get_Stations")]
        [HttpGet]
        public object Get_Stations()
        {
            try
            {
                DataSet oDs = new DataSet();
                //==========
                oDs = oCN.RunProcReturn("select DISTINCT æ£€éªŒå·¥åº from h_v_QC_CheckNote_PNL_Temp_List", "h_v_QC_CheckNote_PNL_Temp_List");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "获取成功!";
                objJsonResult.data = oDs.Tables[0];
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "删除失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        [Route("Gy_BarCodeReportController/GetMaterialNos")]
        [HttpGet]
        public object GetMaterialNos()
        {
            try
            {
                DataSet oDs = new DataSet();
                //==========
                oDs = oCN.RunProcReturn("select DISTINCT HLayOutName from Gy_PNLInfo", "Gy_PNLInfo");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "获取成功!";
                objJsonResult.data = oDs.Tables[0];
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "删除失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #region åˆ—表查询
        [Route("Gy_BarCodeReportController/list")]
        [HttpGet]
        public object list(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //string sql1 = "s"+"select * from h_v_Gy_BarCodeReport";
                //string sql = sql1 + sWhere + "  ";
                //ds = oCN.RunProcReturn(sql, "h_v_Gy_BarCodeReport");
                ds =oCN.RunProcReturn("select a.HCheckProc æ£€éªŒå·¥åº,b.HLayOutName æ–™å·,a.HBarCode PNL条码编号,HPCSNo PCS号,a.HPageIndex æ­£åé¢,a.HBadReason ä¸è‰¯åŽŸå›  from QC_CheckNote_PNL_Temp a INNER JOIN Gy_PNLInfo b on a.HMakeDate=b.HMakeDate where 1=1 " + sWhere  , "h_v_Gy_BarCodeReport");
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_MatePriceController.cs
New file
@@ -0,0 +1,710 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebAPI.Models;
namespace WebAPI.Controllers.基础资料.基础资料
{
    public class Gy_MatePriceController : ApiController
    {
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        // GET: Gy_MatePrice
        #region  æ ·å“ åˆ—表
        [Route("Gy_MatePriceController/MatePriceList")]
        [HttpGet]
        public object MatePriceList(string sWhere, string user, string Organization)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Sc_MouldUpperBill_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_Gy_MaterPrice where 1 = 1 ");
                string sql = sql1 + sWhere;
                ds = oCN.RunProcReturn(sql, "h_v_Gy_MaterPrice");
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                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_MatePrice/cx")]
        [HttpGet]
        public object cx(string HItemID, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_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_Gy_MatePriceEdit where HItemID = " + HItemID);
                ds = oCN.RunProcReturn(sql1, "h_v_Gy_MatePriceEdit");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region  ç¼–辑
        [Route("Gy_MatePriceController/MatePriceEdit")]
        [HttpPost]
        public object MatePriceEdit([FromBody] JObject msg)
        {
            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();
            ////编辑权限
            //if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_Edit", 1, false, msg2))
            //{
            //    objJsonResult.code = "0";
            //    objJsonResult.count = 0;
            //    objJsonResult.Message = "无保存权限!";
            //    objJsonResult.data = null;
            //    return objJsonResult;
            //}
            ListModels oListModels = new ListModels();
            try
            {
                DAL.ClsGy_MatePrice_Ctl oBill = new DAL.ClsGy_MatePrice_Ctl();
                List<Model.ClsGy_MatePrice_Model> lsmain = new List<Model.ClsGy_MatePrice_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Gy_MatePrice(msg1);
                foreach (Model.ClsGy_MatePrice_Model oItem in lsmain)
                {
                    //新增时判断
                    #region çˆ¶çº§æ ¡éªŒæ–¹æ³•(api调用先注释掉,)
                    /*
                    if (oItem.HItemID == 0)
                    {
                        if (ds == null || ds.Tables[0].Rows.Count > 0)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "保存失败!代码重复!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        //检查父级是否存在
                        string sParent;
                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
                        if (sParent.Trim() == "")
                        {
                            oBill.oModel.HParentID = 0;
                        }
                        else
                        {
                            if (oBill.HavParentCode(sParent.Trim(), HItemID))
                            {
                                oBill.oModel.HParentID = oBill.oModel.HItemID;
                            }
                            else
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "保存失败!上级代码不存在或被禁用!";
                                objJsonResult.data = 1;
                                return objJsonResult;
                            }
                        }
                    }
                    else//编辑时判断
                    {
                        //检查父级是否存在
                        string sParent;
                        sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
                        if (sParent.Trim() == "")
                        {
                            oBill.oModel.HParentID = 0;
                        }
                        else
                        {
                            if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID))
                            {
                                oBill.oModel.HParentID = oBill.oModel.HItemID;
                            }
                            else
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "保存失败!上级代码不存在或被禁用!";
                                objJsonResult.data = 1;
                                return objJsonResult;
                            }
                        }
                    }
                    */
                    #endregion
                    //oItem.HUSEORGID = Convert.ToInt32(msg_HUSEORGID); //组织id
                    oBill.oModel = oItem;
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (oBill.oModel.HItemID == 0)
                {
                    bResult = oBill.AddNew();
                }
                else
                {
                    //是否已经审核判断
                    DataSet Maxds = oCN.RunProcReturn("select * from h_v_Gy_MatePriceEdit where HItemID =  " + oBill.oModel.HItemID, "h_v_Gy_MatePriceEdit");
                    //if (Maxds != null && Maxds.Tables[0].Rows[0]["审核人"].ToString() != "")
                    //{
                    //    objJsonResult.code = "0";
                    //    objJsonResult.count = 0;
                    //    objJsonResult.Message = "单据已审核无法编辑!";
                    //    objJsonResult.data = 1;
                    //    return objJsonResult;
                    //}
                    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_MatePriceController/Delete")]
        [HttpGet]
        public object Delete(string HItemID, string user)
        {
            DataSet ds;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("Gy_MatePriceSupList_Delete", 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_MaterPrice where HItemID=" + HItemID, "Gy_MaterPrice");
                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 (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "数据已审核无法删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.RunProc("delete from Gy_MaterPrice 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 å®¡æ ¸ã€åå®¡æ ¸
        [Route("Gy_MatePriceController/MatePriceCheck")]
        [HttpGet]
        public object MatePriceCheck(int HInterID, int IsAudit, string CurUserName)
        {
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameterUnit_Check", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_MaterPrice where HItemID=" + HInterID, "Gy_MaterPrice");
                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)  //审核判断
                {
                    //审核前控制=========================================
                    string sql1 = "exec h_p_Gy_MaterPrice_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPrice_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_MaterPrice set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
                    //审核后控制=========================================
                    string sql2 = "exec h_p_Gy_MaterPrice_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterPrice_AfterCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "审核成功";
                    objJsonResult.data = null;
                }
                if (IsAudit == 1) //反审核判断
                {
                    //反审核前控制=========================================
                    string sql1 = "exec h_p_Gy_MaterPrice_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPrice_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_MaterPrice set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
                    //反审核后控制=========================================
                    string sql2 = "exec h_p_Gy_MaterPrice_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterPrice_AfterUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    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
        #region  ç¦ç”¨ã€åç¦ç”¨
        [Route("Gy_MatePriceController/StopGy_MaterPrice")]
        [HttpGet]
        public object StopGy_MaterPrice(int HInterID, int IsStop, string CurUserName)
        {
            try
            {
                //禁用权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_TechnologyParameterUnit_Stop", 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "禁用失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                var ds = oCN.RunProcReturn("select * from Gy_MaterPrice where HItemID=" + HInterID, "Gy_MaterPrice");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (IsStop == 0)  //禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已禁用!不能再次禁用!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsStop == 1) //反禁用判断
                    {
                        if (ds.Tables[0].Rows[0]["HStopEmp"].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 (IsStop == 0)  //禁用判断
                {
                    //禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_MaterPrice_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPrice_BeforeStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_MaterPrice set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
                    //禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_MaterPrice_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterPrice_AfterStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "禁用成功";
                    objJsonResult.data = null;
                }
                if (IsStop == 1) //反禁用判断
                {
                    //反禁用前控制=========================================
                    string sql1 = "exec h_p_Gy_Gy_MaterPrice_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_Gy_MaterPrice_BeforeUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    oCN.RunProc("update Gy_MaterPrice set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
                    //反禁用后控制=========================================
                    string sql2 = "exec h_p_Gy_MaterPrice_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterPrice_AfterUnStopCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
                    }
                    //==================================================================================
                    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
    }
}
WebAPI/ListModels.cs
@@ -2378,6 +2378,18 @@
            List<Model.ClsGy_MatePriceSup_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_MatePriceSup_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理采购价格表的json
        /// </summary>
        /// <param name="jsonString"></param>
        /// <returns></returns>
        public List<Model.ClsGy_MatePrice_Model> getObjectByJson_Gy_MatePrice(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_MatePrice_Model> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_MatePrice_Model>>(jsonString);
            return list;
        }
        /// <summary>
        /// å¤„理器具状态表的json