From 9d80cff47dee59ed75a1bd8d309b948d9fa0edf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 12 Aug 2022 15:20:25 +0800 Subject: [PATCH] 1 --- business/jxcallback/orderman/fake_jd_order.go | 2 +- business/jxcallback/scheduler/defsch/defsch.go | 4 ++-- business/jxutils/netprinter/netprinter.go | 11 +++++------ business/model/const.go | 7 +++++++ business/partner/printer/jxprint/jxprint.go | 2 +- business/partner/printer/jxprint/jxprint_const.go | 4 ++-- business/partner/purchase/jx/localjx/order.go | 6 +++--- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/business/jxcallback/orderman/fake_jd_order.go b/business/jxcallback/orderman/fake_jd_order.go index faedd275b..f712ec9d7 100644 --- a/business/jxcallback/orderman/fake_jd_order.go +++ b/business/jxcallback/orderman/fake_jd_order.go @@ -42,7 +42,7 @@ func (c *OrderManager) notifyNewFakeJdOrder(order *model.GoodsOrder) (err error) realStoreID = storeDetail.LinkStoreID } notifyWxNewFakeJdOrder(order, realStoreID) - netprinter.PrintOrderByOrder4Store(jxcontext.AdminCtx, order, realStoreID) + netprinter.PrintOrderByOrder4Store(jxcontext.AdminCtx, order, realStoreID, "") return err } diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 781b3dd43..9091ef9f2 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -392,7 +392,7 @@ func (s *DefScheduler) OnOrderNew(order *model.GoodsOrder, isPending bool, isAut if order.Flag&model.OrderFlagMaskFake == 0 { utils.CallFuncAsync(func() { // order = setFakeActualPayPrice(order) - netprinter.PrintOrderByOrder(jxcontext.AdminCtx, order) + netprinter.PrintOrderByOrder(jxcontext.AdminCtx, order, model.PrintTypeOrder) //目前暂且认为AdjustCount > 0 就是调整单 if order.AdjustCount > 0 { weixinmsg.NotifyAdjustOrder(order) @@ -1688,7 +1688,7 @@ func (s *DefScheduler) notifyNewOrder(order *model.GoodsOrder, isAuto bool) { if order.Flag&model.OrderFlagMaskFake == 0 && order.VendorID != model.VendorIDEBAI { utils.CallFuncAsync(func() { // order = setFakeActualPayPrice(order) - netprinter.PrintOrderByOrder(jxcontext.AdminCtx, order) + netprinter.PrintOrderByOrder(jxcontext.AdminCtx, order, model.PrintTypeOrder) //目前暂且认为AdjustCount > 0 就是调整单 if order.AdjustCount > 0 { weixinmsg.NotifyAdjustOrder(order) diff --git a/business/jxutils/netprinter/netprinter.go b/business/jxutils/netprinter/netprinter.go index 32db6f0cc..13b97e424 100644 --- a/business/jxutils/netprinter/netprinter.go +++ b/business/jxutils/netprinter/netprinter.go @@ -40,13 +40,13 @@ func PrintOrder(ctx *jxcontext.Context, vendorOrderID string, vendorID int) (pri order.StoreID = storeID order.JxStoreID = storeID } - printResult, err = PrintOrderByOrder(ctx, order) + printResult, err = PrintOrderByOrder(ctx, order, "") } return printResult, err } -func PrintOrderByOrder(ctx *jxcontext.Context, order *model.GoodsOrder) (printResult *partner.PrinterStatus, err error) { - return PrintOrderByOrder4Store(ctx, order, jxutils.GetSaleStoreIDFromOrder(order)) +func PrintOrderByOrder(ctx *jxcontext.Context, order *model.GoodsOrder, printType string) (printResult *partner.PrinterStatus, err error) { + return PrintOrderByOrder4Store(ctx, order, jxutils.GetSaleStoreIDFromOrder(order), printType) } func getStore4Print(db *dao.DaoDB, storeID int) (store *model.Store, err error) { @@ -71,7 +71,7 @@ func getStore4Print(db *dao.DaoDB, storeID int) (store *model.Store, err error) } // PrintOrderByOrder4Store 打印订单信息 -func PrintOrderByOrder4Store(ctx *jxcontext.Context, order *model.GoodsOrder, storeID int) (printResult *partner.PrinterStatus, err error) { +func PrintOrderByOrder4Store(ctx *jxcontext.Context, order *model.GoodsOrder, storeID int, printType string) (printResult *partner.PrinterStatus, err error) { globals.SugarLogger.Debugf("PrintOrderByOrder4Store orderID:%s", order.VendorOrderID) db := dao.GetDB() store, err := getStore4Print(db, storeID) @@ -89,9 +89,8 @@ func PrintOrderByOrder4Store(ctx *jxcontext.Context, order *model.GoodsOrder, st BrandIsPrint: model.NO, } } - bill, _ := partner.CurOrderManager.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID) - printResult, err = handler.PrintOrder(ctx, store, storeDetail, order) + printResult, err = handler.PrintOrder(ctx, store, storeDetail, order, printType) if err == nil { dao.SetOrderPrintFlag(db, ctx.GetUserName(), order.VendorOrderID, order.VendorID, true) } diff --git a/business/model/const.go b/business/model/const.go index 0089be0f6..908d3b555 100644 --- a/business/model/const.go +++ b/business/model/const.go @@ -308,6 +308,13 @@ const ( OperateCopyStoreSkus = 3 //复制门店商品 ) +const ( + PrintTypeOrder = "order" // 京西云打印机:打印订单 + PrintTypeWayBill = "wayBill " // 京西云打印机:打印运单 + PrintTypeStore = "store " // 京西云打印机:门店下线 + PrintTypeEnter = "enter" // 京西云打印机:进店订单 +) + const ( WaybillStatusRefuseFailedGetGoods = -70 WaybillStatusUnknown = 0 diff --git a/business/partner/printer/jxprint/jxprint.go b/business/partner/printer/jxprint/jxprint.go index ea59a08e7..c6d77f592 100644 --- a/business/partner/printer/jxprint/jxprint.go +++ b/business/partner/printer/jxprint/jxprint.go @@ -257,7 +257,7 @@ func (c *PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store, printData[WayBillStatus] = order.VendorStatus // 运单状态 case "store": printData[StoreStatus] = utils.Int2Str(store.Status) // 运单状态 - case "reminder": + case "enter": printData[ReminderStatus] = "1" // 催单 } orderPrint, err := json.Marshal(printData) diff --git a/business/partner/printer/jxprint/jxprint_const.go b/business/partner/printer/jxprint/jxprint_const.go index db91815cd..3c8e3a1fc 100644 --- a/business/partner/printer/jxprint/jxprint_const.go +++ b/business/partner/printer/jxprint/jxprint_const.go @@ -50,7 +50,7 @@ const ( RiderPhone = "riderPhone" // 骑手电话 RejectionReason = "rejectionReason" // 拒收原因 CustcareRefundReason = "custcareRefundReason" // 客服退款理由 - EnterTheStore = "enterTheStore" // 进店 + EnterTheStore = "enterTheStore" // 催单 ) type SkuListPrintOrder struct { @@ -112,7 +112,7 @@ func ManagerOrderPrint(order *model.GoodsOrder, storeTel string, storeDetail *da printOrder[OfficialName] = globals.StoreName bill, _ := partner.CurOrderManager.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID) - printOrder[StoreStatus] = utils.Int2Str(storeDetail.Status) + //printOrder[StoreStatus] = utils.Int2Str(storeDetail.Status) printOrder[RiderVendorId] = utils.Int2Str(bill.WaybillVendorID) printOrder[RiderName] = bill.CourierName printOrder[RiderPhone] = bill.CourierMobile diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index ccb796527..c9ac94033 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -562,7 +562,7 @@ func OnPayFinished(orderPay *model.OrderPay) (err error) { if order.OrderType != model.OrderTypeNormal { // if order.FromStoreID != 0 { if order.OrderType != model.OrderTypeDefendPrice { - netprinter.PrintOrderByOrder(jxcontext.AdminCtx, order) + netprinter.PrintOrderByOrder(jxcontext.AdminCtx, order, model.PrintTypeOrder) } PickupGoods(order, false, "jxadmin") // } @@ -605,7 +605,7 @@ func OnPayFinished(orderPay *model.OrderPay) (err error) { if err != nil { return err } - partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, storeBrandId, storeOrder.ActualPayPrice, model.BrandBillFeeTypeSys, model.BrandBillFeeTypeSys, "","") + partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, storeBrandId, storeOrder.ActualPayPrice, model.BrandBillFeeTypeSys, model.BrandBillFeeTypeSys, "", "") } } case model.PayTypeTL_BrandBillCharge: @@ -616,7 +616,7 @@ func OnPayFinished(orderPay *model.OrderPay) (err error) { brandOrder.OrderFinishedAt = time.Now() brandOrder.Status = model.OrderStatusFinished if _, err = dao.UpdateEntity(dao.GetDB(), brandOrder, "OrderFinishedAt", "Status"); err == nil { - partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, brandOrder.BrandID, brandOrder.ActualPayPrice, model.BrandBillTypeIncome, model.BrandBillFeeTypeCharge, orderPay.VendorOrderID,"") + partner.CurStoreAcctManager.InsertBrandBill(jxcontext.AdminCtx, brandOrder.BrandID, brandOrder.ActualPayPrice, model.BrandBillTypeIncome, model.BrandBillFeeTypeCharge, orderPay.VendorOrderID, "") } } default: