yxj
2022-01-27 106eaee4e79735dee332900cc02bc6c21b554f89
Merge branch 'master' of http://101.37.171.70:10101/r/MESWMS-WEBS
2个文件已修改
1个文件已添加
143 ■■■■ 已修改文件
CLOUDWEB/CLOUDWEB.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CLOUDWEB/Log.cs 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CLOUDWEB/WebService1.asmx.cs 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CLOUDWEB/CLOUDWEB.csproj
@@ -317,6 +317,7 @@
    <Compile Include="Global.asax.cs">
      <DependentUpon>Global.asax</DependentUpon>
    </Compile>
    <Compile Include="Log.cs" />
    <Compile Include="LogService.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Site.Master.cs">
CLOUDWEB/Log.cs
New file
@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
namespace CLOUDWEB
{
    public class Log
    {
        public static void WriteListToTextFile(List<string> list)
        {
            string uploadPath = System.Web.HttpContext.Current.Server.MapPath("./") + "Log\\";
            if (!Directory.Exists(uploadPath))
            {
                Directory.CreateDirectory(uploadPath);
            }
            string fileName = DateTime.Now.ToString("yyyy-MM-dd") + "_sql.log";
            string txtFile = uploadPath + fileName;
            //创建一个文件流,用以写入或者创建一个StreamWriter
            FileStream fs = new FileStream(txtFile, FileMode.OpenOrCreate, FileAccess.Write);
            StreamWriter sw = new StreamWriter(fs);
            sw.Flush();
            // 使用StreamWriter来往文件中写入内容
            sw.BaseStream.Seek(0, SeekOrigin.Begin);
            for (int i = 0; i < list.Count; i++) sw.WriteLine(list[i]);
            //关闭此文件t
            sw.Flush();
            sw.Close();
            fs.Close();
        }
        public static void LogInfo(string msg)
        {
            string uploadPath = System.Web.HttpContext.Current.Server.MapPath("./") + "Log\\";
            if (!Directory.Exists(uploadPath))
            {
                Directory.CreateDirectory(uploadPath);
            }
            string fileName = DateTime.Now.Ticks.ToString() + ".log";
            FileStream fs;
            StreamWriter sw;
            string sFileName = uploadPath + fileName;
            if (File.Exists(sFileName))
            //验证文件是否存在,有则追加,无则创建
            {
                fs = new FileStream(sFileName, FileMode.Append, FileAccess.Write);
            }
            else
            {
                fs = new FileStream(sFileName, FileMode.Create, FileAccess.Write);
            }
            sw = new StreamWriter(fs);
            msg = String.Format("------------------------{0}------------------------------\r\n", DateTime.Now) + msg;
            msg += "\r\n";
            sw.WriteLine(msg);
            sw.Close();
            fs.Close();
        }
        public static void LogSaveInfo(string msg)
        {
            string uploadPath = System.Web.HttpContext.Current.Server.MapPath("./") + "Log\\";
            if (!Directory.Exists(uploadPath))
            {
                Directory.CreateDirectory(uploadPath);
            }
            string fileName = DateTime.Now.ToString("yyyy-MM-dd") + ".log";
            FileStream fs;
            StreamWriter sw;
            string sFileName = uploadPath + fileName;
            if (File.Exists(sFileName))
            //验证文件是否存在,有则追加,无则创建
            {
                fs = new FileStream(sFileName, FileMode.Append, FileAccess.Write);
            }
            else
            {
                fs = new FileStream(sFileName, FileMode.Create, FileAccess.Write);
            }
            sw = new StreamWriter(fs);
            msg = String.Format("------------------------{0}------------------------------\r\n", DateTime.Now) + msg;
            msg += "\r\n";
            sw.WriteLine(msg);
            sw.Close();
            fs.Close();
        }
    }
}
CLOUDWEB/WebService1.asmx.cs
@@ -5469,6 +5469,7 @@
        [WebMethod]
        public bool set_SaveICMOProductReportBill_LayuiYqn(Model.ClsSc_ICMOReportBillMain oMain, string workcode, int HSourceID, string sHSourceType,string HProcID, ref string sErrMsg)
        {
            Log.LogInfo(workcode.ToString()); //记录提交数据
            //获取系统参数
            Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
            if (oSystemParameter.ShowBill(ref sErrMsg) == false)
@@ -5580,9 +5581,10 @@
                //根据生产订单号查询生产订单表,拿到组织、车间
                DataSet ds0 = oCn.RunProcReturn("select HPRDORGID,HDeptID from Sc_ICMOBillMain with(nolock) where HBillNo='" + workcode + "'", "Sc_ICMOBillMain");
                //查询产量汇报临时表
                DataSet ds = oCn.RunProcReturn("select top 1 * from  Sc_ICMOBillWorkQtyStatus_Tmp with(nolock) where HICMOReportInterID='" + oMain.HInterID + "' and HICMOReportBillNo='" + oMain.HBillNo + "' and HProcID='" + HProcID + "'", "Sc_ICMOBillWorkQtyStatus_Tmp");
                if (ds.Tables[0].Rows.Count <= 0)
                {
                    sErrMsg = "当前单据无产量汇报记录!";
@@ -5594,32 +5596,36 @@
                oMain.HPRDORGID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HPRDORGID"]);
                //插入子表
                oCn.RunProc("exec h_p_Sc_ICMOReportBillSub_Insert_WorkQtyYqn " + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + sHSourceType + "'");
                //Log.LogInfo("执行通过2");
                //插入主表
                oCn.RunProc("Insert Into Sc_ICMOReportBillMain " +
                "(HBillType,HBillSubType,HInterID,HBillNo,HDate" +
                ",HYear,HPeriod,HRemark,HMaker,HMakeDate" +
                ",HEmpID,HGroupID,HDeptID,HPRDORGID" +
                oCn.RunProc("Insert Into Sc_ProcessReportMain" +
               "(HYear,HPeriod,HBillType,HBillSubType,HInterID" +
               ",HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID" +
               ",HICMOInterID,HICMOBillNo ,HDeptID ,HDeptNumber,HGroupID" +
               ",HGroupNumber,HMaterID,HMaterNumber,HUnitID,HUnitNumber" +
               ",HPlanQty,HInStockQty,HSumTimes,HExplanation,HRemark" +
               ",HInnerBillNo,HMaker,HMakeDate,HSupID,HMarker" +
                ") " +
                " values('3711','3711'," + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "',convert(varchar(10),getdate(),120)" +
                ", " + oMain.HYear.ToString() + "," + oMain.HPeriod.ToString() + ",'" + oMain.HRemark + "','" + oMain.HMaker + "',convert(varchar(10),getdate(),120)" +
                ", " + oMain.HEmpID.ToString() + "," + oMain.HGroupID.ToString() + "," + oMain.HDeptID.ToString() + "," + oMain.HPRDORGID.ToString() +
               " values('" + oMain.HYear.ToString() + "','"+ oMain.HPeriod.ToString() + "','3714','3714','"+ oMain.HInterID.ToString() + "'" +
               ", convert(varchar(10),getdate(),120),'"+oMain.HBillNo+"','2','0','0'" +
               ", '"+oMain.HMainSourceInterID+"','','" + oMain.HDeptID.ToString() + "','','"+ ds.Tables[0].Rows[0]["HGroupID"].ToString() +"'" +
               ", '','" + ds.Tables[0].Rows[0]["HMaterID"].ToString() + "','','0',''" +
               ", '" + ds.Tables[0].Rows[0]["HPlanQty"].ToString() + "','0','0','同步erp生产汇报单','报工台同步工序汇报单'" +
               ",'','" +oMain.HMaker+ "','" + oMain.HDate + "','0',''" +
                ") ");
                //更新生产状态临时表(当日完工数量)HDateFinishQty  h_p_JIT_Sc_ICMOBillStatus_Tmp_Qty
                oCn.RunProc("exec h_p_JIT_Sc_ICMOBillStatus_Tmp_QtyYqn '" + workcode + "','" + HSourceID + "','"+HProcID+"','" + oMain.HMainSourceInterID + "','" + oMain.HMainSourceEntryID + "'");
                //string sql1 = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp  set
                //                 HICMOReportInterID ='" + oMain.HInterID + "', HICMOReportBillNo='" + oMain.HBillNo + "' from Sc_ICMOBillWorkQtyStatus_Tmp a where a.HICMOBillNo='" + workcode + "' and a.HSourceID='" + HSourceID + "' and  HICMOInterID='" + oMain.HMainSourceInterID + "' and a.HICMOEntryID='" + oMain.HMainSourceEntryID + "' and a.HMaker='" + oMain.HMaker + "'  and HRelationInterID='0'");
                //oCn.RunProc(sql1);
                //string sql1 = string.Format(@"update Sc_ICMOBillStatus_Tmp ");
                //oCn.RunProc("exec h_p_JIT_Sc_ICMOBillStatus_Tmp_QtyYqn '" + workcode + "','" + HSourceID + "','"+HProcID+"','" + oMain.HMainSourceInterID + "','" + oMain.HMainSourceEntryID + "'");
                //更新关联数量
                oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToICMOReport_Add " + oMain.HInterID.ToString());
                oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToICMOReport_AddYqn " + oMain.HInterID.ToString());
                if (oSystemParameterMain.Sc_ICMOReportBill_AutoCheck == "Y") //系统参数  自动审核 
                {
                    //审核单据
                    oCn.RunProc("Update Sc_ICMOReportBillMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120),HBillStatus=2 where HInterID= " + oMain.HInterID.ToString());
                    oCn.RunProc("Update Sc_ProcessReportMain Set HChecker='" + oMain.HMaker + "',HCheckDate=convert(varchar(10),getdate(),120),HBillStatus=2 where HInterID= " + oMain.HInterID.ToString());
                }
                //根据TMP表 返回 子表信息
@@ -5632,6 +5638,7 @@
                }
                else
                {
                    Log.LogInfo("执行通过s");
                    string sJson_ZYMESFLAG = "";    //生产汇报单同步MES标记
                    sJson_ZYMESFLAG = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FHZYMESFLAG"]);
@@ -5691,6 +5698,7 @@
                        " \"FREPORTTYPE\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREPORTTYPE"]) + "\"}," +
                        " \"FUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUNITID"]) + "\"}," +
                        " \"FWORKSHIPID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FWORKSHOPID"]) + "\"}," +
                        " \"FShiftGroupId\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HGROUPID"]) + "\"}," +
                        //\"FShiftGroupId\":{\"FNumber\":\"\"},
                        sJson_BatchNo +
                        //\"FDeptId\":{\"FNumber\":\"\"},
