//CommData. CPP: defines the DLL export function of the application,
//
# include "stdafx. H"
# pragma once
# ifdef Data_API
# the else
# define Data_API extern "C" _declspec (dllimport)
# endif
#include
#include
#include
#include
using namespace std;
//send the product scan to data,
//parameter Mo work order number (note: if the user does not change the work order number within the production file, the default for the machine number)
//Sn scan parameters to an array of data
//parameter snNum scanning to the number of data format for: SN1, SN2, SN3==3
//the return value//return TRUE success/failure returns FALSE
Data_API bool SenScanData (string Mo, a string of Sn [], int snNum);
Bool SenScanData (string Mo, a string of Sn [], int snNum)
{
return TRUE;
}
//parameter 1 dlgData extra interface data
//parameter 3 machineData machine data
//PrName system program
//StarTime start homework time 2017/9/5 13:30
//StopTime 2017/9/5 end homework time comes to
//MNum number
//CodeType
//parameter 2 addDataNum additional data quantity
Data_API bool SenData (string dlgData [], string machineData [], string Sn [], int snNum, string FilePath);
Bool SenData (string dlgData [], string machineData [], string Sn [], int snNum, string FilePath)
{
//General1=
string str;
Ofstream ofst;
Ofst. Open (FilePath, the ios: : app);
STR="General1=" + dlgData [1]. No.//work order
Ofst & lt;STR="\ nGeneral2=" + dlgData [2].//process
Ofst & lt;STR="\ nGeneral3=" + machineData [2].//start time
Ofst & lt;STR="\ nGeneral4=" + machineData [3].//end time
Ofst & lt;STR="\ nGeneral5=" + dlgData [0].//the machine number
Ofst & lt;STR="\ nGeneral6=" + dlgData [3].//CODE type
Ofst & lt;STR="\ nGeneral7=" + Sn [0].//barcode
for(int i=1; I<(snNum - 1); I++)
{
STR=STR + ", "+ Sn [I + 1);
}
Ofst & lt;
STR="\ nGeneral8=" + machineData [0].//the program name
Ofst & lt;STR="\ nGeneral9=" + dlgData [4].//homework quantity (the amount of total production)
Ofst & lt;
STR="\ nGeneral10=" + machineData [4].//which one products
Ofst & lt;
STR="\ nGeneral11=" + machineData [1]. No.//operators
Ofst & lt;
STR="\ nGeneral12=" + dlgData [5].//smelting equipment number
Ofst & lt;
STR="\ nGeneral13=" + machineData [5]. Positive and negative//
Ofst & lt;STR="\ nGeneral14=" + machineData [6].//PCS serial number
Ofst & lt;
STR="\ nMachine1=" + machineData [7].//this board posted several points in total,
Ofst & lt;STR="\ nMachine2=" + dlgData [6].//number of auxiliary number 1
Ofst & lt;STR="\ nMachine3=" + dlgData [7].//number of auxiliary number 2
Ofst & lt;STR="\ nMachine4=" + dlgData [8].//suction nozzle number 1
Ofst & lt;STR="\ nMachine5=" + dlgData [9].//suction nozzle number 2
Ofst & lt;STR="\ nMachine6=" + machineData [8].//extractor number
Ofst & lt;STR="\ nMachine7=" + machineData [9].//extractor rate
Ofst & lt;
Ofst. Close ();
OutputDebugString (" Dll output complete ");
return true;
}
CodePudding user response:
Serial Communications in Win32Serial Communications,
CodePudding user response:
Using SenData function can ahCodePudding user response: