protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //获取用户所属公司名称 var vUser = (NF.Framework.CurrentUser)HttpContext.Current.Session["CurrentUser"]; if (vUser != null) { ltlempid.Text = vUser.Id; hidempname.Value = vUser.Name; if (!string.IsNullOrEmpty(Request.QueryString["fyd"])) { GetDic(); ltlfyd.Text = Request.QueryString["fyd"]; Mod_TMD_DISPATCH mod = tmd_dispatch.GetModel(ltlfyd.Text); txt_CH.Text = mod.C_LIC_PLA_NO; txtfydt.Text = Convert.ToDateTime(mod.D_DISP_DT).ToString("yyy-MM-dd"); ltlimport_num.Text = mod.C_EXTEND1.ToString();//记录导入条码系统次数 dropfyfs.SelectedIndex = dropfyfs.Items.IndexOf(dropfyfs.Items.FindByValue(mod.C_SHIPVIA)); dropcys.SelectedIndex = dropcys.Items.IndexOf(dropcys.Items.FindByValue(mod.C_COMCAR)); txtgps.Text = mod.C_GPS_NO; txtdz.Text = mod.C_ATSTATION; txtsjtel.Text = mod.C_EXTEND3; //司机姓名/电话 txtkhtel.Text = mod.C_EXTEND4; //客户姓名/电话 } } else { WebMsg.CheckUserLogin(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //获取用户所属公司名称 var vUser = (NF.Framework.CurrentUser)HttpContext.Current.Session["CurrentUser"]; if (vUser != null) { ltlempName.Text = vUser.Name; if (!string.IsNullOrEmpty(Request.QueryString["fyd"])) { ltlfyd.Text = Request.QueryString["fyd"]; Mod_TMD_DISPATCH mod = tmd_dispatch.GetModel(ltlfyd.Text); if (mod != null) { btnSave.Enabled = mod.C_STATUS == "9" ? true : false; btnNC.Enabled = mod.C_STATUS == "9" ? true : false; GetList(); } } } else { WebMsg.CheckUserLogin(); } } }
protected void btnSave_Click(object sender, EventArgs e) { try { Mod_TMD_DISPATCH mod = new Mod_TMD_DISPATCH(); mod.C_ID = ltlfyd.Text; mod.C_LIC_PLA_NO = txt_CH.Text; mod.C_EXTEND2 = txtxnch.Text; mod.D_CREATE_DT = Convert.ToDateTime(txtfydt.Text); mod.D_DISP_DT = Convert.ToDateTime(txtfydt.Text); mod.C_EMP_ID = ltlempid.Text; mod.C_EMP_NAME = hidempname.Value; mod.C_ATSTATION = txtdz.Text; mod.C_GPS_NO = txtgps.Text; //GPS号 mod.C_SHIPVIA = dropfyfs.SelectedItem.Value; //发运方式 mod.C_COMCAR = dropcys.SelectedItem.Value; //承运商 mod.C_EXTEND3 = txtsjtel.Text; //司机姓名/电话 mod.C_EXTEND4 = txtkhtel.Text; //客户姓名/电话 if (tmd_dispatch.UpdateFyd_CH(mod)) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script language='javascript'> _closemsg('保存成功');</script>", false); } } catch (Exception ex) { WebMsg.MessageBox(ex.Message); } }
/// <summary> /// 加载发运单信息 /// </summary> private void BindList() { if (!string.IsNullOrEmpty(txtsendcode.Text)) { #region //加载表头信息 Mod_TMD_DISPATCH mod = tmd_dispatch.GetModel(txtsendcode.Text); if (mod != null) { ltlpkid.Text = mod.C_GUID;//NC主键 txtfydt.Text = Convert.ToDateTime(mod.D_DISP_DT).ToString("yyy-MM-dd"); dropfyfs.SelectedIndex = dropfyfs.Items.IndexOf(dropfyfs.Items.FindByValue(mod.C_SHIPVIA)); dropsfxc.SelectedIndex = dropsfxc.Items.IndexOf(dropsfxc.Items.FindByValue(mod.C_IS_WIRESALE_ID)); txtdz.Text = mod.C_ATSTATION; txtcph.Text = mod.C_LIC_PLA_NO; txtgps.Text = mod.C_GPS_NO; txtzdr.Text = GetUserName(mod.C_CREATE_ID); //制单人 txtzddt.Text = Convert.ToDateTime(mod.D_CREATE_DT).ToString("yyy-MM-dd"); txtxgr.Text = GetUserName(mod.C_EMP_ID); //修改人 txtxgtime.Text = Convert.ToDateTime(mod.D_MOD_DT).ToString(); txtspr.Text = GetUserName(mod.C_APPROVE_ID); //审批人 if (Convert.ToDateTime(mod.D_APPROVE_DT).ToString("yyy-MM-dd") != "001-01-01") { txtspdt.Text = Convert.ToDateTime(mod.D_APPROVE_DT).ToString("yyy-MM-dd"); } hidstatus.Value = mod.C_STATUS; ltltype.Text = mod.C_EXTEND5; txtfyqua.Value = mod.N_QUA.ToString(); //发运支数 txtfywgt.Value = mod.N_WGT.ToString(); //发运重量 #region //操作按钮/输入框权限显示 txtcph.Enabled = mod.C_STATUS == "0" ? true : false; //车牌号 btn(mod.C_STATUS); //按钮状态 #endregion #region //加载表体信息 DataTable dt = tmd_dispatchdetails.GetList(txtsendcode.Text).Tables[0]; if (dt.Rows.Count > 0) { txtcount.Value = dt.Compute("sum(N_FYZS)", "true").ToString(); txtsumwgt.Value = dt.Compute("sum(N_FYWGT)", "true").ToString(); rptList.DataSource = dt; rptList.DataBind(); } else { rptList.DataSource = null; rptList.DataBind(); txtcount.Value = ""; txtsumwgt.Value = ""; } #endregion } #endregion } }
protected void Button1_Click(object sender, EventArgs e) { for (int i = 0; i < rptList2.Items.Count; i++) { HtmlInputCheckBox chkMat_Code = (HtmlInputCheckBox)rptList2.Items[i].FindControl("cbsj"); if (chkMat_Code.Checked) { Literal lstcph = (Literal)rptList2.Items[i].FindControl("lstcph"); Literal lstfyid = (Literal)rptList2.Items[i].FindControl("lstfyid"); Literal lstfydh = (Literal)rptList2.Items[i].FindControl("lstfydh"); Literal lstQua = (Literal)rptList2.Items[i].FindControl("lstqua"); Literal lstSlabCode = (Literal)rptList2.Items[i].FindControl("lstck"); Literal lstStove = (Literal)rptList2.Items[i].FindControl("lststove"); Literal lstBatchNo = (Literal)rptList2.Items[i].FindControl("lstbatchNo"); Literal lstLevZh = (Literal)rptList2.Items[i].FindControl("lstzldj"); Literal lstGrd = (Literal)rptList2.Items[i].FindControl("lstgrd"); Literal lstStdCode = (Literal)rptList2.Items[i].FindControl("lststd"); Literal LstSpec = (Literal)rptList2.Items[i].FindControl("lstspec"); Mod_TMD_DISPATCH mod_TMD_DISPATCH = bll_TMD_DISPATCH.GetModel(lstfydh.Text); if (mod_TMD_DISPATCH.C_STATUS == "7") { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script language='javascript'> _closemsg('实绩已确认不能再次确认');</script>", false); return; } bll_TMD_DISPATCH.UPFYD("7", vUser.Id, vUser.Name, lstfydh.Text); string msg = bll_Interface_WL.ADDFYDToZJB(lstfydh.Text, Convert.ToDateTime(txtFYSJ.Text)); if (msg != "1") { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script language='javascript'> _closemsg('" + msg + "');</script>", false); return; } Mod_TMD_GPFY_LOG mod = new Mod_TMD_GPFY_LOG(); mod.C_EMP_ID = vUser.Account; mod.C_FYDH = lstfydh.Text; mod.C_LIC_PLA_NO = lstcph.Text; mod.C_TYPE = "确认实绩"; bll_TMD_GPFY_LOG.Add(mod); this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script language='javascript'> _closemsg('实绩已确认');</script>", false); Query(); Detail(); SJQuery(); return; } //else //{ // this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script language='javascript'> _closemsg('未选中实绩行');</script>", false); // return; //} } }
/// <summary> /// 修改发运单 /// </summary> /// <returns></returns> private bool updateFyd(string flag) { #region //表头 Mod_TMD_DISPATCH modfyd = tmd_dispatch.GetModel(txtsendcode.Text); modfyd.C_COMCAR = dropcys.SelectedItem.Value; //承运商 modfyd.C_GPS_NO = txtgps.Text; //GPS号 modfyd.C_LIC_PLA_NO = txtcph.Text; //车牌号 modfyd.C_EXTEND3 = txtsjxm.Text; //司机姓名/电话 //modfyd.C_EXTEND4 = txtsjtel.Text;//客户姓名/电话 modfyd.C_EMP_ID = ltlempid.Text; //最后修改人ID modfyd.C_EMP_NAME = hidempname.Value; //最后修改人 modfyd.C_XGEMP = hidempname.Value; //维护人员 #endregion return(tmd_dispatch.UpdateFyd_CH_WL(modfyd)); }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TMD_DISPATCH GetModel(string C_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select C_ID,C_PLAN_ID,C_GPS_NO,C_NO,C_CON_NO,D_DISP_DT,C_SHIPVIA,C_COMCAR,C_PATH,C_PATH_DESC,C_SEND_DEPT,C_BUSINESS_DEPT,C_BUSINESS_ID,C_IS_WIRESALE,N_IS_EXPORT,C_LIC_PLA_NO,C_ATSTATION,D_APPROVE_DT,D_CREATE_DT,C_APPROVE_ID,C_CREATE_ID,C_STATUS,C_EMP_ID,C_EMP_NAME,D_MOD_DT,C_GUID,C_IS_WIRESALE_ID,C_REMARK,C_REMARK2,D_FAILURE from TMD_DISPATCH "); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = C_ID; Mod_TMD_DISPATCH model = new Mod_TMD_DISPATCH(); DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <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; } }
/// <summary> /// 修改发运单 /// </summary> /// <returns></returns> private bool updateFyd(string flag) { decimal fyzs = 0; //发运支数 decimal fywgt = 0; //发运量 #region //表体 List <Mod_TMD_DISPATCHDETAILS> item = new List <Mod_TMD_DISPATCHDETAILS>(); for (int i = 0; i < rptList.Items.Count; i++) { HtmlInputHidden hidpkid = (HtmlInputHidden)rptList.Items[i].FindControl("hidpkid"); //发运单明细主键 HtmlInputCheckBox chkOrder = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkOrder"); //订单主键 HtmlInputHidden hidckid = (HtmlInputHidden)rptList.Items[i].FindControl("hidckid"); //仓库ID HtmlInputText txtckname = (HtmlInputText)rptList.Items[i].FindControl("txtckname"); //仓库名称 //HtmlInputText txtflag = (HtmlInputText)rptList.Items[i].FindControl("txtflag");//标识:Y/N HtmlInputText txtfyzs = (HtmlInputText)rptList.Items[i].FindControl("txtfyzs"); //发运支数 HtmlInputText txtjhfyl = (HtmlInputText)rptList.Items[i].FindControl("txtjhfyl"); //发运数量 HtmlInputText txtbatch = (HtmlInputText)rptList.Items[i].FindControl("txtbatch"); //批次号 fyzs += Convert.ToDecimal(txtfyzs.Value ?? "0"); fywgt += Convert.ToDecimal(txtjhfyl.Value ?? "0"); if (flag == "N") { if (chkOrder.Checked) { #region //insert Mod_TMD_DISPATCHDETAILS modfyditem = tmd_dispatchdetails.GetModel(hidpkid.Value); modfyditem.C_EMP_ID = ltlempid.Text; modfyditem.C_EMP_NAME = hidempname.Value; modfyditem.N_FYZS = Convert.ToDecimal(txtfyzs.Value ?? "0"); //发运支数 modfyditem.N_FYWGT = Convert.ToDecimal(txtjhfyl.Value ?? "0"); //发运数量 modfyditem.C_BATCH_NO = txtbatch.Value.Trim(); //批次号 modfyditem.C_SEND_STOCK = txtckname.Value; //发运仓库名称 modfyditem.C_SEND_STOCK_PK = hidckid.Value; //发运仓库ID modfyditem.FLAG = flag; item.Add(modfyditem); #endregion } } else { #region //update Mod_TMD_DISPATCHDETAILS modfyditem = tmd_dispatchdetails.GetModel(hidpkid.Value); modfyditem.C_ID = hidpkid.Value; //主键 modfyditem.C_EMP_ID = ltlempid.Text; modfyditem.C_EMP_NAME = hidempname.Value; modfyditem.N_FYZS = Convert.ToDecimal(txtfyzs.Value); //发运支数 modfyditem.N_FYWGT = Convert.ToDecimal(txtjhfyl.Value); //发运数量 modfyditem.C_BATCH_NO = txtbatch.Value.Trim(); //批次号 modfyditem.C_SEND_STOCK = txtckname.Value; //发运仓库名称 modfyditem.C_SEND_STOCK_PK = hidckid.Value; //发运仓库ID modfyditem.FLAG = flag; item.Add(modfyditem); #endregion } } #endregion #region //表头 Mod_TMD_DISPATCH modfyd = new Mod_TMD_DISPATCH(); modfyd.C_ID = txtsendcode.Text; //发运单单据号 modfyd.C_GPS_NO = txtgps.Text; //GPS号 modfyd.D_DISP_DT = Convert.ToDateTime(txtfydt.Text); //发运日期 modfyd.C_SHIPVIA = dropfyfs.SelectedItem.Value; //发运方式 modfyd.C_COMCAR = dropcys.SelectedItem.Value; //承运商 modfyd.C_IS_WIRESALE = dropsfxc.SelectedItem.Text; //汉字是否线材 modfyd.C_IS_WIRESALE_ID = dropsfxc.SelectedItem.Value; //是否线材主键 modfyd.C_LIC_PLA_NO = txtcph.Text; //车牌号 modfyd.C_ATSTATION = txtdz.Text; //到站 modfyd.C_EMP_ID = ltlempid.Text; //修改人ID modfyd.C_EMP_NAME = hidempname.Value; //修改人 //modfyd.C_EXTEND5 = ltltype.Text;//订单类型 8线材 6钢坯 831废乱材 841焦化产品 851渣 modfyd.N_QUA = fyzs; //发运支数 modfyd.N_WGT = fywgt; //发运量 #endregion if (tmd_dispatch.UpdateFYD(modfyd, item)) { return(true); } else { return(false); } }
/// <summary> /// 添加发运单 /// </summary> /// <returns></returns> private bool InsertFyd() { decimal fyzs = 0; decimal fywgt = 0; string sendcode = randomnumber.CreateDispID(); //发运单据号 #region //表体 List <Mod_TMD_DISPATCHDETAILS> item = new List <Mod_TMD_DISPATCHDETAILS>(); for (int i = 0; i < rptList.Items.Count; i++) { HtmlInputCheckBox chkOrder = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkOrder"); //订单主键 HtmlInputText txtfyzs = (HtmlInputText)rptList.Items[i].FindControl("txtfyzs"); //发运支数 HtmlInputText txtjhfyl = (HtmlInputText)rptList.Items[i].FindControl("txtjhfyl"); //发运数量 HtmlInputHidden hidC_CGID = (HtmlInputHidden)rptList.Items[i].FindControl("hidC_CGID"); //收货单位 HtmlInputHidden hidshdq = (HtmlInputHidden)rptList.Items[i].FindControl("hidshdq"); //收货地区 TextBox txtPack_Code = (TextBox)rptList.Items[i].FindControl("txtPack_Code"); //包装要求 DropDownList dropzldj = (DropDownList)rptList.Items[i].FindControl("dropzldj"); //质量等级 DropDownList dropshdz = (DropDownList)rptList.Items[i].FindControl("dropshdz"); //收货地址 Literal ltlpkplan = (Literal)rptList.Items[i].FindControl("ltlpkplan"); //日计划主键 Literal ltlcustno = (Literal)rptList.Items[i].FindControl("ltlcustno"); //客户编码 HtmlInputHidden hidckid = (HtmlInputHidden)rptList.Items[i].FindControl("hidckid"); //仓库ID HtmlInputText txtckname = (HtmlInputText)rptList.Items[i].FindControl("txtckname"); //仓库名称 HtmlInputText txtqtyq = (HtmlInputText)rptList.Items[i].FindControl("txtqtyq"); //其他要求 HtmlInputText txtremark = (HtmlInputText)rptList.Items[i].FindControl("txtremark"); //行备注 TextBox txtStd_Code = (TextBox)rptList.Items[i].FindControl("txtStd_Code"); //执行标准 TextBox txtC_FREE1 = (TextBox)rptList.Items[i].FindControl("txtC_FREE1"); //自由项1 TextBox txtC_FREE2 = (TextBox)rptList.Items[i].FindControl("txtC_FREE2"); //自由项2 Mod_TMO_ORDER modOrder = tmo_order.GetModel(chkOrder.Value); if (modOrder != null) { fyzs += Convert.ToDecimal(txtfyzs.Value ?? "0"); fywgt += Convert.ToDecimal(txtjhfyl.Value ?? "0"); Mod_TMD_DISPATCHDETAILS modfyditem = new Mod_TMD_DISPATCHDETAILS(); modfyditem.C_DISPATCH_ID = sendcode; //发运单单据号 modfyditem.C_MAT_CODE = modOrder.C_MAT_CODE; //物料编码 modfyditem.C_MAT_NAME = modOrder.C_MAT_NAME; //物料名称 modfyditem.C_SPEC = modOrder.C_SPEC; //规格 modfyditem.C_STL_GRD = modOrder.C_STL_GRD; //钢种 modfyditem.C_QUALIRY_LEV = dropzldj.SelectedItem.Value; //质量等级主键-发运单 modfyditem.C_JUDGE_LEV_ZH = dropzldj.SelectedItem.Text; //质量等级编码 modfyditem.C_FREE_TERM = txtC_FREE1.Text; //自由项 modfyditem.C_FREE_TERM2 = txtC_FREE2.Text; //自由项 modfyditem.C_PACK = txtPack_Code.Text; //包装要求 modfyditem.C_STD_CODE = txtStd_Code.Text; //执行标准 modfyditem.C_ELSENEED = txtqtyq.Value; //其他要求? modfyditem.C_REMARK = txtremark.Value; //行备注***** modfyditem.N_COM_AMOUNT_WGT = modOrder.N_FNUM; //原始订单辅数量 modfyditem.N_WGT = modOrder.N_WGT; //原始订单数量 modfyditem.C_EQUATION_FACTOR = modOrder.N_HSL.ToString(); //换算率 modfyditem.C_UNITIS = modOrder.C_UNITID; //主计量单位ID modfyditem.C_ORGO_CUST = modOrder.C_CUST_NAME; //订货客户 modfyditem.C_CGC = hidC_CGID.Value; //收货单位-发运单 modfyditem.C_ORDER_TYPE = modOrder.N_TYPE.ToString() == "8" ? "805" : modOrder.N_TYPE.ToString(); //订单类型 8线材 6钢坯 831废乱材 841焦化产品 851渣 modfyditem.C_SEND_AREA = hidshdq.Value; //到货地区-发运单 modfyditem.C_AREA = dropshdz.SelectedItem?.Value ?? ""; //到货地址-发运单 modfyditem.C_EMP_ID = ltlempid.Text; modfyditem.C_EMP_NAME = ltlempname.Text; modfyditem.C_CON_NO = modOrder.C_CON_NO; //合同号 modfyditem.C_PLAN_ID = ltlpkplan.Text; //日计划主键 modfyditem.C_NO = modOrder.C_ORDER_NO; //订单号 modfyditem.C_ORDERPK = modOrder.C_ID; //订单主键 modfyditem.C_CUSTNO = ltlcustno.Text; //客户编码 modfyditem.N_FYZS = Convert.ToDecimal(txtfyzs.Value == "" ? "0" : txtfyzs.Value); //发运支数 modfyditem.N_FYWGT = Convert.ToDecimal(txtjhfyl.Value == "" ? "0" : txtjhfyl.Value); //发运数量 modfyditem.C_SEND_STOCK = txtckname.Value; //发运仓库名称 modfyditem.C_SEND_STOCK_PK = hidckid.Value; //发运仓库ID modfyditem.C_PRODUCT_ID = ""; //库存产品ID modfyditem.C_AU_UNITIS = modOrder.C_FUNITID; //辅单位 modfyditem.N_PRICE = 0; //到货地点费用 item.Add(modfyditem); } } #endregion #region//表头 Mod_TMD_DISPATCH modfyd = new Mod_TMD_DISPATCH(); modfyd.C_ID = sendcode; //发运单单据号 modfyd.C_GPS_NO = txtgps.Text; //GPS号 modfyd.D_DISP_DT = Convert.ToDateTime(txtfydt.Text); //发运日期 modfyd.C_SHIPVIA = dropfyfs.SelectedItem.Value; //发运方式 modfyd.C_COMCAR = dropcys.SelectedItem.Value; //承运商 modfyd.C_IS_WIRESALE = dropsfxc.SelectedItem.Text; //汉字是否线材 modfyd.C_IS_WIRESALE_ID = dropsfxc.SelectedItem.Value; //是否线材主键 modfyd.C_LIC_PLA_NO = txtcph.Text; //车牌号 modfyd.C_ATSTATION = txtdz.Text; //到站 modfyd.C_CREATE_ID = ltlempid.Text; //制单人 modfyd.C_EMP_ID = ltlempid.Text; //修改人ID modfyd.C_EMP_NAME = ltlempname.Text; //修改人 modfyd.C_EXTEND5 = ltltype.Text; //订单类型 8线材 6钢坯 831废乱材 841焦化产品 851渣 modfyd.C_CUSTNAME = ltlcustname.Text; //客户 modfyd.C_CON_NO = ltlcon_no.Text; //合同号 modfyd.N_QUA = fyzs; //发运支数 modfyd.N_WGT = fywgt; //发运量 modfyd.N_IS_EXPORT = 0; //是否包到价 modfyd.C_EXTEND2 = txtcph.Text; //虚拟车号 Mod_TMO_CON modCon = tmo_con.GetModel(ltlcon_no.Text); if (modCon != null) { modfyd.C_BUSINESS_DEPT = modCon.C_DEPTID; //业务部门 modfyd.C_BUSINESS_ID = modCon.C_EMPLOYEEID; //业务员 } #endregion if (tmd_dispatch.InsertFYD(modfyd, item)) { txtsendcode.Text = sendcode; return(true); } else { return(false); } }
/// <summary> /// 发送发运单到中间表 /// </summary> /// <param name="dt">要发送的集合</param> /// <returns>返回int类型 大于0为转入成功,等于0发送失败</returns> public int ADDFYDToZJB(string sendcode) { //TransactionHelper_SQL.BeginTransaction(); List <Mod_TMD_DISPATCHDETAILS> item = new List <Mod_TMD_DISPATCHDETAILS>(); #region //实例化 Dal_TMD_DISPATCHDETAILS dalitem = new Dal_TMD_DISPATCHDETAILS(); Dal_TQB_CHECKSTATE daltqb = new Dal_TQB_CHECKSTATE(); Dal_TS_DEPT daldetp = new Dal_TS_DEPT(); Dal_TS_USER daluser = new Dal_TS_USER(); Dal_TMD_DISPATCH dalhead = new Dal_TMD_DISPATCH(); Dal_TS_DIC daldic = new Dal_TS_DIC(); #endregion Mod_TMD_DISPATCH modTmd = dalhead.GetModel(sendcode); //发运单主表 item = DataTableToList(dalitem.GetList(sendcode).Tables[0]); //发运明细 StringBuilder strSql = new StringBuilder(); for (int i = 0; i < item.Count; i++) { #region //基础数据 Mod_TQB_CHECKSTATE modtqb = daltqb.GetModel(item[i].C_QUALIRY_LEV); Mod_TS_DEPT moddept = daldetp.GetModel(modTmd.C_BUSINESS_DEPT); //业务部门 string saleemp = daluser.GetSaleName(modTmd.C_BUSINESS_ID); //业务人 Mod_TS_USER moduser = daluser.GetModel(modTmd.C_CREATE_ID); //制单人 //0主计量单位,1辅单位 DataTable dt = DbHelperOra.Query("SELECT T.C_ID,T.C_MEASNAME FROM TMB_MEAS T WHERE T.C_ID in('" + item[i].C_UNITIS + "','" + item[i].C_AU_UNITIS + "')").Tables[0]; DataRow drfyfs = DbHelperOra.GetDataRow("select T.C_INDEX from TS_DIC t where t.c_detailcode='" + modTmd.C_SHIPVIA + "'"); #endregion #region //插入条码中间表 strSql.Append("insert into ReZJB_FYD("); strSql.Append("fydh,"); //发运单号- strSql.Append("ck,"); //仓库主键- strSql.Append("khbm,"); //客户编码- strSql.Append("yslb,"); //运输方式主键 strSql.Append("cph,"); //车牌号- strSql.Append("wlh,"); //物料编码- strSql.Append("wlmc,"); //物料名称- strSql.Append("sx,"); //质量等级编码A,B- strSql.Append("jhsl,"); //支数-- strSql.Append("jhzl,"); //重量-- strSql.Append("zjldw,"); //线材主计量单位名称(件【线材】)- strSql.Append("fjldw,"); //吨-- strSql.Append("ywbm,"); //业务部门名称-- strSql.Append("ywry,"); //业务员名称-- strSql.Append("zdr,"); //制单人名称-- strSql.Append("zdrq,"); //制单时间-- strSql.Append("PH,"); //钢种-- strSql.Append("GG,"); //规格-- strSql.Append("ZJBstatus,"); //状态默认0-- strSql.Append("CAPPK,"); //发运单明细表主键-- strSql.Append("insertts,"); //插入时间-- strSql.Append("PCInfo,"); //其他要求名称-- strSql.Append("zyx1,"); //自由项1-- strSql.Append("zyx2,"); //自由项2-- strSql.Append("zyx3,"); //包装要求 strSql.Append("zyx4,"); //导入条码次数 strSql.Append("zldj"); //行备注 strSql.Append(")values("); strSql.Append("'" + item[i].C_DISPATCH_ID + "',"); //发运单号 strSql.Append("'" + item[i].C_SEND_STOCK_PK + "',"); //发运仓库主键 strSql.Append("'" + item[i].C_CUSTNO + "',"); //客户编码 strSql.Append("'" + drfyfs["C_INDEX"].ToString() + "',"); //发运方式主键1汽运 2火运 strSql.Append("'" + modTmd.C_LIC_PLA_NO + "',"); //车牌号 strSql.Append("'" + item[i].C_MAT_CODE + "',"); //物料编码 strSql.Append("'" + item[i].C_MAT_NAME + "',"); //物料编码 strSql.Append("'" + modtqb.C_CHECKSTATE_NAME + "',"); //质量等级名称 strSql.Append("'" + item[i].N_FYZS + "',"); //发运支数 strSql.Append("'" + item[i].N_FYWGT + "',"); //发运重量 strSql.Append("'" + dt.Rows[1]["C_MEASNAME"] + "',"); //线材主计量单位名称(件【线材】) strSql.Append("'" + dt.Rows[0]["C_MEASNAME"] + "',"); //线材主计量单位名称(吨) strSql.Append("'" + moddept.C_NAME + "',"); //业务部门名称 strSql.Append("'" + saleemp + "',"); //业务员名称 strSql.Append("'" + moduser.C_NAME + "',"); //制单人名称 strSql.Append("'" + modTmd.D_CREATE_DT + "',"); //制单时间 strSql.Append("'" + item[i].C_STL_GRD + "',"); //钢种 strSql.Append("'" + item[i].C_SPEC + "',"); //规格 strSql.Append("0,"); //状态 strSql.Append("'" + item[i].C_ID + "',"); //发运单明细表主键 strSql.Append("'" + DateTime.Now.ToString() + "',"); //插入时间 strSql.Append("'" + item[i].C_ELSENEED + "',"); //其他要求 strSql.Append("'" + item[i].C_FREE_TERM + "',"); //自由项1 strSql.Append("'" + item[i].C_FREE_TERM2 + "',"); //自由项2 strSql.Append("'" + item[i].C_PACK + "',"); // 包装要求 strSql.Append("'" + modTmd.C_EXTEND1 + "',"); // 导入条码系统次数 strSql.Append("'" + item[i].C_REMARK + "'"); // 行备注 strSql.Append(");"); #endregion } if (DbHelper_SQL.ExecuteSql(strSql.ToString()) == 0) { return(-2); } return(1); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TMD_DISPATCH model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TMD_DISPATCH("); strSql.Append("C_PLAN_ID,C_GPS_NO,C_NO,C_CON_NO,D_DISP_DT,C_SHIPVIA,C_COMCAR,C_PATH,C_PATH_DESC,C_SEND_DEPT,C_BUSINESS_DEPT,C_BUSINESS_ID,C_IS_WIRESALE,N_IS_EXPORT,C_LIC_PLA_NO,C_ATSTATION,D_APPROVE_DT,D_CREATE_DT,C_APPROVE_ID,C_CREATE_ID,C_STATUS,C_EMP_ID,C_EMP_NAME,D_MOD_DT,C_GUID,C_IS_WIRESALE_ID,C_REMARK,C_REMARK2,D_FAILURE)"); strSql.Append(" values ("); strSql.Append(":C_PLAN_ID,:C_GPS_NO,:C_NO,:C_CON_NO,:D_DISP_DT,:C_SHIPVIA,:C_COMCAR,:C_PATH,:C_PATH_DESC,:C_SEND_DEPT,:C_BUSINESS_DEPT,:C_BUSINESS_ID,:C_IS_WIRESALE,:N_IS_EXPORT,:C_LIC_PLA_NO,:C_ATSTATION,:D_APPROVE_DT,:D_CREATE_DT,:C_APPROVE_ID,:C_CREATE_ID,:C_STATUS,:C_EMP_ID,:C_EMP_NAME,:D_MOD_DT,:C_GUID,:C_IS_WIRESALE_ID,:C_REMARK,:C_REMARK2,:D_FAILURE)"); OracleParameter[] parameters = { new OracleParameter(":C_PLAN_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_GPS_NO", OracleDbType.Varchar2, 100), new OracleParameter(":C_NO", OracleDbType.Varchar2, 100), new OracleParameter(":C_CON_NO", OracleDbType.Varchar2, 100), new OracleParameter(":D_DISP_DT", OracleDbType.Date), new OracleParameter(":C_SHIPVIA", OracleDbType.Varchar2, 100), new OracleParameter(":C_COMCAR", OracleDbType.Varchar2, 100), new OracleParameter(":C_PATH", OracleDbType.Varchar2, 100), new OracleParameter(":C_PATH_DESC", OracleDbType.Varchar2, 200), new OracleParameter(":C_SEND_DEPT", OracleDbType.Varchar2, 100), new OracleParameter(":C_BUSINESS_DEPT", OracleDbType.Varchar2, 100), new OracleParameter(":C_BUSINESS_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_IS_WIRESALE", OracleDbType.Varchar2, 2), new OracleParameter(":N_IS_EXPORT", OracleDbType.Int16, 1), new OracleParameter(":C_LIC_PLA_NO", OracleDbType.Varchar2, 100), new OracleParameter(":C_ATSTATION", OracleDbType.Varchar2, 100), new OracleParameter(":D_APPROVE_DT", OracleDbType.Date), new OracleParameter(":D_CREATE_DT", OracleDbType.Date), new OracleParameter(":C_APPROVE_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_CREATE_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_STATUS", OracleDbType.Varchar2, 100), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_EMP_NAME", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT", OracleDbType.Date), new OracleParameter(":C_GUID", OracleDbType.Varchar2, 100), new OracleParameter(":C_IS_WIRESALE_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_REMARK", OracleDbType.Varchar2, 500), new OracleParameter(":C_REMARK2", OracleDbType.Varchar2, 500), new OracleParameter(":D_FAILURE", OracleDbType.Date) }; parameters[0].Value = model.C_PLAN_ID; parameters[1].Value = model.C_GPS_NO; parameters[2].Value = model.C_NO; parameters[3].Value = model.C_CON_NO; parameters[4].Value = model.D_DISP_DT; parameters[5].Value = model.C_SHIPVIA; parameters[6].Value = model.C_COMCAR; parameters[7].Value = model.C_PATH; parameters[8].Value = model.C_PATH_DESC; parameters[9].Value = model.C_SEND_DEPT; parameters[10].Value = model.C_BUSINESS_DEPT; parameters[11].Value = model.C_BUSINESS_ID; parameters[12].Value = model.C_IS_WIRESALE; parameters[13].Value = model.N_IS_EXPORT; parameters[14].Value = model.C_LIC_PLA_NO; parameters[15].Value = model.C_ATSTATION; parameters[16].Value = model.D_APPROVE_DT; parameters[17].Value = model.D_CREATE_DT; parameters[18].Value = model.C_APPROVE_ID; parameters[19].Value = model.C_CREATE_ID; parameters[20].Value = model.C_STATUS; parameters[21].Value = model.C_EMP_ID; parameters[22].Value = model.C_EMP_NAME; parameters[23].Value = model.D_MOD_DT; parameters[24].Value = model.C_GUID; parameters[25].Value = model.C_IS_WIRESALE_ID; parameters[26].Value = model.C_REMARK; parameters[27].Value = model.C_REMARK2; parameters[28].Value = model.D_FAILURE; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TMD_DISPATCH model) { return(dal.Add(model)); }
protected void Page_Load(object sender, EventArgs e) { if (Request.RequestType == "POST") { //接收并读取POST过来的XML文件流 StreamReader reader = new StreamReader(Request.InputStream); String xmlData = reader.ReadToEnd(); List <ApiDispDto> apiDispList = new List <ApiDispDto>(); #region //读取WL实绩XML XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlData); string sendcode = string.Empty;//发运单号 XmlNodeList headlist = xmlDoc.SelectNodes("//bill/bill_head"); foreach (XmlNode item in headlist) { sendcode = item["vdelivbillcode"].InnerText; } XmlNodeList ndlist = xmlDoc.SelectNodes("//bill/bill_body"); //xmlDoc.GetElementsByTagName("bill_body"); foreach (XmlNode item1 in ndlist) { XmlNodeList ndlist2 = item1.ChildNodes; foreach (XmlNode item2 in ndlist2) { if (item2["nnetwgt"].InnerText != "") { ApiDispDto mod = new ApiDispDto(); mod.sendcode = sendcode; //发运单 mod.pkid = item2["vfree10"].InnerText; //发运单表体主键 mod.matcode = item2["vinvcode"].InnerText; //存货编码 mod.mzdate = item2["vuserdef1"].InnerText; //毛重日期 mod.mztime = item2["vuserdef6"].InnerText; //毛重时间 mod.mwgt = item2["vuserdef2"].InnerText; //毛重 mod.pzdate = item2["vuserdef3"].InnerText; //皮重日期 mod.pztime = item2["vuserdef7"].InnerText.Trim(); //皮重时间 mod.pwgt = item2["vuserdef4"].InnerText; //皮重 mod.jwgt = item2["nnetwgt"].InnerText; //净重 apiDispList.Add(mod); } } } string ss = "ss" + DateTime.Now.Second.ToString(); string filePath2 = "~/FileInterface/download/wlsj" + sendcode + ss + ".xml"; string xmlfile2 = Server.MapPath(filePath2); xmlDoc.Save(xmlfile2); #endregion //更新物流实绩到发运单明细并钢种库存与发运单NC中间表 if (apiDispList.Count > 0) { #region //检测发运单物流实绩是否导入NC Mod_TMD_DISPATCH modDisp = tmd_dispatch.GetModel(sendcode); if (modDisp != null) { if (modDisp.C_STATUS == "9")//钢坯实绩已导入NC { BackMsg("N", "异常信息:钢坯实绩已导入NC", sendcode); } else { int result = tmd_dispatchdetails.WL_SJ(apiDispList); #region //钢坯 bool res = true; DataTable dt = tmd_dispatchdetails.GetZJBList(sendcode).Tables[0]; if (dt.Rows.Count > 0)//有实绩 { for (int i = 0; i < dt.Rows.Count; i++) { if (string.IsNullOrEmpty(dt.Rows[i]["N_JZ"].ToString())) { res = false; } } if (res) { //发运实绩净重,导入NC ApiWL_SJ apiwl_sj = new ApiWL_SJ(); string filename = "wlsj_nc" + sendcode; string filePath = "~/FileInterface/download/" + filename + ".xml"; string xmlfile = Server.MapPath(filePath); apiwl_sj.SendXml_DM(xmlfile, sendcode, apiDispList); BackMsg("Y", "接收成功", sendcode); } else { BackMsg("Y", "接收成功", sendcode); } } else { BackMsg("Y", "接收成功", sendcode); } #endregion #region //副产品 //if(modDisp.C_EXTEND5=="6")//钢坯 //{ //} //else //{ // if(tmd_dispatchdetails.WL_SJ_F(apiDispList)) // { // #region //辅产品 发运实绩净重,导入NC // ApiWL_SJ_F apiwl_sj_f = new ApiWL_SJ_F(); // string filename = "wlsj_nc" + sendcode; // string filePath = "~/FileInterface/download/" + filename + ".xml"; // string xmlfile = Server.MapPath(filePath); // apiwl_sj_f.SendXml_DM(xmlfile, sendcode); // #endregion // BackMsg("Y", "接收成功", sendcode); // } //} #endregion } } else { BackMsg("N", "当前发运单系统不存在", sendcode); } #endregion } else { BackMsg("N", "异常信息:没有重量", sendcode); } } }
/// <summary> /// 更新发运单车牌号 /// </summary> /// <param name="sendcode">发运单号</param> /// <param name="ch">车牌号</param> /// <returns></returns> public bool UpdateFyd_CH(Mod_TMD_DISPATCH modhead) { return(dal.UpdateFyd_CH(modhead)); }
/// <summary> /// 批量更新发运单 /// </summary> /// <param name="modhead"></param> /// <param name="item"></param> /// <returns></returns> public bool UpdateFYD(Mod_TMD_DISPATCH modhead, List <Mod_TMD_DISPATCHDETAILS> item) { return(dal.UpdateFYD(modhead, item)); }
/// <summary> ///批量添加发运单 /// </summary> /// <param name="modhead">表头</param> /// <param name="item">表体</param> /// <returns></returns> public bool InsertFYD(Mod_TMD_DISPATCH modhead, List <Mod_TMD_DISPATCHDETAILS> item) { return(dal.InsertFYD(modhead, item)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TMD_DISPATCH model) { return(dal.Update(model)); }
/// <summary> /// 加载发运单信息 /// </summary> private void BindList() { dtOrder.Clear(); if (!string.IsNullOrEmpty(txtsendcode.Text)) { #region //加载表头信息 Mod_TMD_DISPATCH mod = tmd_dispatch.GetModel(txtsendcode.Text); if (mod != null) { ltlpkid.Text = mod.C_GUID;//NC主键 txtfydt.Text = Convert.ToDateTime(mod.D_DISP_DT).ToString("yyy-MM-dd"); dropfyfs.SelectedIndex = dropfyfs.Items.IndexOf(dropfyfs.Items.FindByValue(mod.C_SHIPVIA)); txtcph.Enabled = mod.C_SHIPVIA == "0001NC10000000003ILQ" ? true : false; //火运 dropsfxc.SelectedIndex = dropsfxc.Items.IndexOf(dropsfxc.Items.FindByValue(mod.C_IS_WIRESALE_ID)); dropcys.SelectedIndex = dropcys.Items.IndexOf(dropcys.Items.FindByValue(mod.C_COMCAR)); if (dropsfxc.SelectedItem.Text == "是") { btntm.Visible = true; btnwl.Visible = false; } else { btntm.Visible = false; btnwl.Visible = true; } txtdz.Text = mod.C_ATSTATION; txtcph.Text = mod.C_LIC_PLA_NO; txtgps.Text = mod.C_GPS_NO; txtzdr.Text = GetUserName(mod.C_CREATE_ID); //制单人 txtzddt.Text = Convert.ToDateTime(mod.D_CREATE_DT).ToString("yyy-MM-dd"); txtxgr.Text = GetUserName(mod.C_EMP_ID); //修改人 txtxgtime.Text = Convert.ToDateTime(mod.D_MOD_DT).ToString(); txtspr.Text = GetUserName(mod.C_APPROVE_ID); //审批人 if (Convert.ToDateTime(mod.D_APPROVE_DT).ToString("yyy-MM-dd") != "001-01-01") { txtspdt.Text = Convert.ToDateTime(mod.D_APPROVE_DT).ToString("yyy-MM-dd"); } hidstatus.Value = mod.C_STATUS; ltltype.Text = mod.C_EXTEND5; txtfyqua.Value = mod.N_QUA.ToString(); //发运支数 txtfywgt.Value = mod.N_WGT.ToString(); //发运重量 ltlimport_num.Text = mod.C_EXTEND1.ToString(); //记录导入条码系统次数 #region //发运量控制 //DataTable dtfywgt = GetData("DM001"); //if (dtfywgt.Rows.Count > 0) //{ // decimal num = 0; // if (!string.IsNullOrEmpty(dtfywgt.Rows[0]["C_DETAILCODE"].ToString()) && !string.IsNullOrEmpty(txtfywgt.Value)) // { // num = Convert.ToDecimal(dtfywgt.Rows[0]["C_DETAILCODE"].ToString()); // decimal fywgt = Convert.ToDecimal(txtfywgt.Value); // decimal fd = fywgt * num; // hidsf.Value = Convert.ToString(fywgt + fd);//上幅数 // hidxf.Value = Convert.ToString(fywgt - fd);//下幅数 // hidmsg.Value = dtfywgt.Rows[0]["C_DETAILNAME"].ToString();//提示发运数量总和幅度上下5% // } //} #endregion #region //操作按钮/输入框权限显示 txtcph.Enabled = mod.C_STATUS == "0" ? true : false; //车牌号 btn(mod.C_STATUS); //按钮状态 #endregion #region //加载表体信息 DataTable dt = tmd_dispatchdetails.GetList(txtsendcode.Text).Tables[0]; if (dt.Rows.Count > 0) { txtcount.Value = dt.Compute("sum(N_FYZS)", "true").ToString(); txtsumwgt.Value = dt.Compute("sum(N_FYWGT)", "true").ToString(); rptList.DataSource = dt; rptList.DataBind(); } else { rptList.DataSource = null; rptList.DataBind(); txtcount.Value = ""; txtsumwgt.Value = ""; } #endregion } #endregion } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TMD_DISPATCH model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TMD_DISPATCH set "); strSql.Append("C_PLAN_ID=:C_PLAN_ID,"); strSql.Append("C_GPS_NO=:C_GPS_NO,"); strSql.Append("C_NO=:C_NO,"); strSql.Append("C_CON_NO=:C_CON_NO,"); strSql.Append("D_DISP_DT=:D_DISP_DT,"); strSql.Append("C_SHIPVIA=:C_SHIPVIA,"); strSql.Append("C_COMCAR=:C_COMCAR,"); strSql.Append("C_PATH=:C_PATH,"); strSql.Append("C_PATH_DESC=:C_PATH_DESC,"); strSql.Append("C_SEND_DEPT=:C_SEND_DEPT,"); strSql.Append("C_BUSINESS_DEPT=:C_BUSINESS_DEPT,"); strSql.Append("C_BUSINESS_ID=:C_BUSINESS_ID,"); strSql.Append("C_IS_WIRESALE=:C_IS_WIRESALE,"); strSql.Append("N_IS_EXPORT=:N_IS_EXPORT,"); strSql.Append("C_LIC_PLA_NO=:C_LIC_PLA_NO,"); strSql.Append("C_ATSTATION=:C_ATSTATION,"); strSql.Append("D_APPROVE_DT=:D_APPROVE_DT,"); strSql.Append("D_CREATE_DT=:D_CREATE_DT,"); strSql.Append("C_APPROVE_ID=:C_APPROVE_ID,"); strSql.Append("C_CREATE_ID=:C_CREATE_ID,"); strSql.Append("C_STATUS=:C_STATUS,"); strSql.Append("C_EMP_ID=:C_EMP_ID,"); strSql.Append("C_EMP_NAME=:C_EMP_NAME,"); strSql.Append("D_MOD_DT=:D_MOD_DT,"); strSql.Append("C_GUID=:C_GUID,"); strSql.Append("C_IS_WIRESALE_ID=:C_IS_WIRESALE_ID,"); strSql.Append("C_REMARK=:C_REMARK,"); strSql.Append("C_REMARK2=:C_REMARK2,"); strSql.Append("D_FAILURE=:D_FAILURE"); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_PLAN_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_GPS_NO", OracleDbType.Varchar2, 100), new OracleParameter(":C_NO", OracleDbType.Varchar2, 100), new OracleParameter(":C_CON_NO", OracleDbType.Varchar2, 100), new OracleParameter(":D_DISP_DT", OracleDbType.Date), new OracleParameter(":C_SHIPVIA", OracleDbType.Varchar2, 100), new OracleParameter(":C_COMCAR", OracleDbType.Varchar2, 100), new OracleParameter(":C_PATH", OracleDbType.Varchar2, 100), new OracleParameter(":C_PATH_DESC", OracleDbType.Varchar2, 200), new OracleParameter(":C_SEND_DEPT", OracleDbType.Varchar2, 100), new OracleParameter(":C_BUSINESS_DEPT", OracleDbType.Varchar2, 100), new OracleParameter(":C_BUSINESS_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_IS_WIRESALE", OracleDbType.Varchar2, 2), new OracleParameter(":N_IS_EXPORT", OracleDbType.Int16, 1), new OracleParameter(":C_LIC_PLA_NO", OracleDbType.Varchar2, 100), new OracleParameter(":C_ATSTATION", OracleDbType.Varchar2, 100), new OracleParameter(":D_APPROVE_DT", OracleDbType.Date), new OracleParameter(":D_CREATE_DT", OracleDbType.Date), new OracleParameter(":C_APPROVE_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_CREATE_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_STATUS", OracleDbType.Varchar2, 100), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_EMP_NAME", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT", OracleDbType.Date), new OracleParameter(":C_GUID", OracleDbType.Varchar2, 100), new OracleParameter(":C_IS_WIRESALE_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_REMARK", OracleDbType.Varchar2, 500), new OracleParameter(":C_REMARK2", OracleDbType.Varchar2, 500), new OracleParameter(":D_FAILURE", OracleDbType.Date), new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_PLAN_ID; parameters[1].Value = model.C_GPS_NO; parameters[2].Value = model.C_NO; parameters[3].Value = model.C_CON_NO; parameters[4].Value = model.D_DISP_DT; parameters[5].Value = model.C_SHIPVIA; parameters[6].Value = model.C_COMCAR; parameters[7].Value = model.C_PATH; parameters[8].Value = model.C_PATH_DESC; parameters[9].Value = model.C_SEND_DEPT; parameters[10].Value = model.C_BUSINESS_DEPT; parameters[11].Value = model.C_BUSINESS_ID; parameters[12].Value = model.C_IS_WIRESALE; parameters[13].Value = model.N_IS_EXPORT; parameters[14].Value = model.C_LIC_PLA_NO; parameters[15].Value = model.C_ATSTATION; parameters[16].Value = model.D_APPROVE_DT; parameters[17].Value = model.D_CREATE_DT; parameters[18].Value = model.C_APPROVE_ID; parameters[19].Value = model.C_CREATE_ID; parameters[20].Value = model.C_STATUS; parameters[21].Value = model.C_EMP_ID; parameters[22].Value = model.C_EMP_NAME; parameters[23].Value = model.D_MOD_DT; parameters[24].Value = model.C_GUID; parameters[25].Value = model.C_IS_WIRESALE_ID; parameters[26].Value = model.C_REMARK; parameters[27].Value = model.C_REMARK2; parameters[28].Value = model.D_FAILURE; parameters[29].Value = model.C_ID; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
private void btn_FY_Click(object sender, EventArgs e) { if (gv_FYD.FocusedRowHandle < 0) { MessageBox.Show("未选中发运单!"); return; } string fydstr = gv_FYD.GetRowCellValue(gv_FYD.FocusedRowHandle, "C_ID").ToString(); string num = gv_FYD.GetRowCellValue(gv_FYD.FocusedRowHandle, "N_NUM").ToString(); string sjnum = gv_FYD.GetRowCellValue(gv_FYD.FocusedRowHandle, "SJSL").ToString(); if (bll_Interface_WL.GetFYDZT(fydstr) != "4") { MessageBox.Show("该发运单状态已变更!"); FYDQuery(); return; } if (sjnum == "") { sjnum = "0"; } int[] row = gv_GP.GetSelectedRows(); ///判断选中库存支数是否超出发运单支数 int sjzs = 0; foreach (var item in row) { sjzs += Convert.ToInt32(gv_GP.GetRowCellValue(item, "N_SNUM"));//获取当前选中行计划支数 } int yxzs = Convert.ToInt32(num) - Convert.ToInt32(sjnum); if (sjzs > yxzs) { MessageBox.Show("选中数量超出!当前选中" + sjzs + "条,应选中" + yxzs + "条!"); return; } List <CommonKC> list = new List <CommonKC>(); foreach (var item in row) { int qua = Convert.ToInt32(gv_GP.GetRowCellValue(item, "N_QUA")); //获取当前选中行数量 int zs = Convert.ToInt32(gv_GP.GetRowCellValue(item, "N_SNUM")); //获取当前选中行计划支数 string mat = gv_GP.GetRowCellValue(item, "C_MAT_CODE").ToString(); //获取当前选中行物料号; string ck = gv_GP.GetRowCellValue(item, "C_SLABWH_CODE").ToString(); //获取当前选中行仓库 string qy = gv_GP.GetRowCellValue(item, "C_SLABWH_AREA_CODE").ToString(); //获取当前选中行仓库 string kw = gv_GP.GetRowCellValue(item, "C_SLABWH_LOC_CODE").ToString(); //获取当前选中行仓库 string stove = gv_GP.GetRowCellValue(item, "C_STOVE").ToString(); //获取当前选中行批号 string batch = gv_GP.GetRowCellValue(item, "C_BATCH_NO").ToString(); //获取当前选中行批号 string zldj = gv_GP.GetRowCellValue(item, "C_JUDGE_LEV_ZH").ToString(); //获取当前选中行质量等级 int szs = bll_TSC_SLAB_MAIN.CKKC(mat, ck, stove, batch); if (qua != szs) //验证数量 { MessageBox.Show("批号:" + batch + "库存数量已变更!"); GPQuery(); return; } if (qua < zs) { MessageBox.Show("数量超出请修改!"); return; } CommonKC commonKC = new CommonKC(); commonKC.batch = batch; commonKC.ck = ck; commonKC.kw = kw; commonKC.mat = mat; commonKC.num = zs; commonKC.qy = qy; commonKC.stove = stove; commonKC.zldj = zldj; list.Add(commonKC); } if (bll_TSC_SLAB_MAIN.UPSLABSTATUS(list, fydstr, "1") != 1) { MessageBox.Show("实绩标记失败!"); return; } if (bll_TSC_SLAB_MAIN.GetSJCount(fydstr) == Convert.ToInt32(num)) { Mod_TMD_DISPATCH mod_TMD_DISPATCH = bll_TMD_DISPATCH.GetModel(fydstr); mod_TMD_DISPATCH.C_STATUS = "7";//实绩已标记状态 bll_TMD_DISPATCH.Update(mod_TMD_DISPATCH); if (bll_Interface_WL.ADDFYDToZJB(fydstr, de_SJ.DateTime) == "1") { MessageBox.Show("实绩已全部标记!"); GPQuery(); FYDQuery(); SJQuery(); return; } } MessageBox.Show("实绩标记成功!"); GPQuery(); FYDQuery(); SJQuery(); }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TMD_DISPATCH DataRowToModel(DataRow row) { Mod_TMD_DISPATCH model = new Mod_TMD_DISPATCH(); if (row != null) { if (row["C_ID"] != null) { model.C_ID = row["C_ID"].ToString(); } if (row["C_PLAN_ID"] != null) { model.C_PLAN_ID = row["C_PLAN_ID"].ToString(); } if (row["C_GPS_NO"] != null) { model.C_GPS_NO = row["C_GPS_NO"].ToString(); } if (row["C_NO"] != null) { model.C_NO = row["C_NO"].ToString(); } if (row["C_CON_NO"] != null) { model.C_CON_NO = row["C_CON_NO"].ToString(); } if (row["D_DISP_DT"] != null && row["D_DISP_DT"].ToString() != "") { model.D_DISP_DT = DateTime.Parse(row["D_DISP_DT"].ToString()); } if (row["C_SHIPVIA"] != null) { model.C_SHIPVIA = row["C_SHIPVIA"].ToString(); } if (row["C_COMCAR"] != null) { model.C_COMCAR = row["C_COMCAR"].ToString(); } if (row["C_PATH"] != null) { model.C_PATH = row["C_PATH"].ToString(); } if (row["C_PATH_DESC"] != null) { model.C_PATH_DESC = row["C_PATH_DESC"].ToString(); } if (row["C_SEND_DEPT"] != null) { model.C_SEND_DEPT = row["C_SEND_DEPT"].ToString(); } if (row["C_BUSINESS_DEPT"] != null) { model.C_BUSINESS_DEPT = row["C_BUSINESS_DEPT"].ToString(); } if (row["C_BUSINESS_ID"] != null) { model.C_BUSINESS_ID = row["C_BUSINESS_ID"].ToString(); } if (row["C_IS_WIRESALE"] != null) { model.C_IS_WIRESALE = row["C_IS_WIRESALE"].ToString(); } if (row["N_IS_EXPORT"] != null && row["N_IS_EXPORT"].ToString() != "") { model.N_IS_EXPORT = decimal.Parse(row["N_IS_EXPORT"].ToString()); } if (row["C_LIC_PLA_NO"] != null) { model.C_LIC_PLA_NO = row["C_LIC_PLA_NO"].ToString(); } if (row["C_ATSTATION"] != null) { model.C_ATSTATION = row["C_ATSTATION"].ToString(); } if (row["D_APPROVE_DT"] != null && row["D_APPROVE_DT"].ToString() != "") { model.D_APPROVE_DT = DateTime.Parse(row["D_APPROVE_DT"].ToString()); } if (row["D_CREATE_DT"] != null && row["D_CREATE_DT"].ToString() != "") { model.D_CREATE_DT = DateTime.Parse(row["D_CREATE_DT"].ToString()); } if (row["C_APPROVE_ID"] != null) { model.C_APPROVE_ID = row["C_APPROVE_ID"].ToString(); } if (row["C_CREATE_ID"] != null) { model.C_CREATE_ID = row["C_CREATE_ID"].ToString(); } if (row["C_STATUS"] != null) { model.C_STATUS = row["C_STATUS"].ToString(); } if (row["C_EMP_ID"] != null) { model.C_EMP_ID = row["C_EMP_ID"].ToString(); } if (row["C_EMP_NAME"] != null) { model.C_EMP_NAME = row["C_EMP_NAME"].ToString(); } if (row["D_MOD_DT"] != null && row["D_MOD_DT"].ToString() != "") { model.D_MOD_DT = DateTime.Parse(row["D_MOD_DT"].ToString()); } if (row["C_GUID"] != null) { model.C_GUID = row["C_GUID"].ToString(); } if (row["C_IS_WIRESALE_ID"] != null) { model.C_IS_WIRESALE_ID = row["C_IS_WIRESALE_ID"].ToString(); } if (row["C_REMARK"] != null) { model.C_REMARK = row["C_REMARK"].ToString(); } if (row["C_REMARK2"] != null) { model.C_REMARK2 = row["C_REMARK2"].ToString(); } if (row["D_FAILURE"] != null && row["D_FAILURE"].ToString() != "") { model.D_FAILURE = DateTime.Parse(row["D_FAILURE"].ToString()); } } return(model); }
/// <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; } }
/// <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()); } }
/// <summary> /// 添加发运单 /// </summary> /// <returns></returns> private bool InsertFyd() { decimal fyzs = 0; decimal fywgt = 0; string sendcode = randomnumber.CreateDispID(); //发运单据号 #region //表体 List <Mod_TMD_DISPATCHDETAILS> item = new List <Mod_TMD_DISPATCHDETAILS>(); //发运明显 List <Mod_TMC_TRAIN_ITEM> trainList = new List <Mod_TMC_TRAIN_ITEM>(); //火运计划申请明显 for (int i = 0; i < rptList.Items.Count; i++) { HtmlInputCheckBox chkOrder = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkOrder"); //订单主键 HtmlInputText txtfyzs = (HtmlInputText)rptList.Items[i].FindControl("txtfyzs"); //发运支数 HtmlInputText txtjhfyl = (HtmlInputText)rptList.Items[i].FindControl("txtjhfyl"); //发运数量 HtmlInputHidden hidC_CGID = (HtmlInputHidden)rptList.Items[i].FindControl("hidC_CGID"); //收货单位 HtmlInputHidden hidshdq = (HtmlInputHidden)rptList.Items[i].FindControl("hidshdq"); //收货地区 TextBox txtPack_Code = (TextBox)rptList.Items[i].FindControl("txtPack_Code"); //包装要求 DropDownList dropzldj = (DropDownList)rptList.Items[i].FindControl("dropzldj"); //质量等级 DropDownList dropshdz = (DropDownList)rptList.Items[i].FindControl("dropshdz"); //收货地址 Literal ltlpkplan = (Literal)rptList.Items[i].FindControl("ltlpkplan"); //日计划主键 Literal ltlcustno = (Literal)rptList.Items[i].FindControl("ltlcustno"); //客户编码 HtmlInputHidden hidckid = (HtmlInputHidden)rptList.Items[i].FindControl("hidckid"); //仓库ID HtmlInputText txtckname = (HtmlInputText)rptList.Items[i].FindControl("txtckname"); //仓库名称 HtmlInputText txtqtyq = (HtmlInputText)rptList.Items[i].FindControl("txtqtyq"); //其他要求 HtmlInputText txtremark = (HtmlInputText)rptList.Items[i].FindControl("txtremark"); //行备注 HtmlInputText txtaddr = (HtmlInputText)rptList.Items[i].FindControl("txtaddr"); //到货地点 HtmlInputText txtprice = (HtmlInputText)rptList.Items[i].FindControl("txtprice"); //费用 TextBox txtStd_Code = (TextBox)rptList.Items[i].FindControl("txtStd_Code"); //执行标准 TextBox txtC_FREE1 = (TextBox)rptList.Items[i].FindControl("txtC_FREE1"); //自由项1 TextBox txtC_FREE2 = (TextBox)rptList.Items[i].FindControl("txtC_FREE2"); //自由项2 Mod_TMO_ORDER modOrder = tmo_order.GetModel(chkOrder.Value); if (modOrder != null) { fyzs += Convert.ToDecimal(txtfyzs.Value ?? "0"); fywgt += Convert.ToDecimal(txtjhfyl.Value ?? "0"); Mod_TMD_DISPATCHDETAILS modfyditem = new Mod_TMD_DISPATCHDETAILS(); modfyditem.C_DISPATCH_ID = sendcode; //发运单单据号 modfyditem.C_MAT_CODE = modOrder.C_MAT_CODE; //物料编码 modfyditem.C_MAT_NAME = modOrder.C_MAT_NAME; //物料名称 modfyditem.C_SPEC = modOrder.C_SPEC; //规格 modfyditem.C_STL_GRD = modOrder.C_STL_GRD; //钢种 modfyditem.C_QUALIRY_LEV = dropzldj.SelectedItem.Value; //质量等级主键-发运单 modfyditem.C_JUDGE_LEV_ZH = dropzldj.SelectedItem.Text; //质量等级编码 modfyditem.C_FREE_TERM = txtC_FREE1.Text; //自由项 modfyditem.C_FREE_TERM2 = txtC_FREE2.Text; //自由项 modfyditem.C_PACK = txtPack_Code.Text; //包装要求 modfyditem.C_STD_CODE = txtStd_Code.Text; //执行标准 modfyditem.C_ELSENEED = txtqtyq.Value; //其他要求? modfyditem.C_REMARK = txtremark.Value; //行备注***** modfyditem.N_COM_AMOUNT_WGT = modOrder.N_FNUM; //原始订单辅数量 modfyditem.N_WGT = modOrder.N_WGT; //原始订单数量 modfyditem.C_EQUATION_FACTOR = modOrder.N_HSL.ToString(); //换算率 modfyditem.C_UNITIS = modOrder.C_UNITID; //主计量单位ID modfyditem.C_ORGO_CUST = modOrder.C_CUST_NAME; //订货客户 modfyditem.C_CGC = hidC_CGID.Value; //收货单位-发运单 modfyditem.C_ORDER_TYPE = modOrder.N_TYPE.ToString(); //订单类型 8线材 6钢坯 831废乱材 841焦化产品 851渣 modfyditem.C_SEND_AREA = hidshdq.Value; //到货地区-发运单 modfyditem.C_AREA = dropshdz.SelectedItem?.Value ?? ""; //到货地址-发运单 modfyditem.C_EMP_ID = ltlempid.Text; modfyditem.C_EMP_NAME = ltlempname.Text; modfyditem.C_CON_NO = modOrder.C_CON_NO; //合同号 modfyditem.C_PLAN_ID = ltlpkplan.Text; //日计划主键 modfyditem.C_NO = modOrder.C_ORDER_NO; //订单号 modfyditem.C_ORDERPK = modOrder.C_ID; //订单主键 modfyditem.C_CUSTNO = ltlcustno.Text; //客户编码 modfyditem.N_FYZS = Convert.ToDecimal(txtfyzs.Value == "" ? "0" : txtfyzs.Value); //发运支数 modfyditem.N_FYWGT = Convert.ToDecimal(txtjhfyl.Value == "" ? "0" : txtjhfyl.Value); //发运数量 modfyditem.C_SEND_STOCK = txtckname.Value; //发运仓库名称 modfyditem.C_SEND_STOCK_PK = hidckid.Value; //发运仓库ID modfyditem.C_PRODUCT_ID = ""; //库存产品ID modfyditem.C_AU_UNITIS = modOrder.C_FUNITID; //辅单位 modfyditem.C_AOG_SITE = txtaddr.Value; //到货地点 modfyditem.N_PRICE = Convert.ToDecimal(txtprice.Value == "" ? "0" : txtprice.Value); //到货地点费用 item.Add(modfyditem); #region //火运计划明细 Mod_TS_CUSTFILE modCustInfo = ts_custfile.GetCustInfo(txtkpdwcode.Text == "" ? modOrder.C_CUST_NO : txtkpdwcode.Text); var modTrainItem = new Mod_TMC_TRAIN_ITEM() { C_EMPNAME = ltlempname.Text, //提报人 C_PKID = sendcode, //发运单号 C_AREA = modOrder.C_AREA, //区域 C_CONNO = modOrder.C_CON_NO, //合同号 C_DH_COMPANY = modOrder.C_CUST_NAME, //订货单位 C_SH_COMPANY = txtshdw.Text == "" ? modOrder.C_CUST_NAME : txtshdw.Text, //收货单位 C_CUSTNO = modCustInfo.C_NO, //客户编码 C_CUSTNAME = modCustInfo.C_NAME, //客户名称 C_KH_BANK = modCustInfo.C_EXTEND1, //开户行 C_TAXNO = modCustInfo.C_TAXPAYERNO, //税号 C_ADDRESS = modCustInfo.C_EXTEND3, //地址 C_TEL = modCustInfo.C_EXTEND4, //电话 C_ACCOUNT = modCustInfo.C_EXTEND2, //账号 C_FLAG = "1", C_BILLCODE = modOrder.C_ORDER_NO, //订单号 C_SPEC = modOrder.C_SPEC, //规格 C_STL_GRD = modOrder.C_STL_GRD, //钢种 N_WGT = Convert.ToDecimal(txtjhfyl.Value == "" ? "0" : txtjhfyl.Value), //发运量 C_REMARK = txtremark.Value //行备注 }; trainList.Add(modTrainItem); #endregion } } #endregion #region//发运表头 Mod_TMD_DISPATCH modfyd = new Mod_TMD_DISPATCH(); modfyd.C_ID = sendcode; //发运单单据号 modfyd.C_GPS_NO = txtgps.Text; //GPS号 modfyd.D_DISP_DT = Convert.ToDateTime(txtfydt.Text); //发运日期 modfyd.C_SHIPVIA = dropfyfs.SelectedItem.Value; //发运方式 modfyd.C_COMCAR = dropcys.SelectedItem.Value; //承运商 modfyd.C_IS_WIRESALE = dropsfxc.SelectedItem.Text; //汉字是否线材 modfyd.C_IS_WIRESALE_ID = dropsfxc.SelectedItem.Value; //是否线材主键 modfyd.C_LIC_PLA_NO = txtcph.Text; //车牌号 modfyd.C_ATSTATION = txtdz.Text; //到站 modfyd.C_CREATE_ID = ltlempid.Text; //制单人 modfyd.C_EMP_ID = ltlempid.Text; //修改人ID modfyd.C_EMP_NAME = ltlempname.Text; //修改人 modfyd.C_EXTEND5 = ltltype.Text; //订单类型 8线材 6钢坯 831废乱材 841焦化产品 851渣 modfyd.C_CUSTNAME = ltlcustname.Text; //客户 modfyd.C_CON_NO = ltlcon_no.Text; //合同号 modfyd.N_QUA = fyzs; //发运支数 modfyd.N_WGT = fywgt; //发运量 //0001NC10000000003ILQ-火运代垫,0001NC10000000003ILR-汽运代垫,0001NC10000000003ILV-自提运输 modfyd.N_IS_EXPORT = dropfyfs.SelectedValue == "0001NC10000000003ILQ" ? 1 : Convert.ToDecimal(dropsfbdj.SelectedValue); //是否包到价 modfyd.C_EXTEND2 = txtxnch.Text == "" ? txtcph.Text : txtxnch.Text; //虚拟车号 modfyd.C_EXTEND4 = txtcust_tel.Text; //客户姓名/电话 modfyd.C_EXTEND3 = txtsjtel.Text; //司机姓名/电话 Mod_TMO_CON modCon = tmo_con.GetModel(ltlcon_no.Text); if (modCon != null) { modfyd.C_BUSINESS_DEPT = modCon.C_DEPTID; //业务部门 modfyd.C_BUSINESS_ID = modCon.C_EMPLOYEEID; //业务员 } #endregion #region //火运计划表头 string fyfalg = ts_dic.GetDicFlag("ShipVia", dropfyfs.SelectedItem.Text); //获取是否下发审核(泰翔)Y/N var modtrain = new Mod_TMC_TRAIN_MAIN() { C_ID = sendcode, C_EMPID = modfyd.C_CREATE_ID, C_EMPNAME = modfyd.C_EMP_NAME, C_STATION = modfyd.C_ATSTATION, C_PLANNO = txtplanno.Text, C_LINE = txtline.Text, C_REMARK = txtshdw.Text, N_TRAIN_NUM = 1, C_SHIPVIA = dropfyfs.SelectedItem.Text, C_ISCHECK = fyfalg == "N" ? "Y" : "N"//Y通过/N未通过 }; #endregion if (tmd_dispatch.InsertFYD(modfyd, item)) { txtsendcode.Text = sendcode; //汽运代垫自动生成汽运计划/火运计划 if (dropfyfs.SelectedValue == "0001NC10000000003ILR" || cbx_sftrain.Checked == true) { #region //自动生成火运/汽运日计划申请 try { tmd_dispatch.AddTrainPlan(modtrain, trainList); } catch (Exception) { return(true); } #endregion } return(true); } else { return(false); } }
/// <summary> /// 加载发运单信息 /// </summary> private void BindList() { dtOrder.Clear(); if (!string.IsNullOrEmpty(txtsendcode.Text)) { #region //加载表头信息 Mod_TMD_DISPATCH mod = tmd_dispatch.GetModel(txtsendcode.Text); if (mod != null) { ltlpkid.Text = mod.C_GUID;//NC主键 txtfydt.Text = Convert.ToDateTime(mod.D_DISP_DT).ToString("yyy-MM-dd"); dropfyfs.SelectedIndex = dropfyfs.Items.IndexOf(dropfyfs.Items.FindByValue(mod.C_SHIPVIA)); txtcph.Enabled = mod.C_SHIPVIA == "0001NC10000000003ILQ" ? true : false; //火运 dropsfxc.SelectedIndex = dropsfxc.Items.IndexOf(dropsfxc.Items.FindByValue(mod.C_IS_WIRESALE_ID)); dropcys.SelectedIndex = dropcys.Items.IndexOf(dropcys.Items.FindByValue(mod.C_COMCAR)); if (dropsfxc.SelectedItem.Text == "是") { btntm.Visible = true; btnwl.Visible = false; } else { btntm.Visible = false; btnwl.Visible = true; } txtdz.Text = mod.C_ATSTATION; txtcph.Text = mod.C_LIC_PLA_NO; txtgps.Text = mod.C_GPS_NO; txtzdr.Text = GetUserName(mod.C_CREATE_ID); //制单人 txtzddt.Text = Convert.ToDateTime(mod.D_CREATE_DT).ToString("yyy-MM-dd"); txtxgr.Text = GetUserName(mod.C_EMP_ID); //修改人 txtxgtime.Text = Convert.ToDateTime(mod.D_MOD_DT).ToString(); txtspr.Text = GetUserName(mod.C_APPROVE_ID); //审批人 if (Convert.ToDateTime(mod.D_APPROVE_DT).ToString("yyy-MM-dd") != "001-01-01") { txtspdt.Text = Convert.ToDateTime(mod.D_APPROVE_DT).ToString("yyy-MM-dd"); } hidstatus.Value = mod.C_STATUS; ltltype.Text = mod.C_EXTEND5; txtfyqua.Value = mod.N_QUA.ToString(); //发运支数 txtfywgt.Value = mod.N_WGT.ToString(); //发运重量 ltlimport_num.Text = mod.C_EXTEND1.ToString(); //记录导入条码系统次数 dropsfbdj.SelectedIndex = dropsfbdj.Items.IndexOf(dropsfbdj.Items.FindByValue(mod.N_IS_EXPORT.ToString())); //是否包到价 txtxnch.Text = mod.C_EXTEND2; //虚拟车号 txtsjxm.Text = mod.C_EXTEND3; //司机姓名 txtsjtel.Text = mod.C_EXTEND4; //司机电话 #region //操作按钮/输入框权限显示 txtcph.Enabled = mod.C_STATUS == "0" ? true : false; //车牌号 txtsjxm.Enabled = mod.C_STATUS == "0" ? true : false; //司机姓名 txtsjtel.Enabled = mod.C_STATUS == "0" ? true : false; //司机电话 btn(mod.C_STATUS); //按钮状态 #endregion #region //加载表体信息 DataTable dt = tmd_dispatchdetails.GetList(txtsendcode.Text).Tables[0]; if (dt.Rows.Count > 0) { txtcount.Value = dt.Compute("sum(N_FYZS)", "true").ToString(); txtsumwgt.Value = dt.Compute("sum(N_FYWGT)", "true").ToString(); rptList.DataSource = dt; rptList.DataBind(); } else { rptList.DataSource = null; rptList.DataBind(); txtcount.Value = ""; txtsumwgt.Value = ""; } #endregion } #endregion } }
/// <summary> /// 修改发运单 /// </summary> /// <returns></returns> private bool UpdateFyd() { decimal fyzs = 0; //发运支数 decimal fywgt = 0; //发运量 #region //表体 List <Mod_TMD_DISPATCHDETAILS> item = new List <Mod_TMD_DISPATCHDETAILS>(); for (int i = 0; i < rptList.Items.Count; i++) { //HtmlInputCheckBox chkOrder = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkOrder");//订单主键 HtmlInputText txtfyzs = (HtmlInputText)rptList.Items[i].FindControl("txtfyzs"); //发运支数 HtmlInputText txtjhfyl = (HtmlInputText)rptList.Items[i].FindControl("txtjhfyl"); //发运数量 HtmlInputHidden hidC_CGID = (HtmlInputHidden)rptList.Items[i].FindControl("hidC_CGID"); //收货单位 HtmlInputHidden hidshdq = (HtmlInputHidden)rptList.Items[i].FindControl("hidshdq"); //收货地区 TextBox txtPack_Code = (TextBox)rptList.Items[i].FindControl("txtPack_Code"); //包装要求 DropDownList dropzldj = (DropDownList)rptList.Items[i].FindControl("dropzldj"); //质量等级 HtmlInputText txtqtyq = (HtmlInputText)rptList.Items[i].FindControl("txtqtyq"); //其他要求 DropDownList dropshdz = (DropDownList)rptList.Items[i].FindControl("dropshdz"); //收货地址 HtmlInputHidden hidckid = (HtmlInputHidden)rptList.Items[i].FindControl("hidckid"); //仓库ID HtmlInputText txtckname = (HtmlInputText)rptList.Items[i].FindControl("txtckname"); //仓库名称 HtmlInputHidden hidpkid = (HtmlInputHidden)rptList.Items[i].FindControl("hidpkid"); //发运单明细主键 HtmlInputText txtremark = (HtmlInputText)rptList.Items[i].FindControl("txtremark"); //行备注 TextBox txtStd_Code = (TextBox)rptList.Items[i].FindControl("txtStd_Code"); //执行标准 TextBox txtC_FREE1 = (TextBox)rptList.Items[i].FindControl("txtC_FREE1"); //自由项1 TextBox txtC_FREE2 = (TextBox)rptList.Items[i].FindControl("txtC_FREE2"); //自由项2 if (!string.IsNullOrEmpty(txtfyzs.Value) & !string.IsNullOrEmpty(txtjhfyl.Value)) { fyzs += Convert.ToDecimal(txtfyzs.Value); fywgt += Convert.ToDecimal(txtjhfyl.Value); } #region //update Mod_TMD_DISPATCHDETAILS modfyditem = tmd_dispatchdetails.GetModel(hidpkid.Value); modfyditem.C_ID = hidpkid.Value; //主键 modfyditem.C_QUALIRY_LEV = dropzldj.SelectedItem.Value; //质量等级主键-发运单 modfyditem.C_JUDGE_LEV_ZH = dropzldj.SelectedItem.Text; //质量等级编码-发运单 modfyditem.C_FREE_TERM = txtC_FREE1.Text; //自由项1 modfyditem.C_FREE_TERM2 = txtC_FREE2.Text; //自由项2 modfyditem.C_STD_CODE = txtStd_Code.Text; //执行标准 modfyditem.C_PACK = txtPack_Code.Text; //包装要求 modfyditem.C_ELSENEED = txtqtyq.Value; //其他要求? modfyditem.C_REMARK = txtremark.Value; //行备注***** modfyditem.C_CGC = hidC_CGID.Value; //收货单位-发运单 modfyditem.C_SEND_AREA = hidshdq.Value; //到货地区-发运单 modfyditem.C_AREA = dropshdz.SelectedItem?.Value ?? ""; //到货地址-发运单 modfyditem.C_EMP_ID = ltlempid.Text; modfyditem.C_EMP_NAME = hidempname.Value; modfyditem.N_FYZS = Convert.ToDecimal(txtfyzs.Value == "" ? "0" : txtfyzs.Value); //发运支数 modfyditem.N_FYWGT = Convert.ToDecimal(txtjhfyl.Value == "" ? "0" : txtjhfyl.Value); //发运数量 modfyditem.C_SEND_STOCK = txtckname.Value; //发运仓库名称 modfyditem.C_SEND_STOCK_PK = hidckid.Value; //发运仓库ID modfyditem.FLAG = "Y"; item.Add(modfyditem); #endregion } #endregion #region //表头 Mod_TMD_DISPATCH modfyd = new Mod_TMD_DISPATCH(); modfyd.C_ID = txtsendcode.Text; //发运单单据号 modfyd.C_GPS_NO = txtgps.Text; //GPS号 modfyd.D_DISP_DT = Convert.ToDateTime(txtfydt.Text); //发运日期 modfyd.C_SHIPVIA = dropfyfs.SelectedItem.Value; //发运方式 modfyd.C_COMCAR = dropcys.SelectedItem.Value; //承运商 modfyd.C_IS_WIRESALE = dropsfxc.SelectedItem.Text; //汉字是否线材 modfyd.C_IS_WIRESALE_ID = dropsfxc.SelectedItem.Value; //是否线材主键 modfyd.C_LIC_PLA_NO = txtcph.Text; //车牌号 modfyd.C_ATSTATION = txtdz.Text; //到站 modfyd.C_EMP_ID = ltlempid.Text; //修改人ID modfyd.C_EMP_NAME = hidempname.Value; //修改人 modfyd.C_EXTEND5 = ltltype.Text; //订单类型 8线材 6钢坯 831废乱材 841焦化产品 851渣 modfyd.N_QUA = fyzs; //发运支数 modfyd.N_WGT = fywgt; //发运量 modfyd.N_IS_EXPORT = Convert.ToDecimal(dropsfbdj.SelectedValue); //是否包到价 modfyd.C_EXTEND2 = txtxnch.Text; //虚拟车号 #endregion if (tmd_dispatch.UpdateFYD(modfyd, item)) { return(true); } else { return(false); } }