/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TB_NCIF_LOG model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TB_NCIF_LOG("); strSql.Append("C_TYPE,D_MOD_DT,C_REMARK,C_RELATIONSHIP_ID,C_RESULT)"); strSql.Append(" values ("); strSql.Append(":C_TYPE,:D_MOD_DT,:C_REMARK,:C_RELATIONSHIP_ID,:C_RESULT)"); OracleParameter[] parameters = { new OracleParameter(":C_TYPE", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT", OracleDbType.Date), new OracleParameter(":C_REMARK", OracleDbType.Varchar2, 2000), new OracleParameter(":C_RELATIONSHIP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_RESULT", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_TYPE; parameters[1].Value = model.D_MOD_DT; parameters[2].Value = model.C_REMARK; parameters[3].Value = model.C_RELATIONSHIP_ID; parameters[4].Value = model.C_RESULT; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TB_NCIF_LOG DataRowToModel(DataRow row) { Mod_TB_NCIF_LOG model = new Mod_TB_NCIF_LOG(); if (row != null) { if (row["C_ID"] != null) { model.C_ID = row["C_ID"].ToString(); } if (row["C_TYPE"] != null) { model.C_TYPE = row["C_TYPE"].ToString(); } if (row["D_MOD_DT"] != null && row["D_MOD_DT"].ToString() != "") { model.D_MOD_DT = DateTime.Parse(row["D_MOD_DT"].ToString()); } if (row["C_REMARK"] != null) { model.C_REMARK = row["C_REMARK"].ToString(); } if (row["C_RELATIONSHIP_ID"] != null) { model.C_RELATIONSHIP_ID = row["C_RELATIONSHIP_ID"].ToString(); } if (row["C_RESULT"] != null) { model.C_RESULT = row["C_RESULT"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TB_NCIF_LOG model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TB_NCIF_LOG set "); strSql.Append("C_TYPE=:C_TYPE,"); strSql.Append("D_MOD_DT=:D_MOD_DT,"); strSql.Append("C_REMARK=:C_REMARK,"); strSql.Append("C_RELATIONSHIP_ID=:C_RELATIONSHIP_ID,"); strSql.Append("C_RESULT=:C_RESULT"); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_TYPE", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT", OracleDbType.Date), new OracleParameter(":C_REMARK", OracleDbType.Varchar2, 500), new OracleParameter(":C_RELATIONSHIP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_RESULT", OracleDbType.Varchar2, 100), new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_TYPE; parameters[1].Value = model.D_MOD_DT; parameters[2].Value = model.C_REMARK; parameters[3].Value = model.C_RELATIONSHIP_ID; parameters[4].Value = model.C_RESULT; parameters[5].Value = model.C_ID; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TB_NCIF_LOG GetModel(string C_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select C_ID,C_TYPE,D_MOD_DT,C_REMARK,C_RELATIONSHIP_ID,C_RESULT from TB_NCIF_LOG "); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = C_ID; Mod_TB_NCIF_LOG model = new Mod_TB_NCIF_LOG(); DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public List <string> SendXml_ROLL_A3(string zdrid, string xmlFileName, NcRollA3 nc, string path) { try { string url = path + "\\NCXML"; if (!Directory.Exists(url)) { Directory.CreateDirectory(url); } //Mod_TMO_CON modCon = tmo_con.GetModel(zdrid); XmlDocument xmlDoc = new XmlDocument(); //创建类型声明节点 XmlNode node = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", "no"); xmlDoc.AppendChild(node); //创建根节点 XmlElement root = xmlDoc.CreateElement("ufinterface"); #region//给节点属性赋值 root.SetAttribute("billtype", "A3"); root.SetAttribute("filename", "" + zdrid + ".xml"); root.SetAttribute("isexchange", "Y"); root.SetAttribute("operation", "req"); root.SetAttribute("proc", "add"); root.SetAttribute("receiver", "101"); root.SetAttribute("replace", "Y"); root.SetAttribute("roottag", "bill"); root.SetAttribute("sender", "1107"); #endregion xmlDoc.AppendChild(root); //创建子根节点 XmlElement bill = xmlDoc.CreateElement("bill"); #region//节点属性 bill.SetAttribute("id", nc.hpch); #endregion root.AppendChild(bill); XmlNode head = xmlDoc.CreateNode(XmlNodeType.Element, "bill_head", null); #region //表头_order_head CreateNode(xmlDoc, head, "scddh", ""); //生产订单号 表头是线材数据 CreateNode(xmlDoc, head, "zdrid", nc.hzdrid); //制单人 CreateNode(xmlDoc, head, "pch", nc.hpch); //批次号 CreateNode(xmlDoc, head, "wlbmid", nc.hwlbmid); //物料编码ID CreateNode(xmlDoc, head, "jldwid", nc.hjldwid); //计量单位ID CreateNode(xmlDoc, head, "ylbmid", ""); //用料部门ID CreateNode(xmlDoc, head, "bljhdh", ""); //备料计划单号 CreateNode(xmlDoc, head, "zdrq", nc.hzdrq.ToString("yyyy-MM-dd")); //制单日期 没有出出炉日期,可以编辑 CreateNode(xmlDoc, head, "freeitemvalue1", nc.hfreeitemvalue1); CreateNode(xmlDoc, head, "freeitemvalue2", nc.hfreeitemvalue2); CreateNode(xmlDoc, head, "freeitemvalue3", nc.hfreeitemvalue3); CreateNode(xmlDoc, head, "freeitemvalue4", ""); CreateNode(xmlDoc, head, "freeitemvalue5", ""); #endregion bill.AppendChild(head); XmlElement body = xmlDoc.CreateElement("bill_body"); bill.AppendChild(body); XmlNode item = xmlDoc.CreateNode(XmlNodeType.Element, "item", null); #region //表体_item CreateNode(xmlDoc, item, "kgyid", nc.kgyid); //库管员 表体是消耗钢坯数据 CreateNode(xmlDoc, item, "ckckid", nc.ckckid); //出库仓库ID CreateNode(xmlDoc, item, "ckckbm", ""); CreateNode(xmlDoc, item, "wlbmid", nc.wlbmid); //物料编码ID CreateNode(xmlDoc, item, "jldwid", nc.jldwid); //计量单位ID CreateNode(xmlDoc, item, "fjldwid", nc.fjldwid); //辅计量单位ID CreateNode(xmlDoc, item, "ljcksl", nc.ljcksl); //累计出库数量 CreateNode(xmlDoc, item, "fljcksl", nc.fljcksl); //辅累计出库数量 CreateNode(xmlDoc, item, "pch", nc.pch); //批次号 CreateNode(xmlDoc, item, "gzzxid", nc.gzzxid); //工作中心ID CreateNode(xmlDoc, item, "gxh", ""); //工序号 CreateNode(xmlDoc, item, "zdy1", ""); //自定义项1 CreateNode(xmlDoc, item, "zdy2", ""); //自定义项2 CreateNode(xmlDoc, item, "zdy3", ""); //自定义项3 CreateNode(xmlDoc, item, "zdy4", ""); //自定义项4 CreateNode(xmlDoc, item, "zdy5", ""); //自定义项5 CreateNode(xmlDoc, item, "freeitemvalue1", nc.freeitemvalue1); CreateNode(xmlDoc, item, "freeitemvalue2", nc.freeitemvalue2); CreateNode(xmlDoc, item, "freeitemvalue3", ""); CreateNode(xmlDoc, item, "freeitemvalue4", ""); CreateNode(xmlDoc, item, "freeitemvalue5", ""); CreateNode(xmlDoc, item, "pk_corp", ""); //公司编码 CreateNode(xmlDoc, item, "gcbm", ""); //工厂 CreateNode(xmlDoc, item, "ccostobject", ""); //成本对象ID CreateNode(xmlDoc, item, "flrq", nc.flrq); //发料日期 CreateNode(xmlDoc, item, "pk_moid", ""); //生产定单ID #endregion body.AppendChild(item); xmlDoc.Save(url + "\\" + xmlFileName); var result = dalSendNC.SendXML(url + "\\" + xmlFileName); Mod_TB_NCIF_LOG log = new Mod_TB_NCIF_LOG(); log.C_TYPE = "A3"; log.C_RESULT = result[0]; log.C_REMARK = result[1]; log.C_RELATIONSHIP_ID = nc.pch; dal_TB_NCIF_LOG.Add(log); return(result); } catch (Exception ex) { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TB_NCIF_LOG model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TB_NCIF_LOG model) { return(dal.Add(model)); }
public List <string> SendXml_ROLL_A2(string dayplcode, string xmlFileName, NcRollA2 nc, string path) { try { string url = path + "\\NCXML"; if (!Directory.Exists(url)) { Directory.CreateDirectory(url); } //Bll_TMP_DAYPLAN tmp_dayplan = new Bll_TMP_DAYPLAN(); //Mod_TMP_DAYPLAN modPlan = tmp_dayplan.GetModel(dayplcode); XmlDocument xmlDoc = new XmlDocument(); //创建类型声明节点 XmlNode node = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", "no"); xmlDoc.AppendChild(node); //创建根节点 XmlElement root = xmlDoc.CreateElement("ufinterface"); #region//给节点属性赋值 root.SetAttribute("billtype", "A2"); root.SetAttribute("filename", "" + dayplcode + ".xml"); root.SetAttribute("isexchange", "Y"); root.SetAttribute("operation", "req"); root.SetAttribute("proc", "add"); root.SetAttribute("receiver", "101"); root.SetAttribute("replace", "Y"); root.SetAttribute("roottag", "bill"); root.SetAttribute("sender", "1107"); #endregion xmlDoc.AppendChild(root); //创建子根节点 XmlElement so_order = xmlDoc.CreateElement("bill"); //#region//节点属性 //so_order.SetAttribute("id", dayplcode); //#endregiond root.AppendChild(so_order); XmlNode head = xmlDoc.CreateNode(XmlNodeType.Element, "bill_head", null); #region //表头_order_head CreateNode(xmlDoc, head, "scddh", ""); //生产订单号 CreateNode(xmlDoc, head, "pk_poid", ""); //计划订单主键 CreateNode(xmlDoc, head, "jhddh", ""); //计划订单号 CreateNode(xmlDoc, head, "wlbmid", nc.wlbmid); //物料编码ID CreateNode(xmlDoc, head, "pk_produce", nc.pk_produce); //物料PK CreateNode(xmlDoc, head, "invcode", nc.invcode); CreateNode(xmlDoc, head, "invname", ""); CreateNode(xmlDoc, head, "pch", nc.pch); //批次号 CreateNode(xmlDoc, head, "scbmid", nc.scbmid); //生产部门ID CreateNode(xmlDoc, head, "gzzxid", nc.gzzxid); //工作中心ID CreateNode(xmlDoc, head, "gzzxbm", ""); //工作中心编码ID CreateNode(xmlDoc, head, "ksid", ""); //客商ID CreateNode(xmlDoc, head, "memo", ""); //备注 CreateNode(xmlDoc, head, "sfjj", ""); //是否加急 CreateNode(xmlDoc, head, "yxj", ""); CreateNode(xmlDoc, head, "bcid", nc.bcid); //班次ID CreateNode(xmlDoc, head, "bzid", nc.bzid); //班组 CreateNode(xmlDoc, head, "jhkgrq", nc.jhkgrq.ToString("yyyy-MM-dd")); //计划开工日期 CreateNode(xmlDoc, head, "jhwgrq", nc.jhwgrq.ToString("yyyy-MM-dd")); //计划完工日期 CreateNode(xmlDoc, head, "jhkssj", nc.jhkssj.ToString("HH:mm:ss")); //计划开始时间 CreateNode(xmlDoc, head, "jhjssj", nc.jhjssj.ToString("HH:mm:ss")); //计划结束时间 CreateNode(xmlDoc, head, "sjkgrq", nc.sjkgrq.ToString("yyyy-MM-dd")); //实际开工日期 CreateNode(xmlDoc, head, "sjwgrq", nc.sjwgrq.ToString("yyyy-MM-dd")); //实际完工日期 CreateNode(xmlDoc, head, "sjkssj", nc.sjkssj.ToString("HH:mm:ss")); //实际开始时间 CreateNode(xmlDoc, head, "sjjssj", nc.sjjssj.ToString("HH:mm:ss")); //实际结束时间 CreateNode(xmlDoc, head, "jhwgsl", nc.jhwgsl); //计划完工数量 CreateNode(xmlDoc, head, "fjhsl", nc.fjhsl); //辅计量数量 CreateNode(xmlDoc, head, "jldwid", nc.jldwid); //计量单位ID CreateNode(xmlDoc, head, "fjlid", nc.fjlid); CreateNode(xmlDoc, head, "sjwgsl", ""); //实际完工数量 CreateNode(xmlDoc, head, "fwcsl", ""); CreateNode(xmlDoc, head, "zdy1", ""); //自定义项1 CreateNode(xmlDoc, head, "zdy2", ""); //自定义项2 CreateNode(xmlDoc, head, "zdy3", ""); //自定义项3 CreateNode(xmlDoc, head, "zdy4", ""); //自定义项4 CreateNode(xmlDoc, head, "zdy5", ""); //自定义项5 CreateNode(xmlDoc, head, "freeitemvalue1", nc.freeitemvalue1); CreateNode(xmlDoc, head, "freeitemvalue2", nc.freeitemvalue2); CreateNode(xmlDoc, head, "freeitemvalue3", nc.freeitemvalue3); CreateNode(xmlDoc, head, "freeitemvalue4", ""); CreateNode(xmlDoc, head, "freeitemvalue5", nc.freeitemvalue5); //PCI计划订单主键 CreateNode(xmlDoc, head, "pk_corp", "1001"); //公司编码 CreateNode(xmlDoc, head, "gcbm", "1001NC10000000000669"); //工厂 CreateNode(xmlDoc, head, "zdrid", nc.zdrid); //制单人 用户编码 CreateNode(xmlDoc, head, "pk_moid", ""); //生产定单ID #endregion so_order.AppendChild(head); xmlDoc.Save(url + "\\" + xmlFileName); var result = dalSendNC.SendXML(url + "\\" + xmlFileName); Mod_TB_NCIF_LOG log = new Mod_TB_NCIF_LOG(); log.C_TYPE = "A2"; log.C_RESULT = result[0]; log.C_REMARK = result[1]; log.C_RELATIONSHIP_ID = nc.pch; dal_TB_NCIF_LOG.Add(log); return(result); } catch (Exception ex) { return(null); } }
public List <string> SendXml_ROLL_46(string cwarehouseid, string xmlFileName, List <NcRoll46> nc, string path) { try { string url = path + "\\NCXML"; if (!Directory.Exists(url)) { Directory.CreateDirectory(url); } //Mod_TMO_CON modCon = tmo_con.GetModel(cwarehouseid); XmlDocument xmlDoc = new XmlDocument(); //创建类型声明节点 XmlNode node = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", "no"); xmlDoc.AppendChild(node); //创建根节点 XmlElement root = xmlDoc.CreateElement("ufinterface"); #region//给节点属性赋值 root.SetAttribute("billtype", "46"); root.SetAttribute("filename", "123.xml"); root.SetAttribute("isexchange", "Y"); root.SetAttribute("operation", "req"); root.SetAttribute("proc", "add"); root.SetAttribute("receiver", "101"); root.SetAttribute("replace", "Y"); root.SetAttribute("roottag", "bill"); root.SetAttribute("sender", "1107"); #endregion xmlDoc.AppendChild(root); //创建子根节点 XmlElement bill = xmlDoc.CreateElement("bill"); #region//节点属性 bill.SetAttribute("id", nc[0].vbatchcode); #endregion root.AppendChild(bill); XmlNode head = xmlDoc.CreateNode(XmlNodeType.Element, "bill_head", null); #region //表头_order_head CreateNode(xmlDoc, head, "cwarehouseid", nc[0].castunitid); #endregion bill.AppendChild(head); XmlElement body = xmlDoc.CreateElement("bill_body"); bill.AppendChild(body); #region //表体_item foreach (var n in nc) { XmlNode item = xmlDoc.CreateNode(XmlNodeType.Element, "item", null); CreateNode(xmlDoc, item, "cwarehouseid", n.cwarehouseid); //仓库ID CreateNode(xmlDoc, item, "taccounttime", n.taccounttime.ToString("yyyy-MM-dd HH:mm:ss")); //库房签字时间 CreateNode(xmlDoc, item, "coperatorid", n.coperatorid); //制单人 CreateNode(xmlDoc, item, "ccheckstate_bid", n.ccheckstate_bid); //质量等级NC主键 CreateNode(xmlDoc, item, "cworkcenterid", n.cworkcenterid); //工作中心主键1线NC主键 CreateNode(xmlDoc, item, "dbizdate", n.dbizdate.ToString("yyyy-MM-dd")); //业务日期 CreateNode(xmlDoc, item, "vbatchcode", n.vbatchcode); //批次号 CreateNode(xmlDoc, item, "cinvbasid", n.cinvbasid); //存货基本ID CreateNode(xmlDoc, item, "pk_produce", n.pk_produce); //物料PK C_PK_PRODUCE CreateNode(xmlDoc, item, "ninnum", n.ninnum); //实入数量 CreateNode(xmlDoc, item, "ninassistnum", n.ninassistnum); //实入辅数量 件数 CreateNode(xmlDoc, item, "castunitid", n.castunitid); //辅计量单位ID CreateNode(xmlDoc, item, "vfree1", n.vfree1); //自由项1 CreateNode(xmlDoc, item, "vfree2", n.vfree2); //自由项2 CreateNode(xmlDoc, item, "vfree3", n.vfree3); //自由项3 CreateNode(xmlDoc, item, "vfree4", ""); //自由项4 CreateNode(xmlDoc, item, "vfree5", ""); //自由项5 CreateNode(xmlDoc, item, "pk_corp", "1001"); //公司编码 1001 CreateNode(xmlDoc, item, "gcbm", ""); //工厂 #endregion body.AppendChild(item); } xmlDoc.Save(url + "\\" + xmlFileName); List <string> result = dalSendNC.SendXML(url + "\\" + xmlFileName); Mod_TB_NCIF_LOG log = new Mod_TB_NCIF_LOG(); log.C_TYPE = "46"; log.C_RESULT = result[0]; log.C_REMARK = result[1]; log.C_RELATIONSHIP_ID = nc[0].vbatchcode; dal_TB_NCIF_LOG.Add(log); return(result); } catch { return(null); } }
public List <string> SendXml_ROLL_A1(string dayplcode, string xmlFileName, NcRollA1 nc, string path) { try { string url = path + "\\NCXML"; if (!Directory.Exists(url)) { Directory.CreateDirectory(url); } //Bll_TMP_DAYPLAN tmp_dayplan = new Bll_TMP_DAYPLAN(); //Mod_TMP_DAYPLAN modPlan = tmp_dayplan.GetModel(dayplcode); XmlDocument xmlDoc = new XmlDocument(); //创建类型声明节点 XmlNode node = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", "no"); xmlDoc.AppendChild(node); //创建根节点 XmlElement root = xmlDoc.CreateElement("ufinterface"); #region//给节点属性赋值 root.SetAttribute("account", "1"); root.SetAttribute("billtype", "A1"); root.SetAttribute("filename", "" + dayplcode + ".xml"); root.SetAttribute("isexchange", "Y"); root.SetAttribute("proc", "add"); root.SetAttribute("receiver", "101"); root.SetAttribute("replace", "Y"); root.SetAttribute("roottag", "bill"); root.SetAttribute("sender", "1107"); #endregion xmlDoc.AppendChild(root); //创建子根节点 XmlElement so_order = xmlDoc.CreateElement("bill"); //#region//节点属性 //so_order.SetAttribute("id", dayplcode); //#endregiond root.AppendChild(so_order); XmlNode head = xmlDoc.CreateNode(XmlNodeType.Element, "billhead", null); #region //表头_order_head CreateNode(xmlDoc, head, "bgbz", "1"); //变更标志 CreateNode(xmlDoc, head, "bmid", nc.bmid); //部门ID 用下发计划人查询部门 CreateNode(xmlDoc, head, "bmmc", ""); //部门名称 CreateNode(xmlDoc, head, "bomver", ""); //BOM版本 CreateNode(xmlDoc, head, "busiDate", ""); CreateNode(xmlDoc, head, "ckbm", ""); //仓库编码 CreateNode(xmlDoc, head, "ckbmid", ""); //仓库编码ID CreateNode(xmlDoc, head, "ckmc", ""); //仓库名称 CreateNode(xmlDoc, head, "curwwsl", ""); CreateNode(xmlDoc, head, "ddlx", "1"); //订单类型 CreateNode(xmlDoc, head, "ddlxshow", ""); CreateNode(xmlDoc, head, "durl", ""); //资料路径 CreateNode(xmlDoc, head, "fah", ""); CreateNode(xmlDoc, head, "fjbz", "0"); //分解标记 CreateNode(xmlDoc, head, "fjldwid", ""); //辅计量单位ID CreateNode(xmlDoc, head, "fjldwmc", ""); CreateNode(xmlDoc, head, "gcbm", "1001NC10000000000669"); //工厂 CreateNode(xmlDoc, head, "gcbmcode", ""); CreateNode(xmlDoc, head, "graphid", ""); CreateNode(xmlDoc, head, "gzzxbm", ""); //工作中心编码ID CreateNode(xmlDoc, head, "gzzxid", ""); //工作中心ID CreateNode(xmlDoc, head, "gzzxmc", ""); //工作中心名称 CreateNode(xmlDoc, head, "hbbz", "0"); //合并标志 CreateNode(xmlDoc, head, "hsl", ""); //换算率 CreateNode(xmlDoc, head, "invspec", ""); CreateNode(xmlDoc, head, "invtype", ""); CreateNode(xmlDoc, head, "jhbmbm", ""); CreateNode(xmlDoc, head, "jhddh", ""); //计划订单号 CreateNode(xmlDoc, head, "jhfaid", nc.jhfaid); //计划方案ID CreateNode(xmlDoc, head, "jhlx", "0"); //备料计划类型(固定) CreateNode(xmlDoc, head, "jhrq", nc.jhrq.ToString("yyyy-MM-dd")); //计划日期 CreateNode(xmlDoc, head, "jhxxsl", nc.jhxxsl); //计划下限数量 CreateNode(xmlDoc, head, "jhyid", nc.jhyid); //计划员ID CreateNode(xmlDoc, head, "jldw", ""); //计量单位 CreateNode(xmlDoc, head, "jldwid", nc.jldwid); //计量单位ID CreateNode(xmlDoc, head, "ksid", ""); //客商ID CreateNode(xmlDoc, head, "memo", nc.memo); //备注 CreateNode(xmlDoc, head, "pch", ""); //批次号 CreateNode(xmlDoc, head, "pk_corp", "1001"); //公司 CreateNode(xmlDoc, head, "pk_poid", ""); //计划订单主键 CreateNode(xmlDoc, head, "pk_produce", nc.pk_produce); //物料PK CreateNode(xmlDoc, head, "primaryKey", ""); CreateNode(xmlDoc, head, "pzh", ""); //配置号 CreateNode(xmlDoc, head, "qrrid", ""); CreateNode(xmlDoc, head, "qrrq", ""); CreateNode(xmlDoc, head, "rtver", ""); CreateNode(xmlDoc, head, "scbmbm", ""); CreateNode(xmlDoc, head, "scbmid", nc.scbmid);//生产部门ID CreateNode(xmlDoc, head, "scbmmc", ""); CreateNode(xmlDoc, head, "scbz", "1"); CreateNode(xmlDoc, head, "scxid", ""); CreateNode(xmlDoc, head, "shrid", nc.shrid); CreateNode(xmlDoc, head, "shrq", nc.shrq.ToString("yyyy-MM-dd")); CreateNode(xmlDoc, head, "slrq", nc.slrq.ToString("yyyy-MM-dd")); CreateNode(xmlDoc, head, "unitcode", ""); CreateNode(xmlDoc, head, "userid", ""); CreateNode(xmlDoc, head, "wlbm", ""); CreateNode(xmlDoc, head, "wlbmid", nc.wlbmid); CreateNode(xmlDoc, head, "wlmc", ""); CreateNode(xmlDoc, head, "wpcsl", "0.00000000"); CreateNode(xmlDoc, head, "wwlx", "OA"); CreateNode(xmlDoc, head, "xdrq", nc.xdrq.ToString("yyyy-MM-dd")); CreateNode(xmlDoc, head, "xqfsl", ""); CreateNode(xmlDoc, head, "xqrq", nc.xqrq.ToString("yyyy-MM-dd")); CreateNode(xmlDoc, head, "xqsl", nc.xqsl); CreateNode(xmlDoc, head, "xsddh", ""); CreateNode(xmlDoc, head, "xsddid", ""); CreateNode(xmlDoc, head, "xxbz", "0"); CreateNode(xmlDoc, head, "yfjsl", ""); CreateNode(xmlDoc, head, "ypcsl", ""); CreateNode(xmlDoc, head, "ywwsl", ""); CreateNode(xmlDoc, head, "zdrid", nc.shrid); CreateNode(xmlDoc, head, "zdrmc", ""); CreateNode(xmlDoc, head, "zdrq", nc.zdrq.ToString("yyyy-MM-dd")); CreateNode(xmlDoc, head, "zdy1", ""); CreateNode(xmlDoc, head, "zdy2", "其它要求"); CreateNode(xmlDoc, head, "zdy3", ""); CreateNode(xmlDoc, head, "zdy4", "火运"); CreateNode(xmlDoc, head, "zdy5", "特级"); CreateNode(xmlDoc, head, "zt", "B"); CreateNode(xmlDoc, head, "zyx1", nc.zyx1); CreateNode(xmlDoc, head, "zyx2", nc.zyx2); CreateNode(xmlDoc, head, "zyx3", nc.zyx3); CreateNode(xmlDoc, head, "zyx4", ""); CreateNode(xmlDoc, head, "zyx5", nc.zyx5);//pci主键 #endregion so_order.AppendChild(head); xmlDoc.Save(url + "\\" + xmlFileName); var result = dalSendNC.SendXML(url + "\\" + xmlFileName); Mod_TB_NCIF_LOG log = new Mod_TB_NCIF_LOG(); log.C_TYPE = "A1"; log.C_RESULT = result[0]; log.C_REMARK = result[1]; log.C_RELATIONSHIP_ID = nc.zyx5; dal_TB_NCIF_LOG.Add(log); return(result); } catch (Exception ex) { return(null); } }
public List <string> SendXml_ROLL_A4(string pch, string xmlFileName, NcRollA4 nc, string path) { try { string url = path + "\\NCXML"; if (!Directory.Exists(url)) { Directory.CreateDirectory(url); } // Mod_TMO_CON modCon = tmo_con.GetModel(pch); XmlDocument xmlDoc = new XmlDocument(); //创建类型声明节点 XmlNode node = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", "no"); xmlDoc.AppendChild(node); //创建根节点 XmlElement root = xmlDoc.CreateElement("ufinterface"); #region//给节点属性赋值 root.SetAttribute("billtype", "AM"); root.SetAttribute("filename", "" + pch + ".xml"); root.SetAttribute("isexchange", "Y"); root.SetAttribute("operation", "req"); root.SetAttribute("proc", "add"); root.SetAttribute("receiver", "101"); root.SetAttribute("replace", "Y"); root.SetAttribute("roottag", "bill"); root.SetAttribute("sender", "1107"); #endregion xmlDoc.AppendChild(root); //创建子根节点 XmlElement bill = xmlDoc.CreateElement("bill"); #region//节点属性 bill.SetAttribute("id", nc.pch); #endregion root.AppendChild(bill); XmlNode head = xmlDoc.CreateNode(XmlNodeType.Element, "bill_head", null); #region //表头_order_head CreateNode(xmlDoc, head, "zdrid", nc.zdrid); //制单人 CreateNode(xmlDoc, head, "rq", nc.rq.ToString("yyyy-MM-dd")); //日期 CreateNode(xmlDoc, head, "sj", nc.rq.ToString("HH:mm:ss")); //报告时间 CreateNode(xmlDoc, head, "gzzxbmid", nc.gzzxbmid); //工作中心编码ID CreateNode(xmlDoc, head, "scbmid", nc.scbmid); //生产部门ID #endregion bill.AppendChild(head); XmlElement body = xmlDoc.CreateElement("bill_body"); bill.AppendChild(body); XmlNode item = xmlDoc.CreateNode(XmlNodeType.Element, "item", null); #region //表体_item CreateNode(xmlDoc, item, "pch", nc.pch); //批次号 CreateNode(xmlDoc, item, "scddh", ""); //生产订单号 CreateNode(xmlDoc, item, "wlbmid", nc.wlbmid); //物料编码ID CreateNode(xmlDoc, item, "jldwid", nc.jldwid); //计量单位ID CreateNode(xmlDoc, item, "gzzxid", nc.gzzxid); //工作中心ID CreateNode(xmlDoc, item, "ccxh", nc.pch); //产出序号 CreateNode(xmlDoc, item, "gxh", ""); //工序号 CreateNode(xmlDoc, item, "pk_produce", nc.pk_produce); //物料PK CreateNode(xmlDoc, item, "ksrq", nc.ksrq.ToString("yyyy-MM-dd")); //开始日期 CreateNode(xmlDoc, item, "kssj", nc.ksrq.ToString("HH:mm:ss")); //开始时间 CreateNode(xmlDoc, item, "jsrq", nc.jsrq.ToString("yyyy-MM-dd")); //结束日期 CreateNode(xmlDoc, item, "jssj", nc.jsrq.ToString("HH:mm:ss")); //结束时间 CreateNode(xmlDoc, item, "hgsl", nc.hgsl); //合格数量 CreateNode(xmlDoc, item, "fhgsl", nc.fhgsl); //辅合格数量 CreateNode(xmlDoc, item, "sflfcp", nc.sffsgp); //是否联副产品 CreateNode(xmlDoc, item, "sffsgp", nc.sffsgp); //是否发生改判 CreateNode(xmlDoc, item, "zdy1", ""); //自定义项1 CreateNode(xmlDoc, item, "zdy2", ""); //自定义项2 CreateNode(xmlDoc, item, "zdy3", ""); //自定义项3 CreateNode(xmlDoc, item, "zdy4", ""); //自定义项4 CreateNode(xmlDoc, item, "zdy5", ""); //自定义项5 CreateNode(xmlDoc, item, "freeitemvalue1", nc.freeitemvalue1); CreateNode(xmlDoc, item, "freeitemvalue2", nc.freeitemvalue2); CreateNode(xmlDoc, item, "freeitemvalue3", nc.freeitemvalue3); CreateNode(xmlDoc, item, "freeitemvalue4", ""); CreateNode(xmlDoc, item, "freeitemvalue5", ""); //PCI计划订单主键 CreateNode(xmlDoc, item, "pk_corp", ""); //公司编码 CreateNode(xmlDoc, item, "gcbm", ""); //工厂 #endregion body.AppendChild(item); xmlDoc.Save(url + "\\" + xmlFileName); List <string> result = dalSendNC.SendXML(url + "\\" + xmlFileName); Mod_TB_NCIF_LOG log = new Mod_TB_NCIF_LOG(); log.C_TYPE = "A4"; log.C_RESULT = result[0]; log.C_REMARK = result[1]; log.C_RELATIONSHIP_ID = nc.pch; dal_TB_NCIF_LOG.Add(log); return(result); } catch (Exception ex) { return(null); } }