wanggang
1 year ago
20 changed files with 5561 additions and 333 deletions
@ -0,0 +1,88 @@ |
|||
export default function () { |
|||
return { |
|||
title: "寄售库存", |
|||
type: "object", |
|||
properties: { |
|||
// id: {
|
|||
// type: "string",
|
|||
// hidden: true,
|
|||
// showForList: false,
|
|||
// },
|
|||
erpToLoc: { |
|||
title: "ERP库位", |
|||
type: "string", |
|||
}, |
|||
lu: { |
|||
title: "LU零件号", |
|||
type: "string", |
|||
}, |
|||
partCode: { |
|||
title: "客户零件号", |
|||
type: "string", |
|||
}, |
|||
vinCode: { |
|||
title: "生产码", |
|||
type: "string", |
|||
}, |
|||
codeType: { |
|||
title: "生产码类型", |
|||
type: "string", |
|||
input: "select", |
|||
options: [ |
|||
{ value: "01", label: "前保" }, |
|||
{ value: "02", label: "后保" }, |
|||
{ value: "03", label: "门槛" }, |
|||
], |
|||
}, |
|||
proType: { |
|||
title: "发货类型", |
|||
type: "string", |
|||
input: "select", |
|||
options: [ |
|||
{ value: "JIS", label: "JIS" }, |
|||
{ value: "JIT", label: "JIT" }, |
|||
{ value: "买单件", label: "买单件" }, |
|||
{ value: "备件", label: "备件" }, |
|||
], |
|||
}, |
|||
qty: { |
|||
title: "数量", |
|||
type: "string", |
|||
}, |
|||
shippingDate: { |
|||
title: "发运日期", |
|||
type: "string", |
|||
input: "date", |
|||
}, |
|||
creationTime: { |
|||
title: "订单日期", |
|||
type: "string", |
|||
input: "date", |
|||
}, |
|||
seqNumber: { |
|||
title: "EDI顺序号", |
|||
type: "string", |
|||
}, |
|||
tmpe4: { |
|||
title: "客户订单号", |
|||
type: "string", |
|||
}, |
|||
uniqueCode: { |
|||
title: "塑件唯一码", |
|||
type: "string", |
|||
}, |
|||
matchNumber: { |
|||
title: "EDI总成号", |
|||
type: "string", |
|||
}, |
|||
pjsNum: { |
|||
title: "PJIS生产顺序号", |
|||
type: "string", |
|||
}, |
|||
desc: { |
|||
title: "备注", |
|||
type: "string", |
|||
}, |
|||
}, |
|||
}; |
|||
} |
@ -1,6 +1,6 @@ |
|||
import AppList from "../../../components/list/index.js"; |
|||
import html from "html"; |
|||
import useConfig from "../../../models/inventory/record.js"; |
|||
import useConfig from "../../../models/inventory/log.js"; |
|||
|
|||
export default { |
|||
components: { AppList }, |
@ -0,0 +1,92 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Diagnostics; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Linq.Dynamic.Core; |
|||
using System.Reflection; |
|||
using System.Threading.Tasks; |
|||
using CodeArts.Db; |
|||
using Flurl.Http; |
|||
using InfluxDB.LineProtocol.Client; |
|||
using InfluxDB.LineProtocol.Payload; |
|||
using Microsoft.Extensions.Configuration; |
|||
|
|||
namespace Win.Sfs.SettleAccount.influxdb; |
|||
|
|||
public class InfluxHelper |
|||
{ |
|||
private readonly IConfiguration _configuration; |
|||
private readonly string _database = "vmi"; |
|||
|
|||
public InfluxHelper(IConfiguration configuration) |
|||
{ |
|||
this._configuration = configuration; |
|||
} |
|||
|
|||
public InfluxHelper Start() |
|||
{ |
|||
if (!Process.GetProcessesByName("influxd").Any()) |
|||
{ |
|||
var influxPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "influxdb"); |
|||
var process = new Process(); |
|||
process.StartInfo = new ProcessStartInfo |
|||
{ |
|||
UseShellExecute = false, |
|||
CreateNoWindow = true, |
|||
WorkingDirectory = influxPath, |
|||
FileName = Path.Combine(influxPath, "influxd.exe"), |
|||
Arguments = $"-config {Path.Combine(influxPath, "influxdb.conf")}", |
|||
}; |
|||
process.Start(); |
|||
} |
|||
return this; |
|||
} |
|||
|
|||
public async Task<InfluxQueryResult> Query(string q) |
|||
{ |
|||
var influxUrl = GetUrl(); |
|||
var response = await $"{influxUrl}/query".PostUrlEncodedAsync(new { q, db = this._database }).ConfigureAwait(false); |
|||
if (response.StatusCode == 200) |
|||
{ |
|||
var result = await response.GetJsonAsync<InfluxQueryResult>().ConfigureAwait(false); |
|||
return result; |
|||
} |
|||
throw new Exception($"StatusCode:{response.StatusCode}"); |
|||
} |
|||
|
|||
private string GetUrl() |
|||
{ |
|||
return (_configuration.GetConnectionString("influxdb") ?? "http://localhost:8086").TrimEnd('/'); |
|||
} |
|||
|
|||
public async Task<LineProtocolWriteResult> Insert<T>(T data) |
|||
{ |
|||
var influxUrl = GetUrl(); |
|||
var client = new LineProtocolClient(new Uri(influxUrl), this._database); |
|||
var table = typeof(T).Name; |
|||
var payload = new LineProtocolPayload(); |
|||
var dictonary = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly) |
|||
.ToDictionary(o => o.Name, o => o.GetValue(data, null)); |
|||
payload.Add(new LineProtocolPoint(table, dictonary)); |
|||
var result = await client.WriteAsync(payload).ConfigureAwait(false); |
|||
return result; |
|||
} |
|||
|
|||
public List<T> Query<T>(out long total, int pageIndex, int pageSize, Func<T, bool> where) where T : class, new() |
|||
{ |
|||
var influxOptions = new InfluxOptions(GetUrl(), _database, string.Empty, string.Empty); |
|||
var influxDbClient = influxOptions.CreateSampleInfluxClient(); |
|||
var connectionConfig = new Influx17xConnectionConfig(influxDbClient); |
|||
CodeArtsHelper.InitializeBasic(); |
|||
Influx17xHelper.InitializeCodeArts(); |
|||
Influx17xHelper.InitializeDefaultConnectionConfig(connectionConfig); |
|||
var query = Influx17xHelper.CreateQuery<T>(connectionConfig, null); |
|||
//.Where(where);
|
|||
//total = query.LongCount();
|
|||
Debug.WriteLine(query.ToString()); |
|||
total = 10; |
|||
var result = query.Skip(0).Take(10).ToList(); |
|||
return result; |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Win.Sfs.SettleAccount.influxdb; |
|||
|
|||
public class InfluxQueryResult |
|||
{ |
|||
public List<InfluxResult> results { get; set; } = new List<InfluxResult>(); |
|||
} |
|||
|
|||
public class InfluxResult |
|||
{ |
|||
public string statement_id { get; set; } |
|||
public List<InfluxMessage> messages { get; set;} = new List<InfluxMessage>(); |
|||
public List<InfluxSeries> series { get; set; } = new List<InfluxSeries>(); |
|||
} |
|||
|
|||
public class InfluxMessage |
|||
{ |
|||
public string level { get; set; } |
|||
public string text { get; set; } |
|||
} |
|||
|
|||
public class InfluxSeries |
|||
{ |
|||
public string name { get; set; } |
|||
public List<string> columns { get; set; } = new List<string>(); |
|||
public List<List<string>> values { get; set; } = new List<List<string>>(); |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,202 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Migrations |
|||
{ |
|||
public partial class vmi4 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropForeignKey( |
|||
name: "FK_Set_VmiLog_Set_VmiBalance_BalanceId", |
|||
table: "Set_VmiLog"); |
|||
|
|||
migrationBuilder.DropForeignKey( |
|||
name: "FK_Set_VmiLog_Set_VmiCategory_CategoryId", |
|||
table: "Set_VmiLog"); |
|||
|
|||
migrationBuilder.DropIndex( |
|||
name: "IX_Set_VmiLog_BalanceId", |
|||
table: "Set_VmiLog"); |
|||
|
|||
migrationBuilder.DropIndex( |
|||
name: "IX_Set_VmiLog_CategoryId", |
|||
table: "Set_VmiLog"); |
|||
|
|||
migrationBuilder.DeleteData( |
|||
table: "Set_VmiCategory", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("27b1609e-05af-cef7-f5f4-dd598c31b4de")); |
|||
|
|||
migrationBuilder.DeleteData( |
|||
table: "Set_VmiCategory", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("3e0655a6-2532-a861-344f-b9c53c809c64")); |
|||
|
|||
migrationBuilder.DeleteData( |
|||
table: "Set_VmiCategory", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("869f1589-9063-a545-719e-a83b6dca03c3")); |
|||
|
|||
migrationBuilder.DeleteData( |
|||
table: "Set_VmiCategory", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("a6462ee4-6e2c-bc8b-b1cb-5203c8dcaea8")); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "BalanceId", |
|||
table: "Set_VmiLog"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "CategoryId", |
|||
table: "Set_VmiLog"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "Type", |
|||
table: "Set_VmiLog"); |
|||
|
|||
migrationBuilder.RenameColumn( |
|||
name: "D2", |
|||
table: "Set_VmiLog", |
|||
newName: "Category"); |
|||
|
|||
migrationBuilder.RenameColumn( |
|||
name: "Tmpe4", |
|||
table: "Set_VmiBalance", |
|||
newName: "CustomOrderNumber"); |
|||
|
|||
migrationBuilder.AddColumn<decimal>( |
|||
name: "Count", |
|||
table: "Set_VmiLog", |
|||
type: "decimal(18,2)", |
|||
nullable: false, |
|||
defaultValue: 0m); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "VmiCategoryId", |
|||
table: "Set_VmiLog", |
|||
type: "uniqueidentifier", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_VmiCategory", |
|||
columns: new[] { "Id", "Name", "Number", "Type" }, |
|||
values: new object[] { new Guid("b3b321dd-5e0e-55b0-5548-70a742e9a4db"), "发运入库", "100", 0 }); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_VmiCategory", |
|||
columns: new[] { "Id", "Name", "Number", "Type" }, |
|||
values: new object[] { new Guid("a04d00ac-0e9c-064d-b7ce-af0b4d7c8c6b"), "结算出库", "200", 1 }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Set_VmiLog_VmiCategoryId", |
|||
table: "Set_VmiLog", |
|||
column: "VmiCategoryId"); |
|||
|
|||
migrationBuilder.AddForeignKey( |
|||
name: "FK_Set_VmiLog_Set_VmiCategory_VmiCategoryId", |
|||
table: "Set_VmiLog", |
|||
column: "VmiCategoryId", |
|||
principalTable: "Set_VmiCategory", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Restrict); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropForeignKey( |
|||
name: "FK_Set_VmiLog_Set_VmiCategory_VmiCategoryId", |
|||
table: "Set_VmiLog"); |
|||
|
|||
migrationBuilder.DropIndex( |
|||
name: "IX_Set_VmiLog_VmiCategoryId", |
|||
table: "Set_VmiLog"); |
|||
|
|||
migrationBuilder.DeleteData( |
|||
table: "Set_VmiCategory", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("a04d00ac-0e9c-064d-b7ce-af0b4d7c8c6b")); |
|||
|
|||
migrationBuilder.DeleteData( |
|||
table: "Set_VmiCategory", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("b3b321dd-5e0e-55b0-5548-70a742e9a4db")); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "Count", |
|||
table: "Set_VmiLog"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "VmiCategoryId", |
|||
table: "Set_VmiLog"); |
|||
|
|||
migrationBuilder.RenameColumn( |
|||
name: "Category", |
|||
table: "Set_VmiLog", |
|||
newName: "D2"); |
|||
|
|||
migrationBuilder.RenameColumn( |
|||
name: "CustomOrderNumber", |
|||
table: "Set_VmiBalance", |
|||
newName: "Tmpe4"); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "BalanceId", |
|||
table: "Set_VmiLog", |
|||
type: "uniqueidentifier", |
|||
nullable: false, |
|||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "CategoryId", |
|||
table: "Set_VmiLog", |
|||
type: "uniqueidentifier", |
|||
nullable: false, |
|||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); |
|||
|
|||
migrationBuilder.AddColumn<int>( |
|||
name: "Type", |
|||
table: "Set_VmiLog", |
|||
type: "int", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_VmiCategory", |
|||
columns: new[] { "Id", "Name", "Number", "Type" }, |
|||
values: new object[,] |
|||
{ |
|||
{ new Guid("a6462ee4-6e2c-bc8b-b1cb-5203c8dcaea8"), "发运", "100", 0 }, |
|||
{ new Guid("869f1589-9063-a545-719e-a83b6dca03c3"), "结算", "200", 1 }, |
|||
{ new Guid("3e0655a6-2532-a861-344f-b9c53c809c64"), "漏发补货", "600", 0 }, |
|||
{ new Guid("27b1609e-05af-cef7-f5f4-dd598c31b4de"), "负库存补货", "700", 0 } |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Set_VmiLog_BalanceId", |
|||
table: "Set_VmiLog", |
|||
column: "BalanceId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Set_VmiLog_CategoryId", |
|||
table: "Set_VmiLog", |
|||
column: "CategoryId"); |
|||
|
|||
migrationBuilder.AddForeignKey( |
|||
name: "FK_Set_VmiLog_Set_VmiBalance_BalanceId", |
|||
table: "Set_VmiLog", |
|||
column: "BalanceId", |
|||
principalTable: "Set_VmiBalance", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
|
|||
migrationBuilder.AddForeignKey( |
|||
name: "FK_Set_VmiLog_Set_VmiCategory_CategoryId", |
|||
table: "Set_VmiLog", |
|||
column: "CategoryId", |
|||
principalTable: "Set_VmiCategory", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue