杨乐
2022-02-10 777db38816776abbe4b864d26a6c0381b75e8f9d
WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
@@ -30,14 +30,30 @@
        {
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            try
            {
                //委外工序发出反序列化
                msg1 = "[" + msg1.ToString() + "]";
                List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg1);
                string msg2 = "[" + sArray[0].ToString() + "]";
                string user = sArray[1].ToString();
                //判断是否有编辑权限
                if (!DBUtility.ClsPub.Security_Log("Cj_StationInBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无编辑权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg2);
                long HMainInterID = 0;
                HMainInterID = list[0].HMainInterID;
                long HProcExchInterID = list[0].lngBillKey;//流转卡主内码
                if (HProcExchInterID <= 0)
                {
                    objJsonResult.code = "0";
@@ -276,6 +292,18 @@
                }
                oCN.Commit();
                string sReturn = "";
                if (oSystemParameter.ShowBill(ref sReturn) == true)
                {
                    if (oSystemParameter.omodel.MES_StationInBill_SaveAutoAddnew == "Y") //系统参数  自动审核
                    {
                        objJsonResult.Verify = "Y";
                    }
                    else
                    {
                        objJsonResult.Verify = "N";
                    }
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "新增单据成功!";
@@ -348,28 +376,38 @@
        }
        #endregion
        #region 返回委外工序接收单列表
        #region 返回工序进站接收单列表
        [Route("Cj_StationInBill/get_Display")]
        [HttpGet]
        public object get_Display(string sWhere)
        public object get_Display(string sWhere,string user)
        {
            try
            {
                //判断是否有查询权限
                if (!DBUtility.ClsPub.Security_Log("Cj_StationInBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查询权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_MES_StationInBillList " + sWhere+ " order by 进站时间 desc", "h_v_MES_StationInBillList");
                    ds = oCN.RunProcReturn("select * from h_v_MES_StationInBillList order by hmainid desc", "h_v_MES_StationInBillList");
                }
                else
                {
                    string sql1 = "select * from h_v_MES_StationInBillList where 1 = 1 ";
                    string sql = sql1 + sWhere;
                    string sql = sql1 + sWhere+ " order by hmainid desc";
                    ds = oCN.RunProcReturn(sql, "h_v_MES_StationInBillList");
                }
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查询数据异常,请与管理员联系!";
                    objJsonResult.Message = "无记录,请与管理员联系!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -480,9 +518,9 @@
        {
            try
            {
                string ModRightNameCheck = "MES_StationInBill_Check";
                string ModRightNameCheck = "Cj_StationInBill_Check";
                //审核权限
                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true,CurUserName))
                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false,CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -569,8 +607,8 @@
                ds1 = oCN.RunProcReturn("select HLastProc,HFstProc " +
                    " from Sc_ProcessExchangeBillMain a " +
                    " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID " +
                    " Where a.HInterID=(Select HProcExchInterID from Sc_StationInBillMain Where HInterID=55) " +
                    " and b.HEntryID=(Select HProcExchEntryID from Sc_StationInBillMain Where HInterID=55)", "Sc_ProcessExchangeBillMain");
                    " Where a.HInterID=(Select HProcExchInterID from Sc_StationInBillMain Where HInterID="+ lngBillKey + ") " +
                    " and b.HEntryID=(Select HProcExchEntryID from Sc_StationInBillMain Where HInterID="+ lngBillKey + ")", "Sc_ProcessExchangeBillMain");
                if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
                {
                }
@@ -597,6 +635,17 @@
        {
            try
            {
                string ModRightNameCheck = "Cj_StationInBill_Check";
                //审核权限
                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "反审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (HInterID == 0)
                {
                    objJsonResult.code = "0";
@@ -680,8 +729,8 @@
                ds1 = oCN.RunProcReturn("select HLastProc,HFstProc " +
                    " from Sc_ProcessExchangeBillMain a " +
                    " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID " +
                    " Where a.HInterID=(Select HProcExchInterID from Sc_StationInBillMain Where HInterID=55) " +
                    " and b.HEntryID=(Select HProcExchEntryID from Sc_StationInBillMain Where HInterID=55)", "Sc_ProcessExchangeBillMain");
                    " Where a.HInterID=(Select HProcExchInterID from Sc_StationInBillMain Where HInterID="+ lngBillKey + ") " +
                    " and b.HEntryID=(Select HProcExchEntryID from Sc_StationInBillMain Where HInterID="+ lngBillKey + ")", "Sc_ProcessExchangeBillMain");
                if (ds1 == null || ds1.Tables[0].Rows.Count == 0)
                {
                }
@@ -777,9 +826,8 @@
        {
            try
            {
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log("MES_StationInBill_Delete", 1, true, HDeleteMan))
                if (!DBUtility.ClsPub.Security_Log("Cj_StationInBill_Drop", 1, false, HDeleteMan))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -867,5 +915,41 @@
            }
        }
        #endregion
        #region 查看工序流转卡关联数量列表加载
        [Route("Cj_StationInBill/GetStationQtyList")]
        [HttpGet]
        public object GetStationQtyList(string HInterID)
        {
            try
            {
                ds = oCN.RunProcReturn("execute h_p_Sc_ProcExchBilltransRelationQty @HInterID=" + HInterID, "h_p_Sc_ProcExchBilltransRelationQty");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有你要找的记录!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "返回记录成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}