package service
|
|
|
|
import (
|
|
utils2 "leit.com/LAPP_CHEERSSON_BACKEND/utils"
|
|
request2 "leit.com/LAPP_CHEERSSON_BACKEND/utils/k3cloud/struct/request"
|
|
)
|
|
|
|
type STK_InventoryService struct {
|
|
*utils2.K3config
|
|
FormID string
|
|
FieldKeys string
|
|
FUseOrgKey string
|
|
}
|
|
//即时库存 期初库存
|
|
func STK_InventoryInit() *STK_InventoryService {
|
|
voucher := &STK_InventoryService{
|
|
K3config: utils2.K3Obj,
|
|
FormID: "STK_Inventory",
|
|
FieldKeys: "FMaterialId.FNumber,FBaseQty",
|
|
FUseOrgKey:"FStockOrgId="+utils2.K3Obj.FUseOrgId,//库存组织工厂
|
|
//
|
|
}
|
|
return voucher
|
|
}
|
|
|
|
/**
|
|
凭证写入
|
|
*/
|
|
func (_this *STK_InventoryService) Search( FilterString, OrderString string) [][]interface{} {
|
|
var data [][]interface{}
|
|
if FilterString != ""{
|
|
FilterString = _this.FUseOrgKey+" And "+FilterString
|
|
}else{
|
|
FilterString = _this.FUseOrgKey
|
|
}
|
|
request := request2.SearchRequest{
|
|
Formid: _this.FormID,
|
|
FieldKeys: _this.FieldKeys,
|
|
FilterString: FilterString,
|
|
OrderString: OrderString,
|
|
TopRowCount: 0,
|
|
StartRow: 0,
|
|
Limit: 1000,
|
|
}
|
|
|
|
for true {
|
|
response, err := _this.SearchApi(_this.FormID, request)
|
|
if err != nil {
|
|
return data
|
|
}
|
|
for _, v := range response {
|
|
data = append(data, v)
|
|
}
|
|
if len(response) == request.Limit {
|
|
request.StartRow = request.StartRow + request.Limit
|
|
} else {
|
|
break
|
|
}
|
|
}
|
|
return data
|
|
}
|