/// <summary> /// 补打运单 /// </summary> /// <param name="gr"></param> /// <param name="S"></param> /// <returns></returns> private Model.GeneralReturns SupplementPrint(Model.GeneralReturns gr, Model.M_Print.Request S) { if (String.IsNullOrEmpty(S.operateMan) || String.IsNullOrEmpty(S.operateSite)) { gr.MsgText = "缺少操作人或站点"; gr.State = false; return(gr); } pmw_billcode billcodeInfo = new DAL.Dal_Print().SupplementGetBillCodeInfo(S.repair); if (billcodeInfo == null || string.IsNullOrEmpty(billcodeInfo.packed_billcode)) { gr.MsgText = "无法获取快递单信息"; return(gr); } List <Model.M_Print.Return> reqList = new List <Model.M_Print.Return>(); pmw_order orderInfo = new DAL.Dal_Print().SupplementGetOrderInfo(billcodeInfo.order_code); if (orderInfo == null) { gr.MsgText = "无法获取订单信息"; return(gr); } CFHMPring pringInfo = new DAL.Dal_Print().SupplementGetPrintInfo(billcodeInfo.packed_billcode); if (pringInfo == null) { gr.MsgText = "无法获取打印信息"; return(gr); } pmw_timeBar flightInfo = new DAL.Dal_Print().getFlightTime(orderInfo.timeBarID); if (flightInfo == null) { gr.MsgText = "无法获取航班信息"; return(gr); } GoodsCatalog goodsInfo = new DAL.Dal_Print().getGoodsTypeInfo(orderInfo.goodsType); if (goodsInfo == null) { gr.MsgText = "无法获取货物类型"; return(gr); } string SignerCode = string.Empty, VersionCode = string.Empty, addressCode = string.Empty; secondEJSPushData(pringInfo.deliveryCom, pringInfo.recipientsAdd, out SignerCode, out VersionCode, out addressCode); reqList.Add(new Model.M_Print.Return { WaybillNo = pringInfo.CForHM_number, billcode = pringInfo.KD_billcodeList, employee = S.operateMan, Js_number = (int)pringInfo.TurnNumber, briefCode = goodsInfo.briefCode, goodsType = billcodeInfo.goodsTyep, goodsName = pringInfo.goods, shopName = pringInfo.consolidator, OrderGoodsNotes = orderInfo.OrderGoodsNotes, CusCode = pringInfo.deliveryCode, timeBarName = flightInfo.timeBarName, orderID = orderInfo.id.ToString(), z_weight = pringInfo.netWeight.ToString(), address = pringInfo.recipientsAdd, Phone = pringInfo.recipientsPhone, recipients = pringInfo.recipients, IdentificationGoods = billcodeInfo.goodsTyep.Contains("特") ? "T" : "", ds_mdgj_Free = orderInfo.pay_type == 1 ? pringInfo.freightPayable.ToString() : "0", DFFeer = pringInfo.freightPayable.ToString(), addressCode = addressCode, SignerCode = SignerCode, VersionCode = VersionCode, chargedWeight = orderInfo.Free_Weight.ToString() }); if (reqList.Count > 0) { gr.ReturnJson = DataHandling.ObjToJson(reqList); gr.State = true; gr.Mb = pringInfo.deliveryCom; gr.MsgText = S.operateMan; } else { gr.MsgText = "无法获取打印信息"; } return(gr); }
private Model.GeneralReturns Print(Model.M_Print.Request S) { return(new BLL.Bll_Print().Print(S)); }
public Model.GeneralReturns Print(Model.M_Print.Request S) { Model.GeneralReturns genRet = new Model.GeneralReturns(); if (!string.IsNullOrEmpty(S.repair)) { return(SupplementPrint(genRet, S)); } if (String.IsNullOrEmpty(S.operateMan) || String.IsNullOrEmpty(S.operateSite) || null == S.PackaginBillcode || S.PackaginBillcode.Count == 0) { genRet.MsgText = "参数不全,请核实"; } else { List <Model.M_Print.Return> reqList = new List <Model.M_Print.Return>(); pmw_order orderInfo = new DAL.Dal_Print().getOrderInfo(long.Parse(S.orderID)); int subcontractCount = 0; if (orderInfo.subpackageNum == null || orderInfo.subpackageNum < 1) { subcontractCount = 1; } else { subcontractCount = int.Parse(orderInfo.subpackageNum.ToString()); } for (int i = 1; i <= subcontractCount; i++) { if (orderInfo == null) { genRet.MsgText = "无法获取订单信息"; } else { List <string> billcodeList = new List <string>(); foreach (var billcode in S.PackaginBillcode) { billcodeList.Add(i == 1 ? billcode.billcode : billcode.billcode + "-" + i); } string message = string.Empty; //错误消息 StringBuilder strBuiGoodsCode = new StringBuilder(); //货物类型代码 StringBuilder strBuiGoodsType = new StringBuilder(); //货物类型 StringBuilder strBuiGoodsName = new StringBuilder(); //货物名称 double billcodeWeight = 0; if (!IsPackage(orderInfo.order_code, i, billcodeList, ref message, ref strBuiGoodsType, ref strBuiGoodsName, ref billcodeWeight)) { genRet.MsgText = message; return(genRet); } #region 代收货款 var collectingMoney = orderInfo.pay_type == 1 ? (orderInfo.country_free + orderInfo.agencyFund) : orderInfo.agencyFund; #endregion GoodsCatalog goodsInfo = new DAL.Dal_Print().getGoodsTypeInfo(orderInfo.goodsType); if (goodsInfo == null) { genRet.MsgText = "无法获取货物类型"; return(genRet); } strBuiGoodsCode.Append(goodsInfo.briefCode); pmw_member memberInfo = new DAL.Dal_Print().getMemberInfo(orderInfo.member_id); if (memberInfo == null) { genRet.MsgText = "无法获取会员信息"; return(genRet); } TaoBaoInfo shopInfo = new DAL.Dal_Print().getShopInfo(memberInfo.astro); if (shopInfo == null) { genRet.MsgText = "无法获取店铺信息"; return(genRet); } pmw_house houseInfo = new DAL.Dal_Print().getHouseInfo(long.Parse(S.operateSite)); if (houseInfo == null) { genRet.MsgText = "无法获取仓库信息"; return(genRet); } pmw_timeBar flightInfo = new DAL.Dal_Print().getFlightTime(orderInfo.timeBarID); if (flightInfo == null) { genRet.MsgText = "无法获取航班时效信息"; return(genRet); } PrintConfig printConfigInfo = PrintConfigInfo(orderInfo, S.express); if (printConfigInfo == null) { genRet.MsgText = "无法获取打印配置信息"; return(genRet); } Forwarder forwarderInfo = new DAL.Dal_Print().getForwarderCode(printConfigInfo.pjCom, printConfigInfo.pjCode); if (forwarderInfo == null) { genRet.MsgText = "无法获取派件公司信息"; return(genRet); } Forwarder_number forwarderNoInfo = new DAL.Dal_Print().getPrintNo(forwarderInfo.id); if (forwarderNoInfo == null || string.IsNullOrEmpty(forwarderNoInfo.num)) { genRet.MsgText = "无法获取单号"; return(genRet); } string printNo = forwarderNoInfo.num; //if (new DAL.Dal_Print().getForwardingAgentNoCount(forwarderInfo.id) < 2001) //{ // try // { // var SentState1 = FastSocket.MaeesgeSend(new MassgeClass() // { // IsSite = true, // Mags = forwarderInfo.ForwarderName, // MagsID = "0", // Mags_Type = "HmOrderCount", // SiteOrUser = new string[] { "客服" } // }, false); // } // catch (Exception ex) // { // } //} string recipients = new DAL.Dal_Print().getRecipientName(orderInfo.cname, orderInfo.id); string sentKdBillcode = string.IsNullOrEmpty(orderInfo.sent_kd_billcode) ? printNo : orderInfo.sent_kd_billcode + "," + printNo; bool dbPrint = new DAL.Dal_Print().Print(Convert.ToDecimal(collectingMoney), orderInfo, sentKdBillcode, S.express.Contains("黑猫") ? "黑猫宅急便" : S.express, recipients, houseInfo, shopInfo, forwarderInfo, billcodeList.ToArray(), strBuiGoodsName.ToString(), S, printNo, billcodeWeight); if (!dbPrint) { new DAL.Dal_Print().ReleaseForwarder_number(forwarderNoInfo); genRet.MsgText = "无法生成运单"; return(genRet); } if (printConfigInfo.pjCom.Contains("国阳")) { ApiHelp.GYHelper gyApi = new ApiHelp.GYHelper(); gyApi.AddData(new ApiHelp.GYHelper.Data() { SentType = S.express.Contains("取货") ? "A02" : "A01", Signer = recipients, SignAddress = orderInfo.address, SignPhone = orderInfo.mobile, SignEmail = memberInfo.email, StoreName = S.express.Contains("取货") ? recipients : "", StoreCode = S.express.Contains("取货") ? orderInfo.customerCode : "", StoreAddress = S.express.Contains("取货") ? orderInfo.address : "", StorePhone = S.express.Contains("取货") ? orderInfo.mobile : "", OrderCode = printNo, GoodsName = strBuiGoodsName.ToString(), GoodsAccount = billcodeList.Count, DsMoney = (int)collectingMoney, Weight = (int)billcodeWeight, SentFastType = GyTransferCompanyCode(S.express) }); gyApi.ToCsv(Common.Entity.ftpPaht, true); } reqList.Add(new Model.M_Print.Return { WaybillNo = printNo, billcode = string.Join(",", billcodeList.ToArray()), employee = S.operateMan, Js_number = billcodeList.Count, briefCode = strBuiGoodsCode.ToString(), goodsType = strBuiGoodsType.ToString(), shopName = shopInfo.Name, OrderGoodsNotes = orderInfo.OrderGoodsNotes, CusCode = forwarderInfo.ForwarderCode, timeBarName = flightInfo.timeBarName, orderID = orderInfo.id.ToString(), z_weight = billcodeWeight.ToString(), address = orderInfo.address, Phone = orderInfo.mobile, recipients = recipients, IdentificationGoods = strBuiGoodsType.ToString().Contains("特") ? "T" : "", ds_mdgj_Free = orderInfo.pay_type == 1 ? Math.Round(Convert.ToDecimal(orderInfo.agencyFund + orderInfo.country_free), 2).ToString() : "0", DFFeer = collectingMoney.ToString(), addressCode = printNo.Substring(6), goodsName = strBuiGoodsName.ToString(), chargedWeight = orderInfo.Free_Weight.ToString() }); genRet.State = true; genRet.Mb = S.express; genRet.ReturnJson = Common.DataHandling.ObjToJson(reqList); genRet.MsgText = S.operateMan; } } } return(genRet); }
/// <summary> /// 记录打单数据 /// </summary> /// <param name="orderInfo"></param> /// <param name="orderSentBillCode"></param> /// <param name="orderSentCompany"></param> /// <param name="recipients"></param> /// <param name="houserInfo"></param> /// <param name="tbInfo"></param> /// <param name="forwarderInfo"></param> /// <param name="billCoderList"></param> /// <param name="goodsName"></param> /// <param name="S"></param> /// <param name="printNo"></param> /// <returns></returns> public bool Print(decimal collectingMoney, pmw_order orderInfo, string orderSentBillCode, string orderSentCompany, string recipients, pmw_house houserInfo, TaoBaoInfo tbInfo, Forwarder forwarderInfo, string[] billCoderList, string goodsName, Model.M_Print.Request S, string printNo, double weightBillcode) { return(Common.Config.StartSqlSugar <bool>((db) => { return db.Ado.UseTran(() => { db.Insertable <pmw_Print>(new pmw_Print { address = orderInfo.address, orderID = orderInfo.id, operateMan = S.operateMan, operateSiteID = SqlFunc.ToInt32(S.operateSite), operateTime = DateTime.Now, WaybillNo = printNo, z_weight = SqlFunc.ToDecimal(weightBillcode) }).ExecuteCommand(); db.Insertable <pmw_track>(new pmw_track { billcode = printNo, scan_time = DateTime.Now, scan_type = "拣货完成", scan_memo = "拣货完毕,快件已拣货完毕,正在打包", scan_site = houserInfo.house_name, scan_emp = S.operateMan }).ExecuteCommand(); db.Updateable <pmw_billcode>(new { is_packed = 1, packed_time = DateTime.Now, packed_emp = S.operateMan, packed_billcode = printNo, packed_code = forwarderInfo.ForwarderCode, packed_kd_com = forwarderInfo.ForwarderName, printID = forwarderInfo.id, is_Big = S.is_Big }) .Where(a => SqlFunc.ContainsArray(billCoderList, a.kd_billcode) && a.order_code == orderInfo.order_code && (SqlFunc.IsNullToInt(a.is_lock) == 0 || SqlFunc.IsNullToInt(a.is_lock) == 2)) .ExecuteCommand(); db.Updateable <pmw_order>(new { is_sented = 1, sent_emp = S.operateMan, sent_time = DateTime.Now, sent_kd_billcode = orderSentBillCode, sent_kd_com = orderSentCompany }) .Where(a => a.id == orderInfo.id) .ExecuteCommand(); db.Insertable <CFHMPring>(new CFHMPring { CForHM_number = printNo, OrderID = orderInfo.id, freightPayable = collectingMoney, goods = goodsName.ToString(), recipients = recipients, consignee = recipients, recipientsAdd = orderInfo.address, recipientsPhone = orderInfo.mobile, recipientsIDCard = orderInfo.RecipientCode, TurnNumber = billCoderList.Length, Order_Notes = orderInfo.order_memo, consolidator = tbInfo.Name, deliveryCom = forwarderInfo.ForwarderName, deliveryCode = forwarderInfo.ForwarderCode, billNumType = "PDA", CFpacked_time = DateTime.Now, CFpacked_billcode = printNo, CFpacked_code = forwarderInfo.ForwarderCode, CFpacked_emp = S.operateMan, CFpacked_kd_com = forwarderInfo.ForwarderName, KD_billcodeList = string.Join(",", billCoderList), houseID = houserInfo.id, houseName = houserInfo.house_name, netWeight = SqlFunc.ToDecimal(weightBillcode) }).ExecuteCommand(); }).IsSuccess; })); }