提交代码

This commit is contained in:
hehaibing-1996
2024-04-19 08:47:45 +08:00
parent e89b64ea3a
commit d40c3f253a
46 changed files with 2500 additions and 57 deletions

View File

@ -0,0 +1,124 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.DAL.DbModels;
namespace WCS.BLL.DbModels
{
/// <summary>
/// 出入库记录
/// </summary>
public class InOutRecord
{
/// <summary>
/// 主键 自增Id
/// </summary>
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
public int Id { get; set; }
#region
/// <summary>
/// 入库的库位表ID
/// </summary>
[SugarColumn(ColumnName = "store_id", IsNullable = false, ColumnDescription = "库位ID")]
public int StoreId { get; set; }
/// <summary>
/// 入库的库位编码
/// </summary>
[SugarColumn(ColumnName = "store_code", Length = 50, IsNullable = false, ColumnDescription = "库位编码")]
public string StoreCode { get; set; }
[Navigate(NavigateType.OneToOne, nameof(StoreId))]
public StoreInfo StoreInfo { get; set; }
#endregion
#region
/// <summary>
/// 物料编码SN
/// </summary>
[SugarColumn(ColumnName = "mat_sn", Length = 200, IsNullable = false, ColumnDescription = "物料SN")]
public string MatSN { get; set; }
/// <summary>
/// 物料编码
/// </summary>
[SugarColumn(ColumnName = "mat_code", Length = 100, IsNullable = true, ColumnDescription = "物料编号")]
public string MatCode { get; set; }
/// <summary>
/// 物料名称
/// </summary>
[SugarColumn(ColumnName = "mat_name", Length = 150, IsNullable = true, ColumnDescription = "物料名称")]
public string MatName { get; set; }
/// <summary>
/// 物料规格
/// </summary>
[SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")]
public string MatSpec { get; set; }
/// <summary>
/// 物料批次
/// </summary>
[SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
public string MatBatch { get; set; }
/// <summary>
/// 物料数量
/// </summary>
[SugarColumn(ColumnName = "mat_qty", IsNullable = false, ColumnDescription = "物料数量")]
public int MatQty { get; set; }
/// <summary>
/// 物料供应商
/// </summary>
[SugarColumn(ColumnName = "mat_supplier", Length = 150, IsNullable = true, ColumnDescription = "物料供应商")]
public string? MatSupplier { get; set; }
/// <summary>
/// 物料客户
/// </summary>
[SugarColumn(ColumnName = "mat_customer", Length = 150, IsNullable = true, ColumnDescription = "物料客户")]
public string? MatCustomer { get; set; }
#endregion
/// <summary>
/// 出库单据号/盘点单据号
/// </summary>
[SugarColumn(ColumnName = "order_number", Length = 50, IsNullable = false, ColumnDescription = "出库单据号/盘点单据号")]
public string? OrderNumber { get; set; }
/// <summary>
/// 出入库方向
/// </summary>
[SugarColumn(ColumnName = "direction", IsNullable = false, ColumnDescription = "出入库方向: 入库 = 0,\r\n 出库 = 1,\r\n 丢失 = 2")]
public DirectionEnum Direction { get; set; }
/// <summary>
/// 是否已上传
/// </summary>
[SugarColumn(ColumnName = "is_upload", IsNullable = false, ColumnDescription = "物料信息是否已上传")]
public bool IsUpload { get; set; } = false;
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnName = "operate_time", IsNullable = false, ColumnDescription = "创建时间")]
public DateTime OperateTime { get; set; } = DateTime.Now;
/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnName = "operate_user", Length = 100, IsNullable = true, ColumnDescription = "创建人")]
public string OperateUser { get; set; }
}
public enum DirectionEnum
{
= 0,
= 1,
= 2,
= 3,
}
}

View File

@ -65,11 +65,21 @@ namespace WCS.BLL.DbModels
public string? MatCustomer { get; set; }
/// <summary>
/// 物料数量
/// 默认数量
/// </summary>
[SugarColumn(ColumnName = "mat_qty", IsNullable = false, ColumnDescription = "物料数量")]
public int MatQty { get; set; } = 100;
[SugarColumn(ColumnName = "default_qty", IsNullable = false, ColumnDescription = "默认数量")]
public int DefaultQty { get; set; } = 1000;
/// <summary>
/// 默认盘数
/// </summary>
[SugarColumn(ColumnName = "default_count", IsNullable = false, ColumnDescription = "默认盘数")]
public int DefaultCount { get; set; } = 100;
/// <summary>
/// 当前序列号
/// </summary>
[SugarColumn(ColumnName = "serial_number", IsNullable = false, DefaultValue = "0", ColumnDescription = "默认盘数")]
public int SerialNumber { get; set; } = 0;
/// <summary>
/// Desc:更新人

View File

@ -71,10 +71,10 @@ namespace WCS.BLL.DbModels
public int MatQty { get; set; }
/// <summary>
/// 是否启用
/// 是否已打印
/// </summary>
[SugarColumn(ColumnName = "is_printed", ColumnDescription = "是否已打印")]
public bool IsPrinted { get; set; } = true;
public bool IsPrinted { get; set; } = false;
/// <summary>
/// Desc:更新人
/// Default:

View File

@ -58,4 +58,5 @@ namespace WCS.BLL.DbModels
= 1,
= 2
}
}

View File

@ -0,0 +1,72 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WCS.BLL.DbModels
{
/// <summary>
/// 盘点单据
/// </summary>
[SugarTable("stock_taking_order")]
public class StockTakingOrder
{
/// <summary>
/// 主键 自增Id
/// </summary>
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 盘点单据号
/// </summary>
[SugarColumn(ColumnName = "stocktaking_order_number", Length = 50, IsNullable = false, ColumnDescription = "盘点单据号")]
public string StocktakingOrderNumber { get; set; }
/// <summary>
/// 盘点单据状态
/// </summary>
[SugarColumn(ColumnName = "stocktaking_order_status", IsNullable = false, ColumnDescription = "盘点单据状态")]
public StocktakingOrderStatus StocktakingOrderStatus { get; set; } = StocktakingOrderStatus.;
/// <summary>
/// 盘点单据来源
/// </summary>
[SugarColumn(ColumnName = "StocktakingOrderSource", Length = 50, IsNullable = true, ColumnDescription = "单据来源")]
public string? StocktakingOrderSource { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnName = "create_time", IsNullable = false, ColumnDescription = "创建时间")]
public DateTime CreateTime { get; set; } = DateTime.Now;
/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "创建人")]
public string CreateUser { get; set; }
/// <summary>
/// 序号
/// </summary>
[SugarColumn(IsIgnore = true)]
public int RowNumber { get; set; }
/// <summary>
/// 是否已经选择
/// </summary>
[SugarColumn(IsIgnore = true)]
public bool IsSelected { get; set; }
}
public enum StocktakingOrderStatus
{
= 0,
= 1,
= 2,
= 3
}
}

View File

@ -0,0 +1,120 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.DAL.DbModels;
namespace WCS.BLL.DbModels
{
/// <summary>
/// 盘点单据物料明细
/// </summary>
[SugarTable("stock_taking_order_matdetail")]
public class StockTakingOrderMatDetail
{
/// <summary>
/// 主键 自增Id
/// </summary>
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 盘点单据的主键ID
/// </summary>
[SugarColumn(ColumnName = "stocktaking_order_id", IsNullable = false)]
public int StocktakingOrderId { get; set; }
/// <summary>
/// 盘点单据号
/// </summary>
[SugarColumn(ColumnName = "stocktaking_order_number", Length = 50, IsNullable = false, ColumnDescription = "盘点单据号")]
public string StocktakingOrderNumber { get; set; }
#region
/// <summary>
/// 入库的库位表ID
/// </summary>
[SugarColumn(ColumnName = "store_id", IsNullable = false, ColumnDescription = "库位ID")]
public int StoreId { get; set; }
/// <summary>
/// 入库的库位编码
/// </summary>
[SugarColumn(ColumnName = "store_code", Length = 50, IsNullable = false, ColumnDescription = "库位编码")]
public string StoreCode { get; set; }
[Navigate(NavigateType.OneToOne, nameof(StoreId))]
public StoreInfo StoreInfo { get; set; }
#endregion
#region
/// <summary>
/// 物料编码SN
/// </summary>
[SugarColumn(ColumnName = "mat_sn", Length = 200, IsNullable = false, ColumnDescription = "物料SN")]
public string MatSN { get; set; }
/// <summary>
/// 物料编码
/// </summary>
[SugarColumn(ColumnName = "mat_code", Length = 100, IsNullable = true, ColumnDescription = "物料编号")]
public string MatCode { get; set; }
/// <summary>
/// 物料名称
/// </summary>
[SugarColumn(ColumnName = "mat_name", Length = 150, IsNullable = true, ColumnDescription = "物料名称")]
public string MatName { get; set; }
/// <summary>
/// 物料规格
/// </summary>
[SugarColumn(ColumnName = "mat_spec", Length = 150, IsNullable = true, ColumnDescription = "物料规格")]
public string MatSpec { get; set; }
/// <summary>
/// 物料批次
/// </summary>
[SugarColumn(ColumnName = "mat_batch", Length = 150, IsNullable = true, ColumnDescription = "物料批次")]
public string MatBatch { get; set; }
/// <summary>
/// 物料数量
/// </summary>
[SugarColumn(ColumnName = "mat_qty", IsNullable = false, ColumnDescription = "物料数量")]
public int MatQty { get; set; }
/// <summary>
/// 物料供应商
/// </summary>
[SugarColumn(ColumnName = "mat_supplier", Length = 150, IsNullable = true, ColumnDescription = "物料供应商")]
public string? MatSupplier { get; set; }
/// <summary>
/// 物料客户
/// </summary>
[SugarColumn(ColumnName = "mat_customer", Length = 150, IsNullable = true, ColumnDescription = "物料客户")]
public string? MatCustomer { get; set; }
#endregion
/// <summary>
/// 该物料是否已盘点
/// </summary>
[SugarColumn(ColumnName = "is_stocktaking", IsNullable = false, ColumnDescription = "该物料是否已盘点")]
public bool IsStocktaking { get; set; } = false;
/// <summary>
/// 盘点数量
/// </summary>
[SugarColumn(ColumnName = "stocktaking_qty", IsNullable = false, ColumnDescription = "盘点数量")]
public int StocktakingQty { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnName = "create_time", IsNullable = false, ColumnDescription = "最后更新时间")]
public DateTime UpdateTime { get; set; } = DateTime.Now;
/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnName = "create_user", Length = 100, IsNullable = true, ColumnDescription = "最后更新人")]
public string UpdateUser { get; set; }
}
}