@@ -5729,6 +5737,8 @@
                        " \"FSTOCKID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKID"]) + "\"}," +
                        " \"FCOSTRATE\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCOSTRATE"]) + "," +
                        " \"FSNUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUNITID"]) + "\"}," +
                        " \"F_zzzz_procedure\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HSOURCENAME"]) + "\"," +
                        " \"F_zzzz_equipment\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HPROCNAME"]) + "\"," +
                        //\"FSNQty\":\"0\",
                        //\"FProduceDate\":\"1900-01-01\",
                        //\"FExpiryDate\":\"1900-01-01\",
@@ -5852,7 +5862,7 @@
            }
            catch (Exception e)
            {
                sErrMsg = "生成生产汇报单失败!" + e.Message;
                sErrMsg = "生成生产汇报单失败Erro!" + e.Message+e.StackTrace;
                oCn.RollBack();
                return false;
            }
@@ -32670,6 +32680,8 @@
        [WebMethod]
        public Model.ClsKf_ICStockBill_WMS get_CheckTypeByBarCode_All(string sBarCode, Int64 HBillID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Double HQty, bool HRedBlueFlag, bool SourceFlag, string HSourceBillNo, string HSourceBillType, Int64 HOWNERID, string HExpressNumber, ref string sErrMsg)
        {
            try
            {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            Model.ClsKf_ICStockBill_WMS oBar = new Model.ClsKf_ICStockBill_WMS();
            DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl();
@@ -33347,6 +33359,13 @@
                }
            }
        }
            catch (Exception e)
            {
                sErrMsg = e.Message+";"+e.StackTrace;
                return null;
            }
        }
        #endregion