private String getError(retCode type, String text) { StringBuilder xml = new StringBuilder(); xml.AppendLine("<cas:serviceResponse xmlns:cas=\"http://www.yale.edu/tp/cas\">"); xml.AppendLine(" <cas:authenticationFailure code=\"" + type.ToString() + "\">"); switch (type) { case retCode.INVALID_TICKET: xml.AppendLine(" Ticket " + text + " not recognized"); break; case retCode.INVALID_SERVICE: xml.AppendLine(" Service " + text + " not recognized"); break; case retCode.INVALID_REQUEST: xml.AppendLine(" Mandatory field '" + text + "' not supplied"); break; } xml.AppendLine(" </cas:authenticationFailure>"); xml.AppendLine("</cas:serviceResponse>"); return(xml.ToString()); }
//处理ID,AUTOID,CCODE public retCode getCode(string cVouchType, int sl, string CardNumber, SqlTransaction tran) { //cVouchType:采购入库单 rd,其他入库单 re,销售发货单 DISPATCH //sl: 子表数量 //CardNumber:采购入库单 24,其他出库单 0302,销售发货单 01 retCode model = new retCode(); string sqlid = @"exec ZZp_sp_GetID_VS '" + cVouchType + "','" + sl + "','" + CardNumber + "'"; DataTable dtid = U8DataHelper.GetDataTable(sqlid, tran); if (dtid.Rows.Count > 0) { model.ID = int.Parse(dtid.Rows[0]["id"].ToString()); model.AUTOID = int.Parse(dtid.Rows[0]["autoid"].ToString()); model.CCODE = dtid.Rows[0]["ccode"].ToString(); } else { throw new Exception("获取U8 id 错误"); } return(model); }
//生成主表model,添加默认值 public RdRecord01 ZbModelMaker(RdRecord01 m, retCode retCode) { m.ID = retCode.ID; m.cCode = retCode.CCODE; m.bRdFlag = 1; //m.cOrderCode = ""; //m.cARVCode = ""; //m.cHandler = m.cMaker; m.bTransFlag = false; //m.dVeriDate = m.dDate; //m.dnverifytime = m.dnmaketime; m.cModifyPerson = ""; // m.dModifyDate = DateTime.Parse(m.dnmaketime.ToString().Substring(0, 10)); //m.dnmodifytime = m.dnmaketime; m.bpufirst = false; m.biafirst = false; m.VT_ID = 27; m.bIsSTQc = false; m.iExchRate = 1; m.cExch_Name = "人民币"; m.bFromPreYear = false; m.bIsComplement = 0; m.iDiscountTaxType = 0; m.ireturncount = 0; m.iverifystate = 0; m.iswfcontrolled = 0; m.iPrintCount = 0; m.csysbarcode = "||st01|" + m.cCode; return(m); }
private bool FindAndConnectScale(string serialRFID, string comPortRFID) { isScaleConnected = false; bool ret = false; string comScale = null; if (GetComScale(serialRFID, comPortRFID, out comScale)) { if (scale != null) { scale.closePort(); } scale = new Sartorius_Scale(comScale); scale.NotifyWeightEvent += new NotifyHandlerWeightScaleDelegate(scale_NotifyWeightEvent); if (scale.IsConnected) { scale.getWeight(); System.Threading.Thread.Sleep(3000); if (scale.LastScaledWeight != null) { isScaleConnected = true; ret = true; } } } if (eventEndConnection != null) { eventEndConnection.Set(); } return(ret); }
public retCode getTagAndWeight(int timeoutScale, out string tagUID, out double scaleWeight) { tagUID = null; scaleWeight = 0.0; ret = retCode.RC_Unknown; if (device == null) { ret = retCode.RC_RFID_Not_Connected; } else if (scale == null) { ret = retCode.RC_Scale_Not_Connected; } else if (!isRfidConnected) { ret = retCode.RC_RFID_Not_Connected; } else if (!isScaleConnected) { ret = retCode.RC_Scale_Not_Connected; } else { device.ScanDevice(); eventEndRFID.WaitOne(); if (device.currentInventory.nbTagAll == 0) { ret = retCode.RC_No_Tag_Detected; } else if (device.currentInventory.nbTagAll > 1) { ret = retCode.RC_Too_Many_Tags_Detected; } else if (device.currentInventory.nbTagAll == 1) { tagUID = device.currentInventory.listTagAll[0].ToString(); eventEndScale.Reset(); scale.getWeight(); if (eventEndScale.WaitOne(timeoutScale)) { if (scale.LastScaledWeight != null) { scaleWeight = scale.LastScaledWeight.WeightValue; ret = retCode.RC_succeed; } else { ret = retCode.RC_Unknown; } } else { ret = retCode.RC_Scale_Not_Stabilized; } } } return(ret); }
private void rfidDev_NotifyRFIDEvent(object sender, SDK_SC_RfidReader.rfidReaderArgs args) { switch (args.RN_Value) { case SDK_SC_RfidReader.rfidReaderArgs.ReaderNotify.RN_FailedToConnect: { isRfidConnected = false; if (eventEndConnection != null) { eventEndConnection.Set(); } break; } case SDK_SC_RfidReader.rfidReaderArgs.ReaderNotify.RN_Disconnected: { isRfidConnected = false; } break; case SDK_SC_RfidReader.rfidReaderArgs.ReaderNotify.RN_Connected: { isRfidConnected = true; FindAndConnectScale(args.SerialNumber, device.get_RFID_Device.StrCom); break; } case rfidReaderArgs.ReaderNotify.RN_ErrorDuringScan: case rfidReaderArgs.ReaderNotify.RN_ReaderFailToStartScan: { ret = retCode.RC_Error_RFID; if (eventEndRFID != null) { eventEndRFID.Set(); } break; } case rfidReaderArgs.ReaderNotify.RN_ScanStarted: { break; } case rfidReaderArgs.ReaderNotify.RN_ScanCompleted: { if (eventEndRFID != null) { eventEndRFID.Set(); } break; } } }
//生成子表list,添加默认值 public List <RdRecords01> ZbsListMaker(string cCode, List <RdRecords01> list, retCode retCode) { int t = 0; foreach (var i in list) { i.AutoID = retCode.AUTOID - t; i.ID = retCode.ID; i.iFlag = 0; i.bTaxCost = false; i.iMatSettleState = 0; i.iBillSettleCount = 0; i.bLPUseFree = false; i.iOriTrackID = 0; i.bCosting = true; //i.bVMIUsed = false; i.iordertype = 0; i.isotype = 0; i.irowno = t + 1; //i.cbsysbarcode = ""; //i.iProductType = 0; //i.bgift = 0; i.iExpiratDateCalcu = 0; i.cbsysbarcode = "||st01|" + cCode + "|" + (t + 1).ToString(); t++; } return(list); }