yangle
2024-11-28 f9c66dcfca26da4eeba5c87df4ca3916461e37f8
WebAPI/Controllers/CJGL/Sc_WorkBeginDotCheckBillController.cs
@@ -110,7 +110,7 @@
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from h_v_Sc_WorkBeginDotCheckBillMainList where HInterID = " + HInterID, " h_v_Sc_WorkBeginDotCheckBillMainList");
                ds = oCN.RunProcReturn("select * from h_v_Sc_WorkBeginDotCheckBillMainList_Edit where HInterID = " + HInterID, " h_v_Sc_WorkBeginDotCheckBillMainList_Edit");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -213,7 +213,7 @@
                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                    {
@@ -318,6 +318,7 @@
                oCN.BeginTran();
                oCN.RunProc("delete from Sc_WorkBeginDotCheckBillMain where HInterID = " + HInterID);
                oCN.RunProc("delete from Sc_WorkBeginDotCheckBillSub where HInterID = " + HInterID);
                oCN.Commit();
@@ -761,6 +762,107 @@
        }
        #endregion
        #region 报工台跳转获取数据
        [Route("Sc_WorkBeginDotCheckBill/Sc_WorkBeginDotCheckBillList")]
        [HttpGet]
        public object Sc_WorkBeginDotCheckBillList(string HMaterID, string HProcID,string HSourceID, string SCOrder, string User)
        {
            try
            {
                List<DataTable> tableList = new List<DataTable>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Sc_WorkBeginDotCheckBillMain_Edit", 1, false, User))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查询失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (HMaterID == null || HMaterID.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "物料不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (HProcID == null || HProcID.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "工序不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (HSourceID == null || HSourceID.Equals(""))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "生产资源不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("exec h_p_WorkBeginDotCheckList '" + HMaterID + "','" + HProcID + "','" + HSourceID + "','"+ SCOrder + "'", "h_p_WorkBeginDotCheckList");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "查询成功!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 根据生产资源获取最新的模具
        [Route("Sc_WorkBeginDotCheckBill/Sc_WorkBeginDotCheckBill_HMould")]
        [HttpGet]
        public object Sc_WorkBeginDotCheckBill_HMould(string HSourceID, string User)
        {
            try
            {
                List<DataTable> tableList = new List<DataTable>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Sc_WorkBeginDotCheckBillMain_Edit", 1, false, User))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查询失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select top 1 a.*,b.HName 模具名称 from Sc_MouldUpperBillSub a left join Gy_MouldFileMain b on a.HMouldID=b.HInterID where a.HSourceID='" + HSourceID + "'order by HScanDate desc", "Sc_MouldUpperBillSub");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "查询成功!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 设备启动点检清单列表 查询       
        [Route("Sc_WorkBeginDotCheckBill/getGy_WorkBeginDotCheckListBillMainList")]
        [HttpGet]
@@ -846,7 +948,7 @@
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from h_v_Gy_WorkBeginDotCheckListBillMainList where HInterID = " + HInterID, " h_v_Gy_WorkBeginDotCheckListBillMainList");
                ds = oCN.RunProcReturn("select * from h_v_Gy_WorkBeginDotCheckListBillMainList_Edit where HInterID = " + HInterID, " h_v_Gy_WorkBeginDotCheckListBillMainList_Edit");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -903,7 +1005,7 @@
                    if (refSav == "Add")
                    {
                        //单据号是否重复
                        if (OBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, OBill.omodel.HInterID))
                        if (OBill1.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, OBill1.omodel.HInterID))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -914,7 +1016,7 @@
                    }
                    if (refSav == "Update")
                    {
                        if (OBill.ShowBill(oItem.HInterID, ref s) == false)
                        if (OBill1.ShowBill(oItem.HInterID, ref s) == false)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -923,7 +1025,7 @@
                            return objJsonResult;
                        }
                        //判断是否可编辑
                        if (OBill.omodel.HChecker != "" && OBill.omodel.HChecker != null)
                        if (OBill1.omodel.HChecker != "" && OBill1.omodel.HChecker != null)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -931,7 +1033,7 @@
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        if (OBill.omodel.HBillStatus > 1)
                        if (OBill1.omodel.HBillStatus > 1)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
@@ -949,7 +1051,7 @@
                    oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                    {
@@ -1054,6 +1156,7 @@
                oCN.BeginTran();
                oCN.RunProc("delete from Gy_WorkBeginDotCheckListBillMain where HInterID = " + HInterID);
                oCN.RunProc("delete from Gy_WorkBeginDotCheckListBillSub where HInterID = " + HInterID);
                oCN.Commit();
@@ -1497,5 +1600,61 @@
        }
        #endregion
        #region 启动点检子表根据类型 查询  日常点检
        [Route("Sc_WorkBeginDotCheckBill/getSc_WorkDotCheckList_Day")]
        [HttpGet]
        public object getSc_WorkDotCheckList_Day(string sWhere, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere);
                string Type = dic["Type"].ToString();
                string HInterId = dic["HInterId"].ToString();
                ds = oCN.RunProcReturn("exec h_p_DotCheckDayList '" + Type + "','" + HInterId + "'", "h_p_DotCheckDayList");
                if (ds.Tables.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "未查询到数据!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "当月没有数据产生!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //添加列名
                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
    }
}