1
llj
昨天 3e073e3d25f894fa43b800b6ee3c44a847203ddf
WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
@@ -2891,7 +2891,6 @@
                string HUpDater = mainList[0].HUpDater;
                string HMaterNumber = mainList[0].HMaterNumber;
                string HSupNumber = mainList[0].HSupNumber;
                long HPrintQty = mainList[0].HPrintQty;
                string HMouldOWNER = mainList[0].HMouldOWNER;
                string HSaveLife = mainList[0].HSaveLife;
                int HCaveQty = mainList[0].HCaveQty;
@@ -2949,7 +2948,7 @@
                }
                //=========================================================
                                //主表
                //主表
                oCN.RunProc("UpDate Gy_MouldFileMain set  " +
                 " HBillNo='" + HBillNo + "'" +  //固定赋值===============
                 ",HDate='" + HDate + "'" +
@@ -2979,7 +2978,6 @@
                 ",HDeptID=" + HDeptID.ToString() +
                 ",HSupID=" + HSupID.ToString() +
                 ",HSupNumber='" + HSupNumber + "'" +
                 ",HPrintQty=" + HPrintQty.ToString() +
                 ",HMouldStatus='" + HMouldStatus + "'" +
                 ",HSaveLife='" + HSaveLife + "'" +
                 ",HWhID=" + HWHID.ToString() +
@@ -3235,86 +3233,77 @@
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from Gy_MouldFileMain where HInterID = " + hmainid + " and ISNULL(HChecker,'') <> ''", "Gy_MouldFileMain");
                ds = oCN.RunProcReturn("select * from Gy_MouldFileMain where HInterID = " + hmainid + " and ISNULL(HChecker,'') <> '' and HPrintQty>0", "Gy_MouldFileMain");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!单据已审核!";
                    objJsonResult.Message = "删除失败!单据已审核或已被打印!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (oBill.DeleteBill(hmainid, ref DBUtility.ClsPub.sExeReturnInfo))
                oCN.BeginTran();
                //删除前控制=========================================
                ds = oCN.RunProcReturn("Exec h_p_Gy_MouldFile_BeforeDelCtrl " + hmainid + ",'" + User + "'", "h_p_Gy_MouldFile_BeforeDelCtrl");
                if (ds == null)
                {
                    oCN.BeginTran();
                    //删除前控制=========================================
                    ds = oCN.RunProcReturn("Exec h_p_Gy_MouldFile_BeforeDelCtrl " + hmainid + ",'" + User + "'", "h_p_Gy_MouldFile_BeforeDelCtrl");
                    if (ds == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除前判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.RunProc("Delete From Gy_MouldFileSub_MaintainRule  where HInterID=" + hmainid);
                    oCN.RunProc("Delete From Gy_MouldFileSub_DotCheckRule  where HInterID=" + hmainid);
                    //删除后控制=========================================
                    DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_MouldFile_AfterDelCtrl " + hmainid + ",'" + User + "'", "h_p_Gy_MouldFile_AfterDelCtrl");
                    if (ds2 == null)
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除后判断失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                    {
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //=========================================================
                    oCN.Commit();
                    //写入日志
                    ClsPub.Add_Log("", "删除项目,代码:" + oBill.omodel.HMouldNo + ",名称:" + oBill.omodel.HName, ClsPub.CurUserName);
                    //更新上级为 末级
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除成功";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败";
                    objJsonResult.Message = "删除前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //ds = oCN.RunProcReturn("delete from Gy_Department where HItemID =  " + HItemID, "Gy_Department");
                if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.RunProc("Delete From Gy_MouldFileMain  where HInterID=" + hmainid);
                oCN.RunProc("Delete From Gy_MouldFileSub  where HInterID=" + hmainid);
                oCN.RunProc("Delete From Gy_MouldFileSub2  where HInterID=" + hmainid);
                oCN.RunProc("Delete From Gy_MouldFileSub_SubMater  where HInterID=" + hmainid);
                oCN.RunProc("Delete From Gy_MouldFileSub_MaintainRule  where HInterID=" + hmainid);
                oCN.RunProc("Delete From Gy_MouldFileSub_DotCheckRule  where HInterID=" + hmainid);
                //删除后控制=========================================
                DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_MouldFile_AfterDelCtrl " + hmainid + ",'" + User + "'", "h_p_Gy_MouldFile_AfterDelCtrl");
                if (ds2 == null)
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除后判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0")
                {
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //=========================================================
                oCN.Commit();
                //写入日志
                ClsPub.Add_Log("", "删除模具档案,代码:" + oBill.omodel.HMouldNo + ",名称:" + oBill.omodel.HName, ClsPub.CurUserName);
                //更新上级为 末级
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
@@ -4016,7 +4005,7 @@
        #region [模具档案批量生成]
        [Route("Gy_Mould/SaveBatchGen_MouldFile")]
        [HttpGet]
        public object SaveBatchGen_MouldFile(long HInterID, string StarNum, string EndNum)
        public object SaveBatchGen_MouldFile(long HInterID, string StarNum, string EndNum,string user)
        {
            int StarNum1 = int.Parse(StarNum);
            int EndNum1 = int.Parse(EndNum);
@@ -4069,10 +4058,10 @@
                        ",HUseLife,HLeaveLife,HProdQty,HProdWeight,HMouldOWNER,HSaveLife,HMouldDotCheckRuleInterID,HMouldMaintainRuleInterID" +
                        ") " +
                        " values('3899','3899'," + HItemID + ",'" + Num1 + j + "',getdate()" +
                        "," + dr["HYear"] + "," + dr["HPeriod"] + ",'" + dr["HRemark"] + "','" + dr["HMaker"] + "',getdate(),'" + Num1 + j +
                        "," + dr["HYear"] + "," + dr["HPeriod"] + ",'" + dr["HRemark"] + "','" + user + "',getdate(),'" + Num1 + j +
                        "','" + Num1 + j + "','" + dr["HName"] + "','" + dr["HModel"] + "','" + dr["HModel2"] + "','" + dr["HDiameter"] + "'" +
                        ",'" + dr["HSubjoin"] + "','" + dr["HSubjoin2"] + "','" + dr["HPICNo"] + "','" + dr["HWorkMaterModel"] + "'" +
                        "," + dr["HMaterID"] + ",'" + dr["HMaterNumber"] + "',0," + dr["HUnitID"] +
                        "," + dr["HMaterID"] + ",'" + dr["HMaterNumber"] + "',"+dr["HMouldType"]+"," + dr["HUnitID"] +
                        ",'" + dr["HOutComDate"] + "','" + dr["HOutComNo"] + "'," + dr["HDeptID"] + "," + dr["HSupID"] + ",'" + dr["HSupNumber"] + "'" +
                        "," + dr["HPrintQty"] + ",'" + dr["HMouldStatus"] + "'," + dr["HWHID"] + "," + dr["HRoutingID"] + ",'" + dr["HCaveQty"] +
                        "'," + dr["HBOMID"] + ",'" + dr["HVersion"] + "'," + dr["HSPGroupID"] + "," + dr["HSPID"] + ",'" + dr["HDesignLife"] + "','" + dr["HNowSupID"] + "','" + dr["HNowSupTypeID"] + "'" +
@@ -4922,11 +4911,23 @@
        public object UploadFile_Gy_MouldFilen()
        {
            string path = "";
            string HBillNo = HttpContext.Current.Request.Params["HBillNo"];  //单据号
            string HRemark = HttpContext.Current.Request.Params["HRemark"];  //备注
            string HUserName = HttpContext.Current.Request.Params["HUserName"];  //创建人
            HttpPostedFile files = HttpContext.Current.Request.Files["file"];
            string path = HttpContext.Current.Server.MapPath("~/../Files/Gy_MouldFilen/" + HBillNo);
            string Ret = "";
            if (oSystemParameter.ShowBill(ref Ret))
            {
                if (oSystemParameter.omodel.WMS_CampanyName == "凯贝奈特")
                {
                    path = "D:/网站发布/LAYUI/Files/Gy_MouldFilen/" + HBillNo;
                }
                else
                {
                    path = HttpContext.Current.Server.MapPath("~/../Files/Gy_MouldFilen/" + HBillNo);
                }
            }
            dynamic dyResult = UploadFile_Gy_MouldFilen(files, path, HBillNo, HRemark, HUserName);
            if (dyResult != null && dyResult.result == 1)
            {
@@ -4981,7 +4982,20 @@
                {
                    File.Delete(fileurl);      //删除指定文件
                    files.SaveAs(fileurl);
                    string StrPath = "/files/Gy_MouldFilen/" + HBillNo + "/" + filename;
                    string StrPath = "";
                    string Ret = "";
                    if (oSystemParameter.ShowBill(ref Ret))
                    {
                        if (oSystemParameter.omodel.WMS_CampanyName == "凯贝奈特")
                        {
                            StrPath = "D:/网站发布/LAYUI/Files/Gy_MouldFilen/" + HBillNo + "/" + filename;
                        }
                        else
                        {
                            StrPath = "/files/Gy_MouldFilen/" + HBillNo + "/" + filename;
                        }
                    }
                    if (File.Exists(fileurl))
                    {
                        //这里可以执行一些其它的操作,比如更新数据库
@@ -5041,7 +5055,19 @@
        [HttpGet]
        public object Gy_MouldFilen_Filelist(string HBillNo)
        {
            var url = fileip + "/Files/Gy_MouldFilen/" + HBillNo + "/";
            string Ret = "";
            var url = "";
            if (oSystemParameter.ShowBill(ref Ret))
            {
                if (oSystemParameter.omodel.WMS_CampanyName == "凯贝奈特")
                {
                    url = "D:/网站发布/LAYUI/Files/Gy_MouldFilen/" + HBillNo + "/";
                }
                else
                {
                    url = fileip + "/Files/Gy_MouldFilen/" + HBillNo + "/";
                }
            }
            try
            {
@@ -5075,9 +5101,7 @@
            try
            {
                oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID);
                string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/Gy_MouldFilen/" + HSourceBillNo), HFileName);
                File.Delete(fileurl);      //删除指定文件
                oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功!";
@@ -5103,7 +5127,7 @@
        {
            try
            {
                ds = oCN.RunProcReturn($"select * from Gy_BarCodeBill where HBarCode='{HbarCode}' ", "Gy_Material");
                ds = oCN.RunProcReturn($"select *,b.hnumber HMaterNumber,b.hname HMaterName_m from Gy_BarCodeBill a with(nolock) left join Gy_Material b with(nolock) on a.HMaterID=b.HItemID where HBarCode='{HbarCode}' ", "Gy_Material");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";