yusijie
2024-04-25 822b0c802fbe0dedf224440e281904c63e4a9d0a
指导书
3个文件已修改
128 ■■■■■ 已修改文件
DAL/工位看板/ClsGy_SOPBill.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_SOPBillEditController.cs 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/ListModels.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/¹¤Î»¿´°å/ClsGy_SOPBill.cs
@@ -88,7 +88,12 @@
            try
            {
                //得到mainid
                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                if (omodel.HInterID.ToString() == null || omodel.HInterID == 0 || omodel.HInterID.ToString() == "undefined")
                {
                    omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                //若MAINDI重复则重新获取
                oCn.BeginTran();
                //主表
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_SOPBillEditController.cs
@@ -241,6 +241,92 @@
            }
        }
        #endregion
        #region ä¿å­˜å•据
        [Route("Gy_SOPBill/Save")]
        [HttpPost]
        public object Save([FromBody] JObject oMain)
        {
            try
            {
                var _value = oMain["oMain"].ToString();
                string msg1 = _value.ToString();
                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                string msgMain = sArray[0].ToString(); //表头信息
                string msgSub = sArray[1].ToString(); //表体信息
                string OperationType = sArray[2].ToString(); //操作类型
                string user = sArray[3].ToString(); //用户
                ListModels oListModels = new ListModels();
                DAL.ClsGy_SOPBill oBill = new DAL.ClsGy_SOPBill();
                List<Model.ClsGy_SOPBillMain> lsmain = new List<Model.ClsGy_SOPBillMain>();
                msgMain = msgMain.Replace("\\", "");
                msgMain = msgMain.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Gy_SOPBillMain(msgMain);
                foreach (Model.ClsGy_SOPBillMain oItem in lsmain)
                {
                    oBill.omodel = oItem;
                }
                //表体数据
                //按 },{来拆分数组 //去掉【和】
                msgSub = msgSub.Substring(1, msgSub.Length - 2);
                msgSub = msgSub.Replace("\\", "");
                msgSub = msgSub.Replace("\n", "");  //\n
                //msg2 = msg2.Replace("'", "’");
                List<Model.ClsGy_SOPBillSub> ls = new List<Model.ClsGy_SOPBillSub>();
                ls = oListModels.getObjectByJson_Gy_SOPBillSub(msgSub);
                int i = 0;
                foreach (Model.ClsGy_SOPBillSub oItemSub in ls)
                {
                    i++;
                    oItemSub.HEntryID = i;
                    oBill.DetailColl.Add(oItemSub);
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (OperationType == "1" || OperationType == "2")
                {
                    // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                }
                else
                {
                    bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        [Route("Gy_SOPBill/Use")]
        [HttpGet]
        public object sy_Click()
@@ -292,9 +378,9 @@
            string HBillNo = HttpContext.Current.Request.Params["HBillNo"];  //单据号
            string HUserName = HttpContext.Current.Request.Params["HUserName"];  //创建人
            string HInterID = HttpContext.Current.Request.Params["HInterID"];  //创建人
            HttpPostedFile files = HttpContext.Current.Request.Files["file"]; //单据主内码
            string path = HttpContext.Current.Server.MapPath("~/../Files/" + HBillNo);
            string HInterID = HttpContext.Current.Request.Params["HInterID"];  //单据内码
            HttpPostedFile files = HttpContext.Current.Request.Files["file"]; //文件
            string path = HttpContext.Current.Server.MapPath("~/../Files/SOP/" + HBillNo);
            //string path = @"D:\\Files\\"+ HBillNo;
            Int64 HEntryID = Convert.ToInt64(HttpContext.Current.Request.Params["HEntryID"]);  //子内码
            dynamic dyResult = UpLoadFile(files, path, HBillNo, HInterID, HUserName, HEntryID);
@@ -313,8 +399,7 @@
                objJsonResult.Message = dyResult.returnval;
                objJsonResult.data = null;
                return objJsonResult;
            }
            }
        }
        public dynamic UpLoadFile(HttpPostedFile files, string path, string HBillNo, string HInterID, string HUserName,Int64 HEntryID)
@@ -371,7 +456,7 @@
                {
                    File.Delete(fileurl);      //删除指定文件
                    files.SaveAs(fileurl);
                    string StrPath = "/files/" + HBillNo + "/" + filename;
                    string StrPath = "/files/SOP/" + HBillNo + "/" + filename;
                    if (File.Exists(fileurl))
                    {
                        //这里可以执行一些其它的操作,比如更新数据库
@@ -379,7 +464,7 @@
                        oCN.RunProc("Insert into Gy_SOPBillSub2 (HFileName,HPath,HFileType" +
                               ",HUpMan,HUpTime,HInterID,HEntryID,HSno,HFileID,HFileSize" +
                              ") values('"
                               + filename.ToString() + "','" + filePath.ToString() + "','" +  fileExtension.ToString() + "'" +
                               + filename.ToString() + "','" + StrPath.ToString() + "','" +  fileExtension.ToString() + "'" +
                               ",'" + HUserName + "',getdate()"  + ",'" + HInterID + "','" + HEntryID + "','" + Sno + "','" + lID + "','" + filesize +
                        "') ");
                    }
@@ -392,7 +477,7 @@
                {
                    Directory.CreateDirectory(fileSavePath); //添加文件夹
                    files.SaveAs(fileurl);
                    string StrPath = "/files/" + HBillNo + "/" + filename;
                    string StrPath = "/files/SOP/" + HBillNo + "/" + filename;
                    if (File.Exists(fileurl))
                    {
                        //这里可以执行一些其它的操作,比如更新数据库
@@ -400,7 +485,7 @@
                        oCN.RunProc("Insert into Gy_SOPBillSub2 (HFileName,HPath,HFileType" +
                                     ",HUpMan,HUpTime,HInterID,HEntryID,HSno,HFileID,HFileSize" +
                                    ") values('"
                                     + filename.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" +
                                     + filename.ToString() + "','" + StrPath.ToString() + "','" + fileExtension.ToString() + "'" +
                                     ",'" + HUserName + "',getdate()" + ",'" + HInterID + "','" + HEntryID + "','" + Sno + "','" + lID + "','" + filesize +
                                    "') ");
                    }
WebAPI/ListModels.cs
@@ -3988,5 +3988,23 @@
            return list;
        }
        ///作业指导书 ä¸»è¡¨
        ///ClsGy_SOPBillMain
        public List<Model.ClsGy_SOPBillMain> getObjectByJson_Gy_SOPBillMain(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_SOPBillMain> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_SOPBillMain>>(jsonString);
            return list;
        }
        ///作业指导书 å­è¡¨
        ///ClsGy_SOPBillSub
        public List<Model.ClsGy_SOPBillSub> getObjectByJson_Gy_SOPBillSub(string jsonString)
        {
            jsonString = "[" + jsonString.ToString() + "]";
            List<Model.ClsGy_SOPBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_SOPBillSub>>(jsonString);
            return list;
        }
    }