王 垚
2022-07-06 91fae0337579f3259c2920ed3ee0a742bd145127
WebAPI/Controllers/WebAPIController.cs
@@ -2,6 +2,7 @@
using DBUtility;
using Microsoft.AspNet.SignalR;
using Model;
using Newtonsoft.Json.Linq;
using SQLHelper;
using System;
using System.Collections.Generic;
@@ -9,9 +10,11 @@
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using WebAPI.BLL;
using WebAPI.Models;
using WebAPI.Utility;
namespace WebAPI.Controllers
{
@@ -177,14 +180,15 @@
        {
            try
            {
                LogService.Write("测试登录错误");
                DataSet ds = null;
                ClsCNSRM oCnLoc = new ClsCNSRM();
                DAL.ClsUser oUser = new DAL.ClsUser();
                Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
                string sReturn = "测试";
                string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref sReturn);
                //LogService.Write(sReturn);
                //LogService.Write(FCusName);
                LogService.Write("测试1:" + DBUtility.ClsPub.sExeReturnInfo);
                string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
                LogService.Write("测试2:" + DBUtility.ClsPub.sExeReturnInfo);
                LogService.Write(FCusName);
                if (FCusName == "夏宝电器")
                    ds = oUser.CheckMainID(UserName.Trim(), DBUtility.ClsPub.StrToPsd(PassWord.Trim()));
                else
@@ -199,6 +203,7 @@
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "登录成功!";
@@ -210,6 +215,7 @@
            catch (Exception e)
            {
                LogService.Write("异常" + e.Message.ToString());
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "登录异常!" + e.ToString();
@@ -241,12 +247,13 @@
                    return objJsonResult; ;
                }
                //===========
                oDs = oCn.RunProcReturn("select Czmm from  Gy_Czygl where Czymc='" + UserName + "'", "Gy_Czygl");
                //LogService.Write("select Czmm from  Gy_Czygl where Czymc='" + UserName + "' and  Czmm = '" + DBUtility.ClsPub.StrToPsd(oldPassword.Trim()) + "'");
                oDs = oCn.RunProcReturn("select Czmm from  Gy_Czygl where Czymc='" + UserName + "' and  Czmm = '" + DBUtility.ClsPub.StrToPsd(oldPassword.Trim()) + "'", "Gy_Czygl");
                if (oDs == null || oDs.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有这个用户,不能修改密码!";
                    objJsonResult.Message = "原密码错误!";
                    objJsonResult.data = null;
                    return objJsonResult; ;
                }
@@ -376,13 +383,13 @@
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Insert into SRM_OpenTmp " +
                    " (HNumber,HModel,HName) " +
                    " Values('" + HNumber + "','" + HName + "','" + HName + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                //oCn.RunProc("Update Gy_OpenTmp set HEndflag=0 where HItemID=" + oModel.HParentID, ref ClsPub.sExeReturnInfo);
                oCn.Commit();
                //oCn.BeginTran();
                //oCn.RunProc("Insert into SRM_OpenTmp " +
                //    " (HNumber,HModel,HName) " +
                //    " Values('" + HNumber + "','" + HName + "','" + HName + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                ////修改上级为非末级代码
                ////oCn.RunProc("Update Gy_OpenTmp set HEndflag=0 where HItemID=" + oModel.HParentID, ref ClsPub.sExeReturnInfo);
                //oCn.Commit();
                objjson.code = "0";
                objjson.count = 1;
                objjson.Message = "保存成功!";
@@ -412,9 +419,9 @@
            ClsCNSRM oCn = new ClsCNSRM();
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Delete from SRM_OpenTmp where HItemID='" + DBUtility.ClsPub.isLong(HItemID) + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
                //oCn.BeginTran();
                //oCn.RunProc("Delete from SRM_OpenTmp where HItemID='" + DBUtility.ClsPub.isLong(HItemID) + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                //oCn.Commit();
                objjson.code = "0";
                objjson.count = 1;
                objjson.Message = "删除成功!";
@@ -811,5 +818,32 @@
            return objjson; ;
        }
        #endregion
        #region[打印idSession]
        [Route("linteridSession")]
        [HttpPost]
        public object linteridSession([FromBody] JObject linterid)
        {
            var _linterid = linterid["linterid"].ToString();
            var _huserName = linterid["HUserName"].ToString();
            var postMesseege = _linterid + ";" + _huserName;
            //HttpHelper.PostData("http://localhost:8082/AR-SRMLAYUI/layuiAdmin.std-v1.2.1/src/views/SRM/Api/SRM_Web_PoBarCodeBillApi.ashx", postMesseege);
            HttpHelper.PostData("http://60.191.21.116:9090/srmui/layuiAdmin.std-v1.2.1/src/views/SRM/Api/SRM_Web_PoBarCodeBillApi.ashx", postMesseege);
            SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
            string sql = $"Update Gy_BarCodeBill set HPrintQty=isnull(HPrintQty,0) + 1  where HItemID in ({_linterid})";
            oCn.RunProc(sql);
            objJsonResult.code = "0";
            objJsonResult.count = 0;
            objJsonResult.Message = "";
            objJsonResult.data = 1;
            return objJsonResult;
            //HttpContext.Current.Session["linterid"];
        }
        #endregion
    }
}