/// <summary> /// 接收装配信息到临时表事件 /// </summary> /// <param name="sender"></param> /// <param name="re">事件参数</param> public Socket_StateInfo ReceiveSaveTempFittingInfo(Socket_FittingAccessoryInfoSum fittingAccessoryInfoSum) { DateTime serverTime = ServerTime.Time; if (fittingAccessoryInfoSum.FittingTime != "") { fittingAccessoryInfoSum.FittingTime = serverTime.ToLongDateString() + " " + serverTime.ToLongTimeString(); } Socket_StateInfo stateInfo = new Socket_StateInfo(); //string error; List <Socket_FittingAccessoryInfo> fittingAccessoryInfoList = fittingAccessoryInfoSum.FittingAccessoryInfoList; for (int i = 0; i < fittingAccessoryInfoList.Count; i++) { string oldParentCode = ""; if (fittingAccessoryInfoList[i].ParentCode != null && fittingAccessoryInfoList[i].ParentCode != "") { if (fittingAccessoryInfoList[i].ParentCode.Length < 10) { oldParentCode = fittingAccessoryInfoList[i].ParentCode; } else { oldParentCode = fittingAccessoryInfoList[i].ParentCode.Substring( 0, fittingAccessoryInfoList[i].ParentCode.Length - 10); } } if (!GlobalObject.GeneralFunction.IsNullOrEmpty(fittingAccessoryInfoList[i].FinishTime)) { fittingAccessoryInfoList[i].FinishTime = serverTime.ToLongDateString() + " " + serverTime.ToLongTimeString(); } // 2014-02-21 删除m_electronFileServer中的方法SaveTempElectronFile //if (!m_electronFileServer.SaveTempElectronFile( // fittingAccessoryInfoList[i].OverlayFlag.ToString(), fittingAccessoryInfoSum.ProductCode, // fittingAccessoryInfoList[i].ParentCode, fittingAccessoryInfoList[i].GoodsCode, fittingAccessoryInfoList[i].Spec, // fittingAccessoryInfoList[i].GoodsName, fittingAccessoryInfoList[i].GoodsOnlyCode, fittingAccessoryInfoList[i].Provider, // fittingAccessoryInfoList[i].BatchNo, fittingAccessoryInfoSum.WorkBench, fittingAccessoryInfoList[i].CheckData, // fittingAccessoryInfoList[i].FactData, fittingAccessoryInfoSum.FittingPersonnel,fittingAccessoryInfoSum.FittingTime, // fittingAccessoryInfoSum.AmendPersonnel, fittingAccessoryInfoSum.AmendTime, fittingAccessoryInfoList[i].Remark, // fittingAccessoryInfoSum.Edition, fittingAccessoryInfoList[i].AssemblyFlag, fittingAccessoryInfoList[i].FinishTime, // oldParentCode, fittingAccessoryInfoList[i].Counts, out error)) //{ // if (error.Contains(Socket_FittingAccessoryInfo.OperateStateEnum.无法获取Bom基数.ToString())) // { // stateInfo.StateInfo = Socket_FittingAccessoryInfo.OperateStateEnum.无法获取Bom基数; // return stateInfo; // } // else if (error.Contains(Socket_FittingAccessoryInfo.OperateStateEnum.电子档案临时表中无此信息无法覆盖.ToString())) // { // stateInfo.StateInfo = Socket_FittingAccessoryInfo.OperateStateEnum.电子档案临时表中无此信息无法覆盖; // return stateInfo; // } // else // { // stateInfo.StateInfo = Socket_FittingAccessoryInfo.OperateStateEnum.存储装配信息失败; // stateInfo.Error = error; // return stateInfo; // } //} } stateInfo.StateInfo = Socket_FittingAccessoryInfo.OperateStateEnum.操作成功; stateInfo.WorkBench = fittingAccessoryInfoSum.WorkBench; return(stateInfo); }
void asynServer_OnReceive(object sender, CommEventArgs args) { CommEventArgs commArgs = args; string address = commArgs.SourceAddress; commArgs.SourceAddress = args.TargetAddress; commArgs.TargetAddress = address; if (args.Params != null) { for (int i = 0; i < args.Params.Count; i++) { if (commArgs.Params[i].CMD == CommCMD.用户登陆) { Socket_UserInfo userInfo = commArgs.Params[i].DataValue as Socket_UserInfo; RequestUserProcessor userProcessor = new RequestUserProcessor(); commArgs.Params[i].DataValue = userProcessor.ReceiveUserInfo(userInfo); } else if (commArgs.Params[i].CMD == CommCMD.初始化) { string workbench = commArgs.Params[i].DataValue as string; RequestWorkBenchInfo wbProcessor = new RequestWorkBenchInfo(); if (commArgs.Params[i].Code == TagCode.工位产品列表) { commArgs.Params[i].DataValue = wbProcessor.GetProductInfo(workbench); } else if (commArgs.Params[i].Code == TagCode.工位指定产品零件信息) { commArgs.Params[i].DataValue = wbProcessor.GetWorkBenchInfo(workbench); } } else if (commArgs.Params[i].CMD == CommCMD.请求) { if (commArgs.Params[i].Code == TagCode.获取装配条形码对应零件信息) { Socket_FittingAccessoryInfo fittingAccessoryInfo = commArgs.Params[i].DataValue as Socket_FittingAccessoryInfo; RequestFittingInfo fittingProcessor = new RequestFittingInfo(); commArgs.Params[i].DataValue = fittingProcessor.ReceiveReadBarCodeInfo(fittingAccessoryInfo); } else if (commArgs.Params[i].Code == TagCode.获取选配值) { string info = (string)commArgs.Params[i].DataValue; RequestFittingInfo fittingProcessor = new RequestFittingInfo(); commArgs.Params[i].DataValue = fittingProcessor.ReceiveReadChoseMatchInfo(info); //Socket_FittingAccessoryInfo fittingAccessoryInfo = commArgs.Params[i].DataValue as Socket_FittingAccessoryInfo; //RequestFittingInfo fittingProcessor = new RequestFittingInfo(); //fittingAccessoryInfo = fittingProcessor.ReceiveReadBarCodeInfo(fittingAccessoryInfo); //commArgs.Params[i].DataValue = fittingProcessor.ReceiveReadChoseMatchInfo(fittingAccessoryInfo); } } else if (commArgs.Params[i].CMD == CommCMD.存储工位信息) { if (commArgs.Params[i].Code == TagCode.装配信息) { Socket_FittingAccessoryInfoSum fittingAccessoryInfoSum = commArgs.Params[i].DataValue as Socket_FittingAccessoryInfoSum; fittingAccessoryInfoSum.Edition = GetProductType(fittingAccessoryInfoSum.ProductTypeName); RequestFittingInfo fittingProcessor = new RequestFittingInfo(); commArgs.Params[i].DataValue = fittingProcessor.ReceiveSaveTempFittingInfo(fittingAccessoryInfoSum); if (fittingAccessoryInfoSum.ProductTypeName.Contains("力帆") && fittingAccessoryInfoSum.WorkBench == "DB") { commArgs.Params[i].DataValue = fittingProcessor.ReceiveSaveFittingInfo(fittingAccessoryInfoSum.ProductCode); } else if (fittingAccessoryInfoSum.ProductTypeName.Contains("众泰") && fittingAccessoryInfoSum.WorkBench == "DB") { commArgs.Params[i].DataValue = fittingProcessor.ReceiveSaveFittingInfo(fittingAccessoryInfoSum.ProductCode); } } } } } for (int i = 0; i < commArgs.Params.Count; i++) { commArgs.Params[i].CMD = CommCMD.应答; } string error; m_server.Send(commArgs, out error); }