Example #1
0
        protected void btndel_day_Click(object sender, EventArgs e)
        {
            try
            {
                var list = new List <Mod_TMP_DAYPLAN>();

                for (int i = 0; i < rptList.Items.Count; i++)
                {
                    HtmlInputCheckBox cbxselect = (HtmlInputCheckBox)rptList.Items[i].FindControl("cbxselect");
                    if (cbxselect.Checked)
                    {
                        var mod = new Mod_TMP_DAYPLAN()
                        {
                            C_ID = cbxselect.Value
                        };
                        list.Add(mod);
                    }
                }

                if (tmo_order.DelDayPlan(list))
                {
                    WebMsg.MessageBox("删除成功");
                }
            }
            catch (Exception ex)
            {
                WebMsg.MessageBox(ex.Message);
            }
        }
Example #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TMP_DAYPLAN GetModel(string C_PLCODE)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select C_ID,C_PLCODE,C_PKBILLB,C_PKBILLH,C_CONNO,C_ORDERNO,C_PKINV,C_PKASSISTMEASURE,N_ASSISTNUM,N_NUM,N_UNITPRICE,N_MONEY,D_PLANDATE,D_ORDSNDATE,D_REQUIREDATE,D_SNDDATE,C_PKCUST,C_PKSENDTYPE,C_PKSALECORP,C_PKSALEORG,C_PKSENDSTOREORG,C_PKOPERATOR,C_PKOPRDEPART,C_PKPLANPERSON,C_PKAPPRPERSON,D_APPRDATE,C_PKARRIVEAREA,C_DESTADDRESS,C_RECEIPTCORPID,C_BIZTYPE,C_REMARK,C_PKSENDAREA,C_PKDELIVORG,C_UNITID,C_VFREE1,C_VFREE2,C_VFREE3,C_VFREE4,C_SALECODE from TMP_DAYPLAN ");
            strSql.Append(" where C_PLCODE=:C_PLCODE ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_PLCODE", OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = C_PLCODE;

            Mod_TMP_DAYPLAN model = new Mod_TMP_DAYPLAN();
            DataSet         ds    = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #3
0
        public List <string> SendXmlDayPlan(string dayplcode, string xmlFileName, string empID)
        {
            try
            {
                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", "DMDP");
                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");
                so_order.SetAttribute("id", modPlan.C_ID);
                root.AppendChild(so_order);

                XmlNode head = xmlDoc.CreateNode(XmlNodeType.Element, "bill_head", null);

                #region                                                                                                   //表头_order_head
                CreateNode(xmlDoc, head, "vdelivdayplcode", modPlan.C_PLCODE);                                            //日计划单据号
                CreateNode(xmlDoc, head, "vbilltype", "30");                                                              //来源单据类型
                CreateNode(xmlDoc, head, "pkbillb", modPlan.C_PKBILLB);                                                   //来源单据子表ID
                CreateNode(xmlDoc, head, "pkbillh", modPlan.C_PKBILLH);                                                   //来源单据主表ID
                CreateNode(xmlDoc, head, "vsrcbillnum", modPlan.C_SALECODE);                                              //来源销售主表单据号
                CreateNode(xmlDoc, head, "iplanstatus", "0");
                CreateNode(xmlDoc, head, "plandate", Convert.ToDateTime(modPlan.D_PLANDATE).ToString("yyy-MM-dd"));       //日计划日期
                CreateNode(xmlDoc, head, "ordsndate", Convert.ToDateTime(modPlan.D_ORDSNDATE).ToString("yyy-MM-dd"));     //定单要求发货日期
                CreateNode(xmlDoc, head, "requiredate", Convert.ToDateTime(modPlan.D_REQUIREDATE).ToString("yyy-MM-dd")); //定单要求到货日期
                CreateNode(xmlDoc, head, "snddate", Convert.ToDateTime(modPlan.D_SNDDATE).ToString("yyy-MM-dd"));         //实际发货日期
                CreateNode(xmlDoc, head, "pkinv", modPlan.C_PKINV);                                                       //存货主键
                CreateNode(xmlDoc, head, "pkassistmeasure", modPlan.C_PKASSISTMEASURE);                                   //辅计量单位
                CreateNode(xmlDoc, head, "dassistnum", modPlan.N_ASSISTNUM.ToString());                                   //辅数量
                CreateNode(xmlDoc, head, "dnum", modPlan.N_NUM.ToString());                                               //主数量
                CreateNode(xmlDoc, head, "pkcust", modPlan.C_PKCUST);                                                     //客户主键
                CreateNode(xmlDoc, head, "pksendtype", modPlan.C_PKSENDTYPE);                                             //发运方式
                CreateNode(xmlDoc, head, "vbatchcode", "");
                CreateNode(xmlDoc, head, "ibatchstatus", "0");
                CreateNode(xmlDoc, head, "pkdeststoreorg", "");
                CreateNode(xmlDoc, head, "pkdeststore", "");
                CreateNode(xmlDoc, head, "pksalecorp", modPlan.C_PKSALECORP);         //销售公司主键
                CreateNode(xmlDoc, head, "pksaleorg", modPlan.C_PKSALEORG);           //销售组织主键
                CreateNode(xmlDoc, head, "pksendstoreorg", modPlan.C_PKSENDSTOREORG); //发货库存组织主键
                CreateNode(xmlDoc, head, "pksendstore", "N");
                CreateNode(xmlDoc, head, "dweight", "");
                CreateNode(xmlDoc, head, "dvolumn", "");
                CreateNode(xmlDoc, head, "dunitprice", modPlan.N_UNITPRICE.ToString()); //单价
                CreateNode(xmlDoc, head, "dmoney", modPlan.N_MONEY.ToString());         //订单金额
                CreateNode(xmlDoc, head, "bpresent", "N");
                CreateNode(xmlDoc, head, "dsendnum", "");
                CreateNode(xmlDoc, head, "dsignnum", "");
                CreateNode(xmlDoc, head, "doutnum", "");
                CreateNode(xmlDoc, head, "dbacknum", "");
                CreateNode(xmlDoc, head, "pkitem", "");
                CreateNode(xmlDoc, head, "pkitemperiod", "");
                CreateNode(xmlDoc, head, "pkoperator", modPlan.C_PKOPERATOR);                                       //业务员主键
                CreateNode(xmlDoc, head, "pkoprdepart", modPlan.C_PKOPRDEPART);                                     //业务部门主键
                CreateNode(xmlDoc, head, "pkplanperson", modPlan.C_PKPLANPERSON);                                   //计划人
                CreateNode(xmlDoc, head, "pkapprperson", modPlan.C_PKAPPRPERSON);                                   //审批人
                CreateNode(xmlDoc, head, "apprdate", Convert.ToDateTime(modPlan.D_APPRDATE).ToString("yyy-MM-dd")); //审批日期
                CreateNode(xmlDoc, head, "pkarrivearea", modPlan.C_PKARRIVEAREA);                                   //到货地区主键
                CreateNode(xmlDoc, head, "vdestaddress", modPlan.C_DESTADDRESS);                                    //到货地址
                CreateNode(xmlDoc, head, "cfreezeid", "");
                CreateNode(xmlDoc, head, "creceiptcorpid", modPlan.C_RECEIPTCORPID);                                //收货单位
                CreateNode(xmlDoc, head, "cbiztype", modPlan.C_BIZTYPE);                                            //业务类型
                CreateNode(xmlDoc, head, "vnote", modPlan.C_REMARK);
                CreateNode(xmlDoc, head, "dwaylossnum", "");
                CreateNode(xmlDoc, head, "bisdelivend", "");
                CreateNode(xmlDoc, head, "bisoutend", "");
                CreateNode(xmlDoc, head, "pkarrivecorp", "");
                CreateNode(xmlDoc, head, "pksendarea", modPlan.C_PKSENDAREA);//发货地区
                CreateNode(xmlDoc, head, "cplansendtime", "");
                CreateNode(xmlDoc, head, "crequiretime", "");
                CreateNode(xmlDoc, head, "pkarriveaddress", "");
                CreateNode(xmlDoc, head, "pksendaddress", "");
                CreateNode(xmlDoc, head, "pkdelivorg", modPlan.C_PKDELIVORG);//发运组织固定
                CreateNode(xmlDoc, head, "pkorderplanid", "");
                CreateNode(xmlDoc, head, "borderreturn", "N");
                CreateNode(xmlDoc, head, "csendcorpid", "");
                CreateNode(xmlDoc, head, "vsendaddr", "");
                CreateNode(xmlDoc, head, "ntotalshouldoutnum", "");
                CreateNode(xmlDoc, head, "nfeedbacknum", modPlan.N_NUM.ToString()); //回写上游数量--发运单
                CreateNode(xmlDoc, head, "iprintcount", "");
                CreateNode(xmlDoc, head, "cquoteunitid", modPlan.C_UNITID);         //报价计量单位ID
                CreateNode(xmlDoc, head, "nquoteunitnum", "1");
                CreateNode(xmlDoc, head, "nquoteunitrate", "1");
                CreateNode(xmlDoc, head, "taudittime", "");
                CreateNode(xmlDoc, head, "tmaketime", "");
                CreateNode(xmlDoc, head, "tlastmodifytime", "");
                CreateNode(xmlDoc, head, "clastmodifierid", "");
                CreateNode(xmlDoc, head, "vfree1", modPlan.C_VFREE1); //自由项1
                CreateNode(xmlDoc, head, "vfree2", modPlan.C_VFREE2); //自由项2
                CreateNode(xmlDoc, head, "vfree3", modPlan.C_VFREE3); //包装要求
                CreateNode(xmlDoc, head, "vfree4", "");
                CreateNode(xmlDoc, head, "vfree5", "");
                CreateNode(xmlDoc, head, "vfree6", "");
                CreateNode(xmlDoc, head, "vfree7", "");
                CreateNode(xmlDoc, head, "vfree8", "");
                CreateNode(xmlDoc, head, "vfree9", "");
                CreateNode(xmlDoc, head, "vfree10", "");
                CreateNode(xmlDoc, head, "vuserdef0", "");
                CreateNode(xmlDoc, head, "vuserdef1", "");
                CreateNode(xmlDoc, head, "vuserdef2", "");
                CreateNode(xmlDoc, head, "vuserdef3", "");
                CreateNode(xmlDoc, head, "vuserdef4", "");
                CreateNode(xmlDoc, head, "vuserdef5", "");
                CreateNode(xmlDoc, head, "vuserdef6", "");
                CreateNode(xmlDoc, head, "vuserdef7", "");
                CreateNode(xmlDoc, head, "vuserdef8", "");
                CreateNode(xmlDoc, head, "vuserdef9", "");
                CreateNode(xmlDoc, head, "vuserdef10", "");
                CreateNode(xmlDoc, head, "vuserdef11", "");
                CreateNode(xmlDoc, head, "vuserdef12", "");
                CreateNode(xmlDoc, head, "vuserdef13", "");
                CreateNode(xmlDoc, head, "vuserdef14", "");
                CreateNode(xmlDoc, head, "vuserdef15", "");
                CreateNode(xmlDoc, head, "vuserdef16", "");
                CreateNode(xmlDoc, head, "vuserdef17", "");
                CreateNode(xmlDoc, head, "vuserdef18", "");
                CreateNode(xmlDoc, head, "vuserdef19", "");
                CreateNode(xmlDoc, head, "pk_defdoc0", "");
                CreateNode(xmlDoc, head, "pk_defdoc1", "");
                CreateNode(xmlDoc, head, "pk_defdoc2", "");
                CreateNode(xmlDoc, head, "pk_defdoc3", "");
                CreateNode(xmlDoc, head, "pk_defdoc4", "");
                CreateNode(xmlDoc, head, "pk_defdoc5", "");
                CreateNode(xmlDoc, head, "pk_defdoc6", "");
                CreateNode(xmlDoc, head, "pk_defdoc7", "");
                CreateNode(xmlDoc, head, "pk_defdoc8", "");
                CreateNode(xmlDoc, head, "pk_defdoc9", "");
                CreateNode(xmlDoc, head, "pk_defdoc10", "");
                CreateNode(xmlDoc, head, "pk_defdoc11", "");
                CreateNode(xmlDoc, head, "pk_defdoc12", "");
                CreateNode(xmlDoc, head, "pk_defdoc13", "");
                CreateNode(xmlDoc, head, "pk_defdoc14", "");
                CreateNode(xmlDoc, head, "pk_defdoc15", "");
                CreateNode(xmlDoc, head, "pk_defdoc16", "");
                CreateNode(xmlDoc, head, "pk_defdoc17", "");
                CreateNode(xmlDoc, head, "pk_defdoc18", "");
                CreateNode(xmlDoc, head, "pk_defdoc19", "");
                CreateNode(xmlDoc, head, "vuserdef_b_0", "");
                CreateNode(xmlDoc, head, "vuserdef_b_1", "");
                CreateNode(xmlDoc, head, "vuserdef_b_2", "");
                CreateNode(xmlDoc, head, "vuserdef_b_3", "");
                CreateNode(xmlDoc, head, "vuserdef_b_4", "");
                CreateNode(xmlDoc, head, "vuserdef_b_5", "");
                CreateNode(xmlDoc, head, "vuserdef_b_6", "");
                CreateNode(xmlDoc, head, "vuserdef_b_7", "");
                CreateNode(xmlDoc, head, "vuserdef_b_8", "");
                CreateNode(xmlDoc, head, "vuserdef_b_9", "");
                CreateNode(xmlDoc, head, "vuserdef_b_10", modPlan.C_CONNO);  //合同号
                CreateNode(xmlDoc, head, "vuserdef_b_11", modPlan.C_VFREE4); //质量等级
                CreateNode(xmlDoc, head, "vuserdef_b_12", "");
                CreateNode(xmlDoc, head, "vuserdef_b_13", "");
                CreateNode(xmlDoc, head, "vuserdef_b_14", "");
                CreateNode(xmlDoc, head, "vuserdef_b_15", "");
                CreateNode(xmlDoc, head, "vuserdef_b_16", "");
                CreateNode(xmlDoc, head, "vuserdef_b_17", "");
                CreateNode(xmlDoc, head, "vuserdef_b_18", "");
                CreateNode(xmlDoc, head, "vuserdef_b_19", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_0", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_1", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_2", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_3", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_4", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_5", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_6", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_7", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_8", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_9", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_10", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_11", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_12", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_13", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_14", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_15", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_16", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_17", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_18", "");
                CreateNode(xmlDoc, head, "pk_defdoc_b_19", "");

                #endregion

                so_order.AppendChild(head);

                xmlDoc.Save(xmlFileName);

                List <string> parem = NCSendXml.SendXML(xmlDoc);//发送NC
                parem.Add(dayplcode);
                parem.Add(empID);
                parem.Add("日计划-NC");
                parem.Add(parem[0] == "1" ? "导入NC成功" : "导入NC失败");

                //日志录入
                AddLog(parem);

                return(parem);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 发送改判信息给NC
        /// </summary>
        /// <param name="xmlFileName">xml完整路径</param>
        /// <returns></returns>
        public string SendXml_DM(string xmlFileName, string fydh)
        {
            try
            {
                string name = "FYSJ" + fydh + ".xml";
                xmlFileName += "\\NCXML\\" + name;
                Mod_TMD_DISPATCH modDispatch = dal_TMD_DISPATCH.GetModel(fydh);
                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", "7F");
                root.SetAttribute("filename", name);
                root.SetAttribute("isexchange", "Y");
                root.SetAttribute("operation", "req");
                root.SetAttribute("proc", "update");
                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");
                bill.SetAttribute("id", modDispatch.C_GUID);//发运单表头主键
                root.AppendChild(bill);

                XmlNode head = xmlDoc.CreateNode(XmlNodeType.Element, "bill_head", null);

                #region                                                                                                   //表头_order_head
                CreateNode(xmlDoc, head, "apprdate", Convert.ToDateTime(modDispatch.D_APPROVE_DT).ToString("yyy-MM-dd")); //审批日期
                CreateNode(xmlDoc, head, "bconfirm", "N");
                CreateNode(xmlDoc, head, "billdate", Convert.ToDateTime(modDispatch.D_CREATE_DT).ToString("yyy-MM-dd"));  //制单日期
                CreateNode(xmlDoc, head, "billnewaddtime", Convert.ToDateTime(modDispatch.D_CREATE_DT).ToString("yyy-MM-dd HH:mm:ss"));
                CreateNode(xmlDoc, head, "bisopen", "");
                CreateNode(xmlDoc, head, "bmissionbill", "N");
                CreateNode(xmlDoc, head, "bmustreturnbillcode", "");
                CreateNode(xmlDoc, head, "btestbyinvoice", "");
                CreateNode(xmlDoc, head, "clastmodifierid", modDispatch.C_EMP_ID);//最后修改人
                CreateNode(xmlDoc, head, "clastmodiname", "");
                CreateNode(xmlDoc, head, "curbilltype", "");
                CreateNode(xmlDoc, head, "dallpacknum", "0");
                CreateNode(xmlDoc, head, "dallvolumn", "0");
                CreateNode(xmlDoc, head, "dallweight", "0");
                CreateNode(xmlDoc, head, "dfactweight", "");
                CreateNode(xmlDoc, head, "dr", "0");
                CreateNode(xmlDoc, head, "dtotal", "");
                CreateNode(xmlDoc, head, "employee", "");
                CreateNode(xmlDoc, head, "h_confirmarrivedate", "");
                CreateNode(xmlDoc, head, "iprintcount", "");
                CreateNode(xmlDoc, head, "isendtype", "3");//运费类别
                CreateNode(xmlDoc, head, "linkman1", "");
                CreateNode(xmlDoc, head, "oprdepartname", "");
                CreateNode(xmlDoc, head, "phone1", "");
                CreateNode(xmlDoc, head, "pk_defdoc0", modDispatch.C_IS_WIRESALE_ID); //是否线材销售主键
                CreateNode(xmlDoc, head, "pk_defdoc1", "");
                CreateNode(xmlDoc, head, "pk_defdoc10", "");
                CreateNode(xmlDoc, head, "pk_defdoc11", "");
                CreateNode(xmlDoc, head, "pk_defdoc12", "");
                CreateNode(xmlDoc, head, "pk_defdoc13", "");
                CreateNode(xmlDoc, head, "pk_defdoc14", "");
                CreateNode(xmlDoc, head, "pk_defdoc15", "");
                CreateNode(xmlDoc, head, "pk_defdoc16", "");
                CreateNode(xmlDoc, head, "pk_defdoc17", "");
                CreateNode(xmlDoc, head, "pk_defdoc18", "");
                CreateNode(xmlDoc, head, "pk_defdoc19", "");
                CreateNode(xmlDoc, head, "pk_defdoc2", "");
                CreateNode(xmlDoc, head, "pk_defdoc3", "");
                CreateNode(xmlDoc, head, "pk_defdoc4", "");
                CreateNode(xmlDoc, head, "pk_defdoc5", "");
                CreateNode(xmlDoc, head, "pk_defdoc6", "");
                CreateNode(xmlDoc, head, "pk_defdoc7", "");
                CreateNode(xmlDoc, head, "pk_defdoc8", "");
                CreateNode(xmlDoc, head, "pk_defdoc9", "");
                CreateNode(xmlDoc, head, "pk_delivbill_h", "");                       //发运单表头主键
                CreateNode(xmlDoc, head, "pkapprperson", "");
                CreateNode(xmlDoc, head, "pkbillperson", modDispatch.C_CREATE_ID);    //制单人
                CreateNode(xmlDoc, head, "pkcorpforgenoid", "1001");
                CreateNode(xmlDoc, head, "pkdelivmode", modDispatch.C_SHIPVIA);       //发运方式主键
                CreateNode(xmlDoc, head, "pkdelivorg", "1001NC10000000006EHS");       //发运组织主键固定
                CreateNode(xmlDoc, head, "pkdelivroute", "1001NC10000000006EHV");     //发运路线主键 固定
                CreateNode(xmlDoc, head, "pkdriver", "");
                CreateNode(xmlDoc, head, "pkoperator", modDispatch.C_BUSINESS_ID);    //业务员主键
                CreateNode(xmlDoc, head, "pkoprdepart", modDispatch.C_BUSINESS_DEPT); //业务部门主键
                CreateNode(xmlDoc, head, "pksendperson", "");
                CreateNode(xmlDoc, head, "pktrancust", modDispatch.C_COMCAR);         //承运商
                CreateNode(xmlDoc, head, "pktranorg", "");
                CreateNode(xmlDoc, head, "pkvehicle", "");
                CreateNode(xmlDoc, head, "pkvehicletype", "");
                CreateNode(xmlDoc, head, "returndate", "");
                CreateNode(xmlDoc, head, "returntime", "");
                CreateNode(xmlDoc, head, "senddate", Convert.ToDateTime(modDispatch.D_DISP_DT).ToString("yyy-MM-dd"));//发运日期
                CreateNode(xmlDoc, head, "startdate", "");
                CreateNode(xmlDoc, head, "starttime", "");
                CreateNode(xmlDoc, head, "taudittime", "");
                CreateNode(xmlDoc, head, "tlastmodifytime", Convert.ToDateTime(modDispatch.D_MOD_DT).ToString("yyy-MM-dd HH:mm:ss")); //最后修改时间
                CreateNode(xmlDoc, head, "tmaketime", Convert.ToDateTime(modDispatch.D_CREATE_DT).ToString("yyy-MM-dd HH:mm:ss"));    // 制单时间
                CreateNode(xmlDoc, head, "ts", Convert.ToDateTime(modDispatch.D_CREATE_DT).ToString("yyy-MM-dd HH:mm:ss"));
                CreateNode(xmlDoc, head, "userid", modDispatch.C_CREATE_ID);                                                          //制单人
                CreateNode(xmlDoc, head, "vapprpersonname", "");
                CreateNode(xmlDoc, head, "vbillpersonname", "");
                CreateNode(xmlDoc, head, "vdelivbillcode", modDispatch.C_ID);//发运单单据号
                CreateNode(xmlDoc, head, "vdoname", "");
                CreateNode(xmlDoc, head, "vdrivername", "");
                CreateNode(xmlDoc, head, "vehiclelicense", "");
                CreateNode(xmlDoc, head, "vnote", "");
                CreateNode(xmlDoc, head, "voldDelivbillcode", "");
                CreateNode(xmlDoc, head, "vroutedescr", "");
                CreateNode(xmlDoc, head, "vroutename", "");
                CreateNode(xmlDoc, head, "vsendtypename", "");
                CreateNode(xmlDoc, head, "vtranname", "");
                CreateNode(xmlDoc, head, "vtranorgname", "");
                CreateNode(xmlDoc, head, "vuserdef0", modDispatch.C_IS_WIRESALE);// 是否线材销售 是/ 否  *****
                CreateNode(xmlDoc, head, "vuserdef1", "");
                CreateNode(xmlDoc, head, "vuserdef10", "");
                CreateNode(xmlDoc, head, "vuserdef11", "");
                CreateNode(xmlDoc, head, "vuserdef12", "");
                CreateNode(xmlDoc, head, "vuserdef13", "");
                CreateNode(xmlDoc, head, "vuserdef14", "");
                CreateNode(xmlDoc, head, "vuserdef15", "");
                CreateNode(xmlDoc, head, "vuserdef16", "");
                CreateNode(xmlDoc, head, "vuserdef17", "");
                CreateNode(xmlDoc, head, "vuserdef18", "");
                CreateNode(xmlDoc, head, "vuserdef19", "");
                CreateNode(xmlDoc, head, "vuserdef2", "");
                CreateNode(xmlDoc, head, "vuserdef3", "Y");                      //是否已导出
                CreateNode(xmlDoc, head, "vuserdef4", modDispatch.C_LIC_PLA_NO); //车牌号
                CreateNode(xmlDoc, head, "vuserdef5", "");
                CreateNode(xmlDoc, head, "vuserdef6", "");
                CreateNode(xmlDoc, head, "vuserdef7", "");
                CreateNode(xmlDoc, head, "vuserdef8", "");
                CreateNode(xmlDoc, head, "vuserdef9", "");
                CreateNode(xmlDoc, head, "vvehiclename", "");
                CreateNode(xmlDoc, head, "vvhcltypename", "");

                #endregion

                bill.AppendChild(head);
                XmlElement body = xmlDoc.CreateElement("bill_body");
                bill.AppendChild(body);

                DataTable dt = GetZJBList(fydh).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        int rowno = i + 1;

                        Mod_TMP_DAYPLAN modDayPlan = dal_TMP_DAYPLAN.GetModel(dt.Rows[i]["C_PLAN_ID"].ToString());
                        if (modDayPlan != null)
                        {
                            #region //实体参数

                            Mod_TMO_ORDER           modOrder           = dal_TMO_ORDER.GetModel(modDayPlan.C_PKBILLB);
                            Mod_TPB_LINEWH          mbck               = dal_TPB_LINEWH.GetModel_Interface_Trans(dt.Rows[i]["C_SEND_STOCK"].ToString()); //目标仓库
                            Mod_TPB_SLABWH          slabwh             = dal_TPB_SLABWH.GetModel_Interface_Trans(dt.Rows[i]["C_SEND_STOCK"].ToString());
                            Mod_TS_CUSTFILE         modCust            = dal_TS_CUSTFILE.GetCustModel(modDayPlan.C_PKCUST);                              //客户档案
                            Mod_TMB_AREA            modArea            = dal_TMB_AREA.GetModel(modDayPlan.C_PKARRIVEAREA);                               //区域
                            Mod_TB_MATRL_MAIN       modMat             = dal_TB_MATRL_MAIN.GetMatModel(modDayPlan.C_PKINV);                              //物料
                            Mod_TQB_CHECKSTATE      mod_TQB_CHECKSTATE = dal_TQB_CHECKSTATE.GetModelByName(dt.Rows[i]["C_ZLDJ"].ToString(), "1001");
                            Mod_TMD_DISPATCHDETAILS modfyditem         = dal_fyditem.GetModel(dt.Rows[i]["C_PK_NCID"].ToString());

                            string    addrpk   = "";
                            DataTable dtaddess = dal_TMB_AREA.GetAreaAddress(modfyditem.C_SEND_AREA).Tables[0];
                            if (dtaddess.Rows.Count > 0)
                            {
                                addrpk = dtaddess.Rows[0]["PK_ADDRESS"].ToString();
                            }
                            #endregion

                            decimal dunitprice = Convert.ToDecimal(modDayPlan.N_UNITPRICE); //含税单价
                            string  wgt        = dt.Rows[i]["N_JZ"].ToString();             //重量
                            string  num        = dt.Rows[i]["N_NUM"].ToString();            //数量
                            decimal dmoney     = dunitprice * Convert.ToDecimal(wgt);       //订单金额

                            XmlNode item = xmlDoc.CreateNode(XmlNodeType.Element, "item", null);

                            #region //表体_item
                            CreateNode(xmlDoc, item, "bappendent", "");
                            CreateNode(xmlDoc, item, "bcloseout", "");
                            CreateNode(xmlDoc, item, "bcloseout_old", "");
                            CreateNode(xmlDoc, item, "blargess", "N");
                            CreateNode(xmlDoc, item, "borderreturn", "N");
                            CreateNode(xmlDoc, item, "breceiveinform", "");
                            CreateNode(xmlDoc, item, "bsigned", "");
                            CreateNode(xmlDoc, item, "btestbyinvoice", "");
                            CreateNode(xmlDoc, item, "carrivecorpname", "");
                            CreateNode(xmlDoc, item, "cbiztype", modDayPlan.C_BIZTYPE);           //业务类型
                            CreateNode(xmlDoc, item, "ccheckstate_bid", mod_TQB_CHECKSTATE.C_ID); //质量等级**
                            CreateNode(xmlDoc, item, "ccheckstatename", "");
                            CreateNode(xmlDoc, item, "cfreezeid", "");
                            CreateNode(xmlDoc, item, "cinvmanid", "");
                            CreateNode(xmlDoc, item, "confirmarrivedate", "");
                            CreateNode(xmlDoc, item, "cquoteunitid", modDayPlan.C_UNITID);//报价计量单位ID
                            CreateNode(xmlDoc, item, "cquoteunitname", "");
                            CreateNode(xmlDoc, item, "creceiptcorp", "");
                            CreateNode(xmlDoc, item, "creceiptcorpid", modDayPlan.C_RECEIPTCORPID);//收货单位
                            CreateNode(xmlDoc, item, "csendcorp", "");
                            CreateNode(xmlDoc, item, "csendcorpid", "");
                            CreateNode(xmlDoc, item, "dcancelassistnum", "");
                            CreateNode(xmlDoc, item, "dcancelnum", "");
                            CreateNode(xmlDoc, item, "dfee", "");
                            CreateNode(xmlDoc, item, "dfeeitem", "");
                            CreateNode(xmlDoc, item, "dinvassist", num); //辅数量-件数
                            CreateNode(xmlDoc, item, "dinvnum", wgt);    //存货数量
                            CreateNode(xmlDoc, item, "dinvweight", "");
                            CreateNode(xmlDoc, item, "dmileage", "");
                            CreateNode(xmlDoc, item, "dmoney", dmoney.ToString());//订单金额
                            CreateNode(xmlDoc, item, "doutassistnum", "");
                            CreateNode(xmlDoc, item, "doutnum", "");
                            CreateNode(xmlDoc, item, "doutnummargin", "");
                            CreateNode(xmlDoc, item, "dpackboxnum", "");
                            CreateNode(xmlDoc, item, "dpacknum", "");
                            CreateNode(xmlDoc, item, "dpackvolumn", "");
                            CreateNode(xmlDoc, item, "dpackweight", "");
                            CreateNode(xmlDoc, item, "dr", "0");
                            CreateNode(xmlDoc, item, "dreturnassistnum", "");
                            CreateNode(xmlDoc, item, "dreturnnum", "");
                            CreateNode(xmlDoc, item, "dsignasnum", "");
                            CreateNode(xmlDoc, item, "dsignassistnum", "");
                            CreateNode(xmlDoc, item, "dsignnum", "");
                            CreateNode(xmlDoc, item, "dsourcerow", "");
                            CreateNode(xmlDoc, item, "dtotalout", "");
                            CreateNode(xmlDoc, item, "dunitprice", dunitprice.ToString());//含税单价
                            CreateNode(xmlDoc, item, "dvolumn", "");
                            CreateNode(xmlDoc, item, "dwaylossasnum", "");
                            CreateNode(xmlDoc, item, "dwaylossnum", "");
                            CreateNode(xmlDoc, item, "hsl", "");
                            CreateNode(xmlDoc, item, "iattitude", "");
                            CreateNode(xmlDoc, item, "ibatchstatus", "0");
                            CreateNode(xmlDoc, item, "ibetimes", "");
                            CreateNode(xmlDoc, item, "iloadnum", "");
                            CreateNode(xmlDoc, item, "ilockstatus", "");
                            CreateNode(xmlDoc, item, "ionroadtime", "");
                            CreateNode(xmlDoc, item, "ipacking", "");
                            CreateNode(xmlDoc, item, "irownumber", rowno.ToString());//行号
                            CreateNode(xmlDoc, item, "irowstatus", "0");
                            CreateNode(xmlDoc, item, "ischeckatp", "N");
                            CreateNode(xmlDoc, item, "linkman1", "");
                            CreateNode(xmlDoc, item, "nassistnetwgt", num);
                            CreateNode(xmlDoc, item, "nfeedbacknum", wgt);   //回写上游数量
                            CreateNode(xmlDoc, item, "nnetwgt", wgt);        //净重
                            CreateNode(xmlDoc, item, "nquoteunitnum", wgt);  //报价计量单位数量?-存货数量
                            CreateNode(xmlDoc, item, "nquoteunitrate", "1"); //报价计量单位换算率固定
                            CreateNode(xmlDoc, item, "ntotalshouldoutnum", "");
                            CreateNode(xmlDoc, item, "orderplantime", "");
                            CreateNode(xmlDoc, item, "packsortcode", "");
                            CreateNode(xmlDoc, item, "packsortname", "");
                            CreateNode(xmlDoc, item, "phone1", "");//****?
                            CreateNode(xmlDoc, item, "pk_corp", "");
                            CreateNode(xmlDoc, item, "pk_defdoc0", "");
                            CreateNode(xmlDoc, item, "pk_defdoc1", "");
                            CreateNode(xmlDoc, item, "pk_defdoc10", "");
                            CreateNode(xmlDoc, item, "pk_defdoc11", "");
                            CreateNode(xmlDoc, item, "pk_defdoc12", "");
                            CreateNode(xmlDoc, item, "pk_defdoc13", "");
                            CreateNode(xmlDoc, item, "pk_defdoc14", "");
                            CreateNode(xmlDoc, item, "pk_defdoc15", "");
                            CreateNode(xmlDoc, item, "pk_defdoc16", "");
                            CreateNode(xmlDoc, item, "pk_defdoc17", "");
                            CreateNode(xmlDoc, item, "pk_defdoc18", "");
                            CreateNode(xmlDoc, item, "pk_defdoc19", "");
                            CreateNode(xmlDoc, item, "pk_defdoc2", "");
                            CreateNode(xmlDoc, item, "pk_defdoc3", "");
                            CreateNode(xmlDoc, item, "pk_defdoc4", "");
                            CreateNode(xmlDoc, item, "pk_defdoc5", "");
                            CreateNode(xmlDoc, item, "pk_defdoc6", "");
                            CreateNode(xmlDoc, item, "pk_defdoc7", "");
                            CreateNode(xmlDoc, item, "pk_defdoc8", "");
                            CreateNode(xmlDoc, item, "pk_defdoc9", "");
                            CreateNode(xmlDoc, item, "pk_delivbill_b", "");                   //置空
                            CreateNode(xmlDoc, item, "pk_delivbill_h", "");
                            CreateNode(xmlDoc, item, "pk_invbasdoc", modOrder.C_INVBASDOCID); //存货档案主键
                            CreateNode(xmlDoc, item, "pk_packsort", "");
                            CreateNode(xmlDoc, item, "pk_transcontainer", "");
                            CreateNode(xmlDoc, item, "pkarriveaddress", addrpk);              //到货地点
                            CreateNode(xmlDoc, item, "pkarrivearea", modfyditem.C_SEND_AREA); //到货地区主键
                            CreateNode(xmlDoc, item, "pkarrivecorp", "");
                            CreateNode(xmlDoc, item, "pkassistmeasure", modOrder.C_FUNITID);  //辅计量单位
                            CreateNode(xmlDoc, item, "pkbasinv", modOrder.C_INVBASDOCID);     //存货档案主键
                            CreateNode(xmlDoc, item, "pkbasreceiptcorp", modCust.C_NC_ID);    //客户主键
                            CreateNode(xmlDoc, item, "pkbassendcorp", "");
                            CreateNode(xmlDoc, item, "pkconsign", "");
                            CreateNode(xmlDoc, item, "pkcorpforgenoid", modDayPlan.C_PKSALECORP); //销售公司(1001)
                            CreateNode(xmlDoc, item, "pkcusbasdoc", modCust.C_NC_ID);             //客户主键
                            CreateNode(xmlDoc, item, "pkcusmandoc", modDayPlan.C_PKCUST);         //客户管理主键
                            CreateNode(xmlDoc, item, "pkcustinvoice", "");
                            CreateNode(xmlDoc, item, "pkdayplan", "");
                            CreateNode(xmlDoc, item, "pkdestrep", "");
                            CreateNode(xmlDoc, item, "pkdeststockorg", "");
                            CreateNode(xmlDoc, item, "pkinv", modOrder.C_INVENTORYID);//存货管理档案主键
                            CreateNode(xmlDoc, item, "pkinvoice", "");
                            CreateNode(xmlDoc, item, "pkitem", "");
                            CreateNode(xmlDoc, item, "pkitemperiod", "");
                            CreateNode(xmlDoc, item, "pkoperator", modDayPlan.C_PKOPERATOR);   //业务员ID
                            CreateNode(xmlDoc, item, "pkoprdepart", modDayPlan.C_PKOPRDEPART); //业务员部门
                            CreateNode(xmlDoc, item, "pkorder", "");
                            CreateNode(xmlDoc, item, "pkorderplanid", "");
                            CreateNode(xmlDoc, item, "pkorderrow", "");
                            CreateNode(xmlDoc, item, "pkpackboxtype", "");
                            CreateNode(xmlDoc, item, "pksalecorp", "1001");
                            CreateNode(xmlDoc, item, "pksalegrp", modDayPlan.C_PKSALEORG);     //销售组织主键
                            CreateNode(xmlDoc, item, "pksendaddress", "0001AA1000000002LFNT"); //发货地点
                            CreateNode(xmlDoc, item, "pksendarea", "dqda0000000000000057");    //发货地区
                            if (mbck != null)
                            {
                                CreateNode(xmlDoc, item, "pksendstock", mbck.C_ID);//发货仓库
                            }
                            else
                            {
                                CreateNode(xmlDoc, item, "pksendstock", slabwh.C_ID);           //发货仓库
                            }
                            CreateNode(xmlDoc, item, "pksendstockorg", "1001NC10000000000669"); //发货库存组织主键-固定
                            CreateNode(xmlDoc, item, "pksrccalbodyar", "");
                            CreateNode(xmlDoc, item, "pkunit", "");
                            CreateNode(xmlDoc, item, "plantime", "");
                            CreateNode(xmlDoc, item, "receivedate", "");
                            CreateNode(xmlDoc, item, "requireday", Convert.ToDateTime(modDayPlan.D_REQUIREDATE).ToString("yyy-MM-dd")); //要求到货日期
                            CreateNode(xmlDoc, item, "sourcebillts", "");
                            CreateNode(xmlDoc, item, "ts", "");                                                                         //HH:mm:ss
                            CreateNode(xmlDoc, item, "ufdtmp", "");
                            CreateNode(xmlDoc, item, "userid", "");
                            CreateNode(xmlDoc, item, "varriveaddress", "其他地区");
                            CreateNode(xmlDoc, item, "vassistmeaname", "");
                            string batch = "";
                            if (modMat.C_MAT_TYPE == "6")
                            {
                                if (dt.Rows[i]["C_BATCH_NO"].ToString() != "")
                                {
                                    batch = dt.Rows[i]["C_BATCH_NO"].ToString();
                                }
                                else
                                {
                                    batch = dt.Rows[i]["C_STOVE"].ToString();
                                }
                            }
                            if (modMat.C_MAT_TYPE == "8")
                            {
                                batch = dt.Rows[i]["C_BATCH_NO"].ToString();
                            }
                            CreateNode(xmlDoc, item, "vbatchcode", batch);
                            CreateNode(xmlDoc, item, "vbilltype", "30");
                            CreateNode(xmlDoc, item, "vbilltypename", "");
                            CreateNode(xmlDoc, item, "vcargcode", "");
                            CreateNode(xmlDoc, item, "vconsign", "");
                            CreateNode(xmlDoc, item, "vcontainername", "");
                            CreateNode(xmlDoc, item, "vcustcode", modCust.C_NO);           //客户编码
                            CreateNode(xmlDoc, item, "vcustname", modCust.C_NAME);         //客户名称
                            CreateNode(xmlDoc, item, "vdayplancode", modDayPlan.C_PLCODE); //对应日计划单据号
                            CreateNode(xmlDoc, item, "vdestaddress", modfyditem.C_AREA);   //收货地址
                            CreateNode(xmlDoc, item, "vdestarea", modfyditem.C_SEND_AREA); //收货地区
                            CreateNode(xmlDoc, item, "vdeststoreaddre", "");
                            CreateNode(xmlDoc, item, "vdeststorename", "");
                            CreateNode(xmlDoc, item, "vdeststoreorgname", "");
                            CreateNode(xmlDoc, item, "vfree0", "");
                            CreateNode(xmlDoc, item, "vfree1", modDayPlan.C_VFREE1);                 //自由项1
                            CreateNode(xmlDoc, item, "vfree10", dt.Rows[i]["C_PK_NCID"].ToString()); //CRM发运单表体主键//C_PK_NCID
                            CreateNode(xmlDoc, item, "vfree2", modDayPlan.C_VFREE2);                 //自由项2
                            CreateNode(xmlDoc, item, "vfree3", dt.Rows[i]["C_BZYQ"].ToString());     //包装钢坯传空
                            CreateNode(xmlDoc, item, "vfree4", "");
                            CreateNode(xmlDoc, item, "vfree5", "");
                            CreateNode(xmlDoc, item, "vfree6", "");
                            CreateNode(xmlDoc, item, "vfree7", "");
                            CreateNode(xmlDoc, item, "vfree8", modDayPlan.C_ID);    //CRM发运日计划主键
                            CreateNode(xmlDoc, item, "vfree9", modDispatch.C_GUID); // CRM发运单表头主键
                            CreateNode(xmlDoc, item, "vfreeid1", "");
                            CreateNode(xmlDoc, item, "vfreeid10", "");
                            CreateNode(xmlDoc, item, "vfreeid2", "");
                            CreateNode(xmlDoc, item, "vfreeid3", "");
                            CreateNode(xmlDoc, item, "vfreeid4", "");
                            CreateNode(xmlDoc, item, "vfreeid5", "");
                            CreateNode(xmlDoc, item, "vfreeid6", "");
                            CreateNode(xmlDoc, item, "vfreeid7", "");
                            CreateNode(xmlDoc, item, "vfreeid8", "");
                            CreateNode(xmlDoc, item, "vfreeid9", "");
                            CreateNode(xmlDoc, item, "vfreename1", "");
                            CreateNode(xmlDoc, item, "vfreename10", "");
                            CreateNode(xmlDoc, item, "vfreename2", "");
                            CreateNode(xmlDoc, item, "vfreename3", "");
                            CreateNode(xmlDoc, item, "vfreename4", "");
                            CreateNode(xmlDoc, item, "vfreename5", "");
                            CreateNode(xmlDoc, item, "vfreename6", "");
                            CreateNode(xmlDoc, item, "vfreename7", "");
                            CreateNode(xmlDoc, item, "vfreename8", "");
                            CreateNode(xmlDoc, item, "vfreename9", "");
                            CreateNode(xmlDoc, item, "vinvcode", modMat.C_MAT_CODE);
                            CreateNode(xmlDoc, item, "vinvname", "");
                            CreateNode(xmlDoc, item, "vinvoicecode", "");
                            CreateNode(xmlDoc, item, "vitemname", "");
                            CreateNode(xmlDoc, item, "vitemperiodname", "");
                            CreateNode(xmlDoc, item, "vnote", "");
                            CreateNode(xmlDoc, item, "voperatorname", "");
                            CreateNode(xmlDoc, item, "voprdepartname", "");
                            CreateNode(xmlDoc, item, "vordercode", modDayPlan.C_SALECODE);//销售单据号
                            CreateNode(xmlDoc, item, "vreceiptcorpname", "");
                            CreateNode(xmlDoc, item, "vsalecorpname", "");
                            CreateNode(xmlDoc, item, "vsaleorgname", "");
                            CreateNode(xmlDoc, item, "vsendaddr", "");
                            CreateNode(xmlDoc, item, "vsendaddress", "");
                            CreateNode(xmlDoc, item, "vsendarea", "");
                            CreateNode(xmlDoc, item, "vsendcorpname", "");
                            CreateNode(xmlDoc, item, "vsendstoreaddre", "");
                            CreateNode(xmlDoc, item, "vsendstorename", "");
                            CreateNode(xmlDoc, item, "vsendstoreorgaddre", "");
                            CreateNode(xmlDoc, item, "vsendstoreorgname", "");
                            CreateNode(xmlDoc, item, "vsignname", "");
                            CreateNode(xmlDoc, item, "vsignnote", "");
                            CreateNode(xmlDoc, item, "vspec", modMat.C_SPEC);           //规格
                            CreateNode(xmlDoc, item, "vsrccalbodyarname", "");
                            CreateNode(xmlDoc, item, "vtype", modMat.C_STL_GRD);        //钢种
                            CreateNode(xmlDoc, item, "vunit", modMat.C_ZJLDWMC);        //主计量单位名称
                            CreateNode(xmlDoc, item, "vuserdef0", "");
                            CreateNode(xmlDoc, item, "vuserdef1", "");                  //计量毛重日期*****
                            CreateNode(xmlDoc, item, "vuserdef10", modDayPlan.C_CONNO); //合同号
                            CreateNode(xmlDoc, item, "vuserdef11", "");
                            CreateNode(xmlDoc, item, "vuserdef12", "");
                            CreateNode(xmlDoc, item, "vuserdef13", "");
                            CreateNode(xmlDoc, item, "vuserdef14", "");
                            CreateNode(xmlDoc, item, "vuserdef15", "");
                            CreateNode(xmlDoc, item, "vuserdef16", "");
                            CreateNode(xmlDoc, item, "vuserdef17", "");
                            CreateNode(xmlDoc, item, "vuserdef18", "");
                            CreateNode(xmlDoc, item, "vuserdef19", "");
                            CreateNode(xmlDoc, item, "vuserdef2", ""); //毛重*****
                            CreateNode(xmlDoc, item, "vuserdef3", ""); //计量皮重日期****
                            CreateNode(xmlDoc, item, "vuserdef4", ""); //皮重
                            CreateNode(xmlDoc, item, "vuserdef5", ""); //净重
                            CreateNode(xmlDoc, item, "vuserdef6", ""); //计量毛重时间
                            CreateNode(xmlDoc, item, "vuserdef7", ""); //计量皮重时间
                            CreateNode(xmlDoc, item, "vuserdef8", "");
                            CreateNode(xmlDoc, item, "vuserdef9", "");
                            #endregion

                            body.AppendChild(item);
                        }
                    }
                }
                xmlDoc.Save(xmlFileName);
                List <string> parem = dalSendNC.SendXML(xmlFileName);
                if (parem[0] == "1")
                {
                    return("1");
                }
                else
                {
                    return(parem[1]);
                }
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
Example #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TMP_DAYPLAN DataRowToModel(DataRow row)
        {
            Mod_TMP_DAYPLAN model = new Mod_TMP_DAYPLAN();

            if (row != null)
            {
                if (row["C_ID"] != null)
                {
                    model.C_ID = row["C_ID"].ToString();
                }
                if (row["C_PLCODE"] != null)
                {
                    model.C_PLCODE = row["C_PLCODE"].ToString();
                }
                if (row["C_PKBILLB"] != null)
                {
                    model.C_PKBILLB = row["C_PKBILLB"].ToString();
                }
                if (row["C_PKBILLH"] != null)
                {
                    model.C_PKBILLH = row["C_PKBILLH"].ToString();
                }
                if (row["C_CONNO"] != null)
                {
                    model.C_CONNO = row["C_CONNO"].ToString();
                }
                if (row["C_ORDERNO"] != null)
                {
                    model.C_ORDERNO = row["C_ORDERNO"].ToString();
                }
                if (row["C_PKINV"] != null)
                {
                    model.C_PKINV = row["C_PKINV"].ToString();
                }
                if (row["C_PKASSISTMEASURE"] != null)
                {
                    model.C_PKASSISTMEASURE = row["C_PKASSISTMEASURE"].ToString();
                }
                if (row["N_ASSISTNUM"] != null && row["N_ASSISTNUM"].ToString() != "")
                {
                    model.N_ASSISTNUM = decimal.Parse(row["N_ASSISTNUM"].ToString());
                }
                if (row["N_NUM"] != null && row["N_NUM"].ToString() != "")
                {
                    model.N_NUM = decimal.Parse(row["N_NUM"].ToString());
                }
                if (row["N_UNITPRICE"] != null && row["N_UNITPRICE"].ToString() != "")
                {
                    model.N_UNITPRICE = decimal.Parse(row["N_UNITPRICE"].ToString());
                }
                if (row["N_MONEY"] != null && row["N_MONEY"].ToString() != "")
                {
                    model.N_MONEY = decimal.Parse(row["N_MONEY"].ToString());
                }
                if (row["D_PLANDATE"] != null && row["D_PLANDATE"].ToString() != "")
                {
                    model.D_PLANDATE = DateTime.Parse(row["D_PLANDATE"].ToString());
                }
                if (row["D_ORDSNDATE"] != null && row["D_ORDSNDATE"].ToString() != "")
                {
                    model.D_ORDSNDATE = DateTime.Parse(row["D_ORDSNDATE"].ToString());
                }
                if (row["D_REQUIREDATE"] != null && row["D_REQUIREDATE"].ToString() != "")
                {
                    model.D_REQUIREDATE = DateTime.Parse(row["D_REQUIREDATE"].ToString());
                }
                if (row["D_SNDDATE"] != null && row["D_SNDDATE"].ToString() != "")
                {
                    model.D_SNDDATE = DateTime.Parse(row["D_SNDDATE"].ToString());
                }
                if (row["C_PKCUST"] != null)
                {
                    model.C_PKCUST = row["C_PKCUST"].ToString();
                }
                if (row["C_PKSENDTYPE"] != null)
                {
                    model.C_PKSENDTYPE = row["C_PKSENDTYPE"].ToString();
                }
                if (row["C_PKSALECORP"] != null)
                {
                    model.C_PKSALECORP = row["C_PKSALECORP"].ToString();
                }
                if (row["C_PKSALEORG"] != null)
                {
                    model.C_PKSALEORG = row["C_PKSALEORG"].ToString();
                }
                if (row["C_PKSENDSTOREORG"] != null)
                {
                    model.C_PKSENDSTOREORG = row["C_PKSENDSTOREORG"].ToString();
                }
                if (row["C_PKOPERATOR"] != null)
                {
                    model.C_PKOPERATOR = row["C_PKOPERATOR"].ToString();
                }
                if (row["C_PKOPRDEPART"] != null)
                {
                    model.C_PKOPRDEPART = row["C_PKOPRDEPART"].ToString();
                }
                if (row["C_PKPLANPERSON"] != null)
                {
                    model.C_PKPLANPERSON = row["C_PKPLANPERSON"].ToString();
                }
                if (row["C_PKAPPRPERSON"] != null)
                {
                    model.C_PKAPPRPERSON = row["C_PKAPPRPERSON"].ToString();
                }
                if (row["D_APPRDATE"] != null && row["D_APPRDATE"].ToString() != "")
                {
                    model.D_APPRDATE = DateTime.Parse(row["D_APPRDATE"].ToString());
                }
                if (row["C_PKARRIVEAREA"] != null)
                {
                    model.C_PKARRIVEAREA = row["C_PKARRIVEAREA"].ToString();
                }
                if (row["C_DESTADDRESS"] != null)
                {
                    model.C_DESTADDRESS = row["C_DESTADDRESS"].ToString();
                }
                if (row["C_RECEIPTCORPID"] != null)
                {
                    model.C_RECEIPTCORPID = row["C_RECEIPTCORPID"].ToString();
                }
                if (row["C_BIZTYPE"] != null)
                {
                    model.C_BIZTYPE = row["C_BIZTYPE"].ToString();
                }
                if (row["C_REMARK"] != null)
                {
                    model.C_REMARK = row["C_REMARK"].ToString();
                }
                if (row["C_PKSENDAREA"] != null)
                {
                    model.C_PKSENDAREA = row["C_PKSENDAREA"].ToString();
                }
                if (row["C_PKDELIVORG"] != null)
                {
                    model.C_PKDELIVORG = row["C_PKDELIVORG"].ToString();
                }
                if (row["C_UNITID"] != null)
                {
                    model.C_UNITID = row["C_UNITID"].ToString();
                }
                if (row["C_VFREE1"] != null)
                {
                    model.C_VFREE1 = row["C_VFREE1"].ToString();
                }
                if (row["C_VFREE2"] != null)
                {
                    model.C_VFREE2 = row["C_VFREE2"].ToString();
                }
                if (row["C_VFREE3"] != null)
                {
                    model.C_VFREE3 = row["C_VFREE3"].ToString();
                }
                if (row["C_VFREE4"] != null)
                {
                    model.C_VFREE4 = row["C_VFREE4"].ToString();
                }
                if (row["C_SALECODE"] != null)
                {
                    model.C_SALECODE = row["C_SALECODE"].ToString();
                }
            }
            return(model);
        }
Example #6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Mod_TMP_DAYPLAN model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TMP_DAYPLAN(");
            strSql.Append("C_ID,C_PLCODE,C_PKBILLB,C_PKBILLH,C_CONNO,C_ORDERNO,C_PKINV,C_PKASSISTMEASURE,N_ASSISTNUM,N_NUM,N_UNITPRICE,N_MONEY,D_PLANDATE,D_ORDSNDATE,D_REQUIREDATE,D_SNDDATE,C_PKCUST,C_PKSENDTYPE,C_PKSALECORP,C_PKSALEORG,C_PKSENDSTOREORG,C_PKOPERATOR,C_PKOPRDEPART,C_PKPLANPERSON,C_PKAPPRPERSON,D_APPRDATE,C_PKARRIVEAREA,C_DESTADDRESS,C_RECEIPTCORPID,C_BIZTYPE,C_REMARK,C_PKSENDAREA,C_PKDELIVORG,C_UNITID,C_VFREE1,C_VFREE2,C_VFREE3,C_VFREE4)");
            strSql.Append(" values (");
            strSql.Append(":C_ID,:C_PLCODE,:C_PKBILLB,:C_PKBILLH,:C_CONNO,:C_ORDERNO,:C_PKINV,:C_PKASSISTMEASURE,:N_ASSISTNUM,:N_NUM,:N_UNITPRICE,:N_MONEY,:D_PLANDATE,:D_ORDSNDATE,:D_REQUIREDATE,:D_SNDDATE,:C_PKCUST,:C_PKSENDTYPE,:C_PKSALECORP,:C_PKSALEORG,:C_PKSENDSTOREORG,:C_PKOPERATOR,:C_PKOPRDEPART,:C_PKPLANPERSON,:C_PKAPPRPERSON,:D_APPRDATE,:C_PKARRIVEAREA,:C_DESTADDRESS,:C_RECEIPTCORPID,:C_BIZTYPE,:C_REMARK,:C_PKSENDAREA,:C_PKDELIVORG,:C_UNITID,:C_VFREE1,:C_VFREE2,:C_VFREE3,:C_VFREE4)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_ID",              OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PLCODE",          OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKBILLB",         OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKBILLH",         OracleDbType.Varchar2, 100),
                new OracleParameter(":C_CONNO",           OracleDbType.Varchar2, 100),
                new OracleParameter(":C_ORDERNO",         OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKINV",           OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKASSISTMEASURE", OracleDbType.Varchar2, 100),
                new OracleParameter(":N_ASSISTNUM",       OracleDbType.Decimal,   15),
                new OracleParameter(":N_NUM",             OracleDbType.Decimal,   15),
                new OracleParameter(":N_UNITPRICE",       OracleDbType.Decimal,   15),
                new OracleParameter(":N_MONEY",           OracleDbType.Decimal,   15),
                new OracleParameter(":D_PLANDATE",        OracleDbType.Date),
                new OracleParameter(":D_ORDSNDATE",       OracleDbType.Date),
                new OracleParameter(":D_REQUIREDATE",     OracleDbType.Date),
                new OracleParameter(":D_SNDDATE",         OracleDbType.Date),
                new OracleParameter(":C_PKCUST",          OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKSENDTYPE",      OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKSALECORP",      OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKSALEORG",       OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKSENDSTOREORG",  OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKOPERATOR",      OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKOPRDEPART",     OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKPLANPERSON",    OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKAPPRPERSON",    OracleDbType.Varchar2, 100),
                new OracleParameter(":D_APPRDATE",        OracleDbType.Date),
                new OracleParameter(":C_PKARRIVEAREA",    OracleDbType.Varchar2, 100),
                new OracleParameter(":C_DESTADDRESS",     OracleDbType.Varchar2, 100),
                new OracleParameter(":C_RECEIPTCORPID",   OracleDbType.Varchar2, 100),
                new OracleParameter(":C_BIZTYPE",         OracleDbType.Varchar2, 100),
                new OracleParameter(":C_REMARK",          OracleDbType.Varchar2, 500),
                new OracleParameter(":C_PKSENDAREA",      OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKDELIVORG",      OracleDbType.Varchar2, 100),
                new OracleParameter(":C_UNITID",          OracleDbType.Varchar2, 100),
                new OracleParameter(":C_VFREE1",          OracleDbType.Varchar2, 200),
                new OracleParameter(":C_VFREE2",          OracleDbType.Varchar2, 200),
                new OracleParameter(":C_VFREE3",          OracleDbType.Varchar2, 200),
                new OracleParameter(":C_VFREE4",          OracleDbType.Varchar2, 200)
            };
            parameters[0].Value  = model.C_ID;
            parameters[1].Value  = model.C_PLCODE;
            parameters[2].Value  = model.C_PKBILLB;
            parameters[3].Value  = model.C_PKBILLH;
            parameters[4].Value  = model.C_CONNO;
            parameters[5].Value  = model.C_ORDERNO;
            parameters[6].Value  = model.C_PKINV;
            parameters[7].Value  = model.C_PKASSISTMEASURE;
            parameters[8].Value  = model.N_ASSISTNUM;
            parameters[9].Value  = model.N_NUM;
            parameters[10].Value = model.N_UNITPRICE;
            parameters[11].Value = model.N_MONEY;
            parameters[12].Value = model.D_PLANDATE;
            parameters[13].Value = model.D_ORDSNDATE;
            parameters[14].Value = model.D_REQUIREDATE;
            parameters[15].Value = model.D_SNDDATE;
            parameters[16].Value = model.C_PKCUST;
            parameters[17].Value = model.C_PKSENDTYPE;
            parameters[18].Value = model.C_PKSALECORP;
            parameters[19].Value = model.C_PKSALEORG;
            parameters[20].Value = model.C_PKSENDSTOREORG;
            parameters[21].Value = model.C_PKOPERATOR;
            parameters[22].Value = model.C_PKOPRDEPART;
            parameters[23].Value = model.C_PKPLANPERSON;
            parameters[24].Value = model.C_PKAPPRPERSON;
            parameters[25].Value = model.D_APPRDATE;
            parameters[26].Value = model.C_PKARRIVEAREA;
            parameters[27].Value = model.C_DESTADDRESS;
            parameters[28].Value = model.C_RECEIPTCORPID;
            parameters[29].Value = model.C_BIZTYPE;
            parameters[30].Value = model.C_REMARK;
            parameters[31].Value = model.C_PKSENDAREA;
            parameters[32].Value = model.C_PKDELIVORG;
            parameters[33].Value = model.C_UNITID;
            parameters[34].Value = model.C_VFREE1;
            parameters[35].Value = model.C_VFREE2;
            parameters[36].Value = model.C_VFREE3;
            parameters[37].Value = model.C_VFREE4;

            int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #7
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Mod_TMP_DAYPLAN model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TMP_DAYPLAN set ");
            strSql.Append("C_PLCODE=:C_PLCODE,");
            strSql.Append("C_PKBILLB=:C_PKBILLB,");
            strSql.Append("C_PKBILLH=:C_PKBILLH,");
            strSql.Append("C_CONNO=:C_CONNO,");
            strSql.Append("C_ORDERNO=:C_ORDERNO,");
            strSql.Append("C_PKINV=:C_PKINV,");
            strSql.Append("C_PKASSISTMEASURE=:C_PKASSISTMEASURE,");
            strSql.Append("N_ASSISTNUM=:N_ASSISTNUM,");
            strSql.Append("N_NUM=:N_NUM,");
            strSql.Append("N_UNITPRICE=:N_UNITPRICE,");
            strSql.Append("N_MONEY=:N_MONEY,");
            strSql.Append("D_PLANDATE=:D_PLANDATE,");
            strSql.Append("D_ORDSNDATE=:D_ORDSNDATE,");
            strSql.Append("D_REQUIREDATE=:D_REQUIREDATE,");
            strSql.Append("D_SNDDATE=:D_SNDDATE,");
            strSql.Append("C_PKCUST=:C_PKCUST,");
            strSql.Append("C_PKSENDTYPE=:C_PKSENDTYPE,");
            strSql.Append("C_PKSALECORP=:C_PKSALECORP,");
            strSql.Append("C_PKSALEORG=:C_PKSALEORG,");
            strSql.Append("C_PKSENDSTOREORG=:C_PKSENDSTOREORG,");
            strSql.Append("C_PKOPERATOR=:C_PKOPERATOR,");
            strSql.Append("C_PKOPRDEPART=:C_PKOPRDEPART,");
            strSql.Append("C_PKPLANPERSON=:C_PKPLANPERSON,");
            strSql.Append("C_PKAPPRPERSON=:C_PKAPPRPERSON,");
            strSql.Append("D_APPRDATE=:D_APPRDATE,");
            strSql.Append("C_PKARRIVEAREA=:C_PKARRIVEAREA,");
            strSql.Append("C_DESTADDRESS=:C_DESTADDRESS,");
            strSql.Append("C_RECEIPTCORPID=:C_RECEIPTCORPID,");
            strSql.Append("C_BIZTYPE=:C_BIZTYPE,");
            strSql.Append("C_REMARK=:C_REMARK,");
            strSql.Append("C_PKSENDAREA=:C_PKSENDAREA,");
            strSql.Append("C_PKDELIVORG=:C_PKDELIVORG,");
            strSql.Append("C_UNITID=:C_UNITID,");
            strSql.Append("C_VFREE1=:C_VFREE1,");
            strSql.Append("C_VFREE2=:C_VFREE2,");
            strSql.Append("C_VFREE3=:C_VFREE3,");
            strSql.Append("C_VFREE4=:C_VFREE4");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_PLCODE",          OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKBILLB",         OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKBILLH",         OracleDbType.Varchar2, 100),
                new OracleParameter(":C_CONNO",           OracleDbType.Varchar2, 100),
                new OracleParameter(":C_ORDERNO",         OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKINV",           OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKASSISTMEASURE", OracleDbType.Varchar2, 100),
                new OracleParameter(":N_ASSISTNUM",       OracleDbType.Decimal,   15),
                new OracleParameter(":N_NUM",             OracleDbType.Decimal,   15),
                new OracleParameter(":N_UNITPRICE",       OracleDbType.Decimal,   15),
                new OracleParameter(":N_MONEY",           OracleDbType.Decimal,   15),
                new OracleParameter(":D_PLANDATE",        OracleDbType.Date),
                new OracleParameter(":D_ORDSNDATE",       OracleDbType.Date),
                new OracleParameter(":D_REQUIREDATE",     OracleDbType.Date),
                new OracleParameter(":D_SNDDATE",         OracleDbType.Date),
                new OracleParameter(":C_PKCUST",          OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKSENDTYPE",      OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKSALECORP",      OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKSALEORG",       OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKSENDSTOREORG",  OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKOPERATOR",      OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKOPRDEPART",     OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKPLANPERSON",    OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKAPPRPERSON",    OracleDbType.Varchar2, 100),
                new OracleParameter(":D_APPRDATE",        OracleDbType.Date),
                new OracleParameter(":C_PKARRIVEAREA",    OracleDbType.Varchar2, 100),
                new OracleParameter(":C_DESTADDRESS",     OracleDbType.Varchar2, 100),
                new OracleParameter(":C_RECEIPTCORPID",   OracleDbType.Varchar2, 100),
                new OracleParameter(":C_BIZTYPE",         OracleDbType.Varchar2, 100),
                new OracleParameter(":C_REMARK",          OracleDbType.Varchar2, 500),
                new OracleParameter(":C_PKSENDAREA",      OracleDbType.Varchar2, 100),
                new OracleParameter(":C_PKDELIVORG",      OracleDbType.Varchar2, 100),
                new OracleParameter(":C_UNITID",          OracleDbType.Varchar2, 100),
                new OracleParameter(":C_VFREE1",          OracleDbType.Varchar2, 200),
                new OracleParameter(":C_VFREE2",          OracleDbType.Varchar2, 200),
                new OracleParameter(":C_VFREE3",          OracleDbType.Varchar2, 200),
                new OracleParameter(":C_VFREE4",          OracleDbType.Varchar2, 200),
                new OracleParameter(":C_ID",              OracleDbType.Varchar2, 100)
            };
            parameters[0].Value  = model.C_PLCODE;
            parameters[1].Value  = model.C_PKBILLB;
            parameters[2].Value  = model.C_PKBILLH;
            parameters[3].Value  = model.C_CONNO;
            parameters[4].Value  = model.C_ORDERNO;
            parameters[5].Value  = model.C_PKINV;
            parameters[6].Value  = model.C_PKASSISTMEASURE;
            parameters[7].Value  = model.N_ASSISTNUM;
            parameters[8].Value  = model.N_NUM;
            parameters[9].Value  = model.N_UNITPRICE;
            parameters[10].Value = model.N_MONEY;
            parameters[11].Value = model.D_PLANDATE;
            parameters[12].Value = model.D_ORDSNDATE;
            parameters[13].Value = model.D_REQUIREDATE;
            parameters[14].Value = model.D_SNDDATE;
            parameters[15].Value = model.C_PKCUST;
            parameters[16].Value = model.C_PKSENDTYPE;
            parameters[17].Value = model.C_PKSALECORP;
            parameters[18].Value = model.C_PKSALEORG;
            parameters[19].Value = model.C_PKSENDSTOREORG;
            parameters[20].Value = model.C_PKOPERATOR;
            parameters[21].Value = model.C_PKOPRDEPART;
            parameters[22].Value = model.C_PKPLANPERSON;
            parameters[23].Value = model.C_PKAPPRPERSON;
            parameters[24].Value = model.D_APPRDATE;
            parameters[25].Value = model.C_PKARRIVEAREA;
            parameters[26].Value = model.C_DESTADDRESS;
            parameters[27].Value = model.C_RECEIPTCORPID;
            parameters[28].Value = model.C_BIZTYPE;
            parameters[29].Value = model.C_REMARK;
            parameters[30].Value = model.C_PKSENDAREA;
            parameters[31].Value = model.C_PKDELIVORG;
            parameters[32].Value = model.C_UNITID;
            parameters[33].Value = model.C_VFREE1;
            parameters[34].Value = model.C_VFREE2;
            parameters[35].Value = model.C_VFREE3;
            parameters[36].Value = model.C_VFREE4;
            parameters[37].Value = model.C_ID;

            int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #8
0
        /// <summary>
        /// 发送实绩给NC
        /// </summary>
        /// <param name="xmlFileName">xml完整路径</param>
        /// <returns></returns>
        public bool SendXml_DM(string xmlFileName, string code)
        {
            try
            {
                Mod_TMD_DISPATCH modDispatch = tmd_dispatch.GetModel(code);
                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", "7F");
                root.SetAttribute("filename", "" + code + ".xml");
                root.SetAttribute("isexchange", "Y");
                root.SetAttribute("operation", "req");
                root.SetAttribute("proc", "update");
                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");
                bill.SetAttribute("id", modDispatch.C_GUID);//发运单表头主键
                root.AppendChild(bill);

                XmlNode head = xmlDoc.CreateNode(XmlNodeType.Element, "bill_head", null);

                #region                                                                                                   //表头_order_head
                CreateNode(xmlDoc, head, "apprdate", Convert.ToDateTime(modDispatch.D_APPROVE_DT).ToString("yyy-MM-dd")); //发运审批日期
                CreateNode(xmlDoc, head, "bconfirm", "N");
                CreateNode(xmlDoc, head, "billdate", Convert.ToDateTime(modDispatch.D_CREATE_DT).ToString("yyy-MM-dd"));  //制单日期
                CreateNode(xmlDoc, head, "billnewaddtime", Convert.ToDateTime(modDispatch.D_CREATE_DT).ToString("yyy-MM-dd HH:mm:ss"));
                CreateNode(xmlDoc, head, "bisopen", "");
                CreateNode(xmlDoc, head, "bmissionbill", "N");
                CreateNode(xmlDoc, head, "bmustreturnbillcode", "");
                CreateNode(xmlDoc, head, "btestbyinvoice", "");
                CreateNode(xmlDoc, head, "clastmodifierid", modDispatch.C_EMP_ID);//最后修改人
                CreateNode(xmlDoc, head, "clastmodiname", "");
                CreateNode(xmlDoc, head, "curbilltype", "");
                CreateNode(xmlDoc, head, "dallpacknum", "0");
                CreateNode(xmlDoc, head, "dallvolumn", "0");
                CreateNode(xmlDoc, head, "dallweight", "0");
                CreateNode(xmlDoc, head, "dfactweight", "");
                CreateNode(xmlDoc, head, "dr", "0");
                CreateNode(xmlDoc, head, "dtotal", "");
                CreateNode(xmlDoc, head, "employee", "");
                CreateNode(xmlDoc, head, "h_confirmarrivedate", "");
                CreateNode(xmlDoc, head, "iprintcount", "");
                CreateNode(xmlDoc, head, "isendtype", "3");//运费类别
                CreateNode(xmlDoc, head, "linkman1", "");
                CreateNode(xmlDoc, head, "oprdepartname", "");
                CreateNode(xmlDoc, head, "phone1", "");
                CreateNode(xmlDoc, head, "pk_defdoc0", modDispatch.C_IS_WIRESALE_ID); //是否线材销售主键
                CreateNode(xmlDoc, head, "pk_defdoc1", "");
                CreateNode(xmlDoc, head, "pk_defdoc10", "");
                CreateNode(xmlDoc, head, "pk_defdoc11", "");
                CreateNode(xmlDoc, head, "pk_defdoc12", "");
                CreateNode(xmlDoc, head, "pk_defdoc13", "");
                CreateNode(xmlDoc, head, "pk_defdoc14", "");
                CreateNode(xmlDoc, head, "pk_defdoc15", "");
                CreateNode(xmlDoc, head, "pk_defdoc16", "");
                CreateNode(xmlDoc, head, "pk_defdoc17", "");
                CreateNode(xmlDoc, head, "pk_defdoc18", "");
                CreateNode(xmlDoc, head, "pk_defdoc19", "");
                CreateNode(xmlDoc, head, "pk_defdoc2", "");
                CreateNode(xmlDoc, head, "pk_defdoc3", "");
                CreateNode(xmlDoc, head, "pk_defdoc4", "");
                CreateNode(xmlDoc, head, "pk_defdoc5", "");
                CreateNode(xmlDoc, head, "pk_defdoc6", "");
                CreateNode(xmlDoc, head, "pk_defdoc7", "");
                CreateNode(xmlDoc, head, "pk_defdoc8", "");
                CreateNode(xmlDoc, head, "pk_defdoc9", "");
                CreateNode(xmlDoc, head, "pk_delivbill_h", "");                       //发运单表头主键modDispatch.C_GUID
                CreateNode(xmlDoc, head, "pkapprperson", "");
                CreateNode(xmlDoc, head, "pkbillperson", modDispatch.C_CREATE_ID);    //制单人
                CreateNode(xmlDoc, head, "pkcorpforgenoid", "1001");                  //公司编码
                CreateNode(xmlDoc, head, "pkdelivmode", modDispatch.C_SHIPVIA);       //发运方式主键
                CreateNode(xmlDoc, head, "pkdelivorg", "1001NC10000000006EHS");       //发运组织主键固定
                CreateNode(xmlDoc, head, "pkdelivroute", "1001NC10000000006EHV");     //发运路线主键 固定
                CreateNode(xmlDoc, head, "pkdriver", "");
                CreateNode(xmlDoc, head, "pkoperator", modDispatch.C_BUSINESS_ID);    //业务员主键
                CreateNode(xmlDoc, head, "pkoprdepart", modDispatch.C_BUSINESS_DEPT); //业务部门主键
                CreateNode(xmlDoc, head, "pksendperson", "");
                CreateNode(xmlDoc, head, "pktrancust", modDispatch.C_COMCAR);         //承运商
                CreateNode(xmlDoc, head, "pktranorg", "");
                CreateNode(xmlDoc, head, "pkvehicle", "");
                CreateNode(xmlDoc, head, "pkvehicletype", "");
                CreateNode(xmlDoc, head, "returndate", "");
                CreateNode(xmlDoc, head, "returntime", "");
                CreateNode(xmlDoc, head, "senddate", Convert.ToDateTime(modDispatch.D_DISP_DT).ToString("yyy-MM-dd"));//发运日期
                CreateNode(xmlDoc, head, "startdate", "");
                CreateNode(xmlDoc, head, "starttime", "");
                CreateNode(xmlDoc, head, "taudittime", "");
                CreateNode(xmlDoc, head, "tlastmodifytime", Convert.ToDateTime(modDispatch.D_MOD_DT).ToString("yyy-MM-dd HH:mm:ss")); //最后修改时间
                CreateNode(xmlDoc, head, "tmaketime", Convert.ToDateTime(modDispatch.D_CREATE_DT).ToString("yyy-MM-dd HH:mm:ss"));    // 制单时间
                CreateNode(xmlDoc, head, "ts", Convert.ToDateTime(modDispatch.D_CREATE_DT).ToString("yyy-MM-dd HH:mm:ss"));
                CreateNode(xmlDoc, head, "userid", modDispatch.C_CREATE_ID);                                                          //制单人
                CreateNode(xmlDoc, head, "vapprpersonname", "");
                CreateNode(xmlDoc, head, "vbillpersonname", "");
                CreateNode(xmlDoc, head, "vdelivbillcode", modDispatch.C_ID);//发运单单据号
                CreateNode(xmlDoc, head, "vdoname", "");
                CreateNode(xmlDoc, head, "vdrivername", "");
                CreateNode(xmlDoc, head, "vehiclelicense", "");
                CreateNode(xmlDoc, head, "vnote", "");
                CreateNode(xmlDoc, head, "voldDelivbillcode", "");
                CreateNode(xmlDoc, head, "vroutedescr", "");
                CreateNode(xmlDoc, head, "vroutename", "");
                CreateNode(xmlDoc, head, "vsendtypename", "");
                CreateNode(xmlDoc, head, "vtranname", "");
                CreateNode(xmlDoc, head, "vtranorgname", "");
                CreateNode(xmlDoc, head, "vuserdef0", modDispatch.C_IS_WIRESALE);// 是否线材销售 是/ 否
                CreateNode(xmlDoc, head, "vuserdef1", "");
                CreateNode(xmlDoc, head, "vuserdef10", "");
                CreateNode(xmlDoc, head, "vuserdef11", "");
                CreateNode(xmlDoc, head, "vuserdef12", "");
                CreateNode(xmlDoc, head, "vuserdef13", "");
                CreateNode(xmlDoc, head, "vuserdef14", "");
                CreateNode(xmlDoc, head, "vuserdef15", "");
                CreateNode(xmlDoc, head, "vuserdef16", "");
                CreateNode(xmlDoc, head, "vuserdef17", "");
                CreateNode(xmlDoc, head, "vuserdef18", "");
                CreateNode(xmlDoc, head, "vuserdef19", "");
                CreateNode(xmlDoc, head, "vuserdef2", "");
                CreateNode(xmlDoc, head, "vuserdef3", "Y");                      //是否已导出
                CreateNode(xmlDoc, head, "vuserdef4", modDispatch.C_LIC_PLA_NO); //车牌号
                CreateNode(xmlDoc, head, "vuserdef5", "");
                CreateNode(xmlDoc, head, "vuserdef6", modDispatch.C_ATSTATION);  //到站
                CreateNode(xmlDoc, head, "vuserdef7", "");
                CreateNode(xmlDoc, head, "vuserdef8", "");
                CreateNode(xmlDoc, head, "vuserdef9", "");
                CreateNode(xmlDoc, head, "vvehiclename", "");
                CreateNode(xmlDoc, head, "vvhcltypename", "");

                #endregion

                bill.AppendChild(head);
                XmlElement body = xmlDoc.CreateElement("bill_body");
                bill.AppendChild(body);

                DataTable dt = tmd_dispatchdetails.GetList(code).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        int rowno = i + 1;

                        Mod_TMP_DAYPLAN modDayPlan = tmp_dayplan.GetModelID(dt.Rows[i]["C_PLAN_ID"].ToString());
                        if (modDayPlan != null)
                        {
                            #region                                                                         //实体参数
                            Mod_TMO_ORDER   modOrder = tmo_order.GetModel(modDayPlan.C_PKBILLB);
                            Mod_TS_CUSTFILE modCust  = ts_custfile.GetCustModel(modDayPlan.C_PKCUST);       //客户档案
                            //Mod_TMB_AREA modArea = tmb_area.GetModel(modDayPlan.C_PKARRIVEAREA);//区域
                            Mod_TB_MATRL_MAIN       modMat = tb_matrl_main.GetMatModel(modDayPlan.C_PKINV); //物料
                            Mod_TMD_DISPATCHDETAILS modFYD = tmd_dispatchdetails.GetModel(dt.Rows[i]["C_ID"].ToString());

                            string pkstock = modFYD.C_SEND_STOCK_PK;//仓库编码

                            string    addrpk    = "";
                            DataTable dtaddress = tmb_area.GetAreaAddress(modFYD.C_SEND_AREA).Tables[0];
                            if (dtaddress.Rows.Count > 0)
                            {
                                addrpk = dtaddress.Rows[0]["PK_ADDRESS"].ToString();
                            }

                            #endregion

                            string NCCHECKID = modFYD.C_QUALIRY_LEV; //质量等级

                            string C_BATCH_NO = string.Empty;        //批号
                            //if (!string.IsNullOrEmpty(dt.Rows[i]["C_BATCH_NO"].ToString()))
                            //{
                            //    C_BATCH_NO = dt.Rows[i]["C_BATCH_NO"].ToString();//批号
                            //}
                            //else
                            //{
                            //    C_BATCH_NO = dt.Rows[i]["C_STOVE"].ToString();//炉号
                            //}

                            decimal dunitprice = Convert.ToDecimal(modDayPlan.N_UNITPRICE); //含税单价
                            decimal N_JZ       = Convert.ToDecimal(modFYD.N_JWGT);          //净重
                            string  wgt        = Convert.ToString(modFYD.N_WGT);            //计划重量
                            string  num        = Convert.ToString(modFYD.N_FYZS);           //件数
                            decimal dmoney     = dunitprice * N_JZ;                         //订单金额


                            XmlNode item = xmlDoc.CreateNode(XmlNodeType.Element, "item", null);

                            #region //表体_item
                            CreateNode(xmlDoc, item, "bappendent", "");
                            CreateNode(xmlDoc, item, "bcloseout", "");
                            CreateNode(xmlDoc, item, "bcloseout_old", "");
                            CreateNode(xmlDoc, item, "blargess", "N");
                            CreateNode(xmlDoc, item, "borderreturn", "N");
                            CreateNode(xmlDoc, item, "breceiveinform", "");
                            CreateNode(xmlDoc, item, "bsigned", "");
                            CreateNode(xmlDoc, item, "btestbyinvoice", "");
                            CreateNode(xmlDoc, item, "carrivecorpname", "");
                            CreateNode(xmlDoc, item, "cbiztype", modDayPlan.C_BIZTYPE); //业务类型
                            CreateNode(xmlDoc, item, "ccheckstate_bid", NCCHECKID);     //实绩质量等级
                            CreateNode(xmlDoc, item, "ccheckstatename", "");
                            CreateNode(xmlDoc, item, "cfreezeid", "");
                            CreateNode(xmlDoc, item, "cinvmanid", "");
                            CreateNode(xmlDoc, item, "confirmarrivedate", "");
                            CreateNode(xmlDoc, item, "cquoteunitid", modDayPlan.C_UNITID);   //报价计量单位ID
                            CreateNode(xmlDoc, item, "cquoteunitname", "");
                            CreateNode(xmlDoc, item, "creceiptcorp", GetCust(modFYD.C_CGC)); //收货单位名称
                            CreateNode(xmlDoc, item, "creceiptcorpid", modFYD.C_CGC);        //收货单位
                            CreateNode(xmlDoc, item, "csendcorp", "");
                            CreateNode(xmlDoc, item, "csendcorpid", "");
                            CreateNode(xmlDoc, item, "dcancelassistnum", "");
                            CreateNode(xmlDoc, item, "dcancelnum", "");
                            CreateNode(xmlDoc, item, "dfee", "");
                            CreateNode(xmlDoc, item, "dfeeitem", "");
                            CreateNode(xmlDoc, item, "dinvassist", num); //辅数量-件数
                            CreateNode(xmlDoc, item, "dinvnum", wgt);    //计划重量
                            CreateNode(xmlDoc, item, "dinvweight", "");
                            CreateNode(xmlDoc, item, "dmileage", "");
                            CreateNode(xmlDoc, item, "dmoney", dmoney.ToString());//订单金额
                            CreateNode(xmlDoc, item, "doutassistnum", "");
                            CreateNode(xmlDoc, item, "doutnum", "");
                            CreateNode(xmlDoc, item, "doutnummargin", "");
                            CreateNode(xmlDoc, item, "dpackboxnum", "");
                            CreateNode(xmlDoc, item, "dpacknum", "");
                            CreateNode(xmlDoc, item, "dpackvolumn", "");
                            CreateNode(xmlDoc, item, "dpackweight", "");
                            CreateNode(xmlDoc, item, "dr", "0");
                            CreateNode(xmlDoc, item, "dreturnassistnum", "");
                            CreateNode(xmlDoc, item, "dreturnnum", "");
                            CreateNode(xmlDoc, item, "dsignasnum", "");
                            CreateNode(xmlDoc, item, "dsignassistnum", "");
                            CreateNode(xmlDoc, item, "dsignnum", "");
                            CreateNode(xmlDoc, item, "dsourcerow", "");
                            CreateNode(xmlDoc, item, "dtotalout", "");
                            CreateNode(xmlDoc, item, "dunitprice", dunitprice.ToString());//含税单价
                            CreateNode(xmlDoc, item, "dvolumn", "");
                            CreateNode(xmlDoc, item, "dwaylossasnum", "");
                            CreateNode(xmlDoc, item, "dwaylossnum", "");
                            CreateNode(xmlDoc, item, "hsl", "");
                            CreateNode(xmlDoc, item, "iattitude", "");
                            CreateNode(xmlDoc, item, "ibatchstatus", "0");
                            CreateNode(xmlDoc, item, "ibetimes", "");
                            CreateNode(xmlDoc, item, "iloadnum", "");
                            CreateNode(xmlDoc, item, "ilockstatus", "");
                            CreateNode(xmlDoc, item, "ionroadtime", "");
                            CreateNode(xmlDoc, item, "ipacking", "");
                            CreateNode(xmlDoc, item, "irownumber", rowno.ToString());//行号
                            CreateNode(xmlDoc, item, "irowstatus", "0");
                            CreateNode(xmlDoc, item, "ischeckatp", "N");
                            CreateNode(xmlDoc, item, "linkman1", "");
                            CreateNode(xmlDoc, item, "nassistnetwgt", num);       //实发辅数量
                            CreateNode(xmlDoc, item, "nfeedbacknum", wgt);        //回写上游数量
                            CreateNode(xmlDoc, item, "nnetwgt", N_JZ.ToString()); //净重
                            CreateNode(xmlDoc, item, "nquoteunitnum", wgt);       //报价计量单位数量?-存货数量
                            CreateNode(xmlDoc, item, "nquoteunitrate", "1");      //报价计量单位换算率固定
                            CreateNode(xmlDoc, item, "ntotalshouldoutnum", "");
                            CreateNode(xmlDoc, item, "orderplantime", "");
                            CreateNode(xmlDoc, item, "packsortcode", "");
                            CreateNode(xmlDoc, item, "packsortname", "");
                            CreateNode(xmlDoc, item, "phone1", "");//****?
                            CreateNode(xmlDoc, item, "pk_corp", "");
                            CreateNode(xmlDoc, item, "pk_defdoc0", "");
                            CreateNode(xmlDoc, item, "pk_defdoc1", "");
                            CreateNode(xmlDoc, item, "pk_defdoc10", "");
                            CreateNode(xmlDoc, item, "pk_defdoc11", "");
                            CreateNode(xmlDoc, item, "pk_defdoc12", "");
                            CreateNode(xmlDoc, item, "pk_defdoc13", "");
                            CreateNode(xmlDoc, item, "pk_defdoc14", "");
                            CreateNode(xmlDoc, item, "pk_defdoc15", "");
                            CreateNode(xmlDoc, item, "pk_defdoc16", "");
                            CreateNode(xmlDoc, item, "pk_defdoc17", "");
                            CreateNode(xmlDoc, item, "pk_defdoc18", "");
                            CreateNode(xmlDoc, item, "pk_defdoc19", "");
                            CreateNode(xmlDoc, item, "pk_defdoc2", "");
                            CreateNode(xmlDoc, item, "pk_defdoc3", "");
                            CreateNode(xmlDoc, item, "pk_defdoc4", "");
                            CreateNode(xmlDoc, item, "pk_defdoc5", "");
                            CreateNode(xmlDoc, item, "pk_defdoc6", "");
                            CreateNode(xmlDoc, item, "pk_defdoc7", "");
                            CreateNode(xmlDoc, item, "pk_defdoc8", "");
                            CreateNode(xmlDoc, item, "pk_defdoc9", "");
                            CreateNode(xmlDoc, item, "pk_delivbill_b", "");                   //置空
                            CreateNode(xmlDoc, item, "pk_delivbill_h", "");
                            CreateNode(xmlDoc, item, "pk_invbasdoc", modOrder.C_INVBASDOCID); //存货档案主键
                            CreateNode(xmlDoc, item, "pk_packsort", "");
                            CreateNode(xmlDoc, item, "pk_transcontainer", "");
                            CreateNode(xmlDoc, item, "pkarriveaddress", addrpk);             //到货地点
                            CreateNode(xmlDoc, item, "pkarrivearea", modFYD.C_SEND_AREA);    //到货地区主键
                            CreateNode(xmlDoc, item, "pkarrivecorp", "");
                            CreateNode(xmlDoc, item, "pkassistmeasure", modOrder.C_FUNITID); //辅计量单位
                            CreateNode(xmlDoc, item, "pkbasinv", modOrder.C_INVBASDOCID);    //存货档案主键
                            CreateNode(xmlDoc, item, "pkbasreceiptcorp", modCust.C_NC_ID);   //客户主键
                            CreateNode(xmlDoc, item, "pkbassendcorp", "");
                            CreateNode(xmlDoc, item, "pkconsign", "");
                            CreateNode(xmlDoc, item, "pkcorpforgenoid", modDayPlan.C_PKSALECORP); //销售公司(1001)
                            CreateNode(xmlDoc, item, "pkcusbasdoc", modCust.C_NC_ID);             //客户主键
                            CreateNode(xmlDoc, item, "pkcusmandoc", modDayPlan.C_PKCUST);         //客户管理主键
                            CreateNode(xmlDoc, item, "pkcustinvoice", "");
                            CreateNode(xmlDoc, item, "pkdayplan", "");
                            CreateNode(xmlDoc, item, "pkdestrep", "");
                            CreateNode(xmlDoc, item, "pkdeststockorg", "");
                            CreateNode(xmlDoc, item, "pkinv", modOrder.C_INVENTORYID);//存货管理档案主键
                            CreateNode(xmlDoc, item, "pkinvoice", "");
                            CreateNode(xmlDoc, item, "pkitem", "");
                            CreateNode(xmlDoc, item, "pkitemperiod", "");
                            CreateNode(xmlDoc, item, "pkoperator", modDayPlan.C_PKOPERATOR);   //业务员ID
                            CreateNode(xmlDoc, item, "pkoprdepart", modDayPlan.C_PKOPRDEPART); //业务员部门
                            CreateNode(xmlDoc, item, "pkorder", "");
                            CreateNode(xmlDoc, item, "pkorderplanid", "");
                            CreateNode(xmlDoc, item, "pkorderrow", "");
                            CreateNode(xmlDoc, item, "pkpackboxtype", "");
                            CreateNode(xmlDoc, item, "pksalecorp", "1001");
                            CreateNode(xmlDoc, item, "pksalegrp", modDayPlan.C_PKSALEORG);      //销售组织主键
                            CreateNode(xmlDoc, item, "pksendaddress", "0001AA1000000002LFNT");  //发货地点
                            CreateNode(xmlDoc, item, "pksendarea", "dqda0000000000000057");     //发货地区
                            CreateNode(xmlDoc, item, "pksendstock", pkstock);                   //仓库
                            CreateNode(xmlDoc, item, "pksendstockorg", "1001NC10000000000669"); //发货库存组织主键-固定
                            CreateNode(xmlDoc, item, "pksrccalbodyar", "");
                            CreateNode(xmlDoc, item, "pkunit", "");
                            CreateNode(xmlDoc, item, "plantime", "");
                            CreateNode(xmlDoc, item, "receivedate", "");
                            CreateNode(xmlDoc, item, "requireday", Convert.ToDateTime(modDayPlan.D_REQUIREDATE).ToString("yyy-MM-dd")); //要求到货日期
                            CreateNode(xmlDoc, item, "sourcebillts", "");
                            CreateNode(xmlDoc, item, "ts", "");                                                                         //HH:mm:ss
                            CreateNode(xmlDoc, item, "ufdtmp", "");
                            CreateNode(xmlDoc, item, "userid", "");
                            CreateNode(xmlDoc, item, "varriveaddress", "其他地区");
                            CreateNode(xmlDoc, item, "vassistmeaname", "");
                            CreateNode(xmlDoc, item, "vbatchcode", C_BATCH_NO);//批号
                            CreateNode(xmlDoc, item, "vbilltype", "30");
                            CreateNode(xmlDoc, item, "vbilltypename", "");
                            CreateNode(xmlDoc, item, "vcargcode", "");
                            CreateNode(xmlDoc, item, "vconsign", "");
                            CreateNode(xmlDoc, item, "vcontainername", "");
                            CreateNode(xmlDoc, item, "vcustcode", modCust.C_NO);           //客户编码
                            CreateNode(xmlDoc, item, "vcustname", modCust.C_NAME);         //客户名称
                            CreateNode(xmlDoc, item, "vdayplancode", modDayPlan.C_PLCODE); //对应日计划单据号
                            CreateNode(xmlDoc, item, "vdestaddress", modFYD.C_AREA);       //收货地址
                            CreateNode(xmlDoc, item, "vdestarea", modFYD.C_SEND_AREA);     //收货地区
                            CreateNode(xmlDoc, item, "vdeststoreaddre", "");
                            CreateNode(xmlDoc, item, "vdeststorename", "");
                            CreateNode(xmlDoc, item, "vdeststoreorgname", "");
                            CreateNode(xmlDoc, item, "vfree0", "");
                            CreateNode(xmlDoc, item, "vfree1", modDayPlan.C_VFREE1); //自由项1
                            CreateNode(xmlDoc, item, "vfree10", modFYD.C_ID);        //CRM发运单表体主键//C_PK_NCID
                            CreateNode(xmlDoc, item, "vfree2", modDayPlan.C_VFREE2); //自由项2
                            CreateNode(xmlDoc, item, "vfree3", "");                  //包装
                            CreateNode(xmlDoc, item, "vfree4", "");
                            CreateNode(xmlDoc, item, "vfree5", "");
                            CreateNode(xmlDoc, item, "vfree6", "");
                            CreateNode(xmlDoc, item, "vfree7", "");
                            CreateNode(xmlDoc, item, "vfree8", modDayPlan.C_ID);    //CRM发运日计划主键
                            CreateNode(xmlDoc, item, "vfree9", modDispatch.C_GUID); // CRM发运单表头主键
                            CreateNode(xmlDoc, item, "vfreeid1", "");
                            CreateNode(xmlDoc, item, "vfreeid10", "");
                            CreateNode(xmlDoc, item, "vfreeid2", "");
                            CreateNode(xmlDoc, item, "vfreeid3", "");
                            CreateNode(xmlDoc, item, "vfreeid4", "");
                            CreateNode(xmlDoc, item, "vfreeid5", "");
                            CreateNode(xmlDoc, item, "vfreeid6", "");
                            CreateNode(xmlDoc, item, "vfreeid7", "");
                            CreateNode(xmlDoc, item, "vfreeid8", "");
                            CreateNode(xmlDoc, item, "vfreeid9", "");
                            CreateNode(xmlDoc, item, "vfreename1", "");
                            CreateNode(xmlDoc, item, "vfreename10", "");
                            CreateNode(xmlDoc, item, "vfreename2", "");
                            CreateNode(xmlDoc, item, "vfreename3", "");
                            CreateNode(xmlDoc, item, "vfreename4", "");
                            CreateNode(xmlDoc, item, "vfreename5", "");
                            CreateNode(xmlDoc, item, "vfreename6", "");
                            CreateNode(xmlDoc, item, "vfreename7", "");
                            CreateNode(xmlDoc, item, "vfreename8", "");
                            CreateNode(xmlDoc, item, "vfreename9", "");
                            CreateNode(xmlDoc, item, "vinvcode", "");
                            CreateNode(xmlDoc, item, "vinvname", "");
                            CreateNode(xmlDoc, item, "vinvoicecode", "");
                            CreateNode(xmlDoc, item, "vitemname", "");
                            CreateNode(xmlDoc, item, "vitemperiodname", "");
                            CreateNode(xmlDoc, item, "vnote", "");
                            CreateNode(xmlDoc, item, "voperatorname", "");
                            CreateNode(xmlDoc, item, "voprdepartname", "");
                            CreateNode(xmlDoc, item, "vordercode", modDayPlan.C_SALECODE);//销售单据号
                            CreateNode(xmlDoc, item, "vreceiptcorpname", "");
                            CreateNode(xmlDoc, item, "vsalecorpname", "");
                            CreateNode(xmlDoc, item, "vsaleorgname", "");
                            CreateNode(xmlDoc, item, "vsendaddr", "");
                            CreateNode(xmlDoc, item, "vsendaddress", "");
                            CreateNode(xmlDoc, item, "vsendarea", "");
                            CreateNode(xmlDoc, item, "vsendcorpname", "");
                            CreateNode(xmlDoc, item, "vsendstoreaddre", "");
                            CreateNode(xmlDoc, item, "vsendstorename", "");
                            CreateNode(xmlDoc, item, "vsendstoreorgaddre", "");
                            CreateNode(xmlDoc, item, "vsendstoreorgname", "");
                            CreateNode(xmlDoc, item, "vsignname", "");
                            CreateNode(xmlDoc, item, "vsignnote", "");
                            CreateNode(xmlDoc, item, "vspec", modMat.C_SPEC);           //规格
                            CreateNode(xmlDoc, item, "vsrccalbodyarname", "");
                            CreateNode(xmlDoc, item, "vtype", modMat.C_STL_GRD);        //钢种
                            CreateNode(xmlDoc, item, "vunit", modMat.C_ZJLDWMC);        //主计量单位名称
                            CreateNode(xmlDoc, item, "vuserdef0", "");
                            CreateNode(xmlDoc, item, "vuserdef1", modFYD.C_MZDATE);     //计量毛重日期*****
                            CreateNode(xmlDoc, item, "vuserdef10", modDayPlan.C_CONNO); //合同号
                            CreateNode(xmlDoc, item, "vuserdef11", "");
                            CreateNode(xmlDoc, item, "vuserdef12", "");
                            CreateNode(xmlDoc, item, "vuserdef13", "");
                            CreateNode(xmlDoc, item, "vuserdef14", "");
                            CreateNode(xmlDoc, item, "vuserdef15", "");
                            CreateNode(xmlDoc, item, "vuserdef16", "");
                            CreateNode(xmlDoc, item, "vuserdef17", "");
                            CreateNode(xmlDoc, item, "vuserdef18", "");
                            CreateNode(xmlDoc, item, "vuserdef19", "");
                            CreateNode(xmlDoc, item, "vuserdef2", Convert.ToString(modFYD.N_MWGT));   //毛重*****
                            CreateNode(xmlDoc, item, "vuserdef3", Convert.ToString(modFYD.C_PZDATE)); //计量皮重日期****
                            CreateNode(xmlDoc, item, "vuserdef4", Convert.ToString(modFYD.N_PWGT));   //皮重
                            CreateNode(xmlDoc, item, "vuserdef5", Convert.ToString(modFYD.N_JWGT));   // 净重
                            CreateNode(xmlDoc, item, "vuserdef6", Convert.ToString(modFYD.N_MZTIME)); //计量毛重时间
                            CreateNode(xmlDoc, item, "vuserdef7", Convert.ToString(modFYD.N_PZTIME)); //计量皮重时间
                            CreateNode(xmlDoc, item, "vuserdef8", "");
                            CreateNode(xmlDoc, item, "vuserdef9", "");
                            #endregion

                            body.AppendChild(item);
                        }
                    }
                }
                xmlDoc.Save(xmlFileName);
                List <string> parem = NCSendXml.SendXML(xmlDoc);
                if (parem[0] == "1")
                {
                    //更新发运单状态
                    tmd_dispatchdetails.UpdateFydStatus(code, 9);

                    #region //添加日志
                    try
                    {
                        Bll_TMB_INTERFACE_LOG tmb_interface_log = new Bll_TMB_INTERFACE_LOG();
                        Mod_TMB_INTERFACE_LOG mod = new Mod_TMB_INTERFACE_LOG();

                        mod.D_SENDTIME   = DateTime.Now;
                        mod.C_RESULTCODE = parem[0];     //返回结果
                        mod.C_RESULTDESC = parem[1];     //返回结果描述
                        mod.C_CONTENT    = parem[2];     //返回成功或空
                        mod.C_PKID       = code;         //主键
                        mod.C_FLAG       = "WL-NC";      //标识
                        mod.C_REMARK     = "物流实绩导入NC成功"; //备注
                        tmb_interface_log.Add(mod);
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }
                    #endregion

                    return(true);
                }
                else
                {
                    #region //添加日志
                    try
                    {
                        Bll_TMB_INTERFACE_LOG tmb_interface_log = new Bll_TMB_INTERFACE_LOG();
                        Mod_TMB_INTERFACE_LOG mod = new Mod_TMB_INTERFACE_LOG();

                        mod.D_SENDTIME   = DateTime.Now;
                        mod.C_RESULTCODE = parem[0];     //返回结果
                        mod.C_RESULTDESC = parem[1];     //返回结果描述
                        mod.C_CONTENT    = parem[2];     //返回成功或空
                        mod.C_PKID       = code;         //主键
                        mod.C_FLAG       = "WL-NC";      //标识
                        mod.C_REMARK     = "物流实绩导入NC失败"; //备注
                        tmb_interface_log.Add(mod);
                    }
                    catch (Exception e)
                    {
                        throw e;
                    }
                    #endregion

                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #9
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Mod_TMP_DAYPLAN model)
 {
     return(dal.Update(model));
 }
Example #10
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Mod_TMP_DAYPLAN model)
 {
     return(dal.Add(model));
 }
Example #11
0
        /// <summary>
        /// NC发运单
        /// </summary>
        /// <param name="code">发运单单据号</param>
        /// <param name="xmlFileName">路径/文件.xml</param>
        /// <param name="empID">操作ID</param>
        /// <param name="flag">8线材,6钢坯</param>
        /// <returns></returns>
        public List <string> SendXmlApiDispatchOrder(string code, string xmlFileName, string empID, int flag)
        {
            try
            {
                List <apiPkDto> listPk = new List <apiPkDto>();

                Mod_TMD_DISPATCH modDispatch = tmd_dispatch.GetModel(code);

                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", "7F");
                root.SetAttribute("filename", "" + code + ".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");
                bill.SetAttribute("id", modDispatch.C_GUID);//发运单表头主键
                root.AppendChild(bill);

                XmlNode head = xmlDoc.CreateNode(XmlNodeType.Element, "bill_head", null);

                #region                                                                                                   //表头_order_head
                CreateNode(xmlDoc, head, "apprdate", Convert.ToDateTime(modDispatch.D_APPROVE_DT).ToString("yyy-MM-dd")); //发运审批日期
                CreateNode(xmlDoc, head, "bconfirm", "N");
                CreateNode(xmlDoc, head, "billdate", Convert.ToDateTime(modDispatch.D_CREATE_DT).ToString("yyy-MM-dd"));  //制单日期
                CreateNode(xmlDoc, head, "billnewaddtime", Convert.ToDateTime(modDispatch.D_CREATE_DT).ToString("yyy-MM-dd HH:mm:ss"));
                CreateNode(xmlDoc, head, "bisopen", "");
                CreateNode(xmlDoc, head, "bmissionbill", "N");
                CreateNode(xmlDoc, head, "bmustreturnbillcode", "");
                CreateNode(xmlDoc, head, "btestbyinvoice", "");
                CreateNode(xmlDoc, head, "clastmodifierid", modDispatch.C_EMP_ID);//最后修改人
                CreateNode(xmlDoc, head, "clastmodiname", "");
                CreateNode(xmlDoc, head, "curbilltype", "");
                CreateNode(xmlDoc, head, "dallpacknum", "0");
                CreateNode(xmlDoc, head, "dallvolumn", "0");
                CreateNode(xmlDoc, head, "dallweight", "0");
                CreateNode(xmlDoc, head, "dfactweight", "");
                CreateNode(xmlDoc, head, "dr", "0");
                CreateNode(xmlDoc, head, "dtotal", "");
                CreateNode(xmlDoc, head, "employee", "");
                CreateNode(xmlDoc, head, "h_confirmarrivedate", "");
                CreateNode(xmlDoc, head, "iprintcount", "");
                CreateNode(xmlDoc, head, "isendtype", "3");//运费类别
                CreateNode(xmlDoc, head, "linkman1", "");
                CreateNode(xmlDoc, head, "oprdepartname", "");
                CreateNode(xmlDoc, head, "phone1", "");
                CreateNode(xmlDoc, head, "pk_defdoc0", modDispatch.C_IS_WIRESALE_ID); //是否线材销售主键
                CreateNode(xmlDoc, head, "pk_defdoc1", "");
                CreateNode(xmlDoc, head, "pk_defdoc10", "");
                CreateNode(xmlDoc, head, "pk_defdoc11", "");
                CreateNode(xmlDoc, head, "pk_defdoc12", "");
                CreateNode(xmlDoc, head, "pk_defdoc13", "");
                CreateNode(xmlDoc, head, "pk_defdoc14", "");
                CreateNode(xmlDoc, head, "pk_defdoc15", "");
                CreateNode(xmlDoc, head, "pk_defdoc16", "");
                CreateNode(xmlDoc, head, "pk_defdoc17", "");
                CreateNode(xmlDoc, head, "pk_defdoc18", "");
                CreateNode(xmlDoc, head, "pk_defdoc19", "");
                CreateNode(xmlDoc, head, "pk_defdoc2", "");
                CreateNode(xmlDoc, head, "pk_defdoc3", "");
                CreateNode(xmlDoc, head, "pk_defdoc4", "");
                CreateNode(xmlDoc, head, "pk_defdoc5", "");
                CreateNode(xmlDoc, head, "pk_defdoc6", "");
                CreateNode(xmlDoc, head, "pk_defdoc7", "");
                CreateNode(xmlDoc, head, "pk_defdoc8", "");
                CreateNode(xmlDoc, head, "pk_defdoc9", "");
                CreateNode(xmlDoc, head, "pk_delivbill_h", "");                       //发运单表头主键
                CreateNode(xmlDoc, head, "pkapprperson", "");
                CreateNode(xmlDoc, head, "pkbillperson", modDispatch.C_CREATE_ID);    //制单人
                CreateNode(xmlDoc, head, "pkcorpforgenoid", "1001");
                CreateNode(xmlDoc, head, "pkdelivmode", modDispatch.C_SHIPVIA);       //发运方式主键
                CreateNode(xmlDoc, head, "pkdelivorg", "1001NC10000000006EHS");       //发运组织主键固定
                CreateNode(xmlDoc, head, "pkdelivroute", "1001NC10000000006EHV");     //发运路线主键 固定
                CreateNode(xmlDoc, head, "pkdriver", "");
                CreateNode(xmlDoc, head, "pkoperator", modDispatch.C_BUSINESS_ID);    //业务员主键
                CreateNode(xmlDoc, head, "pkoprdepart", modDispatch.C_BUSINESS_DEPT); //业务部门主键
                CreateNode(xmlDoc, head, "pksendperson", "");
                CreateNode(xmlDoc, head, "pktrancust", modDispatch.C_COMCAR);         //承运商
                CreateNode(xmlDoc, head, "pktranorg", "");
                CreateNode(xmlDoc, head, "pkvehicle", "");
                CreateNode(xmlDoc, head, "pkvehicletype", "");
                CreateNode(xmlDoc, head, "returndate", "");
                CreateNode(xmlDoc, head, "returntime", "");
                CreateNode(xmlDoc, head, "senddate", Convert.ToDateTime(modDispatch.D_DISP_DT).ToString("yyy-MM-dd"));//发运日期
                CreateNode(xmlDoc, head, "startdate", "");
                CreateNode(xmlDoc, head, "starttime", "");
                CreateNode(xmlDoc, head, "taudittime", "");
                CreateNode(xmlDoc, head, "tlastmodifytime", Convert.ToDateTime(modDispatch.D_MOD_DT).ToString("yyy-MM-dd HH:mm:ss")); //最后修改时间
                CreateNode(xmlDoc, head, "tmaketime", Convert.ToDateTime(modDispatch.D_CREATE_DT).ToString("yyy-MM-dd HH:mm:ss"));    // 制单时间
                CreateNode(xmlDoc, head, "ts", Convert.ToDateTime(modDispatch.D_CREATE_DT).ToString("yyy-MM-dd HH:mm:ss"));
                CreateNode(xmlDoc, head, "userid", modDispatch.C_CREATE_ID);                                                          //制单人
                CreateNode(xmlDoc, head, "vapprpersonname", "");
                CreateNode(xmlDoc, head, "vbillpersonname", "");
                CreateNode(xmlDoc, head, "vdelivbillcode", modDispatch.C_ID);//发运单单据号
                CreateNode(xmlDoc, head, "vdoname", "");
                CreateNode(xmlDoc, head, "vdrivername", "");
                CreateNode(xmlDoc, head, "vehiclelicense", "");
                CreateNode(xmlDoc, head, "vnote", "");//行备注
                CreateNode(xmlDoc, head, "voldDelivbillcode", "");
                CreateNode(xmlDoc, head, "vroutedescr", "");
                CreateNode(xmlDoc, head, "vroutename", "");
                CreateNode(xmlDoc, head, "vsendtypename", "");
                CreateNode(xmlDoc, head, "vtranname", "");
                CreateNode(xmlDoc, head, "vtranorgname", "");
                CreateNode(xmlDoc, head, "vuserdef0", modDispatch.C_IS_WIRESALE);// 是否线材销售 是/ 否  *****
                CreateNode(xmlDoc, head, "vuserdef1", "");
                CreateNode(xmlDoc, head, "vuserdef10", "");
                CreateNode(xmlDoc, head, "vuserdef11", "");
                CreateNode(xmlDoc, head, "vuserdef12", "");
                CreateNode(xmlDoc, head, "vuserdef13", "");
                CreateNode(xmlDoc, head, "vuserdef14", "");
                CreateNode(xmlDoc, head, "vuserdef15", "");
                CreateNode(xmlDoc, head, "vuserdef16", "");
                CreateNode(xmlDoc, head, "vuserdef17", "");
                CreateNode(xmlDoc, head, "vuserdef18", "");
                CreateNode(xmlDoc, head, "vuserdef19", "");
                CreateNode(xmlDoc, head, "vuserdef2", "");
                CreateNode(xmlDoc, head, "vuserdef3", "Y");                      //是否已导出
                CreateNode(xmlDoc, head, "vuserdef4", modDispatch.C_LIC_PLA_NO); //车牌号
                CreateNode(xmlDoc, head, "vuserdef5", "");
                CreateNode(xmlDoc, head, "vuserdef6", modDispatch.C_ATSTATION);  //到站
                CreateNode(xmlDoc, head, "vuserdef7", "");
                CreateNode(xmlDoc, head, "vuserdef8", "");
                CreateNode(xmlDoc, head, "vuserdef9", "");
                CreateNode(xmlDoc, head, "vvehiclename", "");
                CreateNode(xmlDoc, head, "vvhcltypename", "");

                #endregion

                bill.AppendChild(head);
                XmlElement body = xmlDoc.CreateElement("bill_body");
                bill.AppendChild(body);

                DataTable dt = tmd_dispatchdetails.GetList(code).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        int rowno = i + 1;

                        Mod_TMD_DISPATCHDETAILS moditem = tmd_dispatchdetails.GetModel(dt.Rows[i]["C_ID"].ToString());

                        Mod_TMP_DAYPLAN modDayPlan = tmp_dayplan.GetModelID(dt.Rows[i]["C_PLAN_ID"].ToString());
                        if (modDayPlan != null)
                        {
                            #region //实体参数

                            Mod_TMO_ORDER     modOrder = tmo_order.GetModel(modDayPlan.C_PKBILLB);
                            Mod_TS_CUSTFILE   modCust  = ts_custfile.GetCustModel(modDayPlan.C_PKCUST); //客户档案
                            Mod_TB_MATRL_MAIN modMat   = tb_matrl_main.GetMatModel(modDayPlan.C_PKINV); //物料
                            //Mod_TMB_AREA modArea = tmb_area.GetModel(dt.Rows[i]["C_SEND_AREA"].ToString());//区域

                            string addrpk = "";
                            if (!string.IsNullOrEmpty(moditem.C_AOG_SITE))
                            {
                                DataTable dtname = tmb_area.GetAddrNCPK(moditem.C_AOG_SITE).Tables[0];
                                if (dtname.Rows.Count > 0)
                                {
                                    addrpk = dtname.Rows[0]["C_ADDR_NCPK"].ToString();
                                }
                            }
                            else
                            {
                                DataTable dtaddress = tmb_area.GetAreaAddress(dt.Rows[i]["C_SEND_AREA"].ToString()).Tables[0];
                                if (dtaddress.Rows.Count > 0)
                                {
                                    addrpk = dtaddress.Rows[0]["PK_ADDRESS"].ToString();
                                }
                            }
                            #endregion

                            decimal dunitprice = Convert.ToDecimal(modDayPlan.N_UNITPRICE); //含税单价
                            decimal num        = Convert.ToDecimal(moditem.N_FYWGT);        //数量
                            decimal dmoney     = dunitprice * num;                          //订单金额

                            XmlNode item = xmlDoc.CreateNode(XmlNodeType.Element, "item", null);

                            #region //表体_item
                            CreateNode(xmlDoc, item, "bappendent", "");
                            CreateNode(xmlDoc, item, "bcloseout", "");
                            CreateNode(xmlDoc, item, "bcloseout_old", "");
                            CreateNode(xmlDoc, item, "blargess", "N");
                            CreateNode(xmlDoc, item, "borderreturn", "N");
                            CreateNode(xmlDoc, item, "breceiveinform", "");
                            CreateNode(xmlDoc, item, "bsigned", "");
                            CreateNode(xmlDoc, item, "btestbyinvoice", "");
                            CreateNode(xmlDoc, item, "carrivecorpname", "");
                            CreateNode(xmlDoc, item, "cbiztype", modDayPlan.C_BIZTYPE);         //业务类型主键
                            CreateNode(xmlDoc, item, "ccheckstate_bid", moditem.C_QUALIRY_LEV); //质量等级主键
                            CreateNode(xmlDoc, item, "ccheckstatename", "");
                            CreateNode(xmlDoc, item, "cfreezeid", "");
                            CreateNode(xmlDoc, item, "cinvmanid", "");
                            CreateNode(xmlDoc, item, "confirmarrivedate", "");
                            CreateNode(xmlDoc, item, "cquoteunitid", modOrder.C_UNITID);      //报价计量单位主键
                            CreateNode(xmlDoc, item, "cquoteunitname", "");
                            CreateNode(xmlDoc, item, "creceiptcorp", GetCust(moditem.C_CGC)); //收货单位名称
                            CreateNode(xmlDoc, item, "creceiptcorpid", moditem.C_CGC);        //收货单位主键
                            CreateNode(xmlDoc, item, "csendcorp", "");
                            CreateNode(xmlDoc, item, "csendcorpid", "");
                            CreateNode(xmlDoc, item, "dcancelassistnum", "");
                            CreateNode(xmlDoc, item, "dcancelnum", "");
                            CreateNode(xmlDoc, item, "dfee", "");
                            CreateNode(xmlDoc, item, "dfeeitem", "");
                            CreateNode(xmlDoc, item, "dinvassist", moditem.N_FYZS.ToString()); //辅数量-件数
                            CreateNode(xmlDoc, item, "dinvnum", moditem.N_FYWGT.ToString());   //存货数量
                            CreateNode(xmlDoc, item, "dinvweight", "");
                            CreateNode(xmlDoc, item, "dmileage", "");
                            CreateNode(xmlDoc, item, "dmoney", dmoney.ToString());//订单金额可为空
                            CreateNode(xmlDoc, item, "doutassistnum", "");
                            CreateNode(xmlDoc, item, "doutnum", "");
                            CreateNode(xmlDoc, item, "doutnummargin", "");
                            CreateNode(xmlDoc, item, "dpackboxnum", "");
                            CreateNode(xmlDoc, item, "dpacknum", "");
                            CreateNode(xmlDoc, item, "dpackvolumn", "");
                            CreateNode(xmlDoc, item, "dpackweight", "");
                            CreateNode(xmlDoc, item, "dr", "0");
                            CreateNode(xmlDoc, item, "dreturnassistnum", "");
                            CreateNode(xmlDoc, item, "dreturnnum", "");
                            CreateNode(xmlDoc, item, "dsignasnum", "");
                            CreateNode(xmlDoc, item, "dsignassistnum", "");
                            CreateNode(xmlDoc, item, "dsignnum", "");
                            CreateNode(xmlDoc, item, "dsourcerow", "");
                            CreateNode(xmlDoc, item, "dtotalout", "");
                            CreateNode(xmlDoc, item, "dunitprice", dunitprice.ToString());//含税单价
                            CreateNode(xmlDoc, item, "dvolumn", "");
                            CreateNode(xmlDoc, item, "dwaylossasnum", "");
                            CreateNode(xmlDoc, item, "dwaylossnum", "");
                            CreateNode(xmlDoc, item, "hsl", "");
                            CreateNode(xmlDoc, item, "iattitude", "");
                            CreateNode(xmlDoc, item, "ibatchstatus", "0");
                            CreateNode(xmlDoc, item, "ibetimes", "");
                            CreateNode(xmlDoc, item, "iloadnum", "");
                            CreateNode(xmlDoc, item, "ilockstatus", "");
                            CreateNode(xmlDoc, item, "ionroadtime", "");
                            CreateNode(xmlDoc, item, "ipacking", "");
                            CreateNode(xmlDoc, item, "irownumber", rowno.ToString());//行号
                            CreateNode(xmlDoc, item, "irowstatus", "0");
                            CreateNode(xmlDoc, item, "ischeckatp", "N");
                            CreateNode(xmlDoc, item, "linkman1", "");
                            CreateNode(xmlDoc, item, "nassistnetwgt", "");   //辅数量
                            CreateNode(xmlDoc, item, "nfeedbacknum", "");    //回写上游数量
                            CreateNode(xmlDoc, item, "nnetwgt", "");         // 净重
                            CreateNode(xmlDoc, item, "nquoteunitnum", "");   //报价计量单位数量?-存货数量
                            CreateNode(xmlDoc, item, "nquoteunitrate", "1"); //报价计量单位换算率固定
                            CreateNode(xmlDoc, item, "ntotalshouldoutnum", "");
                            CreateNode(xmlDoc, item, "orderplantime", "");
                            CreateNode(xmlDoc, item, "packsortcode", "");
                            CreateNode(xmlDoc, item, "packsortname", "");
                            CreateNode(xmlDoc, item, "phone1", "");//****?
                            CreateNode(xmlDoc, item, "pk_corp", "");
                            CreateNode(xmlDoc, item, "pk_defdoc0", "");
                            CreateNode(xmlDoc, item, "pk_defdoc1", "");
                            CreateNode(xmlDoc, item, "pk_defdoc10", "");
                            CreateNode(xmlDoc, item, "pk_defdoc11", "");
                            CreateNode(xmlDoc, item, "pk_defdoc12", "");
                            CreateNode(xmlDoc, item, "pk_defdoc13", "");
                            CreateNode(xmlDoc, item, "pk_defdoc14", "");
                            CreateNode(xmlDoc, item, "pk_defdoc15", "");
                            CreateNode(xmlDoc, item, "pk_defdoc16", "");
                            CreateNode(xmlDoc, item, "pk_defdoc17", "");
                            CreateNode(xmlDoc, item, "pk_defdoc18", "");
                            CreateNode(xmlDoc, item, "pk_defdoc19", "");
                            CreateNode(xmlDoc, item, "pk_defdoc2", "");
                            CreateNode(xmlDoc, item, "pk_defdoc3", "");
                            CreateNode(xmlDoc, item, "pk_defdoc4", "");
                            CreateNode(xmlDoc, item, "pk_defdoc5", "");
                            CreateNode(xmlDoc, item, "pk_defdoc6", "");
                            CreateNode(xmlDoc, item, "pk_defdoc7", "");
                            CreateNode(xmlDoc, item, "pk_defdoc8", "");
                            CreateNode(xmlDoc, item, "pk_defdoc9", "");
                            CreateNode(xmlDoc, item, "pk_delivbill_b", "");                   //置空
                            CreateNode(xmlDoc, item, "pk_delivbill_h", "");
                            CreateNode(xmlDoc, item, "pk_invbasdoc", modOrder.C_INVBASDOCID); //存货档案主键
                            CreateNode(xmlDoc, item, "pk_packsort", "");
                            CreateNode(xmlDoc, item, "pk_transcontainer", "");
                            CreateNode(xmlDoc, item, "pkarriveaddress", addrpk);             //到货地点主键
                            CreateNode(xmlDoc, item, "pkarrivearea", moditem.C_SEND_AREA);   //到货地区主键
                            CreateNode(xmlDoc, item, "pkarrivecorp", "");
                            CreateNode(xmlDoc, item, "pkassistmeasure", modOrder.C_FUNITID); //辅计量单位
                            CreateNode(xmlDoc, item, "pkbasinv", modOrder.C_INVBASDOCID);    //存货档案主键
                            CreateNode(xmlDoc, item, "pkbasreceiptcorp", modCust.C_NC_ID);   //客户主键
                            CreateNode(xmlDoc, item, "pkbassendcorp", "");
                            CreateNode(xmlDoc, item, "pkconsign", "");
                            CreateNode(xmlDoc, item, "pkcorpforgenoid", modDayPlan.C_PKSALECORP); //销售公司(1001)
                            CreateNode(xmlDoc, item, "pkcusbasdoc", modCust.C_NC_ID);             //客户主键
                            CreateNode(xmlDoc, item, "pkcusmandoc", modDayPlan.C_PKCUST);         //客户管理主键
                            CreateNode(xmlDoc, item, "pkcustinvoice", "");
                            CreateNode(xmlDoc, item, "pkdayplan", "");
                            CreateNode(xmlDoc, item, "pkdestrep", "");
                            CreateNode(xmlDoc, item, "pkdeststockorg", "");
                            CreateNode(xmlDoc, item, "pkinv", modOrder.C_INVENTORYID);//存货管理档案主键
                            CreateNode(xmlDoc, item, "pkinvoice", "");
                            CreateNode(xmlDoc, item, "pkitem", "");
                            CreateNode(xmlDoc, item, "pkitemperiod", "");
                            CreateNode(xmlDoc, item, "pkoperator", modDayPlan.C_PKOPERATOR);   //业务员ID
                            CreateNode(xmlDoc, item, "pkoprdepart", modDayPlan.C_PKOPRDEPART); //业务员部门
                            CreateNode(xmlDoc, item, "pkorder", "");
                            CreateNode(xmlDoc, item, "pkorderplanid", "");
                            CreateNode(xmlDoc, item, "pkorderrow", "");
                            CreateNode(xmlDoc, item, "pkpackboxtype", "");
                            CreateNode(xmlDoc, item, "pksalecorp", "1001");
                            CreateNode(xmlDoc, item, "pksalegrp", modDayPlan.C_PKSALEORG);      //销售组织主键
                            CreateNode(xmlDoc, item, "pksendaddress", "0001AA1000000002LFNT");  //发货地点-邢台市
                            CreateNode(xmlDoc, item, "pksendarea", "dqda0000000000000057");     //发货地区-邢台市区
                            CreateNode(xmlDoc, item, "pksendstock", moditem.C_SEND_STOCK_PK);   //仓库主键
                            CreateNode(xmlDoc, item, "pksendstockorg", "1001NC10000000000669"); //发货库存组织主键-固定
                            CreateNode(xmlDoc, item, "pksrccalbodyar", "");
                            CreateNode(xmlDoc, item, "pkunit", "");
                            CreateNode(xmlDoc, item, "plantime", "");
                            CreateNode(xmlDoc, item, "receivedate", "");
                            CreateNode(xmlDoc, item, "requireday", Convert.ToDateTime(modDayPlan.D_REQUIREDATE).ToString("yyy-MM-dd")); //要求到货日期
                            CreateNode(xmlDoc, item, "sourcebillts", "");
                            CreateNode(xmlDoc, item, "ts", "");                                                                         //HH:mm:ss
                            CreateNode(xmlDoc, item, "ufdtmp", "");
                            CreateNode(xmlDoc, item, "userid", "");
                            CreateNode(xmlDoc, item, "varriveaddress", "其他地区");
                            CreateNode(xmlDoc, item, "vassistmeaname", "");
                            CreateNode(xmlDoc, item, "vbatchcode", "");
                            CreateNode(xmlDoc, item, "vbilltype", "30");
                            CreateNode(xmlDoc, item, "vbilltypename", "");
                            CreateNode(xmlDoc, item, "vcargcode", "");
                            CreateNode(xmlDoc, item, "vconsign", "");
                            CreateNode(xmlDoc, item, "vcontainername", "");
                            CreateNode(xmlDoc, item, "vcustcode", modCust.C_NO);           //客户编码
                            CreateNode(xmlDoc, item, "vcustname", modCust.C_NAME);         //客户名称
                            CreateNode(xmlDoc, item, "vdayplancode", modDayPlan.C_PLCODE); //对应日计划单据号
                            CreateNode(xmlDoc, item, "vdestaddress", moditem.C_AREA);      //到货地址
                            CreateNode(xmlDoc, item, "vdestarea", moditem.C_SEND_AREA);    //到货地区
                            CreateNode(xmlDoc, item, "vdeststoreaddre", "");
                            CreateNode(xmlDoc, item, "vdeststorename", "");
                            CreateNode(xmlDoc, item, "vdeststoreorgname", "");
                            CreateNode(xmlDoc, item, "vfree0", "");
                            CreateNode(xmlDoc, item, "vfree1", moditem.C_FREE_TERM);                        //自由项1
                            CreateNode(xmlDoc, item, "vfree10", moditem.C_ID);                              //CRM发运单表体主键
                            CreateNode(xmlDoc, item, "vfree2", moditem.C_FREE_TERM2);                       //自由项2
                            CreateNode(xmlDoc, item, "vfree3", modOrder.N_TYPE == 8 ? moditem.C_PACK : ""); //包装8线材
                            CreateNode(xmlDoc, item, "vfree4", "");
                            CreateNode(xmlDoc, item, "vfree5", "");
                            CreateNode(xmlDoc, item, "vfree6", modDispatch.N_IS_EXPORT == 0 ? "否" : "是"); //是否包到
                            CreateNode(xmlDoc, item, "vfree7", moditem.N_PRICE.ToString());               //运费
                            CreateNode(xmlDoc, item, "vfree8", modDayPlan.C_ID);                          //CRM发运日计划主键
                            CreateNode(xmlDoc, item, "vfree9", modDispatch.C_GUID);                       // CRM发运单表头主键
                            CreateNode(xmlDoc, item, "vfreeid1", "");
                            CreateNode(xmlDoc, item, "vfreeid10", "");
                            CreateNode(xmlDoc, item, "vfreeid2", "");
                            CreateNode(xmlDoc, item, "vfreeid3", "");
                            CreateNode(xmlDoc, item, "vfreeid4", "");
                            CreateNode(xmlDoc, item, "vfreeid5", "");
                            CreateNode(xmlDoc, item, "vfreeid6", "");
                            CreateNode(xmlDoc, item, "vfreeid7", "");
                            CreateNode(xmlDoc, item, "vfreeid8", "");
                            CreateNode(xmlDoc, item, "vfreeid9", "");
                            CreateNode(xmlDoc, item, "vfreename1", "");
                            CreateNode(xmlDoc, item, "vfreename10", "");
                            CreateNode(xmlDoc, item, "vfreename2", "");
                            CreateNode(xmlDoc, item, "vfreename3", "");
                            CreateNode(xmlDoc, item, "vfreename4", "");
                            CreateNode(xmlDoc, item, "vfreename5", "");
                            CreateNode(xmlDoc, item, "vfreename6", "");
                            CreateNode(xmlDoc, item, "vfreename7", "");
                            CreateNode(xmlDoc, item, "vfreename8", "");
                            CreateNode(xmlDoc, item, "vfreename9", "");
                            CreateNode(xmlDoc, item, "vinvcode", modOrder.C_MAT_CODE);//存货编码
                            CreateNode(xmlDoc, item, "vinvname", "");
                            CreateNode(xmlDoc, item, "vinvoicecode", "");
                            CreateNode(xmlDoc, item, "vitemname", "");
                            CreateNode(xmlDoc, item, "vitemperiodname", "");
                            CreateNode(xmlDoc, item, "vnote", moditem.C_REMARK);//行备注
                            CreateNode(xmlDoc, item, "voperatorname", "");
                            CreateNode(xmlDoc, item, "voprdepartname", "");
                            CreateNode(xmlDoc, item, "vordercode", modDayPlan.C_SALECODE);//销售单据号
                            CreateNode(xmlDoc, item, "vreceiptcorpname", "");
                            CreateNode(xmlDoc, item, "vsalecorpname", "");
                            CreateNode(xmlDoc, item, "vsaleorgname", "");
                            CreateNode(xmlDoc, item, "vsendaddr", "");
                            CreateNode(xmlDoc, item, "vsendaddress", "");
                            CreateNode(xmlDoc, item, "vsendarea", "");
                            CreateNode(xmlDoc, item, "vsendcorpname", "");
                            CreateNode(xmlDoc, item, "vsendstoreaddre", "");
                            CreateNode(xmlDoc, item, "vsendstorename", "");
                            CreateNode(xmlDoc, item, "vsendstoreorgaddre", "");
                            CreateNode(xmlDoc, item, "vsendstoreorgname", "");
                            CreateNode(xmlDoc, item, "vsignname", "");
                            CreateNode(xmlDoc, item, "vsignnote", "");
                            CreateNode(xmlDoc, item, "vspec", modMat.C_SPEC);    //规格
                            CreateNode(xmlDoc, item, "vsrccalbodyarname", "");
                            CreateNode(xmlDoc, item, "vtype", modMat.C_STL_GRD); //钢种
                            CreateNode(xmlDoc, item, "vunit", modMat.C_ZJLDWMC); //主计量单位名称
                            CreateNode(xmlDoc, item, "vuserdef0", "");
                            CreateNode(xmlDoc, item, "vuserdef1", "");
                            CreateNode(xmlDoc, item, "vuserdef10", modDayPlan.C_CONNO); //合同号
                            CreateNode(xmlDoc, item, "vuserdef11", moditem.C_ELSENEED); //其它要求
                            CreateNode(xmlDoc, item, "vuserdef12", "");
                            CreateNode(xmlDoc, item, "vuserdef13", "");
                            CreateNode(xmlDoc, item, "vuserdef14", "");
                            CreateNode(xmlDoc, item, "vuserdef15", "");
                            CreateNode(xmlDoc, item, "vuserdef16", "");
                            CreateNode(xmlDoc, item, "vuserdef17", "");
                            CreateNode(xmlDoc, item, "vuserdef18", "");
                            CreateNode(xmlDoc, item, "vuserdef19", "");
                            CreateNode(xmlDoc, item, "vuserdef2", "");
                            CreateNode(xmlDoc, item, "vuserdef3", "");
                            CreateNode(xmlDoc, item, "vuserdef4", "");
                            CreateNode(xmlDoc, item, "vuserdef5", "");
                            CreateNode(xmlDoc, item, "vuserdef6", "");
                            CreateNode(xmlDoc, item, "vuserdef7", "");
                            CreateNode(xmlDoc, item, "vuserdef8", "");
                            CreateNode(xmlDoc, item, "vuserdef9", "");
                            #endregion

                            body.AppendChild(item);
                        }
                    }
                }
                xmlDoc.Save(xmlFileName);

                List <string> parem = NCSendXml.SendXML(xmlDoc);
                parem.Add(code);
                parem.Add(empID);
                parem.Add("发运单-NC");
                parem.Add(parem[0] == "1" ? "导入NC成功" : "导入NC失败");
                //日志
                AddLog(parem);

                return(parem);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }