王 垚
2022-04-06 9167264eeb081fdbb94d8a1d2f76f35a6ccdd5fe
WebAPI/Controllers/SCGL/Sc_MESTransFerWorkBillController.cs
@@ -45,8 +45,9 @@
            string UserName = sArray[1].ToString();
            string refSav = sArray[2].ToString();
            DBUtility.ClsPub.CurUserName = UserName;
            //保存权限
            if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Edit", 1, true, DBUtility.ClsPub.CurUserName))
            if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Edit", 1, false, DBUtility.ClsPub.CurUserName))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
@@ -54,6 +55,7 @@
                objJsonResult.data = null;
                return objJsonResult;
            }
            //判断会计期是否合理
            string s = "";
            int sYear = 0;
@@ -140,14 +142,24 @@
                        objJsonResult.data = 1;
                        return objJsonResult;
                    }
                    string[] arrStr = oItem.HCopyMan.Split(',');
                    //接收人表体数据
                    //string[] arrStr = oItem.HSendMan.Split(','); //发送人
                    //arrStr = oItem.HReceiveMan.Split(',');  //接收人
                    string[] arrStr = oItem.HCopyMan.Split(',');  //抄送人
                    List<string> b = new List<string>(arrStr);
                    b.Add(oItem.HSendMan);
                    b.Add(oItem.HReceiveMan);
                    arrStr = b.ToArray();
                    //抄送人表体数据
                    for (int i = 1; i <= arrStr.Length; i++)
                    {
                        Models.ClsOA_ErrMsgBackBillSub2 sb = new Models.ClsOA_ErrMsgBackBillSub2();
                        sb.HEntryID = i;
                        sb.HReceiveMan = arrStr[i - 1];
                        if (arrStr[i-1].ToString() == oItem.HSendMan)
                        {
                            sb.HReadFlag = true;
                        }
                        oBill.DetailColl2.Add(sb);
                    }
                    oBill.omodel = oItem;
@@ -231,7 +243,7 @@
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, true, CurUserName))
                if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -361,23 +373,34 @@
        {
            try
            {
                ds = Get_TransFerBillList(sWhere);
                if (ds == null)
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("OA_ErrMsgBackBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查询数据异常,请与管理员联系!";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "返回记录成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
                ds = Get_TransFerBillList(sWhere);
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
                //}
                //else
                //{
                //objJsonResult.code = "0";
                //objJsonResult.count = 0;
                //objJsonResult.Message = "无数据";
                //objJsonResult.data = null;
                //return objJsonResult;
                //}
            }
            catch (Exception ex)
            {
@@ -400,7 +423,7 @@
                                      A.HSourceInterID,A.HSourceEntryID,A.HSourceBillNo,A.HSourceBillType
                                      from OA_ErrMsgBackBillMain A 
                                      inner join  OA_ErrMsgBackBillSub2 B on A.HInterID=B.HInterID 
                                      left join Gy_Department D on A.HDeptID=D.HItemID where 1=1 " + sWhere + "");
                                      left join Gy_Department D on A.HDeptID=D.HItemID where 1=1 " + sWhere + "   order by HItemID desc ");
            return new SQLHelper.ClsCN().RunProcReturn(sql, "OA_ErrMsgBackBillMain");
        }
@@ -448,5 +471,103 @@
            return objJsonResult; ;
        }
        #endregion
        #region [模具改制申请单删除功能]
        /// <summary>
        /// 模具改制申请单删除功能
        /// </summary>
        /// <returns></returns>
        [Route("Sc_MESTransFerWorkBill/Get_DeleteTransFerBill")]
        [HttpGet]
        public object Get_DeleteTransFerBill(string HInterID,string HEntryID, string user)
        {
            //编辑权限
            if (!DBUtility.ClsPub.Security_Log_second("OA_ErrMsgBackBill_Delete", 1, false, user))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无删除权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            string s = "";
            Int64 lngBillKey = 0;
            try
            {
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
                if (lngBillKey == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据ID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DLL.ClsOA_ErrMsgBackBill oBill = new DLL.ClsOA_ErrMsgBackBill();
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    if (oBill.omodel.HBillStatus > 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据当前处于不能删除状态,不能删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已经审核,不能删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (!DBUtility.Xt_BaseBillFun.Fun_AllowDeleteBill(oBill, ref s))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = s;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    bool IsDete = oBill.DeleteBill(lngBillKey, HEntryID, ref DBUtility.ClsPub.sExeReturnInfo);
                    if (IsDete)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据未找到";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = e.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}