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; }
private void frCompanyInfo_Load(object sender, EventArgs e) { dtOT = bllOT.GetList("(TypeID=" + (int)Hownet.BLL.Enums.OtherType.系统设置 + ")").Tables[0]; DataRow[] drs = dtOT.Select("(Name='物料使用条码出入仓')"); if (drs.Length == 0) { DataTable dtTem = dtOT.Clone(); DataRow dr = dtTem.NewRow(); dr["A"] = 1; dr["ID"] = 0; dr["Name"] = "物料使用条码出入仓"; dr["TypeID"] = (int)Hownet.BLL.Enums.OtherType.系统设置; dr["Value"] = "False"; dtTem.Rows.Add(dr); bllOT.AddByDt(dtTem); } else { try { _chb物料使用条码出入仓.Checked = Convert.ToBoolean(drs[0]["Value"]); } catch (Exception ex) { } } drs = dtOT.Select("(Name='成品需按货架存放')"); if (drs.Length == 0) { DataTable dtTem = dtOT.Clone(); DataRow dr = dtTem.NewRow(); dr["A"] = 1; dr["ID"] = 0; dr["Name"] = "成品需按货架存放"; dr["TypeID"] = (int)Hownet.BLL.Enums.OtherType.系统设置; dr["Value"] = "False"; dtTem.Rows.Add(dr); bllOT.AddByDt(dtTem); } else { try { _chb成品需按货架存放.Checked = Convert.ToBoolean(drs[0]["Value"]); } catch (Exception ex) { } } drs = dtOT.Select("(Name='分组显示为部位')"); if (drs.Length == 0) { DataTable dtTem = dtOT.Clone(); DataRow dr = dtTem.NewRow(); dr["A"] = 1; dr["ID"] = 0; dr["Name"] = "分组显示为部位"; dr["TypeID"] = (int)Hownet.BLL.Enums.OtherType.系统设置; dr["Value"] = "False"; dtTem.Rows.Add(dr); bllOT.AddByDt(dtTem); } else { try { _chb分组显示为部位.Checked = Convert.ToBoolean(drs[0]["Value"]); } catch (Exception ex) { } } drs = dtOT.Select("(Name='备份文件夹位置')"); if (drs.Length == 0) { DataTable dtTem = dtOT.Clone(); DataRow dr = dtTem.NewRow(); dr["A"] = 1; dr["ID"] = 0; dr["Name"] = "备份文件夹位置"; dr["TypeID"] = (int)Hownet.BLL.Enums.OtherType.系统设置; dr["Value"] = @"E:\Backup"; dtTem.Rows.Add(dr); bllOT.AddByDt(dtTem); } else { try { _teBackUpDir.Text = drs[0]["Value"].ToString(); } catch (Exception ex) { } } int _id = bllST.GetMaxId() - 1; // ds = bllST.GetList("(ID=" + _id + ")"); modST = bllST.GetModel(_id); Hownet.BLL.Working bllW = new Hownet.BLL.Working(); Hownet.BLL.Deparment bllD = new Hownet.BLL.Deparment(); _coBackDepot.DataSource = bllW.GetList("(IsSpecial=0)").Tables[0]; DataTable dtD = bllD.GetList("(TypeID=42)").Tables[0]; _coDefaultRaw.DataSource = dtD; DataTable dtDD = bllD.GetList("(TypeID=42) OR (TypeID=39)").Tables[0]; //DataRow dr = dtDD.NewRow(); //dr["ID"] = 0; //dr["Name"] = string.Empty; //dtDD.Rows.Add(dr); _coDefaultDepot.DataSource = dtDD; if (modST != null) { ID = modST.ID; _address.Text = modST.Address; _bank.Text = modST.BanKName; _bankID.Text = modST.BankNO; _bankUser.Text = modST.BankUserName; _comName.Text = modST.CompanyName; _fax.Text = modST.Fax; _linkMan.Text = modST.LinkMan; _phone.Text = modST.Phone; _ceDirect.Checked = modST.Direct2Depot; _ceSell.Checked = modST.Sell4Depot; _ceAutoClient.Checked = modST.AutoClient; _chBoxOrPic.Checked = modST.BoxOrPic; _Mobile.Text = modST.Mobile; _coNumType.SelectedIndex = modST.NumType; _coSellMoney.SelectedIndex = modST.SellMoney; _ceCustom.Checked = modST.CustOder; _chNotPermissions.Checked = modST.NotPermissions; _ceDepotAllowNegative.Checked = modST.DepotAllowNegative; _ceIsChangedSales.Checked = modST.IsChangedSales; _coBackDepot.SelectedValue = modST.BackDepotWorking; _mbOderOne.Text = modST.OderOne.ToString().PadLeft(2, '0'); _mbOderTwo.Text = modST.OderTwo.ToString().PadLeft(2, '0'); _mbOrderThree.Text = modST.OderThree.ToString().PadLeft(2, '0'); _ceAutoCaicBoardWages.Checked = modST.AutoCaicBoardWages; _coDefaultRaw.SelectedValue = modST.DefaultRawDepot; _coDefaultDepot.SelectedValue = modST.DefaultDepot; _ceIsShowMoney.Checked = modST.IsShowMoney; _ceCompanyByUser.Checked = modST.CompanyByUser; _teDoubleNotDefaultWTNum.Text = modST.DoubleNotDefaultWTNum.ToString(); _meOrderDays.Text = modST.OrderDays.ToString(); _ceOrderNeedEat.Checked = modST.OrderNeedEat; _ceIsCheckNoWork.Checked = modST.IsCheckNoWork; _ceIsCanEditAmount.Checked = modST.IsCanEditAmount; _ceIsAutoClose.Checked = modST.IsAutoClose; _ceIsTicketNotNeedCaic.Checked = modST.IsTicketNotNeedCaic; _ceIsShowOutEmp.Checked = modST.IsShowOutEmp; _chMaterielByTask.Checked = modST.MaterielByTask; _chMaterielByTask.Enabled = bllST.CheckCanSetMatByTask(); _ceSumByWorking.Checked = modST.SumByWorking; _tbRegistration.Text = modST.Registration; } else { modST = new Hownet.Model.SysTem(); _coDefaultRaw.SelectedValue = _coDefaultDepot.SelectedValue = 0; _teDoubleNotDefaultWTNum.Text = "0"; } }