更改FTP文件导入
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
---
|
||||
trigger: always_on
|
||||
---
|
||||
1. 读取ExcelFile/20251218161818.xlsx文件,这个是其他系统导出的Excel模板文件,文件名称里面是时间信息,里面有多个Sheet,每个Sheet都是一个表
|
||||
1. 读取ExcelFile/20260120155036.xlsx文件,这个是其他系统导出的Excel模板文件,文件名称里面是时间信息,里面有多个Sheet,每个Sheet都是一个表
|
||||
2. 根据这个Excel文件和里面的多个Sheet帮我建立一个多个数据模型,数据模型建立在FATrace.Model/FileModel 下面
|
||||
3. 数据模型/表的翻译如下:
|
||||
工厂-入库 :FactoryInbound
|
||||
工厂-领料:FactoryMaterial Withdrawal
|
||||
工厂-出入库:**FactoryInventoryTransaction**
|
||||
工厂-原料生产信息:FactoryProductionRecord
|
||||
工厂-成品入库 :FactoryInbound
|
||||
工厂-成品入库与出库:FactoryInOutbound
|
||||
工厂-成品出库:FactoryOutbound
|
||||
工厂-包袋生产:FactoryProductionRecord
|
||||
工厂-原料入库:FactoryRawInbound
|
||||
工厂-原料出库:FactoryRawOutbound
|
||||
工厂-原料出入库:FactoryRawInOutbound
|
||||
OEM-入库:OEMInbound
|
||||
OEM-出库:OEMOutbound
|
||||
OEM-出入库:OEMInventoryTransaction
|
||||
OEM-原料使用信息:OEMRawUsageInfo
|
||||
OEM-出入库:OEMInOutbound
|
||||
OEM-原料使用:OEMRawUsageInfo
|
||||
4. 每个表/模型的字段属性的名称,你可以读取excel里面的列头中文进行翻译,要求简洁。
|
||||
很多的字段属性在FATrace.Model下其他的表/模型里面有有了,你可以借鉴他们的属性字段英文名称,这样属性字段能统一。
|
||||
这些sheet里面的数据我后期只是展示用,表/模型的主键用long,其他Excel数据属性字段数据类型全部用string 类型,
|
||||
@@ -22,52 +24,59 @@ trigger: always_on
|
||||
8. 有不理解的地方需要跟我确认,你要列一个任务清单,一个一个的执行
|
||||
9. 你可以联网查询你需要的内容
|
||||
10. 这些逻辑放到FATrace.WPLApp.Services.ReadFileServices 中,查询界面(View + ViewModel)放到FATrace.WPLApp中
|
||||
|
||||
|
||||
|
||||
11. 每个Sheet的列头内容
|
||||
|
||||
工厂-入库
|
||||
工厂-原料入库
|
||||
|
||||
| 产地 | 原料代码 | 原料名称 | 重量 | 登录日 | 登录时间 | 登录日期时间 |
|
||||
| ---- | -------- | -------- | ---- | ------ | -------- | ------------ |
|
||||
| 产地 | 原料代码 | 原料名称 | 重量(KG) | 登录日期时间 |
|
||||
| ---- | -------- | -------- | -------- | ------------ |
|
||||
|
||||
工厂-领料
|
||||
工厂-原料出库
|
||||
|
||||
| 产地 | 原料代码 | 原料名称 | 重量 | 登录日 | 登录时间 | 登录日期时间 |
|
||||
| ---- | -------- | -------- | ---- | ------ | -------- | ------------ |
|
||||
| 产地 | 原料代码 | 原料名称 | 重量(KG) | 登录日期时间 |
|
||||
| ---- | -------- | -------- | -------- | ------------ |
|
||||
|
||||
工厂-出入库
|
||||
工厂-原料出入库
|
||||
|
||||
| 入库时间 | 出库时间 | 产地 | 原料代码 | 原料名称 | 入库总重量KG | 出库总重量KG | 剩余重量KG |
|
||||
| -------- | -------- | ---- | -------- | -------- | ------------ | ------------ | ---------- |
|
||||
| 入库时间 | 出库时间 | 产地 | 原料代码 | 原料名称 | 入库总重量(KG) | 出库总重量(KG) | 剩余重量(KG) |
|
||||
| -------- | -------- | ---- | -------- | -------- | -------------- | -------------- | ------------ |
|
||||
|
||||
工厂-原料生产信息
|
||||
工厂-包袋生产
|
||||
|
||||
| 原料编号 | 原料名称 | 产地 | 内袋二维码 | 外箱二维码 | 批号 | 保质期 | 称重重量(g) | 配料日期 | 剩余重量(Kg) | 入库总重量(Kg) | 称重时间 | 操作者 | 确认者 | 外箱扫码时间 |
|
||||
| 原料编号 | 原料名称 | 产地 | 内袋二维码 | 外箱二维码 | 批号 | 保质期 | 称重重量(G) | 配料日期 | 剩余重量(KG) | 入库总重量(KG) | 称重时间 | 操作者 | 确认者 | 外箱扫码时间 |
|
||||
| -------- | -------- | ---- | ---------- | ---------- | ---- | ------ | ----------- | -------- | ------------ | -------------- | -------- | ------ | ------ | ------------ |
|
||||
|
||||
工厂-成品入库
|
||||
|
||||
| 批号 | 重量(G) | 保质期 | 产地 | 原料代码 | 原料名称 | 序号 | 登录日期时间 |
|
||||
| ---- | ------- | ------ | ---- | -------- | -------- | ---- | ------------ |
|
||||
|
||||
工厂-成品出库
|
||||
|
||||
| 批号 | 重量 | 保质期 | 产地 | 原料代码 | 原料名称 | 序号 | 登录日 | 登录时间 | 登录日期时间 |
|
||||
| ---- | ---- | ------ | ---- | -------- | -------- | ---- | ------ | -------- | ------------ |
|
||||
| 批号 | 重量(G) | 保质期 | 产地 | 原料代码 | 原料名称 | 序号 | 登录日期时间 |
|
||||
| ---- | ------- | ------ | ---- | -------- | -------- | ---- | ------------ |
|
||||
|
||||
工厂-成品入库与出库
|
||||
|
||||
| 入库时间 | 出库时间 | 产地 | 批号 | 原料代码 | 原料名称 | 入库总箱数 | 出库总箱数 | 剩余箱数 |
|
||||
| -------- | -------- | ---- | ---- | -------- | -------- | ---------- | ---------- | -------- |
|
||||
|
||||
OEM-入库
|
||||
|
||||
| 批号 | 重量 | 保质期 | 产地 | 原料代码 | 原料名称 | 序号 | 登录日 | 登录时间 | 登录日期时间 |
|
||||
| ---- | ---- | ------ | ---- | -------- | -------- | ---- | ------ | -------- | ------------ |
|
||||
| 批号 | 重量(G) | 保质期 | 产地 | 原料代码 | 原料名称 | 序号 | 登录日期时间 |
|
||||
| ---- | ------- | ------ | ---- | -------- | -------- | ---- | ------------ |
|
||||
|
||||
OEM-出库
|
||||
|
||||
| 批号 | 重量 | 保质期 | 产地 | 原料代码 | 原料名称 | 序号 | 登录日 | 登录时间 | 登录日期时间 |
|
||||
| ---- | ---- | ------ | ---- | -------- | -------- | ---- | ------ | -------- | ------------ |
|
||||
| 批号 | 重量(G) | 保质期 | 产地 | 原料代码 | 原料名称 | 序号 | 登录日期时间 |
|
||||
| ---- | ------- | ------ | ---- | -------- | -------- | ---- | ------------ |
|
||||
|
||||
OEM-出入库
|
||||
|
||||
| 入库时间 | 出库时间 | 产地 | 原料代码 | 原料名称 | 入库总重量KG | 出库总重量KG | 剩余重量KG |
|
||||
| -------- | -------- | ---- | -------- | -------- | ------------ | ------------ | ---------- |
|
||||
| 入库时间 | 出库时间 | 产地 | 批号 | 原料代码 | 原料名称 | 入库总箱数 | 出库总箱数 | 剩余箱数 |
|
||||
| -------- | -------- | ---- | ---- | -------- | -------- | ---------- | ---------- | -------- |
|
||||
|
||||
OEM-原料使用信息
|
||||
OEM-原料使用
|
||||
|
||||
| 原料使用时间 | 内袋二维码 | 原料产地 | 原料名称 | 原料代码 | 视频链接 |
|
||||
| ------------ | ---------- | -------- | -------- | -------- | -------- |
|
||||
| 原料使用时间 | 内袋二维码 | 原料产地 | 原料名称 | 原料代码 |
|
||||
| ------------ | ---------- | -------- | -------- | -------- |
|
||||
|
||||
17
FATrace.App/frmMain.Designer.cs
generated
17
FATrace.App/frmMain.Designer.cs
generated
@@ -105,6 +105,7 @@ namespace FATrace.App
|
||||
dtpSearchStartTime = new DateTimePicker();
|
||||
dataGridView1 = new DataGridView();
|
||||
label22 = new Label();
|
||||
btnReprint = new Button();
|
||||
statusStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
|
||||
splitContainer1.Panel1.SuspendLayout();
|
||||
@@ -346,6 +347,7 @@ namespace FATrace.App
|
||||
// panel3
|
||||
//
|
||||
panel3.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel3.Controls.Add(btnReprint);
|
||||
panel3.Controls.Add(pictureBox4);
|
||||
panel3.Controls.Add(btnWeightPrint);
|
||||
panel3.Controls.Add(txtCode);
|
||||
@@ -681,6 +683,7 @@ namespace FATrace.App
|
||||
//
|
||||
// btnRawName3
|
||||
//
|
||||
btnRawName3.Enabled = false;
|
||||
btnRawName3.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Bold, GraphicsUnit.Point, 134);
|
||||
btnRawName3.Location = new Point(321, 53);
|
||||
btnRawName3.Name = "btnRawName3";
|
||||
@@ -692,6 +695,7 @@ namespace FATrace.App
|
||||
//
|
||||
// btnRawName2
|
||||
//
|
||||
btnRawName2.Enabled = false;
|
||||
btnRawName2.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Bold, GraphicsUnit.Point, 134);
|
||||
btnRawName2.Location = new Point(24, 107);
|
||||
btnRawName2.Name = "btnRawName2";
|
||||
@@ -980,6 +984,18 @@ namespace FATrace.App
|
||||
label22.Text = "历史数据";
|
||||
label22.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// btnReprint
|
||||
//
|
||||
btnReprint.Font = new Font("微软雅黑", 14.25F, FontStyle.Bold, GraphicsUnit.Point, 134);
|
||||
btnReprint.ForeColor = SystemColors.ControlDarkDark;
|
||||
btnReprint.Location = new Point(670, 5);
|
||||
btnReprint.Name = "btnReprint";
|
||||
btnReprint.Size = new Size(190, 44);
|
||||
btnReprint.TabIndex = 17;
|
||||
btnReprint.Text = "重新打印当前";
|
||||
btnReprint.UseVisualStyleBackColor = true;
|
||||
btnReprint.Click += btnReprint_Click;
|
||||
//
|
||||
// frmMain
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||
@@ -1102,5 +1118,6 @@ namespace FATrace.App
|
||||
private PictureBox pictureBox4;
|
||||
private TextBox txtOpName;
|
||||
private Label label28;
|
||||
private Button btnReprint;
|
||||
}
|
||||
}
|
||||
@@ -664,7 +664,7 @@ namespace FATrace.App
|
||||
|
||||
//确认数据
|
||||
// 显示消息框,并等待用户响应
|
||||
DialogResult result = MessageBox.Show("确定要【打印】操作吗?", "确认操作", MessageBoxButtons.OKCancel);
|
||||
DialogResult result = frmMessage.ShowConfirm("确定要【打印】操作吗?", "确认操作", this);
|
||||
if (result == DialogResult.Cancel)
|
||||
{
|
||||
return;
|
||||
@@ -674,13 +674,14 @@ namespace FATrace.App
|
||||
{
|
||||
//确认数据
|
||||
// 显示消息框,并等待用户响应
|
||||
DialogResult resultWeightCheck = MessageBox.Show("检测到当前的重量小于2g,确定要【打印】操作吗?", "确认操作", MessageBoxButtons.OKCancel);
|
||||
DialogResult resultWeightCheck = frmMessage.ShowConfirm("检测到当前的重量小于2g,确定要【打印】操作吗?", "确认操作", this);
|
||||
if (resultWeightCheck == DialogResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//新的剩余重量 Kg
|
||||
var NewRemainWeight = CurSelectedRawProInput.RemainWeight - CurWeight / 1000.0;
|
||||
|
||||
@@ -786,13 +787,19 @@ namespace FATrace.App
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 格式化重量显示,整数部分至少2位(不足补0),小数部分固定2位
|
||||
/// 格式化重量显示,自动适配整数部分位数(2-4位),小数部分固定2位
|
||||
/// </summary>
|
||||
/// <param name="weight">原始重量值</param>
|
||||
/// <returns>格式化后的重量字符串(如:09.50, 81.10, 100.00)</returns>
|
||||
/// /// <returns>格式化后的重量字符串(如:09.50, 81.10, 100.00, 1000.00)</returns>
|
||||
private string FormatWeight(double weight)
|
||||
{
|
||||
return weight.ToString("00.00");
|
||||
// 根据重量值大小决定格式
|
||||
if (weight >= 1000)
|
||||
return weight.ToString("0000.00"); // 四位整数:1000.00-9999.99
|
||||
else if (weight >= 100)
|
||||
return weight.ToString("000.00"); // 三位整数:100.00-999.99
|
||||
else
|
||||
return weight.ToString("00.00"); // 两位整数:00.00-99.99
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1276,5 +1283,62 @@ namespace FATrace.App
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重新打印之前最新的一个
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnReprint_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (CurSelectedRawProInput == null)
|
||||
{
|
||||
MessageBox.Show("请先选择要称重的产品", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var LastData = FSqlContext.FDb.Select<RawProUse>().OrderByDescending(a => a.WeightTime).First();
|
||||
if (LastData == null)
|
||||
{
|
||||
MessageBox.Show("没有找到最新的消息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示消息框,并等待用户响应
|
||||
DialogResult result = frmMessage.ShowConfirm($"确定要【重复打印】{LastData.InBagCode} 条码数据吗?", "确认操作", this);
|
||||
if (result == DialogResult.Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 执行打印
|
||||
try
|
||||
{
|
||||
UpdateStatusLabel(tslPrintState, "正在打印...", Color.Goldenrod, Color.White);
|
||||
CurZebraPrint.PrintWeight(LastData.InBagCode!, CurSelectedRawProInput.RawName!,
|
||||
CurWeight,
|
||||
CurSelectedRawProInput.Batch!,
|
||||
CurSelectedRawProInput.ShelfLife
|
||||
);
|
||||
SetPrinterStatusOk("打印成功");
|
||||
logger.Info($"打印成功:{CurSelectedRawProInput.RawName} {CurWeight}g 批号{CurSelectedRawProInput.Batch}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SetPrinterStatusFail($"打印失败:{ex.Message}");
|
||||
logger.Error(ex, "打印失败");
|
||||
MessageBox.Show($"打印失败:{ex.Message}", "打印机错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(String.Format("ErrSource : {0} ErrMsg : {1}", ex.StackTrace.ToString(), ex.Message.ToString()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
94
FATrace.App/frmMessage.Designer.cs
generated
Normal file
94
FATrace.App/frmMessage.Designer.cs
generated
Normal file
@@ -0,0 +1,94 @@
|
||||
namespace FATrace.App
|
||||
{
|
||||
partial class frmMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMessage));
|
||||
lblMessage = new Label();
|
||||
btnTrue = new Button();
|
||||
bntCancel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// lblMessage
|
||||
//
|
||||
lblMessage.Font = new Font("微软雅黑", 21.75F, FontStyle.Bold, GraphicsUnit.Point, 134);
|
||||
lblMessage.ForeColor = Color.Blue;
|
||||
lblMessage.Location = new Point(22, 36);
|
||||
lblMessage.Name = "lblMessage";
|
||||
lblMessage.Size = new Size(710, 165);
|
||||
lblMessage.TabIndex = 0;
|
||||
lblMessage.Text = "消息内容";
|
||||
lblMessage.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// btnTrue
|
||||
//
|
||||
btnTrue.Font = new Font("Microsoft YaHei UI", 21.75F, FontStyle.Bold, GraphicsUnit.Point, 134);
|
||||
btnTrue.ForeColor = SystemColors.ControlDarkDark;
|
||||
btnTrue.Location = new Point(180, 246);
|
||||
btnTrue.Name = "btnTrue";
|
||||
btnTrue.Size = new Size(146, 66);
|
||||
btnTrue.TabIndex = 1;
|
||||
btnTrue.Text = "确 认";
|
||||
btnTrue.UseVisualStyleBackColor = true;
|
||||
btnTrue.Click += btnTrue_Click;
|
||||
//
|
||||
// bntCancel
|
||||
//
|
||||
bntCancel.Font = new Font("Microsoft YaHei UI", 21.75F, FontStyle.Bold, GraphicsUnit.Point, 134);
|
||||
bntCancel.ForeColor = SystemColors.ControlDarkDark;
|
||||
bntCancel.Location = new Point(384, 246);
|
||||
bntCancel.Name = "bntCancel";
|
||||
bntCancel.Size = new Size(146, 66);
|
||||
bntCancel.TabIndex = 2;
|
||||
bntCancel.Text = "取 消";
|
||||
bntCancel.UseVisualStyleBackColor = true;
|
||||
bntCancel.Click += bntCancel_Click;
|
||||
//
|
||||
// frmMessage
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(744, 398);
|
||||
Controls.Add(bntCancel);
|
||||
Controls.Add(btnTrue);
|
||||
Controls.Add(lblMessage);
|
||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||
MaximizeBox = false;
|
||||
MinimizeBox = false;
|
||||
Name = "frmMessage";
|
||||
Text = "消息确认";
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label lblMessage;
|
||||
private Button btnTrue;
|
||||
private Button bntCancel;
|
||||
}
|
||||
}
|
||||
67
FATrace.App/frmMessage.cs
Normal file
67
FATrace.App/frmMessage.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FATrace.App
|
||||
{
|
||||
public partial class frmMessage : Form
|
||||
{
|
||||
public frmMessage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||
ShowInTaskbar = false;
|
||||
AcceptButton = btnTrue;
|
||||
CancelButton = bntCancel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示确认对话框(OK/Cancel)。
|
||||
/// </summary>
|
||||
/// <param name="message">提示内容</param>
|
||||
/// <param name="title">标题</param>
|
||||
/// <param name="owner">父窗口</param>
|
||||
/// <returns>DialogResult.OK 表示确认;DialogResult.Cancel 表示取消</returns>
|
||||
public static DialogResult ShowConfirm(string message, string title = "确认操作", IWin32Window? owner = null)
|
||||
{
|
||||
using (var f = new frmMessage())
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(title))
|
||||
f.Text = title;
|
||||
|
||||
f.SetMessageText(message);
|
||||
|
||||
return owner == null ? f.ShowDialog() : f.ShowDialog(owner);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置提示文本。
|
||||
/// </summary>
|
||||
/// <param name="message">提示内容</param>
|
||||
private void SetMessageText(string message)
|
||||
{
|
||||
lblMessage.Text = (message ?? string.Empty).Trim();
|
||||
}
|
||||
|
||||
private void btnTrue_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void bntCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
1253
FATrace.App/frmMessage.resx
Normal file
1253
FATrace.App/frmMessage.resx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -10,8 +10,4 @@
|
||||
<PackageReference Include="FreeSql" Version="3.5.213" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="FileModel\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
62
FATrace.Model/FileModel/FactoryInOutbound.cs
Normal file
62
FATrace.Model/FileModel/FactoryInOutbound.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
|
||||
namespace FATrace.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 工厂-成品入库与出库(Excel 导入数据,仅展示用)
|
||||
/// </summary>
|
||||
[Table(Name = "FactoryInOutbound")]
|
||||
public class FactoryInOutbound
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入库时间
|
||||
/// </summary>
|
||||
public string? InTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 出库时间
|
||||
/// </summary>
|
||||
public string? OutTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产地
|
||||
/// </summary>
|
||||
public string? Origin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批号
|
||||
/// </summary>
|
||||
public string? Batch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 原料代码
|
||||
/// </summary>
|
||||
public string? RawCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 原料名称
|
||||
/// </summary>
|
||||
public string? RawName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入库总箱数
|
||||
/// </summary>
|
||||
public string? TotalInPcs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 出库总箱数
|
||||
/// </summary>
|
||||
public string? TotalOutPcs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 剩余箱数
|
||||
/// </summary>
|
||||
public string? RemainPcs { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using FreeSql.DataAnnotations;
|
||||
namespace FATrace.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 工厂-入库(Excel 导入数据,仅展示用)
|
||||
/// 工厂-成品入库(Excel 导入数据,仅展示用)
|
||||
/// </summary>
|
||||
[Table(Name = "FactoryInbound")]
|
||||
public class FactoryInbound
|
||||
@@ -14,6 +14,21 @@ namespace FATrace.Model
|
||||
[Column(IsPrimary = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批号
|
||||
/// </summary>
|
||||
public string? Batch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 重量(G)
|
||||
/// </summary>
|
||||
public string? Weight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保质期
|
||||
/// </summary>
|
||||
public string? ShelfLife { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产地
|
||||
/// </summary>
|
||||
@@ -30,19 +45,9 @@ namespace FATrace.Model
|
||||
public string? RawName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 重量
|
||||
/// 序号
|
||||
/// </summary>
|
||||
public string? Weight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录日
|
||||
/// </summary>
|
||||
public string? LoginDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录时间
|
||||
/// </summary>
|
||||
public string? LoginTime { get; set; }
|
||||
public string? SequenceNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录日期时间
|
||||
|
||||
@@ -49,16 +49,6 @@ namespace FATrace.Model
|
||||
/// </summary>
|
||||
public string? SequenceNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录日
|
||||
/// </summary>
|
||||
public string? LoginDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录时间
|
||||
/// </summary>
|
||||
public string? LoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录日期时间
|
||||
/// </summary>
|
||||
|
||||
@@ -3,7 +3,7 @@ using FreeSql.DataAnnotations;
|
||||
namespace FATrace.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 工厂-原料生产信息(Excel 导入数据,仅展示用)
|
||||
/// 工厂-包袋生产(Excel 导入数据,仅展示用)
|
||||
/// </summary>
|
||||
[Table(Name = "FactoryProductionRecord")]
|
||||
public class FactoryProductionRecord
|
||||
|
||||
@@ -3,10 +3,10 @@ using FreeSql.DataAnnotations;
|
||||
namespace FATrace.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 工厂-出入库(Excel 导入数据,仅展示用)
|
||||
/// 工厂-原料出入库(Excel 导入数据,仅展示用)
|
||||
/// </summary>
|
||||
[Table(Name = "FactoryInventoryTransaction")]
|
||||
public class FactoryInventoryTransaction
|
||||
[Table(Name = "FactoryRawInOutbound")]
|
||||
public class FactoryRawInOutbound
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
@@ -20,7 +20,7 @@ namespace FATrace.Model
|
||||
public string? InTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 领料时间
|
||||
/// 出库时间
|
||||
/// </summary>
|
||||
public string? OutTime { get; set; }
|
||||
|
||||
@@ -40,17 +40,17 @@ namespace FATrace.Model
|
||||
public string? RawName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入库总重量 KG
|
||||
/// 入库总重量(KG)
|
||||
/// </summary>
|
||||
public string? TotalInWeightKg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 领料总重量 KG
|
||||
/// 出库总重量(KG)
|
||||
/// </summary>
|
||||
public string? TotalOutWeightKg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 剩余重量 KG
|
||||
/// 剩余重量(KG)
|
||||
/// </summary>
|
||||
public string? RemainWeightKg { get; set; }
|
||||
}
|
||||
@@ -3,10 +3,10 @@ using FreeSql.DataAnnotations;
|
||||
namespace FATrace.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 工厂-领料(Excel 导入数据,仅展示用)
|
||||
/// 工厂-原料入库(Excel 导入数据,仅展示用)
|
||||
/// </summary>
|
||||
[Table(Name = "FactoryMaterialWithdrawal")]
|
||||
public class FactoryMaterialWithdrawal
|
||||
[Table(Name = "FactoryRawInbound")]
|
||||
public class FactoryRawInbound
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
@@ -34,16 +34,6 @@ namespace FATrace.Model
|
||||
/// </summary>
|
||||
public string? Weight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录日
|
||||
/// </summary>
|
||||
public string? LoginDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录时间
|
||||
/// </summary>
|
||||
public string? LoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录日期时间
|
||||
/// </summary>
|
||||
42
FATrace.Model/FileModel/FactoryRawOutbound.cs
Normal file
42
FATrace.Model/FileModel/FactoryRawOutbound.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
|
||||
namespace FATrace.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// 工厂-原料出库(Excel 导入数据,仅展示用)
|
||||
/// </summary>
|
||||
[Table(Name = "FactoryRawOutbound")]
|
||||
public class FactoryRawOutbound
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Column(IsPrimary = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产地
|
||||
/// </summary>
|
||||
public string? Origin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 原料代码
|
||||
/// </summary>
|
||||
public string? RawCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 原料名称
|
||||
/// </summary>
|
||||
public string? RawName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 重量
|
||||
/// </summary>
|
||||
public string? Weight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录日期时间
|
||||
/// </summary>
|
||||
public string? LoginDateTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ namespace FATrace.Model
|
||||
/// <summary>
|
||||
/// OEM-出入库(Excel 导入数据,仅展示用)
|
||||
/// </summary>
|
||||
[Table(Name = "OEMInventoryTransaction")]
|
||||
public class OEMInventoryTransaction
|
||||
[Table(Name = "OEMInOutbound")]
|
||||
public class OEMInOutbound
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
@@ -49,16 +49,6 @@ namespace FATrace.Model
|
||||
/// </summary>
|
||||
public string? SequenceNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录日
|
||||
/// </summary>
|
||||
public string? LoginDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录时间
|
||||
/// </summary>
|
||||
public string? LoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录日期时间
|
||||
/// </summary>
|
||||
|
||||
@@ -49,16 +49,6 @@ namespace FATrace.Model
|
||||
/// </summary>
|
||||
public string? SequenceNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录日
|
||||
/// </summary>
|
||||
public string? LoginDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录时间
|
||||
/// </summary>
|
||||
public string? LoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录日期时间
|
||||
/// </summary>
|
||||
|
||||
@@ -39,9 +39,5 @@ namespace FATrace.Model
|
||||
/// </summary>
|
||||
public string? RawCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 视频链接
|
||||
/// </summary>
|
||||
public string? VideoUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,11 +273,13 @@ namespace FATrace.WPLApp
|
||||
containerRegistry.RegisterForNavigation<WeightUserManageView, WeightUserManageViewModel>();
|
||||
|
||||
// 工厂/OEM Excel 导入数据查询页
|
||||
containerRegistry.RegisterForNavigation<FactoryRawInboundView, FactoryRawInboundViewModel>();
|
||||
containerRegistry.RegisterForNavigation<FactoryInboundView, FactoryInboundViewModel>();
|
||||
containerRegistry.RegisterForNavigation<FactoryMaterialWithdrawalView, FactoryMaterialWithdrawalViewModel>();
|
||||
containerRegistry.RegisterForNavigation<FactoryInventoryTransactionView, FactoryInventoryTransactionViewModel>();
|
||||
containerRegistry.RegisterForNavigation<FactoryProductionRecordView, FactoryProductionRecordViewModel>();
|
||||
containerRegistry.RegisterForNavigation<FactoryOutboundView, FactoryOutboundViewModel>();
|
||||
containerRegistry.RegisterForNavigation<FactoryInOutboundView, FactoryInOutboundViewModel>();
|
||||
containerRegistry.RegisterForNavigation<OEMInboundView, OEMInboundViewModel>();
|
||||
containerRegistry.RegisterForNavigation<OEMOutboundView, OEMOutboundViewModel>();
|
||||
containerRegistry.RegisterForNavigation<OEMInventoryTransactionView, OEMInventoryTransactionViewModel>();
|
||||
|
||||
Binary file not shown.
BIN
FATrace.WPLApp/ExcelFile/20260120155036.xlsx
Normal file
BIN
FATrace.WPLApp/ExcelFile/20260120155036.xlsx
Normal file
Binary file not shown.
@@ -137,29 +137,36 @@ namespace FATrace.WPLApp.Services
|
||||
{
|
||||
new NavItemDto
|
||||
{
|
||||
Name = "工厂-入库",
|
||||
CmdPar = "工厂-入库",
|
||||
Name = "工厂-原料入库",
|
||||
CmdPar = "工厂-原料入库",
|
||||
Icon = "\uea25",
|
||||
IsParent = false,
|
||||
},
|
||||
new NavItemDto
|
||||
{
|
||||
Name = "工厂-领料",
|
||||
CmdPar = "工厂-领料",
|
||||
Name = "工厂-原料出库",
|
||||
CmdPar = "工厂-原料出库",
|
||||
Icon = "\uea25",
|
||||
IsParent = false,
|
||||
},
|
||||
new NavItemDto
|
||||
{
|
||||
Name = "工厂-出入库",
|
||||
CmdPar = "工厂-出入库",
|
||||
Name = "工厂-原料出入库",
|
||||
CmdPar = "工厂-原料出入库",
|
||||
Icon = "\uea25",
|
||||
IsParent = false,
|
||||
},
|
||||
new NavItemDto
|
||||
{
|
||||
Name = "工厂-原料生产信息",
|
||||
CmdPar = "工厂-原料生产信息",
|
||||
Name = "工厂-包袋生产",
|
||||
CmdPar = "工厂-包袋生产",
|
||||
Icon = "\uea25",
|
||||
IsParent = false,
|
||||
},
|
||||
new NavItemDto
|
||||
{
|
||||
Name = "工厂-成品入库",
|
||||
CmdPar = "工厂-成品入库",
|
||||
Icon = "\uea25",
|
||||
IsParent = false,
|
||||
},
|
||||
@@ -169,6 +176,13 @@ namespace FATrace.WPLApp.Services
|
||||
CmdPar = "工厂-成品出库",
|
||||
Icon = "\uea25",
|
||||
IsParent = false,
|
||||
},
|
||||
new NavItemDto
|
||||
{
|
||||
Name = "工厂-成品入库与出库",
|
||||
CmdPar = "工厂-成品入库与出库",
|
||||
Icon = "\uea25",
|
||||
IsParent = false,
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -205,8 +219,8 @@ namespace FATrace.WPLApp.Services
|
||||
},
|
||||
new NavItemDto
|
||||
{
|
||||
Name = "OEM-原料使用信息",
|
||||
CmdPar = "OEM-原料使用信息",
|
||||
Name = "OEM-原料使用",
|
||||
CmdPar = "OEM-原料使用",
|
||||
Icon = "\ueab4",
|
||||
IsParent = false,
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace FATrace.WPLApp.Services
|
||||
}
|
||||
|
||||
// 每小时扫描一次(3600000 ms),如有需要可后续改为配置项
|
||||
_timer = new System.Timers.Timer(TimeSpan.FromMinutes(1).TotalMilliseconds)//TimeSpan.FromHours(1).TotalMilliseconds
|
||||
_timer = new System.Timers.Timer(TimeSpan.FromHours(1).TotalMilliseconds)
|
||||
{
|
||||
AutoReset = true,
|
||||
Enabled = true
|
||||
@@ -221,14 +221,17 @@ namespace FATrace.WPLApp.Services
|
||||
IWorkbook workbook = new XSSFWorkbook(fs);
|
||||
var formatter = new DataFormatter();
|
||||
|
||||
sheetStats["FactoryInbound"] = ImportFactoryInbound(workbook, formatter);
|
||||
sheetStats["FactoryMaterialWithdrawal"] = ImportFactoryMaterialWithdrawal(workbook, formatter);
|
||||
sheetStats["FactoryInventoryTransaction"] = ImportFactoryInventoryTransaction(workbook, formatter);
|
||||
sheetStats["FactoryRawInbound"] = ImportFactoryRawInbound(workbook, formatter);
|
||||
sheetStats["FactoryRawOutbound"] = ImportFactoryRawOutbound(workbook, formatter);
|
||||
sheetStats["FactoryRawInOutbound"] = ImportFactoryRawInOutbound(workbook, formatter);
|
||||
sheetStats["FactoryProductionRecord"] = ImportFactoryProductionRecord(workbook, formatter);
|
||||
sheetStats["FactoryInbound"] = ImportFactoryInbound(workbook, formatter);
|
||||
sheetStats["FactoryOutbound"] = ImportFactoryOutbound(workbook, formatter);
|
||||
sheetStats["FactoryInOutbound"] = ImportFactoryInOutbound(workbook, formatter);
|
||||
|
||||
sheetStats["OEMInbound"] = ImportOEMInbound(workbook, formatter);
|
||||
sheetStats["OEMOutbound"] = ImportOEMOutbound(workbook, formatter);
|
||||
sheetStats["OEMInventoryTransaction"] = ImportOEMInventoryTransaction(workbook, formatter);
|
||||
sheetStats["OEMInOutbound"] = ImportOEMInOutbound(workbook, formatter);
|
||||
sheetStats["OEMRawUsageInfo"] = ImportOEMRawUsageInfo(workbook, formatter);
|
||||
}
|
||||
|
||||
@@ -306,29 +309,27 @@ namespace FATrace.WPLApp.Services
|
||||
return cell == null ? string.Empty : formatter.FormatCellValue(cell).Trim();
|
||||
}
|
||||
|
||||
private int ImportFactoryInbound(IWorkbook workbook, DataFormatter formatter)
|
||||
private int ImportFactoryRawInbound(IWorkbook workbook, DataFormatter formatter)
|
||||
{
|
||||
var sheet = workbook.GetSheet("工厂-入库");
|
||||
var sheet = workbook.GetSheet("工厂-原料入库");
|
||||
if (sheet == null) return 0;
|
||||
|
||||
var list = new List<FactoryInbound>();
|
||||
var list = new List<FactoryRawInbound>();
|
||||
for (int i = 1; i <= sheet.LastRowNum; i++)
|
||||
{
|
||||
var row = sheet.GetRow(i);
|
||||
if (IsRowEmpty(row, formatter)) continue;
|
||||
|
||||
var entity = new FactoryInbound
|
||||
var entity = new FactoryRawInbound
|
||||
{
|
||||
Origin = GetCellString(row, 0, formatter),
|
||||
RawCode = GetCellString(row, 1, formatter),
|
||||
RawName = GetCellString(row, 2, formatter),
|
||||
Weight = GetCellString(row, 3, formatter),
|
||||
LoginDate = GetCellString(row, 4, formatter),
|
||||
LoginTime = GetCellString(row, 5, formatter),
|
||||
LoginDateTime = GetCellString(row, 6, formatter)
|
||||
LoginDateTime = GetCellString(row, 4, formatter)
|
||||
};
|
||||
|
||||
if (IsAllEmpty(entity.Origin, entity.RawCode, entity.RawName, entity.Weight, entity.LoginDate, entity.LoginTime, entity.LoginDateTime))
|
||||
if (IsAllEmpty(entity.Origin, entity.RawCode, entity.RawName, entity.Weight, entity.LoginDateTime))
|
||||
continue;
|
||||
|
||||
list.Add(entity);
|
||||
@@ -341,29 +342,27 @@ namespace FATrace.WPLApp.Services
|
||||
return list.Count;
|
||||
}
|
||||
|
||||
private int ImportFactoryMaterialWithdrawal(IWorkbook workbook, DataFormatter formatter)
|
||||
private int ImportFactoryRawOutbound(IWorkbook workbook, DataFormatter formatter)
|
||||
{
|
||||
var sheet = workbook.GetSheet("工厂-领料");
|
||||
var sheet = workbook.GetSheet("工厂-原料出库");
|
||||
if (sheet == null) return 0;
|
||||
|
||||
var list = new List<FactoryMaterialWithdrawal>();
|
||||
var list = new List<FactoryRawOutbound>();
|
||||
for (int i = 1; i <= sheet.LastRowNum; i++)
|
||||
{
|
||||
var row = sheet.GetRow(i);
|
||||
if (IsRowEmpty(row, formatter)) continue;
|
||||
|
||||
var entity = new FactoryMaterialWithdrawal
|
||||
var entity = new FactoryRawOutbound
|
||||
{
|
||||
Origin = GetCellString(row, 0, formatter),
|
||||
RawCode = GetCellString(row, 1, formatter),
|
||||
RawName = GetCellString(row, 2, formatter),
|
||||
Weight = GetCellString(row, 3, formatter),
|
||||
LoginDate = GetCellString(row, 4, formatter),
|
||||
LoginTime = GetCellString(row, 5, formatter),
|
||||
LoginDateTime = GetCellString(row, 6, formatter)
|
||||
LoginDateTime = GetCellString(row, 4, formatter)
|
||||
};
|
||||
|
||||
if (IsAllEmpty(entity.Origin, entity.RawCode, entity.RawName, entity.Weight, entity.LoginDate, entity.LoginTime, entity.LoginDateTime))
|
||||
if (IsAllEmpty(entity.Origin, entity.RawCode, entity.RawName, entity.Weight, entity.LoginDateTime))
|
||||
continue;
|
||||
|
||||
list.Add(entity);
|
||||
@@ -376,18 +375,18 @@ namespace FATrace.WPLApp.Services
|
||||
return list.Count;
|
||||
}
|
||||
|
||||
private int ImportFactoryInventoryTransaction(IWorkbook workbook, DataFormatter formatter)
|
||||
private int ImportFactoryRawInOutbound(IWorkbook workbook, DataFormatter formatter)
|
||||
{
|
||||
var sheet = workbook.GetSheet("工厂-出入库");
|
||||
var sheet = workbook.GetSheet("工厂-原料出入库");
|
||||
if (sheet == null) return 0;
|
||||
|
||||
var list = new List<FactoryInventoryTransaction>();
|
||||
var list = new List<FactoryRawInOutbound>();
|
||||
for (int i = 1; i <= sheet.LastRowNum; i++)
|
||||
{
|
||||
var row = sheet.GetRow(i);
|
||||
if (IsRowEmpty(row, formatter)) continue;
|
||||
|
||||
var entity = new FactoryInventoryTransaction
|
||||
var entity = new FactoryRawInOutbound
|
||||
{
|
||||
InTime = GetCellString(row, 0, formatter),
|
||||
OutTime = GetCellString(row, 1, formatter),
|
||||
@@ -414,7 +413,7 @@ namespace FATrace.WPLApp.Services
|
||||
|
||||
private int ImportFactoryProductionRecord(IWorkbook workbook, DataFormatter formatter)
|
||||
{
|
||||
var sheet = workbook.GetSheet("工厂-原料生产信息");
|
||||
var sheet = workbook.GetSheet("工厂-包袋生产信息");
|
||||
if (sheet == null) return 0;
|
||||
|
||||
var list = new List<FactoryProductionRecord>();
|
||||
@@ -457,9 +456,45 @@ namespace FATrace.WPLApp.Services
|
||||
return list.Count;
|
||||
}
|
||||
|
||||
private int ImportFactoryInbound(IWorkbook workbook, DataFormatter formatter)
|
||||
{
|
||||
var sheet = workbook.GetSheet("工厂-成品入库信息");
|
||||
if (sheet == null) return 0;
|
||||
|
||||
var list = new List<FactoryInbound>();
|
||||
for (int i = 1; i <= sheet.LastRowNum; i++)
|
||||
{
|
||||
var row = sheet.GetRow(i);
|
||||
if (IsRowEmpty(row, formatter)) continue;
|
||||
|
||||
var entity = new FactoryInbound
|
||||
{
|
||||
Batch = GetCellString(row, 0, formatter),
|
||||
Weight = GetCellString(row, 1, formatter),
|
||||
ShelfLife = GetCellString(row, 2, formatter),
|
||||
Origin = GetCellString(row, 3, formatter),
|
||||
RawCode = GetCellString(row, 4, formatter),
|
||||
RawName = GetCellString(row, 5, formatter),
|
||||
SequenceNo = GetCellString(row, 6, formatter),
|
||||
LoginDateTime = GetCellString(row, 7, formatter)
|
||||
};
|
||||
|
||||
if (IsAllEmpty(entity.Batch, entity.Weight, entity.ShelfLife, entity.Origin, entity.RawCode, entity.RawName, entity.SequenceNo, entity.LoginDateTime))
|
||||
continue;
|
||||
|
||||
list.Add(entity);
|
||||
}
|
||||
|
||||
if (list.Count > 0)
|
||||
{
|
||||
_fsql.Insert(list).ExecuteAffrows();
|
||||
}
|
||||
return list.Count;
|
||||
}
|
||||
|
||||
private int ImportFactoryOutbound(IWorkbook workbook, DataFormatter formatter)
|
||||
{
|
||||
var sheet = workbook.GetSheet("工厂-成品出库");
|
||||
var sheet = workbook.GetSheet("工厂-成品出库信息");
|
||||
if (sheet == null) return 0;
|
||||
|
||||
var list = new List<FactoryOutbound>();
|
||||
@@ -477,13 +512,48 @@ namespace FATrace.WPLApp.Services
|
||||
RawCode = GetCellString(row, 4, formatter),
|
||||
RawName = GetCellString(row, 5, formatter),
|
||||
SequenceNo = GetCellString(row, 6, formatter),
|
||||
LoginDate = GetCellString(row, 7, formatter),
|
||||
LoginTime = GetCellString(row, 8, formatter),
|
||||
LoginDateTime = GetCellString(row, 9, formatter)
|
||||
LoginDateTime = GetCellString(row, 7, formatter)
|
||||
};
|
||||
|
||||
if (IsAllEmpty(entity.Batch, entity.Weight, entity.ShelfLife, entity.Origin, entity.RawCode, entity.RawName,
|
||||
entity.SequenceNo, entity.LoginDate, entity.LoginTime, entity.LoginDateTime))
|
||||
entity.SequenceNo, entity.LoginDateTime))
|
||||
continue;
|
||||
|
||||
list.Add(entity);
|
||||
}
|
||||
|
||||
if (list.Count > 0)
|
||||
{
|
||||
_fsql.Insert(list).ExecuteAffrows();
|
||||
}
|
||||
return list.Count;
|
||||
}
|
||||
|
||||
private int ImportFactoryInOutbound(IWorkbook workbook, DataFormatter formatter)
|
||||
{
|
||||
var sheet = workbook.GetSheet("工厂-成品入库与出库信息");
|
||||
if (sheet == null) return 0;
|
||||
|
||||
var list = new List<FactoryInOutbound>();
|
||||
for (int i = 1; i <= sheet.LastRowNum; i++)
|
||||
{
|
||||
var row = sheet.GetRow(i);
|
||||
if (IsRowEmpty(row, formatter)) continue;
|
||||
|
||||
var entity = new FactoryInOutbound
|
||||
{
|
||||
InTime = GetCellString(row, 0, formatter),
|
||||
OutTime = GetCellString(row, 1, formatter),
|
||||
Origin = GetCellString(row, 2, formatter),
|
||||
Batch = GetCellString(row, 3, formatter),
|
||||
RawCode = GetCellString(row, 4, formatter),
|
||||
RawName = GetCellString(row, 5, formatter),
|
||||
TotalInPcs = GetCellString(row, 6, formatter),
|
||||
TotalOutPcs = GetCellString(row, 7, formatter),
|
||||
RemainPcs = GetCellString(row, 8, formatter)
|
||||
};
|
||||
|
||||
if (IsAllEmpty(entity.InTime, entity.OutTime, entity.Origin, entity.Batch, entity.RawCode, entity.RawName, entity.TotalInPcs, entity.TotalOutPcs, entity.RemainPcs))
|
||||
continue;
|
||||
|
||||
list.Add(entity);
|
||||
@@ -516,13 +586,11 @@ namespace FATrace.WPLApp.Services
|
||||
RawCode = GetCellString(row, 4, formatter),
|
||||
RawName = GetCellString(row, 5, formatter),
|
||||
SequenceNo = GetCellString(row, 6, formatter),
|
||||
LoginDate = GetCellString(row, 7, formatter),
|
||||
LoginTime = GetCellString(row, 8, formatter),
|
||||
LoginDateTime = GetCellString(row, 9, formatter)
|
||||
LoginDateTime = GetCellString(row, 7, formatter)
|
||||
};
|
||||
|
||||
if (IsAllEmpty(entity.Batch, entity.Weight, entity.ShelfLife, entity.Origin, entity.RawCode, entity.RawName,
|
||||
entity.SequenceNo, entity.LoginDate, entity.LoginTime, entity.LoginDateTime))
|
||||
entity.SequenceNo, entity.LoginDateTime))
|
||||
continue;
|
||||
|
||||
list.Add(entity);
|
||||
@@ -555,13 +623,11 @@ namespace FATrace.WPLApp.Services
|
||||
RawCode = GetCellString(row, 4, formatter),
|
||||
RawName = GetCellString(row, 5, formatter),
|
||||
SequenceNo = GetCellString(row, 6, formatter),
|
||||
LoginDate = GetCellString(row, 7, formatter),
|
||||
LoginTime = GetCellString(row, 8, formatter),
|
||||
LoginDateTime = GetCellString(row, 9, formatter)
|
||||
LoginDateTime = GetCellString(row, 7, formatter)
|
||||
};
|
||||
|
||||
if (IsAllEmpty(entity.Batch, entity.Weight, entity.ShelfLife, entity.Origin, entity.RawCode, entity.RawName,
|
||||
entity.SequenceNo, entity.LoginDate, entity.LoginTime, entity.LoginDateTime))
|
||||
entity.SequenceNo, entity.LoginDateTime))
|
||||
continue;
|
||||
|
||||
list.Add(entity);
|
||||
@@ -574,18 +640,18 @@ namespace FATrace.WPLApp.Services
|
||||
return list.Count;
|
||||
}
|
||||
|
||||
private int ImportOEMInventoryTransaction(IWorkbook workbook, DataFormatter formatter)
|
||||
private int ImportOEMInOutbound(IWorkbook workbook, DataFormatter formatter)
|
||||
{
|
||||
var sheet = workbook.GetSheet("OEM-出入库");
|
||||
if (sheet == null) return 0;
|
||||
|
||||
var list = new List<OEMInventoryTransaction>();
|
||||
var list = new List<OEMInOutbound>();
|
||||
for (int i = 1; i <= sheet.LastRowNum; i++)
|
||||
{
|
||||
var row = sheet.GetRow(i);
|
||||
if (IsRowEmpty(row, formatter)) continue;
|
||||
|
||||
var entity = new OEMInventoryTransaction
|
||||
var entity = new OEMInOutbound
|
||||
{
|
||||
InTime = GetCellString(row, 0, formatter),
|
||||
OutTime = GetCellString(row, 1, formatter),
|
||||
@@ -629,11 +695,10 @@ namespace FATrace.WPLApp.Services
|
||||
InBagCode = GetCellString(row, 1, formatter),
|
||||
Origin = GetCellString(row, 2, formatter),
|
||||
RawName = GetCellString(row, 3, formatter),
|
||||
RawCode = GetCellString(row, 4, formatter),
|
||||
VideoUrl = GetCellString(row, 5, formatter)
|
||||
RawCode = GetCellString(row, 4, formatter)
|
||||
};
|
||||
|
||||
if (IsAllEmpty(entity.RawUseTime, entity.InBagCode, entity.Origin, entity.RawName, entity.RawCode, entity.VideoUrl))
|
||||
if (IsAllEmpty(entity.RawUseTime, entity.InBagCode, entity.Origin, entity.RawName, entity.RawCode))
|
||||
continue;
|
||||
|
||||
list.Add(entity);
|
||||
|
||||
272
FATrace.WPLApp/ViewModels/FactoryInOutboundViewModel.cs
Normal file
272
FATrace.WPLApp/ViewModels/FactoryInOutboundViewModel.cs
Normal file
@@ -0,0 +1,272 @@
|
||||
using FATrace.Model;
|
||||
using FATrace.WPLApp.Core;
|
||||
using FATrace.WPLApp.Services;
|
||||
using FreeSql;
|
||||
using Prism.Commands;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace FATrace.WPLApp.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 工厂-成品入库与出库 查询 VM(展示 FactoryInOutbound)
|
||||
/// </summary>
|
||||
public class FactoryInOutboundViewModel : NavigationViewModel
|
||||
{
|
||||
private readonly IFreeSql _fsql;
|
||||
private readonly ILogService _log;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="fsql">FreeSql 实例</param>
|
||||
/// <param name="log">日志服务</param>
|
||||
public FactoryInOutboundViewModel(IFreeSql fsql, ILogService log)
|
||||
{
|
||||
_fsql = fsql;
|
||||
_log = log;
|
||||
|
||||
Items = new ObservableCollection<FactoryInOutbound>();
|
||||
|
||||
SearchCommand = new DelegateCommand(async () => await SearchAsync(), () => !IsBusy)
|
||||
.ObservesProperty(() => IsBusy);
|
||||
ClearCommand = new DelegateCommand(ClearFilters, () => !IsBusy)
|
||||
.ObservesProperty(() => IsBusy);
|
||||
|
||||
FirstPageCommand = new DelegateCommand(async () => { if (PageIndex == 1) return; PageIndex = 1; await SearchAsync(); }, () => !IsBusy && PageIndex > 1)
|
||||
.ObservesProperty(() => IsBusy)
|
||||
.ObservesProperty(() => PageIndex);
|
||||
PrevPageCommand = new DelegateCommand(async () => { if (PageIndex <= 1) return; PageIndex -= 1; await SearchAsync(); }, () => !IsBusy && PageIndex > 1)
|
||||
.ObservesProperty(() => IsBusy)
|
||||
.ObservesProperty(() => PageIndex);
|
||||
NextPageCommand = new DelegateCommand(async () => { if (PageIndex >= TotalPages) return; PageIndex += 1; await SearchAsync(); }, () => !IsBusy && PageIndex < TotalPages)
|
||||
.ObservesProperty(() => IsBusy)
|
||||
.ObservesProperty(() => PageIndex)
|
||||
.ObservesProperty(() => TotalPages);
|
||||
LastPageCommand = new DelegateCommand(async () => { if (TotalPages <= 0 || PageIndex == TotalPages) return; PageIndex = TotalPages; await SearchAsync(); }, () => !IsBusy && PageIndex < TotalPages)
|
||||
.ObservesProperty(() => IsBusy)
|
||||
.ObservesProperty(() => PageIndex)
|
||||
.ObservesProperty(() => TotalPages);
|
||||
}
|
||||
|
||||
#region 查询条件
|
||||
private string? _origin;
|
||||
/// <summary>
|
||||
/// 产地(模糊匹配)
|
||||
/// </summary>
|
||||
public string? Origin { get => _origin; set { _origin = value; RaisePropertyChanged(); } }
|
||||
|
||||
private string? _batch;
|
||||
/// <summary>
|
||||
/// 批号(模糊匹配)
|
||||
/// </summary>
|
||||
public string? Batch { get => _batch; set { _batch = value; RaisePropertyChanged(); } }
|
||||
|
||||
private string? _rawCode;
|
||||
/// <summary>
|
||||
/// 原料代码(模糊匹配)
|
||||
/// </summary>
|
||||
public string? RawCode { get => _rawCode; set { _rawCode = value; RaisePropertyChanged(); } }
|
||||
|
||||
private string? _rawName;
|
||||
/// <summary>
|
||||
/// 原料名称(模糊匹配)
|
||||
/// </summary>
|
||||
public string? RawName { get => _rawName; set { _rawName = value; RaisePropertyChanged(); } }
|
||||
|
||||
private DateTime? _startDate;
|
||||
/// <summary>
|
||||
/// 入库时间起(基于 InTime)
|
||||
/// </summary>
|
||||
public DateTime? StartDate { get => _startDate; set { _startDate = value; RaisePropertyChanged(); } }
|
||||
|
||||
private DateTime? _endDate;
|
||||
/// <summary>
|
||||
/// 入库时间止(基于 InTime,包含当天)
|
||||
/// </summary>
|
||||
public DateTime? EndDate { get => _endDate; set { _endDate = value; RaisePropertyChanged(); } }
|
||||
#endregion
|
||||
|
||||
#region 列表与分页
|
||||
/// <summary>
|
||||
/// 列表数据
|
||||
/// </summary>
|
||||
public ObservableCollection<FactoryInOutbound> Items { get; }
|
||||
|
||||
private bool _isBusy;
|
||||
/// <summary>
|
||||
/// 是否忙碌
|
||||
/// </summary>
|
||||
public bool IsBusy { get => _isBusy; set { _isBusy = value; RaisePropertyChanged(); } }
|
||||
|
||||
private int _totalCount;
|
||||
/// <summary>
|
||||
/// 总记录数
|
||||
/// </summary>
|
||||
public int TotalCount { get => _totalCount; set { _totalCount = value; RaisePropertyChanged(); } }
|
||||
|
||||
private int _pageIndex = 1;
|
||||
/// <summary>
|
||||
/// 当前页码
|
||||
/// </summary>
|
||||
public int PageIndex { get => _pageIndex; set { _pageIndex = value < 1 ? 1 : value; RaisePropertyChanged(); } }
|
||||
|
||||
private int _pageSize = 20;
|
||||
/// <summary>
|
||||
/// 页大小
|
||||
/// </summary>
|
||||
public int PageSize
|
||||
{
|
||||
get => _pageSize;
|
||||
set
|
||||
{
|
||||
var v = value <= 0 ? 20 : value;
|
||||
if (_pageSize != v)
|
||||
{
|
||||
_pageSize = v;
|
||||
RaisePropertyChanged();
|
||||
PageIndex = 1;
|
||||
if (!IsBusy) _ = SearchAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int _totalPages;
|
||||
/// <summary>
|
||||
/// 总页数
|
||||
/// </summary>
|
||||
public int TotalPages { get => _totalPages; set { _totalPages = value; RaisePropertyChanged(); } }
|
||||
#endregion
|
||||
|
||||
#region 命令
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
public DelegateCommand SearchCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 清空
|
||||
/// </summary>
|
||||
public DelegateCommand ClearCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 首页
|
||||
/// </summary>
|
||||
public DelegateCommand FirstPageCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 上一页
|
||||
/// </summary>
|
||||
public DelegateCommand PrevPageCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 下一页
|
||||
/// </summary>
|
||||
public DelegateCommand NextPageCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 末页
|
||||
/// </summary>
|
||||
public DelegateCommand LastPageCommand { get; }
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 清空筛选条件
|
||||
/// </summary>
|
||||
private void ClearFilters()
|
||||
{
|
||||
Origin = Batch = RawCode = RawName = string.Empty;
|
||||
StartDate = null;
|
||||
EndDate = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行查询
|
||||
/// </summary>
|
||||
private async Task SearchAsync()
|
||||
{
|
||||
if (IsBusy) return;
|
||||
try
|
||||
{
|
||||
IsBusy = true;
|
||||
_log.Info("FactoryInOutbound 查询开始");
|
||||
|
||||
var data = await Task.Run(() =>
|
||||
{
|
||||
var q = _fsql.Select<FactoryInOutbound>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Origin))
|
||||
q = q.Where(a => a.Origin != null && a.Origin.Contains(Origin));
|
||||
if (!string.IsNullOrWhiteSpace(Batch))
|
||||
q = q.Where(a => a.Batch != null && a.Batch.Contains(Batch));
|
||||
if (!string.IsNullOrWhiteSpace(RawCode))
|
||||
q = q.Where(a => a.RawCode != null && a.RawCode.Contains(RawCode));
|
||||
if (!string.IsNullOrWhiteSpace(RawName))
|
||||
q = q.Where(a => a.RawName != null && a.RawName.Contains(RawName));
|
||||
|
||||
DateTime? start = StartDate;
|
||||
DateTime? end = EndDate;
|
||||
if (start.HasValue)
|
||||
{
|
||||
var s = start.Value.Date;
|
||||
q = q.Where("TRY_CONVERT(datetime, InTime) >= @start", new { start = s });
|
||||
}
|
||||
if (end.HasValue)
|
||||
{
|
||||
var e = end.Value.Date.AddDays(1).AddTicks(-1);
|
||||
q = q.Where("TRY_CONVERT(datetime, InTime) <= @end", new { end = e });
|
||||
}
|
||||
|
||||
q = q.OrderByDescending(a => a.Id);
|
||||
|
||||
var page = PageIndex < 1 ? 1 : PageIndex;
|
||||
var size = PageSize <= 0 ? 20 : PageSize;
|
||||
|
||||
var list = q.Count(out var total)
|
||||
.Page(page, size)
|
||||
.ToList();
|
||||
|
||||
var pages = total <= 0 || size <= 0 ? 0 : (int)Math.Ceiling(total * 1.0 / size);
|
||||
if (pages > 0 && page > pages)
|
||||
{
|
||||
page = pages;
|
||||
list = q.Page(page, size).ToList();
|
||||
}
|
||||
|
||||
return (items: list, total: (int)total, normalizedPage: page, totalPages: pages);
|
||||
});
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Items.Clear();
|
||||
foreach (var it in data.items) Items.Add(it);
|
||||
TotalCount = data.total;
|
||||
TotalPages = data.totalPages;
|
||||
PageIndex = data.normalizedPage == 0 ? 1 : data.normalizedPage;
|
||||
});
|
||||
|
||||
_log.Info($"FactoryInOutbound 查询完成,记录数: {TotalCount}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Error($"FactoryInOutbound 查询失败: {ex}");
|
||||
MessageBox.Show($"查询失败: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsBusy = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导航进入时自动查询
|
||||
/// </summary>
|
||||
/// <param name="navigationContext">导航上下文</param>
|
||||
public override async void OnNavigatedTo(Prism.Regions.NavigationContext navigationContext)
|
||||
{
|
||||
await SearchAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ using System.Windows;
|
||||
namespace FATrace.WPLApp.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 工厂-入库 数据查询 VM
|
||||
/// 工厂-成品入库 数据查询 VM
|
||||
/// 仅展示从 Excel 导入的 FactoryInbound 数据,支持简单条件与分页。
|
||||
/// </summary>
|
||||
public class FactoryInboundViewModel : NavigationViewModel
|
||||
|
||||
@@ -11,8 +11,8 @@ using System.Windows;
|
||||
namespace FATrace.WPLApp.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 工厂-出入库 数据查询 VM
|
||||
/// 仅展示从 Excel 导入的 FactoryInventoryTransaction 数据,支持简单条件与分页。
|
||||
/// 工厂-原料出入库 数据查询 VM
|
||||
/// 仅展示从 Excel 导入的 FactoryRawInOutbound 数据,支持简单条件与分页。
|
||||
/// </summary>
|
||||
public class FactoryInventoryTransactionViewModel : NavigationViewModel
|
||||
{
|
||||
@@ -24,7 +24,7 @@ namespace FATrace.WPLApp.ViewModels
|
||||
_fsql = fsql;
|
||||
_log = log;
|
||||
|
||||
Items = new ObservableCollection<FactoryInventoryTransaction>();
|
||||
Items = new ObservableCollection<FactoryRawInOutbound>();
|
||||
|
||||
SearchCommand = new DelegateCommand(async () => await SearchAsync(), () => !IsBusy)
|
||||
.ObservesProperty(() => IsBusy);
|
||||
@@ -79,7 +79,7 @@ namespace FATrace.WPLApp.ViewModels
|
||||
#endregion
|
||||
|
||||
#region 列表与分页
|
||||
public ObservableCollection<FactoryInventoryTransaction> Items { get; }
|
||||
public ObservableCollection<FactoryRawInOutbound> Items { get; }
|
||||
|
||||
private bool _isBusy;
|
||||
public bool IsBusy { get => _isBusy; set { _isBusy = value; RaisePropertyChanged(); } }
|
||||
@@ -133,11 +133,11 @@ namespace FATrace.WPLApp.ViewModels
|
||||
try
|
||||
{
|
||||
IsBusy = true;
|
||||
_log.Info("FactoryInventoryTransaction 查询开始");
|
||||
_log.Info("FactoryRawInOutbound 查询开始");
|
||||
|
||||
var data = await Task.Run(() =>
|
||||
{
|
||||
var q = _fsql.Select<FactoryInventoryTransaction>();
|
||||
var q = _fsql.Select<FactoryRawInOutbound>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Origin))
|
||||
q = q.Where(a => a.Origin != null && a.Origin.Contains(Origin));
|
||||
@@ -187,11 +187,11 @@ namespace FATrace.WPLApp.ViewModels
|
||||
PageIndex = data.normalizedPage == 0 ? 1 : data.normalizedPage;
|
||||
});
|
||||
|
||||
_log.Info($"FactoryInventoryTransaction 查询完成,记录数: {TotalCount}");
|
||||
_log.Info($"FactoryRawInOutbound 查询完成,记录数: {TotalCount}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Error($"FactoryInventoryTransaction 查询失败: {ex}");
|
||||
_log.Error($"FactoryRawInOutbound 查询失败: {ex}");
|
||||
MessageBox.Show($"查询失败: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -11,8 +11,8 @@ using System.Windows;
|
||||
namespace FATrace.WPLApp.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 工厂-领料 数据查询 VM
|
||||
/// 仅展示从 Excel 导入的 FactoryMaterialWithdrawal 数据,支持简单条件与分页。
|
||||
/// 工厂-原料出库 数据查询 VM
|
||||
/// 仅展示从 Excel 导入的 FactoryRawOutbound 数据,支持简单条件与分页。
|
||||
/// </summary>
|
||||
public class FactoryMaterialWithdrawalViewModel : NavigationViewModel
|
||||
{
|
||||
@@ -24,7 +24,7 @@ namespace FATrace.WPLApp.ViewModels
|
||||
_fsql = fsql;
|
||||
_log = log;
|
||||
|
||||
Items = new ObservableCollection<FactoryMaterialWithdrawal>();
|
||||
Items = new ObservableCollection<FactoryRawOutbound>();
|
||||
|
||||
SearchCommand = new DelegateCommand(async () => await SearchAsync(), () => !IsBusy)
|
||||
.ObservesProperty(() => IsBusy);
|
||||
@@ -79,7 +79,7 @@ namespace FATrace.WPLApp.ViewModels
|
||||
#endregion
|
||||
|
||||
#region 列表与分页
|
||||
public ObservableCollection<FactoryMaterialWithdrawal> Items { get; }
|
||||
public ObservableCollection<FactoryRawOutbound> Items { get; }
|
||||
|
||||
private bool _isBusy;
|
||||
public bool IsBusy { get => _isBusy; set { _isBusy = value; RaisePropertyChanged(); } }
|
||||
@@ -133,11 +133,11 @@ namespace FATrace.WPLApp.ViewModels
|
||||
try
|
||||
{
|
||||
IsBusy = true;
|
||||
_log.Info("FactoryMaterialWithdrawal 查询开始");
|
||||
_log.Info("FactoryRawOutbound 查询开始");
|
||||
|
||||
var data = await Task.Run(() =>
|
||||
{
|
||||
var q = _fsql.Select<FactoryMaterialWithdrawal>();
|
||||
var q = _fsql.Select<FactoryRawOutbound>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Origin))
|
||||
q = q.Where(a => a.Origin != null && a.Origin.Contains(Origin));
|
||||
@@ -187,11 +187,11 @@ namespace FATrace.WPLApp.ViewModels
|
||||
PageIndex = data.normalizedPage == 0 ? 1 : data.normalizedPage;
|
||||
});
|
||||
|
||||
_log.Info($"FactoryMaterialWithdrawal 查询完成,记录数: {TotalCount}");
|
||||
_log.Info($"FactoryRawOutbound 查询完成,记录数: {TotalCount}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Error($"FactoryMaterialWithdrawal 查询失败: {ex}");
|
||||
_log.Error($"FactoryRawOutbound 查询失败: {ex}");
|
||||
MessageBox.Show($"查询失败: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
finally
|
||||
|
||||
@@ -11,7 +11,7 @@ using System.Windows;
|
||||
namespace FATrace.WPLApp.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 工厂-原料生产信息 查询 VM(展示 FactoryProductionRecord)
|
||||
/// 工厂-包袋生产 查询 VM(展示 FactoryProductionRecord)
|
||||
/// </summary>
|
||||
public class FactoryProductionRecordViewModel : NavigationViewModel
|
||||
{
|
||||
@@ -141,7 +141,7 @@ namespace FATrace.WPLApp.ViewModels
|
||||
try
|
||||
{
|
||||
IsBusy = true;
|
||||
_log.Info("FactoryProductionRecord 查询开始");
|
||||
_log.Info("FactoryProductionRecord(工厂-包袋生产) 查询开始");
|
||||
|
||||
var data = await Task.Run(() =>
|
||||
{
|
||||
@@ -195,11 +195,11 @@ namespace FATrace.WPLApp.ViewModels
|
||||
PageIndex = data.normalizedPage == 0 ? 1 : data.normalizedPage;
|
||||
});
|
||||
|
||||
_log.Info($"FactoryProductionRecord 查询完成,记录数: {TotalCount}");
|
||||
_log.Info($"FactoryProductionRecord(工厂-包袋生产) 查询完成,记录数: {TotalCount}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Error($"FactoryProductionRecord 查询失败: {ex}");
|
||||
_log.Error($"FactoryProductionRecord(工厂-包袋生产) 查询失败: {ex}");
|
||||
MessageBox.Show($"查询失败: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
finally
|
||||
|
||||
264
FATrace.WPLApp/ViewModels/FactoryRawInboundViewModel.cs
Normal file
264
FATrace.WPLApp/ViewModels/FactoryRawInboundViewModel.cs
Normal file
@@ -0,0 +1,264 @@
|
||||
using FATrace.Model;
|
||||
using FATrace.WPLApp.Core;
|
||||
using FATrace.WPLApp.Services;
|
||||
using FreeSql;
|
||||
using Prism.Commands;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace FATrace.WPLApp.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 工厂-原料入库 数据查询 VM(展示 FactoryRawInbound)
|
||||
/// </summary>
|
||||
public class FactoryRawInboundViewModel : NavigationViewModel
|
||||
{
|
||||
private readonly IFreeSql _fsql;
|
||||
private readonly ILogService _log;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="fsql">FreeSql 实例</param>
|
||||
/// <param name="log">日志服务</param>
|
||||
public FactoryRawInboundViewModel(IFreeSql fsql, ILogService log)
|
||||
{
|
||||
_fsql = fsql;
|
||||
_log = log;
|
||||
|
||||
Items = new ObservableCollection<FactoryRawInbound>();
|
||||
|
||||
SearchCommand = new DelegateCommand(async () => await SearchAsync(), () => !IsBusy)
|
||||
.ObservesProperty(() => IsBusy);
|
||||
ClearCommand = new DelegateCommand(ClearFilters, () => !IsBusy)
|
||||
.ObservesProperty(() => IsBusy);
|
||||
|
||||
FirstPageCommand = new DelegateCommand(async () => { if (PageIndex == 1) return; PageIndex = 1; await SearchAsync(); }, () => !IsBusy && PageIndex > 1)
|
||||
.ObservesProperty(() => IsBusy)
|
||||
.ObservesProperty(() => PageIndex);
|
||||
PrevPageCommand = new DelegateCommand(async () => { if (PageIndex <= 1) return; PageIndex -= 1; await SearchAsync(); }, () => !IsBusy && PageIndex > 1)
|
||||
.ObservesProperty(() => IsBusy)
|
||||
.ObservesProperty(() => PageIndex);
|
||||
NextPageCommand = new DelegateCommand(async () => { if (PageIndex >= TotalPages) return; PageIndex += 1; await SearchAsync(); }, () => !IsBusy && PageIndex < TotalPages)
|
||||
.ObservesProperty(() => IsBusy)
|
||||
.ObservesProperty(() => PageIndex)
|
||||
.ObservesProperty(() => TotalPages);
|
||||
LastPageCommand = new DelegateCommand(async () => { if (TotalPages <= 0 || PageIndex == TotalPages) return; PageIndex = TotalPages; await SearchAsync(); }, () => !IsBusy && PageIndex < TotalPages)
|
||||
.ObservesProperty(() => IsBusy)
|
||||
.ObservesProperty(() => PageIndex)
|
||||
.ObservesProperty(() => TotalPages);
|
||||
}
|
||||
|
||||
#region 查询条件
|
||||
private string? _origin;
|
||||
/// <summary>
|
||||
/// 产地(模糊匹配)
|
||||
/// </summary>
|
||||
public string? Origin { get => _origin; set { _origin = value; RaisePropertyChanged(); } }
|
||||
|
||||
private string? _rawCode;
|
||||
/// <summary>
|
||||
/// 原料代码(模糊匹配)
|
||||
/// </summary>
|
||||
public string? RawCode { get => _rawCode; set { _rawCode = value; RaisePropertyChanged(); } }
|
||||
|
||||
private string? _rawName;
|
||||
/// <summary>
|
||||
/// 原料名称(模糊匹配)
|
||||
/// </summary>
|
||||
public string? RawName { get => _rawName; set { _rawName = value; RaisePropertyChanged(); } }
|
||||
|
||||
private DateTime? _startDate;
|
||||
/// <summary>
|
||||
/// 登录日期起(基于 LoginDateTime)
|
||||
/// </summary>
|
||||
public DateTime? StartDate { get => _startDate; set { _startDate = value; RaisePropertyChanged(); } }
|
||||
|
||||
private DateTime? _endDate;
|
||||
/// <summary>
|
||||
/// 登录日期止(基于 LoginDateTime,包含当天)
|
||||
/// </summary>
|
||||
public DateTime? EndDate { get => _endDate; set { _endDate = value; RaisePropertyChanged(); } }
|
||||
#endregion
|
||||
|
||||
#region 列表与分页
|
||||
/// <summary>
|
||||
/// 列表数据
|
||||
/// </summary>
|
||||
public ObservableCollection<FactoryRawInbound> Items { get; }
|
||||
|
||||
private bool _isBusy;
|
||||
/// <summary>
|
||||
/// 是否忙碌
|
||||
/// </summary>
|
||||
public bool IsBusy { get => _isBusy; set { _isBusy = value; RaisePropertyChanged(); } }
|
||||
|
||||
private int _totalCount;
|
||||
/// <summary>
|
||||
/// 总记录数
|
||||
/// </summary>
|
||||
public int TotalCount { get => _totalCount; set { _totalCount = value; RaisePropertyChanged(); } }
|
||||
|
||||
private int _pageIndex = 1;
|
||||
/// <summary>
|
||||
/// 当前页码
|
||||
/// </summary>
|
||||
public int PageIndex { get => _pageIndex; set { _pageIndex = value < 1 ? 1 : value; RaisePropertyChanged(); } }
|
||||
|
||||
private int _pageSize = 20;
|
||||
/// <summary>
|
||||
/// 页大小
|
||||
/// </summary>
|
||||
public int PageSize
|
||||
{
|
||||
get => _pageSize;
|
||||
set
|
||||
{
|
||||
var v = value <= 0 ? 20 : value;
|
||||
if (_pageSize != v)
|
||||
{
|
||||
_pageSize = v;
|
||||
RaisePropertyChanged();
|
||||
PageIndex = 1;
|
||||
if (!IsBusy) _ = SearchAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int _totalPages;
|
||||
/// <summary>
|
||||
/// 总页数
|
||||
/// </summary>
|
||||
public int TotalPages { get => _totalPages; set { _totalPages = value; RaisePropertyChanged(); } }
|
||||
#endregion
|
||||
|
||||
#region 命令
|
||||
/// <summary>
|
||||
/// 查询命令
|
||||
/// </summary>
|
||||
public DelegateCommand SearchCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 清空命令
|
||||
/// </summary>
|
||||
public DelegateCommand ClearCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 首页
|
||||
/// </summary>
|
||||
public DelegateCommand FirstPageCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 上一页
|
||||
/// </summary>
|
||||
public DelegateCommand PrevPageCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 下一页
|
||||
/// </summary>
|
||||
public DelegateCommand NextPageCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 末页
|
||||
/// </summary>
|
||||
public DelegateCommand LastPageCommand { get; }
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 清空筛选条件
|
||||
/// </summary>
|
||||
private void ClearFilters()
|
||||
{
|
||||
Origin = RawCode = RawName = string.Empty;
|
||||
StartDate = null;
|
||||
EndDate = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行查询
|
||||
/// </summary>
|
||||
private async Task SearchAsync()
|
||||
{
|
||||
if (IsBusy) return;
|
||||
try
|
||||
{
|
||||
IsBusy = true;
|
||||
_log.Info("FactoryRawInbound 查询开始");
|
||||
|
||||
var data = await Task.Run(() =>
|
||||
{
|
||||
var q = _fsql.Select<FactoryRawInbound>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Origin))
|
||||
q = q.Where(a => a.Origin != null && a.Origin.Contains(Origin));
|
||||
if (!string.IsNullOrWhiteSpace(RawCode))
|
||||
q = q.Where(a => a.RawCode != null && a.RawCode.Contains(RawCode));
|
||||
if (!string.IsNullOrWhiteSpace(RawName))
|
||||
q = q.Where(a => a.RawName != null && a.RawName.Contains(RawName));
|
||||
|
||||
DateTime? start = StartDate;
|
||||
DateTime? end = EndDate;
|
||||
if (start.HasValue)
|
||||
{
|
||||
var s = start.Value.Date;
|
||||
q = q.Where("TRY_CONVERT(datetime, LoginDateTime) >= @start", new { start = s });
|
||||
}
|
||||
if (end.HasValue)
|
||||
{
|
||||
var e = end.Value.Date.AddDays(1).AddTicks(-1);
|
||||
q = q.Where("TRY_CONVERT(datetime, LoginDateTime) <= @end", new { end = e });
|
||||
}
|
||||
|
||||
q = q.OrderByDescending(a => a.Id);
|
||||
|
||||
var page = PageIndex < 1 ? 1 : PageIndex;
|
||||
var size = PageSize <= 0 ? 20 : PageSize;
|
||||
|
||||
var list = q.Count(out var total)
|
||||
.Page(page, size)
|
||||
.ToList();
|
||||
|
||||
var pages = total <= 0 || size <= 0 ? 0 : (int)Math.Ceiling(total * 1.0 / size);
|
||||
if (pages > 0 && page > pages)
|
||||
{
|
||||
page = pages;
|
||||
list = q.Page(page, size).ToList();
|
||||
}
|
||||
|
||||
return (items: list, total: (int)total, normalizedPage: page, totalPages: pages);
|
||||
});
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Items.Clear();
|
||||
foreach (var it in data.items) Items.Add(it);
|
||||
TotalCount = data.total;
|
||||
TotalPages = data.totalPages;
|
||||
PageIndex = data.normalizedPage == 0 ? 1 : data.normalizedPage;
|
||||
});
|
||||
|
||||
_log.Info($"FactoryRawInbound 查询完成,记录数: {TotalCount}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Error($"FactoryRawInbound 查询失败: {ex}");
|
||||
MessageBox.Show($"查询失败: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsBusy = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导航进入时自动查询
|
||||
/// </summary>
|
||||
/// <param name="navigationContext">导航上下文</param>
|
||||
public override async void OnNavigatedTo(Prism.Regions.NavigationContext navigationContext)
|
||||
{
|
||||
await SearchAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,21 +193,27 @@ namespace FATrace.WPLApp.ViewModels
|
||||
this.regionManager.Regions["ContentRegion"].RequestNavigate("FileImportLogView");
|
||||
break;
|
||||
// 工厂/OEM Excel 导入数据查询
|
||||
case "工厂-入库":
|
||||
this.regionManager.Regions["ContentRegion"].RequestNavigate("FactoryInboundView");
|
||||
case "工厂-原料入库":
|
||||
this.regionManager.Regions["ContentRegion"].RequestNavigate("FactoryRawInboundView");
|
||||
break;
|
||||
case "工厂-领料":
|
||||
case "工厂-原料出库":
|
||||
this.regionManager.Regions["ContentRegion"].RequestNavigate("FactoryMaterialWithdrawalView");
|
||||
break;
|
||||
case "工厂-出入库":
|
||||
case "工厂-原料出入库":
|
||||
this.regionManager.Regions["ContentRegion"].RequestNavigate("FactoryInventoryTransactionView");
|
||||
break;
|
||||
case "工厂-原料生产信息":
|
||||
case "工厂-包袋生产":
|
||||
this.regionManager.Regions["ContentRegion"].RequestNavigate("FactoryProductionRecordView");
|
||||
break;
|
||||
case "工厂-成品入库":
|
||||
this.regionManager.Regions["ContentRegion"].RequestNavigate("FactoryInboundView");
|
||||
break;
|
||||
case "工厂-成品出库":
|
||||
this.regionManager.Regions["ContentRegion"].RequestNavigate("FactoryOutboundView");
|
||||
break;
|
||||
case "工厂-成品入库与出库":
|
||||
this.regionManager.Regions["ContentRegion"].RequestNavigate("FactoryInOutboundView");
|
||||
break;
|
||||
case "OEM-入库":
|
||||
this.regionManager.Regions["ContentRegion"].RequestNavigate("OEMInboundView");
|
||||
break;
|
||||
@@ -217,7 +223,7 @@ namespace FATrace.WPLApp.ViewModels
|
||||
case "OEM-出入库":
|
||||
this.regionManager.Regions["ContentRegion"].RequestNavigate("OEMInventoryTransactionView");
|
||||
break;
|
||||
case "OEM-原料使用信息":
|
||||
case "OEM-原料使用":
|
||||
this.regionManager.Regions["ContentRegion"].RequestNavigate("OEMRawUsageInfoView");
|
||||
break;
|
||||
case "历史报警":
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace FATrace.WPLApp.ViewModels
|
||||
_fsql = fsql;
|
||||
_log = log;
|
||||
|
||||
Items = new ObservableCollection<OEMInventoryTransaction>();
|
||||
Items = new ObservableCollection<OEMInOutbound>();
|
||||
|
||||
SearchCommand = new DelegateCommand(async () => await SearchAsync(), () => !IsBusy)
|
||||
.ObservesProperty(() => IsBusy);
|
||||
@@ -67,7 +67,7 @@ namespace FATrace.WPLApp.ViewModels
|
||||
#endregion
|
||||
|
||||
#region 列表与分页
|
||||
public ObservableCollection<OEMInventoryTransaction> Items { get; }
|
||||
public ObservableCollection<OEMInOutbound> Items { get; }
|
||||
|
||||
private bool _isBusy;
|
||||
public bool IsBusy { get => _isBusy; set { _isBusy = value; RaisePropertyChanged(); } }
|
||||
@@ -125,7 +125,7 @@ namespace FATrace.WPLApp.ViewModels
|
||||
|
||||
var data = await Task.Run(() =>
|
||||
{
|
||||
var q = _fsql.Select<OEMInventoryTransaction>();
|
||||
var q = _fsql.Select<OEMInOutbound>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Origin))
|
||||
q = q.Where(a => a.Origin != null && a.Origin.Contains(Origin));
|
||||
|
||||
@@ -11,7 +11,7 @@ using System.Windows;
|
||||
namespace FATrace.WPLApp.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// OEM-原料使用信息 查询 VM(展示 OEMRawUsageInfo)
|
||||
/// OEM-原料使用 查询 VM(展示 OEMRawUsageInfo)
|
||||
/// </summary>
|
||||
public class OEMRawUsageInfoViewModel : NavigationViewModel
|
||||
{
|
||||
|
||||
132
FATrace.WPLApp/Views/FactoryInOutboundView.xaml
Normal file
132
FATrace.WPLApp/Views/FactoryInOutboundView.xaml
Normal file
@@ -0,0 +1,132 @@
|
||||
<UserControl
|
||||
x:Class="FATrace.WPLApp.Views.FactoryInOutboundView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
d:DesignHeight="720"
|
||||
d:DesignWidth="1280"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="Bool2Vis" />
|
||||
</UserControl.Resources>
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Margin="0,0,0,8" FontSize="20" FontWeight="SemiBold" Text="工厂-成品入库与出库" />
|
||||
|
||||
<Border Grid.Row="1" Padding="10" Background="#F9F9F9" BorderBrush="#DDDDDD" BorderThickness="1" CornerRadius="4">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,10,8" Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="产地:" />
|
||||
<TextBox Width="160" Text="{Binding Origin, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" Margin="0,0,10,8" Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="原料代码:" />
|
||||
<TextBox Width="160" Text="{Binding RawCode, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="2" Margin="0,0,10,8" Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="原料名称:" />
|
||||
<TextBox Width="160" Text="{Binding RawName, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="3" Margin="0,0,10,8" Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="批号:" />
|
||||
<TextBox Width="160" Text="{Binding Batch, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Margin="0,5,10,0" Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="开始日期:" />
|
||||
<DatePicker Width="160" SelectedDate="{Binding StartDate, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Margin="0,5,10,0" Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="结束日期:" />
|
||||
<DatePicker Width="160" SelectedDate="{Binding EndDate, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.Column="3" Margin="0,5,10,0" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Button Width="80" Margin="0,0,8,0" Command="{Binding SearchCommand}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Margin="0,0,6,0" FontFamily="/Assets/Fonts/#iconfont" FontSize="16" Text="" />
|
||||
<TextBlock Text="查询" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Width="80" Margin="0,0,8,0" Command="{Binding ClearCommand}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Margin="0,0,6,0" FontFamily="/Assets/Fonts/#iconfont" FontSize="16" Text="" />
|
||||
<TextBlock Text="清空" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<DataGrid Grid.Row="2" Margin="0,10,0,10" ItemsSource="{Binding Items}" AutoGenerateColumns="False" CanUserAddRows="False" FontSize="15" IsReadOnly="True" RowHeight="34">
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="160" Binding="{Binding InTime}" Header="入库时间" />
|
||||
<DataGridTextColumn Width="160" Binding="{Binding OutTime}" Header="出库时间" />
|
||||
<DataGridTextColumn Width="120" Binding="{Binding Origin}" Header="产地" />
|
||||
<DataGridTextColumn Width="120" Binding="{Binding Batch}" Header="批号" />
|
||||
<DataGridTextColumn Width="140" Binding="{Binding RawCode}" Header="原料代码" />
|
||||
<DataGridTextColumn Width="180" Binding="{Binding RawName}" Header="原料名称" />
|
||||
<DataGridTextColumn Width="150" Binding="{Binding TotalInPcs}" Header="入库总箱数" />
|
||||
<DataGridTextColumn Width="150" Binding="{Binding TotalOutPcs}" Header="出库总箱数" />
|
||||
<DataGridTextColumn Width="150" Binding="{Binding RemainPcs}" Header="剩余箱数" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<StatusBar Grid.Row="3">
|
||||
<StatusBarItem><TextBlock Text="本页:" /></StatusBarItem>
|
||||
<StatusBarItem><TextBlock Text="{Binding Items.Count}" /></StatusBarItem>
|
||||
<StatusBarItem><TextBlock Text=" 总数:" /></StatusBarItem>
|
||||
<StatusBarItem><TextBlock Text="{Binding TotalCount}" /></StatusBarItem>
|
||||
<StatusBarItem><Separator Width="20" /></StatusBarItem>
|
||||
<StatusBarItem><TextBlock Text="页码:" /></StatusBarItem>
|
||||
<StatusBarItem><TextBlock Text="{Binding PageIndex}" /></StatusBarItem>
|
||||
<StatusBarItem><TextBlock Text="/" /></StatusBarItem>
|
||||
<StatusBarItem><TextBlock Text="{Binding TotalPages}" /></StatusBarItem>
|
||||
<StatusBarItem><Button Content="|<" Width="40" Margin="5,0" Command="{Binding FirstPageCommand}" /></StatusBarItem>
|
||||
<StatusBarItem><Button Content="<" Width="40" Margin="5,0" Command="{Binding PrevPageCommand}" /></StatusBarItem>
|
||||
<StatusBarItem><Button Content=">" Width="40" Margin="5,0" Command="{Binding NextPageCommand}" /></StatusBarItem>
|
||||
<StatusBarItem><Button Content=">|" Width="40" Margin="5,0" Command="{Binding LastPageCommand}" /></StatusBarItem>
|
||||
<StatusBarItem><Separator Width="20" /></StatusBarItem>
|
||||
<StatusBarItem><TextBlock Text="页大小:" /></StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<ComboBox Width="80" SelectedValue="{Binding PageSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectedValuePath="Content">
|
||||
<ComboBoxItem Content="10" />
|
||||
<ComboBoxItem Content="20" />
|
||||
<ComboBoxItem Content="50" />
|
||||
<ComboBoxItem Content="100" />
|
||||
</ComboBox>
|
||||
</StatusBarItem>
|
||||
<StatusBarItem HorizontalAlignment="Right">
|
||||
<TextBlock Text="正在处理..." Visibility="{Binding IsBusy, Converter={StaticResource Bool2Vis}}" />
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
18
FATrace.WPLApp/Views/FactoryInOutboundView.xaml.cs
Normal file
18
FATrace.WPLApp/Views/FactoryInOutboundView.xaml.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace FATrace.WPLApp.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// FactoryInOutboundView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class FactoryInOutboundView : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public FactoryInOutboundView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
Margin="0,0,0,8"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="工厂-入库" />
|
||||
Text="工厂-成品入库" />
|
||||
|
||||
<!-- 查询条件区域 -->
|
||||
<Border
|
||||
@@ -147,34 +147,14 @@
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding Origin}"
|
||||
Header="产地" />
|
||||
<DataGridTextColumn
|
||||
Width="160"
|
||||
Binding="{Binding RawCode}"
|
||||
Header="原料代码" />
|
||||
<DataGridTextColumn
|
||||
Width="200"
|
||||
Binding="{Binding RawName}"
|
||||
Header="原料名称" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding Weight}"
|
||||
Header="重量(KG)" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding LoginDate}"
|
||||
Header="登录日" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding LoginTime}"
|
||||
Header="登录时间" />
|
||||
<DataGridTextColumn
|
||||
Width="180"
|
||||
Binding="{Binding LoginDateTime}"
|
||||
Header="登录日期时间" />
|
||||
<DataGridTextColumn Width="120" Binding="{Binding Batch}" Header="批号" />
|
||||
<DataGridTextColumn Width="120" Binding="{Binding Weight}" Header="重量(G)" />
|
||||
<DataGridTextColumn Width="120" Binding="{Binding ShelfLife}" Header="保质期" />
|
||||
<DataGridTextColumn Width="120" Binding="{Binding Origin}" Header="产地" />
|
||||
<DataGridTextColumn Width="160" Binding="{Binding RawCode}" Header="原料代码" />
|
||||
<DataGridTextColumn Width="200" Binding="{Binding RawName}" Header="原料名称" />
|
||||
<DataGridTextColumn Width="120" Binding="{Binding SequenceNo}" Header="序号" />
|
||||
<DataGridTextColumn Width="180" Binding="{Binding LoginDateTime}" Header="登录日期时间" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
Margin="0,0,0,8"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="工厂-出入库" />
|
||||
Text="工厂-原料出入库" />
|
||||
|
||||
<!-- 查询条件区域 -->
|
||||
<Border
|
||||
@@ -154,7 +154,7 @@
|
||||
<DataGridTextColumn
|
||||
Width="160"
|
||||
Binding="{Binding OutTime}"
|
||||
Header="领料时间" />
|
||||
Header="出库时间" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding Origin}"
|
||||
@@ -174,7 +174,7 @@
|
||||
<DataGridTextColumn
|
||||
Width="160"
|
||||
Binding="{Binding TotalOutWeightKg}"
|
||||
Header="领料总重量(KG)" />
|
||||
Header="出库总重量(KG)" />
|
||||
<DataGridTextColumn
|
||||
Width="160"
|
||||
Binding="{Binding RemainWeightKg}"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
Margin="0,0,0,8"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="工厂-领料" />
|
||||
Text="工厂-原料出库" />
|
||||
|
||||
<!-- 查询条件区域 -->
|
||||
<Border
|
||||
@@ -163,14 +163,6 @@
|
||||
Width="120"
|
||||
Binding="{Binding Weight}"
|
||||
Header="重量(KG)" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding LoginDate}"
|
||||
Header="登录日" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding LoginTime}"
|
||||
Header="登录时间" />
|
||||
<DataGridTextColumn
|
||||
Width="180"
|
||||
Binding="{Binding LoginDateTime}"
|
||||
|
||||
@@ -183,14 +183,6 @@
|
||||
Width="80"
|
||||
Binding="{Binding SequenceNo}"
|
||||
Header="序号" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding LoginDate}"
|
||||
Header="登录日" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding LoginTime}"
|
||||
Header="登录时间" />
|
||||
<DataGridTextColumn
|
||||
Width="180"
|
||||
Binding="{Binding LoginDateTime}"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
Margin="0,0,0,8"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="工厂-原料生产信息" />
|
||||
Text="工厂-包袋生产" />
|
||||
|
||||
<!-- 查询条件区域 -->
|
||||
<Border Grid.Row="1" Padding="10" Background="#F9F9F9" BorderBrush="#DDDDDD" BorderThickness="1" CornerRadius="4">
|
||||
@@ -106,10 +106,10 @@
|
||||
<DataGridTextColumn Header="外箱二维码" Binding="{Binding BoxCode}" Width="260" />
|
||||
<DataGridTextColumn Header="批号" Binding="{Binding Batch}" Width="120" />
|
||||
<DataGridTextColumn Header="保质期" Binding="{Binding ShelfLife}" Width="80" />
|
||||
<DataGridTextColumn Header="称重重量(g)" Binding="{Binding Weight}" Width="120" />
|
||||
<DataGridTextColumn Header="称重重量(G)" Binding="{Binding Weight}" Width="120" />
|
||||
<DataGridTextColumn Header="配料日期" Binding="{Binding DeliveryDate}" Width="120" />
|
||||
<DataGridTextColumn Header="剩余重量(Kg)" Binding="{Binding RemainWeight}" Width="150" />
|
||||
<DataGridTextColumn Header="入库总重量(Kg)" Binding="{Binding StockWeight}" Width="170" />
|
||||
<DataGridTextColumn Header="剩余重量(KG)" Binding="{Binding RemainWeight}" Width="150" />
|
||||
<DataGridTextColumn Header="入库总重量(KG)" Binding="{Binding StockWeight}" Width="170" />
|
||||
<DataGridTextColumn Header="称重时间" Binding="{Binding WeightTime}" Width="160" />
|
||||
<DataGridTextColumn Header="操作者" Binding="{Binding OpUser}" Width="100" />
|
||||
<DataGridTextColumn Header="确认者" Binding="{Binding CheckUser}" Width="120" />
|
||||
|
||||
173
FATrace.WPLApp/Views/FactoryRawInboundView.xaml
Normal file
173
FATrace.WPLApp/Views/FactoryRawInboundView.xaml
Normal file
@@ -0,0 +1,173 @@
|
||||
<UserControl
|
||||
x:Class="FATrace.WPLApp.Views.FactoryRawInboundView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
d:DesignHeight="720"
|
||||
d:DesignWidth="1280"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="Bool2Vis" />
|
||||
</UserControl.Resources>
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Margin="0,0,0,8"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="工厂-原料入库" />
|
||||
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Padding="10"
|
||||
Background="#F9F9F9"
|
||||
BorderBrush="#DDDDDD"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Margin="0,0,10,8" Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="产地:" />
|
||||
<TextBox Width="160" Text="{Binding Origin, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" Margin="0,0,10,8" Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="原料代码:" />
|
||||
<TextBox Width="160" Text="{Binding RawCode, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="0" Grid.Column="2" Margin="0,0,10,8" Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="原料名称:" />
|
||||
<TextBox Width="160" Text="{Binding RawName, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.Column="0" Margin="0,5,10,0" Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="开始日期:" />
|
||||
<DatePicker Width="160" SelectedDate="{Binding StartDate, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Margin="0,5,10,0" Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="结束日期:" />
|
||||
<DatePicker Width="160" SelectedDate="{Binding EndDate, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.Column="3" Margin="0,5,10,0" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Button Width="80" Margin="0,0,8,0" Command="{Binding SearchCommand}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Margin="0,0,6,0" FontFamily="/Assets/Fonts/#iconfont" FontSize="16" Text="" />
|
||||
<TextBlock Text="查询" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Width="80" Margin="0,0,8,0" Command="{Binding ClearCommand}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Margin="0,0,6,0" FontFamily="/Assets/Fonts/#iconfont" FontSize="16" Text="" />
|
||||
<TextBlock Text="清空" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<DataGrid
|
||||
Grid.Row="2"
|
||||
Margin="0,10,0,10"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
FontSize="15"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding Items}"
|
||||
RowHeight="34">
|
||||
<DataGrid.ColumnHeaderStyle>
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGrid.ColumnHeaderStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Width="120" Binding="{Binding Origin}" Header="产地" />
|
||||
<DataGridTextColumn Width="160" Binding="{Binding RawCode}" Header="原料代码" />
|
||||
<DataGridTextColumn Width="200" Binding="{Binding RawName}" Header="原料名称" />
|
||||
<DataGridTextColumn Width="120" Binding="{Binding Weight}" Header="重量(KG)" />
|
||||
<DataGridTextColumn Width="180" Binding="{Binding LoginDateTime}" Header="登录日期时间" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<StatusBar Grid.Row="3">
|
||||
<StatusBarItem>
|
||||
<TextBlock Text="本页:" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<TextBlock Text="{Binding Items.Count}" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<TextBlock Text=" 总数:" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<TextBlock Text="{Binding TotalCount}" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<Separator Width="20" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<TextBlock Text="页码:" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<TextBlock Text="{Binding PageIndex}" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<TextBlock Text="/" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<TextBlock Text="{Binding TotalPages}" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<Button Width="40" Margin="5,0" Command="{Binding FirstPageCommand}" Content="|<" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<Button Width="40" Margin="5,0" Command="{Binding PrevPageCommand}" Content="<" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<Button Width="40" Margin="5,0" Command="{Binding NextPageCommand}" Content=">" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<Button Width="40" Margin="5,0" Command="{Binding LastPageCommand}" Content=">|" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<Separator Width="20" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<TextBlock Text="页大小:" />
|
||||
</StatusBarItem>
|
||||
<StatusBarItem>
|
||||
<ComboBox Width="80" SelectedValue="{Binding PageSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectedValuePath="Content">
|
||||
<ComboBoxItem Content="10" />
|
||||
<ComboBoxItem Content="20" />
|
||||
<ComboBoxItem Content="50" />
|
||||
<ComboBoxItem Content="100" />
|
||||
</ComboBox>
|
||||
</StatusBarItem>
|
||||
<StatusBarItem HorizontalAlignment="Right">
|
||||
<TextBlock Text="正在处理..." Visibility="{Binding IsBusy, Converter={StaticResource Bool2Vis}}" />
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
18
FATrace.WPLApp/Views/FactoryRawInboundView.xaml.cs
Normal file
18
FATrace.WPLApp/Views/FactoryRawInboundView.xaml.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace FATrace.WPLApp.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// FactoryRawInboundView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class FactoryRawInboundView : UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public FactoryRawInboundView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,14 +183,6 @@
|
||||
Width="80"
|
||||
Binding="{Binding SequenceNo}"
|
||||
Header="序号" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding LoginDate}"
|
||||
Header="登录日" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding LoginTime}"
|
||||
Header="登录时间" />
|
||||
<DataGridTextColumn
|
||||
Width="180"
|
||||
Binding="{Binding LoginDateTime}"
|
||||
|
||||
@@ -183,14 +183,6 @@
|
||||
Width="80"
|
||||
Binding="{Binding SequenceNo}"
|
||||
Header="序号" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding LoginDate}"
|
||||
Header="登录日" />
|
||||
<DataGridTextColumn
|
||||
Width="120"
|
||||
Binding="{Binding LoginTime}"
|
||||
Header="登录时间" />
|
||||
<DataGridTextColumn
|
||||
Width="180"
|
||||
Binding="{Binding LoginDateTime}"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
Margin="0,0,0,8"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="OEM-原料使用信息" />
|
||||
Text="OEM-原料使用" />
|
||||
|
||||
<!-- 查询条件区域 -->
|
||||
<Border
|
||||
|
||||
Reference in New Issue
Block a user