You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.5 KiB
125 lines
3.5 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace PunchingMistake
|
|
{
|
|
public class Function3
|
|
{
|
|
/// <summary>
|
|
/// 获取班次,规定早8至晚8为A班
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static string GetWorkClass()
|
|
{
|
|
bool classA = IsBetweenTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), DateTime.Now.ToString("yyyy-MM-dd") + " 08:00:00", DateTime.Now.ToString("yyyy-MM-dd") + " 20:00:00");
|
|
if (classA)
|
|
{
|
|
return "A班";
|
|
}
|
|
else
|
|
{
|
|
return "B班";
|
|
}
|
|
} /// <summary>
|
|
/// 判断传入时间是否在工作时间段内
|
|
/// </summary>
|
|
/// <param name="timeStr"></param>
|
|
/// <param name="startTime"></param>
|
|
/// <param name="endTime"></param>
|
|
/// <returns></returns>
|
|
public static bool IsBetweenTime(string timeStr, string startTime, string endTime)
|
|
{
|
|
//判断传入时间是否在工作时间段内
|
|
try
|
|
{
|
|
TimeSpan startSpan = DateTime.Parse(startTime).TimeOfDay;
|
|
TimeSpan endSpan = DateTime.Parse(endTime).TimeOfDay;
|
|
|
|
DateTime t1 = Convert.ToDateTime(timeStr);
|
|
TimeSpan dspNow = t1.TimeOfDay;
|
|
if (dspNow > startSpan && dspNow < endSpan)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteLog(ex.ToString());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断条码有效性
|
|
/// </summary>
|
|
/// <param name="barcode"></param>
|
|
/// <returns></returns>
|
|
public static bool BarCodeValid(string barcode)
|
|
{
|
|
bool res = false;
|
|
if (!string.IsNullOrWhiteSpace(barcode))
|
|
{
|
|
if (barcode.Contains("."))
|
|
{
|
|
res = true;
|
|
}
|
|
else
|
|
{
|
|
if (barcode.Length == 20)
|
|
{
|
|
res = true;
|
|
}
|
|
}
|
|
}
|
|
return res;
|
|
}
|
|
}
|
|
public static class ScanAll
|
|
{
|
|
public static bool ScanResult;
|
|
public static string barCode1;
|
|
public static string barCode2;
|
|
public static string barCode3;
|
|
public static string barCode4;
|
|
public static string barCode5;
|
|
public static string barCode6;
|
|
public static string partNo1;
|
|
public static string partNo2;
|
|
public static string partNo3;
|
|
public static string partNo4;
|
|
public static string partNo5;
|
|
public static string partNo6;
|
|
}
|
|
|
|
public class OtherPart
|
|
{
|
|
public string productID3 { get; set; }
|
|
|
|
public string qty3 { get; set; }
|
|
|
|
public string productID4 { get; set; }
|
|
|
|
public string qty4 { get; set; }
|
|
|
|
public string productID5 { get; set; }
|
|
|
|
public string qty5 { get; set; }
|
|
|
|
public string productID6 { get; set; }
|
|
|
|
public string qty6 { get; set; }
|
|
|
|
public string productID7 { get; set; }
|
|
|
|
public string qty7 { get; set; }
|
|
|
|
public string productID8 { get; set; }
|
|
|
|
public string qty8 { get; set; }
|
|
|
|
}
|
|
}
|
|
|