|
@@ -264,11 +264,11 @@ func (e *Waybill) Insert(c *dto.WaybillInsertReq) error {
|
|
|
// 查询地址是否存在
|
|
|
address := model.Address{}
|
|
|
err = e.Orm.Where("address = ? and phone = ? and name = ? and dept_id = ? and address_type = 'consignee'",
|
|
|
- c.SenderAddressDetails, c.SenderAddressPhone, c.SenderAddressName, c.DeptId).First(&address).Error
|
|
|
+ c.ConsigneeAddressDetails, c.ConsigneeAddressPhone, c.ConsigneeAddressName, c.DeptId).First(&address).Error
|
|
|
if err != nil && errors.Is(err, gorm.ErrRecordNotFound) {
|
|
|
- address.Address = c.SenderAddressDetails
|
|
|
- address.Phone = c.SenderAddressPhone
|
|
|
- address.Name = c.SenderAddressName
|
|
|
+ address.Address = c.ConsigneeAddressDetails
|
|
|
+ address.Phone = c.ConsigneeAddressPhone
|
|
|
+ address.Name = c.ConsigneeAddressName
|
|
|
address.DeptId = c.DeptId
|
|
|
address.AddressType = "consignee"
|
|
|
err = tx.Create(&address).Error
|
|
@@ -594,7 +594,7 @@ func (e *Waybill) Receipt(c *dto.WaybillReceiptReq, p *actions.DataPermission) e
|
|
|
}
|
|
|
|
|
|
var lng, lat string
|
|
|
- lng, lat, err = e.GetSite(p.DeptId, coolerBox.Sn, waybillModel.ReceiptTime.String())
|
|
|
+ lng, lat, err = e.GetSite(waybillModel.DeptId, coolerBox.Sn, waybillModel.ReceiptTime.String())
|
|
|
if err != nil {
|
|
|
e.Log.Errorf("获取定位信息失败: %s", err)
|
|
|
return err
|
|
@@ -611,27 +611,30 @@ func (e *Waybill) Receipt(c *dto.WaybillReceiptReq, p *actions.DataPermission) e
|
|
|
// 未下车 直接点签收
|
|
|
if time.Time(task.EndTime).IsZero() {
|
|
|
task.EndTime = model2.Time(time.Now())
|
|
|
- task.UpdateBy = p.UserId
|
|
|
+ //task.UpdateBy = p.UserId
|
|
|
err = tx.Save(&task).Error
|
|
|
if err != nil {
|
|
|
e.Log.Errorf("db error: %s", err)
|
|
|
return errors.New(fmt.Sprintf("保存运单任务信息失败:%s", err))
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ var userId int
|
|
|
+ if p != nil {
|
|
|
+ userId = p.UserId
|
|
|
+ }
|
|
|
// 添加签收记录
|
|
|
Logistics := model.WaybillLogistics{
|
|
|
WaybillNo: c.WaybillNo,
|
|
|
Status: c.Status,
|
|
|
CoolerBoxId: coolerBox.Id,
|
|
|
- UserId: p.UserId,
|
|
|
+ UserId: userId,
|
|
|
Lng: lng,
|
|
|
Lat: lat,
|
|
|
ControlBy: model2.ControlBy{
|
|
|
- CreateBy: p.UserId,
|
|
|
+ CreateBy: userId,
|
|
|
},
|
|
|
DeptBy: model2.DeptBy{
|
|
|
- DeptId: p.DeptId,
|
|
|
+ DeptId: waybillModel.DeptId,
|
|
|
},
|
|
|
ModelTime: model2.ModelTime{
|
|
|
CreatedAt: waybillModel.ReceiptTime,
|