This commit is contained in:
邹宗楠
2022-08-12 15:20:25 +08:00
parent 827b4f2f29
commit 9d80cff47d
7 changed files with 21 additions and 15 deletions

View File

@@ -42,7 +42,7 @@ func (c *OrderManager) notifyNewFakeJdOrder(order *model.GoodsOrder) (err error)
realStoreID = storeDetail.LinkStoreID realStoreID = storeDetail.LinkStoreID
} }
notifyWxNewFakeJdOrder(order, realStoreID) notifyWxNewFakeJdOrder(order, realStoreID)
netprinter.PrintOrderByOrder4Store(jxcontext.AdminCtx, order, realStoreID) netprinter.PrintOrderByOrder4Store(jxcontext.AdminCtx, order, realStoreID, "")
return err return err
} }

View File

@@ -392,7 +392,7 @@ func (s *DefScheduler) OnOrderNew(order *model.GoodsOrder, isPending bool, isAut
if order.Flag&model.OrderFlagMaskFake == 0 { if order.Flag&model.OrderFlagMaskFake == 0 {
utils.CallFuncAsync(func() { utils.CallFuncAsync(func() {
// order = setFakeActualPayPrice(order) // order = setFakeActualPayPrice(order)
netprinter.PrintOrderByOrder(jxcontext.AdminCtx, order) netprinter.PrintOrderByOrder(jxcontext.AdminCtx, order, model.PrintTypeOrder)
//目前暂且认为AdjustCount > 0 就是调整单 //目前暂且认为AdjustCount > 0 就是调整单
if order.AdjustCount > 0 { if order.AdjustCount > 0 {
weixinmsg.NotifyAdjustOrder(order) 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 { if order.Flag&model.OrderFlagMaskFake == 0 && order.VendorID != model.VendorIDEBAI {
utils.CallFuncAsync(func() { utils.CallFuncAsync(func() {
// order = setFakeActualPayPrice(order) // order = setFakeActualPayPrice(order)
netprinter.PrintOrderByOrder(jxcontext.AdminCtx, order) netprinter.PrintOrderByOrder(jxcontext.AdminCtx, order, model.PrintTypeOrder)
//目前暂且认为AdjustCount > 0 就是调整单 //目前暂且认为AdjustCount > 0 就是调整单
if order.AdjustCount > 0 { if order.AdjustCount > 0 {
weixinmsg.NotifyAdjustOrder(order) weixinmsg.NotifyAdjustOrder(order)

View File

@@ -40,13 +40,13 @@ func PrintOrder(ctx *jxcontext.Context, vendorOrderID string, vendorID int) (pri
order.StoreID = storeID order.StoreID = storeID
order.JxStoreID = storeID order.JxStoreID = storeID
} }
printResult, err = PrintOrderByOrder(ctx, order) printResult, err = PrintOrderByOrder(ctx, order, "")
} }
return printResult, err return printResult, err
} }
func PrintOrderByOrder(ctx *jxcontext.Context, order *model.GoodsOrder) (printResult *partner.PrinterStatus, err error) { func PrintOrderByOrder(ctx *jxcontext.Context, order *model.GoodsOrder, printType string) (printResult *partner.PrinterStatus, err error) {
return PrintOrderByOrder4Store(ctx, order, jxutils.GetSaleStoreIDFromOrder(order)) return PrintOrderByOrder4Store(ctx, order, jxutils.GetSaleStoreIDFromOrder(order), printType)
} }
func getStore4Print(db *dao.DaoDB, storeID int) (store *model.Store, err error) { 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 打印订单信息 // 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) globals.SugarLogger.Debugf("PrintOrderByOrder4Store orderID:%s", order.VendorOrderID)
db := dao.GetDB() db := dao.GetDB()
store, err := getStore4Print(db, storeID) store, err := getStore4Print(db, storeID)
@@ -89,9 +89,8 @@ func PrintOrderByOrder4Store(ctx *jxcontext.Context, order *model.GoodsOrder, st
BrandIsPrint: model.NO, 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 { if err == nil {
dao.SetOrderPrintFlag(db, ctx.GetUserName(), order.VendorOrderID, order.VendorID, true) dao.SetOrderPrintFlag(db, ctx.GetUserName(), order.VendorOrderID, order.VendorID, true)
} }

View File

@@ -308,6 +308,13 @@ const (
OperateCopyStoreSkus = 3 //复制门店商品 OperateCopyStoreSkus = 3 //复制门店商品
) )
const (
PrintTypeOrder = "order" // 京西云打印机:打印订单
PrintTypeWayBill = "wayBill " // 京西云打印机:打印运单
PrintTypeStore = "store " // 京西云打印机:门店下线
PrintTypeEnter = "enter" // 京西云打印机:进店订单
)
const ( const (
WaybillStatusRefuseFailedGetGoods = -70 WaybillStatusRefuseFailedGetGoods = -70
WaybillStatusUnknown = 0 WaybillStatusUnknown = 0

View File

@@ -257,7 +257,7 @@ func (c *PrinterHandler) PrintOrder(ctx *jxcontext.Context, store *model.Store,
printData[WayBillStatus] = order.VendorStatus // 运单状态 printData[WayBillStatus] = order.VendorStatus // 运单状态
case "store": case "store":
printData[StoreStatus] = utils.Int2Str(store.Status) // 运单状态 printData[StoreStatus] = utils.Int2Str(store.Status) // 运单状态
case "reminder": case "enter":
printData[ReminderStatus] = "1" // 催单 printData[ReminderStatus] = "1" // 催单
} }
orderPrint, err := json.Marshal(printData) orderPrint, err := json.Marshal(printData)

View File

@@ -50,7 +50,7 @@ const (
RiderPhone = "riderPhone" // 骑手电话 RiderPhone = "riderPhone" // 骑手电话
RejectionReason = "rejectionReason" // 拒收原因 RejectionReason = "rejectionReason" // 拒收原因
CustcareRefundReason = "custcareRefundReason" // 客服退款理由 CustcareRefundReason = "custcareRefundReason" // 客服退款理由
EnterTheStore = "enterTheStore" // 进店 EnterTheStore = "enterTheStore" // 催单
) )
type SkuListPrintOrder struct { type SkuListPrintOrder struct {
@@ -112,7 +112,7 @@ func ManagerOrderPrint(order *model.GoodsOrder, storeTel string, storeDetail *da
printOrder[OfficialName] = globals.StoreName printOrder[OfficialName] = globals.StoreName
bill, _ := partner.CurOrderManager.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID) 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[RiderVendorId] = utils.Int2Str(bill.WaybillVendorID)
printOrder[RiderName] = bill.CourierName printOrder[RiderName] = bill.CourierName
printOrder[RiderPhone] = bill.CourierMobile printOrder[RiderPhone] = bill.CourierMobile

View File

@@ -562,7 +562,7 @@ func OnPayFinished(orderPay *model.OrderPay) (err error) {
if order.OrderType != model.OrderTypeNormal { if order.OrderType != model.OrderTypeNormal {
// if order.FromStoreID != 0 { // if order.FromStoreID != 0 {
if order.OrderType != model.OrderTypeDefendPrice { if order.OrderType != model.OrderTypeDefendPrice {
netprinter.PrintOrderByOrder(jxcontext.AdminCtx, order) netprinter.PrintOrderByOrder(jxcontext.AdminCtx, order, model.PrintTypeOrder)
} }
PickupGoods(order, false, "jxadmin") PickupGoods(order, false, "jxadmin")
// } // }
@@ -605,7 +605,7 @@ func OnPayFinished(orderPay *model.OrderPay) (err error) {
if err != nil { if err != nil {
return err 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: case model.PayTypeTL_BrandBillCharge:
@@ -616,7 +616,7 @@ func OnPayFinished(orderPay *model.OrderPay) (err error) {
brandOrder.OrderFinishedAt = time.Now() brandOrder.OrderFinishedAt = time.Now()
brandOrder.Status = model.OrderStatusFinished brandOrder.Status = model.OrderStatusFinished
if _, err = dao.UpdateEntity(dao.GetDB(), brandOrder, "OrderFinishedAt", "Status"); err == nil { 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: default: