public string GetEmpWorkingList(int EmpID, DateTime dt1, DateTime dt2) { Hownet.BLL.WorkTicketInfo bllWTI = new Hownet.BLL.WorkTicketInfo(); string EmpAmount = bllWTI.GetEmpSum(EmpID, dt1, dt2, false); Hownet.BLL.MiniEmp bllME = new Hownet.BLL.MiniEmp(); Hownet.Model.MiniEmp modME = bllME.GetModel(EmpID); DataTable dt = bllME.GetSumAmountByID(Convert.ToInt32(modME.IDCardID), dt1, dt2).Tables[0]; return(EmpAmount + "ю" + Table2String(dt)); }
public string EmpAddWork(string TicketInfoID, string EmpID, string TicketTime) { if (TicketInfoID == string.Empty || TicketTime == string.Empty) { return("工序卡刷卡不正确"); } if (Convert.ToDateTime(TicketTime).AddSeconds(30) < DateTime.Now) { return("刷卡超时"); } if (EmpID == string.Empty) { return(string.Empty); } try { Hownet.BLL.MiniEmp bllME = new Hownet.BLL.MiniEmp(); Hownet.Model.MiniEmp modME = bllME.GetModel(Convert.ToInt32(EmpID)); if (modME == null) { return("员工不正确"); } if (Convert.ToDateTime(modME.DimDate) > Convert.ToDateTime("1900-1-1")) { return("员工已离职!"); } Hownet.BLL.WorkTicketInfo bllWTI = new Hownet.BLL.WorkTicketInfo(); Hownet.Model.WorkTicketInfo modWTI = bllWTI.GetModel(Convert.ToInt32(TicketInfoID)); if (modWTI == null) { return("工序卡刷卡不正确"); } if (modWTI.EmployeeID > 0) { return("该工序已被完成"); } Hownet.BLL.Working bllW = new Hownet.BLL.Working(); Hownet.Model.Working modW = bllW.GetModel(modWTI.WorkingID); if (!CheckWorkType(modW.WorkTypeID.ToString(), modME.WorkTypeID)) { return("工种不匹配"); } DateTime dtNow = DateTime.Now; Hownet.BLL.ProductTaskMain bllPTM = new Hownet.BLL.ProductTaskMain(); Hownet.Model.ProductTaskMain modPTM = bllPTM.GetModel(modWTI.TaskID); bllWTI.GetBarBack(modWTI.ID, modME.ID, dtNow, 1); bllWTI.AddPayInfo(modPTM.MaterielID, modWTI.ID, modPTM.DateTime.ToString("yyyyMMdd") + modPTM.Num.ToString().PadLeft(3, '0')); DataRow[] drs = ReaderCard.BasicTable.dtWTCard.Select("(InfoID=" + TicketInfoID + ")"); if (drs.Length == 1) { drs[0]["EmployeeID"] = modME.ID; drs[0]["MiniEmpName"] = modME.Name; drs[0]["DateTime"] = DateTime.Now; } if (modWTI.WorkingID == BasicTable.BackDepotWorkingID) { Hownet.BLL.WorkTicket bllWT = new Hownet.BLL.WorkTicket(); Hownet.Model.WorkTicket modWT = bllWT.GetModel(modWTI.MainID); if (modWT.P2DInfoID == 0) { Hownet.BLL.AmountInfo bllAI = new Hownet.BLL.AmountInfo(); List <Hownet.Model.AmountInfo> liAI = bllAI.GetModelList("(MainID=" + modWT.TaskID + ") And (TableTypeID=1) And (MListID=" + modWT.MListID + ")"); if (liAI.Count > 0) { liAI[0].NotAmount -= modWT.Amount; bllAI.Update(liAI[0]); } } } return("今天总产量:" + bllWTI.CountAmount(modME.ID, dtNow, ReaderCard.BasicTable.IsShowMoney).ToString()); } catch { return("对不起,出现错误!"); } //return string.Empty; }
/// <summary> /// 入库处理 /// </summary> /// <param name="Amount">入库数量,工序全部完成自动入库时,设置为-1</param> /// <param name="NID">机器号</param> public static string EditWorkAmount(int Amount, int NID, int GroupBy) { try { DateTime dt = DateTime.Now; DataRow[] drs = BasicTable.dtMain.Select("(No=" + NID + ") "); if (drs.Length == 0) { return(ReturnStr(0, NID, "没有箱号记录")); } else { if (int.Parse(drs[0]["EmployeeID"].ToString()) == 0) { if (((DateTime)(drs[0]["Date"])).AddSeconds(30) > dt)//30秒内刷员工卡 { Hownet.BLL.WorkTicketInfo bllWTI = new Hownet.BLL.WorkTicketInfo(); DataRow[] dddrs = ReaderCard.BasicTable.dtWTCard.Select("(IDCardNo=" + drs[0]["CardID"] + ")", "Amount DESC"); if (dddrs.Length == 0)//第一道工序 { if (Convert.ToInt32(drs[0]["Amount"]) < Amount) { return(ReturnStr(0, NID, "不能超过原数量!")); } else { bllWTI.UpNoWorkingAmount(Convert.ToInt32(drs[0]["TicketID"]), Amount, Convert.ToInt32(drs[0]["GroupBy"])); DataRow[] ddrs = ReaderCard.BasicTable.dtWTCard.Select("(IDCardNo=" + drs[0]["CardID"] + ")"); for (int i = 0; i < ddrs.Length; i++) { ddrs[i].Delete(); } ReaderCard.BasicTable.dtWTCard.AcceptChanges(); return(ReturnStr(0, NID, "数量已修改!")); } } else { if (Convert.ToInt32(dddrs[0]["Amount"]) < Amount) { return(ReturnStr(0, NID, "不能超过前数量!")); } else { bllWTI.UpNoWorkingAmount(Convert.ToInt32(drs[0]["TicketID"]), Amount, Convert.ToInt32(drs[0]["GroupBy"])); DataRow[] ddrs = ReaderCard.BasicTable.dtWTCard.Select("(IDCardNo=" + drs[0]["CardID"] + ")"); for (int i = 0; i < ddrs.Length; i++) { ddrs[i].Delete(); } ReaderCard.BasicTable.dtWTCard.AcceptChanges(); return(ReturnStr(0, NID, "数量已修改!")); } } } else { return(ReturnStr(0, NID, "已超时!")); } } } return(ReturnStr(0, NID, "")); } catch (Exception ex) { return(ReturnStr(0, NID, "错误")); } }