View File

@ -1,4 +1,5 @@
using System;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -12,6 +13,10 @@ namespace WCS.DAL.DbModels
/// <summary>
/// 库位Id
/// </summary>
/// <summary>
/// 主键 自增Id
/// </summary>
//[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
public int Id { get; set; }
/// <summary>

View File

@ -37,9 +37,9 @@ namespace WCS.BLL.HardWare
/// </summary>
public Mode CurentMode { get; set; }
public MatInfoModel InStoreData { get; set; }
public MatInfoResponse InStoreData { get; set; }
public string OutOrderNumber { get; set; }//出库模式中的单据
public string OrderNumber { get; set; }//出库/盘点模式中的单据
public string ModulesStr { get; set; }

View File

@ -16,9 +16,9 @@ namespace WCS.BLL.HardWare
public Mode CurentMode { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public string ModulesStr { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public string GroupName { get; set; }
public MatInfoModel InStoreData { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public MatInfoResponse InStoreData { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public string OutOrderNumber { get; set; }
public string OrderNumber { get; set; }
public void GoInInstore(string IPAdress)
{

View File

@ -96,9 +96,9 @@ namespace WCS.BLL.HardWare
public string? InstoreIpAddress { get; set; } = string.Empty;
public MatInfoModel InStoreData { get; set; }
public MatInfoResponse InStoreData { get; set; }
public string OutOrderNumber { get; set; }
public string OrderNumber { get; set; }
public void GoInInstore(string? IPAddress)
{
@ -178,18 +178,18 @@ namespace WCS.BLL.HardWare
public void GoInStocktaking()
{
throw new NotImplementedException();
this.CurentMode = Mode.;
}
public void GoOutOutstore()
{
throw new NotImplementedException();
this.CurentMode = Mode.;
}
public void GoOutStocktaking()
{
throw new NotImplementedException();
this.CurentMode = Mode.;
}
void IShelfBase.Reset()

View File

@ -23,6 +23,7 @@ namespace WCS.BLL.Manager
DbHelp.db.CodeFirst.InitTables(typeof(ModuleInfo), typeof(ShelfInfo), typeof(StoreInfo)
, typeof(InventoryDetail), typeof(OutOrder), typeof(OutOrderDetail), typeof(OutOrderMatDetail)
, typeof(ShelfTypeInfo), typeof(MatBaseInfo), typeof(MatInfo)
, typeof(StockTakingOrder), typeof(StockTakingOrderMatDetail), typeof(InOutRecord)
);
DbHelp.dbLog.CodeFirst.InitTables(typeof(SystemApiLogRecord));

View File

@ -0,0 +1,18 @@

using WCS.BLL.DbModels;
using WCS.DAL.AuthDbModel;
using WCS.Model;
using WCS.Model.ApiModel;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.User;
namespace WCS.BLL.Services.IService
{
public interface IGenerateService
{
public Task<ResponseCommon<List<MatInfo>>> generateMatInfo(GenerateMatInfoRequest request);
public Task<string> generateStockTakingNumber();
}
}

View File

@ -11,7 +11,7 @@ namespace WCS.BLL.Services.IService
{
public ResponseBase shelfGoInInStore(ShelfGoInInstoreRequest request);
public ResponseBase shelfGoOutInStore(ShelfGoOutInStoreRequest request);
public ResponseBase queryByMatSn(QueryByMatSnRequest request);
public Task<ResponseBase> queryByMatSn(QueryByMatSnRequest request);
public Task<ResponseBase> queryInstoreStatus(QueryByMatSnRequest request);
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.BLL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel.Stocktaking;
namespace WCS.BLL.Services.IService
{
/// <summary>
/// 盘点模式
/// </summary>
public interface IStockTakingService
{
public Task<ResponseBase> SysStockTakingOrder(SysStockTakingOrderRequest request);
public Task<PageQueryResponse<StockTakingOrder>> getStockTakingOrders(GetStockTakingOrdersRequest request);
public Task<ResponseBase> getStockTakingOrderMatDetail(GetStockTakingOrderMatDetailRequest request);
public Task<ResponseBase> startStockTakingOrder(GetStockTakingOrderMatDetailRequest request);
public Task<ResponseBase> endStockTakingOrder(GetStockTakingOrderMatDetailRequest request);
public Task<ResponseBase> queryMatInfoInStocktakingOrder(QueryMatInfoInStocktakingOrderRequest request);
public Task<ResponseBase> comfirmStocktakingOrder(ComfirmStocktakingOrderRequest request);
public Task<ResponseBase> commitStockTakingOrder(GetStockTakingOrderMatDetailRequest request);
}
}

View File

@ -0,0 +1,129 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using TouchSocket.Core;
using WCS.BLL.DbModels;
using WCS.BLL.Services.IService;
using WCS.DAL;
using WCS.DAL.AuthDbModel;
using WCS.DAL.Db;
using WCS.Model;
using WCS.Model.ApiModel;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.User;
namespace WCS.BLL.Services.Service
{
/// <summary>
/// 需要生成序列号保证不重复的方法
/// </summary>
public class GenerateService : IGenerateService
{
public static object matFlag = new object();
public static object stockTakingFlag = new object();
public async Task<ResponseCommon<List<MatInfo>>> generateMatInfo(GenerateMatInfoRequest request)
{
//校验是否被禁用
var matBaseInfo = await DbHelp.db.Queryable<MatBaseInfo>()
.Where(t => t.Id == request.MatBaseInfo.Id)
.FirstAsync();
if (matBaseInfo == null)
{
return new ResponseCommon<List<MatInfo>>()
{
Code = 201,
Message = $"生成失败:该物料基础信息不存在",
Data = null
};
}
else if (matBaseInfo.IsEnable == false)
{
return new ResponseCommon<List<MatInfo>>()
{
Code = 201,
Message = $"生成失败:该物料已被禁用",
Data = null
};
}
//生成条码
lock (matFlag)
{
try
{
DbHelp.db.BeginTran();
var startNumber = matBaseInfo.SerialNumber++;
var matInfoList = new List<MatInfo>();
for (var i = 0; i < request.TotalCount; i++)
{
var matInfo = new MatInfo()
{
MatSn = GetMatSn(matBaseInfo, startNumber + i),
MatCode = matBaseInfo.MatCode,
MatName = matBaseInfo.MatName,
MatBatch = matBaseInfo.MatBatch,
MatSpec = matBaseInfo.MatSpec,
MatUnit = matBaseInfo.MatUnit,
MatSupplier = matBaseInfo.MatSupplier,
MatCustomer = matBaseInfo.MatCustomer,
MatQty = request.MatQty,
ModifyUser = request.UserName
};
matInfoList.Add(matInfo);
}
DbHelp.db.Insertable(matInfoList).ExecuteCommand();
matBaseInfo.SerialNumber = startNumber + request.TotalCount;
DbHelp.db.Updateable(matBaseInfo).ExecuteCommand();
DbHelp.db.CommitTran();
return new ResponseCommon<List<MatInfo>>()
{
Code = 200,
Message = "success",
Data = matInfoList
};
}
catch (Exception ex)
{
DbHelp.db.RollbackTran();
return new ResponseCommon<List<MatInfo>>()
{
Code = 201,
Message = $"生成失败:{ex.Message}",
Data = null
};
}
}
}
private string GetMatSn(MatBaseInfo matBaseInfo, int serialNumber)
{
var gongshi = "=A1&\"-\"&A2&A3";
//var matSn = matBaseInfo.MatCode + matBaseInfo.MatBatch + serialNumber.ToString().PadLeft(6, '0');
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
keyValuePairs.Add("A1", matBaseInfo.MatCode);
keyValuePairs.Add("A2", matBaseInfo.MatName);
keyValuePairs.Add("A3", serialNumber.ToString().PadLeft(6, '0'));
var matSn = PnHelp.Jx(gongshi, keyValuePairs);
return matSn;
}
public async Task<string> generateStockTakingNumber()
{
lock (stockTakingFlag)
{
Thread.Sleep(1);
return "PD" + DateTime.Now.ToString("yyMMddHHmmssfff");
}
}
}
}

View File

@ -6,6 +6,7 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using WCS.BLL.Config;
using WCS.BLL.DbModels;
using WCS.BLL.HardWare;
using WCS.BLL.Manager;
using WCS.BLL.Services.IService;
@ -79,7 +80,7 @@ namespace WCS.BLL.Services.Service
};
}
public ResponseBase queryByMatSn(QueryByMatSnRequest request)
public async Task<ResponseBase> queryByMatSn(QueryByMatSnRequest request)
{
//获取货架
var shelf = ShelfManager.Shelves.Where(t => t.ShelfCode == request.ShelfCode).FirstOrDefault();
@ -100,23 +101,59 @@ namespace WCS.BLL.Services.Service
Message = $"操作失败:货架[{request.ShelfCode}]不在入库模式!\r\n当前为{shelf.CurentMode}",
};
}
//判断物料是否已入库
var inventory = await DbHelp.db.Queryable<InventoryDetail>().Where(t => t.MatSN == request.MatSn).FirstAsync();
if (inventory != null)
{
return new QueryByMatSnResponse()
{
Code = 201,
Message = $"操作失败:物料{inventory.MatSN}已入库,库位为{inventory.StoreCode}",
};
}
#region
//调用接口或者直接查询数据库
if (1 == 1)
if (1 != 1)
{
}
//查询数据库
else
{
var matInfo = await DbHelp.db.Queryable<MatInfo>().Where(t => t.MatSn == request.MatSn).FirstAsync();
if (matInfo != null)
{
}
shelf.InStoreData = new MatInfoResponse()
{
materialBar = matInfo.MatSn,
materialCode = matInfo.MatCode,
materialName = matInfo.MatName,
materialQty = matInfo.MatQty,
materialSpec = matInfo.MatSpec,
batchNo = matInfo.MatBatch,
supplier = matInfo.MatSupplier,
customer = matInfo.MatCustomer,
};
return new QueryByMatSnResponse()
{
Code = 200,
Data = new MatInfoModel(),
Data = shelf.InStoreData,
Message = "success"
};
}
else
return new QueryByMatSnResponse()
{
Code = 201,
Data = null,
Message = $"不存在物料{request.MatSn}"
};
}
#endregion
}
public async Task<ResponseBase> queryInstoreStatus(QueryByMatSnRequest request)
{
@ -127,7 +164,7 @@ namespace WCS.BLL.Services.Service
return new ResponseCommon()
{
Code = 201,
Message = $"操作失败:货架[{request.ShelfCode}]不存在!",
Message = $"货架[{request.ShelfCode}]不存在!",
};
}
//判断当前是否是入库模式
@ -136,7 +173,7 @@ namespace WCS.BLL.Services.Service
return new ResponseCommon()
{
Code = 201,
Message = $"操作失败:货架[{request.ShelfCode}]不在入库模式!\r\n当前为{shelf.CurentMode}",
Message = $"货架[{request.ShelfCode}]已退出入库模式!\r\n当前为{shelf.CurentMode}",
};
}
//这个时间相当于需要入库扫码后需要等待的时间

View File

@ -122,5 +122,6 @@ namespace WCS.BLL.Services.Service
};
}
}
}
}

View File

@ -32,7 +32,7 @@ namespace WCS.BLL.Services.Service
//判断是否有单据号 没有单据号系统自动生成一个
if (string.IsNullOrEmpty(request.OrderNumber))
{
request.OrderNumber = GetOrderNumber();
request.OrderNumber = GenerateOrderNumber();
}
Console.WriteLine(DateTime.Now);
//保存数据
@ -128,7 +128,7 @@ namespace WCS.BLL.Services.Service
//判断是否有单据号 没有单据号系统自动生成一个
if (string.IsNullOrEmpty(request.OrderNumber))
{
request.OrderNumber = GetOrderNumber();
request.OrderNumber = GenerateOrderNumber();
}
#region
@ -267,6 +267,7 @@ namespace WCS.BLL.Services.Service
.Where(t => t.OrderId == outOrder.Id)
.ToListAsync();
#endregion
var orderDetail = await orderDetailTask;
var orderMatDetail = await orderMatDetailTask;
return new ResponseCommon()
@ -282,8 +283,7 @@ namespace WCS.BLL.Services.Service
}
private string GetOrderNumber()
private string GenerateOrderNumber()
{
var orderNumber = "PD" + DateTime.Now.ToString("yyyyMMddHHmmss");
return orderNumber;
@ -291,6 +291,7 @@ namespace WCS.BLL.Services.Service
public async Task<ResponseBase> GoInOutstore(GetOutOrderDetailRequest request)
{
//先找到所有物料
//分组 按物料找到对应得货架编码
@ -308,8 +309,8 @@ namespace WCS.BLL.Services.Service
public async Task<ResponseBase> GoOutOutstore(GetOutOrderDetailRequest request)
{
//找到出库单号一致的货架列表
var shelves = ShelfManager.Shelves.Where(t => t.OutOrderNumber == request.OrderNumber)
//找到正在出对应出库单的货架
var shelves = ShelfManager.Shelves.Where(t => t.OrderNumber == request.OrderNumber)
.ToList();
//退出出库模式
shelves.ForEach(t =>

View File

@ -0,0 +1,712 @@
using Microsoft.Data.SqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WCS.BLL.DbModels;
using WCS.BLL.Manager;
using WCS.BLL.Services.IService;
using WCS.DAL.Db;
using WCS.DAL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel.Stocktaking;
namespace WCS.BLL.Services.Service
{
public class StockTakingService : IStockTakingService
{
#region SysStockTakingOrder
public async Task<ResponseBase> SysStockTakingOrder(SysStockTakingOrderRequest request)
{
//先判断盘点单据号是否已存在(避免前端多次提交后生成多个的情况)
var stocktakingOrder = await DbHelp.db.Queryable<StockTakingOrder>()
.Where(t => t.StocktakingOrderNumber == request.StocktakingOrderNumber)
.FirstAsync();
if (stocktakingOrder != null)
return new SysStockTakingOrderResponse()
{
Code = 201,
Message = $"操作失败:盘点单据{stocktakingOrder.StocktakingOrderNumber}已存在!"
};
else
{
//分成三类
switch (request.StocktakingOrderType)
{
case "shelfCodes":
return await SysStockTakingOrderByShelfCodes(request);
case "matCodes":
return await SysStockTakingOrderByMatCodes(request);
case "snList":
return await SysStockTakingOrderSnList(request);
default:
return new SysStockTakingOrderResponse()
{
Code = 201,
Message = $"操作失败:[{request.StocktakingOrderType}]不支持的操作!!"
};
}
}
}
public async Task<ResponseBase> SysStockTakingOrderByShelfCodes(SysStockTakingOrderRequest request)
{
//校验参数
if (request.List == null || request.List.Count == 0)
return new SysStockTakingOrderResponse()
{
Code = 201,
Message = $"操作失败:缺少必要参数"
};
//先判断是否有这些货架
var shelfs = ShelfManager.Shelves
.Where(t => request.List.Contains(t.ShelfCode))
.ToList();
if (shelfs.Count < request.List.Count)
{
foreach (var shelf in shelfs)
{
request.List.RemoveAll(t => t == shelf.ShelfCode);
}
return new SysStockTakingOrderResponse()
{
Code = 201,
Message = $"操作失败:货架[{string.Join(",", request.List)}]不存在!"
};
}
try
{
//获取库存数据 生成盘点单据
var inventoryDetails = await DbHelp.db.Queryable<InventoryDetail>()
.Includes(t => t.StoreInfo)
.Where(t => request.List.Contains(t.StoreInfo.ShelfCode))
.ToListAsync();
if (inventoryDetails == null || inventoryDetails.Count == 0)
{
return new SysStockTakingOrderResponse()
{
Code = 201,
Message = $"操作失败:未找到需要盘点的库存数据!"
};
}
await DbHelp.db.BeginTranAsync();
//盘点单据保存
var stockTakingOrder = new StockTakingOrder()
{
StocktakingOrderNumber = request.StocktakingOrderNumber,
StocktakingOrderSource = request.StocktakingOrderSource,
CreateUser = request.UserName
};
var stockTakingOrderId = await DbHelp.db.Insertable(stockTakingOrder).ExecuteReturnIdentityAsync();
stockTakingOrder.Id = stockTakingOrderId;
//盘点物料明细保存
foreach (var inventoryDetail in inventoryDetails)
{
var stockTakingOrderMatDetail = new StockTakingOrderMatDetail()
{
StocktakingOrderId = stockTakingOrderId,
StocktakingOrderNumber = request.StocktakingOrderNumber,
StoreId = inventoryDetail.StoreId,
StoreCode = inventoryDetail.StoreCode,
MatSN = inventoryDetail.MatSN,
MatCode = inventoryDetail.MatCode,
MatName = inventoryDetail.MatName,
MatBatch = inventoryDetail.MatBatch,
MatSpec = inventoryDetail.MatSpec,
MatQty = inventoryDetail.MatQty,
MatCustomer = inventoryDetail.MatCustomer,
MatSupplier = inventoryDetail.MatSupplier,
IsStocktaking = false,
StocktakingQty = inventoryDetail.MatQty,
UpdateUser = request.UserName
};
await DbHelp.db.Insertable(stockTakingOrderMatDetail).ExecuteReturnIdentityAsync();
}
await DbHelp.db.CommitTranAsync();
return new SysStockTakingOrderResponse()
{
Data = new SysStockTakingOrderData() { StocktakingOrderNumber = request.StocktakingOrderNumber },
Code = 200,
Message = $"Success"
};
}
catch (Exception ex)
{
return new SysStockTakingOrderResponse()
{
Code = 201,
Message = $"操作失败:{ex.Message}"
};
}
}
public async Task<ResponseBase> SysStockTakingOrderByMatCodes(SysStockTakingOrderRequest request)
{
//校验参数
if (request.List == null || request.List.Count == 0)
return new SysStockTakingOrderResponse()
{
Code = 201,
Message = $"操作失败:缺少必要参数"
};
//获取库存数据 生成盘点单据
var inventoryDetails = await DbHelp.db.Queryable<InventoryDetail>()
.Where(t => request.List.Contains(t.MatCode))
.ToListAsync();
if (inventoryDetails == null || inventoryDetails.Count == 0)
{
return new SysStockTakingOrderResponse()
{
Code = 201,
Message = $"操作失败:未找到需要盘点的库存数据!"
};
}
try
{
await DbHelp.db.BeginTranAsync();
//盘点单据保存
var stockTakingOrder = new StockTakingOrder()
{
StocktakingOrderNumber = request.StocktakingOrderNumber,
StocktakingOrderSource = request.StocktakingOrderSource,
CreateUser = request.UserName
};
var stockTakingOrderId = await DbHelp.db.Insertable(stockTakingOrder).ExecuteReturnIdentityAsync();
stockTakingOrder.Id = stockTakingOrderId;
//盘点物料明细保存
foreach (var inventoryDetail in inventoryDetails)
{
var stockTakingOrderMatDetail = new StockTakingOrderMatDetail()
{
StocktakingOrderId = stockTakingOrderId,
StocktakingOrderNumber = request.StocktakingOrderNumber,
StoreId = inventoryDetail.StoreId,
StoreCode = inventoryDetail.StoreCode,
MatSN = inventoryDetail.MatSN,
MatCode = inventoryDetail.MatCode,
MatName = inventoryDetail.MatName,
MatBatch = inventoryDetail.MatBatch,
MatSpec = inventoryDetail.MatSpec,
MatQty = inventoryDetail.MatQty,
MatCustomer = inventoryDetail.MatCustomer,
MatSupplier = inventoryDetail.MatSupplier,
IsStocktaking = false,
StocktakingQty = inventoryDetail.MatQty,
UpdateUser = request.UserName
};
await DbHelp.db.Insertable(stockTakingOrderMatDetail).ExecuteReturnIdentityAsync();
}
await DbHelp.db.CommitTranAsync();
return new SysStockTakingOrderResponse()
{
Data = new SysStockTakingOrderData() { StocktakingOrderNumber = request.StocktakingOrderNumber },
Code = 200,
Message = $"Success"
};
}
catch (Exception ex)
{
return new SysStockTakingOrderResponse()
{
Code = 201,
Message = $"操作失败:{ex.Message}"
};
}
}
public async Task<ResponseBase> SysStockTakingOrderSnList(SysStockTakingOrderRequest request)
{
//校验参数
if (request.List == null || request.List.Count == 0)
return new SysStockTakingOrderResponse()
{
Code = 201,
Message = $"操作失败:缺少必要参数"
};
//获取库存数据 生成盘点单据
var inventoryDetails = await DbHelp.db.Queryable<InventoryDetail>()
.Where(t => request.List.Contains(t.MatSN))
.ToListAsync();
if (inventoryDetails == null || inventoryDetails.Count == 0)
{
return new SysStockTakingOrderResponse()
{
Code = 201,
Message = $"操作失败:未找到需要盘点的库存数据!"
};
}
try
{
await DbHelp.db.BeginTranAsync();
//盘点单据保存
var stockTakingOrder = new StockTakingOrder()
{
StocktakingOrderNumber = request.StocktakingOrderNumber,
StocktakingOrderSource = request.StocktakingOrderSource,
CreateUser = request.UserName
};
var stockTakingOrderId = await DbHelp.db.Insertable(stockTakingOrder).ExecuteReturnIdentityAsync();
stockTakingOrder.Id = stockTakingOrderId;
//盘点物料明细保存
foreach (var inventoryDetail in inventoryDetails)
{
var stockTakingOrderMatDetail = new StockTakingOrderMatDetail()
{
StocktakingOrderId = stockTakingOrderId,
StocktakingOrderNumber = request.StocktakingOrderNumber,
StoreId = inventoryDetail.StoreId,
StoreCode = inventoryDetail.StoreCode,
MatSN = inventoryDetail.MatSN,
MatCode = inventoryDetail.MatCode,
MatName = inventoryDetail.MatName,
MatBatch = inventoryDetail.MatBatch,
MatSpec = inventoryDetail.MatSpec,
MatQty = inventoryDetail.MatQty,
MatCustomer = inventoryDetail.MatCustomer,
MatSupplier = inventoryDetail.MatSupplier,
IsStocktaking = false,
StocktakingQty = inventoryDetail.MatQty,
UpdateUser = request.UserName
};
await DbHelp.db.Insertable(stockTakingOrderMatDetail).ExecuteReturnIdentityAsync();
}
await DbHelp.db.CommitTranAsync();
return new SysStockTakingOrderResponse()
{
Data = new SysStockTakingOrderData() { StocktakingOrderNumber = request.StocktakingOrderNumber },
Code = 200,
Message = $"Success"
};
}
catch (Exception ex)
{
return new SysStockTakingOrderResponse()
{
Code = 201,
Message = $"操作失败:{ex.Message}"
};
}
}
#endregion
public async Task<PageQueryResponse<StockTakingOrder>> getStockTakingOrders(GetStockTakingOrdersRequest request)
{
try
{
var recordsQueryable = DbHelp.db.Queryable<StockTakingOrder>()
.WhereIF(!string.IsNullOrEmpty(request.StocktakingOrderNumber), t => t.StocktakingOrderNumber.Contains(request.StocktakingOrderNumber));
switch (request.StocktakingOrderStatus)
{
case Model.ApiModel.Stocktaking.StocktakingOrderStatus.:
recordsQueryable = recordsQueryable.Where(t => t.StocktakingOrderStatus == DbModels.StocktakingOrderStatus.);
break;
case Model.ApiModel.Stocktaking.StocktakingOrderStatus.:
recordsQueryable = recordsQueryable.Where(t => t.StocktakingOrderStatus == DbModels.StocktakingOrderStatus.);
break;
case Model.ApiModel.Stocktaking.StocktakingOrderStatus.:
recordsQueryable = recordsQueryable.Where(t => t.StocktakingOrderStatus == DbModels.StocktakingOrderStatus.);
break;
case Model.ApiModel.Stocktaking.StocktakingOrderStatus.:
recordsQueryable = recordsQueryable.Where(t => t.StocktakingOrderStatus == DbModels.StocktakingOrderStatus.);
break;
default:
break;
}
var totalCount = await recordsQueryable.CountAsync();
var records = await recordsQueryable
.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize)
.Select<StockTakingOrder>()
.ToListAsync();
//生成序号
for (int i = 0; i < records.Count; i++)
{
records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1;
}
return new PageQueryResponse<StockTakingOrder>()
{
Code = 200,
Message = $"success",
Data = new PageQueryResponseData<StockTakingOrder>()
{
TotalCount = totalCount,
MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize),
Count = records.Count,
Lists = records.ToList()
}
};
}
catch (Exception ex)
{
return new PageQueryResponse<StockTakingOrder>()
{
Code = 300,
Message = $"操作失败:{ex.Message}",
};
}
}
public async Task<ResponseBase> getStockTakingOrderMatDetail(GetStockTakingOrderMatDetailRequest request)
{
#region
StockTakingOrder order = null;
if (request.StockTakingOrderId != 0)
{
order = await DbHelp.db.Queryable<StockTakingOrder>().Where(t => t.Id == request.StockTakingOrderId).FirstAsync();
if (order == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"查询失败不存在Id为{request.StockTakingOrderId}的出库单!",
};
}
}
else if (!string.IsNullOrEmpty(request.StockTakingOrderNumber))
{
order = await DbHelp.db.Queryable<StockTakingOrder>().Where(t => t.StocktakingOrderNumber == request.StockTakingOrderNumber)
.FirstAsync();
if (order == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"查询失败:不存在单据号为{request.StockTakingOrderNumber}的出库单!",
};
}
}
else
{
return new ResponseCommon()
{
Code = 201,
Message = $"查询失败:缺少必要参数!",
};
}
#endregion
//查询物料明细
var stockTakingOrderMatDetail = await DbHelp.db.Queryable<StockTakingOrderMatDetail>()
.Where(t => t.StocktakingOrderId == order.Id)
.ToListAsync();
return new ResponseCommon<List<StockTakingOrderMatDetail>>()
{
Code = 200,
Message = "success",
Data = stockTakingOrderMatDetail
};
}
public async Task<ResponseBase> startStockTakingOrder(GetStockTakingOrderMatDetailRequest request)
{
try
{
#region
StockTakingOrder order = null;
if (request.StockTakingOrderId != 0)
{
order = await DbHelp.db.Queryable<StockTakingOrder>().Where(t => t.Id == request.StockTakingOrderId).FirstAsync();
if (order == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"操作失败不存在Id为{request.StockTakingOrderId}的出库单!",
};
}
}
else if (!string.IsNullOrEmpty(request.StockTakingOrderNumber))
{
order = await DbHelp.db.Queryable<StockTakingOrder>().Where(t => t.StocktakingOrderNumber == request.StockTakingOrderNumber)
.FirstAsync();
if (order == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"操作失败:不存在单据号为{request.StockTakingOrderNumber}的出库单!",
};
}
}
else
{
return new ResponseCommon()
{
Code = 201,
Message = $"操作失败:缺少必要参数!",
};
}
#endregion
#region
//查询物料明细
var stockTakingOrderMatDetail = await DbHelp.db.Queryable<StockTakingOrderMatDetail>()
.Where(t => t.StocktakingOrderId == order.Id)
.ToListAsync();
//TO DO 货架按物料进入盘点模式
var shelf = ShelfManager.Shelves.First();
shelf.GoInStocktaking();
shelf.OrderNumber = order.StocktakingOrderNumber;
#endregion
return new ResponseCommon()
{
Code = 200,
Message = $"success",
Data = shelf.ShelfCode
};
}
catch (Exception ex)
{
return new ResponseCommon()
{
Code = 300,
Message = $"操作失败,{ex.Message}",
};
}
}
public async Task<ResponseBase> endStockTakingOrder(GetStockTakingOrderMatDetailRequest request)
{
try
{
#region
StockTakingOrder order = null;
if (request.StockTakingOrderId != 0)
{
order = await DbHelp.db.Queryable<StockTakingOrder>().Where(t => t.Id == request.StockTakingOrderId).FirstAsync();
if (order == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"操作失败不存在Id为{request.StockTakingOrderId}的出库单!",
};
}
}
else if (!string.IsNullOrEmpty(request.StockTakingOrderNumber))
{
order = await DbHelp.db.Queryable<StockTakingOrder>().Where(t => t.StocktakingOrderNumber == request.StockTakingOrderNumber)
.FirstAsync();
if (order == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"操作失败:不存在单据号为{request.StockTakingOrderNumber}的出库单!",
};
}
}
else
{
return new ResponseCommon()
{
Code = 201,
Message = $"操作失败:缺少必要参数!",
};
}
#endregion
#region
var shelfs = ShelfManager.Shelves.Where(t => t.CurentMode == HardWare.Mode. && t.OrderNumber == order.StocktakingOrderNumber).ToList();
shelfs.ForEach(t =>
{
t.GoOutStocktaking();
});
#endregion
return new ResponseCommon()
{
Code = 200,
Message = $"success",
Data = shelfs.Select(t => t.ShelfCode).ToList(),
};
}
catch (Exception ex)
{
return new ResponseCommon()
{
Code = 300,
Message = $"操作失败,{ex.Message}",
};
}
}
public async Task<ResponseBase> queryMatInfoInStocktakingOrder(QueryMatInfoInStocktakingOrderRequest request)
{
//判断是否有这个物料
var storeInfo = await DbHelp.db.Queryable<InventoryDetail>()
.LeftJoin<StoreInfo>((id,si)=>id.StoreId == si.Id)
.Where((id, si) => id.MatSN == request.MatSN)
.Select((id, si) => si)
.FirstAsync();
if (storeInfo == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"不存在物料[{request.MatSN}]",
};
}
//判断货架是否进入入库模式
var shelf = ShelfManager.Shelves.Where(t => t.ShelfCode == storeInfo.ShelfCode).FirstOrDefault();
if (shelf == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"物料[{request.MatSN}不是本次需要盘点的物料!!!]",
};
}
//进入入库模式的那个单据是否有对应的单据明细
var stockTakingOrder = await DbHelp.db.Queryable<StockTakingOrder>()
.Where(t => t.StocktakingOrderNumber == shelf.OrderNumber)
.FirstAsync();
if (stockTakingOrder == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"未找到对应盘点单据{shelf.OrderNumber}",
};
}
//返回具体的单据信息
var stockTakinbgOrder = await DbHelp.db.Queryable<StockTakingOrderMatDetail>()
.Where(t => t.StocktakingOrderId == stockTakingOrder.Id)
.Where(t => t.MatSN == request.MatSN)
.FirstAsync();
return new ResponseCommon<StockTakingOrderMatDetail>()
{
Code = 200,
Message = "success",
Data = stockTakinbgOrder
};
}
public async Task<ResponseBase> comfirmStocktakingOrder(ComfirmStocktakingOrderRequest request)
{
//获取盘点物料明细
var stockTakingMatDetail =await DbHelp.db.Queryable<StockTakingOrderMatDetail>()
.Where(t => t.Id == request.Id)
.FirstAsync();
if (stockTakingMatDetail == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"不存在的盘点明细",
};
}
//修改盘点吗明细数量
stockTakingMatDetail.StocktakingQty = request.Qty;
stockTakingMatDetail.IsStocktaking = true;
await DbHelp.db.Updateable(stockTakingMatDetail).ExecuteCommandAsync();
return new ResponseCommon()
{
Code = 200,
Message = $"success",
};
}
public async Task<ResponseBase> commitStockTakingOrder(GetStockTakingOrderMatDetailRequest request)
{
try
{
#region
StockTakingOrder order = null;
if (request.StockTakingOrderId != 0)
{
order = await DbHelp.db.Queryable<StockTakingOrder>().Where(t => t.Id == request.StockTakingOrderId).FirstAsync();
if (order == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"操作失败不存在Id为{request.StockTakingOrderId}的出库单!",
};
}
}
else if (!string.IsNullOrEmpty(request.StockTakingOrderNumber))
{
order = await DbHelp.db.Queryable<StockTakingOrder>().Where(t => t.StocktakingOrderNumber == request.StockTakingOrderNumber)
.FirstAsync();
if (order == null)
{
return new ResponseCommon()
{
Code = 201,
Message = $"操作失败:不存在单据号为{request.StockTakingOrderNumber}的出库单!",
};
}
}
else
{
return new ResponseCommon()
{
Code = 201,
Message = $"操作失败:缺少必要参数!",
};
}
#endregion
#region
if (order.StocktakingOrderStatus != DbModels.StocktakingOrderStatus.)
{
return new ResponseCommon()
{
Code = 201,
Message = $"单据已提交,请勿重复提交!",
};
}
else if (order.StocktakingOrderStatus != DbModels.StocktakingOrderStatus.)
{
return new ResponseCommon()
{
Code = 201,
Message = $"单据未盘点完成!!!",
};
}
#endregion
//To do 进行提交!
return new ResponseCommon()
{
Code = 200,
Message = $"success",
};
}
catch (Exception ex)
{
return new ResponseCommon()
{
Code = 300,
Message = $"操作失败,{ex.Message}",
};
}
}
}
}

389
WCS.BLL/Tool/PnHelp.cs Normal file
View File

@ -0,0 +1,389 @@

using Irony.Parsing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using XLParser;
namespace WCS.BLL
{
public static class PnHelp
{
public static string Jx(string text, string th_A1 = null)
{
var aaa = new Dictionary<string, string>();
if (!string.IsNullOrWhiteSpace(th_A1))
aaa.Add("A1", th_A1);
return Jx(text, aaa);
}
public static string Jx(string text, Dictionary<string, string> th = null)
{
if (!text.StartsWith("="))
return text;
var par = ExcelFormulaParser.Parse(text.Substring(1));
var aaa1 = Jx(par, th);
return aaa1.AllNodes().LastOrDefault()?.Token.ValueString ?? "";
}
public static ParseTreeNode Jx(ParseTreeNode treeNode, Dictionary<string, string> th = null)
{
var nodes = treeNode.ChildNodes;
foreach (var node in nodes)
{
//var p1 = node.Print();
if (node.IsFunction())
{
//函数
var hs = node.GetFunction();
//参数
var csList = node.GetFunctionArguments();
//参数
List<string> csa = new List<string>();
foreach (var cs in csList)
{
var p12 = cs.Print();
var cs4 = cs.AllNodes().ElementAtOrDefault(3);
if (cs4 != null && (cs4.Is(GrammarNames.TokenText) || cs4.Is(GrammarNames.TokenNumber) || cs4.Is(GrammarNames.TokenBool)))
{
csa.Add(cs4.Token.ValueString);
}
else if (cs4 != null && cs4.Is(GrammarNames.TokenCell))
{
if (th != null && th.ContainsKey(cs4.Token.ValueString))
csa.Add(th[cs4.Token.ValueString]);
else
csa.Add(cs4.Token.ValueString);
}
else
{
var csjg = Jx(cs, th);
var aaaaaa = csjg.AllNodes().LastOrDefault();
csa.Add(aaaaaa.Token.ValueString);
}
}
//执行
var val = keyValuePairs[hs].Item1.Invoke(csa);
var newval = ExcelFormulaParser.Parse("\"" + val + "\"");
treeNode.ChildNodes.Clear();
treeNode.ChildNodes.Add(newval);
return newval;
}
else if (node.Is(GrammarNames.Reference))
{
return Jx(node, th);
}
else if (node.Is(GrammarNames.Formula))
{
return Jx(node, th);
}
//else if (node.Is(GrammarNames.Cell))
//{
// return Jx(node, th);
//}
}
return treeNode;
}
public static Dictionary<string, (Func<List<string>, string>, string)> keyValuePairs = new Dictionary<string, (Func<List<string>, string>, string)>()
{
//excel自带
{ "+",(Jia,"加号")},
{ "-",(Jian,"减号、负数")},
{ "*",(Cen,"乘号")},
{ "/",(Chu,"除号")},
{ "%",(BaiFenBi,"百分号")},
{ "^",(CenMu,"乘幂")},
{ "&",(HeBin,"和号,用于连接两个或更多的文本字符串,或者是文本与数值之间的连接。")},
{ "=",(DengYu,"等于")},
{ "<>",(BuDengYu,"不等于")},
{ ">",(DaYu,"大于")},
{ "<",(XiaoYu,"小于")},
{ ">=",(DaYuDengYu,"大于等于")},
{ "<=",(XiaoYuDengYu,"小于等于")},
{ "IF",(IF,"条件判断。IF(TRUE|FALSE,值_true,值_false)")},
{ "IFS",(IFS,"多条件判断并执行。IFS(TRUE|FALSE,值1,TRUE|FALSE,值2,...)")},
{ "AND",(AND,"多个条件判断需要所有满足。AND(TRUE|FALSE,TRUE|FALSE,...)")},
{ "OR",(OR,"多个条件判断,需要一个满足。OR(TRUE|FALSE,TRUE|FALSE,...)")},
{ "ABS",(ABS,"绝对值。ABS(值)")},
{ "LOG",(LOG,"对数。LOG(值,[底,默认10])")},
{ "REPLACE",(REPLACE,"替换字符串。REPLACE(值,开始位置,个数,新值)")},
{ "SUBSTITUTE",(SUBSTITUTE,"替换字符串。SUBSTITUTE(值,原值,新值,[替换序号|未实现])")},
{ "MID",(MID,"截取字符串。MID(值,开始位置|负数倒取,字符个数)")},
{ "SEARCH",(SEARCH,"查找字符串没有找到为0。SEARCH(查找值,值,[开始位置])")},
{ "TRIM",(TRIM,"清除前后空格。TRIM(值)")},
{ "LEN",(LEN,"获取长度。LEN(值)")},
//自定义函数
{ "REVERSE",(REVERSE,"反转字符串。REVERSE(值)")},
{ "REPLACES",(REPLACES,"替换多个字符串。REPLACES(值,新值,旧值1,旧值2,...)")},
{ "CONTAINS",(CONTAINS,"字符串中是否存在。CONTAINS(值,值1,值2,...)")},
{ "WHERENUM",(WHERENUM,"只保留数字。WHERENUM(值)")},
{ "WHEREAZ",(WHEREAZ,"只保留字母。WHEREAZ(值)")},
{ "WHERENUMAZ",(WHERENUMAZ,"只保留数字和字母。WHERENUMAZ(值)")},
{ "SPLIT",(SPLIT,"分隔字符串。SPLIT(值,分隔值,取的位置|负数倒取)")},
{ "PADLEFT",(PADLEFT,"字符串左侧填充字符,实现右对齐。PADLEFT(值,长度,对齐字符)")},
{ "PADRIGHT",(PADRIGHT,"字符串右侧填充字符,实现左对齐。PADRIGHT(值,长度,对齐字符)")},
{ "MIDLOG10",(MIDLOG10,"截取后计算10底的对数(如:1000=102)。MIDLOG10(值,截取长度,1输出截取|2不输出截取)")},
{ "MIDLOG10R",(MIDLOG10R,"尾位当做10底的对数转为整数(如:102=1000)。MIDLOG10R(值,[尾位长度])")},
{ "KILO4",(KILO4,"千值转为4长度字符串(如:1000=001K)。KILO4(值,从小到大的3个长度的字符单位)")},
{ "KILO4R",(KILO4R,"4长度字符串转为千值(如:001K=1000)。KILO4R(值,从小到大的3个长度的字符单位)")},
};
static string Jia(List<string> data)
{
return (Convert.ToDecimal(data[0]) + Convert.ToDecimal(data[1])).ToString();
}
static string Jian(List<string> data)
{
if (data.Count() == 1)
return (0m - Convert.ToDecimal(data[0])).ToString();
else
return (Convert.ToDecimal(data[0]) - Convert.ToDecimal(data[1])).ToString();
}
static string Cen(List<string> data)
{
return (Convert.ToDecimal(data[0]) * Convert.ToDecimal(data[1])).ToString();
}
static string Chu(List<string> data)
{
return (Convert.ToDecimal(data[0]) / Convert.ToDecimal(data[1])).ToString();
}
static string BaiFenBi(List<string> data)
{
return (Convert.ToDecimal(data[0]) / 100m).ToString();
}
static string CenMu(List<string> data)
{
return (Math.Pow(Convert.ToDouble(data[0]), Convert.ToDouble(data[1]))).ToString();
}
static string HeBin(List<string> data)
{
return string.Join("", data);
}
static string DengYu(List<string> data)
{
return (data[0] == data[1]).ToString().ToUpper();
}
static string BuDengYu(List<string> data)
{
return (data[0] != data[1]).ToString().ToUpper();
}
static string DaYu(List<string> data)
{
return (Convert.ToDecimal(data[0]) > Convert.ToDecimal(data[1])).ToString().ToUpper();
}
static string XiaoYu(List<string> data)
{
return (Convert.ToDecimal(data[0]) < Convert.ToDecimal(data[1])).ToString().ToUpper();
}
static string DaYuDengYu(List<string> data)
{
return (Convert.ToDecimal(data[0]) >= Convert.ToDecimal(data[1])).ToString().ToUpper();
}
static string XiaoYuDengYu(List<string> data)
{
return (Convert.ToDecimal(data[0]) <= Convert.ToDecimal(data[1])).ToString().ToUpper();
}
static string IF(List<string> data)
{
return (data[0] == "TRUE" ? data[1] : data[2]).ToString();
}
static string IFS(List<string> data)
{
int i = 0;
while (true)
{
if (data[i * 2] == "TRUE")
return data[(i * 2) + 1];
i++;
}
}
static string AND(List<string> data)
{
return (data.All(o => o == "TRUE")).ToString().ToUpper();
}
static string OR(List<string> data)
{
return (data.Any(o => o == "TRUE")).ToString().ToUpper();
}
static string ABS(List<string> data)
{
return Math.Abs(Convert.ToDecimal(data[0])).ToString();
}
static string LOG(List<string> data)
{
return Math.Log(Convert.ToDouble(data[0]), data.Count() == 1 ? 10 : Convert.ToDouble(data[1])).ToString();
}
static string REPLACE(List<string> data)
{
return $"{data[0].Substring(0, Convert.ToInt32(data[1]) - 1)}{data[3]}{data[0].Substring(Convert.ToInt32(data[1]) + Convert.ToInt32(data[2]) - 1)}";
}
static string SUBSTITUTE(List<string> data)
{
return data.Count == 3 ? data[0].Replace(data[1], data[2]) : data[0].Replace(data[1], data[2]);
}
static string MID(List<string> data)
{
return Convert.ToInt32(data[1]) > 0 ? new string(data[0].Skip(Convert.ToInt32(data[1]) - 1).Take(Convert.ToInt32(data[2])).ToArray()) : new string(data[0].Reverse().Skip(Math.Abs(Convert.ToInt32(data[1])) - 1).Take(Convert.ToInt32(data[2])).Reverse().ToArray());
}
static string SEARCH(List<string> data)
{
var v1 = (data.Count() == 2 ? data[1].IndexOf(data[0]) + 1 : data[1].Substring(Convert.ToInt32(data[2])).IndexOf(data[0]) + 1);
return (v1 == 0 ? 0 : data.Count() == 2 ? v1 : v1 + Convert.ToInt32(data[2])).ToString();
}
static string TRIM(List<string> data)
{
return data[0].Trim();
}
static string LEN(List<string> data)
{
return data[0].Length.ToString();
}
static string REVERSE(List<string> data)
{
return new string(data[0].Reverse().ToArray());
}
static string REPLACES(List<string> data)
{
var va = data[0];
foreach (var v in data.Skip(2))
{
va = va.Replace(v, data[1]);
}
return va;
}
static string CONTAINS(List<string> data)
{
foreach (var item in data.Skip(1))
{
if (data[0].Contains(item))
return "TRUE";
}
return "FALSE";
}
static string WHERENUM(List<string> data)
{
var sb = new StringBuilder();
foreach (var item in data[0])
if (Char.IsDigit(item))
sb.Append(item);
return sb.ToString();
}
static string WHEREAZ(List<string> data)
{
var sb = new StringBuilder();
foreach (var item in data[0])
if (Char.IsLetter(item))
sb.Append(item);
return sb.ToString();
}
static string WHERENUMAZ(List<string> data)
{
var sb = new StringBuilder();
foreach (var item in data[0])
if (Char.IsLetterOrDigit(item))
sb.Append(item);
return sb.ToString();
}
static string SPLIT(List<string> data)
{
return Convert.ToInt32(data[2]) > 0 ? data[0].Split(new string[] { data[1] }, StringSplitOptions.None).ElementAtOrDefault(Convert.ToInt32(data[2]) - 1) : data[0].Split(new string[] { data[1] }, StringSplitOptions.None).Reverse().ElementAtOrDefault(Math.Abs(Convert.ToInt32(data[2])) - 1);
}
static string PADLEFT(List<string> data)
{
return data[0].PadLeft(Convert.ToInt32(data[1]), data[2].First());
}
static string PADRIGHT(List<string> data)
{
return data[0].PadRight(Convert.ToInt32(data[1]), data[2].First());
}
static string MIDLOG10R(List<string> data)
{
var cc = data[0].Length - (data.Count > 1 ? Convert.ToInt32(data[1]) : 1);
var v1 = Convert.ToInt32(data[0].Substring(0, cc));
var v2 = Convert.ToInt32(data[0].Substring(cc));
return (v1 * Math.Pow(10, v2)).ToString();
}
static string MIDLOG10(List<string> data)
{
var d1 = (Int32)Convert.ToDecimal(data[0]);
var d2 = Convert.ToInt32(data[1]);
var d3 = Convert.ToInt32(data[2]);
var ws = Convert.ToInt32(new string(d1.ToString().Take(d2).ToArray()));
var log = ws == 0 ? 0 : Math.Log10(d1 / ws);
if (double.IsNaN(log) || double.IsInfinity(log))
log = 0;
return d3 == 1 ? (ws.ToString() + log).PadLeft(d2, '0') : log.ToString();
}
static string KILO4(List<string> data)
{
var d1 = Convert.ToDecimal(data[0]);
var d2 = data[1].Skip(0).First();
var d3 = data[1].Skip(1).First();
var d4 = data[1].Skip(2).First();
if (d1 <= 0)
{
return "000" + d2;
}
else if (d1 < 1)
{
return d1.ToString().Replace('.', d2).Trim('0').PadLeft(4, '0').Substring(0, 4);
}
else if (d1 < 1000)
{
var aa = d1.ToString().Replace('.', d2);
return (aa.IndexOf(d2) == -1 ? (aa + d2) : aa).PadLeft(4, '0').Substring(0, 4);
}
else if (d1 < 1000 * 1000)
{
d1 = d1 / 1000m;
var aa = d1.ToString().Replace('.', d3);
return (aa.IndexOf(d3) == -1 ? (aa + d3) : aa).PadLeft(4, '0').Substring(0, 4);
}
else if (d1 < 1000 * 1000 * 1000)
{
d1 = d1 / (1000m * 1000m);
var aa = d1.ToString().Replace('.', d4);
return (aa.IndexOf(d4) == -1 ? (aa + d4) : aa).PadLeft(4, '0').Substring(0, 4);
}
else
{
return "999" + d4;
}
}
static string KILO4R(List<string> data)
{
var d2 = data[1].Skip(0).First();
var d3 = data[1].Skip(1).First();
var d4 = data[1].Skip(2).First();
if (data[0].Contains(d2))
{
return Convert.ToDecimal(data[0].Replace(d2, '.')).ToString();
}
else if (data[0].Contains(d3))
{
return (Convert.ToDecimal(data[0].Replace(d3, '.')) * 1000m).ToString();
}
else if (data[0].Contains(d4))
{
return (Convert.ToDecimal(data[0].Replace(d4, '.')) * 1000m * 1000m).ToString();
}
else
{
return Convert.ToDecimal(data[0]).ToString();
}
}
}
}

View File

@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="TouchSocket" Version="2.0.0" />
<PackageReference Include="XLParser" Version="1.7.2" />
</ItemGroup>
<ItemGroup>

View File

@ -8,10 +8,10 @@ namespace WCS.Model
{
public class QueryByMatSnResponse : ResponseBase
{
public MatInfoModel Data { get; set; }
public MatInfoResponse Data { get; set; }
}
public class MatInfoModel
public class MatInfoResponse
{
public string materialBar { get; set; }

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
using WCS.BLL.DbModels;
namespace WCS.Model.ApiModel.MatBaseInfo
{
public class GenerateMatInfoRequest:RequestBase
{
public MatBaseInfoModel MatBaseInfo { get; set; }
/// <summary>
/// 每盘数量
/// </summary>
public int MatQty { get; set; }
/// <summary>
/// 本次生成的盘数
/// </summary>
public int TotalCount { get; set; }
}
}

View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.MatBaseInfo
{
public class MatInfoModel
{
public int Id { get; set; }
public string MatSn { get; set; }
public string MatCode { get; set; }
public string MatName { get; set; }
public string? MatSpec { get; set; }
public string? MatUnit { get; set; }
public string? MatBatch { get; set; }
public string? MatSupplier { get; set; }
public string? MatCustomer { get; set; }
public int MatQty { get; set; }
public bool IsPrinted { get; set; }
public string? ModifyUser { get; set; }
public DateTime? ModifyTime { get; set; } = DateTime.Now;
}
}

View File

@ -18,13 +18,12 @@ namespace WCS.Model
public string OrderType { get; set; }
public List<MatCodeItemList> ItemList { get; set; }
}
public class MatCodeItemList
{
public string MatCode { get; set; }
public string MatBatch { get; set; }
public int ReqQty { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.Stocktaking
{
public class ComfirmStocktakingOrderRequest
{
public int Id { get; set; }
public string StocktakingOrderNumber { get; set; }
public string MatSN { get; set; }
public int Qty { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.Stocktaking
{
public class GetStockTakingOrderMatDetailRequest
{
public int StockTakingOrderId { get; set; }
public string StockTakingOrderNumber { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.Stocktaking
{
public class GetStockTakingOrdersRequest : PageQueryRequestBase
{
public string StocktakingOrderNumber { get; set; }
public StocktakingOrderStatus? StocktakingOrderStatus { get; set; }
}
public enum StocktakingOrderStatus
{
= 0,
= 1,
= 2,
= 3
}
}

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.Stocktaking
{
public class QueryMatInfoInStocktakingOrderRequest:RequestBase
{
public string MatSN { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.Stocktaking
{
public class SysStockTakingOrderRequest : RequestBase
{
public string StocktakingOrderNumber { get; set; }
public string StocktakingOrderSource { get; set; }
public string StocktakingOrderType { get; set; }
public List<string> List { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WCS.Model.ApiModel.Stocktaking
{
public class SysStockTakingOrderResponse : ResponseBase<SysStockTakingOrderData>
{
}
public class SysStockTakingOrderData
{
public string StocktakingOrderNumber { get; set; }
}
}

View File

@ -88,7 +88,7 @@ namespace WebApi.Controllers
[HttpPost(Name = "queryByMatSn")]
public async Task<ResponseBase> queryByMatSn(QueryByMatSnRequest request)
{
return _instoreService.queryByMatSn(request);
return await _instoreService.queryByMatSn(request);
}
/// <summary>

View File

@ -24,9 +24,12 @@ namespace WCS.WebApi.Controllers
{
public IMatBaseInfoService _matBaseInfoService { get; set; }
public MatBaseInfoController(IMatBaseInfoService matBaseInfoService)
public IGenerateService _generateMatInfoService { get; set; }
public MatBaseInfoController(IMatBaseInfoService matBaseInfoService, IGenerateService generateMatInfoService)
{
_matBaseInfoService = matBaseInfoService;
_generateMatInfoService = generateMatInfoService;
}
[Route("getMatBaseInfo")]
@ -100,5 +103,12 @@ namespace WCS.WebApi.Controllers
{
return await _matBaseInfoService.getMatCodeList(request);
}
[HttpPost("generateMatInfo")]
public async Task<ResponseCommon<List<MatInfo>>> generateMatInfo(GenerateMatInfoRequest request)
{
return await _generateMatInfoService.generateMatInfo(request);
}
}
}

View File

@ -3,6 +3,7 @@ using System.Text;
using WCS.BLL;
using WCS.BLL.DbModels;
using WCS.DAL.Db;
using WCS.Model;
namespace WCS.WebApi.Controllers
{
@ -61,7 +62,12 @@ namespace WCS.WebApi.Controllers
}
catch (Exception e)
{
//Logs.Write(e.Message);
//return new ResponseCommon()
//{
// Code = 300,
// Message = $"操作失败:{e.Message}"
//};
}
finally

View File

@ -0,0 +1,88 @@
using Microsoft.AspNetCore.Mvc;
using WCS.BLL.Services.IService;
using WCS.Model;
using WCS.Model.ApiModel;
using WCS.Model.ApiModel.MatInventoryDetail;
using WCS.Model.ApiModel.Stocktaking;
using WCS.Model.ApiModel.User;
namespace WCS.WebApi.Controllers
{
/// <summary>
/// 权限/用户界面的接口
/// </summary>
[ApiController]
[Route("[controller]")]
public class StockTakingController : ControllerBase
{
public IStockTakingService _stockTakingService { get; set; }
public IGenerateService _generateService { get; set; }
public StockTakingController(IStockTakingService stockTakingService, IGenerateService generateService)
{
_stockTakingService = stockTakingService;
_generateService = generateService;
}
[Route("SysStockTakingOrder")]
[HttpPost(Name = "SysStockTakingOrder")]
public async Task<ResponseBase> SysStockTakingOrder(SysStockTakingOrderRequest request)
{
//判断盘点单号是否已输入
if (string.IsNullOrEmpty(request.StocktakingOrderNumber))
request.StocktakingOrderNumber = await _generateService.generateStockTakingNumber();
return await _stockTakingService.SysStockTakingOrder(request);
}
[Route("getStockTakingOrders")]
[HttpPost(Name = "getStockTakingOrders")]
public async Task<ResponseBase> getStockTakingOrders(GetStockTakingOrdersRequest request)
{
return await _stockTakingService.getStockTakingOrders(request);
}
[Route("getStockTakingOrderMatDetail")]
[HttpPost(Name = "getStockTakingOrderMatDetail")]
public async Task<ResponseBase> getStockTakingOrderMatDetail(GetStockTakingOrderMatDetailRequest request)
{
return await _stockTakingService.getStockTakingOrderMatDetail(request);
}
[Route("startStockTakingOrder")]
[HttpPost(Name = "startStockTakingOrder")]
public async Task<ResponseBase> startStockTakingOrder(GetStockTakingOrderMatDetailRequest request)
{
return await _stockTakingService.startStockTakingOrder(request);
}
[Route("endStockTakingOrder")]
[HttpPost(Name = "endStockTakingOrder")]
public async Task<ResponseBase> endStockTakingOrder(GetStockTakingOrderMatDetailRequest request)
{
return await _stockTakingService.endStockTakingOrder(request);
}
[Route("queryMatInfoInStocktakingOrder")]
[HttpPost(Name = "queryMatInfoInStocktakingOrder")]
public async Task<ResponseBase> queryMatInfoInStocktakingOrder(QueryMatInfoInStocktakingOrderRequest request)
{
return await _stockTakingService.queryMatInfoInStocktakingOrder(request);
}
[Route("comfirmStocktakingOrder")]
[HttpPost(Name = "comfirmStocktakingOrder")]
public async Task<ResponseBase> comfirmStocktakingOrder(ComfirmStocktakingOrderRequest request)
{
return await _stockTakingService.comfirmStocktakingOrder(request);
}
[Route("commitStocktakingOrder")]
[HttpPost(Name = "commitStocktakingOrder")]
public async Task<ResponseBase> commitStocktakingOrder(GetStockTakingOrderMatDetailRequest request)
{
return await _stockTakingService.commitStockTakingOrder(request);
}
}
}

View File

@ -5,8 +5,6 @@ using System.Net;
using System.Net.Http;
using System.Net.Sockets;
using System.Text;
using TouchSocket.Core;
using TouchSocket.Sockets;
using WCS.BLL.Manager;
using WCS.BLL.Services.IService;
using WCS.BLL.Services.Service;
@ -14,7 +12,6 @@ using WCS.DAL;
using WCS.DAL.Db;
using WCS.WebApi;
using WCS.WebApi.Controllers;
using TcpClient = TouchSocket.Sockets.TcpClient;
namespace WebApi
{
@ -62,6 +59,9 @@ namespace WebApi
builder.Services.AddScoped<IMatBaseInfoService, MatBaseInfoService>();
builder.Services.AddScoped<IMatInventoryDetailService, MatInventoryDetailService>();
builder.Services.AddScoped<IStoreInfoService, StoreInfoService>();
builder.Services.AddScoped<IStockTakingService, StockTakingService>();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA1A2><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ģʽ
builder.Services.AddSingleton<IGenerateService, GenerateService>();
var app = builder.Build();

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>false</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\net6.0\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
</PropertyGroup>
</Project>

Binary file not shown.

View File

@ -300,7 +300,6 @@ namespace 货架标准上位机.ViewModel
}
}
/// <summary>
/// 物料修改操作
/// </summary>
@ -389,20 +388,27 @@ namespace 货架标准上位机.ViewModel
}
public ICommand BtnPrintCommand { get => new DelegateCommand(BtnPrint); }
public async void BtnPrint()
{
PrintTender.PrintTag(new PrintClass()
var matBaseInfo = DataGridItemSource?.Where(t => t.IsSelected == true).FirstOrDefault();
if (matBaseInfo == null)
{
MatQty = "123",
MatCode = "123",
MatBatch = "123",
MatName = "123",
MatSn = "123",
MatSpec = "123",
Growl.Warning("请勾选数据!");
}
var generateWindow = new MatBaseInoGenarateMatInfoView(matBaseInfo);
var result = generateWindow.ShowDialog();
});
//PrintTender.PrintTag(new PrintClass()
//{
// MatQty = "123",
// MatCode = "123",
// MatBatch = "123",
// MatName = "123",
// MatSn = "123",
// MatSpec = "123",
//});
}
#endregion

View File

@ -178,7 +178,7 @@
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe662;" FontSize="20" FontFamily="{StaticResource IconFont}"></TextBlock>
<TextBlock Margin="10,0,0,0" FontSize="16">物料管理</TextBlock>
<TextBlock Margin="10,0,0,0" FontSize="16">物料维护</TextBlock>
</StackPanel>
</TabItem.Header>
<hc:TransitioningContentControl TransitionMode="Fade">
@ -190,11 +190,11 @@
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe662;" FontSize="20" FontFamily="{StaticResource IconFont}"></TextBlock>
<TextBlock Margin="10,0,0,0" FontSize="16">条码打印</TextBlock>
<TextBlock Margin="10,0,0,0" FontSize="16">物料明细</TextBlock>
</StackPanel>
</TabItem.Header>
<hc:TransitioningContentControl TransitionMode="Fade">
<View:MatBaseInfoView/>
<View:MatInfoView/>
</hc:TransitioningContentControl>
</TabItem>

View File

@ -0,0 +1,69 @@
<Window
xmlns:pi="https://github.com/ping9719/wpfex"
x:Class="货架标准上位机.MatBaseInoGenarateMatInfoView"
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:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Height="320" Width="320" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
<Border BorderBrush="Gray" Background="WhiteSmoke" CornerRadius="5" BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock FontSize="22" Name="Title" Text="{Binding Title, FallbackValue= 生成物料明细}" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Button Margin="-5,-1"
Visibility="{Binding IsClose,Converter={StaticResource Boolean2VisibilityConverter}}"
Style="{StaticResource ButtonIcon}"
hc:IconElement.Geometry="{StaticResource CloseGeometry}" HorizontalAlignment="Right"
VerticalAlignment="Top" Click="closeClick"/>
<StackPanel Margin="5,0" Grid.Row="1" >
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="物料编码:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<TextBlock Name="txtMatCode" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="物料名称:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<TextBlock Name="txtMatName" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="物料规格:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<TextBlock Name="txtMatSpec" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="物料客户:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<TextBlock Name="txtMatCustomer" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="单盘数量:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<TextBox Name="txtMatQty" MinWidth="200" Grid.Row="0" Grid.Column="1" FontSize="15"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
InputScope="Number"
Style="{StaticResource TextBoxExtend}">
</TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="物料盘数:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<TextBox Name="txtTotalCount" MinWidth="200" Grid.Row="0" Grid.Column="1" FontSize="15"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
InputScope="Number"
Style="{StaticResource TextBoxExtend}">
</TextBox>
</StackPanel>
</StackPanel>
<StackPanel Margin="5" x:Name="spacingPanel" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Margin="5" MinHeight="30" FontSize="15" Content="生成" Name="btnOk" Click="btnOk_Click"/>
<Button Margin="5" MinHeight="30" FontSize="15" Content="生成并打印" Click="btnOk_Click"/>
<Button Margin="5" MinHeight="30" FontSize="15" Content="取 消" Click="closeClick"/>
</StackPanel>
</Grid>
</Border>
</Window>

View File

@ -0,0 +1,68 @@
using HandyControl.Controls;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Windows;
using WCS.BLL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel.MatBaseInfo;
using .Api;
using .ViewModel;
namespace
{
public partial class MatBaseInoGenarateMatInfoView : System.Windows.Window
{
public MatBaseInfoModel matBaseInfo = null;
public MatBaseInoGenarateMatInfoView(MatBaseInfoModel _matBaseInfo = null)
{
InitializeComponent();
if (_matBaseInfo != null)
{
matBaseInfo = _matBaseInfo;
//绑定数据
txtMatCode.Text = matBaseInfo.MatCode;
txtMatName.Text = matBaseInfo.MatName;
txtMatSpec.Text = matBaseInfo.MatSpec;
txtMatCustomer.Text = matBaseInfo.MatCustomer;
}
}
private void btnOk_Click(object sender, RoutedEventArgs e)
{
#region
try
{
var body = new GenerateMatInfoRequest()
{
MatBaseInfo = matBaseInfo,
TotalCount = Convert.ToInt32(txtTotalCount.Text),
MatQty = Convert.ToInt32(txtMatQty.Text),
};
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<MatInfoModel>>>(LocalFile.Config.ApiIpHost + "matBaseInfo/generateMatInfo", body, "POST");
if (Result != null && Result.Data != null && Result.Data.Count > 0)
{
Growl.Success("生成成功!");
}
}
catch (Exception ex)
{
Growl.Error("加载数据失败:" + ex.Message);
}
#endregion
this.DialogResult = true;
this.Close();
}
private void closeClick(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
}
}

View File

@ -0,0 +1,283 @@
<pi:UserControlBase
xmlns:pi="https://github.com/ping9719/wpfex"
x:Class="货架标准上位机.MatInfoView"
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:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
d:DesignHeight="737" d:DesignWidth="1192" LoadedVisibleFirst="LoadedVisible">
<Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="10*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="0" Margin="5 5 5 0" Background="AliceBlue" CornerRadius="5" Padding="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1.9*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="物料编码:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="1"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding MatCode}"></TextBox>
<TextBlock Grid.Column="2"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="物料名称:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="3"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding MatName}"></TextBox>
<TextBlock Grid.Column="4"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="物料规格:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="5"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding MatSpec}"></TextBox>
<TextBlock Grid.Column="6"
VerticalAlignment="Center" HorizontalAlignment="Right"
Text="物料条码:" FontSize="18" ></TextBlock>
<TextBox Grid.Column="7"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
FontSize="18" MinWidth="90" Text="{Binding MatSn}"></TextBox>
<Button Style="{StaticResource ButtonSuccess}" hc:BorderElement.CornerRadius="15"
Grid.Column="9" MinHeight="40" FontSize="18" Content="&#xe8b9; 搜索" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnSearchCommand}">
</Button>
<Button Style="{StaticResource ButtonWarning}" hc:BorderElement.CornerRadius="15"
Grid.Column="10" MinHeight="40" FontSize="18" Content="&#xe652; 重置" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnResetCommand}">
</Button>
</Grid>
</Border>
<Border Grid.Row="1" Margin="5" Background="AliceBlue" CornerRadius="5" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"></RowDefinition>
<RowDefinition Height="9*"></RowDefinition>
<RowDefinition Height="0.8*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button MinHeight="40" FontSize="18" Margin="5"
Content="&#xe8c1;删 除" FontFamily="{StaticResource IconFont}"
Foreground="WhiteSmoke"
Command="{Binding BtnDeleteCommand}"
Style="{StaticResource ButtonDanger}"
>
</Button>
<Button MinHeight="40" FontSize="18" Margin="5"
Content="&#xe866;打印/补打" FontFamily="{StaticResource IconFont}"
Command="{Binding BtnPrintCommand}"
Foreground="WhiteSmoke"
Background="DarkOrange"
>
</Button>
</StackPanel>
<DataGrid Grid.Row="1"
SelectionChanged="DataGrid_SelectionChanged"
SelectedItem="{Binding SelectedataGridItem}"
Name="dataGrid"
SelectedCellsChanged="DataGrid_SelectedCellsChanged"
ItemsSource="{Binding DataGridItemSource}"
RowHeight="39"
AutoGenerateColumns="False" FontSize="13">
<DataGrid.Columns>
<DataGridTemplateColumn CanUserResize="False">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox Width="30" Height="30" IsHitTestVisible="False" IsChecked="{Binding IsSelected}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<CheckBox Width="30" Height="30" Unchecked="allChecked_Unchecked" Checked="allChecked_Checked" Name="allChecked"/>
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="名称" Binding="{Binding MatName}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="规格" Binding="{Binding MatSpec}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="单位" Binding="{Binding MatUnit}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="客户" Binding="{Binding MatCustomer}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="状态" Binding="{Binding IsEnableStr}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="更新人" Binding="{Binding ModifyUser}"></DataGridTextColumn>
<DataGridTextColumn IsReadOnly="True" Header="更新时间" Binding="{Binding ModifyTime ,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="2">
<Border CornerRadius="3" Background="Transparent" VerticalAlignment="Center" >
<Grid HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Top" Width="Auto" MinHeight="26">
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="5*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock FontSize="14" Text="共"></TextBlock>
<TextBlock FontSize="14" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" Text="第"></TextBlock>
<TextBlock FontSize="14" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" Text="/"></TextBlock>
<TextBlock FontSize="14" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" Text="页"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
<Grid>
<Grid.RowDefinitions >
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="0" Name="btnFirst" Content="首页" Foreground="Black" FontSize="14"
Command="{Binding BtnFirstPageCommand}"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="1" Name="btnPrev" Content="上一页" FontSize="14"
Command="{Binding BtnPrePageCommand}"/>
<TextBox BorderBrush="Transparent" Grid.Column="2" FontSize="14" MinWidth="50" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="IBeam" IsEnabled="False"
Text ="{Binding CurrentPage}" TextAlignment="Center"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="3" Name="btnNext" Content="下一页" FontSize="14"
Command="{Binding BtnNextPageCommand}"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="4" Name="btnLast" Content="末页" FontSize="14"
Command="{Binding BtnLastPageCommand}"/>
</Grid>
</StackPanel>
</Grid>
</Border>
</Grid>
</Grid>
</Border>
<!--<Border Grid.Row="1" Margin="3" Background="AliceBlue" CornerRadius="3" Padding="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.8*"></RowDefinition>
<RowDefinition Height="8*"></RowDefinition>
<RowDefinition Height="0.7*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnExportCommand}"
Content="&#xe866; 导 出" FontFamily="{StaticResource IconFont}"
Style="{StaticResource ButtonWarning}" Background="DarkOrange">
</Button>
</StackPanel>
<DataGrid Grid.Row="1"
SelectedCellsChanged="DataGrid_SelectedCellsChanged"
ItemsSource="{Binding DataGridItemSource}"
RowHeight="39"
AutoGenerateColumns="False"
FontSize="13">
<DataGrid.Columns>
<DataGridTextColumn Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
<DataGridTextColumn Header="接口地址" Binding="{Binding RequestUrl}"></DataGridTextColumn>
<DataGridTextColumn Header="设备IP" Binding="{Binding DeviceIp}"></DataGridTextColumn>
<DataGridTextColumn Header="请求参数" Binding="{Binding RequestBody}" MaxWidth="100"></DataGridTextColumn>
<DataGridTextColumn Header="QueryString" Binding="{Binding QueryString}" MaxWidth="100"></DataGridTextColumn>
<DataGridTextColumn Header="请求时间" Binding="{Binding RequestTime,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
<DataGridTextColumn Header="返回参数" Binding="{Binding ResponseJson}" MaxWidth="100"></DataGridTextColumn>
<DataGridTextColumn Header="返回时间" Binding="{Binding ResponseTime,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
<DataGridTextColumn Header="耗时(ms)" Binding="{Binding ExecutionTime}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="2">
<Border CornerRadius="3" Background="Transparent" VerticalAlignment="Center" >
<Grid HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Top" Width="Auto" MinHeight="26">
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="5*"></ColumnDefinition>
<ColumnDefinition Width="5*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock FontSize="14" Text="共"></TextBlock>
<TextBlock FontSize="14" Text="{Binding TotalCount ,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" Text="条记录 "></TextBlock>
<TextBlock FontSize="14" Text="第"></TextBlock>
<TextBlock FontSize="14" Text="{Binding CurrentPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" Text="/"></TextBlock>
<TextBlock FontSize="14" Text="{Binding MaxPage,FallbackValue=0}"></TextBlock>
<TextBlock FontSize="14" Text="页"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Column="1">
<Grid>
<Grid.RowDefinitions >
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="0" Name="btnFirst" Content="首页" Foreground="Black" FontSize="14"
Command="{Binding BtnFirstPageCommand}"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="1" Name="btnPrev" Content="上一页" FontSize="14"
Command="{Binding BtnPrePageCommand}"/>
<TextBox BorderBrush="Transparent" Grid.Column="2" FontSize="14" MinWidth="50" HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="IBeam" IsEnabled="False"
Text ="{Binding CurrentPage}" TextAlignment="Center"
/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="3" Name="btnNext" Content="下一页" FontSize="14"
Command="{Binding BtnNextPageCommand}"/>
<Button BorderBrush="Transparent" Background="Transparent" Grid.Column="4" Name="btnLast" Content="末页" FontSize="14"
Command="{Binding BtnLastPageCommand}"/>
</Grid>
</StackPanel>
</Grid>
</Border>
</Grid>
</Grid>
</Border>-->
</Grid>
</Border>
</pi:UserControlBase>

View File

@ -0,0 +1,88 @@
using Ping9719.WpfEx;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using .ViewModel;
namespace
{
public partial class MatInfoView : UserControlBase
{
public MatBaseInfoViewModel viewModel { get; set; } = new MatBaseInfoViewModel();
public MatInfoView()
{
InitializeComponent();
this.DataContext = viewModel;
}
private void LoadedVisible(object sender, EventArgs e)
{
viewModel.BtnReset();
}
private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
if (viewModel.SelectedataGridItem != null)
{
viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
dataGrid.UnselectAllCells();//取消选中 避免手动点击check选项时反选失败 和重新点击该项时反选失败
}
}
catch
{
}
}
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
{
//try
//{
// if (viewModel.SelectedataGridItem != null)
// {
// viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
// }
//}
//catch
//{
//}
}
private void allChecked_Checked(object sender, RoutedEventArgs e)
{
if (viewModel != null && viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > 0)
{
foreach (var item in viewModel.DataGridItemSource)
{
item.IsSelected = true;
}
}
}
private void allChecked_Unchecked(object sender, RoutedEventArgs e)
{
if (viewModel != null && viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > 0)
{
foreach (var item in viewModel.DataGridItemSource)
{
item.IsSelected = false;
}
}
}
}
}

View File

@ -83,6 +83,9 @@
<None Update="data\jsconfig.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\Interop.BarTender.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\物料条码.btw">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>