| | |
| | | //wms_operation_details.amount as adjust_amount,wms_operation.id as operation_id,wms_operation.status |
| | | search.Orm = search.Orm. |
| | | Table("wms_location_product_amount"). |
| | | Select(`wms_location_product_amount.id as location_product_amount_id,wms_location.id as location_id,wms_location.name as location_name,material.id as product_id,material.name as product_name,wms_location_product_amount.amount,material.unit,wms_location_product_amount.create_date`). |
| | | Select(`wms_location_product_amount.id as location_product_amount_id,wms_location.id as location_id,wms_location.name as location_name, |
| | | material.id as product_id,material.name as product_name,wms_location_product_amount.amount,material.unit, |
| | | wms_location_product_amount.create_date,material.weight`). |
| | | InnerJoins("inner join material on material.id=wms_location_product_amount.product_id"). |
| | | InnerJoins("inner join wms_location on wms_location.id=wms_location_product_amount.location_id") |
| | | |
| | |
| | | Select("wms_operation.id as operation_id,wms_operation.number,wms_operation.base_operation_type,material.id AS product_id," + |
| | | "material.`name` AS product_name,wms_operation_details.amount,material.unit,wms_operation_details.from_location_id," + |
| | | "from_location.`name` AS from_location,wms_operation_details.to_location_id,to_location.`name` AS to_location," + |
| | | "wms_operation.operation_date as date,wms_operation.`status`,material.weight"). |
| | | "wms_operation.operation_date as date,wms_operation.`status`,material.weight,wms_operation.operation_type_name"). |
| | | InnerJoins("inner join wms_operation_details ON wms_operation_details.operation_id = wms_operation.id"). |
| | | InnerJoins("INNER JOIN material ON material.id = wms_operation_details.product_id"). |
| | | InnerJoins("INNER JOIN wms_location AS from_location ON from_location.id = wms_operation_details.from_location_id"). |
| | |
| | | OperationId int `json:"operationId" gorm:"column:operation_id"` |
| | | Status constvar.OperationStatus `json:"status" gorm:"status"` |
| | | BaseOperationType constvar.BaseOperationType `json:"baseOperationType" gorm:"base_operation_type"` |
| | | Weight decimal.Decimal `gorm:"type:decimal(20,3);comment:重量" json:"weight"` //重量 |
| | | } |
| | | ) |
| | | |
| | |
| | | func SearchHistoryReport(keyword string, operationType constvar.BaseOperationType, page, pageSize int) (recordIds []int, total uint64, err error) { |
| | | var ids []string |
| | | from := (page - 1) * pageSize |
| | | t, err := parseDateString(keyword) |
| | | t, err := time.ParseInLocation("20060102", keyword, time.Local) |
| | | //t, err := parseDateString(keyword) |
| | | m := make(map[string]interface{}) |
| | | if operationType > 0 { |
| | | m["baseOperationType"] = operationType |
| | | } |
| | | if err != nil && t.IsZero() { |
| | | if err != nil || t.IsZero() { |
| | | ids, total, err = blevex.ComplexSearch(HistoryReportIndexName, keyword, m, from, pageSize) |
| | | } else { |
| | | ids, total, err = blevex.TimeSearch(HistoryReportIndexName, t, m, from, pageSize) |