dev
liulb@mesnac.com 1 year ago
parent c836f6c48d
commit b2e82ccd86

@ -0,0 +1,43 @@
using Admin.Core.Model;
using Admin.Core.IRepository;
using System.Threading.Tasks;
using Admin.Core.Model.ViewModels;
using Admin.Core.Model.Model_New;
using System.Collections.Generic;
using System;
namespace Admin.Core.Repository
{
/// <summary>
/// SysUserInfoRepository
/// </summary>
public class SysUserInfoRepository : BaseRepository<SysUserInfo>, ISysUserInfoRepository
{
public SysUserInfoRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
public async Task<List<ProductInfoView>> GetStationData(string code)
{
string sql = @$"SELECT BP.PLANT_CODE PLANT_CODE, BP.PARENT_ID PRODUCT_LINE_CODE, BPS.PROCESS_CODE, BP.PRODUCT_LINE_CODE STATION_CODE
FROM BASE_PRODUCTLINE BP
LEFT JOIN BASE_PROCESS_STATION BPS ON BPS.PARENT_ID LIKE '%' || BP.PRODUCT_LINE_CODE || '%'
WHERE BP.PRODUCT_LINE_CODE = '{code}'";
return await Db.Ado.SqlQueryAsync<ProductInfoView>(sql);
}
#region 获取班组数据
/// <summary>
/// 获取班组数据
/// </summary>
/// <returns></returns>
/// <exception cref="System.NotImplementedException"></exception>
public async Task<List<CurrentTeamTimeView>> GetTeamData()
{
string sql = "SELECT * FROM VIEW_CURRENT_TEAM_TIME";
return await Db.Ado.SqlQueryAsync<CurrentTeamTimeView>(sql);
}
#endregion
}
}

@ -76,7 +76,7 @@ namespace Aucma.Core.HwPLc
/// <returns></returns>
public bool Connect(string iP, int port)
{
melsecMcNet.IpAddress = iP;//正式环境开启
//melsecMcNet.IpAddress = iP;//正式环境开启
melsecMcNet.Port = port;
// 如果网络不太理想,配置了两个端口,一个有问题,立即切换另一个的话,可以配置如下的代码

@ -18,6 +18,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@ -361,37 +362,43 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
collection.startCollect();
bLis = collection.listFixtureStatus;
if (bLis.Count == 0) return;
int total = 0;
List<BoxFoamData> bfds = await _oldBoxFoamDataServices.QueryAsync();
List<OldBoxFoamType> spaceList = await _oldBoxFoamTypeServices.QueryAsync();
List < BoxFoamPlan> planList = await _boxFoamPlanServices.QueryAsync();
for (int j = 0; j < bLis.Count; j++)
{
OldBoxFoamType space = await _oldBoxFoamTypeServices.FirstAsync(d => d.Boxtype == bLis[j].FixtureBoxType);
OldBoxFoamType space = spaceList.FirstOrDefault(d => d.Boxtype == bLis[j].FixtureBoxType);
//根据夹具找货道,根据货道找物料
if (space != null)
{
BoxFoamPlan plan = _boxFoamPlanServices.FirstAsync(d => d.MaterialCode == space.MaterialCode).Result;
BoxFoamPlan plan = planList.FirstOrDefault(d => d.MaterialCode == space.MaterialCode && d.PlanAmount > d.CompleteAmount);
if (plan != null)
{
plan.CompleteAmount = plan.CompleteAmount + 1;
await _boxFoamPlanServices.UpdateAsync(plan);
int complateAmount = 0;
//更新小时数据
BoxFoamData bfd = await _oldBoxFoamDataServices.FirstAsync(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
BoxFoamData bfd = bfds.FirstOrDefault(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
if (bfd != null)
{
UpdateBoxData(bLis[j], bfd);
//更新计划数量
complateAmount = bLis[j].Yield - bfd.Production;
}
else
{
SaveBoxData(productLineCode, bLis[j]);
}
plan.CompleteAmount = plan.CompleteAmount + complateAmount;
await _boxFoamPlanServices.UpdateAsync(plan);
}
else
{
//更新小时数据
List<BoxFoamData> bfd = await _oldBoxFoamDataServices.QueryAsync(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
if (bfd.Count > 0)
//List<BoxFoamData> bfd = await _oldBoxFoamDataServices.QueryAsync(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
BoxFoamData bfd = bfds.FirstOrDefault(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
if (bfd!=null)
{
var obj = bfd.FirstOrDefault();
UpdateBoxData(bLis[j], obj);
UpdateBoxData(bLis[j], bfd);
}
else
@ -403,11 +410,12 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
else
{
//更新小时数据
List<BoxFoamData> bfd = await _oldBoxFoamDataServices.QueryAsync(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
if (bfd.Count > 0)
//List<BoxFoamData> bfd = await _oldBoxFoamDataServices.QueryAsync(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
BoxFoamData bfd = bfds.FirstOrDefault(d => d.Fixtureboxtype == bLis[j].FixtureBoxType && d.MainId == bLis[j].ObjId);
if (bfd != null)
{
var obj = bfd.FirstOrDefault();
UpdateBoxData(bLis[j], obj);
UpdateBoxData(bLis[j], bfd);
}
else
{
@ -420,13 +428,12 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
{
Console.WriteLine(ex.Message);
}
}
private async void UpdateBoxData(FixtureStatus item, BoxFoamData bfd)
{
switch (GetTeamHour().Seq)
int hour = GetTeamHour(DateTime.Now).Seq;
switch (hour)
{
case 1:
bfd.AnHour = item.Yield - bfd.Production;
@ -467,7 +474,9 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
default:
break;
}
bfd.Production = item.Yield;
await _oldBoxFoamDataServices.UpdateAsync(bfd);
}
@ -481,7 +490,8 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
bfdata.Production = item.Yield;
bfdata.CuringTimeSettingValue = item.PlanCuringTime.ToString();
bfdata.ActualValue = item.RealCuringTime.ToString();
switch (GetTeamHour().Seq)
int hour = GetTeamHour(DateTime.Now).Seq;
switch (hour)
{
case 1:
bfdata.AnHour = item.Yield = bfdata.Production;
@ -538,5 +548,15 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
}
return null;
}
public CurrentTeamTimeView GetTeamHour(DateTime now)
{
var obj = _sysUserInfoServices.GetTeamData(now).Result;
if (obj != null)
{
return obj;
}
return null;
}
}
}

Loading…
Cancel
Save