cardusestoprealse

Run Settings
LanguageAssembly
Language Version
Run Command
import 'dart:developer'; import 'package:flutter/services.dart'; import 'package:m80app/components/app_dialog.dart'; import 'package:m80app/components/app_info.dart'; import 'package:m80app/services/api_status.dart'; import 'package:m80app/services/grpc/hcservice/hcservice.pbgrpc.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:m80app/services/grpc/hcservice/hcservice.pb.dart'; import 'package:m80app/services/grpc_apis.dart'; import 'package:m80app/utils/log_utils.dart'; import 'package:m80app/utils/parsers.dart'; import 'package:m80app/utils/sqlite_utils.dart'; import 'package:m80app/viewmodels/mainpage_viewmodel.dart'; import 'package:m80app/viewmodels/startup_viewmodel.dart'; import 'package:m80app/views/checkmenupage/settingpage/setting_page.dart'; import 'package:m80app/views/maintenancemenupage/net_map_page.dart'; import 'package:path/path.dart'; import 'package:provider/provider.dart'; import '../../components/app_button.dart'; import '../../components/app_dropdownbutton.dart'; import 'package:m80app/constants/constants.dart' as constants; import 'package:m80app/constants/route_paths_constants.dart' as routes; import 'package:m80app/setting/setting.dart'; // For call Ce request command const CeDemandData = 16385; // On Bit0 and Bit14 const CeState = 1; //for call BA request command const cardtype = 0; const informationrequest = 1; const controlnumber = 0; int numberfuntion = 0; // const List<String> operation = ['停止', '解除', '強制停止']; const rowDivider0 = SizedBox(height: 2); const labelWidth = 130.0; const valueWidth = 400.0; const selectedheight = 70.0; List<String> selectedList = [ '日付', 'カード番号', '場所', '状態', ]; const initialData = { '日付': '', 'カード番号': '', '場所': '', '状態': '', }; class CardUeStopReleasePage extends StatefulWidget { const CardUeStopReleasePage({super.key}); @override State<CardUeStopReleasePage> createState() => _CardUeStopReleasePageState(); } class _CardUeStopReleasePageState extends State<CardUeStopReleasePage> { String operationValue = operation.first; final TextEditingController timeController = TextEditingController(); final cardNumber = TextEditingController(); String StateOfCard = ''; Map<String, String>? dataFilter; // SQLiteProvider provider = SQLiteProvider(); List<HCMap>? hcmaps; bool isInitedHcmaps = false; bool isSendCeOk = false; @override void dispose() { // Clean up the controller when the widget is disposed. cardNumber.dispose(); timeController.dispose(); super.dispose(); } Future<void> initHcmaps() async { hcmaps = await provider.getHCMap(); isInitedHcmaps = true; } @override void initState() { super.initState(); dataFilter = initialData; timeController.text = constants.DATE_INPUT_FORMATTER.format(DateTime.now()); } void onChangeTimeInput(BuildContext context) async { var date = await showDatePicker( context: context, initialDate: DateTime.now(), firstDate: DateTime(2000), lastDate: DateTime(2025), ); if (date != null) { setState(() { timeController.text = constants.DATE_INPUT_FORMATTER.format(date); }); } } Row selectedRow(String label, String? value) { return Row(children: [ SizedBox( width: labelWidth, height: selectedheight, child: Text(style: constants.TEXT_STYLE, label)), SizedBox( width: valueWidth, height: selectedheight, child: Text(style: constants.TEXT_STYLE, ': ${value ?? ""}')), ]); } void showSendBaError(BuildContext context, String errorMess) async { await showDialog( context: context, builder: (BuildContext context) { return M80Info( title: '本電', content: "Error!!!\nDetail: $errorMess", ); }); } void sendBA(BuildContext context) async { if (operationValue == '停止') { numberfuntion = 0; } else if (operationValue == '解除') { numberfuntion = 1; } else if (operationValue == 'ALL印字') { numberfuntion = 2; } else if (operationValue == '強制停止') { numberfuntion = 3; } else if (operationValue == '強制解除') { numberfuntion = 4; } Logger.info('Send BA command via GRPC'); var req = BARequestMessage( commandId: constants.BA_REQUEST, protocol: Setting.m80serviceConfig.hcserviceProtocol, headerDestinationIpAddr: Setting.m80serviceConfig.hcserviceDestIpAddress, headerModelType: Setting.m80serviceConfig.hcserviceDestModeltype, headerEquipmentNumber: Setting.m80serviceConfig.hcserviceDestEquipnum, date: timeController.text, function: numberfuntion, cardType: cardtype, storeNumber: Setting.m80dynamicConfig.miseNo, cardNumber: int.parse(dataFilter!['カード番号']!), controlNumber: controlnumber, useTerminalInformationRequest: informationrequest, ); var bARes = await GrpcApis.sendBA(req); var processingresult = ''; var responsetype = ''; var responsecardtype = ''; var terminalinformationrequest = ''; if (bARes is BAResponseMessage) { if (bARes.err == false) { var dataBA = bARes.dataresponse; if (dataBA[44] == 0) { processingresult = '正常'; } else if (dataBA[44] == 1) { processingresult = '異常'; } if (dataBA[45] == 0) { responsetype = '停止'; } else if (dataBA[45] == 1) { responsetype = '解除'; } else if (dataBA[45] == 2) { responsetype = '印字'; } else if (dataBA[45] == 3) { responsetype = '強制停止'; } else if (dataBA[45] == 4) { responsetype = '強制解除'; } if (dataBA[46] == 0) { responsecardtype = 'Cカード'; } else if (dataBA[46] == 1) { responsecardtype = 'Mカード'; } if (dataBA[47] == 0) { terminalinformationrequest = '無し'; } else if (dataBA[47] == 1) { terminalinformationrequest = '有り'; } // ignore: use_build_context_synchronously await showDialog( context: context, builder: (BuildContext context) { return M80Info( title: '本電', content: "処理結果: $processingresult\n" + "応答種別: $responsetype\n" + "応答カード種別: $responsecardtype\n" + "使用中端末情報要求: $terminalinformationrequest", ); }); log(bARes.dataresponse.toString()); Logger.info("Received Ba Response: ${bARes.dataresponse.toString()}"); } else { log("Request Ba via GRPC error: ${bARes.errMsg}"); Logger.error("Request Ba via GRPC error : ${bARes.errMsg}"); showSendBaError(context, bARes.errMsg); } } if (bARes is Failure) { log("Request Ba via GRPC error : ${bARes.errorResponse.toString()}"); Logger.error( "Request Ba via GRPC error : ${bARes.errorResponse.toString()}"); showSendBaError(context, bARes.errorResponse.toString()); } } Container allSelectedRow(Map<String, String> dataMap) { return Container( padding: const EdgeInsets.fromLTRB(10, 15, 10, 0), decoration: const BoxDecoration(color: constants.COLOR_GREY), child: Column(children: [ Row( children: [ selectedRow(selectedList[0], dataMap[selectedList[0]]), selectedRow(selectedList[1], dataMap[selectedList[1]]), ], ), Row( children: [ selectedRow(selectedList[2], dataMap[selectedList[2]]), selectedRow(selectedList[3], dataMap[selectedList[3]]), ], ), ])); } @override Widget build(BuildContext context) { MainPageViewModel mainpageViewModel = context.watch<MainPageViewModel>(); return Column(children: [ const SizedBox( height: 30, ), SizedBox( width: constants.CONTENT_WIDTH, child: Row( children: [ const SizedBox( width: 150, child: Text('日付', style: TextStyle( fontSize: constants.NORMAL_FONT_SIZE, fontWeight: FontWeight.bold))), const SizedBox( width: 30, ), SizedBox( width: 400, child: TextField( style: const TextStyle( fontSize: constants.NORMAL_FONT_SIZE, height: 2.0, color: Colors.black), controller: timeController, decoration: const InputDecoration( border: InputBorder.none, filled: true, fillColor: constants.COLOR_GREY, ), onChanged: (val) async { setState(() { timeController.text = constants.DATE_INPUT_FORMATTER.format(DateTime.now()); }); onChangeTimeInput(context); }, onTap: () async { onChangeTimeInput(context); }, ), ), ], ), ), const SizedBox( height: 20, ), SizedBox( width: constants.CONTENT_WIDTH, child: Row( children: [ // input2 card number const SizedBox( width: 150, child: Text('カード番号', style: TextStyle( fontSize: constants.NORMAL_FONT_SIZE, fontWeight: FontWeight.bold))), const SizedBox( width: 30, ), SizedBox( width: 400, child: TextField( controller: cardNumber, inputFormatters: <TextInputFormatter>[ LengthLimitingTextInputFormatter(4), FilteringTextInputFormatter.allow(RegExp(r'[0-9]')) ], style: TextStyle( fontSize: constants.NORMAL_FONT_SIZE, height: 2.0, color: Colors.black), decoration: InputDecoration( border: InputBorder.none, filled: true, fillColor: constants.COLOR_GREY, ), ), ), const SizedBox( width: 30, ), // Update dataFilter CustomButton( text: '照会', width: 120, onPressed: () async { Logger.info('Send Ce command via GRPC'); // log('card: ${cardNumber.text}'); var req = CeRequestMessage( commandId: constants.CE_REQUEST, protocol: Setting.m80serviceConfig.hcserviceProtocol, headerDestinationIpAddr: Setting.m80serviceConfig.hcserviceDestIpAddress, headerModelType: Setting.m80serviceConfig.hcserviceDestModeltype, headerEquipmentNumber: Setting.m80serviceConfig.hcserviceDestEquipnum, demandData: CeDemandData, logicalNo: int.parse(cardNumber.text), // OK shopNo: Setting.m80dynamicConfig.miseNo, state: CeState, ); List ListResBCD = []; int attribute = 0; var unitnumber = 0; var modelcode = 0; var samemodelserialnumber = 0; String location = ''; List IPAddress = []; var ceRes = await GrpcApis.sendCe(req); if (ceRes is CeResponseMessage) { if (ceRes.err == false) { isSendCeOk = true; var dataCE = ceRes.dataresponse; unitnumber = getByteDataOf(dataCE.sublist(126, 128)) .getUint16(0, ENDIAN_TYPE); modelcode = getByteDataOf(dataCE.sublist(122, 124)) .getUint16(0, ENDIAN_TYPE); samemodelserialnumber = getByteDataOf(dataCE.sublist(124, 126)) .getUint16(0, ENDIAN_TYPE); for (var x = 118; x < 122; x++) { IPAddress.add(getByteDataOf(dataCE.sublist(x, x + 1)) .getUint8(0)); } ListResBCD = dataCE.sublist(87, 94); attribute = getByteDataOf(dataCE.sublist(103, 104)).getUint8(0); log('${attribute}'); Logger.info( "Received Ce Response: ${ceRes.dataresponse.toString()}"); } else { log("Request Ce via GRPC error: ${ceRes.errMsg}"); Logger.error( "Request Ce via GRPC error : ${ceRes.errMsg}"); } } if (ceRes is Failure) { log("Request Ce via GRPC error : ${ceRes.errorResponse.toString()}"); Logger.error( "Request Ce via GRPC error : ${ceRes.errorResponse.toString()}"); } // show 日時 最新取引 String datedata = ''; for (var number in ListResBCD) { int number_div = (number ~/ 16); datedata += number_div.toString(); int number_mod = (number % 16); datedata += number_mod.toString(); } var LastestDate = '${datedata.substring(0, 4)}/${datedata.substring(4, 6)}/${datedata.substring(6, 8)} ${datedata.substring(8, 10)}:${datedata.substring(10, 12)}:${datedata.substring(12, 14)}'; var dataIP = ''; // show 場所 if (unitnumber != 0) { location = '$unitnumber'; } else if (unitnumber == 0) { // Get IP dataIP = IPAddress.join('.'); if (!isInitedHcmaps) { await initHcmaps(); } // Get kishu name from hcmaps if (modelcode == 0) { for (var hcmap in hcmaps!) { if (hcmap.ipAdder == dataIP) { // dataIP location = hcmap.deviceName; } } } else if (modelcode != 0) { //get kishu name from m80kishu.conf Setting.m80kishuConfig.forEach((key, value) { try { var ranges = key.split('0x'); var keykishu = int.parse(ranges[1], radix: 16); if (keykishu == modelcode) { location = '$value-$samemodelserialnumber'; } } catch (e) {} }); } } //show 状態 if (attribute == 0) { StateOfCard = '未挿入'; } else if (attribute == 1) { StateOfCard = '挿入中 (使用中)'; } else if (attribute == 3) { StateOfCard = '携帯未挿入'; } else if (attribute == 4) { StateOfCard = '携帯挿入中 (使用中)'; } else if (attribute == 5) { StateOfCard = 'ストラップ未挿入'; } else if (attribute == 6) { StateOfCard = 'ストラップ挿入中 (使用中)'; } // Map<String, String> data = { '日付': LastestDate, 'カード番号': '${int.parse(cardNumber.text)}', '場所': location, '状態': StateOfCard, }; setState(() { dataFilter = data; }); }), ], ), ), const SizedBox( height: 20, ), // allSelectedRow(dataFilter!), // rowDivider0, SizedBox( width: constants.CONTENT_WIDTH, height: 160, child: allSelectedRow(dataFilter!), ), const SizedBox( height: 20, ), SizedBox( width: constants.CONTENT_WIDTH, child: Row( children: [ const SizedBox( width: 150, child: Text('操作', style: TextStyle( fontSize: constants.NORMAL_FONT_SIZE, fontWeight: FontWeight.bold))), const SizedBox( width: 30, ), CustomDropdownButton( width: 250, items: operation, onChanged: (value) { setState(() { operationValue = value; }); }, ), ], ), ), const SizedBox( height: 20, ), SizedBox( width: constants.CONTENT_WIDTH, child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ CustomButton( text: '操作実行', onPressed: isSendCeOk ? () => sendBA(context) : null), const SizedBox( width: 285, ), CustomButton( text: '戻る', width: 120, onPressed: () { mainpageViewModel.setcurrentRoute(routes.BusinessMenuRoute); mainpageViewModel.settitleList(['営業モード']); }), ], ), ), ]); } }
package ce import ( "bytes" "encoding/binary" "encoding/hex" "fmt" "hcservice/commands" "hcservice/commands/common" "hcservice/commands/setting" "hcservice/internal/logger" "strconv" ) type RequestMessage struct { Header common.EMessageHeader MembershipNumber MembershipNumberStruct DemandData uint16 // 要求データ State uint8 // 状態 PhoneNumber uint64 // 携帯電話のIDmをセットする SettingExchangeRateNumber uint8 // 端末に設定されている交換率番号(1~5)(1~15) DemandData2 uint16 // 要求データ2 TerminalProperty uint8 // 端末属性 DemandData15Acc uint16 // 要求データ【15口座用】 Reserve uint16 // 予備 BlockSendingSequentialNumber uint16 // 0:単一の電文、1~32767:送信途中、65535:最終の電文 NumberOfSubrecords uint16 // 0~65535 SubRecords []byte } type ResponseMessage struct { Header common.EMessageHeader MembershipNumber MembershipNumberStruct MemberExitInformationSequentialNumber uint8 // 出玉情報に付加する番号(非会員の場合はゼロ) Reserve uint16 // 予備 BlockSendingSequentialNumber uint16 // 0:単一の電文、1~32767:送信途中、65535:最終の電文 NumberOfSubrecords uint16 // 0~65535 } type MembershipNumberStruct struct { BranchNumber uint16 // 店番号 (非会員の場合はゼロ) LogicalNumber uint32 // 会員番号 } type MessageHeader struct { RecordType string // 'C' or 'c' SupplementaryType string // 'e' ResponseRequest string // '@': do not request response 'A': request Reserve uint8 // 予備 DealingsNumber uint16 // 取引番号 AddressLogicalTerminalNumber uint32 // 宛先論理端末番号 DemandFormerLogicalTerminalNumber uint32 // 要求元論理端末番号 ResponseDataSize uint16 // 応答データの最大バイト数 } func ParseCe(message []byte, bigEndian bool) (*ResponseMessage, error) { var Cepackage ResponseMessage var byteOrder binary.ByteOrder if bigEndian { byteOrder = binary.BigEndian } else { byteOrder = binary.LittleEndian } err := binary.Read(bytes.NewReader(message), byteOrder, &Cepackage) if err != nil { return nil, err } return &Cepackage, nil } func GenerateCePackgage(ceConfig setting.CeConfig, datasendTime [8]byte, sourceIPinfo common.SourceIPInfo, destIPInfo common.DestIPInfo, echoback uint32, shopNo uint16, logicalNo uint32, demandData uint16, state uint8) []byte { var buf []byte header := common.GenerateEHeader( commands.REQUEST_Ce_ID, ceConfig.ResponseDemand, commands.HeaderVersion, 48, 0x0000, datasendTime, sourceIPinfo, destIPInfo, echoback, ceConfig.DealingsNumber, ceConfig.IslandNo, ceConfig.CommandExtension) buf = append(buf, header...) branch_number := make([]byte, 2) binary.BigEndian.PutUint16(branch_number, shopNo) buf = append(buf, branch_number...) logical_number := make([]byte, 4) binary.BigEndian.PutUint32(logical_number, logicalNo) buf = append(buf, logical_number...) demand_data := make([]byte, 2) binary.BigEndian.PutUint16(demand_data, demandData) buf = append(buf, demand_data...) buf = append(buf, state) phone_number := make([]byte, 8) binary.BigEndian.PutUint64(phone_number, ceConfig.PhoneNumber) buf = append(buf, phone_number...) buf = append(buf, byte(ceConfig.SettingExchangeRateNumber)) demand_data2 := make([]byte, 2) binary.BigEndian.PutUint16(demand_data2, ceConfig.DemandData2) buf = append(buf, demand_data2...) buf = append(buf, byte(ceConfig.TerminalProperty)) demand_data15Acc := make([]byte, 2) binary.BigEndian.PutUint16(demand_data15Acc, ceConfig.DemandData15Acc) buf = append(buf, demand_data15Acc...) buf = append(buf, 0x00, 0x00, 0x00, 0x00, 0x00) block_sending_sequential_number := make([]byte, 2) binary.BigEndian.PutUint16(block_sending_sequential_number, ceConfig.BlockSendingSequentialNumber) buf = append(buf, block_sending_sequential_number...) n := strconv.FormatInt(int64(demandData), 2) count := uint16(0) var subRecord []byte for i := 0; i < len(n); i++ { if string(n[i]) == "1" { count++ x := len(n) - i - 1 switch x { case 0: subRecord = append(subRecord, []byte(ceConfig.IndividualSubrecord.Type)...) subRecord = append(subRecord, []byte(ceConfig.IndividualSubrecord.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.IndividualSubrecord.Size) subRecord = append(subRecord, size...) if ceConfig.IndividualSubrecord.RegistrationDate != "" { registration_date, _ := hex.DecodeString(ceConfig.IndividualSubrecord.RegistrationDate) subRecord = append(subRecord, registration_date...) } else { subRecord = append(subRecord, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) } if ceConfig.IndividualSubrecord.LatestDealingsDate != "" { latest_dealing_date, _ := hex.DecodeString(ceConfig.IndividualSubrecord.LatestDealingsDate) subRecord = append(subRecord, latest_dealing_date...) } else { subRecord = append(subRecord, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) } physical_number := make([]byte, 4) binary.BigEndian.PutUint32(physical_number, ceConfig.IndividualSubrecord.PhysicalNumber) subRecord = append(subRecord, physical_number...) password := make([]byte, 2) binary.BigEndian.PutUint16(password, ceConfig.IndividualSubrecord.Password) subRecord = append(subRecord, password...) subRecord = append(subRecord, byte(ceConfig.IndividualSubrecord.Sex)) subRecord = append(subRecord, byte(ceConfig.IndividualSubrecord.ReissueFrequency)) if ceConfig.IndividualSubrecord.LatestDealingsDate != "" { subRecord = append(subRecord, []byte(ceConfig.IndividualSubrecord.MediumAttribute)...) } else { subRecord = append(subRecord, 0x00) } subRecord = append(subRecord, byte(ceConfig.IndividualSubrecord.Attribute)) subRecord = append(subRecord, byte(ceConfig.IndividualSubrecord.AttributeOnThatDay)) subRecord = append(subRecord, byte(ceConfig.IndividualSubrecord.PointAdditionFrequency)) subRecord = append(subRecord, byte(ceConfig.IndividualSubrecord.Rank)) subRecord = append(subRecord, byte(ceConfig.IndividualSubrecord.RoikoPrintInformation)) order_coming_store := make([]byte, 2) binary.BigEndian.PutUint16(order_coming_store, ceConfig.IndividualSubrecord.OrderComingStore) subRecord = append(subRecord, order_coming_store...) publisher_machine_number := make([]byte, 2) binary.BigEndian.PutUint16(publisher_machine_number, ceConfig.IndividualSubrecord.PublisherMachineNumber) subRecord = append(subRecord, publisher_machine_number...) replay_receipt := make([]byte, 2) binary.BigEndian.PutUint16(replay_receipt, ceConfig.IndividualSubrecord.ReplayReceipt) subRecord = append(subRecord, replay_receipt...) case 1: subRecord = append(subRecord, []byte(ceConfig.GemMST.Type)...) subRecord = append(subRecord, []byte(ceConfig.GemMST.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.GemMST.Size) subRecord = append(subRecord, size...) subRecord = append(subRecord, byte(ceConfig.GemMST.MST.NodeID)) subRecord = append(subRecord, byte(ceConfig.GemMST.MST.Identifier)) number_of_gems := make([]byte, 4) binary.BigEndian.PutUint32(number_of_gems, ceConfig.GemMST.MST.NumberOfGems) subRecord = append(subRecord, number_of_gems...) box1_total := make([]byte, 4) binary.BigEndian.PutUint32(box1_total, ceConfig.GemMST.MST.Box1Total) subRecord = append(subRecord, box1_total...) box2_total := make([]byte, 4) binary.BigEndian.PutUint32(box2_total, ceConfig.GemMST.MST.Box2Total) subRecord = append(subRecord, box2_total...) box3_total := make([]byte, 4) binary.BigEndian.PutUint32(box3_total, ceConfig.GemMST.MST.Box3Total) subRecord = append(subRecord, box3_total...) box4_total := make([]byte, 4) binary.BigEndian.PutUint32(box4_total, ceConfig.GemMST.MST.Box4Total) subRecord = append(subRecord, box4_total...) box5_total := make([]byte, 4) binary.BigEndian.PutUint32(box5_total, ceConfig.GemMST.MST.Box5Total) subRecord = append(subRecord, box5_total...) box1 := make([]byte, 4) binary.BigEndian.PutUint32(box1, ceConfig.GemMST.MST.Box1) subRecord = append(subRecord, box1...) box2 := make([]byte, 4) binary.BigEndian.PutUint32(box2, ceConfig.GemMST.MST.Box2) subRecord = append(subRecord, box2...) box3 := make([]byte, 4) binary.BigEndian.PutUint32(box3, ceConfig.GemMST.MST.Box3) subRecord = append(subRecord, box3...) box4 := make([]byte, 4) binary.BigEndian.PutUint32(box4, ceConfig.GemMST.MST.Box4) subRecord = append(subRecord, box4...) box5 := make([]byte, 4) binary.BigEndian.PutUint32(box5, ceConfig.GemMST.MST.Box5) subRecord = append(subRecord, box5...) case 2: subRecord = append(subRecord, []byte(ceConfig.GemTDY.Type)...) subRecord = append(subRecord, []byte(ceConfig.GemTDY.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.GemTDY.Size) subRecord = append(subRecord, size...) totaluse1 := make([]byte, 4) binary.BigEndian.PutUint32(totaluse1, ceConfig.GemTDY.TDY.VendingMachine.Box1.TotalUse1) subRecord = append(subRecord, totaluse1...) useonthatday1 := make([]byte, 4) binary.BigEndian.PutUint32(useonthatday1, ceConfig.GemTDY.TDY.VendingMachine.Box1.UseOnThatDay1) subRecord = append(subRecord, useonthatday1...) totaluse2 := make([]byte, 4) binary.BigEndian.PutUint32(totaluse2, ceConfig.GemTDY.TDY.VendingMachine.Box2.TotalUse2) subRecord = append(subRecord, totaluse2...) useonthatday2 := make([]byte, 4) binary.BigEndian.PutUint32(useonthatday2, ceConfig.GemTDY.TDY.VendingMachine.Box2.UseOnThatDay2) subRecord = append(subRecord, useonthatday2...) totaluse3 := make([]byte, 4) binary.BigEndian.PutUint32(totaluse3, ceConfig.GemTDY.TDY.VendingMachine.Box3.TotalUse3) subRecord = append(subRecord, totaluse3...) useonthatday3 := make([]byte, 4) binary.BigEndian.PutUint32(useonthatday3, ceConfig.GemTDY.TDY.VendingMachine.Box3.UseOnThatDay3) subRecord = append(subRecord, useonthatday3...) totaluse4 := make([]byte, 4) binary.BigEndian.PutUint32(totaluse4, ceConfig.GemTDY.TDY.VendingMachine.Box4.TotalUse4) subRecord = append(subRecord, totaluse4...) useonthatday4 := make([]byte, 4) binary.BigEndian.PutUint32(useonthatday4, ceConfig.GemTDY.TDY.VendingMachine.Box4.UseOnThatDay4) subRecord = append(subRecord, useonthatday4...) totaluse5 := make([]byte, 4) binary.BigEndian.PutUint32(totaluse5, ceConfig.GemTDY.TDY.VendingMachine.Box5.TotalUse5) subRecord = append(subRecord, totaluse5...) useonthatday5 := make([]byte, 4) binary.BigEndian.PutUint32(useonthatday5, ceConfig.GemTDY.TDY.VendingMachine.Box5.UseOnThatDay5) subRecord = append(subRecord, useonthatday5...) numberofusetotal1 := make([]byte, 4) binary.BigEndian.PutUint32(numberofusetotal1, ceConfig.GemTDY.TDY.RePlayMachine.Box1Total.OnThatDay1.NumberOfUseOnThatDay1) subRecord = append(subRecord, numberofusetotal1...) commissiontotal1 := make([]byte, 2) binary.BigEndian.PutUint16(commissiontotal1, ceConfig.GemTDY.TDY.RePlayMachine.Box1Total.OnThatDay1.CommissionOnThatDay1) subRecord = append(subRecord, commissiontotal1...) numberofusetotal2 := make([]byte, 4) binary.BigEndian.PutUint32(numberofusetotal2, ceConfig.GemTDY.TDY.RePlayMachine.Box2Total.OnThatDay2.NumberOfUseOnThatDay2) subRecord = append(subRecord, numberofusetotal2...) commissiontotal2 := make([]byte, 2) binary.BigEndian.PutUint16(commissiontotal2, ceConfig.GemTDY.TDY.RePlayMachine.Box2Total.OnThatDay2.CommissionOnThatDay2) subRecord = append(subRecord, commissiontotal2...) numberofusetotal3 := make([]byte, 4) binary.BigEndian.PutUint32(numberofusetotal3, ceConfig.GemTDY.TDY.RePlayMachine.Box3Total.OnThatDay3.NumberOfUseOnThatDay3) subRecord = append(subRecord, numberofusetotal3...) commissiontotal3 := make([]byte, 2) binary.BigEndian.PutUint16(commissiontotal3, ceConfig.GemTDY.TDY.RePlayMachine.Box3Total.OnThatDay3.CommissionOnThatDay3) subRecord = append(subRecord, commissiontotal3...) numberofusetotal4 := make([]byte, 4) binary.BigEndian.PutUint32(numberofusetotal4, ceConfig.GemTDY.TDY.RePlayMachine.Box4Total.OnThatDay4.NumberOfUseOnThatDay4) subRecord = append(subRecord, numberofusetotal4...) commissiontotal4 := make([]byte, 2) binary.BigEndian.PutUint16(commissiontotal4, ceConfig.GemTDY.TDY.RePlayMachine.Box4Total.OnThatDay4.CommissionOnThatDay4) subRecord = append(subRecord, commissiontotal4...) numberofusetotal5 := make([]byte, 4) binary.BigEndian.PutUint32(numberofusetotal5, ceConfig.GemTDY.TDY.RePlayMachine.Box5Total.OnThatDay5.NumberOfUseOnThatDay5) subRecord = append(subRecord, numberofusetotal5...) commissiontotal5 := make([]byte, 2) binary.BigEndian.PutUint16(commissiontotal5, ceConfig.GemTDY.TDY.RePlayMachine.Box5Total.OnThatDay5.CommissionOnThatDay5) subRecord = append(subRecord, commissiontotal5...) case 3: subRecord = append(subRecord, []byte(ceConfig.MedalMST.Type)...) subRecord = append(subRecord, []byte(ceConfig.MedalMST.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.MedalMST.Size) subRecord = append(subRecord, size...) subRecord = append(subRecord, byte(ceConfig.MedalMST.MST.NodeID)) subRecord = append(subRecord, byte(ceConfig.MedalMST.MST.Identifier)) number_of_gems := make([]byte, 4) binary.BigEndian.PutUint32(number_of_gems, ceConfig.MedalMST.MST.NumberOfGems) subRecord = append(subRecord, number_of_gems...) box1_total := make([]byte, 4) binary.BigEndian.PutUint32(box1_total, ceConfig.MedalMST.MST.Box1Total) subRecord = append(subRecord, box1_total...) box2_total := make([]byte, 4) binary.BigEndian.PutUint32(box2_total, ceConfig.MedalMST.MST.Box2Total) subRecord = append(subRecord, box2_total...) box3_total := make([]byte, 4) binary.BigEndian.PutUint32(box3_total, ceConfig.MedalMST.MST.Box3Total) subRecord = append(subRecord, box3_total...) box4_total := make([]byte, 4) binary.BigEndian.PutUint32(box4_total, ceConfig.MedalMST.MST.Box4Total) subRecord = append(subRecord, box4_total...) box5_total := make([]byte, 4) binary.BigEndian.PutUint32(box5_total, ceConfig.MedalMST.MST.Box5Total) subRecord = append(subRecord, box5_total...) box1 := make([]byte, 4) binary.BigEndian.PutUint32(box1, ceConfig.MedalMST.MST.Box1) subRecord = append(subRecord, box1...) box2 := make([]byte, 4) binary.BigEndian.PutUint32(box2, ceConfig.MedalMST.MST.Box2) subRecord = append(subRecord, box2...) box3 := make([]byte, 4) binary.BigEndian.PutUint32(box3, ceConfig.MedalMST.MST.Box3) subRecord = append(subRecord, box3...) box4 := make([]byte, 4) binary.BigEndian.PutUint32(box4, ceConfig.MedalMST.MST.Box4) subRecord = append(subRecord, box4...) box5 := make([]byte, 4) binary.BigEndian.PutUint32(box5, ceConfig.MedalMST.MST.Box5) subRecord = append(subRecord, box5...) case 4: subRecord = append(subRecord, []byte(ceConfig.MedalTDY.Type)...) subRecord = append(subRecord, []byte(ceConfig.MedalTDY.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.MedalTDY.Size) subRecord = append(subRecord, size...) addition_amount := make([]byte, 4) binary.BigEndian.PutUint32(addition_amount, ceConfig.MedalTDY.TDYMedal.SameDayBallRental.AdditionalAmount) subRecord = append(subRecord, addition_amount...) usage_amount_p := make([]byte, 4) binary.BigEndian.PutUint32(usage_amount_p, ceConfig.MedalTDY.TDYMedal.SameDayBallRental.UsageAmountP) subRecord = append(subRecord, usage_amount_p...) usage_amount_s := make([]byte, 4) binary.BigEndian.PutUint32(usage_amount_s, ceConfig.MedalTDY.TDYMedal.SameDayBallRental.UsageAmountS) subRecord = append(subRecord, usage_amount_s...) refund_amount := make([]byte, 4) binary.BigEndian.PutUint32(refund_amount, ceConfig.MedalTDY.TDYMedal.SameDayBallRental.RefundAmount) subRecord = append(subRecord, refund_amount...) renewal_amount := make([]byte, 4) binary.BigEndian.PutUint32(renewal_amount, ceConfig.MedalTDY.TDYMedal.ReusedBallRental.RenewalAmount) subRecord = append(subRecord, renewal_amount...) re_usage_amount_p := make([]byte, 4) binary.BigEndian.PutUint32(re_usage_amount_p, ceConfig.MedalTDY.TDYMedal.ReusedBallRental.ReUsageAmountP) subRecord = append(subRecord, re_usage_amount_p...) re_usage_amount_s := make([]byte, 4) binary.BigEndian.PutUint32(re_usage_amount_s, ceConfig.MedalTDY.TDYMedal.ReusedBallRental.ReUsageAmountS) subRecord = append(subRecord, re_usage_amount_s...) re_refund_amount := make([]byte, 4) binary.BigEndian.PutUint32(re_refund_amount, ceConfig.MedalTDY.TDYMedal.ReusedBallRental.ReRefundAmount) subRecord = append(subRecord, re_refund_amount...) case 5: subRecord = append(subRecord, []byte(ceConfig.PointMST.Type)...) subRecord = append(subRecord, []byte(ceConfig.PointMST.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.PointMST.Size) subRecord = append(subRecord, size...) point_situation := make([]byte, 4) binary.BigEndian.PutUint32(point_situation, ceConfig.PointMST.PointSituation) subRecord = append(subRecord, point_situation...) box1 := make([]byte, 4) binary.BigEndian.PutUint32(box1, ceConfig.PointMST.NumberOfPoints.Box1) subRecord = append(subRecord, box1...) box2 := make([]byte, 4) binary.BigEndian.PutUint32(box2, ceConfig.PointMST.NumberOfPoints.Box2) subRecord = append(subRecord, box2...) box3 := make([]byte, 4) binary.BigEndian.PutUint32(box3, ceConfig.PointMST.NumberOfPoints.Box3) subRecord = append(subRecord, box3...) box4 := make([]byte, 4) binary.BigEndian.PutUint32(box4, ceConfig.PointMST.NumberOfPoints.Box4) subRecord = append(subRecord, box4...) box5 := make([]byte, 4) binary.BigEndian.PutUint32(box5, ceConfig.PointMST.NumberOfPoints.Box5) subRecord = append(subRecord, box5...) box6 := make([]byte, 4) binary.BigEndian.PutUint32(box6, ceConfig.PointMST.NumberOfPoints.Box6) subRecord = append(subRecord, box6...) box7 := make([]byte, 4) binary.BigEndian.PutUint32(box7, ceConfig.PointMST.NumberOfPoints.Box7) subRecord = append(subRecord, box7...) box8 := make([]byte, 4) binary.BigEndian.PutUint32(box8, ceConfig.PointMST.NumberOfPoints.Box8) subRecord = append(subRecord, box8...) box9 := make([]byte, 4) binary.BigEndian.PutUint32(box9, ceConfig.PointMST.NumberOfPoints.Box9) subRecord = append(subRecord, box9...) box10 := make([]byte, 4) binary.BigEndian.PutUint32(box10, ceConfig.PointMST.NumberOfPoints.Box10) subRecord = append(subRecord, box10...) case 6: subRecord = append(subRecord, []byte(ceConfig.PointTDYData.Type)...) subRecord = append(subRecord, []byte(ceConfig.PointTDYData.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.PointTDYData.Size) subRecord = append(subRecord, size...) add1 := make([]byte, 4) binary.BigEndian.PutUint32(add1, ceConfig.PointTDYData.TDYData.TDYBox1.Add1) subRecord = append(subRecord, add1...) sub1 := make([]byte, 4) binary.BigEndian.PutUint32(sub1, ceConfig.PointTDYData.TDYData.TDYBox1.Sub1) subRecord = append(subRecord, sub1...) add2 := make([]byte, 4) binary.BigEndian.PutUint32(add2, ceConfig.PointTDYData.TDYData.TDYBox2.Add2) subRecord = append(subRecord, add2...) sub2 := make([]byte, 4) binary.BigEndian.PutUint32(sub2, ceConfig.PointTDYData.TDYData.TDYBox2.Sub2) subRecord = append(subRecord, sub2...) add3 := make([]byte, 4) binary.BigEndian.PutUint32(add3, ceConfig.PointTDYData.TDYData.TDYBox3.Add3) subRecord = append(subRecord, add3...) sub3 := make([]byte, 4) binary.BigEndian.PutUint32(sub3, ceConfig.PointTDYData.TDYData.TDYBox3.Sub3) subRecord = append(subRecord, sub3...) add4 := make([]byte, 4) binary.BigEndian.PutUint32(add4, ceConfig.PointTDYData.TDYData.TDYBox4.Add4) subRecord = append(subRecord, add4...) sub4 := make([]byte, 4) binary.BigEndian.PutUint32(sub4, ceConfig.PointTDYData.TDYData.TDYBox4.Sub4) subRecord = append(subRecord, sub4...) add5 := make([]byte, 4) binary.BigEndian.PutUint32(add5, ceConfig.PointTDYData.TDYData.TDYBox5.Add5) subRecord = append(subRecord, add5...) sub5 := make([]byte, 4) binary.BigEndian.PutUint32(sub5, ceConfig.PointTDYData.TDYData.TDYBox5.Sub5) subRecord = append(subRecord, sub5...) add6 := make([]byte, 4) binary.BigEndian.PutUint32(add6, ceConfig.PointTDYData.TDYData.TDYBox6.Add6) subRecord = append(subRecord, add6...) sub6 := make([]byte, 4) binary.BigEndian.PutUint32(sub6, ceConfig.PointTDYData.TDYData.TDYBox6.Sub6) subRecord = append(subRecord, sub6...) add7 := make([]byte, 4) binary.BigEndian.PutUint32(add7, ceConfig.PointTDYData.TDYData.TDYBox7.Add7) subRecord = append(subRecord, add7...) sub7 := make([]byte, 4) binary.BigEndian.PutUint32(sub7, ceConfig.PointTDYData.TDYData.TDYBox7.Sub7) subRecord = append(subRecord, sub7...) add8 := make([]byte, 4) binary.BigEndian.PutUint32(add8, ceConfig.PointTDYData.TDYData.TDYBox8.Add8) subRecord = append(subRecord, add8...) sub8 := make([]byte, 4) binary.BigEndian.PutUint32(sub8, ceConfig.PointTDYData.TDYData.TDYBox8.Sub8) subRecord = append(subRecord, sub8...) add9 := make([]byte, 4) binary.BigEndian.PutUint32(add9, ceConfig.PointTDYData.TDYData.TDYBox9.Add9) subRecord = append(subRecord, add9...) sub9 := make([]byte, 4) binary.BigEndian.PutUint32(sub9, ceConfig.PointTDYData.TDYData.TDYBox9.Sub9) subRecord = append(subRecord, sub9...) add10 := make([]byte, 4) binary.BigEndian.PutUint32(add10, ceConfig.PointTDYData.TDYData.TDYBox10.Add10) subRecord = append(subRecord, add10...) sub10 := make([]byte, 4) binary.BigEndian.PutUint32(sub10, ceConfig.PointTDYData.TDYData.TDYBox10.Sub10) subRecord = append(subRecord, sub10...) case 7: subRecord = append(subRecord, []byte(ceConfig.KatamaMSTSubRecord.Type)...) subRecord = append(subRecord, []byte(ceConfig.KatamaMSTSubRecord.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.KatamaMSTSubRecord.Size) subRecord = append(subRecord, size...) subRecord = append(subRecord, byte(ceConfig.KatamaMSTSubRecord.Attribute)) subRecord = append(subRecord, byte(ceConfig.KatamaMSTSubRecord.Frequency)) number_of_issuing_tickets := make([]byte, 4) binary.BigEndian.PutUint32(number_of_issuing_tickets, ceConfig.KatamaMSTSubRecord.NumberOfIssuingTickets) subRecord = append(subRecord, number_of_issuing_tickets...) registration_date := make([]byte, 4) binary.BigEndian.PutUint32(registration_date, ceConfig.KatamaMSTSubRecord.RegistrationDate) subRecord = append(subRecord, registration_date...) reuse_update := make([]byte, 4) binary.BigEndian.PutUint32(reuse_update, ceConfig.KatamaMSTSubRecord.ReuseUpdate) subRecord = append(subRecord, reuse_update...) case 8: subRecord = append(subRecord, []byte(ceConfig.KatamaTDYSubRecord.Type)...) subRecord = append(subRecord, []byte(ceConfig.KatamaTDYSubRecord.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.KatamaTDYSubRecord.Size) subRecord = append(subRecord, size...) additionfrequency := make([]byte, 2) binary.BigEndian.PutUint16(additionfrequency, ceConfig.KatamaTDYSubRecord.KatamaTDY.KatamaOnThatDay.AdditionFrequency) subRecord = append(subRecord, additionfrequency...) usefrequencyp := make([]byte, 2) binary.BigEndian.PutUint16(usefrequencyp, ceConfig.KatamaTDYSubRecord.KatamaTDY.KatamaOnThatDay.UseFrequencyP) subRecord = append(subRecord, usefrequencyp...) usefrequencys := make([]byte, 2) binary.BigEndian.PutUint16(usefrequencys, ceConfig.KatamaTDYSubRecord.KatamaTDY.KatamaOnThatDay.UseFrequencyS) subRecord = append(subRecord, usefrequencys...) refundfrequency := make([]byte, 2) binary.BigEndian.PutUint16(refundfrequency, ceConfig.KatamaTDYSubRecord.KatamaTDY.KatamaOnThatDay.RefundFrequency) subRecord = append(subRecord, refundfrequency...) updatefrequency := make([]byte, 2) binary.BigEndian.PutUint16(updatefrequency, ceConfig.KatamaTDYSubRecord.KatamaTDY.ReUseKatama.UpdateFrequency) subRecord = append(subRecord, additionfrequency...) reusefrequencyp := make([]byte, 2) binary.BigEndian.PutUint16(reusefrequencyp, ceConfig.KatamaTDYSubRecord.KatamaTDY.ReUseKatama.ReUseFrequencyP) subRecord = append(subRecord, reusefrequencyp...) reusefrequencys := make([]byte, 2) binary.BigEndian.PutUint16(reusefrequencys, ceConfig.KatamaTDYSubRecord.KatamaTDY.ReUseKatama.ReFrequencyS) subRecord = append(subRecord, reusefrequencys...) rerefundfrequency := make([]byte, 2) binary.BigEndian.PutUint16(rerefundfrequency, ceConfig.KatamaTDYSubRecord.KatamaTDY.ReUseKatama.ReRefundFrequency) subRecord = append(subRecord, rerefundfrequency...) case 9: subRecord = append(subRecord, []byte(ceConfig.ReductioInformationTDY.Type)...) subRecord = append(subRecord, []byte(ceConfig.ReductioInformationTDY.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.ReductioInformationTDY.Size) subRecord = append(subRecord, size...) numberofgemreducation := make([]byte, 4) binary.BigEndian.PutUint32(numberofgemreducation, ceConfig.ReductioInformationTDY.NumberOfGemReducation) subRecord = append(subRecord, numberofgemreducation...) numberofmedalreducation := make([]byte, 4) binary.BigEndian.PutUint32(numberofmedalreducation, ceConfig.ReductioInformationTDY.NumberOfMedalReducation) subRecord = append(subRecord, numberofmedalreducation...) reserve := make([]byte, 8) binary.BigEndian.PutUint64(reserve, ceConfig.ReductioInformationTDY.Reserve) subRecord = append(subRecord, reserve...) case 10: subRecord = append(subRecord, []byte(ceConfig.MemberIndividualInfo.Type)...) subRecord = append(subRecord, []byte(ceConfig.MemberIndividualInfo.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.MemberIndividualInfo.Size) subRecord = append(subRecord, size...) name := []byte(ceConfig.MemberIndividualInfo.Name) x := 24 - len(name) if x > 0 { for x > 0 { name = append(name, 0) x-- } } subRecord = append(subRecord, name...) date_of_birth := make([]byte, 4) binary.BigEndian.PutUint32(date_of_birth, ceConfig.MemberIndividualInfo.DateOfBirth) subRecord = append(subRecord, date_of_birth...) phone_number, _ := hex.DecodeString(ceConfig.MemberIndividualInfo.PhoneNumber) subRecord = append(subRecord, phone_number...) reserve := make([]byte, 2) binary.BigEndian.PutUint16(reserve, ceConfig.MemberIndividualInfo.Reserve) subRecord = append(subRecord, reserve...) exchange_cigarette := make([]byte, 8) binary.BigEndian.PutUint64(exchange_cigarette, ceConfig.MemberIndividualInfo.ExchangeCigarette) subRecord = append(subRecord, exchange_cigarette...) exchange_general := make([]byte, 8) binary.BigEndian.PutUint64(exchange_general, ceConfig.MemberIndividualInfo.ExchangeGeneral) subRecord = append(subRecord, exchange_general...) reserve2 := make([]byte, 8) binary.BigEndian.PutUint64(reserve2, ceConfig.MemberIndividualInfo.Reserve2) subRecord = append(subRecord, reserve2...) preference_gigarette := make([]byte, 8) binary.BigEndian.PutUint64(preference_gigarette, ceConfig.MemberIndividualInfo.PreferenceGigarette) subRecord = append(subRecord, preference_gigarette...) preference_general := make([]byte, 8) binary.BigEndian.PutUint64(preference_general, ceConfig.MemberIndividualInfo.PreferenceGeneral) subRecord = append(subRecord, preference_general...) case 11: subRecord = append(subRecord, []byte(ceConfig.ChangeDataSubRecord.Type)...) subRecord = append(subRecord, []byte(ceConfig.ChangeDataSubRecord.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.ChangeDataSubRecord.Size) subRecord = append(subRecord, size...) subRecord = append(subRecord, []byte(ceConfig.ChangeDataSubRecord.DealingsDivision)...) subRecord = append(subRecord, []byte(ceConfig.ChangeDataSubRecord.DealingsEvent)...) nodeid := make([]byte, 1) subRecord = append(subRecord, nodeid...) identifier := make([]byte, 1) subRecord = append(subRecord, identifier...) numberofgems := make([]byte, 4) binary.BigEndian.PutUint32(numberofgems, ceConfig.ChangeDataSubRecord.Ball.NumberOfGems) subRecord = append(subRecord, numberofgems...) accumulatebox1 := make([]byte, 4) binary.BigEndian.PutUint32(accumulatebox1, ceConfig.ChangeDataSubRecord.AccumulatedBall.AccumulateBox1) subRecord = append(subRecord, accumulatebox1...) accumulatebox2 := make([]byte, 4) binary.BigEndian.PutUint32(accumulatebox2, ceConfig.ChangeDataSubRecord.AccumulatedBall.AccumulateBox2) subRecord = append(subRecord, accumulatebox2...) accumulatebox3 := make([]byte, 4) binary.BigEndian.PutUint32(accumulatebox3, ceConfig.ChangeDataSubRecord.AccumulatedBall.AccumulateBox3) subRecord = append(subRecord, accumulatebox3...) accumulatebox4 := make([]byte, 4) binary.BigEndian.PutUint32(accumulatebox4, ceConfig.ChangeDataSubRecord.AccumulatedBall.AccumulateBox4) subRecord = append(subRecord, accumulatebox4...) accumulatebox5 := make([]byte, 4) binary.BigEndian.PutUint32(accumulatebox5, ceConfig.ChangeDataSubRecord.AccumulatedBall.AccumulateBox5) subRecord = append(subRecord, accumulatebox5...) earnedbox1 := make([]byte, 4) binary.BigEndian.PutUint32(earnedbox1, ceConfig.ChangeDataSubRecord.EarnedBall.EarnedBox1) subRecord = append(subRecord, earnedbox1...) earnedbox2 := make([]byte, 4) binary.BigEndian.PutUint32(earnedbox2, ceConfig.ChangeDataSubRecord.EarnedBall.EarnedBox2) subRecord = append(subRecord, earnedbox2...) earnedbox3 := make([]byte, 4) binary.BigEndian.PutUint32(earnedbox3, ceConfig.ChangeDataSubRecord.EarnedBall.EarnedBox3) subRecord = append(subRecord, earnedbox3...) earnedbox4 := make([]byte, 4) binary.BigEndian.PutUint32(earnedbox4, ceConfig.ChangeDataSubRecord.EarnedBall.EarnedBox4) subRecord = append(subRecord, earnedbox4...) earnedbox5 := make([]byte, 4) binary.BigEndian.PutUint32(earnedbox5, ceConfig.ChangeDataSubRecord.EarnedBall.EarnedBox5) subRecord = append(subRecord, earnedbox5...) case 12: subRecord = append(subRecord, []byte(ceConfig.PointChangeData.Type)...) subRecord = append(subRecord, []byte(ceConfig.PointChangeData.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.PointChangeData.Size) subRecord = append(subRecord, size...) pointsituation := make([]byte, 4) binary.BigEndian.PutUint32(pointsituation, ceConfig.PointChangeData.PointSituation) subRecord = append(subRecord, pointsituation...) pointbox1 := make([]byte, 4) binary.BigEndian.PutUint32(pointbox1, ceConfig.PointChangeData.NumberOfPoints.PointBox1) subRecord = append(subRecord, pointbox1...) pointbox2 := make([]byte, 4) binary.BigEndian.PutUint32(pointbox2, ceConfig.PointChangeData.NumberOfPoints.PointBox2) subRecord = append(subRecord, pointbox2...) pointbox3 := make([]byte, 4) binary.BigEndian.PutUint32(pointbox3, ceConfig.PointChangeData.NumberOfPoints.PointBox3) subRecord = append(subRecord, pointbox3...) pointbox4 := make([]byte, 4) binary.BigEndian.PutUint32(pointbox4, ceConfig.PointChangeData.NumberOfPoints.PointBox4) subRecord = append(subRecord, pointbox4...) pointbox5 := make([]byte, 4) binary.BigEndian.PutUint32(pointbox5, ceConfig.PointChangeData.NumberOfPoints.PointBox5) subRecord = append(subRecord, pointbox5...) pointbox6 := make([]byte, 4) binary.BigEndian.PutUint32(pointbox6, ceConfig.PointChangeData.NumberOfPoints.PointBox6) subRecord = append(subRecord, pointbox6...) pointbox7 := make([]byte, 4) binary.BigEndian.PutUint32(pointbox7, ceConfig.PointChangeData.NumberOfPoints.PointBox7) subRecord = append(subRecord, pointbox7...) pointbox8 := make([]byte, 4) binary.BigEndian.PutUint32(pointbox8, ceConfig.PointChangeData.NumberOfPoints.PointBox8) subRecord = append(subRecord, pointbox8...) pointbox9 := make([]byte, 4) binary.BigEndian.PutUint32(pointbox9, ceConfig.PointChangeData.NumberOfPoints.PointBox9) subRecord = append(subRecord, pointbox9...) pointbox10 := make([]byte, 4) binary.BigEndian.PutUint32(pointbox10, ceConfig.PointChangeData.NumberOfPoints.PointBox10) subRecord = append(subRecord, pointbox10...) case 13: subRecord = append(subRecord, []byte(ceConfig.OtherInformationSubrecord.Type)...) subRecord = append(subRecord, []byte(ceConfig.OtherInformationSubrecord.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.OtherInformationSubrecord.Size) subRecord = append(subRecord, size...) numberofmemberdiscountgems := make([]byte, 2) binary.BigEndian.PutUint16(numberofmemberdiscountgems, ceConfig.OtherInformationSubrecord.NumberOfMemberDiscountGems) subRecord = append(subRecord, numberofmemberdiscountgems...) numberofmemberdiscountmedals := make([]byte, 2) binary.BigEndian.PutUint16(numberofmemberdiscountmedals, ceConfig.OtherInformationSubrecord.NumberOfMemberDiscountMedals) subRecord = append(subRecord, numberofmemberdiscountmedals...) discountdayonbirthday := make([]byte, 4) binary.BigEndian.PutUint32(discountdayonbirthday, ceConfig.OtherInformationSubrecord.DiscountDayOnBirthday) subRecord = append(subRecord, discountdayonbirthday...) numberofsexdiscounts := make([]byte, 1) subRecord = append(subRecord, numberofsexdiscounts...) case 14: subRecord = append(subRecord, []byte(ceConfig.LatestTradingTerminalInfo.Type)...) subRecord = append(subRecord, []byte(ceConfig.LatestTradingTerminalInfo.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.LatestTradingTerminalInfo.Size) subRecord = append(subRecord, size...) ip := make([]byte, 4) binary.BigEndian.PutUint32(ip, ceConfig.LatestTradingTerminalInfo.GTI.IP) subRecord = append(subRecord, ip...) modelcode := make([]byte, 2) binary.BigEndian.PutUint16(modelcode, ceConfig.LatestTradingTerminalInfo.GTI.ModelCode) subRecord = append(subRecord, modelcode...) serialnumber := make([]byte, 2) binary.BigEndian.PutUint16(serialnumber, ceConfig.LatestTradingTerminalInfo.GTI.SerialNumber) subRecord = append(subRecord, serialnumber...) unitnumber := make([]byte, 2) binary.BigEndian.PutUint16(unitnumber, ceConfig.LatestTradingTerminalInfo.UnitNumber) subRecord = append(subRecord, unitnumber...) spare := make([]byte, 6) subRecord = append(subRecord, spare...) } } } number_of_subrecords := make([]byte, 2) binary.BigEndian.PutUint16(number_of_subrecords, count) buf = append(buf, number_of_subrecords...) buf = append(buf, subRecord...) var operatorInfoSubrecord []byte operatorInfoSubrecord = append(operatorInfoSubrecord, []byte(ceConfig.OperatorInfo.Type)...) operatorInfoSubrecord = append(operatorInfoSubrecord, []byte(ceConfig.OperatorInfo.AssistanceType)...) size := make([]byte, 2) binary.BigEndian.PutUint16(size, ceConfig.OperatorInfo.Size) operatorInfoSubrecord = append(operatorInfoSubrecord, size...) operator_number := []byte(ceConfig.OperatorInfo.OperatorNumber) x := 10 - len(operator_number) if x > 0 { for x > 0 { operator_number = append(operator_number, 0) x-- } } operatorInfoSubrecord = append(operatorInfoSubrecord, operator_number...) reserve := make([]byte, 2) binary.BigEndian.PutUint16(reserve, ceConfig.OperatorInfo.Reserve) operatorInfoSubrecord = append(operatorInfoSubrecord, reserve...) buf = append(buf, operatorInfoSubrecord...) return buf } func ValidCePackage(message []byte, bigEndian bool, echoback uint32, requestdealingsnumber uint16, demandData uint16) (bool, *ResponseMessage, string) { subrecord_length := 0 var messageErr = "" n := strconv.FormatInt(int64(demandData), 2) for i := 0; i < len(n); i++ { if string(n[i]) == "1" { x := len(n) - i - 1 switch x { case 0: subrecord_length += 38 case 1: subrecord_length += 50 case 2: subrecord_length += 108 case 3: subrecord_length += 50 case 4: subrecord_length += 36 case 5: subrecord_length += 48 case 6: subrecord_length += 84 case 7: subrecord_length += 18 case 8: subrecord_length += 20 case 9: subrecord_length += 20 case 10: subrecord_length += 88 case 11: subrecord_length += 52 case 12: subrecord_length += 48 case 13: subrecord_length += 64 case 14: subrecord_length += 20 } } } if len(message) != (76 + subrecord_length) { messageErr = fmt.Sprintf("Error Ce response message is invalid length: %v", len(message)) logger.HCLog.Error(messageErr) return false, nil, messageErr } cepackage, err := ParseCe(message, bigEndian) if err != nil { messageErr = fmt.Sprintf("Error parsing Ce response message: %v", err) logger.HCLog.Error(messageErr) return false, nil, messageErr } response_dealingsnumber := requestdealingsnumber | 0x8000 if string(cepackage.Header.DataId.Cmd)+string(cepackage.Header.DataId.Sub) == commands.RESPONSE_ce_ID && cepackage.Header.EchoBack == echoback && response_dealingsnumber == cepackage.Header.TransactionNo { return true, cepackage, messageErr } else { messageErr = fmt.Sprintf("Error Ce response message data is invalid: %v", message) logger.HCLog.Error(messageErr) return false, nil, messageErr } }
package setting import ( "encoding/json" "fmt" "io/ioutil" "hcservice/internal/utils" ) var CommandConfig *Config const CONFIG_PATH = "/commands/setting/Command.conf" type Config struct { TzConfig TzConfig `json:"Tz"` CeConfig CeConfig `json:"Ce"` A0Config A0Config `json:"A0"` } type SubVersionInfo struct { Version string `json:"Version"` // バージョン } type SubordinateTerminal struct { PhysicalNetwork uint8 `json:"PhysicalNetwork"` // 物理ネットワーク番号 PhysicalTerminal uint8 `json:"PhysicalTerminal"` // 物理端末番号 Version string `json:"Version"` // バージョン } type SubSubordinate struct { SubList []SubordinateTerminal `json:"SubList"` } type SubordinateTerminalBali struct { PhysicalNetwork uint8 `json:"PhysicalNetwork"` // 物理ネットワーク番号 PhysicalTerminal uint8 `json:"PhysicalTerminal"` // 物理端末番号 Bali uint8 `json:"Bali"` // ビルバリ番号 Version string `json:"Version"` // バージョン } type SubSubordinateBali struct { SubList []SubordinateTerminalBali `json:"SubList"` } type A0Config struct { ResponseDemand uint8 `json:"ResponseDemand"` DealingsNumber uint16 `json:"DealingsNumber"` IslandNo uint8 `json:"IslandNo"` CommandExtension uint8 `json:"CommandExtension"` Data2Info uint8 `json:"Data2Info"` VersionInfo SubVersionInfo `json:"VersionInfo"` SubTerminal SubSubordinate `json:"SubTerminal"` SubTerminalBali SubSubordinateBali `json:"SubTerminalBali"` } type TzConfig struct { ResponseDemand uint8 `json:"ResponseDemand"` DealingsNumber uint16 `json:"DealingsNumber"` IslandNo uint8 `json:"IslandNo"` CommandExtension uint8 `json:"CommandExtension"` Masteraddress uint32 `json:"Masteraddress"` Terminal1address uint32 `json:"Terminal1address"` Terminal2address uint32 `json:"Terminal2address"` Terminal3address uint32 `json:"Terminal3address"` Terminal4address uint32 `json:"Terminal4address"` Terminal5address uint32 `json:"Terminal5address"` Terminal6address uint32 `json:"Terminal6address"` Terminal7address uint32 `json:"Terminal7address"` Terminal8address uint32 `json:"Terminal8address"` Terminal9address uint32 `json:"Terminal9address"` Terminal10address uint32 `json:"Terminal10address"` Configurationfileupdateflag uint8 `json:"Configurationfileupdateflag"` Premiummasterupdateflag uint8 `json:"Premiummasterupdateflag"` Employeeupdateflag uint8 `json:"Employeeupdateflag"` Sectionmasterupdateflag uint8 `json:"Sectionmasterupdateflag"` } type CeConfig struct { ResponseDemand uint8 `json:"ResponseDemand"` DealingsNumber uint16 `json:"DealingsNumber"` IslandNo uint8 `json:"IslandNo"` CommandExtension uint8 `json:"CommandExtension"` PhoneNumber uint64 `json:"PhoneNumber"` SettingExchangeRateNumber uint8 `json:"SettingExchangeRateNumber"` DemandData2 uint16 `json:"DemandData2"` TerminalProperty uint8 `json:"TerminalProperty"` DemandData15Acc uint16 `json:"DemandData15Acc"` Reserve uint16 `json:"Reserve"` BlockSendingSequentialNumber uint16 `json:"BlockSendingSequentialNumber"` KatamaMSTSubRecord KatamaMSTSubRecordStruct `json:"KatamaMSTSubRecord"` IndividualSubrecord IndividualSubrecordStruct `json:"IndividualSubRecord"` GemMST GemMSTStruct `json:"GemMST"` GemTDY GemTDYStruct `json:"GemTDY"` MedalMST MedalMSTStruct `json:"MedalMST"` MedalTDY MedalTDYStruct `json:"MedalTDY"` MemberIndividualInfo MemberIndividualInfoStruct `json:"MemberIndividualInfo"` PointMST PointMSTStruct `json:"PointMST"` OperatorInfo OperatorInfo `json:"OperatorInfo"` LatestTradingTerminalInfo LatestTradingTerminalInfo `json:"LatestTradingTerminalInfo"` OtherInformationSubrecord OtherInformationSubrecord `json:"OtherInformationSubrecord"` PointTDYData PointTDYDataStruct `json:"PointTDYData"` KatamaTDYSubRecord KatamaTDYSubRecordStruct `json:"KatamaTDYSubRecord"` ReductioInformationTDY ReductioInformationTDYStruct `json:"ReductioInformationTDY"` ChangeDataSubRecord ChangeDataSubRecordStruct `json:"ChangeDataSubRecord"` PointChangeData PointChangeDataStruct `json:"PointChangeData"` } type OperatorInfo struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` OperatorNumber string `json:"OperatorNumber"` Reserve uint16 `json:"Reserve"` } type PointMSTStruct struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` PointSituation uint32 `json:"PointSituation"` NumberOfPoints NumberOfPointStruct `json:"NumberOfPoints"` } type NumberOfPointStruct struct { Box1 uint32 `json:"Box1"` Box2 uint32 `json:"Box2"` Box3 uint32 `json:"Box3"` Box4 uint32 `json:"Box4"` Box5 uint32 `json:"Box5"` Box6 uint32 `json:"Box6"` Box7 uint32 `json:"Box7"` Box8 uint32 `json:"Box8"` Box9 uint32 `json:"Box9"` Box10 uint32 `json:"Box10"` } type MemberIndividualInfoStruct struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` Name string `json:"Name"` DateOfBirth uint32 `json:"DateOfBirth"` PhoneNumber string `json:"PhoneNumber"` Reserve uint16 `json:"Reserve"` ExchangeCigarette uint64 `json:"ExchangeCigarette"` ExchangeGeneral uint64 `json:"ExchangeGeneral"` Reserve2 uint64 `json:"Reserve2"` PreferenceGigarette uint64 `json:"PreferenceGigarette"` PreferenceGeneral uint64 `json:"PreferenceGeneral"` } type KatamaMSTSubRecordStruct struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` Attribute uint8 `json:"Attribute"` Frequency uint8 `json:"Frequency"` NumberOfIssuingTickets uint32 `json:"NumberOfIssuingTickets"` RegistrationDate uint32 `json:"RegistrationDate"` ReuseUpdate uint32 `json:"ReuseUpdate"` } type IndividualSubrecordStruct struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` RegistrationDate string `json:"RegistrationDate"` LatestDealingsDate string `json:"LatestDealingsDate"` PhysicalNumber uint32 `json:"PhysicalNumber"` Password uint16 `json:"Password"` Sex uint8 `json:"Sex"` ReissueFrequency uint8 `json:"ReissueFrequency"` MediumAttribute string `json:"MediumAttribute"` Attribute uint8 `json:"Attribute"` AttributeOnThatDay uint8 `json:"AttributeOnThatDay"` PointAdditionFrequency uint8 `json:"PointAdditionFrequency"` Rank uint8 `json:"Rank"` RoikoPrintInformation uint8 `json:"RoikoPrintInformation"` OrderComingStore uint16 `json:"OrderComingStore"` PublisherMachineNumber uint16 `json:"PublisherMachineNumber"` ReplayReceipt uint16 `json:"ReplayReceipt"` } type GemMSTStruct struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` MST MSTStruct `json:"MST"` } // start GemTDY type GemTDYStruct struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` TDY TDYStruct `json:"TDY"` } type TDYStruct struct { VendingMachine VendingMachineStruct `json:"VendingMachine"` RePlayMachine RePlayMachineStruct `json:"RePlayMachine"` } type VendingMachineStruct struct { UseFrequency uint16 `json:"UseFrequency"` Box1 Box1Struct `json:"Box1"` Box2 Box2Struct `json:"Box2"` Box3 Box3Struct `json:"Box3"` Box4 Box4Struct `json:"Box4"` Box5 Box5Struct `json:"Box5"` } type Box1Struct struct { TotalUse1 uint32 `json:"TotalUse1"` UseOnThatDay1 uint32 `json:"UseOnThatDay1"` } type Box2Struct struct { TotalUse2 uint32 `json:"TotalUse2"` UseOnThatDay2 uint32 `json:"UseOnThatDay2"` } type Box3Struct struct { TotalUse3 uint32 `json:"TotalUse3"` UseOnThatDay3 uint32 `json:"UseOnThatDay3"` } type Box4Struct struct { TotalUse4 uint32 `json:"TotalUse4"` UseOnThatDay4 uint32 `json:"UseOnThatDay4"` } type Box5Struct struct { TotalUse5 uint32 `json:"TotalUse5"` UseOnThatDay5 uint32 `json:"UseOnThatDay5"` } type RePlayMachineStruct struct { UseFrequency uint16 `json:"UseFrequency"` Box1Total Box1TotalStruct `json:"Box1Total"` Box2Total Box2TotalStruct `json:"Box2Total"` Box3Total Box3TotalStruct `json:"Box3Total"` Box4Total Box4TotalStruct `json:"Box4Total"` Box5Total Box5TotalStruct `json:"Box5Total"` } type Box1TotalStruct struct { Total1 Total1Struct `json:"Total1"` OnThatDay1 OnThatDay1Struct `json:"OnThatDay1"` } type Box2TotalStruct struct { Total2 Total2Struct `json:"Total2"` OnThatDay2 OnThatDay2Struct `json:"OnThatDay2"` } type Box3TotalStruct struct { Total3 Total3Struct `json:"Total3"` OnThatDay3 OnThatDay3Struct `json:"OnThatDay3"` } type Box4TotalStruct struct { Total4 Total4Struct `json:"Total4"` OnThatDay4 OnThatDay4Struct `json:"OnThatDay4"` } type Box5TotalStruct struct { Total5 Total5Struct `json:"Total5"` OnThatDay5 OnThatDay5Struct `json:"OnThatDay5"` } type Total1Struct struct { NumberOfUseTotal1 uint32 `json:"NumberOfUseTotal1"` CommissionTotal1 uint16 `json:"CommissionTotal2"` } type OnThatDay1Struct struct { NumberOfUseOnThatDay1 uint32 `json:"NumberOfUseOnThatDay1"` CommissionOnThatDay1 uint16 `json:"CommissionOnThatDay1"` } type Total2Struct struct { NumberOfUseTotal2 uint32 `json:"NumberOfUseTotal2"` CommissionTotal2 uint16 `json:"CommissionTotal2"` } type OnThatDay2Struct struct { NumberOfUseOnThatDay2 uint32 `json:"NumberOfUseOnThatDay2"` CommissionOnThatDay2 uint16 `json:"CommissionOnThatDay2"` } type Total3Struct struct { NumberOfUseTotal3 uint32 `json:"NumberOfUseTotal3"` CommissionTotal3 uint16 `json:"CommissionTotal3"` } type OnThatDay3Struct struct { NumberOfUseOnThatDay3 uint32 `json:"NumberOfUseOnThatDay3"` CommissionOnThatDay3 uint16 `json:"CommissionOnThatDay3"` } type Total4Struct struct { NumberOfUseTotal4 uint32 `json:"NumberOfUseTotal4"` CommissionTotal4 uint16 `json:"CommissionTotal4"` } type OnThatDay4Struct struct { NumberOfUseOnThatDay4 uint32 `json:"NumberOfUseOnThatDay4"` CommissionOnThatDay4 uint16 `json:"CommissionOnThatDay4"` } type Total5Struct struct { NumberOfUseTotal5 uint32 `json:"NumberOfUseTotal5"` CommissionTotal5 uint16 `json:"CommissionTotal5"` } type OnThatDay5Struct struct { NumberOfUseOnThatDay5 uint32 `json:"NumberOfUseOnThatDay5"` CommissionOnThatDay5 uint16 `json:"CommissionOnThatDay5"` } // end GemTDY type PointTDYDataStruct struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` TDYData TDYDataStruct `json:"TDYData"` } type TDYDataStruct struct { TDYBox1 TDYBox1Struct `json:"TDYBox1"` TDYBox2 TDYBox2Struct `json:"TDYBox2"` TDYBox3 TDYBox3Struct `json:"TDYBox3"` TDYBox4 TDYBox4Struct `json:"TDYBox4"` TDYBox5 TDYBox5Struct `json:"TDYBox5"` TDYBox6 TDYBox6Struct `json:"TDYBox6"` TDYBox7 TDYBox7Struct `json:"TDYBox7"` TDYBox8 TDYBox8Struct `json:"TDYBox8"` TDYBox9 TDYBox9Struct `json:"TDYBox9"` TDYBox10 TDYBox10Struct `json:"TDYBox10"` } type TDYBox1Struct struct { Add1 uint32 `json:"Add1"` Sub1 uint32 `json:"Sub1"` } type TDYBox2Struct struct { Add2 uint32 `json:"Add2"` Sub2 uint32 `json:"Sub2"` } type TDYBox3Struct struct { Add3 uint32 `json:"Add3"` Sub3 uint32 `json:"Sub3"` } type TDYBox4Struct struct { Add4 uint32 `json:"Add4"` Sub4 uint32 `json:"Sub4"` } type TDYBox5Struct struct { Add5 uint32 `json:"Add5"` Sub5 uint32 `json:"Sub5"` } type TDYBox6Struct struct { Add6 uint32 `json:"Add6"` Sub6 uint32 `json:"Sub6"` } type TDYBox7Struct struct { Add7 uint32 `json:"Add7"` Sub7 uint32 `json:"Sub7"` } type TDYBox8Struct struct { Add8 uint32 `json:"Add8"` Sub8 uint32 `json:"Sub8"` } type TDYBox9Struct struct { Add9 uint32 `json:"Add9"` Sub9 uint32 `json:"Sub9"` } type TDYBox10Struct struct { Add10 uint32 `json:"Add10"` Sub10 uint32 `json:"Sub10"` } type MedalMSTStruct struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` MST MSTStruct `json:"MST"` } type MotamaStruct struct { NodeID uint8 `json:"NodeID"` Identifier uint8 `json:"Identifier"` NumberOfGems uint32 `json:"NumberOfGems"` } type TotalTamaStruct struct { Box1Total uint32 `json:"Box1Total"` Box2Total uint32 `json:"Box2Total"` Box3Total uint32 `json:"Box3Total"` Box4Total uint32 `json:"Box4Total"` Box5Total uint32 `json:"Box5Total"` } type TamaOnThatDayStruct struct { Box1 uint32 `json:"Box1"` Box2 uint32 `json:"Box2"` Box3 uint32 `json:"Box3"` Box4 uint32 `json:"Box4"` Box5 uint32 `json:"Box5"` } type MSTStruct struct { MotamaStruct `json:"Motama"` TotalTamaStruct `json:"TotalTama"` TamaOnThatDayStruct `json:"TamaOnThatDay"` } type MedalTDYStruct struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` TDYMedal TDYMedalStruct `json:"TDY"` } type TDYMedalStruct struct { SameDayBallRental SameDayBallRentalStruct `json:"SameDayBallRental"` ReusedBallRental ReusedBallRentalStruct `json:"ReusedBallRental"` } type SameDayBallRentalStruct struct { AdditionalAmount uint32 `json:"AdditionalAmount"` UsageAmountP uint32 `json:"UsageAmountP"` UsageAmountS uint32 `json:"UsageAmountS"` RefundAmount uint32 `json:"RefundAmount"` } type ReusedBallRentalStruct struct { RenewalAmount uint32 `json:"RenewalAmount"` ReUsageAmountP uint32 `json:"UsageAmountP"` ReUsageAmountS uint32 `json:"UsageAmountS"` ReRefundAmount uint32 `json:"RefundAmount"` } type LatestTradingTerminalInfo struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` GTI GameTerminalInformation `json:"GTI"` UnitNumber uint16 `json:"UnitNumber"` } type GameTerminalInformation struct { IP uint32 `json:"IP"` ModelCode uint16 `json:"ModelCode"` SerialNumber uint16 `json:"SerialNumber"` } type OtherInformationSubrecord struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` NumberOfMemberDiscountGems uint16 `json:"NumberOfMemberDiscountGems"` NumberOfMemberDiscountMedals uint16 `json:"NumberOfMemberDiscountMedals"` DiscountDayOnBirthday uint32 `json:"DiscountDayOnBirthday"` NumberOfSexDiscounts uint8 `json:"NumberOfSexDiscounts"` } type KatamaTDYSubRecordStruct struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` KatamaTDY KatamaTDYStruct `json:"KatamaTDY"` } type KatamaTDYStruct struct { KatamaOnThatDay KatamaOnThatDayStruct `json:"KatamaOnThatDay"` ReUseKatama ReUseKatamaStruct `json:"ReUseKatama"` } type KatamaOnThatDayStruct struct { AdditionFrequency uint16 `json:"AdditionFreuqency"` UseFrequencyP uint16 `json:"UseFreuqencyP"` UseFrequencyS uint16 `json:"UseFreuqencyS"` RefundFrequency uint16 `json:"RefundFreuqency"` } type ReUseKatamaStruct struct { UpdateFrequency uint16 `json:"UpdateFreuqency"` ReUseFrequencyP uint16 `json:"ReUseFreuqencyP"` ReFrequencyS uint16 `json:"ReFreuqencyS"` ReRefundFrequency uint16 `json:"ReRefundFreuqency"` } type ReductioInformationTDYStruct struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` NumberOfGemReducation uint32 `json:"NumberOfGemReducation"` NumberOfMedalReducation uint32 `json:"NumberOfMedalReducation"` Reserve uint64 `json:"Reserve"` } type ChangeDataSubRecordStruct struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` DealingsDivision string `json:"DealingsDivision"` DealingsEvent string `json:"DealingsEvent"` Ball BallStruct `json:"Ball"` AccumulatedBall AccumulatedBallStruct `json:"AccumulatedBall"` EarnedBall EarnedBallStruct `json:"EarnedBall"` } type BallStruct struct { NodeID uint8 `json:"NodeID"` Identifier uint8 `json:"Identifier"` NumberOfGems uint32 `json:"NumberOfGems"` } type AccumulatedBallStruct struct { AccumulateBox1 uint32 `json:"AccumulateBox1"` AccumulateBox2 uint32 `json:"AccumulateBox2"` AccumulateBox3 uint32 `json:"AccumulateBox3"` AccumulateBox4 uint32 `json:"AccumulateBox4"` AccumulateBox5 uint32 `json:"AccumulateBox5"` } type EarnedBallStruct struct { EarnedBox1 uint32 `json:"EarnedBox1"` EarnedBox2 uint32 `json:"EarnedBox2"` EarnedBox3 uint32 `json:"EarnedBox3"` EarnedBox4 uint32 `json:"EarnedBox4"` EarnedBox5 uint32 `json:"EarnedBox5"` } type PointChangeDataStruct struct { Type string `json:"Type"` AssistanceType string `json:"AssistanceType"` Size uint16 `json:"Size"` PointSituation uint32 `json:"PointSituation"` NumberOfPoints NumberOfPointsStruct `json:"NumberOfPoints"` } type NumberOfPointsStruct struct { PointBox1 uint32 `json:"PointBox1"` PointBox2 uint32 `json:"PointBox2"` PointBox3 uint32 `json:"PointBox3"` PointBox4 uint32 `json:"PointBox4"` PointBox5 uint32 `json:"PointBox5"` PointBox6 uint32 `json:"PointBox6"` PointBox7 uint32 `json:"PointBox7"` PointBox8 uint32 `json:"PointBox8"` PointBox9 uint32 `json:"PointBox9"` PointBox10 uint32 `json:"PointBox10"` } func Load() error { root_path := utils.RootDir() config, err := LoadConfig(root_path + CONFIG_PATH) if err != nil { return err } CommandConfig = config return nil } func LoadConfig(path string) (*Config, error) { config := &Config{} data, err := ioutil.ReadFile(path) if err != nil { return nil, fmt.Errorf("failed to read config file: %w", err) } if err := json.Unmarshal(data, config); err != nil { return nil, fmt.Errorf("failed to parse config file: %w", err) } return config, nil }
{ "Tz":{ "ResponseDemand": 128, "DealingsNumber": 1, "IslandNo": 0, "CommandExtension": 0, "Masteraddress": 0, "Terminal1address":0, "Terminal2address":0, "Terminal3address":0, "Terminal4address":0, "Terminal5address":0, "Terminal6address":0, "Terminal7address":0, "Terminal8address":0, "Terminal9address":0, "Terminal10address":0, "Configurationfileupdateflag":0, "Premiummasterupdateflag":0, "Employeeupdateflag":0, "Sectionmasterupdateflag":0 }, "Ce": { "ResponseDemand": 128, "DealingsNumber": 1, "IslandNo": 0, "CommandExtension": 0, "PhoneNumber": 84376584773, "SettingExchangeRateNumber": 0, "DemandData2": 0, "TerminalProperty": 0, "DemandData15Acc": 0, "Reserve": 0, "BlockSendingSequentialNumber": 0, "KatamaMSTSubRecord": { "Type": "J", "AssistanceType": "1", "Size": 18, "Attribute": 1, "Frequency": 0, "NumberOfIssuingTickets": 0, "RegistrationDate": 20230418, "ReuseUpdate": 0 }, "IndividualSubRecord": { "Type": "I", "AssistanceType": "1", "Size": 38, "RegistrationDate": "20230418152033", "LatestDealingsDate": "", "PhysicalNumber": 0, "Password": 1234, "Sex": 1, "ReissueFrequency": 0, "MediumAttribute": "", "Attribute": 0, "AttributeOnThatDay": 0, "PointAdditionFrequency": 0, "Rank": 1, "RoikoPrintInformation": 0, "OrderComingStore" : 0, "PublisherMachineNumber": 0, "ReplayReceipt": 0 }, "GemMST": { "Type": "T", "AssistanceType": "1", "Size": 50, "MST": { "Motama": { "NodeID": 1, "Identifier": 2, "NumberOfGems": 3 }, "TotalTama": { "Box1Total": 1, "Box2Total": 2, "Box3Total": 3, "Box4Total": 4, "Box5Total": 5 }, "TamaOnThatDay": { "Box1": 1, "Box2": 2, "Box3": 3, "Box4": 4, "Box5": 5 } } }, "GemTDY": { "Type": "t", "AssistanceType": "1", "Size": 108, "TDY": { "Vendingmachine": { "UseFrequency": 0, "Box1": { "TotalUse1": 1, "UseOnThatDay1": 1 }, "Box2": { "TotalUse2": 2, "UseOnThatDay2": 2 }, "Box3": { "TotalUse3": 3, "UseOnThatDay3": 3 }, "Box4": { "TotalUse4": 4, "UseOnThatDay4": 4 }, "Box5": { "TotalUse5": 5, "UseOnThatDay5": 5 } }, "RePlayMachine": { "UseFrequency": 0, "Box1Total": { "Total1": { "NumberOfUseTotal1": 1, "CommissionTotal1": 1 }, "OnThatDay1": { "NumberOfUseOnThatDay1": 1, "CommissionOnThatDay1": 1 } }, "Box2Total": { "Total2": { "NumberOfUseTotal2": 2, "CommissionTotal2": 2 }, "OnThatDay2": { "NumberOfUseOnThatDay2": 2, "CommissionOnThatDay2": 2 } }, "Box3Total": { "Total3": { "NumberOfUseTotal3": 3, "CommissionTotal3": 3 }, "OnThatDay3": { "NumberOfUseOnThatDay3": 3, "CommissionOnThatDay3": 3 } }, "Box4Total": { "Total4": { "NumberOfUseTotal4": 4, "CommissionTotal4": 4 }, "OnThatDay4": { "NumberOfUseOnThatDay4": 4, "CommissionOnThatDay4": 4 } }, "Box5Total": { "Total5": { "NumberOfUseTotal5": 5, "CommissionTotal5": 5 }, "OnThatDay5": { "NumberOfUseOnThatDay5": 5, "CommissionOnThatDay5": 5 } } } } }, "MedalMST": { "Type": "M", "AssistanceType": "1", "Size": 50, "MST": { "Motama": { "NodeID": 0, "Identifier": 0, "NumberOfGems": 0 }, "TotalTama": { "Box1Total": 0, "Box2Total": 0, "Box3Total": 0, "Box4Total": 0, "Box5Total": 0 }, "TamaOnThatDay": { "Box1": 0, "Box2": 0, "Box3": 0, "Box4": 0, "Box5": 0 } } }, "MedalTDY" : { "Type": "b", "AssistanceType": "1", "Size": 36, "TDYMedal" : { "SameDayBallRental": { "AdditionalAmount": 0, "UsageAmountP": 0, "UsageAmountS": 0, "RefundAmount": 0 }, "ReusedBallRental": { "RenewalAmount": 0, "ReUsageAmountP": 0, "ReUsageAmountS": 0, "ReRefundAmount": 0 } } }, "MemberIndividualInfo": { "Type": "U", "AssistanceType": "1", "Size": 88, "Name": "Bui Anh Quan", "DateOfBirth": 19980910, "PhoneNumber": "123456654321", "Reserve": 0, "ExchangeCigarette": 0, "ExchangeGeneral": 0, "Reserve2": 0, "PreferenceGigarette": 0, "PreferenceGeneral": 0 }, "PointMST": { "Type": "P", "AssistanceType": "1", "Size": 48, "PointSituation": 1, "NumberOfPoints": { "Box1": 1, "Box2": 2, "Box3": 3, "Box4": 4, "Box5": 5, "Box6": 6, "Box7": 7, "Box8": 8, "Box9": 9, "Box10": 10 } }, "PointTDYData": { "Type": "p", "AssistanceType": "1", "Size": 84, "TDY": { "TDYBox1": { "Add1": 0, "Sub1": 0 }, "TDYBox2": { "Add2": 0, "Sub2": 0 }, "TDYBox3": { "Add3": 0, "Sub3": 0 }, "TDYBox4": { "Add4": 0, "Sub4": 0 }, "TDYBox5": { "Add5": 0, "Sub5": 0 }, "TDYBox6": { "Add6": 0, "Sub6": 0 }, "TDYBox7": { "Add7": 0, "Sub7": 0 }, "TDYBox8": { "Add8": 0, "Sub8": 0 }, "TDYBox9": { "Add9": 0, "Sub9": 0 }, "TDYBox10": { "Add10": 0, "Sub10": 0 } } }, "OperatorInfo": { "Type": "O", "AssistanceType": "1", "Size": 16, "OperatorNumber": "", "Reserve": 0 }, "LatestTradingTerminalInfo": { "Type": "D", "AssistanceType": "1", "Size": 20, "GameTerminalInformation": { "IPAddress": 0, "SubordinateTerminalModelCode": 0, "SubordinateTerminalSameModelSerialNumber": 0 }, "UnitNumber": 0 }, "OtherInformationSubrecord": { "Type": "E", "AssistanceType": "1", "Size": 64, "NumberOfMemberDiscountGems": 0, "NumberOfMemberDiscountMedals": 0, "DiscountDayOnBirthday": 19980910, "NumberOfSexDiscounts": 0 }, "KatamaTDYSubRecord": { "Type": "j", "AssistanceType": "1", "Size": 20, "KatamaTDY": { "KatamaOnThatDay":{ "AdditionFrequency": 0, "UseFrequencyP": 0, "UseFrequencyS": 0, "RefundFreuqency": 0 }, "ReUseKatama": { "UpdateFrequency": 0, "ReUseFrequencyP": 0, "ReFrequencyS": 0, "ReRefundFrequency": 0 } } }, "ReductioInformationTDY": { "Type": "g", "AssistanceType": "1", "Size": 20, "NumberOfGemReducation": 0, "NumberOfMedalReducation": 0, "Reserve": 0 }, "ChangeDataSubRecord": { "Type": "d", "AssistanceType": "1", "Size": 52, "DealingsDivision": "", "DealingsEvent": "", "Ball": { "NodeID": 0, "Identifier": 0, "NumberOfGems": 0 }, "AccumulatedBall": { "AccumulateBox1": 0, "AccumulateBox2": 0, "AccumulateBox3": 0, "AccumulateBox4": 0, "AccumulateBox5": 0 }, "EarnedBall": { "EarnedBox1": 0, "EarnedBox2": 0, "EarnedBox3": 0, "EarnedBox4": 0, "EarnedBox5": 0 } }, "PointChangeData" : { "Type": "v", "AssistanceType": "1", "Size": 48, "PointSituation": 0, "NumberOfPoints": { "PointBox1": 0, "PointBox2": 0, "PointBox3": 0, "PointBox4": 0, "PointBox5": 0, "PointBox6": 0, "PointBox7": 0, "PointBox8": 0, "PointBox9": 0, "PointBox10": 0 } } }, "A0":{ "ResponseDemand": 128, "DealingsNumber": 1, "IslandNo": 0, "CommandExtension": 0, "Data2Info": 0, "VersionInfo": { "Version": "0102" }, "SubTerminal": { "SubList": [ { "PhysicalNetwork": 1, "PhysicalTerminal": 1, "Version": "0102" } ] }, "SubTerminalBali": { "SubList": [ { "PhysicalNetwork": 1, "PhysicalTerminal": 1, "Bali": 1, "Version": "0102" } ] } } }
import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:m80app/services/api_status.dart'; import 'package:m80app/services/grpc/hcservice/hcservice.pb.dart'; import 'package:m80app/services/grpc_apis.dart'; import 'package:m80app/setting/setting.dart'; import 'package:m80app/utils/log_utils.dart'; import 'package:m80app/viewmodels/mainpage_viewmodel.dart'; import 'package:path/path.dart'; import 'package:provider/provider.dart'; import '../../components/app_button.dart'; import 'package:m80app/constants/route_paths_constants.dart' as routes; import 'package:m80app/constants/constants.dart' as constants; const BSRequestContent = 0; // Request 0x00 const BSDataContent = 0; // On BIT0 var salesmode = ''; var dailymode = ''; var checkmode = ''; var searchmode = ''; class CheckmenuPage extends StatelessWidget { const CheckmenuPage({super.key}); @override Widget build(BuildContext context) { MainPageViewModel mainpageViewModel = context.watch<MainPageViewModel>(); return Column(children: [ const SizedBox(height: 10,), SizedBox( width: constants.CONTENT_WIDTH, child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ CustomButton( text: '調査', onPressed: () { mainpageViewModel.setcurrentRoute(routes.InvestigationRoute); mainpageViewModel.settitleList(['点検モード', '調査']); } ), ], ), ), const SizedBox(height: 30,), SizedBox( width: constants.CONTENT_WIDTH, child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ CustomButton( text: 'テストモード', onPressed: () { mainpageViewModel.setcurrentRoute(routes.TestRoute1); mainpageViewModel.settitleList(['点検モード', 'テストモード']); } ), const SizedBox(width: 30,), CustomButton( text: 'アシストモード', onPressed: () { mainpageViewModel.setcurrentRoute(routes.AssistanceRoute); mainpageViewModel.settitleList(['点検モード', 'アシストモード']); } ), ], ), ), const SizedBox(height: 30,), SizedBox( width: constants.CONTENT_WIDTH, child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ CustomButton( text: 'ビルバリ開錠', onPressed: () { mainpageViewModel.setcurrentRoute(routes.TestRoute2); mainpageViewModel.settitleList(['点検モード', 'ビルバリ開錠']); } ), const SizedBox(width: 30,), CustomButton( text: '補給口開錠許可', onPressed: () { mainpageViewModel.setcurrentRoute(routes.TestRoute3); mainpageViewModel.settitleList(['点検モード', '補給口開錠許可']); } ), ], ), ), const SizedBox(height: 60,), SizedBox( width: constants.CONTENT_WIDTH, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ CustomButton( text: '設定', onPressed: () async { mainpageViewModel.setcurrentRoute(routes.SettingRoute); mainpageViewModel.settitleList(['点検モード', '設定']); Logger.info('Send BS command via GRPC'); var req = BSRequestMessage( commandId: constants.BS_REQUEST, protocol: Setting.m80serviceConfig.hcserviceProtocol, headerDestinationIpAddr: Setting.m80serviceConfig.hcserviceDestIpAddress, headerModelType: Setting.m80serviceConfig.hcserviceDestModeltype, headerEquipmentNumber: Setting.m80serviceConfig.hcserviceDestEquipnum, requestContent: BSRequestContent, dataContent: BSDataContent, ); var bSRes = await GrpcApis.sendBS(req); List dataSalesMode = []; List dataDailyMode = []; List dataCheckMode = []; List dataSearchMode = []; if (bSRes is BSResponseMessage) { if (bSRes.err == false) { log('${bSRes.dataresponse}'); dataSalesMode = bSRes.dataresponse.sublist(82, 84); List<String> SalesMode = (dataSalesMode.map((e) => e.toString()).toList()); salesmode = SalesMode.join(); dataDailyMode = bSRes.dataresponse.sublist(84, 86); List<String> DailyMode = (dataDailyMode.map((e) => e.toString()).toList()); dailymode = DailyMode.join(); dataCheckMode = bSRes.dataresponse.sublist(86, 88); List<String> CheckMode = (dataCheckMode.map((e) => e.toString()).toList()); checkmode = CheckMode.join(); dataSearchMode = bSRes.dataresponse.sublist(88, 90); List<String> SearchMode = (dataSearchMode.map((e) => e.toString()).toList()); searchmode = SearchMode.join(); Logger.info( "Received B7 Response: ${bSRes.dataresponse.toString()}"); } else { Logger.error( "Request B7 via GRPC error : ${bSRes.errMsg}"); } } if (bSRes is Failure) { log("Request Ba via GRPC error : ${bSRes.errorResponse.toString()}"); Logger.error( "Request B7 via GRPC error : ${bSRes.errorResponse.toString()}"); } } ), CustomButton( text: '戻る', width: 120, onPressed: () { mainpageViewModel.setcurrentRoute(routes.MainMenuRoute); mainpageViewModel.settitleList([]); } ), ], ), ), ]); } }
import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:m80app/services/api_status.dart'; import 'package:m80app/services/grpc/hcservice/hcservice.pbgrpc.dart'; import 'package:m80app/services/grpc_apis.dart'; import 'package:m80app/setting/setting.dart'; import 'package:m80app/utils/log_utils.dart'; import 'package:m80app/viewmodels/mainpage_viewmodel.dart'; import 'package:m80app/views/checkmenupage/checkmenu_page.dart'; import 'package:m80app/views/investigationpage/investigation_page.dart'; import 'package:provider/provider.dart'; import 'package:m80app/constants/route_paths_constants.dart' as routes; import 'package:m80app/constants/constants.dart' as constants; import 'package:m80app/components/app_button.dart'; import '../../../components/dialog_password.dart'; const List<String> list = <String>['パチンコ', 'スロット']; const double PADING_LEFT = 200; const double PADING_RIGHT = 310; const BSDataContent = 0; // ON BIT0 const BSRequestContent = 1; // Request 0x01 class SettingPage extends StatefulWidget { const SettingPage({super.key}); @override SettingPageState createState() => SettingPageState(); } class SettingPageState extends State<SettingPage> { String selectedOption = list.first; TextEditingController saleController = TextEditingController(text: '${salesmode}'); TextEditingController dailyTotalController = TextEditingController(text: '${dailymode}'); TextEditingController inspectionController = TextEditingController(text: '${checkmode}'); TextEditingController searchController = TextEditingController(text: '${searchmode}'); @override void initState() { super.initState(); saleController.text; dailyTotalController.text; inspectionController.text; } Widget buildTextField(TextEditingController controller) { return SizedBox( width: 210, child: TextField( controller: controller, style: constants.TEXT_STYLE, obscureText: true, obscuringCharacter: "*", decoration: const InputDecoration( border: InputBorder.none, filled: true, fillColor: constants.COLOR_GREY, ), readOnly: true, onTap: () async { String result = await showDialog( context: context, builder: (BuildContext context) { return const PasswordDialog(); }, ); controller.text = result; }, ), ); } @override Widget build(BuildContext context) { MainPageViewModel mainpageViewModel = context.watch<MainPageViewModel>(); return Column(children: [ const SizedBox(height: 20,), const SizedBox( width: constants.CONTENT_WIDTH, child: Text( "1.パスワード設定(m80)", style: constants.TEXT_STYLE, ), ), const SizedBox(height: 20,), SizedBox( width: constants.CONTENT_WIDTH - PADING_LEFT, child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ const Text( "営業モード", style: constants.TEXT_STYLE ), const SizedBox(width: PADING_RIGHT,), buildTextField(saleController), ], ), ), const SizedBox(height: 20,), SizedBox( width: constants.CONTENT_WIDTH - PADING_LEFT, child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ const Text( "日計モード", style: constants.TEXT_STYLE, ), const SizedBox(width: PADING_RIGHT,), buildTextField(dailyTotalController), ], ), ), const SizedBox(height: 20,), SizedBox( width: constants.CONTENT_WIDTH - PADING_LEFT, child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ const Text( "点検モード", style: constants.TEXT_STYLE, ), const SizedBox(width: PADING_RIGHT,), buildTextField(inspectionController), ], ), ), const SizedBox(height: 20,), SizedBox( width: constants.CONTENT_WIDTH - PADING_LEFT, child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ const Text( "検索モード", style: constants.TEXT_STYLE, ), const SizedBox(width: PADING_RIGHT,), buildTextField(searchController), ], ), ), const SizedBox(height: 120,), SizedBox( width: constants.CONTENT_WIDTH, child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ CustomButton( text: "設定保存", width: 225, onPressed: () async { Logger.info('Send BS command via GRPC'); var req = BSRequestMessage( commandId: constants.BS_REQUEST, protocol: Setting.m80serviceConfig.hcserviceProtocol, headerDestinationIpAddr: Setting.m80serviceConfig.hcserviceDestIpAddress, headerModelType: Setting.m80serviceConfig.hcserviceDestModeltype, headerEquipmentNumber: Setting.m80serviceConfig.hcserviceDestEquipnum, requestContent: BSRequestContent, dataContent: BSDataContent, ); var bSRes = await GrpcApis.sendBS(req); if (bSRes is BSResponseMessage) { if (bSRes.err == false) { log('${bSRes.dataresponse}'); Logger.info( "Received B7 Response: ${bSRes.dataresponse.toString()}"); } else { Logger.error( "Request B7 via GRPC error : ${bSRes.errMsg}"); } } if (bSRes is Failure) { log("Request Ba via GRPC error : ${bSRes.errorResponse.toString()}"); Logger.error( "Request B7 via GRPC error : ${bSRes.errorResponse.toString()}"); } } ), const SizedBox(width: 40,), CustomButton( text: "戻る", width: 120, onPressed: () { mainpageViewModel.setcurrentRoute(routes.CheckMenuRoute); mainpageViewModel.settitleList(['点検モード']); } ), ], ), ), ]); } }
Editor Settings
Theme
Key bindings
Full width
Lines